Refactor stations to properly use entity prototypes. (stationsv3) (#16570)
* Update StationSpawningSystem.cs Web-edit to allow feeding in an existing entity. * Update StationSpawningSystem.cs value type moment * Update StationSpawningSystem.cs * Oh goddamnit this is a refactor now. * awawawa * aaaaaaaaaaa * ee * forgot records. * no records? no records. * What's in a name? * Sloth forcing me to do the refactor properly smh. * e * optional evac in test. * tests pls work * awa --------- Co-authored-by: moonheart08 <moonheart08@users.noreply.github.com>
This commit is contained in:
@@ -32,13 +32,10 @@ public sealed class AlertLevelSystem : EntitySystem
|
||||
|
||||
public override void Update(float time)
|
||||
{
|
||||
foreach (var station in _stationSystem.Stations)
|
||||
{
|
||||
if (!TryComp(station, out AlertLevelComponent? alert))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var query = EntityQueryEnumerator<AlertLevelComponent>();
|
||||
|
||||
while (query.MoveNext(out var station, out var alert))
|
||||
{
|
||||
if (alert.CurrentDelay <= 0)
|
||||
{
|
||||
if (alert.ActiveDelay)
|
||||
@@ -55,9 +52,10 @@ public sealed class AlertLevelSystem : EntitySystem
|
||||
|
||||
private void OnStationInitialize(StationInitializedEvent args)
|
||||
{
|
||||
var alertLevelComponent = AddComp<AlertLevelComponent>(args.Station);
|
||||
if (!TryComp<AlertLevelComponent>(args.Station, out var alertLevelComponent))
|
||||
return;
|
||||
|
||||
if (!_prototypeManager.TryIndex(DefaultAlertLevelSet, out AlertLevelPrototype? alerts))
|
||||
if (!_prototypeManager.TryIndex(alertLevelComponent.AlertLevelPrototype, out AlertLevelPrototype? alerts))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user