]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Kick teamkiller mutator: use lower limit of teamkills instead of mintime
authorFreddy <schro.sb@gmail.com>
Wed, 27 Sep 2017 20:26:26 +0000 (22:26 +0200)
committerFreddy <schro.sb@gmail.com>
Wed, 27 Sep 2017 20:26:26 +0000 (22:26 +0200)
mutators.cfg
qcsrc/common/mutators/mutator/kick_teamkiller/sv_kick_teamkiller.qc

index 6e581fdbc4275f88ec421b9cf831f08a8f8506dc..1538c684fa8947d7aa4eed368f9b6564b53f1580 100644 (file)
@@ -476,5 +476,5 @@ set g_dynamic_handicap_max 0 "The maximum value of the handicap."
 // ===============
 // kick teamkiller
 // ===============
-set g_kick_teamkiller_rate 0 "Limit for teamkills per minute before the client gets dropped."
-set g_kick_teamkiller_mintime 2 "Minimum playtime in minutes that is used for teamkill rate calculation"
+set g_kick_teamkiller_rate 0 "Limit for teamkills per minute before the client gets dropped. 0 means that the teamkillers don't get kicked automatically"
+set g_kick_teamkiller_lower_limit 5 "Minimum number of teamkills before the teamkill rate is considered"
index 1772bcc63402ed1970031095c9ed33c039f892e9..5b5f03833b4f847efcd60c5e020dea56d040a219 100644 (file)
@@ -1,6 +1,6 @@
 
 float autocvar_g_kick_teamkiller_rate;
-float autocvar_g_kick_teamkiller_mintime;
+float autocvar_g_kick_teamkiller_lower_limit;
 
 REGISTER_MUTATOR(kick_teamkiller, (autocvar_g_kick_teamkiller_rate > 0));
 
@@ -21,10 +21,11 @@ MUTATOR_HOOKFUNCTION(kick_teamkiller, PlayerDies)
        }
 
        int teamkills = PlayerScore_Get(attacker, SP_TEAMKILLS);
-       // don't use the players actual playtime if they just started playing
-       // to avoid kicking players who only teamkilled by mistake just after joining
-       float playtime_minutes = max((time - attacker.alivetime)/60.0, autocvar_g_kick_teamkiller_mintime);
-       if (teamkills >= autocvar_g_kick_teamkiller_rate*playtime_minutes)
+       // use the players actual playtime
+       float playtime = time - attacker.alivetime;
+       // rate is in teamkills/minutes, playtime in seconds
+       if (teamkills >= autocvar_g_kick_teamkiller_lower_limit && 
+           teamkills >= autocvar_g_kick_teamkiller_rate*playtime/60.0)
        {
                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_QUIT_KICK_TEAMKILL, attacker.netname);
                dropclient(attacker);