]> git.lizzy.rs Git - dragonfireclient.git/commitdiff
Play place_failed sound if occupied or cannot attach (#9486)
authorWuzzy <wuzzy2@mail.ru>
Mon, 27 Jul 2020 17:40:33 +0000 (19:40 +0200)
committerGitHub <noreply@github.com>
Mon, 27 Jul 2020 17:40:33 +0000 (19:40 +0200)
doc/lua_api.txt
src/client/game.cpp

index e0c895c97c7c75e1b2b3fdd53546ecba096edba1..5fe02b4522d7e2f3b84041a361079870a32674a5 100644 (file)
@@ -7217,10 +7217,13 @@ Used by `minetest.register_node`.
             -- Node was placed. Also played after falling
 
             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>,
-            -- When node starts to fall
+            -- When node starts to fall or is detached
         },
 
         drop = "",
index 42d60b21cdd0712583712edfc028f2efd9eb66bd..20d2c6f90ab45145976ac658738a296ae1891802 100644 (file)
@@ -3379,6 +3379,7 @@ bool Game::nodePlacement(const ItemDefinition &selected_def,
                } else {
                        node = map.getNode(p, &is_valid_position);
                        if (is_valid_position && !nodedef->get(node).buildable_to) {
+                               soundmaker->m_player_rightpunch_sound = selected_def.sound_place_failed;
                                // Report to server
                                client->interact(INTERACT_PLACE, pointed);
                                return false;
@@ -3451,6 +3452,7 @@ bool Game::nodePlacement(const ItemDefinition &selected_def,
                        pp = p + v3s16(0, -1, 0);
 
                if (!nodedef->get(map.getNode(pp)).walkable) {
+                       soundmaker->m_player_rightpunch_sound = selected_def.sound_place_failed;
                        // Report to server
                        client->interact(INTERACT_PLACE, pointed);
                        return false;