Compare commits
2 Commits
a865692a64
...
de71082a69
Author | SHA1 | Date |
---|---|---|
Pascal Abresch | de71082a69 | |
Pascal Abresch | 794951caba |
|
@ -103,6 +103,12 @@ minetest.register_globalstep(function(dtime)
|
||||||
end
|
end
|
||||||
elseif outputType == "Inventory" then
|
elseif outputType == "Inventory" then
|
||||||
hudString = hudString .. outputname .. ": Inventory (viewing not implemented)"
|
hudString = hudString .. outputname .. ": Inventory (viewing not implemented)"
|
||||||
|
elseif outputType == "InventoryList" then
|
||||||
|
local count = 1
|
||||||
|
for listItemName, listItem in pairs(output) do
|
||||||
|
hudString = hudString .. outputname .. "[" .. count .. "]:" .. listItem:get_name() .. "[" .. listItem:get_count() .. "] (item)\n"
|
||||||
|
count = count +1
|
||||||
|
end
|
||||||
else
|
else
|
||||||
hudString = hudString .. outputType .. "?\n".. dump2(output)
|
hudString = hudString .. outputType .. "?\n".. dump2(output)
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,8 +21,8 @@ local function is_smeltable(items)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function is_item_allowed(pos, target, _, stack)
|
local function is_item_allowed(pos, target, _, stack)
|
||||||
if target ~= "source" then return 0 end
|
if target ~= "source" or not sparktech.getoption(pos, "acceptInput") then return 0 end
|
||||||
|
|
||||||
if not is_smeltable({stack}) then
|
if not is_smeltable({stack}) then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
|
@ -39,6 +39,7 @@ end
|
||||||
|
|
||||||
local function ongetitem(pos)
|
local function ongetitem(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
if not sparktech.getoption(pos, "enabled") then return end
|
||||||
if meta:get_int("energy") < modifier then return end
|
if meta:get_int("energy") < modifier then return end
|
||||||
local timer = minetest.get_node_timer(pos)
|
local timer = minetest.get_node_timer(pos)
|
||||||
timer:start(1.0)
|
timer:start(1.0)
|
||||||
|
@ -46,6 +47,8 @@ end
|
||||||
|
|
||||||
local function mytime(pos, elapsed)
|
local function mytime(pos, elapsed)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
|
||||||
|
if not sparktech.getoption(pos, "enabled") then return end -- TODO: show in the gui somehow
|
||||||
local energy = meta:get_int("energy")
|
local energy = meta:get_int("energy")
|
||||||
local inventory = meta:get_inventory()
|
local inventory = meta:get_inventory()
|
||||||
local source = inventory:get_list("source")
|
local source = inventory:get_list("source")
|
||||||
|
@ -125,7 +128,41 @@ minetest.register_node( NAME .. ":furnace", {
|
||||||
|
|
||||||
allow_metadata_inventory_put = is_item_allowed,
|
allow_metadata_inventory_put = is_item_allowed,
|
||||||
allow_metadata_inventory_move = is_item_allowed_move,
|
allow_metadata_inventory_move = is_item_allowed_move,
|
||||||
on_metadata_inventory_put = ongetitem
|
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
|
if listname ~= "product" then return stack:get_count() end
|
||||||
|
if not sparktech.getoption(pos, "acceptRemoval") then return 0 end
|
||||||
|
return stack:get_count()
|
||||||
|
end,
|
||||||
|
on_metadata_inventory_put = ongetitem,
|
||||||
|
_sparkoptionchanged = function(pos, name)
|
||||||
|
if name == "enabled" then
|
||||||
|
local timer = minetest.get_node_timer(pos)
|
||||||
|
if sparktech.getoption(pos, name) then
|
||||||
|
timer:start(1.0)
|
||||||
|
else
|
||||||
|
timer:stop()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
_sparkoption = {
|
||||||
|
enabled = true,
|
||||||
|
acceptInput = true,
|
||||||
|
acceptRemoval = true
|
||||||
|
},
|
||||||
|
_sparkoutput = {
|
||||||
|
inputItems = function(nodepos)
|
||||||
|
local inventory = minetest.get_meta(nodepos):get_inventory()
|
||||||
|
return inventory:get_list("source")
|
||||||
|
end,
|
||||||
|
outputItems = function(nodepos)
|
||||||
|
local inventory = minetest.get_meta(nodepos):get_inventory()
|
||||||
|
return inventory:get_list("product")
|
||||||
|
end
|
||||||
|
},
|
||||||
|
_sparkoutputtype = {
|
||||||
|
inputItems = "InventoryList",
|
||||||
|
outputItems = "InventoryList"
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
|
|
Loading…
Reference in New Issue