]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Decide if an item will spawn before precaching its assets
authorbones_was_here <bones_was_here@xonotic.au>
Sun, 2 Apr 2023 20:09:33 +0000 (06:09 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Sun, 2 Apr 2023 20:25:56 +0000 (06:25 +1000)
May help with #2799

qcsrc/server/items/items.qc

index 9d53f7a28c29ce149a45c94e3ed289af8043be98..504ba6e6380e75981958ddc55eb95411d7f2effa 100644 (file)
@@ -976,9 +976,6 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
                return;
        }
 
-       precache_model(this.model);
-       precache_sound(this.item_pickupsound);
-
        if (Item_IsLoot(this))
        {
                this.reset = RemoveItem;
@@ -1163,6 +1160,10 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
                return;
        }
 
+       // we should be sure this item will spawn before loading its assets
+       precache_model(this.model);
+       precache_sound(this.item_pickupsound);
+
        setItemGroup(this);
 }