put back restriction that on osTeleport the target must be on land owned by the script owner or this is a estate manager/owner, or target did gave script permission.
parent
0418542344
commit
0c5f412ed4
|
@ -852,6 +852,43 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
m_host.ParentGroup.RootPart.SetFloatOnWater(floatYN);
|
m_host.ParentGroup.RootPart.SetFloatOnWater(floatYN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool checkAllowAgentTPbyLandOwner(UUID agentId, Vector3 pos)
|
||||||
|
{
|
||||||
|
if (m_item.PermsGranter == agentId)
|
||||||
|
{
|
||||||
|
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) != 0)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
ILandObject land = World.LandChannel.GetLandObject(pos);
|
||||||
|
if(land == null)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
LandData landdata = land.LandData;
|
||||||
|
if(landdata == null)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
UUID hostOwner = m_host.OwnerID;
|
||||||
|
|
||||||
|
if(landdata.OwnerID == hostOwner)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if(World.RegionInfo.EstateSettings != null && World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(hostOwner))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if(!landdata.IsGroupOwned)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
UUID landGroup = landdata.GroupID;
|
||||||
|
if(landGroup == UUID.Zero)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(landGroup == m_host.GroupID)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Teleport functions
|
// Teleport functions
|
||||||
public void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
|
public void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
|
||||||
{
|
{
|
||||||
|
@ -859,15 +896,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
//
|
//
|
||||||
CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent");
|
CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent");
|
||||||
|
|
||||||
TeleportAgent(agent, regionName, position, lookat);
|
TeleportAgent(agent, regionName, position, lookat, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TeleportAgent(string agent, string regionName,
|
private void TeleportAgent(string agent, string regionName,
|
||||||
LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
|
LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool isNotOwner)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
if(String.IsNullOrWhiteSpace(regionName))
|
if(String.IsNullOrEmpty(regionName))
|
||||||
return;
|
regionName = World.RegionInfo.RegionName;
|
||||||
|
|
||||||
UUID agentId;
|
UUID agentId;
|
||||||
if (UUID.TryParse(agent, out agentId))
|
if (UUID.TryParse(agent, out agentId))
|
||||||
|
@ -876,6 +913,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (presence == null || presence.IsDeleted || presence.IsInTransit)
|
if (presence == null || presence.IsDeleted || presence.IsInTransit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Vector3 pos = presence.AbsolutePosition;
|
||||||
|
if(isNotOwner && !checkAllowAgentTPbyLandOwner(agentId, pos))
|
||||||
|
{
|
||||||
|
ScriptSleep(500);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(regionName == World.RegionInfo.RegionName)
|
if(regionName == World.RegionInfo.RegionName)
|
||||||
{
|
{
|
||||||
// should be faster than going to threadpool
|
// should be faster than going to threadpool
|
||||||
|
@ -903,15 +947,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
//
|
//
|
||||||
CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent");
|
CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent");
|
||||||
|
|
||||||
TeleportAgent(agent, regionGridX, regionGridY, position, lookat, false);
|
TeleportAgent(agent, regionGridX, regionGridY, position, lookat, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 relaxRestrictions)
|
LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool isNotOwner)
|
||||||
{
|
{
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
ulong regionHandle = Util.RegionGridLocToHandle((uint)regionGridX, (uint)regionGridY);
|
ulong regionHandle = Util.RegionGridLocToHandle((uint)regionGridX, (uint)regionGridY);
|
||||||
|
|
||||||
m_host.AddScriptLPS(1);
|
|
||||||
UUID agentId;
|
UUID agentId;
|
||||||
if (UUID.TryParse(agent, out agentId))
|
if (UUID.TryParse(agent, out agentId))
|
||||||
{
|
{
|
||||||
|
@ -919,6 +964,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (presence == null || presence.IsDeleted || presence.IsInTransit)
|
if (presence == null || presence.IsDeleted || presence.IsInTransit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Vector3 pos = presence.AbsolutePosition;
|
||||||
|
if(isNotOwner && !checkAllowAgentTPbyLandOwner(agentId, pos))
|
||||||
|
{
|
||||||
|
ScriptSleep(500);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Util.FireAndForget(
|
Util.FireAndForget(
|
||||||
o => World.RequestTeleportLocation(
|
o => World.RequestTeleportLocation(
|
||||||
presence.ControllingClient, regionHandle,
|
presence.ControllingClient, regionHandle,
|
||||||
|
@ -931,8 +983,12 @@ 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)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
TeleportAgent(agent, position, lookat, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool isNotOwner)
|
||||||
|
{
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
UUID agentId;
|
UUID agentId;
|
||||||
if (UUID.TryParse(agent, out agentId))
|
if (UUID.TryParse(agent, out agentId))
|
||||||
{
|
{
|
||||||
|
@ -940,6 +996,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (presence == null || presence.IsDeleted || presence.IsInTransit)
|
if (presence == null || presence.IsDeleted || presence.IsInTransit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Vector3 pos = presence.AbsolutePosition;
|
||||||
|
if(isNotOwner && !checkAllowAgentTPbyLandOwner(agentId, pos))
|
||||||
|
{
|
||||||
|
ScriptSleep(500);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
World.RequestTeleportLocation(presence.ControllingClient, World.RegionInfo.RegionName, position,
|
World.RequestTeleportLocation(presence.ControllingClient, World.RegionInfo.RegionName, position,
|
||||||
lookat, (uint)TPFlags.ViaLocation);
|
lookat, (uint)TPFlags.ViaLocation);
|
||||||
ScriptSleep(500);
|
ScriptSleep(500);
|
||||||
|
@ -951,19 +1014,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);
|
TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat, false);
|
||||||
}
|
|
||||||
|
|
||||||
public void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
|
|
||||||
{
|
|
||||||
osTeleportAgent(m_host.OwnerID.ToString(), 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, true);
|
TeleportAgent(m_host.OwnerID.ToString(), regionGridX, regionGridY, position, lookat, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
|
||||||
|
{
|
||||||
|
TeleportAgent(m_host.OwnerID.ToString(), position, lookat, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
|
|
Loading…
Reference in New Issue