diff options
author | UbitUmarov | 2017-01-21 06:37:29 +0000 |
---|---|---|
committer | UbitUmarov | 2017-01-21 06:37:29 +0000 |
commit | 0a5d6671cec0eaea00127e29d4237cc4614d111d (patch) | |
tree | 478fd1c3a172f90dbbae1bb624698bef6d140c2b | |
parent | fix CanObjectEntry and CanTerraformLand group permissions (diff) | |
download | opensim-SC-0a5d6671cec0eaea00127e29d4237cc4614d111d.zip opensim-SC-0a5d6671cec0eaea00127e29d4237cc4614d111d.tar.gz opensim-SC-0a5d6671cec0eaea00127e29d4237cc4614d111d.tar.bz2 opensim-SC-0a5d6671cec0eaea00127e29d4237cc4614d111d.tar.xz |
fix llScriptDanger(); don't call old ScriptDamage on ossl health functions
3 files changed, 47 insertions, 52 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d9b0327..ca298be 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -5083,65 +5083,59 @@ Label_GroupsDone: | |||
5083 | #endregion | 5083 | #endregion |
5084 | 5084 | ||
5085 | #region Script Engine | 5085 | #region Script Engine |
5086 | 5086 | public bool LSLScriptDanger(SceneObjectPart part, Vector3 pos) | |
5087 | private bool ScriptDanger(SceneObjectPart part, Vector3 pos) | ||
5088 | { | 5087 | { |
5088 | |||
5089 | ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); | 5089 | ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); |
5090 | if (part != null) | 5090 | if (parcel == null) |
5091 | { | 5091 | return true; |
5092 | if (parcel != null) | 5092 | |
5093 | { | 5093 | LandData ldata = parcel.LandData; |
5094 | if ((parcel.LandData.Flags & (uint)ParcelFlags.AllowOtherScripts) != 0) | 5094 | if (ldata == null) |
5095 | { | 5095 | return true; |
5096 | return true; | 5096 | |
5097 | } | 5097 | uint landflags = ldata.Flags; |
5098 | else if ((part.OwnerID == parcel.LandData.OwnerID) || Permissions.IsGod(part.OwnerID)) | 5098 | |
5099 | { | 5099 | uint mask = (uint)(ParcelFlags.CreateObjects | ParcelFlags.AllowAPrimitiveEntry); |
5100 | return true; | 5100 | if((landflags & mask) != mask) |
5101 | } | 5101 | return true; |
5102 | else if (((parcel.LandData.Flags & (uint)ParcelFlags.AllowGroupScripts) != 0) | 5102 | |
5103 | && (parcel.LandData.GroupID != UUID.Zero) && (parcel.LandData.GroupID == part.GroupID)) | 5103 | if((landflags & (uint)ParcelFlags.AllowOtherScripts) != 0) |
5104 | { | 5104 | return false; |
5105 | return true; | ||
5106 | } | ||
5107 | else | ||
5108 | { | ||
5109 | return false; | ||
5110 | } | ||
5111 | } | ||
5112 | else | ||
5113 | { | ||
5114 | 5105 | ||
5115 | if (pos.X > 0f && pos.X < RegionInfo.RegionSizeX && pos.Y > 0f && pos.Y < RegionInfo.RegionSizeY) | 5106 | if(part == null) |
5116 | { | 5107 | return true; |
5117 | // The only time parcel != null when an object is inside a region is when | 5108 | if(part.GroupID == ldata.GroupID && (landflags & (uint)ParcelFlags.AllowGroupScripts) != 0) |
5118 | // there is nothing behind the landchannel. IE, no land plugin loaded. | ||
5119 | return true; | ||
5120 | } | ||
5121 | else | ||
5122 | { | ||
5123 | // The object is outside of this region. Stop piping events to it. | ||
5124 | return false; | ||
5125 | } | ||
5126 | } | ||
5127 | } | ||
5128 | else | ||
5129 | { | ||
5130 | return false; | 5109 | return false; |
5131 | } | 5110 | |
5111 | return true; | ||
5132 | } | 5112 | } |
5133 | 5113 | ||
5134 | public bool ScriptDanger(uint localID, Vector3 pos) | 5114 | private bool ScriptDanger(SceneObjectPart part, Vector3 pos) |
5135 | { | 5115 | { |
5136 | SceneObjectPart part = GetSceneObjectPart(localID); | 5116 | if (part == null) |
5137 | if (part != null) | 5117 | return false; |
5118 | |||
5119 | ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); | ||
5120 | if (parcel != null) | ||
5138 | { | 5121 | { |
5139 | return ScriptDanger(part, pos); | 5122 | if ((parcel.LandData.Flags & (uint)ParcelFlags.AllowOtherScripts) != 0) |
5123 | return true; | ||
5124 | |||
5125 | if ((part.OwnerID == parcel.LandData.OwnerID) || Permissions.IsGod(part.OwnerID)) | ||
5126 | return true; | ||
5127 | |||
5128 | if (((parcel.LandData.Flags & (uint)ParcelFlags.AllowGroupScripts) != 0) | ||
5129 | && (parcel.LandData.GroupID != UUID.Zero) && (parcel.LandData.GroupID == part.GroupID)) | ||
5130 | return true; | ||
5140 | } | 5131 | } |
5141 | else | 5132 | else |
5142 | { | 5133 | { |
5143 | return false; | 5134 | if (pos.X > 0f && pos.X < RegionInfo.RegionSizeX && pos.Y > 0f && pos.Y < RegionInfo.RegionSizeY) |
5135 | return true; | ||
5144 | } | 5136 | } |
5137 | |||
5138 | return false; | ||
5145 | } | 5139 | } |
5146 | 5140 | ||
5147 | public bool PipeEventsForScript(uint localID) | 5141 | public bool PipeEventsForScript(uint localID) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 3cdf49c..226ad6c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -7963,7 +7963,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7963 | public LSL_Integer llScriptDanger(LSL_Vector pos) | 7963 | public LSL_Integer llScriptDanger(LSL_Vector pos) |
7964 | { | 7964 | { |
7965 | m_host.AddScriptLPS(1); | 7965 | m_host.AddScriptLPS(1); |
7966 | bool result = World.ScriptDanger(m_host.LocalId, pos); | 7966 | bool result = World.LSLScriptDanger(m_host, pos); |
7967 | if (result) | 7967 | if (result) |
7968 | { | 7968 | { |
7969 | return 1; | 7969 | return 1; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index a17eb03..4c3f7ee 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -3538,7 +3538,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3538 | 3538 | ||
3539 | LSL_Float health = new LSL_Float(-1); | 3539 | LSL_Float health = new LSL_Float(-1); |
3540 | ScenePresence presence = World.GetScenePresence(new UUID(avatar)); | 3540 | ScenePresence presence = World.GetScenePresence(new UUID(avatar)); |
3541 | if (presence != null) health = presence.Health; | 3541 | if (presence != null) |
3542 | health = presence.Health; | ||
3542 | return health; | 3543 | return health; |
3543 | } | 3544 | } |
3544 | 3545 | ||
@@ -3578,7 +3579,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3578 | UUID avatarId = new UUID(avatar); | 3579 | UUID avatarId = new UUID(avatar); |
3579 | ScenePresence presence = World.GetScenePresence(avatarId); | 3580 | ScenePresence presence = World.GetScenePresence(avatarId); |
3580 | 3581 | ||
3581 | if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition())) | 3582 | if (presence != null) |
3582 | { | 3583 | { |
3583 | float health = presence.Health; | 3584 | float health = presence.Health; |
3584 | health += (float)healing; | 3585 | health += (float)healing; |
@@ -3598,7 +3599,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3598 | UUID avatarId = new UUID(avatar); | 3599 | UUID avatarId = new UUID(avatar); |
3599 | ScenePresence presence = World.GetScenePresence(avatarId); | 3600 | ScenePresence presence = World.GetScenePresence(avatarId); |
3600 | 3601 | ||
3601 | if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition())) | 3602 | if (presence != null) |
3602 | { | 3603 | { |
3603 | if (health > 100.0) | 3604 | if (health > 100.0) |
3604 | health = 100.0; | 3605 | health = 100.0; |
@@ -3617,7 +3618,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3617 | UUID avatarId = new UUID(avatar); | 3618 | UUID avatarId = new UUID(avatar); |
3618 | ScenePresence presence = World.GetScenePresence(avatarId); | 3619 | ScenePresence presence = World.GetScenePresence(avatarId); |
3619 | 3620 | ||
3620 | if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition())) | 3621 | if (presence != null) |
3621 | presence.HealRate = (float)healrate; | 3622 | presence.HealRate = (float)healrate; |
3622 | } | 3623 | } |
3623 | 3624 | ||