Xenoborg jammer now ignores xenoborg associated frequencies (#38005)

* stop jammer from jamming radio of certain frequency

* xenoborg jammer no longer jamms xenoborg radio

* stop jammer from jamming device network signals from certain frequency

* xenoborg jammer no longer jamms xenoborg camera signal

* the old tale of the missing ;

* backwards

* fix issue with readonly

* comments to the frequencies excluded

* triple typo

* clearer summary

* add summary

* fixed 4th hidden typo
This commit is contained in:
Samuka-C
2025-09-24 19:02:46 -03:00
committed by GitHub
parent 4555b72608
commit ea3c44686c
9 changed files with 77 additions and 6 deletions

View File

@@ -72,6 +72,15 @@ public sealed class JammerSystem : SharedJammerSystem
EnsureComp<DeviceNetworkJammerComponent>(ent, out var jammingComp);
_jammer.SetRange((ent, jammingComp), GetCurrentRange(ent));
_jammer.AddJammableNetwork((ent, jammingComp), DeviceNetworkComponent.DeviceNetIdDefaults.Wireless.ToString());
// Add excluded frequencies using the system method
if (ent.Comp.FrequenciesExcluded != null)
{
foreach (var freq in ent.Comp.FrequenciesExcluded)
{
_jammer.AddExcludedFrequency((ent, jammingComp), (uint)freq);
}
}
}
else
{
@@ -96,19 +105,23 @@ public sealed class JammerSystem : SharedJammerSystem
private void OnRadioSendAttempt(ref RadioSendAttemptEvent args)
{
if (ShouldCancelSend(args.RadioSource))
if (ShouldCancelSend(args.RadioSource, args.Channel.Frequency))
{
args.Cancelled = true;
}
}
private bool ShouldCancelSend(EntityUid sourceUid)
private bool ShouldCancelSend(EntityUid sourceUid, int frequency)
{
var source = Transform(sourceUid).Coordinates;
var query = EntityQueryEnumerator<ActiveRadioJammerComponent, RadioJammerComponent, TransformComponent>();
while (query.MoveNext(out var uid, out _, out var jam, out var transform))
{
// Check if this jammer excludes the frequency
if (jam.FrequenciesExcluded != null && jam.FrequenciesExcluded.Contains(frequency))
continue;
if (_transform.InRange(source, transform.Coordinates, GetCurrentRange((uid, jam))))
{
return true;