From 0881840946019caddffd89311416606e19c3cf3b Mon Sep 17 00:00:00 2001 From: Bill Blight Date: Mon, 10 Dec 2018 21:52:36 -0800 Subject: Add osNpcSayTo(key npc, key target, integer channel, string message) Signed-off-by: UbitUmarov --- .../Shared/Api/Implementation/OSSL_Api.cs | 26 ++++++++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 6 +++-- 3 files changed, 31 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 969347a..7c43b6a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3164,7 +3164,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api module.Say(npcId, World, message, channel); } } + + public void osNpcSayTo(LSL_Key npc, string target, int channel, string msg) + { + CheckThreatLevel(ThreatLevel.High, "osNpcSayTo"); + INPCModule module = World.RequestModuleInterface(); + if (module != null) + { + UUID npcId = new UUID(npc.m_string); + + if (!module.CheckPermissions(npcId, m_host.OwnerID)) + return; + + ScenePresence NPCpresence = World.GetScenePresence(npcId); + if (NPCpresence == null || NPCpresence.IsDeleted) + return; + + Vector3 npcPOS = NPCpresence.AbsolutePosition; + string npcNAME = NPCpresence.Name; + UUID TargetID; + UUID.TryParse(target, out TargetID); + + IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); + if (wComm != null) + wComm.DeliverMessageTo(TargetID, channel, npcPOS, npcNAME, npcId, msg); + } + } public void osNpcShout(LSL_Key npc, int channel, string message) { CheckThreatLevel(ThreatLevel.High, "osNpcShout"); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index cfdc7d5..2f800bc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -358,6 +358,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osNpcSetProfileImage(LSL_Key npc, string image); void osNpcSay(key npc, string message); void osNpcSay(key npc, int channel, string message); + void osNpcSayTo(LSL_Key npc, string target, int channel, string msg); void osNpcShout(key npc, int channel, string message); void osNpcSit(key npc, key target, int options); void osNpcStand(LSL_Key npc); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index a55dc77..ba899b0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -682,8 +682,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { m_OSSL_Functions.osNpcSay(npc, channel, message); } - - + public void osNpcSayTo(LSL_Key npc, string target, int channel, string msg) + { + m_OSSL_Functions.osNpcSayTo(npc, target, channel, msg); + } public void osNpcShout(key npc, int channel, string message) { m_OSSL_Functions.osNpcShout(npc, channel, message); -- cgit v1.1