From c28f4fdc7f4c48dae532d91cd4d03e6cd765894a Mon Sep 17 00:00:00 2001 From: slarticodefast <161409025+slarticodefast@users.noreply.github.com> Date: Wed, 11 Dec 2024 15:30:29 +0100 Subject: [PATCH] Fix greytide virus hitting other maps (#33806) fix greytide virus hitting other maps --- .../StationEvents/Events/GreytideVirusRule.cs | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Content.Server/StationEvents/Events/GreytideVirusRule.cs b/Content.Server/StationEvents/Events/GreytideVirusRule.cs index f60d80ba9c576d..19d4438347255f 100644 --- a/Content.Server/StationEvents/Events/GreytideVirusRule.cs +++ b/Content.Server/StationEvents/Events/GreytideVirusRule.cs @@ -6,6 +6,7 @@ using Content.Shared.Doors.Systems; using Content.Shared.Lock; using Content.Shared.GameTicking.Components; +using Content.Shared.Station.Components; using Robust.Shared.Prototypes; using Robust.Shared.Random; @@ -43,6 +44,9 @@ protected override void Started(EntityUid uid, GreytideVirusRuleComponent virusC if (virusComp.Severity == null) return; + if (!TryGetRandomStation(out var chosenStation)) + return; + // pick random access groups var chosen = _random.GetItems(virusComp.AccessGroups, virusComp.Severity.Value, allowDuplicates: false); @@ -57,12 +61,16 @@ protected override void Started(EntityUid uid, GreytideVirusRuleComponent virusC var firelockQuery = GetEntityQuery(); var accessQuery = GetEntityQuery(); - var lockQuery = AllEntityQuery(); - while (lockQuery.MoveNext(out var lockUid, out var lockComp)) + var lockQuery = AllEntityQuery(); + while (lockQuery.MoveNext(out var lockUid, out var lockComp, out var xform)) { if (!accessQuery.TryComp(lockUid, out var accessComp)) continue; + // make sure not to hit CentCom or other maps + if (CompOrNull(xform.GridUid)?.Station != chosenStation) + continue; + // check access // the AreAccessTagsAllowed function is a little weird because it technically has support for certain tags to be locked out of opening something // which might have unintened side effects (see the comments in the function itself) @@ -74,13 +82,17 @@ protected override void Started(EntityUid uid, GreytideVirusRuleComponent virusC _lock.Unlock(lockUid, null, lockComp); } - var airlockQuery = AllEntityQuery(); - while (airlockQuery.MoveNext(out var airlockUid, out var airlockComp, out var doorComp)) + var airlockQuery = AllEntityQuery(); + while (airlockQuery.MoveNext(out var airlockUid, out var airlockComp, out var doorComp, out var xform)) { // don't space everything if (firelockQuery.HasComp(airlockUid)) continue; + // make sure not to hit CentCom or other maps + if (CompOrNull(xform.GridUid)?.Station != chosenStation) + continue; + // use the access reader from the door electronics if they exist if (!_access.GetMainAccessReader(airlockUid, out var accessComp)) continue;