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-06-05 18:01:32 +02:00
|
|
|
traps = {}
|
2020-05-17 12:23:55 +02:00
|
|
|
}
|
|
|
|
local Public = {}
|
|
|
|
|
2021-07-12 16:15:55 +02:00
|
|
|
Public.events = {reset_map = Event.generate_event_name('reset_map')}
|
|
|
|
|
2020-05-17 12:23:55 +02:00
|
|
|
Global.register(
|
|
|
|
this,
|
|
|
|
function(tbl)
|
|
|
|
this = tbl
|
|
|
|
end
|
|
|
|
)
|
|
|
|
|
2020-11-23 23:10:45 +02:00
|
|
|
Public.level_depth = 704
|
2021-08-21 09:39:12 +02:00
|
|
|
Public.level_width = 510
|
2020-11-23 23:10:45 +02:00
|
|
|
|
2020-10-10 20:36:51 +02:00
|
|
|
Public.pickaxe_upgrades = {
|
|
|
|
'Wood',
|
|
|
|
'Plastic',
|
|
|
|
'Bone',
|
|
|
|
'Alabaster',
|
|
|
|
'Lead',
|
|
|
|
'Zinc',
|
|
|
|
'Tin',
|
|
|
|
'Salt',
|
|
|
|
'Bauxite',
|
|
|
|
'Borax',
|
|
|
|
'Bismuth',
|
|
|
|
'Amber',
|
|
|
|
'Galena',
|
|
|
|
'Calcite',
|
|
|
|
'Aluminium',
|
|
|
|
'Silver',
|
|
|
|
'Gold',
|
|
|
|
'Copper',
|
|
|
|
'Marble',
|
|
|
|
'Brass',
|
|
|
|
'Flourite',
|
|
|
|
'Platinum',
|
|
|
|
'Nickel',
|
|
|
|
'Iron',
|
|
|
|
'Manganese',
|
|
|
|
'Apatite',
|
|
|
|
'Uraninite',
|
|
|
|
'Turquoise',
|
|
|
|
'Hematite',
|
|
|
|
'Glass',
|
|
|
|
'Magnetite',
|
|
|
|
'Concrete',
|
|
|
|
'Pyrite',
|
|
|
|
'Steel',
|
|
|
|
'Zircon',
|
|
|
|
'Titanium',
|
|
|
|
'Silicon',
|
|
|
|
'Quartz',
|
|
|
|
'Garnet',
|
|
|
|
'Flint',
|
|
|
|
'Tourmaline',
|
|
|
|
'Beryl',
|
|
|
|
'Topaz',
|
|
|
|
'Chrysoberyl',
|
|
|
|
'Chromium',
|
|
|
|
'Tungsten',
|
|
|
|
'Corundum',
|
|
|
|
'Tungsten',
|
|
|
|
'Diamond',
|
|
|
|
'Penumbrite',
|
|
|
|
'Meteorite',
|
|
|
|
'Crimtane',
|
|
|
|
'Obsidian',
|
|
|
|
'Demonite',
|
|
|
|
'Mythril',
|
|
|
|
'Adamantite',
|
|
|
|
'Chlorophyte',
|
|
|
|
'Densinium',
|
|
|
|
'Luminite'
|
|
|
|
}
|
|
|
|
|
2020-05-17 12:23:55 +02:00
|
|
|
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
|
2020-09-02 17:36:04 +02:00
|
|
|
this.game_saved = false
|
2020-06-07 23:25:01 +02:00
|
|
|
-- @end
|
2020-06-03 20:09:00 +02:00
|
|
|
this.icw_locomotive = nil
|
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-09-25 11:08:15 +02:00
|
|
|
this.gap_between_zones = {
|
|
|
|
set = false,
|
2020-11-17 16:03:05 +02:00
|
|
|
gap = 900,
|
2020-11-18 16:24:22 +02:00
|
|
|
neg_gap = -500,
|
|
|
|
highest_pos = 0
|
2020-09-25 11:08:15 +02:00
|
|
|
}
|
2020-10-27 00:55:06 +02:00
|
|
|
this.force_chunk = false
|
2021-09-17 22:28:18 +02:00
|
|
|
this.allow_decon = true
|
2020-05-17 12:23:55 +02:00
|
|
|
this.train_upgrades = 0
|
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
|
2020-09-17 09:14:07 +02:00
|
|
|
this.cleared_nauvis = false
|
2020-05-17 12:23:55 +02:00
|
|
|
this.locomotive_xp_aura = 40
|
2020-11-18 16:24:22 +02:00
|
|
|
this.locomotive_pos = {tbl = {}}
|
2020-08-27 13:27:34 +02:00
|
|
|
this.trusted_only_car_tanks = true
|
2020-05-17 12:23:55 +02:00
|
|
|
this.xp_points = 0
|
|
|
|
this.xp_points_upgrade = 0
|
2020-07-28 11:24:16 +02:00
|
|
|
--!grief prevention
|
2020-09-17 09:14:07 +02:00
|
|
|
this.enable_arties = 6 -- default to callback 6
|
2020-07-28 11:24:16 +02:00
|
|
|
--!snip
|
2020-06-07 13:33:24 +02:00
|
|
|
this.poison_deployed = false
|
2021-02-01 00:59:49 +02:00
|
|
|
this.robotics_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-07-06 15:45:09 +02:00
|
|
|
this.aura_upgrades = 0
|
2020-10-10 20:36:51 +02:00
|
|
|
this.pickaxe_tier = 1
|
2021-05-16 13:48:50 +02:00
|
|
|
this.pickaxe_speed_per_purchase = 0.07
|
|
|
|
this.health_upgrades = 1
|
|
|
|
this.health_upgrades_limit = 100
|
2020-05-23 21:18:18 +02:00
|
|
|
this.breached_wall = 1
|
2020-05-20 09:10:17 +02:00
|
|
|
this.left_top = {
|
|
|
|
x = 0,
|
|
|
|
y = 0
|
|
|
|
}
|
2020-09-02 17:36:04 +02:00
|
|
|
this.biters = {
|
|
|
|
amount = 0,
|
2020-09-17 09:14:07 +02:00
|
|
|
limit = 512
|
2020-09-02 17:36:04 +02:00
|
|
|
}
|
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-14 21:50:56 +02:00
|
|
|
this.placed_trains_in_zone = {
|
|
|
|
placed = 0,
|
|
|
|
positions = {},
|
2020-11-15 20:23:54 +02:00
|
|
|
limit = 2,
|
2020-07-22 18:58:42 +02:00
|
|
|
randomized = false
|
2020-07-14 21:50:56 +02:00
|
|
|
}
|
2020-10-21 23:17:17 +02:00
|
|
|
this.marked_fixed_prices = {
|
|
|
|
chest_limit_cost = 3000,
|
2021-02-01 00:59:49 +02:00
|
|
|
health_cost = 7000,
|
2020-10-21 23:17:17 +02:00
|
|
|
pickaxe_cost = 3000,
|
|
|
|
aura_cost = 4000,
|
|
|
|
xp_point_boost_cost = 5000,
|
2021-02-01 00:59:49 +02:00
|
|
|
explosive_bullets_cost = 10000,
|
2020-10-21 23:17:17 +02:00
|
|
|
flamethrower_turrets_cost = 3000,
|
2021-02-01 00:59:49 +02:00
|
|
|
land_mine_cost = 2
|
2020-10-21 23:17:17 +02:00
|
|
|
}
|
2020-07-25 17:22:04 +02:00
|
|
|
this.collapse_grace = true
|
2020-08-21 13:56:01 +02:00
|
|
|
this.explosive_bullets = false
|
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-12-04 02:09:52 +02:00
|
|
|
this.offline_players_enabled = true
|
|
|
|
this.offline_players = {}
|
2020-12-05 19:09:09 +02:00
|
|
|
this.collapse_amount = false
|
|
|
|
this.collapse_speed = false
|
2020-11-23 23:10:45 +02:00
|
|
|
this.spawn_near_collapse = {
|
|
|
|
active = true,
|
|
|
|
total_pos = 35,
|
|
|
|
compare = -150,
|
|
|
|
compare_next = 200,
|
|
|
|
distance_from = 2
|
|
|
|
}
|
2021-02-15 23:34:24 +02:00
|
|
|
this.spidertron_unlocked_at_zone = 11
|
2020-08-22 20:15:56 +02:00
|
|
|
-- this.void_or_tile = 'lab-dark-2'
|
|
|
|
this.void_or_tile = 'out-of-map'
|
2020-11-17 16:03:05 +02:00
|
|
|
this.validate_spider = {}
|
2020-12-20 20:56:26 +02:00
|
|
|
this.check_afk_players = true
|
2020-12-28 11:48:25 +02:00
|
|
|
this.winter_mode = false
|
|
|
|
this.sent_to_discord = false
|
2020-12-30 12:07:44 +02:00
|
|
|
this.difficulty = {
|
|
|
|
multiply = 0.25,
|
2021-10-08 18:52:14 +02:00
|
|
|
highest = 10,
|
|
|
|
lowest = 4
|
2020-12-30 12:07:44 +02:00
|
|
|
}
|
2021-10-08 18:52:14 +02:00
|
|
|
this.mining_bonus_till_wave = 300
|
2021-02-10 23:08:07 +02:00
|
|
|
this.market_announce = game.tick + 1200
|
2021-02-12 01:48:56 +02:00
|
|
|
this.check_heavy_damage = true
|
2021-07-12 16:15:55 +02:00
|
|
|
this.prestige_system_enabled = false
|
2021-05-23 17:03:52 +02:00
|
|
|
for k, _ in pairs(this.players) do
|
|
|
|
this.players[k] = {}
|
2020-09-25 11:08:15 +02:00
|
|
|
end
|
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-11-17 13:45:27 +02:00
|
|
|
function Public.set(key, value)
|
2020-11-17 16:03:05 +02:00
|
|
|
if key and (value or value == false) then
|
2020-11-17 13:45:27 +02:00
|
|
|
this[key] = value
|
|
|
|
return this[key]
|
|
|
|
elseif key then
|
2020-07-14 21:50:56 +02:00
|
|
|
return this[key]
|
|
|
|
else
|
|
|
|
return this
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-03-01 23:12:36 +02:00
|
|
|
function Public.remove(key)
|
|
|
|
if key then
|
|
|
|
this[key] = nil
|
|
|
|
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
|