summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2014-05-18 21:03:58 +0100
committerRealBadAngel <maciej.kasatkin@o2.pl>2014-05-24 00:25:19 +0200
commit4d20e4473e7207bdb3493cced6df47cda4823a88 (patch)
treec702c48d0d5bb10270cf8eb111988adfa0951681
parent623fcae4a4ad3ec12cc242b29b0d781357cff3f7 (diff)
Stop quarry duplicating items
The quarry was digging via dig_node and also manually putting the node's drops into the tube system. This assumed that dig_node would attempt to put the drops in the player's inventory, doing nothing if there is no such inventory. With the item_drop mod installed, dig_node would instead turn the node into an item entity, so the quarry's strategy would duplicate the item, making it appear both as an item entity in situ and as an item in the tube. Instead, the quarry must use remove_node when it manually processes the drops, just like the pipeworks node breaker.
-rw-r--r--technic/machines/HV/quarry.lua13
1 files changed, 4 insertions, 9 deletions
diff --git a/technic/machines/HV/quarry.lua b/technic/machines/HV/quarry.lua
index fcf0fec..c591663 100644
--- a/technic/machines/HV/quarry.lua
+++ b/technic/machines/HV/quarry.lua
@@ -107,15 +107,10 @@ local function quarry_dig(pos, center, size)
end
dig_y = digpos.y
local node = minetest.get_node(digpos)
- drops = minetest.get_node_drops(node.name, "")
- minetest.dig_node(digpos)
- if minetest.get_node(digpos).name == node.name then
- -- We tried to dig something undigable like a
- -- filled chest. Notice that we check for a node
- -- change, not for air. This is so that we get drops
- -- from things like concrete posts with platforms,
- -- which turn into regular concrete posts when dug.
- drops = {}
+ local node_def = minetest.registered_nodes[node.name] or { diggable = false }
+ if node_def.diggable and ((not node_def.can_dig) or node_def.can_dig(digpos, nil)) then
+ minetest.remove_node(digpos)
+ drops = minetest.get_node_drops(node.name, "")
end
elseif not (dig_y < pos.y - quarry_max_depth) then
dig_y = dig_y - 16