Carter Kolwey
2014-01-11 ebc114df71cc20868afbd3c6dea4039dc14c1a0e
technic/machines/register/generator.lua
@@ -4,7 +4,7 @@
   insert_object = function(pos, node, stack, direction)
      local meta = minetest.get_meta(pos)
      local inv = meta:get_inventory()
      return inv:add_item("src",stack)
      return inv:add_item("src", stack)
   end,
   can_insert = function(pos, node, stack, direction)
      local meta = minetest.get_meta(pos)
@@ -17,7 +17,7 @@
function technic.register_generator(data) 
   local tier = data.tier
   local ltier = string.lower(tier)
   local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2}
   local active_groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}
   if data.tube then
@@ -26,7 +26,7 @@
      active_groups.tubedevice = 1
      active_groups.tubedevice_receiver = 1
   end
   local generator_formspec =
      "invsize[8,9;]"..
      "label[0,0;"..S("%s Generator"):format(tier).."]"..
@@ -91,20 +91,17 @@
            burn_time = burn_time - 1
            meta:set_int("burn_time", burn_time)
         end
         local tube_upgrade = 0, 0
         if data.tube then
            technic.handle_machine_pipeworks(pos, tube_upgrade)
         end
         -- Burn another piece of fuel
         if burn_time == 0 then
            local inv = meta:get_inventory()
            if not inv:is_empty("src") then 
               local fuellist = inv:get_list("src")
               fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
               local fuel = minetest.get_craft_result(
                     {method = "fuel", width = 1,
                     items = fuellist})
               if not fuel or fuel.time == 0 then
                  meta:set_string("infotext", S("%s Out Of Fuel"):format(desc))
                  hacky_swap_node(pos, "technic:"..ltier.."_generator")
                  technic.swap_node(pos, "technic:"..ltier.."_generator")
                  return
               end
               meta:set_int("burn_time", fuel.time)
@@ -112,10 +109,10 @@
               local stack = inv:get_stack("src", 1)
               stack:take_item()
               inv:set_stack("src", 1, stack)
               hacky_swap_node(pos, "technic:"..ltier.."_generator_active")
               technic.swap_node(pos, "technic:"..ltier.."_generator_active")
               meta:set_int(tier.."_EU_supply", data.supply)
            else
               hacky_swap_node(pos, "technic:"..ltier.."_generator")
               technic.swap_node(pos, "technic:"..ltier.."_generator")
               meta:set_int(tier.."_EU_supply", 0)
            end
         end