float ticrate;
.float damageforcescale;
+#define MIN_DAMAGEEXTRARADIUS 2
#define MAX_DAMAGEEXTRARADIUS 16
.float damageextraradius;
.void(float thisdmg, float hittype, vector org, vector thisforce) event_damage;
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;
-
+ vector nearest = NearestPointOnBox(self, w_org);
if(rad)
{
- thisdmg = vlen(self.origin - w_org) / rad;
+ thisdmg = ((vlen (nearest - w_org) - bound(MIN_DAMAGEEXTRARADIUS, self.damageextraradius, MAX_DAMAGEEXTRARADIUS)) / rad);
if(thisdmg >= 1)
- thisdmg = 1;
+ continue;
if(dmg)
{
thisdmg = dmg + (edge - dmg) * thisdmg;
}
else
{
+ if(vlen(nearest - w_org) > bound(MIN_DAMAGEEXTRARADIUS, self.damageextraradius, MAX_DAMAGEEXTRARADIUS))
+ continue;
+
thisdmg = dmg;
thisforce = forcemul * force;
}
//.float chasecam;
.float damageforcescale;
+#define MIN_DAMAGEEXTRARADIUS 2
+#define MAX_DAMAGEEXTRARADIUS 16
+.float damageextraradius;
//.float gravity;
stat_damagedone = 0;
- targ = WarpZone_FindRadius (blastorigin, rad, FALSE);
+ targ = WarpZone_FindRadius (blastorigin, rad + MAX_DAMAGEEXTRARADIUS, FALSE);
while (targ)
{
next = targ.chain;
diff = targ.WarpZone_findradius_dist;
// round up a little on the damage to ensure full damage on impacts
// and turn the distance into a fraction of the radius
- power = 1 - ((vlen (diff) - 2) / rad);
+ power = 1 - ((vlen (diff) - bound(MIN_DAMAGEEXTRARADIUS, targ.damageextraradius, MAX_DAMAGEEXTRARADIUS)) / rad);
//bprint(" ");
//bprint(ftos(power));
//if (targ == attacker)