X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fgamemodes%2Fgamemode%2Flms%2Fsv_lms.qc;fp=qcsrc%2Fcommon%2Fgamemodes%2Fgamemode%2Flms%2Fsv_lms.qc;h=dd2c93e5037af969fd62155846a8a94b1ebac134;hp=e69e1b7d4490295e68cc371b3449a34272d56290;hb=61ec7040b5c809cc0ff62e92f21d5cbb8183bfb9;hpb=795d52997c93986d6569c95b717c383a2e162879 diff --git a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc index e69e1b7d4..dd2c93e50 100644 --- a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc +++ b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc @@ -197,6 +197,28 @@ MUTATOR_HOOKFUNCTION(lms, PutClientInServer) } } +MUTATOR_HOOKFUNCTION(lms, PlayerSpawn) +{ + entity player = M_ARGV(0, entity); + + if (warmup_stage || time < game_starttime) + return true; + + int pl_lives = GameRules_scoring_add(player, LMS_LIVES, 0); + float min_health = start_health; + float min_armorvalue = start_armorvalue; + FOREACH_CLIENT(it != player && IS_PLAYER(it) && !IS_DEAD(it) && GameRules_scoring_add(it, LMS_LIVES, 0) == pl_lives, { + if (GetResource(it, RES_HEALTH) < min_health) + min_health = GetResource(it, RES_HEALTH); + if (GetResource(it, RES_ARMOR) < min_armorvalue) + min_armorvalue = GetResource(it, RES_ARMOR); + }); + if (min_health != start_health) + SetResource(player, RES_HEALTH, max(1, min_health)); + if (min_armorvalue != start_armorvalue) + SetResource(player, RES_ARMOR, min_armorvalue); +} + MUTATOR_HOOKFUNCTION(lms, ForbidSpawn) { entity player = M_ARGV(0, entity);