So I added a GUI with a button to read all the custom_input_prototypes and their key_sequence and it spits out a table with all the duplicates key sequences. I was wondering if it is even possible to allow a mod to write to the key sequence like you would do by going into the setting -> controls menu. The idea being that only duplicate mod custom inputs would be displayed and the player could change them directly from the mod GUI instead of finding them in controls menu. Unless I'm missing something in the API where this would already be doable.
https://mods.factorio.com/mod/project-corona - My Mod that does this
Possible to make custom_input_prototypes read-write?
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Possible to make custom_input_prototypes read-write?
According to the doc that is not the current key sequence. The current key is probably not even part of the game-state.LuaDoc wrote: LuaCustomInputPrototype.key_sequence :: string [Read-only]
The default key sequence for this custom input.
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.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Possible to make custom_input_prototypes read-write?
Yeah I'd assume the same honestly, but I was hoping for a way to maybe access it on a per player basis since different players have different preferences of custom inputs.
Maybe something along the lines of:
Maybe something along the lines of:
Code: Select all
script.on_event(defines.events.on_gui_click, function(event)
local player = game.get_player(event.player_index)
player.active_input_prototype["custom-input-name"].key_sequence = "new-key-sequence"
end)