aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorUbitUmarov2012-06-29 01:00:38 +0100
committerUbitUmarov2012-06-29 01:00:38 +0100
commit58b44171404a8a52a434e53ee437c670b226e3ac (patch)
treec87b1c20a3e3deeee56c33719ca8abed96499bdf /OpenSim/Region
parent reactivate physics raycasts on llCastRay() until it's clear what is its prob... (diff)
parentFix llRegionSayTo the right way (diff)
downloadopensim-SC-58b44171404a8a52a434e53ee437c670b226e3ac.zip
opensim-SC-58b44171404a8a52a434e53ee437c670b226e3ac.tar.gz
opensim-SC-58b44171404a8a52a434e53ee437c670b226e3ac.tar.bz2
opensim-SC-58b44171404a8a52a434e53ee437c670b226e3ac.tar.xz
Merge branch 'avination' into ubitwork
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs11
-rw-r--r--OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs19
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs11
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Helpers.cs2
4 files changed, 32 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
index 4d8fb90..357c2af 100644
--- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
@@ -199,6 +199,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
199 UUID fromID = UUID.Zero; 199 UUID fromID = UUID.Zero;
200 string message = c.Message; 200 string message = c.Message;
201 IScene scene = c.Scene; 201 IScene scene = c.Scene;
202 UUID destination = c.Destination;
202 Vector3 fromPos = c.Position; 203 Vector3 fromPos = c.Position;
203 Vector3 regionPos = new Vector3(scene.RegionInfo.RegionLocX * Constants.RegionSize, 204 Vector3 regionPos = new Vector3(scene.RegionInfo.RegionLocX * Constants.RegionSize,
204 scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); 205 scene.RegionInfo.RegionLocY * Constants.RegionSize, 0);
@@ -222,6 +223,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
222 { 223 {
223 fromNamePrefix = m_adminPrefix; 224 fromNamePrefix = m_adminPrefix;
224 } 225 }
226 destination = UUID.Zero; // Avatars cant "SayTo"
225 break; 227 break;
226 228
227 case ChatSourceType.Object: 229 case ChatSourceType.Object:
@@ -244,9 +246,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
244 { 246 {
245 // This should use ForEachClient, but clients don't have a position. 247 // This should use ForEachClient, but clients don't have a position.
246 // If camera is moved into client, then camera position can be used 248 // If camera is moved into client, then camera position can be used
249 // MT: No, it can't, as chat is heard from the avatar position, not
250 // the camera position.
247 s.ForEachRootScenePresence( 251 s.ForEachRootScenePresence(
248 delegate(ScenePresence presence) 252 delegate(ScenePresence presence)
249 { 253 {
254 if (destination != UUID.Zero && presence.UUID != destination)
255 return;
250 ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); 256 ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y);
251 if (Presencecheck != null) 257 if (Presencecheck != null)
252 { 258 {
@@ -346,8 +352,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
346 UUID fromAgentID, string fromName, ChatTypeEnum type, 352 UUID fromAgentID, string fromName, ChatTypeEnum type,
347 string message, ChatSourceType src) 353 string message, ChatSourceType src)
348 { 354 {
349 // don't send stuff to child agents 355 // don't send llRegionSay to child agents. Send normal chat because you
350 if (presence.IsChildAgent) return false; 356 // can't talk across sim borders if it's not done
357 if (type == ChatTypeEnum.Broadcast && presence.IsChildAgent) return false;
351 358
352 Vector3 fromRegionPos = fromPos + regionPos; 359 Vector3 fromRegionPos = fromPos + regionPos;
353 Vector3 toRegionPos = presence.AbsolutePosition + 360 Vector3 toRegionPos = presence.AbsolutePosition +
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
index 176c86d..07bb291 100644
--- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
@@ -90,6 +90,8 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
90 // private static readonly ILog m_log = 90 // private static readonly ILog m_log =
91 // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 91 // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
92 92
93 private const int DEBUG_CHANNEL = 2147483647;
94
93 private ListenerManager m_listenerManager; 95 private ListenerManager m_listenerManager;
94 private Queue m_pending; 96 private Queue m_pending;
95 private Queue m_pendingQ; 97 private Queue m_pendingQ;
@@ -311,6 +313,10 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
311 public bool DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg, out string error) 313 public bool DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg, out string error)
312 { 314 {
313 error = null; 315 error = null;
316
317 if (channel == DEBUG_CHANNEL)
318 return true;
319
314 // Is id an avatar? 320 // Is id an avatar?
315 ScenePresence sp = m_scene.GetScenePresence(target); 321 ScenePresence sp = m_scene.GetScenePresence(target);
316 322
@@ -319,7 +325,9 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
319 // Send message to avatar 325 // Send message to avatar
320 if (channel == 0) 326 if (channel == 0)
321 { 327 {
322 m_scene.SimChatBroadcast(Utils.StringToBytes(msg), ChatTypeEnum.Broadcast, 0, pos, name, id, false); 328 // Channel 0 goes to viewer ONLY
329 m_scene.SimChat(Utils.StringToBytes(msg), ChatTypeEnum.Broadcast, 0, pos, name, id, false, false, target);
330 return true;
323 } 331 }
324 332
325 List<SceneObjectGroup> attachments = sp.GetAttachments(); 333 List<SceneObjectGroup> attachments = sp.GetAttachments();
@@ -351,12 +359,9 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
351 return true; 359 return true;
352 } 360 }
353 361
354 // Need to toss an error here 362 SceneObjectPart part = m_scene.GetSceneObjectPart(target);
355 if (channel == 0) 363 if (part == null) // Not even an object
356 { 364 return true; // No error
357 error = "Cannot use llRegionSayTo to message objects on channel 0";
358 return false;
359 }
360 365
361 foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) 366 foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg))
362 { 367 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 3ef1e29..431b903 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -38,8 +38,8 @@ namespace OpenSim.Region.Framework.Scenes
38{ 38{
39 public partial class Scene 39 public partial class Scene
40 { 40 {
41 protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName, 41 public void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName,
42 UUID fromID, bool fromAgent, bool broadcast) 42 UUID fromID, bool fromAgent, bool broadcast, UUID destination)
43 { 43 {
44 OSChatMessage args = new OSChatMessage(); 44 OSChatMessage args = new OSChatMessage();
45 45
@@ -49,6 +49,7 @@ namespace OpenSim.Region.Framework.Scenes
49 args.Position = fromPos; 49 args.Position = fromPos;
50 args.SenderUUID = fromID; 50 args.SenderUUID = fromID;
51 args.Scene = this; 51 args.Scene = this;
52 args.Destination = destination;
52 53
53 if (fromAgent) 54 if (fromAgent)
54 { 55 {
@@ -71,6 +72,12 @@ namespace OpenSim.Region.Framework.Scenes
71 EventManager.TriggerOnChatFromWorld(this, args); 72 EventManager.TriggerOnChatFromWorld(this, args);
72 } 73 }
73 74
75 protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName,
76 UUID fromID, bool fromAgent, bool broadcast)
77 {
78 SimChat(message, type, channel, fromPos, fromName, fromID, fromAgent, broadcast, UUID.Zero);
79 }
80
74 /// <summary> 81 /// <summary>
75 /// 82 ///
76 /// </summary> 83 /// </summary>
diff --git a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
index 7e7e278..5c9d30f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
@@ -197,6 +197,8 @@ namespace OpenSim.Region.ScriptEngine.Shared
197 presence.Velocity.Z); 197 presence.Velocity.Z);
198 198
199 Type = 0x01; // Avatar 199 Type = 0x01; // Avatar
200 if (presence.PresenceType == PresenceType.Npc)
201 Type = 0x20;
200 if (presence.Velocity != Vector3.Zero) 202 if (presence.Velocity != Vector3.Zero)
201 Type |= 0x02; // Active 203 Type |= 0x02; // Active
202 204