#include <Block/SpriteBlock/BasicBlock/ConstructTable/ConstructTable.hpp>
#include <BlockRegistry/BlockRegistry.hpp>
#include <Controller/InventoryController/InventoryController.hpp>
#include <Milestone/CarpentryMilestone/CarpentryMilestone.hpp>
#include <World/LocalWorld/LocalWorld.hpp>

ConstructTable::ConstructTable(std::string name) : BasicBlock(
    name,
    "Construction Table",
    15.0f,
    {
        "constructTableSide",
        "constructTableSide",
        "constructTableSide",
        "constructTableSide",
        "constructTableBottom",
        "constructTableTop"
    },
    {0, 0, 0, 8, 8, 8},
    "constructTableTop"
)
{
    withWoodSounds();
}

bool ConstructTable::canManuallyDig()
{
    return true;
}

void ConstructTable::onInteract(LocalWorld &world, Player &player, glm::ivec3 pos, Side side, const RGBABytes &collisionKey)
{
    player.achieve(CarpentryMilestone::ID, CarpentryMilestone::ConstructTable);
    player.connectController<InventoryController>("main:ConstructionTableController", ItemRecipe::Level::Table);
}