Skip to content

Commit

Permalink
initialize NextEventComponent when created
Browse files Browse the repository at this point in the history
  • Loading branch information
ewokswagger committed Nov 12, 2024
1 parent 83267fd commit 36f45be
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ protected override void Started(EntityUid uid, BasicStationEventSchedulerCompone
{
// 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ protected override void Started(EntityUid uid, RampingStationEventSchedulerCompo
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)
Expand Down

0 comments on commit 36f45be

Please sign in to comment.