initialize NextEventComponent when created
This commit is contained in:
parent
83267fdf5b
commit
36f45be10e
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue