aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
diff options
context:
space:
mode:
authorAlan Webb2009-08-03 21:43:08 -0400
committerdr scofield (aka dirk husemann)2009-08-04 11:41:06 +0200
commit9ffe4d850e9ccf2fc40901e186af3d38c31b9a6d (patch)
tree8f63928743d5383254bb934f58f3369c0492007e /OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
parentstarting to refactor path generation out of prim extrusion (diff)
downloadopensim-SC-9ffe4d850e9ccf2fc40901e186af3d38c31b9a6d.zip
opensim-SC-9ffe4d850e9ccf2fc40901e186af3d38c31b9a6d.tar.gz
opensim-SC-9ffe4d850e9ccf2fc40901e186af3d38c31b9a6d.tar.bz2
opensim-SC-9ffe4d850e9ccf2fc40901e186af3d38c31b9a6d.tar.xz
This change adds support for the attach event in scripts.
[1] Added a new OnAttach event to Scene/EventManager [2] Hooked up existing attach event handler in XEngine. [3] Modified SceneGraph and Scene.Inventory to trigger attach events at the appropriate places. I was forced to distribut the changes across two files because of the way attach processing is distributed across the two files. [4] In the case of RezSingleAttachmentFromInventory it is necessary to handle event scheduling in a special way. There is no synchronous path available, so the fact that this object is attached, and who it is attached to, is cached when the ScriptInstance is created. When the script is started, the attached handler is driven after on_rez (but before changed, this should be reviewed). Signed-off-by: dr scofield (aka dirk husemann) <drscofield@xyzzyxyzzy.net>
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs16
1 files changed, 16 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 42d61a7..586f926 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -89,6 +89,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
89 private long m_eventDelayTicks = 0; 89 private long m_eventDelayTicks = 0;
90 private long m_nextEventTimeTicks = 0; 90 private long m_nextEventTimeTicks = 0;
91 private bool m_startOnInit = true; 91 private bool m_startOnInit = true;
92 private bool m_isAttachment = false;
93 private UUID m_attachedAvatar = UUID.Zero;
92 private StateSource m_stateSource; 94 private StateSource m_stateSource;
93 private bool m_postOnRez; 95 private bool m_postOnRez;
94 private bool m_startedFromSavedState = false; 96 private bool m_startedFromSavedState = false;
@@ -232,6 +234,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
232 m_MaxScriptQueue = maxScriptQueue; 234 m_MaxScriptQueue = maxScriptQueue;
233 m_stateSource = stateSource; 235 m_stateSource = stateSource;
234 m_postOnRez = postOnRez; 236 m_postOnRez = postOnRez;
237 m_isAttachment = part.IsAttachment;
238 m_attachedAvatar = part.AttachedAvatar;
235 m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID; 239 m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID;
236 240
237 if (part != null) 241 if (part != null)
@@ -379,6 +383,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
379 new Object[] {new LSL_Types.LSLInteger(m_StartParam)}, new DetectParams[0])); 383 new Object[] {new LSL_Types.LSLInteger(m_StartParam)}, new DetectParams[0]));
380 } 384 }
381 385
386 if (m_isAttachment)
387 {
388 PostEvent(new EventParams("attach",
389 new object[] { new LSL_Types.LSLString(m_attachedAvatar.ToString()) }, new DetectParams[0]));
390 }
391
382 if (m_stateSource == StateSource.NewRez) 392 if (m_stateSource == StateSource.NewRez)
383 { 393 {
384// m_log.Debug("[Script] Posted changed(CHANGED_REGION_RESTART) to script"); 394// m_log.Debug("[Script] Posted changed(CHANGED_REGION_RESTART) to script");
@@ -403,6 +413,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
403 new Object[] {new LSL_Types.LSLInteger(m_StartParam)}, new DetectParams[0])); 413 new Object[] {new LSL_Types.LSLInteger(m_StartParam)}, new DetectParams[0]));
404 } 414 }
405 415
416 if (m_isAttachment)
417 {
418 PostEvent(new EventParams("attach",
419 new object[] { new LSL_Types.LSLString(m_attachedAvatar.ToString()) }, new DetectParams[0]));
420 }
421
406 } 422 }
407 } 423 }
408 424