From fce5cac8a94353a891eaa25da062ffac2b9e62b5 Mon Sep 17 00:00:00 2001 From: Niklp Date: Sat, 27 Apr 2024 20:01:07 +0200 Subject: [PATCH] Allow non mtg screwdrivers to get repaired in anvil (#41) * Allow other screwdrivers to get repaired too * Check if player is still holding the same item --- init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 99c445f..55beabf 100644 --- a/init.lua +++ b/init.lua @@ -253,6 +253,7 @@ local function anvil_rotate(pos, node, user, mode, new_param2) local player_name = user:get_player_name() local wield_list = user:get_wield_list() local wield_index = user:get_wield_index() + local wielded_original = user:get_inventory():get_stack(wield_list, wield_index) minetest.after(0,function() local player = minetest.get_player_by_name(player_name) @@ -263,7 +264,7 @@ local function anvil_rotate(pos, node, user, mode, new_param2) local inv = player:get_inventory() local wielded = inv:get_stack(wield_list, wield_index) - if wielded:get_name() ~= "screwdriver:screwdriver" then + if wielded:get_name() ~= wielded_original:get_name() then return end