From b36d718ec69723ff8efbfa566700cabf410817f6 Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Sat, 30 Jun 2018 22:23:30 +0300 Subject: [PATCH] unfinished business --- elepower_dynamics/compat/init.lua | 3 +++ elepower_dynamics/{ => compat}/plastic.lua | 0 elepower_dynamics/craftitems.lua | 6 +++++ elepower_dynamics/init.lua | 2 +- elepower_dynamics/textures/elepower_ic_3.png | Bin 0 -> 2490 bytes elepower_machines/formspec.lua | 22 +++++++++++++++++- elepower_machines/machines/assembler.lua | 17 ++++++++++++++ elepower_machines/machines/bases/crafter.lua | 15 +++++++----- elepower_machines/machines/init.lua | 4 ++++ .../textures/elepower_active_cooler.png | Bin 0 -> 6863 bytes 10 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 elepower_dynamics/compat/init.lua rename elepower_dynamics/{ => compat}/plastic.lua (100%) create mode 100644 elepower_dynamics/textures/elepower_ic_3.png create mode 100644 elepower_machines/machines/assembler.lua create mode 100644 elepower_machines/textures/elepower_active_cooler.png 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 0000000000000000000000000000000000000000..431ea64e7ae0bf642a3bc6ec088bf9dd9997edee GIT binary patch literal 2490 zcmV;r2}SmaP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O1ewk|ZY#{pS=u0!S?4III!AfsgM8i0rDGp7A*B z%&1I~MF_p8rQ3|Z{+#9yT;weoACklzqs8U3&s5M5d#B?rl=q$-Pxb-dX8mdmh^gr zrt_zcZ!_R$*28n67@|uaPfs?bn9&xpKEZB%DLNbFwJuZ@^zm)(RDw=4*s;ZvmWB-V zS-9XG@g&Z)dJ@`xKP{^%fEF2>(9YMczrKE@xw)z<gyQr5 zw%>)Xe)9_H#_eV27@wWr`e#@MdATlX>o;eYImbC&@exOkdZ>Gp-NL-OthHA~+zG#6 zWf^UZ zm%n=$3VbF z$H7Hs6Ol>I!H@!g3REZdQ~`?%fjX2V&l~{`ya0P+O>%oG1v=dbga9ING;luwLIq%X zAHbjF1sp1YgAXCZkb;C9O60gaEXEX9L@kMvPa(yWlBAr95f(2&q9hT?QZi*m#0?q# zm?h_23N|f}T(G)eLMfFhS6@SoHC3s(mPV#=^DVU4Qj?Zj>D0Nyk9+K?OV7OwH$bJ~ zM;LLWAtR46LAA-#&oJXmQ)V`^Jg6zGKivNUHK(Z2Mrut=4{GR5>56bGoP>oL5F_sZ zcv=WJHbe_EE6#gb$SurlCU`|4C>a(w-7Um`pdXIHbPsl4$OVHi`oG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*qoM6N<$ Ef}Wj~1poj5 literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..30195a67d9325b11726f91e281edb713d3a00aa7 GIT binary patch literal 6863 zcmeHL2~-o;8V)L;Y()i8s1kw;E@6_%I*|a8H7EjtfD|80W+o&+7Lvh$P^D58R4hnE zToG3+)`FD9LJ<^;`z~$;K@?D0C|X((#Wx95@jYMP^PJan-aALm3CX?p`@j3&@BaUP z?@YS?LN8MzYa z*P`doO#JcdF~&1*iT3l`dg^*_=0(_r7(PGnV)fM+PumBa12;@M5+kRW9E(YwJ)>_^ z;oSY%<=e4#$8&%x+sjp+ck<4&-~Q&-Elb>TIQ5)-ZhZJwM#sakU-#vleAr_-*|VtL zGEV}&Y{7RwR}_?Rt^{RX zIzXOmvM(9Vm$DbCSC23WF*3UC7P{e=v#-9p-tExqY_!gM?d;&1Q}!jFiD+K?m;%!c z{`Ul%CpD}2E~z0S4X`y(P3^v?p?beY<$v=4%$AJwsI7RMmfUDec6TL{+zd=4UY@73 zemj45yj`Z=sA;ZI2$VWuT#Hd=tf|j=##f}Wo{a|&ojoysgXd^U9T#(|NT2@MoEZJS zR++2WG`h&6E`19*U=u?gl&fya*to5#r(wOOslR!z->lro)KON+qwUsMK-PG8dO`g} z(T16|k`rggC}ue9`x4q7TY_%+)C_713bhQ3&APu1$gkTpDI`6w+t35+Izov zJM(6;F}3V^R&*nNcYkG9Qb#~9UR)-9x$LE3gQVn#>_hn-Km)mVV2)t#&eP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