#include <Item/StatelessItem/BasicItem/Fan/Fan.hpp>

Fan::Fan(std::string name, std::string displayName, Material &icon, float coolingRate) :
    BasicItem(name, displayName, icon),
    coolingRate(coolingRate)
{
    setMaxStackSize(1);
}

void Fan::describeInNuclearReactor(ItemStack &stack, std::ostream &os)
{
    os << "Cools its cell to the room temperature." << std::endl;
    os << ((int) std::floor(coolingRate * 100)) << "% airflow" << std::endl;
}

bool Fan::updateNuclearReactor(ItemStack &stack, MNuclearReactor &reactor, glm::ivec2 cellPos)
{
    int dt = (300 - reactor.getCellTemperature(cellPos)) * coolingRate;
    reactor.heatCell(cellPos, dt);

    return false;
}

float Fan::getHeatConductivity(ItemStack &stack)
{
    return 0.5f;
}