Prevent dragons from spawning off-station (#15804)
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.GameTicking;
|
using Content.Server.GameTicking;
|
||||||
using Content.Server.GameTicking.Rules.Components;
|
using Content.Server.GameTicking.Rules.Components;
|
||||||
|
using Content.Server.Station.Components;
|
||||||
using Content.Shared.Dragon;
|
using Content.Shared.Dragon;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Map.Components;
|
using Robust.Shared.Map.Components;
|
||||||
@@ -30,13 +31,14 @@ public sealed partial class DragonSystem
|
|||||||
{
|
{
|
||||||
base.Started(uid, component, gameRule, args);
|
base.Started(uid, component, gameRule, args);
|
||||||
|
|
||||||
var spawnLocations = EntityQuery<MapGridComponent, TransformComponent>().ToList();
|
if (!_station.Stations.Any())
|
||||||
|
|
||||||
if (spawnLocations.Count == 0)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var location = _random.Pick(spawnLocations);
|
var station = _random.Pick(_station.Stations);
|
||||||
Spawn("MobDragon", location.Item2.MapPosition);
|
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)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ 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 Content.Server.NPC.Systems;
|
||||||
|
using Content.Server.Station.Systems;
|
||||||
using Content.Shared.DoAfter;
|
using Content.Shared.DoAfter;
|
||||||
using Content.Shared.Humanoid;
|
using Content.Shared.Humanoid;
|
||||||
using Content.Shared.Mobs;
|
using Content.Shared.Mobs;
|
||||||
@@ -37,6 +38,7 @@ 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>
|
||||||
|
|||||||
Reference in New Issue
Block a user