From: Christopher Bock Date: Thu, 9 Jun 2016 08:53:41 +0000 (+0200) Subject: Gametype Infection: added new feature, mutany. Player can now mutany against their... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2bcea0dfc9b9a502a6927b5afc768cb289e86eb9;p=xonotic%2Fxonotic-data.pk3dir.git Gametype Infection: added new feature, mutany. Player can now mutany against their alpha und become alpha of their team however this will cost them 2 points, so it is a tradeoff. --- diff --git a/gamemodes.cfg b/gamemodes.cfg index 5112fa4c3..9f952e700 100644 --- a/gamemodes.cfg +++ b/gamemodes.cfg @@ -554,6 +554,7 @@ set g_infection_round_timelimit 180 "round time limit in seconds" set g_infection_warmup 5 "Time players get to run around before the round starts" set g_infection_teams 4 "Maximum number of teams (from 2 to 15 inclusive)" set g_infection_conversions 1 "Enable stealing when killing an alpha" +set g_infection_mutany 1 "Enable stealing by killing your own alpha" // ========== diff --git a/qcsrc/server/mutators/mutator/gamemode_infection.qc b/qcsrc/server/mutators/mutator/gamemode_infection.qc index b9d931b07..73662700e 100644 --- a/qcsrc/server/mutators/mutator/gamemode_infection.qc +++ b/qcsrc/server/mutators/mutator/gamemode_infection.qc @@ -4,6 +4,7 @@ float autocvar_g_infection_round_timelimit; float autocvar_g_infection_warmup; int autocvar_g_infection_teams; bool autocvar_g_infection_conversions; +bool autocvar_g_infection_mutany; int infection_players_count; @@ -184,8 +185,29 @@ MUTATOR_HOOKFUNCTION(inf, GiveFragsForKill, CBC_ORDER_FIRST) { frag_score = 0; infection_GetColorOwner(frag_attacker); + // Check whether this was an act of mutany + if (autocvar_g_infection_mutany + && infection_IsAlpha(frag_target) + && INF_SAMETEAM(frag_attacker, frag_target)) + { + // Mutany! Tell others about this act of shame! + FOREACH_CLIENT(IS_PLAYER(it) && INF_SAMETEAM(it, frag_target), { + centerprint(it, sprintf("^1MUTANY! Your alpha ^7%s^1 was killed by his own follower ^7%s^1!\n^7%s^1 is now your new alpha!", + frag_target.netname, frag_attacker.netname, frag_attacker.netname)); + }); + + centerprint(frag_attacker, sprintf("^2You became alpha of your team!")); + centerprint(frag_target, sprintf("^7%s^1 mutanied against you!", frag_attacker.netname)); + + frag_attacker.infectioncolor_original = frag_target.infectioncolor_original; + frag_target.infectioncolor_original = INFECTIONTEAM_NONE; + + frag_score = -2; + return true; + } + // If this is the first time we die... (our infectioncolor remained unchanged) - if (autocvar_g_infection_conversions && frag_target.infectioncolor == frag_target.infectioncolor_original) + if (autocvar_g_infection_conversions && infection_IsAlpha(frag_target)) { // check other players and see if they have our original infection color FOREACH_CLIENT(IS_PLAYER(it) && INF_SAMETEAM(it, frag_target), { @@ -196,6 +218,8 @@ MUTATOR_HOOKFUNCTION(inf, GiveFragsForKill, CBC_ORDER_FIRST) infection_SetColor(it, frag_attacker.infectioncolor); frag_score++; }); + + frag_target.infectioncolor_original = INFECTIONTEAM_NONE; } else { @@ -234,8 +258,10 @@ MUTATOR_HOOKFUNCTION(inf, PlayerDamage_Calculate) && INF_SAMETEAM(frag_attacker, frag_target) // Block friendly fire ) { - frag_damage = 0; - frag_force = '0 0 0'; + if(!infection_IsAlpha(frag_target) || (infection_IsAlpha(frag_target) && !autocvar_g_infection_mutany) ){ + frag_damage = 0; + frag_force = '0 0 0'; + } } return false; }