Enabled chats from scripted objects to be propogated to other objects and avatars.
parent
4bb99b3df5
commit
7eb9affbd3
|
@ -853,6 +853,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
case SymmetricSyncMessage.MsgType.UpdateScript:
|
||||
case SymmetricSyncMessage.MsgType.ScriptReset:
|
||||
case SymmetricSyncMessage.MsgType.ChatFromClient:
|
||||
case SymmetricSyncMessage.MsgType.ChatFromWorld:
|
||||
{
|
||||
HandleRemoteEvent(msg);
|
||||
return;
|
||||
|
@ -1007,6 +1008,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
case SymmetricSyncMessage.MsgType.ChatFromClient:
|
||||
HandleRemoteEvent_OnChatFromClient(init_actorID, evSeqNum, data);
|
||||
break;
|
||||
case SymmetricSyncMessage.MsgType.ChatFromWorld:
|
||||
HandleRemoteEvent_OnChatFromWorld(init_actorID, evSeqNum, data);
|
||||
break;
|
||||
}
|
||||
|
||||
//if this is a relay node, forwards the event
|
||||
|
@ -1075,27 +1079,30 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
ScenePresence sp;
|
||||
m_scene.TryGetScenePresence(id, out sp);
|
||||
|
||||
|
||||
//m_scene.EventManager.TriggerOnChatFromClientLocally(sp, args);
|
||||
|
||||
m_scene.EventManager.TriggerOnChatFromWorldLocally(sp, args);
|
||||
/*
|
||||
if (sp != null)
|
||||
{
|
||||
args.Sender = sp.ControllingClient;
|
||||
args.SenderUUID = id;
|
||||
m_scene.EventManager.TriggerOnChatBroadcastLocally(sp.ControllingClient, args);
|
||||
}
|
||||
else
|
||||
{
|
||||
args.Sender = null;
|
||||
args.SenderUUID = id;
|
||||
m_scene.EventManager.TriggerOnChatFromWorldLocally(null, args);
|
||||
}
|
||||
* */
|
||||
//m_scene.EventManager
|
||||
m_scene.EventManager.TriggerOnChatFromClientLocally(sp, args); //Let WorldCommModule and other modules to catch the event
|
||||
m_scene.EventManager.TriggerOnChatFromWorldLocally(sp, args); //This is to let ChatModule to get the event and deliver it to avatars
|
||||
}
|
||||
|
||||
private void HandleRemoteEvent_OnChatFromWorld(string actorID, ulong evSeqNum, OSDMap data)
|
||||
{
|
||||
m_log.Debug(LogHeader + ", " + m_actorID + ": received ChatFromWorld from " + actorID + ", seq " + evSeqNum);
|
||||
|
||||
OSChatMessage args = new OSChatMessage();
|
||||
args.Channel = data["channel"].AsInteger();
|
||||
args.Message = data["msg"].AsString();
|
||||
args.Position = data["pos"].AsVector3();
|
||||
args.From = data["name"].AsString();
|
||||
UUID id = data["id"].AsUUID();
|
||||
args.Scene = m_scene;
|
||||
//args.Type = ChatTypeEnum.Say;
|
||||
args.Type = (ChatTypeEnum)data["type"].AsInteger();
|
||||
//ScenePresence sp;
|
||||
//m_scene.TryGetScenePresence(id, out sp);
|
||||
|
||||
m_scene.EventManager.TriggerOnChatFromWorldLocally(m_scene, args);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Send a sync message to remove the given objects in all connected actors, if this is a relay node.
|
||||
/// UUID is used for identified a removed object.
|
||||
|
@ -1149,6 +1156,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
}
|
||||
OnLocalChatFromClient(evArgs[0], (OSChatMessage)evArgs[1]);
|
||||
return;
|
||||
case EventManager.EventNames.ChatFromWorld:
|
||||
if (evArgs.Length < 2)
|
||||
{
|
||||
m_log.Error(LogHeader + " not enough event args for ChatFromWorld");
|
||||
return;
|
||||
}
|
||||
OnLocalChatFromWorld(evArgs[0], (OSChatMessage)evArgs[1]);
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
@ -1211,13 +1226,26 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
data["channel"] = OSD.FromInteger(chat.Channel);
|
||||
data["msg"] = OSD.FromString(chat.Message);
|
||||
data["pos"] = OSD.FromVector3(chat.Position);
|
||||
//data["name"] = OSD.FromString(chat.From);
|
||||
data["name"] = OSD.FromString(avatar.Name);
|
||||
data["name"] = OSD.FromString(avatar.Name); //note this is different from OnLocalChatFromWorld
|
||||
data["id"] = OSD.FromUUID(chat.SenderUUID);
|
||||
data["type"] = OSD.FromInteger((int)chat.Type);
|
||||
SendSceneEvent(SymmetricSyncMessage.MsgType.ChatFromClient, data);
|
||||
}
|
||||
|
||||
|
||||
private void OnLocalChatFromWorld(Object sender, OSChatMessage chat)
|
||||
{
|
||||
|
||||
OSDMap data = new OSDMap();
|
||||
data["channel"] = OSD.FromInteger(chat.Channel);
|
||||
data["msg"] = OSD.FromString(chat.Message);
|
||||
data["pos"] = OSD.FromVector3(chat.Position);
|
||||
data["name"] = OSD.FromString(chat.From); //note this is different from OnLocalChatFromClient
|
||||
data["id"] = OSD.FromUUID(chat.SenderUUID);
|
||||
data["type"] = OSD.FromInteger((int)chat.Type);
|
||||
SendSceneEvent(SymmetricSyncMessage.MsgType.ChatFromWorld, data);
|
||||
}
|
||||
|
||||
private void SendSceneEvent(SymmetricSyncMessage.MsgType msgType, OSDMap data)
|
||||
{
|
||||
data["actorID"] = OSD.FromString(m_actorID);
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
UpdateScript,
|
||||
ScriptReset,
|
||||
ChatFromClient,
|
||||
ChatFromWorld,
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -34,8 +34,8 @@ using OpenSim.Framework;
|
|||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
// using log4net;
|
||||
// using System.Reflection;
|
||||
using log4net;
|
||||
using System.Reflection;
|
||||
|
||||
|
||||
/*****************************************************
|
||||
|
@ -98,6 +98,8 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
|
|||
private int m_saydistance = 30;
|
||||
private int m_shoutdistance = 100;
|
||||
|
||||
private ILog m_log;
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
|
@ -126,7 +128,9 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
|
|||
m_scene.EventManager.OnChatFromClient += DeliverClientMessage;
|
||||
m_scene.EventManager.OnChatBroadcast += DeliverClientMessage;
|
||||
//SYMMETRIC SYNC
|
||||
m_scene.EventManager.OnChatFromWorld += DeliverClientMessage;
|
||||
//m_scene.EventManager.OnChatFromWorld += DeliverClientMessage;
|
||||
//Kitty: temp debug
|
||||
m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
//end SYMMETRIC SYNC
|
||||
m_pendingQ = new Queue();
|
||||
m_pending = Queue.Synchronized(m_pendingQ);
|
||||
|
@ -244,8 +248,8 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
|
|||
/// <param name="msg">msg to sent</param>
|
||||
public void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg, Vector3 position)
|
||||
{
|
||||
// m_log.DebugFormat("[WorldComm] got[2] type {0}, channel {1}, name {2}, id {3}, msg {4}",
|
||||
// type, channel, name, id, msg);
|
||||
m_log.DebugFormat("[WorldComm] got[2] type {0}, channel {1}, name {2}, id {3}, msg {4}",
|
||||
type, channel, name, id, msg);
|
||||
|
||||
// Determine which listen event filters match the given set of arguments, this results
|
||||
// in a limited set of listeners, each belonging a host. If the host is in range, add them
|
||||
|
|
|
@ -52,7 +52,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
UpdateScript,
|
||||
ScriptReset,
|
||||
ChatFromClient,
|
||||
ChatFromClient, //chats from avatars
|
||||
ChatFromWorld, //chats from objects
|
||||
}
|
||||
|
||||
public EventManager(Scene scene)
|
||||
|
@ -128,10 +129,25 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
base.TriggerOnChatBroadcast(sender, chat);
|
||||
}
|
||||
|
||||
#region ChatFromWorld
|
||||
|
||||
public override void TriggerOnChatFromWorld(Object sender, OSChatMessage chat)
|
||||
{
|
||||
if (m_scene.RegionSyncModule != null)
|
||||
{
|
||||
Object[] eventArgs = new Object[2];
|
||||
eventArgs[0] = sender;
|
||||
eventArgs[1] = (Object)chat;
|
||||
m_scene.RegionSyncModule.PublishSceneEvent(EventNames.ChatFromWorld, eventArgs);
|
||||
}
|
||||
TriggerOnChatFromWorldLocally(sender, chat);
|
||||
}
|
||||
|
||||
public void TriggerOnChatFromWorldLocally(Object sender, OSChatMessage chat)
|
||||
{
|
||||
base.TriggerOnChatFromWorld(sender, chat);
|
||||
}
|
||||
#endregion //ChatFromWorld
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1670,7 +1686,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public void TriggerOnChatFromWorld(Object sender, OSChatMessage chat)
|
||||
//SYMMETRIC SYNC: the function is overridden in new EventManager
|
||||
//public void TriggerOnChatFromWorld(Object sender, OSChatMessage chat)
|
||||
public virtual void TriggerOnChatFromWorld(Object sender, OSChatMessage chat)
|
||||
{
|
||||
ChatFromWorldEvent handlerChatFromWorld = OnChatFromWorld;
|
||||
if (handlerChatFromWorld != null)
|
||||
|
|
|
@ -69,6 +69,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
EventManager.TriggerOnChatBroadcast(this, args);
|
||||
else
|
||||
EventManager.TriggerOnChatFromWorld(this, args);
|
||||
|
||||
m_log.Debug("end of SimChat");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -51,6 +51,8 @@ using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
|
|||
using OpenSim.Region.ScriptEngine.Shared.CodeTools;
|
||||
using OpenSim.Region.ScriptEngine.Interfaces;
|
||||
|
||||
using log4net;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||
{
|
||||
public class ScriptInstance : MarshalByRefObject, IScriptInstance
|
||||
|
@ -214,12 +216,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
get { return m_thisScriptTask; }
|
||||
}
|
||||
|
||||
private ILog m_log;
|
||||
|
||||
public ScriptInstance(IScriptEngine engine, SceneObjectPart part,
|
||||
UUID itemID, UUID assetID, string assembly,
|
||||
AppDomain dom, string primName, string scriptName,
|
||||
int startParam, bool postOnRez, StateSource stateSource,
|
||||
int maxScriptQueue)
|
||||
{
|
||||
//Kitty: temp debug
|
||||
m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
m_Engine = engine;
|
||||
|
||||
m_LocalID = part.LocalId;
|
||||
|
@ -732,7 +739,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// m_log.DebugFormat("[SCRIPT] Exception: {0}", e.Message);
|
||||
m_log.DebugFormat("[SCRIPT] Exception: {0}", e.Message);
|
||||
m_InEvent = false;
|
||||
m_CurrentEvent = String.Empty;
|
||||
|
||||
|
|
Loading…
Reference in New Issue