Fix not being able to place armor on anvil (#19)

* fix not being able to place armor on anvil
* check for node on_rightclick on armor equip
This commit is contained in:
OgelGames 2020-10-02 04:09:31 +10:00 committed by GitHub
parent 7f63df230c
commit 3f1a952afb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -106,7 +106,14 @@ armor.register_armor = function(self, name, def)
def.on_secondary_use = function(itemstack, player)
return armor:equip(player, itemstack)
end
def.on_place = function(itemstack, player)
def.on_place = function(itemstack, player, pointed_thing)
if pointed_thing.type == "node" and player and not player:get_player_control().sneak then
local node = minetest.get_node(pointed_thing.under)
local ndef = minetest.registered_nodes[node.name]
if ndef and ndef.on_rightclick then
return ndef.on_rightclick(pointed_thing.under, node, player, itemstack, pointed_thing)
end
end
return armor:equip(player, itemstack)
end
minetest.register_tool(name, def)