Files
tbd-station-14/Content.Shared/EffectBlocker/EffectBlockerSystem.cs
metalgearsloth 50cc526ebd Refactor standing to be ECS (#4142)
* Refactor standing to be ECS

E C S B A B Y

* DONE

* FIX IT FIX IT FIX IT

* IsDown event

* Change to methods

* Fixes

* Address some reviews

* Last of the Mohicans

* Final fixes

* Fix tests
2021-06-27 19:02:46 +10:00

41 lines
1.0 KiB
C#

#nullable enable
using System;
using Content.Shared.ActionBlocker;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
namespace Content.Shared.EffectBlocker
{
/// <summary>
/// Utility methods to check if an effect is allowed to affect a specific entity.
/// For actions see <see cref="ActionBlockerSystem"/>
/// </summary>
[UsedImplicitly]
public class EffectBlockerSystem : EntitySystem
{
public static bool CanFall(IEntity entity)
{
var canFall = true;
foreach (var blocker in entity.GetAllComponents<IEffectBlocker>())
{
canFall &= blocker.CanFall(); // Sets var to false if false
}
return canFall;
}
public static bool CanSlip(IEntity entity)
{
var canSlip = true;
foreach (var blocker in entity.GetAllComponents<IEffectBlocker>())
{
canSlip &= blocker.CanSlip(); // Sets var to false if false
}
return canSlip;
}
}
}