Skip to content

Commit ae83edd

Browse files
authoredJul 27, 2020
Play place_failed sound if occupied or cannot attach (#9486)
1 parent 808fa5e commit ae83edd

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed
 

‎doc/lua_api.txt

+5-2
Original file line numberDiff line numberDiff line change
@@ -7217,10 +7217,13 @@ Used by `minetest.register_node`.
72177217
-- Node was placed. Also played after falling
72187218

72197219
place_failed = <SimpleSoundSpec>,
7220-
-- When node placement failed
7220+
-- When node placement failed.
7221+
-- Note: This happens if the _built-in_ node placement failed.
7222+
-- This sound will still be played if the node is placed in the
7223+
-- `on_place` callback manually.
72217224

72227225
fall = <SimpleSoundSpec>,
7223-
-- When node starts to fall
7226+
-- When node starts to fall or is detached
72247227
},
72257228

72267229
drop = "",

‎src/client/game.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -3379,6 +3379,7 @@ bool Game::nodePlacement(const ItemDefinition &selected_def,
33793379
} else {
33803380
node = map.getNode(p, &is_valid_position);
33813381
if (is_valid_position && !nodedef->get(node).buildable_to) {
3382+
soundmaker->m_player_rightpunch_sound = selected_def.sound_place_failed;
33823383
// Report to server
33833384
client->interact(INTERACT_PLACE, pointed);
33843385
return false;
@@ -3451,6 +3452,7 @@ bool Game::nodePlacement(const ItemDefinition &selected_def,
34513452
pp = p + v3s16(0, -1, 0);
34523453

34533454
if (!nodedef->get(map.getNode(pp)).walkable) {
3455+
soundmaker->m_player_rightpunch_sound = selected_def.sound_place_failed;
34543456
// Report to server
34553457
client->interact(INTERACT_PLACE, pointed);
34563458
return false;

0 commit comments

Comments
 (0)
Please sign in to comment.