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"
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()
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;