* refactor: Remove GetLandOwner function from Scene

* Simplify since the land is never null
0.6.4-rc1
Justin Clarke Casey 2009-03-06 20:44:31 +00:00
parent 85774de231
commit f12619b786
3 changed files with 35 additions and 43 deletions

View File

@ -3019,19 +3019,6 @@ namespace OpenSim.Region.Framework.Scenes
m_eventManager.TriggerOnPluginConsole(args); m_eventManager.TriggerOnPluginConsole(args);
} }
public UUID GetLandOwner(float x, float y)
{
ILandObject land = LandChannel.GetLandObject(x, y);
if (land == null)
{
return UUID.Zero;
}
else
{
return land.landData.OwnerID;
}
}
public LandData GetLandData(float x, float y) public LandData GetLandData(float x, float y)
{ {
return LandChannel.GetLandObject(x, y).landData; return LandChannel.GetLandObject(x, y).landData;

View File

@ -3706,8 +3706,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScenePresence presence = World.GetScenePresence(agentId); ScenePresence presence = World.GetScenePresence(agentId);
if (presence != null) if (presence != null)
{ {
// agent must be over the owners land // agent must be over the owners land
if (m_host.OwnerID == World.GetLandOwner(presence.AbsolutePosition.X, presence.AbsolutePosition.Y)) if (m_host.OwnerID
== World.LandChannel.GetLandObject(
presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID)
{ {
presence.ControllingClient.SendTeleportLocationStart(); presence.ControllingClient.SendTeleportLocationStart();
World.TeleportClientHome(agentId, presence.ControllingClient); World.TeleportClientHome(agentId, presence.ControllingClient);
@ -5182,7 +5184,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (presence != null) if (presence != null)
{ {
// agent must be over the owners land // agent must be over the owners land
if (m_host.OwnerID == World.GetLandOwner(presence.AbsolutePosition.X, presence.AbsolutePosition.Y)) if (m_host.OwnerID
== World.LandChannel.GetLandObject(
presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID)
World.TeleportClientHome(agentId, presence.ControllingClient); World.TeleportClientHome(agentId, presence.ControllingClient);
} }
} }
@ -5265,29 +5269,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
UUID key = new UUID(); UUID key = new UUID();
if (UUID.TryParse(id,out key)) if (UUID.TryParse(id, out key))
{ {
ScenePresence presence = World.GetScenePresence(key); ScenePresence presence = World.GetScenePresence(key);
if (presence != null) // object is an avatar if (presence != null) // object is an avatar
{ {
if (m_host.OwnerID == World.GetLandOwner(presence.AbsolutePosition.X, presence.AbsolutePosition.Y)) if (m_host.OwnerID
== World.LandChannel.GetLandObject(
presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID)
return 1; return 1;
} }
else // object is not an avatar else // object is not an avatar
{ {
SceneObjectPart obj = World.GetSceneObjectPart(key); SceneObjectPart obj = World.GetSceneObjectPart(key);
if (obj != null) if (obj != null)
if (m_host.OwnerID == World.GetLandOwner(obj.AbsolutePosition.X, obj.AbsolutePosition.Y)) if (m_host.OwnerID
== World.LandChannel.GetLandObject(
obj.AbsolutePosition.X, obj.AbsolutePosition.Y).landData.OwnerID)
return 1; return 1;
} }
} }
return 0; return 0;
} }
public LSL_String llGetLandOwnerAt(LSL_Vector pos) public LSL_String llGetLandOwnerAt(LSL_Vector pos)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
return World.GetLandOwner((float)pos.x, (float)pos.y).ToString(); return World.LandChannel.GetLandObject((float)pos.x, (float)pos.y).landData.OwnerID.ToString();
} }
/// <summary> /// <summary>
@ -6812,17 +6821,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetParcelMusicURL(string url) public void llSetParcelMusicURL(string url)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
UUID landowner = World.GetLandOwner(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
if (landowner == UUID.Zero)
{
return;
}
if (landowner != m_host.ObjectOwner)
{
return;
}
World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).SetMusicUrl(url); ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
if (land.landData.OwnerID != m_host.ObjectOwner)
return;
land.SetMusicUrl(url);
// ScriptSleep(2000); // ScriptSleep(2000);
} }

View File

@ -503,12 +503,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (presence != null) if (presence != null)
{ {
// agent must be over owners land to avoid abuse // agent must be over owners land to avoid abuse
if (m_host.OwnerID == World.GetLandOwner(presence.AbsolutePosition.X, presence.AbsolutePosition.Y)) if (m_host.OwnerID
== World.LandChannel.GetLandObject(
presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID)
{ {
presence.ControllingClient.SendTeleportLocationStart(); presence.ControllingClient.SendTeleportLocationStart();
World.RequestTeleportLocation(presence.ControllingClient, regionName, World.RequestTeleportLocation(presence.ControllingClient, regionName,
new Vector3((float)position.x, (float)position.y, (float)position.z), new Vector3((float)position.x, (float)position.y, (float)position.z),
new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation); new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation);
ScriptSleep(5000); ScriptSleep(5000);
} }
} }
@ -532,7 +535,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (presence != null) if (presence != null)
{ {
// agent must be over owners land to avoid abuse // agent must be over owners land to avoid abuse
if (m_host.OwnerID == World.GetLandOwner(presence.AbsolutePosition.X, presence.AbsolutePosition.Y)) if (m_host.OwnerID
== World.LandChannel.GetLandObject(
presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID)
{ {
presence.ControllingClient.SendTeleportLocationStart(); presence.ControllingClient.SendTeleportLocationStart();
World.RequestTeleportLocation(presence.ControllingClient, regionHandle, World.RequestTeleportLocation(presence.ControllingClient, regionHandle,
@ -777,19 +782,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL"); CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL");
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
UUID landowner = World.GetLandOwner(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
ILandObject land
= World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
if (landowner == UUID.Zero) if (land.landData.OwnerID != m_host.ObjectOwner)
{
return; return;
}
if (landowner != m_host.ObjectOwner) land.SetMediaUrl(url);
{
return;
}
World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).SetMediaUrl(url);
} }
public string osGetScriptEngineName() public string osGetScriptEngineName()