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.cs571
1 files changed, 489 insertions, 82 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 3909fd4..310e21a 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;
@@ -98,7 +99,7 @@ namespace OpenSim.Region.Framework.Scenes
98 /// rotation, prim cut, prim twist, prim taper, and prim shear. See mantis 99 /// rotation, prim cut, prim twist, prim taper, and prim shear. See mantis
99 /// issue #1716 100 /// issue #1716
100 /// </summary> 101 /// </summary>
101 public static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.0f, 0.0f, 0.418f); 102 public static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.0f, 0.0f, 0.4f);
102 103
103 /// <summary> 104 /// <summary>
104 /// Movement updates for agents in neighboring regions are sent directly to clients. 105 /// Movement updates for agents in neighboring regions are sent directly to clients.
@@ -175,6 +176,7 @@ namespace OpenSim.Region.Framework.Scenes
175// private int m_lastColCount = -1; //KF: Look for Collision chnages 176// private int m_lastColCount = -1; //KF: Look for Collision chnages
176// private int m_updateCount = 0; //KF: Update Anims for a while 177// private int m_updateCount = 0; //KF: Update Anims for a while
177// private static readonly int UPDATE_COUNT = 10; // how many frames to update for 178// private static readonly int UPDATE_COUNT = 10; // how many frames to update for
179 private List<uint> m_lastColliders = new List<uint>();
178 180
179 private TeleportFlags m_teleportFlags; 181 private TeleportFlags m_teleportFlags;
180 public TeleportFlags TeleportFlags 182 public TeleportFlags TeleportFlags
@@ -236,6 +238,13 @@ namespace OpenSim.Region.Framework.Scenes
236 //private int m_moveToPositionStateStatus; 238 //private int m_moveToPositionStateStatus;
237 //***************************************************** 239 //*****************************************************
238 240
241 private bool m_collisionEventFlag = false;
242 private object m_collisionEventLock = new Object();
243
244 private int m_movementAnimationUpdateCounter = 0;
245
246 private Vector3 m_prevSitOffset;
247
239 protected AvatarAppearance m_appearance; 248 protected AvatarAppearance m_appearance;
240 249
241 public AvatarAppearance Appearance 250 public AvatarAppearance Appearance
@@ -577,6 +586,13 @@ namespace OpenSim.Region.Framework.Scenes
577 /// </summary> 586 /// </summary>
578 public uint ParentID { get; set; } 587 public uint ParentID { get; set; }
579 588
589 public UUID ParentUUID
590 {
591 get { return m_parentUUID; }
592 set { m_parentUUID = value; }
593 }
594 private UUID m_parentUUID = UUID.Zero;
595
580 /// <summary> 596 /// <summary>
581 /// If the avatar is sitting, the prim that it's sitting on. If not sitting then null. 597 /// If the avatar is sitting, the prim that it's sitting on. If not sitting then null.
582 /// </summary> 598 /// </summary>
@@ -737,6 +753,33 @@ namespace OpenSim.Region.Framework.Scenes
737 Appearance = appearance; 753 Appearance = appearance;
738 } 754 }
739 755
756 private void RegionHeartbeatEnd(Scene scene)
757 {
758 if (IsChildAgent)
759 return;
760
761 m_movementAnimationUpdateCounter ++;
762 if (m_movementAnimationUpdateCounter >= 2)
763 {
764 m_movementAnimationUpdateCounter = 0;
765 if (Animator != null)
766 {
767 // If the parentID == 0 we are not sitting
768 // if !SitGournd then we are not sitting on the ground
769 // Fairly straightforward, now here comes the twist
770 // if ParentUUID is NOT UUID.Zero, we are looking to
771 // be sat on an object that isn't there yet. Should
772 // be treated as if sat.
773 if(ParentID == 0 && !SitGround && ParentUUID == UUID.Zero) // skip it if sitting
774 Animator.UpdateMovementAnimations();
775 }
776 else
777 {
778 m_scene.EventManager.OnRegionHeartbeatEnd -= RegionHeartbeatEnd;
779 }
780 }
781 }
782
740 public void RegisterToEvents() 783 public void RegisterToEvents()
741 { 784 {
742 ControllingClient.OnCompleteMovementToRegion += CompleteMovement; 785 ControllingClient.OnCompleteMovementToRegion += CompleteMovement;
@@ -746,6 +789,7 @@ namespace OpenSim.Region.Framework.Scenes
746 ControllingClient.OnSetAlwaysRun += HandleSetAlwaysRun; 789 ControllingClient.OnSetAlwaysRun += HandleSetAlwaysRun;
747 ControllingClient.OnStartAnim += HandleStartAnim; 790 ControllingClient.OnStartAnim += HandleStartAnim;
748 ControllingClient.OnStopAnim += HandleStopAnim; 791 ControllingClient.OnStopAnim += HandleStopAnim;
792 ControllingClient.OnChangeAnim += avnHandleChangeAnim;
749 ControllingClient.OnForceReleaseControls += HandleForceReleaseControls; 793 ControllingClient.OnForceReleaseControls += HandleForceReleaseControls;
750 ControllingClient.OnAutoPilotGo += MoveToTarget; 794 ControllingClient.OnAutoPilotGo += MoveToTarget;
751 795
@@ -806,10 +850,38 @@ namespace OpenSim.Region.Framework.Scenes
806 "[SCENE]: Upgrading child to root agent for {0} in {1}", 850 "[SCENE]: Upgrading child to root agent for {0} in {1}",
807 Name, m_scene.RegionInfo.RegionName); 851 Name, m_scene.RegionInfo.RegionName);
808 852
809 //m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count);
810
811 bool wasChild = IsChildAgent; 853 bool wasChild = IsChildAgent;
812 IsChildAgent = false; 854
855 if (ParentUUID != UUID.Zero)
856 {
857 m_log.DebugFormat("[SCENE PRESENCE]: Sitting avatar back on prim {0}", ParentUUID);
858 SceneObjectPart part = m_scene.GetSceneObjectPart(ParentUUID);
859 if (part == null)
860 {
861 m_log.ErrorFormat("[SCENE PRESENCE]: Can't find prim {0} to sit on", ParentUUID);
862 }
863 else
864 {
865 part.ParentGroup.AddAvatar(UUID);
866 if (part.SitTargetPosition != Vector3.Zero)
867 part.SitTargetAvatar = UUID;
868 ParentPosition = part.GetWorldPosition();
869 ParentID = part.LocalId;
870 ParentPart = part;
871 m_pos = m_prevSitOffset;
872 pos = ParentPosition;
873 }
874 ParentUUID = UUID.Zero;
875
876 IsChildAgent = false;
877
878// Animator.TrySetMovementAnimation("SIT");
879 }
880 else
881 {
882 IsChildAgent = false;
883 }
884
813 885
814 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); 886 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
815 if (gm != null) 887 if (gm != null)
@@ -819,62 +891,72 @@ namespace OpenSim.Region.Framework.Scenes
819 891
820 m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); 892 m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene);
821 893
822 // Moved this from SendInitialData to ensure that Appearance is initialized 894 if (ParentID == 0)
823 // before the inventory is processed in MakeRootAgent. This fixes a race condition
824 // related to the handling of attachments
825 //m_scene.GetAvatarAppearance(ControllingClient, out Appearance);
826 if (m_scene.TestBorderCross(pos, Cardinals.E))
827 { 895 {
828 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E); 896 // Moved this from SendInitialData to ensure that Appearance is initialized
829 pos.X = crossedBorder.BorderLine.Z - 1; 897 // before the inventory is processed in MakeRootAgent. This fixes a race condition
830 } 898 // related to the handling of attachments
899 //m_scene.GetAvatarAppearance(ControllingClient, out Appearance);
900 if (m_scene.TestBorderCross(pos, Cardinals.E))
901 {
902 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E);
903 pos.X = crossedBorder.BorderLine.Z - 1;
904 }
831 905
832 if (m_scene.TestBorderCross(pos, Cardinals.N)) 906 if (m_scene.TestBorderCross(pos, Cardinals.N))
833 { 907 {
834 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.N); 908 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.N);
835 pos.Y = crossedBorder.BorderLine.Z - 1; 909 pos.Y = crossedBorder.BorderLine.Z - 1;
836 } 910 }
837 911
838 CheckAndAdjustLandingPoint(ref pos); 912 CheckAndAdjustLandingPoint(ref pos);
839 913
840 if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f) 914 if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f)
841 { 915 {
842 m_log.WarnFormat( 916 m_log.WarnFormat(
843 "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Clamping", 917 "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Clamping",
844 pos, Name, UUID); 918 pos, Name, UUID);
845 919
846 if (pos.X < 0f) pos.X = 0f; 920 if (pos.X < 0f) pos.X = 0f;
847 if (pos.Y < 0f) pos.Y = 0f; 921 if (pos.Y < 0f) pos.Y = 0f;
848 if (pos.Z < 0f) pos.Z = 0f; 922 if (pos.Z < 0f) pos.Z = 0f;
849 } 923 }
850 924
851 float localAVHeight = 1.56f; 925 float localAVHeight = 1.56f;
852 if (Appearance.AvatarHeight > 0) 926 if (Appearance.AvatarHeight > 0)
853 localAVHeight = Appearance.AvatarHeight; 927 localAVHeight = Appearance.AvatarHeight;
854 928
855 float posZLimit = 0; 929 float posZLimit = 0;
856 930
857 if (pos.X < Constants.RegionSize && pos.Y < Constants.RegionSize) 931 if (pos.X < Constants.RegionSize && pos.Y < Constants.RegionSize)
858 posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; 932 posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y];
859 933
860 float newPosZ = posZLimit + localAVHeight / 2; 934 float newPosZ = posZLimit + localAVHeight / 2;
861 if (posZLimit >= (pos.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) 935 if (posZLimit >= (pos.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ)))
862 { 936 {
863 pos.Z = newPosZ; 937 pos.Z = newPosZ;
864 } 938 }
865 AbsolutePosition = pos; 939 AbsolutePosition = pos;
866 940
867 AddToPhysicalScene(isFlying); 941 if (m_teleportFlags == TeleportFlags.Default)
942 {
943 Vector3 vel = Velocity;
944 AddToPhysicalScene(isFlying);
945 if (PhysicsActor != null)
946 PhysicsActor.SetMomentum(vel);
947 }
948 else
949 AddToPhysicalScene(isFlying);
868 950
869 if (ForceFly) 951 if (ForceFly)
870 { 952 {
871 Flying = true; 953 Flying = true;
872 } 954 }
873 else if (FlyDisabled) 955 else if (FlyDisabled)
874 { 956 {
875 Flying = false; 957 Flying = false;
958 }
876 } 959 }
877
878 // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying 960 // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying
879 // avatar to return to the standing position in mid-air. On login it looks like this is being sent 961 // avatar to return to the standing position in mid-air. On login it looks like this is being sent
880 // elsewhere anyway 962 // elsewhere anyway
@@ -892,14 +974,19 @@ namespace OpenSim.Region.Framework.Scenes
892 { 974 {
893 m_log.DebugFormat("[SCENE PRESENCE]: Restarting scripts in attachments..."); 975 m_log.DebugFormat("[SCENE PRESENCE]: Restarting scripts in attachments...");
894 // Resume scripts 976 // Resume scripts
895 foreach (SceneObjectGroup sog in m_attachments) 977 Util.FireAndForget(delegate(object x) {
896 { 978 foreach (SceneObjectGroup sog in m_attachments)
897 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); 979 {
898 sog.ResumeScripts(); 980 sog.ScheduleGroupForFullUpdate();
899 } 981 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource());
982 sog.ResumeScripts();
983 }
984 });
900 } 985 }
901 } 986 }
902 987
988 SendAvatarDataToAllAgents();
989
903 // send the animations of the other presences to me 990 // send the animations of the other presences to me
904 m_scene.ForEachRootScenePresence(delegate(ScenePresence presence) 991 m_scene.ForEachRootScenePresence(delegate(ScenePresence presence)
905 { 992 {
@@ -910,9 +997,12 @@ namespace OpenSim.Region.Framework.Scenes
910 // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will 997 // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will
911 // stall on the border crossing since the existing child agent will still have the last movement 998 // stall on the border crossing since the existing child agent will still have the last movement
912 // recorded, which stops the input from being processed. 999 // recorded, which stops the input from being processed.
1000
913 MovementFlag = 0; 1001 MovementFlag = 0;
914 1002
915 m_scene.EventManager.TriggerOnMakeRootAgent(this); 1003 m_scene.EventManager.TriggerOnMakeRootAgent(this);
1004
1005 m_scene.EventManager.OnRegionHeartbeatEnd += RegionHeartbeatEnd;
916 } 1006 }
917 1007
918 public int GetStateSource() 1008 public int GetStateSource()
@@ -940,12 +1030,16 @@ namespace OpenSim.Region.Framework.Scenes
940 /// </remarks> 1030 /// </remarks>
941 public void MakeChildAgent() 1031 public void MakeChildAgent()
942 { 1032 {
1033 m_scene.EventManager.OnRegionHeartbeatEnd -= RegionHeartbeatEnd;
1034
943 m_log.DebugFormat("[SCENE PRESENCE]: Making {0} a child agent in {1}", Name, Scene.RegionInfo.RegionName); 1035 m_log.DebugFormat("[SCENE PRESENCE]: Making {0} a child agent in {1}", Name, Scene.RegionInfo.RegionName);
944 1036
945 // Reset these so that teleporting in and walking out isn't seen 1037 // Reset these so that teleporting in and walking out isn't seen
946 // as teleporting back 1038 // as teleporting back
947 TeleportFlags = TeleportFlags.Default; 1039 TeleportFlags = TeleportFlags.Default;
948 1040
1041 MovementFlag = 0;
1042
949 // It looks like Animator is set to null somewhere, and MakeChild 1043 // It looks like Animator is set to null somewhere, and MakeChild
950 // is called after that. Probably in aborted teleports. 1044 // is called after that. Probably in aborted teleports.
951 if (Animator == null) 1045 if (Animator == null)
@@ -953,6 +1047,7 @@ namespace OpenSim.Region.Framework.Scenes
953 else 1047 else
954 Animator.ResetAnimations(); 1048 Animator.ResetAnimations();
955 1049
1050
956// m_log.DebugFormat( 1051// m_log.DebugFormat(
957// "[SCENE PRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}", 1052// "[SCENE PRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}",
958// Name, UUID, m_scene.RegionInfo.RegionName); 1053// Name, UUID, m_scene.RegionInfo.RegionName);
@@ -964,6 +1059,7 @@ namespace OpenSim.Region.Framework.Scenes
964 IsChildAgent = true; 1059 IsChildAgent = true;
965 m_scene.SwapRootAgentCount(true); 1060 m_scene.SwapRootAgentCount(true);
966 RemoveFromPhysicalScene(); 1061 RemoveFromPhysicalScene();
1062 ParentID = 0; // Child agents can't be sitting
967 1063
968 // FIXME: Set RegionHandle to the region handle of the scene this agent is moving into 1064 // FIXME: Set RegionHandle to the region handle of the scene this agent is moving into
969 1065
@@ -979,9 +1075,9 @@ namespace OpenSim.Region.Framework.Scenes
979 { 1075 {
980// PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; 1076// PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients;
981 PhysicsActor.OnOutOfBounds -= OutOfBoundsCall; 1077 PhysicsActor.OnOutOfBounds -= OutOfBoundsCall;
982 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor);
983 PhysicsActor.UnSubscribeEvents();
984 PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; 1078 PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
1079 PhysicsActor.UnSubscribeEvents();
1080 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor);
985 PhysicsActor = null; 1081 PhysicsActor = null;
986 } 1082 }
987// else 1083// else
@@ -998,7 +1094,7 @@ namespace OpenSim.Region.Framework.Scenes
998 /// <param name="pos"></param> 1094 /// <param name="pos"></param>
999 public void Teleport(Vector3 pos) 1095 public void Teleport(Vector3 pos)
1000 { 1096 {
1001 TeleportWithMomentum(pos, null); 1097 TeleportWithMomentum(pos, Vector3.Zero);
1002 } 1098 }
1003 1099
1004 public void TeleportWithMomentum(Vector3 pos, Vector3? v) 1100 public void TeleportWithMomentum(Vector3 pos, Vector3? v)
@@ -1022,6 +1118,41 @@ namespace OpenSim.Region.Framework.Scenes
1022 SendTerseUpdateToAllClients(); 1118 SendTerseUpdateToAllClients();
1023 } 1119 }
1024 1120
1121 public void avnLocalTeleport(Vector3 newpos, Vector3? newvel, bool rotateToVelXY)
1122 {
1123 CheckLandingPoint(ref newpos);
1124 AbsolutePosition = newpos;
1125
1126 if (newvel.HasValue)
1127 {
1128 if ((Vector3)newvel == Vector3.Zero)
1129 {
1130 if (PhysicsActor != null)
1131 PhysicsActor.SetMomentum(Vector3.Zero);
1132 m_velocity = Vector3.Zero;
1133 }
1134 else
1135 {
1136 if (PhysicsActor != null)
1137 PhysicsActor.SetMomentum((Vector3)newvel);
1138 m_velocity = (Vector3)newvel;
1139
1140 if (rotateToVelXY)
1141 {
1142 Vector3 lookAt = (Vector3)newvel;
1143 lookAt.Z = 0;
1144 lookAt.Normalize();
1145 ControllingClient.SendLocalTeleport(newpos, lookAt, (uint)TeleportFlags.ViaLocation);
1146 return;
1147 }
1148 }
1149 }
1150
1151 SendTerseUpdateToAllClients();
1152 }
1153
1154
1155
1025 public void StopFlying() 1156 public void StopFlying()
1026 { 1157 {
1027 ControllingClient.StopFlying(this); 1158 ControllingClient.StopFlying(this);
@@ -1337,8 +1468,18 @@ namespace OpenSim.Region.Framework.Scenes
1337 { 1468 {
1338 if (m_followCamAuto) 1469 if (m_followCamAuto)
1339 { 1470 {
1340 Vector3 posAdjusted = m_pos + HEAD_ADJUSTMENT; 1471 // Vector3 posAdjusted = m_pos + HEAD_ADJUSTMENT;
1341 m_scene.PhysicsScene.RaycastWorld(m_pos, Vector3.Normalize(CameraPosition - posAdjusted), Vector3.Distance(CameraPosition, posAdjusted) + 0.3f, RayCastCameraCallback); 1472 // m_scene.PhysicsScene.RaycastWorld(m_pos, Vector3.Normalize(CameraPosition - posAdjusted), Vector3.Distance(CameraPosition, posAdjusted) + 0.3f, RayCastCameraCallback);
1473
1474 Vector3 posAdjusted = AbsolutePosition + HEAD_ADJUSTMENT;
1475 Vector3 distTocam = CameraPosition - posAdjusted;
1476 float distTocamlen = distTocam.Length();
1477 if (distTocamlen > 0)
1478 {
1479 distTocam *= 1.0f / distTocamlen;
1480 m_scene.PhysicsScene.RaycastWorld(posAdjusted, distTocam, distTocamlen + 0.3f, RayCastCameraCallback);
1481 }
1482
1342 } 1483 }
1343 } 1484 }
1344 1485
@@ -1772,12 +1913,17 @@ namespace OpenSim.Region.Framework.Scenes
1772// m_log.DebugFormat("[SCENE PRESENCE]: StandUp() for {0}", Name); 1913// m_log.DebugFormat("[SCENE PRESENCE]: StandUp() for {0}", Name);
1773 1914
1774 SitGround = false; 1915 SitGround = false;
1916
1917/* move this down so avatar gets physical in the new position and not where it is siting
1775 if (PhysicsActor == null) 1918 if (PhysicsActor == null)
1776 AddToPhysicalScene(false); 1919 AddToPhysicalScene(false);
1920 */
1777 1921
1778 if (ParentID != 0) 1922 if (ParentID != 0)
1779 { 1923 {
1780 SceneObjectPart part = ParentPart; 1924 SceneObjectPart part = ParentPart;
1925 UnRegisterSeatControls(part.ParentGroup.UUID);
1926
1781 TaskInventoryDictionary taskIDict = part.TaskInventory; 1927 TaskInventoryDictionary taskIDict = part.TaskInventory;
1782 if (taskIDict != null) 1928 if (taskIDict != null)
1783 { 1929 {
@@ -1797,6 +1943,7 @@ namespace OpenSim.Region.Framework.Scenes
1797 if (part.SitTargetAvatar == UUID) 1943 if (part.SitTargetAvatar == UUID)
1798 part.SitTargetAvatar = UUID.Zero; 1944 part.SitTargetAvatar = UUID.Zero;
1799 1945
1946 part.ParentGroup.DeleteAvatar(UUID);
1800 ParentPosition = part.GetWorldPosition(); 1947 ParentPosition = part.GetWorldPosition();
1801 ControllingClient.SendClearFollowCamProperties(part.ParentUUID); 1948 ControllingClient.SendClearFollowCamProperties(part.ParentUUID);
1802 1949
@@ -1805,6 +1952,10 @@ namespace OpenSim.Region.Framework.Scenes
1805 1952
1806 ParentID = 0; 1953 ParentID = 0;
1807 ParentPart = null; 1954 ParentPart = null;
1955
1956 if (PhysicsActor == null)
1957 AddToPhysicalScene(false);
1958
1808 SendAvatarDataToAllAgents(); 1959 SendAvatarDataToAllAgents();
1809 m_requestedSitTargetID = 0; 1960 m_requestedSitTargetID = 0;
1810 1961
@@ -1812,6 +1963,9 @@ namespace OpenSim.Region.Framework.Scenes
1812 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); 1963 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
1813 } 1964 }
1814 1965
1966 else if (PhysicsActor == null)
1967 AddToPhysicalScene(false);
1968
1815 Animator.TrySetMovementAnimation("STAND"); 1969 Animator.TrySetMovementAnimation("STAND");
1816 } 1970 }
1817 1971
@@ -1890,7 +2044,7 @@ namespace OpenSim.Region.Framework.Scenes
1890// m_log.DebugFormat("[SCENE PRESENCE]: {0} {1}", SitTargetisSet, SitTargetUnOccupied); 2044// m_log.DebugFormat("[SCENE PRESENCE]: {0} {1}", SitTargetisSet, SitTargetUnOccupied);
1891 2045
1892 if (PhysicsActor != null) 2046 if (PhysicsActor != null)
1893 m_sitAvatarHeight = PhysicsActor.Size.Z; 2047 m_sitAvatarHeight = PhysicsActor.Size.Z * 0.5f;
1894 2048
1895 bool canSit = false; 2049 bool canSit = false;
1896 pos = part.AbsolutePosition + offset; 2050 pos = part.AbsolutePosition + offset;
@@ -1935,7 +2089,7 @@ namespace OpenSim.Region.Framework.Scenes
1935 forceMouselook = part.GetForceMouselook(); 2089 forceMouselook = part.GetForceMouselook();
1936 2090
1937 ControllingClient.SendSitResponse( 2091 ControllingClient.SendSitResponse(
1938 targetID, offset, sitOrientation, false, cameraAtOffset, cameraEyeOffset, forceMouselook); 2092 part.UUID, offset, sitOrientation, false, cameraAtOffset, cameraEyeOffset, forceMouselook);
1939 2093
1940 m_requestedSitTargetUUID = targetID; 2094 m_requestedSitTargetUUID = targetID;
1941 2095
@@ -1949,6 +2103,9 @@ namespace OpenSim.Region.Framework.Scenes
1949 2103
1950 public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset) 2104 public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset)
1951 { 2105 {
2106 if (IsChildAgent)
2107 return;
2108
1952 if (ParentID != 0) 2109 if (ParentID != 0)
1953 { 2110 {
1954 StandUp(); 2111 StandUp();
@@ -2217,14 +2374,36 @@ namespace OpenSim.Region.Framework.Scenes
2217 2374
2218 //Quaternion result = (sitTargetOrient * vq) * nq; 2375 //Quaternion result = (sitTargetOrient * vq) * nq;
2219 2376
2220 m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT; 2377 double x, y, z, m;
2378
2379 Quaternion r = sitTargetOrient;
2380 m = r.X * r.X + r.Y * r.Y + r.Z * r.Z + r.W * r.W;
2381
2382 if (Math.Abs(1.0 - m) > 0.000001)
2383 {
2384 m = 1.0 / Math.Sqrt(m);
2385 r.X *= (float)m;
2386 r.Y *= (float)m;
2387 r.Z *= (float)m;
2388 r.W *= (float)m;
2389 }
2390
2391 x = 2 * (r.X * r.Z + r.Y * r.W);
2392 y = 2 * (-r.X * r.W + r.Y * r.Z);
2393 z = -r.X * r.X - r.Y * r.Y + r.Z * r.Z + r.W * r.W;
2394
2395 Vector3 up = new Vector3((float)x, (float)y, (float)z);
2396 Vector3 sitOffset = up * Appearance.AvatarHeight * 0.02638f;
2397 m_pos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT;
2221 Rotation = sitTargetOrient; 2398 Rotation = sitTargetOrient;
2222 ParentPosition = part.AbsolutePosition; 2399 ParentPosition = part.AbsolutePosition;
2400 part.ParentGroup.AddAvatar(UUID);
2223 } 2401 }
2224 else 2402 else
2225 { 2403 {
2226 m_pos -= part.AbsolutePosition; 2404 m_pos -= part.AbsolutePosition;
2227 ParentPosition = part.AbsolutePosition; 2405 ParentPosition = part.AbsolutePosition;
2406 part.ParentGroup.AddAvatar(UUID);
2228 2407
2229// m_log.DebugFormat( 2408// m_log.DebugFormat(
2230// "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target", 2409// "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target",
@@ -2269,6 +2448,13 @@ namespace OpenSim.Region.Framework.Scenes
2269 Animator.RemoveAnimation(animID); 2448 Animator.RemoveAnimation(animID);
2270 } 2449 }
2271 2450
2451 public void avnHandleChangeAnim(UUID animID, bool addRemove,bool sendPack)
2452 {
2453 Animator.avnChangeAnim(animID, addRemove, sendPack);
2454 }
2455
2456
2457
2272 /// <summary> 2458 /// <summary>
2273 /// Rotate the avatar to the given rotation and apply a movement in the given relative vector 2459 /// Rotate the avatar to the given rotation and apply a movement in the given relative vector
2274 /// </summary> 2460 /// </summary>
@@ -2322,14 +2508,15 @@ namespace OpenSim.Region.Framework.Scenes
2322 direc.Z *= 2.6f; 2508 direc.Z *= 2.6f;
2323 2509
2324 // TODO: PreJump and jump happen too quickly. Many times prejump gets ignored. 2510 // TODO: PreJump and jump happen too quickly. Many times prejump gets ignored.
2325 Animator.TrySetMovementAnimation("PREJUMP"); 2511// Animator.TrySetMovementAnimation("PREJUMP");
2326 Animator.TrySetMovementAnimation("JUMP"); 2512// Animator.TrySetMovementAnimation("JUMP");
2327 } 2513 }
2328 } 2514 }
2329 } 2515 }
2330 2516
2331 // TODO: Add the force instead of only setting it to support multiple forces per frame? 2517 // TODO: Add the force instead of only setting it to support multiple forces per frame?
2332 m_forceToApply = direc; 2518 m_forceToApply = direc;
2519 Animator.UpdateMovementAnimations();
2333 } 2520 }
2334 2521
2335 #endregion 2522 #endregion
@@ -2722,8 +2909,9 @@ namespace OpenSim.Region.Framework.Scenes
2722 2909
2723 // If we don't have a PhysActor, we can't cross anyway 2910 // If we don't have a PhysActor, we can't cross anyway
2724 // Also don't do this while sat, sitting avatars cross with the 2911 // Also don't do this while sat, sitting avatars cross with the
2725 // object they sit on. 2912 // object they sit on. ParentUUID denoted a pending sit, don't
2726 if (ParentID != 0 || PhysicsActor == null) 2913 // interfere with it.
2914 if (ParentID != 0 || PhysicsActor == null || ParentUUID != UUID.Zero)
2727 return; 2915 return;
2728 2916
2729 if (!IsInTransit) 2917 if (!IsInTransit)
@@ -3064,6 +3252,9 @@ namespace OpenSim.Region.Framework.Scenes
3064 cAgent.AlwaysRun = SetAlwaysRun; 3252 cAgent.AlwaysRun = SetAlwaysRun;
3065 3253
3066 cAgent.Appearance = new AvatarAppearance(Appearance); 3254 cAgent.Appearance = new AvatarAppearance(Appearance);
3255
3256 cAgent.ParentPart = ParentUUID;
3257 cAgent.SitOffset = m_pos;
3067 3258
3068 lock (scriptedcontrols) 3259 lock (scriptedcontrols)
3069 { 3260 {
@@ -3072,7 +3263,7 @@ namespace OpenSim.Region.Framework.Scenes
3072 3263
3073 foreach (ScriptControllers c in scriptedcontrols.Values) 3264 foreach (ScriptControllers c in scriptedcontrols.Values)
3074 { 3265 {
3075 controls[i++] = new ControllerData(c.itemID, (uint)c.ignoreControls, (uint)c.eventControls); 3266 controls[i++] = new ControllerData(c.objectID, c.itemID, (uint)c.ignoreControls, (uint)c.eventControls);
3076 } 3267 }
3077 cAgent.Controllers = controls; 3268 cAgent.Controllers = controls;
3078 } 3269 }
@@ -3083,6 +3274,7 @@ namespace OpenSim.Region.Framework.Scenes
3083 cAgent.Anims = Animator.Animations.ToArray(); 3274 cAgent.Anims = Animator.Animations.ToArray();
3084 } 3275 }
3085 catch { } 3276 catch { }
3277 cAgent.DefaultAnim = Animator.Animations.DefaultAnimation;
3086 3278
3087 // Attachment objects 3279 // Attachment objects
3088 List<SceneObjectGroup> attachments = GetAttachments(); 3280 List<SceneObjectGroup> attachments = GetAttachments();
@@ -3126,6 +3318,8 @@ namespace OpenSim.Region.Framework.Scenes
3126 CameraAtAxis = cAgent.AtAxis; 3318 CameraAtAxis = cAgent.AtAxis;
3127 CameraLeftAxis = cAgent.LeftAxis; 3319 CameraLeftAxis = cAgent.LeftAxis;
3128 CameraUpAxis = cAgent.UpAxis; 3320 CameraUpAxis = cAgent.UpAxis;
3321 ParentUUID = cAgent.ParentPart;
3322 m_prevSitOffset = cAgent.SitOffset;
3129 3323
3130 // When we get to the point of re-computing neighbors everytime this 3324 // When we get to the point of re-computing neighbors everytime this
3131 // changes, then start using the agent's drawdistance rather than the 3325 // changes, then start using the agent's drawdistance rather than the
@@ -3163,6 +3357,7 @@ namespace OpenSim.Region.Framework.Scenes
3163 foreach (ControllerData c in cAgent.Controllers) 3357 foreach (ControllerData c in cAgent.Controllers)
3164 { 3358 {
3165 ScriptControllers sc = new ScriptControllers(); 3359 ScriptControllers sc = new ScriptControllers();
3360 sc.objectID = c.ObjectID;
3166 sc.itemID = c.ItemID; 3361 sc.itemID = c.ItemID;
3167 sc.ignoreControls = (ScriptControlled)c.IgnoreControls; 3362 sc.ignoreControls = (ScriptControlled)c.IgnoreControls;
3168 sc.eventControls = (ScriptControlled)c.EventControls; 3363 sc.eventControls = (ScriptControlled)c.EventControls;
@@ -3177,6 +3372,8 @@ namespace OpenSim.Region.Framework.Scenes
3177 // FIXME: Why is this null check necessary? Where are the cases where we get a null Anims object? 3372 // FIXME: Why is this null check necessary? Where are the cases where we get a null Anims object?
3178 if (cAgent.Anims != null) 3373 if (cAgent.Anims != null)
3179 Animator.Animations.FromArray(cAgent.Anims); 3374 Animator.Animations.FromArray(cAgent.Anims);
3375 if (cAgent.DefaultAnim != null)
3376 Animator.Animations.SetDefaultAnimation(cAgent.DefaultAnim.AnimID, cAgent.DefaultAnim.SequenceNum, UUID.Zero);
3180 3377
3181 if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0) 3378 if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0)
3182 { 3379 {
@@ -3249,7 +3446,7 @@ namespace OpenSim.Region.Framework.Scenes
3249 //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; 3446 //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
3250 PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; 3447 PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
3251 PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong 3448 PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong
3252 PhysicsActor.SubscribeEvents(500); 3449 PhysicsActor.SubscribeEvents(100);
3253 PhysicsActor.LocalID = LocalId; 3450 PhysicsActor.LocalID = LocalId;
3254 } 3451 }
3255 3452
@@ -3279,18 +3476,6 @@ namespace OpenSim.Region.Framework.Scenes
3279 if (IsChildAgent) 3476 if (IsChildAgent)
3280 return; 3477 return;
3281 3478
3282 //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f))
3283 // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents(
3284 // as of this comment the interval is set in AddToPhysicalScene
3285 if (Animator != null)
3286 {
3287// if (m_updateCount > 0)
3288// {
3289 Animator.UpdateMovementAnimations();
3290// m_updateCount--;
3291// }
3292 }
3293
3294 CollisionEventUpdate collisionData = (CollisionEventUpdate)e; 3479 CollisionEventUpdate collisionData = (CollisionEventUpdate)e;
3295 Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList; 3480 Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList;
3296 3481
@@ -3333,6 +3518,8 @@ namespace OpenSim.Region.Framework.Scenes
3333 } 3518 }
3334 } 3519 }
3335 3520
3521 RaiseCollisionScriptEvents(coldata);
3522
3336 // Gods do not take damage and Invulnerable is set depending on parcel/region flags 3523 // Gods do not take damage and Invulnerable is set depending on parcel/region flags
3337 if (Invulnerable || GodLevel > 0) 3524 if (Invulnerable || GodLevel > 0)
3338 return; 3525 return;
@@ -3665,10 +3852,15 @@ namespace OpenSim.Region.Framework.Scenes
3665 3852
3666 public void RegisterControlEventsToScript(int controls, int accept, int pass_on, uint Obj_localID, UUID Script_item_UUID) 3853 public void RegisterControlEventsToScript(int controls, int accept, int pass_on, uint Obj_localID, UUID Script_item_UUID)
3667 { 3854 {
3855 SceneObjectPart p = m_scene.GetSceneObjectPart(Obj_localID);
3856 if (p == null)
3857 return;
3858
3668 ScriptControllers obj = new ScriptControllers(); 3859 ScriptControllers obj = new ScriptControllers();
3669 obj.ignoreControls = ScriptControlled.CONTROL_ZERO; 3860 obj.ignoreControls = ScriptControlled.CONTROL_ZERO;
3670 obj.eventControls = ScriptControlled.CONTROL_ZERO; 3861 obj.eventControls = ScriptControlled.CONTROL_ZERO;
3671 3862
3863 obj.objectID = p.ParentGroup.UUID;
3672 obj.itemID = Script_item_UUID; 3864 obj.itemID = Script_item_UUID;
3673 if (pass_on == 0 && accept == 0) 3865 if (pass_on == 0 && accept == 0)
3674 { 3866 {
@@ -3717,6 +3909,21 @@ namespace OpenSim.Region.Framework.Scenes
3717 ControllingClient.SendTakeControls(int.MaxValue, false, false); 3909 ControllingClient.SendTakeControls(int.MaxValue, false, false);
3718 } 3910 }
3719 3911
3912 private void UnRegisterSeatControls(UUID obj)
3913 {
3914 List<UUID> takers = new List<UUID>();
3915
3916 foreach (ScriptControllers c in scriptedcontrols.Values)
3917 {
3918 if (c.objectID == obj)
3919 takers.Add(c.itemID);
3920 }
3921 foreach (UUID t in takers)
3922 {
3923 UnRegisterControlEventsToScript(0, t);
3924 }
3925 }
3926
3720 public void UnRegisterControlEventsToScript(uint Obj_localID, UUID Script_item_UUID) 3927 public void UnRegisterControlEventsToScript(uint Obj_localID, UUID Script_item_UUID)
3721 { 3928 {
3722 ScriptControllers takecontrols; 3929 ScriptControllers takecontrols;
@@ -4035,6 +4242,12 @@ namespace OpenSim.Region.Framework.Scenes
4035 4242
4036 private void CheckAndAdjustLandingPoint(ref Vector3 pos) 4243 private void CheckAndAdjustLandingPoint(ref Vector3 pos)
4037 { 4244 {
4245 string reason;
4246
4247 // Honor bans
4248 if (!m_scene.TestLandRestrictions(UUID, out reason, ref pos.X, ref pos.Y))
4249 return;
4250
4038 SceneObjectGroup telehub = null; 4251 SceneObjectGroup telehub = null;
4039 if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero && (telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject)) != null) 4252 if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero && (telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject)) != null)
4040 { 4253 {
@@ -4074,11 +4287,206 @@ namespace OpenSim.Region.Framework.Scenes
4074 pos = land.LandData.UserLocation; 4287 pos = land.LandData.UserLocation;
4075 } 4288 }
4076 } 4289 }
4077 4290
4078 land.SendLandUpdateToClient(ControllingClient); 4291 land.SendLandUpdateToClient(ControllingClient);
4079 } 4292 }
4080 } 4293 }
4081 4294
4295 private DetectedObject CreateDetObject(SceneObjectPart obj)
4296 {
4297 DetectedObject detobj = new DetectedObject();
4298 detobj.keyUUID = obj.UUID;
4299 detobj.nameStr = obj.Name;
4300 detobj.ownerUUID = obj.OwnerID;
4301 detobj.posVector = obj.AbsolutePosition;
4302 detobj.rotQuat = obj.GetWorldRotation();
4303 detobj.velVector = obj.Velocity;
4304 detobj.colliderType = 0;
4305 detobj.groupUUID = obj.GroupID;
4306
4307 return detobj;
4308 }
4309
4310 private DetectedObject CreateDetObject(ScenePresence av)
4311 {
4312 DetectedObject detobj = new DetectedObject();
4313 detobj.keyUUID = av.UUID;
4314 detobj.nameStr = av.ControllingClient.Name;
4315 detobj.ownerUUID = av.UUID;
4316 detobj.posVector = av.AbsolutePosition;
4317 detobj.rotQuat = av.Rotation;
4318 detobj.velVector = av.Velocity;
4319 detobj.colliderType = 0;
4320 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
4321
4322 return detobj;
4323 }
4324
4325 private DetectedObject CreateDetObjectForGround()
4326 {
4327 DetectedObject detobj = new DetectedObject();
4328 detobj.keyUUID = UUID.Zero;
4329 detobj.nameStr = "";
4330 detobj.ownerUUID = UUID.Zero;
4331 detobj.posVector = AbsolutePosition;
4332 detobj.rotQuat = Quaternion.Identity;
4333 detobj.velVector = Vector3.Zero;
4334 detobj.colliderType = 0;
4335 detobj.groupUUID = UUID.Zero;
4336
4337 return detobj;
4338 }
4339
4340 private ColliderArgs CreateColliderArgs(SceneObjectPart dest, List<uint> colliders)
4341 {
4342 ColliderArgs colliderArgs = new ColliderArgs();
4343 List<DetectedObject> colliding = new List<DetectedObject>();
4344 foreach (uint localId in colliders)
4345 {
4346 if (localId == 0)
4347 continue;
4348
4349 SceneObjectPart obj = m_scene.GetSceneObjectPart(localId);
4350 if (obj != null)
4351 {
4352 if (!dest.CollisionFilteredOut(obj.UUID, obj.Name))
4353 colliding.Add(CreateDetObject(obj));
4354 }
4355 else
4356 {
4357 ScenePresence av = m_scene.GetScenePresence(localId);
4358 if (av != null && (!av.IsChildAgent))
4359 {
4360 if (!dest.CollisionFilteredOut(av.UUID, av.Name))
4361 colliding.Add(CreateDetObject(av));
4362 }
4363 }
4364 }
4365
4366 colliderArgs.Colliders = colliding;
4367
4368 return colliderArgs;
4369 }
4370
4371 private delegate void ScriptCollidingNotification(uint localID, ColliderArgs message);
4372
4373 private void SendCollisionEvent(SceneObjectGroup dest, scriptEvents ev, List<uint> colliders, ScriptCollidingNotification notify)
4374 {
4375 ColliderArgs CollidingMessage;
4376
4377 if (colliders.Count > 0)
4378 {
4379 if ((dest.RootPart.ScriptEvents & ev) != 0)
4380 {
4381 CollidingMessage = CreateColliderArgs(dest.RootPart, colliders);
4382
4383 if (CollidingMessage.Colliders.Count > 0)
4384 notify(dest.RootPart.LocalId, CollidingMessage);
4385 }
4386 }
4387 }
4388
4389 private void SendLandCollisionEvent(SceneObjectGroup dest, scriptEvents ev, ScriptCollidingNotification notify)
4390 {
4391 if ((dest.RootPart.ScriptEvents & ev) != 0)
4392 {
4393 ColliderArgs LandCollidingMessage = new ColliderArgs();
4394 List<DetectedObject> colliding = new List<DetectedObject>();
4395
4396 colliding.Add(CreateDetObjectForGround());
4397 LandCollidingMessage.Colliders = colliding;
4398
4399 notify(dest.RootPart.LocalId, LandCollidingMessage);
4400 }
4401 }
4402
4403 private void RaiseCollisionScriptEvents(Dictionary<uint, ContactPoint> coldata)
4404 {
4405 try
4406 {
4407 List<uint> thisHitColliders = new List<uint>();
4408 List<uint> endedColliders = new List<uint>();
4409 List<uint> startedColliders = new List<uint>();
4410 List<CollisionForSoundInfo> soundinfolist = new List<CollisionForSoundInfo>();
4411 CollisionForSoundInfo soundinfo;
4412 ContactPoint curcontact;
4413
4414 if (coldata.Count == 0)
4415 {
4416 if (m_lastColliders.Count == 0)
4417 return; // nothing to do
4418
4419 foreach (uint localID in m_lastColliders)
4420 {
4421 endedColliders.Add(localID);
4422 }
4423 m_lastColliders.Clear();
4424 }
4425
4426 else
4427 {
4428 foreach (uint id in coldata.Keys)
4429 {
4430 thisHitColliders.Add(id);
4431 if (!m_lastColliders.Contains(id))
4432 {
4433 startedColliders.Add(id);
4434 curcontact = coldata[id];
4435 if (Math.Abs(curcontact.RelativeSpeed) > 0.2)
4436 {
4437 soundinfo = new CollisionForSoundInfo();
4438 soundinfo.colliderID = id;
4439 soundinfo.position = curcontact.Position;
4440 soundinfo.relativeVel = curcontact.RelativeSpeed;
4441 soundinfolist.Add(soundinfo);
4442 }
4443 }
4444 //m_log.Debug("[SCENE PRESENCE]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
4445 }
4446
4447 // calculate things that ended colliding
4448 foreach (uint localID in m_lastColliders)
4449 {
4450 if (!thisHitColliders.Contains(localID))
4451 {
4452 endedColliders.Add(localID);
4453 }
4454 }
4455 //add the items that started colliding this time to the last colliders list.
4456 foreach (uint localID in startedColliders)
4457 {
4458 m_lastColliders.Add(localID);
4459 }
4460 // remove things that ended colliding from the last colliders list
4461 foreach (uint localID in endedColliders)
4462 {
4463 m_lastColliders.Remove(localID);
4464 }
4465
4466 if (soundinfolist.Count > 0)
4467 CollisionSounds.AvatarCollisionSound(this, soundinfolist);
4468 }
4469
4470 foreach (SceneObjectGroup att in GetAttachments())
4471 {
4472 SendCollisionEvent(att, scriptEvents.collision_start, startedColliders, m_scene.EventManager.TriggerScriptCollidingStart);
4473 SendCollisionEvent(att, scriptEvents.collision , m_lastColliders , m_scene.EventManager.TriggerScriptColliding);
4474 SendCollisionEvent(att, scriptEvents.collision_end , endedColliders , m_scene.EventManager.TriggerScriptCollidingEnd);
4475
4476 if (startedColliders.Contains(0))
4477 SendLandCollisionEvent(att, scriptEvents.land_collision_start, m_scene.EventManager.TriggerScriptLandCollidingStart);
4478 if (m_lastColliders.Contains(0))
4479 SendLandCollisionEvent(att, scriptEvents.land_collision, m_scene.EventManager.TriggerScriptLandColliding);
4480 if (endedColliders.Contains(0))
4481 SendLandCollisionEvent(att, scriptEvents.land_collision_end, m_scene.EventManager.TriggerScriptLandCollidingEnd);
4482 }
4483 }
4484 finally
4485 {
4486 m_collisionEventFlag = false;
4487 }
4488 }
4489
4082 private void TeleportFlagsDebug() { 4490 private void TeleportFlagsDebug() {
4083 4491
4084 // Some temporary debugging help to show all the TeleportFlags we have... 4492 // Some temporary debugging help to show all the TeleportFlags we have...
@@ -4103,6 +4511,5 @@ namespace OpenSim.Region.Framework.Scenes
4103 m_log.InfoFormat("[SCENE PRESENCE]: TELEPORT ******************"); 4511 m_log.InfoFormat("[SCENE PRESENCE]: TELEPORT ******************");
4104 4512
4105 } 4513 }
4106
4107 } 4514 }
4108} 4515}