add osSetHealth() value from 1 to 100; (mantis 7973)

LSLKeyTest
UbitUmarov 2016-07-24 16:31:29 +01:00
parent 37936550f0
commit 2bb467e358
4 changed files with 26 additions and 0 deletions

View File

@ -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");

View File

@ -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);

View File

@ -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);

View File

@ -157,6 +157,7 @@
; ThreatLevel High
Allow_osCauseDamage = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER
Allow_osCauseHealing = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER
Allow_osSetHealth = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER
Allow_osForceAttachToAvatar = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER
Allow_osForceAttachToAvatarFromInventory = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER
Allow_osForceCreateLink = ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER