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.cs41
1 files changed, 34 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 48bf6f3..5301a82 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -75,6 +75,8 @@ namespace OpenSim.Region.Framework.Scenes
75 75
76 public class ScenePresence : EntityBase, IScenePresence 76 public class ScenePresence : EntityBase, IScenePresence
77 { 77 {
78 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
79
78// ~ScenePresence() 80// ~ScenePresence()
79// { 81// {
80// m_log.DebugFormat("[SCENE PRESENCE]: Destructor called on {0}", Name); 82// m_log.DebugFormat("[SCENE PRESENCE]: Destructor called on {0}", Name);
@@ -86,10 +88,27 @@ namespace OpenSim.Region.Framework.Scenes
86 m_scene.EventManager.TriggerScenePresenceUpdated(this); 88 m_scene.EventManager.TriggerScenePresenceUpdated(this);
87 } 89 }
88 90
89 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
90
91 public PresenceType PresenceType { get; private set; } 91 public PresenceType PresenceType { get; private set; }
92 92
93 private ScenePresenceStateMachine m_stateMachine;
94
95 /// <summary>
96 /// The current state of this presence. Governs only the existence lifecycle. See ScenePresenceStateMachine
97 /// for more details.
98 /// </summary>
99 public ScenePresenceState LifecycleState
100 {
101 get
102 {
103 return m_stateMachine.GetState();
104 }
105
106 set
107 {
108 m_stateMachine.SetState(value);
109 }
110 }
111
93// private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes(); 112// private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes();
94 private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags)); 113 private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags));
95 private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f); 114 private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f);
@@ -299,9 +318,9 @@ namespace OpenSim.Region.Framework.Scenes
299 /// <summary> 318 /// <summary>
300 /// In the V1 teleport protocol, the destination simulator sends ReleaseAgent to this address. 319 /// In the V1 teleport protocol, the destination simulator sends ReleaseAgent to this address.
301 /// </summary> 320 /// </summary>
302 string m_callbackURI; 321 private string m_callbackURI;
303 322
304 UUID m_originRegionID; 323 public UUID m_originRegionID;
305 324
306 /// <summary> 325 /// <summary>
307 /// Used by the entity transfer module to signal when the presence should not be closed because a subsequent 326 /// Used by the entity transfer module to signal when the presence should not be closed because a subsequent
@@ -813,7 +832,7 @@ namespace OpenSim.Region.Framework.Scenes
813 832
814 public ScenePresence( 833 public ScenePresence(
815 IClientAPI client, Scene world, AvatarAppearance appearance, PresenceType type) 834 IClientAPI client, Scene world, AvatarAppearance appearance, PresenceType type)
816 { 835 {
817 AttachmentsSyncLock = new Object(); 836 AttachmentsSyncLock = new Object();
818 AllowMovement = true; 837 AllowMovement = true;
819 IsChildAgent = true; 838 IsChildAgent = true;
@@ -859,6 +878,8 @@ namespace OpenSim.Region.Framework.Scenes
859 SetDirectionVectors(); 878 SetDirectionVectors();
860 879
861 Appearance = appearance; 880 Appearance = appearance;
881
882 m_stateMachine = new ScenePresenceStateMachine(this);
862 } 883 }
863 884
864 private void RegionHeartbeatEnd(Scene scene) 885 private void RegionHeartbeatEnd(Scene scene)
@@ -956,7 +977,7 @@ namespace OpenSim.Region.Framework.Scenes
956 /// </summary> 977 /// </summary>
957 public void MakeRootAgent(Vector3 pos, bool isFlying) 978 public void MakeRootAgent(Vector3 pos, bool isFlying)
958 { 979 {
959 m_log.DebugFormat( 980 m_log.InfoFormat(
960 "[SCENE]: Upgrading child to root agent for {0} in {1}", 981 "[SCENE]: Upgrading child to root agent for {0} in {1}",
961 Name, m_scene.RegionInfo.RegionName); 982 Name, m_scene.RegionInfo.RegionName);
962 983
@@ -996,6 +1017,11 @@ namespace OpenSim.Region.Framework.Scenes
996 1017
997 IsChildAgent = false; 1018 IsChildAgent = false;
998 1019
1020 // Must reset this here so that a teleport to a region next to an existing region does not keep the flag
1021 // set and prevent the close of the connection on a subsequent re-teleport.
1022 // Should not be needed if we are not trying to tell this region to close
1023// DoNotCloseAfterTeleport = false;
1024
999 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); 1025 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
1000 if (gm != null) 1026 if (gm != null)
1001 Grouptitle = gm.GetGroupTitle(m_uuid); 1027 Grouptitle = gm.GetGroupTitle(m_uuid);
@@ -1520,7 +1546,7 @@ namespace OpenSim.Region.Framework.Scenes
1520 private bool WaitForUpdateAgent(IClientAPI client) 1546 private bool WaitForUpdateAgent(IClientAPI client)
1521 { 1547 {
1522 // Before UpdateAgent, m_originRegionID is UUID.Zero; after, it's non-Zero 1548 // Before UpdateAgent, m_originRegionID is UUID.Zero; after, it's non-Zero
1523 int count = 20; 1549 int count = 50;
1524 while (m_originRegionID.Equals(UUID.Zero) && count-- > 0) 1550 while (m_originRegionID.Equals(UUID.Zero) && count-- > 0)
1525 { 1551 {
1526 m_log.DebugFormat("[SCENE PRESENCE]: Agent {0} waiting for update in {1}", client.Name, Scene.Name); 1552 m_log.DebugFormat("[SCENE PRESENCE]: Agent {0} waiting for update in {1}", client.Name, Scene.Name);
@@ -3994,6 +4020,7 @@ namespace OpenSim.Region.Framework.Scenes
3994// Animator.Close(); 4020// Animator.Close();
3995 Animator = null; 4021 Animator = null;
3996 4022
4023 LifecycleState = ScenePresenceState.Removed;
3997 } 4024 }
3998 4025
3999 public void AddAttachment(SceneObjectGroup gobj) 4026 public void AddAttachment(SceneObjectGroup gobj)