From d1aec15057410194dfd1089efd2194ca1bef064f Mon Sep 17 00:00:00 2001 From: oilboi <47129783+oilboi@users.noreply.github.com> Date: Wed, 4 Mar 2020 17:34:48 -0500 Subject: [PATCH] Move placing sound serverside --- mods/craftingtable/init.lua | 2 +- mods/main/sounds.lua | 10 +++++----- mods/player/init.lua | 12 ++++++++++-- todo.txt | 8 ++------ 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/mods/craftingtable/init.lua b/mods/craftingtable/init.lua index 01c66e8..9323ba6 100644 --- a/mods/craftingtable/init.lua +++ b/mods/craftingtable/init.lua @@ -2,7 +2,7 @@ minetest.register_node("craftingtable:craftingtable", { description = "Crafting Table", - tiles = {"crafting_workbench_top.png", "default_wood.png", "crafting_workbench_side.png", + tiles = {"crafting_workbench_top.png", "wood.png", "crafting_workbench_side.png", "crafting_workbench_side.png", "crafting_workbench_front.png", "crafting_workbench_front.png"}, groups = {wood = 1, hard = 1, axe = 1, hand = 3,pathable = 1}, sounds = main.woodSound(), diff --git a/mods/main/sounds.lua b/mods/main/sounds.lua index 746a2bd..3d25511 100644 --- a/mods/main/sounds.lua +++ b/mods/main/sounds.lua @@ -6,7 +6,7 @@ function main.stoneSound(table) {name = "stone", gain = 0.1} table.dug = table.dug or {name = "stone", gain = 1.0} - table.place = table.place or + table.placing = table.placing or {name = "stone", gain = 1.0} --default.node_sound_defaults(table) return table @@ -20,7 +20,7 @@ function main.woodSound(table) {name = "wood", gain = 0.2} table.dug = table.dug or {name = "wood", gain = 1.0} - table.place = table.place or + table.placing = table.placing or {name = "wood", gain = 1.0} --default.node_sound_defaults(table) return table @@ -35,7 +35,7 @@ function main.sandSound(table) {name = "sand", gain = 0.07} table.dug = table.dug or {name = "sand", gain = 0.09} - table.place = table.place or + table.placing = table.placing or {name = "sand", gain = 0.09} table.fall = table.fall or {name = "sand", gain = 0.01} @@ -51,7 +51,7 @@ function main.grassSound(table) {name = "leaves", gain = 0.2} table.dug = table.dug or {name = "leaves", gain = 1.0} - table.place = table.place or + table.placing = table.placing or {name = "leaves", gain = 0.5} --default.node_sound_defaults(table) return table @@ -64,7 +64,7 @@ function main.dirtSound(table) {name = "dirt", gain = 0.3} table.dug = table.dug or {name = "dirt", gain = 1.0} - table.place = table.place or + table.placing = table.placing or {name = "dirt", gain = 0.5} --default.node_sound_defaults(table) return table diff --git a/mods/player/init.lua b/mods/player/init.lua index 5deda04..66a0c8e 100644 --- a/mods/player/init.lua +++ b/mods/player/init.lua @@ -37,14 +37,12 @@ end) --throw all items on death minetest.register_on_dieplayer(function(player, reason) local pos = player:getpos() - print(reason) local inv = player:get_inventory() for i = 1,inv:get_size("main") do local stack = inv:get_stack("main", i) local name = stack:get_name() local count = stack:get_count() - print(name) if name ~= "" then local obj = minetest.add_item(pos, name.." "..count) obj:setvelocity(vector.new(math.random(-3,3),math.random(4,8),math.random(-3,3))) @@ -257,3 +255,13 @@ minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack end end,pos, newnode, placer, oldnode, itemstack, pointed_thing,old) end) + +--play sound to keep up with player's placing vs inconsistent client placing sound +minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing) + local sound = minetest.registered_nodes[newnode.name].sounds.placing + minetest.sound_play(sound.name, { + pos = pos, + gain = sound.gain, + --pitch = math.random(60,100)/100 + }) +end) diff --git a/todo.txt b/todo.txt index 467d937..e9b37c5 100644 --- a/todo.txt +++ b/todo.txt @@ -43,12 +43,8 @@ ALPHA STATE CHANGELOG -Crafting bench -Farming with hoes, grass drops seeds, bread, etc -simplify mobs ai -running out of a node when placing tries to replace it with another of the same item in inventory - -make mobs pathfind again when moving into new node - - -crafting bench +-running out of a node when placing tries to replace it with another of the same item in inventory +-crafting bench -- 2.44.0