diff options
author | Justin Clark-Casey (justincc) | 2012-05-08 23:20:27 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-05-08 23:20:27 +0100 |
commit | 6406d5a5b9c1c4ef261254e7d4446603b496d1fd (patch) | |
tree | dde37d6079f7c1679985f02add6fd6cf52410b00 /OpenSim/Region/ScriptEngine/Shared/Api | |
parent | Instead of constantly looking up unchanging self item in script code, pass in... (diff) | |
download | opensim-SC_OLD-6406d5a5b9c1c4ef261254e7d4446603b496d1fd.zip opensim-SC_OLD-6406d5a5b9c1c4ef261254e7d4446603b496d1fd.tar.gz opensim-SC_OLD-6406d5a5b9c1c4ef261254e7d4446603b496d1fd.tar.bz2 opensim-SC_OLD-6406d5a5b9c1c4ef261254e7d4446603b496d1fd.tar.xz |
refactor: Eliminate local id parameter from api initialize.
This is always available from m_host.LocalId
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
4 files changed, 22 insertions, 30 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index e8e4dab..afd943b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -84,7 +84,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
84 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 84 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
85 | protected IScriptEngine m_ScriptEngine; | 85 | protected IScriptEngine m_ScriptEngine; |
86 | protected SceneObjectPart m_host; | 86 | protected SceneObjectPart m_host; |
87 | protected uint m_localID; | ||
88 | 87 | ||
89 | /// <summary> | 88 | /// <summary> |
90 | /// The item that hosts this script | 89 | /// The item that hosts this script |
@@ -108,11 +107,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
108 | protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = | 107 | protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = |
109 | new Dictionary<UUID, UserInfoCacheEntry>(); | 108 | new Dictionary<UUID, UserInfoCacheEntry>(); |
110 | 109 | ||
111 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, TaskInventoryItem item) | 110 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) |
112 | { | 111 | { |
113 | m_ScriptEngine = ScriptEngine; | 112 | m_ScriptEngine = ScriptEngine; |
114 | m_host = host; | 113 | m_host = host; |
115 | m_localID = localID; | ||
116 | m_item = item; | 114 | m_item = item; |
117 | 115 | ||
118 | m_ScriptDelayFactor = | 116 | m_ScriptDelayFactor = |
@@ -843,7 +841,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
843 | UUID.TryParse(ID, out keyID); | 841 | UUID.TryParse(ID, out keyID); |
844 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 842 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
845 | if (wComm != null) | 843 | if (wComm != null) |
846 | return wComm.Listen(m_localID, m_item.ItemID, m_host.UUID, channelID, name, keyID, msg); | 844 | return wComm.Listen(m_host.LocalId, m_item.ItemID, m_host.UUID, channelID, name, keyID, msg); |
847 | else | 845 | else |
848 | return -1; | 846 | return -1; |
849 | } | 847 | } |
@@ -870,7 +868,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
870 | UUID keyID = UUID.Zero; | 868 | UUID keyID = UUID.Zero; |
871 | UUID.TryParse(id, out keyID); | 869 | UUID.TryParse(id, out keyID); |
872 | 870 | ||
873 | AsyncCommands.SensorRepeatPlugin.SenseOnce(m_localID, m_item.ItemID, name, keyID, type, range, arc, m_host); | 871 | AsyncCommands.SensorRepeatPlugin.SenseOnce(m_host.LocalId, m_item.ItemID, name, keyID, type, range, arc, m_host); |
874 | } | 872 | } |
875 | 873 | ||
876 | public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) | 874 | public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) |
@@ -879,13 +877,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
879 | UUID keyID = UUID.Zero; | 877 | UUID keyID = UUID.Zero; |
880 | UUID.TryParse(id, out keyID); | 878 | UUID.TryParse(id, out keyID); |
881 | 879 | ||
882 | AsyncCommands.SensorRepeatPlugin.SetSenseRepeatEvent(m_localID, m_item.ItemID, name, keyID, type, range, arc, rate, m_host); | 880 | AsyncCommands.SensorRepeatPlugin.SetSenseRepeatEvent(m_host.LocalId, m_item.ItemID, name, keyID, type, range, arc, rate, m_host); |
883 | } | 881 | } |
884 | 882 | ||
885 | public void llSensorRemove() | 883 | public void llSensorRemove() |
886 | { | 884 | { |
887 | m_host.AddScriptLPS(1); | 885 | m_host.AddScriptLPS(1); |
888 | AsyncCommands.SensorRepeatPlugin.UnSetSenseRepeaterEvents(m_localID, m_item.ItemID); | 886 | AsyncCommands.SensorRepeatPlugin.UnSetSenseRepeaterEvents(m_host.LocalId, m_item.ItemID); |
889 | } | 887 | } |
890 | 888 | ||
891 | public string resolveName(UUID objecUUID) | 889 | public string resolveName(UUID objecUUID) |
@@ -2874,7 +2872,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2874 | sec = m_MinTimerInterval; | 2872 | sec = m_MinTimerInterval; |
2875 | m_host.AddScriptLPS(1); | 2873 | m_host.AddScriptLPS(1); |
2876 | // Setting timer repeat | 2874 | // Setting timer repeat |
2877 | AsyncCommands.TimerPlugin.SetTimerEvent(m_localID, m_item.ItemID, sec); | 2875 | AsyncCommands.TimerPlugin.SetTimerEvent(m_host.LocalId, m_item.ItemID, sec); |
2878 | } | 2876 | } |
2879 | 2877 | ||
2880 | public virtual void llSleep(double sec) | 2878 | public virtual void llSleep(double sec) |
@@ -2937,7 +2935,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2937 | { | 2935 | { |
2938 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) | 2936 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) |
2939 | { | 2937 | { |
2940 | presence.RegisterControlEventsToScript(controls, accept, pass_on, m_localID, m_item.ItemID); | 2938 | presence.RegisterControlEventsToScript(controls, accept, pass_on, m_host.LocalId, m_item.ItemID); |
2941 | } | 2939 | } |
2942 | } | 2940 | } |
2943 | } | 2941 | } |
@@ -2958,7 +2956,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2958 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) | 2956 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) |
2959 | { | 2957 | { |
2960 | // Unregister controls from Presence | 2958 | // Unregister controls from Presence |
2961 | presence.UnRegisterControlEventsToScript(m_localID, m_item.ItemID); | 2959 | presence.UnRegisterControlEventsToScript(m_host.LocalId, m_item.ItemID); |
2962 | // Remove Take Control permission. | 2960 | // Remove Take Control permission. |
2963 | m_item.PermsMask &= ~ScriptBaseClass.PERMISSION_TAKE_CONTROLS; | 2961 | m_item.PermsMask &= ~ScriptBaseClass.PERMISSION_TAKE_CONTROLS; |
2964 | } | 2962 | } |
@@ -4089,7 +4087,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4089 | UUID rq = UUID.Random(); | 4087 | UUID rq = UUID.Random(); |
4090 | 4088 | ||
4091 | UUID tid = AsyncCommands. | 4089 | UUID tid = AsyncCommands. |
4092 | DataserverPlugin.RegisterRequest(m_localID, | 4090 | DataserverPlugin.RegisterRequest(m_host.LocalId, |
4093 | m_item.ItemID, rq.ToString()); | 4091 | m_item.ItemID, rq.ToString()); |
4094 | 4092 | ||
4095 | AsyncCommands. | 4093 | AsyncCommands. |
@@ -4110,7 +4108,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4110 | if (item.Type == 3 && item.Name == name) | 4108 | if (item.Type == 3 && item.Name == name) |
4111 | { | 4109 | { |
4112 | UUID tid = AsyncCommands. | 4110 | UUID tid = AsyncCommands. |
4113 | DataserverPlugin.RegisterRequest(m_localID, | 4111 | DataserverPlugin.RegisterRequest(m_host.LocalId, |
4114 | m_item.ItemID, item.AssetID.ToString()); | 4112 | m_item.ItemID, item.AssetID.ToString()); |
4115 | 4113 | ||
4116 | Vector3 region = new Vector3( | 4114 | Vector3 region = new Vector3( |
@@ -6564,7 +6562,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6564 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 6562 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
6565 | if (xmlrpcMod.IsEnabled()) | 6563 | if (xmlrpcMod.IsEnabled()) |
6566 | { | 6564 | { |
6567 | UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_item.ItemID, UUID.Zero); | 6565 | UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_host.LocalId, m_item.ItemID, UUID.Zero); |
6568 | IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>(); | 6566 | IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>(); |
6569 | if (xmlRpcRouter != null) | 6567 | if (xmlRpcRouter != null) |
6570 | { | 6568 | { |
@@ -6594,7 +6592,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6594 | m_host.AddScriptLPS(1); | 6592 | m_host.AddScriptLPS(1); |
6595 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 6593 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
6596 | ScriptSleep(3000); | 6594 | ScriptSleep(3000); |
6597 | return (xmlrpcMod.SendRemoteData(m_localID, m_item.ItemID, channel, dest, idata, sdata)).ToString(); | 6595 | return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString(); |
6598 | } | 6596 | } |
6599 | 6597 | ||
6600 | public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) | 6598 | public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) |
@@ -9083,7 +9081,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9083 | UUID rq = UUID.Random(); | 9081 | UUID rq = UUID.Random(); |
9084 | 9082 | ||
9085 | UUID tid = AsyncCommands. | 9083 | UUID tid = AsyncCommands. |
9086 | DataserverPlugin.RegisterRequest(m_localID, m_item.ItemID, rq.ToString()); | 9084 | DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, rq.ToString()); |
9087 | 9085 | ||
9088 | AsyncCommands. | 9086 | AsyncCommands. |
9089 | DataserverPlugin.DataserverReply(rq.ToString(), reply); | 9087 | DataserverPlugin.DataserverReply(rq.ToString(), reply); |
@@ -9982,8 +9980,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9982 | } | 9980 | } |
9983 | } | 9981 | } |
9984 | 9982 | ||
9985 | UUID reqID = httpScriptMod. | 9983 | UUID reqID |
9986 | StartHttpRequest(m_localID, m_item.ItemID, url, param, httpHeaders, body); | 9984 | = httpScriptMod.StartHttpRequest(m_host.LocalId, m_item.ItemID, url, param, httpHeaders, body); |
9987 | 9985 | ||
9988 | if (reqID != UUID.Zero) | 9986 | if (reqID != UUID.Zero) |
9989 | return reqID.ToString(); | 9987 | return reqID.ToString(); |
@@ -10413,7 +10411,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10413 | } | 10411 | } |
10414 | 10412 | ||
10415 | // was: UUID tid = tid = AsyncCommands. | 10413 | // was: UUID tid = tid = AsyncCommands. |
10416 | UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_item.ItemID, assetID.ToString()); | 10414 | UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, assetID.ToString()); |
10417 | 10415 | ||
10418 | if (NotecardCache.IsCached(assetID)) | 10416 | if (NotecardCache.IsCached(assetID)) |
10419 | { | 10417 | { |
@@ -10475,7 +10473,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10475 | } | 10473 | } |
10476 | 10474 | ||
10477 | // was: UUID tid = tid = AsyncCommands. | 10475 | // was: UUID tid = tid = AsyncCommands. |
10478 | UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_item.ItemID, assetID.ToString()); | 10476 | UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, assetID.ToString()); |
10479 | 10477 | ||
10480 | if (NotecardCache.IsCached(assetID)) | 10478 | if (NotecardCache.IsCached(assetID)) |
10481 | { | 10479 | { |
@@ -10561,7 +10559,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10561 | { | 10559 | { |
10562 | UUID rq = UUID.Random(); | 10560 | UUID rq = UUID.Random(); |
10563 | 10561 | ||
10564 | AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_item.ItemID, rq.ToString()); | 10562 | AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, rq.ToString()); |
10565 | 10563 | ||
10566 | AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), Name2Username(llKey2Name(id))); | 10564 | AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), Name2Username(llKey2Name(id))); |
10567 | 10565 | ||
@@ -10577,7 +10575,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10577 | { | 10575 | { |
10578 | UUID rq = UUID.Random(); | 10576 | UUID rq = UUID.Random(); |
10579 | 10577 | ||
10580 | AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_item.ItemID, rq.ToString()); | 10578 | AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, rq.ToString()); |
10581 | 10579 | ||
10582 | AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), llKey2Name(id)); | 10580 | AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), llKey2Name(id)); |
10583 | 10581 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs index cd47d96..795de80 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs | |||
@@ -58,15 +58,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
58 | { | 58 | { |
59 | internal IScriptEngine m_ScriptEngine; | 59 | internal IScriptEngine m_ScriptEngine; |
60 | internal SceneObjectPart m_host; | 60 | internal SceneObjectPart m_host; |
61 | internal uint m_localID; | ||
62 | internal bool m_LSFunctionsEnabled = false; | 61 | internal bool m_LSFunctionsEnabled = false; |
63 | internal IScriptModuleComms m_comms = null; | 62 | internal IScriptModuleComms m_comms = null; |
64 | 63 | ||
65 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, TaskInventoryItem item) | 64 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) |
66 | { | 65 | { |
67 | m_ScriptEngine = ScriptEngine; | 66 | m_ScriptEngine = ScriptEngine; |
68 | m_host = host; | 67 | m_host = host; |
69 | m_localID = localID; | ||
70 | 68 | ||
71 | if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false)) | 69 | if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false)) |
72 | m_LSFunctionsEnabled = true; | 70 | 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 a578b50..4bd3dff 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs | |||
@@ -57,16 +57,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
57 | { | 57 | { |
58 | internal IScriptEngine m_ScriptEngine; | 58 | internal IScriptEngine m_ScriptEngine; |
59 | internal SceneObjectPart m_host; | 59 | internal SceneObjectPart m_host; |
60 | internal uint m_localID; | ||
61 | internal TaskInventoryItem m_item; | 60 | internal TaskInventoryItem m_item; |
62 | internal bool m_MODFunctionsEnabled = false; | 61 | internal bool m_MODFunctionsEnabled = false; |
63 | internal IScriptModuleComms m_comms = null; | 62 | internal IScriptModuleComms m_comms = null; |
64 | 63 | ||
65 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, TaskInventoryItem item) | 64 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) |
66 | { | 65 | { |
67 | m_ScriptEngine = ScriptEngine; | 66 | m_ScriptEngine = ScriptEngine; |
68 | m_host = host; | 67 | m_host = host; |
69 | m_localID = localID; | ||
70 | m_item = item; | 68 | m_item = item; |
71 | 69 | ||
72 | if (m_ScriptEngine.Config.GetBoolean("AllowMODFunctions", false)) | 70 | if (m_ScriptEngine.Config.GetBoolean("AllowMODFunctions", false)) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 9b2022a..ad1a358 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -133,7 +133,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
133 | internal IScriptEngine m_ScriptEngine; | 133 | internal IScriptEngine m_ScriptEngine; |
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; | ||
137 | internal TaskInventoryItem m_item; | 136 | internal TaskInventoryItem m_item; |
138 | internal bool m_OSFunctionsEnabled = false; | 137 | internal bool m_OSFunctionsEnabled = false; |
139 | internal ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow; | 138 | internal ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow; |
@@ -141,11 +140,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
141 | internal float m_ScriptDistanceFactor = 1.0f; | 140 | internal float m_ScriptDistanceFactor = 1.0f; |
142 | internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >(); | 141 | internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >(); |
143 | 142 | ||
144 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, TaskInventoryItem item) | 143 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) |
145 | { | 144 | { |
146 | m_ScriptEngine = ScriptEngine; | 145 | m_ScriptEngine = ScriptEngine; |
147 | m_host = host; | 146 | m_host = host; |
148 | m_localID = localID; | ||
149 | m_item = item; | 147 | m_item = item; |
150 | 148 | ||
151 | if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) | 149 | if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) |