Add face bandanas (#24597)
* add face bandanas * oops * make face bandanas butcherable, also one bite * oops * Add mouth IdentityBlocker to bandanas * refactor to use foldablecomponent * remove some leftover bits * remove HamsterWearable until face sprite updated * oops * review changes * remove a few unneeded bits
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Clothing.Components;
|
||||
using Content.Shared.Foldable;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Inventory.Events;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
@@ -21,11 +23,12 @@ public sealed class MaskSystem : EntitySystem
|
||||
SubscribeLocalEvent<MaskComponent, ToggleMaskEvent>(OnToggleMask);
|
||||
SubscribeLocalEvent<MaskComponent, GetItemActionsEvent>(OnGetActions);
|
||||
SubscribeLocalEvent<MaskComponent, GotUnequippedEvent>(OnGotUnequipped);
|
||||
SubscribeLocalEvent<MaskComponent, FoldedEvent>(OnFolded);
|
||||
}
|
||||
|
||||
private void OnGetActions(EntityUid uid, MaskComponent component, GetItemActionsEvent args)
|
||||
{
|
||||
if (!args.InHands)
|
||||
if (_inventorySystem.InSlotWithFlags(uid, SlotFlags.MASK))
|
||||
args.AddAction(ref component.ToggleActionEntity, component.ToggleAction);
|
||||
}
|
||||
|
||||
@@ -46,7 +49,7 @@ public sealed class MaskSystem : EntitySystem
|
||||
else
|
||||
_popupSystem.PopupEntity(Loc.GetString("action-mask-pull-up-popup-message", ("mask", uid)), args.Performer, args.Performer);
|
||||
|
||||
ToggleMaskComponents(uid, mask, args.Performer);
|
||||
ToggleMaskComponents(uid, mask, args.Performer, mask.EquippedPrefix);
|
||||
}
|
||||
|
||||
// set to untoggled when unequipped, so it isn't left in a 'pulled down' state
|
||||
@@ -59,15 +62,22 @@ public sealed class MaskSystem : EntitySystem
|
||||
Dirty(uid, mask);
|
||||
_actionSystem.SetToggled(mask.ToggleActionEntity, mask.IsToggled);
|
||||
|
||||
ToggleMaskComponents(uid, mask, args.Equipee, true);
|
||||
ToggleMaskComponents(uid, mask, args.Equipee, mask.EquippedPrefix, true);
|
||||
}
|
||||
|
||||
private void ToggleMaskComponents(EntityUid uid, MaskComponent mask, EntityUid wearer, bool isEquip = false)
|
||||
private void ToggleMaskComponents(EntityUid uid, MaskComponent mask, EntityUid wearer, string? equippedPrefix = null, bool isEquip = false)
|
||||
{
|
||||
var maskEv = new ItemMaskToggledEvent(wearer, mask.IsToggled, isEquip);
|
||||
var maskEv = new ItemMaskToggledEvent(wearer, equippedPrefix, mask.IsToggled, isEquip);
|
||||
RaiseLocalEvent(uid, ref maskEv);
|
||||
|
||||
var wearerEv = new WearerMaskToggledEvent(mask.IsToggled);
|
||||
RaiseLocalEvent(wearer, ref wearerEv);
|
||||
}
|
||||
|
||||
private void OnFolded(Entity<MaskComponent> ent, ref FoldedEvent args)
|
||||
{
|
||||
ent.Comp.IsToggled = args.IsFolded;
|
||||
|
||||
ToggleMaskComponents(ent.Owner, ent.Comp, ent.Owner);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user