aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJeff Ames2007-11-12 20:25:59 +0000
committerJeff Ames2007-11-12 20:25:59 +0000
commitad002835d3ce2ad1eaf3d151a4403e1825d56b55 (patch)
tree22f9d2a8b79482d7d1183bac9d49881dfe4fa5ad /OpenSim/Region
parentremoved obj directory from Region/Physics/Meshing (diff)
downloadopensim-SC-ad002835d3ce2ad1eaf3d151a4403e1825d56b55.zip
opensim-SC-ad002835d3ce2ad1eaf3d151a4403e1825d56b55.tar.gz
opensim-SC-ad002835d3ce2ad1eaf3d151a4403e1825d56b55.tar.bz2
opensim-SC-ad002835d3ce2ad1eaf3d151a4403e1825d56b55.tar.xz
enable typing animation for chat, maybe
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs6
-rw-r--r--OpenSim/Region/Environment/Modules/ChatModule.cs124
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs21
3 files changed, 91 insertions, 60 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
index 7414340..978f34e 100644
--- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
+++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
@@ -83,11 +83,7 @@ namespace OpenSim.Region.ClientStack
83 break; 83 break;
84 case PacketType.ChatFromViewer: 84 case PacketType.ChatFromViewer:
85 ChatFromViewerPacket inchatpack = (ChatFromViewerPacket) Pack; 85 ChatFromViewerPacket inchatpack = (ChatFromViewerPacket) Pack;
86 if (Helpers.FieldToUTF8String(inchatpack.ChatData.Message) == "") 86
87 {
88 //empty message so don't bother with it
89 break;
90 }
91 string fromName = ""; //ClientAvatar.firstname + " " + ClientAvatar.lastname; 87 string fromName = ""; //ClientAvatar.firstname + " " + ClientAvatar.lastname;
92 byte[] message = inchatpack.ChatData.Message; 88 byte[] message = inchatpack.ChatData.Message;
93 byte type = inchatpack.ChatData.Type; 89 byte type = inchatpack.ChatData.Type;
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
143 new LLVector3(scene.RegionInfo.RegionLocX*256, scene.RegionInfo.RegionLocY*256, 0); 143 new LLVector3(scene.RegionInfo.RegionLocX*256, scene.RegionInfo.RegionLocY*256, 0);
144 fromName = avatar.Firstname + " " + avatar.Lastname; 144 fromName = avatar.Firstname + " " + avatar.Lastname;
145 fromAgentID = e.Sender.AgentId; 145 fromAgentID = e.Sender.AgentId;
146 avatar = null;
147 } 146 }
148 147
149 string typeName; 148 string typeName;
@@ -166,82 +165,101 @@ namespace OpenSim.Region.Environment.Modules
166 break; 165 break;
167 } 166 }
168 167
169 m_log.Verbose("CHAT", 168 if (e.Message.Length > 0)
170 fromName + " (" + e.Channel + " @ " + scene.RegionInfo.RegionName + ") " + typeName + ": " +
171 e.Message);
172
173 if (m_irc.Connected)
174 { 169 {
175 m_irc.PrivMsg(fromName, scene.RegionInfo.RegionName, e.Message); 170 m_log.Verbose("CHAT",
176 } 171 fromName + " (" + e.Channel + " @ " + scene.RegionInfo.RegionName + ") " + typeName + ": " +
172 e.Message);
177 173
178 if (e.Channel == 0) 174 if (m_irc.Connected)
179 {
180 foreach (Scene m_scene in m_scenes)
181 { 175 {
182 m_scene.ForEachScenePresence(delegate(ScenePresence presence) 176 m_irc.PrivMsg(fromName, scene.RegionInfo.RegionName, e.Message);
177 }
178
179 if (e.Channel == 0)
180 {
181 foreach (Scene m_scene in m_scenes)
182 {
183 m_scene.ForEachScenePresence(delegate(ScenePresence presence)
183 { 184 {
184 if (!presence.IsChildAgent) 185 if (!presence.IsChildAgent)
185 { 186 {
186 int dis = -100000; 187 int dis = -100000;
187 188
188 LLVector3 avatarRegionPos = presence.AbsolutePosition + 189 LLVector3 avatarRegionPos = presence.AbsolutePosition +
189 new LLVector3( 190 new LLVector3(
190 scene.RegionInfo.RegionLocX * 256, 191 scene.RegionInfo.RegionLocX * 256,
191 scene.RegionInfo.RegionLocY * 256, 192 scene.RegionInfo.RegionLocY * 256,
192 0); 193 0);
193 dis = 194 dis =
194 Math.Abs((int)avatarRegionPos.GetDistanceTo(fromRegionPos)); 195 Math.Abs((int)avatarRegionPos.GetDistanceTo(fromRegionPos));
195 196
196 switch (e.Type) 197 switch (e.Type)
197 { 198 {
198 case ChatTypeEnum.Whisper: 199 case ChatTypeEnum.Whisper:
199 if (dis < m_whisperdistance) 200 if (dis < m_whisperdistance)
200 { 201 {
201 //should change so the message is sent through the avatar rather than direct to the ClientView 202 //should change so the message is sent through the avatar rather than direct to the ClientView
202 presence.ControllingClient.SendChatMessage(message, 203 presence.ControllingClient.SendChatMessage(message,
203 type, 204 type,
204 fromPos, 205 fromPos,
205 fromName, 206 fromName,
206 fromAgentID); 207 fromAgentID);
207 } 208 }
208 break; 209 break;
209 case ChatTypeEnum.Say: 210 case ChatTypeEnum.Say:
210 if (dis < m_saydistance) 211 if (dis < m_saydistance)
211 { 212 {
212 //Console.WriteLine("sending chat"); 213 //Console.WriteLine("sending chat");
213 presence.ControllingClient.SendChatMessage(message, 214 presence.ControllingClient.SendChatMessage(message,
214 type, 215 type,
215 fromPos, 216 fromPos,
216 fromName, 217 fromName,
217 fromAgentID); 218 fromAgentID);
218 } 219 }
219 break; 220 break;
220 case ChatTypeEnum.Shout: 221 case ChatTypeEnum.Shout:
221 if (dis < m_shoutdistance) 222 if (dis < m_shoutdistance)
222 { 223 {
223 presence.ControllingClient.SendChatMessage(message,
224 type,
225 fromPos,
226 fromName,
227 fromAgentID);
228 }
229 break;
230
231 case ChatTypeEnum.Broadcast:
232 presence.ControllingClient.SendChatMessage(message, 224 presence.ControllingClient.SendChatMessage(message,
233 type, 225 type,
234 fromPos, 226 fromPos,
235 fromName, 227 fromName,
236 fromAgentID); 228 fromAgentID);
237 break; 229 }
238 default: 230 break;
239 break; 231
232 case ChatTypeEnum.Broadcast:
233 presence.ControllingClient.SendChatMessage(message,
234 type,
235 fromPos,
236 fromName,
237 fromAgentID);
238 break;
239 default:
240 break;
240 } 241 }
241 } 242 }
242 }); 243 });
244 }
243 } 245 }
244 } 246 }
247 else
248 {
249 if (avatar != null)
250 {
251 switch (e.Type)
252 {
253 case ChatTypeEnum.StartTyping:
254 avatar.setTyping(true);
255 break;
256 case ChatTypeEnum.StopTyping:
257 avatar.setTyping(false);
258 break;
259 }
260 }
261 }
262
245 } 263 }
246 } 264 }
247 265
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
53 private LLVector3 m_requestedSitOffset = new LLVector3(); 53 private LLVector3 m_requestedSitOffset = new LLVector3();
54 private float m_sitAvatarHeight = 2.0f; 54 private float m_sitAvatarHeight = 2.0f;
55 55
56 private bool m_isTyping = false;
57
56 private Quaternion m_bodyRot; 58 private Quaternion m_bodyRot;
57 private byte[] m_visualParams; 59 private byte[] m_visualParams;
58 private AvatarWearable[] m_wearables; 60 private AvatarWearable[] m_wearables;
@@ -367,7 +369,6 @@ namespace OpenSim.Region.Environment.Scenes
367 AddToPhysicalScene(); 369 AddToPhysicalScene();
368 m_physicsActor.Flying = isFlying; 370 m_physicsActor.Flying = isFlying;
369 371
370
371 m_scene.SendAllSceneObjectsToClient(this); 372 m_scene.SendAllSceneObjectsToClient(this);
372 } 373 }
373 374
@@ -662,6 +663,10 @@ namespace OpenSim.Region.Environment.Scenes
662 { 663 {
663 SendAnimPack(Animations.AnimsLLUUID["CROUCH"], 1); 664 SendAnimPack(Animations.AnimsLLUUID["CROUCH"], 1);
664 } 665 }
666 else if (m_isTyping)
667 {
668 SendAnimPack(Animations.AnimsLLUUID["TYPE"], 1);
669 }
665 else 670 else
666 { 671 {
667 SendAnimPack(Animations.AnimsLLUUID["STAND"], 1); 672 SendAnimPack(Animations.AnimsLLUUID["STAND"], 1);
@@ -670,7 +675,6 @@ namespace OpenSim.Region.Environment.Scenes
670 } 675 }
671 } 676 }
672 677
673
674 protected void AddNewMovement(Vector3 vec, Quaternion rotation) 678 protected void AddNewMovement(Vector3 vec, Quaternion rotation)
675 { 679 {
676 if (m_isChildAgent) 680 if (m_isChildAgent)
@@ -708,6 +712,19 @@ namespace OpenSim.Region.Environment.Scenes
708 m_forcesList.Add(newVelocity); 712 m_forcesList.Add(newVelocity);
709 } 713 }
710 714
715 public void setTyping(bool typing)
716 {
717 if (m_isChildAgent)
718 {
719 MainLog.Instance.Warn("setTyping called on child agent");
720 return;
721 }
722
723 m_isTyping = typing;
724
725 UpdateMovementAnimations(true);
726 }
727
711 #endregion 728 #endregion
712 729
713 #region Overridden Methods 730 #region Overridden Methods