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
This commit is contained in:
Kara
2024-01-30 22:52:35 -07:00
committed by GitHub
parent 1029142740
commit cc24ba6a31
37 changed files with 977 additions and 148 deletions

View File

@@ -214,6 +214,21 @@ namespace Content.Server.Light.EntitySystems
return bulb;
}
/// <summary>
/// Replaces the spawned prototype of a pre-mapinit powered light with a different variant.
/// </summary>
public bool ReplaceSpawnedPrototype(Entity<PoweredLightComponent> light, string bulb)
{
if (light.Comp.LightBulbContainer.ContainedEntity != null)
return false;
if (LifeStage(light.Owner) >= EntityLifeStage.MapInitialized)
return false;
light.Comp.HasLampOnSpawn = bulb;
return true;
}
/// <summary>
/// Try to replace current bulb with a new one
/// If succeed old bulb just drops on floor
@@ -241,6 +256,17 @@ namespace Content.Server.Light.EntitySystems
/// </summary>
public bool TryDestroyBulb(EntityUid uid, PoweredLightComponent? light = null)
{
if (!Resolve(uid, ref light, false))
return false;
// if we aren't mapinited,
// just null the spawned bulb
if (LifeStage(uid) < EntityLifeStage.MapInitialized)
{
light.HasLampOnSpawn = null;
return true;
}
// check bulb state
var bulbUid = GetBulb(uid, light);
if (bulbUid == null || !EntityManager.TryGetComponent(bulbUid.Value, out LightBulbComponent? lightBulb))