* Instrument test. * Midi stuff * Some more work * This actually works now! * update * Midi Audio works! * Lots of stuff, and cool interfaces for items * Update * Fix a few things * It just works * Move textures to another folder, remove placeholder description from instruments * Fix warning * Use renderer enum * Instruments now use DisposeRenderer method, and send MidiEvents as they receive them. Deletes InstrumentSystem whoo. * Fix incorrect sprite paths * Instruments take midi file size check into account when enabling/disabling midi playback buttons * Fix crash when pressing drop on empty hand. * Use new renderer return values for midi/input * Xylophones are no longer handheld instruments, fix their sprites. * Use new API * Remove nfluidsynth from solution * Timing information * Use IGameTiming.CurTime for timestamps instead
98 lines
2.7 KiB
C#
98 lines
2.7 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();
|
|
|
|
bool CanSpeak();
|
|
|
|
bool CanDrop();
|
|
|
|
bool CanEmote();
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
public static bool CanSpeak(IEntity entity)
|
|
{
|
|
bool canspeak = true;
|
|
foreach (var actionblockercomponents in entity.GetAllComponents<IActionBlocker>())
|
|
{
|
|
canspeak &= actionblockercomponents.CanSpeak();
|
|
}
|
|
return canspeak;
|
|
}
|
|
|
|
public static bool CanDrop(IEntity entity)
|
|
{
|
|
bool candrop = true;
|
|
foreach (var actionblockercomponents in entity.GetAllComponents<IActionBlocker>())
|
|
{
|
|
candrop &= actionblockercomponents.CanDrop();
|
|
}
|
|
return candrop;
|
|
}
|
|
|
|
public static bool CanEmote(IEntity entity)
|
|
{
|
|
bool canemote = true;
|
|
|
|
foreach (var actionblockercomponents in entity.GetAllComponents<IActionBlocker>())
|
|
{
|
|
canemote &= actionblockercomponents.CanEmote();
|
|
}
|
|
|
|
return canemote;
|
|
}
|
|
}
|
|
}
|