Разрешаю кушать (Фикс банданы) (#818)

This commit is contained in:
BIGZi0348
2024-12-13 21:18:04 +03:00
committed by GitHub
4 changed files with 24 additions and 3 deletions

View File

@@ -22,4 +22,18 @@ public sealed partial class MaskComponent : Component
[DataField, AutoNetworkedField]
public string EquippedPrefix = "toggled";
/// <summary>
/// WD Ahead of wizden.
/// When <see langword="true"/> will function normally, otherwise will not react to events
/// </summary>
[DataField("enabled"), AutoNetworkedField]
public bool IsEnabled = true;
/// <summary>
/// WD Ahead of wizden.
/// When <see langword="true"/> will disable <see cref="IsEnabled"/> when folded
/// </summary>
[DataField, AutoNetworkedField]
public bool DisableOnFolded;
}

View File

@@ -35,7 +35,7 @@ public sealed class MaskSystem : EntitySystem
private void OnToggleMask(Entity<MaskComponent> ent, ref ToggleMaskEvent args)
{
var (uid, mask) = ent;
if (mask.ToggleActionEntity == null || !_timing.IsFirstTimePredicted)
if (mask.ToggleActionEntity == null || !_timing.IsFirstTimePredicted || !mask.IsEnabled) // WD Ahead of wizden
return;
if (!_inventorySystem.TryGetSlotEntity(args.Performer, "mask", out var existing) || !uid.Equals(existing))
@@ -53,7 +53,7 @@ public sealed class MaskSystem : EntitySystem
// set to untoggled when unequipped, so it isn't left in a 'pulled down' state
private void OnGotUnequipped(EntityUid uid, MaskComponent mask, GotUnequippedEvent args)
{
if (!mask.IsToggled)
if (!mask.IsToggled || !mask.IsEnabled) // WD Ahead of wizden
return;
mask.IsToggled = false;
@@ -66,7 +66,7 @@ public sealed class MaskSystem : EntitySystem
private void ToggleMaskComponents(EntityUid uid, MaskComponent mask, EntityUid wearer, string? equippedPrefix = null, bool isEquip = false)
{
Dirty(uid, mask);
if (mask.ToggleActionEntity is {} action)
if (mask.ToggleActionEntity is { } action)
_actionSystem.SetToggled(action, mask.IsToggled);
var maskEv = new ItemMaskToggledEvent(wearer, equippedPrefix, mask.IsToggled, isEquip);
@@ -78,6 +78,8 @@ public sealed class MaskSystem : EntitySystem
private void OnFolded(Entity<MaskComponent> ent, ref FoldedEvent args)
{
if (ent.Comp.DisableOnFolded) // WD Ahead of wizden
ent.Comp.IsEnabled = !args.IsFolded;
ent.Comp.IsToggled = args.IsFolded;
ToggleMaskComponents(ent.Owner, ent.Comp, ent.Owner);

View File

@@ -7,6 +7,8 @@
folded: true
- type: Mask
isToggled: true
enabled: false
disableOnFolded: true
- type: IngestionBlocker
enabled: false
- type: IdentityBlocker
@@ -20,6 +22,8 @@
- state: icon_mask
map: [ "unfoldedLayer" ]
visible: false
- type: HideLayerClothing # needed since head bandana inherits from mask bandana
slots: []
- type: Tag
tags:
- Bandana

View File

@@ -12,6 +12,7 @@
unfoldedSlots:
- MASK
- type: Mask
disableOnFolded: true
- type: IngestionBlocker
- type: IdentityBlocker
coverage: MOUTH