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:
parent
91be03d0a3
commit
ecc9fbfe42
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
using Content.Server.Antag.Components;
|
||||
|
||||
namespace Content.Server.Antag;
|
||||
|
||||
/// <summary>
|
||||
/// Spawns an entity when creating an antag for <see cref="AntagSpawnerComponent"/>.
|
||||
/// </summary>
|
||||
public sealed class AntagSpawnerSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<AntagSpawnerComponent, AntagSelectEntityEvent>(OnSelectEntity);
|
||||
}
|
||||
|
||||
private void OnSelectEntity(Entity<AntagSpawnerComponent> ent, ref AntagSelectEntityEvent args)
|
||||
{
|
||||
args.Entity = Spawn(ent.Comp.Prototype);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
namespace Content.Server.Antag.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Spawns this rule's antags at random tiles on a station using <c>TryGetRandomTile</c>.
|
||||
/// Requires <see cref="AntagSelectionComponent"/>.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class AntagRandomSpawnComponent : Component;
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
using Content.Server.Antag;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Antag.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Spawns a prototype for antags created with a spawner.
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(AntagSpawnerSystem))]
|
||||
public sealed partial class AntagSpawnerComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The entity to spawn.
|
||||
/// </summary>
|
||||
[DataField(required: true)]
|
||||
public EntProtoId Prototype = string.Empty;
|
||||
}
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
using Content.Server.GenericAntag;
|
||||
using Content.Server.Objectives.Components;
|
||||
using Content.Server.Objectives.Systems;
|
||||
using Content.Server.Popups;
|
||||
|
|
@ -55,7 +54,6 @@ public sealed partial class DragonSystem : EntitySystem
|
|||
SubscribeLocalEvent<DragonComponent, DragonSpawnRiftActionEvent>(OnSpawnRift);
|
||||
SubscribeLocalEvent<DragonComponent, RefreshMovementSpeedModifiersEvent>(OnDragonMove);
|
||||
SubscribeLocalEvent<DragonComponent, MobStateChangedEvent>(OnMobStateChanged);
|
||||
SubscribeLocalEvent<DragonComponent, GenericAntagCreatedEvent>(OnCreated);
|
||||
SubscribeLocalEvent<DragonComponent, EntityZombifiedEvent>(OnZombified);
|
||||
}
|
||||
|
||||
|
|
@ -192,18 +190,6 @@ public sealed partial class DragonSystem : EntitySystem
|
|||
DeleteRifts(uid, false, component);
|
||||
}
|
||||
|
||||
private void OnCreated(EntityUid uid, DragonComponent comp, ref GenericAntagCreatedEvent args)
|
||||
{
|
||||
var mindId = args.MindId;
|
||||
var mind = args.Mind;
|
||||
|
||||
_role.MindAddRole(mindId, new DragonRoleComponent(), mind);
|
||||
_role.MindAddRole(mindId, new RoleBriefingComponent()
|
||||
{
|
||||
Briefing = Loc.GetString("dragon-role-briefing")
|
||||
}, mind);
|
||||
}
|
||||
|
||||
private void OnZombified(Entity<DragonComponent> ent, ref EntityZombifiedEvent args)
|
||||
{
|
||||
// prevent carp attacking zombie dragon
|
||||
|
|
|
|||
|
|
@ -33,3 +33,6 @@ roles-antag-thief-objective = Add some NT property to your personal collection w
|
|||
|
||||
roles-antag-terminator-name = Paradox Anomaly # DeltaV - paradox anomaly
|
||||
roles-antag-terminator-objective = Replace your double, or befriend them. # DeltaV - paradox anomaly
|
||||
|
||||
roles-antag-dragon-name = Space Dragon
|
||||
roles-antag-dragon-objective = Create a carp army to take over this quadrant.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,14 @@
|
|||
- type: entity
|
||||
abstract: true
|
||||
parent: MarkerBase
|
||||
id: BaseAntagSpawner
|
||||
name: ghost role spawn point
|
||||
components:
|
||||
- type: GhostRole
|
||||
raffle:
|
||||
settings: default
|
||||
- type: GhostRoleAntagSpawner
|
||||
|
||||
- type: entity
|
||||
id: SpawnPointGhostRatKing
|
||||
name: ghost role spawn point
|
||||
|
|
@ -83,10 +94,8 @@
|
|||
|
||||
- type: entity
|
||||
noSpawn: true
|
||||
parent: BaseAntagSpawner
|
||||
id: SpawnPointLoneNukeOperative
|
||||
name: ghost role spawn point
|
||||
suffix: loneops
|
||||
parent: MarkerBase
|
||||
components:
|
||||
- type: GhostRole
|
||||
name: ghost-role-information-loneop-name
|
||||
|
|
@ -98,8 +107,6 @@
|
|||
- !type:DepartmentTimeRequirement # DeltaV - Security dept time requirement
|
||||
department: Security
|
||||
time: 36000 # DeltaV - 10 hours
|
||||
raffle:
|
||||
settings: default
|
||||
- type: GhostRoleAntagSpawner
|
||||
- type: Sprite
|
||||
sprite: Markers/jobs.rsi
|
||||
|
|
@ -136,20 +143,14 @@
|
|||
description: roles-antag-nuclear-operative-objective
|
||||
|
||||
- type: entity
|
||||
parent: MarkerBase
|
||||
id: SpawnPointGhostDragon
|
||||
noSpawn: true
|
||||
name: ghost role spawn point
|
||||
suffix: dragon
|
||||
parent: BaseAntagSpawner
|
||||
id: SpawnPointGhostDragon
|
||||
components:
|
||||
- type: GhostRole
|
||||
name: ghost-role-information-space-dragon-name
|
||||
description: ghost-role-information-space-dragon-description
|
||||
rules: ghost-role-component-default-rules
|
||||
raffle:
|
||||
settings: default
|
||||
- type: GhostRoleMobSpawner
|
||||
prototype: MobDragon
|
||||
- type: Sprite
|
||||
layers:
|
||||
- state: green
|
||||
|
|
|
|||
|
|
@ -142,11 +142,10 @@
|
|||
- type: entity
|
||||
parent: BaseMobDragon
|
||||
id: MobDragon
|
||||
suffix: No role or objectives
|
||||
components:
|
||||
- type: Dragon
|
||||
spawnRiftAction: ActionSpawnRift
|
||||
- type: GenericAntag
|
||||
rule: Dragon
|
||||
- type: ActionGun
|
||||
action: ActionDragonsBreath
|
||||
gunProto: DragonsBreathGun
|
||||
|
|
|
|||
|
|
@ -85,13 +85,29 @@
|
|||
noSpawn: true
|
||||
components:
|
||||
- type: StationEvent
|
||||
weight: 1 # DeltaV - was 5
|
||||
duration: 1
|
||||
earliestStart: 60 # DeltaV - was 45
|
||||
reoccurrenceDelay: 60
|
||||
weight: 1 # DeltaV - was 6.5
|
||||
earliestStart: 60 # DeltaV - was 40
|
||||
reoccurrenceDelay: 20
|
||||
minimumPlayers: 45 # DeltaV - was 20
|
||||
- type: RandomSpawnRule
|
||||
prototype: SpawnPointGhostDragon
|
||||
- type: AntagRandomSpawn
|
||||
- type: AntagSpawner
|
||||
prototype: MobDragon
|
||||
- type: AntagObjectives
|
||||
objectives:
|
||||
- CarpRiftsObjective
|
||||
- DragonSurviveObjective
|
||||
- type: AntagSelection
|
||||
agentName: dragon-round-end-agent-name
|
||||
definitions:
|
||||
- spawnerPrototype: SpawnPointGhostDragon
|
||||
min: 1
|
||||
max: 1
|
||||
pickPlayer: false
|
||||
mindComponents:
|
||||
- type: DragonRole
|
||||
prototype: Dragon
|
||||
- type: RoleBriefing
|
||||
briefing: dragon-role-briefing
|
||||
|
||||
- type: entity
|
||||
parent: BaseGameRule
|
||||
|
|
|
|||
|
|
@ -17,18 +17,6 @@
|
|||
- type: NinjaRule
|
||||
threats: NinjaThreats
|
||||
|
||||
# stores configuration for dragon
|
||||
- type: entity
|
||||
noSpawn: true
|
||||
parent: BaseGameRule
|
||||
id: Dragon
|
||||
components:
|
||||
- type: GenericAntagRule
|
||||
agentName: dragon-round-end-agent-name
|
||||
objectives:
|
||||
- CarpRiftsObjective
|
||||
- DragonSurviveObjective
|
||||
|
||||
- type: entity
|
||||
noSpawn: true
|
||||
parent: BaseGameRule
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
- type: antag
|
||||
id: Dragon
|
||||
name: roles-antag-dragon-name
|
||||
antagonist: true
|
||||
objective: roles-antag-dragon-objective
|
||||
Loading…
Reference in New Issue