2 void Obituary (entity attacker, entity targ, float deathtype)
6 if (targ.classname == "player" || targ.classname == "corpse")
8 if (targ.classname == "corpse")
15 if (deathtype == IT_GRENADE_LAUNCHER)
16 bprint ("^1",s, " detonated\n");
17 else if (deathtype == IT_ELECTRO)
18 bprint ("^1",s, " played with plasma\n");
19 else if (deathtype == IT_ROCKET_LAUNCHER)
20 bprint ("^1",s, " exploded\n");
21 else if (deathtype == DEATH_HURTTRIGGER)
22 bprint ("^1",s, " ", attacker.message, "\n");
23 else if (deathtype == DEATH_KILL)
24 bprint ("^1",s, " couldn't take it anymore\n");
25 else if (deathtype == DEATH_FALL)
26 bprint ("^1",s, " hit the ground with a crunch\n");
27 else if (deathtype == DEATH_BIGFALL)
28 bprint ("^1",s, " fell into oblivion\n");
29 else if (deathtype == DEATH_DROWN)
30 bprint ("^1",s, " drowned\n");
32 bprint ("^1",s, " died\n");
33 self.frags = self.frags - 1;
36 else if (attacker.classname == "player")
38 if (deathtype == IT_LASER)
39 bprint ("^1",s, " was blasted by ", attacker.netname, "\n");
40 else if (deathtype == IT_UZI)
41 bprint ("^1",s, " was riddled full of holes by ", attacker.netname, "\n");
42 else if (deathtype == IT_SHOTGUN)
43 bprint ("^1",s, " was gunned by ", attacker.netname, "\n");
44 else if (deathtype == IT_GRENADE_LAUNCHER)
45 bprint ("^1", s, " was blasted by ", attacker.netname, "\n");
46 else if (deathtype == IT_ELECTRO)
47 bprint ("^1",s, " was blasted by ", attacker.netname, "\n");
48 else if (deathtype == IT_CRYLINK)
49 bprint ("^1",s, " was blasted ", attacker.netname, "\n");
50 else if (deathtype == IT_NEX)
51 bprint ("^1",s, " has been vaporized by ", attacker.netname, "\n");
52 else if (deathtype == IT_HAGAR)
53 bprint ("^1",s, " was pummeled by ", attacker.netname, "\n");
54 else if (deathtype == IT_ROCKET_LAUNCHER)
55 bprint ("^1",s, " blasted by ", attacker.netname, "\n");
57 bprint ("^1",s, " was killed by ", attacker.netname, "\n");
59 attacker.frags = attacker.frags + 1;
60 if (targ.killcount > 2)
61 bprint ("^1",attacker.netname," has stopped ",s,"'s killing spree\n");
63 attacker.killcount = attacker.killcount + 1;
64 if (attacker.killcount > 2)
65 bprint ("^1",attacker.netname," has ",ftos(attacker.killcount)," kills in a row\n");
70 void Damage (entity targ, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
75 if (attacker.items & IT_STRENGTH)
77 damage = damage * POWERUP_STRENGTH_DAMAGE;
78 force = force * POWERUP_STRENGTH_FORCE;
80 if (targ.items & IT_INVINCIBLE)
81 damage = damage * POWERUP_INVINCIBLE_TAKEDAMAGE;
83 if (self.damageforcescale)
85 self.velocity = self.velocity + self.damageforcescale * force;
86 self.flags = self.flags - (self.flags & FL_ONGROUND);
89 if (self.event_damage)
90 self.event_damage (inflictor, attacker, damage, deathtype, hitloc, force);
94 void RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity ignore, float forceintensity, float deathtype)
106 blastorigin = (inflictor.origin + (inflictor.mins + inflictor.maxs) * 0.5);
108 targ = findradius (blastorigin, rad);
111 if (targ != inflictor)
114 // LordHavoc: measure distance to nearest point on target (not origin)
115 // (this guarentees 100% damage on a touch impact)
116 nearest = blastorigin;
117 m1 = targ.origin + targ.mins;
118 m2 = targ.origin + targ.maxs;
119 if (nearest_x < m1_x) nearest_x = m1_x;
120 if (nearest_y < m1_y) nearest_y = m1_y;
121 if (nearest_z < m1_z) nearest_z = m1_z;
122 if (nearest_x > m2_x) nearest_x = m2_x;
123 if (nearest_y > m2_y) nearest_y = m2_y;
124 if (nearest_z > m2_z) nearest_z = m2_z;
125 diff = nearest - blastorigin;
126 // round up a little on the damage to ensure full damage on impacts
127 // and turn the distance into a fraction of the radius
128 power = 1 - ((vlen (diff) - 2) / rad);
130 //bprint(ftos(power));
135 finaldmg = coredamage * power + edgedamage * (1 - power);
136 force = normalize((m1 + m2) * 0.5 - blastorigin) * (finaldmg / coredamage) * forceintensity;
137 if (targ == attacker)
138 finaldmg = finaldmg * 0.6; // Partial damage if the attacker hits himself
140 Damage (targ, inflictor, attacker, finaldmg, deathtype, inflictor.origin, force);
152 void ClearMultiDamage (void)
156 multi_force = '0 0 0';
159 void ApplyMultiDamage (void)
164 Damage (self, multi_ent.origin, multi_ent, 0, multi_damage, multi_force);
167 void AddMultiDamage (entity hit, float damage, vector force)
172 if (hit != multi_ent)
178 multi_damage = multi_damage + damage;
179 multi_force = multi_force + force;
182 void FireBullets (float shotcount, vector dir, vector spread, float deathtype)
189 makevectors (self.v_angle);
191 source = self.origin + v_forward * 10; // FIXME
192 source_x = self.absmin_z + self.size_z * 0.7; // ??? whaddabout view_ofs
194 // LordHavoc: better to use normal damage
195 //ClearMultiDamage ();
196 while (shotcount > 0)
198 direction = dir + crandom () * spread_x * v_right + crandom () * spread_y * v_up;
200 traceline (source, source + direction * 2048, FALSE, self);
201 if (trace_fraction != 1.0)
203 vel = normalize (direction + v_up * crandom () + v_right * crandom ());
204 vel = vel + 2 * trace_plane_normal;
207 org = trace_endpos - direction * 4;
209 if (!trace_ent.takedamage)
211 // LordHavoc: better to use normal damage
212 //AddMultiDamage (trace_ent, 4, direction * 4);
213 Damage (trace_ent, self, self, 4, deathtype, trace_endpos, direction * 4);
216 shotcount = shotcount + 1;
219 // LordHavoc: better to use normal damage
220 //ApplyMultiDamage ();