From ca8929fa9d6064b67b64e595380eb907caa66986 Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Wed, 5 Jan 2022 21:41:30 +0100 Subject: [PATCH] Allow to turn the pusher with the new screwdriver --- basic_machines/consumer.lua | 2 ++ basic_machines/pusher.lua | 13 ++++++--- basis/command.lua | 7 ++--- init.lua | 4 +-- textures/techage_frame_ta2_bottom.png | Bin 0 -> 336 bytes textures/techage_frame_ta3_bottom.png | Bin 0 -> 331 bytes textures/techage_frame_ta4_bottom.png | Bin 0 -> 111 bytes tools/screwdriver.lua | 37 +++++++++++++++++--------- 8 files changed, 41 insertions(+), 22 deletions(-) create mode 100644 textures/techage_frame_ta2_bottom.png create mode 100644 textures/techage_frame_ta3_bottom.png create mode 100644 textures/techage_frame_ta4_bottom.png diff --git a/basic_machines/consumer.lua b/basic_machines/consumer.lua index b75fd0d..ff2eb18 100644 --- a/basic_machines/consumer.lua +++ b/basic_machines/consumer.lua @@ -229,6 +229,7 @@ function techage.register_consumer(base_name, inv_name, tiles, tNode, validState on_metadata_inventory_move = tNode.on_metadata_inventory_move, on_metadata_inventory_put = tNode.on_metadata_inventory_put, on_metadata_inventory_take = tNode.on_metadata_inventory_take, + ta_rotate_node = tNode.ta_rotate_node, paramtype = tNode.paramtype, paramtype2 = "facedir", @@ -269,6 +270,7 @@ function techage.register_consumer(base_name, inv_name, tiles, tNode, validState on_metadata_inventory_move = tNode.on_metadata_inventory_move, on_metadata_inventory_put = tNode.on_metadata_inventory_put, on_metadata_inventory_take = tNode.on_metadata_inventory_take, + ta_rotate_node = tNode.ta_rotate_node, paramtype = tNode.paramtype, paramtype2 = "facedir", diff --git a/basic_machines/pusher.lua b/basic_machines/pusher.lua index 9568d8a..fd03895 100644 --- a/basic_machines/pusher.lua +++ b/basic_machines/pusher.lua @@ -197,7 +197,7 @@ local tiles = {} -- '{power}' will be replaced by the power PNG tiles.pas = { "techage_filling_ta#.png^techage_frame_ta#_top.png^techage_appl_arrow.png", - "techage_filling_ta#.png^techage_frame_ta#.png", + "techage_filling_ta#.png^techage_frame_ta#_bottom.png^techage_appl_arrow.png", "techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_outp.png", "techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_inp.png", "techage_appl_pusher.png^[transformR180]^techage_frame_ta#.png", @@ -206,7 +206,7 @@ tiles.pas = { tiles.act = { -- up, down, right, left, back, front "techage_filling_ta#.png^techage_frame_ta#_top.png^techage_appl_arrow.png", - "techage_filling_ta#.png^techage_frame_ta#.png", + "techage_filling_ta#.png^techage_frame_ta#_bottom.png^techage_appl_arrow.png", "techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_outp.png", "techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_inp.png", { @@ -277,7 +277,14 @@ local node_name_ta2, node_name_ta3, node_name_ta4 = M(pos):set_string("formspec", ta4_formspec(CRD(pos).State, pos, nvm)) end end, - + ta_rotate_node = function(pos, node, new_param2) + Tube:after_dig_node(pos) + minetest.swap_node(pos, {name = node.name, param2 = new_param2}) + Tube:after_place_node(pos) + local meta = M(pos) + meta:set_int("pull_dir", techage.side_to_outdir("L", new_param2)) + meta:set_int("push_dir", techage.side_to_outdir("R", new_param2)) + end, allow_metadata_inventory_put = allow_metadata_inventory_put, allow_metadata_inventory_take = allow_metadata_inventory_take, on_rightclick = on_rightclick, diff --git a/basis/command.lua b/basis/command.lua index a32f218..f2b4362 100644 --- a/basis/command.lua +++ b/basis/command.lua @@ -28,6 +28,7 @@ local NodeDef = techage.NodeDef local Tube = techage.Tube local is_cart_available = minecart.is_nodecart_available local techage_counting_hit = techage.counting_hit +local tubelib2_side_to_dir = tubelib2.side_to_dir ------------------------------------------------------------------- -- Database @@ -125,11 +126,7 @@ end local SideToDir = {B=1, R=2, F=3, L=4, D=5, U=6} local function side_to_dir(side, param2) - local dir = SideToDir[side] - if dir < 5 then - dir = (((dir - 1) + (param2 % 4)) % 4) + 1 - end - return dir + return tubelib2_side_to_dir(side, param2) end techage.side_to_outdir = side_to_dir diff --git a/init.lua b/init.lua index 71f83e4..fe7b60c 100644 --- a/init.lua +++ b/init.lua @@ -24,8 +24,8 @@ elseif minetest.global_exists("ironage") then elseif minetest.global_exists("techpack") then minetest.log("error", "[techage] Techage can't be used together with the modpack techpack!") return -elseif minetest.global_exists("tubelib2") and tubelib2.version < 1.9 then - minetest.log("error", "[techage] Techage requires tubelib2 version 1.9 or newer!") +elseif minetest.global_exists("tubelib2") and tubelib2.version < 2.2 then + minetest.log("error", "[techage] Techage requires tubelib2 version 2.2 or newer!") return elseif minetest.global_exists("minecart") and minecart.version < 1.08 then minetest.log("error", "[techage] Techage requires minecart version 1.08 or newer!") diff --git a/textures/techage_frame_ta2_bottom.png b/textures/techage_frame_ta2_bottom.png new file mode 100644 index 0000000000000000000000000000000000000000..f7ac529cc3a975912bc1f706563013cdfaaa0316 GIT binary patch literal 336 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnF3?v&v(vJfvi2$DvS0D`pi!1%scPFlFj@U9S zZ}sZcWu+xw-hOfcN-&iK`2~k$7pc760pvaPba4#PIG;Q5VBTQ`0hi_V7yd9kcy`XI zhCSzgWWl?w%J+qD-@hL*RcnLQ@#R-zw%hSu1Ydo^vuwe$PjjfLB2t94kI_+ShWhA6A{f^?fDF+nz$*gF6oX5PHGp zB0Awg2$QS&<=-V{u@g%$pTk-0vkHFZnvyVQhVH=`*_DnRWt8DRe$qt^YU+3zje4&?D)2m gv)cjc*Pvq)_*?^t-i<4wtM^e@Y)INUmXO$@Xc}hW?jLRw71#w!F0Zm6OZ}) zq)pV?N~HYzHA^47y5P7)-n(t(?4p=sD>lb{e6vr*`N=`6a;dtKs%wdkXO&C*?y`EB zr?S4@aJhKr@q(%?q28J!p_F_uTf#c4pxT#!{#UFIm>{QFnGH9xvX