Page 1 of 1

Prototype/Shortcut: technology_to_unlock

Posted: Mon Aug 24, 2020 2:09 pm
by PrestonLeeC
Hello/

According to https://wiki.factorio.com/Prototype/Sho ... _to_unlock, it should be possible to hide a shortcut button behind a research. However, this doesn't seem to be working for me. In a new freeplay game (modded), I have all shortcut buttons available, despite giving them all technology_to_unlock. I can see with Data.Raw Serpent that the shortcuts do in fact have the technology_to_unlock tag correctly applied at runtime.

Does anyone know of a popular mod that could be causing this? (Construction Drones, Space Exploration, Krastorio 2)?

I've managed to use control.lua to "disable" the shortcuts 'til the technology is researched, but that just makes the shortcuts greyed-out. I wanted the shortcuts to be hidden until the correct technology was researched.

Thanks very much, and good day.

PS: I was unable to search the forum for technology_to_unlock because it replaces underscores with spaces. Advice on this would also be appreciated!

Re: Prototype/Shortcut: technology_to_unlock

Posted: Mon Aug 24, 2020 2:58 pm
by DaveMcW
You only unlock shortcuts once and then they are permanently available in future games.

To disable them for testing, edit player-data.json in your user data directory and delete the shortcut bar entries.

Re: Prototype/Shortcut: technology_to_unlock

Posted: Mon Aug 24, 2020 3:41 pm
by PrestonLeeC
Thank you for explaining this to me. I think it's awful, though. The whole point of hiding a shortcut behind a technology is that the shortcut isn't useful until you have that technology. Does anyone know of a control script to reset the player's "already unlocked" shortcuts?

Re: Prototype/Shortcut: technology_to_unlock

Posted: Mon Aug 24, 2020 5:26 pm
by ickputzdirwech
PrestonLeeC wrote: Mon Aug 24, 2020 3:41 pm Does anyone know of a control script to reset the player's "already unlocked" shortcuts?

Code: Select all

/c game.player.set_shortcut_available("insert-custom-shortcut-name", false)
You can see the internal name of the shortcut by hovering over it and pressing ctrl-shift-F.

This does work only for shortcuts from mods that have action = "lua", however. (I made a request to make it work for all shortcuts: 88356).

I don't know what mods you are using and which shortcuts you want to be locked but maybe some of them are supported by the mod I'm maintaining: Shortcuts for 1.0. Link in my signature.

Re: Prototype/Shortcut: technology_to_unlock

Posted: Mon Aug 24, 2020 5:46 pm
by PrestonLeeC
Thank you for the hint about ctrl-shift-F! I didn't know that.

Code: Select all

/c game.player.set_shortcut_available("insert-custom-shortcut-name", false)
I'm already using this code, and it only greys out the shortcut, it doesn't hide it.

Re: Prototype/Shortcut: technology_to_unlock

Posted: Mon Aug 24, 2020 6:31 pm
by ickputzdirwech
PrestonLeeC wrote: Mon Aug 24, 2020 5:46 pm I'm already using this code, and it only greys out the shortcut, it doesn't hide it.
This is not possible afaik. If a shortcut is implemented it always shows up in the shortcut menu. You can’t implement them on a condition other than a startup setting because the game has to restart to change/remove/add a prototype.

Re: Prototype/Shortcut: technology_to_unlock

Posted: Tue Aug 25, 2020 3:40 pm
by eradicator
PrestonLeeC wrote: Mon Aug 24, 2020 2:09 pm PS: I was unable to search the forum for technology_to_unlock
Just search with quotes "technology_to_unlock".

Shortcut layout/order isn't moddable. It's what the player decides they want it to be. If you want a shortcut that has to be unlocked seperately on every new map then you have to manually disable it in on_init.