#include <Block/SpriteBlock/BasicBlock/BasicBlock.hpp>
#include <Block/SpriteBlock/BasicBlock/OreBlock/OreBlock.hpp>

OreBlock::OreBlock(std::string name, std::string displayName, float hardness, std::string templateName, std::string materialName) :
    BasicBlock(name, displayName, hardness, formatString("ore/$+", materialName)),
    templateName(templateName),
    materialName(materialName)
{
    withFallbackScript("ore.lua");
    withStoneSounds();
}

void OreBlock::onDesignerInitializing(BlockSpriteDesigner &designer, ScriptEngine &engine)
{
    BasicBlock::onDesignerInitializing(designer, engine);

    engine.push(templateName);
    engine.setGlobal("ORE_TEMPLATE");

    engine.push(materialName);
    engine.setGlobal("ORE_MATERIAL");
}