Prototype/Shortcut: technology_to_unlock

Place to get help with not working mods / modding interface.
Post Reply
PrestonLeeC
Burner Inserter
Burner Inserter
Posts: 9
Joined: Mon Aug 24, 2020 1:02 pm
Contact:

Prototype/Shortcut: technology_to_unlock

Post 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!

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Prototype/Shortcut: technology_to_unlock

Post 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.

PrestonLeeC
Burner Inserter
Burner Inserter
Posts: 9
Joined: Mon Aug 24, 2020 1:02 pm
Contact:

Re: Prototype/Shortcut: technology_to_unlock

Post 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?

User avatar
ickputzdirwech
Filter Inserter
Filter Inserter
Posts: 768
Joined: Sun May 07, 2017 10:16 am
Contact:

Re: Prototype/Shortcut: technology_to_unlock

Post 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.
Mods: Shortcuts for 1.1, ick's Sea Block, ick's vanilla tweaks
Tools: Atom language pack
Text quickly seems cold and unfriendly. Be careful how you write and interpret what others have written.
- A reminder for me and all who read what I write

PrestonLeeC
Burner Inserter
Burner Inserter
Posts: 9
Joined: Mon Aug 24, 2020 1:02 pm
Contact:

Re: Prototype/Shortcut: technology_to_unlock

Post 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.

User avatar
ickputzdirwech
Filter Inserter
Filter Inserter
Posts: 768
Joined: Sun May 07, 2017 10:16 am
Contact:

Re: Prototype/Shortcut: technology_to_unlock

Post 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.
Mods: Shortcuts for 1.1, ick's Sea Block, ick's vanilla tweaks
Tools: Atom language pack
Text quickly seems cold and unfriendly. Be careful how you write and interpret what others have written.
- A reminder for me and all who read what I write

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Prototype/Shortcut: technology_to_unlock

Post 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.
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”