Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Station Only Glimmer Mites #976

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 35 additions & 4 deletions Content.Server/DeltaV/StationEvents/Events/GlimmerMobSpawnRule.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Linq;
using Content.Server.GameTicking.Components;
using Robust.Shared.Random;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.GameTicking;
using Content.Server.NPC.Components;
using Content.Server.Psionics.Glimmer;
using Content.Server.StationEvents.Components;
Expand All @@ -14,15 +14,44 @@ public sealed class GlimmerMobRule : StationEventSystem<GlimmerMobRuleComponent>
{
[Dependency] private readonly IRobustRandom _robustRandom = default!;
[Dependency] private readonly GlimmerSystem _glimmerSystem = default!;
[Dependency] private readonly GameTicker _gameTicker = default!;


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

var glimmerSources = EntityQuery<GlimmerSourceComponent, TransformComponent>().ToList();
var normalSpawnLocations = EntityQuery<VentCritterSpawnLocationComponent, TransformComponent>().ToList();
var hiddenSpawnLocations = EntityQuery<MidRoundAntagSpawnLocationComponent, TransformComponent>().ToList();
var station = _gameTicker.GetSpawnableStations();
if (station is null)
return;

var glimmerSources = new List<(GlimmerSourceComponent, TransformComponent)>();
foreach (var source in EntityQuery<GlimmerSourceComponent, TransformComponent>().ToList())
{
if (source.Item2.GridUid != Transform(station[0]).GridUid)
Copy link
Contributor

@Mnemotechnician Mnemotechnician Sep 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (source.Item2.GridUid != Transform(station[0]).GridUid)
if (station.All(it => Transform(it).GridUid != source.Item2.GridUid))

continue;

glimmerSources.Add(source);
}


var normalSpawnLocations = new List<(VentCritterSpawnLocationComponent, TransformComponent)>();
foreach (var source in EntityQuery<VentCritterSpawnLocationComponent, TransformComponent>().ToList())
{
if (source.Item2.GridUid != Transform(station[0]).GridUid)
Copy link
Contributor

@Mnemotechnician Mnemotechnician Sep 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (source.Item2.GridUid != Transform(station[0]).GridUid)
if (station.All(it => Transform(it).GridUid != source.Item2.GridUid))

continue;

normalSpawnLocations.Add(source);
}

var hiddenSpawnLocations = new List<(MidRoundAntagSpawnLocationComponent, TransformComponent)>();
foreach (var source in EntityQuery<MidRoundAntagSpawnLocationComponent, TransformComponent>().ToList())
{
if (source.Item2.GridUid != Transform(station[0]).GridUid)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... see above

continue;

hiddenSpawnLocations.Add(source);
}

var baseCount = Math.Max(1, EntityQuery<PsionicComponent, NpcFactionMemberComponent>().Count() / 10);
int multiplier = Math.Max(1, (int) _glimmerSystem.GetGlimmerTier() - 2);
Expand Down Expand Up @@ -52,6 +81,8 @@ protected override void Started(EntityUid uid, GlimmerMobRuleComponent component
i++;
continue;
}

return;
}
}
}
Loading