diff --git a/elepower_dynamics/compat/init.lua b/elepower_dynamics/compat/init.lua new file mode 100644 index 0000000..e3c704f --- /dev/null +++ b/elepower_dynamics/compat/init.lua @@ -0,0 +1,3 @@ +-- Elepower Compatibility registrations + +dofile(elepd.modpath.."/compat/plastic.lua") diff --git a/elepower_dynamics/plastic.lua b/elepower_dynamics/compat/plastic.lua similarity index 100% rename from elepower_dynamics/plastic.lua rename to elepower_dynamics/compat/plastic.lua diff --git a/elepower_dynamics/craftitems.lua b/elepower_dynamics/craftitems.lua index 9c5b07c..90fb154 100644 --- a/elepower_dynamics/craftitems.lua +++ b/elepower_dynamics/craftitems.lua @@ -178,6 +178,12 @@ minetest.register_craftitem("elepower_dynamics:control_circuit", { groups = {ic = 2, assembled_component = 1, control_circuit = 1} }) +minetest.register_craftitem("elepower_dynamics:micro_circuit", { + description = "Microcontroller Circuit", + inventory_image = "elepower_ic_3.png", + groups = {ic = 3, assembled_component = 1, control_circuit = 2} +}) + --------------- -- Overrides -- --------------- diff --git a/elepower_dynamics/init.lua b/elepower_dynamics/init.lua index d6b9b05..0dee742 100644 --- a/elepower_dynamics/init.lua +++ b/elepower_dynamics/init.lua @@ -8,7 +8,7 @@ elepd.modpath = modpath dofile(modpath.."/conduits.lua") dofile(modpath.."/craftitems.lua") -dofile(modpath.."/plastic.lua") +dofile(modpath.."/compat/init.lua") dofile(modpath.."/tools.lua") dofile(modpath.."/nodes.lua") dofile(modpath.."/liquids.lua") diff --git a/elepower_dynamics/textures/elepower_ic_3.png b/elepower_dynamics/textures/elepower_ic_3.png new file mode 100644 index 0000000..431ea64 Binary files /dev/null and b/elepower_dynamics/textures/elepower_ic_3.png differ diff --git a/elepower_machines/formspec.lua b/elepower_machines/formspec.lua index 2dc1962..e8449fc 100644 --- a/elepower_machines/formspec.lua +++ b/elepower_machines/formspec.lua @@ -11,12 +11,32 @@ function ele.formspec.get_crafter_formspec(craft_type, power, percent) (percent)..":gui_furnace_arrow_fg.png^[transformR270]" end + local in_width = input_size + local in_height = 1 + + for n = 2, 4 do + if input_size % n == 0 and input_size ~= n then + in_width = input_size / n + in_height = input_size / n + end + end + + local y = 1.5 + local x = 1.5 + if in_height == 2 then + y = 1 + x = 1 + elseif in_height >= 3 then + y = 0.5 + x = 1 + end + return "size[8,8.5]".. default.gui_bg.. default.gui_bg_img.. default.gui_slots.. ele.formspec.power_meter(power).. - "list[context;src;1.5,1.5;"..input_size..",1;]".. + "list[context;src;"..x..","..y..";"..in_width..","..in_height..";]".. bar.. "list[context;dst;5,1;2,2;]".. "list[current_player;main;0,4.25;8,1;]".. diff --git a/elepower_machines/machines/assembler.lua b/elepower_machines/machines/assembler.lua new file mode 100644 index 0000000..1e849ed --- /dev/null +++ b/elepower_machines/machines/assembler.lua @@ -0,0 +1,17 @@ + +elepm.register_craft_type("assembly", { + description = "Assembly", + inputs = 9, +}) + +elepm.register_crafter("elepower_machines:assembler", { + description = "Assembler", + craft_type = "assembly", + tiles = { + "elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png", + "elepower_machine_side.png", "elepower_machine_side.png", "elepower_machine_side.png", + }, + groups = {oddly_breakable_by_hand = 1}, + ele_capacity = 64000, + ele_usage = 124 +}) diff --git a/elepower_machines/machines/bases/crafter.lua b/elepower_machines/machines/bases/crafter.lua index 7faf8ac..a444e30 100644 --- a/elepower_machines/machines/bases/crafter.lua +++ b/elepower_machines/machines/bases/crafter.lua @@ -25,6 +25,7 @@ function elepm.register_crafter(nodename, nodedef) local machine_speed = nodedef.craft_speed or 1 local capacity = ele.helpers.get_node_property(meta, pos, "capacity") + local time = meta:get_int("src_time") while true do local result = elepm.get_recipe(craft_type, inv:get_list("src")) @@ -45,7 +46,7 @@ function elepm.register_crafter(nodename, nodedef) if result.time == 0 then meta:set_string("formspec", ele.formspec.get_crafter_formspec(craft_type, pow_percent)) - meta:set_int("src_time", 0) + time = 0 meta:set_string("infotext", ("%s Idle"):format(nodedef.description) .. "\n" .. ele.capacity_text(capacity, storage)) else @@ -63,7 +64,7 @@ function elepm.register_crafter(nodename, nodedef) -- One step meta:set_int("storage", storage - usage) pow_percent = math.floor((storage / capacity) * 100) - meta:set_int("src_time", meta:get_int("src_time") + ele.helpers.round(machine_speed * 10)) + time = time + ele.helpers.round(machine_speed * 10) meta:set_string("infotext", ("%s Active"):format(nodedef.description) .. "\n" .. ele.capacity_text(capacity, storage)) @@ -76,8 +77,8 @@ function elepm.register_crafter(nodename, nodedef) ele.helpers.swap_node(pos, active_node) end - if meta:get_int("src_time") <= ele.helpers.round(result.time * 10) then - local pct = math.floor((meta:get_int("src_time") / ele.helpers.round(result.time * 10)) * 100) + if time <= ele.helpers.round(result.time * 10) then + local pct = math.floor((time / ele.helpers.round(result.time * 10)) * 100) meta:set_string("formspec", ele.formspec.get_crafter_formspec(craft_type, pow_percent, pct)) break end @@ -104,17 +105,19 @@ function elepm.register_crafter(nodename, nodedef) if not room_for_output then ele.helpers.swap_node(pos, machine_node) meta:set_string("formspec", ele.formspec.get_crafter_formspec(craft_type, pow_percent)) - meta:set_int("src_time", ele.helpers.round(result.time*10)) + time = ele.helpers.round(result.time*10) meta:set_string("infotext", ("%s Output Full!"):format(nodedef.description) .. "\n" .. ele.capacity_text(capacity, storage)) break end - meta:set_int("src_time", meta:get_int("src_time") - ele.helpers.round(result.time*10)) + time = 0 inv:set_list("src", result.new_input) inv:set_list("dst", inv:get_list("dst_tmp")) end + meta:set_int("src_time", time) + return refresh end diff --git a/elepower_machines/machines/init.lua b/elepower_machines/machines/init.lua index d33661e..324ba32 100644 --- a/elepower_machines/machines/init.lua +++ b/elepower_machines/machines/init.lua @@ -1,4 +1,5 @@ +-- Basic dofile(elepm.modpath.."/machines/bases/init.lua") dofile(elepm.modpath.."/machines/accumulator.lua") dofile(elepm.modpath.."/machines/furnace.lua") @@ -10,3 +11,6 @@ dofile(elepm.modpath.."/machines/sawmill.lua") dofile(elepm.modpath.."/machines/generator.lua") dofile(elepm.modpath.."/machines/storage.lua") dofile(elepm.modpath.."/machines/lava_cooler.lua") + +-- Hardened +dofile(elepm.modpath.."/machines/assembler.lua") diff --git a/elepower_machines/textures/elepower_active_cooler.png b/elepower_machines/textures/elepower_active_cooler.png new file mode 100644 index 0000000..30195a6 Binary files /dev/null and b/elepower_machines/textures/elepower_active_cooler.png differ