From 87ae325e8f752b6e2edad69855e516b4894670c0 Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Mon, 4 Nov 2019 19:57:13 +0100 Subject: [PATCH] oil tank added --- liquids/tank.lua | 99 ++++++++++++++++++++++++++- textures/techage_appl_explosive.png | Bin 0 -> 217 bytes textures/techage_filling_metal.png | Bin 0 -> 296 bytes textures/techage_framexl_ta3.png | Bin 0 -> 792 bytes textures/techage_framexl_ta3_top.png | Bin 0 -> 583 bytes 5 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 textures/techage_appl_explosive.png create mode 100644 textures/techage_filling_metal.png create mode 100644 textures/techage_framexl_ta3.png create mode 100644 textures/techage_framexl_ta3_top.png diff --git a/liquids/tank.lua b/liquids/tank.lua index dd8df09..d5ecb77 100644 --- a/liquids/tank.lua +++ b/liquids/tank.lua @@ -8,7 +8,7 @@ GPL v3 See LICENSE.txt for more information - TA3/TA4 Tank + TA3/TA4 Tank, Oil Tank ]]-- @@ -224,6 +224,90 @@ minetest.register_node("techage:ta3_tank", { sounds = default.node_sound_metal_defaults(), }) +minetest.register_node("techage:oiltank", { + description = S("Oil Tank"), + tiles = { + -- up, down, right, left, back, front + "techage_filling_metal.png^techage_framexl_ta3_top.png", + "techage_filling_metal.png^techage_framexl_ta3_top.png", + "techage_filling_metal.png^techage_framexl_ta3.png^techage_appl_explosive.png", + }, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = {-6/8, -6/8, -6/8, 6/8, 6/8, 6/8}, + }, + selection_box = { + type = "fixed", + fixed = {-6/8, -6/8, -6/8, 6/8, 6/8, 6/8}, + }, + collision_box = { + type = "fixed", + fixed = {-6/8, -6/8, -6/8, 6/8, 6/8, 6/8}, + }, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + inv:set_size('src', 1) + inv:set_size('dst', 1) + end, + after_place_node = function(pos, placer) + local meta = M(pos) + local mem = tubelib2.init_mem(pos) + mem.liquid = {} + local number = techage.add_node(pos, "techage:oiltank") + meta:set_string("node_number", number) + meta:set_string("owner", placer:get_player_name()) + meta:set_string("formspec", formspec(mem)) + meta:set_string("infotext", S("Oil Tank").." "..number) + Pipe:after_place_node(pos) + end, + tubelib2_on_update2 = function(pos, dir, tlib2, node) + liquid.update_network(pos) + end, + on_timer = function(pos, elapsed) + local mem = tubelib2.get_mem(pos) + mem.countdown = mem.countdown - 1 + M(pos):set_string("formspec", formspec(mem)) + return mem.countdown > 0 + end, + after_dig_node = function(pos, oldnode, oldmetadata, digger) + Pipe:after_dig_node(pos) + techage.remove_node(pos) + end, + liquid = { + capa = CAPACITY * 4, + peek = liquid.srv_peek, + put = function(pos, indir, name, amount) + local leftover = liquid.srv_put(pos, indir, name, amount) + local inv = M(pos):get_inventory() + if not inv:is_empty("src") and inv:is_empty("dst") then + fill_container(pos, inv) + end + return leftover + end, + take = liquid.srv_take, + }, + networks = { + pipe = { + sides = techage.networks.AllSides, -- Pipe connection sides + ntype = "tank", + }, + }, + on_rightclick = on_rightclick, + on_receive_fields = on_receive_fields, + can_dig = can_dig, + allow_metadata_inventory_put = allow_metadata_inventory_put, + allow_metadata_inventory_take = allow_metadata_inventory_take, + allow_metadata_inventory_move = allow_metadata_inventory_move, + on_metadata_inventory_put = on_metadata_inventory_put, + paramtype2 = "facedir", + on_rotate = screwdriver.disallow, + groups = {cracky=2}, + is_ground_content = false, + sounds = default.node_sound_metal_defaults(), +}) + minetest.register_node("techage:ta4_tank", { description = S("TA4 Tank"), tiles = { @@ -299,7 +383,7 @@ minetest.register_node("techage:ta4_tank", { sounds = default.node_sound_metal_defaults(), }) -techage.register_node({"techage:ta3_tank", "techage:ta4_tank"}, { +techage.register_node({"techage:ta3_tank", "techage:ta4_tank", "techage:oiltank"}, { on_pull_item = function(pos, in_dir, num) local inv = M(pos):get_inventory() if not inv:is_empty("dst") then @@ -339,7 +423,7 @@ techage.register_node({"techage:ta3_tank", "techage:ta4_tank"}, { end, }) -Pipe:add_secondary_node_names({"techage:ta3_tank", "techage:ta4_tank"}) +Pipe:add_secondary_node_names({"techage:ta3_tank", "techage:ta4_tank", "techage:oiltank"}) minetest.register_craft({ output = "techage:ta3_tank 2", @@ -350,6 +434,15 @@ minetest.register_craft({ }, }) +minetest.register_craft({ + output = "techage:oiltank", + recipe = { + {"", "", ""}, + {"techage:ta3_tank", "techage:iron_ingot", ""}, + {"techage:iron_ingot", "techage:ta3_tank", ""}, + }, +}) + minetest.register_craft({ output = "techage:ta4_tank", recipe = { diff --git a/textures/techage_appl_explosive.png b/textures/techage_appl_explosive.png new file mode 100644 index 0000000000000000000000000000000000000000..39706f98a283dcbafb14ec99d6ba10a9e24271ed GIT binary patch literal 217 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI z1_o|n5N2eUHAey{$X?><>&pI^n?*=lKW*!!CqSVzPZ!6Kh{MSV60D08mN2_1UH!X! z>Q9{`v%Z{|Z8H1mHlgKxog&WD?VBzNS%G}U;vjb? zhIQv;UIICs1s;*b3=G`DAk4@xYmNj^kUzjD#5KRYwthx$MSn~GvYAmO**}jvf;2Dk zba4#PIG@^oQIJ`Y!=-$V$bw~zOPYCjpB(;|-Nnvv@9Fom$>ofVoUQkj=3o2ux|>xZ zRi!~nJfpU8CvRXgZ^?#c6Pqns8g-Y>d` ld_d)#4DQd5Ezka7e6h&*XsgH}1)ysgJYD@<);T3K0RR}UY$X5y literal 0 HcmV?d00001 diff --git a/textures/techage_framexl_ta3.png b/textures/techage_framexl_ta3.png new file mode 100644 index 0000000000000000000000000000000000000000..869208eddb8b1fc254c74ec2b0f1e44bcb17e80d GIT binary patch literal 792 zcmV+z1LypSP)GIPS(^b((Q-2$he!X>V`0m zSk;Z43*+d`Go{GRS}uz9OU=ReAKza4N5^)NS)QYmLPRj=0HjJ$iXbA4Moae)frgXBdQ>4O6<%1P2A$Oe6{2$by< z02GVDdl~LjK@^AHl+cx8t*cEHn13|o5rJY+Y&hUnLHa-1vF~PN4r#`~Wu}i5lr0W) zip3IBiiRL}SC@Myp|NNk%}V>a4gD<7?P2>z$1I

*oWcC*q02PYF$yk)cgjJ WEQ0i@@r7jo0000KWo&O1k;Jf(xTL5BsG4S6n>Qyd7&g#nq*SNRT@d-PE=Czz)k?w zIt5LL%1=vV8w>|Ohq+rU_ijFXeE+;ymRQ>WkmobJYbitk@Mn)mK@Zg$k%HEF(#+60 zALi1`{IRB1y*djBvE0dV^X2R3=kjhI4%zN@hzP2Rylez0M5t9!RW|E2+uaTT5xJTh zeh>HcFjZ@3L1JQz#>I_4ulfKfNI@kAl3z}Z7wD34;#AdWN9{u}BESdxk*=s>3m^4lI^s+!6p(hbrzXFj*Q+j3(AL!K00d z>QHqY_%94e4D>c|0$kbV(K%2Zj!{T>{Q2YJ2V#)0yqk9!*sRx4(w}AqcXCYn7AuAl zE|w+Jfh~VCV*Gn+8{Elt7chxo|FnG&DINg!`#nQ_=