aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs15
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/EventManager.cs1
6 files changed, 43 insertions, 4 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 4b3e45f..086496e 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -298,6 +298,13 @@ namespace OpenSim.Region.Framework.Scenes
298 public delegate void EmptyScriptCompileQueue(int numScriptsFailed, string message); 298 public delegate void EmptyScriptCompileQueue(int numScriptsFailed, string message);
299 public event EmptyScriptCompileQueue OnEmptyScriptCompileQueue; 299 public event EmptyScriptCompileQueue OnEmptyScriptCompileQueue;
300 300
301 /// <summary>
302 /// Called whenever an object is attached, or detached
303 /// from an in-world presence.
304 /// </summary>
305 public delegate void Attach(uint localID, UUID itemID, UUID avatarID);
306 public event Attach OnAttach;
307
301 public class MoneyTransferArgs : EventArgs 308 public class MoneyTransferArgs : EventArgs
302 { 309 {
303 public UUID sender; 310 public UUID sender;
@@ -438,6 +445,15 @@ namespace OpenSim.Region.Framework.Scenes
438 445
439 private EmptyScriptCompileQueue handlerEmptyScriptCompileQueue = null; 446 private EmptyScriptCompileQueue handlerEmptyScriptCompileQueue = null;
440 447
448 private Attach handlerOnAttach = null;
449
450 public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID)
451 {
452 handlerOnAttach = OnAttach;
453 if (handlerOnAttach != null)
454 handlerOnAttach(localID, itemID, avatarID);
455 }
456
441 public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) 457 public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)
442 { 458 {
443 handlerGetScriptRunning = OnGetScriptRunning; 459 handlerGetScriptRunning = OnGetScriptRunning;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 15009a3..facd301 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -2574,6 +2574,11 @@ namespace OpenSim.Region.Framework.Scenes
2574 EventManager.TriggerStopScript(part.LocalId, itemID); 2574 EventManager.TriggerStopScript(part.LocalId, itemID);
2575 } 2575 }
2576 2576
2577 internal void SendAttachEvent(uint localID, UUID itemID, UUID avatarID)
2578 {
2579 EventManager.TriggerOnAttach(localID, itemID, avatarID);
2580 }
2581
2577 public UUID RezSingleAttachment(IClientAPI remoteClient, UUID itemID, 2582 public UUID RezSingleAttachment(IClientAPI remoteClient, UUID itemID,
2578 uint AttachmentPt) 2583 uint AttachmentPt)
2579 { 2584 {
@@ -2684,6 +2689,7 @@ namespace OpenSim.Region.Framework.Scenes
2684 remoteClient.SendRemoveInventoryItem(inventoryID); 2689 remoteClient.SendRemoveInventoryItem(inventoryID);
2685 } 2690 }
2686 } 2691 }
2692 SendAttachEvent(part.ParentGroup.LocalId, itemID, UUID.Zero);
2687 } 2693 }
2688 2694
2689 public void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient) 2695 public void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient)
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 3f63481..0e0999a 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -489,6 +489,7 @@ namespace OpenSim.Region.Framework.Scenes
489 // Calls attach with a Zero position 489 // Calls attach with a Zero position
490 // 490 //
491 AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false); 491 AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false);
492 m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromAssetID(), remoteClient.AgentId);
492 } 493 }
493 494
494 public SceneObjectGroup RezSingleAttachment( 495 public SceneObjectGroup RezSingleAttachment(
@@ -511,8 +512,8 @@ namespace OpenSim.Region.Framework.Scenes
511 objatt.HasGroupChanged = true; 512 objatt.HasGroupChanged = true;
512 513
513 // Fire after attach, so we don't get messy perms dialogs 514 // Fire after attach, so we don't get messy perms dialogs
514 // 515 // 3 == AttachedRez
515 objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 0); 516 objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3);
516 } 517 }
517 return objatt; 518 return objatt;
518 } 519 }
@@ -537,6 +538,7 @@ namespace OpenSim.Region.Framework.Scenes
537 group = (SceneObjectGroup)entity; 538 group = (SceneObjectGroup)entity;
538 if (group.GetFromAssetID() == itemID) 539 if (group.GetFromAssetID() == itemID)
539 { 540 {
541 m_parentScene.SendAttachEvent(group.LocalId, itemID, UUID.Zero);
540 group.DetachToInventoryPrep(); 542 group.DetachToInventoryPrep();
541 m_log.Debug("[DETACH]: Saving attachpoint: " + 543 m_log.Debug("[DETACH]: Saving attachpoint: " +
542 ((uint)group.GetAttachmentPoint()).ToString()); 544 ((uint)group.GetAttachmentPoint()).ToString());
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
index c2fce2f..f49aea8 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
@@ -40,7 +40,8 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
40 { 40 {
41 NewRez = 0, 41 NewRez = 0,
42 PrimCrossing = 1, 42 PrimCrossing = 1,
43 ScriptedRez = 2 43 ScriptedRez = 2,
44 AttachedRez = 3
44 } 45 }
45 46
46 public interface IScriptWorkItem 47 public interface IScriptWorkItem
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 42d61a7..8168300 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -89,6 +89,7 @@ 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 UUID m_AttachedAvatar = UUID.Zero;
92 private StateSource m_stateSource; 93 private StateSource m_stateSource;
93 private bool m_postOnRez; 94 private bool m_postOnRez;
94 private bool m_startedFromSavedState = false; 95 private bool m_startedFromSavedState = false;
@@ -232,6 +233,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
232 m_MaxScriptQueue = maxScriptQueue; 233 m_MaxScriptQueue = maxScriptQueue;
233 m_stateSource = stateSource; 234 m_stateSource = stateSource;
234 m_postOnRez = postOnRez; 235 m_postOnRez = postOnRez;
236 m_AttachedAvatar = part.AttachedAvatar;
235 m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID; 237 m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID;
236 238
237 if (part != null) 239 if (part != null)
@@ -379,7 +381,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
379 new Object[] {new LSL_Types.LSLInteger(m_StartParam)}, new DetectParams[0])); 381 new Object[] {new LSL_Types.LSLInteger(m_StartParam)}, new DetectParams[0]));
380 } 382 }
381 383
382 if (m_stateSource == StateSource.NewRez) 384 if (m_stateSource == StateSource.AttachedRez)
385 {
386 PostEvent(new EventParams("attach",
387 new object[] { new LSL_Types.LSLString(m_AttachedAvatar.ToString()) }, new DetectParams[0]));
388 }
389 else if (m_stateSource == StateSource.NewRez)
383 { 390 {
384// m_log.Debug("[Script] Posted changed(CHANGED_REGION_RESTART) to script"); 391// m_log.Debug("[Script] Posted changed(CHANGED_REGION_RESTART) to script");
385 PostEvent(new EventParams("changed", 392 PostEvent(new EventParams("changed",
@@ -403,6 +410,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
403 new Object[] {new LSL_Types.LSLInteger(m_StartParam)}, new DetectParams[0])); 410 new Object[] {new LSL_Types.LSLInteger(m_StartParam)}, new DetectParams[0]));
404 } 411 }
405 412
413 if (m_stateSource == StateSource.AttachedRez)
414 {
415 PostEvent(new EventParams("attach",
416 new object[] { new LSL_Types.LSLString(m_AttachedAvatar.ToString()) }, new DetectParams[0]));
417 }
418
406 } 419 }
407 } 420 }
408 421
diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
index 3b9ff2e..7142c8c 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
@@ -53,6 +53,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
53 myScriptEngine = _ScriptEngine; 53 myScriptEngine = _ScriptEngine;
54 54
55 m_log.Info("[XEngine] Hooking up to server events"); 55 m_log.Info("[XEngine] Hooking up to server events");
56 myScriptEngine.World.EventManager.OnAttach += attach;
56 myScriptEngine.World.EventManager.OnObjectGrab += touch_start; 57 myScriptEngine.World.EventManager.OnObjectGrab += touch_start;
57 myScriptEngine.World.EventManager.OnObjectDeGrab += touch_end; 58 myScriptEngine.World.EventManager.OnObjectDeGrab += touch_end;
58 myScriptEngine.World.EventManager.OnScriptChangedEvent += changed; 59 myScriptEngine.World.EventManager.OnScriptChangedEvent += changed;