let osTeleport* always work on script prim owner

0.9.0-post-fixes
UbitUmarov 2017-06-26 18:26:45 +01:00
parent ef74efeaa7
commit cbd0af3cab
1 changed files with 15 additions and 17 deletions

View File

@ -854,6 +854,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
private bool checkAllowAgentTPbyLandOwner(UUID agentId, Vector3 pos) private bool checkAllowAgentTPbyLandOwner(UUID agentId, Vector3 pos)
{ {
UUID hostOwner = m_host.OwnerID;
if(hostOwner == agentId)
return true;
if (m_item.PermsGranter == agentId) if (m_item.PermsGranter == agentId)
{ {
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) != 0) if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) != 0)
@ -868,8 +873,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if(landdata == null) if(landdata == null)
return true; return true;
UUID hostOwner = m_host.OwnerID;
if(landdata.OwnerID == hostOwner) if(landdata.OwnerID == hostOwner)
return true; return true;
@ -896,11 +899,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// //
CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent"); CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent");
TeleportAgent(agent, regionName, position, lookat, true); TeleportAgent(agent, regionName, position, lookat);
} }
private void TeleportAgent(string agent, string regionName, private void TeleportAgent(string agent, string regionName,
LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool isNotOwner) LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if(String.IsNullOrEmpty(regionName)) if(String.IsNullOrEmpty(regionName))
@ -914,7 +917,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return; return;
Vector3 pos = presence.AbsolutePosition; Vector3 pos = presence.AbsolutePosition;
if(isNotOwner && !checkAllowAgentTPbyLandOwner(agentId, pos)) if(!checkAllowAgentTPbyLandOwner(agentId, pos))
{ {
ScriptSleep(500); ScriptSleep(500);
return; return;
@ -947,11 +950,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// //
CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent"); CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent");
TeleportAgent(agent, regionGridX, regionGridY, position, lookat, true); TeleportAgent(agent, regionGridX, regionGridY, position, lookat);
} }
private void TeleportAgent(string agent, int regionGridX, int regionGridY, private void TeleportAgent(string agent, int regionGridX, int regionGridY,
LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool isNotOwner) LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
@ -965,7 +968,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return; return;
Vector3 pos = presence.AbsolutePosition; Vector3 pos = presence.AbsolutePosition;
if(isNotOwner && !checkAllowAgentTPbyLandOwner(agentId, pos)) if(!checkAllowAgentTPbyLandOwner(agentId, pos))
{ {
ScriptSleep(500); ScriptSleep(500);
return; return;
@ -982,11 +985,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
public void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) public void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
{
TeleportAgent(agent, position, lookat, true);
}
private void TeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool isNotOwner)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
UUID agentId; UUID agentId;
@ -997,7 +995,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return; return;
Vector3 pos = presence.AbsolutePosition; Vector3 pos = presence.AbsolutePosition;
if(isNotOwner && !checkAllowAgentTPbyLandOwner(agentId, pos)) if(!checkAllowAgentTPbyLandOwner(agentId, pos))
{ {
ScriptSleep(500); ScriptSleep(500);
return; return;
@ -1014,19 +1012,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Threat level None because this is what can already be done with the World Map in the viewer // Threat level None because this is what can already be done with the World Map in the viewer
CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); CheckThreatLevel(ThreatLevel.None, "osTeleportOwner");
TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat, false); TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat);
} }
public void osTeleportOwner(int regionGridX, int regionGridY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) public void osTeleportOwner(int regionGridX, int regionGridY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
{ {
CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); CheckThreatLevel(ThreatLevel.None, "osTeleportOwner");
TeleportAgent(m_host.OwnerID.ToString(), regionGridX, regionGridY, position, lookat, false); TeleportAgent(m_host.OwnerID.ToString(), regionGridX, regionGridY, position, lookat);
} }
public void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) public void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
{ {
TeleportAgent(m_host.OwnerID.ToString(), position, lookat, false); osTeleportAgent(m_host.OwnerID.ToString(), position, lookat);
} }
///<summary> ///<summary>