air alarm signal ports and other stuff (#18642)
Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -66,7 +66,7 @@ namespace Content.Server.DeviceNetwork.Systems
|
||||
/// <param name="frequency">The frequency to send on</param>
|
||||
/// <param name="data">The data to be sent</param>
|
||||
/// <returns>Returns true when the packet was successfully enqueued.</returns>
|
||||
public bool QueuePacket(EntityUid uid, string? address, NetworkPayload data, uint? frequency = null, DeviceNetworkComponent? device = null)
|
||||
public bool QueuePacket(EntityUid uid, string? address, NetworkPayload data, uint? frequency = null, int? network = null, DeviceNetworkComponent? device = null)
|
||||
{
|
||||
if (!Resolve(uid, ref device, false))
|
||||
return false;
|
||||
@@ -79,7 +79,9 @@ namespace Content.Server.DeviceNetwork.Systems
|
||||
if (frequency == null)
|
||||
return false;
|
||||
|
||||
_nextQueue.Enqueue(new DeviceNetworkPacketEvent(device.DeviceNetId, address, frequency.Value, device.Address, uid, data));
|
||||
network ??= device.DeviceNetId;
|
||||
|
||||
_nextQueue.Enqueue(new DeviceNetworkPacketEvent(network.Value, address, frequency.Value, device.Address, uid, data));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Content.Server.DeviceNetwork.Systems
|
||||
/// </summary>
|
||||
private void OnBeforePacketSent(EntityUid uid, WiredNetworkComponent component, BeforePacketSentEvent args)
|
||||
{
|
||||
if (EntityManager.GetComponent<TransformComponent>(uid).GridUid != args.SenderTransform.GridUid)
|
||||
if (Transform(uid).GridUid != args.SenderTransform.GridUid)
|
||||
{
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
@@ -20,8 +20,11 @@ namespace Content.Server.DeviceNetwork.Systems
|
||||
var ownPosition = args.SenderPosition;
|
||||
var xform = Transform(uid);
|
||||
|
||||
// not a wireless to wireless connection, just let it happen
|
||||
if (!TryComp<WirelessNetworkComponent>(args.Sender, out var sendingComponent))
|
||||
return;
|
||||
|
||||
if (xform.MapID != args.SenderTransform.MapID
|
||||
|| !TryComp<WirelessNetworkComponent>(args.Sender, out var sendingComponent)
|
||||
|| (ownPosition - xform.WorldPosition).Length() > sendingComponent.Range)
|
||||
{
|
||||
args.Cancel();
|
||||
|
||||
Reference in New Issue
Block a user