diff options
author | Melanie | 2012-05-05 10:32:22 +0100 |
---|---|---|
committer | Melanie | 2012-05-05 10:32:22 +0100 |
commit | b62cc3ce0a395248f01174834cbbddde88018c4e (patch) | |
tree | 5b1d954d625923663933b264563b8a20a47b739e /OpenSim/Region/Framework | |
parent | Merge branch 'master' into careminster (diff) | |
parent | force lower avatar density for testing (diff) | |
download | opensim-SC_OLD-b62cc3ce0a395248f01174834cbbddde88018c4e.zip opensim-SC_OLD-b62cc3ce0a395248f01174834cbbddde88018c4e.tar.gz opensim-SC_OLD-b62cc3ce0a395248f01174834cbbddde88018c4e.tar.bz2 opensim-SC_OLD-b62cc3ce0a395248f01174834cbbddde88018c4e.tar.xz |
Merge branch 'avination' into careminster
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 66 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 55 |
2 files changed, 104 insertions, 17 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 42b6bc5..a6ce0e2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -465,7 +465,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
465 | { | 465 | { |
466 | return (IsAttachment || (m_rootPart.Shape.PCode == 9 && m_rootPart.Shape.State != 0)); | 466 | return (IsAttachment || (m_rootPart.Shape.PCode == 9 && m_rootPart.Shape.State != 0)); |
467 | } | 467 | } |
468 | 468 | ||
469 | |||
470 | |||
471 | private struct avtocrossInfo | ||
472 | { | ||
473 | public ScenePresence av; | ||
474 | public uint ParentID; | ||
475 | } | ||
476 | |||
469 | /// <summary> | 477 | /// <summary> |
470 | /// The absolute position of this scene object in the scene | 478 | /// The absolute position of this scene object in the scene |
471 | /// </summary> | 479 | /// </summary> |
@@ -517,15 +525,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
517 | { | 525 | { |
518 | // We unparent the SP quietly so that it won't | 526 | // We unparent the SP quietly so that it won't |
519 | // be made to stand up | 527 | // be made to stand up |
528 | |||
529 | List<avtocrossInfo> avsToCross = new List<avtocrossInfo>(); | ||
530 | |||
520 | foreach (ScenePresence av in m_linkedAvatars) | 531 | foreach (ScenePresence av in m_linkedAvatars) |
521 | { | 532 | { |
533 | avtocrossInfo avinfo = new avtocrossInfo(); | ||
522 | SceneObjectPart parentPart = m_scene.GetSceneObjectPart(av.ParentID); | 534 | SceneObjectPart parentPart = m_scene.GetSceneObjectPart(av.ParentID); |
523 | if (parentPart != null) | 535 | if (parentPart != null) |
524 | av.ParentUUID = parentPart.UUID; | 536 | av.ParentUUID = parentPart.UUID; |
525 | 537 | ||
538 | avinfo.av = av; | ||
539 | avinfo.ParentID = av.ParentID; | ||
540 | avsToCross.Add(avinfo); | ||
541 | |||
526 | av.ParentID = 0; | 542 | av.ParentID = 0; |
527 | } | 543 | } |
528 | 544 | ||
545 | // m_linkedAvatars.Clear(); | ||
529 | m_scene.CrossPrimGroupIntoNewRegion(val, this, true); | 546 | m_scene.CrossPrimGroupIntoNewRegion(val, this, true); |
530 | 547 | ||
531 | // Normalize | 548 | // Normalize |
@@ -541,18 +558,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
541 | // If it's deleted, crossing was successful | 558 | // If it's deleted, crossing was successful |
542 | if (IsDeleted) | 559 | if (IsDeleted) |
543 | { | 560 | { |
544 | foreach (ScenePresence av in m_linkedAvatars) | 561 | // foreach (ScenePresence av in m_linkedAvatars) |
562 | foreach (avtocrossInfo avinfo in avsToCross) | ||
545 | { | 563 | { |
546 | m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val); | 564 | ScenePresence av = avinfo.av; |
547 | 565 | if (!av.IsInTransit) // just in case... | |
548 | av.IsInTransit = true; | 566 | { |
549 | 567 | m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val); | |
550 | CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync; | 568 | |
551 | d.BeginInvoke(av, val, x, y, destination, av.Flying, version, CrossAgentToNewRegionCompleted, d); | 569 | av.IsInTransit = true; |
570 | |||
571 | CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync; | ||
572 | d.BeginInvoke(av, val, x, y, destination, av.Flying, version, CrossAgentToNewRegionCompleted, d); | ||
573 | } | ||
574 | else | ||
575 | m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar alreasy in transit {0} to {1}", av.Name, val); | ||
552 | } | 576 | } |
553 | 577 | avsToCross.Clear(); | |
554 | return; | 578 | return; |
555 | } | 579 | } |
580 | else // cross failed, put avas back ?? | ||
581 | { | ||
582 | foreach (avtocrossInfo avinfo in avsToCross) | ||
583 | { | ||
584 | ScenePresence av = avinfo.av; | ||
585 | av.ParentUUID = UUID.Zero; | ||
586 | av.ParentID = avinfo.ParentID; | ||
587 | // m_linkedAvatars.Add(av); | ||
588 | } | ||
589 | } | ||
590 | avsToCross.Clear(); | ||
591 | |||
556 | } | 592 | } |
557 | else if (RootPart.PhysActor != null) | 593 | else if (RootPart.PhysActor != null) |
558 | { | 594 | { |
@@ -565,6 +601,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
565 | val.Z = Util.Clamp<float>(oldp.Z, 0.5f, 4096.0f); | 601 | val.Z = Util.Clamp<float>(oldp.Z, 0.5f, 4096.0f); |
566 | } | 602 | } |
567 | } | 603 | } |
604 | |||
568 | /* don't see the need but worse don't see where is restored to false if things stay in | 605 | /* don't see the need but worse don't see where is restored to false if things stay in |
569 | foreach (SceneObjectPart part in m_parts.GetArray()) | 606 | foreach (SceneObjectPart part in m_parts.GetArray()) |
570 | { | 607 | { |
@@ -640,9 +677,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
640 | { | 677 | { |
641 | agent.ParentPart = null; | 678 | agent.ParentPart = null; |
642 | agent.ParentPosition = Vector3.Zero; | 679 | agent.ParentPosition = Vector3.Zero; |
680 | // agent.ParentUUID = UUID.Zero; | ||
643 | } | 681 | } |
644 | } | 682 | } |
645 | 683 | ||
684 | agent.ParentUUID = UUID.Zero; | ||
685 | |||
646 | // agent.Reset(); | 686 | // agent.Reset(); |
647 | // else // Not successful | 687 | // else // Not successful |
648 | // agent.RestoreInCurrentScene(); | 688 | // agent.RestoreInCurrentScene(); |
@@ -1779,15 +1819,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1779 | part.ClearUpdateSchedule(); | 1819 | part.ClearUpdateSchedule(); |
1780 | if (part == m_rootPart) | 1820 | if (part == m_rootPart) |
1781 | { | 1821 | { |
1782 | if (!IsAttachment || (AttachedAvatar == avatar.ControllingClient.AgentId) || | 1822 | if (!IsAttachment || (AttachedAvatar == avatar.ControllingClient.AgentId) || |
1783 | (AttachmentPoint < 31) || (AttachmentPoint > 38)) | 1823 | (AttachmentPoint < 31) || (AttachmentPoint > 38)) |
1784 | avatar.ControllingClient.SendKillObject(m_regionHandle, new List<uint> { part.LocalId }); | 1824 | avatar.ControllingClient.SendKillObject(m_regionHandle, new List<uint> { part.LocalId }); |
1785 | } | 1825 | } |
1786 | } | 1826 | } |
1787 | }); | 1827 | }); |
1788 | } | 1828 | } |
1789 | 1829 | ||
1790 | |||
1791 | } | 1830 | } |
1792 | 1831 | ||
1793 | public void AddScriptLPS(int count) | 1832 | public void AddScriptLPS(int count) |
@@ -2069,6 +2108,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2069 | dupe.m_isBackedUp = false; | 2108 | dupe.m_isBackedUp = false; |
2070 | dupe.m_parts = new MapAndArray<OpenMetaverse.UUID, SceneObjectPart>(); | 2109 | dupe.m_parts = new MapAndArray<OpenMetaverse.UUID, SceneObjectPart>(); |
2071 | 2110 | ||
2111 | // new group as no sitting avatars | ||
2112 | dupe.m_linkedAvatars = new List<ScenePresence>(); | ||
2113 | |||
2072 | // Warning, The following code related to previousAttachmentStatus is needed so that clones of | 2114 | // Warning, The following code related to previousAttachmentStatus is needed so that clones of |
2073 | // attachments do not bordercross while they're being duplicated. This is hacktastic! | 2115 | // attachments do not bordercross while they're being duplicated. This is hacktastic! |
2074 | // Normally, setting AbsolutePosition will bordercross a prim if it's outside the region! | 2116 | // Normally, setting AbsolutePosition will bordercross a prim if it's outside the region! |
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; |