diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 1b8c276..aac80f7 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -74,6 +74,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
74 | 74 | ||
75 | public class ScenePresence : EntityBase, IScenePresence | 75 | public class ScenePresence : EntityBase, IScenePresence |
76 | { | 76 | { |
77 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
78 | |||
77 | // ~ScenePresence() | 79 | // ~ScenePresence() |
78 | // { | 80 | // { |
79 | // m_log.DebugFormat("[SCENE PRESENCE]: Destructor called on {0}", Name); | 81 | // m_log.DebugFormat("[SCENE PRESENCE]: Destructor called on {0}", Name); |
@@ -85,10 +87,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
85 | m_scene.EventManager.TriggerScenePresenceUpdated(this); | 87 | m_scene.EventManager.TriggerScenePresenceUpdated(this); |
86 | } | 88 | } |
87 | 89 | ||
88 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
89 | |||
90 | public PresenceType PresenceType { get; private set; } | 90 | public PresenceType PresenceType { get; private set; } |
91 | 91 | ||
92 | private ScenePresenceStateMachine m_stateMachine; | ||
93 | |||
94 | /// <summary> | ||
95 | /// The current state of this presence. Governs only the existence lifecycle. See ScenePresenceStateMachine | ||
96 | /// for more details. | ||
97 | /// </summary> | ||
98 | public ScenePresenceState LifecycleState | ||
99 | { | ||
100 | get | ||
101 | { | ||
102 | return m_stateMachine.GetState(); | ||
103 | } | ||
104 | |||
105 | set | ||
106 | { | ||
107 | m_stateMachine.SetState(value); | ||
108 | } | ||
109 | } | ||
110 | |||
92 | // private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes(); | 111 | // private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes(); |
93 | private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags)); | 112 | private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags)); |
94 | private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f); | 113 | private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f); |
@@ -766,7 +785,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
766 | 785 | ||
767 | public ScenePresence( | 786 | public ScenePresence( |
768 | IClientAPI client, Scene world, AvatarAppearance appearance, PresenceType type) | 787 | IClientAPI client, Scene world, AvatarAppearance appearance, PresenceType type) |
769 | { | 788 | { |
770 | AttachmentsSyncLock = new Object(); | 789 | AttachmentsSyncLock = new Object(); |
771 | AllowMovement = true; | 790 | AllowMovement = true; |
772 | IsChildAgent = true; | 791 | IsChildAgent = true; |
@@ -811,6 +830,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
811 | SetDirectionVectors(); | 830 | SetDirectionVectors(); |
812 | 831 | ||
813 | Appearance = appearance; | 832 | Appearance = appearance; |
833 | |||
834 | m_stateMachine = new ScenePresenceStateMachine(this); | ||
814 | } | 835 | } |
815 | 836 | ||
816 | public void RegisterToEvents() | 837 | public void RegisterToEvents() |
@@ -879,7 +900,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
879 | /// </summary> | 900 | /// </summary> |
880 | public void MakeRootAgent(Vector3 pos, bool isFlying) | 901 | public void MakeRootAgent(Vector3 pos, bool isFlying) |
881 | { | 902 | { |
882 | m_log.DebugFormat( | 903 | m_log.InfoFormat( |
883 | "[SCENE]: Upgrading child to root agent for {0} in {1}", | 904 | "[SCENE]: Upgrading child to root agent for {0} in {1}", |
884 | Name, m_scene.RegionInfo.RegionName); | 905 | Name, m_scene.RegionInfo.RegionName); |
885 | 906 | ||
@@ -887,6 +908,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
887 | 908 | ||
888 | IsChildAgent = false; | 909 | IsChildAgent = false; |
889 | 910 | ||
911 | // Must reset this here so that a teleport to a region next to an existing region does not keep the flag | ||
912 | // set and prevent the close of the connection on a subsequent re-teleport. | ||
913 | // Should not be needed if we are not trying to tell this region to close | ||
914 | // DoNotCloseAfterTeleport = false; | ||
915 | |||
890 | IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); | 916 | IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); |
891 | if (gm != null) | 917 | if (gm != null) |
892 | Grouptitle = gm.GetGroupTitle(m_uuid); | 918 | Grouptitle = gm.GetGroupTitle(m_uuid); |
@@ -3738,6 +3764,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3738 | // m_reprioritizationTimer.Dispose(); | 3764 | // m_reprioritizationTimer.Dispose(); |
3739 | 3765 | ||
3740 | RemoveFromPhysicalScene(); | 3766 | RemoveFromPhysicalScene(); |
3767 | |||
3768 | LifecycleState = ScenePresenceState.Removed; | ||
3741 | } | 3769 | } |
3742 | 3770 | ||
3743 | public void AddAttachment(SceneObjectGroup gobj) | 3771 | public void AddAttachment(SceneObjectGroup gobj) |