Skip to content

Commit 41bda25

Browse files
committed
Modify event handler
1 parent cb8f292 commit 41bda25

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ sudo apt install p7zip-full jq git -y
154154
Optional Dependencies
155155
---------------------
156156

157-
* <a href="github.com/ZwerOxotnik/zk-lib" target="_blank"><code>zk-lib</code></a> - for localization of [BetterCommands](models/BetterCommands/control.lua), currently
157+
* <a href="github.com/ZwerOxotnik/zk-lib" target="_blank"><code>zk-lib</code></a> - for localization of [BetterCommands](models/BetterCommands/control.lua) and [event handler](/control.lua), currently
158158

159159
‼️ Important Links (Translations, Discord Support)
160160
---------------------------------------------------------------

control.lua

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ if script.level.campaign_name then return end -- Don't init if it's a campaign
33
if script.level.level_name == "sandbox" then return end -- Don't init if it's "sandbox" scenario
44

55
require("defines")
6-
local event_handler = require("event_handler")
76

87

98
---@type table<string, module>
@@ -33,4 +32,12 @@ else
3332
end
3433

3534

35+
local event_handler
36+
if script.active_mods["zk-lib"] then
37+
-- Same as Factorio "event_handler", but slightly better performance
38+
event_handler = require("__zk-lib__/static-libs/lualibs/event_handler_vZO.lua")
39+
else
40+
event_handler = require("event_handler")
41+
end
42+
3643
event_handler.add_libraries(modules)

info.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
"contact": "Put your contacts",
88
"homepage": "Put a link",
99
"description": "See locale/en",
10-
"dependencies": ["? zk-lib >= 0.7.10"]
10+
"dependencies": ["? zk-lib >= 0.10.0"]
1111
}

0 commit comments

Comments
 (0)