Content update for NetEntities (#18935)

This commit is contained in:
metalgearsloth
2023-09-11 09:42:41 +10:00
committed by GitHub
parent 389c8d1a2c
commit 5a0fc68be2
526 changed files with 3058 additions and 2215 deletions

View File

@@ -66,18 +66,18 @@ public sealed class GatewaySystem : EntitySystem
private void UpdateUserInterface(EntityUid uid, GatewayComponent comp)
{
var destinations = new List<(EntityUid, String, TimeSpan, bool)>();
var destinations = new List<(NetEntity, String, TimeSpan, bool)>();
foreach (var destUid in comp.Destinations)
{
var dest = Comp<GatewayDestinationComponent>(destUid);
if (!dest.Enabled)
continue;
destinations.Add((destUid, dest.Name, dest.NextReady, HasComp<PortalComponent>(destUid)));
destinations.Add((GetNetEntity(destUid), dest.Name, dest.NextReady, HasComp<PortalComponent>(destUid)));
}
GetDestination(uid, out var current);
var state = new GatewayBoundUserInterfaceState(destinations, current, comp.NextClose, comp.LastOpen);
var state = new GatewayBoundUserInterfaceState(destinations, GetNetEntity(current), comp.NextClose, comp.LastOpen);
_ui.TrySetUiState(uid, GatewayUiKey.Key, state);
}
@@ -89,15 +89,17 @@ public sealed class GatewaySystem : EntitySystem
private void OnOpenPortal(EntityUid uid, GatewayComponent comp, GatewayOpenPortalMessage args)
{
// can't link if portal is already open on either side, the destination is invalid or on cooldown
var desto = GetEntity(args.Destination);
if (HasComp<PortalComponent>(uid) ||
HasComp<PortalComponent>(args.Destination) ||
!TryComp<GatewayDestinationComponent>(args.Destination, out var dest) ||
HasComp<PortalComponent>(desto) ||
!TryComp<GatewayDestinationComponent>(desto, out var dest) ||
!dest.Enabled ||
_timing.CurTime < dest.NextReady)
return;
// TODO: admin log???
OpenPortal(uid, comp, args.Destination, dest);
OpenPortal(uid, comp, desto, dest);
}
private void OpenPortal(EntityUid uid, GatewayComponent comp, EntityUid dest, GatewayDestinationComponent destComp)