How to determine the pick being used?
So, I had this idea which I'd like to code into something playable.
Here's my idea: Better drops when you use better (or more efficient picks). So a wood pick will only ever drop 1 block, but better picks have higher chances of dropping multiples...
I figured I would have to program this individually into each block type. So it would probably look something like:
My issue is, I don't know how to get the type of pick wielded by the player in LUA, nor am I 100% clear on how to make a variable call there. Any help?
Here's my idea: Better drops when you use better (or more efficient picks). So a wood pick will only ever drop 1 block, but better picks have higher chances of dropping multiples...
I figured I would have to program this individually into each block type. So it would probably look something like:
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
minetest.register_node("default:stone", {
description = "Stone",
tiles = {"default_stone.png"},
is_ground_content = true,
groups = {cracky=3, stone=1},
drop = {
max_items = 1,
items = {
if wood.pick then { items = {'default:cobble 1}, rarity = 1 },
elseif stone.pick then { items = {'default:cobble 1}, rarity = 2 },
{ items = {'default:cobble 2}, rarity = 2 },
elseif bronze.pick then { items = {'default:cobble 1}, rarity = 2 },
{ items = {'default:cobble 2}, rarity = 2 }
{ items = {'default:cobble 3}, rarity = 3 }, etc etc etc
}
},
legacy_mineral = true,
sounds = default.node_sound_stone_defaults(),
})
My issue is, I don't know how to get the type of pick wielded by the player in LUA, nor am I 100% clear on how to make a variable call there. Any help?