From e1f5688a2d0b36249850a8d8ab4707da5796f1df Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Wed, 4 Jan 2012 13:34:09 +0100 Subject: [PATCH] add a field .damageextraradius to DamageInfo entities to be able to tune how much an entity "attracts" damage --- qcsrc/client/Defs.qc | 2 ++ qcsrc/client/damage.qc | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/qcsrc/client/Defs.qc b/qcsrc/client/Defs.qc index 901380c1b..ee721353a 100644 --- a/qcsrc/client/Defs.qc +++ b/qcsrc/client/Defs.qc @@ -238,6 +238,8 @@ float servertime, serverprevtime, serverdeltatime; float ticrate; .float damageforcescale; +#define MAX_DAMAGEEXTRARADIUS 16 +.float damageextraradius; .void(float thisdmg, float hittype, vector org, vector thisforce) event_damage; // only for Porto diff --git a/qcsrc/client/damage.qc b/qcsrc/client/damage.qc index 51029396a..57d4c5c0e 100644 --- a/qcsrc/client/damage.qc +++ b/qcsrc/client/damage.qc @@ -30,13 +30,17 @@ void Ent_DamageInfo(float isNew) else forcemul = 1; - for(self = findradius(w_org, rad); self; self = self.chain) + for(self = findradius(w_org, rad + MAX_DAMAGEEXTRARADIUS); self; self = self.chain) { + vector p = NearestPointOnBox(self, w_org); + if(vlen(p - w_org) > rad + self.damageextraradius) + continue; + if(rad) { thisdmg = vlen(self.origin - w_org) / rad; if(thisdmg >= 1) - continue; + thisdmg = 1; if(dmg) { thisdmg = dmg + (edge - dmg) * thisdmg; -- 2.39.2