Files
tbd-station-14/Content.Server/GameObjects/EntitySystems/ActionBlockerSystem.cs
Víctor Aguilera Puerto d9077bde74 Adds IThrown, ILand interfaces. Adds dice. (#273)
* Dice, IThrown, ILand

* Adds sounds to the dice using a sound collection.

* Seed random instance better.

* Missed a ")", should compile now
2019-07-18 23:33:02 +02:00

60 lines
1.6 KiB
C#

using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
namespace Content.Server.GameObjects.EntitySystems
{
public interface IActionBlocker
{
bool CanMove();
bool CanInteract();
bool CanUse();
bool CanThrow();
}
public class ActionBlockerSystem : EntitySystem
{
public static bool CanMove(IEntity entity)
{
bool canmove = true;
foreach(var actionblockercomponents in entity.GetAllComponents<IActionBlocker>())
{
canmove &= actionblockercomponents.CanMove(); //sets var to false if false
}
return canmove;
}
public static bool CanInteract(IEntity entity)
{
bool caninteract = true;
foreach (var actionblockercomponents in entity.GetAllComponents<IActionBlocker>())
{
caninteract &= actionblockercomponents.CanInteract();
}
return caninteract;
}
public static bool CanUse(IEntity entity)
{
bool canuse = true;
foreach (var actionblockercomponents in entity.GetAllComponents<IActionBlocker>())
{
canuse &= actionblockercomponents.CanUse();
}
return canuse;
}
public static bool CanThrow(IEntity entity)
{
bool canthrow = true;
foreach (var actionblockercomponents in entity.GetAllComponents<IActionBlocker>())
{
canthrow &= actionblockercomponents.CanThrow();
}
return canthrow;
}
}
}