forked from narc0tiq/YARM
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontrol.lua
More file actions
51 lines (34 loc) · 1.39 KB
/
control.lua
File metadata and controls
51 lines (34 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
require "resmon"
require "remote"
-- if this ever happens, I'll be enormously surprised
if not resmon then error("{{MOD_NAME}} has become badly corrupted: the variable resmon should've been set!") end
function msg_all(message)
for _,p in pairs(game.players) do
p.print(message)
end
end
script.on_init(function()
local _, err = pcall(resmon.init_globals)
if err then msg_all({"YARM-err-generic", err}) end
end)
script.on_configuration_changed(function()
local _, err = pcall(resmon.init_globals)
if err then msg_all({"YARM-err-generic", err}) end
end)
script.on_event(defines.events.on_player_created, function(event)
local _, err = pcall(resmon.on_player_created, event)
if err then msg_all({"YARM-err-specific", "on_player_created", err}) end
end)
script.on_event(defines.events.on_built_entity, function(event)
local _, err = pcall(resmon.on_built_entity, event)
if err then msg_all({"YARM-err-specific", "on_built_entity", err}) end
end)
script.on_event(defines.events.on_tick, function(event)
local _, err = pcall(resmon.on_tick, event)
if err then msg_all({"YARM-err-specific", "on_tick", err}) end
end)
script.on_event(defines.events.on_gui_click, function(event)
local _, err = pcall(resmon.on_gui_click, event)
if err then msg_all({"YARM-err-specific", "on_gui_click", err}) end
end)
on_site_updated = script.generate_event_name()