From 14e62c096d571a47abffd1a954c1a949300f156c Mon Sep 17 00:00:00 2001 From: Revolution Date: Thu, 21 Jan 2010 18:12:40 -0600 Subject: Fixes llSetDamage. Patch from Revolution --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 8545425..39a2c65 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3236,17 +3236,15 @@ namespace OpenSim.Region.Framework.Scenes uint killerObj = 0; foreach (uint localid in coldata.Keys) { - if (coldata[localid].PenetrationDepth <= 0.10f || m_invulnerable) - continue; - //if (localid == 0) - //continue; - - SceneObjectPart part = m_scene.GetSceneObjectPart(localid); + SceneObjectPart part = Scene.GetSceneObjectPart(localid); if (part != null && part.ParentGroup.Damage != -1.0f) Health -= part.ParentGroup.Damage; else - Health -= coldata[localid].PenetrationDepth * 5.0f; + { + if (coldata[localid].PenetrationDepth >= 0.10f) + Health -= coldata[localid].PenetrationDepth * 5.0f; + } if (Health <= 0.0f) { -- cgit v1.1 From e61f42ad3a4a315d4eb56107bb6ead7092035bff Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 21 Jan 2010 23:59:04 -0800 Subject: add a target position to agent updates to ScenePresence to support alternative client protocols --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 39a2c65..1c183f3 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1276,6 +1276,12 @@ namespace OpenSim.Region.Framework.Scenes if (m_allowMovement) { + if (agentData.UseClientAgentPosition) + { + m_moveToPositionInProgress = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f; + m_moveToPositionTarget = agentData.ClientAgentPosition; + } + int i = 0; bool update_rotation = false; @@ -1382,7 +1388,7 @@ namespace OpenSim.Region.Framework.Scenes if (bAllowUpdateMoveToPosition && (m_moveToPositionInProgress && !m_autopilotMoving)) { //Check the error term of the current position in relation to the target position - if (Util.GetDistanceTo(AbsolutePosition, m_moveToPositionTarget) <= 1.5f) + if (Util.GetDistanceTo(AbsolutePosition, m_moveToPositionTarget) <= 0.5f) { // we are close enough to the target m_moveToPositionTarget = Vector3.Zero; -- cgit v1.1 From ec3c31e61e5e540f822891110df9bc978655bbaf Mon Sep 17 00:00:00 2001 From: Revolution Date: Fri, 22 Jan 2010 18:09:33 -0600 Subject: Updates all IRegionModules to the new style region modules. Signed-off-by: Melanie --- OpenSim/Region/Framework/Interfaces/ICloudModule.cs | 2 +- OpenSim/Region/Framework/Interfaces/IEmailModule.cs | 2 +- OpenSim/Region/Framework/Interfaces/IEstateModule.cs | 2 +- OpenSim/Region/Framework/Interfaces/ISunModule.cs | 2 +- OpenSim/Region/Framework/Interfaces/IWindModule.cs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/ICloudModule.cs b/OpenSim/Region/Framework/Interfaces/ICloudModule.cs index f8a5bad..879114b 100644 --- a/OpenSim/Region/Framework/Interfaces/ICloudModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ICloudModule.cs @@ -28,7 +28,7 @@ namespace OpenSim.Region.Framework.Interfaces { - public interface ICloudModule : IRegionModule + public interface ICloudModule : INonSharedRegionModule { /// /// Retrieves the cloud density at the given region coordinates diff --git a/OpenSim/Region/Framework/Interfaces/IEmailModule.cs b/OpenSim/Region/Framework/Interfaces/IEmailModule.cs index 3a2c423..bdad0b4 100644 --- a/OpenSim/Region/Framework/Interfaces/IEmailModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEmailModule.cs @@ -38,7 +38,7 @@ namespace OpenSim.Region.Framework.Interfaces public int numLeft; } - public interface IEmailModule : IRegionModule + public interface IEmailModule : ISharedRegionModule { void SendEmail(UUID objectID, string address, string subject, string body); Email GetNextEmail(UUID objectID, string sender, string subject); diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs index 890fa31..347818c 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs @@ -29,7 +29,7 @@ using OpenMetaverse; namespace OpenSim.Region.Framework.Interfaces { - public interface IEstateModule : IRegionModule + public interface IEstateModule : INonSharedRegionModule { uint GetRegionFlags(); bool IsManager(UUID avatarID); diff --git a/OpenSim/Region/Framework/Interfaces/ISunModule.cs b/OpenSim/Region/Framework/Interfaces/ISunModule.cs index 819ae11..8231716 100644 --- a/OpenSim/Region/Framework/Interfaces/ISunModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ISunModule.cs @@ -29,7 +29,7 @@ using OpenMetaverse; namespace OpenSim.Region.Framework.Interfaces { - public interface ISunModule : IRegionModule + public interface ISunModule : INonSharedRegionModule { double GetSunParameter(string param); diff --git a/OpenSim/Region/Framework/Interfaces/IWindModule.cs b/OpenSim/Region/Framework/Interfaces/IWindModule.cs index 10ecc32..4a26a71 100644 --- a/OpenSim/Region/Framework/Interfaces/IWindModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IWindModule.cs @@ -29,7 +29,7 @@ using OpenMetaverse; namespace OpenSim.Region.Framework.Interfaces { - public interface IWindModule : IRegionModule + public interface IWindModule : INonSharedRegionModule { /// -- cgit v1.1 From fe06f0dd05fa783a6d3d7e7aa2b5614c9825e8fe Mon Sep 17 00:00:00 2001 From: Revolution Date: Sat, 23 Jan 2010 20:29:02 -0600 Subject: Fixes Region Crossings on a prim. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 1c183f3..5562e51 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2779,7 +2779,15 @@ namespace OpenSim.Region.Framework.Scenes protected void CrossToNewRegion() { InTransit(); - m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying); + try + { + m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying); + } + catch(Exception ex) + { + m_scene.CrossAgentToNewRegion(this, false); + } + } public void InTransit() -- cgit v1.1 From 38cfc9366ce264d2aeb6409df48be7cecc348952 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 25 Jan 2010 21:51:58 +0000 Subject: Fix a problem where llDie() calls were sometimes leaving dead objects behind. When an object was deleted, the remove script instance call was aggregating the scripting events as normal. This would queue a full update of the prim before the viewer was notifed of the deletion of that prim (QuitPacket) On some occasions, the QuitPacket would be sent before the full update was dequeued and sent. In principle, you would think that a viewer would ignore updates for deleted prims. But it appears that in the Linden viewer (1.23.5), a prim update that arrives after the prim was deleted instead makes the deleted prim persist in the viewer. Such prims have no properties and cannot be removed from the viewer except by a relog. This change stops the prim event aggregation call if it's being deleted anyway, hence removing the spurious viewer-confusing update. --- .../Region/Framework/Interfaces/IEntityInventory.cs | 12 ++++++++++-- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 4 +++- OpenSim/Region/Framework/Scenes/Scene.cs | 8 ++++++-- .../Framework/Scenes/SceneObjectGroup.Inventory.cs | 8 ++++++-- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 12 +++++++++++- .../Framework/Scenes/SceneObjectPartInventory.cs | 21 ++++++++++++++++----- 6 files changed, 52 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index 67395fa..eeb5102 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs @@ -77,7 +77,11 @@ namespace OpenSim.Region.Framework.Interfaces /// /// Stop all the scripts in this entity. /// - void RemoveScriptInstances(); + /// + /// Should be true if these scripts are being removed because the scene + /// object is being deleted. This will prevent spurious updates to the client. + /// + void RemoveScriptInstances(bool sceneObjectBeingDeleted); /// /// Start a script which is in this entity's inventory. @@ -103,7 +107,11 @@ namespace OpenSim.Region.Framework.Interfaces /// Stop a script which is in this prim's inventory. /// /// - void RemoveScriptInstance(UUID itemId); + /// + /// Should be true if these scripts are being removed because the scene + /// object is being deleted. This will prevent spurious updates to the client. + /// + void RemoveScriptInstance(UUID itemId, bool sceneObjectBeingDeleted); /// /// Add an item to this entity's inventory. If an item with the same name already exists, then an alternative diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 3044017..11754ea 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -256,7 +256,7 @@ namespace OpenSim.Region.Framework.Scenes if (isScriptRunning) { - part.Inventory.RemoveScriptInstance(item.ItemID); + part.Inventory.RemoveScriptInstance(item.ItemID, false); } // Update item with new asset @@ -855,8 +855,10 @@ namespace OpenSim.Region.Framework.Scenes if (item.Type == 10) { + part.RemoveScriptEvents(itemID); EventManager.TriggerRemoveScript(localID, itemID); } + group.RemoveInventoryItem(localID, itemID); part.GetProperties(remoteClient); } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 234554e..4da05cf 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1009,7 +1009,7 @@ namespace OpenSim.Region.Framework.Scenes { if (ent is SceneObjectGroup) { - ((SceneObjectGroup) ent).RemoveScriptInstances(); + ((SceneObjectGroup) ent).RemoveScriptInstances(false); } } } @@ -1884,13 +1884,15 @@ namespace OpenSim.Region.Framework.Scenes /// Suppress broadcasting changes to other clients. public void DeleteSceneObject(SceneObjectGroup group, bool silent) { +// m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID); + //SceneObjectPart rootPart = group.GetChildPart(group.UUID); // Serialise calls to RemoveScriptInstances to avoid // deadlocking on m_parts inside SceneObjectGroup lock (m_deleting_scene_object) { - group.RemoveScriptInstances(); + group.RemoveScriptInstances(true); } foreach (SceneObjectPart part in group.Children.Values) @@ -1918,6 +1920,8 @@ namespace OpenSim.Region.Framework.Scenes } group.DeleteGroup(silent); + +// m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); } /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 5a06bdb..71354b4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs @@ -74,13 +74,17 @@ namespace OpenSim.Region.Framework.Scenes /// /// Stop the scripts contained in all the prims in this group /// - public void RemoveScriptInstances() + /// + /// Should be true if these scripts are being removed because the scene + /// object is being deleted. This will prevent spurious updates to the client. + /// + public void RemoveScriptInstances(bool sceneObjectBeingDeleted) { lock (m_parts) { foreach (SceneObjectPart part in m_parts.Values) { - part.Inventory.RemoveScriptInstances(); + part.Inventory.RemoveScriptInstances(sceneObjectBeingDeleted); } } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 56b2f13..a5296eb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2479,7 +2479,7 @@ namespace OpenSim.Region.Framework.Scenes //m_log.Debug("prev: " + prevflag.ToString() + " curr: " + Flags.ToString()); //ScheduleFullUpdate(); } - + public void RemoveScriptEvents(UUID scriptid) { lock (m_scriptEvents) @@ -2533,6 +2533,8 @@ namespace OpenSim.Region.Framework.Scenes /// public void ScheduleFullUpdate() { +// m_log.DebugFormat("[SCENE OBJECT PART]: Scheduling full update for {0} {1}", Name, LocalId); + if (m_parentGroup != null) { m_parentGroup.QueueForUpdateCheck(); @@ -4042,6 +4044,8 @@ namespace OpenSim.Region.Framework.Scenes if (m_parentGroup == null) { +// m_log.DebugFormat( +// "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents() since m_parentGroup == null", Name, LocalId); ScheduleFullUpdate(); return; } @@ -4058,9 +4062,15 @@ namespace OpenSim.Region.Framework.Scenes LocalFlags=(PrimFlags)objectflagupdate; if (m_parentGroup != null && m_parentGroup.RootPart == this) + { m_parentGroup.aggregateScriptEvents(); + } else + { +// m_log.DebugFormat( +// "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId); ScheduleFullUpdate(); + } } public int registerTargetWaypoint(Vector3 target, float tolerance) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index eb7f5ff..5f13278 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -230,7 +230,11 @@ namespace OpenSim.Region.Framework.Scenes /// /// Stop all the scripts in this prim. /// - public void RemoveScriptInstances() + /// + /// Should be true if these scripts are being removed because the scene + /// object is being deleted. This will prevent spurious updates to the client. + /// + public void RemoveScriptInstances(bool sceneObjectBeingDeleted) { lock (Items) { @@ -238,8 +242,7 @@ namespace OpenSim.Region.Framework.Scenes { if ((int)InventoryType.LSL == item.InvType) { - RemoveScriptInstance(item.ItemID); - m_part.RemoveScriptEvents(item.ItemID); + RemoveScriptInstance(item.ItemID, sceneObjectBeingDeleted); } } } @@ -388,10 +391,17 @@ namespace OpenSim.Region.Framework.Scenes /// Stop a script which is in this prim's inventory. /// /// - public void RemoveScriptInstance(UUID itemId) + /// + /// Should be true if this script is being removed because the scene + /// object is being deleted. This will prevent spurious updates to the client. + /// + public void RemoveScriptInstance(UUID itemId, bool sceneObjectBeingDeleted) { if (m_items.ContainsKey(itemId)) { + if (!sceneObjectBeingDeleted) + m_part.RemoveScriptEvents(itemId); + m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemId); m_part.ParentGroup.AddActiveScriptCount(-1); } @@ -465,7 +475,7 @@ namespace OpenSim.Region.Framework.Scenes if (i.Name == item.Name) { if (i.InvType == (int)InventoryType.LSL) - RemoveScriptInstance(i.ItemID); + RemoveScriptInstance(i.ItemID, false); RemoveInventoryItem(i.ItemID); break; @@ -613,6 +623,7 @@ namespace OpenSim.Region.Framework.Scenes int type = m_items[itemID].InvType; if (type == 10) // Script { + m_part.RemoveScriptEvents(itemID); m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID); } m_items.Remove(itemID); -- cgit v1.1 From 72dd680dd3808f0222bb4cba0c9989c5bbb00287 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 26 Jan 2010 14:46:53 +0000 Subject: Replace dome tabs with spaces --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 5562e51..e26283d 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2781,11 +2781,11 @@ namespace OpenSim.Region.Framework.Scenes InTransit(); try { - m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying); + m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying); } catch(Exception ex) { - m_scene.CrossAgentToNewRegion(this, false); + m_scene.CrossAgentToNewRegion(this, false); } } @@ -3860,4 +3860,4 @@ namespace OpenSim.Region.Framework.Scenes } } } -} \ No newline at end of file +} -- cgit v1.1 From a87a247f0548d39a8c39b1d28123d7da8db44598 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 29 Jan 2010 07:20:13 +0000 Subject: Revert "Updates all IRegionModules to the new style region modules." This reverts commit ec3c31e61e5e540f822891110df9bc978655bbaf. --- OpenSim/Region/Framework/Interfaces/ICloudModule.cs | 2 +- OpenSim/Region/Framework/Interfaces/IEmailModule.cs | 2 +- OpenSim/Region/Framework/Interfaces/IEstateModule.cs | 2 +- OpenSim/Region/Framework/Interfaces/ISunModule.cs | 2 +- OpenSim/Region/Framework/Interfaces/IWindModule.cs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/ICloudModule.cs b/OpenSim/Region/Framework/Interfaces/ICloudModule.cs index 879114b..f8a5bad 100644 --- a/OpenSim/Region/Framework/Interfaces/ICloudModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ICloudModule.cs @@ -28,7 +28,7 @@ namespace OpenSim.Region.Framework.Interfaces { - public interface ICloudModule : INonSharedRegionModule + public interface ICloudModule : IRegionModule { /// /// Retrieves the cloud density at the given region coordinates diff --git a/OpenSim/Region/Framework/Interfaces/IEmailModule.cs b/OpenSim/Region/Framework/Interfaces/IEmailModule.cs index bdad0b4..3a2c423 100644 --- a/OpenSim/Region/Framework/Interfaces/IEmailModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEmailModule.cs @@ -38,7 +38,7 @@ namespace OpenSim.Region.Framework.Interfaces public int numLeft; } - public interface IEmailModule : ISharedRegionModule + public interface IEmailModule : IRegionModule { void SendEmail(UUID objectID, string address, string subject, string body); Email GetNextEmail(UUID objectID, string sender, string subject); diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs index 347818c..890fa31 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs @@ -29,7 +29,7 @@ using OpenMetaverse; namespace OpenSim.Region.Framework.Interfaces { - public interface IEstateModule : INonSharedRegionModule + public interface IEstateModule : IRegionModule { uint GetRegionFlags(); bool IsManager(UUID avatarID); diff --git a/OpenSim/Region/Framework/Interfaces/ISunModule.cs b/OpenSim/Region/Framework/Interfaces/ISunModule.cs index 8231716..819ae11 100644 --- a/OpenSim/Region/Framework/Interfaces/ISunModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ISunModule.cs @@ -29,7 +29,7 @@ using OpenMetaverse; namespace OpenSim.Region.Framework.Interfaces { - public interface ISunModule : INonSharedRegionModule + public interface ISunModule : IRegionModule { double GetSunParameter(string param); diff --git a/OpenSim/Region/Framework/Interfaces/IWindModule.cs b/OpenSim/Region/Framework/Interfaces/IWindModule.cs index 4a26a71..10ecc32 100644 --- a/OpenSim/Region/Framework/Interfaces/IWindModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IWindModule.cs @@ -29,7 +29,7 @@ using OpenMetaverse; namespace OpenSim.Region.Framework.Interfaces { - public interface IWindModule : INonSharedRegionModule + public interface IWindModule : IRegionModule { /// -- cgit v1.1 From ae2174d8f526b225c3cccf551f1a9f01d6569203 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 29 Jan 2010 18:11:53 +0000 Subject: Add method to get all items with the same name from a particular prim Extend load oar test to check loading of a sound item --- .../Framework/Interfaces/IEntityInventory.cs | 13 ++++++++++- .../Framework/Scenes/SceneObjectPartInventory.cs | 26 +++++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index eeb5102..fa9bf19 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs @@ -71,7 +71,8 @@ namespace OpenSim.Region.Framework.Interfaces /// /// Start all the scripts contained in this entity's inventory /// - void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource); + void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource); + ArrayList GetScriptErrors(UUID itemID); /// @@ -143,6 +144,16 @@ namespace OpenSim.Region.Framework.Interfaces TaskInventoryItem GetInventoryItem(UUID itemId); /// + /// Get inventory items by name. + /// + /// + /// + /// A list of inventory items with that name. + /// If no inventory item has that name then an empty list is returned. + /// + IList GetInventoryItems(string name); + + /// /// Update an existing inventory item. /// /// The updated item. An item with the same id must already exist diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 5f13278..b37e1a2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -554,8 +554,32 @@ namespace OpenSim.Region.Framework.Scenes m_items.TryGetValue(itemId, out item); return item; - } + } + + /// + /// Get inventory items by name. + /// + /// + /// + /// A list of inventory items with that name. + /// If no inventory item has that name then an empty list is returned. + /// + public IList GetInventoryItems(string name) + { + IList items = new List(); + lock (m_items) + { + foreach (TaskInventoryItem item in m_items.Values) + { + if (item.Name == name) + items.Add(item); + } + } + + return items; + } + /// /// Update an existing inventory item. /// -- cgit v1.1 From 968b9e160d70568fbdea5b190d1386e9431316e3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 29 Jan 2010 20:36:13 +0000 Subject: improve locking of m_items in SceneObjectPartInventory --- .../Framework/Scenes/SceneObjectPartInventory.cs | 218 +++++++++++++-------- 1 file changed, 133 insertions(+), 85 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index b37e1a2..87c1a95 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -44,6 +44,8 @@ namespace OpenSim.Region.Framework.Scenes { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + static System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); + private string m_inventoryFileName = String.Empty; private int m_inventoryFileNameSerial = 0; @@ -270,8 +272,12 @@ namespace OpenSim.Region.Framework.Scenes if (stateSource == 1 && // Prim crossing m_part.ParentGroup.Scene.m_trustBinaries) { - m_items[item.ItemID].PermsMask = 0; - m_items[item.ItemID].PermsGranter = UUID.Zero; + lock (m_items) + { + m_items[item.ItemID].PermsMask = 0; + m_items[item.ItemID].PermsGranter = UUID.Zero; + } + m_part.ParentGroup.Scene.EventManager.TriggerRezScript( m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource); m_part.ParentGroup.AddActiveScriptCount(1); @@ -279,33 +285,38 @@ namespace OpenSim.Region.Framework.Scenes return; } - m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString(), this, delegate(string id, object sender, AssetBase asset) - { - if (null == asset) - { - m_log.ErrorFormat( - "[PRIM INVENTORY]: " + - "Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found", - item.Name, item.ItemID, m_part.AbsolutePosition, - m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID); - } - else - { - if (m_part.ParentGroup.m_savedScriptState != null) - RestoreSavedScriptState(item.OldItemID, item.ItemID); - m_items[item.ItemID].PermsMask = 0; - m_items[item.ItemID].PermsGranter = UUID.Zero; - string script = Utils.BytesToString(asset.Data); - m_part.ParentGroup.Scene.EventManager.TriggerRezScript( - m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); - m_part.ParentGroup.AddActiveScriptCount(1); - m_part.ScheduleFullUpdate(); - } - }); - } - } + m_part.ParentGroup.Scene.AssetService.Get( + item.AssetID.ToString(), this, delegate(string id, object sender, AssetBase asset) + { + if (null == asset) + { + m_log.ErrorFormat( + "[PRIM INVENTORY]: " + + "Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found", + item.Name, item.ItemID, m_part.AbsolutePosition, + m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID); + } + else + { + if (m_part.ParentGroup.m_savedScriptState != null) + RestoreSavedScriptState(item.OldItemID, item.ItemID); - static System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); + lock (m_items) + { + m_items[item.ItemID].PermsMask = 0; + m_items[item.ItemID].PermsGranter = UUID.Zero; + } + + string script = Utils.BytesToString(asset.Data); + m_part.ParentGroup.Scene.EventManager.TriggerRezScript( + m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); + m_part.ParentGroup.AddActiveScriptCount(1); + m_part.ScheduleFullUpdate(); + } + } + ); + } + } private void RestoreSavedScriptState(UUID oldID, UUID newID) { @@ -397,7 +408,15 @@ namespace OpenSim.Region.Framework.Scenes /// public void RemoveScriptInstance(UUID itemId, bool sceneObjectBeingDeleted) { - if (m_items.ContainsKey(itemId)) + bool scriptPresent = false; + + lock (m_items) + { + if (m_items.ContainsKey(itemId)) + scriptPresent = true; + } + + if (scriptPresent) { if (!sceneObjectBeingDeleted) m_part.RemoveScriptEvents(itemId); @@ -469,7 +488,13 @@ namespace OpenSim.Region.Framework.Scenes /// public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop) { - List il = new List(m_items.Values); + List il; + + lock (m_items) + { + il = new List(m_items.Values); + } + foreach (TaskInventoryItem i in il) { if (i.Name == item.Name) @@ -551,7 +576,9 @@ namespace OpenSim.Region.Framework.Scenes public TaskInventoryItem GetInventoryItem(UUID itemId) { TaskInventoryItem item; - m_items.TryGetValue(itemId, out item); + + lock (m_items) + m_items.TryGetValue(itemId, out item); return item; } @@ -877,54 +904,61 @@ namespace OpenSim.Region.Framework.Scenes { uint mask=0x7fffffff; - foreach (TaskInventoryItem item in m_items.Values) + lock (m_items) { - if (item.InvType != (int)InventoryType.Object) - { - if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0) - mask &= ~((uint)PermissionMask.Copy >> 13); - if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0) - mask &= ~((uint)PermissionMask.Transfer >> 13); - if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0) - mask &= ~((uint)PermissionMask.Modify >> 13); - } - else + foreach (TaskInventoryItem item in m_items.Values) { - if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) - mask &= ~((uint)PermissionMask.Copy >> 13); - if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) - mask &= ~((uint)PermissionMask.Transfer >> 13); - if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) - mask &= ~((uint)PermissionMask.Modify >> 13); + if (item.InvType != (int)InventoryType.Object) + { + if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0) + mask &= ~((uint)PermissionMask.Copy >> 13); + if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0) + mask &= ~((uint)PermissionMask.Transfer >> 13); + if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0) + mask &= ~((uint)PermissionMask.Modify >> 13); + } + else + { + if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) + mask &= ~((uint)PermissionMask.Copy >> 13); + if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) + mask &= ~((uint)PermissionMask.Transfer >> 13); + if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) + mask &= ~((uint)PermissionMask.Modify >> 13); + } + + if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) + mask &= ~(uint)PermissionMask.Copy; + if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) + mask &= ~(uint)PermissionMask.Transfer; + if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0) + mask &= ~(uint)PermissionMask.Modify; } - - if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) - mask &= ~(uint)PermissionMask.Copy; - if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) - mask &= ~(uint)PermissionMask.Transfer; - if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0) - mask &= ~(uint)PermissionMask.Modify; } + return mask; } public void ApplyNextOwnerPermissions() { - foreach (TaskInventoryItem item in m_items.Values) + lock (m_items) { - if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) + foreach (TaskInventoryItem item in m_items.Values) { - if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) - item.CurrentPermissions &= ~(uint)PermissionMask.Copy; - if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) - item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; - if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) - item.CurrentPermissions &= ~(uint)PermissionMask.Modify; - item.CurrentPermissions |= 8; + if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) + { + if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) + item.CurrentPermissions &= ~(uint)PermissionMask.Copy; + if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) + item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; + if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) + item.CurrentPermissions &= ~(uint)PermissionMask.Modify; + item.CurrentPermissions |= 8; + } + item.CurrentPermissions &= item.NextPermissions; + item.BasePermissions &= item.NextPermissions; + item.EveryonePermissions &= item.NextPermissions; } - item.CurrentPermissions &= item.NextPermissions; - item.BasePermissions &= item.NextPermissions; - item.EveryonePermissions &= item.NextPermissions; } m_part.TriggerScriptChangedEvent(Changed.OWNER); @@ -932,22 +966,29 @@ namespace OpenSim.Region.Framework.Scenes public void ApplyGodPermissions(uint perms) { - foreach (TaskInventoryItem item in m_items.Values) + lock (m_items) { - item.CurrentPermissions = perms; - item.BasePermissions = perms; + foreach (TaskInventoryItem item in m_items.Values) + { + item.CurrentPermissions = perms; + item.BasePermissions = perms; + } } } public bool ContainsScripts() { - foreach (TaskInventoryItem item in m_items.Values) + lock (m_items) { - if (item.InvType == (int)InventoryType.LSL) + foreach (TaskInventoryItem item in m_items.Values) { - return true; + if (item.InvType == (int)InventoryType.LSL) + { + return true; + } } } + return false; } @@ -955,8 +996,11 @@ namespace OpenSim.Region.Framework.Scenes { List ret = new List(); - foreach (TaskInventoryItem item in m_items.Values) - ret.Add(item.ItemID); + lock (m_items) + { + foreach (TaskInventoryItem item in m_items.Values) + ret.Add(item.ItemID); + } return ret; } @@ -969,26 +1013,30 @@ namespace OpenSim.Region.Framework.Scenes if (engines == null) // No engine at all return ret; - foreach (TaskInventoryItem item in m_items.Values) + lock (m_items) { - if (item.InvType == (int)InventoryType.LSL) + foreach (TaskInventoryItem item in m_items.Values) { - foreach (IScriptModule e in engines) + if (item.InvType == (int)InventoryType.LSL) { - if (e != null) + foreach (IScriptModule e in engines) { - string n = e.GetXMLState(item.ItemID); - if (n != String.Empty) + if (e != null) { - if (!ret.ContainsKey(item.ItemID)) - ret[item.ItemID] = n; - break; + string n = e.GetXMLState(item.ItemID); + if (n != String.Empty) + { + if (!ret.ContainsKey(item.ItemID)) + ret[item.ItemID] = n; + break; + } } } } } } + return ret; } } -} +} \ No newline at end of file -- cgit v1.1 From 05a3e37b853fc870b83eb67b47bc70eb724f652e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 29 Jan 2010 23:12:08 +0000 Subject: Apply http://opensimulator.org/mantis/view.php?id=3334 Send continuous touch() events if the left mouse button is held down while moving over an object This conforms with Linden Lab practice Thanks Revolution --- OpenSim/Region/Framework/Scenes/EventManager.cs | 11 ++++++ .../Framework/Scenes/Scene.PacketHandlers.cs | 40 ++++++++++++++++++++++ OpenSim/Region/Framework/Scenes/Scene.cs | 1 + 3 files changed, 52 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 399379e..004ea1f 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -104,6 +104,7 @@ namespace OpenSim.Region.Framework.Scenes public event OnSetRootAgentSceneDelegate OnSetRootAgentScene; public event ObjectGrabDelegate OnObjectGrab; + public event ObjectGrabDelegate OnObjectGrabbing; public event ObjectDeGrabDelegate OnObjectDeGrab; public event ScriptResetDelegate OnScriptReset; @@ -408,6 +409,7 @@ namespace OpenSim.Region.Framework.Scenes private OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = null; //OnParcelPrimCountAdd; private OnShutdownDelegate handlerShutdown = null; //OnShutdown; private ObjectGrabDelegate handlerObjectGrab = null; //OnObjectGrab; + private ObjectGrabDelegate handlerObjectGrabbing = null; //OnObjectGrabbing; private ObjectDeGrabDelegate handlerObjectDeGrab = null; //OnObjectDeGrab; private ScriptResetDelegate handlerScriptReset = null; // OnScriptReset private NewRezScript handlerRezScript = null; //OnRezScript; @@ -620,6 +622,15 @@ namespace OpenSim.Region.Framework.Scenes } } + public void TriggerObjectGrabbing(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) + { + handlerObjectGrabbing = OnObjectGrabbing; + if (handlerObjectGrabbing != null) + { + handlerObjectGrabbing(localID, originalID, offsetPos, remoteClient, surfaceArgs); + } + } + public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) { handlerObjectDeGrab = OnObjectDeGrab; diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 47fbeb4..ac04dc7 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -292,6 +292,46 @@ namespace OpenSim.Region.Framework.Scenes } } + public virtual void ProcessObjectGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List surfaceArgs) + { + List EntityList = GetEntities(); + + SurfaceTouchEventArgs surfaceArg = null; + if (surfaceArgs != null && surfaceArgs.Count > 0) + surfaceArg = surfaceArgs[0]; + + foreach (EntityBase ent in EntityList) + { + if (ent is SceneObjectGroup) + { + SceneObjectGroup obj = ent as SceneObjectGroup; + if (obj != null) + { + // Is this prim part of the group + if (obj.HasChildPrim(objectID)) + { + SceneObjectPart part = obj.GetChildPart(objectID); + + // If the touched prim handles touches, deliver it + // If not, deliver to root prim + if ((part.ScriptEvents & scriptEvents.touch) != 0) + EventManager.TriggerObjectGrabbing(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg); + // Deliver to the root prim if the touched prim doesn't handle touches + // or if we're meant to pass on touches anyway. Don't send to root prim + // if prim touched is the root prim as we just did it + if (((part.ScriptEvents & scriptEvents.touch) == 0) || + (part.PassTouches && (part.LocalId != obj.RootPart.LocalId))) + { + EventManager.TriggerObjectGrabbing(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg); + } + + return; + } + } + } + } + } + public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List surfaceArgs) { List EntityList = GetEntities(); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4da05cf..73b0b3e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2675,6 +2675,7 @@ namespace OpenSim.Region.Framework.Scenes client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; client.OnObjectPermissions += HandleObjectPermissionsUpdate; client.OnGrabObject += ProcessObjectGrab; + client.OnGrabUpdate += ProcessObjectGrabUpdate; client.OnDeGrabObject += ProcessObjectDeGrab; client.OnUndo += m_sceneGraph.HandleUndo; client.OnObjectDescription += m_sceneGraph.PrimDescription; -- cgit v1.1 From 53a01dc42273b9252eb290187e87a47a898af86a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 1 Feb 2010 20:06:43 +0000 Subject: Don't try to start attachment scripts or send updates if the attachment itself has been unsuccessful --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 14 +++- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 77 +++++++++++++++------- 2 files changed, 64 insertions(+), 27 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 11754ea..7df3e50 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -2376,9 +2376,19 @@ namespace OpenSim.Region.Framework.Scenes } } - public void AttachObject(IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos, bool silent) + /// + /// Attach an object. + /// + /// + /// + /// + /// + /// + /// + /// true if the object was successfully attached, false otherwise + public bool AttachObject(IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos, bool silent) { - m_sceneGraph.AttachObject(controllingClient, localID, attachPoint, rot, pos, silent); + return m_sceneGraph.AttachObject(controllingClient, localID, attachPoint, rot, pos, silent); } public void AttachObject(IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att) diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index f74fd5d..fc2798d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -478,46 +478,59 @@ namespace OpenSim.Region.Framework.Scenes if (part == null) return; - if (!m_parentScene.Permissions.CanTakeObject( - part.UUID, remoteClient.AgentId)) + if (!m_parentScene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId)) return; // Calls attach with a Zero position - AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false); - m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); - - // Save avatar attachment information - ScenePresence presence; - if (m_parentScene.AvatarFactory != null && m_parentScene.TryGetAvatar(remoteClient.AgentId, out presence)) + if (AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false)) { - m_log.Info("[SCENE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId + ", AttachmentPoint: " + AttachmentPt); - m_parentScene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); + m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); + + // Save avatar attachment information + ScenePresence presence; + if (m_parentScene.AvatarFactory != null && m_parentScene.TryGetAvatar(remoteClient.AgentId, out presence)) + { + m_log.Info( + "[SCENE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId + + ", AttachmentPoint: " + AttachmentPt); + + m_parentScene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); + } } } - public SceneObjectGroup RezSingleAttachment( - IClientAPI remoteClient, UUID itemID, uint AttachmentPt) + /// + /// Rez an attachment + /// + /// + /// + /// + /// The scene object that was attached. Null if the scene object could not be found + public SceneObjectGroup RezSingleAttachment(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) { SceneObjectGroup objatt = m_parentScene.RezObject(remoteClient, itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, false, false, remoteClient.AgentId, true); - if (objatt != null) { bool tainted = false; if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) tainted = true; - AttachObject(remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false); - objatt.ScheduleGroupForFullUpdate(); - if (tainted) - objatt.HasGroupChanged = true; - - // Fire after attach, so we don't get messy perms dialogs - // 3 == AttachedRez - objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3); + if (AttachObject( + remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false)) + { + objatt.ScheduleGroupForFullUpdate(); + if (tainted) + objatt.HasGroupChanged = true; + + // Fire after attach, so we don't get messy perms dialogs + // 3 == AttachedRez + objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3); + } } + return objatt; } @@ -554,7 +567,17 @@ namespace OpenSim.Region.Framework.Scenes } } - protected internal void AttachObject( + /// + /// Attach a scene object to an avatar. + /// + /// + /// + /// + /// + /// + /// + /// true if the attachment was successful, false otherwise + protected internal bool AttachObject( IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent) { SceneObjectGroup group = GetGroupByPrim(objectLocalID); @@ -583,10 +606,8 @@ namespace OpenSim.Region.Framework.Scenes // Stick it on left hand with Zero Offset from the attachment point. AttachmentPt = (uint)AttachmentPoint.LeftHand; attachPos = Vector3.Zero; - } - group.SetAttachmentPoint((byte)AttachmentPt); group.AbsolutePosition = attachPos; @@ -609,15 +630,21 @@ namespace OpenSim.Region.Framework.Scenes // it get cleaned up // group.RootPart.RemFlag(PrimFlags.TemporaryOnRez); - group.HasGroupChanged = false; + group.HasGroupChanged = false; } else { remoteClient.SendAgentAlertMessage("You don't have sufficient permissions to attach this object", false); + return false; } } else + { m_log.DebugFormat("[SCENE GRAPH]: AttachObject found no such scene object {0}", objectLocalID); + return false; + } + + return true; } protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) -- cgit v1.1 From 4c1740f7d8e4e577167a84438cce83a7cc32f56d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 1 Feb 2010 20:15:36 +0000 Subject: Actually make EventManager.OnAttach() fire when an object is attached. Previously, only detach was firing! --- OpenSim/Region/Framework/Scenes/EventManager.cs | 5 +++-- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 004ea1f..464ead8 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -313,9 +313,10 @@ namespace OpenSim.Region.Framework.Scenes public event EmptyScriptCompileQueue OnEmptyScriptCompileQueue; /// - /// Called whenever an object is attached, or detached - /// from an in-world presence. + /// Called whenever an object is attached, or detached from an in-world presence. /// + /// If the object is being attached, then the avatarID will be present. If the object is being detached then + /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical). public delegate void Attach(uint localID, UUID itemID, UUID avatarID); public event Attach OnAttach; diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index fc2798d..1ac061a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -528,6 +528,9 @@ namespace OpenSim.Region.Framework.Scenes // Fire after attach, so we don't get messy perms dialogs // 3 == AttachedRez objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3); + + // Do this last so that event listeners have access to all the effects of the attachment + m_parentScene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); } } -- cgit v1.1 From 3863cd1d2395fb87489ed4e544fc33048c81761c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 1 Feb 2010 21:35:05 +0000 Subject: Copy prim face color setting code from LSL_Api down into SOP so that non-LSL callers can use it --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 192 +++++++++++++++++++++ 1 file changed, 192 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a5296eb..8b5c348 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -90,10 +90,27 @@ namespace OpenSim.Region.Framework.Scenes SCALE = 0x40 } + public enum PrimType : int + { + BOX = 0, + CYLINDER = 1, + PRISM = 2, + SPHERE = 3, + TORUS = 4, + TUBE = 5, + RING = 6, + SCULPT = 7 + } + #endregion Enumerations public class SceneObjectPart : IScriptHost { + /// + /// Denote all sides of the prim + /// + public const int ALL_SIDES = -1; + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // use only one serializer to give the runtime a chance to optimize it (it won't do that if you @@ -737,6 +754,9 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Text color. + /// public Color Color { get { return m_color; } @@ -2955,6 +2975,178 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Set the color of prim faces + /// + /// + /// + public void SetFaceColor(Vector3 color, int face) + { + Primitive.TextureEntry tex = Shape.Textures; + Color4 texcolor; + if (face >= 0 && face < GetNumberOfSides()) + { + texcolor = tex.CreateFace((uint)face).RGBA; + texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); + texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); + texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); + tex.FaceTextures[face].RGBA = texcolor; + UpdateTexture(tex); + return; + } + else if (face == ALL_SIDES) + { + for (uint i = 0; i < GetNumberOfSides(); i++) + { + if (tex.FaceTextures[i] != null) + { + texcolor = tex.FaceTextures[i].RGBA; + texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); + texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); + texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); + tex.FaceTextures[i].RGBA = texcolor; + } + texcolor = tex.DefaultTexture.RGBA; + texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); + texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); + texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); + tex.DefaultTexture.RGBA = texcolor; + } + UpdateTexture(tex); + return; + } + } + + /// + /// Get the number of sides that this part has. + /// + /// + public int GetNumberOfSides() + { + int ret = 0; + bool hasCut; + bool hasHollow; + bool hasDimple; + bool hasProfileCut; + + PrimType primType = getScriptPrimType(); + hasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); + + switch (primType) + { + case PrimType.BOX: + ret = 6; + if (hasCut) ret += 2; + if (hasHollow) ret += 1; + break; + case PrimType.CYLINDER: + ret = 3; + if (hasCut) ret += 2; + if (hasHollow) ret += 1; + break; + case PrimType.PRISM: + ret = 5; + if (hasCut) ret += 2; + if (hasHollow) ret += 1; + break; + case PrimType.SPHERE: + ret = 1; + if (hasCut) ret += 2; + if (hasDimple) ret += 2; + if (hasHollow) ret += 3; // Emulate lsl on secondlife (according to documentation it should have added only +1) + break; + case PrimType.TORUS: + ret = 1; + if (hasCut) ret += 2; + if (hasProfileCut) ret += 2; + if (hasHollow) ret += 1; + break; + case PrimType.TUBE: + ret = 4; + if (hasCut) ret += 2; + if (hasProfileCut) ret += 2; + if (hasHollow) ret += 1; + break; + case PrimType.RING: + ret = 3; + if (hasCut) ret += 2; + if (hasProfileCut) ret += 2; + if (hasHollow) ret += 1; + break; + case PrimType.SCULPT: + ret = 1; + break; + } + return ret; + } + + /// + /// Tell us what type this prim is + /// + /// + /// + public PrimType getScriptPrimType() + { + if (Shape.SculptEntry) + return PrimType.SCULPT; + if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Square) + { + if (Shape.PathCurve == (byte)Extrusion.Straight) + return PrimType.BOX; + else if (Shape.PathCurve == (byte)Extrusion.Curve1) + return PrimType.TUBE; + } + else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Circle) + { + if (Shape.PathCurve == (byte)Extrusion.Straight) + return PrimType.CYLINDER; + // ProfileCurve seems to combine hole shape and profile curve so we need to only compare against the lower 3 bits + else if (Shape.PathCurve == (byte)Extrusion.Curve1) + return PrimType.TORUS; + } + else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle) + { + if (Shape.PathCurve == (byte)Extrusion.Curve1 || Shape.PathCurve == (byte)Extrusion.Curve2) + return PrimType.SPHERE; + } + else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.EquilateralTriangle) + { + if (Shape.PathCurve == (byte)Extrusion.Straight) + return PrimType.PRISM; + else if (Shape.PathCurve == (byte)Extrusion.Curve1) + return PrimType.RING; + } + + return PrimType.BOX; + } + + /// + /// Tell us if this object has cut, hollow, dimple, and other factors affecting the number of faces + /// + /// + /// + /// + /// + /// + /// + protected static void hasCutHollowDimpleProfileCut(PrimType primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow, + out bool hasDimple, out bool hasProfileCut) + { + if (primType == PrimType.BOX + || + primType == PrimType.CYLINDER + || + primType == PrimType.PRISM) + + hasCut = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); + else + hasCut = (shape.PathBegin > 0) || (shape.PathEnd > 0); + + hasHollow = shape.ProfileHollow > 0; + hasDimple = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); // taken from llSetPrimitiveParms + hasProfileCut = hasDimple; // is it the same thing? + } + public void SetGroup(UUID groupID, IClientAPI client) { _groupID = groupID; -- cgit v1.1 From ecc068fbe0b8a95563281c3aaf8e7392e5ef49e9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 1 Feb 2010 22:08:00 +0000 Subject: remove now duplicated shape code from LSL_Api.cs --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 8b5c348..33c3fcf 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3029,8 +3029,8 @@ namespace OpenSim.Region.Framework.Scenes bool hasDimple; bool hasProfileCut; - PrimType primType = getScriptPrimType(); - hasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); + PrimType primType = GetScriptPrimType(); + HasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); switch (primType) { @@ -3085,7 +3085,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - public PrimType getScriptPrimType() + public PrimType GetScriptPrimType() { if (Shape.SculptEntry) return PrimType.SCULPT; @@ -3129,7 +3129,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - protected static void hasCutHollowDimpleProfileCut(PrimType primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow, + protected static void HasCutHollowDimpleProfileCut(PrimType primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow, out bool hasDimple, out bool hasProfileCut) { if (primType == PrimType.BOX -- cgit v1.1 From 5432925a3b153737adf7f59483e05202068ce2af Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 1 Feb 2010 22:29:21 +0000 Subject: move hollow sphere faces bug back up to LSL_Api.cs --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 33c3fcf..4f9beb7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3053,7 +3053,7 @@ namespace OpenSim.Region.Framework.Scenes ret = 1; if (hasCut) ret += 2; if (hasDimple) ret += 2; - if (hasHollow) ret += 3; // Emulate lsl on secondlife (according to documentation it should have added only +1) + if (hasHollow) ret += 1; break; case PrimType.TORUS: ret = 1; -- cgit v1.1 From 08721be3740624fb10a205bcf1ddcfd58bff7f87 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 1 Feb 2010 22:33:15 +0000 Subject: minor: rename GetScriptPrimType() to GetPrimType() --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4f9beb7..ef9005f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3029,7 +3029,7 @@ namespace OpenSim.Region.Framework.Scenes bool hasDimple; bool hasProfileCut; - PrimType primType = GetScriptPrimType(); + PrimType primType = GetPrimType(); HasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); switch (primType) @@ -3085,7 +3085,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - public PrimType GetScriptPrimType() + public PrimType GetPrimType() { if (Shape.SculptEntry) return PrimType.SCULPT; -- cgit v1.1 From 96d5c8196a3c756639e9f57a7fb3d630d174d0c4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 2 Feb 2010 15:45:41 +0000 Subject: minor: add reminder to lock SOG.Children before using it directly in order to avoid threading issues --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index ec41ac7..8c56870 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -235,6 +235,9 @@ namespace OpenSim.Region.Framework.Scenes set { m_rootPart.GroupID = value; } } + /// + /// The parts of this scene object group. You must lock this property before using it. + /// public Dictionary Children { get { return m_parts; } @@ -2097,7 +2100,7 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Get a child part with a given UUID + /// Get a part with a given UUID /// /// /// null if a child part with the primID was not found @@ -2112,7 +2115,7 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Get a child part with a given local ID + /// Get a part with a given local ID /// /// /// null if a child part with the local ID was not found -- cgit v1.1 From 0e23c5fffb8eced017c696ee85bee32131e18d51 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 2 Feb 2010 18:19:15 +0000 Subject: minor: add some documentation to EventManager.OnObjectGrab --- OpenSim/Region/Framework/Scenes/EventManager.cs | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 464ead8..a4a1abc 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -92,8 +92,7 @@ namespace OpenSim.Region.Framework.Scenes public delegate void OnShutdownDelegate(); public event OnShutdownDelegate OnShutdown; - - public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); + public delegate void ObjectDeGrabDelegate(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); public delegate void ScriptResetDelegate(uint localID, UUID itemID); @@ -103,7 +102,14 @@ namespace OpenSim.Region.Framework.Scenes public event OnSetRootAgentSceneDelegate OnSetRootAgentScene; + /// + /// Called when an object is touched/grabbed. + /// + /// The originalID is the local ID of the part that was actually touched. The localID itself is always that of + /// the root part. + public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); public event ObjectGrabDelegate OnObjectGrab; + public event ObjectGrabDelegate OnObjectGrabbing; public event ObjectDeGrabDelegate OnObjectDeGrab; public event ScriptResetDelegate OnScriptReset; @@ -111,55 +117,42 @@ namespace OpenSim.Region.Framework.Scenes public event OnPermissionErrorDelegate OnPermissionError; public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource); - public event NewRezScript OnRezScript; public delegate void RemoveScript(uint localID, UUID itemID); - public event RemoveScript OnRemoveScript; public delegate void StartScript(uint localID, UUID itemID); - public event StartScript OnStartScript; public delegate void StopScript(uint localID, UUID itemID); - public event StopScript OnStopScript; public delegate bool SceneGroupMoved(UUID groupID, Vector3 delta); - public event SceneGroupMoved OnSceneGroupMove; public delegate void SceneGroupGrabed(UUID groupID, Vector3 offset, UUID userID); - public event SceneGroupGrabed OnSceneGroupGrab; public delegate bool SceneGroupSpinStarted(UUID groupID); - public event SceneGroupSpinStarted OnSceneGroupSpinStart; public delegate bool SceneGroupSpun(UUID groupID, Quaternion rotation); - public event SceneGroupSpun OnSceneGroupSpin; public delegate void LandObjectAdded(ILandObject newParcel); - public event LandObjectAdded OnLandObjectAdded; public delegate void LandObjectRemoved(UUID globalID); - public event LandObjectRemoved OnLandObjectRemoved; public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID); - public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel; public delegate void SignificantClientMovement(IClientAPI remote_client); - public event SignificantClientMovement OnSignificantClientMovement; public delegate void IncomingInstantMessage(GridInstantMessage message); - public event IncomingInstantMessage OnIncomingInstantMessage; public event IncomingInstantMessage OnUnhandledInstantMessage; -- cgit v1.1 From dc8240910620b1ca2faa0709c0db00d405124193 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 2 Feb 2010 19:04:06 +0000 Subject: minor: add method doc to sop.SetScriptEvents() --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ef9005f..d7f9bbb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3178,6 +3178,11 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Set the events that this part will pass on to listeners. + /// + /// + /// public void SetScriptEvents(UUID scriptid, int events) { // scriptEvents oldparts; -- cgit v1.1 From 0faeaf98a66bbe32a171ee32024ea38fc17b6db2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 2 Feb 2010 19:42:45 +0000 Subject: minor: copy some method doc from the WorldComm implementation to the interface --- OpenSim/Region/Framework/Interfaces/IWorldComm.cs | 39 +++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs index 74526c4..948b9dc 100644 --- a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs +++ b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs @@ -49,10 +49,49 @@ namespace OpenSim.Region.Framework.Interfaces public interface IWorldComm { + /// + /// Create a listen event callback with the specified filters. + /// The parameters localID,itemID are needed to uniquely identify + /// the script during 'peek' time. Parameter hostID is needed to + /// determine the position of the script. + /// + /// localID of the script engine + /// UUID of the script engine + /// UUID of the SceneObjectPart + /// channel to listen on + /// name to filter on + /// key to filter on (user given, could be totally faked) + /// msg to filter on + /// number of the scripts handle int Listen(uint LocalID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg); + + /// + /// This method scans over the objects which registered an interest in listen callbacks. + /// For everyone it finds, it checks if it fits the given filter. If it does, then + /// enqueue the message for delivery to the objects listen event handler. + /// The enqueued ListenerInfo no longer has filter values, but the actually trigged values. + /// Objects that do an llSay have their messages delivered here and for nearby avatars, + /// the OnChatFromClient event is used. + /// + /// type of delvery (whisper,say,shout or regionwide) + /// channel to sent on + /// name of sender (object or avatar) + /// key of sender (object or avatar) + /// msg to sent void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg); + + /// + /// Are there any listen events ready to be dispatched? + /// + /// boolean indication bool HasMessages(); + + /// + /// Pop the first availlable listen event from the queue + /// + /// ListenerInfo with filter filled in IWorldCommListenerInfo GetNextMessage(); + void ListenControl(UUID itemID, int handle, int active); void ListenRemove(UUID itemID, int handle); void DeleteListener(UUID itemID); -- cgit v1.1 From 88d0fc3b093e1ae79ef17e2496348251e196a5fa Mon Sep 17 00:00:00 2001 From: radams1 Date: Tue, 2 Feb 2010 16:20:02 -0800 Subject: allow terrain collision events after regular collision check Signed-off-by: Melanie --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ef9005f..b1c6fb9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1921,7 +1921,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (uint localId in startedColliders) { if (localId == 0) - return; + continue; // always running this check because if the user deletes the object it would return a null reference. if (m_parentGroup == null) return; @@ -2057,7 +2057,7 @@ namespace OpenSim.Region.Framework.Scenes { // always running this check because if the user deletes the object it would return a null reference. if (localId == 0) - return; + continue; if (m_parentGroup == null) return; @@ -2189,7 +2189,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (uint localId in endedColliders) { if (localId == 0) - return; + continue; // always running this check because if the user deletes the object it would return a null reference. if (m_parentGroup == null) -- cgit v1.1 From b6bee4999c9d238a052022f105069ea4eb85f8f4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 3 Feb 2010 15:35:41 +0000 Subject: change position of OnAttach event firing so that this also happens when a user teleports into a region --- OpenSim/Region/Framework/Scenes/Scene.cs | 29 +++++++++++++++------------ OpenSim/Region/Framework/Scenes/SceneGraph.cs | 3 +-- 2 files changed, 17 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 73b0b3e..ff2be05 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2496,20 +2496,24 @@ namespace OpenSim.Region.Framework.Scenes //RootPrim.SetParentLocalId(parentLocalID); - m_log.DebugFormat("[ATTACHMENT]: Received " + - "attachment {0}, inworld asset id {1}", - //grp.RootPart.LastOwnerID.ToString(), - grp.GetFromItemID(), - grp.UUID.ToString()); + m_log.DebugFormat( + "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", + //grp.RootPart.LastOwnerID.ToString(), + grp.GetFromItemID(), + grp.UUID.ToString()); //grp.SetFromAssetID(grp.RootPart.LastOwnerID); - m_log.DebugFormat("[ATTACHMENT]: Attach " + - "to avatar {0} at position {1}", - sp.UUID.ToString(), grp.AbsolutePosition); - AttachObject(sp.ControllingClient, - grp.LocalId, (uint)0, - grp.GroupRotation, - grp.AbsolutePosition, false); + m_log.DebugFormat( + "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID.ToString(), grp.AbsolutePosition); + + if ( + AttachObject( + sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false)) + { + // Do this last so that event listeners have access to all the effects of the attachment + EventManager.TriggerOnAttach(grp.LocalId, UUID.Zero, sp.UUID); + } + RootPrim.RemFlag(PrimFlags.TemporaryOnRez); grp.SendGroupFullUpdate(); } @@ -2518,7 +2522,6 @@ namespace OpenSim.Region.Framework.Scenes RootPrim.RemFlag(PrimFlags.TemporaryOnRez); RootPrim.AddFlag(PrimFlags.TemporaryOnRez); } - } else { diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 1ac061a..b508af5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -627,11 +627,10 @@ namespace OpenSim.Region.Framework.Scenes } m_parentScene.AttachObject(remoteClient, AttachmentPt, itemId, group); - group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); + // In case it is later dropped again, don't let // it get cleaned up - // group.RootPart.RemFlag(PrimFlags.TemporaryOnRez); group.HasGroupChanged = false; } -- cgit v1.1 From da62344822524b74b431bf35e682aaf882c44da9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 3 Feb 2010 15:40:59 +0000 Subject: minor: remove a couple of mono warnings --- OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 2 -- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 87c1a95..298ede9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -44,8 +44,6 @@ namespace OpenSim.Region.Framework.Scenes { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - static System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); - private string m_inventoryFileName = String.Empty; private int m_inventoryFileNameSerial = 0; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e26283d..bd59f2e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2783,11 +2783,10 @@ namespace OpenSim.Region.Framework.Scenes { m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying); } - catch(Exception ex) + catch { m_scene.CrossAgentToNewRegion(this, false); } - } public void InTransit() -- cgit v1.1 From c020fed1b86588966d397bcfe8530b8a3bc5df99 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 3 Feb 2010 15:46:24 +0000 Subject: minor: comment out a log line in ScenePresence --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index bd59f2e..5419a9a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2864,7 +2864,6 @@ namespace OpenSim.Region.Framework.Scenes { RemoveNeighbourRegion(handle); } - } #endregion @@ -3025,7 +3024,7 @@ namespace OpenSim.Region.Framework.Scenes List attPoints = m_appearance.GetAttachedPoints(); if (attPoints != null) { - m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count); + //m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count); int i = 0; AttachmentData[] attachs = new AttachmentData[attPoints.Count]; foreach (int point in attPoints) -- cgit v1.1 From daa66c4811be49a0eee843f2bc77a3465da674de Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 3 Feb 2010 16:40:21 +0000 Subject: add an IsRoot property to sop --- OpenSim/Region/Framework/Scenes/EventManager.cs | 16 +++++++++++++++- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 9 +++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index a4a1abc..c50082d 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -469,7 +469,21 @@ namespace OpenSim.Region.Framework.Scenes { handlerOnAttach = OnAttach; if (handlerOnAttach != null) - handlerOnAttach(localID, itemID, avatarID); + { + foreach (Delegate d in handlerOnAttach.GetInvocationList()) + { + try + { + d(localID, itemID, avatarID); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. Error was {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index d7f9bbb..d012d3e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -113,6 +113,15 @@ namespace OpenSim.Region.Framework.Scenes private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// + /// Is this sop a root part? + /// + [XmlIgnore] + public bool IsRoot + { + get { return ParentGroup.RootPart == this; } + } + // use only one serializer to give the runtime a chance to optimize it (it won't do that if you // use a new instance every time) private static XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); -- cgit v1.1 From cd4651041efb277ff101e009806aa9ea75536bb1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 3 Feb 2010 19:04:31 +0000 Subject: For each delegate added to events in the EventManager, catch and log but do not propogate any exceptions that come back This stops exceptions thrown by modules from disrupting the kernel and still allows other delegates to be executed normally --- OpenSim/Region/Framework/Scenes/EventManager.cs | 1454 ++++++++++++++++++----- 1 file changed, 1134 insertions(+), 320 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index c50082d..2ab393f 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -27,11 +27,13 @@ using System; using System.Collections.Generic; +using System.Reflection; +using log4net; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Client; using OpenSim.Region.Framework.Interfaces; -using Caps=OpenSim.Framework.Capabilities.Caps; +using Caps = OpenSim.Framework.Capabilities.Caps; using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Region.Framework.Scenes @@ -41,6 +43,8 @@ namespace OpenSim.Region.Framework.Scenes /// public class EventManager { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + public delegate void OnFrameDelegate(); public event OnFrameDelegate OnFrame; @@ -213,9 +217,9 @@ namespace OpenSim.Region.Framework.Scenes public event AvatarKillData OnAvatarKilled; - public delegate void ScriptTimerEvent(uint localID, double timerinterval); +// public delegate void ScriptTimerEvent(uint localID, double timerinterval); - public event ScriptTimerEvent OnScriptTimerEvent; +// public event ScriptTimerEvent OnScriptTimerEvent; public delegate void EstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool EstateSun, float LindenHour); public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); @@ -382,95 +386,12 @@ namespace OpenSim.Region.Framework.Scenes public event LandBuy OnLandBuy; public event LandBuy OnValidateLandBuy; - /* Designated Event Deletage Instances */ - - private ScriptChangedEvent handlerScriptChangedEvent = null; //OnScriptChangedEvent; - private ScriptAtTargetEvent handlerScriptAtTargetEvent = null; - private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = null; - private ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = null; - private ScriptNotAtRotTargetEvent handlerScriptNotAtRotTargetEvent = null; - private ClientMovement handlerClientMovement = null; //OnClientMovement; - private OnPermissionErrorDelegate handlerPermissionError = null; //OnPermissionError; - private OnPluginConsoleDelegate handlerPluginConsole = null; //OnPluginConsole; - private OnFrameDelegate handlerFrame = null; //OnFrame; - private OnNewClientDelegate handlerNewClient = null; //OnNewClient; - private OnClientConnectCoreDelegate handlerClientConnect = null; //OnClientConnect - private OnNewPresenceDelegate handlerNewPresence = null; //OnNewPresence; - private OnRemovePresenceDelegate handlerRemovePresence = null; //OnRemovePresence; - private OnBackupDelegate handlerBackup = null; //OnBackup; - private OnParcelPrimCountUpdateDelegate handlerParcelPrimCountUpdate = null; //OnParcelPrimCountUpdate; - private MoneyTransferEvent handlerMoneyTransfer = null; //OnMoneyTransfer; - private OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = null; //OnParcelPrimCountAdd; - private OnShutdownDelegate handlerShutdown = null; //OnShutdown; - private ObjectGrabDelegate handlerObjectGrab = null; //OnObjectGrab; - private ObjectGrabDelegate handlerObjectGrabbing = null; //OnObjectGrabbing; - private ObjectDeGrabDelegate handlerObjectDeGrab = null; //OnObjectDeGrab; - private ScriptResetDelegate handlerScriptReset = null; // OnScriptReset - private NewRezScript handlerRezScript = null; //OnRezScript; - private RemoveScript handlerRemoveScript = null; //OnRemoveScript; - private StartScript handlerStartScript = null; //OnStartScript; - private StopScript handlerStopScript = null; //OnStopScript; - private SceneGroupMoved handlerSceneGroupMove = null; //OnSceneGroupMove; - private SceneGroupGrabed handlerSceneGroupGrab = null; //OnSceneGroupGrab; - private SceneGroupSpinStarted handlerSceneGroupSpinStarted = null; //OnSceneGroupSpinStart; - private SceneGroupSpun handlerSceneGroupSpin = null; //OnSceneGroupSpin; - private LandObjectAdded handlerLandObjectAdded = null; //OnLandObjectAdded; - private LandObjectRemoved handlerLandObjectRemoved = null; //OnLandObjectRemoved; - private AvatarEnteringNewParcel handlerAvatarEnteringNewParcel = null; //OnAvatarEnteringNewParcel; - private IncomingInstantMessage handlerIncomingInstantMessage = null; //OnIncomingInstantMessage; - private IncomingInstantMessage handlerUnhandledInstantMessage = null; //OnUnhandledInstantMessage; - private ClientClosed handlerClientClosed = null; //OnClientClosed; - private OnMakeChildAgentDelegate handlerMakeChildAgent = null; //OnMakeChildAgent; - private OnMakeRootAgentDelegate handlerMakeRootAgent = null; //OnMakeRootAgent; - private OnTerrainTickDelegate handlerTerrainTick = null; // OnTerainTick; - private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps; - private DeregisterCapsEvent handlerDeregisterCaps = null; // OnDeregisterCaps; - private ChatFromWorldEvent handlerChatFromWorld = null; // OnChatFromWorld; - private ChatFromClientEvent handlerChatFromClient = null; // OnChatFromClient; - private ChatBroadcastEvent handlerChatBroadcast = null; // OnChatBroadcast; - private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = null; - private RequestChangeWaterHeight handlerRequestChangeWaterHeight = null; //OnRequestChangeWaterHeight - private ScriptControlEvent handlerScriptControlEvent = null; - private SignificantClientMovement handlerSignificantClientMovement = null; - - private LandBuy handlerLandBuy = null; - private LandBuy handlerValidateLandBuy = null; - private AvatarKillData handlerAvatarKill = null; - - private NoticeNoLandDataFromStorage handlerNoticeNoLandDataFromStorage = null; - private IncomingLandDataFromStorage handlerIncomingLandDataFromStorage = null; - private SetAllowForcefulBan handlerSetAllowForcefulBan = null; - private RequestParcelPrimCountUpdate handlerRequestParcelPrimCountUpdate = null; - private ParcelPrimCountTainted handlerParcelPrimCountTainted = null; - private ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = null; - // TODO: unused: private ScriptTimerEvent handlerScriptTimerEvent = null; - private EstateToolsSunUpdate handlerEstateToolsSunUpdate = null; - - private ScriptColliding handlerCollidingStart = null; - private ScriptColliding handlerColliding = null; - private ScriptColliding handlerCollidingEnd = null; - private ScriptColliding handlerLandCollidingStart = null; - private ScriptColliding handlerLandColliding = null; - private ScriptColliding handlerLandCollidingEnd = null; - private GetScriptRunning handlerGetScriptRunning = null; - - private SunLindenHour handlerCurrentTimeAsLindenSunHour = null; - private OnSetRootAgentSceneDelegate handlerSetRootAgentScene = null; - - private OarFileLoaded handlerOarFileLoaded = null; - private OarFileSaved handlerOarFileSaved = null; - - private EmptyScriptCompileQueue handlerEmptyScriptCompileQueue = null; - - private Attach handlerOnAttach = null; - private RegionUp handlerOnRegionUp = null; - public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID) { - handlerOnAttach = OnAttach; + Attach handlerOnAttach = OnAttach; if (handlerOnAttach != null) { - foreach (Delegate d in handlerOnAttach.GetInvocationList()) + foreach (Attach d in handlerOnAttach.GetInvocationList()) { try { @@ -479,7 +400,7 @@ namespace OpenSim.Region.Framework.Scenes catch (Exception e) { m_log.ErrorFormat( - "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. Error was {0} {1}", + "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}", e.Message, e.StackTrace); } } @@ -488,525 +409,1240 @@ namespace OpenSim.Region.Framework.Scenes public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) { - handlerGetScriptRunning = OnGetScriptRunning; + GetScriptRunning handlerGetScriptRunning = OnGetScriptRunning; if (handlerGetScriptRunning != null) - handlerGetScriptRunning(controllingClient, objectID, itemID); + { + foreach (GetScriptRunning d in handlerGetScriptRunning.GetInvocationList()) + { + try + { + d(controllingClient, objectID, itemID); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerGetScriptRunning failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerOnScriptChangedEvent(uint localID, uint change) { - handlerScriptChangedEvent = OnScriptChangedEvent; + ScriptChangedEvent handlerScriptChangedEvent = OnScriptChangedEvent; if (handlerScriptChangedEvent != null) - handlerScriptChangedEvent(localID, change); + { + foreach (ScriptChangedEvent d in handlerScriptChangedEvent.GetInvocationList()) + { + try + { + d(localID, change); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnScriptChangedEvent failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerOnClientMovement(ScenePresence avatar) { - handlerClientMovement = OnClientMovement; + ClientMovement handlerClientMovement = OnClientMovement; if (handlerClientMovement != null) - handlerClientMovement(avatar); + { + foreach (ClientMovement d in handlerClientMovement.GetInvocationList()) + { + try + { + d(avatar); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnClientMovement failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerPermissionError(UUID user, string reason) { - handlerPermissionError = OnPermissionError; + OnPermissionErrorDelegate handlerPermissionError = OnPermissionError; if (handlerPermissionError != null) - handlerPermissionError(user, reason); + { + foreach (OnPermissionErrorDelegate d in handlerPermissionError.GetInvocationList()) + { + try + { + d(user, reason); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerPermissionError failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerOnPluginConsole(string[] args) { - handlerPluginConsole = OnPluginConsole; + OnPluginConsoleDelegate handlerPluginConsole = OnPluginConsole; if (handlerPluginConsole != null) - handlerPluginConsole(args); + { + foreach (OnPluginConsoleDelegate d in handlerPluginConsole.GetInvocationList()) + { + try + { + d(args); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnPluginConsole failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerOnFrame() { - handlerFrame = OnFrame; + OnFrameDelegate handlerFrame = OnFrame; if (handlerFrame != null) { - handlerFrame(); - } + foreach (OnFrameDelegate d in handlerFrame.GetInvocationList()) + { + try + { + d(); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnFrame failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerOnNewClient(IClientAPI client) - { - handlerNewClient = OnNewClient; + { + OnNewClientDelegate handlerNewClient = OnNewClient; if (handlerNewClient != null) - handlerNewClient(client); + { + foreach (OnNewClientDelegate d in handlerNewClient.GetInvocationList()) + { + try + { + d(client); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnNewClient failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } if (client is IClientCore) - { - handlerClientConnect = OnClientConnect; + { + OnClientConnectCoreDelegate handlerClientConnect = OnClientConnect; if (handlerClientConnect != null) - handlerClientConnect((IClientCore)client); + { + foreach (OnClientConnectCoreDelegate d in handlerClientConnect.GetInvocationList()) + { + try + { + d((IClientCore)client); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnNewClient (IClientCore) failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } } public void TriggerOnNewPresence(ScenePresence presence) { - handlerNewPresence = OnNewPresence; + OnNewPresenceDelegate handlerNewPresence = OnNewPresence; if (handlerNewPresence != null) - handlerNewPresence(presence); + { + foreach (OnNewPresenceDelegate d in handlerNewPresence.GetInvocationList()) + { + try + { + d(presence); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnNewPresence failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerOnRemovePresence(UUID agentId) - { - handlerRemovePresence = OnRemovePresence; + { + OnRemovePresenceDelegate handlerRemovePresence = OnRemovePresence; if (handlerRemovePresence != null) { - handlerRemovePresence(agentId); - } + foreach (OnRemovePresenceDelegate d in handlerRemovePresence.GetInvocationList()) + { + try + { + d(agentId); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnRemovePresence failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerOnBackup(IRegionDataStore dstore) - { - handlerBackup = OnBackup; - if (handlerBackup != null) + { + OnBackupDelegate handlerOnAttach = OnBackup; + if (handlerOnAttach != null) { - handlerBackup(dstore, false); - } + foreach (OnBackupDelegate d in handlerOnAttach.GetInvocationList()) + { + try + { + d(dstore, false); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnBackup failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerParcelPrimCountUpdate() { - handlerParcelPrimCountUpdate = OnParcelPrimCountUpdate; + OnParcelPrimCountUpdateDelegate handlerParcelPrimCountUpdate = OnParcelPrimCountUpdate; if (handlerParcelPrimCountUpdate != null) { - handlerParcelPrimCountUpdate(); - } + foreach (OnParcelPrimCountUpdateDelegate d in handlerParcelPrimCountUpdate.GetInvocationList()) + { + try + { + d(); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerParcelPrimCountUpdate failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } - public void TriggerMoneyTransfer(Object sender, MoneyTransferArgs e) + public void TriggerMoneyTransfer(Object sender, MoneyTransferArgs args) { - handlerMoneyTransfer = OnMoneyTransfer; + MoneyTransferEvent handlerMoneyTransfer = OnMoneyTransfer; if (handlerMoneyTransfer != null) { - handlerMoneyTransfer(sender, e); - } + foreach (MoneyTransferEvent d in handlerMoneyTransfer.GetInvocationList()) + { + try + { + d(sender, args); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerMoneyTransfer failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerTerrainTick() { - handlerTerrainTick = OnTerrainTick; + OnTerrainTickDelegate handlerTerrainTick = OnTerrainTick; if (handlerTerrainTick != null) { - handlerTerrainTick(); - } + foreach (OnTerrainTickDelegate d in handlerTerrainTick.GetInvocationList()) + { + try + { + d(); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerTerrainTick failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerParcelPrimCountAdd(SceneObjectGroup obj) { - handlerParcelPrimCountAdd = OnParcelPrimCountAdd; + OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = OnParcelPrimCountAdd; if (handlerParcelPrimCountAdd != null) { - handlerParcelPrimCountAdd(obj); - } + foreach (OnParcelPrimCountAddDelegate d in handlerParcelPrimCountAdd.GetInvocationList()) + { + try + { + d(obj); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerParcelPrimCountAdd failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj) { - handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene; + ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene; if (handlerObjectBeingRemovedFromScene != null) { - handlerObjectBeingRemovedFromScene(obj); - } + foreach (ObjectBeingRemovedFromScene d in handlerObjectBeingRemovedFromScene.GetInvocationList()) + { + try + { + d(obj); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerObjectBeingRemovedFromScene failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerShutdown() - { - handlerShutdown = OnShutdown; + { + OnShutdownDelegate handlerShutdown = OnShutdown; if (handlerShutdown != null) - handlerShutdown(); + { + foreach (OnShutdownDelegate d in handlerShutdown.GetInvocationList()) + { + try + { + d(); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerShutdown failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) - { - handlerObjectGrab = OnObjectGrab; + { + ObjectGrabDelegate handlerObjectGrab = OnObjectGrab; if (handlerObjectGrab != null) { - handlerObjectGrab(localID, originalID, offsetPos, remoteClient, surfaceArgs); - } + foreach (ObjectGrabDelegate d in handlerObjectGrab.GetInvocationList()) + { + try + { + d(localID, originalID, offsetPos, remoteClient, surfaceArgs); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerObjectGrab failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerObjectGrabbing(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) - { - handlerObjectGrabbing = OnObjectGrabbing; + { + ObjectGrabDelegate handlerObjectGrabbing = OnObjectGrabbing; if (handlerObjectGrabbing != null) { - handlerObjectGrabbing(localID, originalID, offsetPos, remoteClient, surfaceArgs); - } + foreach (ObjectGrabDelegate d in handlerObjectGrabbing.GetInvocationList()) + { + try + { + d(localID, originalID, offsetPos, remoteClient, surfaceArgs); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerObjectGrabbing failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) - { - handlerObjectDeGrab = OnObjectDeGrab; + { + ObjectDeGrabDelegate handlerObjectDeGrab = OnObjectDeGrab; if (handlerObjectDeGrab != null) { - handlerObjectDeGrab(localID, originalID, remoteClient, surfaceArgs); - } + foreach (ObjectDeGrabDelegate d in handlerObjectDeGrab.GetInvocationList()) + { + try + { + d(localID, originalID, remoteClient, surfaceArgs); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerObjectDeGrab failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerScriptReset(uint localID, UUID itemID) - { - handlerScriptReset = OnScriptReset; + { + ScriptResetDelegate handlerScriptReset = OnScriptReset; if (handlerScriptReset != null) { - handlerScriptReset(localID, itemID); - } + foreach (ScriptResetDelegate d in handlerScriptReset.GetInvocationList()) + { + try + { + d(localID, itemID); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerScriptReset failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource) - { - handlerRezScript = OnRezScript; + { + NewRezScript handlerRezScript = OnRezScript; if (handlerRezScript != null) { - handlerRezScript(localID, itemID, script, startParam, - postOnRez, engine, stateSource); - } + foreach (NewRezScript d in handlerRezScript.GetInvocationList()) + { + try + { + d(localID, itemID, script, startParam, postOnRez, engine, stateSource); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerRezScript failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerStartScript(uint localID, UUID itemID) { - handlerStartScript = OnStartScript; + StartScript handlerStartScript = OnStartScript; if (handlerStartScript != null) { - handlerStartScript(localID, itemID); - } - } - - public void TriggerStopScript(uint localID, UUID itemID) - { - handlerStopScript = OnStopScript; - if (handlerStopScript != null) - { - handlerStopScript(localID, itemID); - } + foreach (StartScript d in handlerStartScript.GetInvocationList()) + { + try + { + d(localID, itemID); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerStartScript failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } - public void TriggerRemoveScript(uint localID, UUID itemID) + public void TriggerStopScript(uint localID, UUID itemID) { - handlerRemoveScript = OnRemoveScript; + StopScript handlerStopScript = OnStopScript; + if (handlerStopScript != null) + { + foreach (StopScript d in handlerStopScript.GetInvocationList()) + { + try + { + d(localID, itemID); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerStopScript failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } + } + + public void TriggerRemoveScript(uint localID, UUID itemID) + { + RemoveScript handlerRemoveScript = OnRemoveScript; if (handlerRemoveScript != null) { - handlerRemoveScript(localID, itemID); - } + foreach (RemoveScript d in handlerRemoveScript.GetInvocationList()) + { + try + { + d(localID, itemID); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerRemoveScript failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public bool TriggerGroupMove(UUID groupID, Vector3 delta) { - handlerSceneGroupMove = OnSceneGroupMove; - + bool result = true; + + SceneGroupMoved handlerSceneGroupMove = OnSceneGroupMove; if (handlerSceneGroupMove != null) { - return handlerSceneGroupMove(groupID, delta); + foreach (SceneGroupMoved d in handlerSceneGroupMove.GetInvocationList()) + { + try + { + if (d(groupID, delta) == false) + result = false; + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } } - return true; + + return result; } public bool TriggerGroupSpinStart(UUID groupID) { - handlerSceneGroupSpinStarted = OnSceneGroupSpinStart; - + bool result = true; + + SceneGroupSpinStarted handlerSceneGroupSpinStarted = OnSceneGroupSpinStart; if (handlerSceneGroupSpinStarted != null) { - return handlerSceneGroupSpinStarted(groupID); + foreach (SceneGroupSpinStarted d in handlerSceneGroupSpinStarted.GetInvocationList()) + { + try + { + if (d(groupID) == false) + result = false; + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerGroupSpinStart failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } } - return true; + + return result; } public bool TriggerGroupSpin(UUID groupID, Quaternion rotation) { - handlerSceneGroupSpin = OnSceneGroupSpin; - + bool result = true; + + SceneGroupSpun handlerSceneGroupSpin = OnSceneGroupSpin; if (handlerSceneGroupSpin != null) { - return handlerSceneGroupSpin(groupID, rotation); + foreach (SceneGroupSpun d in handlerSceneGroupSpin.GetInvocationList()) + { + try + { + if (d(groupID, rotation) == false) + result = false; + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerGroupSpin failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } } - return true; + + return result; } public void TriggerGroupGrab(UUID groupID, Vector3 offset, UUID userID) { - handlerSceneGroupGrab = OnSceneGroupGrab; + SceneGroupGrabed handlerSceneGroupGrab = OnSceneGroupGrab; if (handlerSceneGroupGrab != null) { - handlerSceneGroupGrab(groupID, offset, userID); - } + foreach (SceneGroupGrabed d in handlerSceneGroupGrab.GetInvocationList()) + { + try + { + d(groupID, offset, userID); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerGroupGrab failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerLandObjectAdded(ILandObject newParcel) { - handlerLandObjectAdded = OnLandObjectAdded; - + LandObjectAdded handlerLandObjectAdded = OnLandObjectAdded; if (handlerLandObjectAdded != null) { - handlerLandObjectAdded(newParcel); - } + foreach (LandObjectAdded d in handlerLandObjectAdded.GetInvocationList()) + { + try + { + d(newParcel); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerLandObjectAdded failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerLandObjectRemoved(UUID globalID) { - handlerLandObjectRemoved = OnLandObjectRemoved; + LandObjectRemoved handlerLandObjectRemoved = OnLandObjectRemoved; if (handlerLandObjectRemoved != null) { - handlerLandObjectRemoved(globalID); - } + foreach (LandObjectRemoved d in handlerLandObjectRemoved.GetInvocationList()) + { + try + { + d(globalID); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerLandObjectRemoved failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerLandObjectUpdated(uint localParcelID, ILandObject newParcel) { - //triggerLandObjectRemoved(localParcelID); - TriggerLandObjectAdded(newParcel); } public void TriggerAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID) { - handlerAvatarEnteringNewParcel = OnAvatarEnteringNewParcel; - + AvatarEnteringNewParcel handlerAvatarEnteringNewParcel = OnAvatarEnteringNewParcel; if (handlerAvatarEnteringNewParcel != null) { - handlerAvatarEnteringNewParcel(avatar, localLandID, regionID); - } + foreach (AvatarEnteringNewParcel d in handlerAvatarEnteringNewParcel.GetInvocationList()) + { + try + { + d(avatar, localLandID, regionID); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerAvatarEnteringNewParcel failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerIncomingInstantMessage(GridInstantMessage message) { - handlerIncomingInstantMessage = OnIncomingInstantMessage; + IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage; if (handlerIncomingInstantMessage != null) { - handlerIncomingInstantMessage(message); - } + foreach (IncomingInstantMessage d in handlerIncomingInstantMessage.GetInvocationList()) + { + try + { + d(message); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerIncomingInstantMessage failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerUnhandledInstantMessage(GridInstantMessage message) { - handlerUnhandledInstantMessage = OnUnhandledInstantMessage; + IncomingInstantMessage handlerUnhandledInstantMessage = OnUnhandledInstantMessage; if (handlerUnhandledInstantMessage != null) { - handlerUnhandledInstantMessage(message); - } + foreach (IncomingInstantMessage d in handlerUnhandledInstantMessage.GetInvocationList()) + { + try + { + d(message); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerClientClosed(UUID ClientID, Scene scene) { - handlerClientClosed = OnClientClosed; + ClientClosed handlerClientClosed = OnClientClosed; if (handlerClientClosed != null) { - handlerClientClosed(ClientID, scene); - } + foreach (ClientClosed d in handlerClientClosed.GetInvocationList()) + { + try + { + d(ClientID, scene); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerClientClosed failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerOnMakeChildAgent(ScenePresence presence) { - handlerMakeChildAgent = OnMakeChildAgent; + OnMakeChildAgentDelegate handlerMakeChildAgent = OnMakeChildAgent; if (handlerMakeChildAgent != null) { - handlerMakeChildAgent(presence); - } + foreach (OnMakeChildAgentDelegate d in handlerMakeChildAgent.GetInvocationList()) + { + try + { + d(presence); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnMakeChildAgent failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerOnMakeRootAgent(ScenePresence presence) { - handlerMakeRootAgent = OnMakeRootAgent; + OnMakeRootAgentDelegate handlerMakeRootAgent = OnMakeRootAgent; if (handlerMakeRootAgent != null) { - handlerMakeRootAgent(presence); - } + foreach (OnMakeRootAgentDelegate d in handlerMakeRootAgent.GetInvocationList()) + { + try + { + d(presence); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnMakeRootAgent failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerOnRegisterCaps(UUID agentID, Caps caps) - { - handlerRegisterCaps = OnRegisterCaps; + { + RegisterCapsEvent handlerRegisterCaps = OnRegisterCaps; if (handlerRegisterCaps != null) { - handlerRegisterCaps(agentID, caps); - } + foreach (RegisterCapsEvent d in handlerRegisterCaps.GetInvocationList()) + { + try + { + d(agentID, caps); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnRegisterCaps failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerOnDeregisterCaps(UUID agentID, Caps caps) { - handlerDeregisterCaps = OnDeregisterCaps; + DeregisterCapsEvent handlerDeregisterCaps = OnDeregisterCaps; if (handlerDeregisterCaps != null) { - handlerDeregisterCaps(agentID, caps); - } + foreach (DeregisterCapsEvent d in handlerDeregisterCaps.GetInvocationList()) + { + try + { + d(agentID, caps); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnDeregisterCaps failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerOnNewInventoryItemUploadComplete(UUID agentID, UUID AssetID, String AssetName, int userlevel) { - handlerNewInventoryItemUpdateComplete = OnNewInventoryItemUploadComplete; + NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = OnNewInventoryItemUploadComplete; if (handlerNewInventoryItemUpdateComplete != null) { - handlerNewInventoryItemUpdateComplete(agentID, AssetID, AssetName, userlevel); - } + foreach (NewInventoryItemUploadComplete d in handlerNewInventoryItemUpdateComplete.GetInvocationList()) + { + try + { + d(agentID, AssetID, AssetName, userlevel); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnNewInventoryItemUploadComplete failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } - public void TriggerLandBuy(Object sender, LandBuyArgs e) + public void TriggerLandBuy(Object sender, LandBuyArgs args) { - handlerLandBuy = OnLandBuy; + LandBuy handlerLandBuy = OnLandBuy; if (handlerLandBuy != null) { - handlerLandBuy(sender, e); - } + foreach (LandBuy d in handlerLandBuy.GetInvocationList()) + { + try + { + d(sender, args); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerLandBuy failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } - public void TriggerValidateLandBuy(Object sender, LandBuyArgs e) + public void TriggerValidateLandBuy(Object sender, LandBuyArgs args) { - handlerValidateLandBuy = OnValidateLandBuy; + LandBuy handlerValidateLandBuy = OnValidateLandBuy; if (handlerValidateLandBuy != null) { - handlerValidateLandBuy(sender, e); - } + foreach (LandBuy d in handlerValidateLandBuy.GetInvocationList()) + { + try + { + d(sender, args); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerValidateLandBuy failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 currentpos) - { - handlerScriptAtTargetEvent = OnScriptAtTargetEvent; + { + ScriptAtTargetEvent handlerScriptAtTargetEvent = OnScriptAtTargetEvent; if (handlerScriptAtTargetEvent != null) { - handlerScriptAtTargetEvent(localID, handle, targetpos, currentpos); - } + foreach (ScriptAtTargetEvent d in handlerScriptAtTargetEvent.GetInvocationList()) + { + try + { + d(localID, handle, targetpos, currentpos); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerAtTargetEvent failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerNotAtTargetEvent(uint localID) { - handlerScriptNotAtTargetEvent = OnScriptNotAtTargetEvent; + ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = OnScriptNotAtTargetEvent; if (handlerScriptNotAtTargetEvent != null) { - handlerScriptNotAtTargetEvent(localID); - } + foreach (ScriptNotAtTargetEvent d in handlerScriptNotAtTargetEvent.GetInvocationList()) + { + try + { + d(localID); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerNotAtTargetEvent failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion currentrot) - { - handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent; + { + ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent; if (handlerScriptAtRotTargetEvent != null) { - handlerScriptAtRotTargetEvent(localID, handle, targetrot, currentrot); - } + foreach (ScriptAtRotTargetEvent d in handlerScriptAtRotTargetEvent.GetInvocationList()) + { + try + { + d(localID, handle, targetrot, currentrot); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerAtRotTargetEvent failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerNotAtRotTargetEvent(uint localID) { - handlerScriptNotAtRotTargetEvent = OnScriptNotAtRotTargetEvent; + ScriptNotAtRotTargetEvent handlerScriptNotAtRotTargetEvent = OnScriptNotAtRotTargetEvent; if (handlerScriptNotAtRotTargetEvent != null) { - handlerScriptNotAtRotTargetEvent(localID); - } + foreach (ScriptNotAtRotTargetEvent d in handlerScriptNotAtRotTargetEvent.GetInvocationList()) + { + try + { + d(localID); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerNotAtRotTargetEvent failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerRequestChangeWaterHeight(float height) { - handlerRequestChangeWaterHeight = OnRequestChangeWaterHeight; + RequestChangeWaterHeight handlerRequestChangeWaterHeight = OnRequestChangeWaterHeight; if (handlerRequestChangeWaterHeight != null) { - handlerRequestChangeWaterHeight(height); - } + foreach (RequestChangeWaterHeight d in handlerRequestChangeWaterHeight.GetInvocationList()) + { + try + { + d(height); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerRequestChangeWaterHeight failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerAvatarKill(uint KillerObjectLocalID, ScenePresence DeadAvatar) { - handlerAvatarKill = OnAvatarKilled; + AvatarKillData handlerAvatarKill = OnAvatarKilled; if (handlerAvatarKill != null) { - handlerAvatarKill(KillerObjectLocalID, DeadAvatar); - } + foreach (AvatarKillData d in handlerAvatarKill.GetInvocationList()) + { + try + { + d(KillerObjectLocalID, DeadAvatar); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerAvatarKill failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerSignificantClientMovement(IClientAPI client) { - handlerSignificantClientMovement = OnSignificantClientMovement; + SignificantClientMovement handlerSignificantClientMovement = OnSignificantClientMovement; if (handlerSignificantClientMovement != null) { - handlerSignificantClientMovement(client); - } + foreach (SignificantClientMovement d in handlerSignificantClientMovement.GetInvocationList()) + { + try + { + d(client); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerSignificantClientMovement failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerOnChatFromWorld(Object sender, OSChatMessage chat) { - handlerChatFromWorld = OnChatFromWorld; + ChatFromWorldEvent handlerChatFromWorld = OnChatFromWorld; if (handlerChatFromWorld != null) { - handlerChatFromWorld(sender, chat); - } + foreach (ChatFromWorldEvent d in handlerChatFromWorld.GetInvocationList()) + { + try + { + d(sender, chat); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnChatFromWorld failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerOnChatFromClient(Object sender, OSChatMessage chat) { - handlerChatFromClient = OnChatFromClient; + ChatFromClientEvent handlerChatFromClient = OnChatFromClient; if (handlerChatFromClient != null) { - handlerChatFromClient(sender, chat); - } + foreach (ChatFromClientEvent d in handlerChatFromClient.GetInvocationList()) + { + try + { + d(sender, chat); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnChatFromClient failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat) { - handlerChatBroadcast = OnChatBroadcast; + ChatBroadcastEvent handlerChatBroadcast = OnChatBroadcast; if (handlerChatBroadcast != null) { - handlerChatBroadcast(sender, chat); - } + foreach (ChatBroadcastEvent d in handlerChatBroadcast.GetInvocationList()) + { + try + { + d(sender, chat); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnChatBroadcast failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } internal void TriggerControlEvent(uint p, UUID scriptUUID, UUID avatarID, uint held, uint _changed) { - handlerScriptControlEvent = OnScriptControlEvent; + ScriptControlEvent handlerScriptControlEvent = OnScriptControlEvent; if (handlerScriptControlEvent != null) { - handlerScriptControlEvent(p, scriptUUID, avatarID, held, _changed); - } + foreach (ScriptControlEvent d in handlerScriptControlEvent.GetInvocationList()) + { + try + { + d(p, scriptUUID, avatarID, held, _changed); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerControlEvent failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerNoticeNoLandDataFromStorage() { - handlerNoticeNoLandDataFromStorage = OnNoticeNoLandDataFromStorage; + NoticeNoLandDataFromStorage handlerNoticeNoLandDataFromStorage = OnNoticeNoLandDataFromStorage; if (handlerNoticeNoLandDataFromStorage != null) { - handlerNoticeNoLandDataFromStorage(); - - } + foreach (NoticeNoLandDataFromStorage d in handlerNoticeNoLandDataFromStorage.GetInvocationList()) + { + try + { + d(); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerNoticeNoLandDataFromStorage failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerIncomingLandDataFromStorage(List landData) { - handlerIncomingLandDataFromStorage = OnIncomingLandDataFromStorage; + IncomingLandDataFromStorage handlerIncomingLandDataFromStorage = OnIncomingLandDataFromStorage; if (handlerIncomingLandDataFromStorage != null) { - handlerIncomingLandDataFromStorage(landData); - - } + foreach (IncomingLandDataFromStorage d in handlerIncomingLandDataFromStorage.GetInvocationList()) + { + try + { + d(landData); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerIncomingLandDataFromStorage failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerSetAllowForcefulBan(bool allow) { - handlerSetAllowForcefulBan = OnSetAllowForcefulBan; + SetAllowForcefulBan handlerSetAllowForcefulBan = OnSetAllowForcefulBan; if (handlerSetAllowForcefulBan != null) { - handlerSetAllowForcefulBan(allow); - - } + foreach (SetAllowForcefulBan d in handlerSetAllowForcefulBan.GetInvocationList()) + { + try + { + d(allow); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerSetAllowForcefulBan failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerRequestParcelPrimCountUpdate() { - handlerRequestParcelPrimCountUpdate = OnRequestParcelPrimCountUpdate; + RequestParcelPrimCountUpdate handlerRequestParcelPrimCountUpdate = OnRequestParcelPrimCountUpdate; if (handlerRequestParcelPrimCountUpdate != null) { - handlerRequestParcelPrimCountUpdate(); - } + foreach (RequestParcelPrimCountUpdate d in handlerRequestParcelPrimCountUpdate.GetInvocationList()) + { + try + { + d(); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerRequestParcelPrimCountUpdate failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerParcelPrimCountTainted() { - handlerParcelPrimCountTainted = OnParcelPrimCountTainted; + ParcelPrimCountTainted handlerParcelPrimCountTainted = OnParcelPrimCountTainted; if (handlerParcelPrimCountTainted != null) { - handlerParcelPrimCountTainted(); - } + foreach (ParcelPrimCountTainted d in handlerParcelPrimCountTainted.GetInvocationList()) + { + try + { + d(); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerParcelPrimCountTainted failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } // this lets us keep track of nasty script events like timer, etc. @@ -1029,99 +1665,277 @@ namespace OpenSim.Region.Framework.Scenes /// The hour 0.0 <= FixedSunHour <= 24.0 at which the sun is fixed at. Sun Hour 0 is sun-rise, when Day/Night ratio is 1:1 public void TriggerEstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool useEstateTime, float FixedSunHour) { - handlerEstateToolsSunUpdate = OnEstateToolsSunUpdate; + EstateToolsSunUpdate handlerEstateToolsSunUpdate = OnEstateToolsSunUpdate; if (handlerEstateToolsSunUpdate != null) { - handlerEstateToolsSunUpdate(regionHandle, FixedTime, useEstateTime, FixedSunHour); - } + foreach (EstateToolsSunUpdate d in handlerEstateToolsSunUpdate.GetInvocationList()) + { + try + { + d(regionHandle, FixedTime, useEstateTime, FixedSunHour); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerEstateToolsSunUpdate failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public float GetCurrentTimeAsSunLindenHour() { - handlerCurrentTimeAsLindenSunHour = OnGetCurrentTimeAsLindenSunHour; + SunLindenHour handlerCurrentTimeAsLindenSunHour = OnGetCurrentTimeAsLindenSunHour; if (handlerCurrentTimeAsLindenSunHour != null) { - return handlerCurrentTimeAsLindenSunHour(); + foreach (SunLindenHour d in handlerCurrentTimeAsLindenSunHour.GetInvocationList()) + { + try + { + return d(); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } } + return 6; } public void TriggerOarFileLoaded(Guid requestId, string message) - { - handlerOarFileLoaded = OnOarFileLoaded; + { + OarFileLoaded handlerOarFileLoaded = OnOarFileLoaded; if (handlerOarFileLoaded != null) - handlerOarFileLoaded(requestId, message); + { + foreach (OarFileLoaded d in handlerOarFileLoaded.GetInvocationList()) + { + try + { + d(requestId, message); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOarFileLoaded failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerOarFileSaved(Guid requestId, string message) { - handlerOarFileSaved = OnOarFileSaved; + OarFileSaved handlerOarFileSaved = OnOarFileSaved; if (handlerOarFileSaved != null) - handlerOarFileSaved(requestId, message); + { + foreach (OarFileSaved d in handlerOarFileSaved.GetInvocationList()) + { + try + { + d(requestId, message); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOarFileSaved failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerEmptyScriptCompileQueue(int numScriptsFailed, string message) { - handlerEmptyScriptCompileQueue = OnEmptyScriptCompileQueue; + EmptyScriptCompileQueue handlerEmptyScriptCompileQueue = OnEmptyScriptCompileQueue; if (handlerEmptyScriptCompileQueue != null) - handlerEmptyScriptCompileQueue(numScriptsFailed, message); + { + foreach (EmptyScriptCompileQueue d in handlerEmptyScriptCompileQueue.GetInvocationList()) + { + try + { + d(numScriptsFailed, message); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerEmptyScriptCompileQueue failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerScriptCollidingStart(uint localId, ColliderArgs colliders) { - handlerCollidingStart = OnScriptColliderStart; + ScriptColliding handlerCollidingStart = OnScriptColliderStart; if (handlerCollidingStart != null) - handlerCollidingStart(localId, colliders); + { + foreach (ScriptColliding d in handlerCollidingStart.GetInvocationList()) + { + try + { + d(localId, colliders); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerScriptCollidingStart failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerScriptColliding(uint localId, ColliderArgs colliders) { - handlerColliding = OnScriptColliding; + ScriptColliding handlerColliding = OnScriptColliding; if (handlerColliding != null) - handlerColliding(localId, colliders); + { + foreach (ScriptColliding d in handlerColliding.GetInvocationList()) + { + try + { + d(localId, colliders); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerScriptColliding failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerScriptCollidingEnd(uint localId, ColliderArgs colliders) { - handlerCollidingEnd = OnScriptCollidingEnd; + ScriptColliding handlerCollidingEnd = OnScriptCollidingEnd; if (handlerCollidingEnd != null) - handlerCollidingEnd(localId, colliders); + { + foreach (ScriptColliding d in handlerCollidingEnd.GetInvocationList()) + { + try + { + d(localId, colliders); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerScriptCollidingEnd failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerScriptLandCollidingStart(uint localId, ColliderArgs colliders) { - handlerLandCollidingStart = OnScriptLandColliderStart; + ScriptColliding handlerLandCollidingStart = OnScriptLandColliderStart; if (handlerLandCollidingStart != null) - handlerLandCollidingStart(localId, colliders); + { + foreach (ScriptColliding d in handlerLandCollidingStart.GetInvocationList()) + { + try + { + d(localId, colliders); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerScriptLandCollidingStart failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerScriptLandColliding(uint localId, ColliderArgs colliders) { - handlerLandColliding = OnScriptLandColliding; + ScriptColliding handlerLandColliding = OnScriptLandColliding; if (handlerLandColliding != null) - handlerLandColliding(localId, colliders); + { + foreach (ScriptColliding d in handlerLandColliding.GetInvocationList()) + { + try + { + d(localId, colliders); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerScriptLandColliding failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerScriptLandCollidingEnd(uint localId, ColliderArgs colliders) { - handlerLandCollidingEnd = OnScriptLandColliderEnd; + ScriptColliding handlerLandCollidingEnd = OnScriptLandColliderEnd; if (handlerLandCollidingEnd != null) - handlerLandCollidingEnd(localId, colliders); + { + foreach (ScriptColliding d in handlerLandCollidingEnd.GetInvocationList()) + { + try + { + d(localId, colliders); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerScriptLandCollidingEnd failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerSetRootAgentScene(UUID agentID, Scene scene) - { - handlerSetRootAgentScene = OnSetRootAgentScene; + { + OnSetRootAgentSceneDelegate handlerSetRootAgentScene = OnSetRootAgentScene; if (handlerSetRootAgentScene != null) - handlerSetRootAgentScene(agentID, scene); + { + foreach (OnSetRootAgentSceneDelegate d in handlerSetRootAgentScene.GetInvocationList()) + { + try + { + d(agentID, scene); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerSetRootAgentScene failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } public void TriggerOnRegionUp(GridRegion otherRegion) { - handlerOnRegionUp = OnRegionUp; + RegionUp handlerOnRegionUp = OnRegionUp; if (handlerOnRegionUp != null) - handlerOnRegionUp(otherRegion); + { + foreach (RegionUp d in handlerOnRegionUp.GetInvocationList()) + { + try + { + d(otherRegion); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnRegionUp failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } } - } -} +} \ No newline at end of file -- cgit v1.1 From 2c7672a2b9d2cf38087ff29fa4a142710c3043bb Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 3 Feb 2010 19:27:44 +0000 Subject: minor: add a smidgen of EventManager doc --- OpenSim/Region/Framework/Scenes/EventManager.cs | 8 +++++--- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 +--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 2ab393f..473920e 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -212,10 +212,12 @@ namespace OpenSim.Region.Framework.Scenes public delegate void RequestChangeWaterHeight(float height); public event RequestChangeWaterHeight OnRequestChangeWaterHeight; - - public delegate void AvatarKillData(uint KillerLocalID, ScenePresence avatar); - + + /// + /// Fired if any avatar is 'killed' due to its health falling to zero + /// public event AvatarKillData OnAvatarKilled; + public delegate void AvatarKillData(uint KillerLocalID, ScenePresence avatar); // public delegate void ScriptTimerEvent(uint localID, double timerinterval); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 5419a9a..cd39cab 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3274,9 +3274,7 @@ namespace OpenSim.Region.Framework.Scenes } if (m_health <= 0) m_scene.EventManager.TriggerAvatarKill(killerObj, this); - } - - + } } public void setHealthWithUpdate(float health) -- cgit v1.1 From 2953bee1f4443e041dbce38d042f6ed421d30533 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 4 Feb 2010 17:11:06 +0000 Subject: Revert "change position of OnAttach event firing so that this also happens when a user teleports into a region" The behavior introduced here is not compatible with SL This reverts commit b6bee4999c9d238a052022f105069ea4eb85f8f4. --- OpenSim/Region/Framework/Scenes/Scene.cs | 29 ++++++++++++--------------- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 3 ++- 2 files changed, 15 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ff2be05..73b0b3e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2496,24 +2496,20 @@ namespace OpenSim.Region.Framework.Scenes //RootPrim.SetParentLocalId(parentLocalID); - m_log.DebugFormat( - "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", - //grp.RootPart.LastOwnerID.ToString(), - grp.GetFromItemID(), - grp.UUID.ToString()); + m_log.DebugFormat("[ATTACHMENT]: Received " + + "attachment {0}, inworld asset id {1}", + //grp.RootPart.LastOwnerID.ToString(), + grp.GetFromItemID(), + grp.UUID.ToString()); //grp.SetFromAssetID(grp.RootPart.LastOwnerID); - m_log.DebugFormat( - "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID.ToString(), grp.AbsolutePosition); - - if ( - AttachObject( - sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false)) - { - // Do this last so that event listeners have access to all the effects of the attachment - EventManager.TriggerOnAttach(grp.LocalId, UUID.Zero, sp.UUID); - } - + m_log.DebugFormat("[ATTACHMENT]: Attach " + + "to avatar {0} at position {1}", + sp.UUID.ToString(), grp.AbsolutePosition); + AttachObject(sp.ControllingClient, + grp.LocalId, (uint)0, + grp.GroupRotation, + grp.AbsolutePosition, false); RootPrim.RemFlag(PrimFlags.TemporaryOnRez); grp.SendGroupFullUpdate(); } @@ -2522,6 +2518,7 @@ namespace OpenSim.Region.Framework.Scenes RootPrim.RemFlag(PrimFlags.TemporaryOnRez); RootPrim.AddFlag(PrimFlags.TemporaryOnRez); } + } else { diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index b508af5..1ac061a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -627,10 +627,11 @@ namespace OpenSim.Region.Framework.Scenes } m_parentScene.AttachObject(remoteClient, AttachmentPt, itemId, group); + group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); - // In case it is later dropped again, don't let // it get cleaned up + // group.RootPart.RemFlag(PrimFlags.TemporaryOnRez); group.HasGroupChanged = false; } -- cgit v1.1 From f1b99c4a7f9543c3a2aa36de2e659bdefca9e68b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 4 Feb 2010 21:35:56 +0000 Subject: minor: one method doc --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 8d84557..dd797fc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4144,9 +4144,13 @@ namespace OpenSim.Region.Framework.Scenes ScheduleFullUpdate(); } - // Added to handle bug in libsecondlife's TextureEntry.ToBytes() - // not handling RGBA properly. Cycles through, and "fixes" the color - // info + /// + /// Update the textures on the part. + /// + /// Added to handle bug in libsecondlife's TextureEntry.ToBytes() + /// not handling RGBA properly. Cycles through, and "fixes" the color + /// info + /// public void UpdateTexture(Primitive.TextureEntry tex) { //Color4 tmpcolor; -- cgit v1.1 From 0a084a31e9f96cc007f953b47e3319bde6d834f2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 4 Feb 2010 23:23:07 +0000 Subject: refactor: chain two ScenePresence constructors together to eliminate common code. No functional changes --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 26 ++++++++++-------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index cd39cab..bcf22c3 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -104,6 +104,8 @@ namespace OpenSim.Region.Framework.Scenes } protected ScenePresenceAnimator m_animator; + protected List m_attachments = new List(); + private Dictionary scriptedcontrols = new Dictionary(); private ScriptControlled IgnoredControls = ScriptControlled.CONTROL_ZERO; private ScriptControlled LastCommands = ScriptControlled.CONTROL_ZERO; @@ -215,9 +217,7 @@ namespace OpenSim.Region.Framework.Scenes // Agent's Draw distance. protected float m_DrawDistance; - protected AvatarAppearance m_appearance; - - protected List m_attachments = new List(); + protected AvatarAppearance m_appearance; // neighbouring regions we have enabled a child agent in // holds the seed cap for the child agent in that region @@ -630,12 +630,16 @@ namespace OpenSim.Region.Framework.Scenes #endregion #region Constructor(s) - - private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) - { - m_animator = new ScenePresenceAnimator(this); + + public ScenePresence() + { m_sendCourseLocationsMethod = SendCoarseLocationsDefault; CreateSceneViewer(); + m_animator = new ScenePresenceAnimator(this); + } + + private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this() + { m_rootRegionHandle = reginfo.RegionHandle; m_controllingClient = client; m_firstname = m_controllingClient.FirstName; @@ -659,7 +663,6 @@ namespace OpenSim.Region.Framework.Scenes m_reprioritization_timer.Elapsed += new ElapsedEventHandler(Reprioritize); m_reprioritization_timer.AutoReset = false; - AdjustKnownSeeds(); // TODO: I think, this won't send anything, as we are still a child here... @@ -3321,13 +3324,6 @@ namespace OpenSim.Region.Framework.Scenes m_animator = null; } - public ScenePresence() - { - m_sendCourseLocationsMethod = SendCoarseLocationsDefault; - CreateSceneViewer(); - m_animator = new ScenePresenceAnimator(this); - } - public void AddAttachment(SceneObjectGroup gobj) { lock (m_attachments) -- cgit v1.1