diff options
author | Sebastian Rühl <bahamada_basti@yahoo.de> | 2011-06-26 12:24:32 +0200 |
---|---|---|
committer | Sebastian Rühl <bahamada_basti@yahoo.de> | 2011-06-26 12:24:32 +0200 |
commit | 033ae0dcaecc37fee487e44896a0c0fb4c844e4e (patch) | |
tree | 5c161b8031994d53cd851dad88b284475e7e429f /src/game.cpp | |
parent | a80025c352fb91ff295423940b3ded22755b70f0 (diff) | |
parent | e261cc9e8fa67c9020fa0a82bd1a7041ecd351a0 (diff) | |
download | minetest-033ae0dcaecc37fee487e44896a0c0fb4c844e4e.tar.gz minetest-033ae0dcaecc37fee487e44896a0c0fb4c844e4e.tar.bz2 minetest-033ae0dcaecc37fee487e44896a0c0fb4c844e4e.zip |
Merge branch 'master' of https://github.com/erlehmann/minetest-delta.git into upstream_merge
Conflicts:
.gitignore
CMakeLists.txt
data/heart.png
src/CMakeLists.txt
src/game.cpp
src/guiMainMenu.cpp
src/inventory.cpp
src/map.cpp
src/mapblock.cpp
src/mapnode.cpp
src/mapnode.h
src/materials.cpp
src/server.cpp
Signed-off-by: Sebastian Rühl <bahamada_basti@yahoo.de>
Diffstat (limited to 'src/game.cpp')
-rw-r--r-- | src/game.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/game.cpp b/src/game.cpp index f3fac0c84..5632c1805 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -534,6 +534,43 @@ void getPointedNode(Client *client, v3f player_position, } } } + else if(n.d == CONTENT_RAIL) + { + v3s16 dir = unpackDir(n.dir); + v3f dir_f = v3f(dir.X, dir.Y, dir.Z); + dir_f *= BS/2 - BS/6 - BS/20; + v3f cpf = npf + dir_f; + f32 distance = (cpf - camera_position).getLength(); + + float d = (float)BS/16; + v3f vertices[4] = + { + v3f(BS/2, -BS/2+d, -BS/2), + v3f(-BS/2, -BS/2, BS/2), + }; + + for(s32 i=0; i<2; i++) + { + vertices[i] += npf; + } + + core::aabbox3d<f32> box; + + box = core::aabbox3d<f32>(vertices[0]); + box.addInternalPoint(vertices[1]); + + if(distance < mindistance) + { + if(box.intersectsWithLine(shootline)) + { + nodefound = true; + nodepos = np; + neighbourpos = np; + mindistance = distance; + nodehilightbox = box; + } + } + } /* Regular blocks */ |