public ScenePresence( IClientAPI client, Scene world, AvatarAppearance appearance, PresenceType type) { m_scene = world; AttachmentsSyncLock = new Object(); AllowMovement = true; IsChildAgent = true; IsLoggingIn = false; m_sendCoarseLocationsMethod = SendCoarseLocationsDefault; Animator = new ScenePresenceAnimator(this); Overrides = new MovementAnimationOverrides(); PresenceType = type; DrawDistance = world.DefaultDrawDistance; RegionHandle = world.RegionInfo.RegionHandle; ControllingClient = client; Firstname = ControllingClient.FirstName; Lastname = ControllingClient.LastName; m_name = String.Format("{0} {1}", Firstname, Lastname); m_uuid = client.AgentId; LocalId = m_scene.AllocateLocalId(); LegacySitOffsets = m_scene.LegacySitOffsets; UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); if (account != null) m_userFlags = account.UserFlags; else m_userFlags = 0; if (account != null) UserLevel = account.UserLevel; IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); if (gm != null) Grouptitle = gm.GetGroupTitle(m_uuid); m_scriptEngines = m_scene.RequestModuleInterfaces<IScriptModule>(); AbsolutePosition = posLastSignificantMove = CameraPosition = m_lastCameraPosition = ControllingClient.StartPos; m_reprioritization_timer = new Timer(world.ReprioritizationInterval); m_reprioritization_timer.Elapsed += new ElapsedEventHandler(Reprioritize); m_reprioritization_timer.AutoReset = false; AdjustKnownSeeds(); RegisterToEvents(); SetDirectionVectors(); Appearance = appearance; m_stateMachine = new ScenePresenceStateMachine(this); }
/// <summary> /// Attach this object to a scene. It will also now appear to agents. /// </summary> /// <param name="scene"></param> public void AttachToScene(Scene scene) { m_scene = scene; RegionHandle = m_scene.RegionInfo.RegionHandle; if (m_rootPart.Shape.PCode != 9 || m_rootPart.Shape.State == 0) m_rootPart.ParentID = 0; if (m_rootPart.LocalId == 0) m_rootPart.LocalId = m_scene.AllocateLocalId(); SceneObjectPart[] parts = m_parts.GetArray(); for (int i = 0; i < parts.Length; i++) { SceneObjectPart part = parts[i]; if (Object.ReferenceEquals(part, m_rootPart)) continue; if (part.LocalId == 0) part.LocalId = m_scene.AllocateLocalId(); part.ParentID = m_rootPart.LocalId; //m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID); } ApplyPhysics(); // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled // for the same object with very different properties. The caller must schedule the update. //ScheduleGroupForFullUpdate(); }
/// <summary> /// Attach this object to a scene. It will also now appear to agents. /// </summary> /// <param name="scene"></param> public void AttachToScene(Scene scene) { m_scene = scene; RegionHandle = m_scene.RegionInfo.RegionHandle; if (m_rootPart.Shape.PCode != 9 || m_rootPart.Shape.State == 0) m_rootPart.ParentID = 0; if (m_rootPart.LocalId == 0) m_rootPart.LocalId = m_scene.AllocateLocalId(); // No need to lock here since the object isn't yet in a scene foreach (SceneObjectPart part in m_parts.Values) { if (Object.ReferenceEquals(part, m_rootPart)) { continue; } if (part.LocalId == 0) { part.LocalId = m_scene.AllocateLocalId(); } part.ParentID = m_rootPart.LocalId; //m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID); } ApplyPhysics(m_scene.m_physicalPrim); // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled // for the same object with very different properties. The caller must schedule the update. //ScheduleGroupForFullUpdate(); }
private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this() { m_rootRegionHandle = reginfo.RegionHandle; m_controllingClient = client; m_firstname = m_controllingClient.FirstName; m_lastname = m_controllingClient.LastName; m_name = String.Format("{0} {1}", m_firstname, m_lastname); m_scene = world; m_uuid = client.AgentId; m_regionInfo = reginfo; m_localId = m_scene.AllocateLocalId(); UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); if (account != null) m_userLevel = account.UserLevel; IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); if (gm != null) m_grouptitle = gm.GetGroupTitle(m_uuid); m_scriptEngines = m_scene.RequestModuleInterfaces<IScriptModule>(); AbsolutePosition = posLastSignificantMove = m_CameraCenter = m_lastCameraCenter = m_controllingClient.StartPos; m_reprioritization_timer = new Timer(world.ReprioritizationInterval); m_reprioritization_timer.Elapsed += new ElapsedEventHandler(Reprioritize); m_reprioritization_timer.AutoReset = false; AdjustKnownSeeds(); // TODO: I think, 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(); RegisterToEvents(); SetDirectionVectors(); }
private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) { m_regionHandle = reginfo.RegionHandle; m_controllingClient = client; Firstname = m_controllingClient.FirstName; Lastname = m_controllingClient.LastName; m_name = String.Format("{0} {1}", Firstname, Lastname); m_scene = world; m_uuid = client.AgentId; m_regionInfo = reginfo; m_localId = m_scene.AllocateLocalId(); m_useFlySlow = m_scene.m_useFlySlow; m_usePreJump = m_scene.m_usePreJump; IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); if (gm != null) m_grouptitle = gm.GetGroupTitle(m_uuid); m_scriptEngines = m_scene.RequestModuleInterfaces<IScriptModule>(); ISceneViewModule sceneViewModule = m_scene.RequestModuleInterface<ISceneViewModule>(); if (sceneViewModule != null) m_sceneView = sceneViewModule.CreateSceneView(this); else m_log.Warn("[SCENE PRESENCE]: Failed to create a scene view"); SetAgentPositionInfo(null, true, m_controllingClient.StartPos, null, Vector3.Zero, m_velocity); m_animPersistUntil = 0; RegisterToEvents(); SetDirectionVectors(); SetDirectionFlags(); m_remotePresences = new AvatarRemotePresences(world, this); m_connection = world.ConnectionManager.GetConnection(this.UUID); if (m_connection != null) // can be null for bots which don't have a LLCV m_connection.ScenePresence = this; // Prime (cache) the user's group list. m_scene.UserGroupsGet(this.UUID); }
/// <summary> /// Attach this object to a scene. It will also now appear to agents. /// </summary> /// <param name="scene"></param> public void AttachToScene(Scene scene, bool fromStorage) { m_scene = scene; RegionHandle = m_scene.RegionInfo.RegionHandle; if (!IsAttachment) m_rootPart.ParentID = 0; if (m_rootPart.LocalId == 0) m_rootPart.LocalId = m_scene.AllocateLocalId(); // No need to lock here since the object isn't yet in a scene foreach (SceneObjectPart part in m_parts.Values) { if (Object.ReferenceEquals(part, m_rootPart)) continue; if (part.LocalId == 0) part.LocalId = m_scene.AllocateLocalId(); part.ParentID = m_rootPart.LocalId; //m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID); } if (RootPart.PhysActor == null) //don't apply physics if we already have a physactor. { ApplyPhysics(m_scene.m_physicalPrim, fromStorage); ScheduleGroupForFullUpdate(); } // Need the bounding box now. BoundingBox(); }
/// <summary> /// Attach this object to a scene. It will also now appear to agents. /// </summary> /// <param name="scene"></param> public void AttachToScene(Scene scene) { m_scene = scene; RegionHandle = m_scene.RegionInfo.RegionHandle; if (m_rootPart.Shape.PCode != 9 || m_rootPart.Shape.State == 0) m_rootPart.ParentID = 0; if (m_rootPart.LocalId==0) m_rootPart.LocalId = m_scene.AllocateLocalId(); // No need to lock here since the object isn't yet in a scene foreach (SceneObjectPart part in m_parts.Values) { if (Object.ReferenceEquals(part, m_rootPart)) { continue; } if (part.LocalId == 0) { part.LocalId = m_scene.AllocateLocalId(); } part.ParentID = m_rootPart.LocalId; //m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID); } ApplyPhysics(m_scene.m_physicalPrim); ScheduleGroupForFullUpdate(); }
private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) { m_sendCourseLocationsMethod = SendCoarseLocationsDefault; CreateSceneViewer(); m_regionHandle = reginfo.RegionHandle; m_controllingClient = client; m_firstname = m_controllingClient.FirstName; m_lastname = m_controllingClient.LastName; m_name = String.Format("{0} {1}", m_firstname, m_lastname); m_scene = world; m_uuid = client.AgentId; m_regionInfo = reginfo; m_localId = m_scene.AllocateLocalId(); m_useFlySlow = m_scene.m_useFlySlow; m_usePreJump = m_scene.m_usePreJump; IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); if (gm != null) m_grouptitle = gm.GetGroupTitle(m_uuid); m_scriptEngines = m_scene.RequestModuleInterfaces<IScriptModule>(); AbsolutePosition = m_controllingClient.StartPos; AdjustKnownSeeds(); TrySetMovementAnimation("STAND"); // TODO: I think, this won't send anything, as we are still a child here... // 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(); RegisterToEvents(); SetDirectionVectors(); }
public ScenePresence( IClientAPI client, Scene world, AvatarAppearance appearance, PresenceType type) { m_scene = world; AttachmentsSyncLock = new Object(); AllowMovement = true; IsChildAgent = true; IsLoggingIn = false; m_sendCoarseLocationsMethod = SendCoarseLocationsDefault; Animator = new ScenePresenceAnimator(this); Overrides = new MovementAnimationOverrides(); PresenceType = type; DrawDistance = world.DefaultDrawDistance; RegionHandle = world.RegionInfo.RegionHandle; ControllingClient = client; Firstname = ControllingClient.FirstName; Lastname = ControllingClient.LastName; m_name = String.Format("{0} {1}", Firstname, Lastname); m_uuid = client.AgentId; LocalId = m_scene.AllocateLocalId(); LegacySitOffsets = m_scene.LegacySitOffsets; UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); if (account != null) m_userFlags = account.UserFlags; else m_userFlags = 0; if (account != null) UserLevel = account.UserLevel; // IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); // if (gm != null) // Grouptitle = gm.GetGroupTitle(m_uuid); m_scriptEngines = m_scene.RequestModuleInterfaces<IScriptModule>(); AbsolutePosition = posLastMove = posLastSignificantMove = CameraPosition = m_reprioritizationLastPosition = ControllingClient.StartPos; m_reprioritizationLastDrawDistance = DrawDistance; // disable updates workjobs for now childUpdatesBusy = true; m_reprioritizationBusy = true; AdjustKnownSeeds(); RegisterToEvents(); SetDirectionVectors(); Appearance = appearance; m_stateMachine = new ScenePresenceStateMachine(this); HealRate = 0.5f; IConfig sconfig = m_scene.Config.Configs["EntityTransfer"]; if (sconfig != null) { string lpb = sconfig.GetString("LandingPointBehavior", "LandingPointBehavior_OS"); if (lpb == "LandingPointBehavior_SL") m_LandingPointBehavior = LandingPointBehavior.SL; } }
/// <summary> /// Attach this object to a scene. It will also now appear to agents. /// </summary> /// <param name="scene"></param> public void AttachToScene(Scene scene) { m_scene = scene; if (m_rootPart.Shape == null) { m_log.Warn("[SceneObjectGroup]: Found null shape for prim " + UUID + ", creating default box shape"); m_rootPart.Shape = new PrimitiveBaseShape(); } if (m_rootPart.Shape.PCode != 9 || m_rootPart.Shape.State == 0) m_rootPart.SetParentLocalId(0); bool changedLocalIDs = false; if (m_rootPart.LocalId == 0) { m_rootPart.LocalId = m_scene.AllocateLocalId(); changedLocalIDs = true; } // No need to lock here since the object isn't yet in a scene foreach (SceneObjectPart part in m_partsList) { if (Object.ReferenceEquals(part, m_rootPart)) continue; if (part.LocalId == 0) { part.LocalId = m_scene.AllocateLocalId(); changedLocalIDs = true; } part.SetParentLocalId(m_rootPart.LocalId); //m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID); } IOpenRegionSettingsModule WSModule = Scene.RequestModuleInterface<IOpenRegionSettingsModule>(); if (WSModule != null) ApplyPhysics(WSModule.AllowPhysicalPrims); else ApplyPhysics(true); if (changedLocalIDs) { m_scene.Entities.Remove(LocalId); m_scene.Entities.Remove(UUID); m_scene.Entities.Add(this); } // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled // for the same object with very different properties. The caller must schedule the update. //ScheduleGroupForFullUpdate(); }
/// <summary> /// Attach this object to a scene. It will also now appear to agents. /// </summary> /// <param name="scene"></param> public void AttachToScene(Scene scene, bool fromStorage) { m_scene = scene; RegionHandle = m_scene.RegionInfo.RegionHandle; if (!IsAttachment) m_rootPart.ParentID = 0; if (m_rootPart.LocalId == 0) m_rootPart.LocalId = m_scene.AllocateLocalId(); m_childParts.ForEachPart((SceneObjectPart part) => { if (Object.ReferenceEquals(part, m_rootPart)) return; if (part.LocalId == 0) part.LocalId = m_scene.AllocateLocalId(); part.ParentID = m_rootPart.LocalId; }); if (RootPart.PhysActor == null) //don't apply physics if we already have a physactor. { ApplyPhysics(m_scene.m_physicalPrim, fromStorage); ScheduleGroupForFullUpdate(PrimUpdateFlags.ForcedFullUpdate); } // Need the bounding box now. BoundingBox(); //Signal a new object appearing in the scene Scene.EventManager.TriggerObjectAddedToScene(this); }
public ScenePresence( IClientAPI client, Scene world, AvatarAppearance appearance, PresenceType type) { AttachmentsSyncLock = new Object(); m_sendCourseLocationsMethod = SendCoarseLocationsDefault; Animator = new ScenePresenceAnimator(this); PresenceType = type; DrawDistance = world.DefaultDrawDistance; RegionHandle = world.RegionInfo.RegionHandle; ControllingClient = client; Firstname = ControllingClient.FirstName; Lastname = ControllingClient.LastName; m_name = String.Format("{0} {1}", Firstname, Lastname); m_scene = world; m_uuid = client.AgentId; LocalId = m_scene.AllocateLocalId(); UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); if (account != null) m_userFlags = account.UserFlags; else m_userFlags = 0; if (account != null) UserLevel = account.UserLevel; IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); if (gm != null) Grouptitle = gm.GetGroupTitle(m_uuid); m_scriptEngines = m_scene.RequestModuleInterfaces<IScriptModule>(); AbsolutePosition = posLastSignificantMove = CameraPosition = m_lastCameraPosition = ControllingClient.StartPos; m_reprioritization_timer = new Timer(world.ReprioritizationInterval); m_reprioritization_timer.Elapsed += new ElapsedEventHandler(Reprioritize); m_reprioritization_timer.AutoReset = false; AdjustKnownSeeds(); // TODO: I think, 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) // MIC: This gets called again in CompleteMovement // SendInitialFullUpdateToAllClients(); SendOtherAgentsAvatarDataToMe(); SendOtherAgentsAppearanceToMe(); RegisterToEvents(); SetDirectionVectors(); Appearance = appearance; }