Possible to make custom_input_prototypes read-write?

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
jdogg
Burner Inserter
Burner Inserter
Posts: 7
Joined: Mon Oct 08, 2018 9:41 pm
Contact:

Possible to make custom_input_prototypes read-write?

Post by jdogg »

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
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Possible to make custom_input_prototypes read-write?

Post by eradicator »

LuaDoc wrote: LuaCustomInputPrototype.key_sequence :: string [Read-only]
The default key sequence for this custom input.
According to the doc that is not the current key sequence. The current key is probably not even part of the game-state.
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.
jdogg
Burner Inserter
Burner Inserter
Posts: 7
Joined: Mon Oct 08, 2018 9:41 pm
Contact:

Re: Possible to make custom_input_prototypes read-write?

Post by jdogg »

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:

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)
Post Reply

Return to “Modding interface requests”