/// <summary> /// We've got an update about an agent that sees into this region, /// send it to ScenePresence for processing It's only positional data /// </summary> /// <param name="scene"></param> /// <param name="cAgentData">AgentPosition that contains agent positional data so we can know what to send</param> /// <returns>true if we handled it.</returns> public virtual bool IncomingChildAgentDataUpdate(IScene scene, AgentPosition cAgentData) { // MainConsole.Instance.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName); IScenePresence presence = scene.GetScenePresence(cAgentData.AgentID); if (presence != 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 (presence.IsChildAgent) { uint rRegionX = 0; uint rRegionY = 0; //In meters Utils.LongToUInts(cAgentData.RegionHandle, out rRegionX, out rRegionY); //In meters int tRegionX = scene.RegionInfo.RegionLocX; int tRegionY = scene.RegionInfo.RegionLocY; //Send Data to ScenePresence presence.ChildAgentDataUpdate(cAgentData, tRegionX, tRegionY, (int)rRegionX, (int)rRegionY); } return(true); } return(false); }
/// <summary> /// We've got an update about an agent that sees into this region, /// send it to ScenePresence for processing It's the full data. /// </summary> /// <param name="scene"></param> /// <param name="cAgentData"> /// Agent that contains all of the relevant things about an agent. /// Appearance, animations, position, etc. /// </param> /// <returns>true if we handled it.</returns> public virtual bool IncomingChildAgentDataUpdate(IScene scene, AgentData cAgentData) { MainConsole.Instance.DebugFormat( "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, scene.RegionInfo.RegionName); //No null updates! if (cAgentData == null) { return(false); } // We have to wait until the viewer contacts this region after receiving EAC. // That calls AddNewClient, which finally creates the ScenePresence and then this gets set up // So if the client isn't here yet, save the update for them when they get into the region fully IScenePresence SP = scene.GetScenePresence(cAgentData.AgentID); if (SP != null) { SP.ChildAgentDataUpdate(cAgentData); } else { lock (m_incomingChildAgentData) { if (!m_incomingChildAgentData.ContainsKey(scene)) { m_incomingChildAgentData.Add(scene, new Dictionary <UUID, AgentData>()); } m_incomingChildAgentData[scene][cAgentData.AgentID] = cAgentData; return(false); //The agent doesn't exist } } return(true); }
void EventManager_OnNewPresence(IScenePresence sp) { lock (m_incomingChildAgentData) { Dictionary <UUID, AgentData> childAgentUpdates; if (m_incomingChildAgentData.TryGetValue(sp.Scene, out childAgentUpdates)) { if (childAgentUpdates.ContainsKey(sp.UUID)) { //Found info, update the agent then remove it sp.ChildAgentDataUpdate(childAgentUpdates [sp.UUID]); childAgentUpdates.Remove(sp.UUID); m_incomingChildAgentData [sp.Scene] = childAgentUpdates; } } } }
private void EventManager_OnNewPresence(IScenePresence sp) { lock (m_incomingChildAgentData) { Dictionary<UUID, AgentData> childAgentUpdates; if (m_incomingChildAgentData.TryGetValue(sp.Scene, out childAgentUpdates)) { if (childAgentUpdates.ContainsKey(sp.UUID)) { //Found info, update the agent then remove it sp.ChildAgentDataUpdate(childAgentUpdates[sp.UUID]); childAgentUpdates.Remove(sp.UUID); m_incomingChildAgentData[sp.Scene] = childAgentUpdates; } } } }