mirror of
https://github.com/opensim/opensim.git
synced 2026-07-31 13:55:35 +08:00
add osSetHealth() value from 1 to 100; (mantis 7973)
This commit is contained in:
@@ -3469,6 +3469,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
}
|
||||
|
||||
public void osSetHealth(string avatar, double health)
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.High, "osSetHealth");
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
UUID avatarId = new UUID(avatar);
|
||||
ScenePresence presence = World.GetScenePresence(avatarId);
|
||||
|
||||
if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition()))
|
||||
{
|
||||
if (health > 100.0)
|
||||
health = 100.0;
|
||||
else if (health < 1.0)
|
||||
health = 1.0;
|
||||
|
||||
presence.setHealthWithUpdate((float)health);
|
||||
}
|
||||
}
|
||||
|
||||
public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules)
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.High, "osGetPrimitiveParams");
|
||||
|
||||
@@ -368,6 +368,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||
void osSetSpeed(string UUID, LSL_Float SpeedModifier);
|
||||
LSL_Float osGetHealth(string avatar);
|
||||
void osCauseHealing(string avatar, double healing);
|
||||
void osSetHealth(string avatar, double health);
|
||||
void osCauseDamage(string avatar, double damage);
|
||||
void osForceOtherSit(string avatar);
|
||||
void osForceOtherSit(string avatar, string target);
|
||||
|
||||
@@ -945,6 +945,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
m_OSSL_Functions.osCauseHealing(avatar, healing);
|
||||
}
|
||||
|
||||
public void osSetHealth(string avatar, double health)
|
||||
{
|
||||
m_OSSL_Functions.osSetHealth(avatar, health);
|
||||
}
|
||||
|
||||
public void osForceOtherSit(string avatar)
|
||||
{
|
||||
m_OSSL_Functions.osForceOtherSit(avatar);
|
||||
|
||||
Reference in New Issue
Block a user