2020-06-07 13:33:24 +02:00
|
|
|
-- one table to rule them all!
|
2020-05-17 12:23:55 +02:00
|
|
|
local Global = require 'utils.global'
|
|
|
|
local Event = require 'utils.event'
|
|
|
|
|
|
|
|
local this = {
|
2020-05-19 23:00:52 +02:00
|
|
|
players = {},
|
2020-05-21 23:08:23 +02:00
|
|
|
offline_players = {},
|
2020-07-14 21:50:56 +02:00
|
|
|
--[[ hidden_dimension = {
|
2020-06-03 20:09:00 +02:00
|
|
|
logistic_research_level = 0,
|
|
|
|
reset_counter = 1
|
|
|
|
},
|
2020-07-14 21:50:56 +02:00
|
|
|
]]
|
2020-05-23 21:18:18 +02:00
|
|
|
breached_wall = 1,
|
2020-06-05 18:01:32 +02:00
|
|
|
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-07 23:25:01 +02:00
|
|
|
-- @start
|
|
|
|
-- these 3 are in case of stop/start/reloading the instance.
|
|
|
|
this.soft_reset = true
|
|
|
|
this.restart = false
|
|
|
|
this.shutdown = false
|
|
|
|
this.announced_message = false
|
|
|
|
-- @end
|
2020-06-03 20:09:00 +02:00
|
|
|
this.icw_locomotive = nil
|
|
|
|
this.debug = false
|
2020-08-09 20:31:50 +02:00
|
|
|
this.game_lost = false
|
2020-06-03 20:09:00 +02:00
|
|
|
this.fullness_enabled = true
|
2020-05-17 12:23:55 +02:00
|
|
|
this.locomotive_health = 10000
|
|
|
|
this.locomotive_max_health = 10000
|
2020-08-09 20:31:50 +02:00
|
|
|
this.enable_biter_settings = true
|
2020-05-17 12:23:55 +02:00
|
|
|
this.train_upgrades = 0
|
|
|
|
this.offline_players = {}
|
|
|
|
this.biter_pets = {}
|
2020-05-23 21:18:18 +02:00
|
|
|
this.flamethrower_damage = {}
|
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-07-28 11:24:16 +02:00
|
|
|
--!grief prevention
|
|
|
|
this.enable_arties = 5 -- default to callback 6
|
|
|
|
--!snip
|
2020-06-07 13:33:24 +02:00
|
|
|
this.poison_deployed = false
|
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-06-03 20:09:00 +02:00
|
|
|
if this.hidden_dimension then
|
|
|
|
this.hidden_dimension.logistic_research_level = 0
|
|
|
|
end
|
2020-07-06 15:45:09 +02:00
|
|
|
this.aura_upgrades = 0
|
2020-05-17 12:23:55 +02:00
|
|
|
this.health_upgrades = 0
|
2020-05-23 21:18:18 +02:00
|
|
|
this.breached_wall = 1
|
2020-06-10 00:11:35 +02:00
|
|
|
this.offline_players_enabled = true
|
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-08-04 12:10:15 +02:00
|
|
|
this.munch_time = true
|
2020-07-06 15:45:09 +02:00
|
|
|
this.coin_amount = 1
|
|
|
|
this.difficulty_set = false
|
2020-08-04 12:10:15 +02:00
|
|
|
this.bonus_xp_on_join = 250
|
2020-07-06 15:45:09 +02:00
|
|
|
this.main_market_items = {}
|
2020-07-28 11:24:16 +02:00
|
|
|
this.spill_items_to_surface = false
|
2020-07-06 15:45:09 +02:00
|
|
|
this.outside_chests = {}
|
|
|
|
this.chests_linked_to = {}
|
|
|
|
this.chest_limit_outside_upgrades = 1
|
2020-07-08 22:57:43 +02:00
|
|
|
this.force_mining_speed = {
|
|
|
|
speed = 0
|
|
|
|
}
|
2020-07-14 21:50:56 +02:00
|
|
|
this.placed_trains_in_zone = {
|
|
|
|
placed = 0,
|
|
|
|
positions = {},
|
2020-07-22 18:58:42 +02:00
|
|
|
limit = 5,
|
|
|
|
randomized = false
|
2020-07-14 21:50:56 +02:00
|
|
|
}
|
2020-07-25 17:22:04 +02:00
|
|
|
this.collapse_grace = true
|
2020-07-27 11:07:32 +02:00
|
|
|
this.locomotive_biter = nil
|
2020-07-28 16:48:55 +02:00
|
|
|
this.disconnect_wagon = false
|
2020-08-14 17:16:04 +02:00
|
|
|
this.spidertron_unlocked_at_wave = 11
|
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
|
|
|
|
|
2020-07-14 21:50:56 +02:00
|
|
|
function Public.set(key)
|
|
|
|
if key then
|
|
|
|
return this[key]
|
|
|
|
else
|
|
|
|
return this
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-05-17 12:23:55 +02:00
|
|
|
local on_init = function()
|
|
|
|
Public.reset_table()
|
|
|
|
end
|
|
|
|
|
|
|
|
Event.on_init(on_init)
|
|
|
|
|
|
|
|
return Public
|