2001-07-23 20:52:47 +00:00
|
|
|
#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
|
2001-11-02 17:00:52 +00:00
|
|
|
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 =
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
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
|
2001-07-23 20:52:47 +00:00
|
|
|
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;
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
deathmsg = DMSG_GREN_MIRV;
|
2001-11-02 17:00:52 +00:00
|
|
|
T_RadiusDamage (self, self.owner, 100, NIL);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
2001-10-13 23:02:22 +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);
|
2001-07-23 20:52:47 +00:00
|
|
|
multicast (self.origin, MULTICAST_PHS);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
self.solid = SOLID_NOT;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
// Launch mirvs
|
|
|
|
i = 0;
|
2001-07-23 20:52:47 +00:00
|
|
|
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;
|
2001-07-23 20:52:47 +00:00
|
|
|
newmis.movetype = MOVETYPE_BOUNCE;
|
|
|
|
newmis.solid = SOLID_BBOX;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
newmis.classname = "grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
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';
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
setmodel (newmis, "progs/grenade2.mdl");
|
2001-07-23 20:52:47 +00:00
|
|
|
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;
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
if (!(self.cutf_items & CUTF_DETPACK))
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (self.ammo_detpack <= 0)
|
|
|
|
return;
|
|
|
|
|
2001-11-02 17:00:52 +00:00
|
|
|
if (infokey (NIL, "no_spam") == "on")
|
2001-07-25 17:03:53 +00:00
|
|
|
{
|
|
|
|
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
|
2001-07-23 20:52:47 +00:00
|
|
|
if (!(self.flags & FL_ONGROUND))
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
2001-07-23 20:52:47 +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)
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
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)
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
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)
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
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;
|
2001-07-23 20:52:47 +00:00
|
|
|
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);
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
self.pausetime = time + WEAP_DETPACK_SETTIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
stimer = ftos(timer);
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
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";
|
2001-07-23 20:52:47 +00:00
|
|
|
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;
|
|
|
|
|
2001-11-02 17:00:52 +00:00
|
|
|
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");
|
|
|
|
|
2001-11-02 17:00:52 +00:00
|
|
|
if (!detpack_timer)
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
if (krac == TRUE) {
|
|
|
|
sprint(self, PRINT_HIGH, "Your detpack got Kraced!\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
} else {
|
2001-07-23 20:52:47 +00:00
|
|
|
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);
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
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;
|
2001-07-23 20:52:47 +00:00
|
|
|
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';
|
2001-07-23 20:52:47 +00:00
|
|
|
newmis.movetype = MOVETYPE_BOUNCE;
|
|
|
|
newmis.solid = SOLID_BBOX;
|
2001-07-17 05:58:10 +00:00
|
|
|
newmis.classname = "detpack";
|
2001-07-23 20:52:47 +00:00
|
|
|
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);
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
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;
|
2001-07-23 20:52:47 +00:00
|
|
|
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;
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
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 =
|
|
|
|
{
|
|
|
|
local float pos;
|
|
|
|
|
2001-07-23 20:52:47 +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
|
|
|
|
pos = pointcontents(self.origin);
|
2001-07-31 17:08:59 +00:00
|
|
|
if (pos != CONTENTS_SOLID && pos != CONTENTS_SKY)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
deathmsg = DMSG_DETPACK;
|
2001-11-02 17:00:52 +00:00
|
|
|
T_RadiusDamage (self, self.owner, WEAP_DETPACK_SIZE, NIL);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
sound(self, CHAN_MISC, "weapons/detpack.wav", 1, ATTN_NONE);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
2001-10-13 23:02:22 +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);
|
2001-07-23 20:52:47 +00:00
|
|
|
multicast (self.origin, MULTICAST_PHS);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
2001-10-13 23:02:22 +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);
|
2001-07-23 20:52:47 +00:00
|
|
|
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;
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
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))
|
|
|
|
{
|
2001-10-13 23:02:22 +00:00
|
|
|
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);
|
2001-07-23 20:52:47 +00:00
|
|
|
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;
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
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)
|
2001-07-23 20:52:47 +00:00
|
|
|
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
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
// 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;
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
//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;
|
2001-07-23 20:52:47 +00:00
|
|
|
other.tfstate = other.tfstate | TFSTATE_CANT_MOVE;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
2001-07-23 20:52:47 +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();
|
2001-07-23 20:52:47 +00:00
|
|
|
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";
|
2001-07-23 20:52:47 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
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()
|
|
|
|
//{
|
2001-07-23 20:52:47 +00:00
|
|
|
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);
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
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
|
2001-07-23 20:52:47 +00:00
|
|
|
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);
|
|
|
|
};
|
|
|
|
|