From 33a894f3d2cc95a7a512b86f39f3c6a6afabb015 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 27 Aug 2011 00:15:21 +0100 Subject: refactor: move SOP.IsAttachment and AttachmentPoint up into SOG to avoid pointless duplication of identical values --- .../Shared/Api/Implementation/LSL_Api.cs | 20 ++++++++++---------- .../Api/Implementation/Plugins/SensorRepeat.cs | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 81f1f38..a7f08d9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1965,7 +1965,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (part.ParentGroup.RootPart == part) { - if ((targetPos.z < ground) && disable_underground_movement && m_host.AttachmentPoint == 0) + if ((targetPos.z < ground) && disable_underground_movement && m_host.ParentGroup.AttachmentPoint == 0) targetPos.z = ground; SceneObjectGroup parent = part.ParentGroup; LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos); @@ -2097,7 +2097,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Quaternion q; if (part.LinkNum == 0 || part.LinkNum == 1) // unlinked or root prim { - if (part.ParentGroup.RootPart.AttachmentPoint != 0) + if (part.ParentGroup.AttachmentPoint != 0) { ScenePresence avatar = World.GetScenePresence(part.ParentGroup.AttachedAvatar); if (avatar != null) @@ -2241,7 +2241,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Vector3 vel; - if (m_host.IsAttachment) + if (m_host.ParentGroup.IsAttachment) { ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.AttachedAvatar); vel = avatar.Velocity; @@ -2997,7 +2997,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - if (m_host.ParentGroup.RootPart.AttachmentPoint == 0) + if (m_host.ParentGroup.AttachmentPoint == 0) return; TaskInventoryItem item; @@ -3587,7 +3587,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)targetID); - if (targetPart.ParentGroup.RootPart.AttachmentPoint != 0) + if (targetPart.ParentGroup.AttachmentPoint != 0) return; // Fail silently if attached SceneObjectGroup parentPrim = null, childPrim = null; @@ -3640,7 +3640,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SceneObjectGroup parentPrim = m_host.ParentGroup; - if (parentPrim.RootPart.AttachmentPoint != 0) + if (parentPrim.AttachmentPoint != 0) return; // Fail silently if attached SceneObjectPart childPrim = null; @@ -3710,7 +3710,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); SceneObjectGroup parentPrim = m_host.ParentGroup; - if (parentPrim.RootPart.AttachmentPoint != 0) + if (parentPrim.AttachmentPoint != 0) return; // Fail silently if attached List parts = new List(parentPrim.Parts); @@ -4349,7 +4349,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; // Object not pushable. Not an attachment and has no physics component - if (!pusheeob.IsAttachment && pusheeob.PhysActor == null) + if (!pusheeob.ParentGroup.IsAttachment && pusheeob.PhysActor == null) return; PusheePos = pusheeob.AbsolutePosition; @@ -5857,7 +5857,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llGetAttached() { m_host.AddScriptLPS(1); - return m_host.ParentGroup.RootPart.AttachmentPoint; + return m_host.ParentGroup.AttachmentPoint; } public LSL_Integer llGetFreeMemory() @@ -7458,7 +7458,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); Quaternion q; - if (m_host.ParentGroup.RootPart.AttachmentPoint != 0) + if (m_host.ParentGroup.AttachmentPoint != 0) { ScenePresence avatar = World.GetScenePresence(m_host.ParentGroup.AttachedAvatar); if (avatar != null) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index bf74760..4ac7f8b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -303,7 +303,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins float dz; Quaternion q = SensePoint.RotationOffset; - if (SensePoint.ParentGroup.RootPart.IsAttachment) + if (SensePoint.ParentGroup.IsAttachment) { // In attachments, the sensor cone always orients with the // avatar rotation. This may include a nonzero elevation if @@ -352,7 +352,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins objtype = 0; part = ((SceneObjectGroup)ent).RootPart; - if (part.AttachmentPoint != 0) // Attached so ignore + if (part.ParentGroup.AttachmentPoint != 0) // Attached so ignore continue; if (part.Inventory.ContainsScripts()) @@ -423,7 +423,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins Vector3 fromRegionPos = SensePoint.AbsolutePosition; Quaternion q = SensePoint.RotationOffset; - if (SensePoint.ParentGroup.RootPart.IsAttachment) + if (SensePoint.ParentGroup.IsAttachment) { // In attachments, the sensor cone always orients with the // avatar rotation. This may include a nonzero elevation if @@ -435,7 +435,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r); double mag_fwd = LSL_Types.Vector3.Mag(forward_dir); - bool attached = (SensePoint.AttachmentPoint != 0); + bool attached = (SensePoint.ParentGroup.AttachmentPoint != 0); Vector3 toRegionPos; double dis; -- cgit v1.1