diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/Executor.cs | 16 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/ExecutorBase.cs | 17 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/IScript.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/ScriptBaseClass.cs | 22 |
4 files changed, 14 insertions, 44 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/Executor.cs b/OpenSim/Region/ScriptEngine/Common/Executor.cs index 56baa66..792004a 100644 --- a/OpenSim/Region/ScriptEngine/Common/Executor.cs +++ b/OpenSim/Region/ScriptEngine/Common/Executor.cs | |||
@@ -43,22 +43,22 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
43 | } | 43 | } |
44 | 44 | ||
45 | 45 | ||
46 | protected override scriptEvents DoGetStateEventFlags() | 46 | protected override scriptEvents DoGetStateEventFlags(string state) |
47 | { | 47 | { |
48 | // Console.WriteLine("Get event flags for " + m_Script.State); | 48 | // Console.WriteLine("Get event flags for " + state); |
49 | 49 | ||
50 | // Check to see if we've already computed the flags for this state | 50 | // Check to see if we've already computed the flags for this state |
51 | scriptEvents eventFlags = scriptEvents.None; | 51 | scriptEvents eventFlags = scriptEvents.None; |
52 | if (m_stateEvents.ContainsKey(m_Script.State)) | 52 | if (m_stateEvents.ContainsKey(state)) |
53 | { | 53 | { |
54 | m_stateEvents.TryGetValue(m_Script.State, out eventFlags); | 54 | m_stateEvents.TryGetValue(state, out eventFlags); |
55 | return eventFlags; | 55 | return eventFlags; |
56 | } | 56 | } |
57 | 57 | ||
58 | // Fill in the events for this state, cache the results in the map | 58 | // Fill in the events for this state, cache the results in the map |
59 | foreach (KeyValuePair<string, scriptEvents> kvp in m_eventFlagsMap) | 59 | foreach (KeyValuePair<string, scriptEvents> kvp in m_eventFlagsMap) |
60 | { | 60 | { |
61 | string evname = m_Script.State + "_event_" + kvp.Key; | 61 | string evname = state + "_event_" + kvp.Key; |
62 | Type type = m_Script.GetType(); | 62 | Type type = m_Script.GetType(); |
63 | try | 63 | try |
64 | { | 64 | { |
@@ -75,16 +75,16 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
75 | } | 75 | } |
76 | 76 | ||
77 | // Save the flags we just computed and return the result | 77 | // Save the flags we just computed and return the result |
78 | m_stateEvents.Add(m_Script.State, eventFlags); | 78 | m_stateEvents.Add(state, eventFlags); |
79 | return (eventFlags); | 79 | return (eventFlags); |
80 | } | 80 | } |
81 | 81 | ||
82 | protected override void DoExecuteEvent(string FunctionName, object[] args) | 82 | protected override void DoExecuteEvent(string state, string FunctionName, object[] args) |
83 | { | 83 | { |
84 | // IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory. | 84 | // IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory. |
85 | // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead! | 85 | // Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead! |
86 | 86 | ||
87 | string EventName = m_Script.State + "_event_" + FunctionName; | 87 | string EventName = state + "_event_" + FunctionName; |
88 | 88 | ||
89 | //#if DEBUG | 89 | //#if DEBUG |
90 | // Console.WriteLine("ScriptEngine: Script event function name: " + EventName); | 90 | // Console.WriteLine("ScriptEngine: Script event function name: " + EventName); |
diff --git a/OpenSim/Region/ScriptEngine/Common/ExecutorBase.cs b/OpenSim/Region/ScriptEngine/Common/ExecutorBase.cs index 3b7e88e..eba88f3 100644 --- a/OpenSim/Region/ScriptEngine/Common/ExecutorBase.cs +++ b/OpenSim/Region/ScriptEngine/Common/ExecutorBase.cs | |||
@@ -140,28 +140,23 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
140 | /// </summary> | 140 | /// </summary> |
141 | /// <param name="FunctionName">Name of function to execute</param> | 141 | /// <param name="FunctionName">Name of function to execute</param> |
142 | /// <param name="args">Arguments to pass to function</param> | 142 | /// <param name="args">Arguments to pass to function</param> |
143 | public void ExecuteEvent(string FunctionName, object[] args) | 143 | public void ExecuteEvent(string state, string FunctionName, object[] args) |
144 | { | 144 | { |
145 | if (m_Running == false) | 145 | DoExecuteEvent(state, FunctionName, args); |
146 | { | ||
147 | // Script is inactive, do not execute! | ||
148 | return; | ||
149 | } | ||
150 | DoExecuteEvent(FunctionName, args); | ||
151 | } | 146 | } |
152 | 147 | ||
153 | protected abstract void DoExecuteEvent(string FunctionName, object[] args); | 148 | protected abstract void DoExecuteEvent(string state, string FunctionName, object[] args); |
154 | 149 | ||
155 | /// <summary> | 150 | /// <summary> |
156 | /// Compute the events handled by the current state of the script | 151 | /// Compute the events handled by the current state of the script |
157 | /// </summary> | 152 | /// </summary> |
158 | /// <returns>state mask</returns> | 153 | /// <returns>state mask</returns> |
159 | public scriptEvents GetStateEventFlags() | 154 | public scriptEvents GetStateEventFlags(string state) |
160 | { | 155 | { |
161 | return DoGetStateEventFlags(); | 156 | return DoGetStateEventFlags(state); |
162 | } | 157 | } |
163 | 158 | ||
164 | protected abstract scriptEvents DoGetStateEventFlags(); | 159 | protected abstract scriptEvents DoGetStateEventFlags(string state); |
165 | 160 | ||
166 | /// <summary> | 161 | /// <summary> |
167 | /// Stop script from running. Event execution will be ignored. | 162 | /// Stop script from running. Event execution will be ignored. |
diff --git a/OpenSim/Region/ScriptEngine/Common/IScript.cs b/OpenSim/Region/ScriptEngine/Common/IScript.cs index d38dc7b..edd8236 100644 --- a/OpenSim/Region/ScriptEngine/Common/IScript.cs +++ b/OpenSim/Region/ScriptEngine/Common/IScript.cs | |||
@@ -32,10 +32,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
32 | { | 32 | { |
33 | public interface IScript | 33 | public interface IScript |
34 | { | 34 | { |
35 | string State { get; set; } | ||
36 | int StartParam { get; set; } | ||
37 | ExecutorBase Exec { get; } | 35 | ExecutorBase Exec { get; } |
38 | string Source { get; set; } | ||
39 | void InitApi(string api, IScriptApi LSL_Functions); | 36 | void InitApi(string api, IScriptApi LSL_Functions); |
40 | } | 37 | } |
41 | } | 38 | } |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptBaseClass.cs b/OpenSim/Region/ScriptEngine/Common/ScriptBaseClass.cs index dc3ae05..1bcccf1 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptBaseClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptBaseClass.cs | |||
@@ -74,12 +74,6 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
74 | 74 | ||
75 | private string m_state = "default"; | 75 | private string m_state = "default"; |
76 | 76 | ||
77 | public String State | ||
78 | { | ||
79 | get { return m_state; } | ||
80 | set { m_state = value; } | ||
81 | } | ||
82 | |||
83 | public void state(string newState) | 77 | public void state(string newState) |
84 | { | 78 | { |
85 | m_LSL_Functions.state(newState); | 79 | m_LSL_Functions.state(newState); |
@@ -98,22 +92,6 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
98 | 92 | ||
99 | public ILSL_Api m_LSL_Functions; | 93 | public ILSL_Api m_LSL_Functions; |
100 | public IOSSL_Api m_OSSL_Functions; | 94 | public IOSSL_Api m_OSSL_Functions; |
101 | private string _Source = String.Empty; | ||
102 | public string Source | ||
103 | { | ||
104 | get | ||
105 | { | ||
106 | return _Source; | ||
107 | } | ||
108 | set { _Source = value; } | ||
109 | } | ||
110 | |||
111 | private int m_StartParam = 0; | ||
112 | public int StartParam | ||
113 | { | ||
114 | get { return m_StartParam; } | ||
115 | set { m_StartParam = value; } | ||
116 | } | ||
117 | 95 | ||
118 | public ScriptBaseClass() | 96 | public ScriptBaseClass() |
119 | { | 97 | { |