From 328dd86d0d025fbcfc60243b5438903745f3d88d Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 26 Jul 2024 12:07:12 +1000 Subject: [PATCH] Prevent independent players from claiming some objectives --- qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc | 5 +++-- qcsrc/common/gamemodes/gamemode/domination/sv_domination.qc | 4 +++- qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc | 1 + qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc | 2 ++ qcsrc/common/gamemodes/gamemode/tka/sv_tka.qc | 1 + 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc index 16130f086..e6554964a 100644 --- a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc +++ b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc @@ -1125,7 +1125,8 @@ METHOD(Flag, giveTo, bool(Flag this, entity flag, entity toucher)) } // special touch behaviors - if(STAT(FROZEN, toucher)) { return; } + if(IS_INDEPENDENT_PLAYER(toucher)) { return; } + else if(STAT(FROZEN, toucher)) { return; } else if(IS_VEHICLE(toucher)) { if(autocvar_g_ctf_allow_vehicle_touch && toucher.owner) @@ -2388,7 +2389,7 @@ MUTATOR_HOOKFUNCTION(ctf, PlayerUseKey) while(head) // find the closest acceptable target to pass to { - if(IS_PLAYER(head) && !IS_DEAD(head)) + if(IS_PLAYER(head) && !IS_DEAD(head) && !IS_INDEPENDENT_PLAYER(head)) if(head != player && SAME_TEAM(head, player)) if(!head.speedrunning && !head.vehicle) { diff --git a/qcsrc/common/gamemodes/gamemode/domination/sv_domination.qc b/qcsrc/common/gamemodes/gamemode/domination/sv_domination.qc index e245ff92f..91e78dda4 100644 --- a/qcsrc/common/gamemodes/gamemode/domination/sv_domination.qc +++ b/qcsrc/common/gamemodes/gamemode/domination/sv_domination.qc @@ -198,7 +198,9 @@ void dompointtouch(entity this, entity toucher) { if(!IS_PLAYER(toucher)) return; - if(GetResource(toucher, RES_HEALTH) < 1) + if(IS_DEAD(toucher)) + return; + if(IS_INDEPENDENT_PLAYER(toucher)) return; if(round_handler_IsActive() && !round_handler_IsRoundStarted()) diff --git a/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc b/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc index 4ba23b197..9f694a0e0 100644 --- a/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc +++ b/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc @@ -115,6 +115,7 @@ void ka_TouchEvent(entity this, entity toucher) // runs any time that the ball c return; } if(toucher.ballcarried) { return; } + if(IS_INDEPENDENT_PLAYER(toucher)) { return; } if(IS_DEAD(toucher)) { return; } if(STAT(FROZEN, toucher)) { return; } if (!IS_PLAYER(toucher)) diff --git a/qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc b/qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc index beb5cd7f4..15024ed88 100644 --- a/qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc +++ b/qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc @@ -455,6 +455,8 @@ void kh_Key_Touch(entity this, entity toucher) // runs many, many times when a return; if(IS_DEAD(toucher)) return; + if(IS_INDEPENDENT_PLAYER(toucher)) + return; if(toucher == this.enemy) if(time < this.kh_droptime + autocvar_g_balance_keyhunt_delay_collect) return; // you just dropped it! diff --git a/qcsrc/common/gamemodes/gamemode/tka/sv_tka.qc b/qcsrc/common/gamemodes/gamemode/tka/sv_tka.qc index 507d31750..0935b9709 100644 --- a/qcsrc/common/gamemodes/gamemode/tka/sv_tka.qc +++ b/qcsrc/common/gamemodes/gamemode/tka/sv_tka.qc @@ -92,6 +92,7 @@ void tka_TouchEvent(entity this, entity toucher) // runs any time that the ball return; } if(toucher.ballcarried) { return; } + if(IS_INDEPENDENT_PLAYER(toucher)) { return; } if(IS_DEAD(toucher)) { return; } if(STAT(FROZEN, toucher)) { return; } if (!IS_PLAYER(toucher)) -- 2.39.2