aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorTBG Renfold2012-08-09 18:03:26 +0100
committerJustin Clark-Casey (justincc)2012-08-24 00:13:14 +0100
commit4f3fabae5bec8a71f9953ef9f4c247e086e4757f (patch)
treee274526ce8e1653175f8da04000d8b07f10507b3 /OpenSim
parentIf a script state save fails for some reason on shutdown/region removal, get ... (diff)
downloadopensim-SC_OLD-4f3fabae5bec8a71f9953ef9f4c247e086e4757f.zip
opensim-SC_OLD-4f3fabae5bec8a71f9953ef9f4c247e086e4757f.tar.gz
opensim-SC_OLD-4f3fabae5bec8a71f9953ef9f4c247e086e4757f.tar.bz2
opensim-SC_OLD-4f3fabae5bec8a71f9953ef9f4c247e086e4757f.tar.xz
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."); } }
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs21
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs7
3 files changed, 28 insertions, 1 deletions
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
2895 } 2895 }
2896 }); 2896 });
2897 } 2897 }
2898
2899 public LSL_Float osGetHealth(string avatar)
2900 {
2901 CheckThreatLevel(ThreatLevel.None, "osGetHealth");
2902 m_host.AddScriptLPS(1);
2903
2904 UUID avatarId = new UUID(avatar);
2905 Vector3 pos = m_host.GetWorldPosition();
2906
2907 LSL_Float health = new LSL_Float(-1);
2908 ScenePresence presence = World.GetScenePresence(avatarId);
2909 if (presence != null)
2910 {
2911 LandData land = World.GetLandData((float)pos.X, (float)pos.Y);
2912 if ((land.Flags & (uint)ParcelFlags.AllowDamage) == (uint)ParcelFlags.AllowDamage)
2913 {
2914 health = presence.Health;
2915 }
2916 }
2917 return health;
2918 }
2898 2919
2899 public void osCauseDamage(string avatar, double damage) 2920 public void osCauseDamage(string avatar, double damage)
2900 { 2921 {
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
258 int osGetSimulatorMemory(); 258 int osGetSimulatorMemory();
259 void osKickAvatar(string FirstName,string SurName,string alert); 259 void osKickAvatar(string FirstName,string SurName,string alert);
260 void osSetSpeed(string UUID, LSL_Float SpeedModifier); 260 void osSetSpeed(string UUID, LSL_Float SpeedModifier);
261 LSL_Float osGetHealth(string avatar);
261 void osCauseHealing(string avatar, double healing); 262 void osCauseHealing(string avatar, double healing);
262 void osCauseDamage(string avatar, double damage); 263 void osCauseDamage(string avatar, double damage);
263 LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules); 264 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
865 { 865 {
866 m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier); 866 m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier);
867 } 867 }
868 868
869 public LSL_Float osGetHealth(string avatar)
870 {
871 return m_OSSL_Functions.osGetHealth(avatar);
872 }
873
869 public void osCauseDamage(string avatar, double damage) 874 public void osCauseDamage(string avatar, double damage)
870 { 875 {
871 m_OSSL_Functions.osCauseDamage(avatar, damage); 876 m_OSSL_Functions.osCauseDamage(avatar, damage);