2 void Obituary (entity attacker, entity targ, float deathtype)
4 if (targ.classname == "player" || targ.classname == "corpse")
6 if (targ.classname == "corpse")
10 bprint (" was killed by ");
11 bprint (attacker.netname);
16 void Damage (entity attacker, vector hitloc, entity targ, float deathtype, float damage)
22 targ.health = targ.health - damage;
29 Obituary (attacker, targ, deathtype);
31 targ.event_die (hitloc, damage);
32 //return; // self = oldself;return;
34 else if (targ.event_hurt)
35 targ.event_hurt (hitloc, damage);
39 else if (targ.event_hurt) // For casings, etc that aren't damageable (cheap, I know :P)
44 targ.event_hurt (hitloc, damage);
50 void RadiusDamage (entity attacker, entity inflictor, float deathtype, float damage, entity ignore)
55 targ = findradius (inflictor.origin, damage);
58 if (targ != inflictor)
61 finaldmg = damage - max (0, 0.5 * vlen (inflictor.origin - targ.origin));
63 finaldmg = finaldmg * 0.6; // Partial damage if the attacker hits himself
65 Damage (attacker, inflictor.origin, targ, deathtype, finaldmg);
74 void ClearMultiDamage (void)
80 void ApplyMultiDamage (void)
85 Damage (self, multi_ent.origin, multi_ent, 0, multi_damage);
88 void AddMultiDamage (entity hit, float damage)
96 multi_damage = damage;
100 multi_damage = multi_damage + damage;
103 void FireBullets (float shotcount, vector dir, vector spread)
110 makevectors (self.v_angle);
112 source = self.origin + v_forward * 10; // FIXME
113 source_x = self.absmin_z + self.size_z * 0.7; // ??? whaddabout view_ofs
116 while (shotcount > 0)
118 direction = dir + crandom () * spread_x * v_right + crandom () * spread_y * v_up;
120 traceline (source, source + direction * 2048, FALSE, self);
121 if (trace_fraction != 1.0)
123 vel = normalize (direction + v_up * crandom () + v_right * crandom ());
124 vel = vel + 2 * trace_plane_normal;
127 org = trace_endpos - direction * 4;
129 if (trace_ent.takedamage)
132 AddMultiDamage (trace_ent, 4);
138 shotcount = shotcount + 1;