From: Lyberta Date: Sun, 8 Oct 2017 21:50:38 +0000 (+0300) Subject: Random items: Preserve team of the items. X-Git-Tag: xonotic-v0.8.5~2426^2~27 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ccbcb3106b45ccc788ed1c5062a873693d499a43;p=xonotic%2Fxonotic-data.pk3dir.git Random items: Preserve team of the items. --- diff --git a/qcsrc/common/mutators/mutator/random_items/sv_random_items.qc b/qcsrc/common/mutators/mutator/random_items/sv_random_items.qc index 32f4e6b53..b971ac1dc 100644 --- a/qcsrc/common/mutators/mutator/random_items/sv_random_items.qc +++ b/qcsrc/common/mutators/mutator/random_items/sv_random_items.qc @@ -346,6 +346,11 @@ entity RandomItems_ReplaceMapItem(entity item) if (!expr_evaluate(autocvar_g_overkill)) { new_item = Item_Create(strzone(new_classname), item.origin); + random_items_is_spawning = false; + if (new_item == NULL) + { + return NULL; + } } else { @@ -354,13 +359,17 @@ entity RandomItems_ReplaceMapItem(entity item) new_item.spawnfunc_checked = true; new_item.ok_item = true; Item_Initialize(new_item, new_classname); + random_items_is_spawning = false; if (wasfreed(new_item)) { return NULL; } setorigin(new_item, item.origin); } - random_items_is_spawning = false; + if (item.team) + { + new_item.team = item.team; + } return new_item; }