aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
diff options
context:
space:
mode:
authorTedd Hansen2008-01-12 10:25:08 +0000
committerTedd Hansen2008-01-12 10:25:08 +0000
commita993d0d3351f15510e404cc09951723cf5c435fb (patch)
treeb4e186b85fc5b1907dffb1347d8b855a4ea7a0ad /OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
parentScriptServer protocol now correctly casts datatypes -- ready for implementing (diff)
downloadopensim-SC_OLD-a993d0d3351f15510e404cc09951723cf5c435fb.zip
opensim-SC_OLD-a993d0d3351f15510e404cc09951723cf5c435fb.tar.gz
opensim-SC_OLD-a993d0d3351f15510e404cc09951723cf5c435fb.tar.bz2
opensim-SC_OLD-a993d0d3351f15510e404cc09951723cf5c435fb.tar.xz
ScriptServer communication is ok. Script is creatd on onrez. But since it can not access Scene it sort of crashes right away ;)
Added some sample placeholders for implementing rest of LSL events.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs66
1 files changed, 45 insertions, 21 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
index ad29feb..a36691d 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
@@ -55,34 +55,30 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
55 55
56 private ScriptEngine myScriptEngine; 56 private ScriptEngine myScriptEngine;
57 //public IScriptHost TEMP_OBJECT_ID; 57 //public IScriptHost TEMP_OBJECT_ID;
58 public EventManager(ScriptEngine _ScriptEngine) 58 public EventManager(ScriptEngine _ScriptEngine, bool performHookUp)
59 { 59 {
60 myScriptEngine = _ScriptEngine; 60 myScriptEngine = _ScriptEngine;
61 // TODO: HOOK EVENTS UP TO SERVER!
62 //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Start");
63 // TODO: ADD SERVER HOOK TO LOAD A SCRIPT THROUGH myScriptEngine.ScriptManager
64 61
65 // Hook up a test event to our test form 62 // Hook up to events from OpenSim
66 myScriptEngine.Log.Verbose("ScriptEngine", "Hooking up to server events"); 63 // We may not want to do it because someone is controlling us and will deliver events to us
67 myScriptEngine.World.EventManager.OnObjectGrab += touch_start; 64 if (performHookUp)
68 myScriptEngine.World.EventManager.OnRezScript += OnRezScript; 65 {
69 myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; 66 myScriptEngine.Log.Verbose("ScriptEngine", "Hooking up to server events");
67 myScriptEngine.World.EventManager.OnObjectGrab += touch_start;
68 myScriptEngine.World.EventManager.OnRezScript += OnRezScript;
69 myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript;
70 // TODO: HOOK ALL EVENTS UP TO SERVER!
71 }
70 } 72 }
71 73
72 public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) 74 public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
73 { 75 {
74 // Add to queue for all scripts in ObjectID object 76 // Add to queue for all scripts in ObjectID object
75 //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Event: touch_start");
76 //Console.WriteLine("touch_start localID: " + localID);
77 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] {(int) 1}); 77 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] {(int) 1});
78 } 78 }
79 79
80 public void OnRezScript(uint localID, LLUUID itemID, string script) 80 public void OnRezScript(uint localID, LLUUID itemID, string script)
81 { 81 {
82 //myScriptEngine.myScriptManager.StartScript(
83 // Path.Combine("ScriptEngines", "Default.lsl"),
84 // new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost()
85 //);
86 Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " + 82 Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " +
87 script.Length); 83 script.Length);
88 myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script); 84 myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script);
@@ -90,10 +86,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
90 86
91 public void OnRemoveScript(uint localID, LLUUID itemID) 87 public void OnRemoveScript(uint localID, LLUUID itemID)
92 { 88 {
93 //myScriptEngine.myScriptManager.StartScript(
94 // Path.Combine("ScriptEngines", "Default.lsl"),
95 // new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost()
96 //);
97 Console.WriteLine("OnRemoveScript localID: " + localID + " LLUID: " + itemID.ToString()); 89 Console.WriteLine("OnRemoveScript localID: " + localID + " LLUID: " + itemID.ToString());
98 myScriptEngine.m_ScriptManager.StopScript( 90 myScriptEngine.m_ScriptManager.StopScript(
99 localID, 91 localID,
@@ -102,134 +94,166 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
102 } 94 }
103 95
104 // TODO: Replace placeholders below 96 // TODO: Replace placeholders below
97 // NOTE! THE PARAMETERS FOR THESE FUNCTIONS ARE NOT CORRECT!
105 // These needs to be hooked up to OpenSim during init of this class 98 // These needs to be hooked up to OpenSim during init of this class
106 // then queued in EventQueueManager. 99 // then queued in EventQueueManager.
107 // When queued in EventQueueManager they need to be LSL compatible (name and params) 100 // When queued in EventQueueManager they need to be LSL compatible (name and params)
108 101
109 //public void state_entry() { } //
110 public void state_exit(uint localID, LLUUID itemID) 102 public void state_exit(uint localID, LLUUID itemID)
111 { 103 {
104 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_exit");
112 } 105 }
113 106
114 //public void touch_start(uint localID, LLUUID itemID) { }
115 public void touch(uint localID, LLUUID itemID) 107 public void touch(uint localID, LLUUID itemID)
116 { 108 {
109 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "touch");
117 } 110 }
118 111
119 public void touch_end(uint localID, LLUUID itemID) 112 public void touch_end(uint localID, LLUUID itemID)
120 { 113 {
114 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "touch_end");
121 } 115 }
122 116
123 public void collision_start(uint localID, LLUUID itemID) 117 public void collision_start(uint localID, LLUUID itemID)
124 { 118 {
119 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "collision_start");
125 } 120 }
126 121
127 public void collision(uint localID, LLUUID itemID) 122 public void collision(uint localID, LLUUID itemID)
128 { 123 {
124 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "collision");
129 } 125 }
130 126
131 public void collision_end(uint localID, LLUUID itemID) 127 public void collision_end(uint localID, LLUUID itemID)
132 { 128 {
129 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "collision_end");
133 } 130 }
134 131
135 public void land_collision_start(uint localID, LLUUID itemID) 132 public void land_collision_start(uint localID, LLUUID itemID)
136 { 133 {
134 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "land_collision_start");
137 } 135 }
138 136
139 public void land_collision(uint localID, LLUUID itemID) 137 public void land_collision(uint localID, LLUUID itemID)
140 { 138 {
139 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "land_collision");
141 } 140 }
142 141
143 public void land_collision_end(uint localID, LLUUID itemID) 142 public void land_collision_end(uint localID, LLUUID itemID)
144 { 143 {
144 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "land_collision_end");
145 } 145 }
146 146
147 // Handled by long commands
147 public void timer(uint localID, LLUUID itemID) 148 public void timer(uint localID, LLUUID itemID)
148 { 149 {
150 //myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "");
149 } 151 }
150 152
151 public void listen(uint localID, LLUUID itemID) 153 public void listen(uint localID, LLUUID itemID)
152 { 154 {
155 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "listen");
153 } 156 }
154 157
155 public void on_rez(uint localID, LLUUID itemID) 158 public void on_rez(uint localID, LLUUID itemID)
156 { 159 {
160 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "on_rez");
157 } 161 }
158 162
159 public void sensor(uint localID, LLUUID itemID) 163 public void sensor(uint localID, LLUUID itemID)
160 { 164 {
165 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "sensor");
161 } 166 }
162 167
163 public void no_sensor(uint localID, LLUUID itemID) 168 public void no_sensor(uint localID, LLUUID itemID)
164 { 169 {
170 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "no_sensor");
165 } 171 }
166 172
167 public void control(uint localID, LLUUID itemID) 173 public void control(uint localID, LLUUID itemID)
168 { 174 {
175 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "control");
169 } 176 }
170 177
171 public void money(uint localID, LLUUID itemID) 178 public void money(uint localID, LLUUID itemID)
172 { 179 {
180 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "money");
173 } 181 }
174 182
175 public void email(uint localID, LLUUID itemID) 183 public void email(uint localID, LLUUID itemID)
176 { 184 {
185 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "email");
177 } 186 }
178 187
179 public void at_target(uint localID, LLUUID itemID) 188 public void at_target(uint localID, LLUUID itemID)
180 { 189 {
190 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "at_target");
181 } 191 }
182 192
183 public void not_at_target(uint localID, LLUUID itemID) 193 public void not_at_target(uint localID, LLUUID itemID)
184 { 194 {
195 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "not_at_target");
185 } 196 }
186 197
187 public void at_rot_target(uint localID, LLUUID itemID) 198 public void at_rot_target(uint localID, LLUUID itemID)
188 { 199 {
200 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "at_rot_target");
189 } 201 }
190 202
191 public void not_at_rot_target(uint localID, LLUUID itemID) 203 public void not_at_rot_target(uint localID, LLUUID itemID)
192 { 204 {
205 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "not_at_rot_target");
193 } 206 }
194 207
195 public void run_time_permissions(uint localID, LLUUID itemID) 208 public void run_time_permissions(uint localID, LLUUID itemID)
196 { 209 {
210 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "run_time_permissions");
197 } 211 }
198 212
199 public void changed(uint localID, LLUUID itemID) 213 public void changed(uint localID, LLUUID itemID)
200 { 214 {
215 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "changed");
201 } 216 }
202 217
203 public void attach(uint localID, LLUUID itemID) 218 public void attach(uint localID, LLUUID itemID)
204 { 219 {
220 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "attach");
205 } 221 }
206 222
207 public void dataserver(uint localID, LLUUID itemID) 223 public void dataserver(uint localID, LLUUID itemID)
208 { 224 {
225 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "dataserver");
209 } 226 }
210 227
211 public void link_message(uint localID, LLUUID itemID) 228 public void link_message(uint localID, LLUUID itemID)
212 { 229 {
230 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "link_message");
213 } 231 }
214 232
215 public void moving_start(uint localID, LLUUID itemID) 233 public void moving_start(uint localID, LLUUID itemID)
216 { 234 {
235 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "moving_start");
217 } 236 }
218 237
219 public void moving_end(uint localID, LLUUID itemID) 238 public void moving_end(uint localID, LLUUID itemID)
220 { 239 {
240 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "moving_end");
221 } 241 }
222 242
223 public void object_rez(uint localID, LLUUID itemID) 243 public void object_rez(uint localID, LLUUID itemID)
224 { 244 {
245 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "object_rez");
225 } 246 }
226 247
227 public void remote_data(uint localID, LLUUID itemID) 248 public void remote_data(uint localID, LLUUID itemID)
228 { 249 {
250 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "remote_data");
229 } 251 }
230 252
253 // Handled by long commands
231 public void http_response(uint localID, LLUUID itemID) 254 public void http_response(uint localID, LLUUID itemID)
232 { 255 {
256 // myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "http_response");
233 } 257 }
234 } 258 }
235} \ No newline at end of file 259} \ No newline at end of file