Make osTeleportOwner work in foreign regions by relaxing the restrictions on teleporting an agent.

0.7.1-dev
Marck 2011-01-21 19:55:35 +01:00
parent dd4a503a22
commit 47a5d8d742
1 changed files with 14 additions and 9 deletions

View File

@ -681,10 +681,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
//
CheckThreatLevel(ThreatLevel.High, "osTeleportAgent");
TeleportAgent(agent, regionName, position, lookat);
TeleportAgent(agent, regionName, position, lookat, false);
}
private void TeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
private void TeleportAgent(string agent, string regionName,
LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions)
{
m_host.AddScriptLPS(1);
UUID agentId = new UUID();
@ -694,7 +695,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (presence != null)
{
// agent must be over owners land to avoid abuse
if (m_host.OwnerID
if (relaxRestrictions ||
m_host.OwnerID
== World.LandChannel.GetLandObject(
presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
{
@ -728,10 +730,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
//
CheckThreatLevel(ThreatLevel.High, "osTeleportAgent");
TeleportAgent(agent, regionX, regionY, position, lookat);
TeleportAgent(agent, regionX, regionY, position, lookat, false);
}
private void TeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
private void TeleportAgent(string agent, int regionX, int regionY,
LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions)
{
ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize));
@ -742,8 +745,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScenePresence presence = World.GetScenePresence(agentId);
if (presence != null)
{
// agent must be over owners land to avoid abuse
if (m_host.OwnerID
// For osTeleportAgent, agent must be over owners land to avoid abuse
// For osTeleportOwner, this restriction isn't necessary
if (relaxRestrictions ||
m_host.OwnerID
== World.LandChannel.GetLandObject(
presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
{
@ -766,7 +771,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Threat level None because this is what can already be done with the World Map in the viewer
CheckThreatLevel(ThreatLevel.None, "osTeleportOwner");
TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat);
TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat, true);
}
public void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
@ -778,7 +783,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
CheckThreatLevel(ThreatLevel.None, "osTeleportOwner");
TeleportAgent(m_host.OwnerID.ToString(), regionX, regionY, position, lookat);
TeleportAgent(m_host.OwnerID.ToString(), regionX, regionY, position, lookat, true);
}
// Functions that get information from the agent itself.