Move MaskComponent to shared and add toggle events (#22395)

* Move MaskComponent to shared and add toggle events

* Datafield and network IsToggled

* Add missing dirty
This commit is contained in:
DrSmugleaf
2023-12-12 19:02:35 -07:00
committed by GitHub
parent 16bd6802df
commit ad6dc94c60
12 changed files with 174 additions and 148 deletions

View File

@@ -25,6 +25,7 @@ public abstract class ClothingSystem : EntitySystem
SubscribeLocalEvent<ClothingComponent, ComponentHandleState>(OnHandleState);
SubscribeLocalEvent<ClothingComponent, GotEquippedEvent>(OnGotEquipped);
SubscribeLocalEvent<ClothingComponent, GotUnequippedEvent>(OnGotUnequipped);
SubscribeLocalEvent<ClothingComponent, ItemMaskToggledEvent>(OnMaskToggled);
}
protected virtual void OnGotEquipped(EntityUid uid, ClothingComponent component, GotEquippedEvent args)
@@ -52,6 +53,12 @@ public abstract class ClothingSystem : EntitySystem
SetEquippedPrefix(uid, state.EquippedPrefix, component);
}
private void OnMaskToggled(Entity<ClothingComponent> ent, ref ItemMaskToggledEvent args)
{
//TODO: sprites for 'pulled down' state. defaults to invisible due to no sprite with this prefix
SetEquippedPrefix(ent, args.IsToggled ? "toggled" : null, ent);
}
#region Public API
public void SetEquippedPrefix(EntityUid uid, string? prefix, ClothingComponent? clothing = null)