summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorSebastian Rühl <bahamada_basti@yahoo.de>2011-06-26 12:24:32 +0200
committerSebastian Rühl <bahamada_basti@yahoo.de>2011-06-26 12:24:32 +0200
commit9d09103e481c4979ebb0130a9dee6265d0d6223b (patch)
treec1c89aa8868975537758fe77a2b174d8ae3e5ed3 /src/game.cpp
parenta80025c352fb91ff295423940b3ded22755b70f0 (diff)
parent158b054e72582005d895f1ed0e1cb0c9b22a8e57 (diff)
downloadminetest-9d09103e481c4979ebb0130a9dee6265d0d6223b.tar.gz
minetest-9d09103e481c4979ebb0130a9dee6265d0d6223b.tar.bz2
minetest-9d09103e481c4979ebb0130a9dee6265d0d6223b.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.cpp37
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
*/