aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-05-08 22:58:34 +0100
committerJustin Clark-Casey (justincc)2012-05-08 23:05:01 +0100
commit01b78235db71994ba3e37bd6ea297bed7e4576b9 (patch)
tree91a89fd18939632973180287f78085723b6b9b9c /OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
parentPerform SceneGraph.DuplicateObject() under existing m_updateLock already used... (diff)
downloadopensim-SC_OLD-01b78235db71994ba3e37bd6ea297bed7e4576b9.zip
opensim-SC_OLD-01b78235db71994ba3e37bd6ea297bed7e4576b9.tar.gz
opensim-SC_OLD-01b78235db71994ba3e37bd6ea297bed7e4576b9.tar.bz2
opensim-SC_OLD-01b78235db71994ba3e37bd6ea297bed7e4576b9.tar.xz
Instead of constantly looking up unchanging self item in script code, pass in self item on initialization.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs29
1 files changed, 11 insertions, 18 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 3b67966..9b2022a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -134,19 +134,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
134 internal ILSL_Api m_LSL_Api = null; // get a reference to the LSL API so we can call methods housed there 134 internal ILSL_Api m_LSL_Api = null; // get a reference to the LSL API so we can call methods housed there
135 internal SceneObjectPart m_host; 135 internal SceneObjectPart m_host;
136 internal uint m_localID; 136 internal uint m_localID;
137 internal UUID m_itemID; 137 internal TaskInventoryItem m_item;
138 internal bool m_OSFunctionsEnabled = false; 138 internal bool m_OSFunctionsEnabled = false;
139 internal ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow; 139 internal ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow;
140 internal float m_ScriptDelayFactor = 1.0f; 140 internal float m_ScriptDelayFactor = 1.0f;
141 internal float m_ScriptDistanceFactor = 1.0f; 141 internal float m_ScriptDistanceFactor = 1.0f;
142 internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >(); 142 internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >();
143 143
144 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) 144 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, TaskInventoryItem item)
145 { 145 {
146 m_ScriptEngine = ScriptEngine; 146 m_ScriptEngine = ScriptEngine;
147 m_host = host; 147 m_host = host;
148 m_localID = localID; 148 m_localID = localID;
149 m_itemID = itemID; 149 m_item = item;
150 150
151 if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) 151 if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
152 m_OSFunctionsEnabled = true; 152 m_OSFunctionsEnabled = true;
@@ -224,7 +224,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
224 if (m_LSL_Api != null) 224 if (m_LSL_Api != null)
225 return; 225 return;
226 226
227 m_LSL_Api = (ILSL_Api)m_ScriptEngine.GetApi(m_itemID, "LSL"); 227 m_LSL_Api = (ILSL_Api)m_ScriptEngine.GetApi(m_item.ItemID, "LSL");
228 } 228 }
229 229
230 // 230 //
@@ -343,22 +343,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
343 return; 343 return;
344 } 344 }
345 345
346 TaskInventoryItem ti = m_host.Inventory.GetInventoryItem(m_itemID); 346 UUID ownerID = m_item.OwnerID;
347 if (ti == null)
348 {
349 OSSLError(
350 String.Format("{0} permission error. Can't find script in prim inventory.",
351 function));
352 }
353
354 UUID ownerID = ti.OwnerID;
355 347
356 //OSSL only may be used if object is in the same group as the parcel 348 //OSSL only may be used if object is in the same group as the parcel
357 if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER")) 349 if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER"))
358 { 350 {
359 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 351 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
360 352
361 if (land.LandData.GroupID == ti.GroupID && land.LandData.GroupID != UUID.Zero) 353 if (land.LandData.GroupID == m_item.GroupID && land.LandData.GroupID != UUID.Zero)
362 { 354 {
363 return; 355 return;
364 } 356 }
@@ -394,13 +386,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
394 } 386 }
395 } 387 }
396 388
397 if (!m_FunctionPerms[function].AllowedCreators.Contains(ti.CreatorID)) 389 if (!m_FunctionPerms[function].AllowedCreators.Contains(m_item.CreatorID))
398 OSSLError( 390 OSSLError(
399 String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.", 391 String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.",
400 function)); 392 function));
401 if (ti.CreatorID != ownerID) 393
394 if (m_item.CreatorID != ownerID)
402 { 395 {
403 if ((ti.CurrentPermissions & (uint)PermissionMask.Modify) != 0) 396 if ((m_item.CurrentPermissions & (uint)PermissionMask.Modify) != 0)
404 OSSLError( 397 OSSLError(
405 String.Format("{0} permission denied. Script permissions error.", 398 String.Format("{0} permission denied. Script permissions error.",
406 function)); 399 function));
@@ -1183,7 +1176,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1183 CheckThreatLevel(ThreatLevel.High, "osSetStateEvents"); 1176 CheckThreatLevel(ThreatLevel.High, "osSetStateEvents");
1184 m_host.AddScriptLPS(1); 1177 m_host.AddScriptLPS(1);
1185 1178
1186 m_host.SetScriptEvents(m_itemID, events); 1179 m_host.SetScriptEvents(m_item.ItemID, events);
1187 } 1180 }
1188 1181
1189 public void osSetRegionWaterHeight(double height) 1182 public void osSetRegionWaterHeight(double height)