aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs230
1 files changed, 154 insertions, 76 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 230cb23..0ab267a 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -221,8 +221,6 @@ namespace OpenSim.Region.Framework.Scenes
221 221
222 private Quaternion m_headrotation = Quaternion.Identity; 222 private Quaternion m_headrotation = Quaternion.Identity;
223 223
224 private string m_nextSitAnimation = String.Empty;
225
226 //PauPaw:Proper PID Controler for autopilot************ 224 //PauPaw:Proper PID Controler for autopilot************
227 public bool MovingToTarget { get; private set; } 225 public bool MovingToTarget { get; private set; }
228 public Vector3 MoveToPositionTarget { get; private set; } 226 public Vector3 MoveToPositionTarget { get; private set; }
@@ -458,9 +456,9 @@ namespace OpenSim.Region.Framework.Scenes
458 { 456 {
459 m_pos = PhysicsActor.Position; 457 m_pos = PhysicsActor.Position;
460 458
461 //m_log.DebugFormat( 459// m_log.DebugFormat(
462 // "[SCENE PRESENCE]: Set position {0} for {1} in {2} via getting AbsolutePosition!", 460// "[SCENE PRESENCE]: Set position of {0} in {1} to {2} via getting AbsolutePosition!",
463 // m_pos, Name, Scene.RegionInfo.RegionName); 461// Name, Scene.Name, m_pos);
464 } 462 }
465 else 463 else
466 { 464 {
@@ -487,6 +485,9 @@ namespace OpenSim.Region.Framework.Scenes
487 } 485 }
488 set 486 set
489 { 487 {
488// m_log.DebugFormat("[SCENE PRESENCE]: Setting position of {0} in {1} to {2}", Name, Scene.Name, value);
489// Util.PrintCallStack();
490
490 if (PhysicsActor != null) 491 if (PhysicsActor != null)
491 { 492 {
492 try 493 try
@@ -592,24 +593,37 @@ namespace OpenSim.Region.Framework.Scenes
592*/ 593*/
593 private Quaternion m_bodyRot = Quaternion.Identity; 594 private Quaternion m_bodyRot = Quaternion.Identity;
594 595
596 /// <summary>
597 /// The rotation of the avatar.
598 /// </summary>
599 /// <remarks>
600 /// If the avatar is not sitting, this is with respect to the world
601 /// If the avatar is sitting, this is a with respect to the part that it's sitting upon (a local rotation).
602 /// If you always want the world rotation, use GetWorldRotation()
603 /// </remarks>
595 public Quaternion Rotation 604 public Quaternion Rotation
596 { 605 {
597 get { return m_bodyRot; } 606 get
607 {
608 return m_bodyRot;
609 }
610
598 set 611 set
599 { 612 {
600 m_bodyRot = value; 613 m_bodyRot = value;
601 // m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, m_bodyRot); 614
602 if (PhysicsActor != null) 615 if (PhysicsActor != null)
603 { 616 {
604 try 617 try
605 { 618 {
606 PhysicsActor.Orientation = value; 619 PhysicsActor.Orientation = m_bodyRot;
607 } 620 }
608 catch (Exception e) 621 catch (Exception e)
609 { 622 {
610 m_log.Error("[SCENE PRESENCE]: Orientation " + e.Message); 623 m_log.Error("[SCENE PRESENCE]: Orientation " + e.Message);
611 } 624 }
612 } 625 }
626// m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, m_bodyRot);
613 } 627 }
614 } 628 }
615 629
@@ -656,6 +670,26 @@ namespace OpenSim.Region.Framework.Scenes
656 set { m_health = value; } 670 set { m_health = value; }
657 } 671 }
658 672
673 /// <summary>
674 /// Gets the world rotation of this presence.
675 /// </summary>
676 /// <remarks>
677 /// Unlike Rotation, this returns the world rotation no matter whether the avatar is sitting on a prim or not.
678 /// </remarks>
679 /// <returns></returns>
680 public Quaternion GetWorldRotation()
681 {
682 if (IsSatOnObject)
683 {
684 SceneObjectPart sitPart = ParentPart;
685
686 if (sitPart != null)
687 return sitPart.GetWorldRotation() * Rotation;
688 }
689
690 return Rotation;
691 }
692
659 public void AdjustKnownSeeds() 693 public void AdjustKnownSeeds()
660 { 694 {
661 Dictionary<ulong, string> seeds; 695 Dictionary<ulong, string> seeds;
@@ -705,6 +739,12 @@ namespace OpenSim.Region.Framework.Scenes
705 739
706 private bool m_inTransit; 740 private bool m_inTransit;
707 741
742 /// <summary>
743 /// This signals whether the presence is in transit between neighbouring regions.
744 /// </summary>
745 /// <remarks>
746 /// It is not set when the presence is teleporting or logging in/out directly to a region.
747 /// </remarks>
708 public bool IsInTransit 748 public bool IsInTransit
709 { 749 {
710 get { return m_inTransit; } 750 get { return m_inTransit; }
@@ -751,8 +791,6 @@ namespace OpenSim.Region.Framework.Scenes
751 791
752 #endregion 792 #endregion
753 793
754
755
756 #region Constructor(s) 794 #region Constructor(s)
757 795
758 public ScenePresence( 796 public ScenePresence(
@@ -903,8 +941,6 @@ namespace OpenSim.Region.Framework.Scenes
903 "[SCENE]: Upgrading child to root agent for {0} in {1}", 941 "[SCENE]: Upgrading child to root agent for {0} in {1}",
904 Name, m_scene.RegionInfo.RegionName); 942 Name, m_scene.RegionInfo.RegionName);
905 943
906 bool wasChild = IsChildAgent;
907
908 if (ParentUUID != UUID.Zero) 944 if (ParentUUID != UUID.Zero)
909 { 945 {
910 m_log.DebugFormat("[SCENE PRESENCE]: Sitting avatar back on prim {0}", ParentUUID); 946 m_log.DebugFormat("[SCENE PRESENCE]: Sitting avatar back on prim {0}", ParentUUID);
@@ -937,6 +973,9 @@ namespace OpenSim.Region.Framework.Scenes
937 IsLoggingIn = false; 973 IsLoggingIn = false;
938 } 974 }
939 975
976 //m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count);
977
978 IsChildAgent = false;
940 979
941 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); 980 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
942 if (gm != null) 981 if (gm != null)
@@ -1030,6 +1069,13 @@ namespace OpenSim.Region.Framework.Scenes
1030 else 1069 else
1031 AddToPhysicalScene(isFlying); 1070 AddToPhysicalScene(isFlying);
1032 1071
1072 // XXX: This is to trigger any secondary teleport needed for a megaregion when the user has teleported to a
1073 // location outside the 'root region' (the south-west 256x256 corner). This is the earlist we can do it
1074 // since it requires a physics actor to be present. If it is left any later, then physics appears to reset
1075 // the value to a negative position which does not trigger the border cross.
1076 // This may not be the best location for this.
1077 CheckForBorderCrossing();
1078
1033 if (ForceFly) 1079 if (ForceFly)
1034 { 1080 {
1035 Flying = true; 1081 Flying = true;
@@ -1050,22 +1096,43 @@ namespace OpenSim.Region.Framework.Scenes
1050 // and it has already rezzed the attachments and started their scripts. 1096 // and it has already rezzed the attachments and started their scripts.
1051 // We do the following only for non-login agents, because their scripts 1097 // We do the following only for non-login agents, because their scripts
1052 // haven't started yet. 1098 // haven't started yet.
1053 lock (m_attachments) 1099 if (PresenceType == PresenceType.Npc || (TeleportFlags & TeleportFlags.ViaLogin) != 0)
1100 {
1101 // Viewers which have a current outfit folder will actually rez their own attachments. However,
1102 // viewers without (e.g. v1 viewers) will not, so we still need to make this call.
1103 if (Scene.AttachmentsModule != null)
1104 Util.FireAndForget(
1105 o =>
1106 {
1107// if (PresenceType != PresenceType.Npc && Util.FireAndForgetMethod != FireAndForgetMethod.None)
1108// System.Threading.Thread.Sleep(7000);
1109
1110 Scene.AttachmentsModule.RezAttachments(this);
1111 });
1112 }
1113 else
1054 { 1114 {
1055 if (wasChild && HasAttachments()) 1115 // We need to restart scripts here so that they receive the correct changed events (CHANGED_TELEPORT
1116 // and CHANGED_REGION) when the attachments have been rezzed in the new region. This cannot currently
1117 // be done in AttachmentsModule.CopyAttachments(AgentData ad, IScenePresence sp) itself since we are
1118 // not transporting the required data.
1119 lock (m_attachments)
1056 { 1120 {
1057 m_log.DebugFormat( 1121 if (HasAttachments())
1058 "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); 1122 {
1059 1123 m_log.DebugFormat(
1060 // Resume scripts 1124 "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name);
1061 Util.FireAndForget(delegate(object x) { 1125
1062 foreach (SceneObjectGroup sog in m_attachments) 1126 // Resume scripts
1063 { 1127 Util.FireAndForget(delegate(object x) {
1064 sog.ScheduleGroupForFullUpdate(); 1128 foreach (SceneObjectGroup sog in m_attachments)
1065 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); 1129 {
1066 sog.ResumeScripts(); 1130 sog.ScheduleGroupForFullUpdate();
1067 } 1131 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource());
1068 }); 1132 sog.ResumeScripts();
1133 }
1134 });
1135 }
1069 } 1136 }
1070 } 1137 }
1071 1138
@@ -1494,6 +1561,15 @@ namespace OpenSim.Region.Framework.Scenes
1494 1561
1495 } 1562 }
1496 1563
1564 // XXX: If we force an update here, then multiple attachments do appear correctly on a destination region
1565 // If we do it a little bit earlier (e.g. when converting the child to a root agent) then this does not work.
1566 // This may be due to viewer code or it may be something we're not doing properly simulator side.
1567 lock (m_attachments)
1568 {
1569 foreach (SceneObjectGroup sog in m_attachments)
1570 sog.ScheduleGroupForFullUpdate();
1571 }
1572
1497// m_log.DebugFormat( 1573// m_log.DebugFormat(
1498// "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", 1574// "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms",
1499// client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds); 1575// client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds);
@@ -1862,32 +1938,28 @@ namespace OpenSim.Region.Framework.Scenes
1862 bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || 1938 bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) ||
1863 ((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); 1939 ((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0));
1864 1940
1865
1866 //m_log.Debug("[CONTROL]: " +flags); 1941 //m_log.Debug("[CONTROL]: " +flags);
1867 // Applies a satisfying roll effect to the avatar when flying. 1942 // Applies a satisfying roll effect to the avatar when flying.
1868 if (((flags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) != 0) && ((flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0)) 1943 if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) != 0 && (flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0)
1869 { 1944 {
1870 1945 ApplyFlyingRoll(
1871 ApplyFlyingRoll(FLY_ROLL_RADIANS_PER_UPDATE, ((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0), ((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0)); 1946 FLY_ROLL_RADIANS_PER_UPDATE,
1872 1947 (flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0,
1873 1948 (flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0);
1874 } 1949 }
1875 else if (((flags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT) != 0) && 1950 else if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT) != 0 &&
1876 ((flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0)) 1951 (flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0)
1877 { 1952 {
1878 ApplyFlyingRoll(-FLY_ROLL_RADIANS_PER_UPDATE, ((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0), ((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0)); 1953 ApplyFlyingRoll(
1879 1954 -FLY_ROLL_RADIANS_PER_UPDATE,
1880 1955 (flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0,
1956 (flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0);
1881 } 1957 }
1882 else 1958 else
1883 { 1959 {
1884 if (m_AngularVelocity.Z != 0) 1960 if (m_AngularVelocity.Z != 0)
1885 m_AngularVelocity.Z += CalculateFlyingRollResetToZero(FLY_ROLL_RESET_RADIANS_PER_UPDATE); 1961 m_AngularVelocity.Z += CalculateFlyingRollResetToZero(FLY_ROLL_RESET_RADIANS_PER_UPDATE);
1886 1962 }
1887 }
1888
1889
1890
1891 1963
1892 if (Flying && IsColliding && controlland) 1964 if (Flying && IsColliding && controlland)
1893 { 1965 {
@@ -2102,7 +2174,11 @@ namespace OpenSim.Region.Framework.Scenes
2102 // Get terrain height for sub-region in a megaregion if necessary 2174 // Get terrain height for sub-region in a megaregion if necessary
2103 int X = (int)((m_scene.RegionInfo.RegionLocX * Constants.RegionSize) + pos.X); 2175 int X = (int)((m_scene.RegionInfo.RegionLocX * Constants.RegionSize) + pos.X);
2104 int Y = (int)((m_scene.RegionInfo.RegionLocY * Constants.RegionSize) + pos.Y); 2176 int Y = (int)((m_scene.RegionInfo.RegionLocY * Constants.RegionSize) + pos.Y);
2105 UUID target_regionID = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y).RegionID; 2177 GridRegion target_region = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y);
2178 // If X and Y is NaN, target_region will be null
2179 if (target_region == null)
2180 return;
2181 UUID target_regionID = target_region.RegionID;
2106 Scene targetScene = m_scene; 2182 Scene targetScene = m_scene;
2107 2183
2108 if (!SceneManager.Instance.TryGetScene(target_regionID, out targetScene)) 2184 if (!SceneManager.Instance.TryGetScene(target_regionID, out targetScene))
@@ -2347,28 +2423,16 @@ namespace OpenSim.Region.Framework.Scenes
2347 2423
2348 if (ParentID != 0) 2424 if (ParentID != 0)
2349 { 2425 {
2426 if (ParentPart.UUID == targetID)
2427 return; // already sitting here, ignore
2428
2350 StandUp(); 2429 StandUp();
2351 } 2430 }
2352 2431
2353// if (!String.IsNullOrEmpty(sitAnimation))
2354// {
2355// m_nextSitAnimation = sitAnimation;
2356// }
2357// else
2358// {
2359 m_nextSitAnimation = "SIT";
2360// }
2361
2362 //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID);
2363 SceneObjectPart part = FindNextAvailableSitTarget(targetID); 2432 SceneObjectPart part = FindNextAvailableSitTarget(targetID);
2364 2433
2365 if (part != null) 2434 if (part != null)
2366 { 2435 {
2367 if (!String.IsNullOrEmpty(part.SitAnimation))
2368 {
2369 m_nextSitAnimation = part.SitAnimation;
2370 }
2371
2372 m_requestedSitTargetID = part.LocalId; 2436 m_requestedSitTargetID = part.LocalId;
2373 m_requestedSitTargetUUID = targetID; 2437 m_requestedSitTargetUUID = targetID;
2374 2438
@@ -2489,18 +2553,6 @@ namespace OpenSim.Region.Framework.Scenes
2489 2553
2490 public void HandleAgentSit(IClientAPI remoteClient, UUID agentID) 2554 public void HandleAgentSit(IClientAPI remoteClient, UUID agentID)
2491 { 2555 {
2492 if (!String.IsNullOrEmpty(m_nextSitAnimation))
2493 {
2494 HandleAgentSit(remoteClient, agentID, m_nextSitAnimation);
2495 }
2496 else
2497 {
2498 HandleAgentSit(remoteClient, agentID, "SIT");
2499 }
2500 }
2501
2502 public void HandleAgentSit(IClientAPI remoteClient, UUID agentID, string sitAnimation)
2503 {
2504 SceneObjectPart part = m_scene.GetSceneObjectPart(m_requestedSitTargetID); 2556 SceneObjectPart part = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
2505 2557
2506 if (part != null) 2558 if (part != null)
@@ -2570,10 +2622,15 @@ namespace OpenSim.Region.Framework.Scenes
2570 2622
2571 ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID); 2623 ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
2572 ParentID = m_requestedSitTargetID; 2624 ParentID = m_requestedSitTargetID;
2573 2625 m_AngularVelocity = Vector3.Zero;
2574 Velocity = Vector3.Zero; 2626 Velocity = Vector3.Zero;
2575 RemoveFromPhysicalScene(); 2627 RemoveFromPhysicalScene();
2576 2628
2629 String sitAnimation = "SIT";
2630 if (!String.IsNullOrEmpty(part.SitAnimation))
2631 {
2632 sitAnimation = part.SitAnimation;
2633 }
2577 Animator.TrySetMovementAnimation(sitAnimation); 2634 Animator.TrySetMovementAnimation(sitAnimation);
2578 SendAvatarDataToAllAgents(); 2635 SendAvatarDataToAllAgents();
2579 } 2636 }
@@ -2581,7 +2638,8 @@ namespace OpenSim.Region.Framework.Scenes
2581 2638
2582 public void HandleAgentSitOnGround() 2639 public void HandleAgentSitOnGround()
2583 { 2640 {
2584// m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick. 2641// m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick..
2642 m_AngularVelocity = Vector3.Zero;
2585 Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); 2643 Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED");
2586 SitGround = true; 2644 SitGround = true;
2587 RemoveFromPhysicalScene(); 2645 RemoveFromPhysicalScene();
@@ -2603,7 +2661,7 @@ namespace OpenSim.Region.Framework.Scenes
2603 2661
2604 public void HandleStopAnim(IClientAPI remoteClient, UUID animID) 2662 public void HandleStopAnim(IClientAPI remoteClient, UUID animID)
2605 { 2663 {
2606 Animator.RemoveAnimation(animID); 2664 Animator.RemoveAnimation(animID, false);
2607 } 2665 }
2608 2666
2609 public void avnHandleChangeAnim(UUID animID, bool addRemove,bool sendPack) 2667 public void avnHandleChangeAnim(UUID animID, bool addRemove,bool sendPack)
@@ -2619,7 +2677,8 @@ namespace OpenSim.Region.Framework.Scenes
2619 /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param> 2677 /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param>
2620 public void AddNewMovement(Vector3 vec) 2678 public void AddNewMovement(Vector3 vec)
2621 { 2679 {
2622// m_log.DebugFormat("[SCENE PRESENCE]: Adding new movement {0} for {1}", vec, Name); 2680// m_log.DebugFormat(
2681// "[SCENE PRESENCE]: Adding new movement {0} with rotation {1} for {2}", vec, Rotation, Name);
2623 2682
2624 Vector3 direc = vec * Rotation; 2683 Vector3 direc = vec * Rotation;
2625 direc.Normalize(); 2684 direc.Normalize();
@@ -2639,6 +2698,8 @@ namespace OpenSim.Region.Framework.Scenes
2639 2698
2640 direc *= 0.03f * 128f * SpeedModifier; 2699 direc *= 0.03f * 128f * SpeedModifier;
2641 2700
2701// m_log.DebugFormat("[SCENE PRESENCE]: Force to apply before modification was {0} for {1}", direc, Name);
2702
2642 if (PhysicsActor != null) 2703 if (PhysicsActor != null)
2643 { 2704 {
2644 if (Flying) 2705 if (Flying)
@@ -2672,6 +2733,8 @@ namespace OpenSim.Region.Framework.Scenes
2672 } 2733 }
2673 } 2734 }
2674 2735
2736// m_log.DebugFormat("[SCENE PRESENCE]: Setting force to apply to {0} for {1}", direc, Name);
2737
2675 // TODO: Add the force instead of only setting it to support multiple forces per frame? 2738 // TODO: Add the force instead of only setting it to support multiple forces per frame?
2676 m_forceToApply = direc; 2739 m_forceToApply = direc;
2677 Animator.UpdateMovementAnimations(); 2740 Animator.UpdateMovementAnimations();
@@ -3090,6 +3153,10 @@ namespace OpenSim.Region.Framework.Scenes
3090 3153
3091 if (!IsInTransit) 3154 if (!IsInTransit)
3092 { 3155 {
3156// m_log.DebugFormat(
3157// "[SCENE PRESENCE]: Testing border check for projected position {0} of {1} in {2}",
3158// pos2, Name, Scene.Name);
3159
3093 // Checks if where it's headed exists a region 3160 // Checks if where it's headed exists a region
3094 bool needsTransit = false; 3161 bool needsTransit = false;
3095 if (m_scene.TestBorderCross(pos2, Cardinals.W)) 3162 if (m_scene.TestBorderCross(pos2, Cardinals.W))
@@ -4314,6 +4381,7 @@ namespace OpenSim.Region.Framework.Scenes
4314 (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || 4381 (m_teleportFlags & TeleportFlags.ViaLocation) != 0 ||
4315 (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0) 4382 (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)
4316 { 4383 {
4384
4317 if (GodLevel < 200 && 4385 if (GodLevel < 200 &&
4318 ((!m_scene.Permissions.IsGod(m_uuid) && 4386 ((!m_scene.Permissions.IsGod(m_uuid) &&
4319 !m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) || 4387 !m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) ||
@@ -4322,7 +4390,14 @@ namespace OpenSim.Region.Framework.Scenes
4322 { 4390 {
4323 SpawnPoint[] spawnPoints = m_scene.RegionInfo.RegionSettings.SpawnPoints().ToArray(); 4391 SpawnPoint[] spawnPoints = m_scene.RegionInfo.RegionSettings.SpawnPoints().ToArray();
4324 if (spawnPoints.Length == 0) 4392 if (spawnPoints.Length == 0)
4393 {
4394 if(m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid))
4395 {
4396 pos.X = 128.0f;
4397 pos.Y = 128.0f;
4398 }
4325 return; 4399 return;
4400 }
4326 4401
4327 int index; 4402 int index;
4328 bool selected = false; 4403 bool selected = false;
@@ -4331,6 +4406,8 @@ namespace OpenSim.Region.Framework.Scenes
4331 { 4406 {
4332 case "random": 4407 case "random":
4333 4408
4409 if (spawnPoints.Length == 0)
4410 return;
4334 do 4411 do
4335 { 4412 {
4336 index = Util.RandomClass.Next(spawnPoints.Length - 1); 4413 index = Util.RandomClass.Next(spawnPoints.Length - 1);
@@ -4342,6 +4419,7 @@ namespace OpenSim.Region.Framework.Scenes
4342 // SpawnPoint sp = spawnPoints[index]; 4419 // SpawnPoint sp = spawnPoints[index];
4343 4420
4344 ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); 4421 ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y);
4422
4345 if (land == null || land.IsEitherBannedOrRestricted(UUID)) 4423 if (land == null || land.IsEitherBannedOrRestricted(UUID))
4346 selected = false; 4424 selected = false;
4347 else 4425 else