outlet power fix for grinder,recycler

master
rnd1 2016-02-29 11:58:11 +01:00
parent d4f214fb6c
commit 2126906f29
2 changed files with 11 additions and 6 deletions

View File

@ -28,7 +28,7 @@ local grinder_process = function(pos)
local supply=0;
if fueladd.time == 0 then -- no fuel inserted, try look for outlet
-- No valid fuel in fuel list
supply = basic_machines.check_power(pos) or 0;
supply = basic_machines.check_power({x=pos.x,y=pos.y,z=pos.z}) or 0;
if supply>0 then
fueladd.time = 40 -- same as 10 coal
else
@ -39,10 +39,12 @@ local grinder_process = function(pos)
if supply==0 then -- Take fuel from fuel list if no supply available
inv:set_stack("fuel", 1, afterfuel.items[1])
end
end
if fueladd.time>0 then
fuel=fuel + fueladd.time*0.1
meta:set_float("fuel",fuel);
meta:set_string("infotext", "added fuel furnace burn time " .. fueladd.time .. ", fuel status " .. fuel);
end
end
if fuel<=0 then return end
end

View File

@ -13,16 +13,17 @@ local recycler_process = function(pos)
if fuel<=0 then -- we need new fuel, check chest below
local fuellist = inv:get_list("fuel")
if not fuellist then return end -- safety check, prevents crash when using previous version recylcler without inventory
if not fuellist then return end
local fueladd, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
local supply=0;
if fueladd.time == 0 then -- no fuel inserted, try look for outlet
-- No valid fuel in fuel list
supply = basic_machines.check_power(pos) or 0;
supply = basic_machines.check_power({x=pos.x,y=pos.y,z=pos.z}) or 0;
minetest.chat_send_all("supply "..supply);
if supply>0 then
fueladd.time = 40 -- same as 1 coal
fueladd.time = 40 -- same as 10 coal
else
meta:set_string("infotext", "Please insert fuel.");
return;
@ -31,10 +32,12 @@ local recycler_process = function(pos)
if supply==0 then -- Take fuel from fuel list if no supply available
inv:set_stack("fuel", 1, afterfuel.items[1])
end
end
if fueladd.time>0 then
fuel=fuel + fueladd.time*0.1
meta:set_float("fuel",fuel);
meta:set_string("infotext", "added fuel furnace burn time " .. fueladd.time .. ", fuel status " .. fuel);
end
end
if fuel<=0 then return end
end