Fix ghost inventory not updating (#11935)
This commit is contained in:
@@ -41,6 +41,7 @@ namespace Content.Client.Inventory
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
SubscribeLocalEvent<ClientInventoryComponent, PlayerAttachedEvent>(OnPlayerAttached);
|
SubscribeLocalEvent<ClientInventoryComponent, PlayerAttachedEvent>(OnPlayerAttached);
|
||||||
|
SubscribeLocalEvent<ClientInventoryComponent, PlayerDetachedEvent>(OnPlayerDetached);
|
||||||
|
|
||||||
SubscribeLocalEvent<ClientInventoryComponent, ComponentInit>(OnInit);
|
SubscribeLocalEvent<ClientInventoryComponent, ComponentInit>(OnInit);
|
||||||
SubscribeLocalEvent<ClientInventoryComponent, ComponentShutdown>(OnShutdown);
|
SubscribeLocalEvent<ClientInventoryComponent, ComponentShutdown>(OnShutdown);
|
||||||
@@ -111,6 +112,11 @@ namespace Content.Client.Inventory
|
|||||||
OnUnlinkInventory?.Invoke();
|
OnUnlinkInventory?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnPlayerDetached(EntityUid uid, ClientInventoryComponent component, PlayerDetachedEvent args)
|
||||||
|
{
|
||||||
|
OnUnlinkInventory?.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
private void OnPlayerAttached(EntityUid uid, ClientInventoryComponent component, PlayerAttachedEvent args)
|
private void OnPlayerAttached(EntityUid uid, ClientInventoryComponent component, PlayerAttachedEvent args)
|
||||||
{
|
{
|
||||||
if (TryGetSlots(uid, out var definitions))
|
if (TryGetSlots(uid, out var definitions))
|
||||||
@@ -130,8 +136,7 @@ namespace Content.Client.Inventory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uid == _playerManager.LocalPlayer?.ControlledEntity)
|
OnLinkInventory?.Invoke(component);
|
||||||
OnLinkInventory?.Invoke(component);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Shutdown()
|
public override void Shutdown()
|
||||||
|
|||||||
Reference in New Issue
Block a user