1 float checkrules_firstblood;
5 float damage_gooddamage;
9 float IsDifferentTeam(entity a, entity b)
24 float IsFlying(entity a)
26 if(a.flags & FL_ONGROUND)
30 traceline(a.origin, a.origin - '0 0 48', MOVE_NORMAL, a);
31 if(trace_fraction < 1)
36 void UpdateFrags(entity player, float f)
38 PlayerTeamScore_AddScore(player, f);
41 // NOTE: f=0 means still count as a (positive) kill, but count no frags for it
42 void GiveFrags (entity attacker, entity targ, float f)
44 // TODO route through PlayerScores instead
52 PlayerScore_Add(attacker, SP_SUICIDES, 1);
57 PlayerScore_Add(attacker, SP_KILLS, -1); // or maybe add a teamkills field?
63 PlayerScore_Add(attacker, SP_KILLS, 1);
66 PlayerScore_Add(targ, SP_DEATHS, 1);
69 if(cvar("g_arena_roundbased"))
72 // FIXME fix the mess this is (we have REAL points now!)
75 f = RunematchHandleFrags(attacker, targ, f);
79 f = kh_HandleFrags(attacker, targ, f);
85 tl = PlayerScore_Add(targ, SP_LMS_LIVES, -1);
86 if(tl < lms_lowest_lives)
87 lms_lowest_lives = tl;
91 lms_next_place = player_count;
92 PlayerScore_Add(targ, SP_LMS_RANK, lms_next_place); // won't ever spawn again
99 if(g_ctf_ignore_frags)
103 attacker.totalfrags += f;
106 UpdateFrags(attacker, f);
109 string AppendItemcodes(string s, entity player)
114 // w = player.switchweapon;
116 w = player.cnt; // previous weapon!
117 s = strcat(s, ftos(w));
118 if(time < player.strength_finished)
120 if(time < player.invincible_finished)
122 if(player.flagcarried != world)
124 if(player.BUTTON_CHAT)
129 s = strcat(s, "|", ftos(player.runes));
133 void LogDeath(string mode, float deathtype, entity killer, entity killed)
136 if(!cvar("sv_eventlog"))
138 s = strcat(":kill:", mode);
139 s = strcat(s, ":", ftos(killer.playerid));
140 s = strcat(s, ":", ftos(killed.playerid));
141 s = strcat(s, ":type=", ftos(deathtype));
142 s = strcat(s, ":items=");
143 s = AppendItemcodes(s, killer);
146 s = strcat(s, ":victimitems=");
147 s = AppendItemcodes(s, killed);
152 void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
157 if (targ.classname == "player" || targ.classname == "corpse")
159 if (targ.classname == "corpse")
163 a = attacker.netname;
165 if (targ == attacker)
167 if (deathtype == DEATH_TEAMCHANGE) {
168 centerprint(targ, strcat("You are now on: ", ColoredTeamName(targ.team)));
169 } else if (deathtype == DEATH_AUTOTEAMCHANGE) {
170 centerprint(targ, strcat("You have been moved into a different team to improve team balance\nYou are now on: ", ColoredTeamName(targ.team)));
172 } else if (deathtype == DEATH_CAMP) {
174 centerprint(targ, "^1Reconsider your tactics, camper!\n\n\n");
176 centerprint(targ, "^1Die camper!\n\n\n");
177 } else if (deathtype == DEATH_NOAMMO) {
179 centerprint(targ, "^1You are reinserted into the game for running out of ammo...\n\n\n");
181 centerprint(targ, "^1You were killed for running out of ammo...\n\n\n");
182 } else if (deathtype == DEATH_ROT) {
184 centerprint(targ, "^1You need to preserve your health\n\n\n");
186 centerprint(targ, "^1You grew too old without taking your medicine\n\n\n");
187 } else if (deathtype == DEATH_MIRRORDAMAGE) {
189 centerprint(targ, "^1Don't go against team mates!\n\n\n");
191 centerprint(targ, "^1Don't shoot your team mates!\n\n\n");
194 centerprint(targ, "^1You need to be more careful!\n\n\n");
196 centerprint(targ, "^1You killed your own dumb self!\n\n\n");
200 if (deathtype == DEATH_CAMP)
201 bprint ("^1",s, "^1 thought he found a nice camping ground\n");
202 else if (deathtype == DEATH_MIRRORDAMAGE)
203 bprint ("^1",s, "^1 didn't become friends with the Lord of Teamplay\n");
205 bprint ("^1",s, "^1 will be reinserted into the game due to his own actions\n");
207 if(deathtype != DEATH_TEAMCHANGE)
209 LogDeath("suicide", deathtype, targ, targ);
210 GiveFrags(attacker, targ, -1);
212 if (targ.killcount > 2)
213 bprint ("^1",s,"^1 ended it all with a ",ftos(targ.killcount)," scoring spree\n");
215 if(deathtype < DEATH_SPECIAL_START && deathtype & DEATH_WEAPONMASK >= WEP_FIRST && deathtype & DEATH_WEAPONMASK <= WEP_LAST)
217 w_deathtypestring = "couldn't resist the urge to self-destruct";
218 w_deathtype = deathtype;
219 weapon_action(deathtype & DEATH_WEAPONMASK, WR_SUICIDEMESSAGE);
220 bprint("^1", s, "^1 ", w_deathtypestring, "\n");
222 else if (deathtype == DEATH_KILL)
223 bprint ("^1",s, "^1 couldn't take it anymore\n");
224 else if (deathtype == DEATH_ROT)
225 bprint ("^1",s, "^1 died\n");
226 else if (deathtype == DEATH_NOAMMO)
228 bprint ("^7",s, " ^7committed suicide. What's the point of living without ammo?\n");
230 else if (deathtype == DEATH_CAMP)
231 bprint ("^1",s, "^1 thought he found a nice camping ground\n");
232 else if (deathtype == DEATH_MIRRORDAMAGE)
233 bprint ("^1",s, "^1 didn't become friends with the Lord of Teamplay\n");
234 else if (deathtype != DEATH_TEAMCHANGE)
235 bprint ("^1",s, "^1 couldn't resist the urge to self-destruct\n");
237 if(deathtype != DEATH_TEAMCHANGE)
239 LogDeath("suicide", deathtype, targ, targ);
240 GiveFrags(attacker, targ, -1);
242 if (targ.killcount > 2)
243 bprint ("^1",s,"^1 ended it all with a ",ftos(targ.killcount)," kill spree\n");
246 else if (attacker.classname == "player" || attacker.classname == "gib")
248 if(teamplay && attacker.team == targ.team)
251 centerprint(attacker, "^1Moron! You went against a teammate!\n\n\n");
252 bprint ("^1", a, "^1 took action against a teammate\n");
254 centerprint(attacker, "^1Moron! You fragged a teammate!\n\n\n");
255 bprint ("^1", a, "^1 mows down a teammate\n");
257 GiveFrags(attacker, targ, -1);
258 if (targ.killcount > 2) {
260 bprint ("^1",s,"'s ^1",ftos(targ.killcount)," scoring spree was ended by a teammate!\n");
262 bprint ("^1",s,"'s ^1",ftos(targ.killcount)," kill spree was ended by a teammate!\n");
264 if (attacker.killcount > 2) {
266 bprint ("^1",a,"^1 ended a ",ftos(attacker.killcount)," scoring spree by going against a teammate\n");
268 bprint ("^1",a,"^1 ended a ",ftos(attacker.killcount)," kill spree by killing a teammate\n");
270 attacker.killcount = 0;
272 LogDeath("tk", deathtype, attacker, targ);
276 if (!checkrules_firstblood)
278 checkrules_firstblood = TRUE;
280 bprint("^1",a, "^1 was the first to score", "\n");
282 bprint("^1",a, "^1 drew first blood", "\n");
286 centerprint(attacker, strcat("^4You scored against ^7", s, "\n\n\n"));
287 centerprint(targ, strcat(a,"^1 scored against you ^7\n\n\n"));
289 centerprint(attacker, strcat("^4You fragged ^7", s, "\n\n\n"));
290 centerprint(targ, strcat("^1You were fragged by ^7", a, "\n\n\n"));
294 bprint ("^1",s, "^1 needs a restart thanks to ", a, "\n");
296 if(deathtype < DEATH_SPECIAL_START && deathtype & DEATH_WEAPONMASK >= WEP_FIRST && deathtype & DEATH_WEAPONMASK <= WEP_LAST)
298 w_deathtypestring = "was blasted by";
299 w_deathtype = deathtype;
300 weapon_action(deathtype & DEATH_WEAPONMASK, WR_KILLMESSAGE);
301 p = strstrofs(w_deathtypestring, "#", 0);
303 bprint("^1", s, "^1 ", w_deathtypestring, " ", a, "\n");
305 bprint("^1", s, "^1 ", substring(w_deathtypestring, 0, p), a, "^1", substring(w_deathtypestring, p+1, strlen(w_deathtypestring) - (p+1)), "\n");
307 else if (deathtype == DEATH_TELEFRAG)
308 bprint ("^1",s, "^1 was telefragged by ", a, "\n");
309 else if (deathtype == DEATH_DROWN)
310 bprint ("^1",s, "^1 was drowned by ", a, "\n");
311 else if (deathtype == DEATH_SLIME)
312 bprint ("^1",s, "^1 was slimed by ", a, "\n");
313 else if (deathtype == DEATH_LAVA)
314 bprint ("^1",s, "^1 was cooked by ", a, "\n");
315 else if (deathtype == DEATH_FALL)
316 bprint ("^1",s, "^1 was grounded by ", a, "\n");
317 else if (deathtype == DEATH_SHOOTING_STAR)
318 bprint ("^1",s, "^1 was shot into space by ", a, "\n");
319 else if (deathtype == DEATH_SWAMP)
320 bprint ("^1",s, "^1 was conserved by ", a, "\n");
321 else if (deathtype == DEATH_HURTTRIGGER && attacker.message2 != "")
323 p = strstrofs(inflictor.message2, "#", 0);
325 bprint("^1", s, "^1 ", inflictor.message2, " ", a, "\n");
327 bprint("^1", s, "^1 ", substring(inflictor.message2, 0, p), a, "^1", substring(inflictor.message2, p+1, strlen(inflictor.message2) - (p+1)), "\n");
329 else if(deathtype == DEATH_TURRET)
330 bprint ("^1",s, "^1 was pushed into the line of fire by ^1", a, "\n");
332 bprint ("^1",s, "^1 was fragged by ", a, "\n");
334 if(g_ctf && targ.flagcarried)
336 UpdateFrags(attacker, ctf_score_value("score_kill"));
337 PlayerScore_Add(attacker, SP_CTF_FCKILLS, 1);
338 GiveFrags(attacker, targ, 0); // for logging
341 GiveFrags(attacker, targ, 1);
342 if (targ.killcount > 2) {
344 bprint ("^1",s,"'s ^1", ftos(targ.killcount), " scoring spree was ended by ", a, "\n");
346 bprint ("^1",s,"'s ^1", ftos(targ.killcount), " kill spree was ended by ", a, "\n");
348 attacker.killcount = attacker.killcount + 1;
349 if (attacker.killcount > 2) {
351 bprint ("^1",a,"^1 made ",ftos(attacker.killcount)," scores in a row\n");
353 bprint ("^1",a,"^1 has ",ftos(attacker.killcount)," frags in a row\n");
356 LogDeath("frag", deathtype, attacker, targ);
358 if (attacker.killcount == 3)
361 bprint (a,"^7 made a ^1TRIPLE SCORE\n");
363 bprint (a,"^7 made a ^1TRIPLE FRAG\n");
364 announce(attacker, "announcer/male/03kills.ogg");
367 else if (attacker.killcount == 5)
370 bprint (a,"^7 unleashes ^1SCORING RAGE\n");
372 bprint (a,"^7 unleashes ^1RAGE\n");
373 announce(attacker, "announcer/male/05kills.ogg");
376 else if (attacker.killcount == 10)
379 bprint (a,"^7 made ^1TEN SCORES IN A ROW!\n");
381 bprint (a,"^7 starts the ^1MASSACRE!\n");
382 announce(attacker, "announcer/male/10kills.ogg");
385 else if (attacker.killcount == 15)
388 bprint (a,"^7 made ^1FIFTEEN SCORES IN A ROW!\n");
390 bprint (a,"^7 executes ^1MAYHEM!\n");
391 announce(attacker, "announcer/male/15kills.ogg");
394 else if (attacker.killcount == 20)
397 bprint (a,"^7 made ^1TWENTY SCORES IN A ROW!\n");
399 bprint (a,"^7 is a ^1BERSERKER!\n");
400 announce(attacker, "announcer/male/20kills.ogg");
403 else if (attacker.killcount == 25)
406 bprint (a,"^7 made ^1TWENTY FIFE SCORES IN A ROW!\n");
408 bprint (a,"^7 inflicts ^1CARNAGE!\n");
409 announce(attacker, "announcer/male/25kills.ogg");
412 else if (attacker.killcount == 30)
415 bprint (a,"^7 made ^1THIRTY SCORES IN A ROW!\n");
417 bprint (a,"^7 unleashes ^1ARMAGEDDON!\n");
418 announce(attacker, "announcer/male/30kills.ogg");
425 centerprint(targ, "^1Watch your step!\n\n\n");
426 if (deathtype == DEATH_HURTTRIGGER && attacker.message != "")
427 bprint ("^1",s, "^1 ", attacker.message, "\n");
428 else if (deathtype == DEATH_DROWN)
430 bprint ("^1",s, "^1 was in the water for too long\n");
432 bprint ("^1",s, "^1 drowned\n");
433 else if (deathtype == DEATH_SLIME)
434 bprint ("^1",s, "^1 was slimed\n");
435 else if (deathtype == DEATH_LAVA)
437 bprint ("^1",s, "^1 found a hot place\n");
439 bprint ("^1",s, "^1 turned into hot slag\n");
440 else if (deathtype == DEATH_FALL)
442 bprint ("^1",s, "^1 tested gravity (and it worked)\n");
444 bprint ("^1",s, "^1 hit the ground with a crunch\n");
445 else if (deathtype == DEATH_SHOOTING_STAR)
446 bprint ("^1",s, "^1 became a shooting star\n");
447 else if (deathtype == DEATH_SWAMP)
449 bprint ("^1",s, "^1 discovered a swamp\n");
451 bprint ("^1",s, "^1 is now conserved for centuries to come\n");
452 else if(deathtype == DEATH_TURRET)
453 bprint ("^1",s, "^1 was mowed down by a turret \n");
456 bprint ("^1",s, "^1 needs a restart\n");
458 bprint ("^1",s, "^1 died\n");
459 GiveFrags(targ, targ, -1);
460 if(PlayerScore_Add(targ, SP_SCORE, 0) == -5) {
461 announce(targ, "announcer/male/botlike.ogg");
464 if (targ.killcount > 2)
466 bprint ("^1",s,"^1 needs a restart after a ",ftos(targ.killcount)," scoring spree\n");
468 bprint ("^1",s,"^1 died with a ",ftos(targ.killcount)," kill spree\n");
470 LogDeath("accident", deathtype, targ, targ);
472 targ.death_origin = targ.origin;
474 targ.killer_origin = attacker.origin;
475 // FIXME: this should go in PutClientInServer
481 // these are updated by each Damage call for use in button triggering and such
483 entity damage_inflictor;
484 entity damage_attacker;
486 void Damage (entity targ, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
490 entity attacker_save;
494 if (gameover || targ.killcount == -666)
497 local entity oldself;
501 damage_inflictor = inflictor;
502 damage_attacker = attacker;
503 attacker_save = attacker;
505 if(deathtype == DEATH_KILL || deathtype == DEATH_TEAMCHANGE || deathtype == DEATH_AUTOTEAMCHANGE)
507 // These are ALWAYS lethal
508 // No damage modification here
509 // Instead, prepare the victim for his death...
511 targ.spawnshieldtime = 0;
512 targ.health = 0.9; // this is < 1
513 targ.flags -= targ.flags & FL_GODMODE;
516 else if(deathtype == DEATH_MIRRORDAMAGE || deathtype == DEATH_NOAMMO)
522 if (targ.classname == "player")
523 if (attacker.classname == "player")
526 damage = damage * bound(0.1, (skill + 5) * 0.1, 1);
528 // nullify damage if teamplay is on
529 if(deathtype != DEATH_TELEFRAG)
530 if(attacker.classname == "player")
532 if(targ.classname == "player" && targ != attacker && (IS_INDEPENDENT_PLAYER(attacker) || IS_INDEPENDENT_PLAYER(targ)))
537 else if(attacker.team == targ.team)
541 else if(attacker != targ)
545 else if(teamplay == 4)
547 if(targ.classname == "player" && targ.deadflag == DEAD_NO)
549 mirrordamage = cvar("g_mirrordamage") * damage;
550 mirrorforce = cvar("g_mirrordamage") * vlen(force);
553 if(cvar("g_friendlyfire") == 0)
557 damage = cvar("g_friendlyfire") * damage;
558 // mirrordamage will be used LATER
567 if(targ.classname == "player")
568 if(attacker.classname == "player")
571 targ.lms_traveled_distance = cvar("g_lms_campcheck_distance");
572 attacker.lms_traveled_distance = cvar("g_lms_campcheck_distance");
577 if ((deathtype == DEATH_FALL) ||
578 (deathtype == DEATH_DROWN) ||
579 (deathtype == DEATH_SLIME) ||
580 (deathtype == DEATH_LAVA))
585 if (targ.armorvalue && (deathtype == WEP_MINSTANEX) && damage)
587 targ.armorvalue -= 1;
588 centerprint(targ, strcat("^3Remaining extra lives: ",ftos(targ.armorvalue),"\n"));
592 if (deathtype == WEP_LASER)
595 if (targ != attacker)
597 if (targ.classname == "player")
598 centerprint(attacker, "Secondary fire inflicts no damage!\n");
608 // apply strength multiplier
609 if (attacker.items & IT_STRENGTH && !g_minstagib)
613 damage = damage * cvar("g_balance_powerup_strength_selfdamage");
614 force = force * cvar("g_balance_powerup_strength_selfforce");
618 damage = damage * cvar("g_balance_powerup_strength_damage");
619 force = force * cvar("g_balance_powerup_strength_force");
623 // apply invincibility multiplier
624 if (targ.items & IT_INVINCIBLE && !g_minstagib)
625 damage = damage * cvar("g_balance_powerup_invincible_takedamage");
627 if (targ == attacker)
628 damage = damage * cvar("g_balance_selfdamagepercent"); // Partial damage if the attacker hits himself
630 // CTF: reduce damage/force
635 damage = damage * cvar("g_ctf_flagcarrier_selfdamage");
636 force = force * cvar("g_ctf_flagcarrier_selfforce");
641 // apply strength rune
642 if (attacker.runes & RUNE_STRENGTH)
644 if(attacker.runes & CURSE_WEAK) // have both curse & rune
646 damage = damage * cvar("g_balance_rune_strength_combo_damage");
647 force = force * cvar("g_balance_rune_strength_combo_force");
651 damage = damage * cvar("g_balance_rune_strength_damage");
652 force = force * cvar("g_balance_rune_strength_force");
655 else if (attacker.runes & CURSE_WEAK)
657 damage = damage * cvar("g_balance_curse_weak_damage");
658 force = force * cvar("g_balance_curse_weak_force");
661 // apply defense rune
662 if (targ.runes & RUNE_DEFENSE)
664 if (targ.runes & CURSE_VULNER) // have both curse & rune
665 damage = damage * cvar("g_balance_rune_defense_combo_takedamage");
667 damage = damage * cvar("g_balance_rune_defense_takedamage");
669 else if (targ.runes & CURSE_VULNER)
670 damage = damage * cvar("g_balance_curse_vulner_takedamage");
675 if(targ.classname == "player")
676 if(IsDifferentTeam(targ, attacker))
678 if(targ.takedamage == DAMAGE_AIM)
681 attacker.hitsound += 1;
683 damage_goodhits += 1;
684 damage_gooddamage += damage;
691 if(targ.items & IT_STRENGTH)
695 // find height of hit on player axis
696 // if above view_ofs and below maxs, and also in the middle half of the bbox, it is head shot
697 vector headmins, headmaxs, org;
698 org = antilag_takebackorigin(targ, time - ANTILAG_LATENCY(attacker));
699 headmins = org + '0.5 0 0' * targ.mins_x + '0 0.5 0' * targ.mins_y + '0 0 1' * targ.view_ofs_z;
700 headmaxs = org + '0.5 0 0' * targ.maxs_x + '0 0.5 0' * targ.maxs_y + '0 0 1' * targ.maxs_z;
701 if(trace_hits_box(railgun_start, railgun_end, headmins, headmaxs))
707 if (self.damageforcescale)
710 self.velocity = self.velocity + self.damageforcescale * force;
711 self.flags = self.flags - (self.flags & FL_ONGROUND);
715 if (self.event_damage)
716 self.event_damage (inflictor, attacker, damage, deathtype, hitloc, force);
719 if(targ.classname == "player" && attacker.classname == "player" && attacker != targ && attacker.health > 2)
721 // Savage: vampire mode
724 if (time > self.spawnshieldtime)
726 attacker.health += damage;
730 if (attacker.runes & RUNE_VAMPIRE)
732 // apply vampire rune
733 if (attacker.runes & CURSE_EMPATHY) // have the curse too
735 //attacker.health = attacker.health + damage * cvar("g_balance_rune_vampire_combo_absorb");
736 attacker.health = bound(
737 cvar("g_balance_curse_empathy_minhealth"), // LA: was 3, now 40
738 attacker.health + damage * cvar("g_balance_rune_vampire_combo_absorb"),
739 cvar("g_balance_rune_vampire_maxhealth")); // LA: was 1000, now 500
743 //attacker.health = attacker.health + damage * cvar("g_balance_rune_vampire_absorb");
744 attacker.health = bound(
745 attacker.health, // LA: was 3, but changed so that you can't lose health
746 // empathy won't let you gain health in the same way...
747 attacker.health + damage * cvar("g_balance_rune_vampire_absorb"),
748 cvar("g_balance_rune_vampire_maxhealth")); // LA: was 1000, now 500
751 // apply empathy curse
752 else if (attacker.runes & CURSE_EMPATHY)
754 attacker.health = bound(
755 cvar("g_balance_curse_empathy_minhealth"), // LA: was 3, now 20
756 attacker.health + damage * cvar("g_balance_curse_empathy_takedamage"),
762 // apply mirror damage if any
763 if(mirrordamage > 0 || mirrorforce > 0)
765 attacker = attacker_save;
769 // just lose extra LIVES, don't kill the player for mirror damage
770 if(attacker.armorvalue > 0)
772 attacker.armorvalue = attacker.armorvalue - 1;
773 centerprint(attacker, strcat("^3Remaining extra lives: ",ftos(attacker.armorvalue),"\n"));
774 attacker.hitsound += 1;
778 force = normalize(attacker.origin + attacker.view_ofs - hitloc) * mirrorforce;
779 Damage(attacker, inflictor, attacker, mirrordamage, DEATH_MIRRORDAMAGE, attacker.origin, force);
783 vector NearestPointOnBox(entity box, vector org)
785 vector m1, m2, nearest;
787 m1 = box.mins + box.origin;
788 m2 = box.maxs + box.origin;
790 nearest_x = bound(m1_x, org_x, m2_x);
791 nearest_y = bound(m1_y, org_y, m2_y);
792 nearest_z = bound(m1_z, org_z, m2_z);
797 float RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity ignore, float forceintensity, float deathtype, entity directhitentity)
798 // Returns total damage applies to creatures
808 float total_damage_to_creatures;
810 blastorigin = (inflictor.origin + (inflictor.mins + inflictor.maxs) * 0.5);
811 total_damage_to_creatures = 0;
813 targ = findradius (blastorigin, rad);
816 if (targ != inflictor)
819 // LordHavoc: measure distance to nearest point on target (not origin)
820 // (this guarentees 100% damage on a touch impact)
821 nearest = NearestPointOnBox(targ, blastorigin);
822 diff = nearest - blastorigin;
823 // round up a little on the damage to ensure full damage on impacts
824 // and turn the distance into a fraction of the radius
825 power = 1 - ((vlen (diff) - 2) / rad);
827 //bprint(ftos(power));
832 finaldmg = coredamage * power + edgedamage * (1 - power);
835 center = targ.origin + (targ.mins + targ.maxs) * 0.5;
836 // if it's a player, use the view origin as reference
837 if (targ.classname == "player")
838 center = targ.origin + targ.view_ofs;
839 force = normalize(center - blastorigin) * (finaldmg / coredamage) * forceintensity;
840 // test line of sight to multiple positions on box,
841 // and do damage if any of them hit
843 c = ceil(finaldmg / 10);
849 traceline(blastorigin, nearest, TRUE, inflictor);
850 if (trace_fraction == 1 || trace_ent == targ
851 || cvar("g_throughfloor"))
854 total_damage_to_creatures += finaldmg;
855 if(targ == directhitentity)
856 Damage (targ, inflictor, attacker, finaldmg, deathtype, nearest, force);
858 Damage (targ, inflictor, attacker, finaldmg, deathtype | HITTYPE_SPLASH, nearest, force);
861 nearest_x = targ.mins_x + random() * targ.size_x;
862 nearest_y = targ.mins_y + random() * targ.size_y;
863 nearest_z = targ.mins_z + random() * targ.size_z;
871 return total_damage_to_creatures;