aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs77
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs4
2 files changed, 12 insertions, 69 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 12fd813..71d0f09 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -498,12 +498,6 @@ namespace OpenSim.Region.Framework.Scenes
498 get { return m_sceneGraph.Entities; } 498 get { return m_sceneGraph.Entities; }
499 } 499 }
500 500
501 public Dictionary<UUID, ScenePresence> m_restorePresences
502 {
503 get { return m_sceneGraph.RestorePresences; }
504 set { m_sceneGraph.RestorePresences = value; }
505 }
506
507 #endregion Properties 501 #endregion Properties
508 502
509 #region Constructors 503 #region Constructors
@@ -2483,56 +2477,24 @@ namespace OpenSim.Region.Framework.Scenes
2483 (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; 2477 (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
2484 2478
2485 CheckHeartbeat(); 2479 CheckHeartbeat();
2486 ScenePresence presence;
2487 2480
2488 if (m_restorePresences.ContainsKey(client.AgentId)) 2481 if (GetScenePresence(client.AgentId) == null) // ensure there is no SP here
2489 { 2482 {
2490 m_log.DebugFormat("[SCENE]: Restoring agent {0} {1} in {2}", client.Name, client.AgentId, RegionInfo.RegionName); 2483 m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName);
2491 2484
2492 m_clientManager.Add(client); 2485 m_clientManager.Add(client);
2493 SubscribeToClientEvents(client); 2486 SubscribeToClientEvents(client);
2494 2487
2495 presence = m_restorePresences[client.AgentId]; 2488 ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance);
2496 m_restorePresences.Remove(client.AgentId); 2489 m_eventManager.TriggerOnNewPresence(sp);
2497
2498 // This is one of two paths to create avatars that are
2499 // used. This tends to get called more in standalone
2500 // than grid, not really sure why, but as such needs
2501 // an explicity appearance lookup here.
2502 AvatarAppearance appearance = null;
2503 GetAvatarAppearance(client, out appearance);
2504 presence.Appearance = appearance;
2505 2490
2506 presence.initializeScenePresence(client, RegionInfo, this); 2491 // HERE!!! Do the initial attachments right here
2507 2492 // first agent upon login is a root agent by design.
2508 m_sceneGraph.AddScenePresence(presence); 2493 // All other AddNewClient calls find aCircuit.child to be true
2509 2494 if (aCircuit.child == false)
2510 lock (m_restorePresences)
2511 { 2495 {
2512 Monitor.PulseAll(m_restorePresences); 2496 sp.IsChildAgent = false;
2513 } 2497 Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
2514 }
2515 else
2516 {
2517 if (GetScenePresence(client.AgentId) == null) // ensure there is no SP here
2518 {
2519 m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName);
2520
2521 m_clientManager.Add(client);
2522 SubscribeToClientEvents(client);
2523
2524 ScenePresence sp = CreateAndAddScenePresence(client);
2525 if (aCircuit != null)
2526 sp.Appearance = aCircuit.Appearance;
2527
2528 // HERE!!! Do the initial attachments right here
2529 // first agent upon login is a root agent by design.
2530 // All other AddNewClient calls find aCircuit.child to be true
2531 if (aCircuit == null || (aCircuit != null && aCircuit.child == false))
2532 {
2533 sp.IsChildAgent = false;
2534 Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
2535 }
2536 } 2498 }
2537 } 2499 }
2538 2500
@@ -2997,25 +2959,6 @@ namespace OpenSim.Region.Framework.Scenes
2997 } 2959 }
2998 2960
2999 /// <summary> 2961 /// <summary>
3000 /// Create a child agent scene presence and add it to this scene.
3001 /// </summary>
3002 /// <param name="client"></param>
3003 /// <returns></returns>
3004 protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client)
3005 {
3006 CheckHeartbeat();
3007 AvatarAppearance appearance = null;
3008 GetAvatarAppearance(client, out appearance);
3009
3010 ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance);
3011 //avatar.KnownRegions = GetChildrenSeeds(avatar.UUID);
3012
3013 m_eventManager.TriggerOnNewPresence(avatar);
3014
3015 return avatar;
3016 }
3017
3018 /// <summary>
3019 /// Get the avatar apperance for the given client. 2962 /// Get the avatar apperance for the given client.
3020 /// </summary> 2963 /// </summary>
3021 /// <param name="client"></param> 2964 /// <param name="client"></param>
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index a2ed54f..969ff13 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -73,7 +73,6 @@ namespace OpenSim.Region.Framework.Scenes
73 protected List<ScenePresence> m_scenePresenceArray = new List<ScenePresence>(); 73 protected List<ScenePresence> m_scenePresenceArray = new List<ScenePresence>();
74 74
75 protected internal EntityManager Entities = new EntityManager(); 75 protected internal EntityManager Entities = new EntityManager();
76 protected internal Dictionary<UUID, ScenePresence> RestorePresences = new Dictionary<UUID, ScenePresence>();
77 76
78 protected RegionInfo m_regInfo; 77 protected RegionInfo m_regInfo;
79 protected Scene m_parentScene; 78 protected Scene m_parentScene;
@@ -564,8 +563,8 @@ namespace OpenSim.Region.Framework.Scenes
564 { 563 {
565 ScenePresence newAvatar = null; 564 ScenePresence newAvatar = null;
566 565
566 // ScenePresence always defaults to child agent
567 newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance); 567 newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance);
568 newAvatar.IsChildAgent = true;
569 568
570 AddScenePresence(newAvatar); 569 AddScenePresence(newAvatar);
571 570
@@ -578,6 +577,7 @@ namespace OpenSim.Region.Framework.Scenes
578 /// <param name="presence"></param> 577 /// <param name="presence"></param>
579 protected internal void AddScenePresence(ScenePresence presence) 578 protected internal void AddScenePresence(ScenePresence presence)
580 { 579 {
580 // Always a child when added to the scene
581 bool child = presence.IsChildAgent; 581 bool child = presence.IsChildAgent;
582 582
583 if (child) 583 if (child)