summaryrefslogtreecommitdiff
path: root/util.lua
diff options
context:
space:
mode:
authorFaceDeer <derksenmobile@gmail.com>2017-01-08 23:52:36 -0700
committerFaceDeer <derksenmobile@gmail.com>2017-01-08 23:52:36 -0700
commiteaae4276fcd1ae82ba0fdd39d7901c3cd9513d5f (patch)
tree32d156a849e28d1c1b8d35649383f65b551dc366 /util.lua
parent38e1cbc41e470ec1fdfca7036056acc1297bcd1c (diff)
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.
Diffstat (limited to 'util.lua')
-rw-r--r--util.lua8
1 files changed, 4 insertions, 4 deletions
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