Fix greytide virus hitting other maps (#33806)
fix greytide virus hitting other maps
This commit is contained in:
@@ -6,6 +6,7 @@ using Content.Shared.Doors.Components;
|
|||||||
using Content.Shared.Doors.Systems;
|
using Content.Shared.Doors.Systems;
|
||||||
using Content.Shared.Lock;
|
using Content.Shared.Lock;
|
||||||
using Content.Shared.GameTicking.Components;
|
using Content.Shared.GameTicking.Components;
|
||||||
|
using Content.Shared.Station.Components;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
@@ -43,6 +44,9 @@ public sealed class GreytideVirusRule : StationEventSystem<GreytideVirusRuleComp
|
|||||||
if (virusComp.Severity == null)
|
if (virusComp.Severity == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!TryGetRandomStation(out var chosenStation))
|
||||||
|
return;
|
||||||
|
|
||||||
// pick random access groups
|
// pick random access groups
|
||||||
var chosen = _random.GetItems(virusComp.AccessGroups, virusComp.Severity.Value, allowDuplicates: false);
|
var chosen = _random.GetItems(virusComp.AccessGroups, virusComp.Severity.Value, allowDuplicates: false);
|
||||||
|
|
||||||
@@ -57,12 +61,16 @@ public sealed class GreytideVirusRule : StationEventSystem<GreytideVirusRuleComp
|
|||||||
var firelockQuery = GetEntityQuery<FirelockComponent>();
|
var firelockQuery = GetEntityQuery<FirelockComponent>();
|
||||||
var accessQuery = GetEntityQuery<AccessReaderComponent>();
|
var accessQuery = GetEntityQuery<AccessReaderComponent>();
|
||||||
|
|
||||||
var lockQuery = AllEntityQuery<LockComponent>();
|
var lockQuery = AllEntityQuery<LockComponent, TransformComponent>();
|
||||||
while (lockQuery.MoveNext(out var lockUid, out var lockComp))
|
while (lockQuery.MoveNext(out var lockUid, out var lockComp, out var xform))
|
||||||
{
|
{
|
||||||
if (!accessQuery.TryComp(lockUid, out var accessComp))
|
if (!accessQuery.TryComp(lockUid, out var accessComp))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// make sure not to hit CentCom or other maps
|
||||||
|
if (CompOrNull<StationMemberComponent>(xform.GridUid)?.Station != chosenStation)
|
||||||
|
continue;
|
||||||
|
|
||||||
// check access
|
// check access
|
||||||
// the AreAccessTagsAllowed function is a little weird because it technically has support for certain tags to be locked out of opening something
|
// 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)
|
// which might have unintened side effects (see the comments in the function itself)
|
||||||
@@ -74,13 +82,17 @@ public sealed class GreytideVirusRule : StationEventSystem<GreytideVirusRuleComp
|
|||||||
_lock.Unlock(lockUid, null, lockComp);
|
_lock.Unlock(lockUid, null, lockComp);
|
||||||
}
|
}
|
||||||
|
|
||||||
var airlockQuery = AllEntityQuery<AirlockComponent, DoorComponent>();
|
var airlockQuery = AllEntityQuery<AirlockComponent, DoorComponent, TransformComponent>();
|
||||||
while (airlockQuery.MoveNext(out var airlockUid, out var airlockComp, out var doorComp))
|
while (airlockQuery.MoveNext(out var airlockUid, out var airlockComp, out var doorComp, out var xform))
|
||||||
{
|
{
|
||||||
// don't space everything
|
// don't space everything
|
||||||
if (firelockQuery.HasComp(airlockUid))
|
if (firelockQuery.HasComp(airlockUid))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// make sure not to hit CentCom or other maps
|
||||||
|
if (CompOrNull<StationMemberComponent>(xform.GridUid)?.Station != chosenStation)
|
||||||
|
continue;
|
||||||
|
|
||||||
// use the access reader from the door electronics if they exist
|
// use the access reader from the door electronics if they exist
|
||||||
if (!_access.GetMainAccessReader(airlockUid, out var accessComp))
|
if (!_access.GetMainAccessReader(airlockUid, out var accessComp))
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user