remove country from avatars DetectParams, since it is only used on a cm function that can get it directly

LSLKeyTest
UbitUmarov 2016-08-05 17:08:34 +01:00
parent e9660d5d05
commit 60b08b51b6
2 changed files with 13 additions and 7 deletions

View File

@ -94,14 +94,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public string cmDetectedCountry(int number) public string cmDetectedCountry(int number)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if(!m_CMFunctionsEnabled)
return String.Empty;
if(World.UserAccountService == null)
return String.Empty;
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number);
if (detectedParams == null) if (detectedParams == null)
return String.Empty; return String.Empty;
return detectedParams.Country; UUID key = detectedParams.Key;
if(key == UUID.Zero)
return String.Empty;
UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, key);
return account.UserCountry;
} }
public string cmGetAgentCountry(LSL_Key key) public string cmGetAgentCountry(LSL_Key key)
{ {
if(! m_CMFunctionsEnabled)
return "";
if(World.UserAccountService == null)
return String.Empty;
if (!World.Permissions.IsGod(m_host.OwnerID)) if (!World.Permissions.IsGod(m_host.OwnerID))
return String.Empty; return String.Empty;

View File

@ -121,7 +121,6 @@ namespace OpenSim.Region.ScriptEngine.Shared
Type = 0; Type = 0;
Velocity = new LSL_Types.Vector3(); Velocity = new LSL_Types.Vector3();
initializeSurfaceTouch(); initializeSurfaceTouch();
Country = String.Empty;
} }
public UUID Key; public UUID Key;
@ -153,8 +152,6 @@ namespace OpenSim.Region.ScriptEngine.Shared
private int touchFace; private int touchFace;
public int TouchFace { get { return touchFace; } } public int TouchFace { get { return touchFace; } }
public string Country;
// This can be done in two places including the constructor // This can be done in two places including the constructor
// so be carefull what gets added here // so be carefull what gets added here
private void initializeSurfaceTouch() private void initializeSurfaceTouch()
@ -202,9 +199,6 @@ namespace OpenSim.Region.ScriptEngine.Shared
return; return;
Name = presence.Firstname + " " + presence.Lastname; Name = presence.Firstname + " " + presence.Lastname;
UserAccount account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, Key);
if (account != null)
Country = account.UserCountry;
Owner = Key; Owner = Key;
Position = new LSL_Types.Vector3(presence.AbsolutePosition); Position = new LSL_Types.Vector3(presence.AbsolutePosition);