Page 1 of 1

How works player.mute_alert?

Posted: Mon May 03, 2021 2:42 pm
by WildBraas
Hi masterminds!
In api for mute_alert written:
mute_alert(alert_type) → boolean
Mutes alerts for the given alert category.

Parameters
alert_type :: defines.alert_type
Return value
If the alert type was muted (false if it was already muted).
I use that:

Code: Select all

player.mute_alert(defines.alert_type.custom);
But nothing changes, custom alerts in still in place.
2021-05-03_17-39-27.png
2021-05-03_17-39-27.png (12.69 KiB) Viewed 1339 times
What I doing wrong?

Re: How works player.mute_alert?

Posted: Mon May 03, 2021 2:50 pm
by Bilka
Muting the alert disables its sound. You are probably looking for LuaPlayer.disable_alert.

Re: How works player.mute_alert?

Posted: Mon May 03, 2021 3:05 pm
by WildBraas
Even simplified

Code: Select all

function OnTick(e)
	if e.tick % 60 == 0 then
		for _, player in pairs(game.connected_players) do
			player.disable_alert(defines.alert_type.custom);
		end
	end
end

script.on_event(defines.events.on_tick, OnTick);
Gives me same behavior
2021-05-03_18-00-49.png
2021-05-03_18-00-49.png (8.43 KiB) Viewed 1331 times
Any suggestions?