Skip to content

Commit

Permalink
drop upgrade items instead of preventing digging
Browse files Browse the repository at this point in the history
  • Loading branch information
OgelGames committed Feb 25, 2020
1 parent 9080211 commit b019106
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions register.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,17 @@ for name,data in pairs(beacon.colors) do
return beacon.update(pos)
end,
can_dig = function(pos, player)
local meta = minetest.get_meta(pos)
return not beacon.showing_formspec(pos) and meta:get_inventory():is_empty("beacon_upgrades")
return not beacon.showing_formspec(pos)
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
if oldmetadata.inventory and oldmetadata.inventory.beacon_upgrades then
for _,item in ipairs(oldmetadata.inventory.beacon_upgrades) do
local stack = ItemStack(item)
if not stack:is_empty() then
minetest.add_item(pos, stack)
end
end
end
end,
on_destruct = beacon.remove_beam,
on_rotate = function(pos, node, user, mode, new_param2)
Expand Down

0 comments on commit b019106

Please sign in to comment.