diff options
author | Justin Clark-Casey (justincc) | 2013-10-04 19:40:43 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-10-04 19:40:43 +0100 |
commit | 970249a3c7b1d9cffe88eb8d7075cce6fa8ca3d9 (patch) | |
tree | be19e076451c41436ac0fbcd0a29d4879e1fc475 /OpenSim | |
parent | minor: Disable logging left active on regression test TestSameSimulatorIsolat... (diff) | |
download | opensim-SC-970249a3c7b1d9cffe88eb8d7075cce6fa8ca3d9.zip opensim-SC-970249a3c7b1d9cffe88eb8d7075cce6fa8ca3d9.tar.gz opensim-SC-970249a3c7b1d9cffe88eb8d7075cce6fa8ca3d9.tar.bz2 opensim-SC-970249a3c7b1d9cffe88eb8d7075cce6fa8ca3d9.tar.xz |
Add OnChatToNPC and OnInstantMessageToNPC messages to NPCAvatar to allow region modules to directly subscribe to chat and messages received by NPCs
Currently still requires INPC from NPCModule.GetNPC() to be cast to an NPCAvatar.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 9a61702..a895ee1 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | |||
@@ -44,6 +44,20 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
44 | { | 44 | { |
45 | public bool SenseAsAgent { get; set; } | 45 | public bool SenseAsAgent { get; set; } |
46 | 46 | ||
47 | public delegate void ChatToNPC( | ||
48 | string message, byte type, Vector3 fromPos, string fromName, | ||
49 | UUID fromAgentID, UUID ownerID, byte source, byte audible); | ||
50 | |||
51 | /// <summary> | ||
52 | /// Fired when the NPC receives a chat message. | ||
53 | /// </summary> | ||
54 | public event ChatToNPC OnChatToNPC; | ||
55 | |||
56 | /// <summary> | ||
57 | /// Fired when the NPC receives an instant message. | ||
58 | /// </summary> | ||
59 | public event Action<GridInstantMessage> OnInstantMessageToNPC; | ||
60 | |||
47 | private readonly string m_firstname; | 61 | private readonly string m_firstname; |
48 | private readonly string m_lastname; | 62 | private readonly string m_lastname; |
49 | private readonly Vector3 m_startPos; | 63 | private readonly Vector3 m_startPos; |
@@ -614,17 +628,18 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
614 | string message, byte type, Vector3 fromPos, string fromName, | 628 | string message, byte type, Vector3 fromPos, string fromName, |
615 | UUID fromAgentID, UUID ownerID, byte source, byte audible) | 629 | UUID fromAgentID, UUID ownerID, byte source, byte audible) |
616 | { | 630 | { |
617 | } | 631 | ChatToNPC ctn = OnChatToNPC; |
618 | 632 | ||
619 | public virtual void SendChatMessage( | 633 | if (ctn != null) |
620 | byte[] message, byte type, Vector3 fromPos, string fromName, | 634 | ctn(message, type, fromPos, fromName, fromAgentID, ownerID, source, audible); |
621 | UUID fromAgentID, UUID ownerID, byte source, byte audible) | ||
622 | { | ||
623 | } | 635 | } |
624 | 636 | ||
625 | public void SendInstantMessage(GridInstantMessage im) | 637 | public void SendInstantMessage(GridInstantMessage im) |
626 | { | 638 | { |
627 | 639 | Action<GridInstantMessage> oimtn = OnInstantMessageToNPC; | |
640 | |||
641 | if (oimtn != null) | ||
642 | oimtn(im); | ||
628 | } | 643 | } |
629 | 644 | ||
630 | public void SendGenericMessage(string method, UUID invoice, List<string> message) | 645 | public void SendGenericMessage(string method, UUID invoice, List<string> message) |