1
0
mirror of https://github.com/D00Med/scifi_nodes.git synced 2024-12-23 00:20:17 +01:00

Fix duplication with item holder and powered stand

The item holder and powered stand could be used to duplicate
buckets, cans from technic, and mob eggs from mobs_redo, as these
items were added to the nodes without being removed from the
player's inventory.
This commit is contained in:
coil 2019-07-02 01:28:05 -04:00
parent 0d388c5976
commit 052ff7287a

View File

@ -606,8 +606,11 @@ minetest.register_node("scifi_nodes:powered_stand", {
groups = {cracky=1, oddly_breakable_by_hand=1}, groups = {cracky=1, oddly_breakable_by_hand=1},
on_rightclick = function(pos, node, clicker, item, _) on_rightclick = function(pos, node, clicker, item, _)
local wield_item = clicker:get_wielded_item():get_name() local wield_item = clicker:get_wielded_item():get_name()
item:take_item() local taken = item:take_item()
minetest.add_item({x=pos.x, y=pos.y+1, z=pos.z}, wield_item) if taken and not taken:is_empty() then
minetest.add_item({x=pos.x, y=pos.y+1, z=pos.z}, wield_item)
return item
end
end, end,
}) })
@ -1067,8 +1070,11 @@ minetest.register_node("scifi_nodes:itemholder", {
if name == meta:get_string("owner") or if name == meta:get_string("owner") or
minetest.check_player_privs(name, "protection_bypass") then minetest.check_player_privs(name, "protection_bypass") then
local wield_item = clicker:get_wielded_item():get_name() local wield_item = clicker:get_wielded_item():get_name()
item:take_item() local taken = item:take_item()
minetest.add_item(pos, wield_item) if taken and not taken:is_empty() then
minetest.add_item(pos, wield_item)
return item
end
end end
end, end,
can_dig = function(pos,player) can_dig = function(pos,player)