set_shortcut_available for all shortcuts
- ickputzdirwech
- Filter Inserter
- Posts: 794
- Joined: Sun May 07, 2017 10:16 am
- Contact:
set_shortcut_available for all shortcuts
Right now you can use set_shortcut_available(prototype_name, available) only for shortcuts with action = "lua". It would be nice if you could use it for all shortcuts.
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
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
- ickputzdirwech
- Filter Inserter
- Posts: 794
- Joined: Sun May 07, 2017 10:16 am
- Contact:
Re: set_shortcut_available for all shortcuts
Maybe a bit of context why this would be useful helps
Modded shortcuts often only make sense if you have researched a specific technology. For example a shortcut for the Module Inserter mod in my eyes only makes sense if you have modules researched. But you can't use the following script since the shortcut "module-inserter" uses the action = "create-blueprint-item". In order to use set_shortcut_available you have to change the action to "lua" and give the item to the player via a custom script (as implemented by Shortcuts for 1.0). It would be way simpler if you could just use set_shortcut_available for all actions. Especially since in 1.1.0 it will be possible again to give the player other items than selection-tools via action = "create-blueprint-item" again like a artillery-targeting-remote. (if I understand this topic 87777 correctly.
Modded shortcuts often only make sense if you have researched a specific technology. For example a shortcut for the Module Inserter mod in my eyes only makes sense if you have modules researched. But you can't use the following script since the shortcut "module-inserter" uses the action = "create-blueprint-item". In order to use set_shortcut_available you have to change the action to "lua" and give the item to the player via a custom script (as implemented by Shortcuts for 1.0). It would be way simpler if you could just use set_shortcut_available for all actions. Especially since in 1.1.0 it will be possible again to give the player other items than selection-tools via action = "create-blueprint-item" again like a artillery-targeting-remote. (if I understand this topic 87777 correctly.
Code: Select all
script.on_event(defines.events.on_player_created, function(event)
if player.force.technologies["modules"].researched == false then
player.set_shortcut_available("module-inserter", false)
end
end)
script.on_event(defines.events.on_research_finished, function(event)
for _,player in pairs(event.research.force.players) do
if event.research and event.research.name == "modules" then
player.set_shortcut_available("module-inserter", true)
end
end
end)
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
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