llGetHealth

Signed-off-by: UbitUmarov <ajlduarte@sapo.pt>
This commit is contained in:
Vincent Sylvester
2025-03-31 08:47:11 +02:00
committed by UbitUmarov
parent 4d0312f122
commit ae4ea576d5
3 changed files with 18 additions and 0 deletions

View File

@@ -5271,6 +5271,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.ParentGroup.Damage = (float)damage;
}
public LSL_Float llGetHealth(LSL_String key)
{
if (UUID.TryParse(key, out UUID agent))
{
ScenePresence user = World.GetScenePresence(agent);
if (user is not null)
return user.Health;
}
return new LSL_Float(-1.0);
}
public void llTeleportAgentHome(string agent)
{
if (UUID.TryParse(agent, out UUID agentId) && agentId.IsNotZero())

View File

@@ -373,6 +373,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void llSetColor(LSL_Vector color, int face);
void llSetContentType(LSL_Key id, LSL_Integer type);
void llSetDamage(double damage);
LSL_Float llGetHealth(LSL_String key);
void llSetForce(LSL_Vector force, int local);
void llSetForceAndTorque(LSL_Vector force, LSL_Vector torque, int local);
void llSetVelocity(LSL_Vector vel, int local);

View File

@@ -1940,6 +1940,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_LSL_Functions.llSetDamage(damage);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public LSL_Float llGetHealth(LSL_String key)
{
return m_LSL_Functions.llGetHealth(key);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void llSetForce(LSL_Vector force, int local)
{