From 796334c5ff44b55f5541625f864441b6e250cdb3 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 8 May 2012 22:58:34 +0100 Subject: [PATCH] Instead of constantly looking up unchanging self item in script code, pass in self item on initialization. --- .../ScriptEngine/Interfaces/IScriptApi.cs | 20 +- .../Shared/Api/Implementation/LSL_Api.cs | 244 ++++++++---------- .../Shared/Api/Implementation/LS_Api.cs | 4 +- .../Shared/Api/Implementation/MOD_Api.cs | 13 +- .../Shared/Api/Implementation/OSSL_Api.cs | 29 +-- .../Shared/Instance/ScriptInstance.cs | 2 +- .../Shared/Tests/LSL_ApiInventoryTests.cs | 9 +- .../ScriptEngine/Shared/Tests/LSL_ApiTest.cs | 3 +- .../Shared/Tests/OSSL_ApiAppearanceTest.cs | 8 +- .../Shared/Tests/OSSL_ApiNpcTests.cs | 6 +- 10 files changed, 148 insertions(+), 190 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs index bb5baccfd4..cced52260f 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs @@ -27,17 +27,23 @@ using System; using OpenMetaverse; +using OpenSim.Framework; using OpenSim.Region.Framework.Scenes; - namespace OpenSim.Region.ScriptEngine.Interfaces { public interface IScriptApi { - // - // Each API has an identifier, which is used to load the - // proper runtime assembly at load time. - // - void Initialize(IScriptEngine engine, SceneObjectPart part, uint localID, UUID item); + /// + /// Initialize the API + /// + /// + /// Each API has an identifier, which is used to load the + /// proper runtime assembly at load time. + /// /param> + /// + /// + /// + void Initialize(IScriptEngine engine, SceneObjectPart part, uint localID, TaskInventoryItem item); } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 166fb611f7..8d4503d22d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -87,9 +87,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected uint m_localID; /// - /// The UUID of the item that hosts this script + /// The item that hosts this script /// - protected UUID m_itemID; + protected TaskInventoryItem m_item; protected bool throwErrorOnNotImplemented = true; protected AsyncCommandManager AsyncCommands = null; @@ -108,12 +108,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected Dictionary m_userInfoCache = new Dictionary(); - public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) + public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, TaskInventoryItem item) { m_ScriptEngine = ScriptEngine; m_host = host; m_localID = localID; - m_itemID = itemID; + m_item = item; m_ScriptDelayFactor = m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); @@ -163,7 +163,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void state(string newState) { - m_ScriptEngine.SetState(m_itemID, newState); + m_ScriptEngine.SetState(m_item.ItemID, newState); } /// @@ -173,7 +173,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llResetScript() { m_host.AddScriptLPS(1); - m_ScriptEngine.ApiResetScript(m_itemID); + m_ScriptEngine.ApiResetScript(m_item.ItemID); } public void llResetOtherScript(string name) @@ -272,20 +272,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - /// - /// Get the inventory item that hosts ourselves. - /// - /// - /// FIXME: It would be far easier to pass in TaskInventoryItem rather than just m_itemID so that we don't need - /// to keep looking ourselves up. - /// - /// - protected TaskInventoryItem GetSelfInventoryItem() - { - lock (m_host.TaskInventory) - return m_host.TaskInventory[m_itemID]; - } - protected UUID InventoryKey(string name, int type) { m_host.AddScriptLPS(1); @@ -855,7 +841,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID.TryParse(ID, out keyID); IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); if (wComm != null) - return wComm.Listen(m_localID, m_itemID, m_host.UUID, channelID, name, keyID, msg); + return wComm.Listen(m_localID, m_item.ItemID, m_host.UUID, channelID, name, keyID, msg); else return -1; } @@ -865,7 +851,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); if (wComm != null) - wComm.ListenControl(m_itemID, number, active); + wComm.ListenControl(m_item.ItemID, number, active); } public void llListenRemove(int number) @@ -873,7 +859,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); if (wComm != null) - wComm.ListenRemove(m_itemID, number); + wComm.ListenRemove(m_item.ItemID, number); } public void llSensor(string name, string id, int type, double range, double arc) @@ -882,7 +868,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID keyID = UUID.Zero; UUID.TryParse(id, out keyID); - AsyncCommands.SensorRepeatPlugin.SenseOnce(m_localID, m_itemID, name, keyID, type, range, arc, m_host); + AsyncCommands.SensorRepeatPlugin.SenseOnce(m_localID, m_item.ItemID, name, keyID, type, range, arc, m_host); } public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) @@ -891,13 +877,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID keyID = UUID.Zero; UUID.TryParse(id, out keyID); - AsyncCommands.SensorRepeatPlugin.SetSenseRepeatEvent(m_localID, m_itemID, name, keyID, type, range, arc, rate, m_host); + AsyncCommands.SensorRepeatPlugin.SetSenseRepeatEvent(m_localID, m_item.ItemID, name, keyID, type, range, arc, rate, m_host); } public void llSensorRemove() { m_host.AddScriptLPS(1); - AsyncCommands.SensorRepeatPlugin.UnSetSenseRepeaterEvents(m_localID, m_itemID); + AsyncCommands.SensorRepeatPlugin.UnSetSenseRepeaterEvents(m_localID, m_item.ItemID); } public string resolveName(UUID objecUUID) @@ -938,7 +924,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llDetectedName(int number) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); if (detectedParams == null) return String.Empty; return detectedParams.Name; @@ -947,7 +933,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llDetectedKey(int number) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); if (detectedParams == null) return String.Empty; return detectedParams.Key.ToString(); @@ -956,7 +942,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llDetectedOwner(int number) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); if (detectedParams == null) return String.Empty; return detectedParams.Owner.ToString(); @@ -965,7 +951,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llDetectedType(int number) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); if (detectedParams == null) return 0; return new LSL_Integer(detectedParams.Type); @@ -974,7 +960,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llDetectedPos(int number) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); if (detectedParams == null) return new LSL_Vector(); return detectedParams.Position; @@ -983,7 +969,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llDetectedVel(int number) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); if (detectedParams == null) return new LSL_Vector(); return detectedParams.Velocity; @@ -992,7 +978,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llDetectedGrab(int number) { m_host.AddScriptLPS(1); - DetectParams parms = m_ScriptEngine.GetDetectParams(m_itemID, number); + DetectParams parms = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); if (parms == null) return new LSL_Vector(0, 0, 0); @@ -1002,7 +988,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Rotation llDetectedRot(int number) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); if (detectedParams == null) return new LSL_Rotation(); return detectedParams.Rotation; @@ -1011,7 +997,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llDetectedGroup(int number) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); if (detectedParams == null) return new LSL_Integer(0); if (m_host.GroupID == detectedParams.Group) @@ -1022,7 +1008,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llDetectedLinkNumber(int number) { m_host.AddScriptLPS(1); - DetectParams parms = m_ScriptEngine.GetDetectParams(m_itemID, number); + DetectParams parms = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); if (parms == null) return new LSL_Integer(0); @@ -1035,7 +1021,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llDetectedTouchBinormal(int index) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index); if (detectedParams == null) return new LSL_Vector(); return detectedParams.TouchBinormal; @@ -1047,7 +1033,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llDetectedTouchFace(int index) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index); if (detectedParams == null) return new LSL_Integer(-1); return new LSL_Integer(detectedParams.TouchFace); @@ -1059,7 +1045,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llDetectedTouchNormal(int index) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index); if (detectedParams == null) return new LSL_Vector(); return detectedParams.TouchNormal; @@ -1071,7 +1057,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llDetectedTouchPos(int index) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index); if (detectedParams == null) return new LSL_Vector(); return detectedParams.TouchPos; @@ -1083,7 +1069,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llDetectedTouchST(int index) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index); if (detectedParams == null) return new LSL_Vector(-1.0, -1.0, 0.0); return detectedParams.TouchST; @@ -1095,7 +1081,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llDetectedTouchUV(int index) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index); if (detectedParams == null) return new LSL_Vector(-1.0, -1.0, 0.0); return detectedParams.TouchUV; @@ -2698,12 +2684,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - TaskInventoryItem item = GetSelfInventoryItem(); - - if (item.PermsGranter == UUID.Zero) + if (m_item.PermsGranter == UUID.Zero) return 0; - if ((item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0) + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0) { LSLError("No permissions to give money"); return 0; @@ -2886,7 +2870,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api sec = m_MinTimerInterval; m_host.AddScriptLPS(1); // Setting timer repeat - AsyncCommands.TimerPlugin.SetTimerEvent(m_localID, m_itemID, sec); + AsyncCommands.TimerPlugin.SetTimerEvent(m_localID, m_item.ItemID, sec); } public virtual void llSleep(double sec) @@ -2917,17 +2901,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llTakeControls(int controls, int accept, int pass_on) { - TaskInventoryItem item = GetSelfInventoryItem(); - - if (item.PermsGranter != UUID.Zero) + if (m_item.PermsGranter != UUID.Zero) { - ScenePresence presence = World.GetScenePresence(item.PermsGranter); + ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); if (presence != null) { - if ((item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) { - presence.RegisterControlEventsToScript(controls, accept, pass_on, m_localID, m_itemID); + presence.RegisterControlEventsToScript(controls, accept, pass_on, m_localID, m_item.ItemID); } } } @@ -2939,20 +2921,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - TaskInventoryItem item = GetSelfInventoryItem(); - - if (item.PermsGranter != UUID.Zero) + if (m_item.PermsGranter != UUID.Zero) { - ScenePresence presence = World.GetScenePresence(item.PermsGranter); + ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); if (presence != null) { - if ((item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) { // Unregister controls from Presence - presence.UnRegisterControlEventsToScript(m_localID, m_itemID); + presence.UnRegisterControlEventsToScript(m_localID, m_item.ItemID); // Remove Take Control permission. - item.PermsMask &= ~ScriptBaseClass.PERMISSION_TAKE_CONTROLS; + m_item.PermsMask &= ~ScriptBaseClass.PERMISSION_TAKE_CONTROLS; } } } @@ -3014,12 +2994,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // if (m_host.ParentGroup.RootPart.AttachmentPoint == 0) // return; - TaskInventoryItem item = GetSelfInventoryItem(); - - if (item.PermsGranter != m_host.OwnerID) + if (m_item.PermsGranter != m_host.OwnerID) return; - if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) AttachToAvatar(attachmentPoint); } @@ -3030,12 +3008,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_host.ParentGroup.AttachmentPoint == 0) return; - TaskInventoryItem item = GetSelfInventoryItem(); - - if (item.PermsGranter != m_host.OwnerID) + if (m_item.PermsGranter != m_host.OwnerID) return; - if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) DetachFromAvatar(); } @@ -3211,7 +3187,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); try { - m_ScriptEngine.SetMinEventDelay(m_itemID, delay); + m_ScriptEngine.SetMinEventDelay(m_item.ItemID, delay); } catch (NotImplementedException) { @@ -3264,14 +3240,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - TaskInventoryItem item = GetSelfInventoryItem(); - - if (item.PermsGranter == UUID.Zero) + if (m_item.PermsGranter == UUID.Zero) return; - if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) { - ScenePresence presence = World.GetScenePresence(item.PermsGranter); + ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); if (presence != null) { @@ -3289,21 +3263,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - TaskInventoryItem item = GetSelfInventoryItem(); - - if (item.PermsGranter == UUID.Zero) + if (m_item.PermsGranter == UUID.Zero) return; - if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) { UUID animID = new UUID(); if (!UUID.TryParse(anim, out animID)) { - animID=InventoryKey(anim); + animID = InventoryKey(anim); } - ScenePresence presence = World.GetScenePresence(item.PermsGranter); + ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); if (presence != null) { @@ -3339,7 +3311,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llGetStartParameter() { m_host.AddScriptLPS(1); - return m_ScriptEngine.GetStartParameter(m_itemID); + return m_ScriptEngine.GetStartParameter(m_item.ItemID); } public void llRequestPermissions(string agent, int perm) @@ -3349,16 +3321,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!UUID.TryParse(agent, out agentID)) return; - TaskInventoryItem item = GetSelfInventoryItem(); - if (agentID == UUID.Zero || perm == 0) // Releasing permissions { llReleaseControls(); - item.PermsGranter = UUID.Zero; - item.PermsMask = 0; + m_item.PermsGranter = UUID.Zero; + m_item.PermsMask = 0; - m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( + m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( "run_time_permissions", new Object[] { new LSL_Integer(0) }, new DetectParams[0])); @@ -3366,7 +3336,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } - if (item.PermsGranter != agentID || (perm & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) + if (m_item.PermsGranter != agentID || (perm & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) llReleaseControls(); m_host.AddScriptLPS(1); @@ -3383,11 +3353,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { lock (m_host.TaskInventory) { - m_host.TaskInventory[m_itemID].PermsGranter = agentID; - m_host.TaskInventory[m_itemID].PermsMask = perm; + m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID; + m_host.TaskInventory[m_item.ItemID].PermsMask = perm; } - m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( + m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( "run_time_permissions", new Object[] { new LSL_Integer(perm) }, new DetectParams[0])); @@ -3407,11 +3377,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { lock (m_host.TaskInventory) { - m_host.TaskInventory[m_itemID].PermsGranter = agentID; - m_host.TaskInventory[m_itemID].PermsMask = perm; + m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID; + m_host.TaskInventory[m_item.ItemID].PermsMask = perm; } - m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( + m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( "run_time_permissions", new Object[] { new LSL_Integer(perm) }, new DetectParams[0])); @@ -3432,8 +3402,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { lock (m_host.TaskInventory) { - m_host.TaskInventory[m_itemID].PermsGranter = agentID; - m_host.TaskInventory[m_itemID].PermsMask = 0; + m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID; + m_host.TaskInventory[m_item.ItemID].PermsMask = 0; } presence.ControllingClient.OnScriptAnswer += handleScriptAnswer; @@ -3441,13 +3411,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } presence.ControllingClient.SendScriptQuestion( - m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, m_itemID, perm); + m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, m_item.ItemID, perm); return; } // Requested agent is not in range, refuse perms - m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( + m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( "run_time_permissions", new Object[] { new LSL_Integer(0) }, new DetectParams[0])); @@ -3466,10 +3436,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api lock (m_host.TaskInventory) { - m_host.TaskInventory[m_itemID].PermsMask = answer; + m_host.TaskInventory[m_item.ItemID].PermsMask = answer; } - m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( + m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( "run_time_permissions", new Object[] { new LSL_Integer(answer) }, new DetectParams[0])); @@ -3479,14 +3449,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - return GetSelfInventoryItem().PermsGranter.ToString(); + return m_item.PermsGranter.ToString(); } public LSL_Integer llGetPermissions() { m_host.AddScriptLPS(1); - int perms = GetSelfInventoryItem().PermsMask; + int perms = m_item.PermsMask; if (m_automaticLinkPermission) perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; @@ -3525,9 +3495,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!UUID.TryParse(target, out targetID)) return; - TaskInventoryItem item = GetSelfInventoryItem(); - - if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 && !m_automaticLinkPermission) { ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); @@ -3535,7 +3503,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } IClientAPI client = null; - ScenePresence sp = World.GetScenePresence(item.PermsGranter); + ScenePresence sp = World.GetScenePresence(m_item.PermsGranter); if (sp != null) client = sp.ControllingClient; @@ -3577,7 +3545,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - if ((GetSelfInventoryItem().PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 && !m_automaticLinkPermission) { ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); @@ -3947,7 +3915,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (item.Name == name) { - if (item.ItemID == m_itemID) + if (item.ItemID == m_item.ItemID) throw new ScriptDeleteException(); else m_host.Inventory.RemoveInventoryItem(item.ItemID); @@ -4080,7 +4048,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID tid = AsyncCommands. DataserverPlugin.RegisterRequest(m_localID, - m_itemID, rq.ToString()); + m_item.ItemID, rq.ToString()); AsyncCommands. DataserverPlugin.DataserverReply(rq.ToString(), reply); @@ -4101,7 +4069,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { UUID tid = AsyncCommands. DataserverPlugin.RegisterRequest(m_localID, - m_itemID, item.AssetID.ToString()); + m_item.ItemID, item.AssetID.ToString()); Vector3 region = new Vector3( World.RegionInfo.RegionLocX * Constants.RegionSize, @@ -4467,9 +4435,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - TaskInventoryItem item = GetSelfInventoryItem(); - - return item.Name != null ? item.Name : String.Empty; + return m_item.Name != null ? m_item.Name : String.Empty; } public LSL_Integer llGetLinkNumberOfSides(int link) @@ -6567,14 +6533,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface(); if (xmlrpcMod.IsEnabled()) { - UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, UUID.Zero); + UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_item.ItemID, UUID.Zero); IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface(); if (xmlRpcRouter != null) { string ExternalHostName = m_ScriptEngine.World.RegionInfo.ExternalHostName; xmlRpcRouter.RegisterNewReceiver(m_ScriptEngine.ScriptModule, channelID, m_host.UUID, - m_itemID, String.Format("http://{0}:{1}/", ExternalHostName, + m_item.ItemID, String.Format("http://{0}:{1}/", ExternalHostName, xmlrpcMod.Port.ToString())); } object[] resobj = new object[] @@ -6586,7 +6552,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api new LSL_Integer(0), new LSL_String(String.Empty) }; - m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams("remote_data", resobj, + m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams("remote_data", resobj, new DetectParams[0])); } ScriptSleep(1000); @@ -6597,7 +6563,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface(); ScriptSleep(3000); - return (xmlrpcMod.SendRemoteData(m_localID, m_itemID, channel, dest, idata, sdata)).ToString(); + return (xmlrpcMod.SendRemoteData(m_localID, m_item.ItemID, channel, dest, idata, sdata)).ToString(); } public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) @@ -9017,13 +8983,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); if (m_UrlModule != null) - return m_UrlModule.RequestSecureURL(m_ScriptEngine.ScriptModule, m_host, m_itemID).ToString(); + return m_UrlModule.RequestSecureURL(m_ScriptEngine.ScriptModule, m_host, m_item.ItemID).ToString(); return UUID.Zero.ToString(); } public LSL_String llRequestSimulatorData(string simulator, int data) { - IOSSL_Api ossl = (IOSSL_Api)m_ScriptEngine.GetApi(m_itemID, "OSSL"); + IOSSL_Api ossl = (IOSSL_Api)m_ScriptEngine.GetApi(m_item.ItemID, "OSSL"); try { @@ -9085,7 +9051,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID rq = UUID.Random(); UUID tid = AsyncCommands. - DataserverPlugin.RegisterRequest(m_localID, m_itemID, rq.ToString()); + DataserverPlugin.RegisterRequest(m_localID, m_item.ItemID, rq.ToString()); AsyncCommands. DataserverPlugin.DataserverReply(rq.ToString(), reply); @@ -9104,7 +9070,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); if (m_UrlModule != null) - return m_UrlModule.RequestURL(m_ScriptEngine.ScriptModule, m_host, m_itemID).ToString(); + return m_UrlModule.RequestURL(m_ScriptEngine.ScriptModule, m_host, m_item.ItemID).ToString(); return UUID.Zero.ToString(); } @@ -9570,12 +9536,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - TaskInventoryItem item = GetSelfInventoryItem(); - - if (item.PermsGranter == UUID.Zero) + if (m_item.PermsGranter == UUID.Zero) return new LSL_Vector(); - if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) { ShoutError("No permissions to track the camera"); return new LSL_Vector(); @@ -9594,12 +9558,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - TaskInventoryItem item = GetSelfInventoryItem(); - - if (item.PermsGranter == UUID.Zero) + if (m_item.PermsGranter == UUID.Zero) return new LSL_Rotation(); - if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) { ShoutError("No permissions to track the camera"); return new LSL_Rotation(); @@ -9664,7 +9626,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llMapDestination(string simname, LSL_Vector pos, LSL_Vector lookAt) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, 0); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, 0); if (detectedParams == null) return; // only works on the first detected avatar ScenePresence avatar = World.GetScenePresence(detectedParams.Key); @@ -9781,15 +9743,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (objectID == UUID.Zero) return; - TaskInventoryItem item = GetSelfInventoryItem(); - // we need the permission first, to know which avatar we want to set the camera for - UUID agentID = item.PermsGranter; + UUID agentID = m_item.PermsGranter; if (agentID == UUID.Zero) return; - if ((item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; ScenePresence presence = World.GetScenePresence(agentID); @@ -9835,15 +9795,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (objectID == UUID.Zero) return; - TaskInventoryItem item = GetSelfInventoryItem(); - // we need the permission first, to know which avatar we want to clear the camera for - UUID agentID = item.PermsGranter; + UUID agentID = m_item.PermsGranter; if (agentID == UUID.Zero) return; - if ((item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; ScenePresence presence = World.GetScenePresence(agentID); @@ -9993,7 +9951,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } UUID reqID = httpScriptMod. - StartHttpRequest(m_localID, m_itemID, url, param, httpHeaders, body); + StartHttpRequest(m_localID, m_item.ItemID, url, param, httpHeaders, body); if (reqID != UUID.Zero) return reqID.ToString(); @@ -10346,7 +10304,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } // was: UUID tid = tid = AsyncCommands. - UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, assetID.ToString()); + UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_item.ItemID, assetID.ToString()); if (NotecardCache.IsCached(assetID)) { @@ -10408,7 +10366,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } // was: UUID tid = tid = AsyncCommands. - UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, assetID.ToString()); + UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_item.ItemID, assetID.ToString()); if (NotecardCache.IsCached(assetID)) { @@ -10466,7 +10424,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void print(string str) { // yes, this is a real LSL function. See: http://wiki.secondlife.com/wiki/Print - IOSSL_Api ossl = (IOSSL_Api)m_ScriptEngine.GetApi(m_itemID, "OSSL"); + IOSSL_Api ossl = (IOSSL_Api)m_ScriptEngine.GetApi(m_item.ItemID, "OSSL"); if (ossl != null) { ossl.CheckThreatLevel(ThreatLevel.High, "print"); @@ -10494,7 +10452,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { UUID rq = UUID.Random(); - AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, rq.ToString()); + AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_item.ItemID, rq.ToString()); AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), Name2Username(llKey2Name(id))); @@ -10510,7 +10468,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { UUID rq = UUID.Random(); - AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, rq.ToString()); + AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_item.ItemID, rq.ToString()); AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), llKey2Name(id)); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs index 77a784d077..cdb1246a12 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs @@ -59,16 +59,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api internal IScriptEngine m_ScriptEngine; internal SceneObjectPart m_host; internal uint m_localID; - internal UUID m_itemID; internal bool m_LSFunctionsEnabled = false; internal IScriptModuleComms m_comms = null; - public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) + public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, TaskInventoryItem item) { m_ScriptEngine = ScriptEngine; m_host = host; m_localID = localID; - m_itemID = itemID; if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false)) m_LSFunctionsEnabled = true; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs index d4facdd657..49a104950e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs @@ -58,16 +58,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api internal IScriptEngine m_ScriptEngine; internal SceneObjectPart m_host; internal uint m_localID; - internal UUID m_itemID; + internal TaskInventoryItem m_item; internal bool m_MODFunctionsEnabled = false; internal IScriptModuleComms m_comms = null; - public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) + public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, TaskInventoryItem item) { m_ScriptEngine = ScriptEngine; m_host = host; m_localID = localID; - m_itemID = itemID; + m_item = item; if (m_ScriptEngine.Config.GetBoolean("AllowMODFunctions", false)) m_MODFunctionsEnabled = true; @@ -115,7 +115,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message); } - + + /// + /// Send a command to functions registered on an event + /// public string modSendCommand(string module, string command, string k) { if (!m_MODFunctionsEnabled) @@ -126,7 +129,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID req = UUID.Random(); - m_comms.RaiseEvent(m_itemID, req.ToString(), module, command, k); + m_comms.RaiseEvent(m_item.ItemID, req.ToString(), module, command, k); return req.ToString(); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 6ee1aa6f74..8c532ca25a 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 internal ILSL_Api m_LSL_Api = null; // get a reference to the LSL API so we can call methods housed there internal SceneObjectPart m_host; internal uint m_localID; - internal UUID m_itemID; + internal TaskInventoryItem m_item; internal bool m_OSFunctionsEnabled = false; internal ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow; internal float m_ScriptDelayFactor = 1.0f; internal float m_ScriptDistanceFactor = 1.0f; internal Dictionary m_FunctionPerms = new Dictionary(); - public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) + public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, TaskInventoryItem item) { m_ScriptEngine = ScriptEngine; m_host = host; m_localID = localID; - m_itemID = itemID; + m_item = item; if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) m_OSFunctionsEnabled = true; @@ -224,7 +224,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_LSL_Api != null) return; - m_LSL_Api = (ILSL_Api)m_ScriptEngine.GetApi(m_itemID, "LSL"); + m_LSL_Api = (ILSL_Api)m_ScriptEngine.GetApi(m_item.ItemID, "LSL"); } // @@ -343,22 +343,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } - TaskInventoryItem ti = m_host.Inventory.GetInventoryItem(m_itemID); - if (ti == null) - { - OSSLError( - String.Format("{0} permission error. Can't find script in prim inventory.", - function)); - } - - UUID ownerID = ti.OwnerID; + UUID ownerID = m_item.OwnerID; //OSSL only may be used if objet is in the same group as the parcel if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER")) { ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); - if (land.LandData.GroupID == ti.GroupID && land.LandData.GroupID != UUID.Zero) + if (land.LandData.GroupID == m_item.GroupID && land.LandData.GroupID != UUID.Zero) { return; } @@ -394,13 +386,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - if (!m_FunctionPerms[function].AllowedCreators.Contains(ti.CreatorID)) + if (!m_FunctionPerms[function].AllowedCreators.Contains(m_item.CreatorID)) OSSLError( 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.", function)); - if (ti.CreatorID != ownerID) + + if (m_item.CreatorID != ownerID) { - if ((ti.CurrentPermissions & (uint)PermissionMask.Modify) != 0) + if ((m_item.CurrentPermissions & (uint)PermissionMask.Modify) != 0) OSSLError( String.Format("{0} permission denied. Script permissions error.", function)); @@ -1181,7 +1174,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.High, "osSetStateEvents"); m_host.AddScriptLPS(1); - m_host.SetScriptEvents(m_itemID, events); + m_host.SetScriptEvents(m_item.ItemID, events); } public void osSetRegionWaterHeight(double height) diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 2c8af81d5e..dd4739346c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs @@ -232,7 +232,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance foreach (string api in am.GetApis()) { m_Apis[api] = am.CreateApi(api); - m_Apis[api].Initialize(engine, part, LocalID, itemID); + m_Apis[api].Initialize(engine, part, LocalID, ScriptTask); } try diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs index 49266e91ea..f480e1d9db 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs @@ -88,10 +88,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests // Create an object embedded inside the first UUID itemId = TestHelpers.ParseTail(0x20); - TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId); + TaskInventoryItem item + = TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId); LSL_Api api = new LSL_Api(); - api.Initialize(m_engine, so1.RootPart, so1.RootPart.LocalId, so1.RootPart.UUID); + api.Initialize(m_engine, so1.RootPart, so1.RootPart.LocalId, null); // Create a second object SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100); @@ -124,7 +125,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10); m_scene.AddSceneObject(so1); LSL_Api api = new LSL_Api(); - api.Initialize(m_engine, so1.RootPart, so1.RootPart.LocalId, so1.RootPart.UUID); + api.Initialize(m_engine, so1.RootPart, so1.RootPart.LocalId, null); // Create an object embedded inside the first UUID itemId = TestHelpers.ParseTail(0x20); @@ -134,7 +135,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100); m_scene.AddSceneObject(so2); LSL_Api api2 = new LSL_Api(); - api2.Initialize(m_engine, so2.RootPart, so2.RootPart.LocalId, so2.RootPart.UUID); + api2.Initialize(m_engine, so2.RootPart, so2.RootPart.LocalId, null); // *** Firstly, we test where llAllowInventoryDrop() has not been called. *** api.llGiveInventory(so2.UUID.ToString(), inventoryItemName); diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index 92a63bf497..bba6c56491 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs @@ -66,8 +66,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests engine.AddRegion(scene); m_lslApi = new LSL_Api(); - m_lslApi.Initialize(engine, part, part.LocalId, part.UUID); - + m_lslApi.Initialize(engine, part, part.LocalId, null); } [Test] diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs index c51227b77c..dff8f6e1ee 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs @@ -95,7 +95,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests m_scene.AddSceneObject(so); OSSL_Api osslApi = new OSSL_Api(); - osslApi.Initialize(m_engine, part, part.LocalId, part.UUID); + osslApi.Initialize(m_engine, part, part.LocalId, null); string notecardName = "appearanceNc"; osslApi.osOwnerSaveAppearance(notecardName); @@ -130,7 +130,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests m_scene.AddSceneObject(so); OSSL_Api osslApi = new OSSL_Api(); - osslApi.Initialize(m_engine, part, part.LocalId, part.UUID); + osslApi.Initialize(m_engine, part, part.LocalId, null); string notecardName = "appearanceNc"; osslApi.osOwnerSaveAppearance(notecardName); @@ -161,7 +161,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests m_scene.AddSceneObject(so); OSSL_Api osslApi = new OSSL_Api(); - osslApi.Initialize(m_engine, part, part.LocalId, part.UUID); + osslApi.Initialize(m_engine, part, part.LocalId, null); string notecardName = "appearanceNc"; @@ -202,7 +202,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests m_scene.AddSceneObject(so); OSSL_Api osslApi = new OSSL_Api(); - osslApi.Initialize(m_engine, part, part.LocalId, part.UUID); + osslApi.Initialize(m_engine, part, part.LocalId, null); string notecardName = "appearanceNc"; diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs index 9c36108da3..80ac52c3ec 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs @@ -104,10 +104,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests m_scene.AddSceneObject(otherSo); OSSL_Api osslApi = new OSSL_Api(); - osslApi.Initialize(m_engine, part, part.LocalId, part.UUID); + osslApi.Initialize(m_engine, part, part.LocalId, null); OSSL_Api otherOsslApi = new OSSL_Api(); - otherOsslApi.Initialize(m_engine, otherPart, otherPart.LocalId, otherPart.UUID); + otherOsslApi.Initialize(m_engine, otherPart, otherPart.LocalId, null); string notecardName = "appearanceNc"; osslApi.osOwnerSaveAppearance(notecardName); @@ -151,7 +151,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests m_scene.AddSceneObject(so); OSSL_Api osslApi = new OSSL_Api(); - osslApi.Initialize(m_engine, part, part.LocalId, part.UUID); + osslApi.Initialize(m_engine, part, part.LocalId, null); string notecardName = "appearanceNc"; osslApi.osOwnerSaveAppearance(notecardName);