2020-12-20 04:26:21 +01:00
|
|
|
|
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
2020-12-20 04:31:04 +01:00
|
|
|
|
using JetBrains.Annotations;
|
2020-12-20 04:26:21 +01:00
|
|
|
|
using Robust.Shared.GameObjects.Systems;
|
2020-06-25 15:52:24 +02:00
|
|
|
|
using Robust.Shared.Interfaces.GameObjects;
|
|
|
|
|
|
|
2020-12-20 04:31:04 +01:00
|
|
|
|
namespace Content.Shared.GameObjects.EntitySystems.EffectBlocker
|
2020-06-25 15:52:24 +02:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Utility methods to check if an effect is allowed to affect a specific entity.
|
|
|
|
|
|
/// For actions see <see cref="ActionBlockerSystem"/>
|
|
|
|
|
|
/// </summary>
|
2020-12-20 04:31:04 +01:00
|
|
|
|
[UsedImplicitly]
|
2020-06-25 15:52:24 +02:00
|
|
|
|
public class EffectBlockerSystem : EntitySystem
|
|
|
|
|
|
{
|
|
|
|
|
|
public static bool CanFall(IEntity entity)
|
|
|
|
|
|
{
|
|
|
|
|
|
var canFall = true;
|
2020-12-20 04:31:04 +01:00
|
|
|
|
|
2020-06-25 15:52:24 +02:00
|
|
|
|
foreach (var blocker in entity.GetAllComponents<IEffectBlocker>())
|
|
|
|
|
|
{
|
|
|
|
|
|
canFall &= blocker.CanFall(); // Sets var to false if false
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return canFall;
|
|
|
|
|
|
}
|
2020-07-11 16:49:54 -05:00
|
|
|
|
|
|
|
|
|
|
public static bool CanSlip(IEntity entity)
|
|
|
|
|
|
{
|
|
|
|
|
|
var canSlip = true;
|
2020-12-20 04:31:04 +01:00
|
|
|
|
|
2020-07-11 16:49:54 -05:00
|
|
|
|
foreach (var blocker in entity.GetAllComponents<IEffectBlocker>())
|
|
|
|
|
|
{
|
|
|
|
|
|
canSlip &= blocker.CanSlip(); // Sets var to false if false
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return canSlip;
|
|
|
|
|
|
}
|
2020-06-25 15:52:24 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|