1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-10 00:43:27 +02:00
ComfyFactorio/modules/wave_defense/table.lua

162 lines
3.6 KiB
Lua
Raw Normal View History

2019-10-28 18:38:36 +02:00
local Global = require 'utils.global'
local Event = require 'utils.event'
2020-08-09 20:23:45 +02:00
local this = {}
2019-10-28 18:38:36 +02:00
local Public = {}
Global.register(
2020-08-09 20:23:45 +02:00
this,
2019-10-28 18:38:36 +02:00
function(tbl)
2020-08-09 20:23:45 +02:00
this = tbl
2019-10-28 18:38:36 +02:00
end
)
2020-10-24 14:46:14 +02:00
function Public.debug_module()
this.next_wave = 1000
this.wave_interval = 500
this.wave_enforced = true
end
2019-10-28 18:38:36 +02:00
function Public.reset_wave_defense()
2020-08-09 20:23:45 +02:00
this.boss_wave = false
this.boss_wave_warning = false
this.side_target_count = 0
this.active_biters = {}
this.active_biter_count = 0
this.active_biter_threat = 0
this.average_unit_group_size = 128
2020-08-09 20:23:45 +02:00
this.biter_raffle = {}
this.debug = false
this.game_lost = false
this.get_random_close_spawner_attempts = 5
this.group_size = 2
this.last_wave = game.tick
this.max_active_biters = 1280
this.max_active_unit_groups = 6
2020-08-09 20:23:45 +02:00
this.max_biter_age = 3600 * 60
this.nests = {}
2020-08-09 20:23:45 +02:00
this.nest_building_density = 48
this.next_wave = game.tick + 3600 * 15
this.side_targets = {}
this.simple_entity_shredding_cost_modifier = 0.009
2020-08-09 20:23:45 +02:00
this.spawn_position = {x = 0, y = 64}
this.spitter_raffle = {}
this.surface_index = 1
this.target = nil
this.threat = 0
this.threat_gain_multiplier = 2
this.threat_log = {}
this.threat_log_index = 0
this.unit_groups = {}
this.index = 0
this.random_group = nil
this.unit_group_command_delay = 3600 * 25
this.unit_group_command_step_length = 15
2020-08-09 20:23:45 +02:00
this.unit_group_last_command = {}
this.wave_interval = 3600
2020-10-24 14:46:14 +02:00
this.wave_enforced = false
2020-08-09 20:23:45 +02:00
this.wave_number = 0
this.worm_building_chance = 3
this.worm_building_density = 16
this.worm_raffle = {}
this.clear_corpses = false
2020-10-25 18:02:37 +02:00
this.biter_health_boost = 1
2020-08-09 20:23:45 +02:00
this.alert_boss_wave = false
2020-10-22 13:32:18 +02:00
this.remove_entities = false
2020-08-09 20:23:45 +02:00
this.enable_threat_log = true
this.check_collapse_position = true
2019-10-28 18:38:36 +02:00
end
2020-07-24 17:33:28 +02:00
function Public.get(key)
if key then
2020-08-09 20:23:45 +02:00
return this[key]
2020-07-24 17:33:28 +02:00
else
2020-08-09 20:23:45 +02:00
return this
2020-07-24 17:33:28 +02:00
end
2019-10-28 18:38:36 +02:00
end
2020-07-24 17:33:28 +02:00
function Public.set(key)
if key then
2020-08-09 20:23:45 +02:00
return this[key]
2020-07-24 17:33:28 +02:00
else
2020-08-09 20:23:45 +02:00
return this
2020-07-24 17:33:28 +02:00
end
end
Public.get_table = Public.get
2020-06-07 13:33:24 +02:00
function Public.clear_corpses(value)
if value then
2020-08-09 20:23:45 +02:00
this.clear_corpses = value
2020-08-17 20:18:06 +02:00
else
this.clear_corpses = false
2020-06-07 13:33:24 +02:00
end
2020-08-09 20:23:45 +02:00
return this.clear_corpses
2020-06-24 15:41:44 +02:00
end
function Public.get_wave()
2020-08-09 20:23:45 +02:00
return this.wave_number
2020-06-07 13:33:24 +02:00
end
function Public.alert_boss_wave(value)
if value then
2020-08-09 20:23:45 +02:00
this.alert_boss_wave = value
2020-08-17 20:18:06 +02:00
else
this.alert_boss_wave = false
2020-06-07 13:33:24 +02:00
end
2020-08-09 20:23:45 +02:00
return this.alert_boss_wave
2020-06-07 13:33:24 +02:00
end
2020-08-21 13:56:01 +02:00
function Public.set_spawn_position(value)
if type(value) == 'table' then
this.spawn_position = value
else
error('Value must be of type table.')
end
return this.spawn_position
end
2020-08-04 12:10:15 +02:00
function Public.remove_entities(value)
if value then
2020-08-09 20:23:45 +02:00
this.remove_entities = value
2020-08-17 20:18:06 +02:00
else
this.remove_entities = false
2020-08-04 12:10:15 +02:00
end
2020-08-09 20:23:45 +02:00
return this.remove_entities
end
function Public.enable_threat_log(value)
if value then
this.enable_threat_log = value
2020-08-17 20:18:06 +02:00
else
this.enable_threat_log = false
2020-08-09 20:23:45 +02:00
end
return this.enable_threat_log
end
function Public.check_collapse_position(value)
if value then
this.check_collapse_position = value
2020-08-17 20:18:06 +02:00
else
this.check_collapse_position = false
2020-08-09 20:23:45 +02:00
end
return this.check_collapse_position
2020-08-04 12:10:15 +02:00
end
2020-10-25 18:02:37 +02:00
function Public.set_biter_health_boost(value)
if value and type(value) == 'number' then
this.biter_health_boost = value
else
this.biter_health_boost = 1
end
return this.biter_health_boost
end
2020-06-07 13:33:24 +02:00
local on_init = function()
2019-10-28 18:38:36 +02:00
Public.reset_wave_defense()
end
Event.on_init(on_init)
return Public