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.cs56
1 files changed, 35 insertions, 21 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 2b9665c..25a53b4 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -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
@@ -546,7 +547,7 @@ namespace OpenSim.Region.Framework.Scenes
546 { 547 {
547 try 548 try
548 { 549 {
549 PhysicsActor.Velocity = value; 550 PhysicsActor.TargetVelocity = value;
550 } 551 }
551 catch (Exception e) 552 catch (Exception e)
552 { 553 {
@@ -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;
@@ -975,7 +976,9 @@ namespace OpenSim.Region.Framework.Scenes
975 { 976 {
976 if (wasChild && HasAttachments()) 977 if (wasChild && HasAttachments())
977 { 978 {
978 m_log.DebugFormat("[SCENE PRESENCE]: Restarting scripts in attachments..."); 979 m_log.DebugFormat(
980 "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name);
981
979 // Resume scripts 982 // Resume scripts
980 Util.FireAndForget(delegate(object x) { 983 Util.FireAndForget(delegate(object x) {
981 foreach (SceneObjectGroup sog in m_attachments) 984 foreach (SceneObjectGroup sog in m_attachments)
@@ -1531,17 +1534,22 @@ namespace OpenSim.Region.Framework.Scenes
1531 bool DCFlagKeyPressed = false; 1534 bool DCFlagKeyPressed = false;
1532 Vector3 agent_control_v3 = Vector3.Zero; 1535 Vector3 agent_control_v3 = Vector3.Zero;
1533 1536
1534 bool oldflying = Flying; 1537 bool newFlying = actor.Flying;
1535 1538
1536 if (ForceFly) 1539 if (ForceFly)
1537 actor.Flying = true; 1540 newFlying = true;
1538 else if (FlyDisabled) 1541 else if (FlyDisabled)
1539 actor.Flying = false; 1542 newFlying = false;
1540 else 1543 else
1541 actor.Flying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); 1544 newFlying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
1542 1545
1543 if (actor.Flying != oldflying) 1546 if (actor.Flying != newFlying)
1547 {
1548 // Note: ScenePresence.Flying is actually fetched from the physical actor
1549 // so setting PhysActor.Flying here also sets the ScenePresence's value.
1550 actor.Flying = newFlying;
1544 update_movementflag = true; 1551 update_movementflag = true;
1552 }
1545 1553
1546 if (ParentID == 0) 1554 if (ParentID == 0)
1547 { 1555 {
@@ -2623,17 +2631,17 @@ namespace OpenSim.Region.Framework.Scenes
2623 2631
2624 public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs) 2632 public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
2625 { 2633 {
2626 SendCourseLocationsMethod d = m_sendCourseLocationsMethod; 2634 SendCoarseLocationsMethod d = m_sendCoarseLocationsMethod;
2627 if (d != null) 2635 if (d != null)
2628 { 2636 {
2629 d.Invoke(m_scene.RegionInfo.originRegionID, this, coarseLocations, avatarUUIDs); 2637 d.Invoke(m_scene.RegionInfo.originRegionID, this, coarseLocations, avatarUUIDs);
2630 } 2638 }
2631 } 2639 }
2632 2640
2633 public void SetSendCourseLocationMethod(SendCourseLocationsMethod d) 2641 public void SetSendCoarseLocationMethod(SendCoarseLocationsMethod d)
2634 { 2642 {
2635 if (d != null) 2643 if (d != null)
2636 m_sendCourseLocationsMethod = d; 2644 m_sendCoarseLocationsMethod = d;
2637 } 2645 }
2638 2646
2639 public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs) 2647 public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
@@ -2837,7 +2845,7 @@ namespace OpenSim.Region.Framework.Scenes
2837 #region Significant Movement Method 2845 #region Significant Movement Method
2838 2846
2839 /// <summary> 2847 /// <summary>
2840 /// This checks for a significant movement and sends a courselocationchange update 2848 /// This checks for a significant movement and sends a coarselocationchange update
2841 /// </summary> 2849 /// </summary>
2842 protected void CheckForSignificantMovement() 2850 protected void CheckForSignificantMovement()
2843 { 2851 {
@@ -3274,6 +3282,7 @@ namespace OpenSim.Region.Framework.Scenes
3274 } 3282 }
3275 catch { } 3283 catch { }
3276 cAgent.DefaultAnim = Animator.Animations.DefaultAnimation; 3284 cAgent.DefaultAnim = Animator.Animations.DefaultAnimation;
3285 cAgent.AnimState = Animator.Animations.ImplicitDefaultAnimation;
3277 3286
3278 if (Scene.AttachmentsModule != null) 3287 if (Scene.AttachmentsModule != null)
3279 Scene.AttachmentsModule.CopyAttachments(this, cAgent); 3288 Scene.AttachmentsModule.CopyAttachments(this, cAgent);
@@ -3350,6 +3359,8 @@ namespace OpenSim.Region.Framework.Scenes
3350 Animator.Animations.FromArray(cAgent.Anims); 3359 Animator.Animations.FromArray(cAgent.Anims);
3351 if (cAgent.DefaultAnim != null) 3360 if (cAgent.DefaultAnim != null)
3352 Animator.Animations.SetDefaultAnimation(cAgent.DefaultAnim.AnimID, cAgent.DefaultAnim.SequenceNum, UUID.Zero); 3361 Animator.Animations.SetDefaultAnimation(cAgent.DefaultAnim.AnimID, cAgent.DefaultAnim.SequenceNum, UUID.Zero);
3362 if (cAgent.AnimState != null)
3363 Animator.Animations.SetImplicitDefaultAnimation(cAgent.AnimState.AnimID, cAgent.AnimState.SequenceNum, UUID.Zero);
3353 3364
3354 if (Scene.AttachmentsModule != null) 3365 if (Scene.AttachmentsModule != null)
3355 Scene.AttachmentsModule.CopyAttachments(cAgent, this); 3366 Scene.AttachmentsModule.CopyAttachments(cAgent, this);
@@ -3632,13 +3643,16 @@ namespace OpenSim.Region.Framework.Scenes
3632 public List<SceneObjectGroup> GetAttachments(uint attachmentPoint) 3643 public List<SceneObjectGroup> GetAttachments(uint attachmentPoint)
3633 { 3644 {
3634 List<SceneObjectGroup> attachments = new List<SceneObjectGroup>(); 3645 List<SceneObjectGroup> attachments = new List<SceneObjectGroup>();
3635 3646
3636 lock (m_attachments) 3647 if (attachmentPoint >= 0)
3637 { 3648 {
3638 foreach (SceneObjectGroup so in m_attachments) 3649 lock (m_attachments)
3639 { 3650 {
3640 if (attachmentPoint == so.AttachmentPoint) 3651 foreach (SceneObjectGroup so in m_attachments)
3641 attachments.Add(so); 3652 {
3653 if (attachmentPoint == so.AttachmentPoint)
3654 attachments.Add(so);
3655 }
3642 } 3656 }
3643 } 3657 }
3644 3658