Final part for implementing SendChildAgentDataUpdate with modules. This is the part that uses the modules in Scene and related classes. This commit breaks compatibility of sim-sim SendChildAgentUpdates with older versions of OpenSim.
parent
e12d2ec9dc
commit
a3e2e03f7b
|
@ -149,6 +149,8 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
protected IAvatarFactory m_AvatarFactory;
|
||||
protected IConfigSource m_config;
|
||||
protected IRegionSerialiserModule m_serialiser;
|
||||
protected IInterregionCommsOut m_interregionCommsOut;
|
||||
protected IInterregionCommsIn m_interregionCommsIn;
|
||||
|
||||
// Central Update Loop
|
||||
|
||||
|
@ -757,6 +759,8 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
XferManager = RequestModuleInterface<IXfer>();
|
||||
m_AvatarFactory = RequestModuleInterface<IAvatarFactory>();
|
||||
m_serialiser = RequestModuleInterface<IRegionSerialiserModule>();
|
||||
m_interregionCommsOut = RequestModuleInterface<IInterregionCommsOut>();
|
||||
m_interregionCommsIn = RequestModuleInterface<IInterregionCommsIn>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -896,10 +900,10 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
{
|
||||
m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
|
||||
}
|
||||
catch (NullReferenceException e)
|
||||
{
|
||||
m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
|
||||
}
|
||||
//catch (NullReferenceException e)
|
||||
//{
|
||||
// m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
|
||||
//}
|
||||
catch (InvalidOperationException e)
|
||||
{
|
||||
m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
|
||||
|
@ -1145,7 +1149,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
RegisterCommsEvents();
|
||||
|
||||
// These two 'commands' *must be* next to each other or sim rebooting fails.
|
||||
m_sceneGridService.RegisterRegion(RegionInfo);
|
||||
m_sceneGridService.RegisterRegion(m_interregionCommsOut, RegionInfo);
|
||||
m_sceneGridService.InformNeighborsThatRegionisUp(RegionInfo);
|
||||
|
||||
Dictionary<string, string> dGridSettings = m_sceneGridService.GetGridSettings();
|
||||
|
@ -2690,12 +2694,21 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing;
|
||||
m_sceneGridService.OnCloseAgentConnection += CloseConnection;
|
||||
m_sceneGridService.OnRegionUp += OtherRegionUp;
|
||||
m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
|
||||
//m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
|
||||
m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup;
|
||||
//m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar;
|
||||
m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid;
|
||||
m_sceneGridService.KiPrimitive += SendKillObject;
|
||||
m_sceneGridService.OnGetLandData += GetLandData;
|
||||
|
||||
if (m_interregionCommsIn != null)
|
||||
{
|
||||
m_log.Debug("[SCENE]: Registering with InterregionCommsIn");
|
||||
m_interregionCommsIn.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
|
||||
}
|
||||
else
|
||||
m_log.Debug("[SCENE]: Unable to register with InterregionCommsIn");
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -2707,13 +2720,16 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid;
|
||||
//m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar;
|
||||
m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup;
|
||||
m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
|
||||
//m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
|
||||
m_sceneGridService.OnRegionUp -= OtherRegionUp;
|
||||
m_sceneGridService.OnExpectUser -= NewUserConnection;
|
||||
m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing;
|
||||
m_sceneGridService.OnCloseAgentConnection -= CloseConnection;
|
||||
m_sceneGridService.OnGetLandData -= GetLandData;
|
||||
|
||||
if (m_interregionCommsIn != null)
|
||||
m_interregionCommsIn.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
|
||||
|
||||
m_sceneGridService.Close();
|
||||
}
|
||||
|
||||
|
@ -2937,17 +2953,18 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public virtual bool IncomingChildAgentDataUpdate(ChildAgentDataUpdate cAgentData)
|
||||
public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData)
|
||||
{
|
||||
ScenePresence childAgentUpdate = GetScenePresence(new UUID(cAgentData.AgentID));
|
||||
//Console.WriteLine(" XXX Scene IncomingChildAgentDataUpdate in " + RegionInfo.RegionName);
|
||||
ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID);
|
||||
if (childAgentUpdate != null)
|
||||
{
|
||||
// I can't imagine *yet* why we would get an update if the agent is a root agent..
|
||||
// however to avoid a race condition crossing borders..
|
||||
if (childAgentUpdate.IsChildAgent)
|
||||
{
|
||||
uint rRegionX = (uint)(cAgentData.regionHandle >> 40);
|
||||
uint rRegionY = (((uint)(cAgentData.regionHandle)) >> 8);
|
||||
uint rRegionX = (uint)(cAgentData.RegionHandle >> 40);
|
||||
uint rRegionY = (((uint)(cAgentData.RegionHandle)) >> 8);
|
||||
uint tRegionX = RegionInfo.RegionLocX;
|
||||
uint tRegionY = RegionInfo.RegionLocY;
|
||||
//Send Data to ScenePresence
|
||||
|
@ -3131,7 +3148,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
return m_sceneGridService.CrossToNeighbouringRegion(regionHandle, agentID, position, isFlying);
|
||||
}
|
||||
|
||||
public void SendOutChildAgentUpdates(ChildAgentDataUpdate cadu, ScenePresence presence)
|
||||
public void SendOutChildAgentUpdates(AgentData cadu, ScenePresence presence)
|
||||
{
|
||||
m_sceneGridService.SendChildAgentDataUpdate(cadu, presence);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ using System.Threading;
|
|||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using log4net;
|
||||
using OpenSim.Region.Environment.Interfaces;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Region.Interfaces;
|
||||
|
@ -49,6 +50,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected CommunicationsManager m_commsProvider;
|
||||
protected IInterregionCommsOut m_interregionCommsOut;
|
||||
protected RegionInfo m_regionInfo;
|
||||
|
||||
protected RegionCommsListener regionCommsHost;
|
||||
|
@ -87,8 +89,10 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// </summary>
|
||||
/// <param name="regionInfos"></param>
|
||||
/// <exception cref="System.Exception">Thrown if region registration fails.</exception>
|
||||
public void RegisterRegion(RegionInfo regionInfos)
|
||||
public void RegisterRegion(IInterregionCommsOut comms_out, RegionInfo regionInfos)
|
||||
{
|
||||
m_interregionCommsOut = comms_out;
|
||||
|
||||
m_regionInfo = regionInfos;
|
||||
m_commsProvider.GridService.gdebugRegionName = regionInfos.RegionName;
|
||||
m_commsProvider.InterRegion.rdebugRegionName = regionInfos.RegionName;
|
||||
|
@ -531,7 +535,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
//bool val = m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region));
|
||||
}
|
||||
|
||||
public delegate void SendChildAgentDataUpdateDelegate(ChildAgentDataUpdate cAgentData, ulong regionHandle);
|
||||
public delegate void SendChildAgentDataUpdateDelegate(AgentData cAgentData, ulong regionHandle);
|
||||
|
||||
/// <summary>
|
||||
/// This informs all neighboring regions about the settings of it's child agent.
|
||||
|
@ -540,13 +544,14 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc.
|
||||
///
|
||||
/// </summary>
|
||||
private void SendChildAgentDataUpdateAsync(ChildAgentDataUpdate cAgentData, ulong regionHandle)
|
||||
private void SendChildAgentDataUpdateAsync(AgentData cAgentData, ulong regionHandle)
|
||||
{
|
||||
//m_log.Info("[INTERGRID]: Informing neighbors about my agent in " + presence.Scene.RegionInfo.RegionName);
|
||||
m_log.Info("[INTERGRID]: Informing neighbors about my agent in " + m_regionInfo.RegionName);
|
||||
//bool regionAccepted = m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData);
|
||||
try
|
||||
{
|
||||
m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData);
|
||||
//m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData);
|
||||
m_interregionCommsOut.SendChildAgentUpdate(regionHandle, cAgentData);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -570,18 +575,20 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
icon.EndInvoke(iar);
|
||||
}
|
||||
|
||||
public void SendChildAgentDataUpdate(ChildAgentDataUpdate cAgentData, ScenePresence presence)
|
||||
public void SendChildAgentDataUpdate(AgentData cAgentData, ScenePresence presence)
|
||||
{
|
||||
// This assumes that we know what our neighbors are.
|
||||
try
|
||||
{
|
||||
foreach (ulong regionHandle in presence.KnownChildRegionHandles)
|
||||
{
|
||||
|
||||
SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync;
|
||||
d.BeginInvoke(cAgentData, regionHandle,
|
||||
SendChildAgentDataUpdateCompleted,
|
||||
d);
|
||||
if (regionHandle != m_regionInfo.RegionHandle)
|
||||
{
|
||||
SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync;
|
||||
d.BeginInvoke(cAgentData, regionHandle,
|
||||
SendChildAgentDataUpdateCompleted,
|
||||
d);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
|
|
|
@ -2326,7 +2326,11 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
//m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString());
|
||||
cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier);
|
||||
cadu.Velocity = new sLLVector3(Velocity);
|
||||
m_scene.SendOutChildAgentUpdates(cadu,this);
|
||||
|
||||
AgentData agent = new AgentData();
|
||||
agent.CopyFrom(cadu);
|
||||
|
||||
m_scene.SendOutChildAgentUpdates(agent, this);
|
||||
|
||||
m_LastChildAgentUpdatePosition.X = AbsolutePosition.X;
|
||||
m_LastChildAgentUpdatePosition.Y = AbsolutePosition.Y;
|
||||
|
@ -2571,7 +2575,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// This updates important decision making data about a child agent
|
||||
/// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region
|
||||
/// </summary>
|
||||
public void ChildAgentDataUpdate(ChildAgentDataUpdate cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY)
|
||||
public void ChildAgentDataUpdate(AgentData cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY)
|
||||
{
|
||||
//
|
||||
if (!IsChildAgent)
|
||||
|
@ -2580,19 +2584,19 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize;
|
||||
int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize;
|
||||
|
||||
m_DrawDistance = cAgentData.drawdistance;
|
||||
m_pos = new Vector3(cAgentData.Position.x + shiftx, cAgentData.Position.y + shifty, cAgentData.Position.z);
|
||||
m_DrawDistance = cAgentData.Far;
|
||||
m_pos = new Vector3(cAgentData.Position.X + shiftx, cAgentData.Position.Y + shifty, cAgentData.Position.Z);
|
||||
|
||||
// It's hard to say here.. We can't really tell where the camera position is unless it's in world cordinates from the sending region
|
||||
m_CameraCenter =
|
||||
new Vector3(cAgentData.cameraPosition.x, cAgentData.cameraPosition.y, cAgentData.cameraPosition.z);
|
||||
m_CameraCenter = cAgentData.Center;
|
||||
// new Vector3(cAgentData.cameraPosition.x, cAgentData.cameraPosition.y, cAgentData.cameraPosition.z);
|
||||
|
||||
|
||||
m_godlevel = cAgentData.godlevel;
|
||||
m_avHeight = cAgentData.AVHeight;
|
||||
m_godlevel = cAgentData.GodLevel;
|
||||
m_avHeight = cAgentData.Size.Z;
|
||||
//SetHeight(cAgentData.AVHeight);
|
||||
|
||||
ControllingClient.SetChildAgentThrottle(cAgentData.throttles);
|
||||
ControllingClient.SetChildAgentThrottle(cAgentData.Throttles);
|
||||
|
||||
// Sends out the objects in the user's draw distance if m_sendTasksToChild is true.
|
||||
if (m_scene.m_seeIntoRegionFromNeighbor)
|
||||
|
|
|
@ -179,6 +179,11 @@
|
|||
;WorldMapModule = "WorldMap"
|
||||
;MapImageModule = "MapImageModule"
|
||||
|
||||
[Communications]
|
||||
|
||||
;InterregionComms = "LocalComms"
|
||||
InterregionComms = "RESTComms"
|
||||
;InterregionComms = "HGRESTComms"
|
||||
|
||||
[StandAlone]
|
||||
accounts_authenticate = true
|
||||
|
|
Loading…
Reference in New Issue