* 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>
23 lines
722 B
C#
23 lines
722 B
C#
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));
|
|
}
|
|
}
|