* simplify AddNewClient since making this root without using MakeRootAgent() no longer sets everything up properly

0.6.1-post-fixes
Justin Clarke Casey 2008-11-28 20:11:17 +00:00
parent 86b75d1617
commit dfbec673a4
9 changed files with 27 additions and 20 deletions

View File

@ -63,7 +63,7 @@ namespace OpenSim.Framework
ClientManager ClientManager { get; } ClientManager ClientManager { get; }
event restart OnRestart; event restart OnRestart;
void AddNewClient(IClientAPI client, bool child); void AddNewClient(IClientAPI client);
void RemoveClient(UUID agentID); void RemoveClient(UUID agentID);
void CloseAllAgents(uint circuitcode); void CloseAllAgents(uint circuitcode);

View File

@ -773,7 +773,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_clientPingTimer.Elapsed += CheckClientConnectivity; m_clientPingTimer.Elapsed += CheckClientConnectivity;
m_clientPingTimer.Enabled = true; m_clientPingTimer.Enabled = true;
m_scene.AddNewClient(this, true); m_scene.AddNewClient(this);
RefreshGroupMembership(); RefreshGroupMembership();
} }

View File

@ -51,7 +51,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
public override void Update() {} public override void Update() {}
public override void LoadWorldMap() {} public override void LoadWorldMap() {}
public override void AddNewClient(IClientAPI client, bool child) public override void AddNewClient(IClientAPI client)
{ {
client.OnObjectName += RecordObjectNameCall; client.OnObjectName += RecordObjectNameCall;
} }

View File

@ -2229,7 +2229,7 @@ namespace OpenSim.Region.Environment.Scenes
#region Add/Remove Avatar Methods #region Add/Remove Avatar Methods
public override void AddNewClient(IClientAPI client, bool child) public override void AddNewClient(IClientAPI client)
{ {
SubscribeToClientEvents(client); SubscribeToClientEvents(client);
ScenePresence presence; ScenePresence presence;
@ -2261,12 +2261,12 @@ namespace OpenSim.Region.Environment.Scenes
else else
{ {
m_log.DebugFormat( m_log.DebugFormat(
"[SCENE]: Adding new {0} agent {1} {2} in {3}", "[SCENE]: Adding new child agent {0} for new user connection in {1}",
(child ? "child" : "root"), client.Name, client.AgentId, RegionInfo.RegionName); client.Name, RegionInfo.RegionName);
CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); CommsManager.UserProfileCacheService.AddNewUser(client.AgentId);
CreateAndAddScenePresence(client, child); CreateAndAddScenePresence(client);
} }
m_LastLogin = System.Environment.TickCount; m_LastLogin = System.Environment.TickCount;
@ -2547,17 +2547,16 @@ namespace OpenSim.Region.Environment.Scenes
} }
/// <summary> /// <summary>
/// Create a scene presence and add it to this scene. /// Create a child agent scene presence and add it to this scene.
/// </summary> /// </summary>
/// <param name="client"></param> /// <param name="client"></param>
/// <param name="child"></param>
/// <returns></returns> /// <returns></returns>
protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child) protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client)
{ {
AvatarAppearance appearance = null; AvatarAppearance appearance = null;
GetAvatarAppearance(client, out appearance); GetAvatarAppearance(client, out appearance);
ScenePresence avatar = m_sceneGraph.CreateAndAddScenePresence(client, child, appearance); ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance);
return avatar; return avatar;
} }

View File

@ -142,14 +142,14 @@ namespace OpenSim.Region.Environment.Scenes
#region Add/Remove Agent/Avatar #region Add/Remove Agent/Avatar
/// <summary> /// <summary>
/// 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.
/// </summary> /// </summary>
/// <param name="client"></param /// <param name="client"></param
/// <param name="child"></param> public abstract void AddNewClient(IClientAPI client);
public abstract void AddNewClient(IClientAPI client, bool child);
/// <summary> /// <summary>
/// /// Remove a client from the scene
/// </summary> /// </summary>
/// <param name="agentID"></param> /// <param name="agentID"></param>
public abstract void RemoveClient(UUID agentID); public abstract void RemoveClient(UUID agentID);

View File

@ -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; ScenePresence newAvatar = null;
newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance); newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance);
newAvatar.IsChildAgent = child; newAvatar.IsChildAgent = true;
AddScenePresence(newAvatar); AddScenePresence(newAvatar);

View File

@ -62,7 +62,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests
agent.CapsPath = "http://wibble.com"; agent.CapsPath = "http://wibble.com";
scene.NewUserConnection(agent); scene.NewUserConnection(agent);
scene.AddNewClient(new TestClient(agent), false); scene.AddNewClient(new TestClient(agent));
ScenePresence presence = scene.GetScenePresence(agentId); ScenePresence presence = scene.GetScenePresence(agentId);

View File

@ -97,9 +97,16 @@ namespace OpenSim.Region.Environment.Scenes.Tests
agent.startpos = Vector3.Zero; agent.startpos = Vector3.Zero;
agent.CapsPath = "http://wibble.com"; 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); scene.NewUserConnection(agent);
// Stage 2: add the new client as a child agent to the scene
IClientAPI client = new TestClient(agent); 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); scene.AgentCrossing(agent.AgentID, new Vector3(90, 90, 90), false);
return client; return client;

View File

@ -85,7 +85,8 @@ namespace OpenSim.Region.Examples.SimpleModule
for (int i = 0; i < 1; i++) for (int i = 0; i < 1; i++)
{ {
MyNpcCharacter m_character = new MyNpcCharacter(m_scene); 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<ScenePresence> avatars = m_scene.GetAvatars(); List<ScenePresence> avatars = m_scene.GetAvatars();