Update axle to new layout class, drop dug items in the right place

This commit is contained in:
FaceDeer 2017-01-12 00:50:17 -07:00
parent 9f13928884
commit e008aed60c
4 changed files with 12 additions and 10 deletions

@ -15,7 +15,9 @@ local get_node_image = function(pos, node)
local build_item = node_image.meta.inventory.main[1] local build_item = node_image.meta.inventory.main[1]
if build_item ~= "" then if build_item ~= "" then
local build_item_def = minetest.registered_nodes[ItemStack(build_item):get_name()] local build_item_def = minetest.registered_nodes[ItemStack(build_item):get_name()]
node_image.build_item_paramtype2 = build_item_def.paramtype2 if build_item_def ~= nil then
node_image.build_item_paramtype2 = build_item_def.paramtype2
end
end end
end end
return node_image return node_image

@ -36,10 +36,10 @@ minetest.register_node("digtron:axle", {
-- Been too soon since last time the digtron rotated. -- Been too soon since last time the digtron rotated.
return return
end end
local image = digtron.get_layout_image(pos, clicker) local image = DigtronLayout.create(pos, clicker)
digtron.rotate_layout_image(image, node.param2) image:rotate_layout_image(node.param2)
if digtron.can_write_layout_image(image) then if image:can_write_layout_image() then
digtron.write_layout_image(image) image:write_layout_image()
minetest.sound_play("whirr", {gain=1.0, pos=pos}) minetest.sound_play("whirr", {gain=1.0, pos=pos})
meta = minetest.get_meta(pos) meta = minetest.get_meta(pos)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 783 B

After

Width:  |  Height:  |  Size: 835 B

@ -221,11 +221,6 @@ digtron.execute_dig_cycle = function(pos, clicker)
-- All tests passed, ready to go for real! -- All tests passed, ready to go for real!
minetest.sound_play("construction", {gain=1.0, pos=pos}) minetest.sound_play("construction", {gain=1.0, pos=pos})
-- store or drop the products of the digger heads
for _, itemname in pairs(items_dropped) do
digtron.place_in_inventory(itemname, layout.inventories, pos)
end
-- if the player is standing within the array or next to it, move him too. -- if the player is standing within the array or next to it, move him too.
local move_player = move_player_test(layout, clicker) local move_player = move_player_test(layout, clicker)
@ -250,6 +245,11 @@ digtron.execute_dig_cycle = function(pos, clicker)
clicker:moveto(digtron.find_new_pos(clicker:getpos(), facing), true) clicker:moveto(digtron.find_new_pos(clicker:getpos(), facing), true)
end end
-- store or drop the products of the digger heads
for _, itemname in pairs(items_dropped) do
minetest.debug("placing in inventory", itemname)
digtron.place_in_inventory(itemname, layout.inventories, oldpos)
end
local building_fuel_cost = 0 local building_fuel_cost = 0
local strange_failure = false local strange_failure = false