Create DeviceNetworkJammerComponent & System as a general way for entities to act as jammers (#26342)
* Add DeviceNetworkJammerComponent & System Allows for entities to "jam" DeviceNetwork packets. Whenever a device attempts to send a packet, the DeviceNetworkJammerSystem listens for the BeforePacketSentEvent. From there if any entity with the jammer component is within range of either the sender or receiver of the packet the event will be cancelled. Additionally jammers can only block packets in certain networks. If a packet is not being transmitted in one of the networks it can block then even if the jammer is in range the event will not be cancelled. The range is stored in the jammer component along with the networks it can jam. Jammable network ids are stored as strings which seems to be how custom networks are stored (E.g. network ids for suit sensors). To allow for all of this, the BeforePacketSentEvent was modified to provide the NetworkId. * Make JammerSystem for the radio jammer use the DeviceNetworkJammer. Remove redundant event. * Replace calls to TryDistance with InRange
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Content.Server.DeviceNetwork.Components;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Server.DeviceNetwork.Components;
|
||||
using Content.Server.Medical.CrewMonitoring;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Station.Systems;
|
||||
@@ -38,7 +39,7 @@ public sealed class SingletonDeviceNetServerSystem : EntitySystem
|
||||
/// <param name="address">The address of the active server if it exists</param>
|
||||
/// <typeparam name="TComp">The component type that determines what type of server you're getting the address of</typeparam>
|
||||
/// <returns>True if there is an active serve. False otherwise</returns>
|
||||
public bool TryGetActiveServerAddress<TComp>(EntityUid stationId, out string? address) where TComp : IComponent
|
||||
public bool TryGetActiveServerAddress<TComp>(EntityUid stationId, [NotNullWhen(true)] out string? address) where TComp : IComponent
|
||||
{
|
||||
var servers = EntityQueryEnumerator<
|
||||
SingletonDeviceNetServerComponent,
|
||||
|
||||
Reference in New Issue
Block a user