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

@@ -33,9 +33,7 @@ public sealed partial class AnomalySystem
SubscribeLocalEvent<AnomalyGeneratorComponent, MaterialAmountChangedEvent>(OnGeneratorMaterialAmountChanged);
SubscribeLocalEvent<AnomalyGeneratorComponent, AnomalyGeneratorGenerateButtonPressedEvent>(OnGenerateButtonPressed);
SubscribeLocalEvent<AnomalyGeneratorComponent, PowerChangedEvent>(OnGeneratorPowerChanged);
SubscribeLocalEvent<AnomalyGeneratorComponent, EntityUnpausedEvent>(OnGeneratorUnpaused);
SubscribeLocalEvent<GeneratingAnomalyGeneratorComponent, ComponentStartup>(OnGeneratingStartup);
SubscribeLocalEvent<GeneratingAnomalyGeneratorComponent, EntityUnpausedEvent>(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);

View File

@@ -22,7 +22,6 @@ public sealed partial class AnomalySystem
SubscribeLocalEvent<AnomalyVesselComponent, InteractUsingEvent>(OnVesselInteractUsing);
SubscribeLocalEvent<AnomalyVesselComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<AnomalyVesselComponent, ResearchServerGetPointsPerSecondEvent>(OnVesselGetPointsPerSecond);
SubscribeLocalEvent<AnomalyVesselComponent, EntityUnpausedEvent>(OnUnpaused);
SubscribeLocalEvent<AnomalyShutdownEvent>(OnShutdown);
SubscribeLocalEvent<AnomalyStabilityChangedEvent>(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<AnomalyVesselComponent>();

View File

@@ -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.
/// </summary>
[RegisterComponent, Access(typeof(SharedAnomalySystem))]
[RegisterComponent, Access(typeof(SharedAnomalySystem)), AutoGenerateComponentPause]
public sealed partial class AnomalyGeneratorComponent : Component
{
/// <summary>
/// The time at which the cooldown for generating another anomaly will be over
/// </summary>
[DataField("cooldownEndTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
[AutoPausedField]
public TimeSpan CooldownEndTime = TimeSpan.Zero;
/// <summary>

View File

@@ -10,7 +10,7 @@ namespace Content.Server.Anomaly.Components;
/// they generate points for the selected server based on
/// the anomaly's stability and severity.
/// </summary>
[RegisterComponent, Access(typeof(SharedAnomalySystem))]
[RegisterComponent, Access(typeof(SharedAnomalySystem)), AutoGenerateComponentPause]
public sealed partial class AnomalyVesselComponent : Component
{
/// <summary>
@@ -42,6 +42,7 @@ public sealed partial class AnomalyVesselComponent : Component
/// When the next beep sound will play
/// </summary>
[DataField("nextBeep", customTypeSerializer:typeof(TimeOffsetSerializer))]
[AutoPausedField]
public TimeSpan NextBeep = TimeSpan.Zero;
/// <summary>

View File

@@ -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
{
/// <summary>
/// When the generating period will end.
/// </summary>
[DataField("endTime", customTypeSerializer: typeof(TimeOffsetSerializer))]
[AutoPausedField]
public TimeSpan EndTime = TimeSpan.Zero;
public EntityUid? AudioStream;