aboutsummaryrefslogtreecommitdiff
path: root/src/client/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/game.cpp')
-rw-r--r--src/client/game.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/client/game.cpp b/src/client/game.cpp
index 360ce4f8c..179557cf5 100644
--- a/src/client/game.cpp
+++ b/src/client/game.cpp
@@ -3585,22 +3585,30 @@ bool Game::nodePlacement(const ItemDefinition &selected_def,
}
// Check attachment if node is in group attached_node
- if (itemgroup_get(predicted_f.groups, "attached_node") != 0) {
- const static v3s16 wallmounted_dirs[8] = {
- v3s16(0, 1, 0),
- v3s16(0, -1, 0),
- v3s16(1, 0, 0),
- v3s16(-1, 0, 0),
- v3s16(0, 0, 1),
- v3s16(0, 0, -1),
- };
+ int an = itemgroup_get(predicted_f.groups, "attached_node");
+ if (an != 0) {
v3s16 pp;
- if (predicted_f.param_type_2 == CPT2_WALLMOUNTED ||
- predicted_f.param_type_2 == CPT2_COLORED_WALLMOUNTED)
+ if (an == 3) {
+ pp = p + v3s16(0, -1, 0);
+ } else if (an == 4) {
+ pp = p + v3s16(0, 1, 0);
+ } else if (an == 2) {
+ if (predicted_f.param_type_2 == CPT2_FACEDIR ||
+ predicted_f.param_type_2 == CPT2_COLORED_FACEDIR) {
+ pp = p + facedir_dirs[param2];
+ } else if (predicted_f.param_type_2 == CPT2_4DIR ||
+ predicted_f.param_type_2 == CPT2_COLORED_4DIR ) {
+ pp = p + fourdir_dirs[param2];
+ } else {
+ pp = p;
+ }
+ } else if (predicted_f.param_type_2 == CPT2_WALLMOUNTED ||
+ predicted_f.param_type_2 == CPT2_COLORED_WALLMOUNTED) {
pp = p + wallmounted_dirs[param2];
- else
+ } else {
pp = p + v3s16(0, -1, 0);
+ }
if (!nodedef->get(map.getNode(pp)).walkable) {
soundmaker->m_player_rightpunch_sound = selected_def.sound_place_failed;