Finally, new concussion grenade done!

This commit is contained in:
Finny Merrill 2004-01-21 16:05:58 +00:00
parent 75d68b9b6d
commit 763804fbf2
9 changed files with 159 additions and 52 deletions

View file

@ -1834,6 +1834,7 @@ void() PutClientInServer =
self.show_hostile = 0;
self.is_malfunctioning = 0;
self.is_abouttodie = 0;
self.mangle = '0 0 0';
// OfN
self.has_holo = 0;
@ -2700,6 +2701,8 @@ void() PlayerPreThink =
return;
}
self.v_angle += self.mangle;
if (self.undercover_team || self.undercover_skin || self.is_undercover)
{
if (self.effects & EF_ANYGLOW)
@ -3075,6 +3078,8 @@ void() PlayerPostThink =
return;
}
self.v_angle += self.mangle;
// check to see if player landed and play landing sound
if (self.takedamage && self.health > 0)
{

View file

@ -320,6 +320,14 @@ void(entity targ, entity inflictor, entity attacker, float damage, float T_flags
}
#endif
if (inflictor.martyr_enemy && (Teammate(attacker.team_no, targ.team_no) || Teammate(attacker.team_no,targ.real_owner.team_no)))
{
if (!Teammate(inflictor.martyr_enemy.team_no, targ.real_owner.team_no) && !Teammate(inflictor.martyr_enemy.team_no, targ.team_no))
{
attacker = inflictor.martyr_enemy;
}
}
//Don't blame people for their airfisted rockets/grenades/detpacks if they hit a teammate
if ((inflictor.AIRG_Flags & 4) && inflictor != attacker && inflictor.AIRG_FlyTracker.classname == "player")
{

View file

@ -346,6 +346,7 @@ void() DropFromCustomClassGen =
setorigin (self, spot.origin + '0 0 1');
self.angles = spot.angles;
self.fixangle = TRUE; // turn this way immediately
self.mangle = '0 0 0';
makevectors(self.angles);
spawn_tfog (self.origin + v_forward*20);

View file

@ -527,6 +527,7 @@ void(float to, float f) WriteAngle = #57;
void(float to, string s) WriteString = #58;
void(float to, entity s) WriteEntity = #59;
void(float to, vector a) WriteAngleV = #0;
void(float step) movetogoal = #67;
@ -595,6 +596,7 @@ string (integer i) Cmd_Args = #0;
integer (string cmd, void() func) Cmd_AddCommand = #0;
integer (string cmd, void() func, integer noredir) SV_AddUserCommand = #0;
//============================================================================
//

18
defs.qh
View file

@ -120,7 +120,7 @@
// protocol bytes
#define SVC_SETVIEWPORT 5
#define SVC_SETANGLES 10
#define SVC_SETANGLE 10
#define SVC_TEMPENTITY 23
#define SVC_KILLEDMONSTER 27
#define SVC_FOUNDSECRET 28
@ -824,8 +824,20 @@ float (entity e) EF_GlowColor;
#define GL_PIPEBOMB 1
// Defines for Concussion Grenade
#define GR_CONCUSS_TIME 5
#define GR_CONCUSS_DEC 20
#define GR_CONCUSS_AMOUNT 75
#define GR_CONCUSS_TIME 0.2
#define GR_CONCUSS_DEC 0.5
#define GR_CONCUSS_MAX 100
#define GR_CONCUSS_IDLE 1
#define GR_CONCUSS_X 0.2
#define GR_CONCUSS_Y 0.3
#define GR_CONCUSS_KICK 0.02
#define GR_CONCUSS_FIXTIME 0.2
//#define GR_CONCUSS_BUBBLETIME 3
#define GR_ANTIGRAV_AMOUNT 100
#define GR_ANTIGRAV_TIME 3
#define GR_ANTIGRAV_DEC 30
// Defines for the Gas Grenade
#define GR_HALLU_TIME 0.1

22
jobs.qc
View file

@ -452,7 +452,7 @@ void() BerserkerKillTimer =
void() JobBerserker =
{
if (self.super_damage_finished > 0)
if (self.super_damage_finished > 0 || self.tfstate & TFSTATE_CONCUSSIONED)
return;
newmis = spawn();
@ -460,7 +460,7 @@ void() JobBerserker =
newmis.nextthink = time + BERSERK_TIME + 1;
newmis.think = BerserkerKillTimer;
newmis.owner = self;
if (self.health > BERSERKER_HP_COST)
self.health -= BERSERKER_HP_COST;
else
@ -758,11 +758,11 @@ void() GuerillaExplode =
sprint(self.owner,PRINT_HIGH,"your mine explodes\n");
// if has_tesla is 1 print nothing, as this is set by DetonateMines() and GuerillaThink
if (time < self.heat + ACTIVATE_TIME) //If not charged, do less damage when blowing up
T_RadiusDamage (self, self.martyr_enemy, MINE_DMG * 0.5, NIL); //- damage was 80
T_RadiusDamage (self, self.owner, MINE_DMG * 0.5, NIL); //- damage was 80
else
T_RadiusDamage (self, self.martyr_enemy, MINE_DMG, NIL); //- damage was 160
T_RadiusDamage (self, self.owner, MINE_DMG, NIL); //- damage was 160
// num_mines is the number of mines the player has
self.owner.num_mines = self.owner.num_mines - 1;
@ -810,14 +810,6 @@ void(vector startpos) GuerillaMineSweep =
local float loopc = 0;
head = findradius(startpos, 30);
while (loopc < 5 && inf.classname != "player")
{
inf = inf.real_owner;
loopc++;
if (loopc >= 5)
inf = NIL;
}
while (head)
{
if (head.classname == "grenade" && head.netname == "land_mine") {
@ -848,6 +840,7 @@ void() GuerillaThink = //Every second see if we have enemy nearby
if (self.health <= 0) { //Detonate mine cause we ran out of time
self.martyr_enemy = self.owner;
self.heat = time; //Make it a smaller explosion
sprint(self.owner,PRINT_HIGH,"Mine runs out of energy, ");
@ -878,10 +871,11 @@ void() GuerillaThink = //Every second see if we have enemy nearby
sprint(self.owner,PRINT_HIGH,head.netname);
sprint(self.owner,PRINT_HIGH,"'s face!\n");
self.has_tesla = 1; //- display no message on GuerillaExplode
self.martyr_enemy = head;
GuerillaExplode();
return;
} else if (head == self.owner) { // ourselves
self.martyr_enemy = self.owner;
self.has_tesla = 1; //- display no message on GuerillaExplode
GuerillaExplode();
return;

View file

@ -741,7 +741,7 @@ void (entity targ, entity attacker) Obituary_Player_by_Player =
else if (deathmsg == DMSG_GREN_EMP)
deathstring = " explodes his ammo and body\n";
else if (deathmsg == DMSG_GREN_EMP_RADIUS)
deathstring = " blows himself up with another player's ammo\n";
deathstring = " blows himself up with someone else's ammo\n";
else if (deathmsg == DMSG_GREN_FLASH)
deathstring = " is charred by his own flash grenade\n";
else if (deathmsg == DMSG_GREN_EMP_AMMO)

View file

@ -600,8 +600,8 @@ void(entity inflictor, entity attacker, float bounce, entity ignore) T_RadiusAnt
if (te)
{
head.gravity = 0.3 * random();
te.health = 100;
te.nextthink = time + GR_CONCUSS_TIME;
te.health += GR_ANTIGRAV_AMOUNT;
te.nextthink = time + GR_ANTIGRAV_TIME;
}
else
{
@ -614,7 +614,7 @@ void(entity inflictor, entity attacker, float bounce, entity ignore) T_RadiusAnt
te.team_no = attacker.team_no;
te.classname = "timer";
te.owner = head;
te.health = 100;
te.health = GR_ANTIGRAV_AMOUNT;
}
}
}
@ -635,15 +635,15 @@ void() AntiGravGrenadeTimer =
return;
}
self.health = self.health - GR_CONCUSS_DEC * 2;
self.health = self.health - GR_ANTIGRAV_DEC * 2;
// hwguy recovers twice as fast - heh heh
if (self.owner.cutf_items & CUTF_HWGUY)
self.health = self.health - GR_CONCUSS_DEC * 2;
self.health = self.health - GR_ANTIGRAV_DEC * 2;
if (self.health < 0)
self.health = 0;
self.nextthink = time + GR_CONCUSS_TIME;
self.nextthink = time + GR_ANTIGRAV_TIME;
if (self.health == 0)
{

141
scout.qc
View file

@ -162,29 +162,37 @@ void() ConcussionGrenadeExplode =
// Concussion grenade timer to remove idlescale
void() ConcussionGrenadeTimer =
{
local string st;
if (self.owner.invincible_finished > time)
{
sprint(self.owner, PRINT_HIGH, "The power heals your concussion\n");
stuffcmd(self.owner, "v_idlescale 0\n");
self.owner.mangle = '0 0 0';
self.owner.tfstate &= ~TFSTATE_CONCUSSIONED;
dremove(self);
return;
}
// Bubble
newmis = spawn();
setmodel (newmis, "progs/s_bubble.spr");
setorigin (newmis, self.owner.origin);
newmis.movetype = MOVETYPE_NOCLIP;
newmis.solid = SOLID_NOT;
newmis.velocity = '0 0 15';
newmis.nextthink = time + 0.5;
newmis.think = bubble_bob;
newmis.touch = bubble_remove;
newmis.classname = "bubble";
newmis.frame = 0;
newmis.cnt = 0;
setsize(newmis, '-8 -8 -8', '8 8 8');
#ifdef GR_CONCUSS_BUBBLETIME
if (self.has_tesla < time)
{
newmis = spawn();
setmodel (newmis, "progs/s_bubble.spr");
setorigin (newmis, self.owner.origin);
newmis.movetype = MOVETYPE_NOCLIP;
newmis.solid = SOLID_NOT;
newmis.velocity = '0 0 15';
newmis.nextthink = time + 0.5;
newmis.think = bubble_bob;
newmis.touch = bubble_remove;
newmis.classname = "bubble";
newmis.frame = 0;
newmis.cnt = 0;
setsize(newmis, '-8 -8 -8', '8 8 8');
self.has_tesla += GR_CONCUSS_BUBBLETIME;
}
#endif
self.health = self.health - GR_CONCUSS_DEC;
@ -198,15 +206,84 @@ void() ConcussionGrenadeTimer =
if (self.health < 0)
self.health = 0;
self.nextthink = time + GR_CONCUSS_TIME;
st = ftos(self.health);
stuffcmd(self.owner, "v_idlescale ");
stuffcmd(self.owner, st);
stuffcmd(self.owner, "\n");
if (self.health == 0)
{
sprint (self.owner, PRINT_HIGH, "Your head feels normal again\n");
stuffcmd (self.owner, "v_idlescale 0\n");
self.owner.mangle = '0 0 0';
self.owner.tfstate &= ~TFSTATE_CONCUSSIONED;
dremove(self);
return;
}
self.nextthink = time + GR_CONCUSS_TIME;
#ifdef OLD_CONC_GRENADE
stuffcmd(self.owner, "v_idlescale " + ftos (self.health * GR_CONCUSS_IDLE) + "\n");
#else
if (self.has_camera < time)
{
self.owner.mangle = '0 0 0';
msg_entity = self.owner;
WriteByte (MSG_ONE, SVC_SETANGLE);
WriteAngleV (MSG_ONE, self.owner.v_angle);
self.has_camera = time + GR_CONCUSS_FIXTIME;
}
local float r = random();
local float amount = self.health;
if (amount > GR_CONCUSS_MAX)
amount = GR_CONCUSS_MAX;
amount *= (0.8 + random() * 0.2);
local float x = random() * amount;
local float y = amount - x;
if (random() < 0.5)
self.owner.mangle_x += x * GR_CONCUSS_X;
else
self.owner.mangle_x -= x * GR_CONCUSS_X;
if (random() < 0.5)
self.owner.mangle_y += y * GR_CONCUSS_Y;
else
self.owner.mangle_y -= y * GR_CONCUSS_Y;
if (self.owner.mangle_x < -60)
self.owner.mangle_x = -60;
if (self.owner.mangle_x > 60)
self.owner.mangle_x = 60;
if (self.owner.mangle_y > 120)
self.owner.mangle_y = 120;
if (self.owner.mangle_y < -120)
self.owner.mangle_y = -120;
if (self.owner.waterlevel || (self.owner.flags & FL_ONGROUND))
{
local float vel = vlen (self.owner.velocity);
if (random() < 0.5)
self.owner.velocity_x += x * GR_CONCUSS_KICK * vel;
else
self.owner.velocity_x -= x * GR_CONCUSS_KICK * vel;
if (random() < 0.5)
self.owner.velocity_y += y * GR_CONCUSS_KICK * vel;
else
self.owner.velocity_y += y * GR_CONCUSS_KICK * vel;
}
//sprint (self.owner, PRINT_HIGH, "mangle: " + vtos (self.owner.mangle) + "\n");
#endif
};
//=========================================================================
@ -615,8 +692,7 @@ void(entity inflictor, entity attacker, float bounce, entity ignore) T_RadiusBou
if (!IsBuilding(head) && points > 0)
{
// Bounce!!
head.velocity = org - inflictor.origin;
head.velocity = head.velocity * (points / 20);
head.velocity += normalize (org - inflictor.origin) * points * 8;
if (head.classname != "player")
{
@ -631,18 +707,27 @@ void(entity inflictor, entity attacker, float bounce, entity ignore) T_RadiusBou
// Concuss 'em!!
// If they are already concussed, set the concussion back up
// Try to find a concusstimer entity for this player
head.tfstate |= TFSTATE_CONCUSSIONED;
te = find(NIL, classname, "timer");
while (((te.owner != head) || (te.think != ConcussionGrenadeTimer)) && (te))
te = find(te, classname, "timer");
if (te)
{
stuffcmd(head,"v_idlescale 100\n");
te.health = 100;
te.health += GR_CONCUSS_AMOUNT;
#ifdef OLD_CONC_GRENADE
stuffcmd(head, "v_idlescale " + ftos (te.health) + "\n");
#endif
te.nextthink = time + GR_CONCUSS_TIME;
}
else
{
stuffcmd(head,"v_idlescale 100\n");
#ifdef OLD_CONC_GRENADE
stuffcmd(head,"v_idlescale " + ftos (GR_CONCUSS_AMOUNT) + "\n");
#else
stuffcmd(head,"v_idlescale 10\n");
#endif
stuffcmd(head,"bf\n");
// Create a timer entity
te = spawn();
@ -651,7 +736,7 @@ void(entity inflictor, entity attacker, float bounce, entity ignore) T_RadiusBou
te.team_no = attacker.team_no;
te.classname = "timer";
te.owner = head;
te.health = 100;
te.health += GR_CONCUSS_AMOUNT;
}
}
}