]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/gamec/g_damage.c
sv_logspam_console - logs events such as frags, captures, suicides to the console.
[divverent/nexuiz.git] / data / qcsrc / server / gamec / g_damage.c
1
2 float checkrules_firstblood;
3
4 void GiveFrags (entity attacker, entity targ, float f)
5 {
6
7         if(gameover) return;
8
9         if(f > 0 && cvar("g_domination") && cvar("g_domination_disable_frags"))
10                 return;
11         else if(f > 0 && cvar("g_runematch"))
12                 f = RunematchHandleFrags(attacker, targ, f);
13         else if(cvar("g_lms"))
14         {
15                 // count remaining lives, not frags in lms
16                 targ.frags -= 1;
17                 // keep track of the worst players lives
18                 if(targ.frags < lms_lowest_lives)
19                         lms_lowest_lives = targ.frags;
20                 // player has no more lives left
21                 if (!targ.frags)
22                         lms_dead_count += 1;
23                 return;
24         }
25
26         if(f)
27                 attacker.frags = attacker.frags + f;
28 }
29
30 void LogDeath(string mode, float deathtype, entity killer, entity killed)
31 {
32         string s;
33         float w;
34         if(!cvar("sv_logspam_console"))
35                 return;
36         s = strcat(":kill:", mode);
37         s = strcat(s, ":", ftos(killer.playerid));
38         s = strcat(s, ":", ftos(killed.playerid));
39         s = strcat(s, ":type=", ftos(deathtype));
40         s = strcat(s, ":items=");
41         w = killer.weapon;
42         if(w == 0)
43                 w = killer.switchweapon;
44         s = strcat(s, ftos(weapon_translateindextoflag(w)));
45         if(time < killer.strength_finished)
46                 s = strcat(s, "S");
47         if(time < killer.invincible_finished)
48                 s = strcat(s, "I");
49         if(killer.flagcarried != world)
50                 s = strcat(s, "F");
51         s = strcat(s, ":victimitems=");
52         w = killed.weapon;
53         if(w == 0)
54                 w = killed.switchweapon;
55         s = strcat(s, ftos(weapon_translateindextoflag(w)));
56         if(time < killed.strength_finished)
57                 s = strcat(s, "s");
58         if(time < killed.invincible_finished)
59                 s = strcat(s, "i");
60         if(killed.flagcarried != world)
61                 s = strcat(s, "f");
62         ServerConsoleEcho(s);
63 }
64
65 void Obituary (entity attacker, entity targ, float deathtype)
66 {
67         string  s, m;
68
69         if (targ.classname == "player" || targ.classname == "corpse")
70         {
71                 if (targ.classname == "corpse")
72                         s = "A corpse";
73                 else
74                         s = targ.netname;
75
76                 if (targ == attacker)
77                 {
78                         if (deathtype == DEATH_NOAMMO)
79                                 centerprint(targ, strcat("^1You were killed for running out of ammo...\n\n\n"));
80                         if (deathtype == DEATH_TEAMCHANGE)
81                         {
82                                 m = "You are now on: ";
83                                 if (targ.team == 5)
84                                         m = strcat(m, "^1Red Team");
85                                 else if (targ.team == 14)
86                                         m = strcat(m, "^4Blue Team");
87                                 else if (targ.team == 10)
88                                         m = strcat(m, "^6Pink Team");
89                                 else if (targ.team == 13)
90                                         m = strcat(m, "^3Yellow Team");
91                                 centerprint(targ, m);
92                         }
93                         else if (deathtype == DEATH_AUTOTEAMCHANGE)
94                         {
95                                 m = "You have been moved into a different team to improve team balance\nYou are now on: ";
96                                 if (targ.team == 5)
97                                         m = strcat(m, "^1Red Team");
98                                 else if (targ.team == 14)
99                                         m = strcat(m, "^4Blue Team");
100                                 else if (targ.team == 10)
101                                         m = strcat(m, "^6Pink Team");
102                                 else if (targ.team == 13)
103                                         m = strcat(m, "^3Yellow Team");
104                                 centerprint(targ, m);
105                                 return;
106                         }
107                         else if (deathtype == DEATH_CAMP)
108                                 centerprint(targ, strcat("^1Die camper!\n\n\n"));
109                         else
110                                 centerprint(targ, strcat("^1You killed your own dumb self!\n\n\n"));
111
112                         if (deathtype == IT_GRENADE_LAUNCHER)
113                                 bprint ("^1",s, "^1 detonated\n");
114                         else if (deathtype == IT_ELECTRO)
115                                 bprint ("^1",s, "^1 played with plasma\n");
116                         else if (deathtype == IT_ROCKET_LAUNCHER)
117                                 bprint ("^1",s, "^1 exploded\n");
118                         else if (deathtype == DEATH_KILL)
119                                 bprint ("^1",s, "^1 couldn't take it anymore\n");
120                         else if (deathtype == DEATH_NOAMMO)
121                         {
122                                 bprint ("^7",s, " ^7committed suicide. What's the point of living without ammo?\n");
123                                 //sound (self, CHAN_BODY, "minstagib/mockery.ogg", 1, ATTN_NONE);
124                         }
125                         else if (deathtype == DEATH_CAMP)
126                                 bprint ("^1",s, "^1 thought he found a nice camping ground\n");
127                         else if (deathtype != DEATH_TEAMCHANGE)
128                                 bprint ("^1",s, "^1 couldn't resist the urge to self-destruct\n");
129
130                         if(deathtype != DEATH_TEAMCHANGE)
131                                 LogDeath("suicide", deathtype, targ, targ);
132
133                         GiveFrags(attacker, targ, -1);
134                         //targ.frags = targ.frags - 1;
135                         if (targ.killcount > 2)
136                                 bprint ("^1",s,"^1 ended it all with a ",ftos(targ.killcount)," kill spree\n");
137                 }
138                 else if (teamplay && attacker.team == targ.team)
139                 {
140                         centerprint(attacker, strcat("^1Moron! You fragged a teammate!\n\n\n"));
141                         bprint ("^1", attacker.netname, "^1 mows down a teammate\n");
142                         GiveFrags(attacker, targ, -1);
143                         //attacker.frags = attacker.frags - 1;
144                         if (targ.killcount > 2)
145                                 bprint ("^1",s,"'s ^1",ftos(targ.killcount)," kill spree was endeded by a teammate!\n");
146                         if (attacker.killcount > 2)
147                                 bprint ("^1",attacker.netname,"^1 ended a ",ftos(attacker.killcount)," kill spree by killing a teammate\n");
148                         attacker.killcount = 0;
149
150                         LogDeath("tk", deathtype, attacker, targ);
151                 }
152                 else if (attacker.classname == "player" || attacker.classname == "gib")
153                 {
154                         if (!checkrules_firstblood)
155                         {
156                                 checkrules_firstblood = TRUE;
157                                 //sound(world, CHAN_AUTO, "announcer/firstblood.wav", 1, ATTN_NONE);
158                                 //if (cvar("g_minstagib"))
159                                         //sound(world, CHAN_AUTO, "announce/male/mapkill1.ogg", 1, ATTN_NONE);
160                                 bprint("^1",attacker.netname, "^1 drew first blood", "\n");
161                         }
162
163                         centerprint(attacker, strcat("^4You fragged ^7", s, "\n\n\n"));
164                         centerprint(targ, strcat("^1You were fragged by ^7", attacker.netname, "\n\n\n"));
165
166                         if (deathtype == IT_LASER)
167                                 bprint ("^1",s, "^1 was blasted by ", attacker.netname, "\n");
168                         else if (deathtype == IT_UZI)
169                                 bprint ("^1",s, "^1 was riddled full of holes by ", attacker.netname, "\n");
170                         else if (deathtype == IT_SHOTGUN)
171                                 bprint ("^1",s, "^1 was gunned by ", attacker.netname, "\n");
172                         else if (deathtype == IT_GRENADE_LAUNCHER)
173                                 bprint ("^1", s, "^1 was blasted by ", attacker.netname, "\n");
174                         else if (deathtype == IT_ELECTRO)
175                                 bprint ("^1",s, "^1 was blasted by ", attacker.netname, "\n");
176                         else if (deathtype == IT_CRYLINK)
177                                 bprint ("^1",s, "^1 was blasted by ", attacker.netname, "\n");
178                         else if (deathtype == IT_NEX)
179                                 bprint ("^1",s, "^1 has been vaporized by ", attacker.netname, "\n");
180                         else if (deathtype == IT_HAGAR)
181                                 bprint ("^1",s, "^1 was pummeled by ", attacker.netname, "\n");
182                         else if (deathtype == IT_ROCKET_LAUNCHER)
183                                 bprint ("^1",s, "^1 was blasted by ", attacker.netname, "\n");
184                         else if (deathtype == DEATH_TELEFRAG)
185                                 bprint ("^1",s, "^1 was telefragged by ", attacker.netname, "\n");
186                         else if (deathtype == DEATH_DROWN)
187                                 bprint ("^1",s, "^1 was drowned by ", attacker.netname, "\n");
188                         else if (deathtype == DEATH_SLIME)
189                                 bprint ("^1",s, "^1 was slimed by ", attacker.netname, "\n");
190                         else if (deathtype == DEATH_LAVA)
191                                 bprint ("^1",s, "^1 was cooked by ", attacker.netname, "\n");
192                         else if (deathtype == DEATH_FALL)
193                                 bprint ("^1",s, "^1 was grounded by ", attacker.netname, "\n");
194                         else if (deathtype == DEATH_SWAMP)
195                                 bprint ("^1",s, "^1 was conserved by ", attacker.netname, "\n");
196                         else if (deathtype == DEATH_HURTTRIGGER)
197                                 bprint ("^1",s, "^1 was thrown into a world of hurt by ", attacker.netname, "\n");
198                         else
199                                 bprint ("^1",s, "^1 was fragged by ", attacker.netname, "\n");
200
201                         GiveFrags(attacker, targ, 1);
202                         //attacker.frags = attacker.frags + 1;
203                         if (targ.killcount > 2)
204                                 bprint ("^1",s,"'s ^1", ftos(targ.killcount), " kill spree was ended by ", attacker.netname, "\n");
205                         attacker.killcount = attacker.killcount + 1;
206                         if (attacker.killcount > 2)
207                                 bprint ("^1",attacker.netname,"^1 has ",ftos(attacker.killcount)," frags in a row\n");
208
209                         LogDeath("frag", deathtype, attacker, targ);
210
211                         if (attacker.killcount == 3)
212                         {
213                                 bprint (attacker.netname,"^7 made a ^1TRIPLE FRAG\n");
214                                 stuffcmd(attacker, "play2 announcer/male/03kills.ogg\n");
215                         }
216                         else if (attacker.killcount == 5)
217                         {
218                                 bprint (attacker.netname,"^7 made a ^1FIVE FRAG COMBO\n");
219                                 stuffcmd(attacker, "play2 announcer/male/05kills.ogg\n");
220                         }
221                         else if (attacker.killcount == 10)
222                         {
223                                 bprint (attacker.netname,"^7 is on a ^1RAGE\n");
224                                 stuffcmd(attacker, "play2 announcer/male/10kills.ogg\n");
225                         }
226                         else if (attacker.killcount == 15)
227                         {
228                                 bprint (attacker.netname,"^7 has done a ^1MASSACRE!\n");
229                                 stuffcmd(attacker, "play2 announcer/male/15kills.ogg\n");
230                         }
231                         else if (attacker.killcount == 20)
232                         {
233                                 bprint (attacker.netname,"^7 is ^1UNHUMAN!\n");
234                                 stuffcmd(attacker, "play2 announcer/male/20kills.ogg\n");
235                         }
236                         else if (attacker.killcount == 25)
237                         {
238                                 bprint (attacker.netname,"^7 is a ^1DEATH INCARNATION!\n");
239                                 stuffcmd(attacker, "play2 announcer/male/25kills.ogg\n");
240                         }
241                         else if (attacker.killcount == 30)
242                         {
243                                 bprint (attacker.netname,"^7 is maybe a ^1AIMBOTTER?!\n");
244                                 stuffcmd(attacker, "play2 announcer/male/30kills.ogg\n");
245                         }
246                 }
247                 else
248                 {
249                         centerprint(targ, strcat("^1Watch your step!\n\n\n"));
250                         if (deathtype == DEATH_HURTTRIGGER && attacker.message != "")
251                                 bprint ("^1",s, "^1 ", attacker.message, "\n");
252                         else if (deathtype == DEATH_DROWN)
253                                 bprint ("^1",s, "^1 drowned\n");
254                         else if (deathtype == DEATH_SLIME)
255                                 bprint ("^1",s, "^1 was slimed\n");
256                         else if (deathtype == DEATH_LAVA)
257                                 bprint ("^1",s, "^1 turned into hot slag\n");
258                         else if (deathtype == DEATH_FALL)
259                                 bprint ("^1",s, "^1 hit the ground with a crunch\n");
260                         else if (deathtype == DEATH_SWAMP)
261                                 bprint ("^1",s, "^1 is now conserved for centuries to come\n");
262                         else
263                                 bprint ("^1",s, "^1 died\n");
264                         GiveFrags(targ, targ, -1);
265                         if(targ.frags == -5) {
266                                 stuffcmd(targ, "play2 announcer/male/botlike.ogg\n");
267                         }
268
269                         //targ.frags = targ.frags - 1;
270                         if (targ.killcount > 2)
271                                 bprint ("^1",s,"^1 died with a ",ftos(targ.killcount)," kill spree\n");
272
273                         LogDeath("accident", deathtype, targ, targ);
274                 }
275                 // FIXME: this should go in PutClientInServer
276                 if (targ.killcount)
277                         targ.killcount = 0;
278         }
279 }
280
281 // these are updated by each Damage call for use in button triggering and such
282 entity damage_targ;
283 entity damage_inflictor;
284 entity damage_attacker;
285
286 void Damage (entity targ, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
287 {
288         if (gameover || targ.killcount == -666)
289                 return;
290
291         local entity oldself;
292         oldself = self;
293         self = targ;
294         damage_targ = targ;
295         damage_inflictor = inflictor;
296         damage_attacker = attacker;
297         // nullify damage if teamplay is on
298         if (teamplay)
299         if (attacker.team)
300         if (attacker.team == targ.team)
301         if ((teamplay == 1 || teamplay == 3) && attacker != targ)
302                 damage = 0;
303
304         if(cvar("g_lms"))
305         if(targ.classname == "player")
306         if(attacker.classname == "player")
307         if(attacker != targ)
308         {
309                 targ.lms_traveled_distance = cvar("g_lms_campcheck_distance");
310                 attacker.lms_traveled_distance = cvar("g_lms_campcheck_distance");
311         }
312
313         if(damage > 0 && targ != attacker && clienttype(attacker) == CLIENTTYPE_REAL && targ.classname == "player")
314                 stuffcmd(attacker, "play2 misc/hit.wav\n");
315
316         if (cvar("g_minstagib"))
317         {
318                 if ((deathtype == DEATH_FALL)  ||
319                     (deathtype == DEATH_DROWN) ||
320                     (deathtype == DEATH_SLIME) ||
321                     (deathtype == DEATH_LAVA))
322                         return;
323                 if (targ.extralives && (deathtype == IT_NEX) && damage)
324                 {
325                         targ.extralives -= 1;
326                         centerprint(targ, strcat("^3Remaining extra lives: ",ftos(targ.extralives),"\n"));
327                         damage = 0;
328                         targ.armorvalue = targ.extralives;
329                         if(clienttype(targ) == CLIENTTYPE_REAL) stuffcmd(targ, "play2 misc/hit.wav\n");
330                         //stuffcmd(attacker, "play2 misc/hit.wav\n");
331                 }
332                 else if (deathtype == IT_NEX && targ.items & IT_STRENGTH)
333                 {
334                         if(clienttype(attacker) == CLIENTTYPE_REAL) stuffcmd(attacker, "play2 announcer/male/yoda.ogg\n");
335                 }
336                 if (deathtype == IT_LASER)
337                 {
338                         damage = 0;
339                         if (targ != attacker)
340                         {
341                                 if (targ.classname == "player")
342                                         centerprint(attacker, "Secondary fire inflicts no damage!\n");
343                                 damage = 0;
344                                 force = '0 0 0';
345                                 attacker = targ;
346                         }
347                 }
348         } else {
349                 if (deathtype == IT_NEX && !(attacker.flags & FL_ONGROUND) && !(targ.flags & FL_ONGROUND) && attacker.waterlevel < 2 && targ.waterlevel < 2 && attacker.killcount != 3 && attacker.killcount != 5 && attacker.killcount != 10 && attacker.killcount != 15 && attacker.killcount != 20 && attacker.killcount != 25 && attacker.killcount != 30)
350                 {
351                         if(clienttype(attacker) == CLIENTTYPE_REAL)  stuffcmd(attacker, "play2 announcer/male/yoda.ogg\n");
352                 }
353         }
354
355         // apply strength multiplier
356         if (attacker.items & IT_STRENGTH && !cvar("g_minstagib"))
357         {
358                 damage = damage * cvar("g_balance_powerup_strength_damage");
359                 force = force * cvar("g_balance_powerup_strength_force");
360         }
361         // apply invincibility multiplier
362         if (targ.items & IT_INVINCIBLE && !cvar("g_minstagib"))
363                 damage = damage * cvar("g_balance_powerup_invincible_takedamage");
364
365
366         if(cvar("g_runematch"))
367         {
368                 // apply strength rune
369                 if (attacker.runes & RUNE_STRENGTH)
370                 {
371                         if(attacker.runes & CURSE_WEAK) // have both curse & rune
372                         {
373                                 damage = damage * cvar("g_balance_rune_strength_combo_damage");
374                                 force = force * cvar("g_balance_rune_strength_combo_force");
375                         }
376                         else
377                         {
378                                 damage = damage * cvar("g_balance_rune_strength_damage");
379                                 force = force * cvar("g_balance_rune_strength_force");
380                         }
381                 }
382                 else if (attacker.runes & CURSE_WEAK)
383                 {
384                         damage = damage * cvar("g_balance_curse_weak_damage");
385                         force = force * cvar("g_balance_curse_weak_force");
386                 }
387
388                 // apply defense rune
389                 if (targ.runes & RUNE_DEFENSE)
390                 {
391                         if (targ.runes & CURSE_VULNER) // have both curse & rune
392                                 damage = damage * cvar("g_balance_rune_defense_combo_takedamage");
393                         else
394                                 damage = damage * cvar("g_balance_rune_defense_takedamage");
395                 }
396                 else if (targ.runes & CURSE_VULNER)
397                         damage = damage * cvar("g_balance_curse_vulner_takedamage");
398         }
399
400         // apply push
401         if (self.damageforcescale)
402         {
403                 self.velocity = self.velocity + self.damageforcescale * force;
404                 self.flags = self.flags - (self.flags & FL_ONGROUND);
405         }
406         // apply damage
407         if (self.event_damage)
408                 self.event_damage (inflictor, attacker, damage, deathtype, hitloc, force);
409         self = oldself;
410
411         if(targ.classname == "player" && attacker.classname == "player" && attacker != targ && attacker.health > 2)
412         {
413                 // Savage: vampire mode
414                 if(cvar("g_vampire") && !cvar("g_minstagib"))
415                 {
416                         attacker.health += damage;
417                 }
418                 if(cvar("g_runematch"))
419                 {
420                         if (attacker.runes & RUNE_VAMPIRE)
421                         {
422                         // apply vampire rune
423                                 if (attacker.runes & CURSE_EMPATHY) // have the curse too
424                                 {
425                                         //attacker.health = attacker.health + damage * cvar("g_balance_rune_vampire_combo_absorb");
426                                         attacker.health = bound(
427                                                 cvar("g_balance_curse_empathy_minhealth"), // LA: was 3, now 40
428                                                 attacker.health + damage * cvar("g_balance_rune_vampire_combo_absorb"),
429                                                 cvar("g_balance_rune_vampire_maxhealth"));      // LA: was 1000, now 500
430                                 }
431                                 else
432                                 {
433                                         //attacker.health = attacker.health + damage * cvar("g_balance_rune_vampire_absorb");
434                                         attacker.health = bound(
435                                                 attacker.health,        // LA: was 3, but changed so that you can't lose health
436                                                                                         // empathy won't let you gain health in the same way...
437                                                 attacker.health + damage * cvar("g_balance_rune_vampire_absorb"),
438                                                 cvar("g_balance_rune_vampire_maxhealth"));      // LA: was 1000, now 500
439                                         }
440                         }
441                         // apply empathy curse
442                         else if (attacker.runes & CURSE_EMPATHY)
443                         {
444                                 attacker.health = bound(
445                                         cvar("g_balance_curse_empathy_minhealth"), // LA: was 3, now 20
446                                         attacker.health + damage * cvar("g_balance_curse_empathy_takedamage"),
447                                         attacker.health);
448                         }
449                 }
450         }
451 }
452
453 void RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity ignore, float forceintensity, float deathtype)
454 {
455         entity  targ;
456         float   finaldmg;
457         float   power;
458         vector  blastorigin;
459         vector  force;
460         vector  m1;
461         vector  m2;
462         vector  nearest;
463         vector  diff;
464
465         blastorigin = (inflictor.origin + (inflictor.mins + inflictor.maxs) * 0.5);
466
467         targ = findradius (blastorigin, rad);
468         while (targ)
469         {
470                 if (targ != inflictor)
471                         if (ignore != targ)
472                         {
473                                 // LordHavoc: measure distance to nearest point on target (not origin)
474                                 // (this guarentees 100% damage on a touch impact)
475                                 nearest = blastorigin;
476                                 m1 = targ.origin + targ.mins;
477                                 m2 = targ.origin + targ.maxs;
478                                 if (nearest_x < m1_x) nearest_x = m1_x;
479                                 if (nearest_y < m1_y) nearest_y = m1_y;
480                                 if (nearest_z < m1_z) nearest_z = m1_z;
481                                 if (nearest_x > m2_x) nearest_x = m2_x;
482                                 if (nearest_y > m2_y) nearest_y = m2_y;
483                                 if (nearest_z > m2_z) nearest_z = m2_z;
484                                 diff = nearest - blastorigin;
485                                 // round up a little on the damage to ensure full damage on impacts
486                                 // and turn the distance into a fraction of the radius
487                                 power = 1 - ((vlen (diff) - 2) / rad);
488                                 //bprint(" ");
489                                 //bprint(ftos(power));
490                                 if (power > 0)
491                                 {
492                                         if (power > 1)
493                                                 power = 1;
494                                         finaldmg = coredamage * power + edgedamage * (1 - power);
495                                         if (finaldmg > 0)
496                                         {
497                                                 force = normalize((m1 + m2) * 0.5 - blastorigin) * (finaldmg / coredamage) * forceintensity;
498                                                 if (targ == attacker)
499                                                         finaldmg = finaldmg * cvar("g_balance_selfdamagepercent");      // Partial damage if the attacker hits himself
500                                                 Damage (targ, inflictor, attacker, finaldmg, deathtype, nearest, force);
501                                         }
502                                 }
503                         }
504                 targ = targ.chain;
505         }
506 }
507
508 /*
509 entity  multi_ent;
510 float   multi_damage;
511 vector  multi_force;
512
513 void ClearMultiDamage (void)
514 {
515         multi_ent = world;
516         multi_damage = 0;
517         multi_force = '0 0 0';
518 }
519
520 void ApplyMultiDamage (void)
521 {
522         if (!multi_ent)
523                 return;
524
525         Damage (self, multi_ent.origin, multi_ent, 0, multi_damage, multi_force);
526 }
527
528 void AddMultiDamage (entity hit, float damage, vector force)
529 {
530         if (!hit)
531                 return;
532
533         if (hit != multi_ent)
534         {
535                 ApplyMultiDamage ();
536                 ClearMultiDamage ();
537                 multi_ent = hit;
538         }
539         multi_damage = multi_damage + damage;
540         multi_force = multi_force + force;
541 }
542
543 void FireBullets (float shotcount, vector dir, vector spread, float deathtype)
544 {
545         vector  direction;
546         vector  source;
547         vector  vel;
548         vector  org;
549
550         makevectors (self.v_angle);
551
552         source = self.origin + v_forward * 10;  // FIXME
553         source_x = self.absmin_z + self.size_z * 0.7;   // ??? whaddabout view_ofs
554
555         // LordHavoc: better to use normal damage
556         //ClearMultiDamage ();
557         while (shotcount > 0)
558         {
559                 direction = dir + crandom () * spread_x * v_right + crandom () * spread_y * v_up;
560
561                 traceline (source, source + direction * 2048, FALSE, self);
562                 if (trace_fraction != 1.0)
563                 {
564                         vel = normalize (direction + v_up * crandom () + v_right * crandom ());
565                         vel = vel + 2 * trace_plane_normal;
566                         vel = vel * 200;
567
568                         org = trace_endpos - direction * 4;
569
570                         if (!trace_ent.takedamage)
571                                 te_gunshot (org);
572                         // LordHavoc: better to use normal damage
573                         //AddMultiDamage (trace_ent, 4, direction * 4);
574                         Damage (trace_ent, self, self, 4, deathtype, trace_endpos, direction * 4);
575                 }
576
577                 shotcount = shotcount + 1;
578         }
579
580         // LordHavoc: better to use normal damage
581         //ApplyMultiDamage ();
582 }
583 */
584
585
586