public void osCauseDamage(string avatar, double damage)
{
CheckThreatLevel(ThreatLevel.High, "osCauseDamage");
m_host.AddScriptLPS(1);
UUID avatarId = new UUID(avatar);
Vector3 pos = m_host.GetWorldPosition();
ScenePresence presence = World.GetScenePresence(avatarId);
if (presence != null)
{
LandData land = World.GetLandData(pos);
if ((land.Flags & (uint)ParcelFlags.AllowDamage) == (uint)ParcelFlags.AllowDamage)
{
float health = presence.Health;
health -= (float)damage;
presence.setHealthWithUpdate(health);
if (health <= 0)
{
float healthliveagain = 100;
presence.ControllingClient.SendAgentAlertMessage("You died!", true);
presence.setHealthWithUpdate(healthliveagain);
presence.Scene.TeleportClientHome(presence.UUID, presence.ControllingClient);
}
}
}
}