From f4acacfafb09818a60b29f13cc3f75e523263096 Mon Sep 17 00:00:00 2001 From: HySpeed Date: Sat, 14 Sep 2019 11:56:04 -0400 Subject: [PATCH] Added Incremental Respawn time to CrashSite (#957) "Respawn timer shouldn't be as long or maybe timer starts off small and increases per death or maybe based off evolution" -- Implementation is based off evolution --- config.lua | 13 +++++++++++-- map_gen/maps/crash_site/entity_died_events.lua | 4 +++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/config.lua b/config.lua index 3a48d7a2b..2c55e3680 100644 --- a/config.lua +++ b/config.lua @@ -203,9 +203,18 @@ global.config = { {name = 'compilatron-chest', count = 5}, {name = 'compilatron-chest', count = 5}, {name = 'selection-tool', count = 1} + } } - } - }, + }, + -- settings for controlling length of delay before player respawn + -- respawn time is determined by biter progression: + -- min_time + (increment_amount * biter_progression ) + -- min_time default is 10 seconds + -- increment_amount default of 3000 will add ~5 seconds per 10% evolution and max at 60 seconds + player_respawn_time = { + min_time = 600, + increment_amount = 3000 + }, -- spawns more units when one dies hail_hydra = { enabled = false, diff --git a/map_gen/maps/crash_site/entity_died_events.lua b/map_gen/maps/crash_site/entity_died_events.lua index 3b4268697..d33bb14d1 100644 --- a/map_gen/maps/crash_site/entity_died_events.lua +++ b/map_gen/maps/crash_site/entity_died_events.lua @@ -6,6 +6,7 @@ local math = require 'utils.math' local table = require 'utils.table' local random = math.random +local round = math.round local set_timeout_in_ticks = Task.set_timeout_in_ticks local ceil = math.ceil local draw_arc = rendering.draw_arc @@ -173,7 +174,8 @@ local spawn_player = Token.register( function(player) if player and player.valid then - player.ticks_to_respawn = 3600 + local increment = round(game.forces.enemy.evolution_factor * global.config.player_respawn_time.increment_amount) + player.ticks_to_respawn = global.config.player_respawn_time.min_time + increment end end )