diff options
author | Teravus Ovares | 2008-06-06 12:51:20 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-06-06 12:51:20 +0000 |
commit | c892ddcd2031466499ade7b101ba007d920af2fb (patch) | |
tree | fbf29835d4ec29011be02704e85d641bd333cd57 /OpenSim/Region/Environment/Scenes | |
parent | * Fixes incorrect message server startup prompt (diff) | |
download | opensim-SC-c892ddcd2031466499ade7b101ba007d920af2fb.zip opensim-SC-c892ddcd2031466499ade7b101ba007d920af2fb.tar.gz opensim-SC-c892ddcd2031466499ade7b101ba007d920af2fb.tar.bz2 opensim-SC-c892ddcd2031466499ade7b101ba007d920af2fb.tar.xz |
* This wraps the autopilot request to the client's sit response. An interesting, but successful way to do it.
* This also takes care of a few error situations that were previously never seen.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
4 files changed, 128 insertions, 27 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 706be06..211f320 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1736,6 +1736,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1736 | client.OnObjectGroupRequest += m_innerScene.HandleObjectGroupUpdate; | 1736 | client.OnObjectGroupRequest += m_innerScene.HandleObjectGroupUpdate; |
1737 | client.OnParcelReturnObjectsRequest += LandChannel.ReturnObjectsInParcel; | 1737 | client.OnParcelReturnObjectsRequest += LandChannel.ReturnObjectsInParcel; |
1738 | client.OnScriptReset += ProcessScriptReset; | 1738 | client.OnScriptReset += ProcessScriptReset; |
1739 | |||
1739 | 1740 | ||
1740 | // EventManager.TriggerOnNewClient(client); | 1741 | // EventManager.TriggerOnNewClient(client); |
1741 | } | 1742 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs index 47dd0bc..eac9e25 100644 --- a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs +++ b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs | |||
@@ -62,6 +62,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
62 | public uint ExternalChecksGenerateClientFlags(LLUUID userID, LLUUID objectID) | 62 | public uint ExternalChecksGenerateClientFlags(LLUUID userID, LLUUID objectID) |
63 | { | 63 | { |
64 | SceneObjectPart part=m_scene.GetSceneObjectPart(objectID); | 64 | SceneObjectPart part=m_scene.GetSceneObjectPart(objectID); |
65 | |||
66 | if (part == null) | ||
67 | return 0; | ||
65 | 68 | ||
66 | uint perms=part.GetEffectiveObjectFlags() | | 69 | uint perms=part.GetEffectiveObjectFlags() | |
67 | (uint)LLObject.ObjectFlags.ObjectModify | | 70 | (uint)LLObject.ObjectFlags.ObjectModify | |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 94d888c..0948d69 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -472,6 +472,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
472 | UpdateParentIDs(); | 472 | UpdateParentIDs(); |
473 | } | 473 | } |
474 | 474 | ||
475 | |||
475 | /// <summary> | 476 | /// <summary> |
476 | /// | 477 | /// |
477 | /// </summary> | 478 | /// </summary> |
@@ -488,12 +489,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
488 | newPart.LinkNum = m_parts.Count; | 489 | newPart.LinkNum = m_parts.Count; |
489 | m_parts.Add(newPart.UUID, newPart); | 490 | m_parts.Add(newPart.UUID, newPart); |
490 | SetPartAsRoot(newPart); | 491 | SetPartAsRoot(newPart); |
491 | 492 | // one of these is a proxy. | |
492 | AttachToBackup(); | 493 | if (shape.PCode != (byte)PCode.None && shape.PCode != (byte)PCode.ParticleSystem) |
494 | AttachToBackup(); | ||
493 | 495 | ||
494 | //ApplyPhysics(scene.m_physicalPrim); | 496 | //ApplyPhysics(scene.m_physicalPrim); |
495 | } | 497 | } |
496 | |||
497 | /// <summary> | 498 | /// <summary> |
498 | /// | 499 | /// |
499 | /// </summary> | 500 | /// </summary> |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 0fdd720..aca0f9d 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -80,6 +80,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
80 | private Dictionary<LLUUID, ScriptControllers> scriptedcontrols = new Dictionary<LLUUID, ScriptControllers>(); | 80 | private Dictionary<LLUUID, ScriptControllers> scriptedcontrols = new Dictionary<LLUUID, ScriptControllers>(); |
81 | private ScriptControlled IgnoredControls = ScriptControlled.CONTROL_ZERO; | 81 | private ScriptControlled IgnoredControls = ScriptControlled.CONTROL_ZERO; |
82 | private ScriptControlled LastCommands = ScriptControlled.CONTROL_ZERO; | 82 | private ScriptControlled LastCommands = ScriptControlled.CONTROL_ZERO; |
83 | private SceneObjectGroup proxyObjectGroup = null; | ||
84 | private SceneObjectPart proxyObjectPart = null; | ||
83 | 85 | ||
84 | public Vector3 lastKnownAllowedPosition = new Vector3(); | 86 | public Vector3 lastKnownAllowedPosition = new Vector3(); |
85 | public bool sentMessageAboutRestrictedParcelFlyingDown = false; | 87 | public bool sentMessageAboutRestrictedParcelFlyingDown = false; |
@@ -89,6 +91,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
89 | private readonly List<NewForce> m_forcesList = new List<NewForce>(); | 91 | private readonly List<NewForce> m_forcesList = new List<NewForce>(); |
90 | private short m_updateCount = 0; | 92 | private short m_updateCount = 0; |
91 | private uint m_requestedSitTargetID = 0; | 93 | private uint m_requestedSitTargetID = 0; |
94 | private LLUUID m_requestedSitTargetUUID = LLUUID.Zero; | ||
95 | |||
92 | private LLVector3 m_requestedSitOffset = new LLVector3(); | 96 | private LLVector3 m_requestedSitOffset = new LLVector3(); |
93 | 97 | ||
94 | private LLVector3 m_LastFinitePos = new LLVector3(); | 98 | private LLVector3 m_LastFinitePos = new LLVector3(); |
@@ -144,6 +148,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
144 | //Reuse the LLVector3 instead of creating a new one on the UpdateMovement method | 148 | //Reuse the LLVector3 instead of creating a new one on the UpdateMovement method |
145 | private LLVector3 movementvector = new LLVector3(); | 149 | private LLVector3 movementvector = new LLVector3(); |
146 | 150 | ||
151 | private bool m_autopilotMoving = false; | ||
152 | private LLVector3 m_autoPilotTarget = LLVector3.Zero; | ||
153 | private bool m_sitAtAutoTarget = false; | ||
154 | |||
147 | private List<LLUUID> m_knownPrimUUID = new List<LLUUID>(); | 155 | private List<LLUUID> m_knownPrimUUID = new List<LLUUID>(); |
148 | 156 | ||
149 | // Agent's Draw distance. | 157 | // Agent's Draw distance. |
@@ -439,6 +447,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
439 | m_controllingClient.OnStartAnim += HandleStartAnim; | 447 | m_controllingClient.OnStartAnim += HandleStartAnim; |
440 | m_controllingClient.OnStopAnim += HandleStopAnim; | 448 | m_controllingClient.OnStopAnim += HandleStopAnim; |
441 | m_controllingClient.OnForceReleaseControls += HandleForceReleaseControls; | 449 | m_controllingClient.OnForceReleaseControls += HandleForceReleaseControls; |
450 | m_controllingClient.OnAutoPilotGo += DoAutoPilot; | ||
442 | 451 | ||
443 | // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); | 452 | // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); |
444 | // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); | 453 | // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); |
@@ -472,6 +481,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
472 | // } | 481 | // } |
473 | } | 482 | } |
474 | 483 | ||
484 | |||
485 | |||
475 | public uint GenerateClientFlags(LLUUID ObjectID) | 486 | public uint GenerateClientFlags(LLUUID ObjectID) |
476 | { | 487 | { |
477 | return m_scene.ExternalChecks.ExternalChecksGenerateClientFlags(m_uuid, ObjectID); | 488 | return m_scene.ExternalChecks.ExternalChecksGenerateClientFlags(m_uuid, ObjectID); |
@@ -835,6 +846,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
835 | return; | 846 | return; |
836 | } | 847 | } |
837 | 848 | ||
849 | if (m_autopilotMoving) | ||
850 | CheckAtSitTarget(); | ||
851 | |||
838 | if ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0) | 852 | if ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0) |
839 | { | 853 | { |
840 | // TODO: This doesn't enable the "stand up" button on the viewer yet (probably a parent ID problem) | 854 | // TODO: This doesn't enable the "stand up" button on the viewer yet (probably a parent ID problem) |
@@ -856,14 +870,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
856 | bool DCFlagKeyPressed = false; | 870 | bool DCFlagKeyPressed = false; |
857 | Vector3 agent_control_v3 = new Vector3(0, 0, 0); | 871 | Vector3 agent_control_v3 = new Vector3(0, 0, 0); |
858 | Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); | 872 | Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); |
859 | bool oldflying = PhysicsActor.Flying; | 873 | if (PhysicsActor != null) |
860 | |||
861 | PhysicsActor.Flying = ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); | ||
862 | if (PhysicsActor.Flying != oldflying) | ||
863 | { | 874 | { |
864 | update_movementflag = true; | 875 | bool oldflying = PhysicsActor.Flying; |
865 | } | ||
866 | 876 | ||
877 | PhysicsActor.Flying = ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); | ||
878 | if (PhysicsActor.Flying != oldflying) | ||
879 | { | ||
880 | update_movementflag = true; | ||
881 | } | ||
882 | } | ||
867 | if (q != m_bodyRot) | 883 | if (q != m_bodyRot) |
868 | { | 884 | { |
869 | m_bodyRot = q; | 885 | m_bodyRot = q; |
@@ -930,11 +946,78 @@ namespace OpenSim.Region.Environment.Scenes | |||
930 | } | 946 | } |
931 | } | 947 | } |
932 | 948 | ||
949 | |||
950 | |||
933 | m_scene.EventManager.TriggerOnClientMovement(this); | 951 | m_scene.EventManager.TriggerOnClientMovement(this); |
934 | 952 | ||
935 | m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); | 953 | m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); |
936 | } | 954 | } |
937 | 955 | ||
956 | public void DoAutoPilot(uint not_used, LLVector3 Pos, IClientAPI remote_client) | ||
957 | { | ||
958 | m_autopilotMoving = true; | ||
959 | m_autoPilotTarget = Pos; | ||
960 | m_sitAtAutoTarget = false; | ||
961 | PrimitiveBaseShape proxy = PrimitiveBaseShape.Default; | ||
962 | //proxy.PCode = (byte)PCode.ParticleSystem; | ||
963 | uint nextUUID = m_scene.NextLocalId; | ||
964 | |||
965 | proxyObjectGroup = new SceneObjectGroup(m_scene, m_scene.RegionInfo.RegionHandle, UUID, nextUUID, Pos, new LLQuaternion(Rotation.x, Rotation.y, Rotation.z, Rotation.w), proxy); | ||
966 | if (proxyObjectGroup != null) | ||
967 | { | ||
968 | proxyObjectGroup.SendGroupFullUpdate(); | ||
969 | remote_client.SendSitResponse(proxyObjectGroup.UUID, LLVector3.Zero, LLQuaternion.Identity, true, LLVector3.Zero, LLVector3.Zero, false); | ||
970 | m_scene.DeleteSceneObject(proxyObjectGroup); | ||
971 | } | ||
972 | else | ||
973 | { | ||
974 | m_autopilotMoving = false; | ||
975 | m_autoPilotTarget = LLVector3.Zero; | ||
976 | ControllingClient.SendAlertMessage("Autopilot cancelled"); | ||
977 | } | ||
978 | |||
979 | } | ||
980 | |||
981 | private void CheckAtSitTarget() | ||
982 | { | ||
983 | //m_log.Debug("[AUTOPILOT]: " + Util.GetDistanceTo(AbsolutePosition, m_autoPilotTarget).ToString()); | ||
984 | if (Util.GetDistanceTo(AbsolutePosition, m_autoPilotTarget) <= 1.5) | ||
985 | { | ||
986 | |||
987 | if (m_sitAtAutoTarget) | ||
988 | { | ||
989 | SceneObjectPart part = m_scene.GetSceneObjectPart(m_requestedSitTargetUUID); | ||
990 | if (part != null) | ||
991 | { | ||
992 | AbsolutePosition = part.AbsolutePosition; | ||
993 | Velocity = new LLVector3(0, 0, 0); | ||
994 | SendFullUpdateToAllClients(); | ||
995 | |||
996 | //HandleAgentSit(ControllingClient, m_requestedSitTargetUUID); | ||
997 | } | ||
998 | //ControllingClient.SendSitResponse(m_requestedSitTargetID, m_requestedSitOffset, LLQuaternion.Identity, false, LLVector3.Zero, LLVector3.Zero, false); | ||
999 | m_requestedSitTargetUUID = LLUUID.Zero; | ||
1000 | } | ||
1001 | else | ||
1002 | { | ||
1003 | //ControllingClient.SendAlertMessage("Autopilot cancelled"); | ||
1004 | //SendTerseUpdateToAllClients(); | ||
1005 | //PrimitiveBaseShape proxy = PrimitiveBaseShape.Default; | ||
1006 | //proxy.PCode = (byte)PCode.ParticleSystem; | ||
1007 | ////uint nextUUID = m_scene.NextLocalId; | ||
1008 | |||
1009 | //proxyObjectGroup = new SceneObjectGroup(m_scene, m_scene.RegionInfo.RegionHandle, UUID, nextUUID, m_autoPilotTarget, LLQuaternion.Identity, proxy); | ||
1010 | //if (proxyObjectGroup != null) | ||
1011 | //{ | ||
1012 | //proxyObjectGroup.SendGroupFullUpdate(); | ||
1013 | //ControllingClient.SendSitResponse(LLUUID.Zero, m_autoPilotTarget, LLQuaternion.Identity, true, LLVector3.Zero, LLVector3.Zero, false); | ||
1014 | //m_scene.DeleteSceneObject(proxyObjectGroup); | ||
1015 | //} | ||
1016 | } | ||
1017 | m_autoPilotTarget = LLVector3.Zero; | ||
1018 | m_autopilotMoving = false; | ||
1019 | } | ||
1020 | } | ||
938 | /// <summary> | 1021 | /// <summary> |
939 | /// Perform the logic necessary to stand the client up. This method also executes | 1022 | /// Perform the logic necessary to stand the client up. This method also executes |
940 | /// the stand animation. | 1023 | /// the stand animation. |
@@ -963,7 +1046,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
963 | 1046 | ||
964 | m_parentID = 0; | 1047 | m_parentID = 0; |
965 | SendFullUpdateToAllClients(); | 1048 | SendFullUpdateToAllClients(); |
966 | 1049 | m_requestedSitTargetID = 0; | |
967 | if (m_physicsActor != null) | 1050 | if (m_physicsActor != null) |
968 | { | 1051 | { |
969 | SetHeight(m_avHeight); | 1052 | SetHeight(m_avHeight); |
@@ -1005,7 +1088,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1005 | } | 1088 | } |
1006 | 1089 | ||
1007 | pos = part.AbsolutePosition + offset; | 1090 | pos = part.AbsolutePosition + offset; |
1008 | 1091 | //if (Math.Abs(part.AbsolutePosition.Z - AbsolutePosition.Z) > 1) | |
1092 | //{ | ||
1093 | // offset = pos; | ||
1094 | //autopilot = false; | ||
1095 | //} | ||
1009 | if (m_physicsActor != null) | 1096 | if (m_physicsActor != null) |
1010 | { | 1097 | { |
1011 | // If we're not using the client autopilot, we're immediately warping the avatar to the location | 1098 | // If we're not using the client autopilot, we're immediately warping the avatar to the location |
@@ -1030,11 +1117,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
1030 | } | 1117 | } |
1031 | 1118 | ||
1032 | ControllingClient.SendSitResponse(targetID, offset, sitOrientation, autopilot, LLVector3.Zero, LLVector3.Zero, false); | 1119 | ControllingClient.SendSitResponse(targetID, offset, sitOrientation, autopilot, LLVector3.Zero, LLVector3.Zero, false); |
1033 | 1120 | m_requestedSitTargetUUID = targetID; | |
1034 | // This calls HandleAgentSit twice, once from here, and the client calls | 1121 | // This calls HandleAgentSit twice, once from here, and the client calls |
1035 | // HandleAgentSit itself after it gets to the location | 1122 | // HandleAgentSit itself after it gets to the location |
1036 | // It doesn't get to the location until we've moved them there though | 1123 | // It doesn't get to the location until we've moved them there though |
1037 | // which happens in HandleAgentSit :P | 1124 | // which happens in HandleAgentSit :P |
1125 | m_autopilotMoving = autopilot; | ||
1126 | m_autoPilotTarget = pos; | ||
1127 | m_sitAtAutoTarget = autopilot; | ||
1038 | if (!autopilot) | 1128 | if (!autopilot) |
1039 | HandleAgentSit(remoteClient, UUID); | 1129 | HandleAgentSit(remoteClient, UUID); |
1040 | } | 1130 | } |
@@ -1064,32 +1154,38 @@ namespace OpenSim.Region.Environment.Scenes | |||
1064 | { | 1154 | { |
1065 | SceneObjectPart part = m_scene.GetSceneObjectPart(m_requestedSitTargetID); | 1155 | SceneObjectPart part = m_scene.GetSceneObjectPart(m_requestedSitTargetID); |
1066 | 1156 | ||
1067 | if (part != null) | 1157 | if (m_sitAtAutoTarget || !m_autopilotMoving) |
1068 | { | 1158 | { |
1069 | if (part.GetAvatarOnSitTarget() == UUID) | 1159 | if (part != null) |
1070 | { | 1160 | { |
1071 | Vector3 sitTargetPos = part.GetSitTargetPosition(); | 1161 | if (part.GetAvatarOnSitTarget() == UUID) |
1072 | Quaternion sitTargetOrient = part.GetSitTargetOrientation(); | 1162 | { |
1163 | Vector3 sitTargetPos = part.GetSitTargetPosition(); | ||
1164 | Quaternion sitTargetOrient = part.GetSitTargetOrientation(); | ||
1073 | 1165 | ||
1074 | //Quaternion vq = new Quaternion(sitTargetPos.x, sitTargetPos.y+0.2f, sitTargetPos.z+0.2f, 0); | 1166 | //Quaternion vq = new Quaternion(sitTargetPos.x, sitTargetPos.y+0.2f, sitTargetPos.z+0.2f, 0); |
1075 | //Quaternion nq = new Quaternion(sitTargetOrient.w, -sitTargetOrient.x, -sitTargetOrient.y, -sitTargetOrient.z); | 1167 | //Quaternion nq = new Quaternion(sitTargetOrient.w, -sitTargetOrient.x, -sitTargetOrient.y, -sitTargetOrient.z); |
1076 | 1168 | ||
1077 | //Quaternion result = (sitTargetOrient * vq) * nq; | 1169 | //Quaternion result = (sitTargetOrient * vq) * nq; |
1078 | 1170 | ||
1079 | m_pos = new LLVector3(sitTargetPos.x, sitTargetPos.y, sitTargetPos.z); | 1171 | m_pos = new LLVector3(sitTargetPos.x, sitTargetPos.y, sitTargetPos.z); |
1080 | m_bodyRot = sitTargetOrient; | 1172 | m_bodyRot = sitTargetOrient; |
1081 | //Rotation = sitTargetOrient; | 1173 | //Rotation = sitTargetOrient; |
1082 | m_parentPosition = part.AbsolutePosition; | 1174 | m_parentPosition = part.AbsolutePosition; |
1083 | 1175 | ||
1084 | //SendTerseUpdateToAllClients(); | 1176 | //SendTerseUpdateToAllClients(); |
1177 | } | ||
1178 | else | ||
1179 | { | ||
1180 | m_pos -= part.AbsolutePosition; | ||
1181 | m_parentPosition = part.AbsolutePosition; | ||
1182 | } | ||
1085 | } | 1183 | } |
1086 | else | 1184 | else |
1087 | { | 1185 | { |
1088 | m_pos -= part.AbsolutePosition; | 1186 | return; |
1089 | m_parentPosition = part.AbsolutePosition; | ||
1090 | } | 1187 | } |
1091 | } | 1188 | } |
1092 | |||
1093 | m_parentID = m_requestedSitTargetID; | 1189 | m_parentID = m_requestedSitTargetID; |
1094 | 1190 | ||
1095 | Velocity = new LLVector3(0, 0, 0); | 1191 | Velocity = new LLVector3(0, 0, 0); |