1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-08 00:39:30 +02:00
ComfyFactorio/maps/chronosphere/table.lua

157 lines
3.8 KiB
Lua
Raw Normal View History

-- one table to rule them all!
local Global = require 'utils.global'
local Event = require 'utils.event'
local chronosphere = {}
2021-02-07 13:54:25 +02:00
local bitersphere = {}
local schedulesphere = {}
local playersphere = {}
local productionsphere = {}
local Public = {}
Global.register(
chronosphere,
function(tbl)
chronosphere = tbl
end
)
2021-02-07 13:54:25 +02:00
Global.register(
bitersphere,
function(tbl)
bitersphere = tbl
end
)
Global.register(
schedulesphere,
function(tbl)
schedulesphere = tbl
end
)
Global.register(
playersphere,
function(tbl)
playersphere = tbl
end
)
Global.register(
productionsphere,
function(tbl)
productionsphere = tbl
end
)
function Public.reset_production_table()
2021-03-24 17:46:00 +02:00
for k, _ in pairs(productionsphere) do
productionsphere[k] = nil
end
productionsphere.experience = {}
productionsphere.assemblers = {}
productionsphere.train_assemblers = {}
2021-02-07 13:54:25 +02:00
end
function Public.reset_player_table()
2021-03-24 17:46:00 +02:00
for k, _ in pairs(playersphere) do
playersphere[k] = nil
end
playersphere.icw = {}
playersphere.icw.players = {}
playersphere.flame_boots = {}
playersphere.offline_players = {}
playersphere.active_upgrades_gui = {}
2021-02-07 13:54:25 +02:00
end
function Public.reset_schedule_table()
2021-03-24 17:46:00 +02:00
for k, _ in pairs(schedulesphere) do
schedulesphere[k] = nil
end
schedulesphere.lab_cells = {}
2021-02-07 13:54:25 +02:00
end
function Public.reset_biter_table()
2021-03-24 17:46:00 +02:00
for k, _ in pairs(bitersphere) do
bitersphere[k] = nil
end
bitersphere.active_biters = {}
bitersphere.unit_groups = {}
bitersphere.biter_raffle = {}
bitersphere.free_biters = 0
2021-02-07 13:54:25 +02:00
end
function Public.reset_table()
2020-04-26 15:43:59 +02:00
for k, _ in pairs(chronosphere) do
2021-03-24 17:46:00 +02:00
chronosphere[k] = nil
end
2021-03-24 17:46:00 +02:00
chronosphere.computermessage = 0
chronosphere.config = {}
chronosphere.chronojumps = 0
chronosphere.game_lost = true
chronosphere.game_won = false
chronosphere.max_health = 0
chronosphere.health = 0
chronosphere.poisontimeout = 0
chronosphere.chronocharges = 0
chronosphere.passive_chronocharge_rate = 0
chronosphere.passivetimer = 0
chronosphere.overstaycount = 0
chronosphere.chronochargesneeded = 0
chronosphere.jump_countdown_start_time = 0
chronosphere.jump_countdown_length = 0
chronosphere.mainscore = 0
chronosphere.dangertimer = 0
chronosphere.dangers = {}
chronosphere.looted_nukes = 0
chronosphere.nextsurface = nil
chronosphere.upgrades = {}
chronosphere.outchests = {}
chronosphere.outcombinators = {}
chronosphere.upgradechest = {}
chronosphere.fishchest = {}
chronosphere.comfylatron = {}
chronosphere.accumulators = {}
chronosphere.comfychests = {}
chronosphere.comfychests2 = {}
chronosphere.locomotive_cargo = {}
chronosphere.world = {}
chronosphere.research_tokens = {}
chronosphere.research_tokens.biters = 0
chronosphere.research_tokens.ammo = 0
chronosphere.research_tokens.tech = 0
chronosphere.research_tokens.ecology = 0
chronosphere.research_tokens.weapons = 0
chronosphere.laser_battery = 0
chronosphere.last_artillery_event = 0
chronosphere.poison_mastery_unlocked = 0
end
function Public.get_table()
return chronosphere
end
2021-02-07 13:54:25 +02:00
function Public.get_player_table()
return playersphere
end
function Public.get_schedule_table()
return schedulesphere
end
function Public.get_biter_table()
return bitersphere
end
function Public.get_production_table()
return productionsphere
end
2021-03-24 17:46:00 +02:00
local on_init = function()
Public.reset_table()
2021-02-07 13:54:25 +02:00
Public.reset_biter_table()
Public.reset_player_table()
Public.reset_schedule_table()
Public.reset_production_table()
end
Event.on_init(on_init)
return Public