Page 1 of 1

[0.18.17] LuaPlayer::set_shortcut_toggled doesnt toggle shortcut

Posted: Fri Apr 03, 2020 2:36 pm
by LuziferSenpai
Hey,

so if I run this Command:

Code: Select all

/c
local player = game.get_player( "LuziferSenpai" )
local shortcut = "toggle-equipment-movement-bonus"

if player.is_shortcut_toggled( shortcut ) then
    game.print( "true" )
    player.set_shortcut_toggled( shortcut, false )
else
    game.print( "false" )
    player.set_shortcut_toggled( shortcut, true )
end
It switches between true and false, BUT it doesnt toggle the shortcut so my exoskeleton is still enabled, what shouldnt be.
Same goes with "toggle-personal-roboport".

Greetz,

Luzifer

Re: [18.17] LuaPlayer::set_shortcut_toggled

Posted: Fri Apr 03, 2020 2:40 pm
by Mylon
I can confirm. I was investigating using the roborport toggle as an option to make Klonan's Construction Drones mod better but I could not enable the Roboport toggle. Thus I was unable to make it useful as an option for controlling construction drones.

Idea:
Toggle mouseover displays some additional information, such as, "You do not have a personal roboport equipped." or "You do not have construction robots to deploy." or, "This toggle is controlled by script."

Re: [0.18.17] LuaPlayer::set_shortcut_toggled doesnt toggle shortcut

Posted: Fri Apr 03, 2020 4:55 pm
by Rseding91
Thanks for the report. Looking into this that only does anything for Lua shortcuts. The alt mode, equipment movement, personal requests, and personal roboport are not controlled through that.

All of those 4 shortcuts are controlled directly on what they modify: alt mode, the boolean on the equipment grid, and the booleans on the entity.

For example:

alt mode: https://lua-api.factorio.com/latest/Lua ... w_settings -> https://lua-api.factorio.com/latest/Con ... ewSettings
movement bonus: https://lua-api.factorio.com/latest/Lua ... ment_bonus
enable personal roboport: https://lua-api.factorio.com/latest/Lua ... ing_robots
enable personal logistics: https://lua-api.factorio.com/latest/Lua ... istic_slot