2 void Obituary (entity attacker, entity targ, float deathtype)
5 if (targ.classname == "player" || targ.classname == "corpse")
8 if (targ.classname == "corpse")
12 if (deathtype == IT_LASER) {bprint(s);bprint(" was unable to resist the urge to self-immolate\n");}
13 else if (deathtype == IT_GRENADE_LAUNCHER) {bprint(s);bprint(" detonated\n");}
14 else if (deathtype == IT_ELECTRO) {bprint(s);bprint(" played with plasma\n");}
15 else if (deathtype == IT_HAGAR) {bprint(s);bprint(" should have used a different weapon\n");}
16 else if (deathtype == IT_ROCKET_LAUNCHER) {bprint(s);bprint(" exploded\n");}
17 else {bprint(s);bprint(" competes for the darwin awards\n");}
19 else if (attacker.classname == "player")
21 if (deathtype == IT_LASER) {bprint(s);bprint(" was a victim of laser surgeon ");bprint(attacker.netname);bprint("\n");}
22 else if (deathtype == IT_UZI) {bprint(s);bprint(" was gunned down by ");bprint(attacker.netname);bprint("\n");}
23 else if (deathtype == IT_SHOTGUN) {bprint(s);bprint(" was gunned down by ");bprint(attacker.netname);bprint("\n");}
24 else if (deathtype == IT_GRENADE_LAUNCHER) {bprint(s);bprint(" was blasted by ");bprint(attacker.netname);bprint("\n");}
25 else if (deathtype == IT_ELECTRO) {bprint(s);bprint(" bathed in plasma from ");bprint(attacker.netname);bprint("\n");}
26 else if (deathtype == IT_CRYLINK) {bprint(s);bprint(" was zapped by ");bprint(attacker.netname);bprint("\n");}
27 else if (deathtype == IT_NEX) {bprint(s);bprint(" sports a new hole from ");bprint(attacker.netname);bprint("\n");}
28 else if (deathtype == IT_HAGAR) {bprint(s);bprint(" was pummeled by ");bprint(attacker.netname);bprint("\n");}
29 else if (deathtype == IT_ROCKET_LAUNCHER) {bprint(s);bprint(" was given a lesson in rocketry by ");bprint(attacker.netname);bprint("\n");}
30 else {bprint(s);bprint(" was killed by ");bprint(attacker.netname);bprint("\n");}
34 {bprint(s);bprint(" died\n");}
39 void Damage (entity targ, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
45 if (self.damageforcescale)
47 self.velocity = self.velocity + self.damageforcescale * force;
48 self.flags = self.flags - (self.flags & FL_ONGROUND);
51 if (self.event_damage)
52 self.event_damage (hitloc, damage, inflictor, attacker, deathtype);
55 // Sajt - added this, but I'm not sure the powerups are even implemented? This might act strange because
56 // there is no code handled to disable powerups when their time is up...
57 if (game & GAME_STRENGTH_GAIN)
59 if (attacker.strength_finished < time)
60 attacker.strength_finished = time + 5;
62 attacker.strength_finished = attacker.strength_finished + 5;
64 attacker.items = attacker.items | IT_STRENGTH;
68 void RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity ignore, float forceintensity, float deathtype)
80 blastorigin = (inflictor.origin + (inflictor.mins + inflictor.maxs) * 0.5);
82 targ = findradius (blastorigin, rad);
85 if (targ != inflictor)
88 // LordHavoc: measure distance to nearest point on target (not origin)
89 // (this guarentees 100% damage on a touch impact)
90 nearest = blastorigin;
91 m1 = targ.origin + targ.mins;
92 m2 = targ.origin + targ.maxs;
93 if (nearest_x < m1_x) nearest_x = m1_x;
94 if (nearest_y < m1_y) nearest_y = m1_y;
95 if (nearest_z < m1_z) nearest_z = m1_z;
96 if (nearest_x > m2_x) nearest_x = m2_x;
97 if (nearest_y > m2_y) nearest_y = m2_y;
98 if (nearest_z > m2_z) nearest_z = m2_z;
99 diff = nearest - blastorigin;
100 // round up a little on the damage to ensure full damage on impacts
101 // and turn the distance into a fraction of the radius
102 power = 1 - ((vlen (diff) - 2) / rad);
104 //bprint(ftos(power));
109 finaldmg = coredamage * power + edgedamage * (1 - power);
110 force = normalize(diff) * (finaldmg / coredamage) * forceintensity;
111 if (targ == attacker)
112 finaldmg = finaldmg * 0.6; // Partial damage if the attacker hits himself
114 Damage (targ, inflictor, attacker, finaldmg, deathtype, inflictor.origin, force);
126 void ClearMultiDamage (void)
130 multi_force = '0 0 0';
133 void ApplyMultiDamage (void)
138 Damage (self, multi_ent.origin, multi_ent, 0, multi_damage, multi_force);
141 void AddMultiDamage (entity hit, float damage, vector force)
146 if (hit != multi_ent)
152 multi_damage = multi_damage + damage;
153 multi_force = multi_force + force;
156 void FireBullets (float shotcount, vector dir, vector spread, float deathtype)
163 makevectors (self.v_angle);
165 source = self.origin + v_forward * 10; // FIXME
166 source_x = self.absmin_z + self.size_z * 0.7; // ??? whaddabout view_ofs
168 // LordHavoc: better to use normal damage
169 //ClearMultiDamage ();
170 while (shotcount > 0)
172 direction = dir + crandom () * spread_x * v_right + crandom () * spread_y * v_up;
174 traceline (source, source + direction * 2048, FALSE, self);
175 if (trace_fraction != 1.0)
177 vel = normalize (direction + v_up * crandom () + v_right * crandom ());
178 vel = vel + 2 * trace_plane_normal;
181 org = trace_endpos - direction * 4;
183 if (!trace_ent.takedamage)
185 // LordHavoc: better to use normal damage
186 //AddMultiDamage (trace_ent, 4, direction * 4);
187 Damage (trace_ent, self, self, 4, deathtype, trace_endpos, direction * 4);
190 shotcount = shotcount + 1;
193 // LordHavoc: better to use normal damage
194 //ApplyMultiDamage ();