From a56af3dabd07b2850d5856c33f892dcfc9617424 Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Mon, 25 Jun 2018 22:01:17 +0300 Subject: [PATCH] New machine: Lava Cooler --- elepower_dynamics/craftitems.lua | 2 +- .../textures/elepower_capacitor.png | Bin 1963 -> 1807 bytes elepower_machines/crafting.lua | 21 +++ elepower_machines/formspec.lua | 34 +++++ .../machines/coal_alloy_furnace.lua | 8 +- elepower_machines/machines/init.lua | 1 + elepower_machines/machines/lava_cooler.lua | 124 ++++++++++++++++++ .../textures/elepower_lava_cooler.png | Bin 0 -> 6861 bytes 8 files changed, 184 insertions(+), 6 deletions(-) create mode 100644 elepower_machines/machines/lava_cooler.lua create mode 100644 elepower_machines/textures/elepower_lava_cooler.png diff --git a/elepower_dynamics/craftitems.lua b/elepower_dynamics/craftitems.lua index 28fbdcd..9c5b07c 100644 --- a/elepower_dynamics/craftitems.lua +++ b/elepower_dynamics/craftitems.lua @@ -103,7 +103,7 @@ minetest.register_craftitem("elepower_dynamics:acidic_compound", { local pos = pointed_thing.under local node = minetest.get_node(pos) - if not node.name == "water_source" then + if node.name ~= "default:water_source" then return itemstack end diff --git a/elepower_dynamics/textures/elepower_capacitor.png b/elepower_dynamics/textures/elepower_capacitor.png index 499ddc4ced6f330fe37b12f8e294a21ad8324414..ac1c9e8d7d195119cf7862e6c6cc9e990bfb3600 100644 GIT binary patch delta 1699 zcmV;U23+~8504IzLVw*?S#sqz4E*OQas&cg03L^HRc?^ur@1{pdp!1=$$UjBiK~bP z8UQKN|M`2Ezi=^&H$I5Q6r;uElTVycQM<3a-emoHpN74acm3uu!02))-EL|;{T=;` z`F#58Stp}EJS~*^87S`u@>z)W2)GiDAV*t(Jqw$B7IJ(f`+waoTP+)t%Cidf%pYfb znE{WPFYkn7h$J3w&sHQR)RnCl*sV>VqjH+xg>n}9&^C7}0~2>g&f?7zp#yxUE~AWi zvkN?X81;aA_VY#xw%AxfJzcwgeSL-8T z=9$vP+mqxNAAgeH^-Gur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PsaN_o5i7>^R$tIEjCusPuH$LzkY_?T8my9}fqa$< zcaTZ=gN4?%X>C_2V&g{9z&i-SX!^;o+~%D{W6XdevVZZh6>#y4G@zKw5gAKZ21aNc zqxxmwdw;zquL1`BGINB2*_J5*^cPPb&LxXz!9tIA2QXLPq7 zd-2YDAAh|1=#$Su!i=yGG|Y^eRn)21psG=mW)mg4=wpZ)V@xq8PJ)c<6XG$&lv2*v zG(&R6*BJ|PE?lIz;!7x6Vo4=eHdU&tzJ{tb)>L!jCJk}iLemyoYPnN~D|Od>4_$lg zspkP#8#3JRBMcpJBs22E+M)G_`ya4Ihc#YI&3}dZu!dRHD}rV^@sl$!#*RR^P6kK} z^W@A%a*ii+lQWwbQQ;XN{UoQ+WDE?tPV5Ig+EQhg0o^ z8Gj1r)f=_d;p%tt%)bTF)9#Jt-Qb$dMxYf;)B|T$61!!;dKF1|Aub(9O&aixJsjkv zZEb+aZnfTTCD$z{+94mt&VFO+DQLl>H9vu$6%G-yV1p{lJNR7`$T-zFBR3%8s%C9 zfxTWdih{eu{Ey~gzUOxREuow#s%v>z(QUpy~Uaw|k$wK5qCO zHAK%h8~NB-(l{<866=c(n12`Y*MA4*;gy%?nq`SzalW_fy*6aonBdbVMe#8*4r)zj zA?jI&>T{0_l1J=5?A>rCzNCQqehN6LcBX(T`NS@|1(feWa(xa@hD043ab{nA`5soo zrW2Rld;%9^zMt!sAlED3Afg^5H&WaIx9~Rnm3_ zGC(6Kf)iDgkZflO5QG$h@Ftg0wta1`iOF7NCfNYTuVJ1i;pATN=&<4LPUj)Mz?&^6Mq3`reQTW usage then + if coolant_buffer.amount >= 1000 and hot_buffer.amount >= 1000 then + if time >= TIME then + local room_for_output = true + local output_stacks = {recipe} + inv:set_size("dst_tmp", inv:get_size("dst")) + inv:set_list("dst_tmp", inv:get_list("dst")) + + for _, o in ipairs(output_stacks) do + if not inv:room_for_item("dst_tmp", o) then + room_for_output = false + break + end + inv:add_item("dst_tmp", o) + end + + if room_for_output then + inv:set_list("dst", inv:get_list("dst_tmp")) + time = 0 + refresh = true + fluid_lib.take_from_buffer(pos, "coolant", consume.water) + fluid_lib.take_from_buffer(pos, "hot", consume.lava) + end + else + time = time + 1 + storage = storage - usage + refresh = true + end + else + refresh = false + end + end + + local power = math.floor(100 * storage / capacity) + local timer = math.floor(100 * time / TIME) + + meta:set_int("src_time", time) + meta:set_int("storage", storage) + + meta:set_string("formspec", elepm.get_lava_cooler_formspec(timer, coolant_buffer, hot_buffer, + power, cooler_recipes, recipe)) + + return refresh +end + +ele.register_machine("elepower_machines:lava_cooler", { + description = "Lava Cooler", + groups = {ele_machine = 1, ele_user = 1, cracky = 2, oddly_breakable_by_hand = 1, fluid_container = 1}, + fluid_buffers = { + coolant = { + capacity = 8000, + accepts = {"default:water_source"}, + }, + hot = { + capacity = 8000, + accepts = {"default:lava_source"}, + } + }, + tiles = { + "elepower_machine_top.png", "elepower_machine_base.png", "elepower_machine_side.png", + "elepower_machine_side.png", "elepower_machine_side.png", "elepower_lava_cooler.png", + }, + on_construct = function (pos) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + + inv:set_size("dst", 1) + + meta:set_string("recipe", "default:cobble") + meta:set_string("formspec", elepm.get_lava_cooler_formspec(0,nil,nil,0,cooler_recipes, "default:cobble")) + end, + on_timer = lava_cooler_timer, + on_receive_fields = function (pos, formname, fields, sender) + local meta = minetest.get_meta(pos) + local frecipe = nil + + for f in pairs(fields) do + if cooler_recipes[f] then + frecipe = f + break + end + end + + if frecipe then + meta:set_string("recipe", frecipe) + minetest.get_node_timer(pos):start(1.0) + end + end, +}) diff --git a/elepower_machines/textures/elepower_lava_cooler.png b/elepower_machines/textures/elepower_lava_cooler.png new file mode 100644 index 0000000000000000000000000000000000000000..f5d5a1652f8ec544f8c8b416b839418bf2a1f1a7 GIT binary patch literal 6861 zcmeHL2~<`cSfkZ4q0dW8otT@yO z(JF$V)Cr10QAEX|0uI!nI8?AW0$Qbr{Fgu#|M%PPTJ2iDYsp$6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