dragon minor refactor and stuff (#18149)
Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -27,43 +27,25 @@ public sealed partial class DragonSystem
|
|||||||
return finished;
|
return finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Started(EntityUid uid, DragonRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
|
|
||||||
{
|
|
||||||
base.Started(uid, component, gameRule, args);
|
|
||||||
|
|
||||||
var eligible = EntityQuery<StationEventEligibleComponent>().Select(x => x.Owner).ToList();
|
|
||||||
|
|
||||||
if (!eligible.Any())
|
|
||||||
return;
|
|
||||||
|
|
||||||
var station = _random.Pick(eligible);
|
|
||||||
|
|
||||||
if (_station.GetLargestGrid(EntityManager.GetComponent<StationDataComponent>(station)) is not { } grid)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Spawn("MobDragon", Transform(grid).MapPosition);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnRiftRoundEnd(RoundEndTextAppendEvent args)
|
private void OnRiftRoundEnd(RoundEndTextAppendEvent args)
|
||||||
{
|
{
|
||||||
var dragons = EntityQuery<DragonComponent>(true).ToList();
|
if (EntityQuery<DragonComponent>().Count() == 0)
|
||||||
|
|
||||||
if (dragons.Count == 0)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
args.AddLine(Loc.GetString("dragon-round-end-summary"));
|
args.AddLine(Loc.GetString("dragon-round-end-summary"));
|
||||||
|
|
||||||
foreach (var dragon in EntityQuery<DragonComponent>(true))
|
var query = EntityQueryEnumerator<DragonComponent>();
|
||||||
|
while (query.MoveNext(out var uid, out var dragon))
|
||||||
{
|
{
|
||||||
var met = RiftsMet(dragon);
|
var met = RiftsMet(dragon);
|
||||||
|
|
||||||
if (TryComp<ActorComponent>(dragon.Owner, out var actor))
|
if (TryComp<ActorComponent>(uid, out var actor))
|
||||||
{
|
{
|
||||||
args.AddLine(Loc.GetString("dragon-round-end-dragon-player", ("name", dragon.Owner), ("count", met), ("player", actor.PlayerSession)));
|
args.AddLine(Loc.GetString("dragon-round-end-dragon-player", ("name", uid), ("count", met), ("player", actor.PlayerSession)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
args.AddLine(Loc.GetString("dragon-round-end-dragon", ("name", dragon.Owner), ("count", met)));
|
args.AddLine(Loc.GetString("dragon-round-end-dragon", ("name", uid), ("count", met)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +1,32 @@
|
|||||||
using System.Numerics;
|
|
||||||
using Content.Server.Body.Systems;
|
using Content.Server.Body.Systems;
|
||||||
using Content.Server.Popups;
|
|
||||||
using Content.Shared.Actions;
|
|
||||||
using Content.Shared.Chemistry.Components;
|
|
||||||
using Robust.Shared.Containers;
|
|
||||||
using Robust.Shared.Player;
|
|
||||||
using Content.Server.Chat.Systems;
|
using Content.Server.Chat.Systems;
|
||||||
using Content.Server.GameTicking;
|
using Content.Server.GameTicking;
|
||||||
using Content.Server.GameTicking.Rules;
|
|
||||||
using Content.Server.NPC;
|
using Content.Server.NPC;
|
||||||
|
using Content.Server.NPC.Systems;
|
||||||
|
using Content.Server.Popups;
|
||||||
|
using Content.Server.Station.Systems;
|
||||||
|
using Content.Shared.Actions;
|
||||||
|
using Content.Shared.Chemistry.Components;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
|
using Content.Shared.DoAfter;
|
||||||
using Content.Shared.Dragon;
|
using Content.Shared.Dragon;
|
||||||
using Content.Shared.Examine;
|
using Content.Shared.Examine;
|
||||||
|
using Content.Shared.Humanoid;
|
||||||
using Content.Shared.Maps;
|
using Content.Shared.Maps;
|
||||||
|
using Content.Shared.Mobs;
|
||||||
|
using Content.Shared.Mobs.Components;
|
||||||
using Content.Shared.Movement.Systems;
|
using Content.Shared.Movement.Systems;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Content.Server.NPC.Systems;
|
using System.Numerics;
|
||||||
using Content.Server.Station.Systems;
|
|
||||||
using Content.Shared.DoAfter;
|
|
||||||
using Content.Shared.Humanoid;
|
|
||||||
using Content.Shared.Mobs;
|
|
||||||
using Content.Shared.Mobs.Components;
|
|
||||||
|
|
||||||
namespace Content.Server.Dragon
|
namespace Content.Server.Dragon;
|
||||||
|
|
||||||
|
public sealed partial class DragonSystem : EntitySystem
|
||||||
{
|
{
|
||||||
public sealed partial class DragonSystem : GameRuleSystem<DragonRuleComponent>
|
|
||||||
{
|
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
[Dependency] private readonly ITileDefinitionManager _tileDef = default!;
|
[Dependency] private readonly ITileDefinitionManager _tileDef = default!;
|
||||||
@@ -39,7 +38,6 @@ namespace Content.Server.Dragon
|
|||||||
[Dependency] private readonly MovementSpeedModifierSystem _movement = default!;
|
[Dependency] private readonly MovementSpeedModifierSystem _movement = default!;
|
||||||
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
||||||
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
|
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
|
||||||
[Dependency] private readonly StationSystem _station = default!;
|
|
||||||
[Dependency] private readonly NPCSystem _npc = default!;
|
[Dependency] private readonly NPCSystem _npc = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -300,5 +298,5 @@ namespace Content.Server.Dragon
|
|||||||
|
|
||||||
Roar(component);
|
Roar(component);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using Content.Server.StationEvents.Events;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||||
|
|
||||||
|
namespace Content.Server.StationEvents.Components;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Spawns a single entity at a random tile on a station using TryGetRandomTile.
|
||||||
|
/// </summary>
|
||||||
|
[RegisterComponent, Access(typeof(RandomSpawnRule))]
|
||||||
|
public sealed class RandomSpawnRuleComponent : Component
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The entity to be spawned.
|
||||||
|
/// </summary>
|
||||||
|
[DataField("prototype", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||||
|
public string Prototype = string.Empty;
|
||||||
|
}
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
using Content.Server.StationEvents.Events;
|
|
||||||
|
|
||||||
namespace Content.Server.StationEvents.Components;
|
|
||||||
|
|
||||||
[RegisterComponent, Access(typeof(RevenantSpawnRule))]
|
|
||||||
public sealed class RevenantSpawnRuleComponent : Component
|
|
||||||
{
|
|
||||||
[DataField("revenantPrototype")]
|
|
||||||
public string RevenantPrototype = "MobRevenant";
|
|
||||||
}
|
|
||||||
18
Content.Server/StationEvents/Events/RandomSpawnRule.cs
Normal file
18
Content.Server/StationEvents/Events/RandomSpawnRule.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using Content.Server.GameTicking.Rules.Components;
|
||||||
|
using Content.Server.StationEvents.Components;
|
||||||
|
|
||||||
|
namespace Content.Server.StationEvents.Events;
|
||||||
|
|
||||||
|
public sealed class RandomSpawnRule : StationEventSystem<RandomSpawnRuleComponent>
|
||||||
|
{
|
||||||
|
protected override void Started(EntityUid uid, RandomSpawnRuleComponent comp, GameRuleComponent gameRule, GameRuleStartedEvent args)
|
||||||
|
{
|
||||||
|
base.Started(uid, comp, gameRule, args);
|
||||||
|
|
||||||
|
if (TryFindRandomTile(out _, out _, out _, out var coords))
|
||||||
|
{
|
||||||
|
Sawmill.Info($"Spawning {comp.Prototype} at {coords}");
|
||||||
|
Spawn(comp.Prototype, coords);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
using Content.Server.GameTicking.Rules.Components;
|
|
||||||
using Content.Server.StationEvents.Components;
|
|
||||||
|
|
||||||
namespace Content.Server.StationEvents.Events;
|
|
||||||
|
|
||||||
public sealed class RevenantSpawnRule : StationEventSystem<RevenantSpawnRuleComponent>
|
|
||||||
{
|
|
||||||
protected override void Started(EntityUid uid, RevenantSpawnRuleComponent component, GameRuleComponent gameRule,
|
|
||||||
GameRuleStartedEvent args)
|
|
||||||
{
|
|
||||||
base.Started(uid, component, gameRule, args);
|
|
||||||
|
|
||||||
if (TryFindRandomTile(out _, out _, out _, out var coords))
|
|
||||||
{
|
|
||||||
Sawmill.Info($"Spawning revenant at {coords}");
|
|
||||||
Spawn(component.RevenantPrototype, coords);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -93,3 +93,22 @@
|
|||||||
- state: green
|
- state: green
|
||||||
- sprite: Structures/Wallmounts/signs.rsi
|
- sprite: Structures/Wallmounts/signs.rsi
|
||||||
state: radiation
|
state: radiation
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
parent: MarkerBase
|
||||||
|
id: SpawnPointGhostDragon
|
||||||
|
noSpawn: true
|
||||||
|
name: ghost role spawn point
|
||||||
|
suffix: dragon
|
||||||
|
components:
|
||||||
|
- type: GhostRole
|
||||||
|
name: ghost-role-information-space-dragon-name
|
||||||
|
description: ghost-role-information-space-dragon-description
|
||||||
|
rules: ghost-role-component-default-rules
|
||||||
|
- type: GhostRoleMobSpawner
|
||||||
|
prototype: MobDragon
|
||||||
|
- type: Sprite
|
||||||
|
layers:
|
||||||
|
- state: green
|
||||||
|
- sprite: Mobs/Aliens/Carps/dragon.rsi
|
||||||
|
state: alive
|
||||||
|
|||||||
@@ -56,8 +56,8 @@
|
|||||||
- type: BureaucraticErrorRule
|
- type: BureaucraticErrorRule
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: Dragon
|
|
||||||
parent: BaseGameRule
|
parent: BaseGameRule
|
||||||
|
id: Dragon
|
||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: StationEvent
|
- type: StationEvent
|
||||||
@@ -65,11 +65,12 @@
|
|||||||
duration: 1
|
duration: 1
|
||||||
earliestStart: 45
|
earliestStart: 45
|
||||||
minimumPlayers: 20
|
minimumPlayers: 20
|
||||||
- type: DragonRule
|
- type: RandomSpawnRule
|
||||||
|
prototype: SpawnPointGhostDragon
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: RevenantSpawn
|
|
||||||
parent: BaseGameRule
|
parent: BaseGameRule
|
||||||
|
id: RevenantSpawn
|
||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: StationEvent
|
- type: StationEvent
|
||||||
@@ -77,7 +78,8 @@
|
|||||||
duration: 1
|
duration: 1
|
||||||
earliestStart: 45
|
earliestStart: 45
|
||||||
minimumPlayers: 20
|
minimumPlayers: 20
|
||||||
- type: RevenantSpawnRule
|
- type: RandomSpawnRule
|
||||||
|
prototype: MobRevenant
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: FalseAlarm
|
id: FalseAlarm
|
||||||
|
|||||||
Reference in New Issue
Block a user