From a348c8e44a72bd2de0151fc6db7a229cd8ee86a2 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 26 May 2013 14:11:48 +0200 Subject: Allow Linden trees to preserve their type when taken into inventory and rezzed again. Allow Linden trees to be sensed by LLSensor as PASSIVE objects. --- .../Framework/InventoryAccess/InventoryAccessModule.cs | 15 ++++++++++++--- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 5 +++++ .../Shared/Api/Implementation/Plugins/SensorRepeat.cs | 4 +++- 3 files changed, 20 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 43c7e7d..4c11135 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -387,7 +387,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess inventoryStoredPosition = objectGroup.RootPart.AttachOffset; inventoryStoredRotation = objectGroup.RootPart.AttachRotation; } - objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint; + + // Trees could be attached and it's been done, but it makes + // no sense. State must be preserved because it's the tree type + if (objectGroup.RootPart.Shape.PCode != (byte)PCode.Tree && + objectGroup.RootPart.Shape.PCode != (byte)PCode.NewTree) + objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint; objectGroup.AbsolutePosition = inventoryStoredPosition; objectGroup.RootPart.RotationOffset = inventoryStoredRotation; @@ -791,7 +796,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess g.RootPart.AttachPoint = g.RootPart.Shape.State; g.RootPart.AttachOffset = g.AbsolutePosition; g.RootPart.AttachRotation = g.GroupRotation; - g.RootPart.Shape.State = 0; + if (g.RootPart.Shape.PCode != (byte)PCode.NewTree && + g.RootPart.Shape.PCode != (byte)PCode.Tree) + g.RootPart.Shape.State = 0; } objlist.Add(g); @@ -825,7 +832,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess g.RootPart.AttachPoint = g.RootPart.Shape.State; g.RootPart.AttachOffset = g.AbsolutePosition; g.RootPart.AttachRotation = g.GroupRotation; - g.RootPart.Shape.State = 0; + if (g.RootPart.Shape.PCode != (byte)PCode.NewTree && + g.RootPart.Shape.PCode != (byte)PCode.Tree) + g.RootPart.Shape.State = 0; objlist.Add(g); XmlElement el = (XmlElement)n; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 69fb6df..0ea4e09 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -272,6 +272,11 @@ namespace OpenSim.Region.Framework.Scenes { AttachmentPoint = 0; + // Don't zap trees + if (RootPart.Shape.PCode == (byte)PCode.Tree || + RootPart.Shape.PCode == (byte)PCode.NewTree) + return; + // Even though we don't use child part state parameters for attachments any more, we still need to set // these to zero since having them non-zero in rezzed scene objects will crash some clients. Even if // we store them correctly, scene objects that we receive from elsewhere might not. diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 884f07c..a47e452 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -398,7 +398,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins objtype = 0; part = ((SceneObjectGroup)ent).RootPart; - if (part.ParentGroup.AttachmentPoint != 0) // Attached so ignore + if (part.ParentGroup.RootPart.Shape.PCode != (byte)PCode.Tree && + part.ParentGroup.RootPart.Shape.PCode != (byte)PCode.NewTree && + part.ParentGroup.AttachmentPoint != 0) // Attached so ignore continue; if (part.Inventory.ContainsScripts()) -- cgit v1.1