]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix #2279 "Randomised powerups not working correctly"
authorterencehill <piuntn@gmail.com>
Wed, 28 Aug 2019 22:17:52 +0000 (00:17 +0200)
committerterencehill <piuntn@gmail.com>
Wed, 28 Aug 2019 22:17:52 +0000 (00:17 +0200)
qcsrc/common/t_items.qc

index 3ea391865c742562cda6ce6ac4e0872caeff7da9..a5786888c18169abdfb93a44200b9383feab5a8d 100644 (file)
@@ -1008,8 +1008,8 @@ void Item_FindTeam(entity this)
                });
 
                e = RandomSelection_chosen_ent;
-               e.state = 0;
-               Item_Show(e, 1);
+               if (!e)
+                       return;
 
                IL_EACH(g_items, it.team == this.team,
                {
@@ -1021,11 +1021,11 @@ void Item_FindTeam(entity this)
                                        Item_Show(it, -1);
                                        it.state = 1; // state 1 = initially hidden item, apparently
                                }
+                               else
+                                       Item_Reset(it);
                                it.effects &= ~EF_NODRAW;
                        }
                });
-
-               Item_Reset(this);
        }
 }
 
@@ -1360,7 +1360,7 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
        }
 
        this.state = 0;
-       if(this.team) // broken, no idea why.
+       if(this.team)
        {
                if(!this.cnt)
                        this.cnt = 1; // item probability weight