2020-05-17 12:23:55 +02:00
|
|
|
-- on table to rule them all!
|
|
|
|
local Global = require 'utils.global'
|
|
|
|
local Event = require 'utils.event'
|
|
|
|
|
|
|
|
local this = {
|
2020-05-20 09:09:39 +02:00
|
|
|
disable_reset = false,
|
2020-05-19 23:00:52 +02:00
|
|
|
players = {},
|
2020-05-21 23:08:23 +02:00
|
|
|
offline_players = {},
|
2020-06-03 20:09:00 +02:00
|
|
|
hidden_dimension = {
|
|
|
|
logistic_research_level = 0,
|
|
|
|
reset_counter = 1
|
|
|
|
},
|
2020-05-21 23:08:23 +02:00
|
|
|
power_sources = {},
|
|
|
|
refill_turrets = {index = 1},
|
|
|
|
magic_crafters = {index = 1},
|
2020-05-23 21:18:18 +02:00
|
|
|
magic_fluid_crafters = {index = 1},
|
|
|
|
breached_wall = 1,
|
2020-06-05 18:01:32 +02:00
|
|
|
entity_limits = {},
|
|
|
|
traps = {}
|
2020-05-17 12:23:55 +02:00
|
|
|
}
|
|
|
|
local Public = {}
|
|
|
|
|
|
|
|
Global.register(
|
|
|
|
this,
|
|
|
|
function(tbl)
|
|
|
|
this = tbl
|
|
|
|
end
|
|
|
|
)
|
|
|
|
|
|
|
|
function Public.reset_table()
|
2020-06-03 20:09:00 +02:00
|
|
|
this.icw_locomotive = nil
|
2020-05-17 12:23:55 +02:00
|
|
|
this.game_lost = false
|
2020-06-03 20:09:00 +02:00
|
|
|
this.debug = false
|
|
|
|
this.game_will_not_reset = false
|
|
|
|
this.fullness_enabled = true
|
|
|
|
this.fullness_limit = 0.95
|
2020-05-17 12:23:55 +02:00
|
|
|
this.locomotive_health = 10000
|
|
|
|
this.locomotive_max_health = 10000
|
|
|
|
this.cargo_health = 10000
|
|
|
|
this.cargo_max_health = 10000
|
|
|
|
this.train_upgrades = 0
|
|
|
|
this.offline_players = {}
|
|
|
|
this.biter_pets = {}
|
2020-05-21 23:08:23 +02:00
|
|
|
this.power_sources = {}
|
2020-05-23 21:18:18 +02:00
|
|
|
this.flamethrower_damage = {}
|
2020-05-21 23:08:23 +02:00
|
|
|
this.refill_turrets = {index = 1}
|
|
|
|
this.magic_crafters = {index = 1}
|
|
|
|
this.magic_fluid_crafters = {index = 1}
|
2020-05-17 12:23:55 +02:00
|
|
|
this.mined_scrap = 0
|
|
|
|
this.biters_killed = 0
|
|
|
|
this.locomotive_xp_aura = 40
|
|
|
|
this.xp_points = 0
|
|
|
|
this.xp_points_upgrade = 0
|
2020-05-23 21:18:18 +02:00
|
|
|
this.upgrades = {
|
|
|
|
showed_text = false,
|
|
|
|
landmine = {
|
2020-06-03 20:09:00 +02:00
|
|
|
limit = 25,
|
|
|
|
bought = 0,
|
2020-05-23 21:18:18 +02:00
|
|
|
built = 0
|
|
|
|
},
|
|
|
|
flame_turret = {
|
2020-06-03 20:09:00 +02:00
|
|
|
limit = 6,
|
|
|
|
bought = 0,
|
2020-05-23 21:18:18 +02:00
|
|
|
built = 0
|
|
|
|
},
|
|
|
|
unit_number = {
|
|
|
|
landmine = {},
|
|
|
|
flame_turret = {}
|
|
|
|
}
|
|
|
|
}
|
2020-05-17 12:23:55 +02:00
|
|
|
this.aura_upgrades = 0
|
2020-06-03 20:09:00 +02:00
|
|
|
if this.hidden_dimension then
|
|
|
|
this.hidden_dimension.logistic_research_level = 0
|
|
|
|
end
|
2020-05-17 12:23:55 +02:00
|
|
|
this.health_upgrades = 0
|
|
|
|
this.threat_upgrades = 0
|
2020-05-23 21:18:18 +02:00
|
|
|
this.breached_wall = 1
|
|
|
|
this.entity_limits = {}
|
|
|
|
this.offline_players_enabled = false
|
2020-05-20 09:10:17 +02:00
|
|
|
this.left_top = {
|
|
|
|
x = 0,
|
|
|
|
y = 0
|
|
|
|
}
|
2020-06-05 18:01:32 +02:00
|
|
|
this.traps = {}
|
2020-05-17 12:23:55 +02:00
|
|
|
end
|
|
|
|
|
2020-05-20 09:09:39 +02:00
|
|
|
function Public.get(key)
|
|
|
|
if key then
|
|
|
|
return this[key]
|
2020-05-17 12:23:55 +02:00
|
|
|
else
|
2020-05-20 09:09:39 +02:00
|
|
|
return this
|
2020-05-17 12:23:55 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local on_init = function()
|
|
|
|
Public.reset_table()
|
|
|
|
end
|
|
|
|
|
|
|
|
Event.on_init(on_init)
|
|
|
|
|
|
|
|
return Public
|