Merge branch 'Mario/pokenade_crash_fix' into 'master'
authorLegendaryGuard <rootuser999@gmail.com>
Sat, 2 Jul 2022 09:34:12 +0000 (09:34 +0000)
committerLegendaryGuard <rootuser999@gmail.com>
Sat, 2 Jul 2022 09:34:12 +0000 (09:34 +0000)
Merge branch Mario/pokenade_crash_fix (XS merge request)

Closes #2703

See merge request xonotic/xonotic-data.pk3dir!1041

qcsrc/common/mutators/mutator/nades/nades.qc

index 5ea4cb49cfb9a4d4deb6802d8bf8e82d1cad3491..2d0a234098fefe2b6b5a6eb979103cb9bf6c6e31 100644 (file)
@@ -675,9 +675,13 @@ void nade_heal_boom(entity this)
 
 void nade_monster_boom(entity this)
 {
+       if(!autocvar_g_monsters)
+               return;
        entity e = spawn();
        e.noalign = true; // don't drop to floor
        e = spawnmonster(e, this.pokenade_type, MON_Null, this.realowner, this.realowner, this.origin, false, false, 1);
+       if(!e)
+               return; // monster failed to be spawned
 
        if(autocvar_g_nades_pokenade_monster_lifetime > 0)
                e.monster_lifetime = time + autocvar_g_nades_pokenade_monster_lifetime;
@@ -732,6 +736,11 @@ void nade_boom(entity this)
                        nade_blast = false;
                        break;
                case NADE_TYPE_MONSTER:
+                       if(!autocvar_g_monsters)
+                       {
+                               expef = EFFECT_NADE_EXPLODE(this.realowner.team);
+                               break; // fall back to a standard nade explosion
+                       }
                case NADE_TYPE_SPAWN:
                        nade_blast = false;
                        switch(this.realowner.team)