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.StationEvents.Components;
/// <summary>
/// Defines basic data for a station event
/// </summary>
[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.
/// </summary>
[DataField("startTime", customTypeSerializer: typeof(TimeOffsetSerializer))]
[AutoPausedField]
public TimeSpan StartTime;
/// <summary>
/// When the station event ends.
/// </summary>
[DataField("endTime", customTypeSerializer: typeof(TimeOffsetSerializer))]
[AutoPausedField]
public TimeSpan? EndTime;
}

View File

@@ -29,15 +29,6 @@ public sealed class EventManagerSystem : EntitySystem
_sawmill = Logger.GetSawmill("events");
Subs.CVar(_configurationManager, CCVars.EventsEnabled, SetEnabled, true);
SubscribeLocalEvent<StationEventComponent, EntityUnpausedEvent>(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;
}
/// <summary>