My mod is using new shortcuts to insert item into player's cursor_stack. But when event handler of defines.events.on_lua_shortcut tries to call player.clean_cursor() or player.cursor_stack.can_set_stack(...) or player.cursor_stack.set_stack(...) it causes a client to desync.
Code in question:
Code: Select all
function OnShortCut(event)
local player = game.players[event.player_index]
if player.clean_cursor() then
local stack = player.cursor_stack
if player.cursor_stack and stack.can_set_stack({ name = "steel-chest" }) then
stack.set_stack({ name = "steel-chest" })
end
end
end
script.on_event(defines.events.on_lua_shortcut, OnShortCut)
-Install attached mod on server and client
-Start server and connect with client
-Open shortcut tool list
-Click on new shortcut (see attached screenshot)
-Enjoy desync
Attached mod, screenshot and desync report.