several changes to telehubs, LandPoint and land access
parent
36e53b0e03
commit
6c5005aa3b
|
@ -1119,7 +1119,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
// only in use as part of completemovement
|
// only in use as part of completemovement
|
||||||
// other uses need fix
|
// other uses need fix
|
||||||
private bool MakeRootAgent(Vector3 pos, bool isFlying)
|
private bool MakeRootAgent(Vector3 pos, bool isFlying, ref Vector3 lookat)
|
||||||
{
|
{
|
||||||
int ts = Util.EnvironmentTickCount();
|
int ts = Util.EnvironmentTickCount();
|
||||||
|
|
||||||
|
@ -1198,33 +1198,38 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (ParentID == 0)
|
if (ParentID == 0)
|
||||||
{
|
{
|
||||||
CheckAndAdjustLandingPoint(ref pos);
|
if(!CheckAndAdjustLandingPoint(ref pos, ref lookat))
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[SCENE PRESENCE MakeRootAgent]: houston we have a problem.. {0}({1} got here banned",Name, UUID);
|
||||||
|
}
|
||||||
|
|
||||||
if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f)
|
if (pos.X < 0f || pos.Y < 0f
|
||||||
|
|| pos.X >= m_scene.RegionInfo.RegionSizeX
|
||||||
|
|| pos.Y >= m_scene.RegionInfo.RegionSizeY)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat(
|
m_log.WarnFormat(
|
||||||
"[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Clamping",
|
"[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Clamping",
|
||||||
pos, Name, UUID);
|
pos, Name, UUID);
|
||||||
|
|
||||||
if (pos.X < 0f) pos.X = 0f;
|
if (pos.X < 0f)
|
||||||
if (pos.Y < 0f) pos.Y = 0f;
|
pos.X = 0.5f;
|
||||||
if (pos.Z < 0f) pos.Z = 0f;
|
else if(pos.X >= m_scene.RegionInfo.RegionSizeX)
|
||||||
|
pos.X = m_scene.RegionInfo.RegionSizeX - 0.5f;
|
||||||
|
if (pos.Y < 0f)
|
||||||
|
pos.Y = 0.5f;
|
||||||
|
else if(pos.Y >= m_scene.RegionInfo.RegionSizeY)
|
||||||
|
pos.Y = m_scene.RegionInfo.RegionSizeY - 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
float localAVHeight = 1.56f;
|
float localAVHeight = 1.56f;
|
||||||
if (Appearance.AvatarHeight > 0)
|
if (Appearance.AvatarHeight > 0)
|
||||||
localAVHeight = Appearance.AvatarHeight;
|
localAVHeight = Appearance.AvatarHeight;
|
||||||
|
|
||||||
float posZLimit = 0;
|
float newPosZ = m_scene.GetGroundHeight(pos.X, pos.Y) + .01f;
|
||||||
|
newPosZ += 0.5f * localAVHeight;
|
||||||
if (pos.X < m_scene.RegionInfo.RegionSizeX && pos.Y < m_scene.RegionInfo.RegionSizeY)
|
if (newPosZ > pos.Z)
|
||||||
posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y];
|
|
||||||
|
|
||||||
float newPosZ = posZLimit + localAVHeight / 2;
|
|
||||||
if (posZLimit >= (pos.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ)))
|
|
||||||
{
|
|
||||||
pos.Z = newPosZ;
|
pos.Z = newPosZ;
|
||||||
}
|
|
||||||
AbsolutePosition = pos;
|
AbsolutePosition = pos;
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
|
@ -1254,16 +1259,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
Flying = false;
|
Flying = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: This is to trigger any secondary teleport needed for a megaregion when the user has teleported to a
|
|
||||||
// location outside the 'root region' (the south-west 256x256 corner). This is the earlist we can do it
|
|
||||||
// since it requires a physics actor to be present. If it is left any later, then physics appears to reset
|
|
||||||
// the value to a negative position which does not trigger the border cross.
|
|
||||||
// This may not be the best location for this.
|
|
||||||
|
|
||||||
|
|
||||||
// its not
|
|
||||||
// CheckForBorderCrossing();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1456,12 +1451,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void TeleportWithMomentum(Vector3 pos, Vector3? v)
|
public void TeleportWithMomentum(Vector3 pos, Vector3? v)
|
||||||
{
|
{
|
||||||
|
if(!CheckLocalTPLandingPoint(ref pos))
|
||||||
|
return;
|
||||||
|
|
||||||
if (ParentID != (uint)0)
|
if (ParentID != (uint)0)
|
||||||
StandUp();
|
StandUp();
|
||||||
|
|
||||||
bool isFlying = Flying;
|
bool isFlying = Flying;
|
||||||
Vector3 vel = Velocity;
|
Vector3 vel = Velocity;
|
||||||
RemoveFromPhysicalScene();
|
RemoveFromPhysicalScene();
|
||||||
CheckLandingPoint(ref pos);
|
|
||||||
AbsolutePosition = pos;
|
AbsolutePosition = pos;
|
||||||
AddToPhysicalScene(isFlying);
|
AddToPhysicalScene(isFlying);
|
||||||
if (PhysicsActor != null)
|
if (PhysicsActor != null)
|
||||||
|
@ -1477,7 +1476,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void avnLocalTeleport(Vector3 newpos, Vector3? newvel, bool rotateToVelXY)
|
public void avnLocalTeleport(Vector3 newpos, Vector3? newvel, bool rotateToVelXY)
|
||||||
{
|
{
|
||||||
CheckLandingPoint(ref newpos);
|
if(!CheckLocalTPLandingPoint(ref newpos))
|
||||||
|
return;
|
||||||
|
|
||||||
AbsolutePosition = newpos;
|
AbsolutePosition = newpos;
|
||||||
|
|
||||||
if (newvel.HasValue)
|
if (newvel.HasValue)
|
||||||
|
@ -1811,7 +1812,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
|
bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
|
||||||
|
|
||||||
if (!MakeRootAgent(AbsolutePosition, flying))
|
Vector3 look = Lookat;
|
||||||
|
if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01))
|
||||||
|
{
|
||||||
|
look = Velocity;
|
||||||
|
look.Z = 0;
|
||||||
|
look.Normalize();
|
||||||
|
if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01) )
|
||||||
|
look = new Vector3(0.99f, 0.042f, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!MakeRootAgent(AbsolutePosition, flying, ref look))
|
||||||
{
|
{
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[SCENE PRESENCE]: Aborting CompleteMovement call for {0} in {1} as they are already root",
|
"[SCENE PRESENCE]: Aborting CompleteMovement call for {0} in {1} as they are already root",
|
||||||
|
@ -1822,15 +1833,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts));
|
m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts));
|
||||||
|
|
||||||
Vector3 look = Lookat;
|
|
||||||
if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01))
|
|
||||||
{
|
|
||||||
look = Velocity;
|
|
||||||
look.Z = 0;
|
|
||||||
look.Normalize();
|
|
||||||
if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01) )
|
|
||||||
look = new Vector3(0.99f, 0.042f, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// start sending terrain patchs
|
// start sending terrain patchs
|
||||||
if (!isNPC)
|
if (!isNPC)
|
||||||
|
@ -1967,13 +1969,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts));
|
m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts));
|
||||||
|
|
||||||
// attachments
|
// attachments
|
||||||
|
|
||||||
if (isNPC || IsRealLogin(m_teleportFlags))
|
if (isNPC || IsRealLogin(m_teleportFlags))
|
||||||
{
|
{
|
||||||
if (Scene.AttachmentsModule != null)
|
if (Scene.AttachmentsModule != null)
|
||||||
// Util.FireAndForget(
|
// Util.FireAndForget(
|
||||||
// o =>
|
// o =>
|
||||||
// {
|
// {
|
||||||
|
|
||||||
if (!isNPC)
|
if (!isNPC)
|
||||||
Scene.AttachmentsModule.RezAttachments(this);
|
Scene.AttachmentsModule.RezAttachments(this);
|
||||||
else
|
else
|
||||||
|
@ -1981,6 +1983,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
Scene.AttachmentsModule.RezAttachments(this);
|
Scene.AttachmentsModule.RezAttachments(this);
|
||||||
});
|
});
|
||||||
|
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2000,7 +2003,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (p == this)
|
if (p == this)
|
||||||
{
|
{
|
||||||
SendTerseUpdateToAgentNF(this);
|
|
||||||
SendAttachmentsToAgentNF(this);
|
SendAttachmentsToAgentNF(this);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -2008,7 +2010,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200)
|
if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SendTerseUpdateToAgentNF(p);
|
|
||||||
SendAttachmentsToAgentNF(p);
|
SendAttachmentsToAgentNF(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3661,56 +3662,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Do everything required once a client completes its movement into a region and becomes
|
|
||||||
/// a root agent.
|
|
||||||
/// </summary>
|
|
||||||
///
|
|
||||||
/* only called from on place, do done inline there
|
|
||||||
private void ValidateAndSendAppearanceAndAgentData()
|
|
||||||
{
|
|
||||||
//m_log.DebugFormat("[SCENE PRESENCE] SendInitialData: {0} ({1})", Name, UUID);
|
|
||||||
// Moved this into CompleteMovement to ensure that Appearance is initialized before
|
|
||||||
// the inventory arrives
|
|
||||||
// m_scene.GetAvatarAppearance(ControllingClient, out Appearance);
|
|
||||||
|
|
||||||
bool cachedappearance = false;
|
|
||||||
|
|
||||||
// We have an appearance but we may not have the baked textures. Check the asset cache
|
|
||||||
// to see if all the baked textures are already here.
|
|
||||||
if (m_scene.AvatarFactory != null)
|
|
||||||
cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(this);
|
|
||||||
|
|
||||||
// If we aren't using a cached appearance, then clear out the baked textures
|
|
||||||
if (!cachedappearance)
|
|
||||||
{
|
|
||||||
if (m_scene.AvatarFactory != null)
|
|
||||||
m_scene.AvatarFactory.QueueAppearanceSave(UUID);
|
|
||||||
}
|
|
||||||
|
|
||||||
// send avatar object to all viewers so they cross it into region
|
|
||||||
bool newhide = m_currentParcelHide;
|
|
||||||
m_currentParcelHide = false;
|
|
||||||
|
|
||||||
SendAvatarDataToAllAgents();
|
|
||||||
|
|
||||||
// now hide
|
|
||||||
if (newhide)
|
|
||||||
{
|
|
||||||
ParcelLoginCheck(m_currentParcelUUID);
|
|
||||||
m_currentParcelHide = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
SendAppearanceToAgent(this);
|
|
||||||
|
|
||||||
m_inTransit = false;
|
|
||||||
|
|
||||||
SendAppearanceToAllOtherAgents();
|
|
||||||
|
|
||||||
if(Animator!= null)
|
|
||||||
Animator.SendAnimPack();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Send avatar full data appearance and animations for all other root agents to this agent, this agent
|
/// Send avatar full data appearance and animations for all other root agents to this agent, this agent
|
||||||
/// can be either a child or root
|
/// can be either a child or root
|
||||||
|
@ -4928,6 +4879,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public void SendAttachmentsToAgentNF(ScenePresence p)
|
public void SendAttachmentsToAgentNF(ScenePresence p)
|
||||||
{
|
{
|
||||||
SendTerseUpdateToAgentNF(p);
|
SendTerseUpdateToAgentNF(p);
|
||||||
|
// SendAvatarDataToAgentNF(this);
|
||||||
lock (m_attachments)
|
lock (m_attachments)
|
||||||
{
|
{
|
||||||
foreach (SceneObjectGroup sog in m_attachments)
|
foreach (SceneObjectGroup sog in m_attachments)
|
||||||
|
@ -5508,166 +5460,258 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckLandingPoint(ref Vector3 pos)
|
// returns true it local teleport allowed and sets the destiny position into pos
|
||||||
|
|
||||||
|
private bool CheckLocalTPLandingPoint(ref Vector3 pos)
|
||||||
{
|
{
|
||||||
// Never constrain lures
|
// Never constrain lures
|
||||||
if ((TeleportFlags & TeleportFlags.ViaLure) != 0)
|
if ((TeleportFlags & TeleportFlags.ViaLure) != 0)
|
||||||
return;
|
return true;
|
||||||
|
|
||||||
if (m_scene.RegionInfo.EstateSettings.AllowDirectTeleport)
|
if (m_scene.RegionInfo.EstateSettings.AllowDirectTeleport)
|
||||||
return;
|
return true;
|
||||||
|
|
||||||
|
// do not constrain gods and estate managers
|
||||||
|
if(m_scene.Permissions.IsGod(m_uuid) ||
|
||||||
|
m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// will teleport to a telehub spawn point or landpoint if that results in getting closer to target
|
||||||
|
// if not the local teleport fails.
|
||||||
|
|
||||||
|
float currDistanceSQ = Vector3.DistanceSquared(AbsolutePosition, pos);
|
||||||
|
|
||||||
|
// first check telehub
|
||||||
|
|
||||||
|
UUID TelehubObjectID = m_scene.RegionInfo.RegionSettings.TelehubObject;
|
||||||
|
if ( TelehubObjectID != UUID.Zero)
|
||||||
|
{
|
||||||
|
SceneObjectGroup telehubSOG = m_scene.GetSceneObjectGroup(TelehubObjectID);
|
||||||
|
if(telehubSOG != null)
|
||||||
|
{
|
||||||
|
Vector3 spawnPos;
|
||||||
|
float spawnDistSQ;
|
||||||
|
|
||||||
|
SpawnPoint[] spawnPoints = m_scene.RegionInfo.RegionSettings.SpawnPoints().ToArray();
|
||||||
|
if(spawnPoints.Length == 0)
|
||||||
|
{
|
||||||
|
spawnPos = new Vector3(128.0f, 128.0f, pos.Z);
|
||||||
|
spawnDistSQ = Vector3.DistanceSquared(spawnPos, pos);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Vector3 hubPos = telehubSOG.AbsolutePosition;
|
||||||
|
Quaternion hubRot = telehubSOG.GroupRotation;
|
||||||
|
|
||||||
|
spawnPos = spawnPoints[0].GetLocation(hubPos, hubRot);
|
||||||
|
spawnDistSQ = Vector3.DistanceSquared(spawnPos, pos);
|
||||||
|
|
||||||
|
float testDistSQ;
|
||||||
|
Vector3 testSpawnPos;
|
||||||
|
for(int i = 1; i< spawnPoints.Length; i++)
|
||||||
|
{
|
||||||
|
testSpawnPos = spawnPoints[i].GetLocation(hubPos, hubRot);
|
||||||
|
testDistSQ = Vector3.DistanceSquared(testSpawnPos, pos);
|
||||||
|
|
||||||
|
if(testDistSQ < spawnDistSQ)
|
||||||
|
{
|
||||||
|
spawnPos = testSpawnPos;
|
||||||
|
spawnDistSQ = testDistSQ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currDistanceSQ < spawnDistSQ)
|
||||||
|
{
|
||||||
|
// we are already close
|
||||||
|
ControllingClient.SendAlertMessage("Can't teleport closer to destination");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pos = spawnPos;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y);
|
ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y);
|
||||||
|
|
||||||
if (land.LandData.LandingType == (byte)LandingType.LandingPoint &&
|
if (land.LandData.LandingType != (byte)LandingType.LandingPoint
|
||||||
land.LandData.UserLocation != Vector3.Zero &&
|
|| land.LandData.OwnerID == m_uuid)
|
||||||
land.LandData.OwnerID != m_uuid &&
|
return true;
|
||||||
(!m_scene.Permissions.IsGod(m_uuid)) &&
|
|
||||||
(!m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)))
|
Vector3 landLocation = land.LandData.UserLocation;
|
||||||
|
if(landLocation == Vector3.Zero)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (currDistanceSQ < Vector3.DistanceSquared(landLocation, pos))
|
||||||
{
|
{
|
||||||
float curr = Vector3.Distance(AbsolutePosition, pos);
|
|
||||||
if (Vector3.Distance(land.LandData.UserLocation, pos) < curr)
|
|
||||||
pos = land.LandData.UserLocation;
|
|
||||||
else
|
|
||||||
ControllingClient.SendAlertMessage("Can't teleport closer to destination");
|
ControllingClient.SendAlertMessage("Can't teleport closer to destination");
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckAndAdjustTelehub(SceneObjectGroup telehub, ref Vector3 pos)
|
pos = land.LandData.UserLocation;
|
||||||
{
|
return true;
|
||||||
if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) ==
|
}
|
||||||
(TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) ||
|
|
||||||
(m_scene.TelehubAllowLandmarks == true ? false : ((m_teleportFlags & TeleportFlags.ViaLandmark) != 0 )) ||
|
|
||||||
(m_teleportFlags & TeleportFlags.ViaLocation) != 0 ||
|
|
||||||
(m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (GodLevel < 200 &&
|
const TeleportFlags TeleHubTPFlags = TeleportFlags.ViaLogin
|
||||||
((!m_scene.Permissions.IsGod(m_uuid) &&
|
| TeleportFlags.ViaHGLogin | TeleportFlags.ViaLocation;
|
||||||
!m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) ||
|
|
||||||
(m_teleportFlags & TeleportFlags.ViaLocation) != 0 ||
|
private bool CheckAndAdjustTelehub(SceneObjectGroup telehub, ref Vector3 pos)
|
||||||
(m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0))
|
|
||||||
{
|
{
|
||||||
|
// forcing telehubs on any tp that reachs this
|
||||||
|
if ((m_teleportFlags & TeleHubTPFlags) != 0 ||
|
||||||
|
(m_scene.TelehubAllowLandmarks == true ? false : ((m_teleportFlags & TeleportFlags.ViaLandmark) != 0 )))
|
||||||
|
{
|
||||||
|
ILandObject land;
|
||||||
|
Vector3 teleHubPosition = telehub.AbsolutePosition;
|
||||||
|
|
||||||
SpawnPoint[] spawnPoints = m_scene.RegionInfo.RegionSettings.SpawnPoints().ToArray();
|
SpawnPoint[] spawnPoints = m_scene.RegionInfo.RegionSettings.SpawnPoints().ToArray();
|
||||||
if (spawnPoints.Length == 0)
|
if(spawnPoints.Length == 0)
|
||||||
{
|
{
|
||||||
pos.X = 128.0f;
|
land = m_scene.LandChannel.GetLandObject(teleHubPosition.X,teleHubPosition.Y);
|
||||||
pos.Y = 128.0f;
|
if(land != null)
|
||||||
return;
|
{
|
||||||
|
pos = teleHubPosition;
|
||||||
|
if(land.IsEitherBannedOrRestricted(UUID))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int index;
|
int index;
|
||||||
|
int tries;
|
||||||
bool selected = false;
|
bool selected = false;
|
||||||
|
bool validhub = false;
|
||||||
|
Vector3 spawnPosition;
|
||||||
|
|
||||||
switch (m_scene.SpawnPointRouting)
|
Quaternion teleHubRotation = telehub.GroupRotation;
|
||||||
|
|
||||||
|
switch(m_scene.SpawnPointRouting)
|
||||||
{
|
{
|
||||||
case "random":
|
case "random":
|
||||||
|
tries = spawnPoints.Length;
|
||||||
if (spawnPoints.Length == 0)
|
if(tries < 3) // no much sense in random with a few points when there same can have bans
|
||||||
return;
|
goto case "sequence";
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
index = Util.RandomClass.Next(spawnPoints.Length - 1);
|
index = Util.RandomClass.Next(spawnPoints.Length - 1);
|
||||||
|
|
||||||
Vector3 spawnPosition = spawnPoints[index].GetLocation(
|
spawnPosition = spawnPoints[index].GetLocation(teleHubPosition, teleHubRotation);
|
||||||
telehub.AbsolutePosition,
|
land = m_scene.LandChannel.GetLandObject(spawnPosition.X,spawnPosition.Y);
|
||||||
telehub.GroupRotation
|
if(land != null && !land.IsEitherBannedOrRestricted(UUID))
|
||||||
);
|
|
||||||
// SpawnPoint sp = spawnPoints[index];
|
|
||||||
|
|
||||||
ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y);
|
|
||||||
|
|
||||||
if (land == null || land.IsEitherBannedOrRestricted(UUID))
|
|
||||||
selected = false;
|
|
||||||
else
|
|
||||||
selected = true;
|
selected = true;
|
||||||
|
|
||||||
} while ( selected == false);
|
} while(selected == false && --tries > 0 );
|
||||||
|
|
||||||
pos = spawnPoints[index].GetLocation(
|
if(tries <= 0)
|
||||||
telehub.AbsolutePosition,
|
goto case "sequence";
|
||||||
telehub.GroupRotation
|
|
||||||
);
|
pos = spawnPosition;
|
||||||
return;
|
return true;
|
||||||
|
|
||||||
case "sequence":
|
case "sequence":
|
||||||
|
tries = spawnPoints.Length;
|
||||||
|
selected = false;
|
||||||
|
validhub = false;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
index = m_scene.SpawnPoint();
|
index = m_scene.SpawnPoint();
|
||||||
|
spawnPosition = spawnPoints[index].GetLocation(teleHubPosition, teleHubRotation);
|
||||||
Vector3 spawnPosition = spawnPoints[index].GetLocation(
|
land = m_scene.LandChannel.GetLandObject(spawnPosition.X,spawnPosition.Y);
|
||||||
telehub.AbsolutePosition,
|
if(land != null)
|
||||||
telehub.GroupRotation
|
{
|
||||||
);
|
validhub = true;
|
||||||
// SpawnPoint sp = spawnPoints[index];
|
if(land.IsEitherBannedOrRestricted(UUID))
|
||||||
|
|
||||||
ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y);
|
|
||||||
if (land == null || land.IsEitherBannedOrRestricted(UUID))
|
|
||||||
selected = false;
|
selected = false;
|
||||||
else
|
else
|
||||||
selected = true;
|
selected = true;
|
||||||
|
}
|
||||||
|
|
||||||
} while (selected == false);
|
} while(selected == false && --tries > 0);
|
||||||
|
|
||||||
pos = spawnPoints[index].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
|
if(!validhub)
|
||||||
;
|
return false;
|
||||||
return;
|
|
||||||
|
pos = spawnPosition;
|
||||||
|
|
||||||
|
if(!selected)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
case "closest":
|
case "closest":
|
||||||
|
float distancesq = float.MaxValue;
|
||||||
float distance = 9999;
|
|
||||||
int closest = -1;
|
int closest = -1;
|
||||||
|
validhub = false;
|
||||||
|
|
||||||
for (int i = 0; i < spawnPoints.Length; i++)
|
for(int i = 0; i < spawnPoints.Length; i++)
|
||||||
{
|
{
|
||||||
Vector3 spawnPosition = spawnPoints[i].GetLocation(
|
spawnPosition = spawnPoints[i].GetLocation(teleHubPosition, teleHubRotation);
|
||||||
telehub.AbsolutePosition,
|
|
||||||
telehub.GroupRotation
|
|
||||||
);
|
|
||||||
Vector3 offset = spawnPosition - pos;
|
Vector3 offset = spawnPosition - pos;
|
||||||
float d = Vector3.Mag(offset);
|
float dsq = offset.LengthSquared();
|
||||||
if (d >= distance)
|
land = m_scene.LandChannel.GetLandObject(spawnPosition.X,spawnPosition.Y);
|
||||||
|
if(land == null)
|
||||||
continue;
|
continue;
|
||||||
ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y);
|
|
||||||
if (land == null)
|
validhub = true;
|
||||||
|
if(land.IsEitherBannedOrRestricted(UUID))
|
||||||
continue;
|
continue;
|
||||||
if (land.IsEitherBannedOrRestricted(UUID))
|
|
||||||
|
if(dsq >= distancesq)
|
||||||
continue;
|
continue;
|
||||||
distance = d;
|
distancesq = dsq;
|
||||||
closest = i;
|
closest = i;
|
||||||
}
|
}
|
||||||
if (closest == -1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
|
if(!validhub)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
}
|
if(closest < 0)
|
||||||
}
|
{
|
||||||
}
|
pos = spawnPoints[0].GetLocation(teleHubPosition, teleHubRotation);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modify landing point based on possible banning, telehubs or parcel restrictions.
|
pos = spawnPoints[closest].GetLocation(teleHubPosition, teleHubRotation);
|
||||||
private void CheckAndAdjustLandingPoint(ref Vector3 pos)
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TeleportFlags adicionalLandPointFlags = TeleportFlags.ViaLandmark |
|
||||||
|
TeleportFlags.ViaLocation | TeleportFlags.ViaHGLogin;
|
||||||
|
|
||||||
|
// Modify landing point based on telehubs or parcel restrictions.
|
||||||
|
private bool CheckAndAdjustLandingPoint(ref Vector3 pos, ref Vector3 lookat)
|
||||||
{
|
{
|
||||||
string reason;
|
string reason;
|
||||||
|
|
||||||
// Honor bans
|
// dont mess with gods
|
||||||
if (!m_scene.TestLandRestrictions(UUID, out reason, ref pos.X, ref pos.Y))
|
if(GodLevel >= 200 || m_scene.Permissions.IsGod(m_uuid))
|
||||||
return;
|
return true;
|
||||||
|
|
||||||
|
// respect region owner and managers
|
||||||
|
if(m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (!m_scene.RegionInfo.EstateSettings.AllowDirectTeleport)
|
||||||
|
{
|
||||||
SceneObjectGroup telehub = null;
|
SceneObjectGroup telehub = null;
|
||||||
if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero && (telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject)) != null)
|
if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero && (telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject)) != null)
|
||||||
{
|
{
|
||||||
if (!m_scene.RegionInfo.EstateSettings.AllowDirectTeleport)
|
if(CheckAndAdjustTelehub(telehub, ref pos))
|
||||||
{
|
return true;
|
||||||
CheckAndAdjustTelehub(telehub, ref pos);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Honor bans, actually we don't honour them
|
||||||
|
if (!m_scene.TestLandRestrictions(UUID, out reason, ref pos.X, ref pos.Y))
|
||||||
|
return false;
|
||||||
|
|
||||||
ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y);
|
ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y);
|
||||||
if (land != null)
|
if (land != null)
|
||||||
{
|
{
|
||||||
|
@ -5678,28 +5722,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// honor landing points. If we come in via Lure, we want
|
// honor landing points. If we come in via Lure, we want
|
||||||
// to ignore them.
|
// to ignore them.
|
||||||
if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) ==
|
if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) ==
|
||||||
(TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) ||
|
(TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)
|
||||||
(m_teleportFlags & TeleportFlags.ViaLandmark) != 0 ||
|
|| (m_teleportFlags & adicionalLandPointFlags) != 0)
|
||||||
(m_teleportFlags & TeleportFlags.ViaLocation) != 0 ||
|
|
||||||
(m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)
|
|
||||||
{
|
{
|
||||||
// Don't restrict gods, estate managers, or land owners to
|
|
||||||
// the TP point. This behaviour mimics agni.
|
|
||||||
if (land.LandData.LandingType == (byte)LandingType.LandingPoint &&
|
if (land.LandData.LandingType == (byte)LandingType.LandingPoint &&
|
||||||
land.LandData.UserLocation != Vector3.Zero &&
|
land.LandData.UserLocation != Vector3.Zero &&
|
||||||
GodLevel < 200 &&
|
land.LandData.OwnerID != m_uuid )
|
||||||
((land.LandData.OwnerID != m_uuid &&
|
|
||||||
!m_scene.Permissions.IsGod(m_uuid) &&
|
|
||||||
!m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) ||
|
|
||||||
(m_teleportFlags & TeleportFlags.ViaLocation) != 0 ||
|
|
||||||
(m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0))
|
|
||||||
{
|
{
|
||||||
pos = land.LandData.UserLocation;
|
pos = land.LandData.UserLocation;
|
||||||
|
if(land.LandData.UserLookAt != Vector3.Zero)
|
||||||
|
lookat = land.LandData.UserLookAt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// this is now done in completeMovement for all cases and not just this
|
|
||||||
// land.SendLandUpdateToClient(ControllingClient);
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private DetectedObject CreateDetObject(SceneObjectPart obj)
|
private DetectedObject CreateDetObject(SceneObjectPart obj)
|
||||||
|
@ -6085,7 +6121,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
foreach (ScenePresence p in killsToSendto)
|
foreach (ScenePresence p in killsToSendto)
|
||||||
{
|
{
|
||||||
m_log.Debug("[AVATAR]: killTo: " + Lastname + " " + p.Lastname);
|
// m_log.Debug("[AVATAR]: killTo: " + Lastname + " " + p.Lastname);
|
||||||
SendKillTo(p);
|
SendKillTo(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6094,7 +6130,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
foreach (ScenePresence p in killsToSendme)
|
foreach (ScenePresence p in killsToSendme)
|
||||||
{
|
{
|
||||||
m_log.Debug("[AVATAR]: killToMe: " + Lastname + " " + p.Lastname);
|
// m_log.Debug("[AVATAR]: killToMe: " + Lastname + " " + p.Lastname);
|
||||||
p.SendKillTo(this);
|
p.SendKillTo(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue