From: Mario Date: Fri, 15 Jun 2018 15:48:30 +0000 (+1000) Subject: Do a trace before respawning a func_breakable to see if there's a player inside their... X-Git-Tag: xonotic-v0.8.5~2043^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=35f5b32246dc29789dd0743954d9c3b31c731782;p=xonotic%2Fxonotic-data.pk3dir.git Do a trace before respawning a func_breakable to see if there's a player inside their bounding box --- diff --git a/qcsrc/common/mapobjects/func/breakable.qc b/qcsrc/common/mapobjects/func/breakable.qc index 2b4d5f232..e4edd29f2 100644 --- a/qcsrc/common/mapobjects/func/breakable.qc +++ b/qcsrc/common/mapobjects/func/breakable.qc @@ -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); }