forked from ndamiano/ProgressiveProductivity
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontrol.lua
More file actions
31 lines (26 loc) · 1.14 KB
/
control.lua
File metadata and controls
31 lines (26 loc) · 1.14 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
local product_cache = require("utility.product_cache")
local gui_module = require("utility.gui_module")
-- When recipes could have changed or when we are initialized, create our local storage
script.on_configuration_changed(function(event)
product_cache.setupStorage()
end)
script.on_init(function(event)
product_cache.setupStorage()
end)
-- Events for toggling gui on and off
script.on_event("toggle_progressive_productivity_gui", function(event)
local player = game.get_player(event.player_index)
gui_module.toggleProgressiveProductivityUI(player, event.tick)
end)
script.on_event(defines.events.on_lua_shortcut, function(event)
if event.prototype_name == "toggle_progressive_productivity_gui_shortcut" then
local player = game.get_player(event.player_index)
gui_module.toggleProgressiveProductivityUI(player, event.tick)
end
end)
script.on_event(defines.events.on_gui_closed, function(event)
if event.element and event.element.name == "progressive_productivty_list" then
local player = game.get_player(event.player_index)
gui_module.toggleProgressiveProductivityUI(player, event.tick)
end
end)