1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-01-18 03:21:47 +02:00

fixed not registering events bug

This commit is contained in:
grilledham 2019-01-09 22:46:36 +00:00
parent 53590ed280
commit d74a9fc225

View File

@ -60,6 +60,9 @@ function Public.add(event_name, handler)
script.on_event(event_name, on_event)
else
table.insert(handlers, handler)
if #handlers == 1 then
script.on_event(event_name, on_event)
end
end
end
@ -71,6 +74,9 @@ function Public.on_init(handler)
script.on_init(on_init)
else
table.insert(handlers, handler)
if #handlers == 1 then
script.on_init(on_init)
end
end
end
@ -82,6 +88,9 @@ function Public.on_load(handler)
script.on_load(on_load)
else
table.insert(handlers, handler)
if #handlers == 1 then
script.on_load(on_load)
end
end
end
@ -93,6 +102,9 @@ function Public.on_nth_tick(tick, handler)
script.on_nth_tick(tick, on_nth_tick_event)
else
table.insert(handlers, handler)
if #handlers == 1 then
script.on_nth_tick(tick, on_nth_tick_event)
end
end
end