local prices = {
    [1] = 5000,
    [2] = 10000,
    [3] = 35000,
    [4] = 50000,
}

GADGETS = {
    name = "loc@NITRO",
    registry = "savegame.mod.gadget",
    ram = {
        upgrades = {
            [0] = {
                cooldown = 12,
                reduceCooldown = 5,
                minScoreToReduce = 100,
                accel = 1.6,
                shapeStrength = 2.4,
            },
            [1] = {
                cooldown = 11,
                reduceCooldown = 5,
                minScoreToReduce = 100,
                accel = 1.825,
                shapeStrength = 4.8,
            },
            [2] = {
                cooldown = 10,
                reduceCooldown = 5,
                minScoreToReduce = 100,
                accel = 2.05,
                shapeStrength = 7.2,
            },
            [3] = {
                cooldown = 9,
                reduceCooldown = 5,
                minScoreToReduce = 100,
                accel = 2.275,
                shapeStrength = 9.6,
            },
            [4] = {
                cooldown = 8,
                reduceCooldown = 5,
                minScoreToReduce = 100,
                accel = 2.5,
                shapeStrength = 12,
            },
        },
    },
    nitro = {
        upgrades = {
            [0] = {
                recoverySpeed = 0.25,
                recoverDelay = 2,
                accel = 0.15,
                shapeStrength = 2,
            },
            [1] = {
                recoverySpeed = 0.2671875,
                recoverDelay = 1.70125,
                accel = 0.186875,
                shapeStrength = 4.475,
            },
            [2] = {
                recoverySpeed = 0.284375,
                recoverDelay = 1.4025,
                accel = 0.22375,
                shapeStrength = 6.95,
            },
            [3] = {
                recoverySpeed = 0.3015625,
                recoverDelay = 1.10375,
                accel = 0.260625,
                shapeStrength = 9.425,
            },
            [4] = {
                recoverySpeed = 0.31875,
                recoverDelay = 0.805,
                accel = 0.2975,
                shapeStrength = 11.9,
            },
        },
    },
}

for _, v in pairs(GADGETS) do
    if type(v) == "table" then
        local upgrades = v.upgrades
        for i = 1, #upgrades do upgrades[i].price = prices[i] end
    end
end

function GetCurrentUpgradeTable(gadget_name)
    local gadget = GADGETS[gadget_name]
    if gadget then return gadget.upgrades[GetInt(GADGETS.registry)] end
end
