aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
authorMelanie2012-05-05 10:32:22 +0100
committerMelanie2012-05-05 10:32:22 +0100
commitb62cc3ce0a395248f01174834cbbddde88018c4e (patch)
tree5b1d954d625923663933b264563b8a20a47b739e /OpenSim/Region/Framework/Scenes/ScenePresence.cs
parentMerge branch 'master' into careminster (diff)
parent force lower avatar density for testing (diff)
downloadopensim-SC-b62cc3ce0a395248f01174834cbbddde88018c4e.zip
opensim-SC-b62cc3ce0a395248f01174834cbbddde88018c4e.tar.gz
opensim-SC-b62cc3ce0a395248f01174834cbbddde88018c4e.tar.bz2
opensim-SC-b62cc3ce0a395248f01174834cbbddde88018c4e.tar.xz
Merge branch 'avination' into careminster
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs55
1 files changed, 50 insertions, 5 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 5e275f6..5a6fb6c 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -63,6 +63,7 @@ namespace OpenSim.Region.Framework.Scenes
63 63
64 struct ScriptControllers 64 struct ScriptControllers
65 { 65 {
66 public UUID objectID;
66 public UUID itemID; 67 public UUID itemID;
67 public ScriptControlled ignoreControls; 68 public ScriptControlled ignoreControls;
68 public ScriptControlled eventControls; 69 public ScriptControlled eventControls;
@@ -756,7 +757,13 @@ namespace OpenSim.Region.Framework.Scenes
756 m_movementAnimationUpdateCounter = 0; 757 m_movementAnimationUpdateCounter = 0;
757 if (Animator != null) 758 if (Animator != null)
758 { 759 {
759 if(ParentID == 0 && !SitGround) // skip it if sitting 760 // If the parentID == 0 we are not sitting
761 // if !SitGournd then we are not sitting on the ground
762 // Fairly straightforward, now here comes the twist
763 // if ParentUUID is NOT UUID.Zero, we are looking to
764 // be sat on an object that isn't there yet. Should
765 // be treated as if sat.
766 if(ParentID == 0 && !SitGround && ParentUUID == UUID.Zero) // skip it if sitting
760 Animator.UpdateMovementAnimations(); 767 Animator.UpdateMovementAnimations();
761 } 768 }
762 else 769 else
@@ -923,7 +930,15 @@ namespace OpenSim.Region.Framework.Scenes
923 } 930 }
924 AbsolutePosition = pos; 931 AbsolutePosition = pos;
925 932
926 AddToPhysicalScene(isFlying); 933 if (m_teleportFlags == TeleportFlags.Default)
934 {
935 Vector3 vel = Velocity;
936 AddToPhysicalScene(isFlying);
937 if (PhysicsActor != null)
938 PhysicsActor.SetMomentum(vel);
939 }
940 else
941 AddToPhysicalScene(isFlying);
927 942
928 if (ForceFly) 943 if (ForceFly)
929 { 944 {
@@ -974,6 +989,7 @@ namespace OpenSim.Region.Framework.Scenes
974 // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will 989 // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will
975 // stall on the border crossing since the existing child agent will still have the last movement 990 // stall on the border crossing since the existing child agent will still have the last movement
976 // recorded, which stops the input from being processed. 991 // recorded, which stops the input from being processed.
992
977 MovementFlag = 0; 993 MovementFlag = 0;
978 994
979 m_scene.EventManager.TriggerOnMakeRootAgent(this); 995 m_scene.EventManager.TriggerOnMakeRootAgent(this);
@@ -1014,6 +1030,8 @@ namespace OpenSim.Region.Framework.Scenes
1014 // as teleporting back 1030 // as teleporting back
1015 TeleportFlags = TeleportFlags.Default; 1031 TeleportFlags = TeleportFlags.Default;
1016 1032
1033 MovementFlag = 0;
1034
1017 // It looks like Animator is set to null somewhere, and MakeChild 1035 // It looks like Animator is set to null somewhere, and MakeChild
1018 // is called after that. Probably in aborted teleports. 1036 // is called after that. Probably in aborted teleports.
1019 if (Animator == null) 1037 if (Animator == null)
@@ -1021,6 +1039,7 @@ namespace OpenSim.Region.Framework.Scenes
1021 else 1039 else
1022 Animator.ResetAnimations(); 1040 Animator.ResetAnimations();
1023 1041
1042
1024// m_log.DebugFormat( 1043// m_log.DebugFormat(
1025// "[SCENE PRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}", 1044// "[SCENE PRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}",
1026// Name, UUID, m_scene.RegionInfo.RegionName); 1045// Name, UUID, m_scene.RegionInfo.RegionName);
@@ -1047,9 +1066,9 @@ namespace OpenSim.Region.Framework.Scenes
1047 { 1066 {
1048// PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; 1067// PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients;
1049 PhysicsActor.OnOutOfBounds -= OutOfBoundsCall; 1068 PhysicsActor.OnOutOfBounds -= OutOfBoundsCall;
1050 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor);
1051 PhysicsActor.UnSubscribeEvents();
1052 PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; 1069 PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
1070 PhysicsActor.UnSubscribeEvents();
1071 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor);
1053 PhysicsActor = null; 1072 PhysicsActor = null;
1054 } 1073 }
1055// else 1074// else
@@ -1885,6 +1904,8 @@ namespace OpenSim.Region.Framework.Scenes
1885 if (ParentID != 0) 1904 if (ParentID != 0)
1886 { 1905 {
1887 SceneObjectPart part = ParentPart; 1906 SceneObjectPart part = ParentPart;
1907 UnRegisterSeatControls(part.ParentGroup.UUID);
1908
1888 TaskInventoryDictionary taskIDict = part.TaskInventory; 1909 TaskInventoryDictionary taskIDict = part.TaskInventory;
1889 if (taskIDict != null) 1910 if (taskIDict != null)
1890 { 1911 {
@@ -3212,7 +3233,7 @@ namespace OpenSim.Region.Framework.Scenes
3212 3233
3213 foreach (ScriptControllers c in scriptedcontrols.Values) 3234 foreach (ScriptControllers c in scriptedcontrols.Values)
3214 { 3235 {
3215 controls[i++] = new ControllerData(c.itemID, (uint)c.ignoreControls, (uint)c.eventControls); 3236 controls[i++] = new ControllerData(c.objectID, c.itemID, (uint)c.ignoreControls, (uint)c.eventControls);
3216 } 3237 }
3217 cAgent.Controllers = controls; 3238 cAgent.Controllers = controls;
3218 } 3239 }
@@ -3223,6 +3244,7 @@ namespace OpenSim.Region.Framework.Scenes
3223 cAgent.Anims = Animator.Animations.ToArray(); 3244 cAgent.Anims = Animator.Animations.ToArray();
3224 } 3245 }
3225 catch { } 3246 catch { }
3247 cAgent.DefaultAnim = Animator.Animations.DefaultAnimation;
3226 3248
3227 // Attachment objects 3249 // Attachment objects
3228 List<SceneObjectGroup> attachments = GetAttachments(); 3250 List<SceneObjectGroup> attachments = GetAttachments();
@@ -3302,6 +3324,7 @@ namespace OpenSim.Region.Framework.Scenes
3302 foreach (ControllerData c in cAgent.Controllers) 3324 foreach (ControllerData c in cAgent.Controllers)
3303 { 3325 {
3304 ScriptControllers sc = new ScriptControllers(); 3326 ScriptControllers sc = new ScriptControllers();
3327 sc.objectID = c.ObjectID;
3305 sc.itemID = c.ItemID; 3328 sc.itemID = c.ItemID;
3306 sc.ignoreControls = (ScriptControlled)c.IgnoreControls; 3329 sc.ignoreControls = (ScriptControlled)c.IgnoreControls;
3307 sc.eventControls = (ScriptControlled)c.EventControls; 3330 sc.eventControls = (ScriptControlled)c.EventControls;
@@ -3316,6 +3339,8 @@ namespace OpenSim.Region.Framework.Scenes
3316 // FIXME: Why is this null check necessary? Where are the cases where we get a null Anims object? 3339 // FIXME: Why is this null check necessary? Where are the cases where we get a null Anims object?
3317 if (cAgent.Anims != null) 3340 if (cAgent.Anims != null)
3318 Animator.Animations.FromArray(cAgent.Anims); 3341 Animator.Animations.FromArray(cAgent.Anims);
3342 if (cAgent.DefaultAnim != null)
3343 Animator.Animations.SetDefaultAnimation(cAgent.DefaultAnim.AnimID, cAgent.DefaultAnim.SequenceNum, UUID.Zero);
3319 3344
3320 if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0) 3345 if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0)
3321 { 3346 {
@@ -3791,10 +3816,15 @@ namespace OpenSim.Region.Framework.Scenes
3791 3816
3792 public void RegisterControlEventsToScript(int controls, int accept, int pass_on, uint Obj_localID, UUID Script_item_UUID) 3817 public void RegisterControlEventsToScript(int controls, int accept, int pass_on, uint Obj_localID, UUID Script_item_UUID)
3793 { 3818 {
3819 SceneObjectPart p = m_scene.GetSceneObjectPart(Obj_localID);
3820 if (p == null)
3821 return;
3822
3794 ScriptControllers obj = new ScriptControllers(); 3823 ScriptControllers obj = new ScriptControllers();
3795 obj.ignoreControls = ScriptControlled.CONTROL_ZERO; 3824 obj.ignoreControls = ScriptControlled.CONTROL_ZERO;
3796 obj.eventControls = ScriptControlled.CONTROL_ZERO; 3825 obj.eventControls = ScriptControlled.CONTROL_ZERO;
3797 3826
3827 obj.objectID = p.ParentGroup.UUID;
3798 obj.itemID = Script_item_UUID; 3828 obj.itemID = Script_item_UUID;
3799 if (pass_on == 0 && accept == 0) 3829 if (pass_on == 0 && accept == 0)
3800 { 3830 {
@@ -3843,6 +3873,21 @@ namespace OpenSim.Region.Framework.Scenes
3843 ControllingClient.SendTakeControls(int.MaxValue, false, false); 3873 ControllingClient.SendTakeControls(int.MaxValue, false, false);
3844 } 3874 }
3845 3875
3876 private void UnRegisterSeatControls(UUID obj)
3877 {
3878 List<UUID> takers = new List<UUID>();
3879
3880 foreach (ScriptControllers c in scriptedcontrols.Values)
3881 {
3882 if (c.objectID == obj)
3883 takers.Add(c.itemID);
3884 }
3885 foreach (UUID t in takers)
3886 {
3887 UnRegisterControlEventsToScript(0, t);
3888 }
3889 }
3890
3846 public void UnRegisterControlEventsToScript(uint Obj_localID, UUID Script_item_UUID) 3891 public void UnRegisterControlEventsToScript(uint Obj_localID, UUID Script_item_UUID)
3847 { 3892 {
3848 ScriptControllers takecontrols; 3893 ScriptControllers takecontrols;