mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-10-01 00:27:59 +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:
@@ -18,9 +18,9 @@ public sealed class SecretRuleSystem : GameRuleSystem<SecretRuleComponent>
|
||||
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
|
||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||
|
||||
protected override void Started(EntityUid uid, SecretRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
|
||||
protected override void Added(EntityUid uid, SecretRuleComponent component, GameRuleComponent gameRule, GameRuleAddedEvent args)
|
||||
{
|
||||
base.Started(uid, component, gameRule, args);
|
||||
base.Added(uid, component, gameRule, args);
|
||||
PickRule(component);
|
||||
}
|
||||
|
||||
@@ -40,13 +40,24 @@ public sealed class SecretRuleSystem : GameRuleSystem<SecretRuleComponent>
|
||||
// but currently there's no way to know anyway as they use cvars.
|
||||
var presetString = _configurationManager.GetCVar(CCVars.SecretWeightPrototype);
|
||||
var preset = _prototypeManager.Index<WeightedRandomPrototype>(presetString).Pick(_random);
|
||||
Logger.InfoS("gamepreset", $"Selected {preset} for secret.");
|
||||
Log.Info($"Selected {preset} for secret.");
|
||||
_adminLogger.Add(LogType.EventStarted, $"Selected {preset} for secret.");
|
||||
|
||||
var rules = _prototypeManager.Index<GamePresetPrototype>(preset).Rules;
|
||||
foreach (var rule in rules)
|
||||
{
|
||||
GameTicker.StartGameRule(rule, out var ruleEnt);
|
||||
EntityUid ruleEnt;
|
||||
|
||||
// if we're pre-round (i.e. will only be added)
|
||||
// then just add rules. if we're added in the middle of the round (or at any other point really)
|
||||
// then we want to start them as well
|
||||
if (GameTicker.RunLevel <= GameRunLevel.InRound)
|
||||
ruleEnt = GameTicker.AddGameRule(rule);
|
||||
else
|
||||
{
|
||||
GameTicker.StartGameRule(rule, out ruleEnt);
|
||||
}
|
||||
|
||||
component.AdditionalGameRules.Add(ruleEnt);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user