Allow rotation with a screwdriver

This commit is contained in:
Joachim Stolberg 2023-08-28 17:03:17 +02:00
parent 14440f0cad
commit 7871b81c2a

View File

@ -19,6 +19,7 @@ local S = techage.S
-- Consumer Related Data -- Consumer Related Data
local CRD = function(pos) return (minetest.registered_nodes[techage.get_node_lvm(pos).name] or {}).consumer end local CRD = function(pos) return (minetest.registered_nodes[techage.get_node_lvm(pos).name] or {}).consumer end
local tooltip = S("Switch to pull mode \nto pull items out of inventory slots \naccording the injector configuration") local tooltip = S("Switch to pull mode \nto pull items out of inventory slots \naccording the injector configuration")
local Tube = techage.Tube
local STANDBY_TICKS = 2 local STANDBY_TICKS = 2
local COUNTDOWN_TICKS = 3 local COUNTDOWN_TICKS = 3
@ -270,6 +271,18 @@ local _, node_name_ta3, node_name_ta4 =
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
M(pos):set_string("formspec", formspec(CRD(pos).State, pos, nvm)) M(pos):set_string("formspec", formspec(CRD(pos).State, pos, nvm))
end, end,
ta_rotate_node = function(pos, node, new_param2)
local nvm = techage.get_nvm(pos)
if CRD(pos).State:get_state(nvm) == techage.STOPPED then
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))
M(pos):set_string("formspec", formspec(CRD(pos).State, pos, nvm))
end
end,
allow_metadata_inventory_put = allow_metadata_inventory_put, allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_take = allow_metadata_inventory_take, allow_metadata_inventory_take = allow_metadata_inventory_take,