Fix bug in osCauseHealing() if called with an avatar ID for an avatar that is not in the scene.

user_profiles
Justin Clark-Casey (justincc) 2013-03-14 23:16:39 +00:00
parent 56b333f301
commit 0ea0f8aa83
1 changed files with 9 additions and 13 deletions

View File

@ -3014,22 +3014,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID avatarId = new UUID(avatar); UUID avatarId = new UUID(avatar);
ScenePresence presence = World.GetScenePresence(avatarId); ScenePresence presence = World.GetScenePresence(avatarId);
Vector3 pos = m_host.GetWorldPosition();
bool result = World.ScriptDanger(m_host.LocalId, new Vector3((float)pos.X, (float)pos.Y, (float)pos.Z)); if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition()))
if (result)
{
if (presence != null)
{ {
float health = presence.Health; float health = presence.Health;
health += (float)healing; health += (float)healing;
if (health >= 100) if (health >= 100)
{
health = 100; health = 100;
}
presence.setHealthWithUpdate(health); presence.setHealthWithUpdate(health);
} }
} }
}
public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules) public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules)
{ {