1 float checkrules_firstblood;
5 float damage_gooddamage;
8 .float teamkill_complain;
12 float IsDifferentTeam(entity a, entity b)
27 float IsFlying(entity a)
29 if(a.flags & FL_ONGROUND)
33 traceline(a.origin, a.origin - '0 0 48', MOVE_NORMAL, a);
34 if(trace_fraction < 1)
39 void UpdateFrags(entity player, float f)
41 PlayerTeamScore_AddScore(player, f);
44 // NOTE: f=0 means still count as a (positive) kill, but count no frags for it
45 void GiveFrags (entity attacker, entity targ, float f)
47 // TODO route through PlayerScores instead
55 PlayerScore_Add(attacker, SP_SUICIDES, 1);
60 PlayerScore_Add(attacker, SP_KILLS, -1); // or maybe add a teamkills field?
66 PlayerScore_Add(attacker, SP_KILLS, 1);
69 PlayerScore_Add(targ, SP_DEATHS, 1);
72 if(cvar("g_arena_roundbased"))
75 // FIXME fix the mess this is (we have REAL points now!)
78 f = RunematchHandleFrags(attacker, targ, f);
82 f = kh_HandleFrags(attacker, targ, f);
88 tl = PlayerScore_Add(targ, SP_LMS_LIVES, -1);
89 if(tl < lms_lowest_lives)
90 lms_lowest_lives = tl;
94 lms_next_place = player_count;
95 PlayerScore_Add(targ, SP_LMS_RANK, lms_next_place); // won't ever spawn again
102 if(g_ctf_ignore_frags)
106 attacker.totalfrags += f;
109 UpdateFrags(attacker, f);
112 string AppendItemcodes(string s, entity player)
117 // w = player.switchweapon;
119 w = player.cnt; // previous weapon!
120 s = strcat(s, ftos(w));
121 if(time < player.strength_finished)
123 if(time < player.invincible_finished)
125 if(player.flagcarried != world)
127 if(player.BUTTON_CHAT)
132 s = strcat(s, "|", ftos(player.runes));
136 void LogDeath(string mode, float deathtype, entity killer, entity killed)
139 if(!cvar("sv_eventlog"))
141 s = strcat(":kill:", mode);
142 s = strcat(s, ":", ftos(killer.playerid));
143 s = strcat(s, ":", ftos(killed.playerid));
144 s = strcat(s, ":type=", ftos(deathtype));
145 s = strcat(s, ":items=");
146 s = AppendItemcodes(s, killer);
149 s = strcat(s, ":victimitems=");
150 s = AppendItemcodes(s, killed);
155 void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
160 if (targ.classname == "player" || targ.classname == "corpse")
162 if (targ.classname == "corpse")
166 a = attacker.netname;
168 if (targ == attacker)
170 if (deathtype == DEATH_TEAMCHANGE) {
171 centerprint(targ, strcat("You are now on: ", ColoredTeamName(targ.team)));
172 } else if (deathtype == DEATH_AUTOTEAMCHANGE) {
173 centerprint(targ, strcat("You have been moved into a different team to improve team balance\nYou are now on: ", ColoredTeamName(targ.team)));
175 } else if (deathtype == DEATH_CAMP) {
177 centerprint(targ, "^1Reconsider your tactics, camper!\n\n\n");
179 centerprint(targ, "^1Die camper!\n\n\n");
180 } else if (deathtype == DEATH_NOAMMO) {
182 centerprint(targ, "^1You are reinserted into the game for running out of ammo...\n\n\n");
184 centerprint(targ, "^1You were killed for running out of ammo...\n\n\n");
185 } else if (deathtype == DEATH_ROT) {
187 centerprint(targ, "^1You need to preserve your health\n\n\n");
189 centerprint(targ, "^1You grew too old without taking your medicine\n\n\n");
190 } else if (deathtype == DEATH_MIRRORDAMAGE) {
192 centerprint(targ, "^1Don't go against team mates!\n\n\n");
194 centerprint(targ, "^1Don't shoot your team mates!\n\n\n");
197 centerprint(targ, "^1You need to be more careful!\n\n\n");
199 centerprint(targ, "^1You killed your own dumb self!\n\n\n");
203 if (deathtype == DEATH_CAMP)
204 bprint ("^1",s, "^1 thought he found a nice camping ground\n");
205 else if (deathtype == DEATH_MIRRORDAMAGE)
206 bprint ("^1",s, "^1 didn't become friends with the Lord of Teamplay\n");
208 bprint ("^1",s, "^1 will be reinserted into the game due to his own actions\n");
210 if(deathtype != DEATH_TEAMCHANGE)
212 LogDeath("suicide", deathtype, targ, targ);
213 GiveFrags(attacker, targ, -1);
215 if (targ.killcount > 2)
216 bprint ("^1",s,"^1 ended it all with a ",ftos(targ.killcount)," scoring spree\n");
218 w = DEATH_WEAPONOF(deathtype);
221 w_deathtypestring = "couldn't resist the urge to self-destruct";
222 w_deathtype = deathtype;
223 weapon_action(w, WR_SUICIDEMESSAGE);
224 bprint("^1", s, "^1 ", w_deathtypestring, "\n");
226 else if (deathtype == DEATH_KILL)
227 bprint ("^1",s, "^1 couldn't take it anymore\n");
228 else if (deathtype == DEATH_ROT)
229 bprint ("^1",s, "^1 died\n");
230 else if (deathtype == DEATH_NOAMMO)
232 bprint ("^7",s, " ^7committed suicide. What's the point of living without ammo?\n");
234 else if (deathtype == DEATH_CAMP)
235 bprint ("^1",s, "^1 thought he found a nice camping ground\n");
236 else if (deathtype == DEATH_MIRRORDAMAGE)
237 bprint ("^1",s, "^1 didn't become friends with the Lord of Teamplay\n");
238 else if (deathtype != DEATH_TEAMCHANGE)
239 bprint ("^1",s, "^1 couldn't resist the urge to self-destruct\n");
241 if(deathtype != DEATH_TEAMCHANGE)
243 LogDeath("suicide", deathtype, targ, targ);
244 GiveFrags(attacker, targ, -1);
246 if (targ.killcount > 2)
247 bprint ("^1",s,"^1 ended it all with a ",ftos(targ.killcount)," kill spree\n");
250 else if (attacker.classname == "player" || attacker.classname == "gib")
252 if(teamplay && attacker.team == targ.team)
255 centerprint(attacker, "^1Moron! You went against a teammate!\n\n\n");
256 bprint ("^1", a, "^1 took action against a teammate\n");
258 centerprint(attacker, "^1Moron! You fragged a teammate!\n\n\n");
259 bprint ("^1", a, "^1 mows down a teammate\n");
261 GiveFrags(attacker, targ, -1);
262 if (targ.killcount > 2) {
264 bprint ("^1",s,"'s ^1",ftos(targ.killcount)," scoring spree was ended by a teammate!\n");
266 bprint ("^1",s,"'s ^1",ftos(targ.killcount)," kill spree was ended by a teammate!\n");
268 if (attacker.killcount > 2) {
270 bprint ("^1",a,"^1 ended a ",ftos(attacker.killcount)," scoring spree by going against a teammate\n");
272 bprint ("^1",a,"^1 ended a ",ftos(attacker.killcount)," kill spree by killing a teammate\n");
274 attacker.killcount = 0;
276 LogDeath("tk", deathtype, attacker, targ);
280 if (!checkrules_firstblood)
282 checkrules_firstblood = TRUE;
284 bprint("^1",a, "^1 was the first to score", "\n");
286 bprint("^1",a, "^1 drew first blood", "\n");
290 centerprint(attacker, strcat("^4You scored against ^7", s, "\n\n\n"));
291 centerprint(targ, strcat(a,"^1 scored against you ^7\n\n\n"));
293 centerprint(attacker, strcat("^4You fragged ^7", s, "\n\n\n"));
294 centerprint(targ, strcat("^1You were fragged by ^7", a, "\n\n\n"));
298 bprint ("^1",s, "^1 needs a restart thanks to ", a, "\n");
300 w = DEATH_WEAPONOF(deathtype);
303 w_deathtypestring = "was blasted by";
304 w_deathtype = deathtype;
305 weapon_action(w, WR_KILLMESSAGE);
306 p = strstrofs(w_deathtypestring, "#", 0);
308 bprint("^1", s, "^1 ", w_deathtypestring, " ", a, "\n");
310 bprint("^1", s, "^1 ", substring(w_deathtypestring, 0, p), a, "^1", substring(w_deathtypestring, p+1, strlen(w_deathtypestring) - (p+1)), "\n");
312 else if (deathtype == DEATH_TELEFRAG)
313 bprint ("^1",s, "^1 was telefragged by ", a, "\n");
314 else if (deathtype == DEATH_DROWN)
315 bprint ("^1",s, "^1 was drowned by ", a, "\n");
316 else if (deathtype == DEATH_SLIME)
317 bprint ("^1",s, "^1 was slimed by ", a, "\n");
318 else if (deathtype == DEATH_LAVA)
319 bprint ("^1",s, "^1 was cooked by ", a, "\n");
320 else if (deathtype == DEATH_FALL)
321 bprint ("^1",s, "^1 was grounded by ", a, "\n");
322 else if (deathtype == DEATH_SHOOTING_STAR)
323 bprint ("^1",s, "^1 was shot into space by ", a, "\n");
324 else if (deathtype == DEATH_SWAMP)
325 bprint ("^1",s, "^1 was conserved by ", a, "\n");
326 else if (deathtype == DEATH_HURTTRIGGER && attacker.message2 != "")
328 p = strstrofs(inflictor.message2, "#", 0);
330 bprint("^1", s, "^1 ", inflictor.message2, " ", a, "\n");
332 bprint("^1", s, "^1 ", substring(inflictor.message2, 0, p), a, "^1", substring(inflictor.message2, p+1, strlen(inflictor.message2) - (p+1)), "\n");
334 else if(deathtype == DEATH_TURRET)
335 bprint ("^1",s, "^1 was pushed into the line of fire by ^1", a, "\n");
337 bprint ("^1",s, "^1 was fragged by ", a, "\n");
339 if(g_ctf && targ.flagcarried)
341 UpdateFrags(attacker, ctf_score_value("score_kill"));
342 PlayerScore_Add(attacker, SP_CTF_FCKILLS, 1);
343 GiveFrags(attacker, targ, 0); // for logging
346 GiveFrags(attacker, targ, 1);
347 if (targ.killcount > 2) {
349 bprint ("^1",s,"'s ^1", ftos(targ.killcount), " scoring spree was ended by ", a, "\n");
351 bprint ("^1",s,"'s ^1", ftos(targ.killcount), " kill spree was ended by ", a, "\n");
353 attacker.killcount = attacker.killcount + 1;
354 if (attacker.killcount > 2) {
356 bprint ("^1",a,"^1 made ",ftos(attacker.killcount)," scores in a row\n");
358 bprint ("^1",a,"^1 has ",ftos(attacker.killcount)," frags in a row\n");
361 LogDeath("frag", deathtype, attacker, targ);
363 if (attacker.killcount == 3)
366 bprint (a,"^7 made a ^1TRIPLE SCORE\n");
368 bprint (a,"^7 made a ^1TRIPLE FRAG\n");
369 announce(attacker, "announcer/male/03kills.ogg");
372 else if (attacker.killcount == 5)
375 bprint (a,"^7 unleashes ^1SCORING RAGE\n");
377 bprint (a,"^7 unleashes ^1RAGE\n");
378 announce(attacker, "announcer/male/05kills.ogg");
381 else if (attacker.killcount == 10)
384 bprint (a,"^7 made ^1TEN SCORES IN A ROW!\n");
386 bprint (a,"^7 starts the ^1MASSACRE!\n");
387 announce(attacker, "announcer/male/10kills.ogg");
390 else if (attacker.killcount == 15)
393 bprint (a,"^7 made ^1FIFTEEN SCORES IN A ROW!\n");
395 bprint (a,"^7 executes ^1MAYHEM!\n");
396 announce(attacker, "announcer/male/15kills.ogg");
399 else if (attacker.killcount == 20)
402 bprint (a,"^7 made ^1TWENTY SCORES IN A ROW!\n");
404 bprint (a,"^7 is a ^1BERSERKER!\n");
405 announce(attacker, "announcer/male/20kills.ogg");
408 else if (attacker.killcount == 25)
411 bprint (a,"^7 made ^1TWENTY FIFE SCORES IN A ROW!\n");
413 bprint (a,"^7 inflicts ^1CARNAGE!\n");
414 announce(attacker, "announcer/male/25kills.ogg");
417 else if (attacker.killcount == 30)
420 bprint (a,"^7 made ^1THIRTY SCORES IN A ROW!\n");
422 bprint (a,"^7 unleashes ^1ARMAGEDDON!\n");
423 announce(attacker, "announcer/male/30kills.ogg");
430 centerprint(targ, "^1Watch your step!\n\n\n");
431 if (deathtype == DEATH_HURTTRIGGER && attacker.message != "")
432 bprint ("^1",s, "^1 ", attacker.message, "\n");
433 else if (deathtype == DEATH_DROWN)
435 bprint ("^1",s, "^1 was in the water for too long\n");
437 bprint ("^1",s, "^1 drowned\n");
438 else if (deathtype == DEATH_SLIME)
439 bprint ("^1",s, "^1 was slimed\n");
440 else if (deathtype == DEATH_LAVA)
442 bprint ("^1",s, "^1 found a hot place\n");
444 bprint ("^1",s, "^1 turned into hot slag\n");
445 else if (deathtype == DEATH_FALL)
447 bprint ("^1",s, "^1 tested gravity (and it worked)\n");
449 bprint ("^1",s, "^1 hit the ground with a crunch\n");
450 else if (deathtype == DEATH_SHOOTING_STAR)
451 bprint ("^1",s, "^1 became a shooting star\n");
452 else if (deathtype == DEATH_SWAMP)
454 bprint ("^1",s, "^1 discovered a swamp\n");
456 bprint ("^1",s, "^1 is now conserved for centuries to come\n");
457 else if(deathtype == DEATH_TURRET)
458 bprint ("^1",s, "^1 was mowed down by a turret \n");
461 bprint ("^1",s, "^1 needs a restart\n");
463 bprint ("^1",s, "^1 died\n");
464 GiveFrags(targ, targ, -1);
465 if(PlayerScore_Add(targ, SP_SCORE, 0) == -5) {
466 announce(targ, "announcer/male/botlike.ogg");
469 if (targ.killcount > 2)
471 bprint ("^1",s,"^1 needs a restart after a ",ftos(targ.killcount)," scoring spree\n");
473 bprint ("^1",s,"^1 died with a ",ftos(targ.killcount)," kill spree\n");
475 LogDeath("accident", deathtype, targ, targ);
477 targ.death_origin = targ.origin;
479 targ.killer_origin = attacker.origin;
480 // FIXME: this should go in PutClientInServer
486 // these are updated by each Damage call for use in button triggering and such
488 entity damage_inflictor;
489 entity damage_attacker;
491 void Damage (entity targ, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
495 entity attacker_save;
499 if (gameover || targ.killcount == -666)
502 local entity oldself;
506 damage_inflictor = inflictor;
507 damage_attacker = attacker;
508 attacker_save = attacker;
510 if(deathtype == DEATH_KILL || deathtype == DEATH_TEAMCHANGE || deathtype == DEATH_AUTOTEAMCHANGE)
512 // These are ALWAYS lethal
513 // No damage modification here
514 // Instead, prepare the victim for his death...
516 targ.spawnshieldtime = 0;
517 targ.health = 0.9; // this is < 1
518 targ.flags -= targ.flags & FL_GODMODE;
521 else if(deathtype == DEATH_MIRRORDAMAGE || deathtype == DEATH_NOAMMO)
527 if (targ.classname == "player")
528 if (attacker.classname == "player")
531 damage = damage * bound(0.1, (skill + 5) * 0.1, 1);
533 // nullify damage if teamplay is on
534 if(deathtype != DEATH_TELEFRAG)
535 if(attacker.classname == "player")
537 if(targ.classname == "player" && targ != attacker && (IS_INDEPENDENT_PLAYER(attacker) || IS_INDEPENDENT_PLAYER(targ)))
542 else if(attacker.team == targ.team)
546 else if(attacker != targ)
550 else if(teamplay == 4)
552 if(targ.classname == "player" && targ.deadflag == DEAD_NO)
554 mirrordamage = cvar("g_mirrordamage") * damage;
555 mirrorforce = cvar("g_mirrordamage") * vlen(force);
558 if(cvar("g_friendlyfire") == 0)
562 damage = cvar("g_friendlyfire") * damage;
563 // mirrordamage will be used LATER
572 if(targ.classname == "player")
573 if(attacker.classname == "player")
576 targ.lms_traveled_distance = cvar("g_lms_campcheck_distance");
577 attacker.lms_traveled_distance = cvar("g_lms_campcheck_distance");
582 if ((deathtype == DEATH_FALL) ||
583 (deathtype == DEATH_DROWN) ||
584 (deathtype == DEATH_SLIME) ||
585 (deathtype == DEATH_LAVA))
590 if (targ.armorvalue && (deathtype == WEP_MINSTANEX) && damage)
592 targ.armorvalue -= 1;
593 centerprint(targ, strcat("^3Remaining extra lives: ",ftos(targ.armorvalue),"\n"));
597 if (DEATH_ISWEAPON(deathtype, WEP_LASER))
600 if (targ != attacker)
602 if (targ.classname == "player")
603 centerprint(attacker, "Secondary fire inflicts no damage!\n");
613 // apply strength multiplier
614 if ((attacker.items & IT_STRENGTH) && !g_minstagib)
618 damage = damage * cvar("g_balance_powerup_strength_selfdamage");
619 force = force * cvar("g_balance_powerup_strength_selfforce");
623 damage = damage * cvar("g_balance_powerup_strength_damage");
624 force = force * cvar("g_balance_powerup_strength_force");
628 // apply invincibility multiplier
629 if (targ.items & IT_INVINCIBLE && !g_minstagib)
630 damage = damage * cvar("g_balance_powerup_invincible_takedamage");
632 if (targ == attacker)
633 damage = damage * cvar("g_balance_selfdamagepercent"); // Partial damage if the attacker hits himself
635 // CTF: reduce damage/force
640 damage = damage * cvar("g_ctf_flagcarrier_selfdamage");
641 force = force * cvar("g_ctf_flagcarrier_selfforce");
646 // apply strength rune
647 if (attacker.runes & RUNE_STRENGTH)
649 if(attacker.runes & CURSE_WEAK) // have both curse & rune
651 damage = damage * cvar("g_balance_rune_strength_combo_damage");
652 force = force * cvar("g_balance_rune_strength_combo_force");
656 damage = damage * cvar("g_balance_rune_strength_damage");
657 force = force * cvar("g_balance_rune_strength_force");
660 else if (attacker.runes & CURSE_WEAK)
662 damage = damage * cvar("g_balance_curse_weak_damage");
663 force = force * cvar("g_balance_curse_weak_force");
666 // apply defense rune
667 if (targ.runes & RUNE_DEFENSE)
669 if (targ.runes & CURSE_VULNER) // have both curse & rune
670 damage = damage * cvar("g_balance_rune_defense_combo_takedamage");
672 damage = damage * cvar("g_balance_rune_defense_takedamage");
674 else if (targ.runes & CURSE_VULNER)
675 damage = damage * cvar("g_balance_curse_vulner_takedamage");
681 if(targ.takedamage == DAMAGE_AIM)
683 if(targ.classname == "player")
685 if(IsDifferentTeam(targ, attacker))
690 attacker.typehitsound += 1;
692 attacker.hitsound += 1;
694 damage_goodhits += 1;
695 damage_gooddamage += damage;
702 if(targ.items & IT_STRENGTH)
706 // find height of hit on player axis
707 // if above view_ofs and below maxs, and also in the middle half of the bbox, it is head shot
708 vector headmins, headmaxs, org;
709 org = antilag_takebackorigin(targ, time - ANTILAG_LATENCY(attacker));
710 headmins = org + '0.5 0 0' * targ.mins_x + '0 0.5 0' * targ.mins_y + '0 0 1' * targ.view_ofs_z;
711 headmaxs = org + '0.5 0 0' * targ.maxs_x + '0 0.5 0' * targ.maxs_y + '0 0 1' * targ.maxs_z;
712 if(trace_hits_box(railgun_start, railgun_end, headmins, headmaxs))
718 attacker.typehitsound += 1; // TODO possibly trigger teamkill complain sound!
719 if(time > attacker.teamkill_complain)
723 // note: here, self is actually targ!
724 oldpusher = self.pusher; self.pusher = attacker;
725 VoiceMessage("teamshoot_auto");
726 self.pusher = oldpusher;
728 attacker.teamkill_complain = time + 5;
735 if (self.damageforcescale)
738 self.velocity = self.velocity + self.damageforcescale * force;
739 self.flags = self.flags - (self.flags & FL_ONGROUND);
743 if (self.event_damage)
744 self.event_damage (inflictor, attacker, damage, deathtype, hitloc, force);
747 if(targ.classname == "player" && attacker.classname == "player" && attacker != targ && attacker.health > 2)
749 // Savage: vampire mode
752 if (time > self.spawnshieldtime)
754 attacker.health += damage;
758 if (attacker.runes & RUNE_VAMPIRE)
760 // apply vampire rune
761 if (attacker.runes & CURSE_EMPATHY) // have the curse too
763 //attacker.health = attacker.health + damage * cvar("g_balance_rune_vampire_combo_absorb");
764 attacker.health = bound(
765 cvar("g_balance_curse_empathy_minhealth"), // LA: was 3, now 40
766 attacker.health + damage * cvar("g_balance_rune_vampire_combo_absorb"),
767 cvar("g_balance_rune_vampire_maxhealth")); // LA: was 1000, now 500
771 //attacker.health = attacker.health + damage * cvar("g_balance_rune_vampire_absorb");
772 attacker.health = bound(
773 attacker.health, // LA: was 3, but changed so that you can't lose health
774 // empathy won't let you gain health in the same way...
775 attacker.health + damage * cvar("g_balance_rune_vampire_absorb"),
776 cvar("g_balance_rune_vampire_maxhealth")); // LA: was 1000, now 500
779 // apply empathy curse
780 else if (attacker.runes & CURSE_EMPATHY)
782 attacker.health = bound(
783 cvar("g_balance_curse_empathy_minhealth"), // LA: was 3, now 20
784 attacker.health + damage * cvar("g_balance_curse_empathy_takedamage"),
790 // apply mirror damage if any
791 if(mirrordamage > 0 || mirrorforce > 0)
793 attacker = attacker_save;
797 // just lose extra LIVES, don't kill the player for mirror damage
798 if(attacker.armorvalue > 0)
800 attacker.armorvalue = attacker.armorvalue - 1;
801 centerprint(attacker, strcat("^3Remaining extra lives: ",ftos(attacker.armorvalue),"\n"));
802 attacker.hitsound += 1;
806 force = normalize(attacker.origin + attacker.view_ofs - hitloc) * mirrorforce;
807 Damage(attacker, inflictor, attacker, mirrordamage, DEATH_MIRRORDAMAGE, attacker.origin, force);
811 vector NearestPointOnBox(entity box, vector org)
813 vector m1, m2, nearest;
815 m1 = box.mins + box.origin;
816 m2 = box.maxs + box.origin;
818 nearest_x = bound(m1_x, org_x, m2_x);
819 nearest_y = bound(m1_y, org_y, m2_y);
820 nearest_z = bound(m1_z, org_z, m2_z);
825 float RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity ignore, float forceintensity, float deathtype, entity directhitentity)
826 // Returns total damage applies to creatures
836 float total_damage_to_creatures;
838 blastorigin = (inflictor.origin + (inflictor.mins + inflictor.maxs) * 0.5);
839 total_damage_to_creatures = 0;
841 targ = findradius (blastorigin, rad);
844 if (targ != inflictor)
847 // LordHavoc: measure distance to nearest point on target (not origin)
848 // (this guarentees 100% damage on a touch impact)
849 nearest = NearestPointOnBox(targ, blastorigin);
850 diff = nearest - blastorigin;
851 // round up a little on the damage to ensure full damage on impacts
852 // and turn the distance into a fraction of the radius
853 power = 1 - ((vlen (diff) - 2) / rad);
855 //bprint(ftos(power));
860 finaldmg = coredamage * power + edgedamage * (1 - power);
863 center = targ.origin + (targ.mins + targ.maxs) * 0.5;
864 // if it's a player, use the view origin as reference
865 if (targ.classname == "player")
866 center = targ.origin + targ.view_ofs;
867 force = normalize(center - blastorigin) * (finaldmg / coredamage) * forceintensity;
868 // test line of sight to multiple positions on box,
869 // and do damage if any of them hit
871 c = ceil(finaldmg / 10);
877 traceline(blastorigin, nearest, TRUE, inflictor);
878 if (trace_fraction == 1 || trace_ent == targ
879 || cvar("g_throughfloor"))
882 total_damage_to_creatures += finaldmg;
883 if(targ == directhitentity)
884 Damage (targ, inflictor, attacker, finaldmg, deathtype, nearest, force);
886 Damage (targ, inflictor, attacker, finaldmg, deathtype | HITTYPE_SPLASH, nearest, force);
889 nearest_x = targ.mins_x + random() * targ.size_x;
890 nearest_y = targ.mins_y + random() * targ.size_y;
891 nearest_z = targ.mins_z + random() * targ.size_z;
899 return total_damage_to_creatures;