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.cs583
1 files changed, 506 insertions, 77 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 548dfd3..4d3ab51 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,22 @@ 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.AbsolutePosition + (m_pos * part.GetWorldRotation()) + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight);
1951 if (part.SitTargetAvatar == UUID)
1952 m_bodyRot = part.GetWorldRotation() * part.SitTargetOrientation;
1802 1953
1803 ParentID = 0; 1954 ParentID = 0;
1804 ParentPart = null; 1955 ParentPart = null;
1956
1957 if (PhysicsActor == null)
1958 AddToPhysicalScene(false);
1959
1805 SendAvatarDataToAllAgents(); 1960 SendAvatarDataToAllAgents();
1806 m_requestedSitTargetID = 0; 1961 m_requestedSitTargetID = 0;
1807 1962
@@ -1811,6 +1966,9 @@ namespace OpenSim.Region.Framework.Scenes
1811 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); 1966 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
1812 } 1967 }
1813 1968
1969 else if (PhysicsActor == null)
1970 AddToPhysicalScene(false);
1971
1814 Animator.TrySetMovementAnimation("STAND"); 1972 Animator.TrySetMovementAnimation("STAND");
1815 } 1973 }
1816 1974
@@ -1862,7 +2020,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 2020 // see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it
1863 2021
1864 if (PhysicsActor != null) 2022 if (PhysicsActor != null)
1865 m_sitAvatarHeight = PhysicsActor.Size.Z; 2023 m_sitAvatarHeight = PhysicsActor.Size.Z * 0.5f;
1866 2024
1867 bool canSit = false; 2025 bool canSit = false;
1868 Vector3 pos = part.AbsolutePosition + offset; 2026 Vector3 pos = part.AbsolutePosition + offset;
@@ -1911,7 +2069,7 @@ namespace OpenSim.Region.Framework.Scenes
1911 forceMouselook = part.GetForceMouselook(); 2069 forceMouselook = part.GetForceMouselook();
1912 2070
1913 ControllingClient.SendSitResponse( 2071 ControllingClient.SendSitResponse(
1914 targetID, offset, sitOrientation, false, cameraAtOffset, cameraEyeOffset, forceMouselook); 2072 part.UUID, offset, sitOrientation, false, cameraAtOffset, cameraEyeOffset, forceMouselook);
1915 2073
1916 m_requestedSitTargetUUID = targetID; 2074 m_requestedSitTargetUUID = targetID;
1917 2075
@@ -1925,6 +2083,9 @@ namespace OpenSim.Region.Framework.Scenes
1925 2083
1926 public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset) 2084 public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset)
1927 { 2085 {
2086 if (IsChildAgent)
2087 return;
2088
1928 if (ParentID != 0) 2089 if (ParentID != 0)
1929 { 2090 {
1930 StandUp(); 2091 StandUp();
@@ -2202,14 +2363,39 @@ namespace OpenSim.Region.Framework.Scenes
2202 2363
2203 //Quaternion result = (sitTargetOrient * vq) * nq; 2364 //Quaternion result = (sitTargetOrient * vq) * nq;
2204 2365
2205 m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT; 2366 double x, y, z, m;
2367
2368 Quaternion r = sitTargetOrient;
2369 m = r.X * r.X + r.Y * r.Y + r.Z * r.Z + r.W * r.W;
2370
2371 if (Math.Abs(1.0 - m) > 0.000001)
2372 {
2373 m = 1.0 / Math.Sqrt(m);
2374 r.X *= (float)m;
2375 r.Y *= (float)m;
2376 r.Z *= (float)m;
2377 r.W *= (float)m;
2378 }
2379
2380 x = 2 * (r.X * r.Z + r.Y * r.W);
2381 y = 2 * (-r.X * r.W + r.Y * r.Z);
2382 z = -r.X * r.X - r.Y * r.Y + r.Z * r.Z + r.W * r.W;
2383
2384 Vector3 up = new Vector3((float)x, (float)y, (float)z);
2385 Vector3 sitOffset = up * Appearance.AvatarHeight * 0.02638f;
2386
2387 m_pos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT;
2388
2389// m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT - sitOffset;
2206 Rotation = sitTargetOrient; 2390 Rotation = sitTargetOrient;
2207 ParentPosition = part.AbsolutePosition; 2391// ParentPosition = part.AbsolutePosition;
2392 part.ParentGroup.AddAvatar(UUID);
2208 } 2393 }
2209 else 2394 else
2210 { 2395 {
2211 m_pos -= part.AbsolutePosition; 2396 m_pos -= part.AbsolutePosition;
2212 ParentPosition = part.AbsolutePosition; 2397// ParentPosition = part.AbsolutePosition;
2398 part.ParentGroup.AddAvatar(UUID);
2213 2399
2214// m_log.DebugFormat( 2400// m_log.DebugFormat(
2215// "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target", 2401// "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target",
@@ -2254,6 +2440,13 @@ namespace OpenSim.Region.Framework.Scenes
2254 Animator.RemoveAnimation(animID); 2440 Animator.RemoveAnimation(animID);
2255 } 2441 }
2256 2442
2443 public void avnHandleChangeAnim(UUID animID, bool addRemove,bool sendPack)
2444 {
2445 Animator.avnChangeAnim(animID, addRemove, sendPack);
2446 }
2447
2448
2449
2257 /// <summary> 2450 /// <summary>
2258 /// Rotate the avatar to the given rotation and apply a movement in the given relative vector 2451 /// Rotate the avatar to the given rotation and apply a movement in the given relative vector
2259 /// </summary> 2452 /// </summary>
@@ -2307,14 +2500,15 @@ namespace OpenSim.Region.Framework.Scenes
2307 direc.Z *= 2.6f; 2500 direc.Z *= 2.6f;
2308 2501
2309 // TODO: PreJump and jump happen too quickly. Many times prejump gets ignored. 2502 // TODO: PreJump and jump happen too quickly. Many times prejump gets ignored.
2310 Animator.TrySetMovementAnimation("PREJUMP"); 2503// Animator.TrySetMovementAnimation("PREJUMP");
2311 Animator.TrySetMovementAnimation("JUMP"); 2504// Animator.TrySetMovementAnimation("JUMP");
2312 } 2505 }
2313 } 2506 }
2314 } 2507 }
2315 2508
2316 // TODO: Add the force instead of only setting it to support multiple forces per frame? 2509 // TODO: Add the force instead of only setting it to support multiple forces per frame?
2317 m_forceToApply = direc; 2510 m_forceToApply = direc;
2511 Animator.UpdateMovementAnimations();
2318 } 2512 }
2319 2513
2320 #endregion 2514 #endregion
@@ -2706,8 +2900,9 @@ namespace OpenSim.Region.Framework.Scenes
2706 2900
2707 // If we don't have a PhysActor, we can't cross anyway 2901 // 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 2902 // Also don't do this while sat, sitting avatars cross with the
2709 // object they sit on. 2903 // object they sit on. ParentUUID denoted a pending sit, don't
2710 if (ParentID != 0 || PhysicsActor == null) 2904 // interfere with it.
2905 if (ParentID != 0 || PhysicsActor == null || ParentUUID != UUID.Zero)
2711 return; 2906 return;
2712 2907
2713 if (!IsInTransit) 2908 if (!IsInTransit)
@@ -3048,6 +3243,9 @@ namespace OpenSim.Region.Framework.Scenes
3048 cAgent.AlwaysRun = SetAlwaysRun; 3243 cAgent.AlwaysRun = SetAlwaysRun;
3049 3244
3050 cAgent.Appearance = new AvatarAppearance(Appearance); 3245 cAgent.Appearance = new AvatarAppearance(Appearance);
3246
3247 cAgent.ParentPart = ParentUUID;
3248 cAgent.SitOffset = m_pos;
3051 3249
3052 lock (scriptedcontrols) 3250 lock (scriptedcontrols)
3053 { 3251 {
@@ -3056,7 +3254,7 @@ namespace OpenSim.Region.Framework.Scenes
3056 3254
3057 foreach (ScriptControllers c in scriptedcontrols.Values) 3255 foreach (ScriptControllers c in scriptedcontrols.Values)
3058 { 3256 {
3059 controls[i++] = new ControllerData(c.itemID, (uint)c.ignoreControls, (uint)c.eventControls); 3257 controls[i++] = new ControllerData(c.objectID, c.itemID, (uint)c.ignoreControls, (uint)c.eventControls);
3060 } 3258 }
3061 cAgent.Controllers = controls; 3259 cAgent.Controllers = controls;
3062 } 3260 }
@@ -3067,6 +3265,7 @@ namespace OpenSim.Region.Framework.Scenes
3067 cAgent.Anims = Animator.Animations.ToArray(); 3265 cAgent.Anims = Animator.Animations.ToArray();
3068 } 3266 }
3069 catch { } 3267 catch { }
3268 cAgent.DefaultAnim = Animator.Animations.DefaultAnimation;
3070 3269
3071 if (Scene.AttachmentsModule != null) 3270 if (Scene.AttachmentsModule != null)
3072 Scene.AttachmentsModule.CopyAttachments(this, cAgent); 3271 Scene.AttachmentsModule.CopyAttachments(this, cAgent);
@@ -3087,6 +3286,8 @@ namespace OpenSim.Region.Framework.Scenes
3087 CameraAtAxis = cAgent.AtAxis; 3286 CameraAtAxis = cAgent.AtAxis;
3088 CameraLeftAxis = cAgent.LeftAxis; 3287 CameraLeftAxis = cAgent.LeftAxis;
3089 CameraUpAxis = cAgent.UpAxis; 3288 CameraUpAxis = cAgent.UpAxis;
3289 ParentUUID = cAgent.ParentPart;
3290 m_prevSitOffset = cAgent.SitOffset;
3090 3291
3091 // When we get to the point of re-computing neighbors everytime this 3292 // When we get to the point of re-computing neighbors everytime this
3092 // changes, then start using the agent's drawdistance rather than the 3293 // changes, then start using the agent's drawdistance rather than the
@@ -3124,6 +3325,7 @@ namespace OpenSim.Region.Framework.Scenes
3124 foreach (ControllerData c in cAgent.Controllers) 3325 foreach (ControllerData c in cAgent.Controllers)
3125 { 3326 {
3126 ScriptControllers sc = new ScriptControllers(); 3327 ScriptControllers sc = new ScriptControllers();
3328 sc.objectID = c.ObjectID;
3127 sc.itemID = c.ItemID; 3329 sc.itemID = c.ItemID;
3128 sc.ignoreControls = (ScriptControlled)c.IgnoreControls; 3330 sc.ignoreControls = (ScriptControlled)c.IgnoreControls;
3129 sc.eventControls = (ScriptControlled)c.EventControls; 3331 sc.eventControls = (ScriptControlled)c.EventControls;
@@ -3138,6 +3340,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? 3340 // FIXME: Why is this null check necessary? Where are the cases where we get a null Anims object?
3139 if (cAgent.Anims != null) 3341 if (cAgent.Anims != null)
3140 Animator.Animations.FromArray(cAgent.Anims); 3342 Animator.Animations.FromArray(cAgent.Anims);
3343 if (cAgent.DefaultAnim != null)
3344 Animator.Animations.SetDefaultAnimation(cAgent.DefaultAnim.AnimID, cAgent.DefaultAnim.SequenceNum, UUID.Zero);
3141 3345
3142 if (Scene.AttachmentsModule != null) 3346 if (Scene.AttachmentsModule != null)
3143 Scene.AttachmentsModule.CopyAttachments(cAgent, this); 3347 Scene.AttachmentsModule.CopyAttachments(cAgent, this);
@@ -3200,7 +3404,7 @@ namespace OpenSim.Region.Framework.Scenes
3200 //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; 3404 //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
3201 PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; 3405 PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
3202 PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong 3406 PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong
3203 PhysicsActor.SubscribeEvents(500); 3407 PhysicsActor.SubscribeEvents(100);
3204 PhysicsActor.LocalID = LocalId; 3408 PhysicsActor.LocalID = LocalId;
3205 } 3409 }
3206 3410
@@ -3282,6 +3486,8 @@ namespace OpenSim.Region.Framework.Scenes
3282 } 3486 }
3283 } 3487 }
3284 3488
3489 RaiseCollisionScriptEvents(coldata);
3490
3285 // Gods do not take damage and Invulnerable is set depending on parcel/region flags 3491 // Gods do not take damage and Invulnerable is set depending on parcel/region flags
3286 if (Invulnerable || GodLevel > 0) 3492 if (Invulnerable || GodLevel > 0)
3287 return; 3493 return;
@@ -3609,10 +3815,18 @@ namespace OpenSim.Region.Framework.Scenes
3609 3815
3610 public void RegisterControlEventsToScript(int controls, int accept, int pass_on, uint Obj_localID, UUID Script_item_UUID) 3816 public void RegisterControlEventsToScript(int controls, int accept, int pass_on, uint Obj_localID, UUID Script_item_UUID)
3611 { 3817 {
3818 SceneObjectPart p = m_scene.GetSceneObjectPart(Obj_localID);
3819 if (p == null)
3820 return;
3821
3822 ControllingClient.SendTakeControls(controls, false, false);
3823 ControllingClient.SendTakeControls(controls, true, false);
3824
3612 ScriptControllers obj = new ScriptControllers(); 3825 ScriptControllers obj = new ScriptControllers();
3613 obj.ignoreControls = ScriptControlled.CONTROL_ZERO; 3826 obj.ignoreControls = ScriptControlled.CONTROL_ZERO;
3614 obj.eventControls = ScriptControlled.CONTROL_ZERO; 3827 obj.eventControls = ScriptControlled.CONTROL_ZERO;
3615 3828
3829 obj.objectID = p.ParentGroup.UUID;
3616 obj.itemID = Script_item_UUID; 3830 obj.itemID = Script_item_UUID;
3617 if (pass_on == 0 && accept == 0) 3831 if (pass_on == 0 && accept == 0)
3618 { 3832 {
@@ -3661,6 +3875,21 @@ namespace OpenSim.Region.Framework.Scenes
3661 ControllingClient.SendTakeControls(int.MaxValue, false, false); 3875 ControllingClient.SendTakeControls(int.MaxValue, false, false);
3662 } 3876 }
3663 3877
3878 private void UnRegisterSeatControls(UUID obj)
3879 {
3880 List<UUID> takers = new List<UUID>();
3881
3882 foreach (ScriptControllers c in scriptedcontrols.Values)
3883 {
3884 if (c.objectID == obj)
3885 takers.Add(c.itemID);
3886 }
3887 foreach (UUID t in takers)
3888 {
3889 UnRegisterControlEventsToScript(0, t);
3890 }
3891 }
3892
3664 public void UnRegisterControlEventsToScript(uint Obj_localID, UUID Script_item_UUID) 3893 public void UnRegisterControlEventsToScript(uint Obj_localID, UUID Script_item_UUID)
3665 { 3894 {
3666 ScriptControllers takecontrols; 3895 ScriptControllers takecontrols;
@@ -3979,6 +4208,12 @@ namespace OpenSim.Region.Framework.Scenes
3979 4208
3980 private void CheckAndAdjustLandingPoint(ref Vector3 pos) 4209 private void CheckAndAdjustLandingPoint(ref Vector3 pos)
3981 { 4210 {
4211 string reason;
4212
4213 // Honor bans
4214 if (!m_scene.TestLandRestrictions(UUID, out reason, ref pos.X, ref pos.Y))
4215 return;
4216
3982 SceneObjectGroup telehub = null; 4217 SceneObjectGroup telehub = null;
3983 if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero && (telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject)) != null) 4218 if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero && (telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject)) != null)
3984 { 4219 {
@@ -4018,11 +4253,206 @@ namespace OpenSim.Region.Framework.Scenes
4018 pos = land.LandData.UserLocation; 4253 pos = land.LandData.UserLocation;
4019 } 4254 }
4020 } 4255 }
4021 4256
4022 land.SendLandUpdateToClient(ControllingClient); 4257 land.SendLandUpdateToClient(ControllingClient);
4023 } 4258 }
4024 } 4259 }
4025 4260
4261 private DetectedObject CreateDetObject(SceneObjectPart obj)
4262 {
4263 DetectedObject detobj = new DetectedObject();
4264 detobj.keyUUID = obj.UUID;
4265 detobj.nameStr = obj.Name;
4266 detobj.ownerUUID = obj.OwnerID;
4267 detobj.posVector = obj.AbsolutePosition;
4268 detobj.rotQuat = obj.GetWorldRotation();
4269 detobj.velVector = obj.Velocity;
4270 detobj.colliderType = 0;
4271 detobj.groupUUID = obj.GroupID;
4272
4273 return detobj;
4274 }
4275
4276 private DetectedObject CreateDetObject(ScenePresence av)
4277 {
4278 DetectedObject detobj = new DetectedObject();
4279 detobj.keyUUID = av.UUID;
4280 detobj.nameStr = av.ControllingClient.Name;
4281 detobj.ownerUUID = av.UUID;
4282 detobj.posVector = av.AbsolutePosition;
4283 detobj.rotQuat = av.Rotation;
4284 detobj.velVector = av.Velocity;
4285 detobj.colliderType = 0;
4286 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
4287
4288 return detobj;
4289 }
4290
4291 private DetectedObject CreateDetObjectForGround()
4292 {
4293 DetectedObject detobj = new DetectedObject();
4294 detobj.keyUUID = UUID.Zero;
4295 detobj.nameStr = "";
4296 detobj.ownerUUID = UUID.Zero;
4297 detobj.posVector = AbsolutePosition;
4298 detobj.rotQuat = Quaternion.Identity;
4299 detobj.velVector = Vector3.Zero;
4300 detobj.colliderType = 0;
4301 detobj.groupUUID = UUID.Zero;
4302
4303 return detobj;
4304 }
4305
4306 private ColliderArgs CreateColliderArgs(SceneObjectPart dest, List<uint> colliders)
4307 {
4308 ColliderArgs colliderArgs = new ColliderArgs();
4309 List<DetectedObject> colliding = new List<DetectedObject>();
4310 foreach (uint localId in colliders)
4311 {
4312 if (localId == 0)
4313 continue;
4314
4315 SceneObjectPart obj = m_scene.GetSceneObjectPart(localId);
4316 if (obj != null)
4317 {
4318 if (!dest.CollisionFilteredOut(obj.UUID, obj.Name))
4319 colliding.Add(CreateDetObject(obj));
4320 }
4321 else
4322 {
4323 ScenePresence av = m_scene.GetScenePresence(localId);
4324 if (av != null && (!av.IsChildAgent))
4325 {
4326 if (!dest.CollisionFilteredOut(av.UUID, av.Name))
4327 colliding.Add(CreateDetObject(av));
4328 }
4329 }
4330 }
4331
4332 colliderArgs.Colliders = colliding;
4333
4334 return colliderArgs;
4335 }
4336
4337 private delegate void ScriptCollidingNotification(uint localID, ColliderArgs message);
4338
4339 private void SendCollisionEvent(SceneObjectGroup dest, scriptEvents ev, List<uint> colliders, ScriptCollidingNotification notify)
4340 {
4341 ColliderArgs CollidingMessage;
4342
4343 if (colliders.Count > 0)
4344 {
4345 if ((dest.RootPart.ScriptEvents & ev) != 0)
4346 {
4347 CollidingMessage = CreateColliderArgs(dest.RootPart, colliders);
4348
4349 if (CollidingMessage.Colliders.Count > 0)
4350 notify(dest.RootPart.LocalId, CollidingMessage);
4351 }
4352 }
4353 }
4354
4355 private void SendLandCollisionEvent(SceneObjectGroup dest, scriptEvents ev, ScriptCollidingNotification notify)
4356 {
4357 if ((dest.RootPart.ScriptEvents & ev) != 0)
4358 {
4359 ColliderArgs LandCollidingMessage = new ColliderArgs();
4360 List<DetectedObject> colliding = new List<DetectedObject>();
4361
4362 colliding.Add(CreateDetObjectForGround());
4363 LandCollidingMessage.Colliders = colliding;
4364
4365 notify(dest.RootPart.LocalId, LandCollidingMessage);
4366 }
4367 }
4368
4369 private void RaiseCollisionScriptEvents(Dictionary<uint, ContactPoint> coldata)
4370 {
4371 try
4372 {
4373 List<uint> thisHitColliders = new List<uint>();
4374 List<uint> endedColliders = new List<uint>();
4375 List<uint> startedColliders = new List<uint>();
4376 List<CollisionForSoundInfo> soundinfolist = new List<CollisionForSoundInfo>();
4377 CollisionForSoundInfo soundinfo;
4378 ContactPoint curcontact;
4379
4380 if (coldata.Count == 0)
4381 {
4382 if (m_lastColliders.Count == 0)
4383 return; // nothing to do
4384
4385 foreach (uint localID in m_lastColliders)
4386 {
4387 endedColliders.Add(localID);
4388 }
4389 m_lastColliders.Clear();
4390 }
4391
4392 else
4393 {
4394 foreach (uint id in coldata.Keys)
4395 {
4396 thisHitColliders.Add(id);
4397 if (!m_lastColliders.Contains(id))
4398 {
4399 startedColliders.Add(id);
4400 curcontact = coldata[id];
4401 if (Math.Abs(curcontact.RelativeSpeed) > 0.2)
4402 {
4403 soundinfo = new CollisionForSoundInfo();
4404 soundinfo.colliderID = id;
4405 soundinfo.position = curcontact.Position;
4406 soundinfo.relativeVel = curcontact.RelativeSpeed;
4407 soundinfolist.Add(soundinfo);
4408 }
4409 }
4410 //m_log.Debug("[SCENE PRESENCE]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
4411 }
4412
4413 // calculate things that ended colliding
4414 foreach (uint localID in m_lastColliders)
4415 {
4416 if (!thisHitColliders.Contains(localID))
4417 {
4418 endedColliders.Add(localID);
4419 }
4420 }
4421 //add the items that started colliding this time to the last colliders list.
4422 foreach (uint localID in startedColliders)
4423 {
4424 m_lastColliders.Add(localID);
4425 }
4426 // remove things that ended colliding from the last colliders list
4427 foreach (uint localID in endedColliders)
4428 {
4429 m_lastColliders.Remove(localID);
4430 }
4431
4432 if (soundinfolist.Count > 0)
4433 CollisionSounds.AvatarCollisionSound(this, soundinfolist);
4434 }
4435
4436 foreach (SceneObjectGroup att in GetAttachments())
4437 {
4438 SendCollisionEvent(att, scriptEvents.collision_start, startedColliders, m_scene.EventManager.TriggerScriptCollidingStart);
4439 SendCollisionEvent(att, scriptEvents.collision , m_lastColliders , m_scene.EventManager.TriggerScriptColliding);
4440 SendCollisionEvent(att, scriptEvents.collision_end , endedColliders , m_scene.EventManager.TriggerScriptCollidingEnd);
4441
4442 if (startedColliders.Contains(0))
4443 SendLandCollisionEvent(att, scriptEvents.land_collision_start, m_scene.EventManager.TriggerScriptLandCollidingStart);
4444 if (m_lastColliders.Contains(0))
4445 SendLandCollisionEvent(att, scriptEvents.land_collision, m_scene.EventManager.TriggerScriptLandColliding);
4446 if (endedColliders.Contains(0))
4447 SendLandCollisionEvent(att, scriptEvents.land_collision_end, m_scene.EventManager.TriggerScriptLandCollidingEnd);
4448 }
4449 }
4450 finally
4451 {
4452 m_collisionEventFlag = false;
4453 }
4454 }
4455
4026 private void TeleportFlagsDebug() { 4456 private void TeleportFlagsDebug() {
4027 4457
4028 // Some temporary debugging help to show all the TeleportFlags we have... 4458 // Some temporary debugging help to show all the TeleportFlags we have...
@@ -4047,6 +4477,5 @@ namespace OpenSim.Region.Framework.Scenes
4047 m_log.InfoFormat("[SCENE PRESENCE]: TELEPORT ******************"); 4477 m_log.InfoFormat("[SCENE PRESENCE]: TELEPORT ******************");
4048 4478
4049 } 4479 }
4050
4051 } 4480 }
4052} 4481}