Forcing ProgrammableSpeakerParameters.playback_* booleans

Place to get help with not working mods / modding interface.
Pebble
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sun Apr 15, 2018 8:21 pm
Contact:

Forcing ProgrammableSpeakerParameters.playback_* booleans

Post by Pebble »

Hi,

I've noticed on alot of servers that the ProgrammableSpeakers are disabled, cause bans, etc. and are just generally unappreciated because of the need to keep them from doing global playback on multiplayer.

I was looking for the right way to disable playback and still allow the global alerts that these entities have because they're so useful to me.

How could we go about forcing the playback_volume or playback_globally settings on all of these to false?
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Forcing ProgrammableSpeakerParameters.playback_* booleans

Post by eradicator »

Hook into on_*_built, on_entity_settings_pasted and on_gui_opened to force it back to non-global whenever a player changes it. Should be possible. You'll need a dynamic tick handler for watching the gui live as it changes unless you want to pay (cpu cost) for a constant background on_tick.

Or you could try using the permission system (/permissions ingame):
https://lua-api.factorio.com/latest/Lua ... ows_action

"change programmable speaker parameters" can disable:
playback_volume :: double
playback_globally :: boolean
allow_polyphony :: boolean

though only all at once.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Post Reply

Return to “Modding help”