Teardown/control.lua

33 lines
803 B
Lua
Raw Normal View History

2024-09-15 08:10:53 +00:00
fmsl = require("__fmsl__.fmsl")
local next = next
active_tick = 1
passive_tick = 31
require("teardown.mining_drill")
require("teardown.on_resource_depleted")
require("teardown.on_tick")
script.on_init(function()
global.active = {}
global.active.mining_drills = {} -- [Tick:Entity]
global.passive = {}
2024-09-20 06:35:21 +00:00
global.passive.mining_drills = {} -- [Entity.unit_number:Entity]
2024-09-15 08:10:53 +00:00
end)
script.on_load(function()
if next(global.active.mining_drills) ~= nil then
script.on_nth_tick(active_tick, on_active_tick)
end
if next(global.passive.mining_drills) ~= nil then
script.on_nth_tick(passive_tick, on_passive_tick)
end
end)
2024-09-19 02:54:18 +00:00
script.on_configuration_changed(function(data)
recompute_max_mining_drill_radius()
end)
2024-09-15 08:10:53 +00:00
script.on_event(defines.events.on_resource_depleted, on_resource_depleted)