Fix mattock crafting issue.

This commit is contained in:
Aaron Suen 2019-09-21 08:33:59 -04:00
parent 58b4e09bab
commit 3b16be70d4
2 changed files with 13 additions and 15 deletions

View File

@ -9,11 +9,6 @@ ISSUES: Bugs, Cleanup and Refinements
# # # # # # # # # # # #
#### # #### # ###### ###### # # ####
- Mattock recipes broken by pez logic. after_destruct is shifting stacks
downwards during node replacement in crafting recipes. Need to look
for an after_dig hook or something instead, or suspend the logic while
recipes are operating.
- Design principles doc is badly out of date, needs to reflect lessons
learned and things observed about where the game is headed.

View File

@ -5,6 +5,18 @@ local ItemStack, minetest, nodecore
local modname = minetest.get_current_modname()
local function pezdispense(pos)
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
local node = minetest.get_node(above)
if node.name ~= modname .. ":stack" then
return nodecore.visinv_update_ents(pos)
end
nodecore.place_stack(pos, nodecore.stack_get(above))
minetest.remove_node(above)
nodecore.visinv_update_ents(pos)
return pezdispense(above)
end
minetest.register_node(modname .. ":stack", {
drawtype = "nodebox",
node_box = nodecore.fixedbox(
@ -51,16 +63,7 @@ minetest.register_node(modname .. ":stack", {
end)
return nodecore.visinv_on_construct(pos, ...)
end,
after_destruct = function(pos)
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
local node = minetest.get_node(above)
if node.name ~= modname .. ":stack" then
return nodecore.visinv_update_ents(pos)
end
nodecore.place_stack(pos, nodecore.stack_get(above))
minetest.remove_node(above)
return nodecore.visinv_update_ents(pos)
end
after_dig_node = pezdispense
})
function nodecore.place_stack(pos, stack, placer, pointed_thing)