mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 13:37:47 +03:00
Roundstart variation game rules (#24397)
* Raise `StationPostInitEvent` broadcast * Basic variation pass handling * standardize names + rule entities * why does it work like that? * add to defaults * light break variation pass * ent spawn entry * move some stationevent utility functions to gamerule + add one for finding random tile on specified station * forgot how statistics works * powered light variation pass is good now * station tile count function * public method to ensure all solutions (for procedural use before mapinit) * move gamerulesystem utility funcs to partial * ensure all solutions before spilling in puddlesystem. for use when spilling before mapinit * trash & puddle variation passes! * oh yeah * ehh lets live a little * std * utility for game rule check based on comp * entprotoid the trash spawner oops * generalize trash variation * use added instead of started for secret rule * random cleanup * generic replacement variation system * Wall rusting variation rule * account for modifying while enumerating * use localaabb * fix test * minor tweaks * reinforced wall replacer + puddletweaker (cherry picked from commit cc24ba6a317c4bee84ffa1eda8397c255ca92be9)
This commit is contained in:
@@ -6,6 +6,7 @@ using Content.Server.Station.Events;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Station;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Collections;
|
||||
using Robust.Shared.Configuration;
|
||||
@@ -35,6 +36,7 @@ public sealed class StationSystem : EntitySystem
|
||||
[Dependency] private readonly GameTicker _gameTicker = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
[Dependency] private readonly MetaDataSystem _metaData = default!;
|
||||
[Dependency] private readonly MapSystem _map = default!;
|
||||
|
||||
private ISawmill _sawmill = default!;
|
||||
|
||||
@@ -208,6 +210,23 @@ public sealed class StationSystem : EntitySystem
|
||||
return largestGrid;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the total number of tiles contained in the station's grids.
|
||||
/// </summary>
|
||||
public int GetTileCount(StationDataComponent component)
|
||||
{
|
||||
var count = 0;
|
||||
foreach (var gridUid in component.Grids)
|
||||
{
|
||||
if (!TryComp<MapGridComponent>(gridUid, out var grid))
|
||||
continue;
|
||||
|
||||
count += _map.GetAllTiles(gridUid, grid).Count();
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to retrieve a filter for everything in the station the source is on.
|
||||
/// </summary>
|
||||
@@ -306,8 +325,8 @@ public sealed class StationSystem : EntitySystem
|
||||
AddGridToStation(station, grid, null, data, name);
|
||||
}
|
||||
|
||||
var ev = new StationPostInitEvent();
|
||||
RaiseLocalEvent(station, ref ev);
|
||||
var ev = new StationPostInitEvent((station, data));
|
||||
RaiseLocalEvent(station, ref ev, true);
|
||||
|
||||
return station;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user