Page 1 of 1

[1.1.68] modding-related bug with un-registering filtered events

Posted: Mon Aug 22, 2022 9:01 pm
by Honktown
Expectation: unregistering multiple events at a time with

Code: Select all

local events = {defines.events.on_pre_player_mined_item, defines.events.on_robot_pre_mined}
script.on_event(events, nil)]
would remove event filters, and be the same as de-registering events separately.

What happens: Unregistering multiple events doesn't reset event filters, which triggers a desync error on join.

Code: Select all

  66.888 Error ClientMultiplayerManager.cpp:1103: mod-conditional_event_filter_deregister_many had the following event filters when the map was saved: on_pre_player_mined_item (ID 11) (checksum: 153013950) and on_robot_pre_mined (ID 15) (checksum: 153013950)
  66.888 Error ClientMultiplayerManager.cpp:1110: mod-conditional_event_filter_deregister_many registered the following event filters when the map was loaded: 
  66.888 Error ClientMultiplayerManager.cpp:99: MultiplayerManager failed: "" + multiplayer.script-event-mismatch + "
" + "
mod-conditional_event_filter_deregister_many"
Here are four mods, the only difference is A) whether the de-registering is one-at-a-time or many in a table, and B) whether or not there are filters:
conditional_event_deregister_many_0.0.1.zip
(1.13 KiB) Downloaded 109 times
conditional_event_deregister_ones_0.0.1.zip
(1.13 KiB) Downloaded 98 times
1) Host game, place and mine a stone furnace. 2) second player joins.

Only "conditional_event_filter_deregister_many_0.0.1.zip" produces the desync error. As someone was looking over the code in Discord #mod-making, they mentioned multi-event (de-)registration seems to not touch filters. Note: *registering* a function produces an error, that 'filters can't be used with multiple event registration', but registering nil with many does not produce such error.

Re: [1.1.68] modding-related bug with un-registering filtered events

Posted: Mon Aug 22, 2022 9:48 pm
by Rseding91
Thanks for the report. It's now fixed for the next 1.1.release.