From 809b30189878d67ce3fe2e7ab274f881c0f0aee1 Mon Sep 17 00:00:00 2001 From: Panquesito7 <51391473+Panquesito7@users.noreply.github.com> Date: Fri, 19 Jul 2019 17:06:06 -0500 Subject: [PATCH] Complete another task from TODO list - Add a [different] sound effect at the source coords when a TP takes place (so other players hear it when to teleport away): This was finished in this commit (tested with MT/MTG 5.0.1 and works fine). If there's any error/bug/typo, please tell me, so, I can fix it. --- README.md | 1 - init.lua | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2d83d7c..fd8a735 100644 --- a/README.md +++ b/README.md @@ -93,5 +93,4 @@ https://wiki.minetest.net/Installing_Mods - Create a better sound effect for teleport and apply it to all teleport methods (not just /tpc) - Create a new function for the actual set_pos() to remove all the redundant code each time the player is moved and the sound played. - Rewrite to place all chat commands into one single command much like how /teleport works. -- Add a [different] sound effect at the source coords when a TP takes place (so other players hear it when to teleport away). - Make evade respect land: no teleporting inside land, but instead make sure player is standing on surface or in water. diff --git a/init.lua b/init.lua index ac49c41..d6a457a 100644 --- a/init.lua +++ b/init.lua @@ -200,6 +200,7 @@ function tpc_send(player, coordinates) -- Admin user (priv "tp_admin") overrides all protection if minetest.check_player_privs(pname, {tp_admin=true}) then minetest.chat_send_player(player, S("Teleporting to: @1, @2, @3", posx, posy, posz)) + minetest.sound_play("whoosh", {pos = pname:get_pos(), gain = 0.5, max_hear_distance = 10}) pname:set_pos(find_free_position_near(target_coords)) minetest.sound_play("whoosh", {pos = target_coords, gain = 0.5, max_hear_distance = 10}) --parti2(target_coords) @@ -213,6 +214,7 @@ function tpc_send(player, coordinates) return end end + minetest.sound_play("whoosh", {pos = pname:get_pos(), gain = 0.5, max_hear_distance = 10}) minetest.chat_send_player(player, S("Teleporting to: @1, @2, @3", posx, posy, posz)) pname:set_pos(find_free_position_near(target_coords)) minetest.sound_play("whoosh", {pos = target_coords, gain = 0.5, max_hear_distance = 10}) @@ -272,8 +274,10 @@ function tpr_accept(name, param) minetest.chat_send_player(name, chatmsg) local target_coords = source:get_pos() + local target_sound = target:get_pos() target:set_pos(find_free_position_near(target_coords)) minetest.sound_play("whoosh", {pos = target_coords, gain = 0.5, max_hear_distance = 10}) + minetest.sound_play("whoosh", {pos = target_sound, gain = 0.5, max_hear_distance = 10}) --parti2(target_coords) end @@ -312,6 +316,7 @@ function tpj(player, param) minetest.chat_send_player(player, S("You cannot teleport to a location outside the map!")) return end + minetest.sound_play("whoosh", {pos = pname:get_pos(), gain = 0.5, max_hear_distance = 10}) pname:set_pos(find_free_position_near(target_coords)) minetest.sound_play("whoosh", {pos = target_coords, gain = 0.5, max_hear_distance = 10}) --parti2(target_coords) @@ -368,9 +373,11 @@ if enable_tpp_command then -- Teleport player to the specified place (taken from shivajiva101's POI mod, thanks!). elseif available_places[param] then + minetest.sound_play("whoosh", {pos = pname:get_pos(), gain = 0.5, max_hear_distance = 10}) local pos = {x = available_places[param].x, y = available_places[param].y, z = available_places[param].z} pname:set_pos(pos) minetest.chat_send_player(player, S("Teleporting to @1.", param)) + minetest.sound_play("whoosh", {pos = pos, gain = 0.5, max_hear_distance = 10}) -- Check if the place exists. elseif not available_places[param] then minetest.chat_send_player(player, S("There is no place by that name. Keep in mind this is case-sensitive."))