From dfbec673a4ca24ab683ea403361efa4372cc1e0d Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Fri, 28 Nov 2008 20:11:17 +0000 Subject: * simplify AddNewClient since making this root without using MakeRootAgent() no longer sets everything up properly --- OpenSim/Framework/IScene.cs | 2 +- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 2 +- OpenSim/Region/ClientStack/LindenUDP/Tests/MockScene.cs | 2 +- OpenSim/Region/Environment/Scenes/Scene.cs | 15 +++++++-------- OpenSim/Region/Environment/Scenes/SceneBase.cs | 8 ++++---- OpenSim/Region/Environment/Scenes/SceneGraph.cs | 4 ++-- .../Region/Environment/Scenes/Tests/ScenePresenceTests.cs | 2 +- OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs | 9 ++++++++- OpenSim/Region/Examples/SimpleModule/RegionModule.cs | 3 ++- 9 files changed, 27 insertions(+), 20 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs index a852eaf..000a800 100644 --- a/OpenSim/Framework/IScene.cs +++ b/OpenSim/Framework/IScene.cs @@ -63,7 +63,7 @@ namespace OpenSim.Framework ClientManager ClientManager { get; } event restart OnRestart; - void AddNewClient(IClientAPI client, bool child); + void AddNewClient(IClientAPI client); void RemoveClient(UUID agentID); void CloseAllAgents(uint circuitcode); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 7d31c77..1823ccf 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -773,7 +773,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_clientPingTimer.Elapsed += CheckClientConnectivity; m_clientPingTimer.Enabled = true; - m_scene.AddNewClient(this, true); + m_scene.AddNewClient(this); RefreshGroupMembership(); } diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/MockScene.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/MockScene.cs index 4c8ee9c..155b52d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/Tests/MockScene.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/MockScene.cs @@ -51,7 +51,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests public override void Update() {} public override void LoadWorldMap() {} - public override void AddNewClient(IClientAPI client, bool child) + public override void AddNewClient(IClientAPI client) { client.OnObjectName += RecordObjectNameCall; } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index e544703..97442fd 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -2229,7 +2229,7 @@ namespace OpenSim.Region.Environment.Scenes #region Add/Remove Avatar Methods - public override void AddNewClient(IClientAPI client, bool child) + public override void AddNewClient(IClientAPI client) { SubscribeToClientEvents(client); ScenePresence presence; @@ -2261,12 +2261,12 @@ namespace OpenSim.Region.Environment.Scenes else { m_log.DebugFormat( - "[SCENE]: Adding new {0} agent {1} {2} in {3}", - (child ? "child" : "root"), client.Name, client.AgentId, RegionInfo.RegionName); + "[SCENE]: Adding new child agent {0} for new user connection in {1}", + client.Name, RegionInfo.RegionName); CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); - CreateAndAddScenePresence(client, child); + CreateAndAddScenePresence(client); } m_LastLogin = System.Environment.TickCount; @@ -2547,17 +2547,16 @@ namespace OpenSim.Region.Environment.Scenes } /// - /// Create a scene presence and add it to this scene. + /// Create a child agent scene presence and add it to this scene. /// /// - /// /// - protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child) + protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client) { AvatarAppearance appearance = null; GetAvatarAppearance(client, out appearance); - ScenePresence avatar = m_sceneGraph.CreateAndAddScenePresence(client, child, appearance); + ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance); return avatar; } diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index 7137c2f..6d1e808 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs @@ -142,14 +142,14 @@ namespace OpenSim.Region.Environment.Scenes #region Add/Remove Agent/Avatar /// - /// Register the new client with the scene + /// Register the new client with the scene. The client starts off as a child agent - the later agent crossing + /// will promote it to a root agent during login. /// /// - public abstract void AddNewClient(IClientAPI client, bool child); + public abstract void AddNewClient(IClientAPI client); /// - /// + /// Remove a client from the scene /// /// public abstract void RemoveClient(UUID agentID); diff --git a/OpenSim/Region/Environment/Scenes/SceneGraph.cs b/OpenSim/Region/Environment/Scenes/SceneGraph.cs index 8c9fdd4..da3be08 100644 --- a/OpenSim/Region/Environment/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Environment/Scenes/SceneGraph.cs @@ -574,12 +574,12 @@ namespace OpenSim.Region.Environment.Scenes } } - protected internal ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child, AvatarAppearance appearance) + protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) { ScenePresence newAvatar = null; newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance); - newAvatar.IsChildAgent = child; + newAvatar.IsChildAgent = true; AddScenePresence(newAvatar); diff --git a/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs index a16c26a..a19dbf7 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs @@ -62,7 +62,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests agent.CapsPath = "http://wibble.com"; scene.NewUserConnection(agent); - scene.AddNewClient(new TestClient(agent), false); + scene.AddNewClient(new TestClient(agent)); ScenePresence presence = scene.GetScenePresence(agentId); diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs index 468a4ad..b169d9a 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs @@ -97,9 +97,16 @@ namespace OpenSim.Region.Environment.Scenes.Tests agent.startpos = Vector3.Zero; agent.CapsPath = "http://wibble.com"; + // We emulate the proper login sequence here by doing things in three stages + // Stage 1: simulate login by telling the scene to expect a new user connection scene.NewUserConnection(agent); + + // Stage 2: add the new client as a child agent to the scene IClientAPI client = new TestClient(agent); - scene.AddNewClient(client, true); + scene.AddNewClient(client); + + // Stage 3: Invoke agent crossing, which converts the child agent into a root agent (with appearance, + // inventory, etc.) scene.AgentCrossing(agent.AgentID, new Vector3(90, 90, 90), false); return client; diff --git a/OpenSim/Region/Examples/SimpleModule/RegionModule.cs b/OpenSim/Region/Examples/SimpleModule/RegionModule.cs index 1bb6cae..0d7919d 100644 --- a/OpenSim/Region/Examples/SimpleModule/RegionModule.cs +++ b/OpenSim/Region/Examples/SimpleModule/RegionModule.cs @@ -85,7 +85,8 @@ namespace OpenSim.Region.Examples.SimpleModule for (int i = 0; i < 1; i++) { MyNpcCharacter m_character = new MyNpcCharacter(m_scene); - m_scene.AddNewClient(m_character, false); + m_scene.AddNewClient(m_character); + m_scene.AgentCrossing(m_character.AgentId, Vector3.Zero, false); } List avatars = m_scene.GetAvatars(); -- cgit v1.1