ActionBlocker CanShiver uses EntityUid exclusively

This commit is contained in:
Vera Aguilera Puerto
2021-11-09 13:51:12 +01:00
parent a2a8a6303f
commit cc9ae191a8
3 changed files with 10 additions and 14 deletions

View File

@@ -289,19 +289,19 @@ namespace Content.Server.Body.Respiratory
// creadth: sweating does not help in airless environment
if (EntitySystem.Get<AtmosphereSystem>().GetTileMixture(Owner.Transform.Coordinates) is not {})
{
temperatureSystem.RemoveHeat(Owner.Uid, Math.Min(targetHeat, SweatHeatRegulation), temperatureComponent);
temperatureSystem.RemoveHeat(OwnerUid, Math.Min(targetHeat, SweatHeatRegulation), temperatureComponent);
}
}
else
{
if (!actionBlocker.CanShiver(Owner)) return;
if (!actionBlocker.CanShiver(OwnerUid)) return;
if (!_isShivering)
{
Owner.PopupMessage(Loc.GetString("metabolism-component-is-shivering"));
_isShivering = true;
}
temperatureSystem.ReceiveHeat(Owner.Uid, Math.Min(targetHeat, ShiveringHeatRegulation), temperatureComponent);
temperatureSystem.ReceiveHeat(OwnerUid, Math.Min(targetHeat, ShiveringHeatRegulation), temperatureComponent);
}
}

View File

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

View File

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