]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Random items: Preserve team of the items.
authorLyberta <lyberta@lyberta.net>
Sun, 8 Oct 2017 21:50:38 +0000 (00:50 +0300)
committerLyberta <lyberta@lyberta.net>
Sun, 8 Oct 2017 21:50:38 +0000 (00:50 +0300)
qcsrc/common/mutators/mutator/random_items/sv_random_items.qc

index 32f4e6b53be9bce2269bec47d2fcfef65a07436e..b971ac1dc58f5e4e4b48e5d5ffd0d6516759ed9c 100644 (file)
@@ -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;
 }