Skip to content

Commit

Permalink
Fix not being able to place armor on anvil (#19)
Browse files Browse the repository at this point in the history
* fix not being able to place armor on anvil
* check for node on_rightclick on armor equip
  • Loading branch information
OgelGames committed Oct 1, 2020
1 parent 7f63df2 commit 3f1a952
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion 3d_armor/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3f1a952

Please sign in to comment.