2002-02-17 03:18:55 +00:00
|
|
|
// + POX moved prototypes from weapons.qc for use here
|
|
|
|
void(float shotcount, vector dir, vector spread) FireBullets2;
|
|
|
|
void(float damage) spawn_touchblood;
|
|
|
|
void() muzzleflash;
|
|
|
|
void (entity targ, entity inflictor, entity attacker, float damage) T_Damage;
|
|
|
|
void () player_run;
|
|
|
|
void(entity bomb, entity attacker, float rad, entity ignore, string dtype) T_RadiusDamage;
|
|
|
|
void(vector org, float damage) SpawnBlood;
|
|
|
|
void() SuperDamageSound;
|
|
|
|
float SECOND_TRIGGER = 15; // Impulse constant for second trigger (more readable than 15)
|
|
|
|
void(vector org) launch_shrapnel; //Predeclare
|
|
|
|
void() player_shot1;
|
|
|
|
void() player_gshot1;
|
|
|
|
void() player_plasma1;
|
|
|
|
void() player_plasma2;
|
|
|
|
void() player_mplasma1;
|
|
|
|
void() player_nail1;
|
|
|
|
void() player_rocket1;
|
|
|
|
void() player_rocketload1;
|
|
|
|
void() player_grenade1;
|
|
|
|
void() player_reshot1;
|
|
|
|
void() player_tshot1;
|
|
|
|
void() player_shrap1;
|
|
|
|
void() player_axe1;
|
|
|
|
void() player_axeb1;
|
|
|
|
void() player_axec1;
|
|
|
|
void() player_axed1;
|
|
|
|
|
|
|
|
//Some nitty-gritty from weapons.qc ...
|
|
|
|
float() crandom =
|
|
|
|
{
|
2002-02-22 20:01:05 +00:00
|
|
|
return 2 * (random() - 0.5);
|
2002-02-17 03:18:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
vector() wall_velocity =
|
|
|
|
{
|
|
|
|
local vector vel;
|
|
|
|
|
|
|
|
vel = normalize (self.velocity);
|
|
|
|
vel = normalize(vel + v_up*(random()- 0.5) + v_right*(random()- 0.5));
|
|
|
|
vel = vel + 2*trace_plane_normal;
|
|
|
|
vel = vel * 200;
|
|
|
|
|
|
|
|
return vel;
|
|
|
|
};
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
Triple Barrel Shot for T-shot
|
|
|
|
Close Range Gibber - long range spread
|
|
|
|
================
|
|
|
|
*/
|
|
|
|
void() W_FireTShot =
|
|
|
|
{
|
|
|
|
local vector dir;
|
|
|
|
|
|
|
|
sound (self ,CHAN_WEAPON, "weapons/ts3fire.wav", 1, ATTN_NORM);
|
|
|
|
|
|
|
|
msg_entity = self;
|
|
|
|
WriteByte (MSG_ONE, SVC_BIGKICK);
|
|
|
|
|
|
|
|
//Added weapon kickback (as long as you're not in mid air)
|
|
|
|
if (self.flags & FL_ONGROUND)
|
|
|
|
self.velocity = self.velocity + v_forward* -80;
|
|
|
|
|
|
|
|
self.currentammo = self.ammo_shells = self.ammo_shells - 3;
|
|
|
|
dir = aim (self, 100000);
|
|
|
|
//POX - 1.01b2 - increased spread, reduced amount
|
|
|
|
//POX - 1.1 - made FireBullets2 (twice the damge, half the pellets + 1 :)
|
|
|
|
FireBullets2 (12, dir, '0.16 0.1 0'); //make priming this thing worth while!
|
|
|
|
};
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
//Start MegaPlasmaBurst - Used by PlasmaGun's Second Trigger
|
|
|
|
//=================================================================================
|
|
|
|
|
|
|
|
void() T_MplasmaTouch =
|
|
|
|
{
|
|
|
|
local float damg;
|
|
|
|
|
|
|
|
if (other == self.owner)
|
|
|
|
return; // don't explode on owner
|
|
|
|
|
|
|
|
if (self.voided) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
self.voided = 1;
|
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
if (pointcontents(self.origin) == CONTENT_SKY) {
|
2002-02-17 03:18:55 +00:00
|
|
|
remove(self);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
damg = 120 + random()*20;
|
|
|
|
|
|
|
|
T_RadiusDamage (self, self.owner, damg, world, "megaplasma");
|
|
|
|
|
|
|
|
sound (self, CHAN_WEAPON, "weapons/mplasex.wav", 1, ATTN_NORM);
|
|
|
|
self.origin = self.origin - 8*normalize(self.velocity);
|
|
|
|
|
|
|
|
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);
|
|
|
|
remove(self);
|
|
|
|
};
|
|
|
|
|
|
|
|
//launch_megaplasma
|
|
|
|
void() launch_megaplasma =
|
|
|
|
{
|
|
|
|
local vector dir;
|
|
|
|
|
|
|
|
self.currentammo = self.ammo_cells = self.ammo_cells - 9;
|
|
|
|
|
|
|
|
sound (self, CHAN_WEAPON, "weapons/mplasma.wav", 1, ATTN_NORM);
|
|
|
|
msg_entity = self;
|
|
|
|
WriteByte (MSG_ONE, SVC_BIGKICK);
|
|
|
|
|
|
|
|
//Added weapon kickback (as long as you're not in mid air)
|
|
|
|
if (self.flags & FL_ONGROUND)
|
|
|
|
self.velocity = self.velocity + v_forward* -270;
|
|
|
|
|
|
|
|
newmis = spawn ();
|
|
|
|
newmis.voided = 0;
|
|
|
|
newmis.owner = self;
|
|
|
|
newmis.movetype = MOVETYPE_FLYMISSILE;
|
|
|
|
newmis.solid = SOLID_BBOX;
|
|
|
|
newmis.classname = "megaplasma";
|
2004-02-08 06:18:03 +00:00
|
|
|
newmis.effects |= EF_BLUE;
|
2002-02-17 03:18:55 +00:00
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
// set speed
|
2002-02-17 03:18:55 +00:00
|
|
|
dir = aim ( self, 1000 );
|
|
|
|
newmis.velocity = dir * 0.01;
|
|
|
|
newmis.avelocity = '300 300 300';
|
|
|
|
newmis.angles = vectoangles(newmis.velocity);
|
|
|
|
newmis.velocity = normalize(newmis.velocity);
|
|
|
|
newmis.velocity = newmis.velocity * 950;
|
|
|
|
|
|
|
|
newmis.touch = T_MplasmaTouch;
|
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
// set duration
|
2002-02-17 03:18:55 +00:00
|
|
|
newmis.think = SUB_Remove;
|
|
|
|
newmis.nextthink = time + 5;
|
|
|
|
setmodel (newmis, "progs/plasma.mdl");
|
|
|
|
setsize (newmis, '0 0 0', '0 0 0');
|
|
|
|
setorigin (newmis, self.origin + v_forward*12 + '0 0 12');
|
|
|
|
};
|
|
|
|
//End MegaPlasmaBurst
|
|
|
|
//=================================================================================
|
|
|
|
//=============================================================================
|
|
|
|
//
|
|
|
|
// START PumkinBall CODE - Used by SuperShotgun's Second Trigger (Impact Grenades)
|
|
|
|
//
|
|
|
|
//=============================================================================
|
|
|
|
void() T_PballTouch =
|
|
|
|
{
|
|
|
|
local float damg;
|
|
|
|
if (other == self.owner)
|
|
|
|
return; // don't explode on owner
|
|
|
|
|
|
|
|
if (self.voided) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
self.voided = 1;
|
|
|
|
|
|
|
|
if (pointcontents(self.origin) == CONTENT_SKY)
|
|
|
|
{
|
|
|
|
remove(self);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
damg = 100 + random()*20;
|
|
|
|
T_RadiusDamage (self, self.owner, damg, world, "impactgrenade");
|
|
|
|
|
|
|
|
// sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
|
|
|
|
self.origin = self.origin - 8*normalize(self.velocity);
|
|
|
|
|
|
|
|
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);
|
|
|
|
remove(self);
|
|
|
|
};
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
W_FirePball
|
|
|
|
================
|
|
|
|
*/
|
|
|
|
void() W_FirePball =
|
|
|
|
{
|
|
|
|
self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
|
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
sound (self, CHAN_AUTO, "weapons/gren2.wav", 1, ATTN_NORM);
|
2002-02-17 03:18:55 +00:00
|
|
|
msg_entity = self;
|
|
|
|
WriteByte (MSG_ONE, SVC_BIGKICK);
|
|
|
|
|
|
|
|
//Added weapon kickback (as long as you're not in mid air)
|
|
|
|
if (self.flags & FL_ONGROUND)
|
|
|
|
self.velocity = self.velocity + v_forward* -150;
|
|
|
|
|
|
|
|
newmis = spawn ();
|
|
|
|
newmis.voided = 0;
|
|
|
|
newmis.owner = self;
|
|
|
|
newmis.movetype = MOVETYPE_TOSS;
|
|
|
|
newmis.solid = SOLID_BBOX;
|
|
|
|
newmis.classname = "impactgrenade";
|
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
// set newmis speed
|
2002-02-17 03:18:55 +00:00
|
|
|
makevectors (self.v_angle);
|
|
|
|
newmis.velocity = v_forward*700 + v_up * 200 + crandom()*v_right*10 + crandom()*v_up*10;
|
|
|
|
newmis.angles = vectoangles(newmis.velocity);
|
|
|
|
|
|
|
|
newmis.touch = T_PballTouch;
|
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
// set newmis duration
|
|
|
|
newmis.think = SUB_Remove;
|
|
|
|
newmis.nextthink = time + 5;
|
2002-02-17 03:18:55 +00:00
|
|
|
setmodel (newmis, "progs/grenade.mdl");
|
|
|
|
setsize (newmis, '0 0 0', '0 0 0');
|
|
|
|
setorigin (newmis, self.origin + v_forward*4);
|
|
|
|
};
|
|
|
|
// END PumkinBall CODE
|
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
//=============================================================================
|
2002-02-17 03:18:55 +00:00
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
//
|
|
|
|
// START MINE CODE (based on hipnotic's proximity mine - uh... hacked to death)
|
|
|
|
// Used for the Grenade Launcher's Second Trigger
|
|
|
|
// This is some laughable, sick code
|
|
|
|
// But it works.
|
|
|
|
//
|
|
|
|
//=============================================================================
|
|
|
|
void() M_DamExplode =
|
|
|
|
{
|
2002-02-22 20:01:05 +00:00
|
|
|
if (self.voided)
|
2002-02-17 03:18:55 +00:00
|
|
|
return;
|
2002-02-22 20:01:05 +00:00
|
|
|
|
2002-02-17 03:18:55 +00:00
|
|
|
self.voided = 1;
|
|
|
|
|
|
|
|
T_RadiusDamage (self, self.owner, 95, world, "mine");
|
|
|
|
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);
|
|
|
|
|
|
|
|
remove (self);
|
|
|
|
};
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
MineExplode
|
|
|
|
================
|
|
|
|
*/
|
|
|
|
//explode immediately! (for doors, plats and breakable objects
|
|
|
|
void() MineImExplode =
|
|
|
|
{
|
|
|
|
self.takedamage = DAMAGE_NO;
|
|
|
|
self.deathtype = "mine";
|
|
|
|
self.owner = self.lastowner;
|
|
|
|
M_DamExplode();
|
|
|
|
};
|
|
|
|
|
|
|
|
void() MineExplode =
|
|
|
|
{
|
|
|
|
self.takedamage = DAMAGE_NO;
|
|
|
|
self.deathtype = "mine";
|
|
|
|
self.nextthink = time + random()*0.15; //gives a more organic explosion when multiple mines explode at once
|
|
|
|
self.owner = self.lastowner;
|
|
|
|
self.think = M_DamExplode;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
MineTouch
|
|
|
|
================
|
|
|
|
*/
|
|
|
|
void() MineTouch =
|
2002-02-22 20:01:05 +00:00
|
|
|
{
|
2002-02-17 03:18:55 +00:00
|
|
|
if (other == self)
|
|
|
|
return;
|
2002-02-22 20:01:05 +00:00
|
|
|
|
|
|
|
if (other.solid == SOLID_TRIGGER) {
|
2002-02-17 03:18:55 +00:00
|
|
|
sound (self, CHAN_AUTO, "weapons/bounce.wav", 1, ATTN_NORM);
|
|
|
|
return;
|
|
|
|
}
|
2002-02-22 20:01:05 +00:00
|
|
|
|
|
|
|
if (other.classname == "grenade") {
|
2002-02-17 03:18:55 +00:00
|
|
|
sound (self, CHAN_AUTO, "weapons/bounce2.wav", 1, ATTN_NORM);
|
|
|
|
self.nextthink = time + 1;
|
|
|
|
return;
|
|
|
|
}
|
2002-02-22 20:01:05 +00:00
|
|
|
|
|
|
|
if (other.classname == "mine") {
|
2002-02-17 03:18:55 +00:00
|
|
|
sound (self, CHAN_AUTO, "weapons/bounce2.wav", 1, ATTN_NORM);
|
|
|
|
self.nextthink = time + 1;
|
|
|
|
return;
|
|
|
|
}
|
2002-02-22 20:01:05 +00:00
|
|
|
|
|
|
|
if (other.classname == "minearm") {
|
2002-02-17 03:18:55 +00:00
|
|
|
sound (self, CHAN_AUTO, "weapons/bounce2.wav", 1, ATTN_NORM);
|
|
|
|
self.nextthink = time + 1;
|
|
|
|
return;
|
|
|
|
}
|
2002-02-22 20:01:05 +00:00
|
|
|
|
|
|
|
if (other.classname == "minearmed") {
|
2002-02-17 03:18:55 +00:00
|
|
|
sound (self, CHAN_AUTO, "weapons/bounce.wav", 1, ATTN_NORM);
|
|
|
|
self.classname = "minearm";
|
|
|
|
self.nextthink = time + 1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
if (other.classname == "player") {
|
2002-02-17 03:18:55 +00:00
|
|
|
sound (self, CHAN_BODY, "weapons/minedet.wav", 1, ATTN_NORM);
|
|
|
|
MineExplode();
|
|
|
|
self.nextthink = time + 0.4;
|
|
|
|
return;
|
|
|
|
}
|
2002-02-22 20:01:05 +00:00
|
|
|
|
|
|
|
if (other.takedamage == DAMAGE_AIM) {
|
2002-02-17 03:18:55 +00:00
|
|
|
MineExplode();
|
|
|
|
self.think();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
self.movetype = MOVETYPE_NONE;
|
|
|
|
self.classname = "minearm";
|
|
|
|
self.spawnmaster = other;
|
|
|
|
self.nextthink = time + 0.1;
|
|
|
|
};
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
MineArm
|
|
|
|
================
|
|
|
|
*/
|
|
|
|
void() MineArm =
|
2002-02-22 20:01:05 +00:00
|
|
|
{
|
|
|
|
local entity head;
|
|
|
|
local float detonate;
|
2002-02-17 03:18:55 +00:00
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
if (self.classname == "minearm") {
|
2002-02-17 03:18:55 +00:00
|
|
|
sound (self, CHAN_WEAPON, "weapons/armed.wav", 1, ATTN_NORM);
|
|
|
|
setsize (self, '-3 -3 -3', '3 3 3');
|
|
|
|
self.owner = world;
|
|
|
|
self.takedamage = DAMAGE_YES;
|
|
|
|
self.skin = 1;
|
|
|
|
self.classname = "minearmed";
|
|
|
|
muzzleflash(); //Will this work?
|
|
|
|
}
|
|
|
|
if ((time > self.delay) || (self.spawnmaster.no_obj == TRUE))
|
|
|
|
{
|
|
|
|
sound (self, CHAN_BODY, "weapons/minedet.wav", 1, ATTN_NORM);
|
|
|
|
MineImExplode();
|
|
|
|
//self.nextthink = time + 0.4;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// No click or delay when velocity triggers mine (so they don't float when doors open)
|
|
|
|
// Although the 'organic' explosion' part in the detonate code might leave it hanging...
|
|
|
|
if (vlen(self.spawnmaster.velocity) > 0)
|
|
|
|
{
|
|
|
|
MineImExplode();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Mines explode on touch, but for some reason most monsters don't detonate them (?)
|
|
|
|
// So had to use a findradius function to look for monsters, it's a small radius though
|
|
|
|
// Ogres still don't always detonate mines (?)
|
|
|
|
head = findradius(self.origin, 39);
|
|
|
|
detonate = 0;
|
2002-02-22 20:01:05 +00:00
|
|
|
|
2002-02-17 03:18:55 +00:00
|
|
|
if (self.health < 0)
|
|
|
|
detonate = 1;
|
2002-02-22 20:01:05 +00:00
|
|
|
|
|
|
|
while (head) {
|
2002-02-17 03:18:55 +00:00
|
|
|
if ((head != self) && (head.health > 0) && ((head.flags & (FL_CLIENT|FL_MONSTER)) || (head.classname == "bot")) && (head.classname!=self.classname))
|
|
|
|
detonate = 1;
|
2002-02-22 20:01:05 +00:00
|
|
|
traceline(self.origin, head.origin, TRUE, self);
|
2002-02-17 03:18:55 +00:00
|
|
|
if (trace_fraction != 1.0)
|
|
|
|
detonate = 0;
|
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
if (detonate==1) {
|
|
|
|
sound (self, CHAN_BODY, "weapons/minedet.wav", 1, ATTN_NORM);
|
|
|
|
MineExplode();
|
|
|
|
self.nextthink = time + 0.25;
|
|
|
|
return;
|
|
|
|
}
|
2002-02-17 03:18:55 +00:00
|
|
|
head = head.chain;
|
|
|
|
}
|
2002-02-22 20:01:05 +00:00
|
|
|
|
2002-02-17 03:18:55 +00:00
|
|
|
self.nextthink = time + 0.1;
|
|
|
|
};
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
W_FireMine
|
|
|
|
================
|
|
|
|
*/
|
|
|
|
void() W_FireMine =
|
|
|
|
{
|
|
|
|
self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
|
2002-02-22 20:01:05 +00:00
|
|
|
sound (self, CHAN_AUTO, "weapons/gren.wav", 1, ATTN_NORM);
|
2002-02-17 03:18:55 +00:00
|
|
|
|
|
|
|
msg_entity = self;
|
|
|
|
WriteByte (MSG_ONE, SVC_SMALLKICK);
|
|
|
|
|
|
|
|
//Added weapon kickback (as long as you're not in mid air)
|
|
|
|
if (self.flags & FL_ONGROUND)
|
|
|
|
self.velocity = self.velocity + v_forward* -100;
|
|
|
|
|
|
|
|
newmis = spawn ();
|
|
|
|
newmis.voided = 0;
|
|
|
|
newmis.owner = self;
|
|
|
|
newmis.lastowner = self;
|
|
|
|
newmis.movetype = MOVETYPE_TOSS;
|
|
|
|
newmis.solid = SOLID_BBOX;
|
|
|
|
newmis.classname = "mine";
|
|
|
|
newmis.takedamage = DAMAGE_NO;
|
|
|
|
newmis.health = 1;
|
|
|
|
|
|
|
|
//POX v1.2 - mines don't bleed....
|
|
|
|
newmis.nobleed = TRUE;
|
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
// set missile speed
|
2002-02-17 03:18:55 +00:00
|
|
|
makevectors (self.v_angle);
|
2002-02-22 20:01:05 +00:00
|
|
|
if (self.v_angle_x) {
|
2002-02-17 03:18:55 +00:00
|
|
|
newmis.velocity = v_forward*600 + v_up * 200 + crandom()*v_right*10 + crandom()*v_up*10;
|
2002-02-22 20:01:05 +00:00
|
|
|
} else {
|
2002-02-17 03:18:55 +00:00
|
|
|
newmis.velocity = aim(self, 10000);
|
|
|
|
newmis.velocity = newmis.velocity * 600;
|
|
|
|
newmis.velocity_z = 200;
|
|
|
|
}
|
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
newmis.avelocity = '100 600 100';
|
|
|
|
newmis.angles = vectoangles(newmis.velocity);
|
|
|
|
newmis.touch = MineTouch;
|
2002-02-17 03:18:55 +00:00
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
// set missile duration
|
|
|
|
newmis.nextthink = time + 0.2;
|
|
|
|
newmis.delay = time + 60;
|
|
|
|
newmis.think = MineArm;
|
|
|
|
newmis.th_die = MineExplode;
|
2002-02-17 03:18:55 +00:00
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
setmodel (newmis, "progs/grenade.mdl");
|
|
|
|
setorigin (newmis, self.origin + v_forward*4);
|
|
|
|
setsize (newmis, '-1 -1 -1', '0 0 0');
|
2002-02-17 03:18:55 +00:00
|
|
|
};
|
|
|
|
// END MINE CODE
|
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
//=============================================================================
|
2002-02-17 03:18:55 +00:00
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
//
|
|
|
|
// Shrapnel Bomb - Nailgun Second Trigger (1 rocket + 30 nails, remotely detonated)
|
|
|
|
//
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
//----------------------------------------------------------
|
|
|
|
//These functions launch a single spike in a random direction
|
|
|
|
void() spikenal_touch =
|
|
|
|
{
|
2002-02-22 20:01:05 +00:00
|
|
|
if (pointcontents(self.origin) == CONTENT_SKY) {
|
|
|
|
remove(self);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-02-17 03:18:55 +00:00
|
|
|
if (self.voided) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
self.voided = 1;
|
2002-02-22 20:01:05 +00:00
|
|
|
|
2002-02-17 03:18:55 +00:00
|
|
|
if (other.solid == SOLID_TRIGGER)
|
|
|
|
return; // trigger field, do nothing
|
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
// hit something that bleeds
|
|
|
|
if (other.takedamage) {
|
2002-02-17 03:18:55 +00:00
|
|
|
spawn_touchblood (12);
|
|
|
|
other.deathtype = "shrapnel";
|
|
|
|
T_Damage (other, self, self.owner, 12);
|
|
|
|
remove(self);
|
|
|
|
}
|
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
else if (random() > 0.9) {
|
2002-02-17 03:18:55 +00:00
|
|
|
WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
|
|
|
|
WriteByte (MSG_MULTICAST, TE_SPIKE);
|
|
|
|
WriteCoord (MSG_MULTICAST, self.origin_x);
|
|
|
|
WriteCoord (MSG_MULTICAST, self.origin_y);
|
|
|
|
WriteCoord (MSG_MULTICAST, self.origin_z);
|
|
|
|
multicast (self.origin, MULTICAST_PHS);
|
|
|
|
remove(self);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//POX - Get a random vector for Shrapnel
|
|
|
|
vector() VelocityForShrapnel =
|
|
|
|
{
|
|
|
|
local vector v;
|
|
|
|
v_x = 200 * crandom();
|
|
|
|
v_y = 200 * crandom();
|
|
|
|
v_z = 200 * crandom();
|
|
|
|
|
|
|
|
if (random() > 0.5)
|
|
|
|
v_z = v_z - (v_z*2);
|
|
|
|
|
|
|
|
v = v * 6;
|
|
|
|
return v;
|
|
|
|
};
|
|
|
|
|
|
|
|
//POX - Shrapnel = fast, bouncy spikes with a short life
|
|
|
|
void(vector org) launch_shrapnel =
|
|
|
|
{
|
|
|
|
newmis = spawn ();
|
2002-02-22 20:01:05 +00:00
|
|
|
|
2002-02-17 03:18:55 +00:00
|
|
|
newmis.voided = 0;
|
|
|
|
newmis.owner = self.owner;
|
|
|
|
newmis.movetype = MOVETYPE_BOUNCE;
|
|
|
|
newmis.solid = SOLID_BBOX;
|
2002-02-22 20:01:05 +00:00
|
|
|
|
2002-02-17 03:18:55 +00:00
|
|
|
newmis.touch = spikenal_touch;
|
|
|
|
newmis.classname = "spikenal";
|
2002-02-22 20:01:05 +00:00
|
|
|
|
2002-02-17 03:18:55 +00:00
|
|
|
newmis.velocity = VelocityForShrapnel();
|
|
|
|
newmis.avelocity_x = random()*800;
|
|
|
|
newmis.avelocity_y = random()*800;
|
|
|
|
newmis.avelocity_z = random()*800;
|
2002-02-22 20:01:05 +00:00
|
|
|
|
2002-02-17 03:18:55 +00:00
|
|
|
newmis.think = SUB_Remove;
|
|
|
|
newmis.nextthink = time + 3;
|
2002-02-22 20:01:05 +00:00
|
|
|
|
2002-02-17 03:18:55 +00:00
|
|
|
setmodel (newmis, "progs/mwrub1.mdl");
|
|
|
|
setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);
|
|
|
|
setorigin (newmis, org);
|
|
|
|
};
|
|
|
|
//----------------------------------------------------------
|
|
|
|
//and now the bomb code...
|
|
|
|
void() ShrapnelExplode =
|
|
|
|
{
|
|
|
|
if (self.voided) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
self.voided = 1;
|
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
// Toss the nails (this function is with the spike stuff since it uses the same touch)
|
2002-02-17 03:18:55 +00:00
|
|
|
launch_shrapnel(self.origin);
|
|
|
|
launch_shrapnel(self.origin);
|
|
|
|
launch_shrapnel(self.origin);
|
|
|
|
launch_shrapnel(self.origin);
|
|
|
|
launch_shrapnel(self.origin);
|
|
|
|
T_RadiusDamage (self, self.owner, 160, world, "shrapnel");
|
|
|
|
|
|
|
|
if (self.owner != world)
|
2002-02-22 20:01:05 +00:00
|
|
|
self.owner.shrap_detonate = FALSE; // Enable next launch
|
2002-02-17 03:18:55 +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);
|
|
|
|
remove (self);
|
|
|
|
};
|
|
|
|
|
|
|
|
void() ShrapnelDetonate =
|
|
|
|
{
|
|
|
|
sound (self, CHAN_BODY, "weapons/minedet.wav", 1, ATTN_NORM);
|
|
|
|
self.think = ShrapnelExplode;
|
|
|
|
self.nextthink = time + 0.1;
|
|
|
|
};
|
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
// Wait for a detonation impulse or time up
|
2002-02-17 03:18:55 +00:00
|
|
|
void() ShrapnelThink =
|
|
|
|
{
|
|
|
|
if (self.shrap_time < time)
|
|
|
|
ShrapnelDetonate();
|
|
|
|
|
|
|
|
if (self.owner == world)
|
|
|
|
return;
|
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
// Owner died so change to world and wait for detonate
|
|
|
|
if (self.owner.health <= 0) {
|
2002-02-17 03:18:55 +00:00
|
|
|
self.owner.shrap_detonate = FALSE;//Enable next launch
|
|
|
|
self.owner = world;
|
|
|
|
self.nextthink = self.shrap_time;
|
|
|
|
self.think = ShrapnelDetonate;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (self.owner.shrap_detonate == 2)
|
|
|
|
ShrapnelDetonate();
|
|
|
|
else
|
|
|
|
self.nextthink = time + 0.1;
|
|
|
|
};
|
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
|
2002-02-17 03:18:55 +00:00
|
|
|
void() ShrapnelTouch =
|
|
|
|
{
|
2002-02-22 20:01:05 +00:00
|
|
|
local float r;
|
2002-02-17 03:18:55 +00:00
|
|
|
|
|
|
|
r = random();
|
|
|
|
|
|
|
|
if (other == self.owner)
|
|
|
|
return; // don't explode on owner
|
|
|
|
|
|
|
|
if (other.takedamage == DAMAGE_AIM)
|
|
|
|
{
|
|
|
|
ShrapnelDetonate();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//pick a bounce sound
|
|
|
|
if (r < 0.75)
|
|
|
|
sound (self, CHAN_VOICE, "weapons/bounce.wav", 1, ATTN_NORM);
|
|
|
|
else
|
|
|
|
sound (self, CHAN_VOICE, "weapons/bounce2.wav", 1, ATTN_NORM);
|
|
|
|
|
|
|
|
if (self.velocity == '0 0 0')
|
|
|
|
self.avelocity = '0 0 0';
|
|
|
|
};
|
|
|
|
// End shrapnel bomb
|
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
//=============================================================================
|
2002-02-17 03:18:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
W_FireShrapnel
|
|
|
|
================
|
|
|
|
*/
|
|
|
|
void() W_FireShrapnel =
|
|
|
|
{
|
|
|
|
self.ammo_rockets = self.ammo_rockets - 1;
|
|
|
|
self.currentammo = self.ammo_nails = self.ammo_nails - 30;
|
2002-02-22 20:01:05 +00:00
|
|
|
sound (self, CHAN_WEAPON, "weapons/gren2.wav", 1, ATTN_NORM);
|
2002-02-17 03:18:55 +00:00
|
|
|
|
|
|
|
msg_entity = self;
|
|
|
|
WriteByte (MSG_ONE, SVC_SMALLKICK);
|
|
|
|
|
|
|
|
//Added weapon kickback (as long as you're not in mid air)
|
|
|
|
if (self.flags & FL_ONGROUND)
|
|
|
|
self.velocity = self.velocity + v_forward* -115;
|
|
|
|
newmis = spawn ();
|
|
|
|
newmis.voided = 0;
|
|
|
|
newmis.owner = self;
|
|
|
|
newmis.movetype = MOVETYPE_BOUNCE;
|
|
|
|
newmis.solid = SOLID_BBOX;
|
|
|
|
newmis.classname = "shrapnel";
|
|
|
|
|
|
|
|
newmis.shrap_time = time + 120;
|
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
// set newmis speed
|
2002-02-17 03:18:55 +00:00
|
|
|
makevectors (self.v_angle);
|
2002-02-22 20:01:05 +00:00
|
|
|
if (self.v_angle_x) {
|
2002-02-17 03:18:55 +00:00
|
|
|
newmis.velocity = v_forward*600 + v_up * 200 + crandom()*v_right*10 + crandom()*v_up*10;
|
2002-02-22 20:01:05 +00:00
|
|
|
} else {
|
2002-02-17 03:18:55 +00:00
|
|
|
newmis.velocity = aim(self, 10000);
|
|
|
|
newmis.velocity = newmis.velocity * 600;
|
|
|
|
newmis.velocity_z = 200;
|
|
|
|
}
|
|
|
|
newmis.avelocity = '300 300 300';
|
|
|
|
newmis.angles = vectoangles(newmis.velocity);
|
|
|
|
newmis.touch = ShrapnelTouch;
|
2002-02-22 20:01:05 +00:00
|
|
|
|
|
|
|
// set newmis duration
|
2002-02-17 03:18:55 +00:00
|
|
|
newmis.nextthink = time + 0.1;
|
|
|
|
newmis.think = ShrapnelThink;
|
|
|
|
setmodel (newmis, "progs/grenade.mdl");
|
|
|
|
newmis.skin = 2;
|
|
|
|
setsize (newmis, '0 0 0', '0 0 0');
|
|
|
|
setorigin (newmis, self.origin);
|
|
|
|
};
|
|
|
|
/*
|
|
|
|
============
|
|
|
|
W_SecondTrigger
|
|
|
|
Second Trigger Impulses
|
|
|
|
POX v1.1 - seperated this from weapons.qc - cleaned it up a bit
|
|
|
|
============
|
|
|
|
*/
|
|
|
|
void() W_SecondTrigger =
|
|
|
|
{
|
2002-02-22 20:01:05 +00:00
|
|
|
// Don't fire during intermission
|
|
|
|
if (intermission_running)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// check for NailGun's second Trigger
|
|
|
|
if (self.weapon == IT_SUPER_NAILGUN) {
|
|
|
|
if (!self.shrap_detonate) { // Check if a bomb is already set
|
2002-02-17 03:18:55 +00:00
|
|
|
// check for nails and rockets
|
2002-02-22 20:01:05 +00:00
|
|
|
if ((self.ammo_nails < 30) || (self.ammo_rockets < 1)) {
|
2002-02-17 03:18:55 +00:00
|
|
|
sound (self, CHAN_AUTO, "weapons/mfire1.wav", 1, ATTN_NORM);
|
|
|
|
sprint (self, PRINT_HIGH, "Not enough ammo...\n");
|
2002-02-22 20:01:05 +00:00
|
|
|
|
|
|
|
} else if (self.st_shrapnel < time) {
|
|
|
|
|
2002-02-17 03:18:55 +00:00
|
|
|
self.weaponframe = 0;
|
|
|
|
SuperDamageSound();
|
|
|
|
self.st_shrapnel = time + 0.1; // Allow a fast detonate
|
|
|
|
player_shrap1();
|
|
|
|
W_FireShrapnel();
|
|
|
|
|
|
|
|
self.shrap_detonate = TRUE;
|
2002-02-22 20:01:05 +00:00
|
|
|
} else {
|
2002-02-17 03:18:55 +00:00
|
|
|
sound (self, CHAN_AUTO, "weapons/mfire1.wav", 1, ATTN_NORM);
|
2002-02-22 20:01:05 +00:00
|
|
|
}
|
|
|
|
} else {
|
2002-02-17 03:18:55 +00:00
|
|
|
sound (self, CHAN_WEAPON, "weapons/shrapdet.wav", 1, ATTN_NORM);
|
|
|
|
SuperDamageSound();
|
|
|
|
self.st_shrapnel = time + 0.7; // Time out before next launch
|
|
|
|
self.shrap_detonate = 2; //Tell the bomb to blow!
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
// check for t-shot prime
|
|
|
|
if (self.weapon == IT_TSHOT) {
|
|
|
|
if (self.prime_tshot == TRUE) { // already primed
|
2002-02-17 03:18:55 +00:00
|
|
|
|
2002-02-21 20:36:23 +00:00
|
|
|
SUB_Null ();
|
2002-02-22 20:01:05 +00:00
|
|
|
|
|
|
|
} else if (self.ammo_shells < 3) { // not enough ammo
|
|
|
|
|
2002-02-21 20:36:23 +00:00
|
|
|
SUB_Null ();
|
2002-02-22 20:01:05 +00:00
|
|
|
|
|
|
|
} else {
|
2002-02-17 03:18:55 +00:00
|
|
|
self.st_tshotload = time + 0.9; //give the reload a chance to happen
|
|
|
|
|
|
|
|
//make a reload sound!
|
|
|
|
sound (self, CHAN_WEAPON, "weapons/tsload.wav", 1, ATTN_NORM);
|
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
player_reshot1(); // play prime animation
|
2002-02-17 03:18:55 +00:00
|
|
|
|
|
|
|
self.prime_tshot = TRUE; //set the prime bit
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
// check for rhino reload
|
|
|
|
if (self.weapon == IT_ROCKET_LAUNCHER) {
|
|
|
|
if (self.reload_rocket == 0) { // already reloaded
|
|
|
|
|
2002-02-21 20:36:23 +00:00
|
|
|
SUB_Null ();
|
2002-02-17 03:18:55 +00:00
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
} else if (self.ammo_rockets < 1) { // if no rockets go away
|
|
|
|
|
2002-02-21 20:36:23 +00:00
|
|
|
SUB_Null ();
|
2002-02-22 20:01:05 +00:00
|
|
|
|
|
|
|
} else {
|
2002-02-17 03:18:55 +00:00
|
|
|
self.st_rocketload = time + 0.6; //give the reload a chance to happen
|
|
|
|
|
|
|
|
sound (self, CHAN_WEAPON, "weapons/rhinore.wav", 1, ATTN_NORM);
|
|
|
|
|
|
|
|
player_rocketload1(); //play reload animation
|
|
|
|
|
|
|
|
self.reload_rocket = 0; //reset reload bit
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
// check for Plasmagun second Trigger
|
|
|
|
if (self.weapon == IT_PLASMAGUN) {
|
|
|
|
|
|
|
|
if (self.ammo_cells < 9) { // check for cells
|
|
|
|
|
2002-02-17 03:18:55 +00:00
|
|
|
sound (self, CHAN_AUTO, "weapons/mfire2.wav", 1, ATTN_NORM);
|
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
} else {
|
|
|
|
if (self.st_mplasma < time) {
|
|
|
|
if (self.waterlevel > 1) { // explode under water
|
|
|
|
sound (self, CHAN_WEAPON, "weapons/mplasex.wav", 1, ATTN_NORM);
|
|
|
|
self.ammo_cells = 0;
|
|
|
|
W_SetCurrentAmmo ();
|
|
|
|
T_RadiusDamage (self, self, 250, world, "waterplasma");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
self.weaponframe = 0;
|
|
|
|
SuperDamageSound();
|
|
|
|
self.st_mplasma = time + 1.9;
|
|
|
|
player_mplasma1();
|
|
|
|
launch_megaplasma();
|
|
|
|
} else {
|
|
|
|
SUB_Null ();
|
|
|
|
}
|
2002-02-17 03:18:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
// check for Super Shotgun second Trigger
|
|
|
|
if (self.weapon == IT_COMBOGUN) {
|
2002-02-17 03:18:55 +00:00
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
if (self.ammo_rockets < 1) { // check for rockets
|
2004-02-08 06:18:03 +00:00
|
|
|
self.items &= ~IT_SHELLS;
|
|
|
|
self.items |= IT_ROCKETS;
|
2002-02-17 03:18:55 +00:00
|
|
|
self.currentammo = self.ammo_rockets;
|
|
|
|
self.which_ammo = 1;
|
|
|
|
sound (self, CHAN_WEAPON, "weapons/mfire1.wav", 1, ATTN_NORM);
|
2002-02-22 20:01:05 +00:00
|
|
|
} else {
|
|
|
|
if (self.st_pball < time) {
|
2004-02-08 06:18:03 +00:00
|
|
|
self.items &= ~IT_SHELLS;
|
|
|
|
self.items |= IT_ROCKETS;
|
2002-02-22 20:01:05 +00:00
|
|
|
self.currentammo = self.ammo_rockets;
|
|
|
|
self.which_ammo = 1;
|
|
|
|
player_gshot1();
|
|
|
|
SuperDamageSound();
|
|
|
|
W_FirePball();
|
|
|
|
self.st_pball = time + 0.9;
|
|
|
|
} else {
|
|
|
|
sound (self, CHAN_WEAPON, "weapons/mfire1.wav", 1, ATTN_NORM);
|
|
|
|
}
|
2002-02-17 03:18:55 +00:00
|
|
|
}
|
|
|
|
}
|
2002-02-22 20:01:05 +00:00
|
|
|
|
|
|
|
// check for GrenadeLauncher second Trigger
|
|
|
|
if (self.weapon == IT_GRENADE_LAUNCHER) {
|
|
|
|
|
|
|
|
if (self.ammo_rockets < 1) { // check for rockets
|
2002-02-17 03:18:55 +00:00
|
|
|
sound (self, CHAN_WEAPON, "weapons/mfire1.wav", 1, ATTN_NORM);
|
2002-02-22 20:01:05 +00:00
|
|
|
} else {
|
|
|
|
if (self.st_mine < time) {
|
|
|
|
player_grenade1();
|
|
|
|
W_FireMine();
|
2002-02-17 03:18:55 +00:00
|
|
|
|
2002-02-22 20:01:05 +00:00
|
|
|
// big delay between refires helps keep the # of mines down in a deathmatch game
|
|
|
|
self.st_mine = time + 1.25;
|
|
|
|
} else {
|
|
|
|
sound (self, CHAN_WEAPON, "weapons/mfire1.wav", 1, ATTN_NORM);
|
|
|
|
}
|
2002-02-17 03:18:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
self.impulse = 0;
|
|
|
|
};
|