summaryrefslogtreecommitdiff
path: root/util.lua
diff options
context:
space:
mode:
authorFaceDeer <derksenmobile@gmail.com>2017-01-06 12:07:27 -0700
committerFaceDeer <derksenmobile@gmail.com>2017-01-06 12:07:27 -0700
commit6af67133be0524a1482e512038c5c1267b0ba1b9 (patch)
tree161ca36b21401aec266ad0436721aa9f41fe85a7 /util.lua
parentf85e42b7fafa3697cca51ff257aa58d7cedaffc6 (diff)
Adding combined storage module
Diffstat (limited to 'util.lua')
-rw-r--r--util.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/util.lua b/util.lua
index 05582e3..6709614 100644
--- a/util.lua
+++ b/util.lua
@@ -105,11 +105,13 @@ digtron.move_node = function(pos, newpos, player_name)
local oldmeta = minetest.get_meta(pos)
local oldinv = oldmeta:get_inventory()
local list = oldinv:get_list("main")
+ local fuel = oldinv:get_list("fuel")
local oldformspec = oldmeta:get_string("formspec")
local newmeta = minetest.get_meta(newpos)
local newinv = newmeta:get_inventory()
newinv:set_list("main", list)
+ newinv:set_list("fuel", fuel)
newmeta:set_string("formspec", oldformspec)
newmeta:set_string("triggering_player", oldmeta:get_string("triggering_player")) -- for auto-controllers
@@ -217,6 +219,9 @@ digtron.get_all_digtron_neighbours = function(pos, player)
table.insert(layout.builders, testpos)
elseif group_number == 5 then
table.insert(layout.fuelstores, testpos)
+ elseif group_number == 6 then
+ table.insert(layout.inventories, testpos)
+ table.insert(layout.fuelstores, testpos)
end
--queue up potential new test points adjacent to this digtron node
@@ -371,7 +376,7 @@ digtron.burn = function(fuelstore_positions, target, test)
break
end
local inv = minetest.get_inventory({type="node", pos=location})
- local invlist = inv:get_list("main")
+ 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
if fuel_per_item ~= 0 then
@@ -391,7 +396,7 @@ digtron.burn = function(fuelstore_positions, target, test)
end
if test ~= true then
-- only update the list if we're doing this for real.
- inv:set_list("main", invlist)
+ inv:set_list("fuel", invlist)
end
end
return current_burned