diff --git a/README.md b/README.md index bd610dd044968f76a7007b3c38bb4a08240030c9..07a9d049ed4d61c0a3f46d3a94d0a442473c67cb 100644 --- a/README.md +++ b/README.md @@ -47,10 +47,12 @@ Pretty simple: - a right click will rotate the face you're pointing in clockwise direction - the arrow in the Testing Cube shows how the face will rotate when right-clicked - `RT` in the tool stands for `rotate` + - hold the sneak key down while clicking to rotate counter-clockwise - a left click will rotate the node as if you "pushed" the closest edge you're pointing at - the colored edges in the Testing Cube indicate the color of the face you'll see when left-clicking near that edge - `PS` in the tool stands for `push` + - hold the sneak key down while clicking to "pull" instead of "pushing" The left-click interaction area is not limited to the edges you can see in the Testing Cube. In reality you can click anywhere in a triangle like this (highlighted here just for convenience, you won't see anything like this in the game): diff --git a/init.lua b/init.lua index 8156450b96a3b2affeece343ff1d05607e2d4b00..20cb0b97dd30647fbf858545d0ea21d4a9193b71 100644 --- a/init.lua +++ b/init.lua @@ -208,17 +208,30 @@ local function interact(itemstack, player, pointed_thing, click) local unit = extract_unit_vectors(player, pointed_thing) local transform = false - + local rotation = rot_matrices[1] + + local controls = player:get_player_control() + if click == PRIMARY_BTN then transform = dir_matrices[vector_to_dir_index(unit.thumb)] - notify(player:get_player_name(), "Pushed closest edge (left click)") + if controls.sneak then + rotation = rot_matrices[3] + notify(player:get_player_name(), "Pulled closest edge (sneak + left click)") + else + notify(player:get_player_name(), "Pushed closest edge (left click)") + end else transform = dir_matrices[vector_to_dir_index(unit.back)] - notify(player:get_player_name(), "Rotated pointed face (right click)") + if controls.sneak then + rotation = rot_matrices[3] + notify(player:get_player_name(), "Rotated pointed face counter-clockwise (sneak + right click)") + else + notify(player:get_player_name(), "Rotated pointed face clockwise (right click)") + end end local start = get_facedir_transform(node.param2) - local stop = transform * rot_matrices[1] * transform:invert() * start + local stop = transform * rotation * transform:invert() * start minetest.set_node(pointed_thing.under,{ name = node.name,