1 void Ent_DamageInfo(float isNew)
3 float dmg, rad, edge, thisdmg, forcemul;
4 vector force, thisforce;
9 w_deathtype = ReadShort();
10 w_issilent = (w_deathtype & 0x8000);
11 w_deathtype = (w_deathtype & 0x7FFF);
13 w_org_x = ReadCoord();
14 w_org_y = ReadCoord();
15 w_org_z = ReadCoord();
20 force = decompressShortVector(ReadShort());
33 for(self = findradius(w_org, rad); self; self = self.chain)
37 thisdmg = vlen(self.origin - w_org) / rad;
42 thisdmg = dmg + (edge - dmg) * thisdmg;
43 thisforce = forcemul * vlen(force) * (thisdmg / dmg) * normalize(self.origin - w_org);
48 thisforce = forcemul * vlen(force) * normalize(self.origin - w_org);
54 thisforce = forcemul * force;
57 if(self.damageforcescale)
60 self.move_velocity = self.move_velocity + damage_explosion_calcpush(self.damageforcescale * thisforce, self.move_velocity, autocvar_g_balance_damagepush_speedfactor);
61 self.move_flags &~= FL_ONGROUND;
68 self.event_damage(thisdmg, w_deathtype, w_org, thisforce);
73 // TODO spawn particle effects and sounds based on w_deathtype
75 if(!DEATH_ISSPECIAL(w_deathtype))
79 hitwep = DEATH_WEAPONOFWEAPONDEATH(w_deathtype);
82 traceline(w_org - normalize(force) * 16, w_org + normalize(force) * 16, MOVE_NOMONSTERS, world);
83 if(trace_fraction < 1 && hitwep != WEP_NEX && hitwep != WEP_MINSTANEX)
84 w_backoff = trace_plane_normal;
86 w_backoff = -1 * normalize(force);
87 setorigin(self, w_org + w_backoff * 2); // for sound() calls
89 (get_weaponinfo(hitwep)).weapon_func(WR_IMPACTEFFECT);
93 void DamageInfo_Precache()
96 for(i = WEP_FIRST; i <= WEP_LAST; ++i)
97 (get_weaponinfo(i)).weapon_func(WR_PRECACHE);