Event refactor (#9589)

* Station event refactor

* Remove clientside `IStationEventManager`

we can just use prototypes

* Basic API idea

* Cruft

* first attempt at epicness

* okay yeah this shit is really clean

* sort out minor stuff

* Convert `BreakerFlip`

* `BureaucraticError` + general cleanup

* `DiseaseOutbreak`

* `FalseAlarm`

* `GasLeak`

* `KudzuGrowth`

* `MeteorSwarm`

* `MouseMigration`

* misc errors

* `PowerGridCheck`

* `RandomSentience`

* `VentClog`

* `VentCritters`

* `ZombieOutbreak`

* Rewrite basic event scheduler

* Minor fixes and logging

* ooooops

* errors + fix

* linter

* completions, `RuleStarted` property, update loop fixes

* Tweaks

* Fix #9462

* Basic scheduler update fix, and fixes #8174

* Add test

* UI cleanup

* really this was just for testing
This commit is contained in:
Kara
2022-07-10 18:48:41 -07:00
committed by GitHub
parent f28cdaaa7c
commit b9a0894d7c
55 changed files with 1095 additions and 1582 deletions

View File

@@ -1,27 +1,33 @@
using JetBrains.Annotations;
using Content.Server.GameTicking.Rules.Configurations;
using JetBrains.Annotations;
using Robust.Shared.Audio;
using Robust.Shared.Player;
namespace Content.Server.StationEvents.Events
{
[UsedImplicitly]
public sealed class FalseAlarm : StationEvent
public sealed class FalseAlarm : StationEventSystem
{
public override string Name => "FalseAlarm";
public override float Weight => WeightHigh;
protected override float EndAfter => 1.0f;
public override int? MaxOccurrences => 5;
public override string Prototype => "FalseAlarm";
public override void Announce()
public override void Started()
{
var stationEventSystem = EntitySystem.Get<StationEventSystem>();
var randomEvent = stationEventSystem.PickRandomEvent();
base.Started();
if (randomEvent != null)
var ev = GetRandomEventUnweighted(PrototypeManager, RobustRandom);
if (ev.Configuration is not StationEventRuleConfiguration cfg)
return;
if (cfg.StartAnnouncement != null)
{
StartAnnouncement = randomEvent.StartAnnouncement;
StartAudio = randomEvent.StartAudio;
ChatSystem.DispatchGlobalAnnouncement(Loc.GetString(cfg.StartAnnouncement), playDefaultSound: false, colorOverride: Color.Gold);
}
base.Announce();
if (cfg.StartAudio != null)
{
SoundSystem.Play(cfg.StartAudio.GetSound(), Filter.Broadcast(), cfg.StartAudio.Params);
}
}
}
}