Use new ComponentPauseGenerator (#25183)

Also includes some (non critical) changes to the solution file to re-organize the Roslyn components.
This commit is contained in:
Pieter-Jan Briers
2024-02-26 04:36:19 +01:00
committed by GitHub
parent 2a2324ecaf
commit e00f74505c
130 changed files with 150 additions and 539 deletions

View File

@@ -6,7 +6,7 @@ namespace Content.Server.Medical.Components;
/// <summary>
/// After scanning, retrieves the target Uid to use with its related UI.
/// </summary>
[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
/// </summary>
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
[AutoPausedField]
public TimeSpan NextUpdate = TimeSpan.Zero;
/// <summary>

View File

@@ -50,21 +50,12 @@ public sealed class DefibrillatorSystem : EntitySystem
/// <inheritdoc/>
public override void Initialize()
{
SubscribeLocalEvent<DefibrillatorComponent, EntityUnpausedEvent>(OnUnpaused);
SubscribeLocalEvent<DefibrillatorComponent, UseInHandEvent>(OnUseInHand);
SubscribeLocalEvent<DefibrillatorComponent, PowerCellSlotEmptyEvent>(OnPowerCellSlotEmpty);
SubscribeLocalEvent<DefibrillatorComponent, AfterInteractEvent>(OnAfterInteract);
SubscribeLocalEvent<DefibrillatorComponent, DefibrillatorZapDoAfterEvent>(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)))

View File

@@ -30,7 +30,6 @@ public sealed class HealthAnalyzerSystem : EntitySystem
public override void Initialize()
{
SubscribeLocalEvent<HealthAnalyzerComponent, EntityUnpausedEvent>(OnEntityUnpaused);
SubscribeLocalEvent<HealthAnalyzerComponent, AfterInteractEvent>(OnAfterInteract);
SubscribeLocalEvent<HealthAnalyzerComponent, HealthAnalyzerDoAfterEvent>(OnDoAfter);
SubscribeLocalEvent<HealthAnalyzerComponent, EntGotInsertedIntoContainerMessage>(OnInsertedIntoContainer);
@@ -65,11 +64,6 @@ public sealed class HealthAnalyzerSystem : EntitySystem
}
}
private void OnEntityUnpaused(Entity<HealthAnalyzerComponent> ent, ref EntityUnpausedEvent args)
{
ent.Comp.NextUpdate += args.PausedTime;
}
/// <summary>
/// Trigger the doafter for scanning
/// </summary>

View File

@@ -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.
/// </summary>
[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
/// </summary>
[DataField("nextUpdate", customTypeSerializer:typeof(TimeOffsetSerializer))]
[AutoPausedField]
public TimeSpan NextUpdate = TimeSpan.Zero;
/// <summary>

View File

@@ -40,7 +40,6 @@ public sealed class SuitSensorSystem : EntitySystem
base.Initialize();
SubscribeLocalEvent<PlayerSpawnCompleteEvent>(OnPlayerSpawn);
SubscribeLocalEvent<SuitSensorComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<SuitSensorComponent, EntityUnpausedEvent>(OnUnpaused);
SubscribeLocalEvent<SuitSensorComponent, GotEquippedEvent>(OnEquipped);
SubscribeLocalEvent<SuitSensorComponent, GotUnequippedEvent>(OnUnequipped);
SubscribeLocalEvent<SuitSensorComponent, ExaminedEvent>(OnExamine);
@@ -51,11 +50,6 @@ public sealed class SuitSensorSystem : EntitySystem
SubscribeLocalEvent<SuitSensorComponent, EmpDisabledRemoved>(OnEmpFinished);
}
private void OnUnpaused(EntityUid uid, SuitSensorComponent component, ref EntityUnpausedEvent args)
{
component.NextUpdate += args.PausedTime;
}
public override void Update(float frameTime)
{
base.Update(frameTime);