Teardown/control.lua

35 lines
837 B
Lua
Raw Normal View History

2024-09-15 08:10:53 +00:00
fmsl = require("__fmsl__.fmsl")
teardown = {}
2024-09-15 08:10:53 +00:00
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 = {}
global.passive.mining_drills = {} -- [Entity:true]
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)
script.on_configuration_changed(function(data)
teardown.max_mining_drill_radius = compute_max_mining_drill_radius()
end)
2024-09-15 08:10:53 +00:00
script.on_event(defines.events.on_resource_depleted, on_resource_depleted)