55 lines
1.3 KiB
C#
55 lines
1.3 KiB
C#
using System;
|
|
|
|
using RobocraftX.Character;
|
|
using RobocraftX.GUI.Hotbar;
|
|
using RobocraftX.Players;
|
|
using RobocraftX.Common;
|
|
using RobocraftX.Common.Input;
|
|
using RobocraftX.Common.Players;
|
|
using Svelto.ECS;
|
|
|
|
using GamecraftModdingAPI.Blocks;
|
|
using GamecraftModdingAPI.Utility;
|
|
using GamecraftModdingAPI.Engines;
|
|
using RobocraftX.Blocks;
|
|
using Techblox.FlyCam;
|
|
|
|
namespace GamecraftModdingAPI.Inventory
|
|
{
|
|
public class HotbarEngine : IApiEngine
|
|
{
|
|
public string Name { get; } = "GamecraftModdingAPIHotbarGameEngine";
|
|
|
|
public EntitiesDB entitiesDB { set; private get; }
|
|
|
|
public bool isRemovable => false;
|
|
|
|
public bool IsInGame = false;
|
|
|
|
public void Dispose()
|
|
{
|
|
IsInGame = false;
|
|
}
|
|
|
|
public void Ready()
|
|
{
|
|
IsInGame = true;
|
|
}
|
|
|
|
public bool SelectBlock(int block, uint playerID, bool cubeSelectedByPick = false)
|
|
{
|
|
if (!entitiesDB.TryQueryEntitiesAndIndex<EquippedPartStruct>(playerID, Techblox.FlyCam.FlyCam.Group,
|
|
out var index, out var inputs))
|
|
return false;
|
|
inputs[index].CubeSelectedByPick = cubeSelectedByPick;
|
|
inputs[index].SelectedDBPartID = block;
|
|
// TODO: expose the rest of the input functionality
|
|
return true;
|
|
}
|
|
|
|
public uint GetLocalPlayerID()
|
|
{
|
|
return LocalPlayerIDUtility.GetLocalPlayerID(entitiesDB);
|
|
}
|
|
}
|
|
}
|