prozac-qfcc/demoman.qc

543 lines
14 KiB
C++
Raw Normal View History

#include "defs.qh"
2001-07-17 05:58:10 +00:00
/*======================================================
DEMOMAN.QC
TeamFortress v2.5 29/2/97
========================================================
Functions for the DEMOMAN class and associated weaponry
========================================================*/
// Functions outside this file
void() NormalGrenadeTouch;
void() NormalGrenadeExplode;
// Functions in this file
// Pipebomb Functions
void() TeamFortress_DetonatePipebombs;
void() PipebombTouch;
// Mirv Grenade Functions
void() MirvGrenadeTouch;
void() MirvGrenadeExplode;
void (vector org, entity shooter) MirvGrenadeLaunch;
// Detpack Functions
void(float timer) TeamFortress_SetDetpack;
void() TeamFortress_DetpackSet;
void(float krac) TeamFortress_DetpackStop;
void() TeamFortress_DetpackExplode;
void() TeamFortress_DetpackTouch;
void() TeamFortress_DetpackDisarm;
void() TeamFortress_DetpackCountDown;
//=========================================================================
// Detonate all thrown pipebombs
void() TeamFortress_DetonatePipebombs =
{
local entity e;
// Find all this players pipebombs
e = find(NIL, classname, "pipebomb");
while (e)
2001-07-17 05:58:10 +00:00
{
if(e.owner == self)
e.nextthink = time;
e = find(e, classname, "pipebomb");
}
};
//=========================================================================
// Pipebomb touch function
void() PipebombTouch =
{
sound (self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM); // bounce sound
2001-07-17 05:58:10 +00:00
if (self.velocity == '0 0 0')
self.avelocity = '0 0 0';
};
//=========================================================================
// Touch Function for Mirv Grenade
// Mirv Grenade heavily influenced by the Firewall Grenade by Steve Bond (wedge@nuc.net)
void() MirvGrenadeTouch =
{
// If the Mirv Grenade hits a player, it just bounces off
sound (self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM);
2001-07-17 05:58:10 +00:00
if (self.velocity == '0 0 0')
self.avelocity = '0 0 0';
};
//=========================================================================
// Mirv Grenade explode function, for when the PRIMETIME runs out
void() MirvGrenadeExplode =
{
local float i;
deathmsg = DMSG_GREN_MIRV;
T_RadiusDamage (self, self.owner, 100, NIL);
2001-07-17 05:58:10 +00:00
WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
WriteByte (MSG_MULTICAST, TE_EXPLOSION);
WriteCoord (MSG_MULTICAST, self.origin_x);
WriteCoord (MSG_MULTICAST, self.origin_y);
WriteCoord (MSG_MULTICAST, self.origin_z);
multicast (self.origin, MULTICAST_PHS);
2001-07-17 05:58:10 +00:00
self.solid = SOLID_NOT;
2001-07-17 05:58:10 +00:00
// Launch mirvs
i = 0;
while (i < GR_TYPE_MIRV_NO)
2001-07-17 05:58:10 +00:00
{
MirvGrenadeLaunch (self.origin + '0 0 -1',self.owner);
i = i + 1;
}
#ifdef DEMO_STUFF
// Remove any camera's locks on this missile
if (self.enemy)
CamProjectileLockOff();
#endif
BecomeExplosion();
};
//=========================================================================
// Launch a Mirv
void (vector org, entity shooter) MirvGrenadeLaunch =
{
local float xdir,ydir,zdir;
xdir = 150 * random() - 75;
<Grievre> lemme see... fixes: stuck shamblers, cheat teslas, camming and sensing <Grievre> give mirvs the right death message, make them a little weaker and more spread out <Grievre> increased damage done by exp body... fixes not being able to use airfist if you have daedalus or lg with no cells <Grievre> made it so missing judo = you can't fire for 1.5 seconds, also judo doesn't always work, less chance of it working a) if they're facing you b) if they have knife, judo, or close combat <Grievre> you lose speed the more armor you have (so upgraded people can buy cougar and cheetah now) <Grievre> attempted to fix the respawn guard not telefragging bug (if it was still there) <Grievre> made it so you can tell a shambler to come, stop, or patrol even if it is fighting someone, doesn't really work most of the time but can "wake up" your shambler if it's being screwy <Grievre> (works for all demons) <Grievre> made it so a monster goes back to what it was doing before (following you, patrolling etc) once it's done with its enemy <Grievre> made the sniper rifle less cheap (or tried to), charging now = more accuracy, rather than more damage. OTR now does slightly less damage than regular, but isn't blocked by armor as much. <Grievre> autorifle now has half the rate of fire but does same damage as sniper rifle, but less accurate <Grievre> headshots always ignore armor if target has green armor, legshots always ignore armor except for red <Grievre> added bshams and shambler kings (can be disabled with infokeys) <Grievre> increased max knife blood to 32 <Grievre> made it so airfist bounces gymnasts twice as much, and bounces everyone a little more (I think), may cause stuck bugs but I think it won't. airfist does half damage to gymnasts and slightly more to hwguys <Grievre> made shamblers a little smarter and more powerful in general <Grievre> they now attack buildings (only bshams/kings) if they are attacked by them first <Grievre> bsham/king fireball now sets things on fire <Grievre> shamblers will generally attack the person who last hit them <Grievre> shortened judoka range (they have the old range if they get close combat <Grievre> shamblers will cycle the left-right slash or fireball longer than they did (but they won't keep doing it if their enemy is not visible) <Grievre> fixed shambler fireball so it doesn't miss and hurt itself so much <Grievre> #define OLD_AUTORIFLE <Grievre> will go to the old behavior of the auto rifle <Grievre> I think that's it <Grievre> oh, I changed the intro message and version string a little, you might want to change that
2003-11-12 04:58:19 +00:00
ydir = 2 * (100 - fabs(xdir)) * random() - (75 - fabs(xdir));
zdir = 170 - (fabs(xdir) + fabs(ydir));
2001-07-17 05:58:10 +00:00
newmis = spawn ();
newmis.owner = shooter;
newmis.movetype = MOVETYPE_BOUNCE;
newmis.solid = SOLID_BBOX;
2001-07-17 05:58:10 +00:00
newmis.classname = "grenade";
newmis.weapon = DMSG_GREN_MIRV;
2001-07-17 05:58:10 +00:00
#ifdef NET_SERVER
<Grievre> lemme see... fixes: stuck shamblers, cheat teslas, camming and sensing <Grievre> give mirvs the right death message, make them a little weaker and more spread out <Grievre> increased damage done by exp body... fixes not being able to use airfist if you have daedalus or lg with no cells <Grievre> made it so missing judo = you can't fire for 1.5 seconds, also judo doesn't always work, less chance of it working a) if they're facing you b) if they have knife, judo, or close combat <Grievre> you lose speed the more armor you have (so upgraded people can buy cougar and cheetah now) <Grievre> attempted to fix the respawn guard not telefragging bug (if it was still there) <Grievre> made it so you can tell a shambler to come, stop, or patrol even if it is fighting someone, doesn't really work most of the time but can "wake up" your shambler if it's being screwy <Grievre> (works for all demons) <Grievre> made it so a monster goes back to what it was doing before (following you, patrolling etc) once it's done with its enemy <Grievre> made the sniper rifle less cheap (or tried to), charging now = more accuracy, rather than more damage. OTR now does slightly less damage than regular, but isn't blocked by armor as much. <Grievre> autorifle now has half the rate of fire but does same damage as sniper rifle, but less accurate <Grievre> headshots always ignore armor if target has green armor, legshots always ignore armor except for red <Grievre> added bshams and shambler kings (can be disabled with infokeys) <Grievre> increased max knife blood to 32 <Grievre> made it so airfist bounces gymnasts twice as much, and bounces everyone a little more (I think), may cause stuck bugs but I think it won't. airfist does half damage to gymnasts and slightly more to hwguys <Grievre> made shamblers a little smarter and more powerful in general <Grievre> they now attack buildings (only bshams/kings) if they are attacked by them first <Grievre> bsham/king fireball now sets things on fire <Grievre> shamblers will generally attack the person who last hit them <Grievre> shortened judoka range (they have the old range if they get close combat <Grievre> shamblers will cycle the left-right slash or fireball longer than they did (but they won't keep doing it if their enemy is not visible) <Grievre> fixed shambler fireball so it doesn't miss and hurt itself so much <Grievre> #define OLD_AUTORIFLE <Grievre> will go to the old behavior of the auto rifle <Grievre> I think that's it <Grievre> oh, I changed the intro message and version string a little, you might want to change that
2003-11-12 04:58:19 +00:00
newmis.touch = GrenadeTouch;
newmis.think = GrenadeExplode;
2001-07-17 05:58:10 +00:00
#else
newmis.touch = GrenadeTouch;
newmis.think = GrenadeExplode;
#endif
//WK 2 + random
newmis.nextthink = time + 0.75 + random();
<Grievre> lemme see... fixes: stuck shamblers, cheat teslas, camming and sensing <Grievre> give mirvs the right death message, make them a little weaker and more spread out <Grievre> increased damage done by exp body... fixes not being able to use airfist if you have daedalus or lg with no cells <Grievre> made it so missing judo = you can't fire for 1.5 seconds, also judo doesn't always work, less chance of it working a) if they're facing you b) if they have knife, judo, or close combat <Grievre> you lose speed the more armor you have (so upgraded people can buy cougar and cheetah now) <Grievre> attempted to fix the respawn guard not telefragging bug (if it was still there) <Grievre> made it so you can tell a shambler to come, stop, or patrol even if it is fighting someone, doesn't really work most of the time but can "wake up" your shambler if it's being screwy <Grievre> (works for all demons) <Grievre> made it so a monster goes back to what it was doing before (following you, patrolling etc) once it's done with its enemy <Grievre> made the sniper rifle less cheap (or tried to), charging now = more accuracy, rather than more damage. OTR now does slightly less damage than regular, but isn't blocked by armor as much. <Grievre> autorifle now has half the rate of fire but does same damage as sniper rifle, but less accurate <Grievre> headshots always ignore armor if target has green armor, legshots always ignore armor except for red <Grievre> added bshams and shambler kings (can be disabled with infokeys) <Grievre> increased max knife blood to 32 <Grievre> made it so airfist bounces gymnasts twice as much, and bounces everyone a little more (I think), may cause stuck bugs but I think it won't. airfist does half damage to gymnasts and slightly more to hwguys <Grievre> made shamblers a little smarter and more powerful in general <Grievre> they now attack buildings (only bshams/kings) if they are attacked by them first <Grievre> bsham/king fireball now sets things on fire <Grievre> shamblers will generally attack the person who last hit them <Grievre> shortened judoka range (they have the old range if they get close combat <Grievre> shamblers will cycle the left-right slash or fireball longer than they did (but they won't keep doing it if their enemy is not visible) <Grievre> fixed shambler fireball so it doesn't miss and hurt itself so much <Grievre> #define OLD_AUTORIFLE <Grievre> will go to the old behavior of the auto rifle <Grievre> I think that's it <Grievre> oh, I changed the intro message and version string a little, you might want to change that
2003-11-12 04:58:19 +00:00
newmis.velocity_x = xdir * 3;
newmis.velocity_y = ydir * 3;
newmis.velocity_z = zdir * 5;
2001-07-17 05:58:10 +00:00
<Grievre> lemme see... fixes: stuck shamblers, cheat teslas, camming and sensing <Grievre> give mirvs the right death message, make them a little weaker and more spread out <Grievre> increased damage done by exp body... fixes not being able to use airfist if you have daedalus or lg with no cells <Grievre> made it so missing judo = you can't fire for 1.5 seconds, also judo doesn't always work, less chance of it working a) if they're facing you b) if they have knife, judo, or close combat <Grievre> you lose speed the more armor you have (so upgraded people can buy cougar and cheetah now) <Grievre> attempted to fix the respawn guard not telefragging bug (if it was still there) <Grievre> made it so you can tell a shambler to come, stop, or patrol even if it is fighting someone, doesn't really work most of the time but can "wake up" your shambler if it's being screwy <Grievre> (works for all demons) <Grievre> made it so a monster goes back to what it was doing before (following you, patrolling etc) once it's done with its enemy <Grievre> made the sniper rifle less cheap (or tried to), charging now = more accuracy, rather than more damage. OTR now does slightly less damage than regular, but isn't blocked by armor as much. <Grievre> autorifle now has half the rate of fire but does same damage as sniper rifle, but less accurate <Grievre> headshots always ignore armor if target has green armor, legshots always ignore armor except for red <Grievre> added bshams and shambler kings (can be disabled with infokeys) <Grievre> increased max knife blood to 32 <Grievre> made it so airfist bounces gymnasts twice as much, and bounces everyone a little more (I think), may cause stuck bugs but I think it won't. airfist does half damage to gymnasts and slightly more to hwguys <Grievre> made shamblers a little smarter and more powerful in general <Grievre> they now attack buildings (only bshams/kings) if they are attacked by them first <Grievre> bsham/king fireball now sets things on fire <Grievre> shamblers will generally attack the person who last hit them <Grievre> shortened judoka range (they have the old range if they get close combat <Grievre> shamblers will cycle the left-right slash or fireball longer than they did (but they won't keep doing it if their enemy is not visible) <Grievre> fixed shambler fireball so it doesn't miss and hurt itself so much <Grievre> #define OLD_AUTORIFLE <Grievre> will go to the old behavior of the auto rifle <Grievre> I think that's it <Grievre> oh, I changed the intro message and version string a little, you might want to change that
2003-11-12 04:58:19 +00:00
newmis.avelocity='100 100 500';
1) Attempted to give players positive frags whenever possible. You now should get frags for blowing people up with others' dispensers/mines/expbody, airfisting rockets, etc. 2) Redid Give_Frags_Out 3) Changed many uses of pointcontents and ugly hacks to use hullpointcontents and checkmove, now a lot cleaner and less buggy 4) You can grapple builds again. This caused really odd bugs. 5) You can now damage your own buildings again (gasp). Any time a tesla or sentry is damaged it turns on its attacker, friendly or otherwise. This is both a counter-TK and counter-spy mechanism. 6) Teslas are now entirely inside their bounding box 7) Now check every frame for players startsolid and for outside of the map cube. 8) #define WALL_HURT to make it hurt when you hit a wall 9) Used some cool ideas (aka laws of physics) to make the airfist a little less annoying 10) You now only get 1 mirv per slot without bandolier. Demoman and hwguy gain bandolier. demoman loses his extra mirv but gains an extra grenade and pair of detpacks. Hwguy gets extra grenade. 11) New and improved EMP grenade now does damage based on range. no longer blows up shells. Doesn't directly damage sentries anymore, but does significant damage to dispensers. EMP someone who's setting a det and it blows up in their face. 12) Players now do radius damage from getting EMPed (again) 13) EMPs now go through walls (again) 14) EMP number lowered by one (3 without, 4 with bandolier) and cost raised by $100 15) You can only have 2 frag grens, 3 with bandolier now. 16) Hover boots will now eat cells if they get low on charge. In addition, the silly bug where their charge wasn't restored when you die is fixed now. 17) EMPing a detpack now sets its timer to anywhere between 1 and 121 seconds from current time, with a logarithmic probability of it being lower. (random() * random() * 120 + 1). Also, probably more time the closer it is to the EMP. 18) Judo can now be blocked by people with close combat, knife or judo. Blocked judo means that the attacker loses 3 seconds of attack. 19) Judo missing now makes them unable to fire. 20) Shortened judo range (back to normal if w/ close combat) 21) Attempted to rework the railgun. Seems to be okay now. Probably still a lot of bugs in here, but since this is the devel version I thought I would commit all my changes so people could start testing it. I'll commit fixes as soon as I find the bugs.
2003-11-26 08:53:44 +00:00
newmis.AIRG_Flags = self.AIRG_Flags; //for tk stuff
newmis.AIRG_FlyTracker = self.AIRG_FlyTracker;
2001-07-17 05:58:10 +00:00
setmodel (newmis, "progs/grenade2.mdl");
setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);
2001-07-17 05:58:10 +00:00
setorigin (newmis, org);
};
//=========================================================================
// Handles the Setting of Detpacks
void(float timer) TeamFortress_SetDetpack =
{
local string stimer;
// prevent detpack impulse from triggering anything else
self.impulse = 0;
self.last_impulse = 0;
if (!(self.cutf_items & CUTF_DETPACK))
2001-07-17 05:58:10 +00:00
return;
if (self.ammo_detpack <= 0)
return;
if (infokey (NIL, "no_spam") == "on")
{
sprint(self,PRINT_HIGH,"The admin has disabled spam devices on this map.\n");
return;
}
2001-07-17 05:58:10 +00:00
// Cant set detpack if you're in the air
if (!(self.flags & FL_ONGROUND))
2001-07-17 05:58:10 +00:00
{
sprint (self, PRINT_HIGH, "You can't set detpacks in the air!\n");
2001-07-17 05:58:10 +00:00
return;
}
//WK Prevents spy sliding bug
if (self.is_feigning)
{
sprint (self, PRINT_HIGH, "You can't set detpacks while playing dead!\n");
2001-07-17 05:58:10 +00:00
return;
}
if (self.is_haxxxoring)
{
sprint (self, PRINT_HIGH, "You can't set a detpack while you're hacking something.\n");
2001-07-17 05:58:10 +00:00
return;
}
if (timer < 5)
{
sprint (self, PRINT_HIGH, "You can't set detpacks for less that 5 seconds.\n");
2001-07-17 05:58:10 +00:00
return;
}
if (self.is_detpacking || self.is_toffingadet)
return;
self.is_detpacking = 1;
self.ammo_detpack = self.ammo_detpack - 1;
makeImmune(self,time + 2);
//self.immune_to_check = time + 2;
self.tfstate = self.tfstate | TFSTATE_CANT_MOVE;
2001-07-17 05:58:10 +00:00
// Save the current weapon and remove it
self.weapon = self.current_weapon;
self.current_weapon = 0;
self.weaponmodel = "";
self.weaponframe = 0;
TeamFortress_SetSpeed(self);
self.pausetime = time + WEAP_DETPACK_SETTIME;
2001-07-17 05:58:10 +00:00
stimer = ftos(timer);
sprint(self, PRINT_HIGH, "Setting detpack for ");
sprint(self, PRINT_HIGH, stimer);
sprint(self, PRINT_HIGH, " seconds...\n");
2001-07-17 05:58:10 +00:00
newmis = spawn();
newmis.owner = self;
newmis.classname = "timer";
newmis.netname = "detpack_timer";
newmis.movetype = MOVETYPE_NONE; //WK M3 Bug Hunt
newmis.nextthink = time + WEAP_DETPACK_SETTIME;
2001-07-17 05:58:10 +00:00
newmis.think = TeamFortress_DetpackSet;
newmis.health = timer;
//CH because its on the sbar :)
self.StatusRefreshTime = time + 0.2;
self.StatusBarScreen = 3;
};
//=========================================================================
// Stops the setting of the detpack
void(float krac) TeamFortress_DetpackStop =
{
local entity detpack_timer;
detpack_timer = find(NIL, netname, "detpack_timer");
while ((detpack_timer.owner != self) && (detpack_timer))
2001-07-17 05:58:10 +00:00
detpack_timer = find(detpack_timer, netname, "detpack_timer");
if (!detpack_timer)
2001-07-17 05:58:10 +00:00
return;
if (krac == TRUE) {
sprint(self, PRINT_HIGH, "Your detpack got Kraced!\n");
2001-07-17 05:58:10 +00:00
} else {
sprint(self, PRINT_HIGH, "Detpack retrieved.\n");
2001-07-17 05:58:10 +00:00
self.ammo_detpack = self.ammo_detpack + 1;
}
dremove(detpack_timer);
self.tfstate = self.tfstate - (self.tfstate & TFSTATE_CANT_MOVE);
2001-07-17 05:58:10 +00:00
self.is_detpacking = 0;
self.current_weapon = self.weapon;
W_SetCurrentAmmo();
TeamFortress_SetSpeed(self);
self.pausetime = time;
};
//=========================================================================
// The detpack is set, let the player go and start timer
void() TeamFortress_DetpackSet =
{
local entity countd, oldself;
self.is_detpacking = 0;
self.owner.tfstate = self.owner.tfstate - (self.owner.tfstate & TFSTATE_CANT_MOVE);
2001-07-17 05:58:10 +00:00
self.owner.is_detpacking = 0;
TeamFortress_SetSpeed(self.owner);
#ifdef SPEECH
stuffcmd(self.owner, "play speech/demo_dp.wav\n");
#endif
oldself = self;
self = self.owner;
//self.is_detpacking = 0;
self.current_weapon = self.weapon;
W_SetCurrentAmmo();
self = oldself;
newmis = spawn ();
newmis.owner = self.owner;
newmis.origin = self.owner.origin - '0 0 23';
newmis.movetype = MOVETYPE_BOUNCE;
newmis.solid = SOLID_BBOX;
2001-07-17 05:58:10 +00:00
newmis.classname = "detpack";
newmis.flags = FL_ITEM;
2001-07-17 05:58:10 +00:00
newmis.angles = '90 0 0';
newmis.angles_y = self.owner.angles_y;
newmis.velocity = '0 0 0';
newmis.avelocity = '0 0 0';
newmis.weaponmode = 0; // Detpack weaponmode = 1 when disarming
newmis.touch = TeamFortress_DetpackTouch;
setmodel (newmis, "progs/detpack.mdl");
setsize (newmis, '-16 -16 0', '16 16 8');
setorigin (newmis, self.owner.origin);
sound (newmis, CHAN_WEAPON, "doors/medtry.wav", 1, ATTN_NORM); //CH play set detpack sound
2001-07-17 05:58:10 +00:00
// Create the CountDown entity
countd = spawn();
newmis.linked_list = countd; // attach count to its detpack
countd.think = TeamFortress_DetpackCountDown;
countd.health = self.health - 1;
countd.owner = self.owner;
countd.movetype = MOVETYPE_NONE; //WK M3 Bug Hunt
2001-07-17 05:58:10 +00:00
countd.classname = "countdown_timer"; // Don't call it timer, because we
// don't want it removed if player dies
countd.enemy = newmis;
newmis.oldenemy = countd;
if (self.health <= 10)
countd.nextthink = time + 1;
else
{
countd.nextthink = time + self.health - 10;
countd.health = 9;
}
newmis.nextthink = time + self.health;
newmis.think = TeamFortress_DetpackExplode;
sprint(self.owner, PRINT_HIGH, "Detpack set!\n");
2001-07-17 05:58:10 +00:00
teamprefixsprint(self.team_no,self);
teamsprint6(self,self.netname," sets a detpack!\n","","","","");
dremove(self);
};
//- OfN - Used for extra det explosions
float (vector targ, vector check) vis2orig;
//=========================================================================
// The detpack goes BOOM!
void() TeamFortress_DetpackExplode =
{
1) Attempted to give players positive frags whenever possible. You now should get frags for blowing people up with others' dispensers/mines/expbody, airfisting rockets, etc. 2) Redid Give_Frags_Out 3) Changed many uses of pointcontents and ugly hacks to use hullpointcontents and checkmove, now a lot cleaner and less buggy 4) You can grapple builds again. This caused really odd bugs. 5) You can now damage your own buildings again (gasp). Any time a tesla or sentry is damaged it turns on its attacker, friendly or otherwise. This is both a counter-TK and counter-spy mechanism. 6) Teslas are now entirely inside their bounding box 7) Now check every frame for players startsolid and for outside of the map cube. 8) #define WALL_HURT to make it hurt when you hit a wall 9) Used some cool ideas (aka laws of physics) to make the airfist a little less annoying 10) You now only get 1 mirv per slot without bandolier. Demoman and hwguy gain bandolier. demoman loses his extra mirv but gains an extra grenade and pair of detpacks. Hwguy gets extra grenade. 11) New and improved EMP grenade now does damage based on range. no longer blows up shells. Doesn't directly damage sentries anymore, but does significant damage to dispensers. EMP someone who's setting a det and it blows up in their face. 12) Players now do radius damage from getting EMPed (again) 13) EMPs now go through walls (again) 14) EMP number lowered by one (3 without, 4 with bandolier) and cost raised by $100 15) You can only have 2 frag grens, 3 with bandolier now. 16) Hover boots will now eat cells if they get low on charge. In addition, the silly bug where their charge wasn't restored when you die is fixed now. 17) EMPing a detpack now sets its timer to anywhere between 1 and 121 seconds from current time, with a logarithmic probability of it being lower. (random() * random() * 120 + 1). Also, probably more time the closer it is to the EMP. 18) Judo can now be blocked by people with close combat, knife or judo. Blocked judo means that the attacker loses 3 seconds of attack. 19) Judo missing now makes them unable to fire. 20) Shortened judo range (back to normal if w/ close combat) 21) Attempted to rework the railgun. Seems to be okay now. Probably still a lot of bugs in here, but since this is the devel version I thought I would commit all my changes so people could start testing it. I'll commit fixes as soon as I find the bugs.
2003-11-26 08:53:44 +00:00
local integer pos;
2001-07-17 05:58:10 +00:00
bprint(PRINT_MEDIUM, "FIRE IN THE HOLE!\n");
2001-07-17 05:58:10 +00:00
// Check the pointcontents to prevent detpack outside the world
1) Attempted to give players positive frags whenever possible. You now should get frags for blowing people up with others' dispensers/mines/expbody, airfisting rockets, etc. 2) Redid Give_Frags_Out 3) Changed many uses of pointcontents and ugly hacks to use hullpointcontents and checkmove, now a lot cleaner and less buggy 4) You can grapple builds again. This caused really odd bugs. 5) You can now damage your own buildings again (gasp). Any time a tesla or sentry is damaged it turns on its attacker, friendly or otherwise. This is both a counter-TK and counter-spy mechanism. 6) Teslas are now entirely inside their bounding box 7) Now check every frame for players startsolid and for outside of the map cube. 8) #define WALL_HURT to make it hurt when you hit a wall 9) Used some cool ideas (aka laws of physics) to make the airfist a little less annoying 10) You now only get 1 mirv per slot without bandolier. Demoman and hwguy gain bandolier. demoman loses his extra mirv but gains an extra grenade and pair of detpacks. Hwguy gets extra grenade. 11) New and improved EMP grenade now does damage based on range. no longer blows up shells. Doesn't directly damage sentries anymore, but does significant damage to dispensers. EMP someone who's setting a det and it blows up in their face. 12) Players now do radius damage from getting EMPed (again) 13) EMPs now go through walls (again) 14) EMP number lowered by one (3 without, 4 with bandolier) and cost raised by $100 15) You can only have 2 frag grens, 3 with bandolier now. 16) Hover boots will now eat cells if they get low on charge. In addition, the silly bug where their charge wasn't restored when you die is fixed now. 17) EMPing a detpack now sets its timer to anywhere between 1 and 121 seconds from current time, with a logarithmic probability of it being lower. (random() * random() * 120 + 1). Also, probably more time the closer it is to the EMP. 18) Judo can now be blocked by people with close combat, knife or judo. Blocked judo means that the attacker loses 3 seconds of attack. 19) Judo missing now makes them unable to fire. 20) Shortened judo range (back to normal if w/ close combat) 21) Attempted to rework the railgun. Seems to be okay now. Probably still a lot of bugs in here, but since this is the devel version I thought I would commit all my changes so people could start testing it. I'll commit fixes as soon as I find the bugs.
2003-11-26 08:53:44 +00:00
pos = entpointcontents(self);
if (pos != CONTENTS_SOLID && pos != CONTENTS_SKY)
2001-07-17 05:58:10 +00:00
{
deathmsg = DMSG_DETPACK;
T_RadiusDamage (self, self.owner, WEAP_DETPACK_SIZE, NIL);
2001-07-17 05:58:10 +00:00
sound(self, CHAN_MISC, "weapons/detpack.wav", 1, ATTN_NONE);
2001-07-17 05:58:10 +00:00
WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
WriteByte (MSG_MULTICAST, TE_EXPLOSION);
WriteCoord (MSG_MULTICAST, self.origin_x);
WriteCoord (MSG_MULTICAST, self.origin_y);
WriteCoord (MSG_MULTICAST, self.origin_z);
multicast (self.origin, MULTICAST_PHS);
2001-07-17 05:58:10 +00:00
WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
WriteByte (MSG_MULTICAST, TE_LAVASPLASH);
WriteCoord (MSG_MULTICAST, self.origin_x);
WriteCoord (MSG_MULTICAST, self.origin_y);
WriteCoord (MSG_MULTICAST, self.origin_z);
multicast (self.origin, MULTICAST_PHS);
2001-07-17 05:58:10 +00:00
//- OfN - Should a detpack make the same explosion a gren does? dont think so...
#ifdef extra_detpack_explosions
local float loopc;
local vector rexp;
loopc = 0;
while (loopc < EXTRA_DETEXPOSIONS)
2001-07-17 05:58:10 +00:00
{
rexp_x = self.origin_x + random()*400 - 200;
rexp_y = self.origin_y + random()*400 - 200;
rexp_z = self.origin_z + random()*100;
if (vis2orig(self.origin,rexp))
{
WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
WriteByte (MSG_MULTICAST, TE_EXPLOSION);
WriteCoord (MSG_MULTICAST, rexp_x);
WriteCoord (MSG_MULTICAST, rexp_y);
WriteCoord (MSG_MULTICAST, rexp_z);
multicast (rexp, MULTICAST_PHS);
2001-07-17 05:58:10 +00:00
}
loopc = loopc + 1;
}
#endif
//- OfN - Moves a bit the players that are near the exploding detpack
#ifdef detpack_earthquake
local entity head;
local vector v;
head = findradius(self.origin, DETPACK_EARTHQUAKE_RANGE);
2001-07-17 05:58:10 +00:00
while (head)
{
if (head.classname == "player")
if (head.health > 0)
if (!head.has_disconnected)
if (head.playerclass != PC_UNDEFINED)
if (head.flags & FL_ONGROUND || head.waterlevel)
2001-07-17 05:58:10 +00:00
{
v_x = 100 * crandom();
v_y = 100 * crandom();
v_z = 150 + 200 * random();
head.velocity = head.velocity + v;
}
head = head.chain;
}
#endif
}
else
{
// bprint(PRINT_HIGH, "Your detpack fizzled out.\n");
sprint(self.owner, PRINT_HIGH, "Your detpack fizzled out.\n");
2001-07-17 05:58:10 +00:00
}
// This code handles a disarming scout with protection
if (self.weaponmode == 1) // Detpack was being disarmed
{
TeamFortress_SetSpeed(self.enemy);
dremove(self.oldenemy); // CountDown
dremove(self.observer_list); // Disarm timer
}
BecomeExplosion ();
};
//=========================================================================
// The detpack touch function. Scouts can disarm it.
void() TeamFortress_DetpackTouch =
{
local entity disarm;
if (other.classname != "player")
return;
//WK if (other.playerclass != PC_SCOUT)
if (!(other.tf_items & NIT_SCANNER))
2001-07-17 05:58:10 +00:00
return;
if (self.weaponmode == 1)
return;
if (Teammate(self.owner.team_no,other.team_no))
return;
makeImmune(other,time + 2);
//other.immune_to_check = time + 2;
other.tfstate = other.tfstate | TFSTATE_CANT_MOVE;
2001-07-17 05:58:10 +00:00
sprint(other, PRINT_HIGH, "Disarming detpack...\n");
2001-07-17 05:58:10 +00:00
TeamFortress_SetSpeed(other);
// Spawn disarming entity
disarm = spawn();
disarm.movetype = MOVETYPE_NONE; //WK M3 Bug Hunt
2001-07-17 05:58:10 +00:00
disarm.owner = other; // the scout
disarm.enemy = self; // the detpack
disarm.classname = "timer";
disarm.nextthink = time + WEAP_DETPACK_DISARMTIME;
2001-07-17 05:58:10 +00:00
disarm.think = TeamFortress_DetpackDisarm;
self.weaponmode = 1; // indicates disarming
self.enemy = other; // points to scout
self.observer_list = disarm;
};
//=========================================================================
// The detpack disarm function. Scout has finished disarming it
// .enemy is the detpack
// .owner is the scout
void() TeamFortress_DetpackDisarm =
{
if (self.owner.health <= 0) {
dremove(self);
return;
}
bprint (PRINT_MEDIUM, self.enemy.owner.netname);
bprint (PRINT_MEDIUM, "'s detpack was defused by ");
bprint (PRINT_MEDIUM, self.owner.netname);
bprint (PRINT_MEDIUM, "\n");
2001-07-17 05:58:10 +00:00
//if (!(self.owner.is_feigning))
//- OfN already checked on TeamFortress_SetSpeed()
//{
self.owner.tfstate = self.owner.tfstate - (self.owner.tfstate & TFSTATE_CANT_MOVE);
2001-07-17 05:58:10 +00:00
// Reset speeds of scout
2001-07-25 21:10:26 +00:00
TeamFortress_SetSpeed(self.owner);
2001-07-17 05:58:10 +00:00
//}
dremove(self.enemy.oldenemy); // remove count down
dremove(self.enemy); // remove detpack
dremove(self); // remove this timer
};
//=========================================================================
// The Detpack CountDown function. Displays the seconds left before the
// detpack detonates to the owner of the detpack, if <10
void() TeamFortress_DetpackCountDown =
{
local string cd;
cd = ftos(self.health);
sprint(self.owner, PRINT_HIGH, cd);
sprint(self.owner, PRINT_HIGH, "...\n");
2001-07-17 05:58:10 +00:00
self.nextthink = time + 1;
self.health = self.health - 1;
// Flash the red light
if (self.health <= 4)
self.enemy.skin = 1;
if (self.health <= 3 && self.health > 2) { //WK Detpack alerts
sound (self.owner, CHAN_VOICE, "weapons/fith.wav", 1, ATTN_NORM);
sound (self.enemy, CHAN_WEAPON, "doors/baseuse.wav", 1, ATTN_NORM); //CH play set detpack sound
2001-07-17 05:58:10 +00:00
}
if (self.health == 0)
dremove(self);
};