using Content.Shared.DeviceNetwork.Components;
using Content.Shared.Examine;
using JetBrains.Annotations;
namespace Content.Shared.DeviceNetwork.Systems;
///
/// Entity system that handles everything device network related.
/// Device networking allows machines and devices to communicate with each other
/// while adhering to restrictions like range or being connected to the same power network.
///
public abstract partial class SharedDeviceNetworkSystem : EntitySystem
{
[SubscribeLocalEvent]
private void OnExamine(Entity ent, ref ExaminedEvent args)
{
if (ent.Comp.ExaminableAddress)
args.PushText(Loc.GetString("device-address-examine-message", ("address", ent.Comp.Address)));
}
///
/// Sends the given as a device network packet to the entity with the given address and frequency.
/// Addresses are given to the of an entity when connecting.
///
/// The sending entity.
///
/// The address of the entity that the packet gets sent to.
/// If null, the message is broadcast to all devices on that frequency (except the sender)
///
/// The frequency to send on.
/// The data to be sent.
/// The network to send on.
/// Returns true when the packet was successfully enqueued.
[PublicAPI]
public virtual bool SendPacket(
Entity ent,
string? address,
ref T data,
uint? frequency = null,
int? network = null)
where T : INetworkPayload
{
return false;
}
}