[Confused] Registering tools using ipairs fails

User avatar
SegFault22
Member
 
Posts: 870
Joined: Mon May 21, 2012 03:17

[Confused] Registering tools using ipairs fails

by SegFault22 » Sat Apr 19, 2014 18:11

I made this code:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local tools = {
    { "metalores:pick_bronze", "Bronze Pickaxe", "metalores_pick_bronze.png", "1.0", "cracky = {times={[1]=2.40, [2]=2.00, [3]=1.60}, uses=32, maxlevel=3}", "fleshy=5" },
}

for _, row in ipairs(tools) do
    local toolid = row[1]
    local toolname = row[2]
    local toolimg = row[3]
    local toolswingspeed = row[4]
    local toolgroupcaps = row[5]
    local tooldamagegroups = row[6]

    minetest.register_tool(toolid, {
        description = toolname,
        inventory_image = toolimg,
        tool_capabilities = {
            full_punch_interval = toolswingspeed,
            max_drop_level=3,
            groupcaps=toolgroupcaps,
            damage_groups = tooldamagegroups,
        },
    })
end

But it's not working. The tool is registered, but it fails to break stone, or anything for that matter. What gives?
Last edited by SegFault22 on Sat Apr 19, 2014 18:30, edited 1 time in total.
Resources are abundant; only money is scarce. People should not have to work hard and remain poor just to pay for the needs of survival.
Society can thrive without money - but only if productive members of society are rewarded for being productive.
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

by Krock » Sat Apr 19, 2014 18:41

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local tools = {
    { "metalores:pick_bronze", "Bronze Pickaxe", "metalores_pick_bronze.png", 1.0, {cracky = {times={[1]=2.40, [2]=2.00, [3]=1.60}, uses=32, maxlevel=3}}, {fleshy=5} },
}

Take this.
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
SegFault22
Member
 
Posts: 870
Joined: Mon May 21, 2012 03:17

by SegFault22 » Sat Apr 19, 2014 18:43

I didn't think of that. Thank you.
Resources are abundant; only money is scarce. People should not have to work hard and remain poor just to pay for the needs of survival.
Society can thrive without money - but only if productive members of society are rewarded for being productive.
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 12 guests

cron