[Oxyd] [0.17.4] Desync when defines.events.on_lua_shortcut handler tries to modify player.cursor_stack

This subforum contains all the issues which we already resolved.
Post Reply
Atria
Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Sat Jul 09, 2016 10:25 am
Contact:

[Oxyd] [0.17.4] Desync when defines.events.on_lua_shortcut handler tries to modify player.cursor_stack

Post by Atria »

Description:
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)
Steps to reproduce:
-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.
Attachments
MiniMod_1.0.0.zip
Minified mod that causes the desync
(1.17 KiB) Downloaded 119 times
desync-report-2019-03-03_17-13-00.zip
Desync report
(5.25 MiB) Downloaded 133 times
Screenshot right before desync
Screenshot right before desync
desync.png (125.04 KiB) Viewed 1945 times

Oxyd
Former Staff
Former Staff
Posts: 1428
Joined: Thu May 07, 2015 8:42 am
Contact:

Re: [Oxyd] [0.17.4] Desync when defines.events.on_lua_shortcut handler tries to modify player.cursor_stack

Post by Oxyd »

Thanks, fixed in 0.17.5.

Post Reply

Return to “Resolved Problems and Bugs”