Detect accidental global sound playing

Every sound in the game (and all known mods for
it) should play either at a specific location, to a
specific player (e.g. chat beeps or notifications),
or bound to a specific physical object.  Detect any
that might be played globally by accident, e.g.
like a bug that existed in NC ZipRunes for a while,
to aid in debugging.
This commit is contained in:
Aaron Suen 2022-10-19 19:22:55 -04:00
parent 0cc42fef14
commit 553893b60a
2 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,15 @@
-- LUALOCALS < ---------------------------------------------------------
local minetest, string
= minetest, string
local string_format
= string.format
-- LUALOCALS > ---------------------------------------------------------
local oldplay = minetest.sound_play
function minetest.sound_play(spec, params, ...)
if not (params and (params.pos or params.to_player or params.object)) then
minetest.log("warning", string_format("global sound %q params %s",
spec, minetest.serialize(params)))
end
return oldplay(spec, params, ...)
end

View File

@ -91,6 +91,7 @@ include("compat_issue10127")
include("compat_legacyent")
include("compat_nodealpha")
include("compat_authcache")
include("compat_soundpos")
include("util_settings")
include("util_privs")