Added code so that collision events are only forwarded from PSA to script engines.
parent
8ab8969d82
commit
22f5f7962c
|
@ -105,6 +105,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
int syncInfoAgeOutSeconds = m_sysConfig.GetInt("PrimSyncInfoAgeOutSeconds", 300); //unit of seconds
|
int syncInfoAgeOutSeconds = m_sysConfig.GetInt("PrimSyncInfoAgeOutSeconds", 300); //unit of seconds
|
||||||
TimeSpan tSpan = new TimeSpan(0, 0, syncInfoAgeOutSeconds);
|
TimeSpan tSpan = new TimeSpan(0, 0, syncInfoAgeOutSeconds);
|
||||||
m_primSyncInfoManager = new PrimSyncInfoManager(this, tSpan.Ticks);
|
m_primSyncInfoManager = new PrimSyncInfoManager(this, tSpan.Ticks);
|
||||||
|
|
||||||
|
//this is temp solution for reducing collision events for country fair demo
|
||||||
|
m_reportCollisions = m_sysConfig.GetString("ReportCollisions", "All");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Called after Initialise()
|
//Called after Initialise()
|
||||||
|
@ -558,37 +561,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
private Dictionary<UUID, HashSet<SceneObjectPartSyncProperties>> m_primPropertyUpdates = new Dictionary<UUID, HashSet<SceneObjectPartSyncProperties>>();
|
private Dictionary<UUID, HashSet<SceneObjectPartSyncProperties>> m_primPropertyUpdates = new Dictionary<UUID, HashSet<SceneObjectPartSyncProperties>>();
|
||||||
private int m_sendingPrimPropertyUpdates = 0;
|
private int m_sendingPrimPropertyUpdates = 0;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
string m_reportCollisions = "All";
|
||||||
// Legacy members for bucket-based sync,
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
private Dictionary<string, Object> m_primUpdateLocks = new Dictionary<string, object>();
|
|
||||||
private Dictionary<string, Dictionary<UUID, SceneObjectPart>> m_primUpdates = new Dictionary<string, Dictionary<UUID, SceneObjectPart>>();
|
|
||||||
|
|
||||||
private delegate void PrimUpdatePerBucketSender(string bucketName, List<SceneObjectPart> primUpdates);
|
|
||||||
private Dictionary<string, PrimUpdatePerBucketSender> m_primUpdatesPerBucketSender = new Dictionary<string, PrimUpdatePerBucketSender>();
|
|
||||||
|
|
||||||
private delegate void PrimUpdatePerBucketReceiver(string bucketName, OSDMap data);
|
|
||||||
private Dictionary<string, PrimUpdatePerBucketReceiver> m_primUpdatesPerBucketReceiver = new Dictionary<string, PrimUpdatePerBucketReceiver>();
|
|
||||||
|
|
||||||
//The functions that encode properties in each bucket. For now,
|
|
||||||
//general bucket works on SOG, physics bucket works on SOP, so we define
|
|
||||||
//the arg to be of type Object to be general in the interface.
|
|
||||||
//TO DO: redesign the interface once the bucket encoders working on more
|
|
||||||
//consistent/specific arguments.
|
|
||||||
private delegate OSDMap UpdatePerBucketEncoder(string bucketName, Object arg);
|
|
||||||
private Dictionary<string, UpdatePerBucketEncoder> m_updatePerBucketEncoder = new Dictionary<string, UpdatePerBucketEncoder>();
|
|
||||||
|
|
||||||
//Decoders of properties in each bucket
|
|
||||||
private delegate void UpdatePerBucketDecoder(string bucketName, OSDMap data, out Object outData);
|
|
||||||
private Dictionary<string, UpdatePerBucketDecoder> m_updatePerBucketDecoder = new Dictionary<string, UpdatePerBucketDecoder>();
|
|
||||||
|
|
||||||
|
|
||||||
private object m_updateScenePresenceLock = new object();
|
|
||||||
private Dictionary<UUID, ScenePresence> m_presenceUpdates = new Dictionary<UUID, ScenePresence>();
|
|
||||||
private int m_sendingUpdates = 0;
|
|
||||||
|
|
||||||
private int m_maxNumOfPropertyBuckets;
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Synchronization related functions, NOT exposed through IRegionSyncModule interface
|
// Synchronization related functions, NOT exposed through IRegionSyncModule interface
|
||||||
|
@ -753,11 +727,24 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
List<SyncConnector> syncConnectors = GetSyncConnectorsForSceneEvents(init_actorID, rsm, sog);
|
List<SyncConnector> syncConnectors = GetSyncConnectorsForSceneEvents(init_actorID, rsm, sog);
|
||||||
|
|
||||||
foreach (SyncConnector connector in syncConnectors)
|
foreach (SyncConnector connector in syncConnectors)
|
||||||
|
{
|
||||||
|
//special fix for demo, need better optimization later
|
||||||
|
if (rsm.Type == SymmetricSyncMessage.MsgType.PhysicsCollision && m_isSyncRelay)
|
||||||
|
{
|
||||||
|
//for persistence actor, only forward collision events to script engines
|
||||||
|
if (connector.OtherSideActorType == ScriptEngineSyncModule.ActorTypeString)
|
||||||
{
|
{
|
||||||
lock (m_stats) m_statEventOut++;
|
lock (m_stats) m_statEventOut++;
|
||||||
connector.Send(rsm);
|
connector.Send(rsm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lock (m_stats) m_statEventOut++;
|
||||||
|
connector.Send(rsm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the set of SyncConnectors to send updates of the given object.
|
/// Get the set of SyncConnectors to send updates of the given object.
|
||||||
|
@ -868,6 +855,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
//m_actorType = m_scene.ActorSyncModule.ActorType;
|
//m_actorType = m_scene.ActorSyncModule.ActorType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//m_actorType = m_scene.ActorSyncModule.ActorType.ToString();
|
||||||
|
|
||||||
//Start symmetric synchronization initialization automatically
|
//Start symmetric synchronization initialization automatically
|
||||||
SyncStart(null);
|
SyncStart(null);
|
||||||
}
|
}
|
||||||
|
@ -1315,6 +1304,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
m_log.WarnFormat("Sending region name: \"{0}\"", m_scene.RegionInfo.RegionName);
|
m_log.WarnFormat("Sending region name: \"{0}\"", m_scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
SendSyncMessage(SymmetricSyncMessage.MsgType.ActorID, m_actorID);
|
SendSyncMessage(SymmetricSyncMessage.MsgType.ActorID, m_actorID);
|
||||||
|
SendSyncMessage(SymmetricSyncMessage.MsgType.ActorType, m_scene.RegionSyncActorType);
|
||||||
|
|
||||||
SendSyncMessage(SymmetricSyncMessage.MsgType.GetTerrain);
|
SendSyncMessage(SymmetricSyncMessage.MsgType.GetTerrain);
|
||||||
SendSyncMessage(SymmetricSyncMessage.MsgType.GetObjects);
|
SendSyncMessage(SymmetricSyncMessage.MsgType.GetObjects);
|
||||||
|
@ -2361,6 +2351,30 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
|
|
||||||
private void OnLocalPhysicsCollision(UUID partUUID, OSDArray collisionUUIDs)
|
private void OnLocalPhysicsCollision(UUID partUUID, OSDArray collisionUUIDs)
|
||||||
{
|
{
|
||||||
|
//temp solution for reducing collision events for demo
|
||||||
|
switch (m_reportCollisions)
|
||||||
|
{
|
||||||
|
case "All":
|
||||||
|
break;
|
||||||
|
case "PrimToAvatarOnly":
|
||||||
|
SceneObjectPart part = m_scene.GetSceneObjectPart(partUUID);
|
||||||
|
if (part == null) return;
|
||||||
|
for (int i = 0; i < collisionUUIDs.Count; i++)
|
||||||
|
{
|
||||||
|
OSD arg = collisionUUIDs[i];
|
||||||
|
UUID collidingUUID = arg.AsUUID();
|
||||||
|
ScenePresence sp = m_scene.GetScenePresence(collidingUUID);
|
||||||
|
if (sp == null)
|
||||||
|
{
|
||||||
|
//not colliding with an avatar, don't propagate
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
OSDMap data = new OSDMap();
|
OSDMap data = new OSDMap();
|
||||||
data["primUUID"] = OSD.FromUUID(partUUID);
|
data["primUUID"] = OSD.FromUUID(partUUID);
|
||||||
data["collisionUUIDs"] = collisionUUIDs;
|
data["collisionUUIDs"] = collisionUUIDs;
|
||||||
|
|
|
@ -150,6 +150,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
|
|
||||||
#region IDSGActorSyncModule members and functions
|
#region IDSGActorSyncModule members and functions
|
||||||
|
|
||||||
|
public static string ActorTypeString = DSGActorTypes.ScriptEngine.ToString();
|
||||||
|
|
||||||
private DSGActorTypes m_actorType = DSGActorTypes.ScriptEngine;
|
private DSGActorTypes m_actorType = DSGActorTypes.ScriptEngine;
|
||||||
public DSGActorTypes ActorType
|
public DSGActorTypes ActorType
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,6 +56,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
RegionName,
|
RegionName,
|
||||||
//RegionStatus,
|
//RegionStatus,
|
||||||
ActorID,
|
ActorID,
|
||||||
|
ActorType,
|
||||||
//events
|
//events
|
||||||
NewScript,
|
NewScript,
|
||||||
UpdateScript,
|
UpdateScript,
|
||||||
|
|
|
@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
public string OtherSideActorID
|
public string OtherSideActorID
|
||||||
{
|
{
|
||||||
get { return m_syncOtherSideActorID; }
|
get { return m_syncOtherSideActorID; }
|
||||||
set { m_syncOtherSideActorID = value; }
|
//set { m_syncOtherSideActorID = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
//The region name of the other side of the connection
|
//The region name of the other side of the connection
|
||||||
|
@ -90,6 +90,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
get { return m_syncOtherSideRegionName; }
|
get { return m_syncOtherSideRegionName; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string m_syncOtherSideActorType;
|
||||||
|
public string OtherSideActorType
|
||||||
|
{
|
||||||
|
get { return m_syncOtherSideActorType; }
|
||||||
|
//set { m_syncOtherSideActorID = value; }
|
||||||
|
}
|
||||||
|
|
||||||
// Check if the client is connected
|
// Check if the client is connected
|
||||||
public bool Connected
|
public bool Connected
|
||||||
{ get { return (m_tcpConnection !=null && m_tcpConnection.Connected); } }
|
{ get { return (m_tcpConnection !=null && m_tcpConnection.Connected); } }
|
||||||
|
@ -322,6 +329,17 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
m_log.DebugFormat("Syncing to actor \"{0}\"", m_syncOtherSideActorID);
|
m_log.DebugFormat("Syncing to actor \"{0}\"", m_syncOtherSideActorID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
case SymmetricSyncMessage.MsgType.ActorType:
|
||||||
|
{
|
||||||
|
m_syncOtherSideActorType = Encoding.ASCII.GetString(msg.Data, 0, msg.Length);
|
||||||
|
if (m_regionSyncModule.IsSyncRelay)
|
||||||
|
{
|
||||||
|
SymmetricSyncMessage outMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.ActorType, m_regionSyncModule.LocalScene.RegionSyncActorType );
|
||||||
|
Send(outMsg);
|
||||||
|
}
|
||||||
|
m_log.DebugFormat("Syncing to actor type \"{0}\"", m_syncOtherSideActorType);
|
||||||
|
return;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -483,6 +483,23 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
set { m_regionSyncMode = value; }
|
set { m_regionSyncMode = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string m_regionSyncActorType = String.Empty;
|
||||||
|
public string RegionSyncActorType
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (m_regionSyncActorType == String.Empty)
|
||||||
|
{
|
||||||
|
IDSGActorSyncModule DSGActorSyncModule = RequestModuleInterface<IDSGActorSyncModule>();
|
||||||
|
if (DSGActorSyncModule != null)
|
||||||
|
{
|
||||||
|
m_regionSyncActorType = DSGActorSyncModule.ActorType.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return m_regionSyncActorType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool ToScheduleFullUpdate()
|
public bool ToScheduleFullUpdate()
|
||||||
{
|
{
|
||||||
//Only Scene (SyncServer) or Client Manager (SyncClient) will schedule update to send to its client. Script Engine will not (its update should be sent to Scene).
|
//Only Scene (SyncServer) or Client Manager (SyncClient) will schedule update to send to its client. Script Engine will not (its update should be sent to Scene).
|
||||||
|
|
Loading…
Reference in New Issue