Reverse directions holding the sneak key down

master
entuland 2018-06-20 10:18:52 +02:00
parent 77bb4c4a79
commit cbf1c137b6
2 changed files with 19 additions and 4 deletions

View File

@ -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):

View File

@ -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,