private void OnShuttleShutdown(EntityUid uid, ShuttleComponent component, ComponentShutdown args) { // None of the below is necessary for any cleanup if we're just deleting. if (EntityManager.GetComponent <MetaDataComponent>(uid).EntityLifeStage >= EntityLifeStage.Terminating) { return; } if (!EntityManager.TryGetComponent(component.Owner, out PhysicsComponent? physicsComponent)) { return; } Disable(physicsComponent); if (!EntityManager.TryGetComponent(component.Owner, out FixturesComponent? fixturesComponent)) { return; } foreach (var fixture in fixturesComponent.Fixtures.Values) { fixture.Mass = 0f; } }
private void OnAirtightShutdown(EntityUid uid, AirtightComponent airtight, ComponentShutdown args) { SetAirblocked(airtight, false); InvalidatePosition(airtight.LastPosition.Item1, airtight.LastPosition.Item2, airtight.FixVacuum); RaiseLocalEvent(new AirtightChanged(airtight)); }
private void OnShutdown(EntityUid uid, SharedPullableComponent component, ComponentShutdown args) { if (component.Puller != null) { ForceRelationship(null, component); } }
private void OnShutdown(EntityUid uid, SleepingComponent component, ComponentShutdown args) { var ev = new SleepStateChangedEvent(false); RaiseLocalEvent(uid, ev, false); _blindingSystem.AdjustBlindSources(uid, false); }
/// <summary> /// Creates a new TCP server to listen on specific IP endpoint. /// </summary> /// <param name="EndPoint">Specification of the interface and TCP port on which the TCP server should listen. IPAddress.Any is a valid value for the interface.</param> /// <param name="UseTls">Indication of whether to use TLS for this TCP server.</param> /// <param name="Roles">One or more roles of this server.</param> /// <param name="ClientKeepAliveTimeoutMs">Number of milliseconds after which the server's client is considered inactive and its connection can be terminated.</param> public TcpRoleServer(IPEndPoint EndPoint, bool UseTls, uint Roles, int ClientKeepAliveTimeoutMs) { string logPrefix = string.Format("[{0}/tcp{1}] ", EndPoint.Port, UseTls ? "_tls" : ""); log = new Logger("IopServerCore.Network.TcpRoleServer", logPrefix); log.Trace("(EndPoint:'{0}',UseTls:{1},Roles:{2},ClientKeepAliveTimeoutMs:{3})", EndPoint, UseTls, Roles, ClientKeepAliveTimeoutMs); this.UseTls = UseTls; this.Roles = Roles; this.EndPoint = EndPoint; this.clientKeepAliveTimeoutMs = ClientKeepAliveTimeoutMs; ShutdownSignaling = new ComponentShutdown(Base.ComponentManager.GlobalShutdown); serverComponent = (ServerBase <TIncomingClient>)Base.ComponentDictionary[ServerBase <TIncomingClient> .ComponentName]; clientList = serverComponent.GetClientList(); IsRunning = false; Listener = new TcpListener(this.EndPoint); Listener.Server.LingerState = new LingerOption(true, 0); Listener.Server.NoDelay = true; IdBase = ((uint)Roles << 24); log.Trace("(-)"); }
private void OnBlindShutdown(EntityUid uid, BlindableComponent component, ComponentShutdown args) { if (_player.LocalPlayer?.ControlledEntity == uid) { _overlayMan.RemoveOverlay(_overlay); } }
private void OnShutdown(EntityUid uid, PAIComponent component, ComponentShutdown args) { if (component.MidiAction != null) { _actionsSystem.RemoveAction(uid, component.MidiAction); } }
private void OnShutdown(EntityUid uid, VocalComponent component, ComponentShutdown args) { if (component.ScreamAction != null) { _actions.RemoveAction(uid, component.ScreamAction); } }
private void OnActorShutdown(EntityUid entity, ActorComponent component, ComponentShutdown args) { component.PlayerSession.SetAttachedEntity(null); // The player is fully detached now that the component has shut down. RaiseLocalEvent(entity, new PlayerDetachedEvent(entity, component.PlayerSession)); }
private void OnDrunkShutdown(EntityUid uid, DrunkComponent component, ComponentShutdown args) { if (_player.LocalPlayer?.ControlledEntity == uid) { _overlay.CurrentBoozePower = 0; _overlayMan.RemoveOverlay(_overlay); } }
private void OnPhysicsShutdown(EntityUid uid, PhysicsComponent component, ComponentShutdown args) { if (EntityManager.GetComponent <MetaDataComponent>(uid).EntityLifeStage > EntityLifeStage.MapInitialized) { return; } EntityManager.RemoveComponent <FixturesComponent>(uid); }
private void OnShutdown(EntityUid uid, SeeingRainbowsComponent component, ComponentShutdown args) { if (_player.LocalPlayer?.ControlledEntity == uid) { _overlay.Intoxication = 0; _overlayMan.RemoveOverlay(_overlay); } }
private void OnHostShutdown(EntityUid uid, GuardianHostComponent component, ComponentShutdown args) { if (component.HostedGuardian == null) { return; } EntityManager.QueueDeleteEntity(component.HostedGuardian.Value); }
private void OnShutdown(EntityUid uid, MindComponent mind, ComponentShutdown args) { // Let's not create ghosts if not in the middle of the round. if (_gameTicker.RunLevel != GameRunLevel.InRound) { return; } if (mind.HasMind) { if (mind.Mind?.VisitingEntity is { Valid : true } visiting) { if (TryComp(visiting, out GhostComponent? ghost)) { _ghostSystem.SetCanReturnToBody(ghost, false); } mind.Mind !.TransferTo(visiting); } else if (mind.GhostOnShutdown) { Transform(uid).AttachToGridOrMap(); var spawnPosition = Transform(uid).Coordinates; // Use a regular timer here because the entity has probably been deleted. Timer.Spawn(0, () => { // Make extra sure the round didn't end between spawning the timer and it being executed. if (_gameTicker.RunLevel != GameRunLevel.InRound) { return; } // Async this so that we don't throw if the grid we're on is being deleted. var gridId = spawnPosition.GetGridUid(EntityManager); if (!spawnPosition.IsValid(EntityManager) || gridId == EntityUid.Invalid || !_mapManager.GridExists(gridId)) { spawnPosition = _gameTicker.GetObserverSpawnPoint(); } var ghost = Spawn("MobObserver", spawnPosition); var ghostComponent = Comp <GhostComponent>(ghost); _ghostSystem.SetCanReturnToBody(ghostComponent, false); // Log these to make sure they're not causing the GameTicker round restart bugs... Logger.DebugS("mind", $"Entity \"{ToPrettyString(uid)}\" for {mind.Mind?.CharacterName} was deleted, spawned \"{ToPrettyString(ghost)}\"."); if (mind.Mind == null) { return; } var val = mind.Mind.CharacterName ?? string.Empty; MetaData(ghost).EntityName = val; mind.Mind.TransferTo(ghost); }); } }
private void OnShutdown(EntityUid uid, FlyBySoundComponent component, ComponentShutdown args) { if (!TryComp <PhysicsComponent>(uid, out var body)) { return; } _fixtures.DestroyFixture(body, FlyByFixture); }
private void OnShutdown(EntityUid uid, AtmosPipeColorComponent component, ComponentShutdown args) { if (!ComponentManager.TryGetComponent(uid, out AppearanceComponent? appearance)) { return; } appearance.SetData(PipeColorVisuals.Color, Color.White); }
private void OnRelayShutdown(EntityUid uid, RelayInputMoverComponent component, ComponentShutdown args) { // If relay is removed then cancel all inputs. if (!TryComp <InputMoverComponent>(component.RelayEntity, out var inputMover)) { return; } SetMoveInput(inputMover, MoveButtons.None); }
private void OnShutdown(EntityUid uid, RottingComponent component, ComponentShutdown args) { RemComp <FliesComponent>(uid); if (TryComp <PerishableComponent>(uid, out var perishable)) { perishable.DeathAccumulator = 0; perishable.RotAccumulator = 0; } }
private void OnShutdown(EntityUid uid, BlockingComponent component, ComponentShutdown args) { //In theory the user should not be null when this fires off if (component.User != null) { _actionsSystem.RemoveProvidedActions(component.User.Value, uid); BlockingShutdownHelper(uid, component, component.User.Value); } }
private void OnShutdown(EntityUid uid, DockingComponent component, ComponentShutdown args) { if (component.DockedWith == null || EntityManager.GetComponent <MetaDataComponent>(uid).EntityLifeStage > EntityLifeStage.MapInitialized) { return; } Cleanup(component); }
private void OnAirtightShutdown(EntityUid uid, AirtightComponent airtight, ComponentShutdown args) { SetAirblocked(airtight, false); InvalidatePosition(airtight.LastPosition.Item1, airtight.LastPosition.Item2); if (airtight.FixVacuum) { _atmosphereSystem.FixVacuum(airtight.LastPosition.Item1, airtight.LastPosition.Item2); } }
private void OnShutdown(EntityUid uid, JitteringComponent jittering, ComponentShutdown args) { if (EntityManager.TryGetComponent(uid, out AnimationPlayerComponent? animationPlayer)) { animationPlayer.Stop(_jitterAnimationKey); } if (EntityManager.TryGetComponent(uid, out SpriteComponent? sprite)) { sprite.Offset = Vector2.Zero; } }
private void OnHeadstandRemoved(EntityUid uid, HeadstandComponent component, ComponentShutdown args) { if (!TryComp <SpriteComponent>(uid, out var sprite)) { return; } foreach (var layer in sprite.AllLayers) { layer.Rotation -= Angle.FromDegrees(180.0f); } }
private void OnActorShutdown(EntityUid uid, ActorComponent component, ComponentShutdown args) { component.PlayerSession.SetAttachedEntity(null); var entity = EntityManager.GetEntity(uid); // TODO: Remove component message. entity.SendMessage(component, new PlayerDetachedMsg(component.PlayerSession)); // The player is fully detached now that the component has shut down. RaiseLocalEvent(uid, new PlayerDetachedEvent(entity, component.PlayerSession)); }
private void OnShutdown(EntityUid uid, SharedCombatModeComponent component, ComponentShutdown args) { if (component.CombatToggleAction != null) { _actionsSystem.RemoveAction(uid, component.CombatToggleAction); } if (component.DisarmAction != null) { _actionsSystem.RemoveAction(uid, component.DisarmAction); } }
private void KillSignRemoved(EntityUid uid, KillSignComponent component, ComponentShutdown args) { if (!TryComp <SpriteComponent>(uid, out var sprite)) { return; } if (!sprite.LayerMapTryGet(KillSignKey.Key, out var layer)) { return; } sprite.RemoveLayer(layer); }
private void OnAirtightShutdown(EntityUid uid, AirtightComponent airtight, ComponentShutdown args) { var xform = Transform(uid); // If the grid is deleting no point updating atmos. if (_mapManager.TryGetGrid(xform.GridID, out var grid)) { if (MetaData(grid.GridEntityId).EntityLifeStage > EntityLifeStage.MapInitialized) { return; } } SetAirblocked(airtight, false, xform); }
/// <summary> /// Initialize the object. /// </summary> /// <param name="ServerEndPoint">LOC server address and port.</param> public LocClient(IPEndPoint ServerEndPoint, IMessageProcessor MessageProcessor, ComponentShutdown ShutdownSignaling) : base(ServerEndPoint, false) { log = new Logger("IopServerCore.Network.LOC.LocClient"); log.Trace("(ServerEndPoint:'{0}')", ServerEndPoint); config = (ConfigBase)Base.ComponentDictionary[ConfigBase.ComponentName]; messageBuilder = new LocMessageBuilder(0, new List <SemVer> { SemVer.V100 }); messageProcessor = MessageProcessor; shutdownSignaling = ShutdownSignaling; log.Trace("(-)"); }
private void OnShutdown(EntityUid uid, FixturesComponent component, ComponentShutdown args) { // TODO: Need a better solution to this because the only reason I don't throw is that allcomponents test // Yes it is actively making the game buggier but I would essentially double the size of this PR trying to fix it // my best solution rn is move the broadphase property onto FixturesComponent and then refactor // SharedBroadphaseSystem a LOT. if (!EntityManager.TryGetComponent(uid, out PhysicsComponent? body)) { return; } // Can't just get physicscomp on shutdown as it may be touched completely independently. body.DestroyContacts(); _broadphaseSystem.RemoveBody(body, component); body.CanCollide = false; }
private void OnShutdown(EntityUid uid, MindComponent mind, ComponentShutdown args) { // Let's not create ghosts if not in the middle of the round. if (_gameTicker.RunLevel != GameRunLevel.InRound) { return; } if (mind.HasMind) { if (mind.Mind?.VisitingEntity is { Valid : true } visiting) { if (TryComp(visiting, out GhostComponent? ghost)) { _ghostSystem.SetCanReturnToBody(ghost, false); } mind.Mind !.TransferTo(visiting); } else if (mind.GhostOnShutdown) { var spawnPosition = Transform(uid).Coordinates; // Use a regular timer here because the entity has probably been deleted. Timer.Spawn(0, () => { // Async this so that we don't throw if the grid we're on is being deleted. var gridId = spawnPosition.GetGridId(EntityManager); if (gridId == GridId.Invalid || !_mapManager.GridExists(gridId)) { spawnPosition = EntitySystem.Get <GameTicker>().GetObserverSpawnPoint(); } var ghost = Spawn("MobObserver", spawnPosition); var ghostComponent = Comp <GhostComponent>(ghost); _ghostSystem.SetCanReturnToBody(ghostComponent, false); if (mind.Mind == null) { return; } var val = mind.Mind.CharacterName ?? string.Empty; MetaData(ghost).EntityName = val; mind.Mind.TransferTo(ghost); }); } }