Files
tbd-station-14/Content.Server/DeviceNetwork/Systems/WiredNetworkSystem.cs
metalgearsloth 63dfd21b14 Predict dumping (#32394)
* Predict dumping

- This got soaped really fucking hard.
- Dumping is predicted, this required disposals to be predicte.d
- Disposals required mailing (because it's tightly coupled), and a smidge of other content systems.
- I also had to fix a compnetworkgenerator issue at the same time so it wouldn't mispredict.

* Fix a bunch of stuff

* nasty merge

* Some reviews

* Some more reviews while I stash

* Fix merge

* Fix merge

* Half of review

* Review

* re(h)f

* lizards

* feexes

* feex
2025-04-19 16:20:40 +10:00

33 lines
1.1 KiB
C#

using Content.Server.DeviceNetwork.Components;
using Content.Shared.DeviceNetwork.Events;
using JetBrains.Annotations;
namespace Content.Server.DeviceNetwork.Systems
{
[UsedImplicitly]
public sealed class WiredNetworkSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<WiredNetworkComponent, BeforePacketSentEvent>(OnBeforePacketSent);
}
/// <summary>
/// Checks if both devices are on the same grid
/// </summary>
private void OnBeforePacketSent(EntityUid uid, WiredNetworkComponent component, BeforePacketSentEvent args)
{
if (Transform(uid).GridUid != args.SenderTransform.GridUid)
{
args.Cancel();
}
}
//Things to do in a future PR:
//Abstract out the connection between the apcExtensionCable and the apcPowerReceiver
//Traverse the power cables using path traversal
//Cache an optimized representation of the traversed path (Probably just cache Devices)
}
}