]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Do a trace before respawning a func_breakable to see if there's a player inside their... 566/head
authorMario <mario@smbclan.net>
Fri, 15 Jun 2018 15:48:30 +0000 (01:48 +1000)
committerMario <mario@smbclan.net>
Fri, 15 Jun 2018 15:48:30 +0000 (01:48 +1000)
qcsrc/common/mapobjects/func/breakable.qc

index 2b4d5f232ffebeee25c194629a9feeb11ffeab8a..e4edd29f2d5eb1310974963a281e3dfd01a58d4d 100644 (file)
@@ -205,6 +205,16 @@ void func_breakable_restore(entity this, entity actor, entity trigger)
 
 void func_breakable_restore_self(entity this)
 {
+       // TODO: use a clipgroup for all func_breakables so they don't collide with eachother
+       float oldhit = this.dphitcontentsmask;
+       this.dphitcontentsmask = DPCONTENTS_BODY; // we really only care about when players are standing inside, obey the mapper in other cases!
+       tracebox(this.origin, this.mins, this.maxs, this.origin, MOVE_NORMAL, this);
+       this.dphitcontentsmask = oldhit;
+       if(trace_startsolid || trace_fraction < 1)
+       {
+               this.nextthink = time + 5; // retry every 5 seconds until the area becomes clear
+               return;
+       }
        func_breakable_restore(this, NULL, NULL);
 }