minor changes

0.9.1.0-post-fixes
UbitUmarov 2018-09-29 21:40:52 +01:00
parent 6d9de17d77
commit 8812684355
3 changed files with 56 additions and 38 deletions

View File

@ -3646,12 +3646,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return (int)pws; return (int)pws;
} }
public void osSetSpeed(string UUID, LSL_Float SpeedModifier) public void osSetSpeed(string ID, LSL_Float SpeedModifier)
{ {
CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed");
ScenePresence avatar = World.GetScenePresence(new UUID(UUID)); UUID avid;
if(!UUID.TryParse(ID, out avid))
return;
ScenePresence avatar = World.GetScenePresence(avid);
if (avatar != null) if (avatar != null)
avatar.SpeedModifier = (float)SpeedModifier; avatar.SpeedModifier = (float)SpeedModifier;
} }
@ -3659,9 +3662,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void osSetOwnerSpeed(LSL_Float SpeedModifier) public void osSetOwnerSpeed(LSL_Float SpeedModifier)
{ {
CheckThreatLevel(ThreatLevel.Moderate, "osSetOwnerSpeed"); CheckThreatLevel(ThreatLevel.Moderate, "osSetOwnerSpeed");
if(SpeedModifier > 4)SpeedModifier = 4;
ScenePresence avatar = World.GetScenePresence(m_host.OwnerID);
if(SpeedModifier > 4)
SpeedModifier = 4;
ScenePresence avatar = World.GetScenePresence(m_host.OwnerID);
if (avatar != null) if (avatar != null)
avatar.SpeedModifier = (float)SpeedModifier; avatar.SpeedModifier = (float)SpeedModifier;
} }
@ -3699,12 +3704,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
CheckThreatLevel(ThreatLevel.High, "osCauseDamage"); CheckThreatLevel(ThreatLevel.High, "osCauseDamage");
UUID avatarId = new UUID(avatar); UUID avatarId;
Vector3 pos = m_host.GetWorldPosition(); if (!UUID.TryParse(avatar, out avatarId))
return;
ScenePresence presence = World.GetScenePresence(avatarId); ScenePresence presence = World.GetScenePresence(avatarId);
if (presence != null) if (presence == null)
{ return;
Vector3 pos = m_host.GetWorldPosition();
LandData land = World.GetLandData(pos); LandData land = World.GetLandData(pos);
if ((land.Flags & (uint)ParcelFlags.AllowDamage) == (uint)ParcelFlags.AllowDamage) if ((land.Flags & (uint)ParcelFlags.AllowDamage) == (uint)ParcelFlags.AllowDamage)
{ {
@ -3720,17 +3728,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
} }
} }
}
public void osCauseHealing(string avatar, double healing) public void osCauseHealing(string avatar, double healing)
{ {
CheckThreatLevel(ThreatLevel.High, "osCauseHealing"); CheckThreatLevel(ThreatLevel.High, "osCauseHealing");
UUID avatarId = new UUID(avatar); UUID avatarId;
ScenePresence presence = World.GetScenePresence(avatarId); if (!UUID.TryParse(avatar, out avatarId))
return;
ScenePresence presence = World.GetScenePresence(avatarId);
if (presence == null)
return;
if (presence != null)
{
float health = presence.Health; float health = presence.Health;
health += (float)healing; health += (float)healing;
@ -3739,7 +3749,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
presence.setHealthWithUpdate(health); presence.setHealthWithUpdate(health);
} }
}
public void osSetHealth(string avatar, double health) public void osSetHealth(string avatar, double health)
{ {
@ -3763,10 +3772,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
CheckThreatLevel(ThreatLevel.High, "osSetHealRate"); CheckThreatLevel(ThreatLevel.High, "osSetHealRate");
UUID avatarId = new UUID(avatar); UUID avatarId;
ScenePresence presence = World.GetScenePresence(avatarId); if (!UUID.TryParse(avatar, out avatarId))
return;
ScenePresence presence = World.GetScenePresence(avatarId);
if (presence == null)
return;
if (presence != null)
presence.HealRate = (float)healrate; presence.HealRate = (float)healrate;
} }
@ -3775,7 +3788,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
CheckThreatLevel(ThreatLevel.None, "osGetHealRate"); CheckThreatLevel(ThreatLevel.None, "osGetHealRate");
LSL_Float rate = new LSL_Float(0); LSL_Float rate = new LSL_Float(0);
ScenePresence presence = World.GetScenePresence(new UUID(avatar));
UUID avatarId;
if (!UUID.TryParse(avatar, out avatarId))
return rate;
ScenePresence presence = World.GetScenePresence(avatarId);
if (presence != null) if (presence != null)
rate = presence.HealRate; rate = presence.HealRate;
return rate; return rate;