aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs518
1 files changed, 259 insertions, 259 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
index 07476ac..6df8343 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
@@ -1,260 +1,260 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29 29
30using System; 30using System;
31using libsecondlife; 31using libsecondlife;
32using OpenSim.Framework; 32using OpenSim.Framework;
33 33
34namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase 34namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
35{ 35{
36 /// <summary> 36 /// <summary>
37 /// Prepares events so they can be directly executed upon a script by EventQueueManager, then queues it. 37 /// Prepares events so they can be directly executed upon a script by EventQueueManager, then queues it.
38 /// </summary> 38 /// </summary>
39 [Serializable] 39 [Serializable]
40 public class EventManager : OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.RemoteEvents 40 public class EventManager : OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.RemoteEvents
41 { 41 {
42 42
43 // 43 //
44 // Class is instanced in "ScriptEngine" and Uses "EventQueueManager" that is also instanced in "ScriptEngine". 44 // Class is instanced in "ScriptEngine" and Uses "EventQueueManager" that is also instanced in "ScriptEngine".
45 // This class needs a bit of explaining: 45 // This class needs a bit of explaining:
46 // 46 //
47 // This class it the link between an event inside OpenSim and the corresponding event in a user script being executed. 47 // This class it the link between an event inside OpenSim and the corresponding event in a user script being executed.
48 // 48 //
49 // For example when an user touches an object then the "myScriptEngine.World.EventManager.OnObjectGrab" event is fired inside OpenSim. 49 // For example when an user touches an object then the "myScriptEngine.World.EventManager.OnObjectGrab" event is fired inside OpenSim.
50 // We hook up to this event and queue a touch_start in EventQueueManager with the proper LSL parameters. 50 // We hook up to this event and queue a touch_start in EventQueueManager with the proper LSL parameters.
51 // It will then be delivered to the script by EventQueueManager. 51 // It will then be delivered to the script by EventQueueManager.
52 // 52 //
53 // You can check debug C# dump of an LSL script if you need to verify what exact parameters are needed. 53 // You can check debug C# dump of an LSL script if you need to verify what exact parameters are needed.
54 // 54 //
55 55
56 56
57 private ScriptEngine myScriptEngine; 57 private ScriptEngine myScriptEngine;
58 //public IScriptHost TEMP_OBJECT_ID; 58 //public IScriptHost TEMP_OBJECT_ID;
59 public EventManager(ScriptEngine _ScriptEngine, bool performHookUp) 59 public EventManager(ScriptEngine _ScriptEngine, bool performHookUp)
60 { 60 {
61 myScriptEngine = _ScriptEngine; 61 myScriptEngine = _ScriptEngine;
62 62
63 // Hook up to events from OpenSim 63 // Hook up to events from OpenSim
64 // We may not want to do it because someone is controlling us and will deliver events to us 64 // We may not want to do it because someone is controlling us and will deliver events to us
65 if (performHookUp) 65 if (performHookUp)
66 { 66 {
67 myScriptEngine.Log.Verbose("ScriptEngine", "Hooking up to server events"); 67 myScriptEngine.Log.Verbose("ScriptEngine", "Hooking up to server events");
68 myScriptEngine.World.EventManager.OnObjectGrab += touch_start; 68 myScriptEngine.World.EventManager.OnObjectGrab += touch_start;
69 myScriptEngine.World.EventManager.OnRezScript += OnRezScript; 69 myScriptEngine.World.EventManager.OnRezScript += OnRezScript;
70 myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; 70 myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript;
71 // TODO: HOOK ALL EVENTS UP TO SERVER! 71 // TODO: HOOK ALL EVENTS UP TO SERVER!
72 } 72 }
73 } 73 }
74 74
75 public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) 75 public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
76 { 76 {
77 // Add to queue for all scripts in ObjectID object 77 // Add to queue for all scripts in ObjectID object
78 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] {(int) 1}); 78 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] {(int) 1});
79 } 79 }
80 80
81 public void OnRezScript(uint localID, LLUUID itemID, string script) 81 public void OnRezScript(uint localID, LLUUID itemID, string script)
82 { 82 {
83 Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " + 83 Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " +
84 script.Length); 84 script.Length);
85 myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script); 85 myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script);
86 } 86 }
87 87
88 public void OnRemoveScript(uint localID, LLUUID itemID) 88 public void OnRemoveScript(uint localID, LLUUID itemID)
89 { 89 {
90 Console.WriteLine("OnRemoveScript localID: " + localID + " LLUID: " + itemID.ToString()); 90 Console.WriteLine("OnRemoveScript localID: " + localID + " LLUID: " + itemID.ToString());
91 myScriptEngine.m_ScriptManager.StopScript( 91 myScriptEngine.m_ScriptManager.StopScript(
92 localID, 92 localID,
93 itemID 93 itemID
94 ); 94 );
95 } 95 }
96 96
97 // TODO: Replace placeholders below 97 // TODO: Replace placeholders below
98 // NOTE! THE PARAMETERS FOR THESE FUNCTIONS ARE NOT CORRECT! 98 // NOTE! THE PARAMETERS FOR THESE FUNCTIONS ARE NOT CORRECT!
99 // These needs to be hooked up to OpenSim during init of this class 99 // These needs to be hooked up to OpenSim during init of this class
100 // then queued in EventQueueManager. 100 // then queued in EventQueueManager.
101 // When queued in EventQueueManager they need to be LSL compatible (name and params) 101 // When queued in EventQueueManager they need to be LSL compatible (name and params)
102 102
103 public void state_exit(uint localID, LLUUID itemID) 103 public void state_exit(uint localID, LLUUID itemID)
104 { 104 {
105 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_exit"); 105 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_exit");
106 } 106 }
107 107
108 public void touch(uint localID, LLUUID itemID) 108 public void touch(uint localID, LLUUID itemID)
109 { 109 {
110 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "touch"); 110 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "touch");
111 } 111 }
112 112
113 public void touch_end(uint localID, LLUUID itemID) 113 public void touch_end(uint localID, LLUUID itemID)
114 { 114 {
115 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "touch_end"); 115 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "touch_end");
116 } 116 }
117 117
118 public void collision_start(uint localID, LLUUID itemID) 118 public void collision_start(uint localID, LLUUID itemID)
119 { 119 {
120 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "collision_start"); 120 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "collision_start");
121 } 121 }
122 122
123 public void collision(uint localID, LLUUID itemID) 123 public void collision(uint localID, LLUUID itemID)
124 { 124 {
125 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "collision"); 125 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "collision");
126 } 126 }
127 127
128 public void collision_end(uint localID, LLUUID itemID) 128 public void collision_end(uint localID, LLUUID itemID)
129 { 129 {
130 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "collision_end"); 130 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "collision_end");
131 } 131 }
132 132
133 public void land_collision_start(uint localID, LLUUID itemID) 133 public void land_collision_start(uint localID, LLUUID itemID)
134 { 134 {
135 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "land_collision_start"); 135 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "land_collision_start");
136 } 136 }
137 137
138 public void land_collision(uint localID, LLUUID itemID) 138 public void land_collision(uint localID, LLUUID itemID)
139 { 139 {
140 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "land_collision"); 140 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "land_collision");
141 } 141 }
142 142
143 public void land_collision_end(uint localID, LLUUID itemID) 143 public void land_collision_end(uint localID, LLUUID itemID)
144 { 144 {
145 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "land_collision_end"); 145 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "land_collision_end");
146 } 146 }
147 147
148 // Handled by long commands 148 // Handled by long commands
149 public void timer(uint localID, LLUUID itemID) 149 public void timer(uint localID, LLUUID itemID)
150 { 150 {
151 //myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, ""); 151 //myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "");
152 } 152 }
153 153
154 public void listen(uint localID, LLUUID itemID) 154 public void listen(uint localID, LLUUID itemID)
155 { 155 {
156 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "listen"); 156 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "listen");
157 } 157 }
158 158
159 public void on_rez(uint localID, LLUUID itemID) 159 public void on_rez(uint localID, LLUUID itemID)
160 { 160 {
161 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "on_rez"); 161 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "on_rez");
162 } 162 }
163 163
164 public void sensor(uint localID, LLUUID itemID) 164 public void sensor(uint localID, LLUUID itemID)
165 { 165 {
166 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "sensor"); 166 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "sensor");
167 } 167 }
168 168
169 public void no_sensor(uint localID, LLUUID itemID) 169 public void no_sensor(uint localID, LLUUID itemID)
170 { 170 {
171 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "no_sensor"); 171 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "no_sensor");
172 } 172 }
173 173
174 public void control(uint localID, LLUUID itemID) 174 public void control(uint localID, LLUUID itemID)
175 { 175 {
176 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "control"); 176 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "control");
177 } 177 }
178 178
179 public void money(uint localID, LLUUID itemID) 179 public void money(uint localID, LLUUID itemID)
180 { 180 {
181 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "money"); 181 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "money");
182 } 182 }
183 183
184 public void email(uint localID, LLUUID itemID) 184 public void email(uint localID, LLUUID itemID)
185 { 185 {
186 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "email"); 186 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "email");
187 } 187 }
188 188
189 public void at_target(uint localID, LLUUID itemID) 189 public void at_target(uint localID, LLUUID itemID)
190 { 190 {
191 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "at_target"); 191 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "at_target");
192 } 192 }
193 193
194 public void not_at_target(uint localID, LLUUID itemID) 194 public void not_at_target(uint localID, LLUUID itemID)
195 { 195 {
196 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "not_at_target"); 196 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "not_at_target");
197 } 197 }
198 198
199 public void at_rot_target(uint localID, LLUUID itemID) 199 public void at_rot_target(uint localID, LLUUID itemID)
200 { 200 {
201 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "at_rot_target"); 201 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "at_rot_target");
202 } 202 }
203 203
204 public void not_at_rot_target(uint localID, LLUUID itemID) 204 public void not_at_rot_target(uint localID, LLUUID itemID)
205 { 205 {
206 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "not_at_rot_target"); 206 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "not_at_rot_target");
207 } 207 }
208 208
209 public void run_time_permissions(uint localID, LLUUID itemID) 209 public void run_time_permissions(uint localID, LLUUID itemID)
210 { 210 {
211 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "run_time_permissions"); 211 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "run_time_permissions");
212 } 212 }
213 213
214 public void changed(uint localID, LLUUID itemID) 214 public void changed(uint localID, LLUUID itemID)
215 { 215 {
216 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "changed"); 216 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "changed");
217 } 217 }
218 218
219 public void attach(uint localID, LLUUID itemID) 219 public void attach(uint localID, LLUUID itemID)
220 { 220 {
221 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "attach"); 221 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "attach");
222 } 222 }
223 223
224 public void dataserver(uint localID, LLUUID itemID) 224 public void dataserver(uint localID, LLUUID itemID)
225 { 225 {
226 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "dataserver"); 226 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "dataserver");
227 } 227 }
228 228
229 public void link_message(uint localID, LLUUID itemID) 229 public void link_message(uint localID, LLUUID itemID)
230 { 230 {
231 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "link_message"); 231 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "link_message");
232 } 232 }
233 233
234 public void moving_start(uint localID, LLUUID itemID) 234 public void moving_start(uint localID, LLUUID itemID)
235 { 235 {
236 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "moving_start"); 236 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "moving_start");
237 } 237 }
238 238
239 public void moving_end(uint localID, LLUUID itemID) 239 public void moving_end(uint localID, LLUUID itemID)
240 { 240 {
241 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "moving_end"); 241 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "moving_end");
242 } 242 }
243 243
244 public void object_rez(uint localID, LLUUID itemID) 244 public void object_rez(uint localID, LLUUID itemID)
245 { 245 {
246 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "object_rez"); 246 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "object_rez");
247 } 247 }
248 248
249 public void remote_data(uint localID, LLUUID itemID) 249 public void remote_data(uint localID, LLUUID itemID)
250 { 250 {
251 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "remote_data"); 251 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "remote_data");
252 } 252 }
253 253
254 // Handled by long commands 254 // Handled by long commands
255 public void http_response(uint localID, LLUUID itemID) 255 public void http_response(uint localID, LLUUID itemID)
256 { 256 {
257 // myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "http_response"); 257 // myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "http_response");
258 } 258 }
259 } 259 }
260} \ No newline at end of file 260} \ No newline at end of file