mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-08-12 16:35:11 +09:00
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>
25 lines
870 B
Lua
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
|