Skip to content

Instantly share code, notes, and snippets.

@PilzAdam

PilzAdam/fuel.patch

Created Nov 30, 2012
Embed
What would you like to do?
diff --git a/mods/default/init.lua b/mods/default/init.lua
index 2a27988..cd0e22d 100644
--- a/mods/default/init.lua
+++ b/mods/default/init.lua
@@ -1455,6 +1455,7 @@ minetest.register_abm({
end
local fuel = nil
+ local fuel_time
local cooked = nil
local fuellist = inv:get_list("fuel")
local srclist = inv:get_list("src")
@@ -1463,10 +1464,13 @@ minetest.register_abm({
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
end
if fuellist then
- fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
+ fuel_time = minetest.get_item_group(inv:get_stack("fuel",1):get_name(),"fuel")
+ if fuel_time == 0 then
+ fuel_time = minetest.get_craft_result({method="fuel",width=1,items=fuellist}).time
+ end
end
- if fuel.time <= 0 then
+ if fuel_time and fuel_time <= 0 then
meta:set_string("infotext","Furnace out of fuel")
hacky_swap_node(pos,"default:furnace")
meta:set_string("formspec", default.furnace_inactive_formspec)
@@ -1482,7 +1486,7 @@ minetest.register_abm({
return
end
- meta:set_string("fuel_totaltime", fuel.time)
+ meta:set_string("fuel_totaltime", fuel_time)
meta:set_string("fuel_time", 0)
local stack = inv:get_stack("fuel", 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment