2020-04-02 13:50:30 +00:00
|
|
|
|
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;
|
2020-05-12 00:28:26 +00:00
|
|
|
|
using GamecraftModdingAPI.Engines;
|
2021-04-19 01:13:00 +00:00
|
|
|
|
using RobocraftX.Blocks;
|
|
|
|
|
using Techblox.FlyCam;
|
2020-04-02 13:50:30 +00:00
|
|
|
|
|
|
|
|
|
namespace GamecraftModdingAPI.Inventory
|
|
|
|
|
{
|
|
|
|
|
public class HotbarEngine : IApiEngine
|
|
|
|
|
{
|
|
|
|
|
public string Name { get; } = "GamecraftModdingAPIHotbarGameEngine";
|
|
|
|
|
|
|
|
|
|
public EntitiesDB entitiesDB { set; private get; }
|
|
|
|
|
|
2020-05-12 00:28:26 +00:00
|
|
|
|
public bool isRemovable => false;
|
|
|
|
|
|
2020-04-02 13:50:30 +00:00
|
|
|
|
public bool IsInGame = false;
|
|
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
|
{
|
|
|
|
|
IsInGame = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Ready()
|
|
|
|
|
{
|
|
|
|
|
IsInGame = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool SelectBlock(int block, uint playerID, bool cubeSelectedByPick = false)
|
|
|
|
|
{
|
2021-04-19 01:13:00 +00:00
|
|
|
|
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;
|
2020-04-02 13:50:30 +00:00
|
|
|
|
// TODO: expose the rest of the input functionality
|
2021-04-19 01:13:00 +00:00
|
|
|
|
return true;
|
2020-04-02 13:50:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public uint GetLocalPlayerID()
|
|
|
|
|
{
|
|
|
|
|
return LocalPlayerIDUtility.GetLocalPlayerID(entitiesDB);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|