aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-03-14 23:05:21 +0000
committerJustin Clark-Casey (justincc)2013-03-14 23:05:21 +0000
commitca99f418d8c09a9364d802d6cbd144c188c7b5cf (patch)
tree207a3ac75b88ebd4541b25fcd460ec6367667f23 /OpenSim/Region
parentAdd ILandChannel.GetLandObject(Vector3 position) as this is a very common inp... (diff)
downloadopensim-SC_OLD-ca99f418d8c09a9364d802d6cbd144c188c7b5cf.zip
opensim-SC_OLD-ca99f418d8c09a9364d802d6cbd144c188c7b5cf.tar.gz
opensim-SC_OLD-ca99f418d8c09a9364d802d6cbd144c188c7b5cf.tar.bz2
opensim-SC_OLD-ca99f418d8c09a9364d802d6cbd144c188c7b5cf.tar.xz
refactor: Use ILandChannel.GetLandObject(Vector3) in LSL_Api rather than having to continually take intermediate Vector3s to avoid race conditions
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs62
1 files changed, 21 insertions, 41 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 42f9c8d..9ab92c9 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4176,13 +4176,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4176 if (presence != null) 4176 if (presence != null)
4177 { 4177 {
4178 // agent must be over the owners land 4178 // agent must be over the owners land
4179 if (m_host.OwnerID == World.LandChannel.GetLandObject( 4179 if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID)
4180 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
4181 { 4180 {
4182 World.TeleportClientHome(agentId, presence.ControllingClient); 4181 World.TeleportClientHome(agentId, presence.ControllingClient);
4183 } 4182 }
4184 } 4183 }
4185 } 4184 }
4185
4186 ScriptSleep(5000); 4186 ScriptSleep(5000);
4187 } 4187 }
4188 4188
@@ -4202,10 +4202,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4202 if (destination == String.Empty) 4202 if (destination == String.Empty)
4203 destination = World.RegionInfo.RegionName; 4203 destination = World.RegionInfo.RegionName;
4204 4204
4205 Vector3 pos = presence.AbsolutePosition;
4206
4207 // agent must be over the owners land 4205 // agent must be over the owners land
4208 if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID) 4206 if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID)
4209 { 4207 {
4210 DoLLTeleport(presence, destination, targetPos, targetLookAt); 4208 DoLLTeleport(presence, destination, targetPos, targetLookAt);
4211 } 4209 }
@@ -4235,10 +4233,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4235 // agent must not be a god 4233 // agent must not be a god
4236 if (presence.GodLevel >= 200) return; 4234 if (presence.GodLevel >= 200) return;
4237 4235
4238 Vector3 pos = presence.AbsolutePosition;
4239
4240 // agent must be over the owners land 4236 // agent must be over the owners land
4241 if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID) 4237 if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID)
4242 { 4238 {
4243 World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); 4239 World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
4244 } 4240 }
@@ -4442,7 +4438,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4442 { 4438 {
4443 if (pushrestricted) 4439 if (pushrestricted)
4444 { 4440 {
4445 ILandObject targetlandObj = World.LandChannel.GetLandObject(PusheePos.X, PusheePos.Y); 4441 ILandObject targetlandObj = World.LandChannel.GetLandObject(PusheePos);
4446 4442
4447 // We didn't find the parcel but region is push restricted so assume it is NOT ok 4443 // We didn't find the parcel but region is push restricted so assume it is NOT ok
4448 if (targetlandObj == null) 4444 if (targetlandObj == null)
@@ -4457,7 +4453,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4457 } 4453 }
4458 else 4454 else
4459 { 4455 {
4460 ILandObject targetlandObj = World.LandChannel.GetLandObject(PusheePos.X, PusheePos.Y); 4456 ILandObject targetlandObj = World.LandChannel.GetLandObject(PusheePos);
4461 if (targetlandObj == null) 4457 if (targetlandObj == null)
4462 { 4458 {
4463 // We didn't find the parcel but region isn't push restricted so assume it's ok 4459 // We didn't find the parcel but region isn't push restricted so assume it's ok
@@ -5715,8 +5711,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5715 UUID id = UUID.Zero; 5711 UUID id = UUID.Zero;
5716 if (parcel || parcelOwned) 5712 if (parcel || parcelOwned)
5717 { 5713 {
5718 pos = m_host.ParentGroup.RootPart.GetWorldPosition(); 5714 land = World.LandChannel.GetLandObject(m_host.ParentGroup.RootPart.GetWorldPosition());
5719 land = World.LandChannel.GetLandObject(pos.X, pos.Y);
5720 if (land == null) 5715 if (land == null)
5721 { 5716 {
5722 id = UUID.Zero; 5717 id = UUID.Zero;
@@ -5742,8 +5737,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5742 { 5737 {
5743 if (!regionWide) 5738 if (!regionWide)
5744 { 5739 {
5745 pos = ssp.AbsolutePosition; 5740 land = World.LandChannel.GetLandObject(ssp.AbsolutePosition);
5746 land = World.LandChannel.GetLandObject(pos.X, pos.Y);
5747 if (land != null) 5741 if (land != null)
5748 { 5742 {
5749 if (parcelOwned && land.LandData.OwnerID == id || 5743 if (parcelOwned && land.LandData.OwnerID == id ||
@@ -5867,10 +5861,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5867 ScenePresence presence = World.GetScenePresence(agentID); 5861 ScenePresence presence = World.GetScenePresence(agentID);
5868 if (presence != null) 5862 if (presence != null)
5869 { 5863 {
5870 Vector3 pos = presence.AbsolutePosition;
5871
5872 // agent must be over the owners land 5864 // agent must be over the owners land
5873 ILandObject land = World.LandChannel.GetLandObject(pos.X, pos.Y); 5865 ILandObject land = World.LandChannel.GetLandObject(presence.AbsolutePosition);
5874 if (land == null) 5866 if (land == null)
5875 return; 5867 return;
5876 5868
@@ -5892,9 +5884,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5892 ScenePresence presence = World.GetScenePresence(key); 5884 ScenePresence presence = World.GetScenePresence(key);
5893 if (presence != null) // object is an avatar 5885 if (presence != null) // object is an avatar
5894 { 5886 {
5895 Vector3 pos = presence.AbsolutePosition; 5887 if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID)
5896
5897 if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID)
5898 return 1; 5888 return 1;
5899 } 5889 }
5900 else // object is not an avatar 5890 else // object is not an avatar
@@ -5903,9 +5893,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5903 5893
5904 if (obj != null) 5894 if (obj != null)
5905 { 5895 {
5906 Vector3 pos = obj.AbsolutePosition; 5896 if (m_host.OwnerID == World.LandChannel.GetLandObject(obj.AbsolutePosition).LandData.OwnerID)
5907
5908 if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID)
5909 return 1; 5897 return 1;
5910 } 5898 }
5911 } 5899 }
@@ -5985,10 +5973,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5985 // if the land is group owned and the object is group owned by the same group 5973 // if the land is group owned and the object is group owned by the same group
5986 // or 5974 // or
5987 // if the object is owned by a person with estate access. 5975 // if the object is owned by a person with estate access.
5988 5976 ILandObject parcel = World.LandChannel.GetLandObject(av.AbsolutePosition);
5989 Vector3 pos = av.AbsolutePosition;
5990
5991 ILandObject parcel = World.LandChannel.GetLandObject(pos.X, pos.Y);
5992 if (parcel != null) 5977 if (parcel != null)
5993 { 5978 {
5994 if (m_host.OwnerID == parcel.LandData.OwnerID || 5979 if (m_host.OwnerID == parcel.LandData.OwnerID ||
@@ -6571,9 +6556,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6571 { 6556 {
6572 m_host.AddScriptLPS(1); 6557 m_host.AddScriptLPS(1);
6573 UUID key; 6558 UUID key;
6574 Vector3 pos = m_host.AbsolutePosition; 6559 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
6575 6560
6576 ILandObject land = World.LandChannel.GetLandObject(pos.X, pos.Y);
6577 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) 6561 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned))
6578 { 6562 {
6579 int expires = 0; 6563 int expires = 0;
@@ -7802,8 +7786,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7802 { 7786 {
7803 m_host.AddScriptLPS(1); 7787 m_host.AddScriptLPS(1);
7804 7788
7805 Vector3 pos = m_host.AbsolutePosition; 7789 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
7806 ILandObject land = World.LandChannel.GetLandObject(pos.X, pos.Y);
7807 7790
7808 if (land.LandData.OwnerID != m_host.OwnerID) 7791 if (land.LandData.OwnerID != m_host.OwnerID)
7809 return; 7792 return;
@@ -7817,8 +7800,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7817 { 7800 {
7818 m_host.AddScriptLPS(1); 7801 m_host.AddScriptLPS(1);
7819 7802
7820 Vector3 pos = m_host.AbsolutePosition; 7803 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
7821 ILandObject land = World.LandChannel.GetLandObject(pos.X, pos.Y);
7822 7804
7823 if (land.LandData.OwnerID != m_host.OwnerID) 7805 if (land.LandData.OwnerID != m_host.OwnerID)
7824 return String.Empty; 7806 return String.Empty;
@@ -9595,9 +9577,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9595 9577
9596 // according to the docs, this command only works if script owner and land owner are the same 9578 // according to the docs, this command only works if script owner and land owner are the same
9597 // lets add estate owners and gods, too, and use the generic permission check. 9579 // lets add estate owners and gods, too, and use the generic permission check.
9598 Vector3 pos = m_host.AbsolutePosition; 9580 ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
9599
9600 ILandObject landObject = World.LandChannel.GetLandObject(pos.X, pos.Y);
9601 if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, landObject, GroupPowers.ChangeMedia)) return; 9581 if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, landObject, GroupPowers.ChangeMedia)) return;
9602 9582
9603 bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)? 9583 bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)?
@@ -10022,7 +10002,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10022 { 10002 {
10023 m_host.AddScriptLPS(1); 10003 m_host.AddScriptLPS(1);
10024 UUID key; 10004 UUID key;
10025 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 10005 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
10026 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) 10006 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned))
10027 { 10007 {
10028 int expires = 0; 10008 int expires = 0;
@@ -10063,7 +10043,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10063 { 10043 {
10064 m_host.AddScriptLPS(1); 10044 m_host.AddScriptLPS(1);
10065 UUID key; 10045 UUID key;
10066 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 10046 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
10067 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed)) 10047 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed))
10068 { 10048 {
10069 if (UUID.TryParse(avatar, out key)) 10049 if (UUID.TryParse(avatar, out key))
@@ -10090,7 +10070,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10090 { 10070 {
10091 m_host.AddScriptLPS(1); 10071 m_host.AddScriptLPS(1);
10092 UUID key; 10072 UUID key;
10093 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 10073 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
10094 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) 10074 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned))
10095 { 10075 {
10096 if (UUID.TryParse(avatar, out key)) 10076 if (UUID.TryParse(avatar, out key))
@@ -10352,7 +10332,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10352 public void llResetLandBanList() 10332 public void llResetLandBanList()
10353 { 10333 {
10354 m_host.AddScriptLPS(1); 10334 m_host.AddScriptLPS(1);
10355 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; 10335 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition).LandData;
10356 if (land.OwnerID == m_host.OwnerID) 10336 if (land.OwnerID == m_host.OwnerID)
10357 { 10337 {
10358 foreach (LandAccessEntry entry in land.ParcelAccessList) 10338 foreach (LandAccessEntry entry in land.ParcelAccessList)
@@ -10369,7 +10349,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10369 public void llResetLandPassList() 10349 public void llResetLandPassList()
10370 { 10350 {
10371 m_host.AddScriptLPS(1); 10351 m_host.AddScriptLPS(1);
10372 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; 10352 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition).LandData;
10373 if (land.OwnerID == m_host.OwnerID) 10353 if (land.OwnerID == m_host.OwnerID)
10374 { 10354 {
10375 foreach (LandAccessEntry entry in land.ParcelAccessList) 10355 foreach (LandAccessEntry entry in land.ParcelAccessList)