From 2787207aa287a60a3c7c06fad66d406180033ae2 Mon Sep 17 00:00:00 2001
From: BlueWall
Date: Fri, 19 Aug 2011 18:47:21 -0400
Subject: Add llRegionSayTo
llRegionSayTo(key target, integer channel, string messasge)
Allows messages to be sent region-wide
to a particular prim.
---
.../Scripting/WorldComm/WorldCommModule.cs | 21 +++++++++++++++++
OpenSim/Region/Framework/Interfaces/IWorldComm.cs | 20 ++++++++++++++++
.../Shared/Api/Implementation/LSL_Api.cs | 27 +++++++++++++++++-----
.../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 1 +
.../ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 5 ++++
5 files changed, 68 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
index d647e71..6917b14 100644
--- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
@@ -282,6 +282,27 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
}
}
+ // wComm.DeliverMessageTo(target, channelID, m_host.Name, m_host.UUID, text);
+ public void DeliverMessageTo(UUID target, int channel, string name, UUID id, string msg)
+ {
+ foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg))
+ {
+ // Dont process if this message is from yourself!
+ if (li.GetHostID().Equals(id))
+ continue;
+
+ SceneObjectPart sPart = m_scene.GetSceneObjectPart(li.GetHostID());
+ if (sPart == null)
+ continue;
+
+ if ( li.GetHostID().Equals(target))
+ {
+ QueueMessage(new ListenerInfo(li, name, id, msg));
+ return;
+ }
+ }
+ }
+
protected void QueueMessage(ListenerInfo li)
{
lock (m_pending.SyncRoot)
diff --git a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs
index 8da99a0..8f200ae 100644
--- a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs
+++ b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs
@@ -81,6 +81,26 @@ namespace OpenSim.Region.Framework.Interfaces
void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg);
///
+ /// Delivers the message to a specified object in the region.
+ ///
+ ///
+ /// Target.
+ ///
+ ///
+ /// Channel.
+ ///
+ ///
+ /// Name.
+ ///
+ ///
+ /// Identifier.
+ ///
+ ///
+ /// Message.
+ ///
+ void DeliverMessageTo(UUID target, int channel, string name, UUID id, string msg);
+
+ ///
/// Are there any listen events ready to be dispatched?
///
/// boolean indication
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index c84afee..25d7ad9 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -843,6 +843,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
wComm.DeliverMessage(ChatTypeEnum.Region, channelID, m_host.Name, m_host.UUID, text);
}
+ public void llRegionSayTo(string target, int channel, string msg)
+ {
+ if (channel == 0)
+ {
+ LSLError("Cannot use llRegionSay() on channel 0");
+ return;
+ }
+
+ if (msg.Length > 1023)
+ msg = msg.Substring(0, 1023);
+
+ m_host.AddScriptLPS(1);
+
+ UUID TargetID;
+ UUID.TryParse(target, out TargetID);
+
+ IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface();
+ if (wComm != null)
+ wComm.DeliverMessageTo(TargetID, channel, m_host.Name, m_host.UUID, msg);
+ }
+
public LSL_Integer llListen(int channelID, string name, string ID, string msg)
{
m_host.AddScriptLPS(1);
@@ -10486,12 +10507,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
NotImplemented("llGetUsedMemory");
}
- public void llRegionSayTo(LSL_Key target, LSL_Integer channel, LSL_String msg)
- {
- m_host.AddScriptLPS(1);
- NotImplemented("llRegionSayTo");
- }
-
public void llScriptProfiler(LSL_Integer flags)
{
m_host.AddScriptLPS(1);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index 27f9c84..4d7d60d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -271,6 +271,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void llPushObject(string target, LSL_Vector impulse, LSL_Vector ang_impulse, int local);
void llRefreshPrimURL();
void llRegionSay(int channelID, string text);
+ void llRegionSayTo(string target, int channelID, string text);
void llReleaseCamera(string avatar);
void llReleaseControls();
void llReleaseURL(string url);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index 303d75e..96e46fd 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -1199,6 +1199,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_LSL_Functions.llRegionSay(channelID, text);
}
+ public void llRegionSayTo(string key, int channelID, string text)
+ {
+ m_LSL_Functions.llRegionSayTo(key, channelID, text);
+ }
+
public void llReleaseCamera(string avatar)
{
m_LSL_Functions.llReleaseCamera(avatar);
--
cgit v1.1