using Content.Shared.Clothing; using Content.Shared.Clothing.Components; using Content.Shared.Movement.Components; using Content.Shared.Inventory.Events; namespace Content.Shared._DV.Waddle; public sealed class WaddleClothingSystem : EntitySystem { public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnGotEquipped); SubscribeLocalEvent(OnGotUnequipped); } private void OnGotEquipped(Entity ent, ref ClothingGotEquippedEvent args) { var user = args.Wearer; // TODO: refcount if (EnsureComp(user, out var waddle)) return; ent.Comp.AddedWaddle = true; Dirty(ent); var comp = ent.Comp; if (comp.AnimationLength is {} length) waddle.AnimationLength = length; if (comp.HopIntensity is {} hopIntensity) waddle.HopIntensity = hopIntensity; if (comp.TumbleIntensity is {} tumbleIntensity) waddle.TumbleIntensity = tumbleIntensity; if (comp.RunAnimationLengthMultiplier is {} multiplier) waddle.RunAnimationLengthMultiplier = multiplier; // very unlikely that some waddle clothing doesn't change at least 1 property, don't bother doing change detection meme Dirty(user, waddle); } private void OnGotUnequipped(Entity ent, ref ClothingGotUnequippedEvent args) { if (!ent.Comp.AddedWaddle) return; // TODO: refcount RemComp(args.Wearer); ent.Comp.AddedWaddle = false; Dirty(ent); } }