From 29f3d2d1caf12685948b07272c56b781d178e903 Mon Sep 17 00:00:00 2001 From: Vera Aguilera Puerto Date: Tue, 9 Nov 2021 13:52:27 +0100 Subject: [PATCH] ActionBlocker CanSweat uses EntityUid exclusively --- .../Body/Respiratory/RespiratorComponent.cs | 2 +- Content.Shared/ActionBlocker/ActionBlockerSystem.cs | 12 +++--------- Content.Shared/Body/Metabolism/SweatAttemptEvent.cs | 6 +++--- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/Content.Server/Body/Respiratory/RespiratorComponent.cs b/Content.Server/Body/Respiratory/RespiratorComponent.cs index 4ed3f26457..4e95ce9002 100644 --- a/Content.Server/Body/Respiratory/RespiratorComponent.cs +++ b/Content.Server/Body/Respiratory/RespiratorComponent.cs @@ -279,7 +279,7 @@ namespace Content.Server.Body.Respiratory if (temperatureComponent.CurrentTemperature > NormalBodyTemperature) { - if (!actionBlocker.CanSweat(Owner)) return; + if (!actionBlocker.CanSweat(OwnerUid)) return; if (!_isSweating) { Owner.PopupMessage(Loc.GetString("metabolism-component-is-sweating")); diff --git a/Content.Shared/ActionBlocker/ActionBlockerSystem.cs b/Content.Shared/ActionBlocker/ActionBlockerSystem.cs index 7743a899a4..b3a3dbf36e 100644 --- a/Content.Shared/ActionBlocker/ActionBlockerSystem.cs +++ b/Content.Shared/ActionBlocker/ActionBlockerSystem.cs @@ -131,18 +131,12 @@ namespace Content.Shared.ActionBlocker return !ev.Cancelled; } - public bool CanSweat(IEntity entity) + public bool CanSweat(EntityUid uid) { - var ev = new SweatAttemptEvent(entity); - - RaiseLocalEvent(entity.Uid, ev); + var ev = new SweatAttemptEvent(uid); + RaiseLocalEvent(uid, ev); return !ev.Cancelled; } - - public bool CanSweat(EntityUid uid) - { - return CanSweat(EntityManager.GetEntity(uid)); - } } } diff --git a/Content.Shared/Body/Metabolism/SweatAttemptEvent.cs b/Content.Shared/Body/Metabolism/SweatAttemptEvent.cs index 6c6180eb00..6d89b84831 100644 --- a/Content.Shared/Body/Metabolism/SweatAttemptEvent.cs +++ b/Content.Shared/Body/Metabolism/SweatAttemptEvent.cs @@ -4,11 +4,11 @@ namespace Content.Shared.Body.Metabolism { public class SweatAttemptEvent : CancellableEntityEventArgs { - public SweatAttemptEvent(IEntity entity) + public SweatAttemptEvent(EntityUid uid) { - Entity = entity; + Uid = uid; } - public IEntity Entity { get; } + public EntityUid Uid { get; } } }