aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs88
1 files changed, 49 insertions, 39 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 67b375a..b6daad6 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -147,6 +147,13 @@ namespace OpenSim.Region.Environment.Scenes
147 get { return m_lastname; } 147 get { return m_lastname; }
148 } 148 }
149 149
150 protected bool m_allowMovement = true;
151 public bool AllowMovement
152 {
153 get { return m_allowMovement; }
154 set { m_allowMovement = value; }
155 }
156
150 private readonly IClientAPI m_controllingClient; 157 private readonly IClientAPI m_controllingClient;
151 protected PhysicsActor m_physicsActor; 158 protected PhysicsActor m_physicsActor;
152 159
@@ -528,58 +535,61 @@ namespace OpenSim.Region.Environment.Scenes
528 // Console.WriteLine("DEBUG: HandleAgentUpdate: null PhysicsActor!"); 535 // Console.WriteLine("DEBUG: HandleAgentUpdate: null PhysicsActor!");
529 return; 536 return;
530 } 537 }
531
532 int i = 0;
533 bool update_movementflag = false;
534 bool update_rotation = false;
535 bool DCFlagKeyPressed = false;
536 Vector3 agent_control_v3 = new Vector3(0, 0, 0);
537 Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
538 bool oldflying = PhysicsActor.Flying;
539
540 538
541 PhysicsActor.Flying = ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); 539 if (m_allowMovement)
542 if (PhysicsActor.Flying != oldflying)
543 { 540 {
544 update_movementflag = true; 541 int i = 0;
545 } 542 bool update_movementflag = false;
543 bool update_rotation = false;
544 bool DCFlagKeyPressed = false;
545 Vector3 agent_control_v3 = new Vector3(0, 0, 0);
546 Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
547 bool oldflying = PhysicsActor.Flying;
546 548
547 if (q != m_bodyRot)
548 {
549 m_bodyRot = q;
550 update_rotation = true;
551 }
552 549
553 if (m_parentID == 0) 550 PhysicsActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0);
554 { 551 if (PhysicsActor.Flying != oldflying)
555 foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof (Dir_ControlFlags)))
556 { 552 {
557 if ((flags & (uint) DCF) != 0) 553 update_movementflag = true;
554 }
555
556 if (q != m_bodyRot)
557 {
558 m_bodyRot = q;
559 update_rotation = true;
560 }
561
562 if (m_parentID == 0)
563 {
564 foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags)))
558 { 565 {
559 DCFlagKeyPressed = true; 566 if ((flags & (uint)DCF) != 0)
560 agent_control_v3 += Dir_Vectors[i];
561 if ((m_movementflag & (uint) DCF) == 0)
562 { 567 {
563 m_movementflag += (byte) (uint) DCF; 568 DCFlagKeyPressed = true;
564 update_movementflag = true; 569 agent_control_v3 += Dir_Vectors[i];
570 if ((m_movementflag & (uint)DCF) == 0)
571 {
572 m_movementflag += (byte)(uint)DCF;
573 update_movementflag = true;
574 }
565 } 575 }
566 } 576 else
567 else
568 {
569 if ((m_movementflag & (uint) DCF) != 0)
570 { 577 {
571 m_movementflag -= (byte) (uint) DCF; 578 if ((m_movementflag & (uint)DCF) != 0)
572 update_movementflag = true; 579 {
580 m_movementflag -= (byte)(uint)DCF;
581 update_movementflag = true;
582 }
573 } 583 }
584 i++;
574 } 585 }
575 i++;
576 } 586 }
577 }
578 587
579 if ((update_movementflag) || (update_rotation && DCFlagKeyPressed)) 588 if ((update_movementflag) || (update_rotation && DCFlagKeyPressed))
580 { 589 {
581 AddNewMovement(agent_control_v3, q); 590 AddNewMovement(agent_control_v3, q);
582 UpdateMovementAnimations(update_movementflag); 591 UpdateMovementAnimations(update_movementflag);
592 }
583 } 593 }
584 594
585 } 595 }