Fix lasso buckle (#1246)

Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
This commit is contained in:
DrSmugleaf
2020-07-02 23:36:06 +02:00
committed by GitHub
parent bc24a852f9
commit 0a8a383019
9 changed files with 86 additions and 30 deletions

View File

@@ -0,0 +1,32 @@
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;
}
}
}