From ad002835d3ce2ad1eaf3d151a4403e1825d56b55 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Mon, 12 Nov 2007 20:25:59 +0000 Subject: enable typing animation for chat, maybe --- OpenSim/Region/Environment/Modules/ChatModule.cs | 124 ++++++++++++--------- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 21 +++- 2 files changed, 90 insertions(+), 55 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs index f12612e..d5edc6d 100644 --- a/OpenSim/Region/Environment/Modules/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/ChatModule.cs @@ -143,7 +143,6 @@ namespace OpenSim.Region.Environment.Modules new LLVector3(scene.RegionInfo.RegionLocX*256, scene.RegionInfo.RegionLocY*256, 0); fromName = avatar.Firstname + " " + avatar.Lastname; fromAgentID = e.Sender.AgentId; - avatar = null; } string typeName; @@ -166,82 +165,101 @@ namespace OpenSim.Region.Environment.Modules break; } - m_log.Verbose("CHAT", - fromName + " (" + e.Channel + " @ " + scene.RegionInfo.RegionName + ") " + typeName + ": " + - e.Message); - - if (m_irc.Connected) + if (e.Message.Length > 0) { - m_irc.PrivMsg(fromName, scene.RegionInfo.RegionName, e.Message); - } + m_log.Verbose("CHAT", + fromName + " (" + e.Channel + " @ " + scene.RegionInfo.RegionName + ") " + typeName + ": " + + e.Message); - if (e.Channel == 0) - { - foreach (Scene m_scene in m_scenes) + if (m_irc.Connected) { - m_scene.ForEachScenePresence(delegate(ScenePresence presence) + m_irc.PrivMsg(fromName, scene.RegionInfo.RegionName, e.Message); + } + + if (e.Channel == 0) + { + foreach (Scene m_scene in m_scenes) + { + m_scene.ForEachScenePresence(delegate(ScenePresence presence) { if (!presence.IsChildAgent) { int dis = -100000; LLVector3 avatarRegionPos = presence.AbsolutePosition + - new LLVector3( - scene.RegionInfo.RegionLocX * 256, - scene.RegionInfo.RegionLocY * 256, - 0); + new LLVector3( + scene.RegionInfo.RegionLocX * 256, + scene.RegionInfo.RegionLocY * 256, + 0); dis = Math.Abs((int)avatarRegionPos.GetDistanceTo(fromRegionPos)); switch (e.Type) { - case ChatTypeEnum.Whisper: - if (dis < m_whisperdistance) - { - //should change so the message is sent through the avatar rather than direct to the ClientView - presence.ControllingClient.SendChatMessage(message, - type, - fromPos, - fromName, - fromAgentID); - } - break; - case ChatTypeEnum.Say: - if (dis < m_saydistance) - { - //Console.WriteLine("sending chat"); - presence.ControllingClient.SendChatMessage(message, - type, - fromPos, - fromName, - fromAgentID); - } - break; - case ChatTypeEnum.Shout: - if (dis < m_shoutdistance) - { - presence.ControllingClient.SendChatMessage(message, - type, - fromPos, - fromName, - fromAgentID); - } - break; - - case ChatTypeEnum.Broadcast: + case ChatTypeEnum.Whisper: + if (dis < m_whisperdistance) + { + //should change so the message is sent through the avatar rather than direct to the ClientView + presence.ControllingClient.SendChatMessage(message, + type, + fromPos, + fromName, + fromAgentID); + } + break; + case ChatTypeEnum.Say: + if (dis < m_saydistance) + { + //Console.WriteLine("sending chat"); + presence.ControllingClient.SendChatMessage(message, + type, + fromPos, + fromName, + fromAgentID); + } + break; + case ChatTypeEnum.Shout: + if (dis < m_shoutdistance) + { presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName, fromAgentID); - break; - default: - break; + } + break; + + case ChatTypeEnum.Broadcast: + presence.ControllingClient.SendChatMessage(message, + type, + fromPos, + fromName, + fromAgentID); + break; + default: + break; } } }); + } } } + else + { + if (avatar != null) + { + switch (e.Type) + { + case ChatTypeEnum.StartTyping: + avatar.setTyping(true); + break; + case ChatTypeEnum.StopTyping: + avatar.setTyping(false); + break; + } + } + } + } } diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 76d307f..ab19973 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -53,6 +53,8 @@ namespace OpenSim.Region.Environment.Scenes private LLVector3 m_requestedSitOffset = new LLVector3(); private float m_sitAvatarHeight = 2.0f; + private bool m_isTyping = false; + private Quaternion m_bodyRot; private byte[] m_visualParams; private AvatarWearable[] m_wearables; @@ -367,7 +369,6 @@ namespace OpenSim.Region.Environment.Scenes AddToPhysicalScene(); m_physicsActor.Flying = isFlying; - m_scene.SendAllSceneObjectsToClient(this); } @@ -662,6 +663,10 @@ namespace OpenSim.Region.Environment.Scenes { SendAnimPack(Animations.AnimsLLUUID["CROUCH"], 1); } + else if (m_isTyping) + { + SendAnimPack(Animations.AnimsLLUUID["TYPE"], 1); + } else { SendAnimPack(Animations.AnimsLLUUID["STAND"], 1); @@ -670,7 +675,6 @@ namespace OpenSim.Region.Environment.Scenes } } - protected void AddNewMovement(Vector3 vec, Quaternion rotation) { if (m_isChildAgent) @@ -708,6 +712,19 @@ namespace OpenSim.Region.Environment.Scenes m_forcesList.Add(newVelocity); } + public void setTyping(bool typing) + { + if (m_isChildAgent) + { + MainLog.Instance.Warn("setTyping called on child agent"); + return; + } + + m_isTyping = typing; + + UpdateMovementAnimations(true); + } + #endregion #region Overridden Methods -- cgit v1.1