Skip to content

Commit

Permalink
Allow non mtg screwdrivers to get repaired in anvil (#41)
Browse files Browse the repository at this point in the history
* Allow other screwdrivers to get repaired too

* Check if player is still holding the same item
  • Loading branch information
Niklp09 authored Apr 27, 2024
1 parent f310cec commit fce5cac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down

0 comments on commit fce5cac

Please sign in to comment.