Adds playable instruments, IDropped, IHandSelected and IHandDese… (#368)

* 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
This commit is contained in:
Víctor Aguilera Puerto
2019-11-25 00:11:47 +01:00
committed by Pieter-Jan Briers
parent ce54c489eb
commit fedc0ad71c
41 changed files with 1062 additions and 7 deletions

View File

@@ -12,6 +12,7 @@ using Robust.Server.Interfaces.Player;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Input;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.Interfaces.Timing;
using Robust.Shared.IoC;
@@ -27,6 +28,7 @@ namespace Content.Server.GameObjects.EntitySystems
{
#pragma warning disable 649
[Dependency] private readonly IMapManager _mapManager;
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
#pragma warning restore 649
private const float ThrowForce = 1.5f; // Throwing force of mobs in Newtons
@@ -94,7 +96,19 @@ namespace Content.Server.GameObjects.EntitySystems
if (!TryGetAttachedComponent(session as IPlayerSession, out HandsComponent handsComp))
return;
var interactionSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<InteractionSystem>();
var oldItem = handsComp.GetActiveHand;
handsComp.SwapHands();
var newItem = handsComp.GetActiveHand;
if(oldItem != null)
interactionSystem.HandDeselectedInteraction(handsComp.Owner, oldItem.Owner);
if(newItem != null)
interactionSystem.HandSelectedInteraction(handsComp.Owner, newItem.Owner);
}
private bool HandleDrop(ICommonSession session, GridCoordinates coords, EntityUid uid)
@@ -102,14 +116,19 @@ namespace Content.Server.GameObjects.EntitySystems
var ent = ((IPlayerSession) session).AttachedEntity;
if (ent == null || !ent.IsValid())
{
return false;
}
if (!ent.TryGetComponent(out HandsComponent handsComp))
{
return false;
}
if (handsComp.GetActiveHand == null)
return false;
if (!_entitySystemManager.GetEntitySystem<InteractionSystem>().TryDroppedInteraction(ent, handsComp.GetActiveHand.Owner))
return false;
if(handsComp.GetActiveHand != null && !_entitySystemManager.GetEntitySystem<InteractionSystem>().TryDroppedInteraction(ent, handsComp.GetActiveHand.Owner))
return false;
if (coords.InRange(_mapManager, ent.Transform.GridPosition, InteractionSystem.InteractionRange))
{