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,25 +3704,27 @@ 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);
if ((land.Flags & (uint)ParcelFlags.AllowDamage) == (uint)ParcelFlags.AllowDamage)
{ {
LandData land = World.GetLandData(pos); float health = presence.Health;
if ((land.Flags & (uint)ParcelFlags.AllowDamage) == (uint)ParcelFlags.AllowDamage) health -= (float)damage;
presence.setHealthWithUpdate(health);
if (health <= 0)
{ {
float health = presence.Health; float healthliveagain = 100;
health -= (float)damage; presence.ControllingClient.SendAgentAlertMessage("You died!", true);
presence.setHealthWithUpdate(health); presence.setHealthWithUpdate(healthliveagain);
if (health <= 0) presence.Scene.TeleportClientHome(presence.UUID, presence.ControllingClient);
{
float healthliveagain = 100;
presence.ControllingClient.SendAgentAlertMessage("You died!", true);
presence.setHealthWithUpdate(healthliveagain);
presence.Scene.TeleportClientHome(presence.UUID, presence.ControllingClient);
}
} }
} }
} }
@ -3726,19 +3733,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
CheckThreatLevel(ThreatLevel.High, "osCauseHealing"); CheckThreatLevel(ThreatLevel.High, "osCauseHealing");
UUID avatarId = new UUID(avatar); UUID avatarId;
if (!UUID.TryParse(avatar, out avatarId))
return;
ScenePresence presence = World.GetScenePresence(avatarId); ScenePresence presence = World.GetScenePresence(avatarId);
if (presence == null)
return;
if (presence != null) float health = presence.Health;
{ health += (float)healing;
float health = presence.Health;
health += (float)healing;
if (health >= 100) if (health >= 100)
health = 100; health = 100;
presence.setHealthWithUpdate(health); presence.setHealthWithUpdate(health);
}
} }
public void osSetHealth(string avatar, double health) public void osSetHealth(string avatar, double health)
@ -3763,11 +3772,15 @@ 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;
if (presence != null) ScenePresence presence = World.GetScenePresence(avatarId);
presence.HealRate = (float)healrate; if (presence == null)
return;
presence.HealRate = (float)healrate;
} }
public LSL_Float osGetHealRate(string avatar) public LSL_Float osGetHealRate(string avatar)
@ -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;

View File

@ -383,7 +383,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
int osGetSimulatorMemoryKB(); int osGetSimulatorMemoryKB();
void osKickAvatar(string FirstName,string SurName,string alert); void osKickAvatar(string FirstName,string SurName,string alert);
void osSetSpeed(string UUID, LSL_Float SpeedModifier); void osSetSpeed(string UUID, LSL_Float SpeedModifier);
void osSetOwnerSpeed(LSL_Float SpeedModifier); void osSetOwnerSpeed(LSL_Float SpeedModifier);
LSL_Float osGetHealth(string avatar); LSL_Float osGetHealth(string avatar);
void osCauseHealing(string avatar, double healing); void osCauseHealing(string avatar, double healing);
void osSetHealth(string avatar, double health); void osSetHealth(string avatar, double health);

View File

@ -986,7 +986,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier); m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier);
} }
public void osSetOwnerSpeed(LSL_Float SpeedModifier) public void osSetOwnerSpeed(LSL_Float SpeedModifier)
{ {
m_OSSL_Functions.osSetOwnerSpeed(SpeedModifier); m_OSSL_Functions.osSetOwnerSpeed(SpeedModifier);
} }