djcev.com

//

Git Repos / fte_dogmode / qc / obituary.qc

Last update to this file was on 2024-06-15 at 19:50.

Show obituary.qc

//==============================================================================
// obituary.qc
//==============================================================================

//======================================================================
// fields
//======================================================================

#ifdef SSQC
.string obit_name; // dumptruck_ds misc pd additions
.string obit_method; // dumptruck_ds misc pd additions
#endif

//======================================================================
// forward declarations
//======================================================================

#ifdef SSQC
void(entity targ, entity inflictor, entity attacker) ClientObituary;
#endif

//------------------------------------------------------------------------------

#ifdef SSQC
//----------------------------------------------------------------------
// ClientObituary -- called when a player dies
//----------------------------------------------------------------------
void(entity targ, entity inflictor, entity attacker) ClientObituary =
{
local float rnum;
local string deathstring, deathstring2;

rnum = random ();
deathstring = deathstring2 = "";

// refactored to remove one level of indentation -- CEV
if (targ.classname != "player")
return;

if (attacker.classname == "teledeath")
{
bprint (targ.netname);
bprint (" was telefragged by ");
bprint (attacker.owner.netname);
bprint ("\n");

attacker.owner.frags = attacker.owner.frags + 1;
return;
}

if (attacker.classname == "teledeath2")
{
bprint ("Satan's power deflects ");
bprint (targ.netname);
bprint ("'s telefrag\n");

targ.frags = targ.frags - 1;
return;
}

// 1998-07-26 Pentagram telefrag fix by Zoid/Maddes start
// double 666 telefrag
// (can happen often in deathmatch 4 and levels with more
// than one pentagram)
if (attacker.classname == "teledeath3")
{
bprint (targ.netname);
bprint (" was telefragged by ");
bprint (attacker.owner.netname);
bprint ("'s Satan's power\n");
// 1998-07-26 only tfrag player on spot by Maddes start
// targ.frags = targ.frags - 1;
attacker.owner.frags = attacker.owner.frags + 1;
// 1998-07-26 only tfrag player on spot by Maddes end
return;
}

// 1998-07-26 Pentagram telefrag fix by Zoid/Maddes end
if (attacker.classname == "player")
{
if (targ == attacker)
{
// killed self
attacker.frags = attacker.frags - 1;
bprint (targ.netname);

if (targ.weapon == 64 &&
targ.waterlevel > WATERLEVEL_FEET)
{
bprint (" discharges into the water.\n");
return;
}
if (targ.weapon == IT_GRENADE_LAUNCHER)
bprint (" tries to put the pin back in\n");
else
bprint (" becomes bored with life\n");
return;
}
else if ((teamplay == 2) && (targ.team > 0) &&
(targ.team == attacker.team))
{
if (rnum < 0.25)
deathstring = " mows down a teammate\n";
else if (rnum < 0.50)
deathstring = " checks his glasses\n";
else if (rnum < 0.75)
deathstring = " gets a frag for the other "
"team\n";
else
deathstring = " loses another friend\n";
bprint (attacker.netname);
bprint (deathstring);
attacker.frags = attacker.frags - 1;
return;
}
else
{
attacker.frags = attacker.frags + 1;

rnum = attacker.weapon;
if (rnum == IT_AXE)
{
deathstring = " was ax-murdered by ";
deathstring2 = "\n";
}
if (rnum == IT_SHOTGUN)
{
deathstring = " chewed on ";
deathstring2 = "'s boomstick\n";
}
if (rnum == IT_SUPER_SHOTGUN)
{
deathstring = " ate 2 loads of ";
deathstring2 = "'s buckshot\n";
}
if (rnum == IT_NAILGUN)
{
deathstring = " was nailed by ";
deathstring2 = "\n";
}
if (rnum == IT_SUPER_NAILGUN)
{
deathstring = " was punctured by ";
deathstring2 = "\n";
}
if (rnum == IT_GRENADE_LAUNCHER)
{
deathstring = " eats ";
deathstring2 = "'s pineapple\n";
if (targ.health < -40)
{
deathstring = " was gibbed by ";
deathstring2 = "'s grenade\n";
}
}
if (rnum == IT_ROCKET_LAUNCHER)
{
deathstring = " rides ";
deathstring2 = "'s rocket\n";
if (targ.health < -40)
{
deathstring = " was gibbed by ";
deathstring2 = "'s rocket\n" ;
}
}
if (rnum == IT_LIGHTNING)
{
deathstring = " accepts ";
if (attacker.waterlevel > WATERLEVEL_FEET)
deathstring2 = "'s discharge\n";
else
deathstring2 = "'s shaft\n";
}
bprint (targ.netname);
bprint (deathstring);
bprint (attacker.netname);
bprint (deathstring2);
}
return;
}
else
{
targ.frags = targ.frags - 1;
bprint (targ.netname);

// custom obituary messages
if (inflictor.deathtype != "")
{
bprint (" ");
bprint (inflictor.deathtype);
bprint ("\n");
return;
}
if (attacker.deathtype != "")
{
bprint (" ");
bprint (attacker.deathtype);
bprint ("\n");
return;
}

// killed by a monster?
// if (attacker.flags & FL_MONSTER)
if ((attacker.flags & FL_MONSTER) && (attacker.obit_name == ""))
{
if (attacker.classname == "monster_army")
bprint (" was shot by a Grunt\n");
if (attacker.classname == "monster_demon1")
bprint (" was eviscerated by a Fiend\n");
if (attacker.classname == "monster_dog")
bprint (" was mauled by a Rottweiler\n");
if (attacker.classname == "monster_dragon")
bprint (" was fried by a Dragon\n");
if (attacker.classname == "monster_enforcer")
bprint (" was blasted by an Enforcer\n");
if (attacker.classname == "monster_fish")
bprint (" was fed to the Rotfish\n");
if (attacker.classname == "monster_hell_knight")
bprint (" was slain by a Death Knight\n");
if (attacker.classname == "monster_knight")
bprint (" was slashed by a Knight\n");
if (attacker.classname == "monster_ogre")
bprint (" was destroyed by an Ogre\n");
if (attacker.classname == "monster_ogre_marksman")
// dumptruck_ds
bprint (" was felled by a Marksman\n");
if (attacker.classname == "monster_oldone")
bprint (" became one with Shub-Niggurath\n");
if (attacker.classname == "monster_oldone2")
// dumptruck_ds
bprint (" became one with Shub-Niggurath\n");
if (attacker.classname == "monster_boss2")
// dumptruck_ds
bprint (" was exploded by Chthon\n");
if (attacker.classname == "monster_boss")
// dumptruck_ds
bprint (" was exploded by Chthon\n");
if (attacker.classname == "monster_shalrath")
bprint (" was exploded by a Vore\n");
if (attacker.classname == "monster_shambler")
bprint (" was smashed by a Shambler\n");
if (attacker.classname == "monster_vomit")
bprint (" was vomited on by a Vomitus\n");
if (attacker.classname == "monster_wizard")
bprint (" was scragged by a Scrag\n");
if (attacker.classname == "monster_zombie")
bprint (" joins the Zombies\n");

return;
}

// obits for custom monsters -- progs_dump -- dumptruck_ds
if (attacker.obit_name != "")
{
bprint (" was ");
if !(attacker.obit_method)
bprint ("killed");
else
// e.g. ripped apart
bprint (attacker.obit_method);
bprint (" by ");
// a bad monster
bprint (attacker.obit_name);
bprint ("\n");
return;
}

// tricks and traps
if (attacker.classname == "explo_box" ||
attacker.classname == "play_explosion")
{
bprint (" blew up\n");
return;
}
if (attacker.classname == "func_laser")
{
bprint (" discovered that lasers are hot\n");
return;
}
/* TODO CEV
if ((attacker.solid == SOLID_BSP &&
attacker != world &&
attacker.classname != "togglewall") ||
(inflictor.classname == "func_movewall" &&
!(inflictor.spawnflags & MOVEWALL_TOUCH)))
{
bprint (" was squished\n");
return;
}
*/
if (attacker.classname == "trap_shooter" ||
attacker.classname == "trap_spikeshooter" ||
attacker.classname == "trap_switched_shooter")
{
// bprint (" was spiked\n");
// changed for custom shooters -- dumptruck_ds
bprint (" was unlucky\n");
return;
}
if (attacker.classname == "ltrail_start" ||
attacker.classname == "ltrail_relay")
{
bprint (" had an electrifying experience\n");
return;
}
if (attacker.classname == "fireball")
{
bprint (" ate a lavaball\n");
return;
}
if (attacker.classname == "trigger_changelevel")
{
bprint (" tried to leave\n");
return;
}

// in-liquid deaths
if (targ.deathtype == "drowning")
{
if (random() < 0.5)
bprint (" sleeps with the fishes\n");
else
bprint (" sucks it down\n");
return;
}
if (targ.deathtype == "slime")
{
if (random() < 0.5)
bprint (" gulped a load of slime\n");
else
bprint (" can't exist on slime alone\n");
return;
}
if (targ.deathtype == "lava")
{
if (targ.health < -15)
{
bprint (" burst into flames\n");
return;
}
if (random() < 0.5)
bprint (" turned into hot slag\n");
else
bprint (" visits the Volcano God\n");
return;
}

// fell to their death?
if (targ.deathtype == "falling")
{
bprint (" fell to his death\n");
return;
}

// hell if I know; he's just dead!!!
bprint (" died\n");
}
};
#endif

Return to the top of this page or return to the overview of this repo.

Log obituary.qc

Date Commit Message Author + -
2024-06-15 Major update, committing as-is, will have bugs cev +6  
2024-03-24 2nd pass refactor, rework QC class structure cev +20 -3
2024-02-18 Client/player, projectiles, entrypoints refactor cev +336  

Return to the top of this page or return to the overview of this repo.