also return buckets with generators
authorgoblin <github@uukgoblin.net>
Fri, 18 Jul 2014 23:18:44 +0000 (00:18 +0100)
committergoblin <github@uukgoblin.net>
Fri, 18 Jul 2014 23:18:44 +0000 (00:18 +0100)
... and in the `smelt_item` function, even though it seems unused

technic/machines/register/common.lua
technic/machines/register/generator.lua

index 3933b0cc1411f346888126130fc742b4cf4a1b69..a3702abeb77d02d2f41675658af3edb6877cfacd 100644 (file)
@@ -71,15 +71,15 @@ function technic.smelt_item(meta, result, speed)
        if meta:get_int("cook_time") < result.time / speed then
                return
        end
-       local result = minetest.get_craft_result({method = "cooking", width = 1, items = inv:get_list("src")})
+       local result
+       local afterfuel
+       result, afterfuel = minetest.get_craft_result({method = "cooking", width = 1, items = inv:get_list("src")})
 
        if result and result.item then
                meta:set_int("cook_time", 0)
                -- check if there's room for output in "dst" list
                if inv:room_for_item("dst", result.item) then
-                       srcstack = inv:get_stack("src", 1)
-                       srcstack:take_item()
-                       inv:set_stack("src", 1, srcstack)
+                       inv:set_stack("src", 1, afterfuel.items[1])
                        inv:add_item("dst", result.item)
                end
        end
index ec1ea796331ab9f7e40a74677cbe1aa09e39ca54..64f75be6aa6b45f2d9f09655e2edec537dfa2bb0 100644 (file)
@@ -51,7 +51,9 @@ function technic.register_generator(data)
                        local inv = meta:get_inventory()
                        if not inv:is_empty("src") then 
                                local fuellist = inv:get_list("src")
-                               local fuel = minetest.get_craft_result(
+                               local fuel
+                               local afterfuel
+                               fuel, afterfuel = minetest.get_craft_result(
                                                {method = "fuel", width = 1,
                                                items = fuellist})
                                if not fuel or fuel.time == 0 then
@@ -61,9 +63,7 @@ function technic.register_generator(data)
                                end
                                meta:set_int("burn_time", fuel.time)
                                meta:set_int("burn_totaltime", fuel.time)
-                               local stack = inv:get_stack("src", 1)
-                               stack:take_item()
-                               inv:set_stack("src", 1, stack)
+                               inv:set_stack("src", 1, afterfuel.items[1])
                                technic.swap_node(pos, "technic:"..ltier.."_generator_active")
                                meta:set_int(tier.."_EU_supply", data.supply)
                        else