Files
factorio-scenario-ExpCluster/exp_roles/module/events.lua
T
bbassieandClaude Opus 5 f39da0c585 Type the last of the forward declarations
Locals declared ahead of an assignment inside a callback were inferred
as nil at every use site.

The role event handlers are given a class so the table is not unified
with the other module handler tables.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:18 +00:00

25 lines
870 B
Lua

--[[-- ExpRoles - Events
Wires the role sync into the factorio event handler.
This is kept apart from control.lua because `ExpRoles.events` holds the ids of
the events this module raises, which is the interface the legacy role system
had, and event_handler expects `events` to be the handlers to register.
]]
local clusterio_api = require("modules/clusterio/api")
local ExpRoles = require("modules/exp_roles/control")
--- @class ExpRoles.EventHandlers
--- @field on_load fun()
--- @field events table<defines.events, fun(event: EventData)>
local handlers = {
on_load = ExpRoles.on_load,
events = {
[clusterio_api.events.on_server_startup] = ExpRoles.on_server_startup,
[defines.events.on_multiplayer_init] = ExpRoles.on_server_startup,
[defines.events.on_player_joined_game] = ExpRoles.on_player_joined_game,
},
}
return handlers