Chameleon clothing hides identity (#12642)

This commit is contained in:
Alex Evgrashin
2022-11-24 03:02:54 +01:00
committed by GitHub
parent 186b8e00da
commit 1cae861f40
4 changed files with 43 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
using Content.Shared.Clothing.Components;
using Content.Shared.Inventory;
using Content.Shared.Inventory.Events;
using Content.Shared.Item;
using Content.Shared.Tag;
using Robust.Shared.Prototypes;
@@ -13,6 +14,23 @@ public abstract class SharedChameleonClothingSystem : EntitySystem
[Dependency] private readonly SharedItemSystem _itemSystem = default!;
[Dependency] private readonly ClothingSystem _clothingSystem = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ChameleonClothingComponent, GotEquippedEvent>(OnGotEquipped);
SubscribeLocalEvent<ChameleonClothingComponent, GotUnequippedEvent>(OnGotUnequipped);
}
private void OnGotEquipped(EntityUid uid, ChameleonClothingComponent component, GotEquippedEvent args)
{
component.User = args.Equipee;
}
private void OnGotUnequipped(EntityUid uid, ChameleonClothingComponent component, GotUnequippedEvent args)
{
component.User = null;
}
// Updates chameleon visuals and meta information.
// This function is called on a server after user selected new outfit.
// And after that on a client after state was updated.