diff options
author | UbitUmarov | 2018-09-29 21:40:52 +0100 |
---|---|---|
committer | UbitUmarov | 2018-09-29 21:40:52 +0100 |
commit | 8812684355de043d7630e327e6180fda4e5271b9 (patch) | |
tree | af04f06f248a327d0398d7a4540c776fdad8ba57 /OpenSim/Region | |
parent | **CONFIRMED**AGAIN** , Add new function, osSetOwnerSpeed(float speed), threat... (diff) | |
download | opensim-SC-8812684355de043d7630e327e6180fda4e5271b9.zip opensim-SC-8812684355de043d7630e327e6180fda4e5271b9.tar.gz opensim-SC-8812684355de043d7630e327e6180fda4e5271b9.tar.bz2 opensim-SC-8812684355de043d7630e327e6180fda4e5271b9.tar.xz |
minor changes
Diffstat (limited to 'OpenSim/Region')
3 files changed, 55 insertions, 37 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 82afab2..34639b0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -3646,26 +3646,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3646 | return (int)pws; | 3646 | return (int)pws; |
3647 | } | 3647 | } |
3648 | 3648 | ||
3649 | public void osSetSpeed(string UUID, LSL_Float SpeedModifier) | 3649 | public void osSetSpeed(string ID, LSL_Float SpeedModifier) |
3650 | { | 3650 | { |
3651 | CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); | 3651 | CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); |
3652 | 3652 | ||
3653 | ScenePresence avatar = World.GetScenePresence(new UUID(UUID)); | 3653 | UUID avid; |
3654 | if(!UUID.TryParse(ID, out avid)) | ||
3655 | return; | ||
3654 | 3656 | ||
3657 | ScenePresence avatar = World.GetScenePresence(avid); | ||
3655 | if (avatar != null) | 3658 | if (avatar != null) |
3656 | avatar.SpeedModifier = (float)SpeedModifier; | 3659 | avatar.SpeedModifier = (float)SpeedModifier; |
3657 | } | 3660 | } |
3658 | 3661 | ||
3659 | public void osSetOwnerSpeed(LSL_Float SpeedModifier) | 3662 | public void osSetOwnerSpeed(LSL_Float SpeedModifier) |
3660 | { | 3663 | { |
3661 | CheckThreatLevel(ThreatLevel.Moderate, "osSetOwnerSpeed"); | 3664 | CheckThreatLevel(ThreatLevel.Moderate, "osSetOwnerSpeed"); |
3662 | if(SpeedModifier > 4)SpeedModifier = 4; | ||
3663 | ScenePresence avatar = World.GetScenePresence(m_host.OwnerID); | ||
3664 | 3665 | ||
3666 | if(SpeedModifier > 4) | ||
3667 | SpeedModifier = 4; | ||
3668 | |||
3669 | ScenePresence avatar = World.GetScenePresence(m_host.OwnerID); | ||
3665 | if (avatar != null) | 3670 | if (avatar != null) |
3666 | avatar.SpeedModifier = (float)SpeedModifier; | 3671 | avatar.SpeedModifier = (float)SpeedModifier; |
3667 | } | 3672 | } |
3668 | 3673 | ||
3669 | public void osKickAvatar(string FirstName, string SurName, string alert) | 3674 | public void osKickAvatar(string FirstName, string SurName, string alert) |
3670 | { | 3675 | { |
3671 | CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); | 3676 | CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); |
@@ -3699,25 +3704,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3699 | { | 3704 | { |
3700 | CheckThreatLevel(ThreatLevel.High, "osCauseDamage"); | 3705 | CheckThreatLevel(ThreatLevel.High, "osCauseDamage"); |
3701 | 3706 | ||
3702 | UUID avatarId = new UUID(avatar); | 3707 | UUID avatarId; |
3703 | Vector3 pos = m_host.GetWorldPosition(); | 3708 | if (!UUID.TryParse(avatar, out avatarId)) |
3709 | return; | ||
3704 | 3710 | ||
3705 | ScenePresence presence = World.GetScenePresence(avatarId); | 3711 | ScenePresence presence = World.GetScenePresence(avatarId); |
3706 | if (presence != null) | 3712 | if (presence == null) |
3713 | return; | ||
3714 | |||
3715 | Vector3 pos = m_host.GetWorldPosition(); | ||
3716 | LandData land = World.GetLandData(pos); | ||
3717 | if ((land.Flags & (uint)ParcelFlags.AllowDamage) == (uint)ParcelFlags.AllowDamage) | ||
3707 | { | 3718 | { |
3708 | LandData land = World.GetLandData(pos); | 3719 | float health = presence.Health; |
3709 | if ((land.Flags & (uint)ParcelFlags.AllowDamage) == (uint)ParcelFlags.AllowDamage) | 3720 | health -= (float)damage; |
3721 | presence.setHealthWithUpdate(health); | ||
3722 | if (health <= 0) | ||
3710 | { | 3723 | { |
3711 | float health = presence.Health; | 3724 | float healthliveagain = 100; |
3712 | health -= (float)damage; | 3725 | presence.ControllingClient.SendAgentAlertMessage("You died!", true); |
3713 | presence.setHealthWithUpdate(health); | 3726 | presence.setHealthWithUpdate(healthliveagain); |
3714 | if (health <= 0) | 3727 | presence.Scene.TeleportClientHome(presence.UUID, presence.ControllingClient); |
3715 | { | ||
3716 | float healthliveagain = 100; | ||
3717 | presence.ControllingClient.SendAgentAlertMessage("You died!", true); | ||
3718 | presence.setHealthWithUpdate(healthliveagain); | ||
3719 | presence.Scene.TeleportClientHome(presence.UUID, presence.ControllingClient); | ||
3720 | } | ||
3721 | } | 3728 | } |
3722 | } | 3729 | } |
3723 | } | 3730 | } |
@@ -3726,19 +3733,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3726 | { | 3733 | { |
3727 | CheckThreatLevel(ThreatLevel.High, "osCauseHealing"); | 3734 | CheckThreatLevel(ThreatLevel.High, "osCauseHealing"); |
3728 | 3735 | ||
3729 | UUID avatarId = new UUID(avatar); | 3736 | UUID avatarId; |
3737 | if (!UUID.TryParse(avatar, out avatarId)) | ||
3738 | return; | ||
3739 | |||
3730 | ScenePresence presence = World.GetScenePresence(avatarId); | 3740 | ScenePresence presence = World.GetScenePresence(avatarId); |
3741 | if (presence == null) | ||
3742 | return; | ||
3731 | 3743 | ||
3732 | if (presence != null) | 3744 | float health = presence.Health; |
3733 | { | 3745 | health += (float)healing; |
3734 | float health = presence.Health; | ||
3735 | health += (float)healing; | ||
3736 | 3746 | ||
3737 | if (health >= 100) | 3747 | if (health >= 100) |
3738 | health = 100; | 3748 | health = 100; |
3739 | 3749 | ||
3740 | presence.setHealthWithUpdate(health); | 3750 | presence.setHealthWithUpdate(health); |
3741 | } | ||
3742 | } | 3751 | } |
3743 | 3752 | ||
3744 | public void osSetHealth(string avatar, double health) | 3753 | public void osSetHealth(string avatar, double health) |
@@ -3763,11 +3772,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3763 | { | 3772 | { |
3764 | CheckThreatLevel(ThreatLevel.High, "osSetHealRate"); | 3773 | CheckThreatLevel(ThreatLevel.High, "osSetHealRate"); |
3765 | 3774 | ||
3766 | UUID avatarId = new UUID(avatar); | 3775 | UUID avatarId; |
3776 | if (!UUID.TryParse(avatar, out avatarId)) | ||
3777 | return; | ||
3778 | |||
3767 | ScenePresence presence = World.GetScenePresence(avatarId); | 3779 | ScenePresence presence = World.GetScenePresence(avatarId); |
3780 | if (presence == null) | ||
3781 | return; | ||
3768 | 3782 | ||
3769 | if (presence != null) | 3783 | presence.HealRate = (float)healrate; |
3770 | presence.HealRate = (float)healrate; | ||
3771 | } | 3784 | } |
3772 | 3785 | ||
3773 | public LSL_Float osGetHealRate(string avatar) | 3786 | public LSL_Float osGetHealRate(string avatar) |
@@ -3775,7 +3788,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3775 | CheckThreatLevel(ThreatLevel.None, "osGetHealRate"); | 3788 | CheckThreatLevel(ThreatLevel.None, "osGetHealRate"); |
3776 | 3789 | ||
3777 | LSL_Float rate = new LSL_Float(0); | 3790 | LSL_Float rate = new LSL_Float(0); |
3778 | ScenePresence presence = World.GetScenePresence(new UUID(avatar)); | 3791 | |
3792 | UUID avatarId; | ||
3793 | if (!UUID.TryParse(avatar, out avatarId)) | ||
3794 | return rate; | ||
3795 | |||
3796 | ScenePresence presence = World.GetScenePresence(avatarId); | ||
3779 | if (presence != null) | 3797 | if (presence != null) |
3780 | rate = presence.HealRate; | 3798 | rate = presence.HealRate; |
3781 | return rate; | 3799 | return rate; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 23cccd0..f4a37ef 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -383,7 +383,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
383 | int osGetSimulatorMemoryKB(); | 383 | int osGetSimulatorMemoryKB(); |
384 | void osKickAvatar(string FirstName,string SurName,string alert); | 384 | void osKickAvatar(string FirstName,string SurName,string alert); |
385 | void osSetSpeed(string UUID, LSL_Float SpeedModifier); | 385 | void osSetSpeed(string UUID, LSL_Float SpeedModifier); |
386 | void osSetOwnerSpeed(LSL_Float SpeedModifier); | 386 | void osSetOwnerSpeed(LSL_Float SpeedModifier); |
387 | LSL_Float osGetHealth(string avatar); | 387 | LSL_Float osGetHealth(string avatar); |
388 | void osCauseHealing(string avatar, double healing); | 388 | void osCauseHealing(string avatar, double healing); |
389 | void osSetHealth(string avatar, double health); | 389 | void osSetHealth(string avatar, double health); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 609675c..0f438ef 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -986,11 +986,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
986 | m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier); | 986 | m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier); |
987 | } | 987 | } |
988 | 988 | ||
989 | public void osSetOwnerSpeed(LSL_Float SpeedModifier) | 989 | public void osSetOwnerSpeed(LSL_Float SpeedModifier) |
990 | { | 990 | { |
991 | m_OSSL_Functions.osSetOwnerSpeed(SpeedModifier); | 991 | m_OSSL_Functions.osSetOwnerSpeed(SpeedModifier); |
992 | } | 992 | } |
993 | 993 | ||
994 | public LSL_Float osGetHealth(string avatar) | 994 | public LSL_Float osGetHealth(string avatar) |
995 | { | 995 | { |
996 | return m_OSSL_Functions.osGetHealth(avatar); | 996 | return m_OSSL_Functions.osGetHealth(avatar); |