* 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; }
event restart OnRestart;
void AddNewClient(IClientAPI client, bool child);
void AddNewClient(IClientAPI client);
void RemoveClient(UUID agentID);
void CloseAllAgents(uint circuitcode);

View File

@ -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();
}

View File

@ -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;
}

View File

@ -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
}
/// <summary>
/// Create a scene presence and add it to this scene.
/// Create a child agent scene presence and add it to this scene.
/// </summary>
/// <param name="client"></param>
/// <param name="child"></param>
/// <returns></returns>
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;
}

View File

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

View File

@ -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);

View File

@ -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;

View File

@ -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<ScenePresence> avatars = m_scene.GetAvatars();