From eaae4276fcd1ae82ba0fdd39d7901c3cd9513d5f Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Sun, 8 Jan 2017 23:52:36 -0700 Subject: removing the old get_all_digtron_neighbours This is basically working, but still needs revisions to take advantage of the new information being stored in the image data. It should be possible to do all the temporary inventory work directly on the image file so that no put-back-in-inventory steps will be needed any more. Much nicer. --- util.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'util.lua') diff --git a/util.lua b/util.lua index dba9db8..73d6d22 100644 --- a/util.lua +++ b/util.lua @@ -103,7 +103,7 @@ digtron.place_in_inventory = function(itemname, inventory_positions, fallback_po --tries placing the item in each inventory node in turn. If there's no room, drop it at fallback_pos local itemstack = ItemStack(itemname) for k, location in pairs(inventory_positions) do - local inv = minetest.get_inventory({type="node", pos=location}) + local inv = minetest.get_inventory({type="node", pos=location.pos}) itemstack = inv:add_item("main", itemstack) if itemstack:is_empty() then return nil @@ -131,10 +131,10 @@ digtron.take_from_inventory = function(itemname, inventory_positions) --tries to take an item from each inventory node in turn. Returns location of inventory item was taken from on success, nil on failure local itemstack = ItemStack(itemname) for k, location in pairs(inventory_positions) do - local inv = minetest.get_inventory({type="node", pos=location}) + local inv = minetest.get_inventory({type="node", pos=location.pos}) local output = inv:remove_item("main", itemstack) if not output:is_empty() then - return location + return location.pos end end return nil @@ -162,7 +162,7 @@ digtron.burn = function(fuelstore_positions, target, test) if current_burned > target then break end - local inv = minetest.get_inventory({type="node", pos=location}) + local inv = minetest.get_inventory({type="node", pos=location.pos}) local invlist = inv:get_list("fuel") for i, itemstack in pairs(invlist) do local fuel_per_item = minetest.get_craft_result({method="fuel", width=1, items={itemstack:peek_item(1)}}).time -- cgit v1.2.3 From 01fb71d2eb5d1dd41c338bef0bcc2e26a259047d Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Tue, 10 Jan 2017 00:32:08 -0700 Subject: renaming class definition files --- util.lua | 1 - 1 file changed, 1 deletion(-) (limited to 'util.lua') diff --git a/util.lua b/util.lua index 73d6d22..acebc59 100644 --- a/util.lua +++ b/util.lua @@ -4,7 +4,6 @@ digtron = {} dofile( minetest.get_modpath( "digtron" ) .. "/util_item_place_node.lua" ) -- separated out to avoid potential for license complexity dofile( minetest.get_modpath( "digtron" ) .. "/util_movement.lua" ) -- separated out simply for tidiness, there's some big code in there -dofile( minetest.get_modpath( "digtron" ) .. "/util_layout.lua" ) -- separated out simply for tidiness, there's some big code in there dofile( minetest.get_modpath( "digtron" ) .. "/util_execute_cycle.lua" ) -- separated out simply for tidiness, there's some big code in there -- Apparently node_sound_metal_defaults is a newer thing, I ran into games using an older version of the default mod without it. -- cgit v1.2.3 From 435f21458ccf4d91fd5ec179bdbc5d1aa6d2945c Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Tue, 10 Jan 2017 00:36:39 -0700 Subject: the old movement code is now unneeded. --- util.lua | 1 - 1 file changed, 1 deletion(-) (limited to 'util.lua') diff --git a/util.lua b/util.lua index acebc59..ac7fe3d 100644 --- a/util.lua +++ b/util.lua @@ -3,7 +3,6 @@ digtron = {} dofile( minetest.get_modpath( "digtron" ) .. "/util_item_place_node.lua" ) -- separated out to avoid potential for license complexity -dofile( minetest.get_modpath( "digtron" ) .. "/util_movement.lua" ) -- separated out simply for tidiness, there's some big code in there dofile( minetest.get_modpath( "digtron" ) .. "/util_execute_cycle.lua" ) -- separated out simply for tidiness, there's some big code in there -- Apparently node_sound_metal_defaults is a newer thing, I ran into games using an older version of the default mod without it. -- cgit v1.2.3