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.integration
parent
4f3fabae5b
commit
a3cbda0d74
|
@ -2901,19 +2901,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
CheckThreatLevel(ThreatLevel.None, "osGetHealth");
|
CheckThreatLevel(ThreatLevel.None, "osGetHealth");
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
UUID avatarId = new UUID(avatar);
|
|
||||||
Vector3 pos = m_host.GetWorldPosition();
|
|
||||||
|
|
||||||
LSL_Float health = new LSL_Float(-1);
|
LSL_Float health = new LSL_Float(-1);
|
||||||
ScenePresence presence = World.GetScenePresence(avatarId);
|
ScenePresence presence = World.GetScenePresence(new UUID(avatar));
|
||||||
if (presence != null)
|
if (presence != null) health = presence.Health;
|
||||||
{
|
|
||||||
LandData land = World.GetLandData((float)pos.X, (float)pos.Y);
|
|
||||||
if ((land.Flags & (uint)ParcelFlags.AllowDamage) == (uint)ParcelFlags.AllowDamage)
|
|
||||||
{
|
|
||||||
health = presence.Health;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return health;
|
return health;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue