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.cs96
1 files changed, 55 insertions, 41 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 040cbfc..c578fc0 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -118,7 +118,7 @@ namespace OpenSim.Region.Framework.Scenes
118 /// TODO: For some reason, we effectively have a list both here and in Appearance. Need to work out if this is 118 /// TODO: For some reason, we effectively have a list both here and in Appearance. Need to work out if this is
119 /// necessary. 119 /// necessary.
120 /// </remarks> 120 /// </remarks>
121 protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>(); 121 private List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>();
122 122
123 public Object AttachmentsSyncLock { get; private set; } 123 public Object AttachmentsSyncLock { get; private set; }
124 124
@@ -550,8 +550,12 @@ namespace OpenSim.Region.Framework.Scenes
550 } 550 }
551 } 551 }
552 552
553 m_pos = value; 553 // Don't update while sitting
554 ParentPosition = Vector3.Zero; 554 if (ParentID == 0)
555 {
556 m_pos = value;
557 ParentPosition = Vector3.Zero;
558 }
555 559
556 //m_log.DebugFormat( 560 //m_log.DebugFormat(
557 // "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}", 561 // "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}",
@@ -566,6 +570,13 @@ namespace OpenSim.Region.Framework.Scenes
566 public Vector3 OffsetPosition 570 public Vector3 OffsetPosition
567 { 571 {
568 get { return m_pos; } 572 get { return m_pos; }
573 set
574 {
575 // There is no offset position when not seated
576 if (ParentID == 0)
577 return;
578 m_pos = value;
579 }
569 } 580 }
570 581
571 /// <summary> 582 /// <summary>
@@ -2740,8 +2751,10 @@ namespace OpenSim.Region.Framework.Scenes
2740 if (IsChildAgent) 2751 if (IsChildAgent)
2741 return; 2752 return;
2742 2753
2743 // We only do this if we have a physics actor or we're sitting on something 2754 if (ParentID != 0)
2744 if (ParentID == 0 && PhysicsActor != null || ParentID != 0) 2755 return;
2756
2757 if (!IsInTransit)
2745 { 2758 {
2746 Vector3 pos2 = AbsolutePosition; 2759 Vector3 pos2 = AbsolutePosition;
2747 Vector3 vel = Velocity; 2760 Vector3 vel = Velocity;
@@ -3100,30 +3113,28 @@ namespace OpenSim.Region.Framework.Scenes
3100 catch { } 3113 catch { }
3101 3114
3102 // Attachment objects 3115 // Attachment objects
3103 lock (m_attachments) 3116 List<SceneObjectGroup> attachments = GetAttachments();
3117 if (attachments.Count > 0)
3104 { 3118 {
3105 if (m_attachments.Count > 0) 3119 cAgent.AttachmentObjects = new List<ISceneObject>();
3106 { 3120 cAgent.AttachmentObjectStates = new List<string>();
3107 cAgent.AttachmentObjects = new List<ISceneObject>(); 3121// IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>();
3108 cAgent.AttachmentObjectStates = new List<string>(); 3122 InTransitScriptStates.Clear();
3109 // IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>();
3110 InTransitScriptStates.Clear();
3111 3123
3112 foreach (SceneObjectGroup sog in m_attachments) 3124 foreach (SceneObjectGroup sog in attachments)
3113 { 3125 {
3114 // We need to make a copy and pass that copy 3126 // We need to make a copy and pass that copy
3115 // because of transfers withn the same sim 3127 // because of transfers withn the same sim
3116 ISceneObject clone = sog.CloneForNewScene(); 3128 ISceneObject clone = sog.CloneForNewScene();
3117 // Attachment module assumes that GroupPosition holds the offsets...! 3129 // Attachment module assumes that GroupPosition holds the offsets...!
3118 ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos; 3130 ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos;
3119 ((SceneObjectGroup)clone).IsAttachment = false; 3131 ((SceneObjectGroup)clone).IsAttachment = false;
3120 cAgent.AttachmentObjects.Add(clone); 3132 cAgent.AttachmentObjects.Add(clone);
3121 string state = sog.GetStateSnapshot(); 3133 string state = sog.GetStateSnapshot();
3122 cAgent.AttachmentObjectStates.Add(state); 3134 cAgent.AttachmentObjectStates.Add(state);
3123 InTransitScriptStates.Add(state); 3135 InTransitScriptStates.Add(state);
3124 // Let's remove the scripts of the original object here 3136 // Let's remove the scripts of the original object here
3125 sog.RemoveScriptInstances(true); 3137 sog.RemoveScriptInstances(true);
3126 }
3127 } 3138 }
3128 } 3139 }
3129 } 3140 }
@@ -3531,26 +3542,29 @@ namespace OpenSim.Region.Framework.Scenes
3531 /// <param name="args">The arguments for the event</param> 3542 /// <param name="args">The arguments for the event</param>
3532 public void SendScriptEventToAttachments(string eventName, Object[] args) 3543 public void SendScriptEventToAttachments(string eventName, Object[] args)
3533 { 3544 {
3534 if (m_scriptEngines.Length == 0) 3545 Util.FireAndForget(delegate(object x)
3535 return;
3536
3537 lock (m_attachments)
3538 { 3546 {
3539 foreach (SceneObjectGroup grp in m_attachments) 3547 if (m_scriptEngines.Length == 0)
3548 return;
3549
3550 lock (m_attachments)
3540 { 3551 {
3541 // 16384 is CHANGED_ANIMATION 3552 foreach (SceneObjectGroup grp in m_attachments)
3542 //
3543 // Send this to all attachment root prims
3544 //
3545 foreach (IScriptModule m in m_scriptEngines)
3546 { 3553 {
3547 if (m == null) // No script engine loaded 3554 // 16384 is CHANGED_ANIMATION
3548 continue; 3555 //
3556 // Send this to all attachment root prims
3557 //
3558 foreach (IScriptModule m in m_scriptEngines)
3559 {
3560 if (m == null) // No script engine loaded
3561 continue;
3549 3562
3550 m.PostObjectEvent(grp.RootPart.UUID, "changed", new Object[] { (int)Changed.ANIMATION }); 3563 m.PostObjectEvent(grp.RootPart.UUID, "changed", new Object[] { (int)Changed.ANIMATION });
3564 }
3551 } 3565 }
3552 } 3566 }
3553 } 3567 });
3554 } 3568 }
3555 3569
3556 internal void PushForce(Vector3 impulse) 3570 internal void PushForce(Vector3 impulse)