Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toggle clothing fix #32826

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Content.Shared/Clothing/Components/ToggleClothingComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ public sealed partial class ToggleClothingComponent : Component
/// </summary>
[DataField]
public bool DisableOnUnequip;

/// <summary>
/// If true, the clothes must equip for adding action.
/// </summary>
[DataField]
public bool MustEquip = true;
}

/// <summary>
Expand Down
4 changes: 4 additions & 0 deletions Content.Shared/Clothing/EntitySystems/ToggleClothingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ private void OnMapInit(Entity<ToggleClothingComponent> ent, ref MapInitEvent arg

private void OnGetActions(Entity<ToggleClothingComponent> 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);
}
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Entities/Clothing/Shoes/magboots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading