[0.17.76] GUI element state is not CRC checked

Bugs that are actually features.
Post Reply
Long Handed Inserter
Long Handed Inserter
Posts: 80
Joined: Fri Oct 05, 2018 4:34 pm

[0.17.76] GUI element state is not CRC checked

Post by Hornwitser »

Not sure if this is strictly speaking a bug, but if you create GUI elements with properties that are different on the server and the client the game does not desync, (see example script below.) Not even the type matters. If you as in the example script below create a flow on the server and a button on the client the game doesn't desync and will send the on_gui_click with a different element on the server and the client.

Code: Select all

-- Put this code into a scenario control.lua, then start up a dedicated server with
-- --start-server-load-scenario name_of_scenario
local is_server = true


    print("========================== on_load")
    is_server = false

script.on_init(function() print("========================== on_init") end)

script.on_event(defines.events.on_player_joined_game, function(event)
    local player = game.players[event.player_index]
    local flow = mod_gui.get_button_flow(player)

    if is_server then
            type = "flow",
            name = "desync-button-server",
            type = "sprite-button",
            tooltip = "Desync the game",
            name = "desync-button-client",
            sprite = "utility/heat_exchange_indication",
            style = mod_gui.button_style

script.on_event(defines.events.on_gui_click, function (event)
    -- Game doesn't desync until some checked action with the divergent content is done
You know what, you could actually do some really cool stuff with this. Please don't fix it, call it feature and add a script.execution_index API that returns the player index the code is running on (different for each client!) Then you can implement GUI's that update information in real time without having each player having to update the GUI for all of the players (bad in 100 player games.)

Factorio Staff
Factorio Staff
Posts: 10323
Joined: Wed Jun 11, 2014 5:23 am

Re: [0.17.76] GUI element state is not CRC checked

Post by Rseding91 »

Thanks for the report. That's intentional: if it was it would be a huge performance impact (it was in the past and I changed it).

Lua global data also isn't CRC checked.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Not a bug”

Who is online

Users browsing this forum: No registered users