Content update for NetEntities (#18935)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user