diff options
Diffstat (limited to 'OpenSim')
7 files changed, 54 insertions, 10 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs b/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs index 07e3b41..47588b6 100644 --- a/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs | |||
@@ -95,6 +95,12 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
95 | set { _Source = value; } | 95 | set { _Source = value; } |
96 | } | 96 | } |
97 | 97 | ||
98 | private int m_StartParam = 0; | ||
99 | public int StartParam | ||
100 | { | ||
101 | get { return m_StartParam; } | ||
102 | set { m_StartParam = value; } | ||
103 | } | ||
98 | 104 | ||
99 | public BuiltIn_Commands_BaseClass() | 105 | public BuiltIn_Commands_BaseClass() |
100 | { | 106 | { |
@@ -860,7 +866,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
860 | 866 | ||
861 | public LSL_Types.LSLInteger llGetStartParameter() | 867 | public LSL_Types.LSLInteger llGetStartParameter() |
862 | { | 868 | { |
863 | return m_LSL_Functions.llGetStartParameter(); | 869 | return m_StartParam; |
864 | } | 870 | } |
865 | 871 | ||
866 | public void llGodLikeRezObject(string inventory, vector pos) | 872 | public void llGodLikeRezObject(string inventory, vector pos) |
diff --git a/OpenSim/Region/ScriptEngine/Common/IScript.cs b/OpenSim/Region/ScriptEngine/Common/IScript.cs index e3ceb47..cad3707 100644 --- a/OpenSim/Region/ScriptEngine/Common/IScript.cs +++ b/OpenSim/Region/ScriptEngine/Common/IScript.cs | |||
@@ -32,6 +32,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
32 | public interface IScript | 32 | public interface IScript |
33 | { | 33 | { |
34 | string State { get; set; } | 34 | string State { get; set; } |
35 | int StartParam { get; set; } | ||
35 | ExecutorBase Exec { get; } | 36 | ExecutorBase Exec { get; } |
36 | string Source { get; set; } | 37 | string Source { get; set; } |
37 | void Start(BuilIn_Commands BuiltIn_Commands); | 38 | void Start(BuilIn_Commands BuiltIn_Commands); |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index c240573..69235c4 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -2343,8 +2343,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2343 | 2343 | ||
2344 | public LSL_Types.LSLInteger llGetStartParameter() | 2344 | public LSL_Types.LSLInteger llGetStartParameter() |
2345 | { | 2345 | { |
2346 | m_host.AddScriptLPS(1); | 2346 | // This is not handled here |
2347 | NotImplemented("llGetStartParameter"); | ||
2348 | return 0; | 2347 | return 0; |
2349 | } | 2348 | } |
2350 | 2349 | ||
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs index ab3cba8..bfdc686 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | |||
@@ -1293,6 +1293,18 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1293 | return ret; | 1293 | return ret; |
1294 | } | 1294 | } |
1295 | 1295 | ||
1296 | public override bool Equals(Object o) | ||
1297 | { | ||
1298 | if(!(o is LSLInteger)) | ||
1299 | return false; | ||
1300 | return value == ((LSLInteger)o).value; | ||
1301 | } | ||
1302 | |||
1303 | public override int GetHashCode() | ||
1304 | { | ||
1305 | return value; | ||
1306 | } | ||
1307 | |||
1296 | static public LSLInteger operator &(LSLInteger i1, LSLInteger i2) | 1308 | static public LSLInteger operator &(LSLInteger i1, LSLInteger i2) |
1297 | { | 1309 | { |
1298 | int ret = i1.value & i2.value; | 1310 | int ret = i1.value & i2.value; |
@@ -1438,6 +1450,19 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1438 | return String.Format("{0:0.000000}", this.value); | 1450 | return String.Format("{0:0.000000}", this.value); |
1439 | } | 1451 | } |
1440 | 1452 | ||
1453 | public override bool Equals(Object o) | ||
1454 | { | ||
1455 | if(!(o is LSLFloat)) | ||
1456 | return false; | ||
1457 | return value == ((LSLFloat)o).value; | ||
1458 | } | ||
1459 | |||
1460 | public override int GetHashCode() | ||
1461 | { | ||
1462 | return Convert.ToInt32(value); | ||
1463 | } | ||
1464 | |||
1465 | |||
1441 | #endregion | 1466 | #endregion |
1442 | } | 1467 | } |
1443 | } | 1468 | } |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs index 93b68d4..0e852d1 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs | |||
@@ -190,7 +190,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
190 | { | 190 | { |
191 | Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " + | 191 | Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " + |
192 | script.Length); | 192 | script.Length); |
193 | myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script); | 193 | myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script, startParam, postOnRez); |
194 | } | 194 | } |
195 | 195 | ||
196 | public void OnRemoveScript(uint localID, LLUUID itemID) | 196 | public void OnRemoveScript(uint localID, LLUUID itemID) |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs index eed0b86..75ab2aa 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs | |||
@@ -72,6 +72,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
72 | public LLUUID itemID; | 72 | public LLUUID itemID; |
73 | public string script; | 73 | public string script; |
74 | public LUType Action; | 74 | public LUType Action; |
75 | public int startParam; | ||
76 | public bool postOnRez; | ||
75 | } | 77 | } |
76 | 78 | ||
77 | private enum LUType | 79 | private enum LUType |
@@ -223,7 +225,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
223 | } | 225 | } |
224 | else if (item.Action == LUType.Load) | 226 | else if (item.Action == LUType.Load) |
225 | { | 227 | { |
226 | _StartScript(item.localID, item.itemID, item.script); | 228 | _StartScript(item.localID, item.itemID, item.script, item.startParam, item.postOnRez); |
227 | } | 229 | } |
228 | } | 230 | } |
229 | } | 231 | } |
@@ -252,7 +254,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
252 | /// </summary> | 254 | /// </summary> |
253 | /// <param name="itemID"></param> | 255 | /// <param name="itemID"></param> |
254 | /// <param name="localID"></param> | 256 | /// <param name="localID"></param> |
255 | public void StartScript(uint localID, LLUUID itemID, string Script) | 257 | public void StartScript(uint localID, LLUUID itemID, string Script, int startParam, bool postOnRez) |
256 | { | 258 | { |
257 | lock (LUQueue) | 259 | lock (LUQueue) |
258 | { | 260 | { |
@@ -267,6 +269,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
267 | ls.itemID = itemID; | 269 | ls.itemID = itemID; |
268 | ls.script = Script; | 270 | ls.script = Script; |
269 | ls.Action = LUType.Load; | 271 | ls.Action = LUType.Load; |
272 | ls.startParam = startParam; | ||
273 | ls.postOnRez = postOnRez; | ||
270 | LUQueue.Enqueue(ls); | 274 | LUQueue.Enqueue(ls); |
271 | } | 275 | } |
272 | } | 276 | } |
@@ -282,6 +286,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
282 | ls.localID = localID; | 286 | ls.localID = localID; |
283 | ls.itemID = itemID; | 287 | ls.itemID = itemID; |
284 | ls.Action = LUType.Unload; | 288 | ls.Action = LUType.Unload; |
289 | ls.startParam = 0; | ||
290 | ls.postOnRez = false; | ||
285 | lock (LUQueue) | 291 | lock (LUQueue) |
286 | { | 292 | { |
287 | LUQueue.Enqueue(ls); | 293 | LUQueue.Enqueue(ls); |
@@ -291,7 +297,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
291 | // Create a new instance of the compiler (reuse) | 297 | // Create a new instance of the compiler (reuse) |
292 | //private Compiler.LSL.Compiler LSLCompiler = new Compiler.LSL.Compiler(); | 298 | //private Compiler.LSL.Compiler LSLCompiler = new Compiler.LSL.Compiler(); |
293 | 299 | ||
294 | public abstract void _StartScript(uint localID, LLUUID itemID, string Script); | 300 | public abstract void _StartScript(uint localID, LLUUID itemID, string Script, int startParam, bool postOnRez); |
295 | public abstract void _StopScript(uint localID, LLUUID itemID); | 301 | public abstract void _StopScript(uint localID, LLUUID itemID); |
296 | 302 | ||
297 | 303 | ||
@@ -423,9 +429,10 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
423 | 429 | ||
424 | public void ResetScript(uint localID, LLUUID itemID) | 430 | public void ResetScript(uint localID, LLUUID itemID) |
425 | { | 431 | { |
426 | string script = GetScript(localID, itemID).Source; | 432 | IScript s = GetScript(localID, itemID); |
433 | string script = s.Source; | ||
427 | StopScript(localID, itemID); | 434 | StopScript(localID, itemID); |
428 | StartScript(localID, itemID, script); | 435 | StartScript(localID, itemID, script, s.StartParam, false); |
429 | } | 436 | } |
430 | 437 | ||
431 | 438 | ||
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index 008abd0..2d2a06a 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | |||
@@ -62,7 +62,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
62 | // PROVIDE SCRIPT WITH ITS INTERFACE TO OpenSim | 62 | // PROVIDE SCRIPT WITH ITS INTERFACE TO OpenSim |
63 | 63 | ||
64 | 64 | ||
65 | public override void _StartScript(uint localID, LLUUID itemID, string Script) | 65 | public override void _StartScript(uint localID, LLUUID itemID, string Script, int startParam, bool postOnRez) |
66 | { | 66 | { |
67 | m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: ScriptManager StartScript: localID: " + localID + ", itemID: " + itemID); | 67 | m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: ScriptManager StartScript: localID: " + localID + ", itemID: " + itemID); |
68 | 68 | ||
@@ -114,6 +114,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
114 | //#endif | 114 | //#endif |
115 | 115 | ||
116 | CompiledScript.Source = Script; | 116 | CompiledScript.Source = Script; |
117 | CompiledScript.StartParam = startParam; | ||
118 | |||
117 | // Add it to our script memstruct | 119 | // Add it to our script memstruct |
118 | m_scriptEngine.m_ScriptManager.SetScript(localID, itemID, CompiledScript); | 120 | m_scriptEngine.m_ScriptManager.SetScript(localID, itemID, CompiledScript); |
119 | 121 | ||
@@ -130,6 +132,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
130 | int eventFlags = m_scriptEngine.m_ScriptManager.GetStateEventFlags(localID, itemID); | 132 | int eventFlags = m_scriptEngine.m_ScriptManager.GetStateEventFlags(localID, itemID); |
131 | m_host.SetScriptEvents(itemID, eventFlags); | 133 | m_host.SetScriptEvents(itemID, eventFlags); |
132 | m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", EventQueueManager.llDetectNull, new object[] { }); | 134 | m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", EventQueueManager.llDetectNull, new object[] { }); |
135 | if(postOnRez) | ||
136 | { | ||
137 | m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "on_rez", EventQueueManager.llDetectNull, new object[] { new LSL_Types.LSLInteger(startParam) }); | ||
138 | } | ||
133 | } | 139 | } |
134 | catch (Exception e) // LEGIT: User Scripting | 140 | catch (Exception e) // LEGIT: User Scripting |
135 | { | 141 | { |