Make landing points work on local teleports. Constrain owners and gods to

landing points when coming from off sim (matches agni) to prevent landing
in floors or other prims.
avinationmerge
Melanie 2011-01-27 06:45:53 +01:00
parent eca82d90c2
commit 1143e022b4
2 changed files with 27 additions and 5 deletions

View File

@ -177,6 +177,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
sp.ControllingClient.SendTeleportStart(teleportFlags); sp.ControllingClient.SendTeleportStart(teleportFlags);
sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags);
sp.TeleportFlags = (TeleportFlags)teleportFlags;
sp.Teleport(position); sp.Teleport(position);
foreach (SceneObjectGroup grp in sp.Attachments) foreach (SceneObjectGroup grp in sp.Attachments)

View File

@ -954,17 +954,17 @@ namespace OpenSim.Region.Framework.Scenes
// If we come in via login, landmark or map, we want to // If we come in via login, landmark or map, we want to
// 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 | if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) == (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) ||
TeleportFlags.ViaLandmark | (m_teleportFlags & TeleportFlags.ViaLandmark) != 0 ||
TeleportFlags.ViaLocation)) != 0) (m_teleportFlags & TeleportFlags.ViaLocation) != 0)
{ {
// Don't restrict gods, estate managers, or land owners to // Don't restrict gods, estate managers, or land owners to
// the TP point. This behaviour mimics agni. // 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 &&
land.LandData.OwnerID != m_uuid && ((land.LandData.OwnerID != m_uuid &&
(!m_scene.Permissions.IsGod(m_uuid)) && (!m_scene.Permissions.IsGod(m_uuid)) &&
(!m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid))) (!m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid))) || (m_teleportFlags & TeleportFlags.ViaLocation) != 0))
{ {
pos = land.LandData.UserLocation; pos = land.LandData.UserLocation;
} }
@ -1158,6 +1158,7 @@ namespace OpenSim.Region.Framework.Scenes
RemoveFromPhysicalScene(); RemoveFromPhysicalScene();
Velocity = Vector3.Zero; Velocity = Vector3.Zero;
CheckLandingPoint(ref pos);
AbsolutePosition = pos; AbsolutePosition = pos;
AddToPhysicalScene(isFlying); AddToPhysicalScene(isFlying);
if (m_appearance != null) if (m_appearance != null)
@ -1177,6 +1178,7 @@ namespace OpenSim.Region.Framework.Scenes
isFlying = m_physicsActor.Flying; isFlying = m_physicsActor.Flying;
RemoveFromPhysicalScene(); RemoveFromPhysicalScene();
CheckLandingPoint(ref pos);
AbsolutePosition = pos; AbsolutePosition = pos;
AddToPhysicalScene(isFlying); AddToPhysicalScene(isFlying);
if (m_appearance != null) if (m_appearance != null)
@ -2099,6 +2101,7 @@ namespace OpenSim.Region.Framework.Scenes
// { // Single, or Root prim of linkset, target is ClickOffset * RootRot // { // Single, or Root prim of linkset, target is ClickOffset * RootRot
//offsetr = offset * partIRot; //offsetr = offset * partIRot;
// //
// }
// else // else
// { // Child prim, offset is (ChildOffset * RootRot) + (ClickOffset * ChildRot) // { // Child prim, offset is (ChildOffset * RootRot) + (ClickOffset * ChildRot)
// offsetr = //(part.OffsetPosition * Quaternion.Inverse(part.ParentGroup.RootPart.RotationOffset)) + // offsetr = //(part.OffsetPosition * Quaternion.Inverse(part.ParentGroup.RootPart.RotationOffset)) +
@ -4415,5 +4418,23 @@ if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for ju
} }
} }
} }
private void CheckLandingPoint(ref Vector3 pos)
{
// Never constrain lures
if ((TeleportFlags & TeleportFlags.ViaLure) != 0)
return;
ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y);
if (land.LandData.LandingType == (byte)LandingType.LandingPoint &&
land.LandData.UserLocation != Vector3.Zero &&
land.LandData.OwnerID != m_uuid &&
(!m_scene.Permissions.IsGod(m_uuid)) &&
(!m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid)))
{
pos = land.LandData.UserLocation;
}
}
} }
} }