mirror of
https://github.com/minetest-mods/technic.git
synced 2024-12-22 13:52:31 +01:00
Don't consume items or drain power when there isn't room for the results
This commit is contained in:
parent
3107618c9e
commit
bd3cc74d05
@ -240,7 +240,8 @@ function technic.register_alloy_furnace(data)
|
|||||||
srcstack = src2stack
|
srcstack = src2stack
|
||||||
src2stack = temp
|
src2stack = temp
|
||||||
end
|
end
|
||||||
if not result then
|
if not result or
|
||||||
|
not inv:room_for_item("dst", result) then
|
||||||
hacky_swap_node(pos, machine_node)
|
hacky_swap_node(pos, machine_node)
|
||||||
meta:set_string("infotext", machine_name.." Idle")
|
meta:set_string("infotext", machine_name.." Idle")
|
||||||
meta:set_int(data.tier.."_EU_demand", 0)
|
meta:set_int(data.tier.."_EU_demand", 0)
|
||||||
@ -251,7 +252,6 @@ function technic.register_alloy_furnace(data)
|
|||||||
-- Unpowered - go idle
|
-- Unpowered - go idle
|
||||||
hacky_swap_node(pos, machine_node)
|
hacky_swap_node(pos, machine_node)
|
||||||
meta:set_string("infotext", machine_name.." Unpowered")
|
meta:set_string("infotext", machine_name.." Unpowered")
|
||||||
next_state = 1
|
|
||||||
elseif eu_input >= machine_demand[EU_upgrade+1] then
|
elseif eu_input >= machine_demand[EU_upgrade+1] then
|
||||||
-- Powered
|
-- Powered
|
||||||
hacky_swap_node(pos, machine_node.."_active")
|
hacky_swap_node(pos, machine_node.."_active")
|
||||||
|
@ -70,7 +70,7 @@ function technic.smelt_item(meta, result, speed)
|
|||||||
if result and result.item then
|
if result and result.item then
|
||||||
meta:set_int("cook_time", 0)
|
meta:set_int("cook_time", 0)
|
||||||
-- check if there's room for output in "dst" list
|
-- check if there's room for output in "dst" list
|
||||||
if inv:room_for_item("dst", result) then
|
if inv:room_for_item("dst", result.item) then
|
||||||
srcstack = inv:get_stack("src", 1)
|
srcstack = inv:get_stack("src", 1)
|
||||||
srcstack:take_item()
|
srcstack:take_item()
|
||||||
inv:set_stack("src", 1, srcstack)
|
inv:set_stack("src", 1, srcstack)
|
||||||
|
@ -152,12 +152,6 @@ function technic.register_electric_furnace(data)
|
|||||||
local machine_node = "technic:"..string.lower(data.tier).."_electric_furnace"
|
local machine_node = "technic:"..string.lower(data.tier).."_electric_furnace"
|
||||||
local machine_demand = data.demand
|
local machine_demand = data.demand
|
||||||
|
|
||||||
-- Setup meta data if it does not exist. state is used as an indicator of this
|
|
||||||
if not eu_input then
|
|
||||||
meta:set_int(data.tier.."_EU_demand", machine_demand[1])
|
|
||||||
meta:set_int(data.tier.."_EU_input", 0)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Power off automatically if no longer connected to a switching station
|
-- Power off automatically if no longer connected to a switching station
|
||||||
technic.switching_station_timeout_count(pos, data.tier)
|
technic.switching_station_timeout_count(pos, data.tier)
|
||||||
|
|
||||||
@ -174,7 +168,8 @@ function technic.register_electric_furnace(data)
|
|||||||
method = "cooking",
|
method = "cooking",
|
||||||
width = 1,
|
width = 1,
|
||||||
items = inv:get_list("src")})
|
items = inv:get_list("src")})
|
||||||
if not result or result.time == 0 then
|
if not result or result.time == 0 or
|
||||||
|
not inv:room_for_item("dst", result.item) then
|
||||||
meta:set_int(data.tier.."_EU_demand", 0)
|
meta:set_int(data.tier.."_EU_demand", 0)
|
||||||
hacky_swap_node(pos, machine_node)
|
hacky_swap_node(pos, machine_node)
|
||||||
meta:set_string("infotext", machine_name.." Idle")
|
meta:set_string("infotext", machine_name.." Idle")
|
||||||
|
Loading…
Reference in New Issue
Block a user