From c8ed9724437d9bf1972d4ef3e2b10dd9fa3e7e70 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 12 Jun 2010 01:25:25 +0100 Subject: [PATCH] Move "StopFlying()" into LLSpace. Try to reinstate the carefully crafted packet we used to send before slimupdates and explicitly send it --- .../Client/MXP/ClientStack/MXPClientView.cs | 4 ++ .../ClientStack/SirikataClientView.cs | 4 ++ .../VWoHTTP/ClientStack/VWHClientView.cs | 4 ++ OpenSim/Framework/IClientAPI.cs | 2 + .../ClientStack/LindenUDP/LLClientView.cs | 40 +++++++++++++++++++ .../Examples/SimpleModule/MyNpcCharacter.cs | 4 ++ .../Region/Framework/Scenes/ScenePresence.cs | 20 +--------- .../Server/IRCClientView.cs | 4 ++ .../OptionalModules/World/NPC/NPCAvatar.cs | 4 ++ OpenSim/Tests/Common/Mock/TestClient.cs | 4 ++ 10 files changed, 71 insertions(+), 19 deletions(-) diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index d742039115..fa1f0d8614 100644 --- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs +++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs @@ -1711,5 +1711,9 @@ namespace OpenSim.Client.MXP.ClientStack public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId) { } + + public void StopFlying(ISceneEntity presence) + { + } } } diff --git a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs index d725943197..cf7aaf2313 100644 --- a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs +++ b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs @@ -1199,6 +1199,10 @@ namespace OpenSim.Client.Sirikata.ClientStack { } + public void StopFlying(ISceneEntity presence) + { + } + #endregion } } diff --git a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs index 2eec844b9d..ab23484454 100644 --- a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs +++ b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs @@ -1214,5 +1214,9 @@ namespace OpenSim.Client.VWoHTTP.ClientStack public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId) { } + + public void StopFlying(ISceneEntity presence) + { + } } } diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index c1333fc285..556a53260b 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1308,5 +1308,7 @@ namespace OpenSim.Framework void SendChangeUserRights(UUID agentID, UUID friendID, int rights); void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId); + + void StopFlying(ISceneEntity presence); } } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index fc5bb28398..85a313314d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -11843,5 +11843,45 @@ namespace OpenSim.Region.ClientStack.LindenUDP dialog.Buttons = buttons; OutPacket(dialog, ThrottleOutPacketType.Task); } + + public void StopFlying(ISceneEntity p) + { + ScenePresence presence = p as ScenePresence; + // It turns out to get the agent to stop flying, you have to feed it stop flying velocities + // There's no explicit message to send the client to tell it to stop flying.. it relies on the + // velocity, collision plane and avatar height + + // Add 1/6 the avatar's height to it's position so it doesn't shoot into the air + // when the avatar stands up + + Vector3 pos = presence.AbsolutePosition; + + if (presence.Appearance.AvatarHeight != 127.0f) + pos += new Vector3(0f, 0f, (presence.Appearance.AvatarHeight / 6f)); + else + pos += new Vector3(0f, 0f, (1.56f / 6f)); + + presence.AbsolutePosition = pos; + + ImprovedTerseObjectUpdatePacket.ObjectDataBlock block = + CreateImprovedTerseBlock(p, false); + + const float TIME_DILATION = 1.0f; + ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f); + + + ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); + packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; + packet.RegionData.TimeDilation = timeDilation; + packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; + + packet.ObjectData[0] = block; + + OutPacket(packet, ThrottleOutPacketType.Task, true); + + //ControllingClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, + // AbsolutePosition, Velocity, Vector3.Zero, m_bodyRot, new Vector4(0,0,1,AbsolutePosition.Z - 0.5f), m_uuid, null, GetUpdatePriority(ControllingClient))); + + } } } diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 2681d4fcf3..af9df45bf7 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -1155,5 +1155,9 @@ namespace OpenSim.Region.Examples.SimpleModule public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId) { } + + public void StopFlying(ISceneEntity presence) + { + } } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 15b9446c91..c1e835e85a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1015,25 +1015,7 @@ namespace OpenSim.Region.Framework.Scenes public void StopFlying() { - // It turns out to get the agent to stop flying, you have to feed it stop flying velocities - // There's no explicit message to send the client to tell it to stop flying.. it relies on the - // velocity, collision plane and avatar height - - // Add 1/6 the avatar's height to it's position so it doesn't shoot into the air - // when the avatar stands up - - if (m_avHeight != 127.0f) - { - AbsolutePosition = AbsolutePosition + new Vector3(0f, 0f, (m_avHeight / 6f)); - } - else - { - AbsolutePosition = AbsolutePosition + new Vector3(0f, 0f, (1.56f / 6f)); - } - - ControllingClient.SendPrimUpdate(this, PrimUpdateFlags.Position); - //ControllingClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, - // AbsolutePosition, Velocity, Vector3.Zero, m_bodyRot, new Vector4(0,0,1,AbsolutePosition.Z - 0.5f), m_uuid, null, GetUpdatePriority(ControllingClient))); + ControllingClient.StopFlying(this); } public void AddNeighbourRegion(ulong regionHandle, string cap) diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 7453eae63e..754b925bb8 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -1680,5 +1680,9 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId) { } + + public void StopFlying(ISceneEntity presence) + { + } } } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 146b3d6f32..12d6643e23 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -1162,5 +1162,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId) { } + + public void StopFlying(ISceneEntity presence) + { + } } } diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 94d9d72b02..496cfb854b 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -1216,5 +1216,9 @@ namespace OpenSim.Tests.Common.Mock public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId) { } + + public void StopFlying(ISceneEntity presence) + { + } } }