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:
committed by
GitHub
parent
2a2324ecaf
commit
e00f74505c
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user