Allow to turn the pusher with the new screwdriver
This commit is contained in:
parent
d7f0dbc50d
commit
ca8929fa9d
@ -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_move = tNode.on_metadata_inventory_move,
|
||||||
on_metadata_inventory_put = tNode.on_metadata_inventory_put,
|
on_metadata_inventory_put = tNode.on_metadata_inventory_put,
|
||||||
on_metadata_inventory_take = tNode.on_metadata_inventory_take,
|
on_metadata_inventory_take = tNode.on_metadata_inventory_take,
|
||||||
|
ta_rotate_node = tNode.ta_rotate_node,
|
||||||
|
|
||||||
paramtype = tNode.paramtype,
|
paramtype = tNode.paramtype,
|
||||||
paramtype2 = "facedir",
|
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_move = tNode.on_metadata_inventory_move,
|
||||||
on_metadata_inventory_put = tNode.on_metadata_inventory_put,
|
on_metadata_inventory_put = tNode.on_metadata_inventory_put,
|
||||||
on_metadata_inventory_take = tNode.on_metadata_inventory_take,
|
on_metadata_inventory_take = tNode.on_metadata_inventory_take,
|
||||||
|
ta_rotate_node = tNode.ta_rotate_node,
|
||||||
|
|
||||||
paramtype = tNode.paramtype,
|
paramtype = tNode.paramtype,
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
|
@ -197,7 +197,7 @@ local tiles = {}
|
|||||||
-- '{power}' will be replaced by the power PNG
|
-- '{power}' will be replaced by the power PNG
|
||||||
tiles.pas = {
|
tiles.pas = {
|
||||||
"techage_filling_ta#.png^techage_frame_ta#_top.png^techage_appl_arrow.png",
|
"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_outp.png",
|
||||||
"techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_inp.png",
|
"techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_inp.png",
|
||||||
"techage_appl_pusher.png^[transformR180]^techage_frame_ta#.png",
|
"techage_appl_pusher.png^[transformR180]^techage_frame_ta#.png",
|
||||||
@ -206,7 +206,7 @@ tiles.pas = {
|
|||||||
tiles.act = {
|
tiles.act = {
|
||||||
-- up, down, right, left, back, front
|
-- 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#_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_outp.png",
|
||||||
"techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_inp.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))
|
M(pos):set_string("formspec", ta4_formspec(CRD(pos).State, pos, nvm))
|
||||||
end
|
end
|
||||||
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_put = allow_metadata_inventory_put,
|
||||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||||
on_rightclick = on_rightclick,
|
on_rightclick = on_rightclick,
|
||||||
|
@ -28,6 +28,7 @@ local NodeDef = techage.NodeDef
|
|||||||
local Tube = techage.Tube
|
local Tube = techage.Tube
|
||||||
local is_cart_available = minecart.is_nodecart_available
|
local is_cart_available = minecart.is_nodecart_available
|
||||||
local techage_counting_hit = techage.counting_hit
|
local techage_counting_hit = techage.counting_hit
|
||||||
|
local tubelib2_side_to_dir = tubelib2.side_to_dir
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
-- Database
|
-- Database
|
||||||
@ -125,11 +126,7 @@ end
|
|||||||
local SideToDir = {B=1, R=2, F=3, L=4, D=5, U=6}
|
local SideToDir = {B=1, R=2, F=3, L=4, D=5, U=6}
|
||||||
|
|
||||||
local function side_to_dir(side, param2)
|
local function side_to_dir(side, param2)
|
||||||
local dir = SideToDir[side]
|
return tubelib2_side_to_dir(side, param2)
|
||||||
if dir < 5 then
|
|
||||||
dir = (((dir - 1) + (param2 % 4)) % 4) + 1
|
|
||||||
end
|
|
||||||
return dir
|
|
||||||
end
|
end
|
||||||
|
|
||||||
techage.side_to_outdir = side_to_dir
|
techage.side_to_outdir = side_to_dir
|
||||||
|
4
init.lua
4
init.lua
@ -24,8 +24,8 @@ elseif minetest.global_exists("ironage") then
|
|||||||
elseif minetest.global_exists("techpack") then
|
elseif minetest.global_exists("techpack") then
|
||||||
minetest.log("error", "[techage] Techage can't be used together with the modpack techpack!")
|
minetest.log("error", "[techage] Techage can't be used together with the modpack techpack!")
|
||||||
return
|
return
|
||||||
elseif minetest.global_exists("tubelib2") and tubelib2.version < 1.9 then
|
elseif minetest.global_exists("tubelib2") and tubelib2.version < 2.2 then
|
||||||
minetest.log("error", "[techage] Techage requires tubelib2 version 1.9 or newer!")
|
minetest.log("error", "[techage] Techage requires tubelib2 version 2.2 or newer!")
|
||||||
return
|
return
|
||||||
elseif minetest.global_exists("minecart") and minecart.version < 1.08 then
|
elseif minetest.global_exists("minecart") and minecart.version < 1.08 then
|
||||||
minetest.log("error", "[techage] Techage requires minecart version 1.08 or newer!")
|
minetest.log("error", "[techage] Techage requires minecart version 1.08 or newer!")
|
||||||
|
BIN
textures/techage_frame_ta2_bottom.png
Normal file
BIN
textures/techage_frame_ta2_bottom.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 336 B |
BIN
textures/techage_frame_ta3_bottom.png
Normal file
BIN
textures/techage_frame_ta3_bottom.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 331 B |
BIN
textures/techage_frame_ta4_bottom.png
Normal file
BIN
textures/techage_frame_ta4_bottom.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 111 B |
@ -41,14 +41,13 @@ local function base_checks(user, pointed_thing)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
if ndef.on_rotate == screwdriver.disallow then
|
if ndef.on_rotate == screwdriver.disallow and not ndef.ta_rotate_node then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
local yaw = user:get_look_horizontal()
|
local yaw = user:get_look_horizontal()
|
||||||
local dir = minetest.yaw_to_dir(yaw)
|
local dir = minetest.yaw_to_dir(yaw)
|
||||||
local facedir = minetest.dir_to_facedir(dir)
|
local facedir = minetest.dir_to_facedir(dir)
|
||||||
print("base_checks", facedir, ndef.paramtype2)
|
|
||||||
|
|
||||||
return true, pos, player_name, facedir, node, ndef
|
return true, pos, player_name, facedir, node, ndef
|
||||||
end
|
end
|
||||||
@ -59,22 +58,36 @@ local function store_node_param2(user, node)
|
|||||||
minetest.chat_send_player(user:get_player_name(), S("Block alignment stored!"))
|
minetest.chat_send_player(user:get_player_name(), S("Block alignment stored!"))
|
||||||
end
|
end
|
||||||
|
|
||||||
local function turn_node_param2(pos, node, user)
|
local function turn_node_param2(pos, node, ndef, user)
|
||||||
local param2 = user:get_meta():get_string("techage_screwdriver_param2")
|
local param2 = user:get_meta():get_string("techage_screwdriver_param2")
|
||||||
minetest.swap_node(pos, {name = node.name, param2 = param2})
|
if ndef.ta_rotate_node then
|
||||||
|
ndef.ta_rotate_node(pos, node, param2)
|
||||||
|
else
|
||||||
|
minetest.swap_node(pos, {name = node.name, param2 = param2})
|
||||||
|
minetest.check_for_falling(pos)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function turn_left(pos, node)
|
local function turn_left(pos, node, ndef)
|
||||||
local param2 = techage.param2_turn_left(node.param2)
|
local param2 = techage.param2_turn_left(node.param2)
|
||||||
minetest.swap_node(pos, {name = node.name, param2 = param2})
|
if ndef.ta_rotate_node then
|
||||||
|
ndef.ta_rotate_node(pos, node, param2)
|
||||||
|
else
|
||||||
|
minetest.swap_node(pos, {name = node.name, param2 = param2})
|
||||||
|
minetest.check_for_falling(pos)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function turn_up(pos, node, facedir)
|
local function turn_up(pos, node, ndef, facedir)
|
||||||
local param2 = techage.param2_turn_up(facedir, node.param2)
|
local param2 = techage.param2_turn_up(facedir, node.param2)
|
||||||
minetest.swap_node(pos, {name = node.name, param2 = param2})
|
if ndef.ta_rotate_node then
|
||||||
|
ndef.ta_rotate_node(pos, node, param2)
|
||||||
|
else
|
||||||
|
minetest.swap_node(pos, {name = node.name, param2 = param2})
|
||||||
|
minetest.check_for_falling(pos)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- on_use == on_left_click == turn left
|
-- on_use == on_left_click == turn left
|
||||||
local function on_use(itemstack, user, pointed_thing)
|
local function on_use(itemstack, user, pointed_thing)
|
||||||
local res, pos, player_name, facedir, node, ndef = base_checks(user, pointed_thing)
|
local res, pos, player_name, facedir, node, ndef = base_checks(user, pointed_thing)
|
||||||
@ -83,7 +96,7 @@ local function on_use(itemstack, user, pointed_thing)
|
|||||||
if user:get_player_control().sneak then
|
if user:get_player_control().sneak then
|
||||||
store_node_param2(user, node)
|
store_node_param2(user, node)
|
||||||
else
|
else
|
||||||
turn_left(pos, node)
|
turn_left(pos, node, ndef)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return screwdriver.handler(itemstack, user, pointed_thing, screwdriver.ROTATE_FACE, USES)
|
return screwdriver.handler(itemstack, user, pointed_thing, screwdriver.ROTATE_FACE, USES)
|
||||||
@ -103,9 +116,9 @@ local function on_place(itemstack, user, pointed_thing)
|
|||||||
if ndef.paramtype2 == "facedir" then
|
if ndef.paramtype2 == "facedir" then
|
||||||
if ndef.on_rotate ~= screwdriver.rotate_simple then
|
if ndef.on_rotate ~= screwdriver.rotate_simple then
|
||||||
if user:get_player_control().sneak then
|
if user:get_player_control().sneak then
|
||||||
turn_node_param2(pos, node, user)
|
turn_node_param2(pos, node, ndef, user)
|
||||||
else
|
else
|
||||||
turn_up(pos, node, facedir)
|
turn_up(pos, node, ndef, facedir)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return itemstack
|
return itemstack
|
||||||
|
Loading…
Reference in New Issue
Block a user