mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
Fix item cabinet's visual state desyncing when toggled by a different client in view (#22759)
Fix item cabinet's visual state desyncing when opened by a different client in view
This commit is contained in:
parent
f43ff90115
commit
edceb55119
2 changed files with 7 additions and 1 deletions
|
|
@ -7,7 +7,7 @@ namespace Content.Shared.Cabinet;
|
|||
/// <summary>
|
||||
/// Used for entities that can be opened, closed, and can hold one item. E.g., fire extinguisher cabinets.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
|
||||
public sealed partial class ItemCabinetComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ public abstract class SharedItemCabinetSystem : EntitySystem
|
|||
SubscribeLocalEvent<ItemCabinetComponent, ComponentInit>(OnComponentInit);
|
||||
SubscribeLocalEvent<ItemCabinetComponent, ComponentRemove>(OnComponentRemove);
|
||||
SubscribeLocalEvent<ItemCabinetComponent, ComponentStartup>(OnComponentStartup);
|
||||
SubscribeLocalEvent<ItemCabinetComponent, AfterAutoHandleStateEvent>(OnComponentHandleState);
|
||||
|
||||
SubscribeLocalEvent<ItemCabinetComponent, ActivateInWorldEvent>(OnActivateInWorld);
|
||||
SubscribeLocalEvent<ItemCabinetComponent, GetVerbsEvent<AlternativeVerb>>(AddToggleOpenVerb);
|
||||
|
|
@ -48,6 +49,11 @@ public abstract class SharedItemCabinetSystem : EntitySystem
|
|||
_itemSlots.SetLock(uid, cabinet.CabinetSlot, !cabinet.Opened);
|
||||
}
|
||||
|
||||
private void OnComponentHandleState(Entity<ItemCabinetComponent> ent, ref AfterAutoHandleStateEvent args)
|
||||
{
|
||||
UpdateAppearance(ent, ent);
|
||||
}
|
||||
|
||||
protected virtual void UpdateAppearance(EntityUid uid, ItemCabinetComponent? cabinet = null)
|
||||
{
|
||||
// we don't fuck with appearance data, and instead just manually update the sprite on the client
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue