aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/DotNetEngine
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
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')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs66
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs6
4 files changed, 58 insertions, 26 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
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
index e2b11cc..e7cb489 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
@@ -314,7 +314,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
314 /// <param name="localID"></param> 314 /// <param name="localID"></param>
315 /// <param name="FunctionName">Name of the function, will be state + "_event_" + FunctionName</param> 315 /// <param name="FunctionName">Name of the function, will be state + "_event_" + FunctionName</param>
316 /// <param name="param">Array of parameters to match event mask</param> 316 /// <param name="param">Array of parameters to match event mask</param>
317 public void AddToObjectQueue(uint localID, string FunctionName, object[] param) 317 public void AddToObjectQueue(uint localID, string FunctionName, params object[] param)
318 { 318 {
319 // Determine all scripts in Object and add to their queue 319 // Determine all scripts in Object and add to their queue
320 //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventQueueManager Adding localID: " + localID + ", FunctionName: " + FunctionName); 320 //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventQueueManager Adding localID: " + localID + ", FunctionName: " + FunctionName);
@@ -345,7 +345,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
345 /// <param name="itemID"></param> 345 /// <param name="itemID"></param>
346 /// <param name="FunctionName">Name of the function, will be state + "_event_" + FunctionName</param> 346 /// <param name="FunctionName">Name of the function, will be state + "_event_" + FunctionName</param>
347 /// <param name="param">Array of parameters to match event mask</param> 347 /// <param name="param">Array of parameters to match event mask</param>
348 public void AddToScriptQueue(uint localID, LLUUID itemID, string FunctionName, object[] param) 348 public void AddToScriptQueue(uint localID, LLUUID itemID, string FunctionName, params object[] param)
349 { 349 {
350 lock (queueLock) 350 lock (queueLock)
351 { 351 {
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
index e403385..1e4dc99 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
@@ -202,6 +202,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
202 202
203 public void CheckHttpRequests() 203 public void CheckHttpRequests()
204 { 204 {
205 if (m_ScriptEngine.World == null)
206 return;
207
205 IHttpRequests iHttpReq = 208 IHttpRequests iHttpReq =
206 m_ScriptEngine.World.RequestModuleInterface<IHttpRequests>(); 209 m_ScriptEngine.World.RequestModuleInterface<IHttpRequests>();
207 210
@@ -241,6 +244,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
241 244
242 public void CheckXMLRPCRequests() 245 public void CheckXMLRPCRequests()
243 { 246 {
247 if (m_ScriptEngine.World == null)
248 return;
249
244 IXMLRPC xmlrpc = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 250 IXMLRPC xmlrpc = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
245 251
246 if (xmlrpc != null) 252 if (xmlrpc != null)
@@ -266,6 +272,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
266 272
267 public void CheckListeners() 273 public void CheckListeners()
268 { 274 {
275 if (m_ScriptEngine.World == null)
276 return;
269 IWorldComm comms = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); 277 IWorldComm comms = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
270 278
271 while (comms.HasMessages()) 279 while (comms.HasMessages())
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
index 604a5f3..c3cb34d 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
@@ -62,7 +62,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
62 get { return m_log; } 62 get { return m_log; }
63 } 63 }
64 64
65 public void InitializeEngine(Scene Sceneworld, LogBase logger) 65 public void InitializeEngine(Scene Sceneworld, LogBase logger, bool HookUpToServer)
66 { 66 {
67 World = Sceneworld; 67 World = Sceneworld;
68 m_log = logger; 68 m_log = logger;
@@ -73,7 +73,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
73 73
74 // Create all objects we'll be using 74 // Create all objects we'll be using
75 m_EventQueueManager = new EventQueueManager(this); 75 m_EventQueueManager = new EventQueueManager(this);
76 m_EventManager = new EventManager(this); 76 m_EventManager = new EventManager(this, HookUpToServer);
77 m_ScriptManager = new ScriptManager(this); 77 m_ScriptManager = new ScriptManager(this);
78 m_AppDomainManager = new AppDomainManager(); 78 m_AppDomainManager = new AppDomainManager();
79 m_LSLLongCmdHandler = new LSLLongCmdHandler(this); 79 m_LSLLongCmdHandler = new LSLLongCmdHandler(this);
@@ -97,7 +97,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
97 97
98 public void Initialise(Scene scene, IConfigSource config) 98 public void Initialise(Scene scene, IConfigSource config)
99 { 99 {
100 InitializeEngine(scene, MainLog.Instance); 100 InitializeEngine(scene, MainLog.Instance, true);
101 } 101 }
102 102
103 public void PostInitialise() 103 public void PostInitialise()