ActionBlocker CanSweat uses EntityUid exclusively

This commit is contained in:
Vera Aguilera Puerto
2021-11-09 13:52:27 +01:00
parent cc9ae191a8
commit 29f3d2d1ca
3 changed files with 7 additions and 13 deletions

View File

@@ -279,7 +279,7 @@ namespace Content.Server.Body.Respiratory
if (temperatureComponent.CurrentTemperature > NormalBodyTemperature) if (temperatureComponent.CurrentTemperature > NormalBodyTemperature)
{ {
if (!actionBlocker.CanSweat(Owner)) return; if (!actionBlocker.CanSweat(OwnerUid)) return;
if (!_isSweating) if (!_isSweating)
{ {
Owner.PopupMessage(Loc.GetString("metabolism-component-is-sweating")); Owner.PopupMessage(Loc.GetString("metabolism-component-is-sweating"));

View File

@@ -131,18 +131,12 @@ namespace Content.Shared.ActionBlocker
return !ev.Cancelled; return !ev.Cancelled;
} }
public bool CanSweat(IEntity entity) public bool CanSweat(EntityUid uid)
{ {
var ev = new SweatAttemptEvent(entity); var ev = new SweatAttemptEvent(uid);
RaiseLocalEvent(uid, ev);
RaiseLocalEvent(entity.Uid, ev);
return !ev.Cancelled; return !ev.Cancelled;
} }
public bool CanSweat(EntityUid uid)
{
return CanSweat(EntityManager.GetEntity(uid));
}
} }
} }

View File

@@ -4,11 +4,11 @@ namespace Content.Shared.Body.Metabolism
{ {
public class SweatAttemptEvent : CancellableEntityEventArgs public class SweatAttemptEvent : CancellableEntityEventArgs
{ {
public SweatAttemptEvent(IEntity entity) public SweatAttemptEvent(EntityUid uid)
{ {
Entity = entity; Uid = uid;
} }
public IEntity Entity { get; } public EntityUid Uid { get; }
} }
} }