From: terencehill Date: Wed, 1 Apr 2020 16:09:51 +0000 (+0200) Subject: LMS: Implement a LMS-specific health rot system activable with g_lms_regenerate ... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a45b6b1aba1167c42a5cc56465bd4c6fb000ac4e;p=xonotic%2Fxonotic-data.pk3dir.git LMS: Implement a LMS-specific health rot system activable with g_lms_regenerate -1: the more the players, the higher the rot pace --- diff --git a/gamemodes-server.cfg b/gamemodes-server.cfg index b1631b233..aacc3a2db 100644 --- a/gamemodes-server.cfg +++ b/gamemodes-server.cfg @@ -437,9 +437,12 @@ set g_keyhunt_team_spawns 0 "when 1, players spawn from the team spawnpoints of set g_lms 0 "Last Man Standing: everyone starts with a certain amount of lives, and the survivor wins" set g_lms_lives_override -1 set g_lms_extra_lives 0 -set g_lms_regenerate 0 +set g_lms_regenerate 0 "1: apply normal rot/regen rules, -1: apply lms-specific rules (health rots depending on the number of alive players)" +set g_lms_rot_base 0.0025 "rot pace while there are only 2 alive players" +set g_lms_rot_increase 0.001 "rot pace increase for each player exceeding the minimum number of alive players (2)" +set g_lms_rot_max 0.006 "max rot pace" set g_lms_last_join 3 "if g_lms_join_anytime is false, new players can only join if the worst active player has more than (fraglimit - g_lms_last_join) lives" -set g_lms_join_anytime 1 "if true, new players can join, but get same amount of lives as the worst player" +set g_lms_join_anytime 1 "allow new players to join, but they get same amount of lives as the worst player" set g_lms_weaponarena "most_available" "starting weapons - takes the same options as g_weaponarena" diff --git a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc index bff9722d0..06b9f818d 100644 --- a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc +++ b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc @@ -8,6 +8,10 @@ int autocvar_g_lms_extra_lives; bool autocvar_g_lms_join_anytime; int autocvar_g_lms_last_join; bool autocvar_g_lms_regenerate; +float autocvar_g_lms_rot_base; +float autocvar_g_lms_rot_increase; +float autocvar_g_lms_rot_max; + // main functions int LMS_NewPlayerLives() @@ -280,6 +284,29 @@ MUTATOR_HOOKFUNCTION(lms, PlayerPreThink) MUTATOR_HOOKFUNCTION(lms, PlayerRegen) { + if (autocvar_g_lms_regenerate == -1) + { + int totalplayers = 0; + FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME, { + ++totalplayers; + }); + entity player = M_ARGV(0, entity); + float max_mod = 1; + float regen_mod = 1; + float rot_mod = 1; + float limit_mod = 1; + float regen_health = 0; + float regen_health_linear = 1; + float regen_health_rot = autocvar_g_lms_rot_base + autocvar_g_lms_rot_increase * max(0, totalplayers - 2); + regen_health_rot = min(autocvar_g_lms_rot_max, regen_health_rot); + float regen_health_rotlinear = 1; + float regen_health_stable = 0; + float regen_health_rotstable = 0; + RotRegen(player, RES_HEALTH, regen_health_stable * max_mod, regen_health, regen_health_linear, + regen_mod * frametime * (time > player.pauseregen_finished), regen_health_rotstable * max_mod, regen_health_rot, regen_health_rotlinear, + rot_mod * frametime * (time > player.pauserothealth_finished), limit_mod); + return true; + } if(autocvar_g_lms_regenerate) return false; return true;