aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/IClientAPI.cs1
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs59
-rw-r--r--OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs1
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs1
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs3
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs7
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs144
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs2
8 files changed, 186 insertions, 32 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index f5e98c8..0ece1a3 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -838,6 +838,7 @@ namespace OpenSim.Framework
838 838
839 event RequestObjectPropertiesFamily OnObjectGroupRequest; 839 event RequestObjectPropertiesFamily OnObjectGroupRequest;
840 event ScriptReset OnScriptReset; 840 event ScriptReset OnScriptReset;
841 event UpdateVector OnAutoPilotGo;
841 842
842 [Obsolete("IClientAPI.OutPacket SHOULD NOT EXIST outside of LLClientView please refactor appropriately.")] 843 [Obsolete("IClientAPI.OutPacket SHOULD NOT EXIST outside of LLClientView please refactor appropriately.")]
843 void OutPacket(Packet newPack, ThrottleOutPacketType packType); 844 void OutPacket(Packet newPack, ThrottleOutPacketType packType);
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index b28a4a6..b2291bc 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -269,6 +269,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
269 269
270 private RequestObjectPropertiesFamily handlerObjectGroupRequest = null; 270 private RequestObjectPropertiesFamily handlerObjectGroupRequest = null;
271 private ScriptReset handlerScriptReset = null; 271 private ScriptReset handlerScriptReset = null;
272 private UpdateVector handlerAutoPilotGo = null;
272 273
273 /* Properties */ 274 /* Properties */
274 275
@@ -900,6 +901,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
900 public event EstateDebugRegionRequest OnEstateDebugRegionRequest; 901 public event EstateDebugRegionRequest OnEstateDebugRegionRequest;
901 public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest; 902 public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
902 public event ScriptReset OnScriptReset; 903 public event ScriptReset OnScriptReset;
904 public event UpdateVector OnAutoPilotGo;
903 905
904 #region Scene/Avatar to Client 906 #region Scene/Avatar to Client
905 907
@@ -1125,7 +1127,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1125 1127
1126 patches[0] = patchx + 0 + patchy * 16; 1128 patches[0] = patchx + 0 + patchy * 16;
1127 1129
1128 Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); 1130 LayerDataPacket layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches);
1129 layerpack.Header.Zerocoded = true; 1131 layerpack.Header.Zerocoded = true;
1130 OutPacket(layerpack, ThrottleOutPacketType.Land); 1132 OutPacket(layerpack, ThrottleOutPacketType.Land);
1131 } 1133 }
@@ -3966,7 +3968,50 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3966 get { return m_packetProcessingEnabled; } 3968 get { return m_packetProcessingEnabled; }
3967 set { m_packetProcessingEnabled = value; } 3969 set { m_packetProcessingEnabled = value; }
3968 } 3970 }
3971 public void DecipherGenericMessage(string gmMethod, LLUUID gmInvoice, GenericMessagePacket.ParamListBlock[] gmParams)
3972 {
3973 switch (gmMethod)
3974 {
3975 case "autopilot":
3976 float locx = 0f;
3977 float locy = 0f;
3978 float locz = 0f;
3979 uint regionX = 0;
3980 uint regionY = 0;
3981 try
3982
3983 {
3984 Helpers.LongToUInts(Scene.RegionInfo.RegionHandle,out regionX, out regionY);
3985 locx = Convert.ToSingle(Helpers.FieldToUTF8String(gmParams[0].Parameter)) - (float)regionX;
3986 locy = Convert.ToSingle(Helpers.FieldToUTF8String(gmParams[1].Parameter)) - (float)regionY;
3987 locz = Convert.ToSingle(Helpers.FieldToUTF8String(gmParams[2].Parameter));
3988 }
3989 catch (InvalidCastException)
3990 {
3991 m_log.Error("[CLIENT]: Invalid autopilot request");
3992 return;
3993 }
3994
3995 handlerAutoPilotGo = OnAutoPilotGo;
3996 if (handlerAutoPilotGo != null)
3997 {
3998 handlerAutoPilotGo(0, new LLVector3(locx, locy, locz), this);
3999 }
4000 m_log.InfoFormat("[CLIENT]: Client Requests autopilot to position <{0},{1},{2}>", locx, locy, locz);
3969 4001
4002
4003 break;
4004 default:
4005 m_log.Debug("[CLIENT]: Unknown Generic Message, Method: " + gmMethod + ". Invoice: " + gmInvoice.ToString() + ". Dumping Params:");
4006 for (int hi = 0; hi < gmParams.Length; hi++)
4007 {
4008 System.Console.WriteLine(gmParams[hi].ToString());
4009 }
4010 //gmpack.MethodData.
4011 break;
4012
4013 }
4014 }
3970 protected void ProcessInPacket(Packet Pack) 4015 protected void ProcessInPacket(Packet Pack)
3971 { 4016 {
3972 ack_pack(Pack); 4017 ack_pack(Pack);
@@ -3998,6 +4043,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3998 { 4043 {
3999 #region Scene/Avatar 4044 #region Scene/Avatar
4000 4045
4046 case PacketType.GenericMessage:
4047 GenericMessagePacket gmpack = (GenericMessagePacket)Pack;
4048
4049 DecipherGenericMessage(Helpers.FieldToUTF8String(gmpack.MethodData.Method),gmpack.MethodData.Invoice,gmpack.ParamList);
4050
4051 break;
4001 case PacketType.AvatarPropertiesRequest: 4052 case PacketType.AvatarPropertiesRequest:
4002 AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; 4053 AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack;
4003 4054
@@ -5933,10 +5984,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5933 // TODO: handle this packet 5984 // TODO: handle this packet
5934 m_log.Warn("[CLIENT]: unhandled CreateGroupRequest packet"); 5985 m_log.Warn("[CLIENT]: unhandled CreateGroupRequest packet");
5935 break; 5986 break;
5936 case PacketType.GenericMessage: 5987 //case PacketType.GenericMessage:
5937 // TODO: handle this packet 5988 // TODO: handle this packet
5938 m_log.Warn("[CLIENT]: unhandled GenericMessage packet"); 5989 //m_log.Warn("[CLIENT]: unhandled GenericMessage packet");
5939 break; 5990 //break;
5940 case PacketType.MapItemRequest: 5991 case PacketType.MapItemRequest:
5941 // TODO: handle this packet 5992 // TODO: handle this packet
5942 m_log.Warn("[CLIENT]: unhandled MapItemRequest packet"); 5993 m_log.Warn("[CLIENT]: unhandled MapItemRequest packet");
diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
index caa3b5c..b8ca482 100644
--- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
@@ -289,6 +289,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
289 public event EstateDebugRegionRequest OnEstateDebugRegionRequest; 289 public event EstateDebugRegionRequest OnEstateDebugRegionRequest;
290 public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest; 290 public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
291 public event ScriptReset OnScriptReset; 291 public event ScriptReset OnScriptReset;
292 public event UpdateVector OnAutoPilotGo;
292 293
293#pragma warning restore 67 294#pragma warning restore 67
294 #endregion 295 #endregion
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);
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 6825fbc..dcbbc68 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -194,7 +194,7 @@ namespace OpenSim.Region.Examples.SimpleModule
194 public event EstateDebugRegionRequest OnEstateDebugRegionRequest; 194 public event EstateDebugRegionRequest OnEstateDebugRegionRequest;
195 public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest; 195 public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
196 public event ScriptReset OnScriptReset; 196 public event ScriptReset OnScriptReset;
197 197 public event UpdateVector OnAutoPilotGo;
198 198
199#pragma warning restore 67 199#pragma warning restore 67
200 200