From e92ab35b0540e09bd0007dbe2de0b32c3832cc76 Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 31 May 2007 16:30:42 +0000 Subject: Another commit as ordered by robl --- .../RegionServerCommsManager.cs | 2 +- .../TestLocalCommsManager.cs | 2 +- Common/OpenSim.Framework/Interfaces/IClientAPI.cs | 1 + OpenSim/OpenSim.RegionServer/ClientView.API.cs | 29 ++++++++++++++++++++ OpenSim/OpenSim.World/World.cs | 32 ++++++++++++++++++---- 5 files changed, 58 insertions(+), 8 deletions(-) diff --git a/Common/OpenGrid.Framework.Communications/RegionServerCommsManager.cs b/Common/OpenGrid.Framework.Communications/RegionServerCommsManager.cs index 2b8c5ca..0b2b72e 100644 --- a/Common/OpenGrid.Framework.Communications/RegionServerCommsManager.cs +++ b/Common/OpenGrid.Framework.Communications/RegionServerCommsManager.cs @@ -50,7 +50,7 @@ namespace OpenGrid.Framework.Communications /// /// /// - public virtual bool InformNeighbourOfChildAgent( uint regionHandle, AgentCircuitData agentData) //should change from agentCircuitData + public virtual bool InformNeighbourOfChildAgent( ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData { return false; } diff --git a/Common/OpenGrid.Framework.Communications/TestLocalCommsManager.cs b/Common/OpenGrid.Framework.Communications/TestLocalCommsManager.cs index b4fe696..54ca966 100644 --- a/Common/OpenGrid.Framework.Communications/TestLocalCommsManager.cs +++ b/Common/OpenGrid.Framework.Communications/TestLocalCommsManager.cs @@ -53,7 +53,7 @@ namespace OpenGrid.Framework.Communications /// /// /// - public override bool InformNeighbourOfChildAgent(uint regionHandle, AgentCircuitData agentData) //should change from agentCircuitData + public override bool InformNeighbourOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData { return false; } diff --git a/Common/OpenSim.Framework/Interfaces/IClientAPI.cs b/Common/OpenSim.Framework/Interfaces/IClientAPI.cs index 5c5cda4..78be30a 100644 --- a/Common/OpenSim.Framework/Interfaces/IClientAPI.cs +++ b/Common/OpenSim.Framework/Interfaces/IClientAPI.cs @@ -84,5 +84,6 @@ namespace OpenSim.Framework.Interfaces void SendRegionHandshake(RegionInfo regionInfo); void MoveAgentIntoRegion(RegionInfo regInfo); void SendAvatarData(RegionInfo regionInfo, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos); + AgentCircuitData RequestClientInfo(); } } diff --git a/OpenSim/OpenSim.RegionServer/ClientView.API.cs b/OpenSim/OpenSim.RegionServer/ClientView.API.cs index b7d87ed..e14b7b7 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView.API.cs +++ b/OpenSim/OpenSim.RegionServer/ClientView.API.cs @@ -373,6 +373,35 @@ namespace OpenSim return objdata; } + + protected void InformClientOfNeighbour(ulong neighbourHandle, System.Net.IPAddress neighbourIP, ushort neighbourPort) + { + EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket(); + enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); + enablesimpacket.SimulatorInfo.Handle = neighbourHandle; + + byte[] byteIP = neighbourIP.GetAddressBytes(); + enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24; + enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16; + enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8; + enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0]; + enablesimpacket.SimulatorInfo.Port = neighbourPort; + OutPacket(enablesimpacket); + } + + public AgentCircuitData RequestClientInfo() + { + AgentCircuitData agentData = new AgentCircuitData(); + agentData.AgentID = this.AgentId; + agentData.SessionID = this.SessionID; + agentData.SecureSessionID = this.SecureSessionID; + agentData.circuitcode = this.CircuitCode; + agentData.child = false; + agentData.firstname = this.firstName; + agentData.lastname = this.lastName; + + return agentData; + } #endregion } diff --git a/OpenSim/OpenSim.World/World.cs b/OpenSim/OpenSim.World/World.cs index 69d4646..2c5971d 100644 --- a/OpenSim/OpenSim.World/World.cs +++ b/OpenSim/OpenSim.World/World.cs @@ -92,7 +92,7 @@ namespace OpenSim.world Avatar.SetupTemplate("avatar-texture.dat"); Avatar.LoadAnims(); - + //this.SetDefaultScripts(); //this.LoadScriptEngines(); @@ -115,7 +115,7 @@ namespace OpenSim.world m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat); } - + #region Update Methods @@ -268,6 +268,7 @@ namespace OpenSim.world #endregion + #region Regenerate Terrain /// @@ -451,6 +452,7 @@ namespace OpenSim.world remoteClient.OnRegionHandShakeReply += new GenericCall(this.SendLayerData); //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); remoteClient.OnChatFromViewer += new ChatFromViewer(this.SimChat); + remoteClient.OnRequestWearables += new GenericCall(this.InformClientOfNeighbours); Avatar newAvatar = null; try @@ -460,13 +462,13 @@ namespace OpenSim.world OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Adding new avatar to world"); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Starting RegionHandshake "); newAvatar.SendRegionHandshake(); - + PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); lock (this.LockPhysicsEngine) { newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); } - + lock (Entities) { if (!Entities.ContainsKey(agentID)) @@ -500,6 +502,24 @@ namespace OpenSim.world /// /// /// + protected void InformClientOfNeighbours(IClientAPI remoteClient) + { + List neighbours = this.commsManager.RequestNeighbours(this.m_regInfo); + + + for (int i = 0; i < neighbours.Count; i++) + { + AgentCircuitData agent = remoteClient.RequestClientInfo(); + agent.BaseFolder = LLUUID.Zero; + agent.InventoryFolder = LLUUID.Zero; + agent.startpos = new LLVector3(128, 128, 70); + this.commsManager.InformNeighbourOfChildAgent(neighbours[i].RegionHandle, agent); + } + } + + /// + /// + /// /// public override void RemoveAvatar(LLUUID agentID) { @@ -556,9 +576,9 @@ namespace OpenSim.world } } - public void NewUserConnection(ulong regionHandle,AgentCircuitData agent) + public void NewUserConnection(ulong regionHandle, AgentCircuitData agent) { - Console.WriteLine("World.cs - add new user connection"); + Console.WriteLine("World.cs - add new user connection"); //should just check that its meant for this region if (regionHandle == this.m_regInfo.RegionHandle) { -- cgit v1.1