mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-30 08:07:28 +00: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 cc24ba6a31)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using Content.Server.GameTicking.Rules.VariationPass.Components;
|
||||
using Content.Shared.Storage;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.GameTicking.Rules.VariationPass;
|
||||
|
||||
/// <inheritdoc cref="EntitySpawnVariationPassComponent"/>
|
||||
public sealed class EntitySpawnVariationPassSystem : VariationPassSystem<EntitySpawnVariationPassComponent>
|
||||
{
|
||||
protected override void ApplyVariation(Entity<EntitySpawnVariationPassComponent> ent, ref StationVariationPassEvent args)
|
||||
{
|
||||
var totalTiles = Stations.GetTileCount(args.Station);
|
||||
|
||||
var dirtyMod = Random.NextGaussian(ent.Comp.TilesPerEntityAverage, ent.Comp.TilesPerEntityStdDev);
|
||||
var trashTiles = Math.Max((int) (totalTiles * (1 / dirtyMod)), 0);
|
||||
|
||||
for (var i = 0; i < trashTiles; i++)
|
||||
{
|
||||
if (!TryFindRandomTileOnStation(args.Station, out _, out _, out var coords))
|
||||
continue;
|
||||
|
||||
var ents = EntitySpawnCollection.GetSpawns(ent.Comp.Entities, Random);
|
||||
foreach (var spawn in ents)
|
||||
{
|
||||
SpawnAtPosition(spawn, coords);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user