From 4f3fabae5bec8a71f9953ef9f4c247e086e4757f Mon Sep 17 00:00:00 2001 From: TBG Renfold Date: Thu, 9 Aug 2012 18:03:26 +0100 Subject: Adds osGetHealth. Returns the amount of health (in an integer) that an avatar has left in the scene. If an avatar is not found or safe is enabled on a region, -1 is returned. Example usage: default { touch_end(integer _t) { key agentID = llDetectedKey(0); osCauseDamage(agentID, 50); llSay(0, llKey2Name(agentID) + " has " + (string)osGetHealth(agentID) + "% health left."); } } --- .../Shared/Api/Implementation/OSSL_Api.cs | 21 +++++++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 7 ++++++- 3 files changed, 28 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 1e8b51b..3d233d7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2895,6 +2895,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } }); } + + public LSL_Float osGetHealth(string avatar) + { + CheckThreatLevel(ThreatLevel.None, "osGetHealth"); + m_host.AddScriptLPS(1); + + UUID avatarId = new UUID(avatar); + Vector3 pos = m_host.GetWorldPosition(); + + LSL_Float health = new LSL_Float(-1); + ScenePresence presence = World.GetScenePresence(avatarId); + if (presence != null) + { + LandData land = World.GetLandData((float)pos.X, (float)pos.Y); + if ((land.Flags & (uint)ParcelFlags.AllowDamage) == (uint)ParcelFlags.AllowDamage) + { + health = presence.Health; + } + } + return health; + } public void osCauseDamage(string avatar, double damage) { diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 1f000a3..9ad1c22 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -258,6 +258,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces int osGetSimulatorMemory(); void osKickAvatar(string FirstName,string SurName,string alert); void osSetSpeed(string UUID, LSL_Float SpeedModifier); + LSL_Float osGetHealth(string avatar); void osCauseHealing(string avatar, double healing); void osCauseDamage(string avatar, double damage); LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 94405d2..e9131e4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -865,7 +865,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier); } - + + public LSL_Float osGetHealth(string avatar) + { + return m_OSSL_Functions.osGetHealth(avatar); + } + public void osCauseDamage(string avatar, double damage) { m_OSSL_Functions.osCauseDamage(avatar, damage); -- cgit v1.1 From a3cbda0d74a14c05acf04adaaa5b9ff30c6d9fa5 Mon Sep 17 00:00:00 2001 From: TBG Renfold Date: Fri, 10 Aug 2012 01:29:41 +0100 Subject: Removed land checking as suggested by SignpostMarv. Now whatever remaining health the avatar has is displayed (float). This will be 100% (100.000000) if no damage has occurred (as what the viewer should really be seeing anyway). Returns -1.000000 if the avatar is not found. --- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 3d233d7..5e7c2d9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2901,19 +2901,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.None, "osGetHealth"); m_host.AddScriptLPS(1); - UUID avatarId = new UUID(avatar); - Vector3 pos = m_host.GetWorldPosition(); - LSL_Float health = new LSL_Float(-1); - ScenePresence presence = World.GetScenePresence(avatarId); - if (presence != null) - { - LandData land = World.GetLandData((float)pos.X, (float)pos.Y); - if ((land.Flags & (uint)ParcelFlags.AllowDamage) == (uint)ParcelFlags.AllowDamage) - { - health = presence.Health; - } - } + ScenePresence presence = World.GetScenePresence(new UUID(avatar)); + if (presence != null) health = presence.Health; return health; } -- cgit v1.1 From c55768466626336849c650349b335365c41359e5 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 24 Aug 2012 00:15:30 +0100 Subject: Fix bad child prim permissions that can make objects change perms after rezzing Port from Avination --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 3 +++ OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 18 +++++++++++++++--- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 21 +++++++++++++++++++++ 3 files changed, 39 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 7e31d60..675c64d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1943,6 +1943,9 @@ namespace OpenSim.Region.Framework.Scenes deleteIDs.Add(localID); deleteGroups.Add(grp); + // If child prims have invalid perms, fix them + grp.AdjustChildPrimPermissions(); + if (remoteClient == null) { // Autoreturn has a null client. Nothing else does. So diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index f6c725b..b4a155e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2131,6 +2131,9 @@ namespace OpenSim.Region.Framework.Scenes // Can't do this yet since backup still makes use of the root part without any synchronization // objectGroup.m_rootPart = null; + // If linking prims with different permissions, fix them + AdjustChildPrimPermissions(); + AttachToBackup(); // Here's the deal, this is ABSOLUTELY CRITICAL so the physics scene gets the update about the @@ -2622,12 +2625,21 @@ namespace OpenSim.Region.Framework.Scenes } } + public void AdjustChildPrimPermissions() + { + ForEachPart(part => + { + if (part != RootPart) + part.ClonePermissions(RootPart); + }); + } + public void UpdatePermissions(UUID AgentID, byte field, uint localID, uint mask, byte addRemTF) { - SceneObjectPart[] parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) - parts[i].UpdatePermissions(AgentID, field, localID, mask, addRemTF); + RootPart.UpdatePermissions(AgentID, field, localID, mask, addRemTF); + + AdjustChildPrimPermissions(); HasGroupChanged = true; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 2a9ee3a..411dcc7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3890,6 +3890,27 @@ namespace OpenSim.Region.Framework.Scenes } } + public void ClonePermissions(SceneObjectPart source) + { + bool update = false; + + if (BaseMask != source.BaseMask || + OwnerMask != source.OwnerMask || + GroupMask != source.GroupMask || + EveryoneMask != source.EveryoneMask || + NextOwnerMask != source.NextOwnerMask) + update = true; + + BaseMask = source.BaseMask; + OwnerMask = source.OwnerMask; + GroupMask = source.GroupMask; + EveryoneMask = source.EveryoneMask; + NextOwnerMask = source.NextOwnerMask; + + if (update) + SendFullUpdateToAllClients(); + } + public bool IsHingeJoint() { // For now, we use the NINJA naming scheme for identifying joints. -- cgit v1.1 From 2ad9d656b3a1a0c519c9599d7680f98eba7e82b8 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 10 Aug 2012 15:58:29 +0100 Subject: implementing function to allow scripts to self-replicate as if the owner duplicated them, using the same script delay as llRezObject() --- .../Shared/Api/Implementation/OSSL_Api.cs | 50 ++++++++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 7 +++ .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 +++ 3 files changed, 62 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 5e7c2d9..119c2ac 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3344,5 +3344,55 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_Key(m_host.ParentGroup.FromPartID.ToString()); } + + public void osRezDuplicate(LSL_Vector offset, LSL_Rotation rot) + { + CheckThreatLevel(ThreatLevel.High, "osRezDuplicate"); + m_host.AddScriptLPS(1); + + Vector3 v = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); + Quaternion r = new Quaternion( + (float)rot.x, + (float)rot.y, + (float)rot.z, + (float)rot.s + ); + + Vector3 destination = m_host.ParentGroup.AbsolutePosition + v; + + if (!World.Permissions.CanRezObject( + m_host.ParentGroup.PrimCount, + m_host.OwnerID, + destination + )) + { + OSSLShoutError("Cannot duplicate object to destination, owner cannot rez objects at destination parcel."); + + ScriptSleep(100); + } + else + { + SceneObjectGroup duplicate = World.SceneGraph.DuplicateObject( + m_host.ParentGroup.LocalId, + v, + m_host.ParentGroup.RootPart.GetEffectiveObjectFlags(), + m_host.OwnerID, + m_host.GroupID, + r + ); + + m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams( + "object_rez", new Object[] { + new LSL_String( + duplicate.RootPart.UUID.ToString()) }, + new DetectParams[0])); + + ScriptSleep(100); + m_ScriptEngine.PostObjectEvent(duplicate.LocalId, new EventParams( + "on_rez", new Object[]{ + new LSL_Integer(0)}, + new DetectParams[0])); + } + } } } \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 9ad1c22..8c90df4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -306,5 +306,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces /// /// Rezzing object key or NULL_KEY if rezzed by agent or otherwise unknown. LSL_Key osGetRezzingObject(); + + /// + /// Duplicates an object as if the owner duplicated it. + /// + /// + /// + void osRezDuplicate(vector offset, rotation rot); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index e9131e4..9a2f859 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -955,5 +955,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { return m_OSSL_Functions.osGetRezzingObject(); } + + public void osRezDuplicate(vector offset, rotation rot) + { + m_OSSL_Functions.osRezDuplicate(offset, rot); + } } } -- cgit v1.1 From a08687aef35079f6c2884d3ae6fd8307ca8a6b0d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 24 Aug 2012 01:18:35 +0100 Subject: Revert "implementing function to allow scripts to self-replicate as if the owner duplicated them, using the same script delay as llRezObject()" This reverts commit 2ad9d656b3a1a0c519c9599d7680f98eba7e82b8. Reverted pending consideration of associated issues. --- .../Shared/Api/Implementation/OSSL_Api.cs | 50 ---------------------- .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 7 --- .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 --- 3 files changed, 62 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 119c2ac..5e7c2d9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3344,55 +3344,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_Key(m_host.ParentGroup.FromPartID.ToString()); } - - public void osRezDuplicate(LSL_Vector offset, LSL_Rotation rot) - { - CheckThreatLevel(ThreatLevel.High, "osRezDuplicate"); - m_host.AddScriptLPS(1); - - Vector3 v = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); - Quaternion r = new Quaternion( - (float)rot.x, - (float)rot.y, - (float)rot.z, - (float)rot.s - ); - - Vector3 destination = m_host.ParentGroup.AbsolutePosition + v; - - if (!World.Permissions.CanRezObject( - m_host.ParentGroup.PrimCount, - m_host.OwnerID, - destination - )) - { - OSSLShoutError("Cannot duplicate object to destination, owner cannot rez objects at destination parcel."); - - ScriptSleep(100); - } - else - { - SceneObjectGroup duplicate = World.SceneGraph.DuplicateObject( - m_host.ParentGroup.LocalId, - v, - m_host.ParentGroup.RootPart.GetEffectiveObjectFlags(), - m_host.OwnerID, - m_host.GroupID, - r - ); - - m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams( - "object_rez", new Object[] { - new LSL_String( - duplicate.RootPart.UUID.ToString()) }, - new DetectParams[0])); - - ScriptSleep(100); - m_ScriptEngine.PostObjectEvent(duplicate.LocalId, new EventParams( - "on_rez", new Object[]{ - new LSL_Integer(0)}, - new DetectParams[0])); - } - } } } \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 8c90df4..9ad1c22 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -306,12 +306,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces /// /// Rezzing object key or NULL_KEY if rezzed by agent or otherwise unknown. LSL_Key osGetRezzingObject(); - - /// - /// Duplicates an object as if the owner duplicated it. - /// - /// - /// - void osRezDuplicate(vector offset, rotation rot); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 9a2f859..e9131e4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -955,10 +955,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { return m_OSSL_Functions.osGetRezzingObject(); } - - public void osRezDuplicate(vector offset, rotation rot) - { - m_OSSL_Functions.osRezDuplicate(offset, rot); - } } } -- cgit v1.1