2001-07-23 20:52:47 +00:00
|
|
|
#include "defs.qh"
|
2001-07-17 05:58:10 +00:00
|
|
|
/*
|
|
|
|
PYRO.QC
|
|
|
|
|
|
|
|
TeamFortress v2.5 31/10/96
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*==============================================
|
|
|
|
Weapons and functions for the PYRO class and
|
|
|
|
associated weaponry
|
|
|
|
==============================================*/
|
|
|
|
void() NapalmGrenadeTouch;
|
|
|
|
|
|
|
|
//WK Extern
|
|
|
|
float (entity foobar) IsBuilding;
|
|
|
|
|
|
|
|
void (vector org, entity shooter) NapalmGrenadeLaunch ;
|
|
|
|
void() Napalm_touch;
|
|
|
|
float (string id_flame) RemoveFlameFromQueue;
|
|
|
|
|
|
|
|
#define DAMAGE_TIME 3
|
|
|
|
|
|
|
|
//** different types of flames (decreasing priority)
|
|
|
|
|
|
|
|
// 1 : burning flames making light and damage (1 per players or monsters)
|
|
|
|
// 2 : exploding flames (grenade)
|
|
|
|
// 3 : burning flames (players, monsters)
|
|
|
|
// 4 : world flames (on ground)
|
|
|
|
|
|
|
|
|
|
|
|
// create a flame of a given type, maintaining the count for each type
|
|
|
|
entity (string type, entity p_owner) FlameSpawn =
|
|
|
|
{
|
|
|
|
if (type != "1")
|
|
|
|
return world;
|
|
|
|
|
|
|
|
|
|
|
|
num_world_flames = num_world_flames + 1;
|
|
|
|
|
|
|
|
/*
|
|
|
|
db1 = ftos(num_world_flames);
|
|
|
|
RPrint("num_world_flames : ");
|
|
|
|
RPrint(db1);
|
|
|
|
RPrint("\n");
|
|
|
|
*/
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
while (num_world_flames > FLAME_MAXWORLDNUM)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
if (!(RemoveFlameFromQueue(type)))
|
|
|
|
{
|
|
|
|
// RPrint("Create flame failed: too many\n");
|
2001-07-23 05:33:21 +00:00
|
|
|
return world;
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
newmis = spawn();
|
|
|
|
|
|
|
|
// to keep track of the number of each type of flames
|
|
|
|
if (type == "1")
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
newmis.movetype = MOVETYPE_FLYMISSILE;
|
|
|
|
newmis.solid = SOLID_BBOX;
|
|
|
|
newmis.effects = EF_DIMLIGHT;
|
2001-07-17 05:58:10 +00:00
|
|
|
newmis.flame_id = "1";
|
|
|
|
setmodel (newmis, "progs/flame2.mdl");
|
|
|
|
setsize (newmis, '0 0 0', '0 0 0');
|
|
|
|
}
|
|
|
|
else if (type == "2")
|
|
|
|
{
|
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.flame_id = "2";
|
|
|
|
setmodel (newmis, "progs/flame2.mdl");
|
|
|
|
newmis.frame=1;
|
|
|
|
setsize (newmis, '0 0 0', '0 0 0');
|
|
|
|
}
|
|
|
|
else if (type == "3")
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
newmis.movetype = MOVETYPE_FLYMISSILE;
|
|
|
|
newmis.solid = SOLID_BBOX;
|
2001-07-17 05:58:10 +00:00
|
|
|
newmis.flame_id = "3";
|
|
|
|
setmodel (newmis, "progs/flame2.mdl");
|
|
|
|
setsize (newmis, '0 0 0', '0 0 0');
|
|
|
|
}
|
|
|
|
else if (type == "4")
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
newmis.movetype = MOVETYPE_FLYMISSILE;
|
|
|
|
newmis.solid = SOLID_BBOX;
|
2001-07-17 05:58:10 +00:00
|
|
|
newmis.flame_id = "4";
|
|
|
|
setmodel (newmis, "progs/flame2.mdl");
|
|
|
|
newmis.frame=1;
|
|
|
|
setsize (newmis, '0 0 0', '0 0 0');
|
|
|
|
}
|
|
|
|
|
|
|
|
newmis.owner = p_owner;
|
|
|
|
return newmis;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// destroy a given flame, maintaining counters and links in the queue
|
|
|
|
void (entity this) FlameDestroy =
|
|
|
|
{
|
|
|
|
// local string db1;
|
|
|
|
|
|
|
|
num_world_flames = num_world_flames - 1;
|
|
|
|
|
|
|
|
/*
|
|
|
|
db1 = ftos(num_world_flames);
|
|
|
|
RPrint("num_world_flames : ");
|
|
|
|
RPrint(db1);
|
|
|
|
RPrint("\n");
|
|
|
|
*/
|
|
|
|
remove(this);
|
|
|
|
};
|
|
|
|
|
|
|
|
float (string id_flame) RemoveFlameFromQueue =
|
|
|
|
{
|
|
|
|
local entity tmp;
|
|
|
|
// local string db1;
|
|
|
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
if (num_world_flames < FLAME_MAXWORLDNUM)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
RPrint("ERROR in RemoveFlameFromQueue\n");
|
2001-07-23 20:52:47 +00:00
|
|
|
return FALSE;
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
db1 = ftos(num_world_flames);
|
|
|
|
RPrint("num_world_flames : ");
|
|
|
|
RPrint(db1);
|
|
|
|
RPrint("\n");
|
|
|
|
*/
|
|
|
|
|
|
|
|
num_world_flames = num_world_flames - 1;
|
|
|
|
|
|
|
|
tmp = find(world, flame_id, "4");
|
|
|
|
if (!tmp)
|
|
|
|
{
|
|
|
|
if (id_flame == "4") // if priority not high enough, don't continue
|
2001-07-23 20:52:47 +00:00
|
|
|
return FALSE;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
tmp = find(world, flame_id, "3");
|
|
|
|
if (!tmp)
|
|
|
|
{
|
|
|
|
if (id_flame == "3")
|
2001-07-23 20:52:47 +00:00
|
|
|
return FALSE;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
tmp = find(world, flame_id, "2");
|
|
|
|
if (!tmp)
|
|
|
|
{
|
|
|
|
if (id_flame == "2")
|
2001-07-23 20:52:47 +00:00
|
|
|
return FALSE;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
tmp = find(world, flame_id, "1");
|
|
|
|
if (!tmp)
|
|
|
|
{
|
|
|
|
// oh shit, no flames found!
|
|
|
|
// the queue must be wrong
|
|
|
|
RPrint("\n\nRemoveFlameFromQueue():BOOM!\n");
|
|
|
|
RPrint("!! please report this bug !!\n");
|
2001-07-23 20:52:47 +00:00
|
|
|
return FALSE;
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
RPrint("flame removed: flame_id: ");
|
|
|
|
RPrint(id_flame);
|
|
|
|
RPrint("\n");
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2001-07-23 20:52:47 +00:00
|
|
|
if (tmp.effects == EF_DIMLIGHT)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
RPrint("** error: this flame should not be removed **\n");
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
remove(tmp);
|
2001-07-23 20:52:47 +00:00
|
|
|
return TRUE;
|
2001-07-17 05:58:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void() Remove=
|
|
|
|
{
|
|
|
|
FlameDestroy(self);
|
|
|
|
};
|
|
|
|
|
|
|
|
// function used by the flames spawned when the grenade explode : killed in water or when stopped
|
|
|
|
void() NapalmGrenadeFollow =
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
traceline(self.origin,self.origin,TRUE,self);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
//WK Bugfix
|
|
|
|
if (self.enemy.waterlevel > 1)
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
sound (self, CHAN_VOICE, "misc/vapeur2.wav", 1, ATTN_NORM);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
FlameDestroy(self);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (self.velocity == '0 0 0')
|
|
|
|
FlameDestroy(self);
|
|
|
|
|
|
|
|
self.nextthink = time + 0.1;
|
|
|
|
// self.think = NapalmGrenadeFollow;
|
|
|
|
};
|
|
|
|
|
|
|
|
void() NapalmGrenadeTouch =
|
|
|
|
{
|
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';
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void() NapalmGrenadeExplode =
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
sound (self, CHAN_AUTO, "weapons/flmgrexp.wav", 1, ATTN_NORM); // bounce sound
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
// Launch flames
|
2001-07-23 20:52:47 +00:00
|
|
|
traceline(self.origin,self.origin,TRUE,self);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
if (trace_inwater == TRUE)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
dremove(self);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DEMO_STUFF
|
|
|
|
// Remove any camera's locks on this missile
|
|
|
|
if (self.enemy)
|
|
|
|
CamProjectileLockOff();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
local entity head;
|
|
|
|
|
|
|
|
// do an incendiary-cannon explosion instead
|
2001-07-23 20:52:47 +00:00
|
|
|
self.effects = self.effects | EF_BRIGHTLIGHT;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
// don't do radius damage to the other, because all the damage
|
|
|
|
// was done in the impact
|
|
|
|
head = findradius(self.origin, 140);
|
|
|
|
|
|
|
|
while (head)
|
|
|
|
{
|
|
|
|
if (head.takedamage)
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
deathmsg = DMSG_FLAME;
|
|
|
|
TF_T_Damage (head, self, self.owner, 120, TF_TD_NOTTEAM, TF_TD_FIRE);
|
2001-07-17 05:58:10 +00:00
|
|
|
// set 'em on fire
|
|
|
|
other = head; // i can't believe this works!
|
|
|
|
Napalm_touch();
|
|
|
|
if (other.classname == "player")
|
|
|
|
stuffcmd(other, "bf\nbf\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
head = head.chain;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
dremove(self);
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
// Launch a flame foe the grenade explosion
|
|
|
|
void (vector org, entity shooter) NapalmGrenadeLaunch =
|
|
|
|
{
|
|
|
|
local float xdir,ydir,zdir, spin;
|
|
|
|
|
|
|
|
xdir = 150 * random() - 75;
|
|
|
|
ydir = 150 * random() - 75;
|
|
|
|
zdir = 40 * random();
|
|
|
|
|
|
|
|
newmis = FlameSpawn ("2", shooter);
|
|
|
|
if (newmis == world)
|
|
|
|
return;
|
|
|
|
|
|
|
|
self.touch = SUB_Null;
|
|
|
|
|
|
|
|
newmis.classname = "fire";
|
|
|
|
newmis.touch = Napalm_touch;
|
|
|
|
newmis.think = NapalmGrenadeFollow;
|
|
|
|
newmis.nextthink = time + 0.1;
|
|
|
|
|
|
|
|
newmis.enemy = shooter.owner;
|
|
|
|
|
|
|
|
newmis.velocity_x = xdir * 2;
|
|
|
|
newmis.velocity_y = ydir * 2;
|
|
|
|
newmis.velocity_z = zdir * 15;
|
|
|
|
|
|
|
|
spin = (random() * 10) / 2;
|
|
|
|
if (spin <= 0)
|
|
|
|
newmis.avelocity='250 300 400';
|
|
|
|
if (spin == 1)
|
|
|
|
newmis.avelocity='400 250 300';
|
|
|
|
if (spin == 2)
|
|
|
|
newmis.avelocity='300 400 250';
|
|
|
|
if (spin == 3)
|
|
|
|
newmis.avelocity='300 300 300';
|
|
|
|
if (spin >= 4)
|
|
|
|
newmis.avelocity='400 250 400';
|
|
|
|
|
|
|
|
setorigin (newmis, org);
|
2001-07-23 20:52:47 +00:00
|
|
|
setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);
|
2001-07-17 05:58:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void() OnPlayerFlame_touch;
|
|
|
|
|
|
|
|
void() FlameFollow =
|
|
|
|
{
|
|
|
|
local vector dir,vtemp,boundsize;
|
|
|
|
local float damage;
|
|
|
|
|
|
|
|
vtemp = self.enemy.absmin;
|
|
|
|
boundsize = self.enemy.size;
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
self.solid = SOLID_NOT;
|
|
|
|
self.movetype = MOVETYPE_NONE;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
// if no flames, remove itself
|
|
|
|
if (self.enemy.numflames == 0)
|
|
|
|
{
|
|
|
|
FlameDestroy(self);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (self.enemy.health < 1)
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
deathmsg = DMSG_FLAME;
|
2001-07-17 05:58:10 +00:00
|
|
|
T_RadiusDamage(self,self,10,self);
|
|
|
|
self.enemy.numflames = 0;
|
|
|
|
FlameDestroy(self);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
if (self.enemy.armorclass & AT_SAVEFIRE)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
// if ((random()*100) < self.enemy.armorvalue)
|
|
|
|
if (self.enemy.armorvalue > 0)
|
|
|
|
{
|
|
|
|
self.health = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (self.health < 1)
|
|
|
|
{
|
|
|
|
// only remove the flame if it is not the master flame, or if it is the last flame
|
2001-07-23 20:52:47 +00:00
|
|
|
if (self.effects != EF_DIMLIGHT || self.enemy.numflames <= 1)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
self.enemy.numflames = self.enemy.numflames - 1;
|
|
|
|
self.enemy.numflames = 0;
|
|
|
|
FlameDestroy(self);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
self.health = self.health - 1;
|
|
|
|
|
|
|
|
// if player is moving too fast, hide flames
|
|
|
|
if (vlen(self.enemy.velocity) < 50)
|
|
|
|
{
|
|
|
|
dir_x = (random() * boundsize_x/2)+boundsize_x/4;
|
|
|
|
dir_y = (random() * boundsize_y/2)+boundsize_y/4;
|
|
|
|
dir_z = (random() * boundsize_z/3)+boundsize_z/2;
|
|
|
|
vtemp = vtemp + dir;
|
|
|
|
setorigin(self, vtemp);
|
|
|
|
|
|
|
|
if (self.model != "progs/flame2.mdl")
|
|
|
|
{
|
|
|
|
self.model = "progs/flame2.mdl";
|
|
|
|
setmodel(self, self.model);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (self.model == "progs/flame2.mdl")
|
|
|
|
{
|
2001-09-30 22:38:44 +00:00
|
|
|
self.model = "";
|
2001-07-17 05:58:10 +00:00
|
|
|
setmodel(self, self.model);
|
|
|
|
}
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
//traceline(self.origin,self.origin,TRUE,self);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
//WK Bugfix
|
|
|
|
if (self.enemy.waterlevel > 1)
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
sound (self, CHAN_VOICE, "misc/vapeur2.wav", 1, ATTN_NORM);
|
2001-07-17 05:58:10 +00:00
|
|
|
self.enemy.numflames = self.enemy.numflames - 1;
|
|
|
|
FlameDestroy(self);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
self.nextthink = time + 0.1;
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
if (self.effects == EF_DIMLIGHT && self.heat >= DAMAGE_TIME)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
damage = self.enemy.numflames * 0.3 * DAMAGE_TIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
if (damage < 1)
|
|
|
|
damage = 1;
|
|
|
|
|
|
|
|
self.heat = 1;
|
2001-07-23 20:52:47 +00:00
|
|
|
deathmsg = DMSG_FLAME;
|
|
|
|
TF_T_Damage(self.enemy, self, self.owner, damage, TF_TD_NOTTEAM, TF_TD_FIRE);
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
2001-07-23 20:52:47 +00:00
|
|
|
else if (self.effects == EF_DIMLIGHT)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
self.heat = self.heat + 1;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// OnPlayerflame : no damage if enemy not dead, spawn flames if touched
|
|
|
|
void() OnPlayerFlame_touch =
|
|
|
|
{
|
|
|
|
local entity flame;
|
|
|
|
local vector vtemp;
|
|
|
|
|
|
|
|
if (other != world && other.health > 0 && other != self.enemy)
|
|
|
|
{
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
if (other.numflames >= FLAME_MAXPLYRFLAMES)
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (other.classname == "player")
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
if ((teamplay & TEAMPLAY_NOEXPLOSIVE) && Teammate(other.team_no, self.owner.team_no))
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
CenterPrint(other,"You are on fire!\n");
|
|
|
|
stuffcmd (other,"bf\n");
|
|
|
|
}
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
if (other.numflames < FLAME_NUMLIGHTS)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
flame = FlameSpawn ("1", other);
|
2001-07-23 20:52:47 +00:00
|
|
|
sound (flame, CHAN_VOICE, "ambience/fire1.wav", 1, ATTN_NORM);
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
flame = FlameSpawn ("3", other);
|
|
|
|
if (flame == world)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
flame.classname = "fire";
|
2001-07-23 20:52:47 +00:00
|
|
|
flame.health = FLAME_PLYRMAXTIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
other.numflames = other.numflames + 1;
|
|
|
|
|
|
|
|
flame.velocity = other.velocity;
|
|
|
|
flame.enemy = other;
|
|
|
|
flame.touch = OnPlayerFlame_touch;
|
|
|
|
flame.owner = self.owner;
|
|
|
|
|
|
|
|
vtemp = self.origin;
|
|
|
|
|
|
|
|
setorigin(flame, vtemp);
|
|
|
|
|
|
|
|
flame.nextthink = time + 0.1;
|
|
|
|
flame.think = FlameFollow;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// worldflame : lot of damage, spawn flames if touched
|
|
|
|
void() WorldFlame_touch =
|
|
|
|
{
|
|
|
|
local entity flame;
|
2001-09-23 04:25:02 +00:00
|
|
|
local vector vtemp;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
deathmsg = DMSG_FLAME;
|
|
|
|
TF_T_Damage(other, self, self.enemy, 2, TF_TD_NOTTEAM, TF_TD_FIRE);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
if (other != world && other.solid != SOLID_TRIGGER && other.health > 0)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
if (other.numflames >= FLAME_MAXPLYRFLAMES)
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (other.classname == "player")
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
if ((teamplay & TEAMPLAY_NOEXPLOSIVE) && Teammate(other.team_no, self.owner.team_no))
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
CenterPrint(other,"You are on fire!\n");
|
|
|
|
stuffcmd (other,"bf\n");
|
|
|
|
}
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
if (other.numflames < FLAME_NUMLIGHTS)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
flame = FlameSpawn ("1", other);
|
2001-07-23 20:52:47 +00:00
|
|
|
sound (flame,CHAN_VOICE, "ambience/fire1.wav", 1, ATTN_NORM);
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
flame = FlameSpawn ("3", other);
|
|
|
|
if (flame == world)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
flame.classname = "fire";
|
|
|
|
flame.health = 0;
|
|
|
|
other.numflames=other.numflames + 1;
|
|
|
|
|
|
|
|
flame.velocity = other.velocity;
|
|
|
|
flame.enemy = other;
|
|
|
|
flame.touch = OnPlayerFlame_touch;
|
|
|
|
flame.owner = self.owner;
|
|
|
|
|
|
|
|
vtemp = self.origin + '0 0 10';
|
|
|
|
|
|
|
|
setorigin(flame, vtemp);
|
|
|
|
|
|
|
|
flame.nextthink = time + 0.15;
|
|
|
|
flame.think = FlameFollow;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//Like the flamethrower touch, but it doesn't light them on fire
|
|
|
|
void() Boot_Flamer_stream_touch =
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
deathmsg = DMSG_HOVER;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
//WK Sweep for mines at point of contact
|
|
|
|
GuerillaMineSweep(self.origin);
|
|
|
|
|
|
|
|
//WK if (other.takedamage && other.classname == "player")
|
|
|
|
if (other.takedamage)
|
2001-07-23 20:52:47 +00:00
|
|
|
TF_T_Damage(other,self,self.owner, 40, TF_TD_NOTTEAM, TF_TD_FIRE);
|
2001-07-17 05:58:10 +00:00
|
|
|
remove(self);
|
|
|
|
};
|
|
|
|
// first touch : direct touch with the flamer stream or flame from grenade
|
|
|
|
void() Flamer_stream_touch =
|
|
|
|
{
|
|
|
|
|
|
|
|
local entity flame;
|
2001-09-23 04:25:02 +00:00
|
|
|
local vector vtemp;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
if (other.classname == "fire")
|
|
|
|
return;
|
|
|
|
|
|
|
|
//WK Sweep for mines at point of contact
|
|
|
|
GuerillaMineSweep(self.origin);
|
|
|
|
|
|
|
|
if (other != world)
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
if (other.takedamage == DAMAGE_AIM && other.health > 0)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
deathmsg = DMSG_FLAME;
|
|
|
|
TF_T_Damage(other,self,self.owner, 15, TF_TD_NOTTEAM, TF_TD_FIRE);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
if (other.numflames >= FLAME_MAXPLYRFLAMES)
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
if (other.armorclass & AT_SAVEFIRE)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
// if ((random()*100) < other.armorvalue)
|
|
|
|
if (other.armorvalue > 0)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (other.classname == "player")
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
if ((teamplay & TEAMPLAY_NOEXPLOSIVE) && Teammate(other.team_no, self.owner.team_no))
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
CenterPrint(other,"You are on fire!\n");
|
|
|
|
stuffcmd (other,"bf\n");
|
|
|
|
}
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
if (other.numflames < FLAME_NUMLIGHTS)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
flame = FlameSpawn("1", other);
|
2001-07-23 20:52:47 +00:00
|
|
|
sound (flame,CHAN_VOICE, "ambience/fire1.wav", 1, ATTN_NORM);
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
flame = FlameSpawn("3", other);
|
|
|
|
if (flame == world)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
flame.classname = "fire";
|
2001-07-23 20:52:47 +00:00
|
|
|
flame.health = FLAME_PLYRMAXTIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
other.numflames=other.numflames + 1;
|
|
|
|
|
|
|
|
flame.velocity = other.velocity;
|
|
|
|
flame.enemy = other;
|
|
|
|
flame.touch = OnPlayerFlame_touch;
|
|
|
|
flame.owner = self.owner;
|
|
|
|
|
|
|
|
vtemp=self.origin;
|
|
|
|
|
|
|
|
setorigin(flame , vtemp);
|
|
|
|
|
|
|
|
flame.nextthink = time + 0.1;
|
|
|
|
flame.think = FlameFollow;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
if (random() < FLAME_BURNRATIO)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
remove(self);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
flame = FlameSpawn("4", other);
|
|
|
|
if (flame != world)
|
|
|
|
{
|
|
|
|
flame.touch = WorldFlame_touch;
|
|
|
|
flame.classname = "fire";
|
|
|
|
|
|
|
|
vtemp=self.origin + '0 0 10';
|
|
|
|
setorigin(flame , vtemp);
|
2001-07-23 20:52:47 +00:00
|
|
|
flame.nextthink = time + FLAME_MAXBURNTIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
flame.think = Remove;
|
|
|
|
flame.enemy = self.owner;
|
|
|
|
}
|
|
|
|
|
|
|
|
remove(self);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void() Napalm_touch =
|
|
|
|
{
|
|
|
|
|
|
|
|
local entity flame;
|
2001-09-23 04:25:02 +00:00
|
|
|
local vector vtemp;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
if (other.classname == "fire")
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (other != world)
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
if (other.takedamage == DAMAGE_AIM && other.health > 0)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
deathmsg = DMSG_FLAME;
|
|
|
|
TF_T_Damage(other, self, self.owner, 6, TF_TD_NOTTEAM, TF_TD_FIRE);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
if (other.numflames >= FLAME_MAXPLYRFLAMES)
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
if (other.armorclass & AT_SAVEFIRE && other.armorvalue > 0)
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (other.classname == "player")
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
if ((teamplay & TEAMPLAY_NOEXPLOSIVE) && Teammate(other.team_no, self.owner.team_no))
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
CenterPrint(other,"You are on fire!\n");
|
|
|
|
stuffcmd (other,"bf\n");
|
|
|
|
}
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
if (other.numflames < FLAME_NUMLIGHTS) // = 0
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
flame = FlameSpawn("1", other);
|
2001-07-23 20:52:47 +00:00
|
|
|
sound (flame,CHAN_VOICE, "ambience/fire1.wav", 1, ATTN_NORM);
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
flame = FlameSpawn("3", other);
|
|
|
|
if (flame == world)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
flame.classname = "fire";
|
2001-07-23 20:52:47 +00:00
|
|
|
flame.health = FLAME_PLYRMAXTIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
other.numflames = other.numflames + 1;
|
|
|
|
|
|
|
|
flame.velocity = other.velocity;
|
|
|
|
flame.enemy = other;
|
|
|
|
flame.touch = OnPlayerFlame_touch;
|
|
|
|
flame.owner = self.owner;
|
|
|
|
|
|
|
|
vtemp=self.origin;
|
|
|
|
|
|
|
|
setorigin(flame , vtemp);
|
|
|
|
|
|
|
|
flame.nextthink = time + 0.1;
|
|
|
|
flame.think = FlameFollow;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
flame = FlameSpawn("4", other);
|
|
|
|
if (flame != world)
|
|
|
|
{
|
|
|
|
flame.touch = WorldFlame_touch;
|
|
|
|
flame.classname = "fire";
|
|
|
|
|
|
|
|
vtemp=self.origin + '0 0 10';
|
|
|
|
setorigin(flame , vtemp);
|
2001-07-23 20:52:47 +00:00
|
|
|
flame.nextthink = time + NAPALM_MAXBURNTIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
flame.think = Remove;
|
|
|
|
flame.enemy = self.owner;
|
|
|
|
}
|
|
|
|
|
|
|
|
FlameDestroy(self);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Player.qc declaration
|
|
|
|
void () DeathBubblesSpawn;
|
|
|
|
|
|
|
|
|
|
|
|
// Slightly varied version of DEATHBUBBLES
|
|
|
|
void(float num_bubbles, vector bub_origin) NewBubbles =
|
|
|
|
{
|
|
|
|
local entity bubble_spawner;
|
|
|
|
|
|
|
|
bubble_spawner = spawn();
|
|
|
|
setorigin (bubble_spawner, bub_origin);
|
2001-07-23 20:52:47 +00:00
|
|
|
bubble_spawner.movetype = MOVETYPE_NONE;
|
|
|
|
bubble_spawner.solid = SOLID_NOT;
|
2001-07-17 05:58:10 +00:00
|
|
|
bubble_spawner.nextthink = time + 0.1;
|
|
|
|
|
|
|
|
if (self.classname == "player")
|
|
|
|
bubble_spawner.owner = self;
|
|
|
|
else
|
|
|
|
bubble_spawner.owner = self.enemy;
|
|
|
|
|
|
|
|
bubble_spawner.think = DeathBubblesSpawn;
|
|
|
|
bubble_spawner.bubble_count = num_bubbles;
|
|
|
|
return;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void() W_FireFlame =
|
|
|
|
{
|
|
|
|
local entity flame;
|
|
|
|
local float rn;
|
|
|
|
|
|
|
|
if (self.waterlevel > 2)
|
|
|
|
{
|
|
|
|
makevectors (self.v_angle);
|
|
|
|
NewBubbles(2, self.origin+v_forward*64);
|
|
|
|
|
|
|
|
rn = random();
|
|
|
|
if (rn < 0.5)
|
2001-07-23 20:52:47 +00:00
|
|
|
sound (self, CHAN_WEAPON, "misc/water1.wav", 1, ATTN_NORM);
|
2001-07-17 05:58:10 +00:00
|
|
|
else
|
2001-07-23 20:52:47 +00:00
|
|
|
sound (self, CHAN_WEAPON, "misc/water2.wav", 1, ATTN_NORM);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Take away a cell
|
|
|
|
self.currentammo = self.ammo_cells = self.ammo_cells - 1;
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
sound (self, CHAN_AUTO, "weapons/flmfire2.wav", 1, ATTN_NORM);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
flame = spawn ();
|
|
|
|
|
|
|
|
flame.owner = self;
|
2001-07-23 20:52:47 +00:00
|
|
|
flame.movetype = MOVETYPE_FLYMISSILE;
|
|
|
|
flame.solid = SOLID_BBOX;
|
2001-07-17 05:58:10 +00:00
|
|
|
flame.classname = "flamerflame";
|
|
|
|
|
|
|
|
// set flame speed
|
|
|
|
|
|
|
|
makevectors (self.v_angle);
|
|
|
|
|
|
|
|
flame.velocity = aim(self, 10000);
|
|
|
|
flame.velocity = flame.velocity * 600;
|
|
|
|
|
|
|
|
flame.touch = Flamer_stream_touch;
|
|
|
|
|
|
|
|
flame.think = s_explode1;
|
|
|
|
flame.nextthink = time + 0.15;
|
|
|
|
|
|
|
|
setmodel (flame, "progs/s_explod.spr");
|
|
|
|
setsize (flame, '0 0 0', '0 0 0');
|
|
|
|
setorigin (flame, self.origin + v_forward * 16 + '0 0 16');
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*======================
|
|
|
|
Touch function for incendiary cannon rockets
|
|
|
|
======================*/
|
|
|
|
void() T_IncendiaryTouch =
|
|
|
|
{
|
|
|
|
local float damg;
|
|
|
|
local entity head;
|
|
|
|
|
|
|
|
if (other == self.owner)
|
|
|
|
return; // don't explode on owner
|
|
|
|
|
2001-07-31 17:08:59 +00:00
|
|
|
if (pointcontents(self.origin) == CONTENTS_SKY)
|
2001-07-17 05:58:10 +00:00
|
|
|
{
|
|
|
|
remove(self);
|
|
|
|
return;
|
|
|
|
}
|
2001-07-23 20:52:47 +00:00
|
|
|
self.effects = self.effects | EF_BRIGHTLIGHT;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
damg = 20 + random()*20;
|
|
|
|
|
|
|
|
if (other.health)
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
deathmsg = DMSG_FLAME;
|
|
|
|
TF_T_Damage (other, self, self.owner, damg, TF_TD_NOTTEAM, TF_TD_FIRE);
|
2001-07-17 05:58:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// don't do radius damage to the other, because all the damage
|
|
|
|
// was done in the impact
|
|
|
|
head = findradius(self.origin, 180);
|
|
|
|
|
|
|
|
while (head)
|
|
|
|
{
|
|
|
|
if (head.takedamage)
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
deathmsg = DMSG_FLAME;
|
|
|
|
TF_T_Damage (head, self, self.owner, 15, TF_TD_NOTTEAM, TF_TD_FIRE);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
// set 'em on fire
|
|
|
|
other = head; // i can't believe this works!
|
|
|
|
Napalm_touch();
|
|
|
|
if (other.classname == "player")
|
|
|
|
stuffcmd(other, "bf\nbf\n");
|
|
|
|
if (IsBuilding(other))
|
2001-07-23 20:52:47 +00:00
|
|
|
TF_T_Damage (head, self, self.owner, 35, TF_TD_NOTTEAM, TF_TD_FIRE);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
head = head.chain;
|
|
|
|
}
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
// sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
|
2001-07-17 05:58:10 +00:00
|
|
|
self.origin = self.origin - 8*normalize(self.velocity);
|
|
|
|
|
|
|
|
#ifdef DEMO_STUFF
|
|
|
|
// Remove any camera's locks on this missile
|
|
|
|
if (self.enemy)
|
|
|
|
CamProjectileLockOff();
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
|
|
|
|
if (other.classname == "force_field") //- OfN - Makes field explosion b4 removing it
|
|
|
|
FieldExplosion(other,self.origin,self);
|
|
|
|
|
|
|
|
dremove(self);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
W_FireIncendiaryCannon
|
|
|
|
================
|
|
|
|
*/
|
|
|
|
void() W_FireIncendiaryCannon =
|
|
|
|
{
|
|
|
|
|
|
|
|
if (self.ammo_rockets < 3)
|
|
|
|
return;
|
|
|
|
|
|
|
|
self.currentammo = self.ammo_rockets = self.ammo_rockets - 3;
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
sound (self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
KickPlayer(-3, self);
|
|
|
|
|
|
|
|
newmis = spawn ();
|
|
|
|
newmis.owner = self;
|
2001-07-23 20:52:47 +00:00
|
|
|
newmis.movetype = MOVETYPE_FLYMISSILE;
|
|
|
|
newmis.solid = SOLID_BBOX;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
// set newmis speed
|
|
|
|
makevectors (self.v_angle);
|
|
|
|
newmis.velocity = aim(self, 1000);
|
|
|
|
newmis.velocity = newmis.velocity * 600;
|
|
|
|
newmis.angles = vectoangles(newmis.velocity);
|
|
|
|
|
|
|
|
newmis.touch = T_IncendiaryTouch;
|
|
|
|
|
|
|
|
//- OfN - For airfist
|
|
|
|
newmis.classname = "rocket";
|
|
|
|
|
|
|
|
// set newmis duration
|
|
|
|
newmis.nextthink = time + 5;
|
|
|
|
newmis.think = SUB_Remove;
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
newmis.weapon = DMSG_INCENDIARY;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
setmodel (newmis, "progs/missile.mdl");
|
|
|
|
setsize (newmis, '0 0 0', '0 0 0');
|
|
|
|
setorigin (newmis, self.origin + v_forward*8 + '0 0 16');
|
|
|
|
|
|
|
|
#ifdef DEMO_STUFF
|
|
|
|
// Have we got a live camera in projectile mode?
|
|
|
|
if (live_camera)
|
|
|
|
CamProjectileLockOn();
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
// Incendiary cannon selection function
|
|
|
|
void() TeamFortress_IncendiaryCannon =
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
if (!(self.weapons_carried & WEAP_INCENDIARY))
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (self.ammo_rockets < 3)
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
sprint (self, PRINT_HIGH, "not enough ammo.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
self.current_weapon = WEAP_INCENDIARY;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
W_SetCurrentAmmo();
|
|
|
|
};
|
|
|
|
// Flamethrower selection function
|
|
|
|
void() TeamFortress_FlameThrower =
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
if (!(self.weapons_carried & WEAP_FLAMETHROWER))
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (self.ammo_cells < 1)
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
sprint (self, PRINT_HIGH, "not enough ammo.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
self.current_weapon = WEAP_FLAMETHROWER;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
W_SetCurrentAmmo();
|
|
|
|
};
|
|
|
|
|