Inline UID
This commit is contained in:
@@ -36,7 +36,7 @@ namespace Content.Server.DeviceNetwork.Systems
|
||||
|
||||
private void OnProviderConnected(EntityUid uid, ApcNetworkComponent component, ExtensionCableSystem.ProviderConnectedEvent args)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.Provider.Owner.Uid, out NodeContainerComponent? nodeContainer)) return;
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.Provider.Owner, out NodeContainerComponent? nodeContainer)) return;
|
||||
|
||||
if (nodeContainer.TryGetNode("power", out CableNode? node))
|
||||
{
|
||||
|
||||
@@ -211,12 +211,12 @@ namespace Content.Server.DeviceNetwork.Systems
|
||||
{
|
||||
foreach (var connection in connections)
|
||||
{
|
||||
var beforeEvent = new BeforePacketSentEvent(packet.Sender.Owner.Uid);
|
||||
RaiseLocalEvent(connection.Owner.Uid, beforeEvent, false);
|
||||
var beforeEvent = new BeforePacketSentEvent(packet.Sender.Owner);
|
||||
RaiseLocalEvent(connection.Owner, beforeEvent, false);
|
||||
|
||||
if (!beforeEvent.Cancelled)
|
||||
{
|
||||
RaiseLocalEvent(connection.Owner.Uid, new PacketSentEvent(connection.Frequency, packet.Sender.Address, packet.Data, packet.Broadcast) , false);
|
||||
RaiseLocalEvent(connection.Owner, new PacketSentEvent(connection.Frequency, packet.Sender.Address, packet.Data, packet.Broadcast) , false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Content.Server.DeviceNetwork.Systems
|
||||
IEntity sender = EntityManager.GetEntity(args.Sender);
|
||||
IEntity receiver = EntityManager.GetEntity(uid);
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(receiver.Uid).GridID != IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(sender.Uid).GridID)
|
||||
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(receiver).GridID != IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(sender).GridID)
|
||||
{
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
@@ -21,11 +21,11 @@ namespace Content.Server.DeviceNetwork.Systems
|
||||
{
|
||||
var sender = EntityManager.GetEntity(args.Sender);
|
||||
|
||||
var ownPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(component.Owner.Uid).WorldPosition;
|
||||
var position = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(sender.Uid).WorldPosition;
|
||||
var ownPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(component.Owner).WorldPosition;
|
||||
var position = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(sender).WorldPosition;
|
||||
var distance = (ownPosition - position).Length;
|
||||
|
||||
if(IoCManager.Resolve<IEntityManager>().TryGetComponent<WirelessNetworkComponent?>(sender.Uid, out var sendingComponent) && distance > sendingComponent.Range)
|
||||
if(IoCManager.Resolve<IEntityManager>().TryGetComponent<WirelessNetworkComponent?>(sender, out var sendingComponent) && distance > sendingComponent.Range)
|
||||
{
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user