Skip to content

Commit

Permalink
Merge branch 'DeltaV-Station:master' into Byoin
Browse files Browse the repository at this point in the history
  • Loading branch information
FieldCommand authored Oct 15, 2024
2 parents 8d59dcf + 054bd8b commit 7accfbc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
21 changes: 15 additions & 6 deletions Content.Server/DeltaV/StationEvents/Events/GlimmerMobSpawnRule.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Linq;
using Content.Server.Psionics.Glimmer;
using Content.Server.Station.Systems;
using Content.Server.StationEvents;
using Content.Server.StationEvents.Components;
using Content.Server.StationEvents.Events;
Expand All @@ -15,14 +16,18 @@ namespace Content.Server.DeltaV.StationEvents.Events;
public sealed class GlimmerMobRule : StationEventSystem<GlimmerMobRuleComponent>
{
[Dependency] private readonly GlimmerSystem _glimmer = default!;
[Dependency] private readonly StationSystem _stationSystem = default!;

protected override void Started(EntityUid uid, GlimmerMobRuleComponent comp, GameRuleComponent gameRule, GameRuleStartedEvent args)
{
base.Started(uid, comp, gameRule, args);

var glimmerSources = GetCoords<GlimmerSourceComponent>();
var normalSpawns = GetCoords<VentCritterSpawnLocationComponent>();
var hiddenSpawns = GetCoords<MidRoundAntagSpawnLocationComponent>();
if (!TryGetRandomStation(out var station))
return;

var glimmerSources = GetCoords<GlimmerSourceComponent>(station.Value);
var normalSpawns = GetCoords<VentCritterSpawnLocationComponent>(station.Value);
var hiddenSpawns = GetCoords<MidRoundAntagSpawnLocationComponent>(station.Value);

var psionics = EntityQuery<PsionicComponent, NpcFactionMemberComponent>().Count();
var baseCount = Math.Max(1, psionics / comp.MobsPerPsionic);
Expand All @@ -43,15 +48,19 @@ protected override void Started(EntityUid uid, GlimmerMobRuleComponent comp, Gam
}
}

private List<EntityCoordinates> GetCoords<T>() where T : IComponent
private List<EntityCoordinates> GetCoords<T>(EntityUid station) where T : IComponent
{
var coords = new List<EntityCoordinates>();
var query = EntityQueryEnumerator<TransformComponent, T>();

while (query.MoveNext(out var xform, out _))
{
coords.Add(xform.Coordinates);
}
if (xform.GridUid == null)
continue;

if (_stationSystem.GetOwningStation(xform.GridUid.Value) == station)
coords.Add(xform.Coordinates);
}
return coords;
}

Expand Down
13 changes: 7 additions & 6 deletions Resources/Changelog/DeltaVChangelog.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
Entries:
- author: JJ
changes:
- message: Add Psionic Antag Objectives
type: Add
id: 110
time: '2023-10-28T19:06:51.0000000+00:00'
- author: DebugOk
changes:
- message: The 10 reserved whitelist slots have been removed until further notice.
Expand Down Expand Up @@ -3674,3 +3668,10 @@
id: 609
time: '2024-10-14T18:07:41.0000000+00:00'
url: https://github.com/DeltaV-Station/Delta-v/pull/1985
- author: MilonPL
changes:
- message: Glimmer mobs will no longer spawn on CentCom or the evac shuttle.
type: Fix
id: 610
time: '2024-10-14T23:43:17.0000000+00:00'
url: https://github.com/DeltaV-Station/Delta-v/pull/1980

0 comments on commit 7accfbc

Please sign in to comment.