mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2025-01-08 08:50:20 +01:00
harden sound_play checks
This commit is contained in:
parent
c3d74394a7
commit
341f92f118
7
api.lua
7
api.lua
@ -5065,7 +5065,7 @@ local old_sound_play = minetest.sound_play
|
||||
|
||||
minetest.sound_play = function(spec, param, eph)
|
||||
|
||||
local op_params = {}
|
||||
local op_params = {} ; param = param or {}
|
||||
|
||||
-- store sound position
|
||||
if param.pos then
|
||||
@ -5076,6 +5076,11 @@ minetest.sound_play = function(spec, param, eph)
|
||||
op_params.pos = minetest.get_player_by_name(param.to_player):get_pos()
|
||||
end
|
||||
|
||||
-- if no position found use default function
|
||||
if not op_params.pos then
|
||||
return old_sound_play(spec, param, eph)
|
||||
end
|
||||
|
||||
-- store sound name and gain
|
||||
if type(spec) == "string" then
|
||||
op_params.sound = spec
|
||||
|
Loading…
Reference in New Issue
Block a user