Files
tbd-station-14/Content.Shared/GameObjects/EntitySystems/EffectBlockerSystem.cs
DrSmugleaf 0a8a383019 Fix lasso buckle (#1246)
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
2020-07-02 23:36:06 +02:00

33 lines
986 B
C#

using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
namespace Content.Shared.GameObjects.EntitySystems
{
/// <summary>
/// This interface gives components the ability to block certain effects
/// from affecting the owning entity. For actions see <see cref="IActionBlocker"/>
/// </summary>
public interface IEffectBlocker
{
bool CanFall() => true;
}
/// <summary>
/// Utility methods to check if an effect is allowed to affect a specific entity.
/// For actions see <see cref="ActionBlockerSystem"/>
/// </summary>
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;
}
}
}