From 54563d8dea86ca1e022f3aafa791908e8bcc4912 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sun, 27 Apr 2008 22:15:38 +0000 Subject: * Patch from XenReborn to make remove-region work properly without needing to do a change-region first. Careful though. I still suggest you do a change-region first. * Patch from Melanie to implement touch_end. * Thanks XenReborn!. Thanks Melanie! --- OpenSim/Region/Environment/Scenes/InnerScene.cs | 3 +- .../Environment/Scenes/Scene.PacketHandlers.cs | 55 ++++++++++++++++++---- OpenSim/Region/Environment/Scenes/Scene.cs | 1 + OpenSim/Region/Environment/Scenes/SceneEvents.cs | 12 +++++ OpenSim/Region/Environment/Scenes/SceneManager.cs | 15 +++++- 5 files changed, 72 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 104ae48..d00f601 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs @@ -324,8 +324,7 @@ namespace OpenSim.Region.Environment.Scenes // Calls attach with a Zero position AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, LLVector3.Zero); } - public void RezSingleAttachment(IClientAPI remoteClient, LLUUID itemID, uint AttachmentPt, - uint ItemFlags, uint NextOwnerMask) + public void RezSingleAttachment(IClientAPI remoteClient, LLUUID itemID, uint AttachmentPt,uint ItemFlags, uint NextOwnerMask) { SceneObjectGroup objatt = m_parentScene.RezObject(remoteClient, itemID, LLVector3.Zero, LLVector3.Zero, LLUUID.Zero, (byte)1, true, (uint)(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer), diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 5e0b8ba..71b2716 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -151,22 +151,57 @@ namespace OpenSim.Region.Environment.Scenes if (ent is SceneObjectGroup) { SceneObjectGroup obj = ent as SceneObjectGroup; + if (obj != null) + { + // Is this prim part of the group + if (obj.HasChildPrim(localID)) + { + // Currently only grab/touch for the single prim + // the client handles rez correctly + obj.ObjectGrabHandler(localID, offsetPos, remoteClient); + + SceneObjectPart part = obj.GetChildPart(localID); + + // If the touched prim handles touches, deliver it + // If not, deliver to root prim + if ((part.ObjectFlags & (uint)LLObject.ObjectFlags.Touch) != 0) + EventManager.TriggerObjectGrab(part.LocalId, part.OffsetPosition, remoteClient); + else + EventManager.TriggerObjectGrab(obj.RootPart.LocalId, part.OffsetPosition, remoteClient); + + return; + } + } + } + } + } + + public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient) + { + + List EntitieList = GetEntities(); + + foreach (EntityBase ent in EntitieList) + { + if (ent is SceneObjectGroup) + { + SceneObjectGroup obj = ent as SceneObjectGroup; // Is this prim part of the group if (obj.HasChildPrim(localID)) { - // Currently only grab/touch for the single prim - // the client handles rez correctly - obj.ObjectGrabHandler(localID, offsetPos, remoteClient); - - // trigger event, one for each prim part in the group - // so that a touch to a non-root prim in a group will still - // trigger a touch_start for a script in the root prim - foreach (SceneObjectPart part in obj.Children.Values) + SceneObjectPart part=obj.GetChildPart(localID); + if (part != null) { - EventManager.TriggerObjectGrab(part.LocalId, part.OffsetPosition, remoteClient); + // If the touched prim handles touches, deliver it + // If not, deliver to root prim + if ((part.ObjectFlags & (uint)LLObject.ObjectFlags.Touch) != 0) + EventManager.TriggerObjectDeGrab(part.LocalId, remoteClient); + else + EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, remoteClient); + + return; } - return; } } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index f94aec7..a517e69 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1617,6 +1617,7 @@ namespace OpenSim.Region.Environment.Scenes client.OnMoveTaskItem += MoveTaskInventoryItem; client.OnGrabObject += ProcessObjectGrab; + client.OnDeGrabObject += ProcessObjectDeGrab; client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; client.OnParcelBuy += ProcessParcelBuy; client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs index 74554c3..769817e 100644 --- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs +++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs @@ -83,10 +83,12 @@ namespace OpenSim.Region.Environment.Scenes public event OnShutdownDelegate OnShutdown; public delegate void ObjectGrabDelegate(uint localID, LLVector3 offsetPos, IClientAPI remoteClient); + public delegate void ObjectDeGrabDelegate(uint localID, IClientAPI remoteClient); public delegate void OnPermissionErrorDelegate(LLUUID user, string reason); public event ObjectGrabDelegate OnObjectGrab; + public event ObjectDeGrabDelegate OnObjectDeGrab; public event OnPermissionErrorDelegate OnPermissionError; @@ -247,6 +249,7 @@ namespace OpenSim.Region.Environment.Scenes private OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = null; //OnParcelPrimCountAdd; private OnShutdownDelegate handlerShutdown = null; //OnShutdown; private ObjectGrabDelegate handlerObjectGrab = null; //OnObjectGrab; + private ObjectDeGrabDelegate handlerObjectDeGrab = null; //OnObjectDeGrab; private NewRezScript handlerRezScript = null; //OnRezScript; private RemoveScript handlerRemoveScript = null; //OnRemoveScript; private SceneGroupMoved handlerSceneGroupMove = null; //OnSceneGroupMove; @@ -386,6 +389,15 @@ namespace OpenSim.Region.Environment.Scenes } } + public void TriggerObjectDeGrab(uint localID, IClientAPI remoteClient) + { + handlerObjectDeGrab = OnObjectDeGrab; + if (handlerObjectDeGrab != null) + { + handlerObjectDeGrab(localID, remoteClient); + } + } + public void TriggerRezScript(uint localID, LLUUID itemID, string script) { handlerRezScript = OnRezScript; diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs index 2dfea2a..4ded1a7 100644 --- a/OpenSim/Region/Environment/Scenes/SceneManager.cs +++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs @@ -268,15 +268,26 @@ namespace OpenSim.Region.Environment.Scenes public bool TryGetScene(string regionName, out Scene scene) { + scene = null; + foreach (Scene mscene in m_localScenes) { - if (String.Compare(mscene.RegionInfo.RegionName, regionName, true) == 0) + Console.Write("Region tested: " + mscene.RegionInfo.RegionName+" With ID: "+mscene.RegionInfo.RegionID.ToString()); + + + bool b = String.Compare(mscene.RegionInfo.RegionName.Trim(), regionName.Trim(), true) == 0; + + Console.WriteLine(" <==> Result: " + b.ToString()); + + if (b) { + + Console.WriteLine("FOUND assigning region to out parameter"); scene = mscene; return true; } } - scene = null; + return false; } -- cgit v1.1