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,26 +3646,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return (int)pws;
}
public void osSetSpeed(string UUID, LSL_Float SpeedModifier)
public void osSetSpeed(string ID, LSL_Float SpeedModifier)
{
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)
avatar.SpeedModifier = (float)SpeedModifier;
}
public void osSetOwnerSpeed(LSL_Float SpeedModifier)
{
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)
avatar.SpeedModifier = (float)SpeedModifier;
}
public void osKickAvatar(string FirstName, string SurName, string alert)
{
CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar");
@ -3699,25 +3704,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
CheckThreatLevel(ThreatLevel.High, "osCauseDamage");
UUID avatarId = new UUID(avatar);
Vector3 pos = m_host.GetWorldPosition();
UUID avatarId;
if (!UUID.TryParse(avatar, out avatarId))
return;
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);
if ((land.Flags & (uint)ParcelFlags.AllowDamage) == (uint)ParcelFlags.AllowDamage)
float health = presence.Health;
health -= (float)damage;
presence.setHealthWithUpdate(health);
if (health <= 0)
{
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);
}
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");
UUID avatarId = new UUID(avatar);
UUID avatarId;
if (!UUID.TryParse(avatar, out avatarId))
return;
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)
health = 100;
if (health >= 100)
health = 100;
presence.setHealthWithUpdate(health);
}
presence.setHealthWithUpdate(health);
}
public void osSetHealth(string avatar, double health)
@ -3763,11 +3772,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
CheckThreatLevel(ThreatLevel.High, "osSetHealRate");
UUID avatarId = new UUID(avatar);
ScenePresence presence = World.GetScenePresence(avatarId);
UUID avatarId;
if (!UUID.TryParse(avatar, out avatarId))
return;
if (presence != null)
presence.HealRate = (float)healrate;
ScenePresence presence = World.GetScenePresence(avatarId);
if (presence == null)
return;
presence.HealRate = (float)healrate;
}
public LSL_Float osGetHealRate(string avatar)
@ -3775,7 +3788,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
CheckThreatLevel(ThreatLevel.None, "osGetHealRate");
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)
rate = presence.HealRate;
return rate;

View File

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

View File

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