| | |
| | | local S = technic.getter |
| | | |
| | | local fs_helpers = pipeworks.fs_helpers |
| | | local tube_entry = "^pipeworks_tube_connection_metallic.png" |
| | | |
| | | local tube = { |
| | | insert_object = function(pos, node, stack, direction) |
| | |
| | | connect_sides = {left=1, right=1, back=1, top=1, bottom=1}, |
| | | } |
| | | |
| | | function technic.register_generator(data) |
| | | function technic.register_generator(data) |
| | | |
| | | local tier = data.tier |
| | | local ltier = string.lower(tier) |
| | | |
| | |
| | | for k, v in pairs(groups) do active_groups[k] = v end |
| | | |
| | | local generator_formspec = |
| | | "invsize[8,9;]".. |
| | | "size[8,9;]".. |
| | | "label[0,0;"..S("Fuel-Fired %s Generator"):format(tier).."]".. |
| | | "list[current_name;src;3,1;1,1;]".. |
| | | "image[4,1;1,1;default_furnace_fire_bg.png]".. |
| | |
| | | -- Burn another piece of fuel |
| | | if burn_time == 0 then |
| | | local inv = meta:get_inventory() |
| | | if not inv:is_empty("src") then |
| | | if not inv:is_empty("src") then |
| | | local fuellist = inv:get_list("src") |
| | | local fuel |
| | | local afterfuel |
| | |
| | | if ltier ~= "lv" then |
| | | form_buttons = fs_helpers.cycling_button( |
| | | meta, |
| | | "image_button[0,4.3;1,0.6", |
| | | pipeworks.button_base, |
| | | "splitstacks", |
| | | { |
| | | {text="", texture="pipeworks_button_off.png", addopts="false;false;pipeworks_button_interm.png"}, |
| | | {text="", texture="pipeworks_button_on.png", addopts="false;false;pipeworks_button_interm.png"} |
| | | pipeworks.button_off, |
| | | pipeworks.button_on |
| | | } |
| | | ).."label[0.9,4.31;Allow splitting incoming stacks from tubes]" |
| | | )..pipeworks.button_label |
| | | end |
| | | meta:set_string("formspec", |
| | | meta:set_string("formspec", |
| | | "size[8, 9]".. |
| | | "label[0, 0;"..minetest.formspec_escape(desc).."]".. |
| | | "list[current_name;src;3, 1;1, 1;]".. |
| | |
| | | form_buttons |
| | | ) |
| | | end |
| | | |
| | | |
| | | local tentry = tube_entry |
| | | if ltier == "lv" then tentry = "" end |
| | | |
| | | minetest.register_node("technic:"..ltier.."_generator", { |
| | | description = desc, |
| | | tiles = {"technic_"..ltier.."_generator_top.png", "technic_machine_bottom.png", |
| | | "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_side.png", |
| | | "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_front.png"}, |
| | | tiles = { |
| | | "technic_"..ltier.."_generator_top.png"..tentry, |
| | | "technic_machine_bottom.png"..tentry, |
| | | "technic_"..ltier.."_generator_side.png"..tentry, |
| | | "technic_"..ltier.."_generator_side.png"..tentry, |
| | | "technic_"..ltier.."_generator_side.png"..tentry, |
| | | "technic_"..ltier.."_generator_front.png" |
| | | }, |
| | | paramtype2 = "facedir", |
| | | groups = groups, |
| | | connect_sides = {"bottom", "back", "left", "right"}, |
| | |
| | | if not string.find(node.name, ":lv_") then |
| | | form_buttons = fs_helpers.cycling_button( |
| | | meta, |
| | | "image_button[0,4.3;1,0.6", |
| | | pipeworks.button_base, |
| | | "splitstacks", |
| | | { |
| | | {text="", texture="pipeworks_button_off.png", addopts="false;false;pipeworks_button_interm.png"}, |
| | | {text="", texture="pipeworks_button_on.png", addopts="false;false;pipeworks_button_interm.png"} |
| | | pipeworks.button_off, |
| | | pipeworks.button_on |
| | | } |
| | | ).."label[0.9,4.31;Allow splitting incoming stacks from tubes]" |
| | | )..pipeworks.button_label |
| | | end |
| | | meta:set_string("formspec", generator_formspec..form_buttons) |
| | | local inv = meta:get_inventory() |
| | |
| | | if not string.find(node.name, ":lv_") then |
| | | form_buttons = fs_helpers.cycling_button( |
| | | meta, |
| | | "image_button[0,4.3;1,0.6", |
| | | pipeworks.button_base, |
| | | "splitstacks", |
| | | { |
| | | {text="", texture="pipeworks_button_off.png", addopts="false;false;pipeworks_button_interm.png"}, |
| | | {text="", texture="pipeworks_button_on.png", addopts="false;false;pipeworks_button_interm.png"} |
| | | pipeworks.button_off, |
| | | pipeworks.button_on |
| | | } |
| | | ).."label[0.9,4.31;Allow splitting incoming stacks from tubes]" |
| | | )..pipeworks.button_label |
| | | end |
| | | meta:set_string("formspec", generator_formspec..form_buttons) |
| | | end, |
| | |
| | | |
| | | minetest.register_node("technic:"..ltier.."_generator_active", { |
| | | description = desc, |
| | | tiles = {"technic_"..ltier.."_generator_top.png", "technic_machine_bottom.png", |
| | | "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_side.png", |
| | | "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_front_active.png"}, |
| | | tiles = { |
| | | "technic_"..ltier.."_generator_top.png"..tube_entry, |
| | | "technic_machine_bottom.png"..tube_entry, |
| | | "technic_"..ltier.."_generator_side.png"..tube_entry, |
| | | "technic_"..ltier.."_generator_side.png"..tube_entry, |
| | | "technic_"..ltier.."_generator_side.png"..tube_entry, |
| | | "technic_"..ltier.."_generator_front_active.png" |
| | | }, |
| | | paramtype2 = "facedir", |
| | | groups = active_groups, |
| | | connect_sides = {"bottom"}, |
| | |
| | | if not string.find(node.name, ":lv_") then |
| | | form_buttons = fs_helpers.cycling_button( |
| | | meta, |
| | | "image_button[0,4.3;1,0.6", |
| | | pipeworks.button_base, |
| | | "splitstacks", |
| | | { |
| | | {text="", texture="pipeworks_button_off.png", addopts="false;false;pipeworks_button_interm.png"}, |
| | | {text="", texture="pipeworks_button_on.png", addopts="false;false;pipeworks_button_interm.png"} |
| | | pipeworks.button_off, |
| | | pipeworks.button_on |
| | | } |
| | | ).."label[0.9,4.31;Allow splitting incoming stacks from tubes]" |
| | | )..pipeworks.button_label |
| | | end |
| | | meta:set_string("formspec", |
| | | meta:set_string("formspec", |
| | | "size[8, 9]".. |
| | | "label[0, 0;"..minetest.formspec_escape(desc).."]".. |
| | | "list[current_name;src;3, 1;1, 1;]".. |
| | |
| | | if not string.find(node.name, ":lv_") then |
| | | form_buttons = fs_helpers.cycling_button( |
| | | meta, |
| | | "image_button[0,4.3;1,0.6", |
| | | pipeworks.button_base, |
| | | "splitstacks", |
| | | { |
| | | {text="", texture="pipeworks_button_off.png", addopts="false;false;pipeworks_button_interm.png"}, |
| | | {text="", texture="pipeworks_button_on.png", addopts="false;false;pipeworks_button_interm.png"} |
| | | pipeworks.button_off, |
| | | pipeworks.button_on |
| | | } |
| | | ).."label[0.9,4.31;Allow splitting incoming stacks from tubes]" |
| | | )..pipeworks.button_label |
| | | end |
| | | |
| | | local burn_totaltime = meta:get_int("burn_totaltime") or 0 |
| | | local burn_time = meta:get_int("burn_time") |
| | | local percent = math.floor(burn_time / burn_totaltime * 100) |
| | | |
| | | meta:set_string("formspec", |
| | | meta:set_string("formspec", |
| | | "size[8, 9]".. |
| | | "label[0, 0;"..minetest.formspec_escape(desc).."]".. |
| | | "list[current_name;src;3, 1;1, 1;]".. |