From: terencehill Date: Tue, 7 Mar 2017 19:15:13 +0000 (+0100) Subject: Fix a subtle Key Hunt bug causing bots to not run to any item as soon as keys are... X-Git-Tag: xonotic-v0.8.2~106 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=e83681c5a21baff962fa8078eeb30d3914fc1ae6;ds=sidebyside Fix a subtle Key Hunt bug causing bots to not run to any item as soon as keys are assigned to players --- diff --git a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc index 6750d48d0d..52daeb7963 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;