Fix toggle mask issues (#22496)

This commit is contained in:
themias
2023-12-14 15:49:26 -05:00
committed by GitHub
parent 1d8116e3f0
commit 59e23c5283
2 changed files with 13 additions and 15 deletions

View File

@@ -53,10 +53,7 @@ public sealed class LungSystem : EntitySystem
private void OnMaskToggled(Entity<BreathToolComponent> ent, ref ItemMaskToggledEvent args) private void OnMaskToggled(Entity<BreathToolComponent> ent, ref ItemMaskToggledEvent args)
{ {
// toggle breath tool connection (skip during equip since that is handled in LungSystem) if (args.IsToggled || args.IsEquip)
if (args.IsEquip)
{
if (args.IsToggled)
{ {
_atmos.DisconnectInternals(ent.Comp); _atmos.DisconnectInternals(ent.Comp);
} }
@@ -71,7 +68,6 @@ public sealed class LungSystem : EntitySystem
} }
} }
} }
}
public void GasToReagent(EntityUid uid, LungComponent lung) public void GasToReagent(EntityUid uid, LungComponent lung)
{ {

View File

@@ -3,6 +3,7 @@ using Content.Shared.Clothing.Components;
using Content.Shared.Inventory; using Content.Shared.Inventory;
using Content.Shared.Inventory.Events; using Content.Shared.Inventory.Events;
using Content.Shared.Popups; using Content.Shared.Popups;
using Robust.Shared.Timing;
namespace Content.Shared.Clothing.EntitySystems; namespace Content.Shared.Clothing.EntitySystems;
@@ -11,6 +12,7 @@ public sealed class MaskSystem : EntitySystem
[Dependency] private readonly SharedActionsSystem _actionSystem = default!; [Dependency] private readonly SharedActionsSystem _actionSystem = default!;
[Dependency] private readonly InventorySystem _inventorySystem = default!; [Dependency] private readonly InventorySystem _inventorySystem = default!;
[Dependency] private readonly SharedPopupSystem _popupSystem = default!; [Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly IGameTiming _timing = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -30,7 +32,7 @@ public sealed class MaskSystem : EntitySystem
private void OnToggleMask(Entity<MaskComponent> ent, ref ToggleMaskEvent args) private void OnToggleMask(Entity<MaskComponent> ent, ref ToggleMaskEvent args)
{ {
var (uid, mask) = ent; var (uid, mask) = ent;
if (mask.ToggleActionEntity == null) if (mask.ToggleActionEntity == null || !_timing.IsFirstTimePredicted)
return; return;
if (!_inventorySystem.TryGetSlotEntity(args.Performer, "mask", out var existing) || !uid.Equals(existing)) if (!_inventorySystem.TryGetSlotEntity(args.Performer, "mask", out var existing) || !uid.Equals(existing))