2020-08-13 14:40:27 +02:00
|
|
|
using Content.Client.GameObjects.Components.HUD.Inventory;
|
2019-07-20 13:11:42 +02:00
|
|
|
using Content.Client.UserInterface;
|
|
|
|
|
using Content.Shared.Input;
|
2020-12-08 11:56:10 +01:00
|
|
|
using JetBrains.Annotations;
|
2019-07-20 13:11:42 +02:00
|
|
|
using Robust.Client.Player;
|
|
|
|
|
using Robust.Client.UserInterface.CustomControls;
|
2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Shared.GameObjects;
|
2020-05-31 14:32:05 -07:00
|
|
|
using Robust.Shared.Input.Binding;
|
2019-07-20 13:11:42 +02:00
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
|
|
|
|
|
namespace Content.Client.GameObjects.EntitySystems
|
|
|
|
|
{
|
2020-12-08 11:56:10 +01:00
|
|
|
[UsedImplicitly]
|
2019-07-20 13:11:42 +02:00
|
|
|
public sealed class ClientInventorySystem : EntitySystem
|
|
|
|
|
{
|
2020-08-24 14:10:28 +02:00
|
|
|
[Dependency] private readonly IGameHud _gameHud = default!;
|
|
|
|
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
2019-07-20 13:11:42 +02:00
|
|
|
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
base.Initialize();
|
|
|
|
|
|
2020-05-31 14:32:05 -07:00
|
|
|
CommandBinds.Builder
|
|
|
|
|
.Bind(ContentKeyFunctions.OpenInventoryMenu,
|
2021-03-10 14:48:29 +01:00
|
|
|
InputCmdHandler.FromDelegate(_ => HandleOpenInventoryMenu()))
|
2020-05-31 14:32:05 -07:00
|
|
|
.Register<ClientInventorySystem>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Shutdown()
|
|
|
|
|
{
|
|
|
|
|
CommandBinds.Unregister<ClientInventorySystem>();
|
|
|
|
|
base.Shutdown();
|
2019-07-20 13:11:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void HandleOpenInventoryMenu()
|
|
|
|
|
{
|
2021-03-26 10:23:12 -05:00
|
|
|
_gameHud.InventoryButtonDown = !_gameHud.InventoryButtonDown;
|
2019-07-20 13:11:42 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|