From 35f5b32246dc29789dd0743954d9c3b31c731782 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 16 Jun 2018 01:48:30 +1000 Subject: [PATCH] Do a trace before respawning a func_breakable to see if there's a player inside their bounding box --- qcsrc/common/mapobjects/func/breakable.qc | 10 ++++++++++ 1 file changed, 10 insertions(+) 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); } -- 2.39.2