dragon antag refactor (#28217)

* remove dragon system usage of GenericAntag

* add AntagRandomSpawn for making antags spawn at a random tile

* add AntagSpawner to make an antag spawner just spawn an entity

* add antag prototype for dragon since it never had one

* make dragon spawner a GhostRoleAntagSpawner, remove GenericAntag

* make dragon rule use AntagSelection and stuff

* remove dragon GenericAntag rule

* add back to spawn menu

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
deltanedas
2024-05-31 15:08:26 +00:00
committed by GitHub
parent 6e278a12fb
commit 5da2151924
11 changed files with 110 additions and 45 deletions

View File

@@ -0,0 +1,22 @@
using Content.Server.Antag.Components;
using Content.Server.GameTicking.Rules;
namespace Content.Server.Antag;
public sealed class AntagRandomSpawnSystem : GameRuleSystem<AntagRandomSpawnComponent>
{
[Dependency] private readonly SharedTransformSystem _transform = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<AntagRandomSpawnComponent, AntagSelectLocationEvent>(OnSelectLocation);
}
private void OnSelectLocation(Entity<AntagRandomSpawnComponent> ent, ref AntagSelectLocationEvent args)
{
if (TryFindRandomTile(out _, out _, out _, out var coords))
args.Coordinates.Add(_transform.ToMapCoordinates(coords));
}
}