| | |
| | | |
| | | local S = technic.getter |
| | | |
| | | -- Register alloy recipes |
| | | technic.alloy_recipes = {} |
| | | |
| | |
| | | |
| | | local formspec = |
| | | "invsize[8,10;]".. |
| | | "label[0,0;"..tier.." Alloy Furnace]".. |
| | | "label[0,0;"..S("%s Alloy Furnace"):format(tier).."]".. |
| | | "list[current_name;src;3,1;1,2;]".. |
| | | "list[current_name;dst;5,1;2,2;]".. |
| | | "list[current_player;main;0,6;8,4;]" |
| | |
| | | } |
| | | |
| | | minetest.register_node("technic:"..ltier.."_alloy_furnace", { |
| | | description = tier.." Alloy Furnace", |
| | | description = S("%s Alloy Furnace"):format(tier), |
| | | tiles = {"technic_"..ltier.."_alloy_furnace_top.png", |
| | | "technic_"..ltier.."_alloy_furnace_bottom.png", |
| | | tube_side_texture, |
| | |
| | | local data = minetest.registered_nodes[name].technic |
| | | |
| | | |
| | | meta:set_string("infotext", data.tier.." Alloy furnace") |
| | | meta:set_string("infotext", S("%s Alloy Furnace"):format(data.tier)) |
| | | meta:set_string("formspec", data.formspec) |
| | | meta:set_int("tube_time", 0) |
| | | local inv = meta:get_inventory() |
| | |
| | | if not inv:is_empty("src") or not inv:is_empty("dst") or |
| | | not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then |
| | | minetest.chat_send_player(player:get_player_name(), |
| | | "Machine cannot be removed because it is not empty"); |
| | | S("Machine cannot be removed because it is not empty")) |
| | | return false |
| | | else |
| | | return true |
| | |
| | | }) |
| | | |
| | | minetest.register_node("technic:"..ltier.."_alloy_furnace_active",{ |
| | | description = tier.." Alloy Furnace", |
| | | description = S(tier.." Alloy Furnace"), |
| | | tiles = {"technic_"..ltier.."_alloy_furnace_top.png", |
| | | "technic_"..ltier.."_alloy_furnace_bottom.png", |
| | | tube_side_texture, |
| | |
| | | if not inv:is_empty("src") or not inv:is_empty("dst") or |
| | | not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then |
| | | minetest.chat_send_player(player:get_player_name(), |
| | | "Machine cannot be removed because it is not empty"); |
| | | S("Machine cannot be removed because it is not empty")) |
| | | return false |
| | | else |
| | | return true |
| | |
| | | local eu_input = meta:get_int(data.tier.."_EU_input") |
| | | |
| | | -- Machine information |
| | | local machine_name = data.tier.." Alloy Furnace" |
| | | local machine_name = S("%s Alloy Furnace"):format(data.tier) |
| | | local machine_node = "technic:"..string.lower(data.tier).."_alloy_furnace" |
| | | local machine_demand = data.demand |
| | | |
| | |
| | | srcstack = src2stack |
| | | src2stack = temp |
| | | end |
| | | if not result then |
| | | if not result or |
| | | not inv:room_for_item("dst", result) then |
| | | hacky_swap_node(pos, machine_node) |
| | | meta:set_string("infotext", machine_name.." Idle") |
| | | meta:set_string("infotext", S("%s Idle"):format(machine_name)) |
| | | meta:set_int(data.tier.."_EU_demand", 0) |
| | | return |
| | | end |
| | |
| | | if eu_input < machine_demand[EU_upgrade+1] then |
| | | -- Unpowered - go idle |
| | | hacky_swap_node(pos, machine_node) |
| | | meta:set_string("infotext", machine_name.." Unpowered") |
| | | next_state = 1 |
| | | meta:set_string("infotext", S("%s Unpowered"):format(machine_name)) |
| | | elseif eu_input >= machine_demand[EU_upgrade+1] then |
| | | -- Powered |
| | | hacky_swap_node(pos, machine_node.."_active") |
| | | meta:set_string("infotext", machine_name.." Active") |
| | | meta:set_string("infotext", S("%s Active"):format(machine_name)) |
| | | meta:set_int("src_time", meta:get_int("src_time") + 1) |
| | | if meta:get_int("src_time") == data.cook_time then |
| | | meta:set_int("src_time", 0) |