diff options
author | Adam Frisby | 2007-10-19 23:27:54 +0000 |
---|---|---|
committer | Adam Frisby | 2007-10-19 23:27:54 +0000 |
commit | f364a084f1ae72c9c52393267052d061df5328e3 (patch) | |
tree | 49d8f357c3e3afa08be897545be39a3c1409f154 | |
parent | * ChatModule is now shared between all scenes. (May be buggy.) (diff) | |
download | opensim-SC_OLD-f364a084f1ae72c9c52393267052d061df5328e3.zip opensim-SC_OLD-f364a084f1ae72c9c52393267052d061df5328e3.tar.gz opensim-SC_OLD-f364a084f1ae72c9c52393267052d061df5328e3.tar.bz2 opensim-SC_OLD-f364a084f1ae72c9c52393267052d061df5328e3.tar.xz |
* Cross-border region chat should now work as long as both regions are part of the same simulator.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Modules/ChatModule.cs | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs index 3b08db3..b6bbdb7 100644 --- a/OpenSim/Region/Environment/Modules/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/ChatModule.cs | |||
@@ -196,7 +196,8 @@ namespace OpenSim.Region.Environment.Modules | |||
196 | scene = m_scenes[0]; | 196 | scene = m_scenes[0]; |
197 | 197 | ||
198 | // Filled in since it's easier than rewriting right now. | 198 | // Filled in since it's easier than rewriting right now. |
199 | LLVector3 fromPos = e.Position; | 199 | LLVector3 fromPos = e.Position; |
200 | LLVector3 fromRegionPos = e.Position + new LLVector3(e.Scene.RegionInfo.RegionLocX * 256, e.Scene.RegionInfo.RegionLocY * 256, 0); | ||
200 | string fromName = e.From; | 201 | string fromName = e.From; |
201 | string message = e.Message; | 202 | string message = e.Message; |
202 | byte type = (byte)e.Type; | 203 | byte type = (byte)e.Type; |
@@ -240,64 +241,63 @@ namespace OpenSim.Region.Environment.Modules | |||
240 | m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + " in " + scene.RegionInfo.RegionName + ">: " + | 241 | m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + " in " + scene.RegionInfo.RegionName + ">: " + |
241 | e.Message); | 242 | e.Message); |
242 | m_ircWriter.Flush(); | 243 | m_ircWriter.Flush(); |
243 | } | 244 | } |
244 | 245 | ||
245 | if (e.Channel == 0) | 246 | if (e.Channel == 0) |
246 | { | 247 | { |
247 | scene.ForEachScenePresence(delegate(ScenePresence presence) | 248 | foreach (Scene m_scene in m_scenes) |
248 | { | 249 | { |
249 | int dis = -1000; | 250 | m_scene.ForEachScenePresence(delegate(ScenePresence presence) |
250 | 251 | { | |
251 | //err ??? the following code seems to be request a scenePresence when it already has a ref to it | 252 | int dis = -100000; |
252 | avatar = scene.GetScenePresence(presence.ControllingClient.AgentId); | 253 | |
253 | if (avatar != null) | 254 | LLVector3 avatarRegionPos = presence.AbsolutePosition + new LLVector3(scene.RegionInfo.RegionLocX * 256, scene.RegionInfo.RegionLocY * 256, 0); |
254 | { | 255 | dis = (int)avatarRegionPos.GetDistanceTo(fromRegionPos); |
255 | dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos); | 256 | |
256 | } | 257 | switch (e.Type) |
257 | 258 | { | |
258 | switch (e.Type) | 259 | case ChatTypeEnum.Whisper: |
259 | { | 260 | if ((dis < 10) && (dis > -10)) |
260 | case ChatTypeEnum.Whisper: | 261 | { |
261 | if ((dis < 10) && (dis > -10)) | 262 | //should change so the message is sent through the avatar rather than direct to the ClientView |
262 | { | 263 | presence.ControllingClient.SendChatMessage(message, |
263 | //should change so the message is sent through the avatar rather than direct to the ClientView | 264 | type, |
264 | presence.ControllingClient.SendChatMessage(message, | 265 | fromPos, |
265 | type, | 266 | fromName, |
266 | fromPos, | 267 | fromAgentID); |
267 | fromName, | 268 | } |
268 | fromAgentID); | 269 | break; |
269 | } | 270 | case ChatTypeEnum.Say: |
270 | break; | 271 | if ((dis < 30) && (dis > -30)) |
271 | case ChatTypeEnum.Say: | 272 | { |
272 | if ((dis < 30) && (dis > -30)) | 273 | //Console.WriteLine("sending chat"); |
273 | { | 274 | presence.ControllingClient.SendChatMessage(message, |
274 | //Console.WriteLine("sending chat"); | 275 | type, |
275 | presence.ControllingClient.SendChatMessage(message, | 276 | fromPos, |
276 | type, | 277 | fromName, |
277 | fromPos, | 278 | fromAgentID); |
278 | fromName, | 279 | } |
279 | fromAgentID); | 280 | break; |
280 | } | 281 | case ChatTypeEnum.Shout: |
281 | break; | 282 | if ((dis < 100) && (dis > -100)) |
282 | case ChatTypeEnum.Shout: | 283 | { |
283 | if ((dis < 100) && (dis > -100)) | 284 | presence.ControllingClient.SendChatMessage(message, |
284 | { | 285 | type, |
285 | presence.ControllingClient.SendChatMessage(message, | 286 | fromPos, |
286 | type, | 287 | fromName, |
287 | fromPos, | 288 | fromAgentID); |
288 | fromName, | 289 | } |
289 | fromAgentID); | 290 | break; |
290 | } | 291 | |
291 | break; | 292 | case ChatTypeEnum.Broadcast: |
292 | 293 | presence.ControllingClient.SendChatMessage(message, type, | |
293 | case ChatTypeEnum.Broadcast: | 294 | fromPos, |
294 | presence.ControllingClient.SendChatMessage(message, type, | 295 | fromName, |
295 | fromPos, | 296 | fromAgentID); |
296 | fromName, | 297 | break; |
297 | fromAgentID); | 298 | } |
298 | break; | 299 | }); |
299 | } | 300 | } |
300 | }); | ||
301 | } | 301 | } |
302 | } | 302 | } |
303 | } | 303 | } |