clean up obituary code
This commit is contained in:
parent
be812d4308
commit
a2b4ae8a15
|
@ -369,10 +369,6 @@ void(float dist) ai_walk = {
|
||||||
|
|
||||||
movedist = dist;
|
movedist = dist;
|
||||||
|
|
||||||
if(self.classname == "monster_dragon") {
|
|
||||||
movetogoal(dist);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// check for noticing a player
|
// check for noticing a player
|
||||||
if(FindTarget()) {
|
if(FindTarget()) {
|
||||||
return;
|
return;
|
||||||
|
|
453
source/client.qc
453
source/client.qc
|
@ -1053,6 +1053,232 @@ void() ClientDisconnect = {
|
||||||
set_suicide_frame();
|
set_suicide_frame();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
float(entity targ, entity attacker) obit_teledeath = {
|
||||||
|
attacker.owner.frags = attacker.owner.frags + 1;
|
||||||
|
bprint(" was telefragged by ");
|
||||||
|
bprint(attacker.owner.netname);
|
||||||
|
bprint("\n");
|
||||||
|
return TRUE;
|
||||||
|
};
|
||||||
|
|
||||||
|
float(entity targ, entity attacker) obit_teledeath2 = {
|
||||||
|
targ.frags = targ.frags - 1;
|
||||||
|
bprint("'s telefrag was deflected by satanic power\n");
|
||||||
|
return TRUE;
|
||||||
|
};
|
||||||
|
|
||||||
|
float(entity targ, entity attacker) obit_suicide = {
|
||||||
|
targ.frags = targ.frags - 1;
|
||||||
|
|
||||||
|
if(targ.weapon == IT_LIGHTNING && targ.waterlevel > 1) {
|
||||||
|
bprint(" discharges into the water.\n");
|
||||||
|
} else if(targ.weapon == IT_GRENADE_LAUNCHER) {
|
||||||
|
bprint(" tries to put the pin back in\n");
|
||||||
|
} else {
|
||||||
|
// FIXME
|
||||||
|
bprint(" becomes bored with life\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
};
|
||||||
|
|
||||||
|
float(entity targ, entity attacker) obit_teamkill = {
|
||||||
|
float rnum;
|
||||||
|
rnum = random();
|
||||||
|
|
||||||
|
attacker.frags = attacker.frags - 1;
|
||||||
|
|
||||||
|
if(rnum < 0.25) {
|
||||||
|
bprint(" mows down a teammate\n");
|
||||||
|
} else if(rnum < 0.50) {
|
||||||
|
// FIXME
|
||||||
|
bprint(" checks his glasses\n");
|
||||||
|
} else if(rnum < 0.75) {
|
||||||
|
bprint(" gets a frag for the other team\n");
|
||||||
|
} else {
|
||||||
|
bprint(" loses another friend\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
};
|
||||||
|
|
||||||
|
float(entity targ, entity attacker) obit_pkill = {
|
||||||
|
string deathstring, deathstring2;
|
||||||
|
|
||||||
|
attacker.frags = attacker.frags + 1;
|
||||||
|
|
||||||
|
switch(attacker.weapon) {
|
||||||
|
case IT_AXE:
|
||||||
|
deathstring = " was ax-murdered by ";
|
||||||
|
deathstring2 = "\n";
|
||||||
|
break;
|
||||||
|
case IT_SHOTGUN:
|
||||||
|
deathstring = " chewed on ";
|
||||||
|
deathstring2 = "'s boomstick\n";
|
||||||
|
break;
|
||||||
|
case IT_SUPER_SHOTGUN:
|
||||||
|
deathstring = " ate 2 loads of ";
|
||||||
|
deathstring2 = "'s buckshot\n";
|
||||||
|
break;
|
||||||
|
case IT_NAILGUN:
|
||||||
|
deathstring = " was nailed by ";
|
||||||
|
deathstring2 = "\n";
|
||||||
|
break;
|
||||||
|
case IT_SUPER_NAILGUN:
|
||||||
|
deathstring = " was punctured by ";
|
||||||
|
deathstring2 = "\n";
|
||||||
|
break;
|
||||||
|
case IT_GRENADE_LAUNCHER:
|
||||||
|
deathstring = " eats ";
|
||||||
|
deathstring2 = "'s pineapple\n";
|
||||||
|
if(targ.health < -40) {
|
||||||
|
deathstring = " was gibbed by ";
|
||||||
|
deathstring2 = "'s grenade\n";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IT_ROCKET_LAUNCHER:
|
||||||
|
deathstring = " rides ";
|
||||||
|
deathstring2 = "'s rocket\n";
|
||||||
|
if(targ.health < -40) {
|
||||||
|
deathstring = " was gibbed by ";
|
||||||
|
deathstring2 = "'s rocket\n" ;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IT_LIGHTNING:
|
||||||
|
deathstring = " accepts ";
|
||||||
|
if(attacker.waterlevel > 1) {
|
||||||
|
deathstring2 = "'s discharge\n";
|
||||||
|
} else {
|
||||||
|
// FIXME
|
||||||
|
deathstring2 = "'s shaft\n";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
bprint(targ.netname);
|
||||||
|
bprint(deathstring);
|
||||||
|
bprint(attacker.netname);
|
||||||
|
bprint(deathstring2);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
};
|
||||||
|
|
||||||
|
float(entity targ, entity attacker) obit_monster = {
|
||||||
|
switch(attacker.classname) {
|
||||||
|
case "monster_army":
|
||||||
|
bprint(" was shot by a Grunt\n"); break;
|
||||||
|
case "monster_demon1":
|
||||||
|
bprint(" was eviscerated by a Fiend\n"); break;
|
||||||
|
case "monster_dog":
|
||||||
|
bprint(" was mauled by a Rottweiler\n"); break;
|
||||||
|
case "monster_enforcer":
|
||||||
|
bprint(" was blasted by an Enforcer\n"); break;
|
||||||
|
case "monster_fish":
|
||||||
|
bprint(" was fed to the Rotfish\n"); break;
|
||||||
|
case "monster_hell_knight":
|
||||||
|
bprint(" was slain by a Death Knight\n"); break;
|
||||||
|
case "monster_knight":
|
||||||
|
bprint(" was slashed by a Knight\n"); break;
|
||||||
|
case "monster_ogre":
|
||||||
|
bprint(" was destroyed by an Ogre\n"); break;
|
||||||
|
case "monster_oldone":
|
||||||
|
bprint(" became one with Shub-Niggurath\n"); break;
|
||||||
|
case "monster_shalrath":
|
||||||
|
bprint(" was exploded by a Vore\n"); break;
|
||||||
|
case "monster_shambler":
|
||||||
|
bprint(" was smashed by a Shambler\n"); break;
|
||||||
|
case "monster_tarbaby":
|
||||||
|
bprint(" was slimed by a Spawn\n"); break;
|
||||||
|
case "monster_vomit":
|
||||||
|
bprint(" was vomited on by a Vomitus\n"); break;
|
||||||
|
case "monster_wizard":
|
||||||
|
bprint(" was scragged by a Scrag\n"); break;
|
||||||
|
case "monster_zombie":
|
||||||
|
bprint(" joins the Zombies\n"); break;
|
||||||
|
default:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
};
|
||||||
|
|
||||||
|
float(entity targ, entity attacker) obit_falling = {
|
||||||
|
if(targ.deathtype == "falling") {
|
||||||
|
targ.deathtype = "";
|
||||||
|
// FIXME
|
||||||
|
bprint(" fell to his death\n");
|
||||||
|
return TRUE;
|
||||||
|
} else {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float(entity targ, entity attacker) obit_water = {
|
||||||
|
switch(targ.watertype) {
|
||||||
|
case -3:
|
||||||
|
if(random() < 0.5) {
|
||||||
|
bprint(" sleeps with the fishes\n");
|
||||||
|
} else {
|
||||||
|
// FIXME
|
||||||
|
bprint(" sucks it down\n");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case -4:
|
||||||
|
if(random() < 0.5) {
|
||||||
|
bprint(" gulped a load of slime\n");
|
||||||
|
} else {
|
||||||
|
bprint(" can't exist on slime alone\n");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case -5:
|
||||||
|
if(targ.health < -15) {
|
||||||
|
bprint(" burst into flames\n");
|
||||||
|
} else if(random() < 0.5) {
|
||||||
|
bprint(" turned into hot slag\n");
|
||||||
|
} else {
|
||||||
|
bprint(" visits the Volcano God\n");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
};
|
||||||
|
|
||||||
|
float(entity targ, entity attacker) obit_trap = {
|
||||||
|
switch(attacker.classname) {
|
||||||
|
case "explo_box":
|
||||||
|
bprint(" blew up\n"); break;
|
||||||
|
case "trap_shooter":
|
||||||
|
case "trap_spikeshooter":
|
||||||
|
bprint(" was spiked\n"); break;
|
||||||
|
case "fireball":
|
||||||
|
bprint(" ate a lavaball\n"); break;
|
||||||
|
case "trigger_changelevel":
|
||||||
|
bprint(" tried to leave\n"); break;
|
||||||
|
default:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
};
|
||||||
|
|
||||||
|
float(entity targ, entity attacker) obit_worldkill = {
|
||||||
|
targ.frags = targ.frags - 1;
|
||||||
|
|
||||||
|
if(attacker.flags & FL_MONSTER) {
|
||||||
|
return obit_monster(targ, attacker);
|
||||||
|
} else if(attacker.solid == SOLID_BSP && attacker != world) {
|
||||||
|
bprint(" was squished\n");
|
||||||
|
return TRUE;
|
||||||
|
} else {
|
||||||
|
return obit_falling(targ, attacker) ||
|
||||||
|
obit_water(targ, attacker) ||
|
||||||
|
obit_trap(targ, attacker);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===========
|
===========
|
||||||
ClientObituary
|
ClientObituary
|
||||||
|
@ -1061,220 +1287,37 @@ called when a player dies
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void(entity targ, entity attacker) ClientObituary = {
|
void(entity targ, entity attacker) ClientObituary = {
|
||||||
float rnum;
|
float did_message;
|
||||||
string deathstring, deathstring2;
|
|
||||||
rnum = random();
|
|
||||||
|
|
||||||
if(targ.classname == "player") {
|
if(targ.classname != "player") {
|
||||||
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;
|
return;
|
||||||
}
|
}
|
||||||
if(attacker.classname == "teledeath2") {
|
|
||||||
bprint("Satan's power deflects ");
|
|
||||||
bprint(targ.netname);
|
bprint(targ.netname);
|
||||||
bprint("'s telefrag\n");
|
|
||||||
targ.frags = targ.frags - 1;
|
switch(attacker.classname) {
|
||||||
return;
|
case "teledeath":
|
||||||
}
|
did_message = obit_teledeath(targ, attacker);
|
||||||
if(attacker.classname == "player") {
|
break;
|
||||||
|
case "teledeath2":
|
||||||
|
did_message = obit_teledeath2(targ, attacker);
|
||||||
|
break;
|
||||||
|
case "player":
|
||||||
if(targ == attacker) {
|
if(targ == attacker) {
|
||||||
// killed self
|
did_message = obit_suicide(targ, attacker);
|
||||||
attacker.frags = attacker.frags - 1;
|
|
||||||
bprint(targ.netname);
|
|
||||||
if(targ.weapon == 64 && targ.waterlevel > 1) {
|
|
||||||
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 && SameTeam(targ, attacker)) {
|
} else if(teamplay == 2 && SameTeam(targ, attacker)) {
|
||||||
if(rnum < 0.25) {
|
did_message = obit_teamkill(targ, attacker);
|
||||||
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 {
|
} else {
|
||||||
deathstring = " loses another friend\n";
|
did_message = obit_pkill(targ, attacker);
|
||||||
}
|
}
|
||||||
bprint(attacker.netname);
|
break;
|
||||||
bprint(deathstring);
|
default:
|
||||||
attacker.frags = attacker.frags - 1;
|
did_message = obit_worldkill(targ, attacker);
|
||||||
return;
|
break;
|
||||||
} 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 ";
|
if(!did_message) {
|
||||||
deathstring2 = "'s boomstick\n";
|
// hell if I know; they're just dead!!!
|
||||||
}
|
|
||||||
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 > 1) {
|
|
||||||
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);
|
|
||||||
// killed by a montser?
|
|
||||||
if(attacker.flags & FL_MONSTER) {
|
|
||||||
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_oldone") {
|
|
||||||
bprint(" became one with Shub-Niggurath\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_tarbaby") {
|
|
||||||
bprint(" was slimed by a Spawn\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;
|
|
||||||
}
|
|
||||||
// tricks and traps
|
|
||||||
if(attacker.classname == "explo_box") {
|
|
||||||
bprint(" blew up\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(attacker.solid == SOLID_BSP && attacker != world) {
|
|
||||||
bprint(" was squished\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(attacker.classname == "trap_shooter" || attacker.classname == "trap_spikeshooter") {
|
|
||||||
bprint(" was spiked\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(attacker.classname == "fireball") {
|
|
||||||
bprint(" ate a lavaball\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(attacker.classname == "trigger_changelevel") {
|
|
||||||
bprint(" tried to leave\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// in-water deaths
|
|
||||||
rnum = targ.watertype;
|
|
||||||
if(rnum == -3) {
|
|
||||||
if(random() < 0.5) {
|
|
||||||
bprint(" sleeps with the fishes\n");
|
|
||||||
} else {
|
|
||||||
bprint(" sucks it down\n");
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
} else if(rnum == -4) {
|
|
||||||
if(random() < 0.5) {
|
|
||||||
bprint(" gulped a load of slime\n");
|
|
||||||
} else {
|
|
||||||
bprint(" can't exist on slime alone\n");
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
} else if(rnum == -5) {
|
|
||||||
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") {
|
|
||||||
targ.deathtype = "";
|
|
||||||
bprint(" fell to his death\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// hell if I know; he's just dead!!!
|
|
||||||
bprint(" died\n");
|
bprint(" died\n");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1085,21 +1085,12 @@ void() ImpulseCommands = {
|
||||||
W_ChangeWeapon();
|
W_ChangeWeapon();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(self.impulse == 9) {
|
switch(self.impulse) {
|
||||||
CheatCommand();
|
case 9: CheatCommand(); break;
|
||||||
}
|
case 10: CycleWeaponCommand(); break;
|
||||||
if(self.impulse == 10) {
|
case 11: ServerflagsCommand(); break;
|
||||||
CycleWeaponCommand();
|
case 12: CycleWeaponReverseCommand(); break;
|
||||||
}
|
case 255: QuadCheat(); break;
|
||||||
if(self.impulse == 11) {
|
|
||||||
ServerflagsCommand();
|
|
||||||
}
|
|
||||||
if(self.impulse == 12) {
|
|
||||||
CycleWeaponReverseCommand();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(self.impulse == 255) {
|
|
||||||
QuadCheat();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.impulse = 0;
|
self.impulse = 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user