tool = {
    tool = {
        x = -1,
        y = -1,
        z = -1,

        input = {
            didShoot = function() return tool.tool.active() and InputPressed('lmb') end,
            didReset = function() return tool.tool.active() and InputPressed('k') end,
            didHalf = function() return tool.tool.active() and InputPressed('l') end,
            isShooting = function() return tool.tool.active() and InputDown('lmb') end,
        },

        setup = {
            name = 'slime',
            title = 'Hungry Slimes',
            voxPath = 'MOD/vox/slime.vox',
        },

        active = function()
            return GetString('game.player.tool') == tool.tool.setup.name and (GetPlayerVehicle() == 0)
        end,

        init = function(enabled)
            RegisterTool(tool.tool.setup.name, tool.tool.setup.title, tool.tool.setup.voxPath)
            SetBool('game.tool.'..tool.tool.setup.name..'.enabled', enabled or true)
        end,

    }
}


function tool.run()

    if tool.tool.input.isShooting() then -- Shooting.
        Gun.actions.shoot()
    end

    if tool.tool.input.didReset() then -- Pressed Reset.
        Gun.actions.reset()
    end

    if tool.tool.input.didHalf() then -- Pressed Half.
        Gun.actions.half()
    end

    if  GetString("game.player.tool") == tool.tool.setup.name then
        local t = Transform()
        t.pos = Vec(0.6,-0.3,-0.7)
        -- DebugPrint("pos("..tool.tool.x..","..tool.tool.y..","..tool.tool.z..")")
        SetToolTransform(t)
    end

end


tool.draw = {}

function tool.draw.process()

    if tool.tool.active() then
        uiDrawToolNameOptionsHint()
    end

end
