Restart machine if power goes back on

This commit is contained in:
mrkubax10 2023-04-02 18:21:39 +02:00
parent cf73640e75
commit 190f83a60f

View File

@ -955,11 +955,13 @@ local function registerSimpleElectricItemProcessor(config)
inv:set_stack("powerStorage",1,powerStorageSlot)
end
end
if srcSlot:get_count()>0 and meta:get_float("maxSrcTime")<=0 and meta:get_int("industrialtest.powerAmount")>=requiredPower then
if srcSlot:get_count()>0 and meta:get_int("industrialtest.powerAmount")>=requiredPower then
local output=craftResultProxy(config.method,srcSlot)
if output.time>0 and inv:room_for_item("dst",output.item) then
meta:set_float("srcTime",0)
meta:set_float("maxSrcTime",output.time*config.efficiency)
if meta:get_float("maxSrcTime")<=0 then
meta:set_float("srcTime",0)
meta:set_float("maxSrcTime",output.time*config.efficiency)
end
minetest.swap_node(pos,{
name="industrialtest:"..config.name.."_active",
param2=minetest.get_node(pos).param2