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.cs578
1 files changed, 501 insertions, 77 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 548dfd3..5cff3f0 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.
@@ -170,6 +171,7 @@ namespace OpenSim.Region.Framework.Scenes
170// private int m_lastColCount = -1; //KF: Look for Collision chnages 171// private int m_lastColCount = -1; //KF: Look for Collision chnages
171// private int m_updateCount = 0; //KF: Update Anims for a while 172// private int m_updateCount = 0; //KF: Update Anims for a while
172// private static readonly int UPDATE_COUNT = 10; // how many frames to update for 173// private static readonly int UPDATE_COUNT = 10; // how many frames to update for
174 private List<uint> m_lastColliders = new List<uint>();
173 175
174 private TeleportFlags m_teleportFlags; 176 private TeleportFlags m_teleportFlags;
175 public TeleportFlags TeleportFlags 177 public TeleportFlags TeleportFlags
@@ -231,6 +233,13 @@ namespace OpenSim.Region.Framework.Scenes
231 //private int m_moveToPositionStateStatus; 233 //private int m_moveToPositionStateStatus;
232 //***************************************************** 234 //*****************************************************
233 235
236 private bool m_collisionEventFlag = false;
237 private object m_collisionEventLock = new Object();
238
239 private int m_movementAnimationUpdateCounter = 0;
240
241 private Vector3 m_prevSitOffset;
242
234 protected AvatarAppearance m_appearance; 243 protected AvatarAppearance m_appearance;
235 244
236 public AvatarAppearance Appearance 245 public AvatarAppearance Appearance
@@ -425,7 +434,7 @@ namespace OpenSim.Region.Framework.Scenes
425 get { return (IClientCore)ControllingClient; } 434 get { return (IClientCore)ControllingClient; }
426 } 435 }
427 436
428 public Vector3 ParentPosition { get; set; } 437// public Vector3 ParentPosition { get; set; }
429 438
430 /// <summary> 439 /// <summary>
431 /// Position of this avatar relative to the region the avatar is in 440 /// Position of this avatar relative to the region the avatar is in
@@ -483,7 +492,7 @@ namespace OpenSim.Region.Framework.Scenes
483 if (ParentID == 0) 492 if (ParentID == 0)
484 { 493 {
485 m_pos = value; 494 m_pos = value;
486 ParentPosition = Vector3.Zero; 495// ParentPosition = Vector3.Zero;
487 } 496 }
488 497
489 //m_log.DebugFormat( 498 //m_log.DebugFormat(
@@ -572,6 +581,13 @@ namespace OpenSim.Region.Framework.Scenes
572 /// </summary> 581 /// </summary>
573 public uint ParentID { get; set; } 582 public uint ParentID { get; set; }
574 583
584 public UUID ParentUUID
585 {
586 get { return m_parentUUID; }
587 set { m_parentUUID = value; }
588 }
589 private UUID m_parentUUID = UUID.Zero;
590
575 /// <summary> 591 /// <summary>
576 /// Are we sitting on an object? 592 /// Are we sitting on an object?
577 /// </summary> 593 /// </summary>
@@ -738,6 +754,33 @@ namespace OpenSim.Region.Framework.Scenes
738 Appearance = appearance; 754 Appearance = appearance;
739 } 755 }
740 756
757 private void RegionHeartbeatEnd(Scene scene)
758 {
759 if (IsChildAgent)
760 return;
761
762 m_movementAnimationUpdateCounter ++;
763 if (m_movementAnimationUpdateCounter >= 2)
764 {
765 m_movementAnimationUpdateCounter = 0;
766 if (Animator != null)
767 {
768 // If the parentID == 0 we are not sitting
769 // if !SitGournd then we are not sitting on the ground
770 // Fairly straightforward, now here comes the twist
771 // if ParentUUID is NOT UUID.Zero, we are looking to
772 // be sat on an object that isn't there yet. Should
773 // be treated as if sat.
774 if(ParentID == 0 && !SitGround && ParentUUID == UUID.Zero) // skip it if sitting
775 Animator.UpdateMovementAnimations();
776 }
777 else
778 {
779 m_scene.EventManager.OnRegionHeartbeatEnd -= RegionHeartbeatEnd;
780 }
781 }
782 }
783
741 public void RegisterToEvents() 784 public void RegisterToEvents()
742 { 785 {
743 ControllingClient.OnCompleteMovementToRegion += CompleteMovement; 786 ControllingClient.OnCompleteMovementToRegion += CompleteMovement;
@@ -747,6 +790,7 @@ namespace OpenSim.Region.Framework.Scenes
747 ControllingClient.OnSetAlwaysRun += HandleSetAlwaysRun; 790 ControllingClient.OnSetAlwaysRun += HandleSetAlwaysRun;
748 ControllingClient.OnStartAnim += HandleStartAnim; 791 ControllingClient.OnStartAnim += HandleStartAnim;
749 ControllingClient.OnStopAnim += HandleStopAnim; 792 ControllingClient.OnStopAnim += HandleStopAnim;
793 ControllingClient.OnChangeAnim += avnHandleChangeAnim;
750 ControllingClient.OnForceReleaseControls += HandleForceReleaseControls; 794 ControllingClient.OnForceReleaseControls += HandleForceReleaseControls;
751 ControllingClient.OnAutoPilotGo += MoveToTarget; 795 ControllingClient.OnAutoPilotGo += MoveToTarget;
752 796
@@ -807,10 +851,39 @@ namespace OpenSim.Region.Framework.Scenes
807 "[SCENE]: Upgrading child to root agent for {0} in {1}", 851 "[SCENE]: Upgrading child to root agent for {0} in {1}",
808 Name, m_scene.RegionInfo.RegionName); 852 Name, m_scene.RegionInfo.RegionName);
809 853
810 //m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count);
811
812 bool wasChild = IsChildAgent; 854 bool wasChild = IsChildAgent;
813 IsChildAgent = false; 855
856 if (ParentUUID != UUID.Zero)
857 {
858 m_log.DebugFormat("[SCENE PRESENCE]: Sitting avatar back on prim {0}", ParentUUID);
859 SceneObjectPart part = m_scene.GetSceneObjectPart(ParentUUID);
860 if (part == null)
861 {
862 m_log.ErrorFormat("[SCENE PRESENCE]: Can't find prim {0} to sit on", ParentUUID);
863 }
864 else
865 {
866 part.ParentGroup.AddAvatar(UUID);
867 if (part.SitTargetPosition != Vector3.Zero)
868 part.SitTargetAvatar = UUID;
869// ParentPosition = part.GetWorldPosition();
870 ParentID = part.LocalId;
871 ParentPart = part;
872 m_pos = m_prevSitOffset;
873// pos = ParentPosition;
874 pos = part.GetWorldPosition();
875 }
876 ParentUUID = UUID.Zero;
877
878 IsChildAgent = false;
879
880// Animator.TrySetMovementAnimation("SIT");
881 }
882 else
883 {
884 IsChildAgent = false;
885 }
886
814 887
815 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); 888 IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
816 if (gm != null) 889 if (gm != null)
@@ -820,62 +893,72 @@ namespace OpenSim.Region.Framework.Scenes
820 893
821 m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); 894 m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene);
822 895
823 // Moved this from SendInitialData to ensure that Appearance is initialized 896 if (ParentID == 0)
824 // before the inventory is processed in MakeRootAgent. This fixes a race condition
825 // related to the handling of attachments
826 //m_scene.GetAvatarAppearance(ControllingClient, out Appearance);
827 if (m_scene.TestBorderCross(pos, Cardinals.E))
828 { 897 {
829 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E); 898 // Moved this from SendInitialData to ensure that Appearance is initialized
830 pos.X = crossedBorder.BorderLine.Z - 1; 899 // before the inventory is processed in MakeRootAgent. This fixes a race condition
831 } 900 // related to the handling of attachments
901 //m_scene.GetAvatarAppearance(ControllingClient, out Appearance);
902 if (m_scene.TestBorderCross(pos, Cardinals.E))
903 {
904 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E);
905 pos.X = crossedBorder.BorderLine.Z - 1;
906 }
832 907
833 if (m_scene.TestBorderCross(pos, Cardinals.N)) 908 if (m_scene.TestBorderCross(pos, Cardinals.N))
834 { 909 {
835 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.N); 910 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.N);
836 pos.Y = crossedBorder.BorderLine.Z - 1; 911 pos.Y = crossedBorder.BorderLine.Z - 1;
837 } 912 }
838 913
839 CheckAndAdjustLandingPoint(ref pos); 914 CheckAndAdjustLandingPoint(ref pos);
840 915
841 if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f) 916 if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f)
842 { 917 {
843 m_log.WarnFormat( 918 m_log.WarnFormat(
844 "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Clamping", 919 "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Clamping",
845 pos, Name, UUID); 920 pos, Name, UUID);
846 921
847 if (pos.X < 0f) pos.X = 0f; 922 if (pos.X < 0f) pos.X = 0f;
848 if (pos.Y < 0f) pos.Y = 0f; 923 if (pos.Y < 0f) pos.Y = 0f;
849 if (pos.Z < 0f) pos.Z = 0f; 924 if (pos.Z < 0f) pos.Z = 0f;
850 } 925 }
851 926
852 float localAVHeight = 1.56f; 927 float localAVHeight = 1.56f;
853 if (Appearance.AvatarHeight > 0) 928 if (Appearance.AvatarHeight > 0)
854 localAVHeight = Appearance.AvatarHeight; 929 localAVHeight = Appearance.AvatarHeight;
855 930
856 float posZLimit = 0; 931 float posZLimit = 0;
857 932
858 if (pos.X < Constants.RegionSize && pos.Y < Constants.RegionSize) 933 if (pos.X < Constants.RegionSize && pos.Y < Constants.RegionSize)
859 posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; 934 posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y];
860 935
861 float newPosZ = posZLimit + localAVHeight / 2; 936 float newPosZ = posZLimit + localAVHeight / 2;
862 if (posZLimit >= (pos.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) 937 if (posZLimit >= (pos.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ)))
863 { 938 {
864 pos.Z = newPosZ; 939 pos.Z = newPosZ;
865 } 940 }
866 AbsolutePosition = pos; 941 AbsolutePosition = pos;
867 942
868 AddToPhysicalScene(isFlying); 943 if (m_teleportFlags == TeleportFlags.Default)
944 {
945 Vector3 vel = Velocity;
946 AddToPhysicalScene(isFlying);
947 if (PhysicsActor != null)
948 PhysicsActor.SetMomentum(vel);
949 }
950 else
951 AddToPhysicalScene(isFlying);
869 952
870 if (ForceFly) 953 if (ForceFly)
871 { 954 {
872 Flying = true; 955 Flying = true;
873 } 956 }
874 else if (FlyDisabled) 957 else if (FlyDisabled)
875 { 958 {
876 Flying = false; 959 Flying = false;
960 }
877 } 961 }
878
879 // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying 962 // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying
880 // avatar to return to the standing position in mid-air. On login it looks like this is being sent 963 // avatar to return to the standing position in mid-air. On login it looks like this is being sent
881 // elsewhere anyway 964 // elsewhere anyway
@@ -893,14 +976,19 @@ namespace OpenSim.Region.Framework.Scenes
893 { 976 {
894 m_log.DebugFormat("[SCENE PRESENCE]: Restarting scripts in attachments..."); 977 m_log.DebugFormat("[SCENE PRESENCE]: Restarting scripts in attachments...");
895 // Resume scripts 978 // Resume scripts
896 foreach (SceneObjectGroup sog in m_attachments) 979 Util.FireAndForget(delegate(object x) {
897 { 980 foreach (SceneObjectGroup sog in m_attachments)
898 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); 981 {
899 sog.ResumeScripts(); 982 sog.ScheduleGroupForFullUpdate();
900 } 983 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource());
984 sog.ResumeScripts();
985 }
986 });
901 } 987 }
902 } 988 }
903 989
990 SendAvatarDataToAllAgents();
991
904 // send the animations of the other presences to me 992 // send the animations of the other presences to me
905 m_scene.ForEachRootScenePresence(delegate(ScenePresence presence) 993 m_scene.ForEachRootScenePresence(delegate(ScenePresence presence)
906 { 994 {
@@ -911,9 +999,12 @@ namespace OpenSim.Region.Framework.Scenes
911 // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will 999 // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will
912 // stall on the border crossing since the existing child agent will still have the last movement 1000 // stall on the border crossing since the existing child agent will still have the last movement
913 // recorded, which stops the input from being processed. 1001 // recorded, which stops the input from being processed.
1002
914 MovementFlag = 0; 1003 MovementFlag = 0;
915 1004
916 m_scene.EventManager.TriggerOnMakeRootAgent(this); 1005 m_scene.EventManager.TriggerOnMakeRootAgent(this);
1006
1007 m_scene.EventManager.OnRegionHeartbeatEnd += RegionHeartbeatEnd;
917 } 1008 }
918 1009
919 public int GetStateSource() 1010 public int GetStateSource()
@@ -941,12 +1032,16 @@ namespace OpenSim.Region.Framework.Scenes
941 /// </remarks> 1032 /// </remarks>
942 public void MakeChildAgent() 1033 public void MakeChildAgent()
943 { 1034 {
1035 m_scene.EventManager.OnRegionHeartbeatEnd -= RegionHeartbeatEnd;
1036
944 m_log.DebugFormat("[SCENE PRESENCE]: Making {0} a child agent in {1}", Name, Scene.RegionInfo.RegionName); 1037 m_log.DebugFormat("[SCENE PRESENCE]: Making {0} a child agent in {1}", Name, Scene.RegionInfo.RegionName);
945 1038
946 // Reset these so that teleporting in and walking out isn't seen 1039 // Reset these so that teleporting in and walking out isn't seen
947 // as teleporting back 1040 // as teleporting back
948 TeleportFlags = TeleportFlags.Default; 1041 TeleportFlags = TeleportFlags.Default;
949 1042
1043 MovementFlag = 0;
1044
950 // It looks like Animator is set to null somewhere, and MakeChild 1045 // It looks like Animator is set to null somewhere, and MakeChild
951 // is called after that. Probably in aborted teleports. 1046 // is called after that. Probably in aborted teleports.
952 if (Animator == null) 1047 if (Animator == null)
@@ -954,6 +1049,7 @@ namespace OpenSim.Region.Framework.Scenes
954 else 1049 else
955 Animator.ResetAnimations(); 1050 Animator.ResetAnimations();
956 1051
1052
957// m_log.DebugFormat( 1053// m_log.DebugFormat(
958// "[SCENE PRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}", 1054// "[SCENE PRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}",
959// Name, UUID, m_scene.RegionInfo.RegionName); 1055// Name, UUID, m_scene.RegionInfo.RegionName);
@@ -965,6 +1061,7 @@ namespace OpenSim.Region.Framework.Scenes
965 IsChildAgent = true; 1061 IsChildAgent = true;
966 m_scene.SwapRootAgentCount(true); 1062 m_scene.SwapRootAgentCount(true);
967 RemoveFromPhysicalScene(); 1063 RemoveFromPhysicalScene();
1064 ParentID = 0; // Child agents can't be sitting
968 1065
969 // FIXME: Set RegionHandle to the region handle of the scene this agent is moving into 1066 // FIXME: Set RegionHandle to the region handle of the scene this agent is moving into
970 1067
@@ -980,9 +1077,9 @@ namespace OpenSim.Region.Framework.Scenes
980 { 1077 {
981// PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; 1078// PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients;
982 PhysicsActor.OnOutOfBounds -= OutOfBoundsCall; 1079 PhysicsActor.OnOutOfBounds -= OutOfBoundsCall;
983 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor);
984 PhysicsActor.UnSubscribeEvents();
985 PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; 1080 PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
1081 PhysicsActor.UnSubscribeEvents();
1082 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor);
986 PhysicsActor = null; 1083 PhysicsActor = null;
987 } 1084 }
988// else 1085// else
@@ -999,7 +1096,7 @@ namespace OpenSim.Region.Framework.Scenes
999 /// <param name="pos"></param> 1096 /// <param name="pos"></param>
1000 public void Teleport(Vector3 pos) 1097 public void Teleport(Vector3 pos)
1001 { 1098 {
1002 TeleportWithMomentum(pos, null); 1099 TeleportWithMomentum(pos, Vector3.Zero);
1003 } 1100 }
1004 1101
1005 public void TeleportWithMomentum(Vector3 pos, Vector3? v) 1102 public void TeleportWithMomentum(Vector3 pos, Vector3? v)
@@ -1023,6 +1120,41 @@ namespace OpenSim.Region.Framework.Scenes
1023 SendTerseUpdateToAllClients(); 1120 SendTerseUpdateToAllClients();
1024 } 1121 }
1025 1122
1123 public void avnLocalTeleport(Vector3 newpos, Vector3? newvel, bool rotateToVelXY)
1124 {
1125 CheckLandingPoint(ref newpos);
1126 AbsolutePosition = newpos;
1127
1128 if (newvel.HasValue)
1129 {
1130 if ((Vector3)newvel == Vector3.Zero)
1131 {
1132 if (PhysicsActor != null)
1133 PhysicsActor.SetMomentum(Vector3.Zero);
1134 m_velocity = Vector3.Zero;
1135 }
1136 else
1137 {
1138 if (PhysicsActor != null)
1139 PhysicsActor.SetMomentum((Vector3)newvel);
1140 m_velocity = (Vector3)newvel;
1141
1142 if (rotateToVelXY)
1143 {
1144 Vector3 lookAt = (Vector3)newvel;
1145 lookAt.Z = 0;
1146 lookAt.Normalize();
1147 ControllingClient.SendLocalTeleport(newpos, lookAt, (uint)TeleportFlags.ViaLocation);
1148 return;
1149 }
1150 }
1151 }
1152
1153 SendTerseUpdateToAllClients();
1154 }
1155
1156
1157
1026 public void StopFlying() 1158 public void StopFlying()
1027 { 1159 {
1028 ControllingClient.StopFlying(this); 1160 ControllingClient.StopFlying(this);
@@ -1338,8 +1470,18 @@ namespace OpenSim.Region.Framework.Scenes
1338 { 1470 {
1339 if (m_followCamAuto) 1471 if (m_followCamAuto)
1340 { 1472 {
1341 Vector3 posAdjusted = m_pos + HEAD_ADJUSTMENT; 1473 // Vector3 posAdjusted = m_pos + HEAD_ADJUSTMENT;
1342 m_scene.PhysicsScene.RaycastWorld(m_pos, Vector3.Normalize(CameraPosition - posAdjusted), Vector3.Distance(CameraPosition, posAdjusted) + 0.3f, RayCastCameraCallback); 1474 // m_scene.PhysicsScene.RaycastWorld(m_pos, Vector3.Normalize(CameraPosition - posAdjusted), Vector3.Distance(CameraPosition, posAdjusted) + 0.3f, RayCastCameraCallback);
1475
1476 Vector3 posAdjusted = AbsolutePosition + HEAD_ADJUSTMENT;
1477 Vector3 distTocam = CameraPosition - posAdjusted;
1478 float distTocamlen = distTocam.Length();
1479 if (distTocamlen > 0)
1480 {
1481 distTocam *= 1.0f / distTocamlen;
1482 m_scene.PhysicsScene.RaycastWorld(posAdjusted, distTocam, distTocamlen + 0.3f, RayCastCameraCallback);
1483 }
1484
1343 } 1485 }
1344 } 1486 }
1345 1487
@@ -1773,12 +1915,17 @@ namespace OpenSim.Region.Framework.Scenes
1773// m_log.DebugFormat("[SCENE PRESENCE]: StandUp() for {0}", Name); 1915// m_log.DebugFormat("[SCENE PRESENCE]: StandUp() for {0}", Name);
1774 1916
1775 SitGround = false; 1917 SitGround = false;
1918
1919/* move this down so avatar gets physical in the new position and not where it is siting
1776 if (PhysicsActor == null) 1920 if (PhysicsActor == null)
1777 AddToPhysicalScene(false); 1921 AddToPhysicalScene(false);
1922 */
1778 1923
1779 if (ParentID != 0) 1924 if (ParentID != 0)
1780 { 1925 {
1781 SceneObjectPart part = ParentPart; 1926 SceneObjectPart part = ParentPart;
1927 UnRegisterSeatControls(part.ParentGroup.UUID);
1928
1782 TaskInventoryDictionary taskIDict = part.TaskInventory; 1929 TaskInventoryDictionary taskIDict = part.TaskInventory;
1783 if (taskIDict != null) 1930 if (taskIDict != null)
1784 { 1931 {
@@ -1794,14 +1941,20 @@ namespace OpenSim.Region.Framework.Scenes
1794 } 1941 }
1795 } 1942 }
1796 1943
1797 ParentPosition = part.GetWorldPosition(); 1944 part.ParentGroup.DeleteAvatar(UUID);
1945// ParentPosition = part.GetWorldPosition();
1798 ControllingClient.SendClearFollowCamProperties(part.ParentUUID); 1946 ControllingClient.SendClearFollowCamProperties(part.ParentUUID);
1799 1947
1800 m_pos += ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight); 1948// m_pos += ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight);
1801 ParentPosition = Vector3.Zero; 1949// ParentPosition = Vector3.Zero;
1950 m_pos += part.GetWorldPosition() + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight);
1802 1951
1803 ParentID = 0; 1952 ParentID = 0;
1804 ParentPart = null; 1953 ParentPart = null;
1954
1955 if (PhysicsActor == null)
1956 AddToPhysicalScene(false);
1957
1805 SendAvatarDataToAllAgents(); 1958 SendAvatarDataToAllAgents();
1806 m_requestedSitTargetID = 0; 1959 m_requestedSitTargetID = 0;
1807 1960
@@ -1811,6 +1964,9 @@ namespace OpenSim.Region.Framework.Scenes
1811 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); 1964 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
1812 } 1965 }
1813 1966
1967 else if (PhysicsActor == null)
1968 AddToPhysicalScene(false);
1969
1814 Animator.TrySetMovementAnimation("STAND"); 1970 Animator.TrySetMovementAnimation("STAND");
1815 } 1971 }
1816 1972
@@ -1862,7 +2018,7 @@ namespace OpenSim.Region.Framework.Scenes
1862 // see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it 2018 // see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it
1863 2019
1864 if (PhysicsActor != null) 2020 if (PhysicsActor != null)
1865 m_sitAvatarHeight = PhysicsActor.Size.Z; 2021 m_sitAvatarHeight = PhysicsActor.Size.Z * 0.5f;
1866 2022
1867 bool canSit = false; 2023 bool canSit = false;
1868 Vector3 pos = part.AbsolutePosition + offset; 2024 Vector3 pos = part.AbsolutePosition + offset;
@@ -1911,7 +2067,7 @@ namespace OpenSim.Region.Framework.Scenes
1911 forceMouselook = part.GetForceMouselook(); 2067 forceMouselook = part.GetForceMouselook();
1912 2068
1913 ControllingClient.SendSitResponse( 2069 ControllingClient.SendSitResponse(
1914 targetID, offset, sitOrientation, false, cameraAtOffset, cameraEyeOffset, forceMouselook); 2070 part.UUID, offset, sitOrientation, false, cameraAtOffset, cameraEyeOffset, forceMouselook);
1915 2071
1916 m_requestedSitTargetUUID = targetID; 2072 m_requestedSitTargetUUID = targetID;
1917 2073
@@ -1925,6 +2081,9 @@ namespace OpenSim.Region.Framework.Scenes
1925 2081
1926 public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset) 2082 public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset)
1927 { 2083 {
2084 if (IsChildAgent)
2085 return;
2086
1928 if (ParentID != 0) 2087 if (ParentID != 0)
1929 { 2088 {
1930 StandUp(); 2089 StandUp();
@@ -2202,14 +2361,39 @@ namespace OpenSim.Region.Framework.Scenes
2202 2361
2203 //Quaternion result = (sitTargetOrient * vq) * nq; 2362 //Quaternion result = (sitTargetOrient * vq) * nq;
2204 2363
2205 m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT; 2364 double x, y, z, m;
2365
2366 Quaternion r = sitTargetOrient;
2367 m = r.X * r.X + r.Y * r.Y + r.Z * r.Z + r.W * r.W;
2368
2369 if (Math.Abs(1.0 - m) > 0.000001)
2370 {
2371 m = 1.0 / Math.Sqrt(m);
2372 r.X *= (float)m;
2373 r.Y *= (float)m;
2374 r.Z *= (float)m;
2375 r.W *= (float)m;
2376 }
2377
2378 x = 2 * (r.X * r.Z + r.Y * r.W);
2379 y = 2 * (-r.X * r.W + r.Y * r.Z);
2380 z = -r.X * r.X - r.Y * r.Y + r.Z * r.Z + r.W * r.W;
2381
2382 Vector3 up = new Vector3((float)x, (float)y, (float)z);
2383 Vector3 sitOffset = up * Appearance.AvatarHeight * 0.02638f;
2384
2385 m_pos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT;
2386
2387// m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT - sitOffset;
2206 Rotation = sitTargetOrient; 2388 Rotation = sitTargetOrient;
2207 ParentPosition = part.AbsolutePosition; 2389// ParentPosition = part.AbsolutePosition;
2390 part.ParentGroup.AddAvatar(UUID);
2208 } 2391 }
2209 else 2392 else
2210 { 2393 {
2211 m_pos -= part.AbsolutePosition; 2394 m_pos -= part.AbsolutePosition;
2212 ParentPosition = part.AbsolutePosition; 2395// ParentPosition = part.AbsolutePosition;
2396 part.ParentGroup.AddAvatar(UUID);
2213 2397
2214// m_log.DebugFormat( 2398// m_log.DebugFormat(
2215// "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target", 2399// "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target",
@@ -2254,6 +2438,13 @@ namespace OpenSim.Region.Framework.Scenes
2254 Animator.RemoveAnimation(animID); 2438 Animator.RemoveAnimation(animID);
2255 } 2439 }
2256 2440
2441 public void avnHandleChangeAnim(UUID animID, bool addRemove,bool sendPack)
2442 {
2443 Animator.avnChangeAnim(animID, addRemove, sendPack);
2444 }
2445
2446
2447
2257 /// <summary> 2448 /// <summary>
2258 /// Rotate the avatar to the given rotation and apply a movement in the given relative vector 2449 /// Rotate the avatar to the given rotation and apply a movement in the given relative vector
2259 /// </summary> 2450 /// </summary>
@@ -2307,14 +2498,15 @@ namespace OpenSim.Region.Framework.Scenes
2307 direc.Z *= 2.6f; 2498 direc.Z *= 2.6f;
2308 2499
2309 // TODO: PreJump and jump happen too quickly. Many times prejump gets ignored. 2500 // TODO: PreJump and jump happen too quickly. Many times prejump gets ignored.
2310 Animator.TrySetMovementAnimation("PREJUMP"); 2501// Animator.TrySetMovementAnimation("PREJUMP");
2311 Animator.TrySetMovementAnimation("JUMP"); 2502// Animator.TrySetMovementAnimation("JUMP");
2312 } 2503 }
2313 } 2504 }
2314 } 2505 }
2315 2506
2316 // TODO: Add the force instead of only setting it to support multiple forces per frame? 2507 // TODO: Add the force instead of only setting it to support multiple forces per frame?
2317 m_forceToApply = direc; 2508 m_forceToApply = direc;
2509 Animator.UpdateMovementAnimations();
2318 } 2510 }
2319 2511
2320 #endregion 2512 #endregion
@@ -2706,8 +2898,9 @@ namespace OpenSim.Region.Framework.Scenes
2706 2898
2707 // If we don't have a PhysActor, we can't cross anyway 2899 // If we don't have a PhysActor, we can't cross anyway
2708 // Also don't do this while sat, sitting avatars cross with the 2900 // Also don't do this while sat, sitting avatars cross with the
2709 // object they sit on. 2901 // object they sit on. ParentUUID denoted a pending sit, don't
2710 if (ParentID != 0 || PhysicsActor == null) 2902 // interfere with it.
2903 if (ParentID != 0 || PhysicsActor == null || ParentUUID != UUID.Zero)
2711 return; 2904 return;
2712 2905
2713 if (!IsInTransit) 2906 if (!IsInTransit)
@@ -3048,6 +3241,9 @@ namespace OpenSim.Region.Framework.Scenes
3048 cAgent.AlwaysRun = SetAlwaysRun; 3241 cAgent.AlwaysRun = SetAlwaysRun;
3049 3242
3050 cAgent.Appearance = new AvatarAppearance(Appearance); 3243 cAgent.Appearance = new AvatarAppearance(Appearance);
3244
3245 cAgent.ParentPart = ParentUUID;
3246 cAgent.SitOffset = m_pos;
3051 3247
3052 lock (scriptedcontrols) 3248 lock (scriptedcontrols)
3053 { 3249 {
@@ -3056,7 +3252,7 @@ namespace OpenSim.Region.Framework.Scenes
3056 3252
3057 foreach (ScriptControllers c in scriptedcontrols.Values) 3253 foreach (ScriptControllers c in scriptedcontrols.Values)
3058 { 3254 {
3059 controls[i++] = new ControllerData(c.itemID, (uint)c.ignoreControls, (uint)c.eventControls); 3255 controls[i++] = new ControllerData(c.objectID, c.itemID, (uint)c.ignoreControls, (uint)c.eventControls);
3060 } 3256 }
3061 cAgent.Controllers = controls; 3257 cAgent.Controllers = controls;
3062 } 3258 }
@@ -3067,6 +3263,7 @@ namespace OpenSim.Region.Framework.Scenes
3067 cAgent.Anims = Animator.Animations.ToArray(); 3263 cAgent.Anims = Animator.Animations.ToArray();
3068 } 3264 }
3069 catch { } 3265 catch { }
3266 cAgent.DefaultAnim = Animator.Animations.DefaultAnimation;
3070 3267
3071 if (Scene.AttachmentsModule != null) 3268 if (Scene.AttachmentsModule != null)
3072 Scene.AttachmentsModule.CopyAttachments(this, cAgent); 3269 Scene.AttachmentsModule.CopyAttachments(this, cAgent);
@@ -3087,6 +3284,8 @@ namespace OpenSim.Region.Framework.Scenes
3087 CameraAtAxis = cAgent.AtAxis; 3284 CameraAtAxis = cAgent.AtAxis;
3088 CameraLeftAxis = cAgent.LeftAxis; 3285 CameraLeftAxis = cAgent.LeftAxis;
3089 CameraUpAxis = cAgent.UpAxis; 3286 CameraUpAxis = cAgent.UpAxis;
3287 ParentUUID = cAgent.ParentPart;
3288 m_prevSitOffset = cAgent.SitOffset;
3090 3289
3091 // When we get to the point of re-computing neighbors everytime this 3290 // When we get to the point of re-computing neighbors everytime this
3092 // changes, then start using the agent's drawdistance rather than the 3291 // changes, then start using the agent's drawdistance rather than the
@@ -3124,6 +3323,7 @@ namespace OpenSim.Region.Framework.Scenes
3124 foreach (ControllerData c in cAgent.Controllers) 3323 foreach (ControllerData c in cAgent.Controllers)
3125 { 3324 {
3126 ScriptControllers sc = new ScriptControllers(); 3325 ScriptControllers sc = new ScriptControllers();
3326 sc.objectID = c.ObjectID;
3127 sc.itemID = c.ItemID; 3327 sc.itemID = c.ItemID;
3128 sc.ignoreControls = (ScriptControlled)c.IgnoreControls; 3328 sc.ignoreControls = (ScriptControlled)c.IgnoreControls;
3129 sc.eventControls = (ScriptControlled)c.EventControls; 3329 sc.eventControls = (ScriptControlled)c.EventControls;
@@ -3138,6 +3338,8 @@ namespace OpenSim.Region.Framework.Scenes
3138 // FIXME: Why is this null check necessary? Where are the cases where we get a null Anims object? 3338 // FIXME: Why is this null check necessary? Where are the cases where we get a null Anims object?
3139 if (cAgent.Anims != null) 3339 if (cAgent.Anims != null)
3140 Animator.Animations.FromArray(cAgent.Anims); 3340 Animator.Animations.FromArray(cAgent.Anims);
3341 if (cAgent.DefaultAnim != null)
3342 Animator.Animations.SetDefaultAnimation(cAgent.DefaultAnim.AnimID, cAgent.DefaultAnim.SequenceNum, UUID.Zero);
3141 3343
3142 if (Scene.AttachmentsModule != null) 3344 if (Scene.AttachmentsModule != null)
3143 Scene.AttachmentsModule.CopyAttachments(cAgent, this); 3345 Scene.AttachmentsModule.CopyAttachments(cAgent, this);
@@ -3200,7 +3402,7 @@ namespace OpenSim.Region.Framework.Scenes
3200 //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; 3402 //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
3201 PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; 3403 PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
3202 PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong 3404 PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong
3203 PhysicsActor.SubscribeEvents(500); 3405 PhysicsActor.SubscribeEvents(100);
3204 PhysicsActor.LocalID = LocalId; 3406 PhysicsActor.LocalID = LocalId;
3205 } 3407 }
3206 3408
@@ -3282,6 +3484,8 @@ namespace OpenSim.Region.Framework.Scenes
3282 } 3484 }
3283 } 3485 }
3284 3486
3487 RaiseCollisionScriptEvents(coldata);
3488
3285 // Gods do not take damage and Invulnerable is set depending on parcel/region flags 3489 // Gods do not take damage and Invulnerable is set depending on parcel/region flags
3286 if (Invulnerable || GodLevel > 0) 3490 if (Invulnerable || GodLevel > 0)
3287 return; 3491 return;
@@ -3609,10 +3813,15 @@ namespace OpenSim.Region.Framework.Scenes
3609 3813
3610 public void RegisterControlEventsToScript(int controls, int accept, int pass_on, uint Obj_localID, UUID Script_item_UUID) 3814 public void RegisterControlEventsToScript(int controls, int accept, int pass_on, uint Obj_localID, UUID Script_item_UUID)
3611 { 3815 {
3816 SceneObjectPart p = m_scene.GetSceneObjectPart(Obj_localID);
3817 if (p == null)
3818 return;
3819
3612 ScriptControllers obj = new ScriptControllers(); 3820 ScriptControllers obj = new ScriptControllers();
3613 obj.ignoreControls = ScriptControlled.CONTROL_ZERO; 3821 obj.ignoreControls = ScriptControlled.CONTROL_ZERO;
3614 obj.eventControls = ScriptControlled.CONTROL_ZERO; 3822 obj.eventControls = ScriptControlled.CONTROL_ZERO;
3615 3823
3824 obj.objectID = p.ParentGroup.UUID;
3616 obj.itemID = Script_item_UUID; 3825 obj.itemID = Script_item_UUID;
3617 if (pass_on == 0 && accept == 0) 3826 if (pass_on == 0 && accept == 0)
3618 { 3827 {
@@ -3661,6 +3870,21 @@ namespace OpenSim.Region.Framework.Scenes
3661 ControllingClient.SendTakeControls(int.MaxValue, false, false); 3870 ControllingClient.SendTakeControls(int.MaxValue, false, false);
3662 } 3871 }
3663 3872
3873 private void UnRegisterSeatControls(UUID obj)
3874 {
3875 List<UUID> takers = new List<UUID>();
3876
3877 foreach (ScriptControllers c in scriptedcontrols.Values)
3878 {
3879 if (c.objectID == obj)
3880 takers.Add(c.itemID);
3881 }
3882 foreach (UUID t in takers)
3883 {
3884 UnRegisterControlEventsToScript(0, t);
3885 }
3886 }
3887
3664 public void UnRegisterControlEventsToScript(uint Obj_localID, UUID Script_item_UUID) 3888 public void UnRegisterControlEventsToScript(uint Obj_localID, UUID Script_item_UUID)
3665 { 3889 {
3666 ScriptControllers takecontrols; 3890 ScriptControllers takecontrols;
@@ -3979,6 +4203,12 @@ namespace OpenSim.Region.Framework.Scenes
3979 4203
3980 private void CheckAndAdjustLandingPoint(ref Vector3 pos) 4204 private void CheckAndAdjustLandingPoint(ref Vector3 pos)
3981 { 4205 {
4206 string reason;
4207
4208 // Honor bans
4209 if (!m_scene.TestLandRestrictions(UUID, out reason, ref pos.X, ref pos.Y))
4210 return;
4211
3982 SceneObjectGroup telehub = null; 4212 SceneObjectGroup telehub = null;
3983 if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero && (telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject)) != null) 4213 if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero && (telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject)) != null)
3984 { 4214 {
@@ -4018,11 +4248,206 @@ namespace OpenSim.Region.Framework.Scenes
4018 pos = land.LandData.UserLocation; 4248 pos = land.LandData.UserLocation;
4019 } 4249 }
4020 } 4250 }
4021 4251
4022 land.SendLandUpdateToClient(ControllingClient); 4252 land.SendLandUpdateToClient(ControllingClient);
4023 } 4253 }
4024 } 4254 }
4025 4255
4256 private DetectedObject CreateDetObject(SceneObjectPart obj)
4257 {
4258 DetectedObject detobj = new DetectedObject();
4259 detobj.keyUUID = obj.UUID;
4260 detobj.nameStr = obj.Name;
4261 detobj.ownerUUID = obj.OwnerID;
4262 detobj.posVector = obj.AbsolutePosition;
4263 detobj.rotQuat = obj.GetWorldRotation();
4264 detobj.velVector = obj.Velocity;
4265 detobj.colliderType = 0;
4266 detobj.groupUUID = obj.GroupID;
4267
4268 return detobj;
4269 }
4270
4271 private DetectedObject CreateDetObject(ScenePresence av)
4272 {
4273 DetectedObject detobj = new DetectedObject();
4274 detobj.keyUUID = av.UUID;
4275 detobj.nameStr = av.ControllingClient.Name;
4276 detobj.ownerUUID = av.UUID;
4277 detobj.posVector = av.AbsolutePosition;
4278 detobj.rotQuat = av.Rotation;
4279 detobj.velVector = av.Velocity;
4280 detobj.colliderType = 0;
4281 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
4282
4283 return detobj;
4284 }
4285
4286 private DetectedObject CreateDetObjectForGround()
4287 {
4288 DetectedObject detobj = new DetectedObject();
4289 detobj.keyUUID = UUID.Zero;
4290 detobj.nameStr = "";
4291 detobj.ownerUUID = UUID.Zero;
4292 detobj.posVector = AbsolutePosition;
4293 detobj.rotQuat = Quaternion.Identity;
4294 detobj.velVector = Vector3.Zero;
4295 detobj.colliderType = 0;
4296 detobj.groupUUID = UUID.Zero;
4297
4298 return detobj;
4299 }
4300
4301 private ColliderArgs CreateColliderArgs(SceneObjectPart dest, List<uint> colliders)
4302 {
4303 ColliderArgs colliderArgs = new ColliderArgs();
4304 List<DetectedObject> colliding = new List<DetectedObject>();
4305 foreach (uint localId in colliders)
4306 {
4307 if (localId == 0)
4308 continue;
4309
4310 SceneObjectPart obj = m_scene.GetSceneObjectPart(localId);
4311 if (obj != null)
4312 {
4313 if (!dest.CollisionFilteredOut(obj.UUID, obj.Name))
4314 colliding.Add(CreateDetObject(obj));
4315 }
4316 else
4317 {
4318 ScenePresence av = m_scene.GetScenePresence(localId);
4319 if (av != null && (!av.IsChildAgent))
4320 {
4321 if (!dest.CollisionFilteredOut(av.UUID, av.Name))
4322 colliding.Add(CreateDetObject(av));
4323 }
4324 }
4325 }
4326
4327 colliderArgs.Colliders = colliding;
4328
4329 return colliderArgs;
4330 }
4331
4332 private delegate void ScriptCollidingNotification(uint localID, ColliderArgs message);
4333
4334 private void SendCollisionEvent(SceneObjectGroup dest, scriptEvents ev, List<uint> colliders, ScriptCollidingNotification notify)
4335 {
4336 ColliderArgs CollidingMessage;
4337
4338 if (colliders.Count > 0)
4339 {
4340 if ((dest.RootPart.ScriptEvents & ev) != 0)
4341 {
4342 CollidingMessage = CreateColliderArgs(dest.RootPart, colliders);
4343
4344 if (CollidingMessage.Colliders.Count > 0)
4345 notify(dest.RootPart.LocalId, CollidingMessage);
4346 }
4347 }
4348 }
4349
4350 private void SendLandCollisionEvent(SceneObjectGroup dest, scriptEvents ev, ScriptCollidingNotification notify)
4351 {
4352 if ((dest.RootPart.ScriptEvents & ev) != 0)
4353 {
4354 ColliderArgs LandCollidingMessage = new ColliderArgs();
4355 List<DetectedObject> colliding = new List<DetectedObject>();
4356
4357 colliding.Add(CreateDetObjectForGround());
4358 LandCollidingMessage.Colliders = colliding;
4359
4360 notify(dest.RootPart.LocalId, LandCollidingMessage);
4361 }
4362 }
4363
4364 private void RaiseCollisionScriptEvents(Dictionary<uint, ContactPoint> coldata)
4365 {
4366 try
4367 {
4368 List<uint> thisHitColliders = new List<uint>();
4369 List<uint> endedColliders = new List<uint>();
4370 List<uint> startedColliders = new List<uint>();
4371 List<CollisionForSoundInfo> soundinfolist = new List<CollisionForSoundInfo>();
4372 CollisionForSoundInfo soundinfo;
4373 ContactPoint curcontact;
4374
4375 if (coldata.Count == 0)
4376 {
4377 if (m_lastColliders.Count == 0)
4378 return; // nothing to do
4379
4380 foreach (uint localID in m_lastColliders)
4381 {
4382 endedColliders.Add(localID);
4383 }
4384 m_lastColliders.Clear();
4385 }
4386
4387 else
4388 {
4389 foreach (uint id in coldata.Keys)
4390 {
4391 thisHitColliders.Add(id);
4392 if (!m_lastColliders.Contains(id))
4393 {
4394 startedColliders.Add(id);
4395 curcontact = coldata[id];
4396 if (Math.Abs(curcontact.RelativeSpeed) > 0.2)
4397 {
4398 soundinfo = new CollisionForSoundInfo();
4399 soundinfo.colliderID = id;
4400 soundinfo.position = curcontact.Position;
4401 soundinfo.relativeVel = curcontact.RelativeSpeed;
4402 soundinfolist.Add(soundinfo);
4403 }
4404 }
4405 //m_log.Debug("[SCENE PRESENCE]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
4406 }
4407
4408 // calculate things that ended colliding
4409 foreach (uint localID in m_lastColliders)
4410 {
4411 if (!thisHitColliders.Contains(localID))
4412 {
4413 endedColliders.Add(localID);
4414 }
4415 }
4416 //add the items that started colliding this time to the last colliders list.
4417 foreach (uint localID in startedColliders)
4418 {
4419 m_lastColliders.Add(localID);
4420 }
4421 // remove things that ended colliding from the last colliders list
4422 foreach (uint localID in endedColliders)
4423 {
4424 m_lastColliders.Remove(localID);
4425 }
4426
4427 if (soundinfolist.Count > 0)
4428 CollisionSounds.AvatarCollisionSound(this, soundinfolist);
4429 }
4430
4431 foreach (SceneObjectGroup att in GetAttachments())
4432 {
4433 SendCollisionEvent(att, scriptEvents.collision_start, startedColliders, m_scene.EventManager.TriggerScriptCollidingStart);
4434 SendCollisionEvent(att, scriptEvents.collision , m_lastColliders , m_scene.EventManager.TriggerScriptColliding);
4435 SendCollisionEvent(att, scriptEvents.collision_end , endedColliders , m_scene.EventManager.TriggerScriptCollidingEnd);
4436
4437 if (startedColliders.Contains(0))
4438 SendLandCollisionEvent(att, scriptEvents.land_collision_start, m_scene.EventManager.TriggerScriptLandCollidingStart);
4439 if (m_lastColliders.Contains(0))
4440 SendLandCollisionEvent(att, scriptEvents.land_collision, m_scene.EventManager.TriggerScriptLandColliding);
4441 if (endedColliders.Contains(0))
4442 SendLandCollisionEvent(att, scriptEvents.land_collision_end, m_scene.EventManager.TriggerScriptLandCollidingEnd);
4443 }
4444 }
4445 finally
4446 {
4447 m_collisionEventFlag = false;
4448 }
4449 }
4450
4026 private void TeleportFlagsDebug() { 4451 private void TeleportFlagsDebug() {
4027 4452
4028 // Some temporary debugging help to show all the TeleportFlags we have... 4453 // Some temporary debugging help to show all the TeleportFlags we have...
@@ -4047,6 +4472,5 @@ namespace OpenSim.Region.Framework.Scenes
4047 m_log.InfoFormat("[SCENE PRESENCE]: TELEPORT ******************"); 4472 m_log.InfoFormat("[SCENE PRESENCE]: TELEPORT ******************");
4048 4473
4049 } 4474 }
4050
4051 } 4475 }
4052} 4476}