From e9134a050aa9fb65afefdac9574a66fb918afe00 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Mon, 20 Oct 2008 01:42:02 +0000 Subject: Thank you kindly, Idb for a patch that solves: lsl conformity, llPushObject incorrectly restricts the pushing of objects based on region and parcel flags --- .../Shared/Api/Implementation/LSL_Api.cs | 124 ++++++++++----------- 1 file changed, 59 insertions(+), 65 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index d410a59..2f5337f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3480,57 +3480,50 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; ScenePresence pusheeav = null; - //SceneObjectPart pusheeob = null; - EntityBase obj = null; Vector3 PusheePos = Vector3.Zero; SceneObjectPart pusheeob = null; - List avatars = World.GetAvatars(); - foreach (ScenePresence avatar in avatars) + ScenePresence avatar = World.GetScenePresence(targetID); + if (avatar != null) { - if (avatar.UUID == targetID) - { - pusheeIsAvatar = true; + pusheeIsAvatar = true; - // Pushee doesn't have a physics actor - if (avatar.PhysicsActor == null) - return; + // Pushee doesn't have a physics actor + if (avatar.PhysicsActor == null) + return; - // Pushee is in GodMode this pushing object isn't owned by them - if (avatar.GodLevel > 0 && m_host.OwnerID != targetID) - return; - - pusheeav = avatar; - - // Find pushee position - // Pushee Linked? - if (pusheeav.ParentID != 0) + // Pushee is in GodMode this pushing object isn't owned by them + if (avatar.GodLevel > 0 && m_host.OwnerID != targetID) + return; + + pusheeav = avatar; + + // Find pushee position + // Pushee Linked? + if (pusheeav.ParentID != 0) + { + SceneObjectPart parentobj = World.GetSceneObjectPart(pusheeav.ParentID); + if (parentobj != null) { - SceneObjectPart parentobj = World.GetSceneObjectPart(pusheeav.ParentID); - if (parentobj != null) - { - PusheePos = parentobj.AbsolutePosition; - } - else - { - PusheePos = pusheeav.AbsolutePosition; - } + PusheePos = parentobj.AbsolutePosition; } else { PusheePos = pusheeav.AbsolutePosition; } - - obj = (EntityBase)pusheeav; - break; + } + else + { + PusheePos = pusheeav.AbsolutePosition; } } if (!pusheeIsAvatar) { + // not an avatar so push is not affected by parcel flags pusheeob = World.GetSceneObjectPart((UUID)target); - + // We can't find object if (pusheeob == null) return; @@ -3540,50 +3533,51 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; PusheePos = pusheeob.AbsolutePosition; - //obj = (EntityBase)pusheeob; - } - - - if (pushrestricted) - { - ILandObject targetlandObj = World.LandChannel.GetLandObject(PusheePos.X,PusheePos.Y); - - // We didn't find the parcel but region is push restricted so assume it is NOT ok - if (targetlandObj == null) - return; - - // Need provisions for Group Owned here - if (m_host.OwnerID == targetlandObj.landData.OwnerID || targetlandObj.landData.IsGroupOwned || m_host.OwnerID == targetID) - { - pushAllowed = true; - } + pushAllowed = true; } else { - ILandObject targetlandObj = World.LandChannel.GetLandObject(PusheePos.X, PusheePos.Y); - if (targetlandObj == null) + if (pushrestricted) { - // We didn't find the parcel but region isn't push restricted so assume it's ok - pushAllowed = true; + ILandObject targetlandObj = World.LandChannel.GetLandObject(PusheePos.X, PusheePos.Y); + + // We didn't find the parcel but region is push restricted so assume it is NOT ok + if (targetlandObj == null) + return; + + // Need provisions for Group Owned here + if (m_host.OwnerID == targetlandObj.landData.OwnerID || targetlandObj.landData.IsGroupOwned || m_host.OwnerID == targetID) + { + pushAllowed = true; + } } else { - // Parcel push restriction - if ((targetlandObj.landData.Flags & (uint)Parcel.ParcelFlags.RestrictPushObject) == (uint)Parcel.ParcelFlags.RestrictPushObject) + ILandObject targetlandObj = World.LandChannel.GetLandObject(PusheePos.X, PusheePos.Y); + if (targetlandObj == null) { - // Need provisions for Group Owned here - if (m_host.OwnerID == targetlandObj.landData.OwnerID || targetlandObj.landData.IsGroupOwned || m_host.OwnerID == targetID) - { - pushAllowed = true; - } - - //Parcel.ParcelFlags.RestrictPushObject - //pushAllowed = true; + // We didn't find the parcel but region isn't push restricted so assume it's ok + pushAllowed = true; } else { - // Parcel isn't push restricted - pushAllowed = true; + // Parcel push restriction + if ((targetlandObj.landData.Flags & (uint)Parcel.ParcelFlags.RestrictPushObject) == (uint)Parcel.ParcelFlags.RestrictPushObject) + { + // Need provisions for Group Owned here + if (m_host.OwnerID == targetlandObj.landData.OwnerID || targetlandObj.landData.IsGroupOwned || m_host.OwnerID == targetID) + { + pushAllowed = true; + } + + //Parcel.ParcelFlags.RestrictPushObject + //pushAllowed = true; + } + else + { + // Parcel isn't push restricted + pushAllowed = true; + } } } } -- cgit v1.1