diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 21 |
1 files changed, 21 insertions, 0 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 | { |