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.0.7.6-extended
parent
329235d3b7
commit
ef10e10fd7
|
@ -44,6 +44,20 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
{
|
{
|
||||||
public bool SenseAsAgent { get; set; }
|
public bool SenseAsAgent { get; set; }
|
||||||
|
|
||||||
|
public delegate void ChatToNPC(
|
||||||
|
string message, byte type, Vector3 fromPos, string fromName,
|
||||||
|
UUID fromAgentID, UUID ownerID, byte source, byte audible);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fired when the NPC receives a chat message.
|
||||||
|
/// </summary>
|
||||||
|
public event ChatToNPC OnChatToNPC;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fired when the NPC receives an instant message.
|
||||||
|
/// </summary>
|
||||||
|
public event Action<GridInstantMessage> OnInstantMessageToNPC;
|
||||||
|
|
||||||
private readonly string m_firstname;
|
private readonly string m_firstname;
|
||||||
private readonly string m_lastname;
|
private readonly string m_lastname;
|
||||||
private readonly Vector3 m_startPos;
|
private readonly Vector3 m_startPos;
|
||||||
|
@ -614,17 +628,18 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
string message, byte type, Vector3 fromPos, string fromName,
|
string message, byte type, Vector3 fromPos, string fromName,
|
||||||
UUID fromAgentID, UUID ownerID, byte source, byte audible)
|
UUID fromAgentID, UUID ownerID, byte source, byte audible)
|
||||||
{
|
{
|
||||||
}
|
ChatToNPC ctn = OnChatToNPC;
|
||||||
|
|
||||||
public virtual void SendChatMessage(
|
if (ctn != null)
|
||||||
byte[] message, byte type, Vector3 fromPos, string fromName,
|
ctn(message, type, fromPos, fromName, fromAgentID, ownerID, source, audible);
|
||||||
UUID fromAgentID, UUID ownerID, byte source, byte audible)
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendInstantMessage(GridInstantMessage im)
|
public void SendInstantMessage(GridInstantMessage im)
|
||||||
{
|
{
|
||||||
|
Action<GridInstantMessage> oimtn = OnInstantMessageToNPC;
|
||||||
|
|
||||||
|
if (oimtn != null)
|
||||||
|
oimtn(im);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendGenericMessage(string method, UUID invoice, List<string> message)
|
public void SendGenericMessage(string method, UUID invoice, List<string> message)
|
||||||
|
|
Loading…
Reference in New Issue