* 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
30 lines
1.0 KiB
C#
30 lines
1.0 KiB
C#
using Content.Server.Station.Systems;
|
|
using Robust.Shared.Random;
|
|
|
|
namespace Content.Server.GameTicking.Rules.VariationPass;
|
|
|
|
/// <summary>
|
|
/// Base class for procedural variation rule passes, which apply some kind of variation to a station,
|
|
/// so we simply reduce the boilerplate for the event handling a bit with this.
|
|
/// </summary>
|
|
public abstract class VariationPassSystem<T> : GameRuleSystem<T>
|
|
where T: IComponent
|
|
{
|
|
[Dependency] protected readonly StationSystem Stations = default!;
|
|
[Dependency] protected readonly IRobustRandom Random = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<T, StationVariationPassEvent>(ApplyVariation);
|
|
}
|
|
|
|
protected bool IsMemberOfStation(Entity<TransformComponent> ent, ref StationVariationPassEvent args)
|
|
{
|
|
return Stations.GetOwningStation(ent, ent.Comp) == args.Station.Owner;
|
|
}
|
|
|
|
protected abstract void ApplyVariation(Entity<T> ent, ref StationVariationPassEvent args);
|
|
}
|