local pl = {}

local function do_wind(player)
	local n = player:get_player_name()

	if pl[n] == nil then
		pl[n] = core.sound_play("pyutest_wind", {
			player = n,
			loop = true,
			gain = 0.5
		})
	end
end

core.register_on_leaveplayer(function (p)
	pl[p:get_player_name()] = nil
end)

core.register_globalstep(function(dtime)
	for _, player in ipairs(core.get_connected_players()) do
		do_wind(player)
	end
end)
