fix llScriptDanger(); don't call old ScriptDamage on ossl health functions

httptests
UbitUmarov 2017-01-21 06:37:29 +00:00
parent 9d61df0887
commit 0a5d6671ce
3 changed files with 48 additions and 53 deletions

View File

@ -5083,65 +5083,59 @@ Label_GroupsDone:
#endregion #endregion
#region Script Engine #region Script Engine
public bool LSLScriptDanger(SceneObjectPart part, Vector3 pos)
{
ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y);
if (parcel == null)
return true;
LandData ldata = parcel.LandData;
if (ldata == null)
return true;
uint landflags = ldata.Flags;
uint mask = (uint)(ParcelFlags.CreateObjects | ParcelFlags.AllowAPrimitiveEntry);
if((landflags & mask) != mask)
return true;
if((landflags & (uint)ParcelFlags.AllowOtherScripts) != 0)
return false;
if(part == null)
return true;
if(part.GroupID == ldata.GroupID && (landflags & (uint)ParcelFlags.AllowGroupScripts) != 0)
return false;
return true;
}
private bool ScriptDanger(SceneObjectPart part, Vector3 pos) private bool ScriptDanger(SceneObjectPart part, Vector3 pos)
{ {
if (part == null)
return false;
ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y);
if (part != null) if (parcel != null)
{ {
if (parcel != null) if ((parcel.LandData.Flags & (uint)ParcelFlags.AllowOtherScripts) != 0)
{ return true;
if ((parcel.LandData.Flags & (uint)ParcelFlags.AllowOtherScripts) != 0)
{
return true;
}
else if ((part.OwnerID == parcel.LandData.OwnerID) || Permissions.IsGod(part.OwnerID))
{
return true;
}
else if (((parcel.LandData.Flags & (uint)ParcelFlags.AllowGroupScripts) != 0)
&& (parcel.LandData.GroupID != UUID.Zero) && (parcel.LandData.GroupID == part.GroupID))
{
return true;
}
else
{
return false;
}
}
else
{
if (pos.X > 0f && pos.X < RegionInfo.RegionSizeX && pos.Y > 0f && pos.Y < RegionInfo.RegionSizeY) if ((part.OwnerID == parcel.LandData.OwnerID) || Permissions.IsGod(part.OwnerID))
{ return true;
// The only time parcel != null when an object is inside a region is when
// there is nothing behind the landchannel. IE, no land plugin loaded. if (((parcel.LandData.Flags & (uint)ParcelFlags.AllowGroupScripts) != 0)
return true; && (parcel.LandData.GroupID != UUID.Zero) && (parcel.LandData.GroupID == part.GroupID))
} return true;
else
{
// The object is outside of this region. Stop piping events to it.
return false;
}
}
} }
else else
{ {
return false; if (pos.X > 0f && pos.X < RegionInfo.RegionSizeX && pos.Y > 0f && pos.Y < RegionInfo.RegionSizeY)
return true;
} }
}
public bool ScriptDanger(uint localID, Vector3 pos) return false;
{
SceneObjectPart part = GetSceneObjectPart(localID);
if (part != null)
{
return ScriptDanger(part, pos);
}
else
{
return false;
}
} }
public bool PipeEventsForScript(uint localID) public bool PipeEventsForScript(uint localID)

View File

@ -7963,7 +7963,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llScriptDanger(LSL_Vector pos) public LSL_Integer llScriptDanger(LSL_Vector pos)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
bool result = World.ScriptDanger(m_host.LocalId, pos); bool result = World.LSLScriptDanger(m_host, pos);
if (result) if (result)
{ {
return 1; return 1;

View File

@ -3538,7 +3538,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSL_Float health = new LSL_Float(-1); LSL_Float health = new LSL_Float(-1);
ScenePresence presence = World.GetScenePresence(new UUID(avatar)); ScenePresence presence = World.GetScenePresence(new UUID(avatar));
if (presence != null) health = presence.Health; if (presence != null)
health = presence.Health;
return health; return health;
} }
@ -3578,7 +3579,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID avatarId = new UUID(avatar); UUID avatarId = new UUID(avatar);
ScenePresence presence = World.GetScenePresence(avatarId); ScenePresence presence = World.GetScenePresence(avatarId);
if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition())) if (presence != null)
{ {
float health = presence.Health; float health = presence.Health;
health += (float)healing; health += (float)healing;
@ -3598,7 +3599,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID avatarId = new UUID(avatar); UUID avatarId = new UUID(avatar);
ScenePresence presence = World.GetScenePresence(avatarId); ScenePresence presence = World.GetScenePresence(avatarId);
if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition())) if (presence != null)
{ {
if (health > 100.0) if (health > 100.0)
health = 100.0; health = 100.0;
@ -3617,7 +3618,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID avatarId = new UUID(avatar); UUID avatarId = new UUID(avatar);
ScenePresence presence = World.GetScenePresence(avatarId); ScenePresence presence = World.GetScenePresence(avatarId);
if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition())) if (presence != null)
presence.HealRate = (float)healrate; presence.HealRate = (float)healrate;
} }