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

@@ -33,7 +33,7 @@ namespace Content.Shared.Pulling
private void OnGetState(EntityUid uid, SharedPullableComponent component, ref ComponentGetState args)
{
args.State = new PullableComponentState(component.Puller);
args.State = new PullableComponentState(GetNetEntity(component.Puller));
}
private void OnHandleState(EntityUid uid, SharedPullableComponent component, ref ComponentHandleState args)
@@ -41,21 +41,23 @@ namespace Content.Shared.Pulling
if (args.Current is not PullableComponentState state)
return;
if (!state.Puller.HasValue)
var puller = EnsureEntity<SharedPullableComponent>(state.Puller, uid);
if (!puller.HasValue)
{
ForceDisconnectPullable(component);
return;
}
if (component.Puller == state.Puller)
if (component.Puller == puller)
{
// don't disconnect and reconnect a puller for no reason
return;
}
if (!TryComp<SharedPullerComponent?>(state.Puller.Value, out var comp))
if (!TryComp<SharedPullerComponent>(puller, out var comp))
{
Log.Error($"Pullable state for entity {ToPrettyString(uid)} had invalid puller entity {ToPrettyString(state.Puller.Value)}");
Log.Error($"Pullable state for entity {ToPrettyString(uid)} had invalid puller entity {ToPrettyString(puller.Value)}");
// ensure it disconnects from any different puller, still
ForceDisconnectPullable(component);
return;