Fix smoking visuals, but properly this time. (#6051)

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
Leon Friedrich
2022-01-14 03:09:46 +13:00
committed by GitHub
parent eb4c8da449
commit 8179a50bdb
4 changed files with 48 additions and 1 deletions

View File

@@ -121,7 +121,7 @@ namespace Content.Shared.Item
private void OnEquippedPrefixChange()
{
if (Owner.TryGetContainer(out var container))
EntitySystem.Get<SharedHandsSystem>().UpdateHandVisuals(container.Owner);
_entMan.EventBus.RaiseLocalEvent(container.Owner, new ItemPrefixChangeEvent(Owner, container.ID));
}
public void RemovedFromSlot()
@@ -154,6 +154,23 @@ namespace Content.Shared.Item
}
}
/// <summary>
/// Raised when an item's EquippedPrefix is changed. The event is directed at the entity that contains this item, so
/// that it can properly update its sprite/GUI.
/// </summary>
[Serializable, NetSerializable]
public class ItemPrefixChangeEvent : EntityEventArgs
{
public readonly EntityUid Item;
public readonly string ContainerId;
public ItemPrefixChangeEvent(EntityUid item, string containerId)
{
Item = item;
ContainerId = containerId;
}
}
/// <summary>
/// Reference sizes for common containers and items.
/// </summary>