Remove events from survival (#289)

* Survival

* Remove events
This commit is contained in:
Aviu00
2023-08-10 15:37:55 +03:00
committed by Aviu00
parent 8b3361a52a
commit bcfe04ebee
3 changed files with 32 additions and 1 deletions

View File

@@ -13,9 +13,16 @@ public sealed class CargoGiftsRule : StationEventSystem<CargoGiftsRuleComponent>
[Dependency] private readonly CargoSystem _cargoSystem = default!; [Dependency] private readonly CargoSystem _cargoSystem = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly GameTicker _ticker = default!; [Dependency] private readonly GameTicker _ticker = default!;
[Dependency] private readonly RampingStationEventSchedulerSystem _rampingEventSystem = default!; // WD
protected override void Added(EntityUid uid, CargoGiftsRuleComponent component, GameRuleComponent gameRule, GameRuleAddedEvent args) protected override void Added(EntityUid uid, CargoGiftsRuleComponent component, GameRuleComponent gameRule, GameRuleAddedEvent args)
{ {
if (_rampingEventSystem.CheckRampingEventRule()) // WD START
{
ForceEndSelf(uid, gameRule);
return;
} // WD END
base.Added(uid, component, gameRule, args); base.Added(uid, component, gameRule, args);
var str = Loc.GetString(component.Announce, var str = Loc.GetString(component.Announce,

View File

@@ -15,11 +15,18 @@ namespace Content.Server.StationEvents.Events;
public sealed class VentClogRule : StationEventSystem<VentClogRuleComponent> public sealed class VentClogRule : StationEventSystem<VentClogRuleComponent>
{ {
[Dependency] private readonly SmokeSystem _smoke = default!; [Dependency] private readonly SmokeSystem _smoke = default!;
[Dependency] private readonly RampingStationEventSchedulerSystem _rampingEventSystem = default!; // WD
protected override void Started(EntityUid uid, VentClogRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args) protected override void Started(EntityUid uid, VentClogRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
{ {
base.Started(uid, component, gameRule, args); base.Started(uid, component, gameRule, args);
if (_rampingEventSystem.CheckRampingEventRule()) // WD START
{
ForceEndSelf(uid, gameRule);
return;
} // WD END
if (!TryGetRandomStation(out var chosenStation)) if (!TryGetRandomStation(out var chosenStation))
return; return;
@@ -56,4 +63,15 @@ public sealed class VentClogRule : StationEventSystem<VentClogRuleComponent>
Audio.PlayPvs(component.Sound, transform.Coordinates); Audio.PlayPvs(component.Sound, transform.Coordinates);
} }
} }
protected override void Added(EntityUid uid, VentClogRuleComponent component, GameRuleComponent gameRule, GameRuleAddedEvent args) // WD
{
if (_rampingEventSystem.CheckRampingEventRule()) // WD START
{
ForceEndSelf(uid, gameRule);
return;
} // WD END
base.Added(uid, component, gameRule, args);
}
} }

View File

@@ -1,4 +1,5 @@
using Content.Server.GameTicking; using System.Linq;
using Content.Server.GameTicking;
using Content.Server.GameTicking.Rules; using Content.Server.GameTicking.Rules;
using Content.Server.GameTicking.Rules.Components; using Content.Server.GameTicking.Rules.Components;
using Content.Server.StationEvents.Components; using Content.Server.StationEvents.Components;
@@ -93,4 +94,9 @@ public sealed class RampingStationEventSchedulerSystem : GameRuleSystem<RampingS
// 4-12 minutes baseline. Will get faster over time as the chaos mod increases. // 4-12 minutes baseline. Will get faster over time as the chaos mod increases.
component.TimeUntilNextEvent = _random.NextFloat(240f / mod, 720f / mod); component.TimeUntilNextEvent = _random.NextFloat(240f / mod, 720f / mod);
} }
public bool CheckRampingEventRule() // WD
{
return EntityQuery<RampingStationEventSchedulerComponent>().Any();
}
} }