From: Pieter-Jan Briers Date: Mon, 26 Feb 2024 03:36:19 +0000 (+0100) Subject: Use new ComponentPauseGenerator (#25183) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=e00f74505c62310bd15aeaba8d6530f648397074;p=space-station-14.git Use new ComponentPauseGenerator (#25183) Also includes some (non critical) changes to the solution file to re-organize the Roslyn components. --- diff --git a/Content.Server/Anomaly/AnomalySystem.Generator.cs b/Content.Server/Anomaly/AnomalySystem.Generator.cs index d07740e2f6..2053a7bbbe 100644 --- a/Content.Server/Anomaly/AnomalySystem.Generator.cs +++ b/Content.Server/Anomaly/AnomalySystem.Generator.cs @@ -33,9 +33,7 @@ public sealed partial class AnomalySystem SubscribeLocalEvent(OnGeneratorMaterialAmountChanged); SubscribeLocalEvent(OnGenerateButtonPressed); SubscribeLocalEvent(OnGeneratorPowerChanged); - SubscribeLocalEvent(OnGeneratorUnpaused); SubscribeLocalEvent(OnGeneratingStartup); - SubscribeLocalEvent(OnGeneratingUnpaused); } private void OnGeneratorPowerChanged(EntityUid uid, AnomalyGeneratorComponent component, ref PowerChangedEvent args) @@ -58,11 +56,6 @@ public sealed partial class AnomalySystem TryGeneratorCreateAnomaly(uid, component); } - private void OnGeneratorUnpaused(EntityUid uid, AnomalyGeneratorComponent component, ref EntityUnpausedEvent args) - { - component.CooldownEndTime += args.PausedTime; - } - public void UpdateGeneratorUi(EntityUid uid, AnomalyGeneratorComponent component) { var materialAmount = _material.GetMaterialAmount(uid, component.RequiredMaterial); @@ -169,11 +162,6 @@ public sealed partial class AnomalySystem Appearance.SetData(uid, AnomalyGeneratorVisuals.Generating, true); } - private void OnGeneratingUnpaused(EntityUid uid, GeneratingAnomalyGeneratorComponent component, ref EntityUnpausedEvent args) - { - component.EndTime += args.PausedTime; - } - private void OnGeneratingFinished(EntityUid uid, AnomalyGeneratorComponent component) { var xform = Transform(uid); diff --git a/Content.Server/Anomaly/AnomalySystem.Vessel.cs b/Content.Server/Anomaly/AnomalySystem.Vessel.cs index 7c7feacb87..98e56a8844 100644 --- a/Content.Server/Anomaly/AnomalySystem.Vessel.cs +++ b/Content.Server/Anomaly/AnomalySystem.Vessel.cs @@ -22,7 +22,6 @@ public sealed partial class AnomalySystem SubscribeLocalEvent(OnVesselInteractUsing); SubscribeLocalEvent(OnExamined); SubscribeLocalEvent(OnVesselGetPointsPerSecond); - SubscribeLocalEvent(OnUnpaused); SubscribeLocalEvent(OnShutdown); SubscribeLocalEvent(OnStabilityChanged); } @@ -92,11 +91,6 @@ public sealed partial class AnomalySystem args.Points += (int) (GetAnomalyPointValue(anomaly) * component.PointMultiplier); } - private void OnUnpaused(EntityUid uid, AnomalyVesselComponent component, ref EntityUnpausedEvent args) - { - component.NextBeep += args.PausedTime; - } - private void OnVesselAnomalyShutdown(ref AnomalyShutdownEvent args) { var query = EntityQueryEnumerator(); diff --git a/Content.Server/Anomaly/Components/AnomalyGeneratorComponent.cs b/Content.Server/Anomaly/Components/AnomalyGeneratorComponent.cs index 1ff0290fc9..d4acfc6150 100644 --- a/Content.Server/Anomaly/Components/AnomalyGeneratorComponent.cs +++ b/Content.Server/Anomaly/Components/AnomalyGeneratorComponent.cs @@ -12,13 +12,14 @@ namespace Content.Server.Anomaly.Components; /// This is used for a machine that is able to generate /// anomalies randomly on the station. /// -[RegisterComponent, Access(typeof(SharedAnomalySystem))] +[RegisterComponent, Access(typeof(SharedAnomalySystem)), AutoGenerateComponentPause] public sealed partial class AnomalyGeneratorComponent : Component { /// /// The time at which the cooldown for generating another anomaly will be over /// [DataField("cooldownEndTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] + [AutoPausedField] public TimeSpan CooldownEndTime = TimeSpan.Zero; /// diff --git a/Content.Server/Anomaly/Components/AnomalyVesselComponent.cs b/Content.Server/Anomaly/Components/AnomalyVesselComponent.cs index 74c5e3e9ed..1225cbf116 100644 --- a/Content.Server/Anomaly/Components/AnomalyVesselComponent.cs +++ b/Content.Server/Anomaly/Components/AnomalyVesselComponent.cs @@ -10,7 +10,7 @@ namespace Content.Server.Anomaly.Components; /// they generate points for the selected server based on /// the anomaly's stability and severity. /// -[RegisterComponent, Access(typeof(SharedAnomalySystem))] +[RegisterComponent, Access(typeof(SharedAnomalySystem)), AutoGenerateComponentPause] public sealed partial class AnomalyVesselComponent : Component { /// @@ -42,6 +42,7 @@ public sealed partial class AnomalyVesselComponent : Component /// When the next beep sound will play /// [DataField("nextBeep", customTypeSerializer:typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan NextBeep = TimeSpan.Zero; /// diff --git a/Content.Server/Anomaly/Components/GeneratingAnomalyGeneratorComponent.cs b/Content.Server/Anomaly/Components/GeneratingAnomalyGeneratorComponent.cs index 4233bfd7e1..ef93e8c699 100644 --- a/Content.Server/Anomaly/Components/GeneratingAnomalyGeneratorComponent.cs +++ b/Content.Server/Anomaly/Components/GeneratingAnomalyGeneratorComponent.cs @@ -4,13 +4,14 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; namespace Content.Server.Anomaly.Components; -[RegisterComponent, Access(typeof(SharedAnomalySystem))] +[RegisterComponent, Access(typeof(SharedAnomalySystem)), AutoGenerateComponentPause] public sealed partial class GeneratingAnomalyGeneratorComponent : Component { /// /// When the generating period will end. /// [DataField("endTime", customTypeSerializer: typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan EndTime = TimeSpan.Zero; public EntityUid? AudioStream; diff --git a/Content.Server/Atmos/Rotting/RottingSystem.cs b/Content.Server/Atmos/Rotting/RottingSystem.cs index e3389def66..47bac84e0c 100644 --- a/Content.Server/Atmos/Rotting/RottingSystem.cs +++ b/Content.Server/Atmos/Rotting/RottingSystem.cs @@ -29,11 +29,9 @@ public sealed class RottingSystem : SharedRottingSystem base.Initialize(); SubscribeLocalEvent(OnPerishableMapInit); - SubscribeLocalEvent(OnPerishableUnpaused); SubscribeLocalEvent(OnMobStateChanged); SubscribeLocalEvent(OnPerishableExamined); - SubscribeLocalEvent(OnRottingUnpaused); SubscribeLocalEvent(OnShutdown); SubscribeLocalEvent(OnRottingMobStateChanged); SubscribeLocalEvent(OnGibbed); @@ -47,11 +45,6 @@ public sealed class RottingSystem : SharedRottingSystem component.RotNextUpdate = _timing.CurTime + component.PerishUpdateRate; } - private void OnPerishableUnpaused(EntityUid uid, PerishableComponent component, ref EntityUnpausedEvent args) - { - component.RotNextUpdate += args.PausedTime; - } - private void OnMobStateChanged(EntityUid uid, PerishableComponent component, MobStateChangedEvent args) { if (args.NewMobState != MobState.Dead && args.OldMobState != MobState.Dead) @@ -64,11 +57,6 @@ public sealed class RottingSystem : SharedRottingSystem component.RotNextUpdate = _timing.CurTime + component.PerishUpdateRate; } - private void OnRottingUnpaused(EntityUid uid, RottingComponent component, ref EntityUnpausedEvent args) - { - component.NextRotUpdate += args.PausedTime; - } - private void OnShutdown(EntityUid uid, RottingComponent component, ComponentShutdown args) { if (TryComp(uid, out var perishable)) diff --git a/Content.Server/Charges/Components/AutoRechargeComponent.cs b/Content.Server/Charges/Components/AutoRechargeComponent.cs index e23f0229bb..9dcf555ea9 100644 --- a/Content.Server/Charges/Components/AutoRechargeComponent.cs +++ b/Content.Server/Charges/Components/AutoRechargeComponent.cs @@ -7,7 +7,7 @@ namespace Content.Server.Charges.Components; /// Something with limited charges that can be recharged automatically. /// Requires LimitedChargesComponent to function. /// -[RegisterComponent] +[RegisterComponent, AutoGenerateComponentPause] [Access(typeof(ChargesSystem))] public sealed partial class AutoRechargeComponent : Component { @@ -21,5 +21,6 @@ public sealed partial class AutoRechargeComponent : Component /// The time when the next charge will be added /// [DataField("nextChargeTime", customTypeSerializer: typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan NextChargeTime; } diff --git a/Content.Server/Charges/Systems/ChargesSystem.cs b/Content.Server/Charges/Systems/ChargesSystem.cs index 82758f4653..03e192e680 100644 --- a/Content.Server/Charges/Systems/ChargesSystem.cs +++ b/Content.Server/Charges/Systems/ChargesSystem.cs @@ -10,13 +10,6 @@ public sealed class ChargesSystem : SharedChargesSystem { [Dependency] private readonly IGameTiming _timing = default!; - public override void Initialize() - { - base.Initialize(); - - SubscribeLocalEvent(OnUnpaused); - } - public override void Update(float frameTime) { base.Update(frameTime); @@ -32,11 +25,6 @@ public sealed class ChargesSystem : SharedChargesSystem } } - private void OnUnpaused(EntityUid uid, AutoRechargeComponent comp, ref EntityUnpausedEvent args) - { - comp.NextChargeTime += args.PausedTime; - } - protected override void OnExamine(EntityUid uid, LimitedChargesComponent comp, ExaminedEvent args) { base.OnExamine(uid, comp, args); diff --git a/Content.Server/Chat/EmoteOnDamageComponent.cs b/Content.Server/Chat/EmoteOnDamageComponent.cs index 91eddef215..8653a4fe55 100644 --- a/Content.Server/Chat/EmoteOnDamageComponent.cs +++ b/Content.Server/Chat/EmoteOnDamageComponent.cs @@ -8,7 +8,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy /// /// Causes an entity to automatically emote when taking damage. /// -[RegisterComponent, Access(typeof(EmoteOnDamageSystem))] +[RegisterComponent, Access(typeof(EmoteOnDamageSystem)), AutoGenerateComponentPause] public sealed partial class EmoteOnDamageComponent : Component { /// @@ -41,6 +41,7 @@ public sealed partial class EmoteOnDamageComponent : Component /// The simulation time of the last emote preformed due to taking damage. /// [DataField("lastEmoteTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] + [AutoPausedField] public TimeSpan LastEmoteTime = TimeSpan.Zero; /// diff --git a/Content.Server/Chat/Systems/EmoteOnDamageSystem.cs b/Content.Server/Chat/Systems/EmoteOnDamageSystem.cs index 9a435971f2..878c517d92 100644 --- a/Content.Server/Chat/Systems/EmoteOnDamageSystem.cs +++ b/Content.Server/Chat/Systems/EmoteOnDamageSystem.cs @@ -18,15 +18,9 @@ public sealed class EmoteOnDamageSystem : EntitySystem { base.Initialize(); - SubscribeLocalEvent(OnUnpaused); SubscribeLocalEvent(OnDamage); } - private void OnUnpaused(EntityUid uid, EmoteOnDamageComponent emoteOnDamage, ref EntityUnpausedEvent args) - { - emoteOnDamage.LastEmoteTime += args.PausedTime; - } - private void OnDamage(EntityUid uid, EmoteOnDamageComponent emoteOnDamage, DamageChangedEvent args) { if (!args.DamageIncreased) diff --git a/Content.Server/Chemistry/Components/SolutionPurgeComponent.cs b/Content.Server/Chemistry/Components/SolutionPurgeComponent.cs index 0525542b96..9b9294b6f9 100644 --- a/Content.Server/Chemistry/Components/SolutionPurgeComponent.cs +++ b/Content.Server/Chemistry/Components/SolutionPurgeComponent.cs @@ -9,7 +9,7 @@ namespace Content.Server.Chemistry.Components; /// /// Passively decreases a solution's quantity of reagent(s). /// -[RegisterComponent] +[RegisterComponent, AutoGenerateComponentPause] [Access(typeof(SolutionPurgeSystem))] public sealed partial class SolutionPurgeComponent : Component { @@ -42,5 +42,6 @@ public sealed partial class SolutionPurgeComponent : Component /// The time when the next purge will occur. /// [DataField("nextPurgeTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] + [AutoPausedField] public TimeSpan NextPurgeTime = TimeSpan.FromSeconds(0); } diff --git a/Content.Server/Chemistry/Components/SolutionRegenerationComponent.cs b/Content.Server/Chemistry/Components/SolutionRegenerationComponent.cs index 7fe2dacb67..23bf6b2157 100644 --- a/Content.Server/Chemistry/Components/SolutionRegenerationComponent.cs +++ b/Content.Server/Chemistry/Components/SolutionRegenerationComponent.cs @@ -7,7 +7,7 @@ namespace Content.Server.Chemistry.Components; /// /// Passively increases a solution's quantity of a reagent. /// -[RegisterComponent] +[RegisterComponent, AutoGenerateComponentPause] [Access(typeof(SolutionRegenerationSystem))] public sealed partial class SolutionRegenerationComponent : Component { @@ -39,5 +39,6 @@ public sealed partial class SolutionRegenerationComponent : Component /// The time when the next regeneration will occur. /// [DataField("nextChargeTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] + [AutoPausedField] public TimeSpan NextRegenTime = TimeSpan.FromSeconds(0); } diff --git a/Content.Server/Chemistry/EntitySystems/SolutionPurgeSystem.cs b/Content.Server/Chemistry/EntitySystems/SolutionPurgeSystem.cs index e6e003a7f5..42b8ab374a 100644 --- a/Content.Server/Chemistry/EntitySystems/SolutionPurgeSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/SolutionPurgeSystem.cs @@ -10,13 +10,6 @@ public sealed class SolutionPurgeSystem : EntitySystem [Dependency] private readonly SolutionContainerSystem _solutionContainer = default!; [Dependency] private readonly IGameTiming _timing = default!; - public override void Initialize() - { - base.Initialize(); - - SubscribeLocalEvent(OnUnpaused); - } - public override void Update(float frameTime) { base.Update(frameTime); @@ -33,9 +26,4 @@ public sealed class SolutionPurgeSystem : EntitySystem _solutionContainer.SplitSolutionWithout(solution.Value, purge.Quantity, purge.Preserve.ToArray()); } } - - private void OnUnpaused(Entity entity, ref EntityUnpausedEvent args) - { - entity.Comp.NextPurgeTime += args.PausedTime; - } } diff --git a/Content.Server/Chemistry/EntitySystems/SolutionRegenerationSystem.cs b/Content.Server/Chemistry/EntitySystems/SolutionRegenerationSystem.cs index 37458846e3..5af181e4af 100644 --- a/Content.Server/Chemistry/EntitySystems/SolutionRegenerationSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/SolutionRegenerationSystem.cs @@ -12,13 +12,6 @@ public sealed class SolutionRegenerationSystem : EntitySystem [Dependency] private readonly SolutionContainerSystem _solutionContainer = default!; [Dependency] private readonly IGameTiming _timing = default!; - public override void Initialize() - { - base.Initialize(); - - SubscribeLocalEvent(OnUnpaused); - } - public override void Update(float frameTime) { base.Update(frameTime); @@ -52,9 +45,4 @@ public sealed class SolutionRegenerationSystem : EntitySystem } } } - - private void OnUnpaused(Entity entity, ref EntityUnpausedEvent args) - { - entity.Comp.NextRegenTime += args.PausedTime; - } } diff --git a/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs b/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs index 35b2afc2e0..6938792315 100644 --- a/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs +++ b/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs @@ -68,7 +68,6 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem // Shouldn't need re-anchoring. SubscribeLocalEvent(OnAnchorChanged); - SubscribeLocalEvent(OnUnpaused); // TODO: Predict me when hands predicted SubscribeLocalEvent(OnMovement); SubscribeLocalEvent(OnPowerChange); @@ -103,14 +102,6 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem GetNetEntityList(component.RecentlyEjected)); } - private void OnUnpaused(EntityUid uid, SharedDisposalUnitComponent component, ref EntityUnpausedEvent args) - { - if (component.NextFlush != null) - component.NextFlush = component.NextFlush.Value + args.PausedTime; - - component.NextPressurized += args.PausedTime; - } - private void AddDisposalAltVerbs(EntityUid uid, SharedDisposalUnitComponent component, GetVerbsEvent args) { if (!args.CanAccess || !args.CanInteract) diff --git a/Content.Server/Emp/EmpSystem.cs b/Content.Server/Emp/EmpSystem.cs index 02a18284e8..7c1a6f9b5d 100644 --- a/Content.Server/Emp/EmpSystem.cs +++ b/Content.Server/Emp/EmpSystem.cs @@ -17,7 +17,6 @@ public sealed class EmpSystem : SharedEmpSystem public override void Initialize() { base.Initialize(); - SubscribeLocalEvent(OnUnpaused); SubscribeLocalEvent(OnExamine); SubscribeLocalEvent(HandleEmpTrigger); @@ -96,12 +95,6 @@ public sealed class EmpSystem : SharedEmpSystem } } - private void OnUnpaused(EntityUid uid, EmpDisabledComponent component, ref EntityUnpausedEvent args) - { - component.DisabledUntil += args.PausedTime; - component.TargetTime += args.PausedTime; - } - private void OnExamine(EntityUid uid, EmpDisabledComponent component, ExaminedEvent args) { args.PushMarkup(Loc.GetString("emp-disabled-comp-on-examine")); diff --git a/Content.Server/Explosion/Components/OnTrigger/TwoStageTriggerComponent.cs b/Content.Server/Explosion/Components/OnTrigger/TwoStageTriggerComponent.cs index 357286b192..a63d6fcf66 100644 --- a/Content.Server/Explosion/Components/OnTrigger/TwoStageTriggerComponent.cs +++ b/Content.Server/Explosion/Components/OnTrigger/TwoStageTriggerComponent.cs @@ -6,7 +6,7 @@ namespace Content.Server.Explosion.Components.OnTrigger; /// /// After being triggered applies the specified components and runs triggers again. /// -[RegisterComponent] +[RegisterComponent, AutoGenerateComponentPause] public sealed partial class TwoStageTriggerComponent : Component { /// @@ -23,6 +23,7 @@ public sealed partial class TwoStageTriggerComponent : Component public ComponentRegistry SecondStageComponents = new(); [DataField("nextTriggerTime", customTypeSerializer: typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan? NextTriggerTime; [DataField("triggered")] diff --git a/Content.Server/Explosion/Components/TriggerOnProximityComponent.cs b/Content.Server/Explosion/Components/TriggerOnProximityComponent.cs index 504ef4dee4..4f3fb4754e 100644 --- a/Content.Server/Explosion/Components/TriggerOnProximityComponent.cs +++ b/Content.Server/Explosion/Components/TriggerOnProximityComponent.cs @@ -13,7 +13,7 @@ namespace Content.Server.Explosion.Components /// /// Raises a whenever an entity collides with a fixture attached to the owner of this component. /// - [RegisterComponent] + [RegisterComponent, AutoGenerateComponentPause] public sealed partial class TriggerOnProximityComponent : SharedTriggerOnProximityComponent { public const string FixtureID = "trigger-on-proximity-fixture"; @@ -58,6 +58,7 @@ namespace Content.Server.Explosion.Components /// [ViewVariables(VVAccess.ReadWrite)] [DataField("nextTrigger", customTypeSerializer: typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan NextTrigger = TimeSpan.Zero; /// @@ -65,6 +66,7 @@ namespace Content.Server.Explosion.Components /// [ViewVariables(VVAccess.ReadWrite)] [DataField("nextVisualUpdate", customTypeSerializer: typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan NextVisualUpdate = TimeSpan.Zero; /// diff --git a/Content.Server/Explosion/EntitySystems/TriggerSystem.Proximity.cs b/Content.Server/Explosion/EntitySystems/TriggerSystem.Proximity.cs index d3d97a851e..119b1a3d36 100644 --- a/Content.Server/Explosion/EntitySystems/TriggerSystem.Proximity.cs +++ b/Content.Server/Explosion/EntitySystems/TriggerSystem.Proximity.cs @@ -17,7 +17,6 @@ public sealed partial class TriggerSystem SubscribeLocalEvent(OnProximityStartCollide); SubscribeLocalEvent(OnProximityEndCollide); SubscribeLocalEvent(OnMapInit); - SubscribeLocalEvent(OnUnpaused); SubscribeLocalEvent(OnProximityShutdown); // Shouldn't need re-anchoring. SubscribeLocalEvent(OnProximityAnchor); @@ -65,12 +64,6 @@ public sealed partial class TriggerSystem collisionLayer: component.Layer); } - private void OnUnpaused(EntityUid uid, TriggerOnProximityComponent component, ref EntityUnpausedEvent args) - { - component.NextTrigger += args.PausedTime; - component.NextVisualUpdate += args.PausedTime; - } - private void OnProximityStartCollide(EntityUid uid, TriggerOnProximityComponent component, ref StartCollideEvent args) { if (args.OurFixtureId != TriggerOnProximityComponent.FixtureID) diff --git a/Content.Server/Explosion/EntitySystems/TwoStageTriggerSystem.cs b/Content.Server/Explosion/EntitySystems/TwoStageTriggerSystem.cs index a8c48f21d6..4e95eabff0 100644 --- a/Content.Server/Explosion/EntitySystems/TwoStageTriggerSystem.cs +++ b/Content.Server/Explosion/EntitySystems/TwoStageTriggerSystem.cs @@ -14,16 +14,9 @@ public sealed class TwoStageTriggerSystem : EntitySystem public override void Initialize() { base.Initialize(); - SubscribeLocalEvent(OnTriggerUnpaused); SubscribeLocalEvent(OnTrigger); } - private void OnTriggerUnpaused(EntityUid uid, TwoStageTriggerComponent component, ref EntityUnpausedEvent args) - { - if (component.NextTriggerTime != null) - component.NextTriggerTime = component.NextTriggerTime.Value + args.PausedTime; - } - private void OnTrigger(EntityUid uid, TwoStageTriggerComponent component, TriggerEvent args) { if (component.Triggered) diff --git a/Content.Server/Fluids/EntitySystems/SmokeSystem.cs b/Content.Server/Fluids/EntitySystems/SmokeSystem.cs index 795655068f..cb6f9c13ef 100644 --- a/Content.Server/Fluids/EntitySystems/SmokeSystem.cs +++ b/Content.Server/Fluids/EntitySystems/SmokeSystem.cs @@ -63,7 +63,6 @@ public sealed class SmokeSystem : EntitySystem SubscribeLocalEvent(OnReactionAttempt); SubscribeLocalEvent>(OnReactionAttempt); SubscribeLocalEvent(OnSmokeSpread); - SubscribeLocalEvent(OnAffectedUnpaused); } /// @@ -124,11 +123,6 @@ public sealed class SmokeSystem : EntitySystem RemComp(args.OtherEntity, smokeAffectedComponent); } - private void OnAffectedUnpaused(Entity entity, ref EntityUnpausedEvent args) - { - entity.Comp.NextSecond += args.PausedTime; - } - private void OnSmokeSpread(Entity entity, ref SpreadNeighborsEvent args) { if (entity.Comp.SpreadAmount == 0 || !_solutionContainerSystem.ResolveSolution(entity.Owner, SmokeComponent.SolutionName, ref entity.Comp.Solution, out var solution)) diff --git a/Content.Server/Gateway/Components/GatewayComponent.cs b/Content.Server/Gateway/Components/GatewayComponent.cs index 71d070f699..9650baafa3 100644 --- a/Content.Server/Gateway/Components/GatewayComponent.cs +++ b/Content.Server/Gateway/Components/GatewayComponent.cs @@ -8,7 +8,7 @@ namespace Content.Server.Gateway.Components; /// /// Controlling gateway that links to other gateway destinations on the server. /// -[RegisterComponent, Access(typeof(GatewaySystem))] +[RegisterComponent, Access(typeof(GatewaySystem)), AutoGenerateComponentPause] public sealed partial class GatewayComponent : Component { /// @@ -61,5 +61,6 @@ public sealed partial class GatewayComponent : Component /// The time at which the portal can next be opened. /// [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan NextReady; } diff --git a/Content.Server/Gateway/Components/GatewayGeneratorComponent.cs b/Content.Server/Gateway/Components/GatewayGeneratorComponent.cs index 670cbea307..d65760e270 100644 --- a/Content.Server/Gateway/Components/GatewayGeneratorComponent.cs +++ b/Content.Server/Gateway/Components/GatewayGeneratorComponent.cs @@ -7,7 +7,7 @@ namespace Content.Server.Gateway.Components; /// /// Generates gateway destinations at a regular interval. /// -[RegisterComponent] +[RegisterComponent, AutoGenerateComponentPause] public sealed partial class GatewayGeneratorComponent : Component { /// @@ -20,6 +20,7 @@ public sealed partial class GatewayGeneratorComponent : Component /// Next time another seed unlocks. /// [DataField(customTypeSerializer:typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan NextUnlock; /// diff --git a/Content.Server/Gateway/Systems/GatewayGeneratorSystem.cs b/Content.Server/Gateway/Systems/GatewayGeneratorSystem.cs index c8b30af620..7558f7afc0 100644 --- a/Content.Server/Gateway/Systems/GatewayGeneratorSystem.cs +++ b/Content.Server/Gateway/Systems/GatewayGeneratorSystem.cs @@ -67,7 +67,6 @@ public sealed class GatewayGeneratorSystem : EntitySystem public override void Initialize() { base.Initialize(); - SubscribeLocalEvent(OnGeneratorUnpaused); SubscribeLocalEvent(OnGeneratorMapInit); SubscribeLocalEvent(OnGeneratorShutdown); SubscribeLocalEvent(OnGeneratorAttemptOpen); @@ -85,11 +84,6 @@ public sealed class GatewayGeneratorSystem : EntitySystem } } - private void OnGeneratorUnpaused(Entity ent, ref EntityUnpausedEvent args) - { - ent.Comp.NextUnlock += args.PausedTime; - } - private void OnGeneratorMapInit(EntityUid uid, GatewayGeneratorComponent generator, MapInitEvent args) { if (!_cfgManager.GetCVar(CCVars.GatewayGeneratorEnabled)) diff --git a/Content.Server/Gateway/Systems/GatewaySystem.cs b/Content.Server/Gateway/Systems/GatewaySystem.cs index 52525ee0d4..7ebc751dd2 100644 --- a/Content.Server/Gateway/Systems/GatewaySystem.cs +++ b/Content.Server/Gateway/Systems/GatewaySystem.cs @@ -32,7 +32,6 @@ public sealed class GatewaySystem : EntitySystem { base.Initialize(); - SubscribeLocalEvent(OnGatewayUnpaused); SubscribeLocalEvent(OnStartup); SubscribeLocalEvent(OnGatewayOpenAttempt); SubscribeLocalEvent(UpdateUserInterface); @@ -48,11 +47,6 @@ public sealed class GatewaySystem : EntitySystem UpdateAllGateways(); } - private void OnGatewayUnpaused(EntityUid uid, GatewayComponent component, ref EntityUnpausedEvent args) - { - component.NextReady += args.PausedTime; - } - private void OnStartup(EntityUid uid, GatewayComponent comp, ComponentStartup args) { // no need to update ui since its just been created, just do portal diff --git a/Content.Server/Hands/Systems/HandsSystem.cs b/Content.Server/Hands/Systems/HandsSystem.cs index 77b5e3970c..62278064b6 100644 --- a/Content.Server/Hands/Systems/HandsSystem.cs +++ b/Content.Server/Hands/Systems/HandsSystem.cs @@ -52,7 +52,6 @@ namespace Content.Server.Hands.Systems SubscribeLocalEvent(HandleBodyPartRemoved); SubscribeLocalEvent(GetComponentState); - SubscribeLocalEvent(OnUnpaused); SubscribeLocalEvent(OnExploded); @@ -73,10 +72,6 @@ namespace Content.Server.Hands.Systems args.State = new HandsComponentState(hands); } - private void OnUnpaused(Entity ent, ref EntityUnpausedEvent args) - { - ent.Comp.NextThrowTime += args.PausedTime; - } private void OnExploded(Entity ent, ref BeforeExplodeEvent args) { diff --git a/Content.Server/Kitchen/Components/ActiveMicrowaveComponent.cs b/Content.Server/Kitchen/Components/ActiveMicrowaveComponent.cs index bd5449dde6..1e32e039db 100644 --- a/Content.Server/Kitchen/Components/ActiveMicrowaveComponent.cs +++ b/Content.Server/Kitchen/Components/ActiveMicrowaveComponent.cs @@ -6,7 +6,7 @@ namespace Content.Server.Kitchen.Components; /// /// Attached to a microwave that is currently in the process of cooking /// -[RegisterComponent] +[RegisterComponent, AutoGenerateComponentPause] public sealed partial class ActiveMicrowaveComponent : Component { [ViewVariables(VVAccess.ReadWrite)] @@ -17,6 +17,7 @@ public sealed partial class ActiveMicrowaveComponent : Component [ViewVariables(VVAccess.ReadWrite)] [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan MalfunctionTime = TimeSpan.Zero; [ViewVariables] diff --git a/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs b/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs index cf3544a7e1..212383c463 100644 --- a/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs +++ b/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs @@ -86,7 +86,6 @@ namespace Content.Server.Kitchen.EntitySystems SubscribeLocalEvent(OnCookStart); SubscribeLocalEvent(OnCookStop); - SubscribeLocalEvent(OnEntityUnpaused); SubscribeLocalEvent(OnActiveMicrowaveInsert); SubscribeLocalEvent(OnActiveMicrowaveRemove); @@ -112,11 +111,6 @@ namespace Content.Server.Kitchen.EntitySystems microwaveComponent.PlayingStream = _audio.Stop(microwaveComponent.PlayingStream); } - private void OnEntityUnpaused(Entity ent, ref EntityUnpausedEvent args) - { - ent.Comp.MalfunctionTime += args.PausedTime; - } - private void OnActiveMicrowaveInsert(Entity ent, ref EntInsertedIntoContainerMessage args) { AddComp(args.Entity); diff --git a/Content.Server/Medical/Components/HealthAnalyzerComponent.cs b/Content.Server/Medical/Components/HealthAnalyzerComponent.cs index a7fed0cae3..6380b71c8a 100644 --- a/Content.Server/Medical/Components/HealthAnalyzerComponent.cs +++ b/Content.Server/Medical/Components/HealthAnalyzerComponent.cs @@ -6,7 +6,7 @@ namespace Content.Server.Medical.Components; /// /// After scanning, retrieves the target Uid to use with its related UI. /// -[RegisterComponent] +[RegisterComponent, AutoGenerateComponentPause] [Access(typeof(HealthAnalyzerSystem), typeof(CryoPodSystem))] public sealed partial class HealthAnalyzerComponent : Component { @@ -14,6 +14,7 @@ public sealed partial class HealthAnalyzerComponent : Component /// When should the next update be sent for the patient /// [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan NextUpdate = TimeSpan.Zero; /// diff --git a/Content.Server/Medical/DefibrillatorSystem.cs b/Content.Server/Medical/DefibrillatorSystem.cs index e6ef8bf96a..467085f49e 100644 --- a/Content.Server/Medical/DefibrillatorSystem.cs +++ b/Content.Server/Medical/DefibrillatorSystem.cs @@ -50,21 +50,12 @@ public sealed class DefibrillatorSystem : EntitySystem /// public override void Initialize() { - SubscribeLocalEvent(OnUnpaused); SubscribeLocalEvent(OnUseInHand); SubscribeLocalEvent(OnPowerCellSlotEmpty); SubscribeLocalEvent(OnAfterInteract); SubscribeLocalEvent(OnDoAfter); } - private void OnUnpaused(EntityUid uid, DefibrillatorComponent component, ref EntityUnpausedEvent args) - { - if (component.NextZapTime == null) - return; - - component.NextZapTime = component.NextZapTime.Value + args.PausedTime; - } - private void OnUseInHand(EntityUid uid, DefibrillatorComponent component, UseInHandEvent args) { if (args.Handled || !TryComp(uid, out UseDelayComponent? useDelay) || _useDelay.IsDelayed((uid, useDelay))) diff --git a/Content.Server/Medical/HealthAnalyzerSystem.cs b/Content.Server/Medical/HealthAnalyzerSystem.cs index 5c7d265e61..a8abc4752d 100644 --- a/Content.Server/Medical/HealthAnalyzerSystem.cs +++ b/Content.Server/Medical/HealthAnalyzerSystem.cs @@ -30,7 +30,6 @@ public sealed class HealthAnalyzerSystem : EntitySystem public override void Initialize() { - SubscribeLocalEvent(OnEntityUnpaused); SubscribeLocalEvent(OnAfterInteract); SubscribeLocalEvent(OnDoAfter); SubscribeLocalEvent(OnInsertedIntoContainer); @@ -65,11 +64,6 @@ public sealed class HealthAnalyzerSystem : EntitySystem } } - private void OnEntityUnpaused(Entity ent, ref EntityUnpausedEvent args) - { - ent.Comp.NextUpdate += args.PausedTime; - } - /// /// Trigger the doafter for scanning /// diff --git a/Content.Server/Medical/SuitSensors/SuitSensorComponent.cs b/Content.Server/Medical/SuitSensors/SuitSensorComponent.cs index 5de11f848c..9079655c80 100644 --- a/Content.Server/Medical/SuitSensors/SuitSensorComponent.cs +++ b/Content.Server/Medical/SuitSensors/SuitSensorComponent.cs @@ -7,7 +7,7 @@ namespace Content.Server.Medical.SuitSensors; /// Tracking device, embedded in almost all uniforms and jumpsuits. /// If enabled, will report to crew monitoring console owners position and status. /// -[RegisterComponent] +[RegisterComponent, AutoGenerateComponentPause] [Access(typeof(SuitSensorSystem))] public sealed partial class SuitSensorComponent : Component { @@ -57,6 +57,7 @@ public sealed partial class SuitSensorComponent : Component /// Next time when sensor updated owners status /// [DataField("nextUpdate", customTypeSerializer:typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan NextUpdate = TimeSpan.Zero; /// diff --git a/Content.Server/Medical/SuitSensors/SuitSensorSystem.cs b/Content.Server/Medical/SuitSensors/SuitSensorSystem.cs index 38a7b0a451..94ecf5fd0e 100644 --- a/Content.Server/Medical/SuitSensors/SuitSensorSystem.cs +++ b/Content.Server/Medical/SuitSensors/SuitSensorSystem.cs @@ -40,7 +40,6 @@ public sealed class SuitSensorSystem : EntitySystem base.Initialize(); SubscribeLocalEvent(OnPlayerSpawn); SubscribeLocalEvent(OnMapInit); - SubscribeLocalEvent(OnUnpaused); SubscribeLocalEvent(OnEquipped); SubscribeLocalEvent(OnUnequipped); SubscribeLocalEvent(OnExamine); @@ -51,11 +50,6 @@ public sealed class SuitSensorSystem : EntitySystem SubscribeLocalEvent(OnEmpFinished); } - private void OnUnpaused(EntityUid uid, SuitSensorComponent component, ref EntityUnpausedEvent args) - { - component.NextUpdate += args.PausedTime; - } - public override void Update(float frameTime) { base.Update(frameTime); diff --git a/Content.Server/NPC/Components/NPCJukeComponent.cs b/Content.Server/NPC/Components/NPCJukeComponent.cs index 4cbd8017f2..2c4136c24b 100644 --- a/Content.Server/NPC/Components/NPCJukeComponent.cs +++ b/Content.Server/NPC/Components/NPCJukeComponent.cs @@ -3,7 +3,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; namespace Content.Server.NPC.Components; -[RegisterComponent] +[RegisterComponent, AutoGenerateComponentPause] public sealed partial class NPCJukeComponent : Component { [DataField("jukeType")] @@ -13,6 +13,7 @@ public sealed partial class NPCJukeComponent : Component public float JukeDuration = 0.5f; [DataField("nextJuke", customTypeSerializer:typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan NextJuke; [DataField("targetTile")] diff --git a/Content.Server/NPC/Components/NPCSteeringComponent.cs b/Content.Server/NPC/Components/NPCSteeringComponent.cs index 52f96e9c55..397b7fb032 100644 --- a/Content.Server/NPC/Components/NPCSteeringComponent.cs +++ b/Content.Server/NPC/Components/NPCSteeringComponent.cs @@ -11,7 +11,7 @@ namespace Content.Server.NPC.Components; /// /// Added to NPCs that are moving. /// -[RegisterComponent] +[RegisterComponent, AutoGenerateComponentPause] public sealed partial class NPCSteeringComponent : Component { #region Context Steering @@ -49,6 +49,7 @@ public sealed partial class NPCSteeringComponent : Component /// Next time we can change our steering direction. /// [DataField("nextSteer", customTypeSerializer:typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan NextSteer = TimeSpan.Zero; [DataField("lastSteerIndex")] @@ -66,6 +67,7 @@ public sealed partial class NPCSteeringComponent : Component public EntityCoordinates LastStuckCoordinates; [DataField("lastStuckTime", customTypeSerializer:typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan LastStuckTime; public const float StuckDistance = 1f; diff --git a/Content.Server/NPC/Pathfinding/GridPathfindingComponent.cs b/Content.Server/NPC/Pathfinding/GridPathfindingComponent.cs index 335a2bbaa1..dac07ea842 100644 --- a/Content.Server/NPC/Pathfinding/GridPathfindingComponent.cs +++ b/Content.Server/NPC/Pathfinding/GridPathfindingComponent.cs @@ -5,7 +5,7 @@ namespace Content.Server.NPC.Pathfinding; /// /// Stores the relevant pathfinding data for grids. /// -[RegisterComponent, Access(typeof(PathfindingSystem))] +[RegisterComponent, Access(typeof(PathfindingSystem)), AutoGenerateComponentPause] public sealed partial class GridPathfindingComponent : Component { [ViewVariables] @@ -15,6 +15,7 @@ public sealed partial class GridPathfindingComponent : Component /// Next time the graph is allowed to update. /// /// Removing this datafield is the lazy fix HOWEVER I want to purge this anyway and do pathfinding at runtime. + [AutoPausedField] public TimeSpan NextUpdate; [ViewVariables] diff --git a/Content.Server/NPC/Pathfinding/PathfindingSystem.Grid.cs b/Content.Server/NPC/Pathfinding/PathfindingSystem.Grid.cs index c27947dedb..6462c10fe5 100644 --- a/Content.Server/NPC/Pathfinding/PathfindingSystem.Grid.cs +++ b/Content.Server/NPC/Pathfinding/PathfindingSystem.Grid.cs @@ -44,7 +44,6 @@ public sealed partial class PathfindingSystem { SubscribeLocalEvent(OnGridInit); SubscribeLocalEvent(OnGridRemoved); - SubscribeLocalEvent(OnGridPathPause); SubscribeLocalEvent(OnGridPathShutdown); SubscribeLocalEvent(OnCollisionChange); SubscribeLocalEvent(OnCollisionLayerChange); @@ -61,10 +60,6 @@ public sealed partial class PathfindingSystem DirtyChunk(ev.Entity, Comp(ev.Entity).GridTileToLocal(ev.NewTile.GridIndices)); } - private void OnGridPathPause(EntityUid uid, GridPathfindingComponent component, ref EntityUnpausedEvent args) - { - component.NextUpdate += args.PausedTime; - } private void OnGridPathShutdown(EntityUid uid, GridPathfindingComponent component, ComponentShutdown args) { diff --git a/Content.Server/NPC/Systems/NPCJukeSystem.cs b/Content.Server/NPC/Systems/NPCJukeSystem.cs index 19f566405a..da9fa1f761 100644 --- a/Content.Server/NPC/Systems/NPCJukeSystem.cs +++ b/Content.Server/NPC/Systems/NPCJukeSystem.cs @@ -33,15 +33,9 @@ public sealed class NPCJukeSystem : EntitySystem _npcRangedQuery = GetEntityQuery(); _physicsQuery = GetEntityQuery(); - SubscribeLocalEvent(OnJukeUnpaused); SubscribeLocalEvent(OnJukeSteering); } - private void OnJukeUnpaused(EntityUid uid, NPCJukeComponent component, ref EntityUnpausedEvent args) - { - component.NextJuke += args.PausedTime; - } - private void OnJukeSteering(EntityUid uid, NPCJukeComponent component, ref NPCSteeringEvent args) { if (component.JukeType == JukeType.AdjacentTile) diff --git a/Content.Server/NPC/Systems/NPCSteeringSystem.cs b/Content.Server/NPC/Systems/NPCSteeringSystem.cs index 149a330919..aca2411d8a 100644 --- a/Content.Server/NPC/Systems/NPCSteeringSystem.cs +++ b/Content.Server/NPC/Systems/NPCSteeringSystem.cs @@ -107,7 +107,6 @@ public sealed partial class NPCSteeringSystem : SharedNPCSteeringSystem Subs.CVar(_configManager, CCVars.NPCPathfinding, SetNPCPathfinding, true); SubscribeLocalEvent(OnSteeringShutdown); - SubscribeLocalEvent(OnSteeringUnpaused); SubscribeNetworkEvent(OnDebugRequest); } @@ -158,12 +157,6 @@ public sealed partial class NPCSteeringSystem : SharedNPCSteeringSystem component.PathfindToken = null; } - private void OnSteeringUnpaused(EntityUid uid, NPCSteeringComponent component, ref EntityUnpausedEvent args) - { - component.LastStuckTime += args.PausedTime; - component.NextSteer += args.PausedTime; - } - /// /// Adds the AI to the steering system to move towards a specific target /// diff --git a/Content.Server/Nutrition/Components/FatExtractorComponent.cs b/Content.Server/Nutrition/Components/FatExtractorComponent.cs index bf81a173e4..e23c557236 100644 --- a/Content.Server/Nutrition/Components/FatExtractorComponent.cs +++ b/Content.Server/Nutrition/Components/FatExtractorComponent.cs @@ -10,7 +10,7 @@ namespace Content.Server.Nutrition.Components; /// /// This is used for a machine that extracts hunger from entities and creates meat. Yum! /// -[RegisterComponent, Access(typeof(FatExtractorSystem))] +[RegisterComponent, Access(typeof(FatExtractorSystem)), AutoGenerateComponentPause] public sealed partial class FatExtractorComponent : Component { /// @@ -48,6 +48,7 @@ public sealed partial class FatExtractorComponent : Component /// When the next update will occur /// [DataField("nextUpdate", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] + [AutoPausedField] public TimeSpan NextUpdate; /// diff --git a/Content.Server/Nutrition/EntitySystems/AnimalHusbandrySystem.cs b/Content.Server/Nutrition/EntitySystems/AnimalHusbandrySystem.cs index 1271c57a23..d0fcd11359 100644 --- a/Content.Server/Nutrition/EntitySystems/AnimalHusbandrySystem.cs +++ b/Content.Server/Nutrition/EntitySystems/AnimalHusbandrySystem.cs @@ -40,23 +40,11 @@ public sealed class AnimalHusbandrySystem : EntitySystem /// public override void Initialize() { - SubscribeLocalEvent(OnUnpaused); SubscribeLocalEvent(OnMindAdded); - SubscribeLocalEvent(OnInfantUnpaused); SubscribeLocalEvent(OnInfantStartup); SubscribeLocalEvent(OnInfantShutdown); } - private void OnUnpaused(EntityUid uid, ReproductiveComponent component, ref EntityUnpausedEvent args) - { - component.NextBreedAttempt += args.PausedTime; - } - - private void OnInfantUnpaused(EntityUid uid, InfantComponent component, ref EntityUnpausedEvent args) - { - component.InfantEndTime += args.PausedTime; - } - // we express EZ-pass terminate the pregnancy if a player takes the role private void OnMindAdded(EntityUid uid, ReproductiveComponent component, MindAddedMessage args) { diff --git a/Content.Server/Nutrition/EntitySystems/FatExtractorSystem.cs b/Content.Server/Nutrition/EntitySystems/FatExtractorSystem.cs index 4bd8c94ac8..180e40d1e4 100644 --- a/Content.Server/Nutrition/EntitySystems/FatExtractorSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/FatExtractorSystem.cs @@ -27,18 +27,12 @@ public sealed class FatExtractorSystem : EntitySystem /// public override void Initialize() { - SubscribeLocalEvent(OnUnpaused); SubscribeLocalEvent(OnGotEmagged); SubscribeLocalEvent(OnClosed); SubscribeLocalEvent(OnOpen); SubscribeLocalEvent(OnPowerChanged); } - private void OnUnpaused(EntityUid uid, FatExtractorComponent component, ref EntityUnpausedEvent args) - { - component.NextUpdate += args.PausedTime; - } - private void OnGotEmagged(EntityUid uid, FatExtractorComponent component, ref GotEmaggedEvent args) { args.Handled = true; diff --git a/Content.Server/Physics/Components/ChasingWalkComponent.cs b/Content.Server/Physics/Components/ChasingWalkComponent.cs index ca7a027544..222c9d64db 100644 --- a/Content.Server/Physics/Components/ChasingWalkComponent.cs +++ b/Content.Server/Physics/Components/ChasingWalkComponent.cs @@ -8,13 +8,14 @@ namespace Content.Server.Physics.Components; /// /// A component which makes its entity chasing entity with selected component. /// -[RegisterComponent, Access(typeof(ChasingWalkSystem))] +[RegisterComponent, Access(typeof(ChasingWalkSystem)), AutoGenerateComponentPause] public sealed partial class ChasingWalkComponent : Component { /// /// The next moment in time when the entity is pushed toward its goal /// [DataField, ViewVariables(VVAccess.ReadWrite)] + [AutoPausedField] public TimeSpan NextImpulseTime; /// @@ -57,6 +58,7 @@ public sealed partial class ChasingWalkComponent : Component /// The next change of direction time. /// [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] + [AutoPausedField] public TimeSpan NextChangeVectorTime; /// diff --git a/Content.Server/Physics/Controllers/ChasingWalkSystem.cs b/Content.Server/Physics/Controllers/ChasingWalkSystem.cs index 8835b44ab7..215e7e3124 100644 --- a/Content.Server/Physics/Controllers/ChasingWalkSystem.cs +++ b/Content.Server/Physics/Controllers/ChasingWalkSystem.cs @@ -27,7 +27,6 @@ public sealed class ChasingWalkSystem : VirtualController base.Initialize(); SubscribeLocalEvent(OnChasingMapInit); - SubscribeLocalEvent(OnChasingUnpaused); } private void OnChasingMapInit(EntityUid uid, ChasingWalkComponent component, MapInitEvent args) @@ -36,12 +35,6 @@ public sealed class ChasingWalkSystem : VirtualController component.NextChangeVectorTime = _gameTiming.CurTime; } - private void OnChasingUnpaused(EntityUid uid, ChasingWalkComponent component, ref EntityUnpausedEvent args) - { - component.NextImpulseTime += args.PausedTime; - component.NextChangeVectorTime += args.PausedTime; - } - public override void UpdateBeforeSolve(bool prediction, float frameTime) { base.UpdateBeforeSolve(prediction, frameTime); diff --git a/Content.Server/PowerCell/PowerCellSystem.Draw.cs b/Content.Server/PowerCell/PowerCellSystem.Draw.cs index c6d8e1e709..8e960357b7 100644 --- a/Content.Server/PowerCell/PowerCellSystem.Draw.cs +++ b/Content.Server/PowerCell/PowerCellSystem.Draw.cs @@ -39,11 +39,6 @@ public sealed partial class PowerCellSystem } } - private void OnUnpaused(EntityUid uid, PowerCellDrawComponent component, ref EntityUnpausedEvent args) - { - component.NextUpdateTime += args.PausedTime; - } - private void OnDrawChargeChanged(EntityUid uid, PowerCellDrawComponent component, ref ChargeChangedEvent args) { // Update the bools for client prediction. diff --git a/Content.Server/PowerCell/PowerCellSystem.cs b/Content.Server/PowerCell/PowerCellSystem.cs index b424f34de5..d501a1bda3 100644 --- a/Content.Server/PowerCell/PowerCellSystem.cs +++ b/Content.Server/PowerCell/PowerCellSystem.cs @@ -35,7 +35,6 @@ public sealed partial class PowerCellSystem : SharedPowerCellSystem SubscribeLocalEvent(OnCellExamined); SubscribeLocalEvent(OnCellEmpAttempt); - SubscribeLocalEvent(OnUnpaused); SubscribeLocalEvent(OnDrawChargeChanged); SubscribeLocalEvent(OnDrawCellChanged); diff --git a/Content.Server/PowerSink/PowerSinkComponent.cs b/Content.Server/PowerSink/PowerSinkComponent.cs index f1df042179..a55d368c6e 100644 --- a/Content.Server/PowerSink/PowerSinkComponent.cs +++ b/Content.Server/PowerSink/PowerSinkComponent.cs @@ -6,7 +6,7 @@ namespace Content.Server.PowerSink /// /// Absorbs power up to its capacity when anchored then explodes. /// - [RegisterComponent] + [RegisterComponent, AutoGenerateComponentPause] public sealed partial class PowerSinkComponent : Component { /// @@ -21,6 +21,7 @@ namespace Content.Server.PowerSink /// If explosion has been triggered, time at which to explode. /// [DataField("explosionTime", customTypeSerializer:typeof(TimeOffsetSerializer))] + [AutoPausedField] public System.TimeSpan? ExplosionTime = null; /// diff --git a/Content.Server/PowerSink/PowerSinkSystem.cs b/Content.Server/PowerSink/PowerSinkSystem.cs index deb6693500..dddfd33967 100644 --- a/Content.Server/PowerSink/PowerSinkSystem.cs +++ b/Content.Server/PowerSink/PowerSinkSystem.cs @@ -37,7 +37,6 @@ namespace Content.Server.PowerSink base.Initialize(); SubscribeLocalEvent(OnExamine); - SubscribeLocalEvent(OnUnpaused); } private void OnExamine(EntityUid uid, PowerSinkComponent component, ExaminedEvent args) @@ -54,14 +53,6 @@ namespace Content.Server.PowerSink ); } - private void OnUnpaused(EntityUid uid, PowerSinkComponent component, ref EntityUnpausedEvent args) - { - if (component.ExplosionTime == null) - return; - - component.ExplosionTime = component.ExplosionTime + args.PausedTime; - } - public override void Update(float frameTime) { var toRemove = new RemQueue<(EntityUid Entity, PowerSinkComponent Sink)>(); diff --git a/Content.Server/Salvage/Expeditions/SalvageExpeditionComponent.cs b/Content.Server/Salvage/Expeditions/SalvageExpeditionComponent.cs index 6d3d831a2d..6a58c209cf 100644 --- a/Content.Server/Salvage/Expeditions/SalvageExpeditionComponent.cs +++ b/Content.Server/Salvage/Expeditions/SalvageExpeditionComponent.cs @@ -11,7 +11,7 @@ namespace Content.Server.Salvage.Expeditions; /// /// Designates this entity as holding a salvage expedition. /// -[RegisterComponent] +[RegisterComponent, AutoGenerateComponentPause] public sealed partial class SalvageExpeditionComponent : SharedSalvageExpeditionComponent { public SalvageMissionParams MissionParams = default!; @@ -26,6 +26,7 @@ public sealed partial class SalvageExpeditionComponent : SharedSalvageExpedition /// When the expeditions ends. /// [ViewVariables(VVAccess.ReadWrite), DataField("endTime", customTypeSerializer: typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan EndTime; /// diff --git a/Content.Server/Salvage/SalvageSystem.Expeditions.cs b/Content.Server/Salvage/SalvageSystem.Expeditions.cs index 1eb1cc3027..7e4a9c9310 100644 --- a/Content.Server/Salvage/SalvageSystem.Expeditions.cs +++ b/Content.Server/Salvage/SalvageSystem.Expeditions.cs @@ -31,10 +31,7 @@ public sealed partial class SalvageSystem SubscribeLocalEvent(OnSalvageConsoleParent); SubscribeLocalEvent(OnSalvageClaimMessage); - SubscribeLocalEvent(OnDataUnpaused); - SubscribeLocalEvent(OnExpeditionShutdown); - SubscribeLocalEvent(OnExpeditionUnpaused); SubscribeLocalEvent(OnExpeditionGetState); SubscribeLocalEvent(OnStructureExamine); @@ -89,16 +86,6 @@ public sealed partial class SalvageSystem } } - private void OnDataUnpaused(EntityUid uid, SalvageExpeditionDataComponent component, ref EntityUnpausedEvent args) - { - component.NextOffer += args.PausedTime; - } - - private void OnExpeditionUnpaused(EntityUid uid, SalvageExpeditionComponent component, ref EntityUnpausedEvent args) - { - component.EndTime += args.PausedTime; - } - private void UpdateExpeditions() { var currentTime = _timing.CurTime; diff --git a/Content.Server/Shuttles/Components/ArrivalsShuttleComponent.cs b/Content.Server/Shuttles/Components/ArrivalsShuttleComponent.cs index 99cdcbc3b6..b9ff375507 100644 --- a/Content.Server/Shuttles/Components/ArrivalsShuttleComponent.cs +++ b/Content.Server/Shuttles/Components/ArrivalsShuttleComponent.cs @@ -3,13 +3,14 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; namespace Content.Server.Shuttles.Components; -[RegisterComponent, Access(typeof(ArrivalsSystem))] +[RegisterComponent, Access(typeof(ArrivalsSystem)), AutoGenerateComponentPause] public sealed partial class ArrivalsShuttleComponent : Component { [DataField("station")] public EntityUid Station; [DataField("nextTransfer", customTypeSerializer: typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan NextTransfer; [DataField("nextArrivalsTime", customTypeSerializer: typeof(TimeOffsetSerializer))] diff --git a/Content.Server/Shuttles/Components/EscapePodComponent.cs b/Content.Server/Shuttles/Components/EscapePodComponent.cs index d68065fc00..72c8024e12 100644 --- a/Content.Server/Shuttles/Components/EscapePodComponent.cs +++ b/Content.Server/Shuttles/Components/EscapePodComponent.cs @@ -6,9 +6,10 @@ namespace Content.Server.Shuttles.Components; /// /// If added to a grid gets launched when the emergency shuttle launches. /// -[RegisterComponent, Access(typeof(EmergencyShuttleSystem))] +[RegisterComponent, Access(typeof(EmergencyShuttleSystem)), AutoGenerateComponentPause] public sealed partial class EscapePodComponent : Component { [DataField("launchTime", customTypeSerializer:typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan? LaunchTime; } diff --git a/Content.Server/Shuttles/Systems/ArrivalsSystem.cs b/Content.Server/Shuttles/Systems/ArrivalsSystem.cs index 7d63b83588..037fcc7566 100644 --- a/Content.Server/Shuttles/Systems/ArrivalsSystem.cs +++ b/Content.Server/Shuttles/Systems/ArrivalsSystem.cs @@ -85,7 +85,6 @@ public sealed class ArrivalsSystem : EntitySystem SubscribeLocalEvent(OnArrivalsStartup); SubscribeLocalEvent(OnShuttleStartup); - SubscribeLocalEvent(OnShuttleUnpaused); SubscribeLocalEvent(OnShuttleTag); SubscribeLocalEvent(OnRoundStarting); @@ -384,11 +383,6 @@ public sealed class ArrivalsSystem : EntitySystem EnsureComp(uid); } - private void OnShuttleUnpaused(EntityUid uid, ArrivalsShuttleComponent component, ref EntityUnpausedEvent args) - { - component.NextTransfer += args.PausedTime; - } - private bool TryGetArrivals(out EntityUid uid) { var arrivalsQuery = EntityQueryEnumerator(); diff --git a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs index f8e6f2423f..6fb939d94a 100644 --- a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs +++ b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs @@ -93,8 +93,6 @@ public sealed partial class EmergencyShuttleSystem SubscribeLocalEvent(OnEmergencyRepeal); SubscribeLocalEvent(OnEmergencyRepealAll); SubscribeLocalEvent(OnEmergencyOpenAttempt); - - SubscribeLocalEvent(OnEscapeUnpaused); } private void OnEmergencyOpenAttempt(EntityUid uid, EmergencyShuttleConsoleComponent component, ActivatableUIOpenAttemptEvent args) diff --git a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs index 66214b0577..8b2c268300 100644 --- a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs +++ b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs @@ -507,14 +507,6 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem EnsureComp(shuttle.Value); } - private void OnEscapeUnpaused(EntityUid uid, EscapePodComponent component, ref EntityUnpausedEvent args) - { - if (component.LaunchTime == null) - return; - - component.LaunchTime = component.LaunchTime.Value + args.PausedTime; - } - /// /// Returns whether a target is escaping on the emergency shuttle, but only if evac has arrived. /// diff --git a/Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs b/Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs index bbe19614a3..e346ae9300 100644 --- a/Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs +++ b/Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs @@ -40,7 +40,6 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem SubscribeLocalEvent(PreventConsume); SubscribeLocalEvent(PreventConsume); SubscribeLocalEvent(OnHorizonMapInit); - SubscribeLocalEvent(OnHorizonUnpaused); SubscribeLocalEvent(OnStartCollide); SubscribeLocalEvent(OnEventHorizonContained); SubscribeLocalEvent(OnEventHorizonContained); @@ -57,11 +56,6 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem component.NextConsumeWaveTime = _timing.CurTime; } - private void OnHorizonUnpaused(EntityUid uid, EventHorizonComponent component, ref EntityUnpausedEvent args) - { - component.NextConsumeWaveTime += args.PausedTime; - } - public override void Shutdown() { var vvHandle = Vvm.GetTypeHandler(); diff --git a/Content.Server/Spreader/GrowingKudzuComponent.cs b/Content.Server/Spreader/GrowingKudzuComponent.cs index d2cd6d6404..8cda21234f 100644 --- a/Content.Server/Spreader/GrowingKudzuComponent.cs +++ b/Content.Server/Spreader/GrowingKudzuComponent.cs @@ -2,12 +2,13 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; namespace Content.Server.Spreader; -[RegisterComponent, Access(typeof(KudzuSystem))] +[RegisterComponent, Access(typeof(KudzuSystem)), AutoGenerateComponentPause] public sealed partial class GrowingKudzuComponent : Component { /// /// The next time kudzu will try to tick its growth level. /// [DataField("nextTick", customTypeSerializer:typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan NextTick = TimeSpan.Zero; } diff --git a/Content.Server/Spreader/KudzuSystem.cs b/Content.Server/Spreader/KudzuSystem.cs index d15a2c667f..49698ea673 100644 --- a/Content.Server/Spreader/KudzuSystem.cs +++ b/Content.Server/Spreader/KudzuSystem.cs @@ -21,7 +21,6 @@ public sealed class KudzuSystem : EntitySystem { SubscribeLocalEvent(SetupKudzu); SubscribeLocalEvent(OnKudzuSpread); - SubscribeLocalEvent(OnKudzuUnpaused); SubscribeLocalEvent(OnDamageChanged); } @@ -80,11 +79,6 @@ public sealed class KudzuSystem : EntitySystem } } - private void OnKudzuUnpaused(EntityUid uid, GrowingKudzuComponent component, ref EntityUnpausedEvent args) - { - component.NextTick += args.PausedTime; - } - private void SetupKudzu(EntityUid uid, KudzuComponent component, ComponentStartup args) { if (!EntityManager.TryGetComponent(uid, out var appearance)) diff --git a/Content.Server/StationEvents/Components/StationEventComponent.cs b/Content.Server/StationEvents/Components/StationEventComponent.cs index de0dc1c28a..b4456a4b5b 100644 --- a/Content.Server/StationEvents/Components/StationEventComponent.cs +++ b/Content.Server/StationEvents/Components/StationEventComponent.cs @@ -6,7 +6,7 @@ namespace Content.Server.StationEvents.Components; /// /// Defines basic data for a station event /// -[RegisterComponent] +[RegisterComponent, AutoGenerateComponentPause] public sealed partial class StationEventComponent : Component { public const float WeightVeryLow = 0.0f; @@ -79,11 +79,13 @@ public sealed partial class StationEventComponent : Component /// When the station event starts. /// [DataField("startTime", customTypeSerializer: typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan StartTime; /// /// When the station event ends. /// [DataField("endTime", customTypeSerializer: typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan? EndTime; } diff --git a/Content.Server/StationEvents/EventManagerSystem.cs b/Content.Server/StationEvents/EventManagerSystem.cs index fb3590dcd5..a0ab037755 100644 --- a/Content.Server/StationEvents/EventManagerSystem.cs +++ b/Content.Server/StationEvents/EventManagerSystem.cs @@ -29,15 +29,6 @@ public sealed class EventManagerSystem : EntitySystem _sawmill = Logger.GetSawmill("events"); Subs.CVar(_configurationManager, CCVars.EventsEnabled, SetEnabled, true); - - SubscribeLocalEvent(OnUnpaused); - } - - private void OnUnpaused(EntityUid uid, StationEventComponent component, ref EntityUnpausedEvent args) - { - component.StartTime += args.PausedTime; - if (component.EndTime != null) - component.EndTime = component.EndTime.Value + args.PausedTime; } /// diff --git a/Content.Server/Tesla/Components/LightningArcShooterComponent.cs b/Content.Server/Tesla/Components/LightningArcShooterComponent.cs index 641dc59e8c..add7bf88e4 100644 --- a/Content.Server/Tesla/Components/LightningArcShooterComponent.cs +++ b/Content.Server/Tesla/Components/LightningArcShooterComponent.cs @@ -6,7 +6,7 @@ namespace Content.Server.Tesla.Components; /// /// Periodically fires electric arcs at surrounding objects. /// -[RegisterComponent, Access(typeof(LightningArcShooterSystem))] +[RegisterComponent, Access(typeof(LightningArcShooterSystem)), AutoGenerateComponentPause] public sealed partial class LightningArcShooterComponent : Component { /// @@ -45,6 +45,7 @@ public sealed partial class LightningArcShooterComponent : Component /// The time, upon reaching which the next batch of lightning bolts will be fired. /// [DataField, ViewVariables(VVAccess.ReadWrite)] + [AutoPausedField] public TimeSpan NextShootTime; /// diff --git a/Content.Server/Tesla/Components/LightningSparkingComponent.cs b/Content.Server/Tesla/Components/LightningSparkingComponent.cs index bb954de89a..e56c59f196 100644 --- a/Content.Server/Tesla/Components/LightningSparkingComponent.cs +++ b/Content.Server/Tesla/Components/LightningSparkingComponent.cs @@ -7,7 +7,7 @@ namespace Content.Server.Tesla.Components; /// /// The component changes the visual of an object after it is struck by lightning /// -[RegisterComponent, Access(typeof(LightningSparkingSystem))] +[RegisterComponent, Access(typeof(LightningSparkingSystem)), AutoGenerateComponentPause] public sealed partial class LightningSparkingComponent : Component { /// @@ -20,6 +20,7 @@ public sealed partial class LightningSparkingComponent : Component /// When the spark visual should turn off. /// [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan LightningEndTime; [DataField, ViewVariables(VVAccess.ReadWrite)] diff --git a/Content.Server/Tesla/EntitySystem/LightningArcShooterSystem.cs b/Content.Server/Tesla/EntitySystem/LightningArcShooterSystem.cs index e901a93288..9948537c3c 100644 --- a/Content.Server/Tesla/EntitySystem/LightningArcShooterSystem.cs +++ b/Content.Server/Tesla/EntitySystem/LightningArcShooterSystem.cs @@ -18,7 +18,6 @@ public sealed class LightningArcShooterSystem : EntitySystem { base.Initialize(); SubscribeLocalEvent(OnShooterMapInit); - SubscribeLocalEvent(OnShooterUnpaused); } private void OnShooterMapInit(EntityUid uid, LightningArcShooterComponent component, ref MapInitEvent args) @@ -26,11 +25,6 @@ public sealed class LightningArcShooterSystem : EntitySystem component.NextShootTime = _gameTiming.CurTime + TimeSpan.FromSeconds(component.ShootMaxInterval); } - private void OnShooterUnpaused(EntityUid uid, LightningArcShooterComponent component, ref EntityUnpausedEvent args) - { - component.NextShootTime += args.PausedTime; - } - public override void Update(float frameTime) { base.Update(frameTime); diff --git a/Content.Server/Tesla/EntitySystem/LightningSparkingSystem.cs b/Content.Server/Tesla/EntitySystem/LightningSparkingSystem.cs index 7b569e66b3..c07472c8b3 100644 --- a/Content.Server/Tesla/EntitySystem/LightningSparkingSystem.cs +++ b/Content.Server/Tesla/EntitySystem/LightningSparkingSystem.cs @@ -18,12 +18,6 @@ public sealed class LightningSparkingSystem : EntitySystem base.Initialize(); SubscribeLocalEvent(OnHitByLightning); - SubscribeLocalEvent(OnLightningUnpaused); - } - - private void OnLightningUnpaused(EntityUid uid, LightningSparkingComponent component, ref EntityUnpausedEvent args) - { - component.LightningEndTime += args.PausedTime; } private void OnHitByLightning(Entity uid, ref HitByLightningEvent args) diff --git a/Content.Shared/Anomaly/Components/AnomalyComponent.cs b/Content.Shared/Anomaly/Components/AnomalyComponent.cs index 89afbb0122..bafdf12360 100644 --- a/Content.Shared/Anomaly/Components/AnomalyComponent.cs +++ b/Content.Shared/Anomaly/Components/AnomalyComponent.cs @@ -14,7 +14,7 @@ namespace Content.Shared.Anomaly.Components; /// /// Anomalies and their related components were designed here: https://hackmd.io/@ss14-design/r1sQbkJOs /// -[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause] [Access(typeof(SharedAnomalySystem))] public sealed partial class AnomalyComponent : Component { @@ -86,7 +86,7 @@ public sealed partial class AnomalyComponent : Component /// /// The time at which the next artifact pulse will occur. /// - [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoNetworkedField] + [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoNetworkedField, AutoPausedField] [ViewVariables(VVAccess.ReadWrite)] public TimeSpan NextPulseTime = TimeSpan.Zero; diff --git a/Content.Shared/Anomaly/Components/AnomalyPulsingComponent.cs b/Content.Shared/Anomaly/Components/AnomalyPulsingComponent.cs index 7326118b3c..a7fedb821b 100644 --- a/Content.Shared/Anomaly/Components/AnomalyPulsingComponent.cs +++ b/Content.Shared/Anomaly/Components/AnomalyPulsingComponent.cs @@ -5,13 +5,14 @@ namespace Content.Shared.Anomaly.Components; /// /// This component tracks anomalies that are currently pulsing /// -[RegisterComponent, Access(typeof(SharedAnomalySystem))] +[RegisterComponent, Access(typeof(SharedAnomalySystem)), AutoGenerateComponentPause] public sealed partial class AnomalyPulsingComponent : Component { /// /// The time at which the pulse will be over. /// [DataField("endTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] + [AutoPausedField] public TimeSpan EndTime; /// diff --git a/Content.Shared/Anomaly/Components/AnomalySupercriticalComponent.cs b/Content.Shared/Anomaly/Components/AnomalySupercriticalComponent.cs index bd8f40852d..00ea882ad2 100644 --- a/Content.Shared/Anomaly/Components/AnomalySupercriticalComponent.cs +++ b/Content.Shared/Anomaly/Components/AnomalySupercriticalComponent.cs @@ -8,6 +8,7 @@ namespace Content.Shared.Anomaly.Components; /// [RegisterComponent, NetworkedComponent, AutoGenerateComponentState] [Access(typeof(SharedAnomalySystem))] +[AutoGenerateComponentPause] public sealed partial class AnomalySupercriticalComponent : Component { /// @@ -15,6 +16,7 @@ public sealed partial class AnomalySupercriticalComponent : Component /// [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoNetworkedField] [ViewVariables(VVAccess.ReadWrite)] + [AutoPausedField] public TimeSpan EndTime; /// diff --git a/Content.Shared/Anomaly/SharedAnomalySystem.cs b/Content.Shared/Anomaly/SharedAnomalySystem.cs index 6eba4221b4..6cdcdf305b 100644 --- a/Content.Shared/Anomaly/SharedAnomalySystem.cs +++ b/Content.Shared/Anomaly/SharedAnomalySystem.cs @@ -46,10 +46,6 @@ public abstract class SharedAnomalySystem : EntitySystem SubscribeLocalEvent(OnAnomalyThrowStart); SubscribeLocalEvent(OnAnomalyThrowEnd); - SubscribeLocalEvent(OnAnomalyUnpause); - SubscribeLocalEvent(OnPulsingUnpause); - SubscribeLocalEvent(OnSupercriticalUnpause); - _sawmill = Logger.GetSawmill("anomaly"); } @@ -89,23 +85,6 @@ public abstract class SharedAnomalySystem : EntitySystem Popup.PopupEntity(Loc.GetString("anomaly-component-contact-damage"), target, target); } - private void OnAnomalyUnpause(EntityUid uid, AnomalyComponent component, ref EntityUnpausedEvent args) - { - component.NextPulseTime += args.PausedTime; - Dirty(uid, component); - } - - private void OnPulsingUnpause(EntityUid uid, AnomalyPulsingComponent component, ref EntityUnpausedEvent args) - { - component.EndTime += args.PausedTime; - } - - private void OnSupercriticalUnpause(EntityUid uid, AnomalySupercriticalComponent component, ref EntityUnpausedEvent args) - { - component.EndTime += args.PausedTime; - Dirty(uid, component); - } - public void DoAnomalyPulse(EntityUid uid, AnomalyComponent? component = null) { if (!Resolve(uid, ref component)) diff --git a/Content.Shared/Atmos/Rotting/PerishableComponent.cs b/Content.Shared/Atmos/Rotting/PerishableComponent.cs index 1c5c4bc4ae..6983b872b8 100644 --- a/Content.Shared/Atmos/Rotting/PerishableComponent.cs +++ b/Content.Shared/Atmos/Rotting/PerishableComponent.cs @@ -7,7 +7,7 @@ namespace Content.Shared.Atmos.Rotting; /// This makes mobs eventually start rotting when they die. /// It may be expanded to food at some point, but it's just for mobs right now. /// -[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause] [Access(typeof(SharedRottingSystem))] public sealed partial class PerishableComponent : Component { @@ -27,6 +27,7 @@ public sealed partial class PerishableComponent : Component /// Gasses are released, this is when the next gas release update will be. /// [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan RotNextUpdate = TimeSpan.Zero; /// diff --git a/Content.Shared/Atmos/Rotting/RottingComponent.cs b/Content.Shared/Atmos/Rotting/RottingComponent.cs index d4ba79bb89..d21fac88a2 100644 --- a/Content.Shared/Atmos/Rotting/RottingComponent.cs +++ b/Content.Shared/Atmos/Rotting/RottingComponent.cs @@ -8,7 +8,7 @@ namespace Content.Shared.Atmos.Rotting; /// Tracking component for stuff that has started to rot. /// Only the current stage is networked to the client. /// -[RegisterComponent, NetworkedComponent] +[RegisterComponent, NetworkedComponent, AutoGenerateComponentPause] [Access(typeof(SharedRottingSystem))] public sealed partial class RottingComponent : Component { @@ -22,6 +22,7 @@ public sealed partial class RottingComponent : Component /// When the next check will happen for rot progression + effects like damage and ammonia /// [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan NextRotUpdate = TimeSpan.Zero; /// diff --git a/Content.Shared/Bed/Cryostorage/CryostorageContainedComponent.cs b/Content.Shared/Bed/Cryostorage/CryostorageContainedComponent.cs index 5ab639bd3c..9c73b59e9a 100644 --- a/Content.Shared/Bed/Cryostorage/CryostorageContainedComponent.cs +++ b/Content.Shared/Bed/Cryostorage/CryostorageContainedComponent.cs @@ -8,7 +8,7 @@ namespace Content.Shared.Bed.Cryostorage; /// This is used to track an entity that is currently being held in Cryostorage. /// [RegisterComponent, NetworkedComponent] -[AutoGenerateComponentState] +[AutoGenerateComponentState, AutoGenerateComponentPause] public sealed partial class CryostorageContainedComponent : Component { /// @@ -22,6 +22,7 @@ public sealed partial class CryostorageContainedComponent : Component /// The time at which the cryostorage grace period ends. /// [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] + [AutoPausedField] public TimeSpan? GracePeriodEndTime; /// diff --git a/Content.Shared/Bed/Cryostorage/SharedCryostorageSystem.cs b/Content.Shared/Bed/Cryostorage/SharedCryostorageSystem.cs index 1197e019d0..f14dc21c48 100644 --- a/Content.Shared/Bed/Cryostorage/SharedCryostorageSystem.cs +++ b/Content.Shared/Bed/Cryostorage/SharedCryostorageSystem.cs @@ -37,7 +37,6 @@ public abstract class SharedCryostorageSystem : EntitySystem SubscribeLocalEvent(OnCanDropTarget); SubscribeLocalEvent(OnRemovedContained); - SubscribeLocalEvent(OnUnpaused); SubscribeLocalEvent(OnShutdownContained); SubscribeLocalEvent(OnRoundRestart); @@ -130,13 +129,6 @@ public abstract class SharedCryostorageSystem : EntitySystem RemCompDeferred(ent, comp); } - private void OnUnpaused(Entity ent, ref EntityUnpausedEvent args) - { - var comp = ent.Comp; - if (comp.GracePeriodEndTime != null) - comp.GracePeriodEndTime = comp.GracePeriodEndTime.Value + args.PausedTime; - } - private void OnShutdownContained(Entity ent, ref ComponentShutdown args) { var comp = ent.Comp; diff --git a/Content.Shared/Bed/Sleep/SharedSleepingSystem.cs b/Content.Shared/Bed/Sleep/SharedSleepingSystem.cs index 8e76ce3a3e..4e4bc2c574 100644 --- a/Content.Shared/Bed/Sleep/SharedSleepingSystem.cs +++ b/Content.Shared/Bed/Sleep/SharedSleepingSystem.cs @@ -26,14 +26,8 @@ namespace Content.Server.Bed.Sleep SubscribeLocalEvent(OnSpeakAttempt); SubscribeLocalEvent(OnSeeAttempt); SubscribeLocalEvent(OnPointAttempt); - SubscribeLocalEvent(OnSleepUnpaused); } - private void OnSleepUnpaused(EntityUid uid, SleepingComponent component, ref EntityUnpausedEvent args) - { - component.CoolDownEnd += args.PausedTime; - Dirty(uid, component); - } private void OnMapInit(EntityUid uid, SleepingComponent component, MapInitEvent args) { diff --git a/Content.Shared/Bed/Sleep/SleepingComponent.cs b/Content.Shared/Bed/Sleep/SleepingComponent.cs index 94838b658f..cd468440f4 100644 --- a/Content.Shared/Bed/Sleep/SleepingComponent.cs +++ b/Content.Shared/Bed/Sleep/SleepingComponent.cs @@ -7,7 +7,7 @@ namespace Content.Shared.Bed.Sleep; /// /// Added to entities when they go to sleep. /// -[NetworkedComponent, RegisterComponent] +[NetworkedComponent, RegisterComponent, AutoGenerateComponentPause(Dirty = true)] public sealed partial class SleepingComponent : Component { /// @@ -24,6 +24,7 @@ public sealed partial class SleepingComponent : Component public TimeSpan Cooldown = TimeSpan.FromSeconds(1f); [DataField("cooldownEnd", customTypeSerializer:typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan CoolDownEnd; [DataField("wakeAction")] public EntityUid? WakeAction; diff --git a/Content.Shared/Chasm/ChasmFallingComponent.cs b/Content.Shared/Chasm/ChasmFallingComponent.cs index 69b1c8e308..09377864c4 100644 --- a/Content.Shared/Chasm/ChasmFallingComponent.cs +++ b/Content.Shared/Chasm/ChasmFallingComponent.cs @@ -7,7 +7,7 @@ namespace Content.Shared.Chasm; /// /// Added to entities which have started falling into a chasm. /// -[RegisterComponent, NetworkedComponent] +[RegisterComponent, NetworkedComponent, AutoGenerateComponentPause] public sealed partial class ChasmFallingComponent : Component { /// @@ -23,6 +23,7 @@ public sealed partial class ChasmFallingComponent : Component public TimeSpan DeletionTime = TimeSpan.FromSeconds(1.8f); [DataField("nextDeletionTime", customTypeSerializer:typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan NextDeletionTime = TimeSpan.Zero; /// diff --git a/Content.Shared/Chasm/ChasmSystem.cs b/Content.Shared/Chasm/ChasmSystem.cs index 4045a27078..51299557db 100644 --- a/Content.Shared/Chasm/ChasmSystem.cs +++ b/Content.Shared/Chasm/ChasmSystem.cs @@ -26,7 +26,6 @@ public sealed class ChasmSystem : EntitySystem SubscribeLocalEvent(OnStepTriggered); SubscribeLocalEvent(OnStepTriggerAttempt); - SubscribeLocalEvent(OnUnpaused); SubscribeLocalEvent(OnUpdateCanMove); } @@ -73,11 +72,6 @@ public sealed class ChasmSystem : EntitySystem args.Continue = true; } - private void OnUnpaused(EntityUid uid, ChasmFallingComponent component, ref EntityUnpausedEvent args) - { - component.NextDeletionTime += args.PausedTime; - } - private void OnUpdateCanMove(EntityUid uid, ChasmFallingComponent component, UpdateCanMoveEvent args) { args.Cancel(); diff --git a/Content.Shared/Chemistry/Components/SmokeAffectedComponent.cs b/Content.Shared/Chemistry/Components/SmokeAffectedComponent.cs index def6940ee1..fdc46dfbef 100644 --- a/Content.Shared/Chemistry/Components/SmokeAffectedComponent.cs +++ b/Content.Shared/Chemistry/Components/SmokeAffectedComponent.cs @@ -7,13 +7,14 @@ namespace Content.Shared.Chemistry.Components; /// This is used for entities which are currently being affected by smoke. /// Manages the gradual metabolism every second. /// -[RegisterComponent, NetworkedComponent] +[RegisterComponent, NetworkedComponent, AutoGenerateComponentPause] public sealed partial class SmokeAffectedComponent : Component { /// /// The time at which the next smoke metabolism will occur. /// [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan NextSecond; /// diff --git a/Content.Shared/Climbing/Components/ClimbingComponent.cs b/Content.Shared/Climbing/Components/ClimbingComponent.cs index 2af2c89feb..89320eabc8 100644 --- a/Content.Shared/Climbing/Components/ClimbingComponent.cs +++ b/Content.Shared/Climbing/Components/ClimbingComponent.cs @@ -4,7 +4,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; namespace Content.Shared.Climbing.Components; -[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause] public sealed partial class ClimbingComponent : Component { /// @@ -17,6 +17,7 @@ public sealed partial class ClimbingComponent : Component /// Whether the owner is being moved onto the climbed entity. /// [AutoNetworkedField, DataField(customTypeSerializer: typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan? NextTransition; /// diff --git a/Content.Shared/Climbing/Systems/ClimbSystem.cs b/Content.Shared/Climbing/Systems/ClimbSystem.cs index 23bc54b8f8..7c760f2c5d 100644 --- a/Content.Shared/Climbing/Systems/ClimbSystem.cs +++ b/Content.Shared/Climbing/Systems/ClimbSystem.cs @@ -62,7 +62,6 @@ public sealed partial class ClimbSystem : VirtualController SubscribeLocalEvent(OnDoAfter); SubscribeLocalEvent(OnClimbEndCollide); SubscribeLocalEvent(OnBuckleChange); - SubscribeLocalEvent(OnClimbableUnpaused); SubscribeLocalEvent(OnCanDragDropOn); SubscribeLocalEvent>(AddClimbableVerb); @@ -71,15 +70,6 @@ public sealed partial class ClimbSystem : VirtualController SubscribeLocalEvent(OnGlassClimbed); } - private void OnClimbableUnpaused(EntityUid uid, ClimbingComponent component, ref EntityUnpausedEvent args) - { - if (component.NextTransition == null) - return; - - component.NextTransition = component.NextTransition.Value + args.PausedTime; - Dirty(uid, component); - } - public override void UpdateBeforeSolve(bool prediction, float frameTime) { base.UpdateBeforeSolve(prediction, frameTime); diff --git a/Content.Shared/CombatMode/Pacification/PacificationSystem.cs b/Content.Shared/CombatMode/Pacification/PacificationSystem.cs index 0c5e12e6f0..6d94c087af 100644 --- a/Content.Shared/CombatMode/Pacification/PacificationSystem.cs +++ b/Content.Shared/CombatMode/Pacification/PacificationSystem.cs @@ -28,16 +28,9 @@ public sealed class PacificationSystem : EntitySystem SubscribeLocalEvent(OnBeforeThrow); SubscribeLocalEvent(OnAttackAttempt); SubscribeLocalEvent(OnShootAttempt); - SubscribeLocalEvent(OnUnpaused); SubscribeLocalEvent(OnPacifiedDangerousAttack); } - private void OnUnpaused(Entity ent, ref EntityUnpausedEvent args) - { - if (ent.Comp.NextPopupTime != null) - ent.Comp.NextPopupTime = ent.Comp.NextPopupTime.Value + args.PausedTime; - } - private bool PacifiedCanAttack(EntityUid user, EntityUid target, [NotNullWhen(false)] out string? reason) { var ev = new AttemptPacifiedAttackEvent(user); diff --git a/Content.Shared/CombatMode/Pacification/PacifiedComponent.cs b/Content.Shared/CombatMode/Pacification/PacifiedComponent.cs index e271628fcb..464ef77885 100644 --- a/Content.Shared/CombatMode/Pacification/PacifiedComponent.cs +++ b/Content.Shared/CombatMode/Pacification/PacifiedComponent.cs @@ -11,7 +11,7 @@ namespace Content.Shared.CombatMode.Pacification; /// /// If you want full-pacifism (no combat mode at all), you can simply set before adding. /// -[RegisterComponent, NetworkedComponent] +[RegisterComponent, NetworkedComponent, AutoGenerateComponentPause] [Access(typeof(PacificationSystem))] public sealed partial class PacifiedComponent : Component { @@ -33,6 +33,7 @@ public sealed partial class PacifiedComponent : Component public TimeSpan PopupCooldown = TimeSpan.FromSeconds(3.0); [DataField] + [AutoPausedField] public TimeSpan? NextPopupTime = null; /// diff --git a/Content.Shared/Construction/Components/FlatpackCreatorComponent.cs b/Content.Shared/Construction/Components/FlatpackCreatorComponent.cs index 1270591548..ed084b39b5 100644 --- a/Content.Shared/Construction/Components/FlatpackCreatorComponent.cs +++ b/Content.Shared/Construction/Components/FlatpackCreatorComponent.cs @@ -11,7 +11,7 @@ namespace Content.Shared.Construction.Components; /// [RegisterComponent, NetworkedComponent] [Access(typeof(SharedFlatpackSystem))] -[AutoGenerateComponentState] +[AutoGenerateComponentState, AutoGenerateComponentPause] public sealed partial class FlatpackCreatorComponent : Component { /// @@ -26,6 +26,7 @@ public sealed partial class FlatpackCreatorComponent : Component /// [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] [AutoNetworkedField] + [AutoPausedField] public TimeSpan PackEndTime; /// diff --git a/Content.Shared/Construction/SharedFlatpackSystem.cs b/Content.Shared/Construction/SharedFlatpackSystem.cs index d4c2513cd3..a62488d6f3 100644 --- a/Content.Shared/Construction/SharedFlatpackSystem.cs +++ b/Content.Shared/Construction/SharedFlatpackSystem.cs @@ -40,7 +40,6 @@ public abstract class SharedFlatpackSystem : EntitySystem SubscribeLocalEvent(OnFlatpackExamined); SubscribeLocalEvent(OnCreatorRemovingAttempt); - SubscribeLocalEvent(OnCreatorUnpaused); } private void OnFlatpackInteractUsing(Entity ent, ref InteractUsingEvent args) @@ -110,11 +109,6 @@ public abstract class SharedFlatpackSystem : EntitySystem args.Cancel(); } - private void OnCreatorUnpaused(Entity ent, ref EntityUnpausedEvent args) - { - ent.Comp.PackEndTime += args.PausedTime; - } - public void SetupFlatpack(Entity ent, EntityUid? board) { if (!Resolve(ent, ref ent.Comp)) diff --git a/Content.Shared/Damage/Components/DamageOnHoldingComponent.cs b/Content.Shared/Damage/Components/DamageOnHoldingComponent.cs index fe28b7e7f0..8af477c30b 100644 --- a/Content.Shared/Damage/Components/DamageOnHoldingComponent.cs +++ b/Content.Shared/Damage/Components/DamageOnHoldingComponent.cs @@ -5,7 +5,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; namespace Content.Shared.Damage.Components; [RegisterComponent, NetworkedComponent] -[AutoGenerateComponentState] +[AutoGenerateComponentState, AutoGenerateComponentPause] [Access(typeof(DamageOnHoldingSystem))] public sealed partial class DamageOnHoldingComponent : Component { @@ -29,5 +29,6 @@ public sealed partial class DamageOnHoldingComponent : Component [DataField("nextDamage", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] [AutoNetworkedField] + [AutoPausedField] public TimeSpan NextDamage = TimeSpan.Zero; } diff --git a/Content.Shared/Damage/Components/StaminaComponent.cs b/Content.Shared/Damage/Components/StaminaComponent.cs index 74e0f6c852..5a2fba4970 100644 --- a/Content.Shared/Damage/Components/StaminaComponent.cs +++ b/Content.Shared/Damage/Components/StaminaComponent.cs @@ -6,7 +6,7 @@ namespace Content.Shared.Damage.Components; /// /// Add to an entity to paralyze it whenever it reaches critical amounts of Stamina DamageType. /// -[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)] +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true), AutoGenerateComponentPause] public sealed partial class StaminaComponent : Component { /// @@ -49,5 +49,6 @@ public sealed partial class StaminaComponent : Component /// To avoid continuously updating our data we track the last time we updated so we can extrapolate our current stamina. /// [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoNetworkedField] + [AutoPausedField] public TimeSpan NextUpdate = TimeSpan.Zero; } diff --git a/Content.Shared/Damage/Systems/DamageOnHoldingSystem.cs b/Content.Shared/Damage/Systems/DamageOnHoldingSystem.cs index e22be2fbbf..c13ec0a1b9 100644 --- a/Content.Shared/Damage/Systems/DamageOnHoldingSystem.cs +++ b/Content.Shared/Damage/Systems/DamageOnHoldingSystem.cs @@ -13,7 +13,6 @@ public sealed class DamageOnHoldingSystem : EntitySystem public override void Initialize() { base.Initialize(); - SubscribeLocalEvent(OnUnpaused); SubscribeLocalEvent(OnMapInit); } @@ -26,11 +25,6 @@ public sealed class DamageOnHoldingSystem : EntitySystem } } - private void OnUnpaused(EntityUid uid, DamageOnHoldingComponent component, ref EntityUnpausedEvent args) - { - component.NextDamage += args.PausedTime; - } - private void OnMapInit(EntityUid uid, DamageOnHoldingComponent component, MapInitEvent args) { component.NextDamage = _timing.CurTime; @@ -50,4 +44,4 @@ public sealed class DamageOnHoldingSystem : EntitySystem component.NextDamage = _timing.CurTime + TimeSpan.FromSeconds(component.Interval); } } -} \ No newline at end of file +} diff --git a/Content.Shared/Damage/Systems/StaminaSystem.cs b/Content.Shared/Damage/Systems/StaminaSystem.cs index 9ac23f1af8..b8ea953f25 100644 --- a/Content.Shared/Damage/Systems/StaminaSystem.cs +++ b/Content.Shared/Damage/Systems/StaminaSystem.cs @@ -46,7 +46,6 @@ public sealed partial class StaminaSystem : EntitySystem InitializeModifier(); - SubscribeLocalEvent(OnStamUnpaused); SubscribeLocalEvent(OnStartup); SubscribeLocalEvent(OnShutdown); SubscribeLocalEvent(OnStamHandleState); @@ -61,11 +60,6 @@ public sealed partial class StaminaSystem : EntitySystem SubscribeLocalEvent(OnMeleeHit); } - private void OnStamUnpaused(EntityUid uid, StaminaComponent component, ref EntityUnpausedEvent args) - { - component.NextUpdate += args.PausedTime; - } - private void OnStamHandleState(EntityUid uid, StaminaComponent component, ref AfterAutoHandleStateEvent args) { if (component.Critical) diff --git a/Content.Shared/Emp/EmpDisabledComponent.cs b/Content.Shared/Emp/EmpDisabledComponent.cs index 33ba619a0d..9e5a56de83 100644 --- a/Content.Shared/Emp/EmpDisabledComponent.cs +++ b/Content.Shared/Emp/EmpDisabledComponent.cs @@ -7,7 +7,7 @@ namespace Content.Shared.Emp; /// While entity has this component it is "disabled" by EMP. /// Add desired behaviour in other systems /// -[RegisterComponent, NetworkedComponent] +[RegisterComponent, NetworkedComponent, AutoGenerateComponentPause] [Access(typeof(SharedEmpSystem))] public sealed partial class EmpDisabledComponent : Component { @@ -15,6 +15,7 @@ public sealed partial class EmpDisabledComponent : Component /// Moment of time when component is removed and entity stops being "disabled" /// [DataField("timeLeft", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] + [AutoPausedField] public TimeSpan DisabledUntil; [DataField("effectCoolDown"), ViewVariables(VVAccess.ReadWrite)] @@ -23,5 +24,6 @@ public sealed partial class EmpDisabledComponent : Component /// /// When next effect will be spawned /// + [AutoPausedField] public TimeSpan TargetTime = TimeSpan.Zero; } diff --git a/Content.Shared/Gravity/GravityShakeComponent.cs b/Content.Shared/Gravity/GravityShakeComponent.cs index e8608a9681..c910320a2f 100644 --- a/Content.Shared/Gravity/GravityShakeComponent.cs +++ b/Content.Shared/Gravity/GravityShakeComponent.cs @@ -6,12 +6,13 @@ namespace Content.Shared.Gravity; /// /// Indicates this entity is shaking due to gravity changes. /// -[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause] public sealed partial class GravityShakeComponent : Component { [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField] public int ShakeTimes; [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoNetworkedField] + [AutoPausedField] public TimeSpan NextShake; } diff --git a/Content.Shared/Gravity/SharedGravitySystem.Shake.cs b/Content.Shared/Gravity/SharedGravitySystem.Shake.cs index e590baae44..ad2e0e3ad5 100644 --- a/Content.Shared/Gravity/SharedGravitySystem.Shake.cs +++ b/Content.Shared/Gravity/SharedGravitySystem.Shake.cs @@ -5,16 +5,6 @@ public abstract partial class SharedGravitySystem protected const float GravityKick = 100.0f; protected const float ShakeCooldown = 0.2f; - private void InitializeShake() - { - SubscribeLocalEvent(OnShakeUnpaused); - } - - private void OnShakeUnpaused(EntityUid uid, GravityShakeComponent component, ref EntityUnpausedEvent args) - { - component.NextShake += args.PausedTime; - } - private void UpdateShake() { var curTime = Timing.CurTime; diff --git a/Content.Shared/Gravity/SharedGravitySystem.cs b/Content.Shared/Gravity/SharedGravitySystem.cs index a65c386ae5..100d2ee74f 100644 --- a/Content.Shared/Gravity/SharedGravitySystem.cs +++ b/Content.Shared/Gravity/SharedGravitySystem.cs @@ -61,8 +61,6 @@ namespace Content.Shared.Gravity SubscribeLocalEvent(OnGravityChange); SubscribeLocalEvent(OnGetState); SubscribeLocalEvent(OnHandleState); - - InitializeShake(); } public override void Update(float frameTime) diff --git a/Content.Shared/Hands/Components/HandsComponent.cs b/Content.Shared/Hands/Components/HandsComponent.cs index ef3b2a6a0e..904b10b3bd 100644 --- a/Content.Shared/Hands/Components/HandsComponent.cs +++ b/Content.Shared/Hands/Components/HandsComponent.cs @@ -5,7 +5,7 @@ using Robust.Shared.Serialization; namespace Content.Shared.Hands.Components; -[RegisterComponent, NetworkedComponent] +[RegisterComponent, NetworkedComponent, AutoGenerateComponentPause] [Access(typeof(SharedHandsSystem))] public sealed partial class HandsComponent : Component { @@ -62,6 +62,7 @@ public sealed partial class HandsComponent : Component /// The time at which throws will be allowed again. /// [DataField, ViewVariables(VVAccess.ReadWrite)] + [AutoPausedField] public TimeSpan NextThrowTime; /// diff --git a/Content.Shared/Materials/ActiveMaterialReclaimerComponent.cs b/Content.Shared/Materials/ActiveMaterialReclaimerComponent.cs index 9c2ee9632e..2beeed5d1e 100644 --- a/Content.Shared/Materials/ActiveMaterialReclaimerComponent.cs +++ b/Content.Shared/Materials/ActiveMaterialReclaimerComponent.cs @@ -8,7 +8,7 @@ namespace Content.Shared.Materials; /// Tracker component for the process of reclaiming entities /// /// -[RegisterComponent, NetworkedComponent, Access(typeof(SharedMaterialReclaimerSystem))] +[RegisterComponent, NetworkedComponent, Access(typeof(SharedMaterialReclaimerSystem)), AutoGenerateComponentPause] public sealed partial class ActiveMaterialReclaimerComponent : Component { /// @@ -21,6 +21,7 @@ public sealed partial class ActiveMaterialReclaimerComponent : Component /// When the reclaiming process ends. /// [DataField("endTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] + [AutoPausedField] public TimeSpan EndTime; /// diff --git a/Content.Shared/Materials/InsertingMaterialStorageComponent.cs b/Content.Shared/Materials/InsertingMaterialStorageComponent.cs index 007dc73345..8ff96c17a7 100644 --- a/Content.Shared/Materials/InsertingMaterialStorageComponent.cs +++ b/Content.Shared/Materials/InsertingMaterialStorageComponent.cs @@ -3,7 +3,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; namespace Content.Shared.Materials; -[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause] public sealed partial class InsertingMaterialStorageComponent : Component { /// @@ -11,6 +11,7 @@ public sealed partial class InsertingMaterialStorageComponent : Component /// [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoNetworkedField] [ViewVariables(VVAccess.ReadWrite)] + [AutoPausedField] public TimeSpan EndTime; [ViewVariables, AutoNetworkedField] diff --git a/Content.Shared/Materials/MaterialReclaimerComponent.cs b/Content.Shared/Materials/MaterialReclaimerComponent.cs index 6c625e2fa2..3e72baf604 100644 --- a/Content.Shared/Materials/MaterialReclaimerComponent.cs +++ b/Content.Shared/Materials/MaterialReclaimerComponent.cs @@ -10,7 +10,7 @@ namespace Content.Shared.Materials; /// This is a machine that handles converting entities /// into the raw materials and chemicals that make them up. /// -[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause] [Access(typeof(SharedMaterialReclaimerSystem))] public sealed partial class MaterialReclaimerComponent : Component { @@ -90,6 +90,7 @@ public sealed partial class MaterialReclaimerComponent : Component /// When the next sound will be allowed to be played. Used to prevent spam. /// [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan NextSound; /// diff --git a/Content.Shared/Materials/SharedMaterialReclaimerSystem.cs b/Content.Shared/Materials/SharedMaterialReclaimerSystem.cs index 66cb25f530..ad8547acc0 100644 --- a/Content.Shared/Materials/SharedMaterialReclaimerSystem.cs +++ b/Content.Shared/Materials/SharedMaterialReclaimerSystem.cs @@ -34,13 +34,11 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem public override void Initialize() { SubscribeLocalEvent(OnShutdown); - SubscribeLocalEvent(OnUnpaused); SubscribeLocalEvent(OnExamined); SubscribeLocalEvent(OnEmagged); SubscribeLocalEvent(OnMapInit); SubscribeLocalEvent(OnCollide); SubscribeLocalEvent(OnActiveStartup); - SubscribeLocalEvent(OnActiveUnpaused); } private void OnMapInit(EntityUid uid, MaterialReclaimerComponent component, MapInitEvent args) @@ -53,11 +51,6 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem _audio.Stop(component.Stream); } - private void OnUnpaused(EntityUid uid, MaterialReclaimerComponent component, ref EntityUnpausedEvent args) - { - component.NextSound += args.PausedTime; - } - private void OnExamined(EntityUid uid, MaterialReclaimerComponent component, ExaminedEvent args) { args.PushMarkup(Loc.GetString("recycler-count-items", ("items", component.ItemsProcessed))); @@ -82,11 +75,6 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem component.ReclaimingContainer = Container.EnsureContainer(uid, ActiveReclaimerContainerId); } - private void OnActiveUnpaused(EntityUid uid, ActiveMaterialReclaimerComponent component, ref EntityUnpausedEvent args) - { - component.EndTime += args.PausedTime; - } - /// /// Tries to start processing an item via a . /// diff --git a/Content.Shared/Materials/SharedMaterialStorageSystem.cs b/Content.Shared/Materials/SharedMaterialStorageSystem.cs index 9f7c87df3c..b1de77d971 100644 --- a/Content.Shared/Materials/SharedMaterialStorageSystem.cs +++ b/Content.Shared/Materials/SharedMaterialStorageSystem.cs @@ -30,7 +30,6 @@ public abstract class SharedMaterialStorageSystem : EntitySystem SubscribeLocalEvent(OnMapInit); SubscribeLocalEvent(OnInteractUsing); - SubscribeLocalEvent(OnUnpaused); } public override void Update(float frameTime) @@ -52,11 +51,6 @@ public abstract class SharedMaterialStorageSystem : EntitySystem _appearance.SetData(uid, MaterialStorageVisuals.Inserting, false); } - private void OnUnpaused(EntityUid uid, InsertingMaterialStorageComponent component, ref EntityUnpausedEvent args) - { - component.EndTime += args.PausedTime; - } - /// /// Gets the volume of a specified material contained in this storage. /// diff --git a/Content.Shared/Medical/DefibrillatorComponent.cs b/Content.Shared/Medical/DefibrillatorComponent.cs index afd1e0cc96..2da5285285 100644 --- a/Content.Shared/Medical/DefibrillatorComponent.cs +++ b/Content.Shared/Medical/DefibrillatorComponent.cs @@ -11,7 +11,7 @@ namespace Content.Shared.Medical; /// This is used for defibrillators; a machine that shocks a dead /// person back into the world of the living. /// -[RegisterComponent, NetworkedComponent] +[RegisterComponent, NetworkedComponent, AutoGenerateComponentPause] public sealed partial class DefibrillatorComponent : Component { /// @@ -24,6 +24,7 @@ public sealed partial class DefibrillatorComponent : Component /// The time at which the zap cooldown will be completed /// [DataField("nextZapTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] + [AutoPausedField] public TimeSpan? NextZapTime; /// diff --git a/Content.Shared/Ninja/Components/NinjaSuitComponent.cs b/Content.Shared/Ninja/Components/NinjaSuitComponent.cs index b6fac57b0b..7e7b1ffcd3 100644 --- a/Content.Shared/Ninja/Components/NinjaSuitComponent.cs +++ b/Content.Shared/Ninja/Components/NinjaSuitComponent.cs @@ -15,6 +15,7 @@ namespace Content.Shared.Ninja.Components; /// As an implementation detail, dashing with katana is a suit action which isn't ideal. /// [RegisterComponent, NetworkedComponent, Access(typeof(SharedNinjaSuitSystem)), AutoGenerateComponentState] +[AutoGenerateComponentPause] public sealed partial class NinjaSuitComponent : Component { /// @@ -46,6 +47,7 @@ public sealed partial class NinjaSuitComponent : Component /// Time at which we will be able to use our abilities again /// [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan DisableCooldown; /// diff --git a/Content.Shared/Ninja/Systems/SharedNinjaSuitSystem.cs b/Content.Shared/Ninja/Systems/SharedNinjaSuitSystem.cs index 1449157538..fed41eaed8 100644 --- a/Content.Shared/Ninja/Systems/SharedNinjaSuitSystem.cs +++ b/Content.Shared/Ninja/Systems/SharedNinjaSuitSystem.cs @@ -27,7 +27,6 @@ public abstract class SharedNinjaSuitSystem : EntitySystem base.Initialize(); SubscribeLocalEvent(OnMapInit); - SubscribeLocalEvent(OnEntityUnpaused); SubscribeLocalEvent(OnEquipped); SubscribeLocalEvent(OnGetItemActions); @@ -43,11 +42,6 @@ public abstract class SharedNinjaSuitSystem : EntitySystem Dirty(uid, component); } - private void OnEntityUnpaused(Entity ent, ref EntityUnpausedEvent args) - { - ent.Comp.DisableCooldown += args.PausedTime; - } - /// /// Call the shared and serverside code for when a ninja equips the suit. /// diff --git a/Content.Shared/Nutrition/AnimalHusbandry/InfantComponent.cs b/Content.Shared/Nutrition/AnimalHusbandry/InfantComponent.cs index c6406a0866..2708c823d2 100644 --- a/Content.Shared/Nutrition/AnimalHusbandry/InfantComponent.cs +++ b/Content.Shared/Nutrition/AnimalHusbandry/InfantComponent.cs @@ -8,7 +8,7 @@ namespace Content.Shared.Nutrition.AnimalHusbandry; /// This is used for marking entities as infants. /// Infants have half the size, visually, and cannot breed. /// -[RegisterComponent, NetworkedComponent] +[RegisterComponent, NetworkedComponent, AutoGenerateComponentPause] public sealed partial class InfantComponent : Component { /// @@ -33,6 +33,7 @@ public sealed partial class InfantComponent : Component /// When the entity will stop being an infant. /// [DataField("infantEndTime", customTypeSerializer: typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan InfantEndTime; /// diff --git a/Content.Shared/Nutrition/AnimalHusbandry/ReproductiveComponent.cs b/Content.Shared/Nutrition/AnimalHusbandry/ReproductiveComponent.cs index ea9edcb507..8d128f547e 100644 --- a/Content.Shared/Nutrition/AnimalHusbandry/ReproductiveComponent.cs +++ b/Content.Shared/Nutrition/AnimalHusbandry/ReproductiveComponent.cs @@ -9,13 +9,14 @@ namespace Content.Shared.Nutrition.AnimalHusbandry; /// given they are next to a particular entity that fulfills a whitelist, /// can create several "child" entities. /// -[RegisterComponent] +[RegisterComponent, AutoGenerateComponentPause] public sealed partial class ReproductiveComponent : Component { /// /// The next time when breeding will be attempted. /// [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] + [AutoPausedField] public TimeSpan NextBreedAttempt; /// diff --git a/Content.Shared/Nutrition/Components/HungerComponent.cs b/Content.Shared/Nutrition/Components/HungerComponent.cs index 11197d8b42..9ac82ba283 100644 --- a/Content.Shared/Nutrition/Components/HungerComponent.cs +++ b/Content.Shared/Nutrition/Components/HungerComponent.cs @@ -9,7 +9,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Generic; namespace Content.Shared.Nutrition.Components; [RegisterComponent, NetworkedComponent, Access(typeof(HungerSystem))] -[AutoGenerateComponentState] +[AutoGenerateComponentState, AutoGenerateComponentPause] public sealed partial class HungerComponent : Component { /// @@ -106,6 +106,7 @@ public sealed partial class HungerComponent : Component /// [DataField("nextUpdateTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] [AutoNetworkedField] + [AutoPausedField] public TimeSpan NextUpdateTime; /// diff --git a/Content.Shared/Nutrition/Components/ThirstComponent.cs b/Content.Shared/Nutrition/Components/ThirstComponent.cs index 35eb4d2614..731346401f 100644 --- a/Content.Shared/Nutrition/Components/ThirstComponent.cs +++ b/Content.Shared/Nutrition/Components/ThirstComponent.cs @@ -6,7 +6,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; namespace Content.Shared.Nutrition.Components; [RegisterComponent, NetworkedComponent, Access(typeof(ThirstSystem))] -[AutoGenerateComponentState] +[AutoGenerateComponentState, AutoGenerateComponentPause] public sealed partial class ThirstComponent : Component { // Base stuff @@ -35,6 +35,7 @@ public sealed partial class ThirstComponent : Component /// [DataField("nextUpdateTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] [AutoNetworkedField] + [AutoPausedField] public TimeSpan NextUpdateTime; /// diff --git a/Content.Shared/Nutrition/EntitySystems/HungerSystem.cs b/Content.Shared/Nutrition/EntitySystems/HungerSystem.cs index 9c09603510..d8808b6e4a 100644 --- a/Content.Shared/Nutrition/EntitySystems/HungerSystem.cs +++ b/Content.Shared/Nutrition/EntitySystems/HungerSystem.cs @@ -23,18 +23,12 @@ public sealed class HungerSystem : EntitySystem { base.Initialize(); - SubscribeLocalEvent(OnUnpaused); SubscribeLocalEvent(OnMapInit); SubscribeLocalEvent(OnShutdown); SubscribeLocalEvent(OnRefreshMovespeed); SubscribeLocalEvent(OnRejuvenate); } - private void OnUnpaused(EntityUid uid, HungerComponent component, ref EntityUnpausedEvent args) - { - component.NextUpdateTime += args.PausedTime; - } - private void OnMapInit(EntityUid uid, HungerComponent component, MapInitEvent args) { var amount = _random.Next( diff --git a/Content.Shared/Nutrition/EntitySystems/ThirstSystem.cs b/Content.Shared/Nutrition/EntitySystems/ThirstSystem.cs index 05a2338768..b070cee283 100644 --- a/Content.Shared/Nutrition/EntitySystems/ThirstSystem.cs +++ b/Content.Shared/Nutrition/EntitySystems/ThirstSystem.cs @@ -29,7 +29,6 @@ public sealed class ThirstSystem : EntitySystem SubscribeLocalEvent(OnRefreshMovespeed); SubscribeLocalEvent(OnMapInit); SubscribeLocalEvent(OnRejuvenate); - SubscribeLocalEvent(OnUnpaused); } private void OnMapInit(EntityUid uid, ThirstComponent component, MapInitEvent args) @@ -184,9 +183,4 @@ public sealed class ThirstSystem : EntitySystem UpdateEffects(uid, thirst); } } - - private void OnUnpaused(EntityUid uid, ThirstComponent component, ref EntityUnpausedEvent args) - { - component.NextUpdateTime += args.PausedTime; - } } diff --git a/Content.Shared/PowerCell/PowerCellDrawComponent.cs b/Content.Shared/PowerCell/PowerCellDrawComponent.cs index 6963326b70..708a86a8ea 100644 --- a/Content.Shared/PowerCell/PowerCellDrawComponent.cs +++ b/Content.Shared/PowerCell/PowerCellDrawComponent.cs @@ -6,7 +6,7 @@ namespace Content.Shared.PowerCell; /// /// Indicates that the entity's ActivatableUI requires power or else it closes. /// -[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause] public sealed partial class PowerCellDrawComponent : Component { #region Prediction @@ -49,5 +49,6 @@ public sealed partial class PowerCellDrawComponent : Component /// When the next automatic power draw will occur /// [DataField("nextUpdate", customTypeSerializer: typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan NextUpdateTime; } diff --git a/Content.Shared/Salvage/Expeditions/SalvageExpeditions.cs b/Content.Shared/Salvage/Expeditions/SalvageExpeditions.cs index 41f44f672b..fe4d59b81a 100644 --- a/Content.Shared/Salvage/Expeditions/SalvageExpeditions.cs +++ b/Content.Shared/Salvage/Expeditions/SalvageExpeditions.cs @@ -42,7 +42,7 @@ public sealed class ClaimSalvageMessage : BoundUserInterfaceMessage /// /// Added per station to store data on their available salvage missions. /// -[RegisterComponent] +[RegisterComponent, AutoGenerateComponentPause] public sealed partial class SalvageExpeditionDataComponent : Component { /// @@ -61,6 +61,7 @@ public sealed partial class SalvageExpeditionDataComponent : Component /// Nexy time salvage missions are offered. /// [ViewVariables(VVAccess.ReadWrite), DataField("nextOffer", customTypeSerializer:typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan NextOffer; [ViewVariables] diff --git a/Content.Shared/Salvage/Fulton/FultonedComponent.cs b/Content.Shared/Salvage/Fulton/FultonedComponent.cs index 3070249eee..c73237a366 100644 --- a/Content.Shared/Salvage/Fulton/FultonedComponent.cs +++ b/Content.Shared/Salvage/Fulton/FultonedComponent.cs @@ -7,7 +7,7 @@ namespace Content.Shared.Salvage.Fulton; /// /// Marks an entity as pending being fultoned. /// -[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)] +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true), AutoGenerateComponentPause] public sealed partial class FultonedComponent : Component { /// @@ -26,6 +26,7 @@ public sealed partial class FultonedComponent : Component /// When the fulton is travelling to the beacon. /// [ViewVariables(VVAccess.ReadWrite), DataField("nextFulton", customTypeSerializer:typeof(TimeOffsetSerializer)), AutoNetworkedField] + [AutoPausedField] public TimeSpan NextFulton; [ViewVariables(VVAccess.ReadWrite), DataField("sound"), AutoNetworkedField] diff --git a/Content.Shared/Salvage/Fulton/SharedFultonSystem.cs b/Content.Shared/Salvage/Fulton/SharedFultonSystem.cs index adaef16608..0599482bbe 100644 --- a/Content.Shared/Salvage/Fulton/SharedFultonSystem.cs +++ b/Content.Shared/Salvage/Fulton/SharedFultonSystem.cs @@ -40,7 +40,6 @@ public abstract partial class SharedFultonSystem : EntitySystem SubscribeLocalEvent(OnFultonDoAfter); - SubscribeLocalEvent(OnFultonUnpaused); SubscribeLocalEvent>(OnFultonedGetVerbs); SubscribeLocalEvent(OnFultonedExamine); SubscribeLocalEvent(OnFultonContainerInserted); @@ -106,11 +105,6 @@ public abstract partial class SharedFultonSystem : EntitySystem Audio.PlayPredicted(fulton.FultonSound, args.Target.Value, args.User); } - private void OnFultonUnpaused(EntityUid uid, FultonedComponent component, ref EntityUnpausedEvent args) - { - component.NextFulton += args.PausedTime; - } - private void OnFultonInteract(EntityUid uid, FultonComponent component, AfterInteractEvent args) { if (args.Target == null || args.Handled || !args.CanReach) diff --git a/Content.Shared/Singularity/Components/EventHorizonComponent.cs b/Content.Shared/Singularity/Components/EventHorizonComponent.cs index 2aa081915b..106d790ccb 100644 --- a/Content.Shared/Singularity/Components/EventHorizonComponent.cs +++ b/Content.Shared/Singularity/Components/EventHorizonComponent.cs @@ -10,7 +10,7 @@ namespace Content.Shared.Singularity.Components; /// Primarily managed by and its server/client versions. /// [Access(friends: typeof(SharedEventHorizonSystem))] -[RegisterComponent, NetworkedComponent] +[RegisterComponent, NetworkedComponent, AutoGenerateComponentPause] public sealed partial class EventHorizonComponent : Component { /// @@ -78,6 +78,7 @@ public sealed partial class EventHorizonComponent : Component /// The next time at which this consumed everything it overlapped with. /// [ViewVariables(VVAccess.ReadOnly), DataField("nextConsumeWaveTime", customTypeSerializer:typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan NextConsumeWaveTime; #endregion Update Timing diff --git a/Content.Shared/Sound/Components/EmitSoundOnCollideComponent.cs b/Content.Shared/Sound/Components/EmitSoundOnCollideComponent.cs index f2c71ad120..a2cdd63ab7 100644 --- a/Content.Shared/Sound/Components/EmitSoundOnCollideComponent.cs +++ b/Content.Shared/Sound/Components/EmitSoundOnCollideComponent.cs @@ -3,7 +3,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; namespace Content.Shared.Sound.Components; -[RegisterComponent, NetworkedComponent] +[RegisterComponent, NetworkedComponent, AutoGenerateComponentPause] public sealed partial class EmitSoundOnCollideComponent : BaseEmitSoundComponent { public static readonly TimeSpan CollideCooldown = TimeSpan.FromSeconds(0.2); @@ -18,5 +18,6 @@ public sealed partial class EmitSoundOnCollideComponent : BaseEmitSoundComponent /// To avoid sound spam add a cooldown to it. /// [ViewVariables(VVAccess.ReadWrite), DataField("nextSound", customTypeSerializer: typeof(TimeOffsetSerializer))] + [AutoPausedField] public TimeSpan NextSound; } diff --git a/Content.Shared/Sound/SharedEmitSoundSystem.cs b/Content.Shared/Sound/SharedEmitSoundSystem.cs index 5e131a1355..22ba8e0e3e 100644 --- a/Content.Shared/Sound/SharedEmitSoundSystem.cs +++ b/Content.Shared/Sound/SharedEmitSoundSystem.cs @@ -42,7 +42,6 @@ public abstract class SharedEmitSoundSystem : EntitySystem SubscribeLocalEvent(OnEmitSoundOnPickup); SubscribeLocalEvent(OnEmitSoundOnDrop); - SubscribeLocalEvent(OnEmitSoundUnpaused); SubscribeLocalEvent(OnEmitSoundOnCollide); } @@ -119,11 +118,6 @@ public abstract class SharedEmitSoundSystem : EntitySystem } } - private void OnEmitSoundUnpaused(EntityUid uid, EmitSoundOnCollideComponent component, ref EntityUnpausedEvent args) - { - component.NextSound += args.PausedTime; - } - private void OnEmitSoundOnCollide(EntityUid uid, EmitSoundOnCollideComponent component, ref StartCollideEvent args) { if (!args.OurFixture.Hard || diff --git a/Content.Shared/Storage/Components/MagnetPickupComponent.cs b/Content.Shared/Storage/Components/MagnetPickupComponent.cs index c57b7c4e85..3467439a6d 100644 --- a/Content.Shared/Storage/Components/MagnetPickupComponent.cs +++ b/Content.Shared/Storage/Components/MagnetPickupComponent.cs @@ -5,10 +5,11 @@ namespace Content.Server.Storage.Components; /// /// Applies an ongoing pickup area around the attached entity. /// -[RegisterComponent] +[RegisterComponent, AutoGenerateComponentPause] public sealed partial class MagnetPickupComponent : Component { [ViewVariables(VVAccess.ReadWrite), DataField("nextScan")] + [AutoPausedField] public TimeSpan NextScan = TimeSpan.Zero; /// diff --git a/Content.Shared/Storage/EntitySystems/MagnetPickupSystem.cs b/Content.Shared/Storage/EntitySystems/MagnetPickupSystem.cs index 1703db25f3..21861f57da 100644 --- a/Content.Shared/Storage/EntitySystems/MagnetPickupSystem.cs +++ b/Content.Shared/Storage/EntitySystems/MagnetPickupSystem.cs @@ -26,12 +26,6 @@ public sealed class MagnetPickupSystem : EntitySystem base.Initialize(); _physicsQuery = GetEntityQuery(); SubscribeLocalEvent(OnMagnetMapInit); - SubscribeLocalEvent(OnMagnetUnpaused); - } - - private void OnMagnetUnpaused(EntityUid uid, MagnetPickupComponent component, ref EntityUnpausedEvent args) - { - component.NextScan += args.PausedTime; } private void OnMagnetMapInit(EntityUid uid, MagnetPickupComponent component, MapInitEvent args) diff --git a/Content.Shared/Teleportation/Components/SwapTeleporterComponent.cs b/Content.Shared/Teleportation/Components/SwapTeleporterComponent.cs index 7a7bac83f4..a080a83aaa 100644 --- a/Content.Shared/Teleportation/Components/SwapTeleporterComponent.cs +++ b/Content.Shared/Teleportation/Components/SwapTeleporterComponent.cs @@ -11,7 +11,7 @@ namespace Content.Shared.Teleportation.Components; /// This is used for an entity that, when linked to another valid entity, allows the two to swap positions, /// additionally swapping the positions of the parents. /// -[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause] [Access(typeof(SwapTeleporterSystem))] public sealed partial class SwapTeleporterComponent : Component { @@ -37,6 +37,7 @@ public sealed partial class SwapTeleporterComponent : Component /// The time at which ends and teleportation can occur again. /// [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] + [AutoPausedField] public TimeSpan NextTeleportUse; /// diff --git a/Content.Shared/Teleportation/Systems/SwapTeleporterSystem.cs b/Content.Shared/Teleportation/Systems/SwapTeleporterSystem.cs index e900700e11..98a8955c7b 100644 --- a/Content.Shared/Teleportation/Systems/SwapTeleporterSystem.cs +++ b/Content.Shared/Teleportation/Systems/SwapTeleporterSystem.cs @@ -33,7 +33,6 @@ public sealed class SwapTeleporterSystem : EntitySystem SubscribeLocalEvent(OnActivateInWorld); SubscribeLocalEvent(OnExamined); - SubscribeLocalEvent(OnUnpaused); SubscribeLocalEvent(OnShutdown); _xformQuery = GetEntityQuery(); @@ -217,11 +216,6 @@ public sealed class SwapTeleporterSystem : EntitySystem } } - private void OnUnpaused(Entity ent, ref EntityUnpausedEvent args) - { - ent.Comp.NextTeleportUse += args.PausedTime; - } - private void OnShutdown(Entity ent, ref ComponentShutdown args) { DestroyLink((ent, ent), null); diff --git a/Content.Shared/Throwing/ThrownItemComponent.cs b/Content.Shared/Throwing/ThrownItemComponent.cs index ab80e07938..16c9b13254 100644 --- a/Content.Shared/Throwing/ThrownItemComponent.cs +++ b/Content.Shared/Throwing/ThrownItemComponent.cs @@ -5,7 +5,7 @@ using Robust.Shared.Timing; namespace Content.Shared.Throwing { - [RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)] + [RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true), AutoGenerateComponentPause] public sealed partial class ThrownItemComponent : Component { /// @@ -24,6 +24,7 @@ namespace Content.Shared.Throwing /// Compared to to land this entity, if any. /// [DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] + [AutoPausedField] public TimeSpan? LandTime; /// diff --git a/Content.Shared/Throwing/ThrownItemSystem.cs b/Content.Shared/Throwing/ThrownItemSystem.cs index 8d84cf36fa..0f38c4d753 100644 --- a/Content.Shared/Throwing/ThrownItemSystem.cs +++ b/Content.Shared/Throwing/ThrownItemSystem.cs @@ -35,7 +35,6 @@ namespace Content.Shared.Throwing SubscribeLocalEvent(HandleCollision); SubscribeLocalEvent(PreventCollision); SubscribeLocalEvent(ThrowItem); - SubscribeLocalEvent(OnThrownUnpaused); SubscribeLocalEvent(HandlePullStarted); } @@ -59,14 +58,6 @@ namespace Content.Shared.Throwing _fixtures.TryCreateFixture(uid, shape, ThrowingFixture, hard: false, collisionMask: (int) CollisionGroup.ThrownItem, manager: fixturesComponent, body: body); } - private void OnThrownUnpaused(EntityUid uid, ThrownItemComponent component, ref EntityUnpausedEvent args) - { - if (component.LandTime != null) - { - component.LandTime = component.LandTime.Value + args.PausedTime; - } - } - private void HandleCollision(EntityUid uid, ThrownItemComponent component, ref StartCollideEvent args) { if (!args.OtherFixture.Hard) diff --git a/Content.Shared/Timing/UseDelayComponent.cs b/Content.Shared/Timing/UseDelayComponent.cs index 784fd6632f..1560d4dd0b 100644 --- a/Content.Shared/Timing/UseDelayComponent.cs +++ b/Content.Shared/Timing/UseDelayComponent.cs @@ -10,7 +10,7 @@ namespace Content.Shared.Timing; /// Currently it only supports a single delay per entity, this means that for things that have two delay interactions they will share one timer, so this can cause issues. For example, the bible has a delay when opening the storage UI and when applying it's interaction effect, and they share the same delay. /// [RegisterComponent] -[NetworkedComponent, AutoGenerateComponentState] +[NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause] [Access(typeof(UseDelaySystem))] public sealed partial class UseDelayComponent : Component { @@ -18,12 +18,14 @@ public sealed partial class UseDelayComponent : Component /// When the delay starts. /// [ViewVariables(VVAccess.ReadWrite), DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoNetworkedField] + [AutoPausedField] public TimeSpan DelayStartTime; /// /// When the delay ends. /// [ViewVariables(VVAccess.ReadWrite), DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoNetworkedField] + [AutoPausedField] public TimeSpan DelayEndTime; /// diff --git a/Content.Shared/Timing/UseDelaySystem.cs b/Content.Shared/Timing/UseDelaySystem.cs index 34f12fa55e..388f31079c 100644 --- a/Content.Shared/Timing/UseDelaySystem.cs +++ b/Content.Shared/Timing/UseDelaySystem.cs @@ -7,19 +7,6 @@ public sealed class UseDelaySystem : EntitySystem [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly MetaDataSystem _metadata = default!; - public override void Initialize() - { - SubscribeLocalEvent(OnUnpaused); - } - - private void OnUnpaused(Entity ent, ref EntityUnpausedEvent args) - { - // We got unpaused, resume the delay - ent.Comp.DelayStartTime += args.PausedTime; - ent.Comp.DelayEndTime += args.PausedTime; - Dirty(ent); - } - public void SetDelay(Entity ent, TimeSpan delay) { if (ent.Comp.Delay == delay) diff --git a/Content.Shared/Weapons/Marker/DamageMarkerComponent.cs b/Content.Shared/Weapons/Marker/DamageMarkerComponent.cs index ef3b712f60..87ad6519d0 100644 --- a/Content.Shared/Weapons/Marker/DamageMarkerComponent.cs +++ b/Content.Shared/Weapons/Marker/DamageMarkerComponent.cs @@ -10,6 +10,7 @@ namespace Content.Shared.Weapons.Marker; /// Marks an entity to take additional damage /// [RegisterComponent, NetworkedComponent, AutoGenerateComponentState, Access(typeof(SharedDamageMarkerSystem))] +[AutoGenerateComponentPause] public sealed partial class DamageMarkerComponent : Component { /// @@ -34,5 +35,6 @@ public sealed partial class DamageMarkerComponent : Component public EntityUid Marker; [ViewVariables(VVAccess.ReadWrite), DataField("endTime", customTypeSerializer:typeof(TimeOffsetSerializer)), AutoNetworkedField] + [AutoPausedField] public TimeSpan EndTime; } diff --git a/Content.Shared/Weapons/Marker/SharedDamageMarkerSystem.cs b/Content.Shared/Weapons/Marker/SharedDamageMarkerSystem.cs index 3a6afce363..63b2d5f211 100644 --- a/Content.Shared/Weapons/Marker/SharedDamageMarkerSystem.cs +++ b/Content.Shared/Weapons/Marker/SharedDamageMarkerSystem.cs @@ -20,7 +20,6 @@ public abstract class SharedDamageMarkerSystem : EntitySystem { base.Initialize(); SubscribeLocalEvent(OnMarkerCollide); - SubscribeLocalEvent(OnMarkerUnpaused); SubscribeLocalEvent(OnMarkerAttacked); } @@ -54,11 +53,6 @@ public abstract class SharedDamageMarkerSystem : EntitySystem } } - private void OnMarkerUnpaused(EntityUid uid, DamageMarkerComponent component, ref EntityUnpausedEvent args) - { - component.EndTime += args.PausedTime; - } - private void OnMarkerCollide(EntityUid uid, DamageMarkerOnCollideComponent component, ref StartCollideEvent args) { if (!args.OtherFixture.Hard || diff --git a/Content.Shared/Weapons/Melee/MeleeWeaponComponent.cs b/Content.Shared/Weapons/Melee/MeleeWeaponComponent.cs index 27c3a5f0df..e5b35f6c0b 100644 --- a/Content.Shared/Weapons/Melee/MeleeWeaponComponent.cs +++ b/Content.Shared/Weapons/Melee/MeleeWeaponComponent.cs @@ -10,7 +10,7 @@ namespace Content.Shared.Weapons.Melee; /// /// When given to a mob lets them do unarmed attacks, or when given to an item lets someone wield it to do attacks. /// -[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause] public sealed partial class MeleeWeaponComponent : Component { // TODO: This is becoming bloated as shit. @@ -33,6 +33,7 @@ public sealed partial class MeleeWeaponComponent : Component /// [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoNetworkedField] [ViewVariables(VVAccess.ReadWrite)] + [AutoPausedField] public TimeSpan NextAttack; /// diff --git a/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs b/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs index 12455a1f49..6a5127f2c9 100644 --- a/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs +++ b/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs @@ -68,7 +68,6 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem { base.Initialize(); - SubscribeLocalEvent(OnMeleeUnpaused); SubscribeLocalEvent(OnMeleeSelected); SubscribeLocalEvent(OnMeleeShotAttempted); SubscribeLocalEvent(OnMeleeShot); @@ -112,11 +111,6 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem } } - private void OnMeleeUnpaused(EntityUid uid, MeleeWeaponComponent component, ref EntityUnpausedEvent args) - { - component.NextAttack += args.PausedTime; - } - private void OnMeleeSelected(EntityUid uid, MeleeWeaponComponent component, HandSelectedEvent args) { var attackRate = GetAttackRate(uid, args.User, component); diff --git a/Content.Shared/Weapons/Ranged/Components/GunComponent.cs b/Content.Shared/Weapons/Ranged/Components/GunComponent.cs index 8d7d548ad8..5a335e7e5c 100644 --- a/Content.Shared/Weapons/Ranged/Components/GunComponent.cs +++ b/Content.Shared/Weapons/Ranged/Components/GunComponent.cs @@ -9,7 +9,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; namespace Content.Shared.Weapons.Ranged.Components; -[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause] [Access(typeof(SharedGunSystem))] public sealed partial class GunComponent : Component { @@ -198,6 +198,7 @@ public sealed partial class GunComponent : Component /// [DataField(customTypeSerializer:typeof(TimeOffsetSerializer))] [AutoNetworkedField] + [AutoPausedField] public TimeSpan NextFire = TimeSpan.Zero; /// diff --git a/Content.Shared/Weapons/Ranged/Components/RechargeBasicEntityAmmoComponent.cs b/Content.Shared/Weapons/Ranged/Components/RechargeBasicEntityAmmoComponent.cs index 923f95e207..f478405bec 100644 --- a/Content.Shared/Weapons/Ranged/Components/RechargeBasicEntityAmmoComponent.cs +++ b/Content.Shared/Weapons/Ranged/Components/RechargeBasicEntityAmmoComponent.cs @@ -7,7 +7,7 @@ namespace Content.Shared.Weapons.Ranged.Components; /// /// Responsible for handling recharging a basic entity ammo provider over time. /// -[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause] public sealed partial class RechargeBasicEntityAmmoComponent : Component { [ViewVariables(VVAccess.ReadWrite)] @@ -25,5 +25,6 @@ public sealed partial class RechargeBasicEntityAmmoComponent : Component [ViewVariables(VVAccess.ReadWrite), DataField("nextCharge", customTypeSerializer:typeof(TimeOffsetSerializer)), AutoNetworkedField] + [AutoPausedField] public TimeSpan? NextCharge; } diff --git a/Content.Shared/Weapons/Ranged/Systems/RechargeBasicEntityAmmoSystem.cs b/Content.Shared/Weapons/Ranged/Systems/RechargeBasicEntityAmmoSystem.cs index 536f3da811..b774c8ab45 100644 --- a/Content.Shared/Weapons/Ranged/Systems/RechargeBasicEntityAmmoSystem.cs +++ b/Content.Shared/Weapons/Ranged/Systems/RechargeBasicEntityAmmoSystem.cs @@ -21,19 +21,10 @@ public sealed class RechargeBasicEntityAmmoSystem : EntitySystem { base.Initialize(); - SubscribeLocalEvent(OnUnpaused); SubscribeLocalEvent(OnInit); SubscribeLocalEvent(OnExamined); } - private void OnUnpaused(EntityUid uid, RechargeBasicEntityAmmoComponent component, ref EntityUnpausedEvent args) - { - if (component.NextCharge == null) - return; - - component.NextCharge = component.NextCharge.Value + args.PausedTime; - } - public override void Update(float frameTime) { base.Update(frameTime); diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs index ba22ba2cdc..71e3e80764 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs @@ -94,7 +94,6 @@ public abstract partial class SharedGunSystem : EntitySystem SubscribeLocalEvent(OnExamine); SubscribeLocalEvent(OnCycleMode); SubscribeLocalEvent(OnGunSelected); - SubscribeLocalEvent(OnGunUnpaused); SubscribeLocalEvent(OnMapInit); } @@ -122,11 +121,6 @@ public abstract partial class SharedGunSystem : EntitySystem } } - private void OnGunUnpaused(EntityUid uid, GunComponent component, ref EntityUnpausedEvent args) - { - component.NextFire += args.PausedTime; - } - private void OnShootRequest(RequestShootEvent msg, EntitySessionEventArgs args) { var user = args.SenderSession.AttachedEntity; diff --git a/SpaceStation14.sln b/SpaceStation14.sln index 5a05a09e35..e0cb455a6d 100644 --- a/SpaceStation14.sln +++ b/SpaceStation14.sln @@ -129,6 +129,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Content.PatreonParser", "Co EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Robust.Analyzers.Tests", "RobustToolbox\Robust.Analyzers.Tests\Robust.Analyzers.Tests.csproj", "{83F510FE-9B50-4D96-AFAB-CC13998D6AFE}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Roslyn", "Roslyn", "{7844DA69-B0F0-49FB-A05E-ECA37372277A}" + ProjectSection(SolutionItems) = preProject + RobustToolbox\Robust.Roslyn.Shared\Robust.Roslyn.Shared.props = RobustToolbox\Robust.Roslyn.Shared\Robust.Roslyn.Shared.props + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -457,20 +462,21 @@ Global {41B450C0-A361-4CD7-8121-7072B8995CFC} = {83B4CBBA-547A-42F0-A7CD-8A67D93196CE} {7B9472D3-79D4-48D1-9B22-BCDE518FE842} = {83B4CBBA-547A-42F0-A7CD-8A67D93196CE} {1FAE651D-29D8-437A-9864-47CE0D180016} = {83B4CBBA-547A-42F0-A7CD-8A67D93196CE} - {3CFEB7DB-12C6-46F3-89FC-1450F3016FFA} = {83B4CBBA-547A-42F0-A7CD-8A67D93196CE} {8922428F-17C3-47A7-BFE9-570DEB2464DA} = {83B4CBBA-547A-42F0-A7CD-8A67D93196CE} {16F7DE32-0186-44B9-9345-0C20D1BF2422} = {AFF53804-115F-4E67-B81F-26265EA27880} {AFF53804-115F-4E67-B81F-26265EA27880} = {83B4CBBA-547A-42F0-A7CD-8A67D93196CE} {23F09C45-950E-4DB7-A465-E937450FF008} = {AFF53804-115F-4E67-B81F-26265EA27880} {440426C1-8DCA-43F6-967F-94439B8DAF47} = {AFF53804-115F-4E67-B81F-26265EA27880} - {88B0FC0F-7209-40E2-AF16-EB90AF727C5B} = {83B4CBBA-547A-42F0-A7CD-8A67D93196CE} {A3C5B00A-D232-4A01-B82E-B0E58BFD5C12} = {83B4CBBA-547A-42F0-A7CD-8A67D93196CE} {8A21C7CA-2EB8-40E5-8043-33582C06D139} = {83B4CBBA-547A-42F0-A7CD-8A67D93196CE} {952AAF2A-DF63-4A7D-8094-3453893EBA80} = {83B4CBBA-547A-42F0-A7CD-8A67D93196CE} {A965CB3B-FD31-44AF-8872-85ABA436098D} = {83B4CBBA-547A-42F0-A7CD-8A67D93196CE} - {07CA34A1-1D37-4771-A2E3-495A1044AE0B} = {83B4CBBA-547A-42F0-A7CD-8A67D93196CE} - {6FBF108E-5CB5-47DE-8D7E-B496ABA9E3E2} = {83B4CBBA-547A-42F0-A7CD-8A67D93196CE} - {83F510FE-9B50-4D96-AFAB-CC13998D6AFE} = {83B4CBBA-547A-42F0-A7CD-8A67D93196CE} + {7844DA69-B0F0-49FB-A05E-ECA37372277A} = {83B4CBBA-547A-42F0-A7CD-8A67D93196CE} + {3CFEB7DB-12C6-46F3-89FC-1450F3016FFA} = {7844DA69-B0F0-49FB-A05E-ECA37372277A} + {6FBF108E-5CB5-47DE-8D7E-B496ABA9E3E2} = {7844DA69-B0F0-49FB-A05E-ECA37372277A} + {07CA34A1-1D37-4771-A2E3-495A1044AE0B} = {7844DA69-B0F0-49FB-A05E-ECA37372277A} + {88B0FC0F-7209-40E2-AF16-EB90AF727C5B} = {7844DA69-B0F0-49FB-A05E-ECA37372277A} + {83F510FE-9B50-4D96-AFAB-CC13998D6AFE} = {7844DA69-B0F0-49FB-A05E-ECA37372277A} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {AA37ED9F-F8D6-468E-A101-658AD605B09A}