mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-02-07 13:31:40 +02:00
Event - add script.raise_event
This commit is contained in:
parent
696de12321
commit
720feaf13b
@ -108,6 +108,7 @@ local core_on_load = EventCore.on_load
|
|||||||
local core_on_nth_tick = EventCore.on_nth_tick
|
local core_on_nth_tick = EventCore.on_nth_tick
|
||||||
local core_on_configuration_changed = EventCore.on_configuration_changed
|
local core_on_configuration_changed = EventCore.on_configuration_changed
|
||||||
local stage_load = _STAGE.load
|
local stage_load = _STAGE.load
|
||||||
|
local raise_event = script.raise_event
|
||||||
local script_on_event = script.on_event
|
local script_on_event = script.on_event
|
||||||
local script_on_nth_tick = script.on_nth_tick
|
local script_on_nth_tick = script.on_nth_tick
|
||||||
local generate_event_name = script.generate_event_name
|
local generate_event_name = script.generate_event_name
|
||||||
@ -182,6 +183,17 @@ function Event.on_init(handler)
|
|||||||
core_on_init(handler)
|
core_on_init(handler)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- This exists only to become more easily available if you are already requiring the event module.
|
||||||
|
function Event.raise(handler, data)
|
||||||
|
if data then
|
||||||
|
if not type(data) == 'table' then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
raise_event(handler, data)
|
||||||
|
end
|
||||||
|
|
||||||
--- Register a handler for the script.on_load event.
|
--- Register a handler for the script.on_load event.
|
||||||
-- This function must be called in the control stage or in Event.on_init or Event.on_load
|
-- This function must be called in the control stage or in Event.on_init or Event.on_load
|
||||||
-- See documentation at top of file for details on using events.
|
-- See documentation at top of file for details on using events.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user