How works player.mute_alert?

Place to get help with not working mods / modding interface.
Post Reply
WildBraas
Inserter
Inserter
Posts: 44
Joined: Sat Feb 16, 2019 6:25 am
Contact:

How works player.mute_alert?

Post 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 913 times
What I doing wrong?

Bilka
Factorio Staff
Factorio Staff
Posts: 3158
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: How works player.mute_alert?

Post by Bilka »

Muting the alert disables its sound. You are probably looking for LuaPlayer.disable_alert.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

WildBraas
Inserter
Inserter
Posts: 44
Joined: Sat Feb 16, 2019 6:25 am
Contact:

Re: How works player.mute_alert?

Post 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 905 times
Any suggestions?

Post Reply

Return to “Modding help”