aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
diff options
context:
space:
mode:
authorMelanie Thielker2008-09-26 15:01:03 +0000
committerMelanie Thielker2008-09-26 15:01:03 +0000
commit24628928c3bd7148e9df6920ca8b3ed74aaafb49 (patch)
tree2dca9e3e8d06a727bb7fdbb2be28d3e76d86730a /OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
parent* refactor: split out AssetXferUploader (diff)
downloadopensim-SC-24628928c3bd7148e9df6920ca8b3ed74aaafb49.zip
opensim-SC-24628928c3bd7148e9df6920ca8b3ed74aaafb49.tar.gz
opensim-SC-24628928c3bd7148e9df6920ca8b3ed74aaafb49.tar.bz2
opensim-SC-24628928c3bd7148e9df6920ca8b3ed74aaafb49.tar.xz
Add per-instance date to DNE to avoid serializing stuff 10 times a second.
Clode cleanup and removal of commented stuff in ScriptManager.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs40
1 files changed, 24 insertions, 16 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
index 7ec71c2..6a3f388 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
@@ -198,12 +198,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
198 if (localID == 0) 198 if (localID == 0)
199 return null; 199 return null;
200 200
201 IScript Script = m_ScriptManager.GetScript(localID, itemID); 201 InstanceData id = m_ScriptManager.GetScript(localID, itemID);
202 202
203 if (Script == null) 203 if (id == null)
204 return null; 204 return null;
205 205
206 DetectParams[] det = m_ScriptManager.GetDetectParams(Script); 206 DetectParams[] det = m_ScriptManager.GetDetectParams(id);
207 207
208 if (number < 0 || number >= det.Length) 208 if (number < 0 || number >= det.Length)
209 return null; 209 return null;
@@ -223,12 +223,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
223 if (localID == 0) 223 if (localID == 0)
224 return; 224 return;
225 225
226 IScript Script = m_ScriptManager.GetScript(localID, itemID); 226 InstanceData id = m_ScriptManager.GetScript(localID, itemID);
227 227
228 if (Script == null) 228 if (id == null)
229 return; 229 return;
230 230
231 string currentState = Script.State; 231 string currentState = id.State;
232 232
233 if (currentState != state) 233 if (currentState != state)
234 { 234 {
@@ -239,22 +239,29 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
239 } 239 }
240 catch (AppDomainUnloadedException) 240 catch (AppDomainUnloadedException)
241 { 241 {
242 Console.WriteLine("[SCRIPT]: state change called when script was unloaded. Nothing to worry about, but noting the occurance"); 242 Console.WriteLine("[SCRIPT]: state change called when "+
243 "script was unloaded. Nothing to worry about, "+
244 "but noting the occurance");
243 } 245 }
244 246
245 Script.State = state; 247 id.State = state;
246 248
247 try 249 try
248 { 250 {
249 int eventFlags = m_ScriptManager.GetStateEventFlags(localID, itemID); 251 int eventFlags = m_ScriptManager.GetStateEventFlags(localID,
252 itemID);
253
250 SceneObjectPart part = m_Scene.GetSceneObjectPart(itemID); 254 SceneObjectPart part = m_Scene.GetSceneObjectPart(itemID);
251 if (part != null) 255 if (part != null)
252 part.SetScriptEvents(itemID, eventFlags); 256 part.SetScriptEvents(itemID, eventFlags);
257
253 m_EventManager.state_entry(localID); 258 m_EventManager.state_entry(localID);
254 } 259 }
255 catch (AppDomainUnloadedException) 260 catch (AppDomainUnloadedException)
256 { 261 {
257 Console.WriteLine("[SCRIPT]: state change called when script was unloaded. Nothing to worry about, but noting the occurance"); 262 Console.WriteLine("[SCRIPT]: state change called when "+
263 "script was unloaded. Nothing to worry about, but "+
264 "noting the occurance");
258 } 265 }
259 } 266 }
260 } 267 }
@@ -265,11 +272,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
265 if (localID == 0) 272 if (localID == 0)
266 return false; 273 return false;
267 274
268 IScript script = m_ScriptManager.GetScript(localID, itemID); 275 InstanceData id = m_ScriptManager.GetScript(localID, itemID);
269 if (script == null) 276 if (id == null)
270 return false; 277 return false;
271 278
272 return script.Exec.Running?true:false; 279 return id.Running;
273 } 280 }
274 281
275 public void SetScriptState(UUID itemID, bool state) 282 public void SetScriptState(UUID itemID, bool state)
@@ -278,11 +285,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
278 if (localID == 0) 285 if (localID == 0)
279 return; 286 return;
280 287
281 IScript script = m_ScriptManager.GetScript(localID, itemID); 288 InstanceData id = m_ScriptManager.GetScript(localID, itemID);
282 if (script == null) 289 if (id == null)
283 return; 290 return;
284 291
285 script.Exec.Running = state; 292 if (!id.Disabled)
293 id.Running = state;
286 } 294 }
287 295
288 public void ApiResetScript(UUID itemID) 296 public void ApiResetScript(UUID itemID)