From: ArZarLordOfMango <96249677+ArZarLordOfMango@users.noreply.github.com> Date: Tue, 19 Nov 2024 20:31:37 +0000 (+0100) Subject: Toggle clothing fix (#32826) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=a949cf33e92384d209886874c2727e22611aca12;p=space-station-14.git Toggle clothing fix (#32826) * toggle clothing fix * some adding --- diff --git a/Content.Shared/Clothing/Components/ToggleClothingComponent.cs b/Content.Shared/Clothing/Components/ToggleClothingComponent.cs index 04bc3ed4e8..f827cbfea8 100644 --- a/Content.Shared/Clothing/Components/ToggleClothingComponent.cs +++ b/Content.Shared/Clothing/Components/ToggleClothingComponent.cs @@ -33,6 +33,12 @@ public sealed partial class ToggleClothingComponent : Component /// [DataField] public bool DisableOnUnequip; + + /// + /// If true, the clothes must equip for adding action. + /// + [DataField] + public bool MustEquip = true; } /// diff --git a/Content.Shared/Clothing/EntitySystems/ToggleClothingSystem.cs b/Content.Shared/Clothing/EntitySystems/ToggleClothingSystem.cs index 9889376c9d..8d6e3e3de6 100644 --- a/Content.Shared/Clothing/EntitySystems/ToggleClothingSystem.cs +++ b/Content.Shared/Clothing/EntitySystems/ToggleClothingSystem.cs @@ -39,8 +39,12 @@ public sealed class ToggleClothingSystem : EntitySystem private void OnGetActions(Entity ent, ref GetItemActionsEvent args) { + if (args.InHands && ent.Comp.MustEquip) + return; + var ev = new ToggleClothingCheckEvent(args.User); RaiseLocalEvent(ent, ref ev); + if (!ev.Cancelled) args.AddAction(ent.Comp.ActionEntity); } diff --git a/Resources/Prototypes/Entities/Clothing/Hands/gloves.yml b/Resources/Prototypes/Entities/Clothing/Hands/gloves.yml index 16777cd690..1dd1e0ba04 100644 --- a/Resources/Prototypes/Entities/Clothing/Hands/gloves.yml +++ b/Resources/Prototypes/Entities/Clothing/Hands/gloves.yml @@ -230,6 +230,7 @@ stealthy: true - type: ToggleClothing action: ActionToggleNinjaGloves + disableOnUnequip: true - type: NinjaGloves abilities: - components: diff --git a/Resources/Prototypes/Entities/Clothing/Head/helmets.yml b/Resources/Prototypes/Entities/Clothing/Head/helmets.yml index 11643c076d..f06f20249b 100644 --- a/Resources/Prototypes/Entities/Clothing/Head/helmets.yml +++ b/Resources/Prototypes/Entities/Clothing/Head/helmets.yml @@ -452,6 +452,7 @@ delay: 1.0 - type: ToggleClothing action: ActionToggleJusticeHelm + mustEquip: false - type: ItemTogglePointLight - type: ToggleableLightVisuals clothingVisuals: diff --git a/Resources/Prototypes/Entities/Clothing/OuterClothing/suits.yml b/Resources/Prototypes/Entities/Clothing/OuterClothing/suits.yml index a58c2a3fdd..f78694a0fa 100644 --- a/Resources/Prototypes/Entities/Clothing/OuterClothing/suits.yml +++ b/Resources/Prototypes/Entities/Clothing/OuterClothing/suits.yml @@ -155,6 +155,7 @@ # phase cloak - type: ToggleClothing action: ActionTogglePhaseCloak + disableOnUnequip: true - type: ComponentToggler parent: true components: diff --git a/Resources/Prototypes/Entities/Clothing/Shoes/magboots.yml b/Resources/Prototypes/Entities/Clothing/Shoes/magboots.yml index 0250671acf..ab8084c91c 100644 --- a/Resources/Prototypes/Entities/Clothing/Shoes/magboots.yml +++ b/Resources/Prototypes/Entities/Clothing/Shoes/magboots.yml @@ -14,6 +14,7 @@ sprite: Clothing/Shoes/Boots/magboots.rsi - type: ToggleClothing action: ActionToggleMagboots + mustEquip: false - type: ToggleVerb text: toggle-magboots-verb-get-data-text - type: ComponentToggler