public ScenePresence(IClientAPI client, IScene world) : this() { m_controllingClient = client; m_name = m_controllingClient.Name; m_scene = world; m_uuid = client.AgentId; m_localId = m_scene.SceneGraph.AllocateLocalId(); CreateSceneViewer(); m_animator = new Animator(this); UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.AllScopeIDs, m_uuid); if (account != null) { m_userLevel = account.UserLevel; client.ScopeID = account.ScopeID; client.AllScopeIDs = account.AllScopeIDs; } else client.ScopeID = m_scene.RegionInfo.ScopeID; AbsolutePosition = posLastSignificantMove = m_CameraCenter = m_controllingClient.StartPos; // This won't send anything, as we are still a child here... //Animator.TrySetMovementAnimation("STAND"); // we created a new ScenePresence (a new child agent) in a fresh region. // Request info about all the (root) agents in this region // Note: This won't send data *to* other clients in that region (children don't send) //SendInitialFullUpdateToAllClients(); //SendOtherAgentsAvatarDataToMe(); //Comment this out for now, just to see what happens //SendOtherAgentsAppearanceToMe(); RegisterToEvents(); SetDirectionVectors(); }
public virtual void Close() { m_sceneViewer.Close(); RemoveFromPhysicalScene(); if (m_animator == null) return; m_animator.Close(); m_animator = null; }
/// <summary> /// This turns a root agent into a child agent /// when an agent departs this region for a neighbor, this gets called. /// It doesn't get called for a teleport. Reason being, an agent that /// teleports out may not end up anywhere near this region /// </summary> public virtual void MakeChildAgent(GridRegion destination) { IsChildAgent = true; SuccessfullyMadeRootAgent = false; SuccessfulTransit(); // It looks like m_animator is set to null somewhere, and MakeChild // is called after that. Probably in aborted teleports. if (m_animator == null) m_animator = new Animator(this); else Animator.ResetAnimations(); MainConsole.Instance.DebugFormat( "[SCENEPRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}", Name, UUID, m_scene.RegionInfo.RegionName); RemoveFromPhysicalScene(); m_sceneViewer.Reset(); SendScriptEventToAllAttachments(Changed.TELEPORT); m_scene.EventManager.TriggerOnMakeChildAgent(this, destination); Reset(); }