- wget -O data/maps/stormkeep.waypoints https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints\r
- wget -O data/maps/stormkeep.waypoints.cache https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints.cache\r
- make\r
- - EXPECT=5d093940aa7306533fdcf8f12579b316\r
+ - EXPECT=d4060caf37a2e60bab68d1f83bc57368\r
- HASH=$(${ENGINE} -noconfig -nohome +timestamps 1 +exec serverbench.cfg\r
| tee /dev/stderr\r
| sed -e 's,^\[[^]]*\] ,,'\r
// WEAPONTODO: replace with simpler method
vector nearest_on_line = (w_shotorg + a * w_shotdir);
- vector nearest_to_attacker = WarpZoneLib_NearestPointOnBox(center + head.mins, center + head.maxs, nearest_on_line);
+ vector nearest_to_attacker = NearestPointOnBoundingBox(center + head.mins, center + head.maxs, nearest_on_line);
if((vdist(head.WarpZone_findradius_dist, <=, WEP_CVAR(shockwave, blast_distance)))
&& (W_Shockwave_Attack_IsVisible(actor, head, nearest_on_line, w_shotorg, attack_endpos)))
ERASEABLE
vector NearestPointOnBox(entity box, vector org)
{
- vector m1 = box.mins + box.origin;
- vector m2 = box.maxs + box.origin;
+ vector mi = box.mins + box.origin;
+ vector ma = box.maxs + box.origin;
return vec3(
- bound(m1.x, org.x, m2.x),
- bound(m1.y, org.y, m2.y),
- bound(m1.z, org.z, m2.z)
+ bound(mi.x, org.x, ma.x),
+ bound(mi.y, org.y, ma.y),
+ bound(mi.z, org.z, ma.z)
);
}
+
+ERASEABLE
+vector NearestPointOnBoundingBox(vector mi, vector ma, vector org)
+{
+ return vec3(
+ bound(mi.x, org.x, ma.x),
+ bound(mi.y, org.y, ma.y),
+ bound(mi.z, org.z, ma.z)
+ );
+}
#endif
return 0;
}
+ if (rad < 0) rad = 0;
+
RadiusDamage_running = 1;
tfloordmg = autocvar_g_throughfloor_damage;
if (((cantbe != targ) && !mustbe) || (mustbe == targ))
if (targ.takedamage)
{
- vector nearest;
- vector diff;
- float power;
-
- // LordHavoc: measure distance to nearest point on target (not origin)
- // (this guarentees 100% damage on a touch impact)
- nearest = targ.WarpZone_findradius_nearest;
- diff = targ.WarpZone_findradius_dist;
+ // measure distance from nearest point on target (not origin)
+ // to nearest point on inflictor (not origin)
+ vector nearest = targ.WarpZone_findradius_nearest;
+ vector inflictornearest = NearestPointOnBoundingBox(
+ inflictororigin - (inflictor.maxs - inflictor.mins) * 0.5,
+ inflictororigin + (inflictor.maxs - inflictor.mins) * 0.5,
+ nearest);
+ vector diff = inflictornearest - nearest;
+
// 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) - bound(MIN_DAMAGEEXTRARADIUS, targ.damageextraradius, MAX_DAMAGEEXTRARADIUS)) / rad);
- //bprint(" ");
- //bprint(ftos(power));
- //if (targ == attacker)
- // print(ftos(power), "\n");
- if (power > 0)
+ float dist = max(0, vlen(diff) - bound(MIN_DAMAGEEXTRARADIUS, targ.damageextraradius, MAX_DAMAGEEXTRARADIUS));
+ if (dist <= rad)
{
- float finaldmg;
- if (power > 1)
- power = 1;
- finaldmg = coredamage * power + edgedamage * (1 - power);
+ float power = 1;
+ if (rad > 0)
+ power -= (dist / rad);
+ // at this point power can't be < 0 or > 1
+ float finaldmg = coredamage * power + edgedamage * (1 - power);
if (finaldmg > 0)
{
float a;
float RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype, .entity weaponentity, entity directhitentity);
.float damageforcescale;
-const float MIN_DAMAGEEXTRARADIUS = 2;
+const float MIN_DAMAGEEXTRARADIUS = 0.1;
const float MAX_DAMAGEEXTRARADIUS = 16;
.float damageextraradius;