]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
monsters: ensure they can't be stuck when spawned
authorbones_was_here <bones_was_here@xonotic.au>
Thu, 14 Mar 2024 06:13:00 +0000 (16:13 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Thu, 14 Mar 2024 08:14:14 +0000 (18:14 +1000)
If too stuck to fix the spawn fails.

Closes #1657
Closes #2645

qcsrc/common/monsters/sv_monsters.qc

index 628db8f7e852bd0df1f3cff0aaf579172a0cfe31..e5ff5127d8092579132dfda3dc6fdf035dae5276 100644 (file)
@@ -1548,6 +1548,13 @@ bool Monster_Spawn(entity this, bool check_appear, Monster mon)
                setorigin(this, trace_endpos);
        }
 
+       if (!nudgeoutofsolid(this))
+       {
+               // Stuck and not fixable
+               Monster_Remove(this);
+               return false;
+       }
+
        if(!(this.spawnflags & MONSTERFLAG_RESPAWNED))
                monster_setupcolors(this);