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:
@@ -1,13 +1,27 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Chat.Managers;
|
||||
using Content.Server.GameTicking.Rules.Components;
|
||||
using Content.Server.Station.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Collections;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.GameTicking.Rules;
|
||||
|
||||
public abstract partial class GameRuleSystem<T> : EntitySystem where T : IComponent
|
||||
{
|
||||
[Dependency] protected readonly IRobustRandom RobustRandom = default!;
|
||||
[Dependency] protected readonly IChatManager ChatManager = default!;
|
||||
[Dependency] protected readonly GameTicker GameTicker = default!;
|
||||
|
||||
// Not protected, just to be used in utility methods
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
[Dependency] private readonly AtmosphereSystem _atmosphere = default!;
|
||||
[Dependency] private readonly MapSystem _map = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -71,36 +85,6 @@ public abstract partial class GameRuleSystem<T> : EntitySystem where T : ICompon
|
||||
|
||||
}
|
||||
|
||||
protected EntityQueryEnumerator<ActiveGameRuleComponent, T, GameRuleComponent> QueryActiveRules()
|
||||
{
|
||||
return EntityQueryEnumerator<ActiveGameRuleComponent, T, GameRuleComponent>();
|
||||
}
|
||||
|
||||
protected bool TryRoundStartAttempt(RoundStartAttemptEvent ev, string localizedPresetName)
|
||||
{
|
||||
var query = EntityQueryEnumerator<ActiveGameRuleComponent, T, GameRuleComponent>();
|
||||
while (query.MoveNext(out _, out _, out _, out var gameRule))
|
||||
{
|
||||
var minPlayers = gameRule.MinPlayers;
|
||||
if (!ev.Forced && ev.Players.Length < minPlayers)
|
||||
{
|
||||
ChatManager.SendAdminAnnouncement(Loc.GetString("preset-not-enough-ready-players",
|
||||
("readyPlayersCount", ev.Players.Length), ("minimumPlayers", minPlayers),
|
||||
("presetName", localizedPresetName)));
|
||||
ev.Cancel();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ev.Players.Length == 0)
|
||||
{
|
||||
ChatManager.DispatchServerAnnouncement(Loc.GetString("preset-no-one-ready"));
|
||||
ev.Cancel();
|
||||
}
|
||||
}
|
||||
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
Reference in New Issue
Block a user