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.cs51
1 files changed, 31 insertions, 20 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index a8aa551..285d1ae 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -69,14 +69,15 @@ namespace OpenSim.Region.Framework.Scenes
69 public ScriptControlled eventControls; 69 public ScriptControlled eventControls;
70 } 70 }
71 71
72 public delegate void SendCourseLocationsMethod(UUID scene, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs); 72 public delegate void SendCoarseLocationsMethod(UUID scene, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs);
73 73
74 public class ScenePresence : EntityBase, IScenePresence 74 public class ScenePresence : EntityBase, IScenePresence
75 { 75 {
76// ~ScenePresence() 76// ~ScenePresence()
77// { 77// {
78// m_log.Debug("[SCENE PRESENCE] Destructor called"); 78// m_log.DebugFormat("[SCENE PRESENCE]: Destructor called on {0}", Name);
79// } 79// }
80
80 private void TriggerScenePresenceUpdated() 81 private void TriggerScenePresenceUpdated()
81 { 82 {
82 if (m_scene != null) 83 if (m_scene != null)
@@ -188,7 +189,7 @@ namespace OpenSim.Region.Framework.Scenes
188 /// </summary> 189 /// </summary>
189 public bool SitGround { get; private set; } 190 public bool SitGround { get; private set; }
190 191
191 private SendCourseLocationsMethod m_sendCourseLocationsMethod; 192 private SendCoarseLocationsMethod m_sendCoarseLocationsMethod;
192 193
193 //private Vector3 m_requestedSitOffset = new Vector3(); 194 //private Vector3 m_requestedSitOffset = new Vector3();
194 195
@@ -711,7 +712,7 @@ namespace OpenSim.Region.Framework.Scenes
711 AttachmentsSyncLock = new Object(); 712 AttachmentsSyncLock = new Object();
712 AllowMovement = true; 713 AllowMovement = true;
713 IsChildAgent = true; 714 IsChildAgent = true;
714 m_sendCourseLocationsMethod = SendCoarseLocationsDefault; 715 m_sendCoarseLocationsMethod = SendCoarseLocationsDefault;
715 Animator = new ScenePresenceAnimator(this); 716 Animator = new ScenePresenceAnimator(this);
716 PresenceType = type; 717 PresenceType = type;
717 DrawDistance = world.DefaultDrawDistance; 718 DrawDistance = world.DefaultDrawDistance;
@@ -974,7 +975,9 @@ namespace OpenSim.Region.Framework.Scenes
974 { 975 {
975 if (wasChild && HasAttachments()) 976 if (wasChild && HasAttachments())
976 { 977 {
977 m_log.DebugFormat("[SCENE PRESENCE]: Restarting scripts in attachments..."); 978 m_log.DebugFormat(
979 "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name);
980
978 // Resume scripts 981 // Resume scripts
979 Util.FireAndForget(delegate(object x) { 982 Util.FireAndForget(delegate(object x) {
980 foreach (SceneObjectGroup sog in m_attachments) 983 foreach (SceneObjectGroup sog in m_attachments)
@@ -1530,17 +1533,22 @@ namespace OpenSim.Region.Framework.Scenes
1530 bool DCFlagKeyPressed = false; 1533 bool DCFlagKeyPressed = false;
1531 Vector3 agent_control_v3 = Vector3.Zero; 1534 Vector3 agent_control_v3 = Vector3.Zero;
1532 1535
1533 bool oldflying = Flying; 1536 bool newFlying = actor.Flying;
1534 1537
1535 if (ForceFly) 1538 if (ForceFly)
1536 actor.Flying = true; 1539 newFlying = true;
1537 else if (FlyDisabled) 1540 else if (FlyDisabled)
1538 actor.Flying = false; 1541 newFlying = false;
1539 else 1542 else
1540 actor.Flying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); 1543 newFlying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
1541 1544
1542 if (actor.Flying != oldflying) 1545 if (actor.Flying != newFlying)
1546 {
1547 // Note: ScenePresence.Flying is actually fetched from the physical actor
1548 // so setting PhysActor.Flying here also sets the ScenePresence's value.
1549 actor.Flying = newFlying;
1543 update_movementflag = true; 1550 update_movementflag = true;
1551 }
1544 1552
1545 if (ParentID == 0) 1553 if (ParentID == 0)
1546 { 1554 {
@@ -2622,17 +2630,17 @@ namespace OpenSim.Region.Framework.Scenes
2622 2630
2623 public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs) 2631 public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
2624 { 2632 {
2625 SendCourseLocationsMethod d = m_sendCourseLocationsMethod; 2633 SendCoarseLocationsMethod d = m_sendCoarseLocationsMethod;
2626 if (d != null) 2634 if (d != null)
2627 { 2635 {
2628 d.Invoke(m_scene.RegionInfo.originRegionID, this, coarseLocations, avatarUUIDs); 2636 d.Invoke(m_scene.RegionInfo.originRegionID, this, coarseLocations, avatarUUIDs);
2629 } 2637 }
2630 } 2638 }
2631 2639
2632 public void SetSendCourseLocationMethod(SendCourseLocationsMethod d) 2640 public void SetSendCoarseLocationMethod(SendCoarseLocationsMethod d)
2633 { 2641 {
2634 if (d != null) 2642 if (d != null)
2635 m_sendCourseLocationsMethod = d; 2643 m_sendCoarseLocationsMethod = d;
2636 } 2644 }
2637 2645
2638 public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs) 2646 public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
@@ -2836,7 +2844,7 @@ namespace OpenSim.Region.Framework.Scenes
2836 #region Significant Movement Method 2844 #region Significant Movement Method
2837 2845
2838 /// <summary> 2846 /// <summary>
2839 /// This checks for a significant movement and sends a courselocationchange update 2847 /// This checks for a significant movement and sends a coarselocationchange update
2840 /// </summary> 2848 /// </summary>
2841 protected void CheckForSignificantMovement() 2849 protected void CheckForSignificantMovement()
2842 { 2850 {
@@ -3268,7 +3276,7 @@ namespace OpenSim.Region.Framework.Scenes
3268 cAgent.Anims = Animator.Animations.ToArray(); 3276 cAgent.Anims = Animator.Animations.ToArray();
3269 } 3277 }
3270 catch { } 3278 catch { }
3271 cAgent.DefaultAnim = Animator.Animations.DefaultAnimation; 3279 cAgent.DefaultAnim = Animator.Animations.ImplicitDefaultAnimation;
3272 3280
3273 if (Scene.AttachmentsModule != null) 3281 if (Scene.AttachmentsModule != null)
3274 Scene.AttachmentsModule.CopyAttachments(this, cAgent); 3282 Scene.AttachmentsModule.CopyAttachments(this, cAgent);
@@ -3627,13 +3635,16 @@ namespace OpenSim.Region.Framework.Scenes
3627 public List<SceneObjectGroup> GetAttachments(uint attachmentPoint) 3635 public List<SceneObjectGroup> GetAttachments(uint attachmentPoint)
3628 { 3636 {
3629 List<SceneObjectGroup> attachments = new List<SceneObjectGroup>(); 3637 List<SceneObjectGroup> attachments = new List<SceneObjectGroup>();
3630 3638
3631 lock (m_attachments) 3639 if (attachmentPoint >= 0)
3632 { 3640 {
3633 foreach (SceneObjectGroup so in m_attachments) 3641 lock (m_attachments)
3634 { 3642 {
3635 if (attachmentPoint == so.AttachmentPoint) 3643 foreach (SceneObjectGroup so in m_attachments)
3636 attachments.Add(so); 3644 {
3645 if (attachmentPoint == so.AttachmentPoint)
3646 attachments.Add(so);
3647 }
3637 } 3648 }
3638 } 3649 }
3639 3650