add osKickAvatar(LSL_Key agentKey, string alert)

0.9.1.0-post-fixes
UbitUmarov 2019-02-20 02:06:25 +00:00
parent 98b6ba24b4
commit fdf5274c25
3 changed files with 53 additions and 22 deletions

View File

@ -3629,7 +3629,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar");
World.ForEachRootScenePresence(delegate(ScenePresence sp) World.ForEachRootScenePresence(delegate (ScenePresence sp)
{ {
if (sp.Firstname == FirstName && sp.Lastname == SurName) if (sp.Firstname == FirstName && sp.Lastname == SurName)
{ {
@ -3643,18 +3643,43 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}); });
} }
public LSL_Float osGetHealth(string avatar) public void osKickAvatar(LSL_Key agentKey, string alert)
{
CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar");
UUID id;
if (!UUID.TryParse(agentKey, out id) || id == UUID.Zero)
return;
ScenePresence sp = World.GetScenePresence(id);
if(sp == null)
return;
// kick client...
if (alert != null)
sp.ControllingClient.Kick(alert);
// ...and close on our side
sp.Scene.CloseAgent(id, false);
}
public LSL_Float osGetHealth(LSL_Key agentKey)
{ {
CheckThreatLevel(ThreatLevel.None, "osGetHealth"); CheckThreatLevel(ThreatLevel.None, "osGetHealth");
LSL_Float health = new LSL_Float(-1); LSL_Float health = new LSL_Float(-1);
ScenePresence presence = World.GetScenePresence(new UUID(avatar));
UUID id;
if (!UUID.TryParse(agentKey, out id) || id == UUID.Zero)
return health;
ScenePresence presence = World.GetScenePresence(id);
if (presence != null) if (presence != null)
health = presence.Health; health = presence.Health;
return health; return health;
} }
public void osCauseDamage(string avatar, double damage) public void osCauseDamage(LSL_Key avatar, LSL_Float damage)
{ {
CheckThreatLevel(ThreatLevel.High, "osCauseDamage"); CheckThreatLevel(ThreatLevel.High, "osCauseDamage");
@ -3683,7 +3708,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
} }
public void osCauseHealing(string avatar, double healing) public void osCauseHealing(LSL_Key avatar, LSL_Float healing)
{ {
CheckThreatLevel(ThreatLevel.High, "osCauseHealing"); CheckThreatLevel(ThreatLevel.High, "osCauseHealing");
@ -3704,7 +3729,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
presence.setHealthWithUpdate(health); presence.setHealthWithUpdate(health);
} }
public void osSetHealth(string avatar, double health) public void osSetHealth(LSL_Key avatar, LSL_Float health)
{ {
CheckThreatLevel(ThreatLevel.High, "osSetHealth"); CheckThreatLevel(ThreatLevel.High, "osSetHealth");
@ -3722,7 +3747,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
} }
public void osSetHealRate(string avatar, double healrate) public void osSetHealRate(LSL_Key avatar, LSL_Float healrate)
{ {
CheckThreatLevel(ThreatLevel.High, "osSetHealRate"); CheckThreatLevel(ThreatLevel.High, "osSetHealRate");
@ -3737,7 +3762,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
presence.HealRate = (float)healrate; presence.HealRate = (float)healrate;
} }
public LSL_Float osGetHealRate(string avatar) public LSL_Float osGetHealRate(LSL_Key avatar)
{ {
CheckThreatLevel(ThreatLevel.None, "osGetHealRate"); CheckThreatLevel(ThreatLevel.None, "osGetHealRate");

View File

@ -379,15 +379,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
int osGetSimulatorMemory(); int osGetSimulatorMemory();
int osGetSimulatorMemoryKB(); int osGetSimulatorMemoryKB();
void osKickAvatar(string FirstName,string SurName,string alert); void osKickAvatar(string FirstName, string SurName, string alert);
void osKickAvatar(LSL_Key agentId, 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(key agentId);
void osCauseHealing(string avatar, double healing); void osCauseHealing(key agentId, LSL_Float healing);
void osSetHealth(string avatar, double health); void osSetHealth(key agentId, LSL_Float health);
void osSetHealRate(string avatar, double health); void osSetHealRate(key agentId, LSL_Float health);
LSL_Float osGetHealRate(string avatar); LSL_Float osGetHealRate(key agentId);
void osCauseDamage(string avatar, double damage); void osCauseDamage(key avatar, LSL_Float damage);
void osForceOtherSit(string avatar); void osForceOtherSit(string avatar);
void osForceOtherSit(string avatar, string target); void osForceOtherSit(string avatar, string target);
LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules); LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules);

View File

@ -965,11 +965,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_OSSL_Functions.osGetSimulatorMemoryKB(); return m_OSSL_Functions.osGetSimulatorMemoryKB();
} }
public void osKickAvatar(string FirstName,string SurName,string alert) public void osKickAvatar(string FirstName, string SurName, string alert)
{ {
m_OSSL_Functions.osKickAvatar(FirstName, SurName, alert); m_OSSL_Functions.osKickAvatar(FirstName, SurName, alert);
} }
public void osKickAvatar(LSL_Key agentId, string alert)
{
m_OSSL_Functions.osKickAvatar(agentId, alert);
}
public void osSetSpeed(string UUID, LSL_Float SpeedModifier) public void osSetSpeed(string UUID, LSL_Float SpeedModifier)
{ {
m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier); m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier);
@ -980,32 +985,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_OSSL_Functions.osSetOwnerSpeed(SpeedModifier); m_OSSL_Functions.osSetOwnerSpeed(SpeedModifier);
} }
public LSL_Float osGetHealth(string avatar) public LSL_Float osGetHealth(key avatar)
{ {
return m_OSSL_Functions.osGetHealth(avatar); return m_OSSL_Functions.osGetHealth(avatar);
} }
public void osCauseDamage(string avatar, double damage) public void osCauseDamage(key avatar, LSL_Float damage)
{ {
m_OSSL_Functions.osCauseDamage(avatar, damage); m_OSSL_Functions.osCauseDamage(avatar, damage);
} }
public void osCauseHealing(string avatar, double healing) public void osCauseHealing(key avatar, LSL_Float healing)
{ {
m_OSSL_Functions.osCauseHealing(avatar, healing); m_OSSL_Functions.osCauseHealing(avatar, healing);
} }
public void osSetHealth(string avatar, double health) public void osSetHealth(key avatar, LSL_Float health)
{ {
m_OSSL_Functions.osSetHealth(avatar, health); m_OSSL_Functions.osSetHealth(avatar, health);
} }
public void osSetHealRate(string avatar, double health) public void osSetHealRate(key avatar, LSL_Float health)
{ {
m_OSSL_Functions.osSetHealRate(avatar, health); m_OSSL_Functions.osSetHealRate(avatar, health);
} }
public LSL_Float osGetHealRate(string avatar) public LSL_Float osGetHealRate(key avatar)
{ {
return m_OSSL_Functions.osGetHealRate(avatar); return m_OSSL_Functions.osGetHealRate(avatar);
} }