summaryrefslogtreecommitdiff
path: root/util.lua
diff options
context:
space:
mode:
authorFaceDeer <derksenmobile@gmail.com>2017-01-12 00:53:04 -0700
committerGitHub <noreply@github.com>2017-01-12 00:53:04 -0700
commit578484352b8892787974fe14b0b856579c5f5afe (patch)
treee7651fc4027e356b48dafe2fbc88c014f2d1cd32 /util.lua
parentf665f430fc94165a8c2d01f7d09fc327eee66c58 (diff)
parente008aed60c3e4e5875c94617a6cc6d588f283582 (diff)
Merge pull request #1 from FaceDeer/layout-refactor
Layout refactor
Diffstat (limited to 'util.lua')
-rw-r--r--util.lua10
1 files changed, 4 insertions, 6 deletions
diff --git a/util.lua b/util.lua
index dba9db8..ac7fe3d 100644
--- a/util.lua
+++ b/util.lua
@@ -3,8 +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_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.
@@ -103,7 +101,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 +129,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 +160,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