Fix lasso buckle (#1246)
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user