diff options
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/Scene.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 472 |
2 files changed, 255 insertions, 219 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a5a6ef0..4d2cdd9 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -6257,7 +6257,7 @@ Environment.Exit(1); | |||
6257 | bool isAdmin = Permissions.IsAdministrator(agentID); | 6257 | bool isAdmin = Permissions.IsAdministrator(agentID); |
6258 | if(isAdmin) | 6258 | if(isAdmin) |
6259 | return true; | 6259 | return true; |
6260 | 6260 | ||
6261 | // also honor estate managers access rights | 6261 | // also honor estate managers access rights |
6262 | bool isManager = Permissions.IsEstateManager(agentID); | 6262 | bool isManager = Permissions.IsEstateManager(agentID); |
6263 | if(isManager) | 6263 | if(isManager) |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 0d2c8c3..4c3bc67 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1119,7 +1119,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1119 | 1119 | ||
1120 | // only in use as part of completemovement | 1120 | // only in use as part of completemovement |
1121 | // other uses need fix | 1121 | // other uses need fix |
1122 | private bool MakeRootAgent(Vector3 pos, bool isFlying) | 1122 | private bool MakeRootAgent(Vector3 pos, bool isFlying, ref Vector3 lookat) |
1123 | { | 1123 | { |
1124 | int ts = Util.EnvironmentTickCount(); | 1124 | int ts = Util.EnvironmentTickCount(); |
1125 | 1125 | ||
@@ -1198,33 +1198,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
1198 | 1198 | ||
1199 | if (ParentID == 0) | 1199 | if (ParentID == 0) |
1200 | { | 1200 | { |
1201 | CheckAndAdjustLandingPoint(ref pos); | 1201 | if(!CheckAndAdjustLandingPoint(ref pos, ref lookat)) |
1202 | { | ||
1203 | m_log.DebugFormat("[SCENE PRESENCE MakeRootAgent]: houston we have a problem.. {0}({1} got here banned",Name, UUID); | ||
1204 | } | ||
1202 | 1205 | ||
1203 | if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f) | 1206 | if (pos.X < 0f || pos.Y < 0f |
1207 | || pos.X >= m_scene.RegionInfo.RegionSizeX | ||
1208 | || pos.Y >= m_scene.RegionInfo.RegionSizeY) | ||
1204 | { | 1209 | { |
1205 | m_log.WarnFormat( | 1210 | m_log.WarnFormat( |
1206 | "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Clamping", | 1211 | "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Clamping", |
1207 | pos, Name, UUID); | 1212 | pos, Name, UUID); |
1208 | 1213 | ||
1209 | if (pos.X < 0f) pos.X = 0f; | 1214 | if (pos.X < 0f) |
1210 | if (pos.Y < 0f) pos.Y = 0f; | 1215 | pos.X = 0.5f; |
1211 | if (pos.Z < 0f) pos.Z = 0f; | 1216 | else if(pos.X >= m_scene.RegionInfo.RegionSizeX) |
1217 | pos.X = m_scene.RegionInfo.RegionSizeX - 0.5f; | ||
1218 | if (pos.Y < 0f) | ||
1219 | pos.Y = 0.5f; | ||
1220 | else if(pos.Y >= m_scene.RegionInfo.RegionSizeY) | ||
1221 | pos.Y = m_scene.RegionInfo.RegionSizeY - 0.5f; | ||
1212 | } | 1222 | } |
1213 | 1223 | ||
1214 | float localAVHeight = 1.56f; | 1224 | float localAVHeight = 1.56f; |
1215 | if (Appearance.AvatarHeight > 0) | 1225 | if (Appearance.AvatarHeight > 0) |
1216 | localAVHeight = Appearance.AvatarHeight; | 1226 | localAVHeight = Appearance.AvatarHeight; |
1217 | 1227 | ||
1218 | float posZLimit = 0; | 1228 | float newPosZ = m_scene.GetGroundHeight(pos.X, pos.Y) + .01f; |
1219 | 1229 | newPosZ += 0.5f * localAVHeight; | |
1220 | if (pos.X < m_scene.RegionInfo.RegionSizeX && pos.Y < m_scene.RegionInfo.RegionSizeY) | 1230 | if (newPosZ > pos.Z) |
1221 | posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; | ||
1222 | |||
1223 | float newPosZ = posZLimit + localAVHeight / 2; | ||
1224 | if (posZLimit >= (pos.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) | ||
1225 | { | ||
1226 | pos.Z = newPosZ; | 1231 | pos.Z = newPosZ; |
1227 | } | 1232 | |
1228 | AbsolutePosition = pos; | 1233 | AbsolutePosition = pos; |
1229 | 1234 | ||
1230 | // m_log.DebugFormat( | 1235 | // m_log.DebugFormat( |
@@ -1254,16 +1259,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1254 | { | 1259 | { |
1255 | Flying = false; | 1260 | Flying = false; |
1256 | } | 1261 | } |
1257 | |||
1258 | // XXX: This is to trigger any secondary teleport needed for a megaregion when the user has teleported to a | ||
1259 | // location outside the 'root region' (the south-west 256x256 corner). This is the earlist we can do it | ||
1260 | // since it requires a physics actor to be present. If it is left any later, then physics appears to reset | ||
1261 | // the value to a negative position which does not trigger the border cross. | ||
1262 | // This may not be the best location for this. | ||
1263 | |||
1264 | |||
1265 | // its not | ||
1266 | // CheckForBorderCrossing(); | ||
1267 | } | 1262 | } |
1268 | 1263 | ||
1269 | 1264 | ||
@@ -1456,12 +1451,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1456 | 1451 | ||
1457 | public void TeleportWithMomentum(Vector3 pos, Vector3? v) | 1452 | public void TeleportWithMomentum(Vector3 pos, Vector3? v) |
1458 | { | 1453 | { |
1454 | if(!CheckLocalTPLandingPoint(ref pos)) | ||
1455 | return; | ||
1456 | |||
1459 | if (ParentID != (uint)0) | 1457 | if (ParentID != (uint)0) |
1460 | StandUp(); | 1458 | StandUp(); |
1459 | |||
1461 | bool isFlying = Flying; | 1460 | bool isFlying = Flying; |
1462 | Vector3 vel = Velocity; | 1461 | Vector3 vel = Velocity; |
1463 | RemoveFromPhysicalScene(); | 1462 | RemoveFromPhysicalScene(); |
1464 | CheckLandingPoint(ref pos); | 1463 | |
1465 | AbsolutePosition = pos; | 1464 | AbsolutePosition = pos; |
1466 | AddToPhysicalScene(isFlying); | 1465 | AddToPhysicalScene(isFlying); |
1467 | if (PhysicsActor != null) | 1466 | if (PhysicsActor != null) |
@@ -1477,7 +1476,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1477 | 1476 | ||
1478 | public void avnLocalTeleport(Vector3 newpos, Vector3? newvel, bool rotateToVelXY) | 1477 | public void avnLocalTeleport(Vector3 newpos, Vector3? newvel, bool rotateToVelXY) |
1479 | { | 1478 | { |
1480 | CheckLandingPoint(ref newpos); | 1479 | if(!CheckLocalTPLandingPoint(ref newpos)) |
1480 | return; | ||
1481 | |||
1481 | AbsolutePosition = newpos; | 1482 | AbsolutePosition = newpos; |
1482 | 1483 | ||
1483 | if (newvel.HasValue) | 1484 | if (newvel.HasValue) |
@@ -1811,7 +1812,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1811 | 1812 | ||
1812 | bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); | 1813 | bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); |
1813 | 1814 | ||
1814 | if (!MakeRootAgent(AbsolutePosition, flying)) | 1815 | Vector3 look = Lookat; |
1816 | if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01)) | ||
1817 | { | ||
1818 | look = Velocity; | ||
1819 | look.Z = 0; | ||
1820 | look.Normalize(); | ||
1821 | if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01) ) | ||
1822 | look = new Vector3(0.99f, 0.042f, 0); | ||
1823 | } | ||
1824 | |||
1825 | if (!MakeRootAgent(AbsolutePosition, flying, ref look)) | ||
1815 | { | 1826 | { |
1816 | m_log.DebugFormat( | 1827 | m_log.DebugFormat( |
1817 | "[SCENE PRESENCE]: Aborting CompleteMovement call for {0} in {1} as they are already root", | 1828 | "[SCENE PRESENCE]: Aborting CompleteMovement call for {0} in {1} as they are already root", |
@@ -1822,15 +1833,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1822 | 1833 | ||
1823 | m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 1834 | m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
1824 | 1835 | ||
1825 | Vector3 look = Lookat; | ||
1826 | if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01)) | ||
1827 | { | ||
1828 | look = Velocity; | ||
1829 | look.Z = 0; | ||
1830 | look.Normalize(); | ||
1831 | if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01) ) | ||
1832 | look = new Vector3(0.99f, 0.042f, 0); | ||
1833 | } | ||
1834 | 1836 | ||
1835 | // start sending terrain patchs | 1837 | // start sending terrain patchs |
1836 | if (!isNPC) | 1838 | if (!isNPC) |
@@ -1967,13 +1969,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1967 | m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 1969 | m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
1968 | 1970 | ||
1969 | // attachments | 1971 | // attachments |
1970 | |||
1971 | if (isNPC || IsRealLogin(m_teleportFlags)) | 1972 | if (isNPC || IsRealLogin(m_teleportFlags)) |
1972 | { | 1973 | { |
1973 | if (Scene.AttachmentsModule != null) | 1974 | if (Scene.AttachmentsModule != null) |
1974 | // Util.FireAndForget( | 1975 | // Util.FireAndForget( |
1975 | // o => | 1976 | // o => |
1976 | // { | 1977 | // { |
1978 | |||
1977 | if (!isNPC) | 1979 | if (!isNPC) |
1978 | Scene.AttachmentsModule.RezAttachments(this); | 1980 | Scene.AttachmentsModule.RezAttachments(this); |
1979 | else | 1981 | else |
@@ -1981,6 +1983,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1981 | { | 1983 | { |
1982 | Scene.AttachmentsModule.RezAttachments(this); | 1984 | Scene.AttachmentsModule.RezAttachments(this); |
1983 | }); | 1985 | }); |
1986 | |||
1984 | // }); | 1987 | // }); |
1985 | } | 1988 | } |
1986 | else | 1989 | else |
@@ -2000,7 +2003,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2000 | { | 2003 | { |
2001 | if (p == this) | 2004 | if (p == this) |
2002 | { | 2005 | { |
2003 | SendTerseUpdateToAgentNF(this); | ||
2004 | SendAttachmentsToAgentNF(this); | 2006 | SendAttachmentsToAgentNF(this); |
2005 | continue; | 2007 | continue; |
2006 | } | 2008 | } |
@@ -2008,7 +2010,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2008 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) | 2010 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) |
2009 | continue; | 2011 | continue; |
2010 | 2012 | ||
2011 | SendTerseUpdateToAgentNF(p); | ||
2012 | SendAttachmentsToAgentNF(p); | 2013 | SendAttachmentsToAgentNF(p); |
2013 | } | 2014 | } |
2014 | } | 2015 | } |
@@ -3660,57 +3661,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3660 | } | 3661 | } |
3661 | }); | 3662 | }); |
3662 | } | 3663 | } |
3663 | |||
3664 | /// <summary> | ||
3665 | /// Do everything required once a client completes its movement into a region and becomes | ||
3666 | /// a root agent. | ||
3667 | /// </summary> | ||
3668 | /// | ||
3669 | /* only called from on place, do done inline there | ||
3670 | private void ValidateAndSendAppearanceAndAgentData() | ||
3671 | { | ||
3672 | //m_log.DebugFormat("[SCENE PRESENCE] SendInitialData: {0} ({1})", Name, UUID); | ||
3673 | // Moved this into CompleteMovement to ensure that Appearance is initialized before | ||
3674 | // the inventory arrives | ||
3675 | // m_scene.GetAvatarAppearance(ControllingClient, out Appearance); | ||
3676 | |||
3677 | bool cachedappearance = false; | ||
3678 | |||
3679 | // We have an appearance but we may not have the baked textures. Check the asset cache | ||
3680 | // to see if all the baked textures are already here. | ||
3681 | if (m_scene.AvatarFactory != null) | ||
3682 | cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(this); | ||
3683 | |||
3684 | // If we aren't using a cached appearance, then clear out the baked textures | ||
3685 | if (!cachedappearance) | ||
3686 | { | ||
3687 | if (m_scene.AvatarFactory != null) | ||
3688 | m_scene.AvatarFactory.QueueAppearanceSave(UUID); | ||
3689 | } | ||
3690 | |||
3691 | // send avatar object to all viewers so they cross it into region | ||
3692 | bool newhide = m_currentParcelHide; | ||
3693 | m_currentParcelHide = false; | ||
3694 | 3664 | ||
3695 | SendAvatarDataToAllAgents(); | ||
3696 | |||
3697 | // now hide | ||
3698 | if (newhide) | ||
3699 | { | ||
3700 | ParcelLoginCheck(m_currentParcelUUID); | ||
3701 | m_currentParcelHide = true; | ||
3702 | } | ||
3703 | |||
3704 | SendAppearanceToAgent(this); | ||
3705 | |||
3706 | m_inTransit = false; | ||
3707 | |||
3708 | SendAppearanceToAllOtherAgents(); | ||
3709 | |||
3710 | if(Animator!= null) | ||
3711 | Animator.SendAnimPack(); | ||
3712 | } | ||
3713 | */ | ||
3714 | /// <summary> | 3665 | /// <summary> |
3715 | /// Send avatar full data appearance and animations for all other root agents to this agent, this agent | 3666 | /// Send avatar full data appearance and animations for all other root agents to this agent, this agent |
3716 | /// can be either a child or root | 3667 | /// can be either a child or root |
@@ -4928,6 +4879,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4928 | public void SendAttachmentsToAgentNF(ScenePresence p) | 4879 | public void SendAttachmentsToAgentNF(ScenePresence p) |
4929 | { | 4880 | { |
4930 | SendTerseUpdateToAgentNF(p); | 4881 | SendTerseUpdateToAgentNF(p); |
4882 | // SendAvatarDataToAgentNF(this); | ||
4931 | lock (m_attachments) | 4883 | lock (m_attachments) |
4932 | { | 4884 | { |
4933 | foreach (SceneObjectGroup sog in m_attachments) | 4885 | foreach (SceneObjectGroup sog in m_attachments) |
@@ -5508,166 +5460,258 @@ namespace OpenSim.Region.Framework.Scenes | |||
5508 | } | 5460 | } |
5509 | } | 5461 | } |
5510 | 5462 | ||
5511 | private void CheckLandingPoint(ref Vector3 pos) | 5463 | // returns true it local teleport allowed and sets the destiny position into pos |
5464 | |||
5465 | private bool CheckLocalTPLandingPoint(ref Vector3 pos) | ||
5512 | { | 5466 | { |
5513 | // Never constrain lures | 5467 | // Never constrain lures |
5514 | if ((TeleportFlags & TeleportFlags.ViaLure) != 0) | 5468 | if ((TeleportFlags & TeleportFlags.ViaLure) != 0) |
5515 | return; | 5469 | return true; |
5516 | 5470 | ||
5517 | if (m_scene.RegionInfo.EstateSettings.AllowDirectTeleport) | 5471 | if (m_scene.RegionInfo.EstateSettings.AllowDirectTeleport) |
5518 | return; | 5472 | return true; |
5473 | |||
5474 | // do not constrain gods and estate managers | ||
5475 | if(m_scene.Permissions.IsGod(m_uuid) || | ||
5476 | m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) | ||
5477 | return true; | ||
5478 | |||
5479 | // will teleport to a telehub spawn point or landpoint if that results in getting closer to target | ||
5480 | // if not the local teleport fails. | ||
5481 | |||
5482 | float currDistanceSQ = Vector3.DistanceSquared(AbsolutePosition, pos); | ||
5483 | |||
5484 | // first check telehub | ||
5485 | |||
5486 | UUID TelehubObjectID = m_scene.RegionInfo.RegionSettings.TelehubObject; | ||
5487 | if ( TelehubObjectID != UUID.Zero) | ||
5488 | { | ||
5489 | SceneObjectGroup telehubSOG = m_scene.GetSceneObjectGroup(TelehubObjectID); | ||
5490 | if(telehubSOG != null) | ||
5491 | { | ||
5492 | Vector3 spawnPos; | ||
5493 | float spawnDistSQ; | ||
5494 | |||
5495 | SpawnPoint[] spawnPoints = m_scene.RegionInfo.RegionSettings.SpawnPoints().ToArray(); | ||
5496 | if(spawnPoints.Length == 0) | ||
5497 | { | ||
5498 | spawnPos = new Vector3(128.0f, 128.0f, pos.Z); | ||
5499 | spawnDistSQ = Vector3.DistanceSquared(spawnPos, pos); | ||
5500 | } | ||
5501 | else | ||
5502 | { | ||
5503 | Vector3 hubPos = telehubSOG.AbsolutePosition; | ||
5504 | Quaternion hubRot = telehubSOG.GroupRotation; | ||
5505 | |||
5506 | spawnPos = spawnPoints[0].GetLocation(hubPos, hubRot); | ||
5507 | spawnDistSQ = Vector3.DistanceSquared(spawnPos, pos); | ||
5508 | |||
5509 | float testDistSQ; | ||
5510 | Vector3 testSpawnPos; | ||
5511 | for(int i = 1; i< spawnPoints.Length; i++) | ||
5512 | { | ||
5513 | testSpawnPos = spawnPoints[i].GetLocation(hubPos, hubRot); | ||
5514 | testDistSQ = Vector3.DistanceSquared(testSpawnPos, pos); | ||
5515 | |||
5516 | if(testDistSQ < spawnDistSQ) | ||
5517 | { | ||
5518 | spawnPos = testSpawnPos; | ||
5519 | spawnDistSQ = testDistSQ; | ||
5520 | } | ||
5521 | } | ||
5522 | } | ||
5523 | if (currDistanceSQ < spawnDistSQ) | ||
5524 | { | ||
5525 | // we are already close | ||
5526 | ControllingClient.SendAlertMessage("Can't teleport closer to destination"); | ||
5527 | return false; | ||
5528 | } | ||
5529 | else | ||
5530 | { | ||
5531 | pos = spawnPos; | ||
5532 | return true; | ||
5533 | } | ||
5534 | } | ||
5535 | } | ||
5519 | 5536 | ||
5520 | ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); | 5537 | ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); |
5521 | 5538 | ||
5522 | if (land.LandData.LandingType == (byte)LandingType.LandingPoint && | 5539 | if (land.LandData.LandingType != (byte)LandingType.LandingPoint |
5523 | land.LandData.UserLocation != Vector3.Zero && | 5540 | || land.LandData.OwnerID == m_uuid) |
5524 | land.LandData.OwnerID != m_uuid && | 5541 | return true; |
5525 | (!m_scene.Permissions.IsGod(m_uuid)) && | 5542 | |
5526 | (!m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid))) | 5543 | Vector3 landLocation = land.LandData.UserLocation; |
5544 | if(landLocation == Vector3.Zero) | ||
5545 | return true; | ||
5546 | |||
5547 | if (currDistanceSQ < Vector3.DistanceSquared(landLocation, pos)) | ||
5527 | { | 5548 | { |
5528 | float curr = Vector3.Distance(AbsolutePosition, pos); | 5549 | ControllingClient.SendAlertMessage("Can't teleport closer to destination"); |
5529 | if (Vector3.Distance(land.LandData.UserLocation, pos) < curr) | 5550 | return false; |
5530 | pos = land.LandData.UserLocation; | ||
5531 | else | ||
5532 | ControllingClient.SendAlertMessage("Can't teleport closer to destination"); | ||
5533 | } | 5551 | } |
5552 | |||
5553 | pos = land.LandData.UserLocation; | ||
5554 | return true; | ||
5534 | } | 5555 | } |
5535 | 5556 | ||
5536 | private void CheckAndAdjustTelehub(SceneObjectGroup telehub, ref Vector3 pos) | 5557 | const TeleportFlags TeleHubTPFlags = TeleportFlags.ViaLogin |
5558 | | TeleportFlags.ViaHGLogin | TeleportFlags.ViaLocation; | ||
5559 | |||
5560 | private bool CheckAndAdjustTelehub(SceneObjectGroup telehub, ref Vector3 pos) | ||
5537 | { | 5561 | { |
5538 | if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) == | 5562 | // forcing telehubs on any tp that reachs this |
5539 | (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) || | 5563 | if ((m_teleportFlags & TeleHubTPFlags) != 0 || |
5540 | (m_scene.TelehubAllowLandmarks == true ? false : ((m_teleportFlags & TeleportFlags.ViaLandmark) != 0 )) || | 5564 | (m_scene.TelehubAllowLandmarks == true ? false : ((m_teleportFlags & TeleportFlags.ViaLandmark) != 0 ))) |
5541 | (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || | ||
5542 | (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0) | ||
5543 | { | 5565 | { |
5566 | ILandObject land; | ||
5567 | Vector3 teleHubPosition = telehub.AbsolutePosition; | ||
5544 | 5568 | ||
5545 | if (GodLevel < 200 && | 5569 | SpawnPoint[] spawnPoints = m_scene.RegionInfo.RegionSettings.SpawnPoints().ToArray(); |
5546 | ((!m_scene.Permissions.IsGod(m_uuid) && | 5570 | if(spawnPoints.Length == 0) |
5547 | !m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) || | ||
5548 | (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || | ||
5549 | (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)) | ||
5550 | { | 5571 | { |
5551 | SpawnPoint[] spawnPoints = m_scene.RegionInfo.RegionSettings.SpawnPoints().ToArray(); | 5572 | land = m_scene.LandChannel.GetLandObject(teleHubPosition.X,teleHubPosition.Y); |
5552 | if (spawnPoints.Length == 0) | 5573 | if(land != null) |
5553 | { | 5574 | { |
5554 | pos.X = 128.0f; | 5575 | pos = teleHubPosition; |
5555 | pos.Y = 128.0f; | 5576 | if(land.IsEitherBannedOrRestricted(UUID)) |
5556 | return; | 5577 | return false; |
5578 | return true; | ||
5557 | } | 5579 | } |
5580 | else | ||
5581 | return false; | ||
5582 | } | ||
5558 | 5583 | ||
5559 | int index; | 5584 | int index; |
5560 | bool selected = false; | 5585 | int tries; |
5586 | bool selected = false; | ||
5587 | bool validhub = false; | ||
5588 | Vector3 spawnPosition; | ||
5589 | |||
5590 | Quaternion teleHubRotation = telehub.GroupRotation; | ||
5561 | 5591 | ||
5562 | switch (m_scene.SpawnPointRouting) | 5592 | switch(m_scene.SpawnPointRouting) |
5563 | { | 5593 | { |
5564 | case "random": | 5594 | case "random": |
5595 | tries = spawnPoints.Length; | ||
5596 | if(tries < 3) // no much sense in random with a few points when there same can have bans | ||
5597 | goto case "sequence"; | ||
5598 | do | ||
5599 | { | ||
5600 | index = Util.RandomClass.Next(spawnPoints.Length - 1); | ||
5565 | 5601 | ||
5566 | if (spawnPoints.Length == 0) | 5602 | spawnPosition = spawnPoints[index].GetLocation(teleHubPosition, teleHubRotation); |
5567 | return; | 5603 | land = m_scene.LandChannel.GetLandObject(spawnPosition.X,spawnPosition.Y); |
5568 | do | 5604 | if(land != null && !land.IsEitherBannedOrRestricted(UUID)) |
5569 | { | 5605 | selected = true; |
5570 | index = Util.RandomClass.Next(spawnPoints.Length - 1); | ||
5571 | |||
5572 | Vector3 spawnPosition = spawnPoints[index].GetLocation( | ||
5573 | telehub.AbsolutePosition, | ||
5574 | telehub.GroupRotation | ||
5575 | ); | ||
5576 | // SpawnPoint sp = spawnPoints[index]; | ||
5577 | 5606 | ||
5578 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | 5607 | } while(selected == false && --tries > 0 ); |
5579 | 5608 | ||
5580 | if (land == null || land.IsEitherBannedOrRestricted(UUID)) | 5609 | if(tries <= 0) |
5610 | goto case "sequence"; | ||
5611 | |||
5612 | pos = spawnPosition; | ||
5613 | return true; | ||
5614 | |||
5615 | case "sequence": | ||
5616 | tries = spawnPoints.Length; | ||
5617 | selected = false; | ||
5618 | validhub = false; | ||
5619 | do | ||
5620 | { | ||
5621 | index = m_scene.SpawnPoint(); | ||
5622 | spawnPosition = spawnPoints[index].GetLocation(teleHubPosition, teleHubRotation); | ||
5623 | land = m_scene.LandChannel.GetLandObject(spawnPosition.X,spawnPosition.Y); | ||
5624 | if(land != null) | ||
5625 | { | ||
5626 | validhub = true; | ||
5627 | if(land.IsEitherBannedOrRestricted(UUID)) | ||
5581 | selected = false; | 5628 | selected = false; |
5582 | else | 5629 | else |
5583 | selected = true; | 5630 | selected = true; |
5631 | } | ||
5584 | 5632 | ||
5585 | } while ( selected == false); | 5633 | } while(selected == false && --tries > 0); |
5586 | 5634 | ||
5587 | pos = spawnPoints[index].GetLocation( | 5635 | if(!validhub) |
5588 | telehub.AbsolutePosition, | 5636 | return false; |
5589 | telehub.GroupRotation | ||
5590 | ); | ||
5591 | return; | ||
5592 | 5637 | ||
5593 | case "sequence": | 5638 | pos = spawnPosition; |
5594 | 5639 | ||
5595 | do | 5640 | if(!selected) |
5596 | { | 5641 | return false; |
5597 | index = m_scene.SpawnPoint(); | 5642 | return true; |
5598 | |||
5599 | Vector3 spawnPosition = spawnPoints[index].GetLocation( | ||
5600 | telehub.AbsolutePosition, | ||
5601 | telehub.GroupRotation | ||
5602 | ); | ||
5603 | // SpawnPoint sp = spawnPoints[index]; | ||
5604 | |||
5605 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | ||
5606 | if (land == null || land.IsEitherBannedOrRestricted(UUID)) | ||
5607 | selected = false; | ||
5608 | else | ||
5609 | selected = true; | ||
5610 | 5643 | ||
5611 | } while (selected == false); | 5644 | default: |
5645 | case "closest": | ||
5646 | float distancesq = float.MaxValue; | ||
5647 | int closest = -1; | ||
5648 | validhub = false; | ||
5612 | 5649 | ||
5613 | pos = spawnPoints[index].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | 5650 | for(int i = 0; i < spawnPoints.Length; i++) |
5614 | ; | 5651 | { |
5615 | return; | 5652 | spawnPosition = spawnPoints[i].GetLocation(teleHubPosition, teleHubRotation); |
5653 | Vector3 offset = spawnPosition - pos; | ||
5654 | float dsq = offset.LengthSquared(); | ||
5655 | land = m_scene.LandChannel.GetLandObject(spawnPosition.X,spawnPosition.Y); | ||
5656 | if(land == null) | ||
5657 | continue; | ||
5616 | 5658 | ||
5617 | default: | 5659 | validhub = true; |
5618 | case "closest": | 5660 | if(land.IsEitherBannedOrRestricted(UUID)) |
5661 | continue; | ||
5619 | 5662 | ||
5620 | float distance = 9999; | 5663 | if(dsq >= distancesq) |
5621 | int closest = -1; | 5664 | continue; |
5622 | 5665 | distancesq = dsq; | |
5623 | for (int i = 0; i < spawnPoints.Length; i++) | 5666 | closest = i; |
5624 | { | 5667 | } |
5625 | Vector3 spawnPosition = spawnPoints[i].GetLocation( | ||
5626 | telehub.AbsolutePosition, | ||
5627 | telehub.GroupRotation | ||
5628 | ); | ||
5629 | Vector3 offset = spawnPosition - pos; | ||
5630 | float d = Vector3.Mag(offset); | ||
5631 | if (d >= distance) | ||
5632 | continue; | ||
5633 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | ||
5634 | if (land == null) | ||
5635 | continue; | ||
5636 | if (land.IsEitherBannedOrRestricted(UUID)) | ||
5637 | continue; | ||
5638 | distance = d; | ||
5639 | closest = i; | ||
5640 | } | ||
5641 | if (closest == -1) | ||
5642 | return; | ||
5643 | |||
5644 | pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | ||
5645 | return; | ||
5646 | 5668 | ||
5647 | } | 5669 | if(!validhub) |
5670 | return false; | ||
5671 | |||
5672 | if(closest < 0) | ||
5673 | { | ||
5674 | pos = spawnPoints[0].GetLocation(teleHubPosition, teleHubRotation); | ||
5675 | return false; | ||
5676 | } | ||
5677 | |||
5678 | pos = spawnPoints[closest].GetLocation(teleHubPosition, teleHubRotation); | ||
5679 | return true; | ||
5648 | } | 5680 | } |
5649 | } | 5681 | } |
5682 | return false; | ||
5650 | } | 5683 | } |
5651 | 5684 | ||
5652 | // Modify landing point based on possible banning, telehubs or parcel restrictions. | 5685 | const TeleportFlags adicionalLandPointFlags = TeleportFlags.ViaLandmark | |
5653 | private void CheckAndAdjustLandingPoint(ref Vector3 pos) | 5686 | TeleportFlags.ViaLocation | TeleportFlags.ViaHGLogin; |
5687 | |||
5688 | // Modify landing point based on telehubs or parcel restrictions. | ||
5689 | private bool CheckAndAdjustLandingPoint(ref Vector3 pos, ref Vector3 lookat) | ||
5654 | { | 5690 | { |
5655 | string reason; | 5691 | string reason; |
5656 | 5692 | ||
5657 | // Honor bans | 5693 | // dont mess with gods |
5658 | if (!m_scene.TestLandRestrictions(UUID, out reason, ref pos.X, ref pos.Y)) | 5694 | if(GodLevel >= 200 || m_scene.Permissions.IsGod(m_uuid)) |
5659 | return; | 5695 | return true; |
5660 | 5696 | ||
5661 | SceneObjectGroup telehub = null; | 5697 | // respect region owner and managers |
5662 | if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero && (telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject)) != null) | 5698 | if(m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) |
5699 | return true; | ||
5700 | |||
5701 | if (!m_scene.RegionInfo.EstateSettings.AllowDirectTeleport) | ||
5663 | { | 5702 | { |
5664 | if (!m_scene.RegionInfo.EstateSettings.AllowDirectTeleport) | 5703 | SceneObjectGroup telehub = null; |
5704 | if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero && (telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject)) != null) | ||
5665 | { | 5705 | { |
5666 | CheckAndAdjustTelehub(telehub, ref pos); | 5706 | if(CheckAndAdjustTelehub(telehub, ref pos)) |
5667 | return; | 5707 | return true; |
5668 | } | 5708 | } |
5669 | } | 5709 | } |
5670 | 5710 | ||
5711 | // Honor bans, actually we don't honour them | ||
5712 | if (!m_scene.TestLandRestrictions(UUID, out reason, ref pos.X, ref pos.Y)) | ||
5713 | return false; | ||
5714 | |||
5671 | ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); | 5715 | ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); |
5672 | if (land != null) | 5716 | if (land != null) |
5673 | { | 5717 | { |
@@ -5678,28 +5722,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
5678 | // honor landing points. If we come in via Lure, we want | 5722 | // honor landing points. If we come in via Lure, we want |
5679 | // to ignore them. | 5723 | // to ignore them. |
5680 | if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) == | 5724 | if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) == |
5681 | (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) || | 5725 | (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) |
5682 | (m_teleportFlags & TeleportFlags.ViaLandmark) != 0 || | 5726 | || (m_teleportFlags & adicionalLandPointFlags) != 0) |
5683 | (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || | ||
5684 | (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0) | ||
5685 | { | 5727 | { |
5686 | // Don't restrict gods, estate managers, or land owners to | ||
5687 | // the TP point. This behaviour mimics agni. | ||
5688 | if (land.LandData.LandingType == (byte)LandingType.LandingPoint && | 5728 | if (land.LandData.LandingType == (byte)LandingType.LandingPoint && |
5689 | land.LandData.UserLocation != Vector3.Zero && | 5729 | land.LandData.UserLocation != Vector3.Zero && |
5690 | GodLevel < 200 && | 5730 | land.LandData.OwnerID != m_uuid ) |
5691 | ((land.LandData.OwnerID != m_uuid && | ||
5692 | !m_scene.Permissions.IsGod(m_uuid) && | ||
5693 | !m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) || | ||
5694 | (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || | ||
5695 | (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)) | ||
5696 | { | 5731 | { |
5697 | pos = land.LandData.UserLocation; | 5732 | pos = land.LandData.UserLocation; |
5733 | if(land.LandData.UserLookAt != Vector3.Zero) | ||
5734 | lookat = land.LandData.UserLookAt; | ||
5698 | } | 5735 | } |
5699 | } | 5736 | } |
5700 | // this is now done in completeMovement for all cases and not just this | ||
5701 | // land.SendLandUpdateToClient(ControllingClient); | ||
5702 | } | 5737 | } |
5738 | return true; | ||
5703 | } | 5739 | } |
5704 | 5740 | ||
5705 | private DetectedObject CreateDetObject(SceneObjectPart obj) | 5741 | private DetectedObject CreateDetObject(SceneObjectPart obj) |
@@ -6085,7 +6121,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
6085 | { | 6121 | { |
6086 | foreach (ScenePresence p in killsToSendto) | 6122 | foreach (ScenePresence p in killsToSendto) |
6087 | { | 6123 | { |
6088 | m_log.Debug("[AVATAR]: killTo: " + Lastname + " " + p.Lastname); | 6124 | // m_log.Debug("[AVATAR]: killTo: " + Lastname + " " + p.Lastname); |
6089 | SendKillTo(p); | 6125 | SendKillTo(p); |
6090 | } | 6126 | } |
6091 | } | 6127 | } |
@@ -6094,7 +6130,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
6094 | { | 6130 | { |
6095 | foreach (ScenePresence p in killsToSendme) | 6131 | foreach (ScenePresence p in killsToSendme) |
6096 | { | 6132 | { |
6097 | m_log.Debug("[AVATAR]: killToMe: " + Lastname + " " + p.Lastname); | 6133 | // m_log.Debug("[AVATAR]: killToMe: " + Lastname + " " + p.Lastname); |
6098 | p.SendKillTo(this); | 6134 | p.SendKillTo(this); |
6099 | } | 6135 | } |
6100 | } | 6136 | } |