BerbCorp Cargo Bay Loader


BerbCorp Cargo Bay Loader lets inserters and loaders insert into and remove from Space Age cargo landing pads, space platform hubs, and cargo bay extensions. It does not change logistic bot behavior.

Utilities
a month ago
2.0 - 2.1
390
Logistics Storage

g issue when hosting server

a month ago
(updated a month ago)

Cannot join. The following mod event handlers are not identical between you and the server. This indicates that the following mods are not multiplayer (save/load) safe. (See the log file for more details):

mod-cargo-bay-loader

57.284 Error ClientMultiplayerManager.cpp:1079: mod-cargo-bay-loader was not registered for the following events when the map was saved but has registered them as a result of loading: on_tick (ID 0)
57.284 Error ClientMultiplayerManager.cpp:86: MultiplayerManager failed: "" + multiplayer.script-event-mismatch + "
" + "
mod-cargo-bay-loader"
57.284 Info ClientMultiplayerManager.cpp:608: UpdateTick(40299752) changing state from(ConnectedLoadingMap) to(Failed)

a month ago

I got it working
-- Changes made:
-- 1. on_tick is permanently registered.
-- 2. Removed dynamic script.on_event(on_tick, ...) registration/unregistration.
-- 3. Removed script.on_load() registration.
-- 4. on_tick immediately returns when no dirty surfaces exist.

-- Apply these edits to your original file:

-- In mark_surface_dirty(), REMOVE:
-- script.on_event(defines.events.on_tick, on_tick)

-- Replace your on_tick function with:

on_tick = function()
ensure_storage()

if next(storage.dirty_surfaces) == nil then
return
end

rebuild_if_startup_settings_changed()

for surface_index in pairs(storage.dirty_surfaces) do
local surface = game.get_surface(surface_index)
if surface then
update_surface(surface)
end
end

storage.dirty_surfaces = {}
end

-- DELETE this entire block:

-- script.on_load(function()
-- script.on_event(defines.events.on_tick, on_tick)
-- end)

-- Finally, add this ONCE near the bottom of the file
-- (after all function definitions is fine):

script.on_event(defines.events.on_tick, on_tick)

New response