initialize NextEventComponent when created

This commit is contained in:
SolStar2 2024-11-12 16:59:36 -05:00
parent 83267fdf5b
commit 36f45be10e
2 changed files with 16 additions and 0 deletions

View File

@ -33,6 +33,14 @@ namespace Content.Server.StationEvents
{
// A little starting variance so schedulers dont all proc at once.
component.TimeUntilNextEvent = RobustRandom.NextFloat(component.MinimumTimeUntilFirstEvent, component.MinimumTimeUntilFirstEvent + 120);
// DeltaV - end init NextEventComp
NextEventComponent? nextEventComponent = null;
if (Resolve(uid, ref nextEventComponent, false)
&& _event.TryGenerateRandomEvent(component.ScheduledGameRules, out string? firstEvent, TimeSpan.FromSeconds(component.TimeUntilNextEvent))
&& firstEvent != null)
_next.UpdateNextEvent(nextEventComponent, firstEvent, TimeSpan.FromSeconds(component.TimeUntilNextEvent));
// DeltaV - end init NextEventComp
}
protected override void Ended(EntityUid uid, BasicStationEventSchedulerComponent component, GameRuleComponent gameRule,

View File

@ -40,6 +40,14 @@ public sealed class RampingStationEventSchedulerSystem : GameRuleSystem<RampingS
component.StartingChaos = component.MaxChaos / 10;
PickNextEventTime(uid, component);
// DeltaV - end init NextEventComp
NextEventComponent? nextEventComponent = null;
if (Resolve(uid, ref nextEventComponent, false)
&& _event.TryGenerateRandomEvent(component.ScheduledGameRules, out string? firstEvent, TimeSpan.FromSeconds(component.TimeUntilNextEvent))
&& firstEvent != null)
_next.UpdateNextEvent(nextEventComponent, firstEvent, TimeSpan.FromSeconds(component.TimeUntilNextEvent));
// DeltaV - end init NextEventComp
}
public override void Update(float frameTime)