From e83681c5a21baff962fa8078eeb30d3914fc1ae6 Mon Sep 17 00:00:00 2001 From: terencehill Date: Tue, 7 Mar 2017 20:15:13 +0100 Subject: [PATCH] Fix a subtle Key Hunt bug causing bots to not run to any item as soon as keys are assigned to players --- qcsrc/server/mutators/mutator/gamemode_keyhunt.qc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc index 6750d48d0..52daeb796 100644 --- a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc @@ -248,7 +248,8 @@ void kh_Key_Attach(entity key) // runs when a player picks up a key and several key.angles_y -= key.owner.angles.y; #endif key.flags = 0; - IL_REMOVE(g_items, key); + if(IL_CONTAINS(g_items, key)) + IL_REMOVE(g_items, key); key.solid = SOLID_NOT; set_movetype(key, MOVETYPE_NONE); key.team = key.owner.team; @@ -288,7 +289,8 @@ void kh_Key_Detach(entity key) // runs every time a key is dropped or lost. Runs key.angles_y += key.owner.angles.y; #endif key.flags = FL_ITEM; - IL_PUSH(g_items, key); + if(!IL_CONTAINS(g_items, key)) + IL_PUSH(g_items, key); key.solid = SOLID_TRIGGER; set_movetype(key, MOVETYPE_TOSS); key.pain_finished = time + autocvar_g_balance_keyhunt_delay_return; -- 2.39.2