forked from Mirrorlandia_minetest/minetest
Play place_failed sound if occupied or cannot attach (#9486)
This commit is contained in:
parent
808fa5ecb3
commit
ae83edd165
@ -7217,10 +7217,13 @@ Used by `minetest.register_node`.
|
|||||||
-- Node was placed. Also played after falling
|
-- Node was placed. Also played after falling
|
||||||
|
|
||||||
place_failed = <SimpleSoundSpec>,
|
place_failed = <SimpleSoundSpec>,
|
||||||
-- When node placement failed
|
-- When node placement failed.
|
||||||
|
-- Note: This happens if the _built-in_ node placement failed.
|
||||||
|
-- This sound will still be played if the node is placed in the
|
||||||
|
-- `on_place` callback manually.
|
||||||
|
|
||||||
fall = <SimpleSoundSpec>,
|
fall = <SimpleSoundSpec>,
|
||||||
-- When node starts to fall
|
-- When node starts to fall or is detached
|
||||||
},
|
},
|
||||||
|
|
||||||
drop = "",
|
drop = "",
|
||||||
|
@ -3379,6 +3379,7 @@ bool Game::nodePlacement(const ItemDefinition &selected_def,
|
|||||||
} else {
|
} else {
|
||||||
node = map.getNode(p, &is_valid_position);
|
node = map.getNode(p, &is_valid_position);
|
||||||
if (is_valid_position && !nodedef->get(node).buildable_to) {
|
if (is_valid_position && !nodedef->get(node).buildable_to) {
|
||||||
|
soundmaker->m_player_rightpunch_sound = selected_def.sound_place_failed;
|
||||||
// Report to server
|
// Report to server
|
||||||
client->interact(INTERACT_PLACE, pointed);
|
client->interact(INTERACT_PLACE, pointed);
|
||||||
return false;
|
return false;
|
||||||
@ -3451,6 +3452,7 @@ bool Game::nodePlacement(const ItemDefinition &selected_def,
|
|||||||
pp = p + v3s16(0, -1, 0);
|
pp = p + v3s16(0, -1, 0);
|
||||||
|
|
||||||
if (!nodedef->get(map.getNode(pp)).walkable) {
|
if (!nodedef->get(map.getNode(pp)).walkable) {
|
||||||
|
soundmaker->m_player_rightpunch_sound = selected_def.sound_place_failed;
|
||||||
// Report to server
|
// Report to server
|
||||||
client->interact(INTERACT_PLACE, pointed);
|
client->interact(INTERACT_PLACE, pointed);
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user