2001-07-23 20:52:47 +00:00
|
|
|
|
#include "defs.qh"
|
|
|
|
|
#include "menu.qh"
|
|
|
|
|
#include "skins.qh"
|
2001-07-17 05:58:10 +00:00
|
|
|
|
/*======================================================
|
|
|
|
|
TFORT.QC Custom TeamFortress v3.2
|
|
|
|
|
|
|
|
|
|
(c) TeamFortress Software Pty Ltd 29/2/97
|
|
|
|
|
(c) William Kerney 9/16/00
|
|
|
|
|
(c) Craig Hauser 19/3/00
|
|
|
|
|
========================================================
|
|
|
|
|
Class handling and other utility functions
|
|
|
|
|
======================================================*/
|
|
|
|
|
// Function Prototypes
|
|
|
|
|
//void() RemoveFlare;
|
|
|
|
|
void() GrenadeExplode;
|
|
|
|
|
void() spike_touch;
|
|
|
|
|
void(entity p) bound_other_ammo;
|
|
|
|
|
void(entity Goal, entity Player, entity Item) DisplayItemStatus;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
void(entity targ, entity inflictor, entity attacker, float damage,
|
|
|
|
|
float T_flags, float T_AttackType) TF_T_Damage;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
// Map Function Prototypes
|
|
|
|
|
void(entity Item, entity AP, float method) tfgoalitem_RemoveFromPlayer;
|
|
|
|
|
|
|
|
|
|
// Help Functions
|
|
|
|
|
void() TeamFortress_MOTD;
|
|
|
|
|
|
|
|
|
|
// Team Functions
|
2001-07-24 16:03:08 +00:00
|
|
|
|
float(float tno) TeamGetColor;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
void(float tno) TeamFortress_TeamSetColor;
|
|
|
|
|
float() TeamFortress_TeamPutPlayerInTeam;
|
|
|
|
|
float(float tno) TeamFortress_TeamGetScore;
|
|
|
|
|
float(float tno) TeamFortress_TeamGetIllegalClasses;
|
|
|
|
|
|
|
|
|
|
//WK
|
|
|
|
|
void() DropToCustomClassGen; //In custom.qc
|
|
|
|
|
float() W_BestWeapon; //In weapons.qc
|
|
|
|
|
void() FragGrenadeTouch; //In custom.qc
|
|
|
|
|
void() FragGrenadeExplode;
|
|
|
|
|
void() KracGrenadeTouch;
|
|
|
|
|
void() KracGrenadeExplode;
|
|
|
|
|
void() AntiGravGrenadeExplode;
|
|
|
|
|
void() Autoitem_think;
|
|
|
|
|
void() DetonateAllGuns;
|
|
|
|
|
|
|
|
|
|
// Impulse Functions
|
|
|
|
|
void() TeamFortress_ChangeClass;
|
|
|
|
|
void() TeamFortress_DisplayLegalClasses;
|
|
|
|
|
void() TeamFortress_Inventory;
|
|
|
|
|
void() Grunty_StateInv;
|
|
|
|
|
void() TeamFortress_ShowTF;
|
|
|
|
|
void() TeamFortress_PrimeGrenade;
|
|
|
|
|
void() TeamFortress_ThrowGrenade;
|
|
|
|
|
void() TeamFortress_DisplayDetectionItems;
|
|
|
|
|
|
|
|
|
|
// Player Class Handling Functions
|
|
|
|
|
float(float pc) IsLegalClass;
|
|
|
|
|
//void() TeamFortress_SetAlias; //WK
|
|
|
|
|
void() TeamFortress_SetHealth;
|
|
|
|
|
void() TeamFortress_SetEquipment;
|
|
|
|
|
void(entity p) TeamFortress_SetSpeed;
|
|
|
|
|
void(entity p) TeamFortress_SetSkin;
|
|
|
|
|
void(entity Viewer, float pc, float rpc) TeamFortress_PrintClassName;
|
|
|
|
|
void() TeamFortress_RemoveTimers;
|
|
|
|
|
void(float Suicided) TeamFortress_SetupRespawn;
|
|
|
|
|
void() TeamFortress_CheckClassStats;
|
|
|
|
|
float(entity Retriever, float AmmoType) TeamFortress_GetMaxAmmo;
|
|
|
|
|
float(entity Retriever, float WeaponType) TeamFortress_CanGetWeapon;
|
|
|
|
|
float(entity Retriever, entity Items) TeamFortress_AddBackpackItems;
|
|
|
|
|
float(entity Player, float Armorclass) TeamFortress_DescribeArmor;
|
|
|
|
|
#ifdef SPEECH
|
|
|
|
|
void(entity player) TeamFortress_SayClassName;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// AmmoBox Handling Functions
|
|
|
|
|
void () TeamFortress_AmmoboxTouch;
|
|
|
|
|
float (float tno) num_team_ammoboxes;
|
|
|
|
|
void(float tno) RemoveOldAmmobox;
|
|
|
|
|
void(float tno) increment_team_ammoboxes;
|
|
|
|
|
void(float tno) decrement_team_ammoboxes;
|
|
|
|
|
|
|
|
|
|
// Weapon Handling Functions
|
|
|
|
|
void() TeamFortress_ExplodePerson;
|
|
|
|
|
void() NormalGrenadeTouch;
|
|
|
|
|
void() NormalGrenadeExplode;
|
|
|
|
|
void() PlayerObserverMode;
|
|
|
|
|
|
|
|
|
|
// Utility Functions
|
|
|
|
|
void(string halias, float himpulse1, float himpulse2) TeamFortress_Alias;
|
|
|
|
|
|
|
|
|
|
// Cyclic Event Functions
|
|
|
|
|
void() TeamFortress_Regenerate;
|
|
|
|
|
void() TeamFortress_RegenerateCyber;
|
|
|
|
|
void() TeamFortress_RegenerateCells;
|
|
|
|
|
|
|
|
|
|
//CH
|
|
|
|
|
float(entity p) Return_Custom_Skins;
|
|
|
|
|
|
|
|
|
|
//- OfN
|
|
|
|
|
void() FlareGrenadeTouch;
|
|
|
|
|
void() FlareGrenadeExplode;
|
|
|
|
|
void() FlareBounce;
|
|
|
|
|
void(entity sld) grunty_boundammo;
|
|
|
|
|
void(entity player) UpdateCells;
|
|
|
|
|
void () BioGrenadeTouch;
|
|
|
|
|
void () BioGrenadeExplode;
|
|
|
|
|
float(entity theplayer, float grenslot) GetMaxGrens;
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// IMPULSE FUNCTIONS
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Uses a class dependant special skill
|
|
|
|
|
void() UseSpecialSkill =
|
|
|
|
|
{
|
|
|
|
|
self.impulse = 0;
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.cutf_items & CUTF_SENTRYGUN
|
|
|
|
|
|| self.tf_items & NIT_TESLA
|
|
|
|
|
|| self.tf_items & NIT_SECURITY_CAMERA
|
|
|
|
|
|| self.tf_items & NIT_TELEPORTER
|
|
|
|
|
|| self.cutf_items & CUTF_DISPENSER
|
|
|
|
|
|| self.cutf_items & CUTF_FIELDGEN)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.impulse = TF_ENGINEER_BUILD;
|
|
|
|
|
else if (self.cutf_items & CUTF_SPY_KIT)
|
|
|
|
|
self.impulse = TF_SPY_SPY;
|
|
|
|
|
else if (self.weapons_carried & WEAP_GRENADE_LAUNCHER)
|
|
|
|
|
self.impulse = TF_PB_DETONATE;
|
|
|
|
|
else if (self.tf_items & NIT_SCANNER)
|
|
|
|
|
self.impulse = TF_SCAN_30;
|
|
|
|
|
else if (self.weapons_carried & WEAP_SNIPER_RIFLE)
|
|
|
|
|
self.impulse = TF_AUTOZOOM;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
else
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.impulse = TF_RELOAD;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
//WK Since most people don't know "disguise" or "build"
|
|
|
|
|
// we'll allow them to toggle between the two with special.
|
|
|
|
|
// This wipes out .money, so watch out for side effects.
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (!(self.done_custom & CUSTOM_BUILDING) && (self.impulse == TF_ENGINEER_BUILD) && (self.cutf_items & CUTF_SPY_KIT)) {
|
|
|
|
|
if (self.money)
|
|
|
|
|
self.money = 0;
|
|
|
|
|
else
|
|
|
|
|
self.money = 1;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
if (self.money)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.impulse = TF_ENGINEER_BUILD;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
else {
|
2003-12-03 02:43:02 +00:00
|
|
|
|
if (self.effects & EF_ANYGLOW) //CH why not have the check here too, saves a keypress
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.impulse = TF_ENGINEER_BUILD;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
else
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.impulse = TF_SPY_SPY;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Player change class function
|
|
|
|
|
// If self.impulse == 1, change to Civilian class
|
|
|
|
|
void() TeamFortress_ChangeClass =
|
|
|
|
|
{
|
|
|
|
|
//WK - Handle Custom Class Restarting
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.playerclass == PC_CUSTOM
|
|
|
|
|
&& (self.done_custom & CUSTOM_BUILDING)) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
DropToCustomClassGen(); //Comatose state
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.playerclass != PC_UNDEFINED) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
// In Deathmatch 3, you can change class after you die
|
|
|
|
|
if (deathmatch != 3)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Civilian Teams can never change class
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (TeamFortress_TeamIsCivilian(self.team_no)) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, "You're a civilian. Learn to live with it.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (!IsLegalClass(self.impulse - TF_CHANGEPC)) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, "Your team cannot play that class.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
TeamFortress_DisplayLegalClasses();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.nextpc = self.impulse - TF_CHANGEPC;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
//WK - Handle Custom Class
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.nextpc == PC_CUSTOM) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.done_custom = self.done_custom | CUSTOM_ON_SPAWN; //Generate a new custom class when we respawn
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, "After dying, you will return as a new class\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// players must join a team, if teamplay is on
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (teamplay && self.team_no == 0) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, "You must join a team first. \n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Only change if you've got any lives left
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.lives == 0) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, "You have no lives left.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (!IsLegalClass(self.impulse - TF_CHANGEPC) && (self.impulse != 1)) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, "You cannot play that playerclass on this map. \n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
TeamFortress_DisplayLegalClasses();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Spy may be disabled
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if ((spy_off == TRUE) && ((self.impulse - TF_CHANGEPC) == PC_SPY)) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, "The spy class has been disabled on the server by the administrator.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (self.impulse != 1)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.playerclass = self.impulse - TF_CHANGEPC;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
else
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.playerclass = PC_CIVILIAN;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
self.nextpc = 0;
|
|
|
|
|
|
2003-11-29 14:26:56 +00:00
|
|
|
|
#if 1
|
|
|
|
|
// Duplicated code again!
|
|
|
|
|
if (coop)
|
|
|
|
|
setspawnparms(self);
|
|
|
|
|
else
|
|
|
|
|
SetNewParms();
|
|
|
|
|
|
|
|
|
|
PutClientInServer();
|
|
|
|
|
TeamFortress_SetSpeed(self);
|
|
|
|
|
|
|
|
|
|
ResetMenu();
|
|
|
|
|
self.impulse = 0;
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
local entity spot, te;
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
// Turn off PC_UNDEFINED's nomove and invincibility
|
|
|
|
|
self.takedamage = DAMAGE_AIM;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
//WK Prevent bad movetype errors, or something
|
|
|
|
|
if (self.classname != "player") {
|
|
|
|
|
RPrint("BUG BUG BUG BUG BUG BUG BUG BUG BUG\n");
|
|
|
|
|
RPrint("Non-player was in tfort.qc::changeclass()!\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.movetype = MOVETYPE_WALK;
|
|
|
|
|
self.flags = FL_CLIENT | FL_ONGROUND;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.waterlevel = 0;
|
|
|
|
|
self.air_finished = time + 12;
|
|
|
|
|
|
|
|
|
|
// give them a model, and a new spawn point
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.solid = SOLID_SLIDEBOX;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
// pausetime is set by teleporters to keep the player from moving a while
|
|
|
|
|
self.pausetime = 0;
|
|
|
|
|
|
|
|
|
|
spot = SelectSpawnPoint ();
|
|
|
|
|
|
|
|
|
|
#ifdef MAP_DEBUG
|
|
|
|
|
RPrint(self.netname);
|
|
|
|
|
RPrint(" spawned at a ");
|
|
|
|
|
RPrint(spot.netname);
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (spot.team_no != 0) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
RPrint(", team_no of ");
|
|
|
|
|
st = ftos(spot.team_no);
|
|
|
|
|
RPrint(st);
|
|
|
|
|
}
|
|
|
|
|
RPrint("\n");
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
self.origin = spot.origin + '0 0 1';
|
|
|
|
|
self.angles = spot.angles;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.fixangle = TRUE; // turn this way immediately
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-09-30 22:38:44 +00:00
|
|
|
|
setmodel (self, "");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
modelindex_null = self.modelindex;
|
|
|
|
|
|
|
|
|
|
setmodel (self, "progs/eyes.mdl");
|
|
|
|
|
modelindex_eyes = self.modelindex;
|
|
|
|
|
|
|
|
|
|
setmodel (self, "progs/player.mdl");
|
|
|
|
|
modelindex_player = self.modelindex;
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
self.view_ofs = '0 0 22';
|
|
|
|
|
player_stand1 ();
|
2002-09-08 01:44:11 +00:00
|
|
|
|
/*
|
|
|
|
|
if (deathmatch || coop) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
makevectors(self.angles);
|
|
|
|
|
spawn_tfog (self.origin + v_forward*20);
|
2002-09-08 01:44:11 +00:00
|
|
|
|
}
|
|
|
|
|
*/
|
2001-10-08 11:14:13 +00:00
|
|
|
|
makevectors (self.angles);
|
|
|
|
|
spawn_tfog (self.origin + v_forward * 20);
|
|
|
|
|
spawn_tdeath (self.origin, self);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
// Display chosen class
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if ( self.playerclass == PC_RANDOM ) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, "Random Playerclass.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.tfstate = (self.tfstate | TFSTATE_RANDOMPC);
|
|
|
|
|
self.playerclass = 1 + floor(random() * (PC_RANDOM - 1));
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If this is a TeamSpawnpoint, check to see if it
|
|
|
|
|
// gives out a GoalItem, or displays a message
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (spot.classname == "info_player_teamspawn") {
|
|
|
|
|
if (spot.items != 0) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
te = Finditem(spot.items);
|
|
|
|
|
if (te)
|
|
|
|
|
tfgoalitem_GiveToPlayer(te, self, self);
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (!(spot.goal_activation & TFSP_MULTIPLEITEMS))
|
2001-07-17 05:58:10 +00:00
|
|
|
|
spot.items = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (spot.message) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
CenterPrint(self, spot.message);
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (!(spot.goal_activation & TFSP_MULTIPLEMSGS))
|
2001-09-30 22:38:44 +00:00
|
|
|
|
spot.message = "";
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TeamSpawn points can remove themselves after being spawned on
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (spot.goal_effects == TFSP_REMOVESELF) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
spot.classname = "deadpoint";
|
2001-09-30 22:38:44 +00:00
|
|
|
|
spot.team_str_home = "";
|
2001-07-17 05:58:10 +00:00
|
|
|
|
spot.nextthink = time + 1;
|
|
|
|
|
spot.think = SUB_Remove;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//WK - Handle Custom Class
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.playerclass == PC_CUSTOM)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
DropToCustomClassGen(); //Comatose state
|
|
|
|
|
|
|
|
|
|
ResetMenu();
|
2001-07-23 20:52:47 +00:00
|
|
|
|
TeamFortress_PrintClassName(self,self.playerclass, (self.tfstate & TFSTATE_RANDOMPC));
|
2001-07-17 05:58:10 +00:00
|
|
|
|
#ifdef SPEECH
|
|
|
|
|
TeamFortress_SayClassName(self);
|
|
|
|
|
#endif
|
|
|
|
|
TeamFortress_SetEquipment();
|
|
|
|
|
TeamFortress_SetHealth();
|
|
|
|
|
TeamFortress_SetSpeed(self);
|
|
|
|
|
TeamFortress_SetSkin(self);
|
|
|
|
|
//WK Give them invincibility if they are a normal class or bought it
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.playerclass >= PC_SCOUT && self.playerclass <= PC_RANDOM) {
|
2001-08-10 10:03:36 +00:00
|
|
|
|
self.items = self.items & IT_INVULNERABILITY;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.invincible_time = 1;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.invincible_finished = time + RESPAWN_GUARD_TIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
2003-11-29 14:26:56 +00:00
|
|
|
|
#endif
|
2001-07-17 05:58:10 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Display a list of all the legal classes for this map
|
|
|
|
|
void() TeamFortress_DisplayLegalClasses =
|
|
|
|
|
{
|
|
|
|
|
local float gotone, ill;
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, "Legal Classes for your team are:\n");
|
|
|
|
|
gotone = FALSE;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
ill = TeamFortress_TeamGetIllegalClasses(self.team_no);
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (!(illegalclasses & TF_ILL_SCOUT) && !(ill & TF_ILL_SCOUT)) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (gotone)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, ", ");
|
|
|
|
|
gotone = TRUE;
|
|
|
|
|
sprint(self, PRINT_HIGH, "Scout");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (!(illegalclasses & TF_ILL_SNIPER) && !(ill & TF_ILL_SNIPER)) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (gotone)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, ", ");
|
|
|
|
|
gotone = TRUE;
|
|
|
|
|
sprint(self, PRINT_HIGH, "Sniper");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (!(illegalclasses & TF_ILL_SOLDIER) && !(ill & TF_ILL_SOLDIER)) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (gotone)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, ", ");
|
|
|
|
|
gotone = TRUE;
|
|
|
|
|
sprint(self, PRINT_HIGH, "Soldier");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (!(illegalclasses & TF_ILL_DEMOMAN) && !(ill & TF_ILL_DEMOMAN)) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (gotone)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, ", ");
|
|
|
|
|
gotone = TRUE;
|
|
|
|
|
sprint(self, PRINT_HIGH, "Demolitions Man");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (!(illegalclasses & TF_ILL_MEDIC) && !(ill & TF_ILL_MEDIC)) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (gotone)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, ", ");
|
|
|
|
|
gotone = TRUE;
|
|
|
|
|
sprint(self, PRINT_HIGH, "Combat Medic");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (!(illegalclasses & TF_ILL_HVYWEP) && !(ill & TF_ILL_HVYWEP)) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (gotone)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, ", ");
|
|
|
|
|
gotone = TRUE;
|
|
|
|
|
sprint(self, PRINT_HIGH, "Heavy Weapons Guy");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (!(illegalclasses & TF_ILL_PYRO) && !(ill & TF_ILL_PYRO)) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (gotone)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, ", ");
|
|
|
|
|
gotone = TRUE;
|
|
|
|
|
sprint(self, PRINT_HIGH, "Pyro");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (!(illegalclasses & TF_ILL_SPY) && !(ill & TF_ILL_SPY)) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (gotone)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, ", ");
|
|
|
|
|
gotone = TRUE;
|
|
|
|
|
sprint(self, PRINT_HIGH, "Spy");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (!(illegalclasses & TF_ILL_ENGINEER) && !(ill & TF_ILL_ENGINEER)) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (gotone)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, ", ");
|
|
|
|
|
gotone = TRUE;
|
|
|
|
|
sprint(self, PRINT_HIGH, "Engineer");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (!(illegalclasses & TF_ILL_RANDOMPC) && !(ill & TF_ILL_RANDOMPC)) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (gotone)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, ", ");
|
|
|
|
|
gotone = TRUE;
|
|
|
|
|
sprint(self, PRINT_HIGH, "RandomPC");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, "\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Displays the player's inventory
|
|
|
|
|
void() TeamFortress_Inventory =
|
|
|
|
|
{
|
|
|
|
|
local entity tg;
|
|
|
|
|
local string ac;
|
|
|
|
|
local float col;
|
|
|
|
|
local float special; //CH used to determine if a \n is needed for a line
|
|
|
|
|
special = 0;
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.demon_one.classname == "monster_army") {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
local entity oself;
|
|
|
|
|
|
|
|
|
|
oself = self;
|
|
|
|
|
self = self.demon_one;
|
|
|
|
|
Grunty_StateInv();
|
|
|
|
|
self = oself;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Display Team
|
2001-07-24 16:03:08 +00:00
|
|
|
|
col = TeamGetColor(self.team_no);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, "You're in team ");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(self.team_no);
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, ac);
|
|
|
|
|
sprint(self, PRINT_HIGH, ", color ");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(col);
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, ac);
|
|
|
|
|
sprint(self, PRINT_HIGH, ".\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
// Display Lives, if applicable
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.lives != -1) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(self.lives);
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, "You've got ");
|
|
|
|
|
sprint(self, PRINT_HIGH, ac);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (self.lives == 1)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, " life.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
else
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, " lives.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Display Number of Grenades of each type
|
|
|
|
|
//WK Fix BUG grenades
|
|
|
|
|
if (self.tp_grenades_1 == 0)
|
|
|
|
|
self.no_grenades_1 = 0;
|
|
|
|
|
if (self.tp_grenades_2 == 0)
|
|
|
|
|
self.no_grenades_2 = 0;
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.no_grenades_1 > 0) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, "Gren.Type 1: ");
|
|
|
|
|
if (self.tp_grenades_1 == GR_TYPE_NORMAL)
|
|
|
|
|
sprint(self, PRINT_HIGH, "Normal(");
|
|
|
|
|
else if (self.tp_grenades_1 == GR_TYPE_CONCUSSION)
|
|
|
|
|
sprint(self, PRINT_HIGH, "Concussion(");
|
|
|
|
|
else if (self.tp_grenades_1 == GR_TYPE_ANTIGRAV)
|
|
|
|
|
sprint(self, PRINT_HIGH, "AntiGrav(");
|
|
|
|
|
else if (self.tp_grenades_1 == GR_TYPE_NAIL)
|
|
|
|
|
sprint(self, PRINT_HIGH, "Nail(");
|
|
|
|
|
else if (self.tp_grenades_1 == GR_TYPE_MIRV)
|
|
|
|
|
sprint(self, PRINT_HIGH, "Mirv(");
|
|
|
|
|
else if (self.tp_grenades_1 == GR_TYPE_NAPALM)
|
|
|
|
|
sprint(self, PRINT_HIGH, "Napalm(");
|
|
|
|
|
else if (self.tp_grenades_1 == GR_TYPE_FLARE)
|
|
|
|
|
sprint(self, PRINT_HIGH, "Flare(");
|
|
|
|
|
else if (self.tp_grenades_1 == GR_TYPE_GAS)
|
|
|
|
|
sprint(self, PRINT_HIGH, "Hallucinogenic(");
|
|
|
|
|
else if (self.tp_grenades_1 == GR_TYPE_EMP)
|
|
|
|
|
sprint(self, PRINT_HIGH, "EMP(");
|
|
|
|
|
else if (self.tp_grenades_1 == GR_TYPE_FLASH)
|
|
|
|
|
sprint(self, PRINT_HIGH, "Flash(");
|
|
|
|
|
else if (self.tp_grenades_1 == GR_TYPE_FRAG)
|
|
|
|
|
sprint(self, PRINT_HIGH, "Frag(");
|
|
|
|
|
else if (self.tp_grenades_1 == GR_TYPE_KRAC)
|
|
|
|
|
sprint(self, PRINT_HIGH, "Krac(");
|
|
|
|
|
else if (self.tp_grenades_1 == GR_TYPE_CALTROP)
|
|
|
|
|
sprint(self, PRINT_HIGH, "Caltrop(");
|
|
|
|
|
else if (self.tp_grenades_1 == GR_TYPE_BIO)
|
|
|
|
|
sprint(self, PRINT_HIGH, "Biological(");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
else
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, "BUG(");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
ac = ftos(self.no_grenades_1);
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, ac);
|
|
|
|
|
sprint(self, PRINT_HIGH, ")\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
|
|
|
|
|
if (self.no_grenades_2 > 0) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, "Gren.Type 2: ");
|
|
|
|
|
if (self.tp_grenades_2 == GR_TYPE_NORMAL)
|
|
|
|
|
sprint(self, PRINT_HIGH, "Normal(");
|
|
|
|
|
else if (self.tp_grenades_2 == GR_TYPE_CONCUSSION)
|
|
|
|
|
sprint(self, PRINT_HIGH, "Concussion(");
|
|
|
|
|
else if (self.tp_grenades_2 == GR_TYPE_NAIL)
|
|
|
|
|
sprint(self, PRINT_HIGH, "Nail(");
|
|
|
|
|
else if (self.tp_grenades_2 == GR_TYPE_ANTIGRAV)
|
|
|
|
|
sprint(self, PRINT_HIGH, "AntiGrav(");
|
|
|
|
|
else if (self.tp_grenades_2 == GR_TYPE_CALTROP)
|
|
|
|
|
sprint(self, PRINT_HIGH, "Caltrop(");
|
|
|
|
|
else if (self.tp_grenades_2 == GR_TYPE_MIRV)
|
|
|
|
|
sprint(self, PRINT_HIGH, "Mirv(");
|
|
|
|
|
else if (self.tp_grenades_2 == GR_TYPE_BIO)
|
|
|
|
|
sprint(self, PRINT_HIGH, "Biological(");
|
|
|
|
|
else if (self.tp_grenades_2 == GR_TYPE_NAPALM)
|
|
|
|
|
sprint(self, PRINT_HIGH, "Napalm(");
|
|
|
|
|
else if (self.tp_grenades_2 == GR_TYPE_FLARE)
|
|
|
|
|
sprint(self, PRINT_HIGH, "Flare(");
|
|
|
|
|
else if (self.tp_grenades_2 == GR_TYPE_GAS)
|
|
|
|
|
sprint(self, PRINT_HIGH, "Hallucinogenic(");
|
|
|
|
|
else if (self.tp_grenades_2 == GR_TYPE_EMP)
|
|
|
|
|
sprint(self, PRINT_HIGH, "EMP(");
|
|
|
|
|
else if (self.tp_grenades_2 == GR_TYPE_FLASH)
|
|
|
|
|
sprint(self, PRINT_HIGH, "Flash(");
|
|
|
|
|
else if (self.tp_grenades_2 == GR_TYPE_FRAG)
|
|
|
|
|
sprint(self, PRINT_HIGH, "Frag(");
|
|
|
|
|
else if (self.tp_grenades_2 == GR_TYPE_KRAC)
|
|
|
|
|
sprint(self, PRINT_HIGH, "Krac(");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
else
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, "BUG(");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
ac = ftos(self.no_grenades_2);
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, ac);
|
|
|
|
|
sprint(self, PRINT_HIGH, ")\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Scanner
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.tf_items & NIT_SCANNER) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, "Scanner. ");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
special = special + 1; //CH determines \n
|
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.cutf_items & CUTF_JAMMER) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, "Jammer. ");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
special = special + 1; //CH determines \n
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.cutf_items & CUTF_CYBERAUG && !(self.weapons_carried & WEAP_MEDIKIT)) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, "CyberAug (");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(self.ammo_medikit);
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, ac);
|
|
|
|
|
sprint(self, PRINT_HIGH, "). ");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
special = special + 1; //CH determines \n
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.cutf_items & CUTF_CYBERAUG && self.weapons_carried & WEAP_MEDIKIT)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, "CyberAug/");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
|
2001-07-17 05:58:10 +00:00
|
|
|
|
// Medikit and ammo
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.weapons_carried & WEAP_MEDIKIT) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, "Medikit (");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(self.ammo_medikit);
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, ac);
|
|
|
|
|
sprint(self, PRINT_HIGH, "). ");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
special = special + 1; //CH determines \n
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
// if (self.cutf_items & CUTF_INTERFACE) //- OfN -
|
|
|
|
|
// sprint(self, PRINT_HIGH, "Cyber Interface. ");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Detpack
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.cutf_items & CUTF_DETPACK) {
|
|
|
|
|
if (self.ammo_detpack > 0) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(self.ammo_detpack);
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, ac);
|
|
|
|
|
sprint(self, PRINT_HIGH, " Detpack");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (self.ammo_detpack > 1)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, "s");
|
|
|
|
|
sprint(self, PRINT_HIGH, ". ");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
special = special + 1; //CH determines \n
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
|
|
|
|
|
if (self.cutf_items & CUTF_TOSSABLEDET) {
|
|
|
|
|
if (self.ammo_c4det > 0) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(self.ammo_c4det);
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, ac);
|
|
|
|
|
sprint(self, PRINT_HIGH, " Tossable Detpack");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (self.ammo_c4det > 1)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, "s");
|
|
|
|
|
sprint(self, PRINT_HIGH, ". ");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
special = special + 1; //CH determines \n
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GoalItems
|
2001-11-02 17:00:52 +00:00
|
|
|
|
tg = find (NIL, classname, "item_tfgoal");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
while (tg) {
|
|
|
|
|
if (tg.owner == self) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, tg.netname);
|
|
|
|
|
sprint(self, PRINT_HIGH, ". ");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
special = special + 1; //CH determines \n
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tg = find(tg, classname, "item_tfgoal");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Armor
|
|
|
|
|
if (self.armorvalue > 0)
|
|
|
|
|
special = special + TeamFortress_DescribeArmor(self, self.armorclass);
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (special > 0)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, "\n");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
|
|
|
|
|
if (!invis_only) {
|
|
|
|
|
// Spy gets told what skin and color he/she is wearing
|
|
|
|
|
if ((self.cutf_items & CUTF_SPY_KIT) && invis_only == FALSE) {
|
|
|
|
|
sprint (self, PRINT_HIGH, "Skin : ");
|
|
|
|
|
if (self.undercover_skin != 0)
|
|
|
|
|
TeamFortress_PrintClassName(self,self.undercover_skin,0);
|
|
|
|
|
else
|
|
|
|
|
TeamFortress_PrintClassName(self,self.skin,0);
|
|
|
|
|
|
|
|
|
|
sprint (self, PRINT_HIGH, "Colors : Team ");
|
|
|
|
|
if (self.undercover_team != 0)
|
|
|
|
|
ac = ftos(self.undercover_team);
|
|
|
|
|
else
|
|
|
|
|
ac = ftos(self.team_no);
|
|
|
|
|
sprint (self, PRINT_HIGH, ac);
|
|
|
|
|
sprint(self, PRINT_HIGH, "\n");
|
|
|
|
|
}
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//WK Let us know if we have a guy summoned
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.job & JOB_DEMON_OUT) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.job & JOB_ARMY)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac="soldier";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (self.job & JOB_WARLOCK)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac=GetMonsterName(self.demon_two);
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "Your ");
|
|
|
|
|
sprint (self, PRINT_HIGH, ac);
|
|
|
|
|
sprint(self, PRINT_HIGH," has ");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
ac = ftos(ceil(self.demon_one.health));
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, ac);
|
|
|
|
|
sprint (self, PRINT_HIGH, "<EFBFBD>");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(ceil(self.demon_one.max_health));
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, ac);
|
|
|
|
|
sprint (self, PRINT_HIGH, " HP\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.has_sentry) {
|
2001-11-02 17:00:52 +00:00
|
|
|
|
tg = find(NIL, classname, "building_sentrygun");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
while (tg) {
|
|
|
|
|
if (tg.real_owner == self) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(ceil(tg.health));
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ");
|
|
|
|
|
sprint (self, PRINT_HIGH, ac);
|
|
|
|
|
sprint (self, PRINT_HIGH, "<EFBFBD>");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(ceil(tg.max_health));
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, ac);
|
|
|
|
|
sprint (self, PRINT_HIGH, " <20><>\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
tg = find(tg, classname, "building_sentrygun");
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
|
|
|
|
|
if (self.has_tesla) {
|
2001-11-02 17:00:52 +00:00
|
|
|
|
tg = find(NIL, classname, "building_tesla");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
while (tg) {
|
|
|
|
|
if (tg.real_owner == self) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(ceil(tg.health));
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ");
|
|
|
|
|
sprint (self, PRINT_HIGH, ac);
|
|
|
|
|
sprint (self, PRINT_HIGH, "<EFBFBD>");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(ceil(tg.max_health));
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, ac);
|
|
|
|
|
sprint (self, PRINT_HIGH, " <20><>\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
tg = find(tg, classname, "building_tesla");
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
|
|
|
|
|
if (self.has_dispenser) {
|
2001-11-02 17:00:52 +00:00
|
|
|
|
tg = find(NIL, classname, "building_dispenser");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
while (tg) {
|
|
|
|
|
if (tg.real_owner == self) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(ceil(tg.health));
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ");
|
|
|
|
|
sprint (self, PRINT_HIGH, ac);
|
|
|
|
|
sprint (self, PRINT_HIGH, "<EFBFBD>");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(ceil(tg.max_health));
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, ac);
|
|
|
|
|
sprint (self, PRINT_HIGH, " <20><>\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
tg = find(tg, classname, "building_dispenser");
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
|
|
|
|
|
if (self.has_sensor) {
|
2001-11-02 17:00:52 +00:00
|
|
|
|
tg = find(NIL, classname, "building_sensor");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
while (tg) {
|
|
|
|
|
if (tg.real_owner == self) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(ceil(tg.health));
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ");
|
|
|
|
|
sprint (self, PRINT_HIGH, ac);
|
|
|
|
|
sprint (self, PRINT_HIGH, "<EFBFBD>");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(ceil(tg.max_health));
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, ac);
|
|
|
|
|
sprint (self, PRINT_HIGH, " <20><>\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
tg = find(tg, classname, "building_sensor");
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
|
|
|
|
|
if (self.has_camera) {
|
|
|
|
|
tg = find(NIL, classname, "building_camera");
|
|
|
|
|
while (tg) {
|
|
|
|
|
if (tg.real_owner == self) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(ceil(tg.health));
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ");
|
|
|
|
|
sprint (self, PRINT_HIGH, ac);
|
|
|
|
|
sprint (self, PRINT_HIGH, "<EFBFBD>");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(ceil(tg.max_health));
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, ac);
|
|
|
|
|
sprint (self, PRINT_HIGH, " <20><>\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
tg = find(tg, classname, "building_camera");
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
|
|
|
|
|
if (self.has_teleporter > 0) {
|
2001-11-02 17:00:52 +00:00
|
|
|
|
tg = find(NIL, classname, "building_teleporter");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
while (tg) {
|
|
|
|
|
if (tg.real_owner == self) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(ceil(tg.health));
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ");
|
|
|
|
|
sprint (self, PRINT_HIGH, ac);
|
|
|
|
|
sprint (self, PRINT_HIGH, "<EFBFBD>");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(ceil(tg.max_health));
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, ac);
|
|
|
|
|
sprint (self, PRINT_HIGH, " <20><>\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
tg = find(tg, classname, "building_teleporter");
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
|
|
|
|
|
if (self.has_fieldgen > 0) {
|
2001-11-02 17:00:52 +00:00
|
|
|
|
tg = find(NIL, classname, "building_fieldgen");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
while (tg) {
|
|
|
|
|
if (tg.real_owner == self) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(ceil(tg.health));
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ");
|
|
|
|
|
sprint (self, PRINT_HIGH, ac);
|
|
|
|
|
sprint (self, PRINT_HIGH, "<EFBFBD>");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(ceil(tg.max_health));
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, ac);
|
|
|
|
|
sprint (self, PRINT_HIGH, " <20><>\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
tg = find(tg, classname, "building_fieldgen");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
/*
|
|
|
|
|
if (self.job & JOB_WARLOCK && self.job & JOB_DEMON_OUT) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "You have a ");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac=GetMonsterName(self.demon_two);
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, ac);
|
|
|
|
|
sprint (self, PRINT_HIGH, " summoned: ");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-11-02 17:00:52 +00:00
|
|
|
|
tg = find(NIL, classname, "monster_demon1");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
while (tg) {
|
|
|
|
|
if (tg.real_owner == self) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(ceil(tg.health));
|
2001-07-23 20:52:47 +00:00
|
|
|
|
//sprint (self, PRINT_HIGH, " (");
|
|
|
|
|
sprint (self, PRINT_HIGH, ac);
|
|
|
|
|
sprint (self, PRINT_HIGH, " HP ");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
tg = find(tg, classname, "monster_demon1");
|
|
|
|
|
}
|
|
|
|
|
|
2001-11-02 17:00:52 +00:00
|
|
|
|
tg = find(NIL, classname, "monster_army");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
while (tg) {
|
|
|
|
|
if (tg.real_owner == self) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(ceil(tg.health));
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, " (");
|
|
|
|
|
sprint (self, PRINT_HIGH, ac);
|
|
|
|
|
sprint (self, PRINT_HIGH, ") ");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
tg = find(tg, classname, "monster_army");
|
|
|
|
|
}
|
|
|
|
|
|
2001-11-02 17:00:52 +00:00
|
|
|
|
tg = find(NIL, classname, "monster_shambler");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
while (tg) {
|
|
|
|
|
if (tg.real_owner == self) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(ceil(tg.health));
|
2001-07-23 20:52:47 +00:00
|
|
|
|
//sprint (self, PRINT_HIGH, " (");
|
|
|
|
|
sprint (self, PRINT_HIGH, ac);
|
|
|
|
|
sprint (self, PRINT_HIGH, " HP ");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
tg = find(tg, classname, "monster_shambler");
|
|
|
|
|
}
|
|
|
|
|
|
2001-11-02 17:00:52 +00:00
|
|
|
|
tg = find(NIL, classname, "monster_wizard");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
while (tg) {
|
|
|
|
|
if (tg.real_owner == self) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(ceil(tg.health));
|
2001-07-23 20:52:47 +00:00
|
|
|
|
//sprint (self, PRINT_HIGH, " (");
|
|
|
|
|
sprint (self, PRINT_HIGH, ac);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(ceil(tg.max_health));
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "<EFBFBD>");
|
|
|
|
|
sprint (self, PRINT_HIGH, ac);
|
|
|
|
|
sprint (self, PRINT_HIGH, " HP ");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
tg = find(tg, classname, "monster_wizard");
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
// sprint (self, PRINT_HIGH, ac);
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "\n");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
if (self.job & JOB_WARLOCK) { // they can see that on warlock menu
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos (self.demon_blood);
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "Knife kills: ", ac, "\n"); // knife kills
|
2002-09-08 01:44:11 +00:00
|
|
|
|
}
|
|
|
|
|
*/
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
//CH if you have boots, state percent of fuel
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.tf_items & NIT_HOVER_BOOTS) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (self.hover_time <= 0)
|
|
|
|
|
ac = "0";
|
|
|
|
|
else
|
2001-07-23 20:52:47 +00:00
|
|
|
|
ac = ftos(floor(100 * (self.hover_time / MAX_HOVER_FUEL)));
|
|
|
|
|
sprint (self, PRINT_HIGH, "Boot Charge: ");
|
|
|
|
|
sprint (self, PRINT_HIGH, ac);
|
|
|
|
|
sprint (self, PRINT_HIGH, "% ");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
//CH if you have a job. tell when can work
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.job & JOB_ALL) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if ((self.job_finished - time) <= 0)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self,PRINT_HIGH, "Skill Time: ");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
else {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
ac = ftos(ceil(self.job_finished - time));
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self,PRINT_HIGH, "Skill Time:");
|
|
|
|
|
sprint (self, PRINT_HIGH, ac);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (ceil(self.job_finished - time) == 1)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, " second");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
else
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, " seconds");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.aura) { //- OfN - If we have an aura it should tell
|
|
|
|
|
if (self.crusader_inspirator && !(self.crusader_inspirator.has_disconnected) && self.crusader_inspirator.classname == "player") {
|
|
|
|
|
sprint(self,PRINT_HIGH,"\n");
|
|
|
|
|
sprint(self,PRINT_HIGH,self.crusader_inspirator.netname);
|
|
|
|
|
sprint(self,PRINT_HIGH," grants you the AURA of ");
|
|
|
|
|
} else
|
|
|
|
|
sprint(self,PRINT_HIGH,"\nYou enjoy the AURA of ");
|
|
|
|
|
|
|
|
|
|
if (self.aura == AURA_POWER)
|
|
|
|
|
sprint(self,PRINT_HIGH," <20><><EFBFBD><EFBFBD><EFBFBD>.");
|
|
|
|
|
else if (self.aura == AURA_RESISTANCE)
|
|
|
|
|
sprint(self,PRINT_HIGH," <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.");
|
|
|
|
|
else if (self.aura == AURA_HASTE)
|
|
|
|
|
sprint(self,PRINT_HIGH," <20><><EFBFBD><EFBFBD><EFBFBD>.");
|
|
|
|
|
else if (self.aura == AURA_INVIS)
|
|
|
|
|
sprint(self,PRINT_HIGH," <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.");
|
|
|
|
|
}
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Displays the state of the ToggleFlags
|
|
|
|
|
void() TeamFortress_ShowTF =
|
|
|
|
|
{
|
|
|
|
|
local string st;
|
|
|
|
|
|
|
|
|
|
// Class Persistence between lvls On/Off
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (toggleflags & TFLAG_CLASS_PERSIST)
|
|
|
|
|
sprint (self, PRINT_HIGH, "Class Persistence On.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
else
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "Class Persistence Off.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
// Cheat Checking On/Off
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (toggleflags & TFLAG_CHEATCHECK)
|
|
|
|
|
sprint (self, PRINT_HIGH, "Cheat Checking On.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
else
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "Cheat Checking Off.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
// AutoTeam On/Off
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (toggleflags & TFLAG_AUTOTEAM)
|
|
|
|
|
sprint (self, PRINT_HIGH, "AutoTeam On.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
else
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "AutoTeam Off.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
// RespawnDelay
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (toggleflags & TFLAG_RESPAWNDELAY)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
st = ftos(respawn_delay_time);
|
|
|
|
|
else
|
|
|
|
|
st = "No";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, st);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (st != "No")
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, " second");
|
|
|
|
|
sprint (self, PRINT_HIGH, " Respawn Delay.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
// TeamFrags On/Off
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (toggleflags & TFLAG_TEAMFRAGS)
|
|
|
|
|
sprint (self, PRINT_HIGH, "TeamFrags On.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
else
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "TeamFrags Off.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
// Grapple hook
|
|
|
|
|
if (allow_hook)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "Grapple On.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
else
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "Grapple Off.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void() TeamFortress_GrenadePrimed;
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Primes a grenade of the type corresponding to the player's impulse
|
|
|
|
|
void() TeamFortress_PrimeGrenade =
|
|
|
|
|
{
|
2001-10-19 03:31:30 +00:00
|
|
|
|
local float gtype = GR_TYPE_NONE;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
local string gs, ptime;
|
|
|
|
|
local entity tGrenade;
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
/*
|
|
|
|
|
if (self.job & JOB_THIEF && self.job & JOB_FULL_HIDE) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self,PRINT_HIGH,"You can't throw grens while invisible\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
}
|
|
|
|
|
*/
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
// If you've already primed a grenade, return
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if ((self.tfstate & TFSTATE_GRENPRIMED) || (self.tfstate & TFSTATE_GRENTHROWING))
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.impulse == TF_GRENADE_1) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
#define SPAM_TIME 7
|
|
|
|
|
//WK Stop frag spammming // enabled again
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.tp_grenades_1 == GR_TYPE_FRAG && self.no_grenades_1 > 0) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if ((self.team_no == 1 && team1nextspam >= time) ||
|
|
|
|
|
(self.team_no == 2 && team2nextspam >= time) ||
|
|
|
|
|
(self.team_no == 3 && team3nextspam >= time) ||
|
|
|
|
|
(self.team_no == 4 && team4nextspam >= time)) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self,PRINT_HIGH,"Your team already has a spam grenade in the world.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.team_no == 1) team1nextspam = time + SPAM_TIME;
|
|
|
|
|
if (self.team_no == 2) team2nextspam = time + SPAM_TIME;
|
|
|
|
|
if (self.team_no == 3) team3nextspam = time + SPAM_TIME;
|
|
|
|
|
if (self.team_no == 4) team4nextspam = time + SPAM_TIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
} // OfN Removed spam control // enabled again
|
|
|
|
|
gtype = self.tp_grenades_1;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (gtype == GR_TYPE_CONCUSSION)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Concussion grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_ANTIGRAV)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "AntiGrav grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_BIO)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "BioInfection grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_CALTROP)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Caltrop grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_NAIL)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Nail grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_MIRV)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Mirv grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_NAPALM)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Napalm grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_FLARE)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Flare";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_GAS)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Gas grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_EMP)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "EMP grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_FLASH)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Flash grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_FRAG)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Fragmentation grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_KRAC)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Krac grenade";
|
|
|
|
|
else
|
|
|
|
|
gs = "Grenade";
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.no_grenades_1 >= 1) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
ptime = ftos( GR_PRIMETIME );
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, gs);
|
|
|
|
|
sprint(self, PRINT_HIGH, " primed, ");
|
|
|
|
|
sprint(self, PRINT_HIGH, ptime);
|
|
|
|
|
sprint(self, PRINT_HIGH, " seconds...\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
/*
|
|
|
|
|
if ((self.tp_grenades_1 == GR_TYPE_NAIL || self.tp_grenades_1 == GR_TYPE_FRAG) && self.no_grenades_1 > 2)
|
|
|
|
|
self.no_grenades_1 = 2;
|
|
|
|
|
*/
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
if (self.no_grenades_1 > GetMaxGrens(self,1))
|
|
|
|
|
self.no_grenades_1 = GetMaxGrens(self,1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.no_grenades_1 = self.no_grenades_1 - 1;
|
|
|
|
|
|
|
|
|
|
// OfN
|
2002-09-08 01:44:11 +00:00
|
|
|
|
// sound(self, CHAN_MISC, "weapons/pinpull.wav", 1, ATTN_IDLE);
|
|
|
|
|
} else {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, "No ");
|
|
|
|
|
sprint(self, PRINT_HIGH, gs);
|
|
|
|
|
sprint(self, PRINT_HIGH, "s left.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} if (self.impulse == TF_GRENADE_2) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.tp_grenades_2 == GR_TYPE_FRAG && self.no_grenades_2 > 0) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if ((self.team_no == 1 && team1nextspam >= time) ||
|
|
|
|
|
(self.team_no == 2 && team2nextspam >= time) ||
|
|
|
|
|
(self.team_no == 3 && team3nextspam >= time) ||
|
|
|
|
|
(self.team_no == 4 && team4nextspam >= time)) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self,PRINT_HIGH,"Your team already has a spam grenade in the world.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.team_no == 1) team1nextspam = time + SPAM_TIME + 1;
|
|
|
|
|
if (self.team_no == 2) team2nextspam = time + SPAM_TIME + 1;
|
|
|
|
|
if (self.team_no == 3) team3nextspam = time + SPAM_TIME + 1;
|
|
|
|
|
if (self.team_no == 4) team4nextspam = time + SPAM_TIME + 1;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
} // OfN Removed spam control
|
|
|
|
|
gtype = self.tp_grenades_2;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (gtype == GR_TYPE_CONCUSSION)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Concussion grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_ANTIGRAV)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "AntiGrav grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_BIO)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "BioInfection grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_CALTROP)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Caltrop grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_NAIL)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Nail grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_MIRV)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Mirv grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_NAPALM)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Napalm grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_FLARE)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Flare";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_GAS)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Gas grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_EMP)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "EMP grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_FLASH)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Flash grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_FRAG)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Fragmentation grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_KRAC)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Krac grenade";
|
|
|
|
|
else
|
|
|
|
|
gs = "Grenade";
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
/*
|
|
|
|
|
if (gtype == GR_TYPE_CONCUSSION)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Concussion grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_NAIL)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Nail grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_MIRV)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Mirv grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_NAPALM)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Napalm grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_FLARE)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Flare";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_GAS)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Gas grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_EMP)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "EMP grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_FLASH)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Flash grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_FRAG)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Fragmentation grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_BIO)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "BioInfection grenade";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_CALTROP)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Caltrop grenade";
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (gtype == GR_TYPE_KRAC)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
gs = "Krac grenade";
|
|
|
|
|
else
|
2002-09-08 01:44:11 +00:00
|
|
|
|
gs = "Grenade";
|
|
|
|
|
*/
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.no_grenades_2 >= 1) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
ptime = ftos( GR_PRIMETIME );
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, gs);
|
|
|
|
|
sprint(self, PRINT_HIGH, " primed, ");
|
|
|
|
|
sprint(self, PRINT_HIGH, ptime);
|
|
|
|
|
sprint(self, PRINT_HIGH, " seconds...\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
//WK Limit Nail grenades to 2 - ofn and frag
|
|
|
|
|
if (self.no_grenades_2 > GetMaxGrens(self,2))
|
|
|
|
|
self.no_grenades_2 = GetMaxGrens(self,2);
|
2002-09-08 01:44:11 +00:00
|
|
|
|
/*
|
|
|
|
|
if ((self.tp_grenades_2 == GR_TYPE_NAIL || self.tp_grenades_2 == GR_TYPE_FRAG) && self.no_grenades_2 > 2)
|
|
|
|
|
self.no_grenades_2 = 2;
|
|
|
|
|
*/
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
self.no_grenades_2 = self.no_grenades_2 - 1;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
// sound(self, CHAN_MISC, "weapons/pinpull.wav", 1, ATTN_IDLE);
|
|
|
|
|
} else {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, "No ");
|
|
|
|
|
sprint(self, PRINT_HIGH, gs);
|
|
|
|
|
sprint(self, PRINT_HIGH, "s left.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.tfstate = (self.tfstate | TFSTATE_GRENPRIMED);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
tGrenade = spawn();
|
|
|
|
|
tGrenade.owner = self;
|
|
|
|
|
tGrenade.weapon = gtype;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
// tGrenade.classname = "timer"; //Ofn was comented, bug? - IT SHOULD BE COMMENTED :)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
tGrenade.nextthink = time + 0.8;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
tGrenade.heat = time + GR_PRIMETIME + 0.8;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
tGrenade.think = TeamFortress_GrenadePrimed;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (gtype == GR_TYPE_CALTROP)
|
|
|
|
|
tGrenade.heat = tGrenade.heat - GR_PRIMETIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void() TeamFortress_GrenadePrimed =
|
|
|
|
|
{
|
|
|
|
|
local entity user;
|
|
|
|
|
local entity oldself;
|
|
|
|
|
|
|
|
|
|
user = self.owner;
|
|
|
|
|
|
2003-12-02 03:37:29 +00:00
|
|
|
|
local float isdrop = FALSE;
|
|
|
|
|
|
|
|
|
|
if (((user.tfstate & TFSTATE_DISARMED) && user.attack_finished > time) || user.deadflag)
|
|
|
|
|
isdrop = TRUE;
|
|
|
|
|
|
|
|
|
|
local float isthrowing = FALSE;
|
|
|
|
|
|
|
|
|
|
if (isdrop || (user.tfstate & TFSTATE_GRENTHROWING))
|
|
|
|
|
isthrowing = TRUE;
|
|
|
|
|
|
|
|
|
|
if (!isthrowing) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.nextthink = time + 0.1;
|
|
|
|
|
|
|
|
|
|
if (!self.think)
|
|
|
|
|
dremove(self);
|
|
|
|
|
|
|
|
|
|
if (time > self.heat)
|
|
|
|
|
TeamFortress_ExplodePerson();
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (!(user.tfstate & TFSTATE_GRENPRIMED))
|
2001-07-17 05:58:10 +00:00
|
|
|
|
RPrint("GrenadePrimed logic error\n");
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
user.tfstate = user.tfstate - (user.tfstate & TFSTATE_GRENPRIMED);
|
|
|
|
|
user.tfstate = user.tfstate - (user.tfstate & TFSTATE_GRENTHROWING);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
// ofn
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.weapon == GR_TYPE_FLARE)
|
|
|
|
|
sound (user, CHAN_WEAPON, "weapons/flmfire2.wav", 1, ATTN_NORM);
|
|
|
|
|
else
|
|
|
|
|
sound (user, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
|
|
|
|
|
// sound (user, CHAN_WEAPON, "weapons/throw.wav", 1, ATTN_NORM);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
KickPlayer(-1, user);
|
|
|
|
|
newmis = spawn ();
|
|
|
|
|
newmis.owner = user;
|
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";
|
|
|
|
|
|
|
|
|
|
// set grenade speed
|
|
|
|
|
makevectors (user.v_angle);
|
|
|
|
|
|
2003-12-02 03:37:29 +00:00
|
|
|
|
if (isdrop) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
// if user is dead, throw grenade directly up
|
|
|
|
|
newmis.velocity = '0 0 200';
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else {
|
|
|
|
|
if (user.v_angle_x) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.velocity = v_forward*600 + v_up * 200 + crandom()*v_right*10 + crandom()*v_up*10;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.velocity = aim(user, 10000);
|
|
|
|
|
newmis.velocity = newmis.velocity * 600;
|
|
|
|
|
newmis.velocity_z = 200;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
newmis.angles = vectoangles(newmis.velocity);
|
|
|
|
|
|
|
|
|
|
// set the grenade's thinktime to when the PRIMETIME runs out
|
2001-11-10 06:35:43 +00:00
|
|
|
|
newmis.think = dont_think;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.nextthink = self.heat;
|
|
|
|
|
|
|
|
|
|
// set the think and touches to the appropriate grenade type
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.weapon == GR_TYPE_NORMAL) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.touch = NormalGrenadeTouch;
|
|
|
|
|
newmis.think = NormalGrenadeExplode;
|
|
|
|
|
newmis.skin = 0;
|
|
|
|
|
newmis.avelocity = '300 300 300';
|
|
|
|
|
setmodel (newmis, "progs/hgren2.mdl");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == GR_TYPE_CONCUSSION) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.touch = ConcussionGrenadeTouch;
|
|
|
|
|
newmis.think = ConcussionGrenadeExplode;
|
|
|
|
|
newmis.skin = 1;
|
|
|
|
|
newmis.avelocity = '300 300 300';
|
|
|
|
|
setmodel (newmis, "progs/hgren2.mdl");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == GR_TYPE_BIO) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.touch = BioGrenadeTouch;
|
|
|
|
|
newmis.think = BioGrenadeExplode;
|
|
|
|
|
newmis.skin = 0;
|
|
|
|
|
newmis.avelocity = '300 300 300';
|
|
|
|
|
setmodel (newmis, "progs/hgren2.mdl");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == GR_TYPE_CALTROP) {
|
2001-10-17 07:48:11 +00:00
|
|
|
|
newmis.touch = NIL;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.think = CaltropGrenadeExplode;
|
|
|
|
|
newmis.skin = 0;
|
|
|
|
|
newmis.avelocity = '0 0 0';
|
|
|
|
|
newmis.velocity = '0 0 0';
|
2001-09-30 22:38:44 +00:00
|
|
|
|
setmodel (newmis, "");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == GR_TYPE_ANTIGRAV) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.touch = ConcussionGrenadeTouch;
|
|
|
|
|
newmis.think = AntiGravGrenadeExplode;
|
|
|
|
|
newmis.skin = 1;
|
|
|
|
|
newmis.avelocity = '300 300 300';
|
|
|
|
|
setmodel (newmis, "progs/hgren2.mdl");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == GR_TYPE_NAIL) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.touch = NailGrenadeTouch;
|
|
|
|
|
newmis.think = NailGrenadeExplode;
|
|
|
|
|
newmis.skin = 1;
|
|
|
|
|
newmis.avelocity = '0 300 0';
|
|
|
|
|
setmodel (newmis, "progs/biggren.mdl");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == GR_TYPE_MIRV) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.touch = MirvGrenadeTouch;
|
|
|
|
|
newmis.think = MirvGrenadeExplode;
|
|
|
|
|
newmis.skin = 0;
|
|
|
|
|
newmis.avelocity = '0 300 0';
|
|
|
|
|
setmodel (newmis, "progs/biggren.mdl");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == GR_TYPE_NAPALM) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.touch = NapalmGrenadeTouch;
|
|
|
|
|
newmis.think = NapalmGrenadeExplode;
|
|
|
|
|
newmis.skin = 2;
|
|
|
|
|
newmis.avelocity = '100 300 100';
|
|
|
|
|
setmodel (newmis, "progs/biggren.mdl");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
//CH flares no longer used
|
|
|
|
|
} else if (self.weapon == GR_TYPE_FLARE) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
newmis.movetype = MOVETYPE_FLY;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.touch = FlareGrenadeTouch;
|
|
|
|
|
newmis.think = FlareGrenadeExplode;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
// newmis.skin = 0; //TF_FLARE_OFF;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.avelocity = '0 0 0';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
makevectors (user.v_angle);
|
|
|
|
|
newmis.velocity = v_forward;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
// newmis.velocity = aim(user, 10000);
|
|
|
|
|
newmis.velocity = newmis.velocity * 2000;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
// newmis.velocity = newmis.velocity * 4;
|
|
|
|
|
// newmis.velocity_z = 0;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
setmodel (newmis, "progs/flarefly.mdl");
|
|
|
|
|
newmis.skin=0;
|
|
|
|
|
newmis.has_holo=0; //flag turned on when explodes
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == GR_TYPE_GAS) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.touch = GasGrenadeTouch;
|
|
|
|
|
newmis.think = GasGrenadeExplode;
|
|
|
|
|
newmis.skin = 3;
|
|
|
|
|
newmis.avelocity = '300 300 300';
|
|
|
|
|
setmodel (newmis, "progs/grenade2.mdl");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == GR_TYPE_EMP) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.touch = EMPGrenadeTouch;
|
|
|
|
|
newmis.think = EMPGrenadeExplode;
|
|
|
|
|
newmis.skin = 4;
|
|
|
|
|
newmis.avelocity = '300 300 300';
|
|
|
|
|
setmodel (newmis, "progs/grenade2.mdl");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == GR_TYPE_FLASH) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.touch = FlashGrenadeTouch;
|
|
|
|
|
newmis.think = FlashGrenadeExplode;
|
|
|
|
|
newmis.skin = 2;
|
|
|
|
|
newmis.avelocity = '300 300 300';
|
|
|
|
|
setmodel (newmis, "progs/hgren2.mdl");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
//WK New Grenades
|
|
|
|
|
} else if (self.weapon == GR_TYPE_FRAG) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.touch = FragGrenadeTouch;
|
|
|
|
|
newmis.think = FragGrenadeExplode;
|
|
|
|
|
newmis.skin = 0; //WK Green Skin
|
|
|
|
|
newmis.avelocity = '300 300 300';
|
|
|
|
|
setmodel (newmis, "progs/hgren2.mdl");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == GR_TYPE_KRAC) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.touch = KracGrenadeTouch;
|
|
|
|
|
newmis.think = KracGrenadeExplode;
|
|
|
|
|
newmis.skin = 1; //WK Conc skin
|
|
|
|
|
newmis.avelocity = '300 300 300';
|
|
|
|
|
setmodel (newmis, "progs/hgren2.mdl");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setsize (newmis, '0 0 0', '0 0 0');
|
|
|
|
|
setorigin (newmis, user.origin);
|
|
|
|
|
|
|
|
|
|
// OfN
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.weapon == GR_TYPE_FLARE)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
setorigin (newmis, user.origin + '0 0 16');
|
|
|
|
|
|
|
|
|
|
oldself = self;
|
|
|
|
|
self = self.owner;
|
|
|
|
|
|
|
|
|
|
#ifdef DEMO_STUFF
|
|
|
|
|
if (live_camera)
|
|
|
|
|
CamProjectileLockOn();
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
self = oldself;
|
|
|
|
|
|
|
|
|
|
// Remove primed grenade object
|
|
|
|
|
dremove(self);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Throws a currently primed grenade
|
|
|
|
|
void() TeamFortress_ThrowGrenade =
|
|
|
|
|
{
|
|
|
|
|
// If no grenade is primed, return
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (!(self.tfstate & TFSTATE_GRENPRIMED))
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
//WK Tossing a gren reveals yourself (so people don't spam)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
//if (self.job & JOB_THIEF && (self.job & JOB_ACTIVE || self.job & JOB_FULL_HIDE))
|
|
|
|
|
if (self.job & JOB_THIEF && self.job & JOB_FULL_HIDE)
|
|
|
|
|
RevealThief(self,FALSE);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.tfstate = self.tfstate | TFSTATE_GRENTHROWING;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// PLAYER CLASS HANDLING FUNCTIONS
|
|
|
|
|
//=========================================================================
|
2001-07-23 20:52:47 +00:00
|
|
|
|
// Return TRUE is this class is allowed on this map
|
2001-07-17 05:58:10 +00:00
|
|
|
|
float(float pc) IsLegalClass =
|
|
|
|
|
{
|
2001-10-19 03:31:30 +00:00
|
|
|
|
local float bit = 0;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
// Spy may be turned off
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (spy_off == TRUE && pc == PC_SPY)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (pc == PC_SCOUT)
|
|
|
|
|
bit = TF_ILL_SCOUT;
|
|
|
|
|
else if (pc == PC_SNIPER)
|
|
|
|
|
bit = TF_ILL_SNIPER;
|
|
|
|
|
else if (pc == PC_SOLDIER)
|
|
|
|
|
bit = TF_ILL_SOLDIER;
|
|
|
|
|
else if (pc == PC_DEMOMAN)
|
|
|
|
|
bit = TF_ILL_DEMOMAN;
|
|
|
|
|
else if (pc == PC_MEDIC)
|
|
|
|
|
bit = TF_ILL_MEDIC;
|
|
|
|
|
else if (pc == PC_HVYWEAP)
|
|
|
|
|
bit = TF_ILL_HVYWEP;
|
|
|
|
|
else if (pc == PC_PYRO)
|
|
|
|
|
bit = TF_ILL_PYRO;
|
|
|
|
|
else if (pc == PC_SPY)
|
|
|
|
|
bit = TF_ILL_SPY;
|
|
|
|
|
else if (pc == PC_ENGINEER)
|
|
|
|
|
bit = TF_ILL_ENGINEER;
|
|
|
|
|
else if (pc == PC_RANDOM)
|
|
|
|
|
//WK else if (pc == PC_RANDOM || pc == PC_CUSTOM) //WK Disabling randompc disables //WK customclass
|
|
|
|
|
bit = TF_ILL_RANDOMPC;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
if ((illegalclasses & bit) || (TeamFortress_TeamGetIllegalClasses(self.team_no) & bit))
|
2001-07-23 20:52:47 +00:00
|
|
|
|
return FALSE;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
return TRUE;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Alter the player's Movement based on class
|
|
|
|
|
void(entity p) TeamFortress_SetSpeed =
|
|
|
|
|
{
|
|
|
|
|
local float tf;
|
|
|
|
|
local entity te;
|
2001-10-17 04:48:19 +00:00
|
|
|
|
local float ms = p.maxspeed;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
// stuffcmd(p,"cl_movespeedkey 1\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
makeImmune(self,time + 1.1); //WK Don't boot someone decelerating
|
|
|
|
|
|
|
|
|
|
// - OfN -//
|
2001-10-17 04:48:19 +00:00
|
|
|
|
//-----------------------------------------------------------------------//
|
|
|
|
|
// STOP THAT SILLY DAMN BUGS, SPY SLIDING ETC.. !!!!!!!!!!!!!!!!!!!!!!! -//
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (p.is_feigning || p.is_haxxxoring || p.is_detpacking || p.is_building)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
p.tfstate = p.tfstate | TFSTATE_CANT_MOVE;
|
2001-10-17 04:48:19 +00:00
|
|
|
|
//-----------------------------------------------------------------------//
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
// Check for any reason why they can't move at all
|
2001-10-17 04:48:19 +00:00
|
|
|
|
if (p.tfstate & TFSTATE_CANT_MOVE) {
|
|
|
|
|
if (STOP_MOUSE_MOVEMENT == ON) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
stuffcmd(p,"m_forward 0\n");
|
|
|
|
|
stuffcmd(p,"m_side 0\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
p.velocity = '0 0 0';
|
|
|
|
|
stuffcmd(p,"cl_backspeed 0\n");
|
|
|
|
|
stuffcmd(p,"cl_forwardspeed 0\n");
|
|
|
|
|
stuffcmd(p,"cl_sidespeed 0\n");
|
|
|
|
|
p.maxspeed = 0;
|
|
|
|
|
return;
|
2001-10-17 04:48:19 +00:00
|
|
|
|
} else {
|
|
|
|
|
if (STOP_MOUSE_MOVEMENT == ON) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
stuffcmd(p,"m_forward 1\n");
|
|
|
|
|
stuffcmd(p,"m_side 0.8\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// First, get their max class speed
|
|
|
|
|
// WK We don't use this block much any more
|
2001-10-17 04:48:19 +00:00
|
|
|
|
if ( p.playerclass == PC_SCOUT)
|
|
|
|
|
p.maxspeed = PC_SCOUT_MAXSPEED;
|
|
|
|
|
else if ( p.playerclass == PC_SNIPER)
|
|
|
|
|
p.maxspeed = PC_SNIPER_MAXSPEED;
|
|
|
|
|
else if ( p.playerclass == PC_SOLDIER)
|
|
|
|
|
p.maxspeed = PC_SOLDIER_MAXSPEED;
|
|
|
|
|
else if ( p.playerclass == PC_DEMOMAN)
|
|
|
|
|
p.maxspeed = PC_DEMOMAN_MAXSPEED;
|
|
|
|
|
else if ( p.playerclass == PC_MEDIC)
|
|
|
|
|
p.maxspeed = PC_MEDIC_MAXSPEED;
|
|
|
|
|
else if ( p.playerclass == PC_HVYWEAP)
|
|
|
|
|
p.maxspeed = PC_HVYWEAP_MAXSPEED;
|
|
|
|
|
else if ( p.playerclass == PC_PYRO)
|
|
|
|
|
p.maxspeed = PC_PYRO_MAXSPEED;
|
|
|
|
|
else if ( p.playerclass == PC_CIVILIAN)
|
|
|
|
|
p.maxspeed = PC_CIVILIAN_MAXSPEED;
|
|
|
|
|
else if ( p.playerclass == PC_SPY)
|
|
|
|
|
p.maxspeed = PC_SPY_MAXSPEED;
|
|
|
|
|
else if ( p.playerclass == PC_ENGINEER)
|
|
|
|
|
p.maxspeed = PC_ENGINEER_MAXSPEED;
|
|
|
|
|
else if ( p.playerclass == PC_UNDEFINED)
|
|
|
|
|
p.maxspeed = 320;
|
|
|
|
|
else if ( p.playerclass == PC_CUSTOM) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
p.maxspeed = p.custom_speed;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (p.done_custom & CUSTOM_BUILDING) //We are building a class
|
2001-07-17 05:58:10 +00:00
|
|
|
|
p.maxspeed = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2001-10-17 04:48:19 +00:00
|
|
|
|
if (p.playerclass != PC_UNDEFINED) {
|
<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
|
|
|
|
//before anything, speed reductions from armor (no speedy tanks)
|
|
|
|
|
if (p.armorvalue > 0)
|
|
|
|
|
p.maxspeed *= (0.8 + (0.2 - p.armortype / 5));
|
|
|
|
|
|
|
|
|
|
if (p.armorvalue > 100 && p.maxspeed > 250) // really tanked? cap speed a little
|
|
|
|
|
p.maxspeed -= (p.maxspeed - 250) * (p.armorvalue - 100) / 200;
|
|
|
|
|
|
2001-10-17 04:48:19 +00:00
|
|
|
|
//1st if we have scuba gear ...
|
|
|
|
|
if (p.tf_items & NIT_SCUBA) {
|
|
|
|
|
if (p.flags & FL_INWATER) // and are underwater, increase speed
|
|
|
|
|
p.maxspeed = p.maxspeed + 200;
|
|
|
|
|
else //Fins slow us down out of water
|
|
|
|
|
p.maxspeed = p.maxspeed - 20;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 2nd, see if any GoalItems are slowing them down
|
|
|
|
|
tf = 0;
|
2001-11-02 17:00:52 +00:00
|
|
|
|
te = find (NIL, classname, "item_tfgoal");
|
|
|
|
|
while ((te) && (tf == 0)) {
|
2001-10-17 04:48:19 +00:00
|
|
|
|
if (te.owner == p) {
|
|
|
|
|
if (te.goal_activation & TFGI_SLOW) {
|
|
|
|
|
tf = 1;
|
|
|
|
|
p.maxspeed = p.maxspeed / 2;
|
|
|
|
|
}
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
2001-10-17 04:48:19 +00:00
|
|
|
|
te = find(te, classname, "item_tfgoal");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-10-17 04:48:19 +00:00
|
|
|
|
// 3rd, See if they're tranquilised
|
|
|
|
|
if (p.tfstate & TFSTATE_TRANQUILISED) {
|
|
|
|
|
//WK p.maxspeed = (p.maxspeed / 3) * 2;
|
|
|
|
|
if (p.maxspeed > 170)
|
|
|
|
|
p.maxspeed = 170;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (p.tfstate & TFSTATE_C4THROW)
|
|
|
|
|
p.maxspeed = p.maxspeed / 3;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-10-17 04:48:19 +00:00
|
|
|
|
// 4th, check for leg wounds
|
|
|
|
|
if (p.leg_damage) {
|
|
|
|
|
if (p.leg_damage > 9)
|
|
|
|
|
p.leg_damage = 9;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-10-17 04:48:19 +00:00
|
|
|
|
// reduce speed by 10% per leg wound
|
|
|
|
|
p.maxspeed = (p.maxspeed * ((10 - p.leg_damage) / 10));
|
|
|
|
|
}
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-10-17 04:48:19 +00:00
|
|
|
|
// 5th, if they're a sniper, and they're aiming, halve their speed
|
|
|
|
|
// again, but not to less than 60
|
|
|
|
|
if (p.tfstate & TFSTATE_AIMING) {
|
|
|
|
|
if (p.maxspeed > 120)
|
|
|
|
|
p.maxspeed = p.maxspeed / 2;
|
|
|
|
|
else if (p.maxspeed > 60)
|
|
|
|
|
p.maxspeed = 60;
|
|
|
|
|
}
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-10-17 04:48:19 +00:00
|
|
|
|
// WK 6th, See if they're partially hidden
|
|
|
|
|
if (p.job & JOB_THIEF) {
|
|
|
|
|
if (p.job & JOB_ACTIVE)
|
|
|
|
|
p.maxspeed = (p.maxspeed * 3) / 4;
|
|
|
|
|
else if (p.job & JOB_FULL_HIDE)
|
|
|
|
|
if (p.maxspeed > 130)
|
|
|
|
|
p.maxspeed = 130;
|
|
|
|
|
}
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-10-17 04:48:19 +00:00
|
|
|
|
//WK 7th, Check to see if they are sprinting or recovering
|
|
|
|
|
//Note that tired is both ACTIVE and TIRED
|
|
|
|
|
if (p.job & JOB_RUNNER) {
|
|
|
|
|
if (p.job & JOB_TIRED)
|
|
|
|
|
p.maxspeed = 2 * p.maxspeed / 3;
|
|
|
|
|
else if (p.job & JOB_ACTIVE)
|
|
|
|
|
p.maxspeed = p.maxspeed + 200;
|
|
|
|
|
}
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-10-17 04:48:19 +00:00
|
|
|
|
// 8th, check if they're firing an Assault Cannon
|
|
|
|
|
if (p.tfstate & TFSTATE_ASSAULTCANNON)
|
|
|
|
|
p.maxspeed /= 4;
|
|
|
|
|
}
|
2001-08-12 22:31:50 +00:00
|
|
|
|
|
2002-09-07 06:40:02 +00:00
|
|
|
|
local string speed = ftos (p.maxspeed);
|
|
|
|
|
stuffcmd(p,"cl_backspeed " + speed + "\n");
|
|
|
|
|
stuffcmd(p,"cl_forwardspeed " + speed + "\n");
|
|
|
|
|
stuffcmd(p,"cl_sidespeed " + speed + "\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Set the max_health of a player based on his/her class
|
|
|
|
|
void() TeamFortress_SetHealth =
|
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if ( self.playerclass == PC_SCOUT )
|
|
|
|
|
self.max_health = PC_SCOUT_MAXHEALTH;
|
|
|
|
|
else if ( self.playerclass == PC_SNIPER )
|
|
|
|
|
self.max_health = PC_SNIPER_MAXHEALTH;
|
|
|
|
|
else if ( self.playerclass == PC_SOLDIER )
|
|
|
|
|
self.max_health = PC_SOLDIER_MAXHEALTH;
|
|
|
|
|
else if ( self.playerclass == PC_DEMOMAN )
|
|
|
|
|
self.max_health = PC_DEMOMAN_MAXHEALTH;
|
|
|
|
|
else if ( self.playerclass == PC_MEDIC )
|
|
|
|
|
self.max_health = PC_MEDIC_MAXHEALTH;
|
|
|
|
|
else if ( self.playerclass == PC_HVYWEAP )
|
|
|
|
|
self.max_health = PC_HVYWEAP_MAXHEALTH;
|
|
|
|
|
else if ( self.playerclass == PC_PYRO )
|
|
|
|
|
self.max_health = PC_PYRO_MAXHEALTH;
|
|
|
|
|
else if ( self.playerclass == PC_CIVILIAN )
|
|
|
|
|
self.max_health = PC_CIVILIAN_MAXHEALTH;
|
|
|
|
|
else if ( self.playerclass == PC_SPY )
|
|
|
|
|
self.max_health = PC_SPY_MAXHEALTH;
|
|
|
|
|
else if ( self.playerclass == PC_ENGINEER )
|
|
|
|
|
self.max_health = PC_ENGINEER_MAXHEALTH;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
else if ( self.playerclass == PC_UNDEFINED ) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.max_health = 1;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.takedamage = 0; // Prevent damage to PC_UNDEFINED players
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
self.health = self.max_health;
|
|
|
|
|
};
|
2002-09-08 01:44:11 +00:00
|
|
|
|
|
2001-07-17 05:58:10 +00:00
|
|
|
|
//==================================================
|
|
|
|
|
//CH returns value for skin. used here and tfortmap.qc
|
|
|
|
|
float(entity p) Return_Custom_Skins =
|
|
|
|
|
{
|
1) Attempted to give players positive frags whenever possible. You now
should get frags for blowing people up with others' dispensers/mines/expbody,
airfisting rockets, etc.
2) Redid Give_Frags_Out
3) Changed many uses of pointcontents and ugly hacks to use hullpointcontents
and checkmove, now a lot cleaner and less buggy
4) You can grapple builds again. This caused really odd bugs.
5) You can now damage your own buildings again (gasp). Any time a tesla or sentry
is damaged it turns on its attacker, friendly or otherwise. This is both a counter-TK
and counter-spy mechanism.
6) Teslas are now entirely inside their bounding box
7) Now check every frame for players startsolid and for outside of the map cube.
8) #define WALL_HURT to make it hurt when you hit a wall
9) Used some cool ideas (aka laws of physics) to make the airfist a little less annoying
10) You now only get 1 mirv per slot without bandolier. Demoman and hwguy gain bandolier.
demoman loses his extra mirv but gains an extra grenade and pair of detpacks. Hwguy
gets extra grenade.
11) New and improved EMP grenade now does damage based on range. no longer blows up shells.
Doesn't directly damage sentries anymore, but does significant damage to dispensers.
EMP someone who's setting a det and it blows up in their face.
12) Players now do radius damage from getting EMPed (again)
13) EMPs now go through walls (again)
14) EMP number lowered by one (3 without, 4 with bandolier) and cost raised by $100
15) You can only have 2 frag grens, 3 with bandolier now.
16) Hover boots will now eat cells if they get low on charge. In addition, the silly bug
where their charge wasn't restored when you die is fixed now.
17) EMPing a detpack now sets its timer to anywhere between 1 and 121 seconds from current time,
with a logarithmic probability of it being lower. (random() * random() * 120 + 1). Also, probably
more time the closer it is to the EMP.
18) Judo can now be blocked by people with close combat, knife or judo. Blocked judo means that the
attacker loses 3 seconds of attack.
19) Judo missing now makes them unable to fire.
20) Shortened judo range (back to normal if w/ close combat)
21) Attempted to rework the railgun. Seems to be okay now.
Probably still a lot of bugs in here, but since this is the devel version I thought I would commit
all my changes so people could start testing it. I'll commit fixes as soon as I find the bugs.
2003-11-26 08:53:44 +00:00
|
|
|
|
if (p.cutf_items & CUTF_SPY_KIT) // want spy to always be spy
|
|
|
|
|
return PC_SPY;
|
|
|
|
|
if (p.cutf_items & (CUTF_DETPACK | CUTF_TOSSABLEDET))
|
|
|
|
|
return PC_DEMOMAN;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (p.weapons_carried & WEAP_SNIPER_RIFLE)
|
|
|
|
|
return PC_SNIPER;
|
1) Attempted to give players positive frags whenever possible. You now
should get frags for blowing people up with others' dispensers/mines/expbody,
airfisting rockets, etc.
2) Redid Give_Frags_Out
3) Changed many uses of pointcontents and ugly hacks to use hullpointcontents
and checkmove, now a lot cleaner and less buggy
4) You can grapple builds again. This caused really odd bugs.
5) You can now damage your own buildings again (gasp). Any time a tesla or sentry
is damaged it turns on its attacker, friendly or otherwise. This is both a counter-TK
and counter-spy mechanism.
6) Teslas are now entirely inside their bounding box
7) Now check every frame for players startsolid and for outside of the map cube.
8) #define WALL_HURT to make it hurt when you hit a wall
9) Used some cool ideas (aka laws of physics) to make the airfist a little less annoying
10) You now only get 1 mirv per slot without bandolier. Demoman and hwguy gain bandolier.
demoman loses his extra mirv but gains an extra grenade and pair of detpacks. Hwguy
gets extra grenade.
11) New and improved EMP grenade now does damage based on range. no longer blows up shells.
Doesn't directly damage sentries anymore, but does significant damage to dispensers.
EMP someone who's setting a det and it blows up in their face.
12) Players now do radius damage from getting EMPed (again)
13) EMPs now go through walls (again)
14) EMP number lowered by one (3 without, 4 with bandolier) and cost raised by $100
15) You can only have 2 frag grens, 3 with bandolier now.
16) Hover boots will now eat cells if they get low on charge. In addition, the silly bug
where their charge wasn't restored when you die is fixed now.
17) EMPing a detpack now sets its timer to anywhere between 1 and 121 seconds from current time,
with a logarithmic probability of it being lower. (random() * random() * 120 + 1). Also, probably
more time the closer it is to the EMP.
18) Judo can now be blocked by people with close combat, knife or judo. Blocked judo means that the
attacker loses 3 seconds of attack.
19) Judo missing now makes them unable to fire.
20) Shortened judo range (back to normal if w/ close combat)
21) Attempted to rework the railgun. Seems to be okay now.
Probably still a lot of bugs in here, but since this is the devel version I thought I would commit
all my changes so people could start testing it. I'll commit fixes as soon as I find the bugs.
2003-11-26 08:53:44 +00:00
|
|
|
|
if (p.weapons_carried & WEAP_ASSAULT_CANNON)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
return PC_HVYWEAP;
|
1) Attempted to give players positive frags whenever possible. You now
should get frags for blowing people up with others' dispensers/mines/expbody,
airfisting rockets, etc.
2) Redid Give_Frags_Out
3) Changed many uses of pointcontents and ugly hacks to use hullpointcontents
and checkmove, now a lot cleaner and less buggy
4) You can grapple builds again. This caused really odd bugs.
5) You can now damage your own buildings again (gasp). Any time a tesla or sentry
is damaged it turns on its attacker, friendly or otherwise. This is both a counter-TK
and counter-spy mechanism.
6) Teslas are now entirely inside their bounding box
7) Now check every frame for players startsolid and for outside of the map cube.
8) #define WALL_HURT to make it hurt when you hit a wall
9) Used some cool ideas (aka laws of physics) to make the airfist a little less annoying
10) You now only get 1 mirv per slot without bandolier. Demoman and hwguy gain bandolier.
demoman loses his extra mirv but gains an extra grenade and pair of detpacks. Hwguy
gets extra grenade.
11) New and improved EMP grenade now does damage based on range. no longer blows up shells.
Doesn't directly damage sentries anymore, but does significant damage to dispensers.
EMP someone who's setting a det and it blows up in their face.
12) Players now do radius damage from getting EMPed (again)
13) EMPs now go through walls (again)
14) EMP number lowered by one (3 without, 4 with bandolier) and cost raised by $100
15) You can only have 2 frag grens, 3 with bandolier now.
16) Hover boots will now eat cells if they get low on charge. In addition, the silly bug
where their charge wasn't restored when you die is fixed now.
17) EMPing a detpack now sets its timer to anywhere between 1 and 121 seconds from current time,
with a logarithmic probability of it being lower. (random() * random() * 120 + 1). Also, probably
more time the closer it is to the EMP.
18) Judo can now be blocked by people with close combat, knife or judo. Blocked judo means that the
attacker loses 3 seconds of attack.
19) Judo missing now makes them unable to fire.
20) Shortened judo range (back to normal if w/ close combat)
21) Attempted to rework the railgun. Seems to be okay now.
Probably still a lot of bugs in here, but since this is the devel version I thought I would commit
all my changes so people could start testing it. I'll commit fixes as soon as I find the bugs.
2003-11-26 08:53:44 +00:00
|
|
|
|
if (p.weapons_carried & WEAP_ROCKET_LAUNCHER)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
return PC_SOLDIER;
|
1) Attempted to give players positive frags whenever possible. You now
should get frags for blowing people up with others' dispensers/mines/expbody,
airfisting rockets, etc.
2) Redid Give_Frags_Out
3) Changed many uses of pointcontents and ugly hacks to use hullpointcontents
and checkmove, now a lot cleaner and less buggy
4) You can grapple builds again. This caused really odd bugs.
5) You can now damage your own buildings again (gasp). Any time a tesla or sentry
is damaged it turns on its attacker, friendly or otherwise. This is both a counter-TK
and counter-spy mechanism.
6) Teslas are now entirely inside their bounding box
7) Now check every frame for players startsolid and for outside of the map cube.
8) #define WALL_HURT to make it hurt when you hit a wall
9) Used some cool ideas (aka laws of physics) to make the airfist a little less annoying
10) You now only get 1 mirv per slot without bandolier. Demoman and hwguy gain bandolier.
demoman loses his extra mirv but gains an extra grenade and pair of detpacks. Hwguy
gets extra grenade.
11) New and improved EMP grenade now does damage based on range. no longer blows up shells.
Doesn't directly damage sentries anymore, but does significant damage to dispensers.
EMP someone who's setting a det and it blows up in their face.
12) Players now do radius damage from getting EMPed (again)
13) EMPs now go through walls (again)
14) EMP number lowered by one (3 without, 4 with bandolier) and cost raised by $100
15) You can only have 2 frag grens, 3 with bandolier now.
16) Hover boots will now eat cells if they get low on charge. In addition, the silly bug
where their charge wasn't restored when you die is fixed now.
17) EMPing a detpack now sets its timer to anywhere between 1 and 121 seconds from current time,
with a logarithmic probability of it being lower. (random() * random() * 120 + 1). Also, probably
more time the closer it is to the EMP.
18) Judo can now be blocked by people with close combat, knife or judo. Blocked judo means that the
attacker loses 3 seconds of attack.
19) Judo missing now makes them unable to fire.
20) Shortened judo range (back to normal if w/ close combat)
21) Attempted to rework the railgun. Seems to be okay now.
Probably still a lot of bugs in here, but since this is the devel version I thought I would commit
all my changes so people could start testing it. I'll commit fixes as soon as I find the bugs.
2003-11-26 08:53:44 +00:00
|
|
|
|
if (p.weapons_carried & WEAP_FLAMETHROWER)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
return PC_PYRO;
|
1) Attempted to give players positive frags whenever possible. You now
should get frags for blowing people up with others' dispensers/mines/expbody,
airfisting rockets, etc.
2) Redid Give_Frags_Out
3) Changed many uses of pointcontents and ugly hacks to use hullpointcontents
and checkmove, now a lot cleaner and less buggy
4) You can grapple builds again. This caused really odd bugs.
5) You can now damage your own buildings again (gasp). Any time a tesla or sentry
is damaged it turns on its attacker, friendly or otherwise. This is both a counter-TK
and counter-spy mechanism.
6) Teslas are now entirely inside their bounding box
7) Now check every frame for players startsolid and for outside of the map cube.
8) #define WALL_HURT to make it hurt when you hit a wall
9) Used some cool ideas (aka laws of physics) to make the airfist a little less annoying
10) You now only get 1 mirv per slot without bandolier. Demoman and hwguy gain bandolier.
demoman loses his extra mirv but gains an extra grenade and pair of detpacks. Hwguy
gets extra grenade.
11) New and improved EMP grenade now does damage based on range. no longer blows up shells.
Doesn't directly damage sentries anymore, but does significant damage to dispensers.
EMP someone who's setting a det and it blows up in their face.
12) Players now do radius damage from getting EMPed (again)
13) EMPs now go through walls (again)
14) EMP number lowered by one (3 without, 4 with bandolier) and cost raised by $100
15) You can only have 2 frag grens, 3 with bandolier now.
16) Hover boots will now eat cells if they get low on charge. In addition, the silly bug
where their charge wasn't restored when you die is fixed now.
17) EMPing a detpack now sets its timer to anywhere between 1 and 121 seconds from current time,
with a logarithmic probability of it being lower. (random() * random() * 120 + 1). Also, probably
more time the closer it is to the EMP.
18) Judo can now be blocked by people with close combat, knife or judo. Blocked judo means that the
attacker loses 3 seconds of attack.
19) Judo missing now makes them unable to fire.
20) Shortened judo range (back to normal if w/ close combat)
21) Attempted to rework the railgun. Seems to be okay now.
Probably still a lot of bugs in here, but since this is the devel version I thought I would commit
all my changes so people could start testing it. I'll commit fixes as soon as I find the bugs.
2003-11-26 08:53:44 +00:00
|
|
|
|
if (p.weapons_carried & WEAP_GRENADE_LAUNCHER)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
return PC_DEMOMAN;
|
1) Attempted to give players positive frags whenever possible. You now
should get frags for blowing people up with others' dispensers/mines/expbody,
airfisting rockets, etc.
2) Redid Give_Frags_Out
3) Changed many uses of pointcontents and ugly hacks to use hullpointcontents
and checkmove, now a lot cleaner and less buggy
4) You can grapple builds again. This caused really odd bugs.
5) You can now damage your own buildings again (gasp). Any time a tesla or sentry
is damaged it turns on its attacker, friendly or otherwise. This is both a counter-TK
and counter-spy mechanism.
6) Teslas are now entirely inside their bounding box
7) Now check every frame for players startsolid and for outside of the map cube.
8) #define WALL_HURT to make it hurt when you hit a wall
9) Used some cool ideas (aka laws of physics) to make the airfist a little less annoying
10) You now only get 1 mirv per slot without bandolier. Demoman and hwguy gain bandolier.
demoman loses his extra mirv but gains an extra grenade and pair of detpacks. Hwguy
gets extra grenade.
11) New and improved EMP grenade now does damage based on range. no longer blows up shells.
Doesn't directly damage sentries anymore, but does significant damage to dispensers.
EMP someone who's setting a det and it blows up in their face.
12) Players now do radius damage from getting EMPed (again)
13) EMPs now go through walls (again)
14) EMP number lowered by one (3 without, 4 with bandolier) and cost raised by $100
15) You can only have 2 frag grens, 3 with bandolier now.
16) Hover boots will now eat cells if they get low on charge. In addition, the silly bug
where their charge wasn't restored when you die is fixed now.
17) EMPing a detpack now sets its timer to anywhere between 1 and 121 seconds from current time,
with a logarithmic probability of it being lower. (random() * random() * 120 + 1). Also, probably
more time the closer it is to the EMP.
18) Judo can now be blocked by people with close combat, knife or judo. Blocked judo means that the
attacker loses 3 seconds of attack.
19) Judo missing now makes them unable to fire.
20) Shortened judo range (back to normal if w/ close combat)
21) Attempted to rework the railgun. Seems to be okay now.
Probably still a lot of bugs in here, but since this is the devel version I thought I would commit
all my changes so people could start testing it. I'll commit fixes as soon as I find the bugs.
2003-11-26 08:53:44 +00:00
|
|
|
|
if (p.weapons_carried & WEAP_MEDIKIT)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
return PC_MEDIC;
|
1) Attempted to give players positive frags whenever possible. You now
should get frags for blowing people up with others' dispensers/mines/expbody,
airfisting rockets, etc.
2) Redid Give_Frags_Out
3) Changed many uses of pointcontents and ugly hacks to use hullpointcontents
and checkmove, now a lot cleaner and less buggy
4) You can grapple builds again. This caused really odd bugs.
5) You can now damage your own buildings again (gasp). Any time a tesla or sentry
is damaged it turns on its attacker, friendly or otherwise. This is both a counter-TK
and counter-spy mechanism.
6) Teslas are now entirely inside their bounding box
7) Now check every frame for players startsolid and for outside of the map cube.
8) #define WALL_HURT to make it hurt when you hit a wall
9) Used some cool ideas (aka laws of physics) to make the airfist a little less annoying
10) You now only get 1 mirv per slot without bandolier. Demoman and hwguy gain bandolier.
demoman loses his extra mirv but gains an extra grenade and pair of detpacks. Hwguy
gets extra grenade.
11) New and improved EMP grenade now does damage based on range. no longer blows up shells.
Doesn't directly damage sentries anymore, but does significant damage to dispensers.
EMP someone who's setting a det and it blows up in their face.
12) Players now do radius damage from getting EMPed (again)
13) EMPs now go through walls (again)
14) EMP number lowered by one (3 without, 4 with bandolier) and cost raised by $100
15) You can only have 2 frag grens, 3 with bandolier now.
16) Hover boots will now eat cells if they get low on charge. In addition, the silly bug
where their charge wasn't restored when you die is fixed now.
17) EMPing a detpack now sets its timer to anywhere between 1 and 121 seconds from current time,
with a logarithmic probability of it being lower. (random() * random() * 120 + 1). Also, probably
more time the closer it is to the EMP.
18) Judo can now be blocked by people with close combat, knife or judo. Blocked judo means that the
attacker loses 3 seconds of attack.
19) Judo missing now makes them unable to fire.
20) Shortened judo range (back to normal if w/ close combat)
21) Attempted to rework the railgun. Seems to be okay now.
Probably still a lot of bugs in here, but since this is the devel version I thought I would commit
all my changes so people could start testing it. I'll commit fixes as soon as I find the bugs.
2003-11-26 08:53:44 +00:00
|
|
|
|
if (p.weapons_carried & WEAP_SPANNER)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
return PC_ENGINEER;
|
1) Attempted to give players positive frags whenever possible. You now
should get frags for blowing people up with others' dispensers/mines/expbody,
airfisting rockets, etc.
2) Redid Give_Frags_Out
3) Changed many uses of pointcontents and ugly hacks to use hullpointcontents
and checkmove, now a lot cleaner and less buggy
4) You can grapple builds again. This caused really odd bugs.
5) You can now damage your own buildings again (gasp). Any time a tesla or sentry
is damaged it turns on its attacker, friendly or otherwise. This is both a counter-TK
and counter-spy mechanism.
6) Teslas are now entirely inside their bounding box
7) Now check every frame for players startsolid and for outside of the map cube.
8) #define WALL_HURT to make it hurt when you hit a wall
9) Used some cool ideas (aka laws of physics) to make the airfist a little less annoying
10) You now only get 1 mirv per slot without bandolier. Demoman and hwguy gain bandolier.
demoman loses his extra mirv but gains an extra grenade and pair of detpacks. Hwguy
gets extra grenade.
11) New and improved EMP grenade now does damage based on range. no longer blows up shells.
Doesn't directly damage sentries anymore, but does significant damage to dispensers.
EMP someone who's setting a det and it blows up in their face.
12) Players now do radius damage from getting EMPed (again)
13) EMPs now go through walls (again)
14) EMP number lowered by one (3 without, 4 with bandolier) and cost raised by $100
15) You can only have 2 frag grens, 3 with bandolier now.
16) Hover boots will now eat cells if they get low on charge. In addition, the silly bug
where their charge wasn't restored when you die is fixed now.
17) EMPing a detpack now sets its timer to anywhere between 1 and 121 seconds from current time,
with a logarithmic probability of it being lower. (random() * random() * 120 + 1). Also, probably
more time the closer it is to the EMP.
18) Judo can now be blocked by people with close combat, knife or judo. Blocked judo means that the
attacker loses 3 seconds of attack.
19) Judo missing now makes them unable to fire.
20) Shortened judo range (back to normal if w/ close combat)
21) Attempted to rework the railgun. Seems to be okay now.
Probably still a lot of bugs in here, but since this is the devel version I thought I would commit
all my changes so people could start testing it. I'll commit fixes as soon as I find the bugs.
2003-11-26 08:53:44 +00:00
|
|
|
|
if (p.weapons_carried & WEAP_NAILGUN || p.weapons_carried & WEAP_AIRF || p.tf_items & NIT_HOVER_BOOTS)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
return PC_SCOUT;
|
1) Attempted to give players positive frags whenever possible. You now
should get frags for blowing people up with others' dispensers/mines/expbody,
airfisting rockets, etc.
2) Redid Give_Frags_Out
3) Changed many uses of pointcontents and ugly hacks to use hullpointcontents
and checkmove, now a lot cleaner and less buggy
4) You can grapple builds again. This caused really odd bugs.
5) You can now damage your own buildings again (gasp). Any time a tesla or sentry
is damaged it turns on its attacker, friendly or otherwise. This is both a counter-TK
and counter-spy mechanism.
6) Teslas are now entirely inside their bounding box
7) Now check every frame for players startsolid and for outside of the map cube.
8) #define WALL_HURT to make it hurt when you hit a wall
9) Used some cool ideas (aka laws of physics) to make the airfist a little less annoying
10) You now only get 1 mirv per slot without bandolier. Demoman and hwguy gain bandolier.
demoman loses his extra mirv but gains an extra grenade and pair of detpacks. Hwguy
gets extra grenade.
11) New and improved EMP grenade now does damage based on range. no longer blows up shells.
Doesn't directly damage sentries anymore, but does significant damage to dispensers.
EMP someone who's setting a det and it blows up in their face.
12) Players now do radius damage from getting EMPed (again)
13) EMPs now go through walls (again)
14) EMP number lowered by one (3 without, 4 with bandolier) and cost raised by $100
15) You can only have 2 frag grens, 3 with bandolier now.
16) Hover boots will now eat cells if they get low on charge. In addition, the silly bug
where their charge wasn't restored when you die is fixed now.
17) EMPing a detpack now sets its timer to anywhere between 1 and 121 seconds from current time,
with a logarithmic probability of it being lower. (random() * random() * 120 + 1). Also, probably
more time the closer it is to the EMP.
18) Judo can now be blocked by people with close combat, knife or judo. Blocked judo means that the
attacker loses 3 seconds of attack.
19) Judo missing now makes them unable to fire.
20) Shortened judo range (back to normal if w/ close combat)
21) Attempted to rework the railgun. Seems to be okay now.
Probably still a lot of bugs in here, but since this is the devel version I thought I would commit
all my changes so people could start testing it. I'll commit fixes as soon as I find the bugs.
2003-11-26 08:53:44 +00:00
|
|
|
|
if (p.job & JOB_GUERILLA)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
return PC_DEMOMAN;
|
1) Attempted to give players positive frags whenever possible. You now
should get frags for blowing people up with others' dispensers/mines/expbody,
airfisting rockets, etc.
2) Redid Give_Frags_Out
3) Changed many uses of pointcontents and ugly hacks to use hullpointcontents
and checkmove, now a lot cleaner and less buggy
4) You can grapple builds again. This caused really odd bugs.
5) You can now damage your own buildings again (gasp). Any time a tesla or sentry
is damaged it turns on its attacker, friendly or otherwise. This is both a counter-TK
and counter-spy mechanism.
6) Teslas are now entirely inside their bounding box
7) Now check every frame for players startsolid and for outside of the map cube.
8) #define WALL_HURT to make it hurt when you hit a wall
9) Used some cool ideas (aka laws of physics) to make the airfist a little less annoying
10) You now only get 1 mirv per slot without bandolier. Demoman and hwguy gain bandolier.
demoman loses his extra mirv but gains an extra grenade and pair of detpacks. Hwguy
gets extra grenade.
11) New and improved EMP grenade now does damage based on range. no longer blows up shells.
Doesn't directly damage sentries anymore, but does significant damage to dispensers.
EMP someone who's setting a det and it blows up in their face.
12) Players now do radius damage from getting EMPed (again)
13) EMPs now go through walls (again)
14) EMP number lowered by one (3 without, 4 with bandolier) and cost raised by $100
15) You can only have 2 frag grens, 3 with bandolier now.
16) Hover boots will now eat cells if they get low on charge. In addition, the silly bug
where their charge wasn't restored when you die is fixed now.
17) EMPing a detpack now sets its timer to anywhere between 1 and 121 seconds from current time,
with a logarithmic probability of it being lower. (random() * random() * 120 + 1). Also, probably
more time the closer it is to the EMP.
18) Judo can now be blocked by people with close combat, knife or judo. Blocked judo means that the
attacker loses 3 seconds of attack.
19) Judo missing now makes them unable to fire.
20) Shortened judo range (back to normal if w/ close combat)
21) Attempted to rework the railgun. Seems to be okay now.
Probably still a lot of bugs in here, but since this is the devel version I thought I would commit
all my changes so people could start testing it. I'll commit fixes as soon as I find the bugs.
2003-11-26 08:53:44 +00:00
|
|
|
|
if (p.job & JOB_HACKER)
|
|
|
|
|
return PC_ENGINEER;
|
|
|
|
|
if (p.job & JOB_THIEF)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
return PC_SPY;
|
1) Attempted to give players positive frags whenever possible. You now
should get frags for blowing people up with others' dispensers/mines/expbody,
airfisting rockets, etc.
2) Redid Give_Frags_Out
3) Changed many uses of pointcontents and ugly hacks to use hullpointcontents
and checkmove, now a lot cleaner and less buggy
4) You can grapple builds again. This caused really odd bugs.
5) You can now damage your own buildings again (gasp). Any time a tesla or sentry
is damaged it turns on its attacker, friendly or otherwise. This is both a counter-TK
and counter-spy mechanism.
6) Teslas are now entirely inside their bounding box
7) Now check every frame for players startsolid and for outside of the map cube.
8) #define WALL_HURT to make it hurt when you hit a wall
9) Used some cool ideas (aka laws of physics) to make the airfist a little less annoying
10) You now only get 1 mirv per slot without bandolier. Demoman and hwguy gain bandolier.
demoman loses his extra mirv but gains an extra grenade and pair of detpacks. Hwguy
gets extra grenade.
11) New and improved EMP grenade now does damage based on range. no longer blows up shells.
Doesn't directly damage sentries anymore, but does significant damage to dispensers.
EMP someone who's setting a det and it blows up in their face.
12) Players now do radius damage from getting EMPed (again)
13) EMPs now go through walls (again)
14) EMP number lowered by one (3 without, 4 with bandolier) and cost raised by $100
15) You can only have 2 frag grens, 3 with bandolier now.
16) Hover boots will now eat cells if they get low on charge. In addition, the silly bug
where their charge wasn't restored when you die is fixed now.
17) EMPing a detpack now sets its timer to anywhere between 1 and 121 seconds from current time,
with a logarithmic probability of it being lower. (random() * random() * 120 + 1). Also, probably
more time the closer it is to the EMP.
18) Judo can now be blocked by people with close combat, knife or judo. Blocked judo means that the
attacker loses 3 seconds of attack.
19) Judo missing now makes them unable to fire.
20) Shortened judo range (back to normal if w/ close combat)
21) Attempted to rework the railgun. Seems to be okay now.
Probably still a lot of bugs in here, but since this is the devel version I thought I would commit
all my changes so people could start testing it. I'll commit fixes as soon as I find the bugs.
2003-11-26 08:53:44 +00:00
|
|
|
|
if (p.custom_speed > 320 || p.job & JOB_RUNNER)
|
|
|
|
|
return PC_SCOUT;
|
|
|
|
|
if (p.cutf_items & CUTF_SENTRYGUN || p.tf_items & NIT_TESLA)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
return PC_ENGINEER;
|
1) Attempted to give players positive frags whenever possible. You now
should get frags for blowing people up with others' dispensers/mines/expbody,
airfisting rockets, etc.
2) Redid Give_Frags_Out
3) Changed many uses of pointcontents and ugly hacks to use hullpointcontents
and checkmove, now a lot cleaner and less buggy
4) You can grapple builds again. This caused really odd bugs.
5) You can now damage your own buildings again (gasp). Any time a tesla or sentry
is damaged it turns on its attacker, friendly or otherwise. This is both a counter-TK
and counter-spy mechanism.
6) Teslas are now entirely inside their bounding box
7) Now check every frame for players startsolid and for outside of the map cube.
8) #define WALL_HURT to make it hurt when you hit a wall
9) Used some cool ideas (aka laws of physics) to make the airfist a little less annoying
10) You now only get 1 mirv per slot without bandolier. Demoman and hwguy gain bandolier.
demoman loses his extra mirv but gains an extra grenade and pair of detpacks. Hwguy
gets extra grenade.
11) New and improved EMP grenade now does damage based on range. no longer blows up shells.
Doesn't directly damage sentries anymore, but does significant damage to dispensers.
EMP someone who's setting a det and it blows up in their face.
12) Players now do radius damage from getting EMPed (again)
13) EMPs now go through walls (again)
14) EMP number lowered by one (3 without, 4 with bandolier) and cost raised by $100
15) You can only have 2 frag grens, 3 with bandolier now.
16) Hover boots will now eat cells if they get low on charge. In addition, the silly bug
where their charge wasn't restored when you die is fixed now.
17) EMPing a detpack now sets its timer to anywhere between 1 and 121 seconds from current time,
with a logarithmic probability of it being lower. (random() * random() * 120 + 1). Also, probably
more time the closer it is to the EMP.
18) Judo can now be blocked by people with close combat, knife or judo. Blocked judo means that the
attacker loses 3 seconds of attack.
19) Judo missing now makes them unable to fire.
20) Shortened judo range (back to normal if w/ close combat)
21) Attempted to rework the railgun. Seems to be okay now.
Probably still a lot of bugs in here, but since this is the devel version I thought I would commit
all my changes so people could start testing it. I'll commit fixes as soon as I find the bugs.
2003-11-26 08:53:44 +00:00
|
|
|
|
|
|
|
|
|
return PC_SOLDIER;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
};
|
2002-09-08 01:44:11 +00:00
|
|
|
|
|
2001-07-17 05:58:10 +00:00
|
|
|
|
//=========================================================================
|
|
|
|
|
// Set the skin of a player based on his/her class, if Classkin is on
|
|
|
|
|
void(entity p) TeamFortress_SetSkin =
|
|
|
|
|
{
|
|
|
|
|
local string st;
|
|
|
|
|
|
|
|
|
|
makeImmune(self,time + 4);
|
|
|
|
|
//self.immune_to_check = time + 4;
|
|
|
|
|
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if ((p.cutf_items & CUTF_SPY_KIT) && p.undercover_skin != 0)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
p.skin = p.undercover_skin;
|
|
|
|
|
else
|
|
|
|
|
p.skin = p.playerclass;
|
|
|
|
|
|
2001-07-20 08:38:54 +00:00
|
|
|
|
st = "base"; // just in case
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (p.skin != PC_UNDEFINED) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
//WK Figure out what Mr.Custom Should look like
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (p.playerclass == PC_CUSTOM && p.undercover_skin == 0)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
p.skin = Return_Custom_Skins(p); //CH
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if ( p.team_no == 4) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if ( p.skin == PC_SCOUT )
|
|
|
|
|
st = TEAM4_SCOUT_SKIN;
|
|
|
|
|
else if ( p.skin == PC_SNIPER )
|
|
|
|
|
st = TEAM4_SNIPER_SKIN;
|
|
|
|
|
else if ( p.skin == PC_SOLDIER )
|
|
|
|
|
st = TEAM4_SOLDIER_SKIN;
|
|
|
|
|
else if ( p.skin == PC_DEMOMAN )
|
|
|
|
|
st = TEAM4_DEMOMAN_SKIN;
|
|
|
|
|
else if ( p.skin == PC_MEDIC )
|
|
|
|
|
st = TEAM4_MEDIC_SKIN;
|
|
|
|
|
else if ( p.skin == PC_HVYWEAP )
|
|
|
|
|
st = TEAM4_HVYWEAP_SKIN;
|
|
|
|
|
else if ( p.skin == PC_PYRO )
|
|
|
|
|
st = TEAM4_PYRO_SKIN;
|
|
|
|
|
else if ( p.skin == PC_SPY )
|
|
|
|
|
st = TEAM4_SPY_SKIN;
|
|
|
|
|
else if ( p.skin == PC_ENGINEER )
|
|
|
|
|
st = TEAM4_ENGINEER_SKIN;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if ( p.team_no == 3) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if ( p.skin == PC_SCOUT )
|
|
|
|
|
st = TEAM3_SCOUT_SKIN;
|
|
|
|
|
else if ( p.skin == PC_SNIPER )
|
|
|
|
|
st = TEAM3_SNIPER_SKIN;
|
|
|
|
|
else if ( p.skin == PC_SOLDIER )
|
|
|
|
|
st = TEAM3_SOLDIER_SKIN;
|
|
|
|
|
else if ( p.skin == PC_DEMOMAN )
|
|
|
|
|
st = TEAM3_DEMOMAN_SKIN;
|
|
|
|
|
else if ( p.skin == PC_MEDIC )
|
|
|
|
|
st = TEAM3_MEDIC_SKIN;
|
|
|
|
|
else if ( p.skin == PC_HVYWEAP )
|
|
|
|
|
st = TEAM3_HVYWEAP_SKIN;
|
|
|
|
|
else if ( p.skin == PC_PYRO )
|
|
|
|
|
st = TEAM3_PYRO_SKIN;
|
|
|
|
|
else if ( p.skin == PC_SPY )
|
|
|
|
|
st = TEAM3_SPY_SKIN;
|
|
|
|
|
else if ( p.skin == PC_ENGINEER )
|
|
|
|
|
st = TEAM3_ENGINEER_SKIN;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if ( p.team_no == 2) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if ( p.skin == PC_SCOUT )
|
|
|
|
|
st = TEAM2_SCOUT_SKIN;
|
|
|
|
|
else if ( p.skin == PC_SNIPER )
|
|
|
|
|
st = TEAM2_SNIPER_SKIN;
|
|
|
|
|
else if ( p.skin == PC_SOLDIER )
|
|
|
|
|
st = TEAM2_SOLDIER_SKIN;
|
|
|
|
|
else if ( p.skin == PC_DEMOMAN )
|
|
|
|
|
st = TEAM2_DEMOMAN_SKIN;
|
|
|
|
|
else if ( p.skin == PC_MEDIC )
|
|
|
|
|
st = TEAM2_MEDIC_SKIN;
|
|
|
|
|
else if ( p.skin == PC_HVYWEAP )
|
|
|
|
|
st = TEAM2_HVYWEAP_SKIN;
|
|
|
|
|
else if ( p.skin == PC_PYRO )
|
|
|
|
|
st = TEAM2_PYRO_SKIN;
|
|
|
|
|
else if ( p.skin == PC_SPY )
|
|
|
|
|
st = TEAM2_SPY_SKIN;
|
|
|
|
|
else if ( p.skin == PC_ENGINEER )
|
|
|
|
|
st = TEAM2_ENGINEER_SKIN;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else { // if ( p.team_no == 1)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if ( p.skin == PC_SCOUT )
|
|
|
|
|
st = TEAM1_SCOUT_SKIN;
|
|
|
|
|
else if ( p.skin == PC_SNIPER )
|
|
|
|
|
st = TEAM1_SNIPER_SKIN;
|
|
|
|
|
else if ( p.skin == PC_SOLDIER )
|
|
|
|
|
st = TEAM1_SOLDIER_SKIN;
|
|
|
|
|
else if ( p.skin == PC_DEMOMAN )
|
|
|
|
|
st = TEAM1_DEMOMAN_SKIN;
|
|
|
|
|
else if ( p.skin == PC_MEDIC )
|
|
|
|
|
st = TEAM1_MEDIC_SKIN;
|
|
|
|
|
else if ( p.skin == PC_HVYWEAP )
|
|
|
|
|
st = TEAM1_HVYWEAP_SKIN;
|
|
|
|
|
else if ( p.skin == PC_PYRO )
|
|
|
|
|
st = TEAM1_PYRO_SKIN;
|
|
|
|
|
else if ( p.skin == PC_SPY )
|
|
|
|
|
st = TEAM1_SPY_SKIN;
|
|
|
|
|
else if ( p.skin == PC_ENGINEER )
|
|
|
|
|
st = TEAM1_ENGINEER_SKIN;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if ( p.skin == PC_CIVILIAN )
|
2001-11-07 05:05:14 +00:00
|
|
|
|
st = "base"; // Need a civilian skin
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
2001-07-20 08:38:54 +00:00
|
|
|
|
stuffcmd(p, "skin ");
|
|
|
|
|
stuffcmd(p, st);
|
|
|
|
|
stuffcmd(p, "\n");
|
|
|
|
|
setinfokey(p, "skin", st);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Set the details of a player based on his/her class
|
|
|
|
|
void() TeamFortress_SetEquipment =
|
|
|
|
|
{
|
|
|
|
|
local entity te;
|
|
|
|
|
local entity automan;
|
|
|
|
|
local float kept_items;
|
2001-07-24 20:54:19 +00:00
|
|
|
|
local float tc, tc2;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
if (self.classname != "player")
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
//- OfN Hack to solve monster cleanup when soldier is choosen
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.playerclass == PC_SOLDIER) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (!(self.job & JOB_ARMY))
|
2001-07-17 05:58:10 +00:00
|
|
|
|
kill_my_demon();
|
|
|
|
|
}
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
kept_items = self.tf_items & (IT_KEY1 | IT_KEY2);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.playerclass != PC_CUSTOM) { //WK -----v
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.items = 0;
|
|
|
|
|
self.current_weapon = 0;
|
|
|
|
|
self.weapons_carried = 0;
|
|
|
|
|
|
|
|
|
|
self.armorclass = 0;
|
|
|
|
|
|
|
|
|
|
self.ammo_medikit = 0;
|
|
|
|
|
self.maxammo_medikit = 0;
|
|
|
|
|
self.ammo_detpack = 0;
|
|
|
|
|
self.ammo_c4det = 0;
|
|
|
|
|
self.maxammo_detpack = 0;
|
|
|
|
|
self.items_allowed = 0;
|
|
|
|
|
self.armor_allowed = 0;
|
|
|
|
|
self.gravity = 1;
|
|
|
|
|
self.maxarmor = 0;
|
|
|
|
|
self.weaponmode = 0;
|
|
|
|
|
self.tf_items = 0;
|
|
|
|
|
self.tf_items_flags = 0;
|
|
|
|
|
self.cutf_items = 0;
|
|
|
|
|
self.done_custom = 0;
|
|
|
|
|
|
|
|
|
|
//Clear job without losing track of demons, etc.
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.job = self.job - (self.job & JOB_ALL);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
//WK ------^
|
|
|
|
|
|
|
|
|
|
self.hover_time = 0;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.tf_items & NIT_HOVER_BOOTS)
|
|
|
|
|
self.hover_time = MAX_HOVER_FUEL; //10 secs of hovering or so
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.respawn_time = 0;
|
|
|
|
|
self.heat = 0;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.tfstate = self.tfstate - (self.tfstate & TFSTATE_RELOADING);
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.tf_items & NIT_SCUBA) { //WK We're a scuba commando!
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.items = self.items | IT_SUIT;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.rad_time = 1;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.tfstate = self.tfstate | TFSTATE_RADSUIT;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.radsuit_finished = time + 666;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.tfstate = self.tfstate - (self.tfstate & TFSTATE_RADSUIT);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.items = 0;
|
|
|
|
|
self.rad_time = 0;
|
|
|
|
|
self.radsuit_finished = 0;
|
|
|
|
|
}
|
|
|
|
|
self.undercover_skin = 0;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.undercover_team != 0) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
makeImmune(self,time + 4);
|
|
|
|
|
//self.immune_to_check = time + 4;
|
|
|
|
|
|
|
|
|
|
self.undercover_team = 0;
|
|
|
|
|
// Set their color
|
2001-07-24 20:54:19 +00:00
|
|
|
|
tc = TeamGetColor (self.team_no) - 1;
|
|
|
|
|
tc2 = TeamGetNiceColor (self.team_no);
|
|
|
|
|
SetPlayerColor (self, tc, tc);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
self.is_building = 0;
|
|
|
|
|
self.is_toffingadet = 0;
|
|
|
|
|
self.is_haxxxoring = 0;
|
|
|
|
|
self.is_detpacking = 0;
|
|
|
|
|
self.is_undercover = 0;
|
|
|
|
|
self.is_feigning = 0;
|
|
|
|
|
self.is_unabletospy = 0;
|
|
|
|
|
self.is_malfunctioning = 0;
|
|
|
|
|
self.is_abouttodie = 0; // reset preventing automartyr flag
|
|
|
|
|
|
|
|
|
|
self.martyr_enemy = self; // reset martyr enemy
|
|
|
|
|
self.stored_deathmsg = 0; // reset stored death message - OfN UNUSED?
|
|
|
|
|
|
|
|
|
|
self.impulse = 0;
|
|
|
|
|
|
|
|
|
|
if (self.team_no == 0)
|
|
|
|
|
self.lives = -1;
|
|
|
|
|
|
|
|
|
|
self.items = self.items | kept_items;
|
|
|
|
|
|
|
|
|
|
// Start the Cheat-Checking Cyclic Event if CheatChecking Toggleflag is on
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (!stof(infokey(NIL,"nospeed")) && (toggleflags&TFLAG_CHEATCHECK)) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
te = spawn(); //Cyto
|
|
|
|
|
te.nextthink = time + 2;
|
|
|
|
|
te.think = TeamFortress_CheckForSpeed;
|
|
|
|
|
te.owner = self;
|
|
|
|
|
te.classname = "timer";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//WK -- Remove flags for job state
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.job = self.job - (self.job & JOB_ACTIVE);
|
|
|
|
|
self.job = self.job - (self.job & JOB_FULL_HIDE);
|
|
|
|
|
self.job = self.job - (self.job & JOB_TIRED);
|
2002-09-08 01:44:11 +00:00
|
|
|
|
// self.job = self.job - (self.job & JOB_MARTYR_ENEMY);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.job_finished = time;
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if ( self.playerclass == PC_CUSTOM ) { //WK - Reset the custom class
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.no_grenades_1 = GetMaxGrens(self,1);
|
|
|
|
|
self.no_grenades_2 = GetMaxGrens(self,2);
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
/*
|
|
|
|
|
if (self.tp_grenades_1 > 0)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.no_grenades_1 = 4;//was 4 //- OfN - returned to 4, it was 5
|
|
|
|
|
if (self.tp_grenades_2 > 0)
|
|
|
|
|
self.no_grenades_2 = 4;// was 4 //- OfN - returned to 4, it was 5
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.tp_grenades_2 == GR_TYPE_NAIL)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.no_grenades_2 = 2;// was 1
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.tp_grenades_2 == GR_TYPE_FRAG)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.no_grenades_2 = 3;// was 1
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.tp_grenades_2 == GR_TYPE_MIRV)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.no_grenades_2 = 2;// was 1
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.tp_grenades_2 == GR_TYPE_FLARE)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.no_grenades_2 = 6;
|
|
|
|
|
|
|
|
|
|
// Ofn
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.tp_grenades_1 == GR_TYPE_NAIL)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.no_grenades_1 = 2;// was 1
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.tp_grenades_1 == GR_TYPE_FRAG)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.no_grenades_1 = 3;// was 1
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.tp_grenades_1 == GR_TYPE_MIRV)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.no_grenades_1 = 2;// was 1
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.tp_grenades_1 == GR_TYPE_FLARE)
|
2002-09-08 01:44:11 +00:00
|
|
|
|
self.no_grenades_1 = 6;
|
|
|
|
|
*/
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.tf_items & NIT_AMMO_BANDOLIER) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.ammo_rockets = self.maxammo_rockets / 2;
|
|
|
|
|
self.ammo_nails = (3 * self.maxammo_nails) / 4;
|
|
|
|
|
self.ammo_shells = (3 * self.maxammo_shells) / 4;
|
|
|
|
|
self.ammo_cells = (2 * self.maxammo_cells) / 3;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
/*
|
|
|
|
|
if (self.tp_grenades_1 > 0) //Grant an extra grenade for bandolierians
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.no_grenades_1 = 5;
|
|
|
|
|
if (self.tp_grenades_2 > 0)
|
|
|
|
|
self.no_grenades_2 = 5;
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.tp_grenades_2 == GR_TYPE_NAIL)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.no_grenades_2 = 3;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.tp_grenades_2 == GR_TYPE_FRAG)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.no_grenades_2 = 4;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.tp_grenades_2 == GR_TYPE_MIRV)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.no_grenades_2 = 3;// was 1
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.tp_grenades_2 == GR_TYPE_FLARE)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.no_grenades_2 = 8;
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.tp_grenades_1 == GR_TYPE_NAIL)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.no_grenades_1 = 3;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.tp_grenades_1 == GR_TYPE_FRAG)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.no_grenades_1 = 4;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.tp_grenades_1 == GR_TYPE_MIRV)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.no_grenades_1 = 3;// was 1
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.tp_grenades_1 == GR_TYPE_FLARE)
|
2002-09-08 01:44:11 +00:00
|
|
|
|
self.no_grenades_1 = 8;
|
|
|
|
|
*/
|
|
|
|
|
} else {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.ammo_rockets = self.maxammo_rockets / 4;
|
|
|
|
|
self.ammo_nails = self.maxammo_nails / 2;
|
|
|
|
|
self.ammo_shells = self.maxammo_shells / 2;
|
|
|
|
|
self.ammo_cells = self.maxammo_cells / 2;
|
|
|
|
|
}
|
|
|
|
|
self.ammo_detpack = self.maxammo_detpack;
|
|
|
|
|
self.ammo_c4det = self.maxammo_detpack;
|
|
|
|
|
self.ammo_medikit = self.maxammo_medikit;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.ammo_medikit > 0 && self.weapons_carried & WEAP_MEDIKIT) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
te = spawn();
|
2001-07-23 20:52:47 +00:00
|
|
|
|
te.nextthink = time + PC_MEDIC_REGEN_TIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
te.think = TeamFortress_Regenerate;
|
|
|
|
|
te.owner = self;
|
|
|
|
|
te.classname = "timer";
|
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.cutf_items & CUTF_CYBERAUG) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
te = spawn();
|
2001-07-23 20:52:47 +00:00
|
|
|
|
te.nextthink = time + PC_MEDIC_REGEN_TIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
te.think = TeamFortress_RegenerateCyber;
|
|
|
|
|
te.owner = self;
|
|
|
|
|
te.classname = "timer";
|
|
|
|
|
}
|
|
|
|
|
// SB only need to activate this with skill
|
2002-09-08 01:44:11 +00:00
|
|
|
|
/*
|
|
|
|
|
if (self.job & JOB_THIEF) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
te = spawn();
|
2001-07-23 20:52:47 +00:00
|
|
|
|
te.nextthink = time + PC_SPY_CELL_REGEN_TIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
te.think = TeamFortress_RegenerateCells;
|
|
|
|
|
te.owner = self;
|
|
|
|
|
te.classname = "timer";
|
2002-09-08 01:44:11 +00:00
|
|
|
|
}
|
|
|
|
|
*/
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.cutf_items & CUTF_FULLARMOUR)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.armorvalue = self.maxarmor;
|
|
|
|
|
else
|
|
|
|
|
self.armorvalue = self.maxarmor / 2;
|
|
|
|
|
self.armortype = self.armor_allowed; //Start with red if red's allowed
|
|
|
|
|
self.armorclass = 0; //Default to no special armor type
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.tf_items & NIT_KEVLAR)
|
|
|
|
|
self.armorclass = self.armorclass | AT_SAVESHOT;
|
|
|
|
|
if (self.tf_items & NIT_GEL)
|
|
|
|
|
self.armorclass = self.armorclass | AT_SAVEMELEE;
|
|
|
|
|
if (self.tf_items & NIT_BLAST)
|
|
|
|
|
self.armorclass = self.armorclass | AT_SAVEEXPLOSION;
|
|
|
|
|
if (self.tf_items & NIT_CERAMIC)
|
|
|
|
|
self.armorclass = self.armorclass | AT_SAVEELECTRICITY;
|
|
|
|
|
if (self.tf_items & NIT_ASBESTOS) //Buying flamer gives this
|
|
|
|
|
self.armorclass = self.armorclass | AT_SAVEFIRE;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
//Support for the "Auto" class itemry
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.tf_items & NIT_AUTOSCANNER || self.weapons_carried & WEAP_MEDIKIT || self.tf_items & NIT_AUTOID) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
automan = spawn ();
|
|
|
|
|
automan.classname = "timer";
|
|
|
|
|
automan.nextthink = time + 2;
|
|
|
|
|
automan.think = Autoitem_think;
|
|
|
|
|
automan.owner = self;
|
|
|
|
|
automan.enemy = self;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
self.current_weapon = W_BestWeapon ();
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if ( self.playerclass == PC_SCOUT ) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.weapons_carried = self.weapons_carried | PC_SCOUT_WEAPONS;
|
|
|
|
|
self.ammo_rockets = PC_SCOUT_INITAMMO_ROCKET;
|
|
|
|
|
self.ammo_nails = PC_SCOUT_INITAMMO_NAIL;
|
|
|
|
|
self.ammo_shells = PC_SCOUT_INITAMMO_SHOT;
|
|
|
|
|
self.ammo_cells = PC_SCOUT_INITAMMO_CELL;
|
|
|
|
|
self.maxammo_rockets = PC_SCOUT_MAXAMMO_ROCKET;
|
|
|
|
|
self.maxammo_nails = PC_SCOUT_MAXAMMO_NAIL;
|
|
|
|
|
self.maxammo_shells = PC_SCOUT_MAXAMMO_SHOT;
|
|
|
|
|
self.maxammo_cells = PC_SCOUT_MAXAMMO_CELL;
|
|
|
|
|
|
|
|
|
|
self.no_grenades_1 = PC_SCOUT_GRENADE_INIT_1;
|
|
|
|
|
self.no_grenades_2 = PC_SCOUT_GRENADE_INIT_2;
|
|
|
|
|
self.tp_grenades_1 = PC_SCOUT_GRENADE_TYPE_1;
|
|
|
|
|
self.tp_grenades_2 = PC_SCOUT_GRENADE_TYPE_2;
|
|
|
|
|
self.tf_items = PC_SCOUT_TF_ITEMS;
|
|
|
|
|
self.cutf_items = PC_SCOUT_CUTFITEMS;
|
|
|
|
|
self.job = self.job | PC_SCOUT_JOB;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
// the scanner defaults to enemy scanning ON, friendly scanning OFF
|
|
|
|
|
// and movement scanner only OFF
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.tf_items_flags = self.tf_items_flags | NIT_SCANNER_ENEMY;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.armorclass = self.armorclass | PC_SCOUT_INITARMORCLASS;
|
|
|
|
|
self.armortype = PC_SCOUT_INITARMORTYPE;
|
|
|
|
|
self.armorvalue = PC_SCOUT_INITARMOR;
|
|
|
|
|
self.armor_allowed = PC_SCOUT_MAXARMORTYPE;
|
|
|
|
|
self.maxarmor = PC_SCOUT_MAXARMOR;
|
|
|
|
|
self.current_weapon = WEAP_NAILGUN;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.items_allowed = PC_SCOUT_WEAPONS;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
kill_my_demon();
|
|
|
|
|
|
|
|
|
|
// set the weapon icons on the status bar
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.items = self.items | IT_SHOTGUN | IT_NAILGUN;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if ( self.playerclass == PC_SNIPER ) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.weapons_carried = self.weapons_carried | PC_SNIPER_WEAPONS;
|
|
|
|
|
self.ammo_rockets = PC_SNIPER_INITAMMO_ROCKET;
|
|
|
|
|
self.ammo_nails = PC_SNIPER_INITAMMO_NAIL;
|
|
|
|
|
self.ammo_shells = PC_SNIPER_INITAMMO_SHOT;
|
|
|
|
|
self.ammo_cells = PC_SNIPER_INITAMMO_CELL;
|
|
|
|
|
self.maxammo_rockets = PC_SNIPER_MAXAMMO_ROCKET;
|
|
|
|
|
self.maxammo_nails = PC_SNIPER_MAXAMMO_NAIL;
|
|
|
|
|
self.maxammo_shells = PC_SNIPER_MAXAMMO_SHOT;
|
|
|
|
|
self.maxammo_cells = PC_SNIPER_MAXAMMO_CELL;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.no_grenades_1 = PC_SNIPER_GRENADE_INIT_1;
|
|
|
|
|
self.no_grenades_2 = PC_SNIPER_GRENADE_INIT_2;
|
|
|
|
|
self.tp_grenades_1 = PC_SNIPER_GRENADE_TYPE_1;
|
|
|
|
|
self.tp_grenades_2 = PC_SNIPER_GRENADE_TYPE_2;
|
|
|
|
|
self.tf_items = PC_SNIPER_TF_ITEMS;
|
|
|
|
|
self.job = self.job | PC_SNIPER_JOB;
|
|
|
|
|
|
|
|
|
|
self.armorclass = self.armorclass | PC_SNIPER_INITARMORCLASS;
|
|
|
|
|
self.armortype = PC_SNIPER_INITARMORTYPE;
|
|
|
|
|
self.armorvalue = PC_SNIPER_INITARMOR;
|
|
|
|
|
self.armor_allowed = PC_SNIPER_MAXARMORTYPE;
|
|
|
|
|
self.maxarmor = PC_SNIPER_MAXARMOR;
|
|
|
|
|
self.current_weapon = WEAP_SNIPER_RIFLE;
|
|
|
|
|
|
|
|
|
|
self.items_allowed = PC_SNIPER_WEAPONS;
|
|
|
|
|
self.cutf_items = PC_SNIPER_CUTF_ITEMS; // OFN -OTR
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
// set the weapon icons on the status bar
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.items = self.items | IT_SHOTGUN | IT_SUPER_SHOTGUN | IT_NAILGUN;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
kill_my_demon();
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if ( self.playerclass == PC_SOLDIER ) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.weapons_carried = self.weapons_carried | PC_SOLDIER_WEAPONS;
|
|
|
|
|
self.ammo_rockets = PC_SOLDIER_INITAMMO_ROCKET;
|
|
|
|
|
self.ammo_nails = PC_SOLDIER_INITAMMO_NAIL;
|
|
|
|
|
self.ammo_shells = PC_SOLDIER_INITAMMO_SHOT;
|
|
|
|
|
self.ammo_cells = PC_SOLDIER_INITAMMO_CELL;
|
|
|
|
|
self.maxammo_rockets = PC_SOLDIER_MAXAMMO_ROCKET;
|
|
|
|
|
self.maxammo_nails = PC_SOLDIER_MAXAMMO_NAIL;
|
|
|
|
|
self.maxammo_shells = PC_SOLDIER_MAXAMMO_SHOT;
|
|
|
|
|
self.maxammo_cells = PC_SOLDIER_MAXAMMO_CELL;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.no_grenades_1 = PC_SOLDIER_GRENADE_INIT_1;
|
|
|
|
|
self.no_grenades_2 = PC_SOLDIER_GRENADE_INIT_2;
|
|
|
|
|
self.tp_grenades_1 = PC_SOLDIER_GRENADE_TYPE_1;
|
|
|
|
|
self.tp_grenades_2 = PC_SOLDIER_GRENADE_TYPE_2;
|
|
|
|
|
self.tf_items = PC_SOLDIER_TF_ITEMS;
|
|
|
|
|
self.job = self.job | PC_SOLDIER_JOB;
|
|
|
|
|
|
|
|
|
|
self.armorclass = self.armorclass | PC_SOLDIER_INITARMORCLASS;
|
|
|
|
|
self.armortype = PC_SOLDIER_INITARMORTYPE;
|
|
|
|
|
self.armorvalue = PC_SOLDIER_INITARMOR;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
self.armor_allowed = PC_SOLDIER_MAXARMORTYPE;
|
|
|
|
|
self.maxarmor = PC_SOLDIER_MAXARMOR;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.current_weapon = WEAP_ROCKET_LAUNCHER;
|
|
|
|
|
|
|
|
|
|
self.items_allowed = PC_SOLDIER_WEAPONS;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
// set the weapon icons on the status bar
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.items = self.items | IT_SHOTGUN | IT_SUPER_SHOTGUN | IT_ROCKET_LAUNCHER;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
// kill_my_demon();
|
|
|
|
|
} else if ( self.playerclass == PC_DEMOMAN ) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.weapons_carried = self.weapons_carried | PC_DEMOMAN_WEAPONS;
|
|
|
|
|
self.ammo_rockets = PC_DEMOMAN_INITAMMO_ROCKET;
|
|
|
|
|
self.ammo_nails = PC_DEMOMAN_INITAMMO_NAIL;
|
|
|
|
|
self.ammo_shells = PC_DEMOMAN_INITAMMO_SHOT;
|
|
|
|
|
self.ammo_cells = PC_DEMOMAN_INITAMMO_CELL;
|
|
|
|
|
self.maxammo_rockets = PC_DEMOMAN_MAXAMMO_ROCKET;
|
|
|
|
|
self.maxammo_nails = PC_DEMOMAN_MAXAMMO_NAIL;
|
|
|
|
|
self.maxammo_shells = PC_DEMOMAN_MAXAMMO_SHOT;
|
|
|
|
|
self.maxammo_cells = PC_DEMOMAN_MAXAMMO_CELL;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.no_grenades_1 = PC_DEMOMAN_GRENADE_INIT_1;
|
|
|
|
|
self.no_grenades_2 = PC_DEMOMAN_GRENADE_INIT_2;
|
|
|
|
|
self.tp_grenades_1 = PC_DEMOMAN_GRENADE_TYPE_1;
|
|
|
|
|
self.tp_grenades_2 = PC_DEMOMAN_GRENADE_TYPE_2;
|
|
|
|
|
self.tf_items = PC_DEMOMAN_TF_ITEMS;
|
|
|
|
|
self.job = self.job | PC_DEMOMAN_JOB;
|
|
|
|
|
self.cutf_items = PC_DEMOMAN_CUTFITEMS;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
// Detpacks
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.ammo_detpack = PC_DEMOMAN_INITAMMO_DETPACK;
|
|
|
|
|
self.maxammo_detpack = PC_DEMOMAN_MAXAMMO_DETPACK;
|
|
|
|
|
|
|
|
|
|
self.armorclass = self.armorclass | PC_DEMOMAN_INITARMORCLASS;
|
|
|
|
|
self.armortype = PC_DEMOMAN_INITARMORTYPE;
|
|
|
|
|
self.armorvalue = PC_DEMOMAN_INITARMOR;
|
|
|
|
|
self.armor_allowed = PC_DEMOMAN_MAXARMORTYPE;
|
|
|
|
|
self.maxarmor = PC_DEMOMAN_MAXARMOR;
|
|
|
|
|
self.current_weapon = WEAP_GRENADE_LAUNCHER;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
kill_my_demon();
|
|
|
|
|
|
|
|
|
|
self.ammo_c4det = 1; // - OfN
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.items_allowed = PC_DEMOMAN_WEAPONS;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
// set the weapon icons on the status bar
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.items = self.items | IT_SHOTGUN | IT_GRENADE_LAUNCHER;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if ( self.playerclass == PC_MEDIC ) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.weapons_carried = self.weapons_carried | PC_MEDIC_WEAPONS;
|
|
|
|
|
self.ammo_rockets = PC_MEDIC_INITAMMO_ROCKET;
|
|
|
|
|
self.ammo_nails = PC_MEDIC_INITAMMO_NAIL;
|
|
|
|
|
self.ammo_shells = PC_MEDIC_INITAMMO_SHOT;
|
|
|
|
|
self.ammo_cells = PC_MEDIC_INITAMMO_CELL;
|
|
|
|
|
self.maxammo_rockets = PC_MEDIC_MAXAMMO_ROCKET;
|
|
|
|
|
self.maxammo_nails = PC_MEDIC_MAXAMMO_NAIL;
|
|
|
|
|
self.maxammo_shells = PC_MEDIC_MAXAMMO_SHOT;
|
|
|
|
|
self.maxammo_cells = PC_MEDIC_MAXAMMO_CELL;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.no_grenades_1 = PC_MEDIC_GRENADE_INIT_1;
|
|
|
|
|
self.no_grenades_2 = PC_MEDIC_GRENADE_INIT_2;
|
|
|
|
|
self.tp_grenades_1 = PC_MEDIC_GRENADE_TYPE_1;
|
|
|
|
|
self.tp_grenades_2 = PC_MEDIC_GRENADE_TYPE_2;
|
|
|
|
|
self.tf_items = PC_MEDIC_TF_ITEMS;
|
|
|
|
|
self.job = self.job | PC_MEDIC_JOB;
|
|
|
|
|
|
|
|
|
|
self.armorclass = self.armorclass | PC_MEDIC_INITARMORCLASS;
|
|
|
|
|
self.armortype = PC_MEDIC_INITARMORTYPE;
|
|
|
|
|
self.armorvalue = PC_MEDIC_INITARMOR;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
self.armor_allowed = PC_MEDIC_MAXARMORTYPE;
|
|
|
|
|
self.maxarmor = PC_MEDIC_MAXARMOR;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.current_weapon = WEAP_LIGHT_ASSAULT;
|
|
|
|
|
|
|
|
|
|
self.ammo_medikit = PC_MEDIC_INITAMMO_MEDIKIT;
|
|
|
|
|
self.maxammo_medikit = PC_MEDIC_MAXAMMO_MEDIKIT;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
// Start the Regeneration Cyclic Event
|
|
|
|
|
te = spawn();
|
2001-07-23 20:52:47 +00:00
|
|
|
|
te.nextthink = time + PC_MEDIC_REGEN_TIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
te.think = TeamFortress_Regenerate;
|
|
|
|
|
te.owner = self;
|
|
|
|
|
te.classname = "timer";
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.items_allowed = PC_MEDIC_WEAPONS;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
// set the weapon icons on the status bar
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.items = self.items | IT_SHOTGUN | IT_SUPER_SHOTGUN | IT_LIGHT_ASSAULT;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
kill_my_demon();
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if ( self.playerclass == PC_HVYWEAP ) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.weapons_carried = self.weapons_carried | PC_HVYWEAP_WEAPONS;
|
|
|
|
|
self.ammo_rockets = PC_HVYWEAP_INITAMMO_ROCKET;
|
|
|
|
|
self.ammo_nails = PC_HVYWEAP_INITAMMO_NAIL;
|
|
|
|
|
self.ammo_shells = PC_HVYWEAP_INITAMMO_SHOT;
|
|
|
|
|
self.ammo_cells = PC_HVYWEAP_INITAMMO_CELL;
|
|
|
|
|
self.maxammo_rockets = PC_HVYWEAP_MAXAMMO_ROCKET;
|
|
|
|
|
self.maxammo_nails = PC_HVYWEAP_MAXAMMO_NAIL;
|
|
|
|
|
self.maxammo_shells = PC_HVYWEAP_MAXAMMO_SHOT;
|
|
|
|
|
self.maxammo_cells = PC_HVYWEAP_MAXAMMO_CELL;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.no_grenades_1 = PC_HVYWEAP_GRENADE_INIT_1;
|
|
|
|
|
self.no_grenades_2 = PC_HVYWEAP_GRENADE_INIT_2;
|
|
|
|
|
self.tp_grenades_1 = PC_HVYWEAP_GRENADE_TYPE_1;
|
|
|
|
|
self.tp_grenades_2 = PC_HVYWEAP_GRENADE_TYPE_2;
|
|
|
|
|
self.tf_items = PC_HVYWEAP_TF_ITEMS;
|
|
|
|
|
self.job = self.job | PC_HVYWEAP_JOB;
|
|
|
|
|
|
|
|
|
|
self.armorclass = self.armorclass | PC_HVYWEAP_INITARMORCLASS;
|
|
|
|
|
self.armortype = PC_HVYWEAP_INITARMORTYPE;
|
|
|
|
|
self.armorvalue = PC_HVYWEAP_INITARMOR;
|
|
|
|
|
self.armor_allowed = PC_HVYWEAP_MAXARMORTYPE;
|
|
|
|
|
self.maxarmor = PC_HVYWEAP_MAXARMOR;
|
|
|
|
|
self.current_weapon = WEAP_SUPER_SHOTGUN;
|
|
|
|
|
self.cutf_items = CUTF_HWGUY;
|
|
|
|
|
|
|
|
|
|
self.items_allowed = PC_HVYWEAP_WEAPONS;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
// set the weapon icons on the status bar
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.items = self.items | IT_SHOTGUN | IT_SUPER_SHOTGUN | IT_ROCKET_LAUNCHER;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
kill_my_demon();
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if ( self.playerclass == PC_PYRO ) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.weapons_carried = self.weapons_carried | PC_PYRO_WEAPONS;
|
|
|
|
|
self.ammo_rockets = PC_PYRO_INITAMMO_ROCKET;
|
|
|
|
|
self.ammo_nails = PC_PYRO_INITAMMO_NAIL;
|
|
|
|
|
self.ammo_shells = PC_PYRO_INITAMMO_SHOT;
|
|
|
|
|
self.ammo_cells = PC_PYRO_INITAMMO_CELL;
|
|
|
|
|
self.maxammo_rockets = PC_PYRO_MAXAMMO_ROCKET;
|
|
|
|
|
self.maxammo_nails = PC_PYRO_MAXAMMO_NAIL;
|
|
|
|
|
self.maxammo_shells = PC_PYRO_MAXAMMO_SHOT;
|
|
|
|
|
self.maxammo_cells = PC_PYRO_MAXAMMO_CELL;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.no_grenades_1 = PC_PYRO_GRENADE_INIT_1;
|
|
|
|
|
self.no_grenades_2 = PC_PYRO_GRENADE_INIT_2;
|
|
|
|
|
self.tp_grenades_1 = PC_PYRO_GRENADE_TYPE_1;
|
|
|
|
|
self.tp_grenades_2 = PC_PYRO_GRENADE_TYPE_2;
|
|
|
|
|
self.tf_items = PC_PYRO_TF_ITEMS;
|
|
|
|
|
self.job = self.job | PC_PYRO_JOB;
|
|
|
|
|
|
|
|
|
|
self.armorclass = self.armorclass | PC_PYRO_INITARMORCLASS;
|
|
|
|
|
self.armortype = PC_PYRO_INITARMORTYPE;
|
|
|
|
|
self.armorvalue = PC_PYRO_INITARMOR;
|
|
|
|
|
self.armor_allowed = PC_PYRO_MAXARMORTYPE;
|
|
|
|
|
self.maxarmor = PC_PYRO_MAXARMOR;
|
|
|
|
|
self.current_weapon = WEAP_FLAMETHROWER;
|
|
|
|
|
self.items_allowed = PC_PYRO_WEAPONS;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
kill_my_demon();
|
|
|
|
|
|
|
|
|
|
// set the weapon icons on the status bar
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.items = self.items | IT_SHOTGUN | IT_GRENADE_LAUNCHER | IT_ROCKET_LAUNCHER;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if ( self.playerclass == PC_CIVILIAN ) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.weapons_carried = self.weapons_carried | PC_CIVILIAN_WEAPONS;
|
|
|
|
|
self.ammo_rockets = PC_CIVILIAN_INITAMMO_ROCKET;
|
|
|
|
|
self.ammo_nails = PC_CIVILIAN_INITAMMO_NAIL;
|
|
|
|
|
self.ammo_shells = PC_CIVILIAN_INITAMMO_SHOT;
|
|
|
|
|
self.ammo_cells = PC_CIVILIAN_INITAMMO_CELL;
|
|
|
|
|
self.maxammo_rockets = PC_CIVILIAN_MAXAMMO_ROCKET;
|
|
|
|
|
self.maxammo_nails = PC_CIVILIAN_MAXAMMO_NAIL;
|
|
|
|
|
self.maxammo_shells = PC_CIVILIAN_MAXAMMO_SHOT;
|
|
|
|
|
self.maxammo_cells = PC_CIVILIAN_MAXAMMO_CELL;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.no_grenades_1 = PC_CIVILIAN_GRENADE_INIT_1;
|
|
|
|
|
self.no_grenades_2 = PC_CIVILIAN_GRENADE_INIT_2;
|
|
|
|
|
self.tp_grenades_1 = PC_CIVILIAN_GRENADE_TYPE_1;
|
|
|
|
|
self.tp_grenades_2 = PC_CIVILIAN_GRENADE_TYPE_2;
|
|
|
|
|
self.tf_items = PC_CIVILIAN_TF_ITEMS;
|
|
|
|
|
self.job = self.job | PC_CIVILIAN_JOB;
|
|
|
|
|
|
|
|
|
|
self.armorclass = self.armorclass | PC_CIVILIAN_INITARMORCLASS;
|
|
|
|
|
self.armortype = PC_CIVILIAN_INITARMORTYPE;
|
|
|
|
|
self.armorvalue = PC_CIVILIAN_INITARMOR;
|
|
|
|
|
self.armor_allowed = PC_CIVILIAN_MAXARMORTYPE;
|
|
|
|
|
self.maxarmor = PC_CIVILIAN_MAXARMOR;
|
|
|
|
|
self.current_weapon = WEAP_AXE;
|
|
|
|
|
self.items_allowed = PC_CIVILIAN_WEAPONS;
|
|
|
|
|
self.cutf_items = PC_CIVILIAN_CUTFITEMS;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
// set the weapon icons on the status bar
|
|
|
|
|
self.items = 0;
|
|
|
|
|
kill_my_demon();
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if ( self.playerclass == PC_SPY ) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.weapons_carried = self.weapons_carried | PC_SPY_WEAPONS;
|
|
|
|
|
self.ammo_rockets = PC_SPY_INITAMMO_ROCKET;
|
|
|
|
|
self.ammo_nails = PC_SPY_INITAMMO_NAIL;
|
|
|
|
|
self.ammo_shells = PC_SPY_INITAMMO_SHOT;
|
|
|
|
|
self.ammo_cells = PC_SPY_INITAMMO_CELL;
|
|
|
|
|
self.maxammo_rockets = PC_SPY_MAXAMMO_ROCKET;
|
|
|
|
|
self.maxammo_nails = PC_SPY_MAXAMMO_NAIL;
|
|
|
|
|
self.maxammo_shells = PC_SPY_MAXAMMO_SHOT;
|
|
|
|
|
self.maxammo_cells = PC_SPY_MAXAMMO_CELL;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.no_grenades_1 = PC_SPY_GRENADE_INIT_1;
|
|
|
|
|
self.no_grenades_2 = PC_SPY_GRENADE_INIT_2;
|
|
|
|
|
self.tp_grenades_1 = PC_SPY_GRENADE_TYPE_1;
|
|
|
|
|
self.tp_grenades_2 = PC_SPY_GRENADE_TYPE_2;
|
|
|
|
|
self.tf_items = PC_SPY_TF_ITEMS;
|
|
|
|
|
self.job = self.job | PC_SPY_JOB;
|
|
|
|
|
|
|
|
|
|
self.armorclass = self.armorclass | PC_SPY_INITARMORCLASS;
|
|
|
|
|
self.armortype = PC_SPY_INITARMORTYPE;
|
|
|
|
|
self.armorvalue = PC_SPY_INITARMOR;
|
|
|
|
|
self.armor_allowed = PC_SPY_MAXARMORTYPE;
|
|
|
|
|
self.maxarmor = PC_SPY_MAXARMOR;
|
|
|
|
|
self.current_weapon = WEAP_TRANQ;
|
|
|
|
|
self.items_allowed = PC_SPY_WEAPONS;
|
|
|
|
|
self.cutf_items = PC_SPY_CUTFITEMS;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
// set the weapon icons on the status bar
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.items = self.items | IT_SHOTGUN | IT_SUPER_SHOTGUN | IT_NAILGUN;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
// If the Spy only has invis, start the Spy's cell regen timer
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (invis_only == TRUE) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
te = spawn();
|
2001-07-23 20:52:47 +00:00
|
|
|
|
te.nextthink = time + PC_SPY_CELL_REGEN_TIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
te.think = TeamFortress_RegenerateCells;
|
|
|
|
|
te.owner = self;
|
|
|
|
|
te.classname = "timer";
|
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if ( self.playerclass == PC_ENGINEER ) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.weapons_carried = self.weapons_carried | PC_ENGINEER_WEAPONS;
|
|
|
|
|
self.ammo_rockets = PC_ENGINEER_INITAMMO_ROCKET;
|
|
|
|
|
self.ammo_nails = PC_ENGINEER_INITAMMO_NAIL;
|
|
|
|
|
self.ammo_shells = PC_ENGINEER_INITAMMO_SHOT;
|
|
|
|
|
self.ammo_cells = PC_ENGINEER_INITAMMO_CELL;
|
|
|
|
|
self.maxammo_rockets = PC_ENGINEER_MAXAMMO_ROCKET;
|
|
|
|
|
self.maxammo_nails = PC_ENGINEER_MAXAMMO_NAIL;
|
|
|
|
|
self.maxammo_shells = PC_ENGINEER_MAXAMMO_SHOT;
|
|
|
|
|
self.maxammo_cells = PC_ENGINEER_MAXAMMO_CELL;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.no_grenades_1 = PC_ENGINEER_GRENADE_INIT_1;
|
|
|
|
|
self.no_grenades_2 = PC_ENGINEER_GRENADE_INIT_2;
|
|
|
|
|
self.tp_grenades_1 = PC_ENGINEER_GRENADE_TYPE_1;
|
|
|
|
|
self.tp_grenades_2 = PC_ENGINEER_GRENADE_TYPE_2;
|
|
|
|
|
self.tf_items = PC_ENGINEER_TF_ITEMS;
|
|
|
|
|
self.job = self.job | PC_ENGINEER_JOB;
|
|
|
|
|
|
|
|
|
|
self.armorclass = self.armorclass | PC_ENGINEER_INITARMORCLASS;
|
|
|
|
|
self.armortype = PC_ENGINEER_INITARMORTYPE;
|
|
|
|
|
self.armorvalue = PC_ENGINEER_INITARMOR;
|
|
|
|
|
self.armor_allowed = PC_ENGINEER_MAXARMORTYPE;
|
|
|
|
|
self.maxarmor = PC_ENGINEER_MAXARMOR;
|
|
|
|
|
self.current_weapon = WEAP_LASER;
|
|
|
|
|
self.items_allowed = PC_ENGINEER_WEAPONS;
|
|
|
|
|
self.cutf_items = PC_ENGINEER_CUTFITEMS;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
// set the weapon icons on the status bar
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.items = self.items | IT_SHOTGUN | IT_SUPER_SHOTGUN;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
kill_my_demon();
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if ( self.playerclass == PC_UNDEFINED ) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.items = 0;
|
|
|
|
|
self.ammo_rockets = 0;
|
|
|
|
|
self.ammo_nails = 0;
|
|
|
|
|
self.ammo_shells = 0;
|
|
|
|
|
self.ammo_cells = 0;
|
|
|
|
|
|
|
|
|
|
self.no_grenades_1 = 0;
|
|
|
|
|
self.no_grenades_2 = 0;
|
|
|
|
|
self.tp_grenades_1 = 0;
|
|
|
|
|
self.tp_grenades_2 = 0;
|
|
|
|
|
|
|
|
|
|
self.armorclass = 0;
|
|
|
|
|
self.armortype = 0;
|
|
|
|
|
self.armorvalue = 0;
|
|
|
|
|
self.weapon = 0;
|
|
|
|
|
self.current_weapon = 0;
|
|
|
|
|
self.weapons_carried = 0;
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.flags = FL_CLIENT | FL_NOTARGET; // | FL_ONGROUND;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.waterlevel = 3;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.takedamage = DAMAGE_NO;
|
|
|
|
|
self.solid = SOLID_NOT;
|
|
|
|
|
self.movetype = MOVETYPE_NOCLIP;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-09-30 22:38:44 +00:00
|
|
|
|
self.model = "";
|
|
|
|
|
self.mdl = "";
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.modelindex = 0;
|
2001-09-30 22:38:44 +00:00
|
|
|
|
self.weaponmodel = "";
|
2001-07-17 05:58:10 +00:00
|
|
|
|
modelindex_player = 0;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.tfstate = self.tfstate | TFSTATE_RELOADING;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-09-30 22:38:44 +00:00
|
|
|
|
setmodel(self, "");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (stock_mode==1) //- OfN - Stock classes don't get a job when stock_mode is 1
|
|
|
|
|
self.job=0;
|
|
|
|
|
|
|
|
|
|
//- OfN - Set initial grens number
|
|
|
|
|
self.no_grenades_1 = GetMaxGrens(self,1);
|
|
|
|
|
self.no_grenades_2 = GetMaxGrens(self,2);
|
|
|
|
|
|
|
|
|
|
//- OfN - Set army timer //
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.job & JOB_ARMY)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
SetArmyTimer();
|
|
|
|
|
|
|
|
|
|
if (no_otr) // if its disabled get it off
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.cutf_items = self.cutf_items - (self.cutf_items & CUTF_OTR);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (no_chaplan)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.job = self.job - (self.job & JOB_CHAPLAN);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
// Give normal classes the hook
|
|
|
|
|
// Custom classes get it in 'drop into custom class gen'
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (allow_hook && self.playerclass != PC_UNDEFINED && self.playerclass != PC_CUSTOM)
|
|
|
|
|
self.weapons_carried = self.weapons_carried | WEAP_HOOK;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
W_SetCurrentAmmo ();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Return the max amount of ammo the Retriever can carry, based on his class
|
|
|
|
|
float(entity Retriever, float AmmoType) TeamFortress_GetMaxAmmo =
|
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (AmmoType == IT_SHELLS)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return Retriever.maxammo_shells;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (AmmoType == IT_NAILS)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return Retriever.maxammo_nails;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (AmmoType == IT_CELLS)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return Retriever.maxammo_cells;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (AmmoType == IT_ROCKETS)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return Retriever.maxammo_rockets;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (AmmoType == WEAP_MEDIKIT)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return Retriever.maxammo_medikit;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if (AmmoType == 131072) //WK Used to be WEAP_DETPACK
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return Retriever.maxammo_detpack;
|
|
|
|
|
|
|
|
|
|
RPrint("Error in TeamFortress_GetMaxAmmo()\n");
|
|
|
|
|
RPrint("Invalid ammo type passed.\n");
|
|
|
|
|
return 0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Return 1 if the Retriever is allowed to pick up the Weapon
|
|
|
|
|
float(entity Retriever, float WeaponType) TeamFortress_CanGetWeapon =
|
|
|
|
|
{
|
|
|
|
|
if ( Retriever.items_allowed & WeaponType )
|
2001-07-23 20:52:47 +00:00
|
|
|
|
return TRUE;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
return FALSE;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Print a string to Player, describing this type of armor
|
|
|
|
|
//CH returns number effected
|
|
|
|
|
float(entity Player, float Armorclass) TeamFortress_DescribeArmor =
|
|
|
|
|
{
|
|
|
|
|
local float num;
|
|
|
|
|
num = 0;
|
|
|
|
|
if (Armorclass == 0)
|
|
|
|
|
return num;
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (Armorclass & AT_SAVEFIRE) {
|
|
|
|
|
sprint (Player, PRINT_HIGH, "Asbestos ");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
num = num + 1;
|
|
|
|
|
}
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (Armorclass & AT_SAVEEXPLOSION) {
|
|
|
|
|
sprint (Player, PRINT_HIGH, "Blast ");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
num = num + 1;
|
|
|
|
|
}
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (Armorclass & AT_SAVEELECTRICITY) {
|
|
|
|
|
sprint (Player, PRINT_HIGH, "Ceramic ");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
num = num + 1;
|
|
|
|
|
}
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (Armorclass & AT_SAVEMELEE) {
|
|
|
|
|
sprint (Player, PRINT_HIGH, "Gel ");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
num = num + 1;
|
|
|
|
|
}
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (Armorclass & AT_SAVESHOT) {
|
|
|
|
|
sprint (Player, PRINT_HIGH, "Kevlar ");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
num = num + 1;
|
|
|
|
|
}
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (Player, PRINT_HIGH, "armor");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return num;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Controls the equipment a class receives from backpacks
|
|
|
|
|
float(entity Retriever, entity Items) TeamFortress_AddBackpackItems =
|
|
|
|
|
{
|
|
|
|
|
// If you want the classes to _not_ start off with all their legal
|
|
|
|
|
// weapons, then you may want them to be able to pick up weapons
|
|
|
|
|
// from backpacks. If so, this is where to do it.
|
|
|
|
|
// For now, return.
|
2001-07-23 05:33:21 +00:00
|
|
|
|
return 0;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Return a string containing the class name for pc
|
|
|
|
|
string(float pc) TeamFortress_GetClassName =
|
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if ( pc == PC_SCOUT )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return "Scout";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( pc == PC_SNIPER )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return "Sniper";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( pc == PC_SOLDIER )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return "Soldier";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( pc == PC_DEMOMAN )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return "Demolitions Man";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( pc == PC_MEDIC )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return "Combat Medic";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( pc == PC_HVYWEAP )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return "Heavy Weapons Guy";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( pc == PC_PYRO )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return "Pyro";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( pc == PC_SPY )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return "Spy";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( pc == PC_ENGINEER )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return "Engineer";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( pc == PC_CIVILIAN )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return "Civilian";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( pc == PC_UNDEFINED )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return "Observer";
|
2002-09-08 01:44:11 +00:00
|
|
|
|
else if ( pc == PC_RANDOM )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return "Random Playerclass";
|
2002-09-08 01:44:11 +00:00
|
|
|
|
else if ( pc == PC_CUSTOM )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return "Custom Playerclass";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Return a string containing the class name for pc
|
|
|
|
|
string(float pc) TeamFortress_GetJobName =
|
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if ( pc & JOB_THIEF )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return "Thief";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( pc & JOB_RUNNER )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return "Runner";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( pc & JOB_WARLOCK )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return "Warlock";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( pc & JOB_CHAPLAN )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return "Combat Chaplan";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( pc & JOB_BERSERKER )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return "Nordish Berserker";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( pc & JOB_GUERILLA )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return "Communist Rebel";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( pc & JOB_JUDOKA )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return "Judo Black Belt";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( pc & JOB_ARMY )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return "Army Member";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( pc & JOB_HACKER )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return "Hacker";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( pc & JOB_MARTYR )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return "Martyr";
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( pc & JOB_CRUSADER )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return "Crusader";
|
|
|
|
|
else
|
|
|
|
|
return "Custom Playerclass";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Display the class of Player to Viewer
|
|
|
|
|
void(entity Viewer, float pc, float rpc) TeamFortress_PrintClassName =
|
|
|
|
|
{
|
|
|
|
|
local string st;
|
|
|
|
|
st = TeamFortress_GetClassName(pc);
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (Viewer, PRINT_HIGH, st);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
if (rpc != 0)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (Viewer, PRINT_HIGH, " (Random)");
|
|
|
|
|
sprint (Viewer, PRINT_HIGH, "\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Display the job of a custom class to Viewer
|
|
|
|
|
void(entity Viewer, float pc) TeamFortress_PrintJobName =
|
|
|
|
|
{
|
|
|
|
|
local string st;
|
|
|
|
|
st = TeamFortress_GetJobName(pc);
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (Viewer, PRINT_HIGH, st);
|
|
|
|
|
sprint (Viewer, PRINT_HIGH, "\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Say the class of Player to him/her
|
|
|
|
|
#ifdef SPEECH
|
|
|
|
|
void(entity player) TeamFortress_SayClassName =
|
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if ( player.playerclass == PC_SCOUT )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
stuffcmd(player, "play speech/scout.wav\n");
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( player.playerclass == PC_SNIPER )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
stuffcmd(player, "play speech/sniper.wav\n");
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( player.playerclass == PC_SOLDIER )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
stuffcmd(player, "play speech/soldier.wav\n");
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( player.playerclass == PC_DEMOMAN )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
stuffcmd(player, "play speech/demoman.wav\n");
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( player.playerclass == PC_MEDIC )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
stuffcmd(player, "play speech/medic.wav\n");
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( player.playerclass == PC_HVYWEAP )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
stuffcmd(player, "play speech/hvyweap.wav\n");
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( player.playerclass == PC_PYRO )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
stuffcmd(player, "play speech/pyro.wav\n");
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( player.playerclass == PC_SPY )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
stuffcmd(player, "play speech/spy.wav\n");
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( player.playerclass == PC_ENGINEER )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
stuffcmd(player, "play speech/engineer.wav\n");
|
2001-07-23 20:52:47 +00:00
|
|
|
|
else if ( player.playerclass == PC_CIVILIAN )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
stuffcmd(player, "play speech/civilian.wav\n");
|
|
|
|
|
};
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Remove all the timers for this player
|
|
|
|
|
// This function is _always_ called when a player dies.
|
|
|
|
|
void() TeamFortress_RemoveTimers =
|
|
|
|
|
{
|
|
|
|
|
local entity te;
|
|
|
|
|
local entity oself;
|
|
|
|
|
|
|
|
|
|
self.leg_damage = 0;
|
|
|
|
|
self.is_undercover = 0;
|
|
|
|
|
self.is_building = 0;
|
2001-11-02 17:00:52 +00:00
|
|
|
|
self.building = NIL;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
//CH
|
|
|
|
|
stuffcmd (self, "throwgren\n"); //Throw any grenades
|
|
|
|
|
stuffcmd (self, "impulse 169\n"); //Stop laying dets
|
|
|
|
|
|
|
|
|
|
// Clear the sniper's aiming
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.tfstate & TFSTATE_AIMING) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.tfstate = self.tfstate - TFSTATE_AIMING;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
TeamFortress_SetSpeed(self);
|
|
|
|
|
self.heat = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Remove all the timer entities for this player
|
2001-11-02 17:00:52 +00:00
|
|
|
|
te = find(NIL, classname, "timer");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
while (te) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
//WK Judokatimer is a little weird
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (te.netname == "judokatimer" && te.think == JudokaRearm) {
|
|
|
|
|
if (te.owner == self || te.enemy == self) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
oself = self;
|
|
|
|
|
self = te;
|
|
|
|
|
self.think();
|
|
|
|
|
self = oself;
|
|
|
|
|
te.think = SUB_Remove;
|
|
|
|
|
te.nextthink = time + 0.1;
|
|
|
|
|
}
|
|
|
|
|
te = find(te, classname, "timer");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (te.owner == self) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
//WK Fix our new little flash timer
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (te.netname == "flashtimer") {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.FlashTime = 0;
|
|
|
|
|
stuffcmd(self, "v_cshift 0\n");
|
|
|
|
|
stuffcmd(self, "r_norefresh 0;wait;echo;wait;echo;wait;echo;wait;echo\n");
|
|
|
|
|
dremove(te);
|
2001-11-02 17:00:52 +00:00
|
|
|
|
te = find(NIL, classname, "timer");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
//WK Support for the curse timer
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (te.netname == "bastardtimer") {
|
|
|
|
|
if (self.has_disconnected == TRUE) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
dremove(te);
|
2001-11-02 17:00:52 +00:00
|
|
|
|
te = find(NIL, classname, "timer");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else
|
2001-07-17 05:58:10 +00:00
|
|
|
|
te = find(te, classname, "timer");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
dremove(te);
|
2001-11-02 17:00:52 +00:00
|
|
|
|
te = find(NIL, classname, "timer");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else
|
2001-07-17 05:58:10 +00:00
|
|
|
|
te = find(te, classname, "timer");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Drop any GoalItems
|
2001-11-02 17:00:52 +00:00
|
|
|
|
te = find (NIL, classname, "item_tfgoal");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
while (te) {
|
|
|
|
|
if (te.owner == self) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
// Remove it from the player, if it is supposed to be
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (!(te.goal_activation & TFGI_KEEP)) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
tfgoalitem_RemoveFromPlayer(te, self, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// CTF support
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (CTF_Map == TRUE && te.goal_no == CTF_FLAG1) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
bprint(PRINT_HIGH, self.netname);
|
|
|
|
|
bprint(PRINT_HIGH, " <20><><EFBFBD><EFBFBD> the <20><><EFBFBD><EFBFBD> flag!\n");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (CTF_Map == TRUE && te.goal_no == CTF_FLAG2) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
bprint(PRINT_HIGH, self.netname);
|
|
|
|
|
bprint(PRINT_HIGH, " <20><><EFBFBD><EFBFBD> the <20><><EFBFBD> flag!\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
te = find(te, classname, "item_tfgoal");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Reset detpacks being disarmed to not being disarmed
|
2001-11-02 17:00:52 +00:00
|
|
|
|
te = find (NIL, classname, "detpack");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
while (te) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if ((te.weaponmode == 1) && (te.enemy == self))
|
|
|
|
|
te.weaponmode = 0;
|
|
|
|
|
te = find(te, classname, "detpack");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// detonate all of the players pipebombs
|
|
|
|
|
TeamFortress_DetonatePipebombs();
|
|
|
|
|
|
|
|
|
|
// OfN Remove holo if player dies!
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.has_holo > 0)
|
|
|
|
|
RemoveHolo(self);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
stuffcmd(self, "v_idlescale 0\n");
|
|
|
|
|
stuffcmd(self, "v_cshift 0 0 0 0\n");
|
|
|
|
|
self.item_list = 0;
|
|
|
|
|
self.FlashTime = 0;
|
|
|
|
|
|
|
|
|
|
// Remove Menu
|
|
|
|
|
CenterPrint(self, "\n");
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.menu_count = MENU_REFRESH_RATE;
|
|
|
|
|
self.current_menu = MENU_DEFAULT;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.impulse = 0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Setup the Respawn delays for this player
|
|
|
|
|
void(float Suicided) TeamFortress_SetupRespawn =
|
|
|
|
|
{
|
2001-09-23 04:25:02 +00:00
|
|
|
|
local float restime;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
local string db;
|
|
|
|
|
|
|
|
|
|
if (self.respawn_time > time)
|
|
|
|
|
return; // already respawning
|
|
|
|
|
|
|
|
|
|
// Setup Respawn Delay
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (toggleflags & TFLAG_RESPAWNDELAY)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
restime = respawn_delay_time;
|
|
|
|
|
else
|
|
|
|
|
restime = 0;
|
|
|
|
|
|
|
|
|
|
// Suiciders can't respawn immediately
|
|
|
|
|
if (Suicided)
|
|
|
|
|
restime = restime + 5;
|
|
|
|
|
|
|
|
|
|
// Remove a life
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.lives > 0 && prematch < time) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.lives = self.lives - 1;
|
|
|
|
|
/* if (self.team_no == 1) team1total = team1total - 1;
|
|
|
|
|
else if (self.team_no == 2) team1total = team2total - 1;
|
|
|
|
|
else if (self.team_no == 3) team1total = team3total - 1;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
else if (self.team_no == 4) team1total = team4total - 1;
|
|
|
|
|
*///- ???
|
|
|
|
|
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.lives != -1) {
|
|
|
|
|
if (self.lives == 0) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
// Move to Observer mode when you die
|
|
|
|
|
PlayerObserverMode();
|
|
|
|
|
//if (livesperguy > 1)
|
|
|
|
|
//{
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "NO lives left, returning to Observer mode.\n");
|
|
|
|
|
bprint (PRINT_MEDIUM, self.netname);
|
|
|
|
|
bprint (PRINT_MEDIUM, " ran out of lives!\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
//}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (self.lives == 1)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "LAST life.\n");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
else {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
db = ftos(self.lives);
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, db);
|
|
|
|
|
sprint (self, PRINT_HIGH, " lives left.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
}//*/// ???
|
|
|
|
|
|
|
|
|
|
// Do this after life calculation, so people without any
|
|
|
|
|
// lives left can respawn back to Observer mode without a delay.
|
|
|
|
|
self.respawn_time = time + restime;
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (restime > 3) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
db = ftos(restime);
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self, PRINT_HIGH, db);
|
|
|
|
|
sprint(self, PRINT_HIGH, " seconds till respawn.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Check all stats to make sure they're good for this class
|
|
|
|
|
void() TeamFortress_CheckClassStats =
|
|
|
|
|
{
|
|
|
|
|
// Check armor
|
|
|
|
|
if (self.armortype > self.armor_allowed)
|
|
|
|
|
self.armortype = self.armor_allowed;
|
|
|
|
|
if (self.armorvalue > self.maxarmor)
|
|
|
|
|
self.armorvalue = self.maxarmor;
|
|
|
|
|
if (self.armortype < 0)
|
|
|
|
|
self.armortype = 0;
|
|
|
|
|
if (self.armorvalue < 0)
|
|
|
|
|
self.armorvalue = 0;
|
|
|
|
|
// Check ammo
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.ammo_shells > TeamFortress_GetMaxAmmo(self,IT_SHELLS))
|
|
|
|
|
self.ammo_shells = TeamFortress_GetMaxAmmo(self,IT_SHELLS);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (self.ammo_shells < 0)
|
|
|
|
|
self.ammo_shells = 0;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.ammo_nails > TeamFortress_GetMaxAmmo(self,IT_NAILS))
|
|
|
|
|
self.ammo_nails = TeamFortress_GetMaxAmmo(self,IT_NAILS);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (self.ammo_nails < 0)
|
|
|
|
|
self.ammo_nails = 0;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.ammo_rockets > TeamFortress_GetMaxAmmo(self,IT_ROCKETS))
|
|
|
|
|
self.ammo_rockets = TeamFortress_GetMaxAmmo(self,IT_ROCKETS);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (self.ammo_rockets < 0)
|
|
|
|
|
self.ammo_rockets = 0;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.ammo_cells > TeamFortress_GetMaxAmmo(self,IT_CELLS))
|
|
|
|
|
self.ammo_cells = TeamFortress_GetMaxAmmo(self,IT_CELLS);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (self.ammo_cells < 0)
|
|
|
|
|
self.ammo_cells = 0;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.ammo_medikit > TeamFortress_GetMaxAmmo(self,WEAP_MEDIKIT))
|
|
|
|
|
self.ammo_medikit = TeamFortress_GetMaxAmmo(self,WEAP_MEDIKIT);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (self.ammo_medikit < 0)
|
|
|
|
|
self.ammo_medikit = 0;
|
|
|
|
|
if (self.ammo_detpack > TeamFortress_GetMaxAmmo(self,131072))
|
|
|
|
|
self.ammo_detpack = TeamFortress_GetMaxAmmo(self,131072);
|
|
|
|
|
if (self.ammo_detpack < 0)
|
|
|
|
|
self.ammo_detpack = 0;
|
|
|
|
|
// Check Grenades
|
|
|
|
|
if (self.no_grenades_1 < 0)
|
|
|
|
|
self.no_grenades_1 = 0;
|
|
|
|
|
if (self.no_grenades_2 < 0)
|
|
|
|
|
self.no_grenades_2 = 0;
|
|
|
|
|
// Check health
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.health > self.max_health && !(self.items & IT_SUPERHEALTH))
|
2001-11-02 17:00:52 +00:00
|
|
|
|
TF_T_Damage (self, NIL, NIL, (self.max_health - self.health), 0, TF_TD_NOSOUND);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (self.health < 0)
|
|
|
|
|
T_Heal(self, (self.health - self.health), 0);
|
|
|
|
|
|
|
|
|
|
// Update armor picture
|
2001-08-10 10:03:36 +00:00
|
|
|
|
self.items = self.items & ~(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (self.armortype >= 0.8)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.items = self.items | IT_ARMOR3;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
else if (self.armortype >= 0.6)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.items = self.items | IT_ARMOR2;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
else if (self.armortype >= 0.3)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.items = self.items | IT_ARMOR1;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// AMMOBOX Handling
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Throw an ammo box with 10 shells, 10 nails, 5 cells or 5 rockets
|
|
|
|
|
void (float type) TeamFortress_DropAmmo =
|
|
|
|
|
{
|
2001-10-19 03:31:30 +00:00
|
|
|
|
local float ammo = 0;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (type == 1) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
ammo = DROP_SHELLS;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.ammo_shells < ammo) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
/*CH who cares, we need space
|
|
|
|
|
// ENGINEER can make ammo
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.playerclass == PC_ENGINEER) {
|
|
|
|
|
if ((self.ammo_cells / AMMO_COST_SHELLS) > (ammo - self.ammo_shells)) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "you make some shells.\n");
|
|
|
|
|
self.ammo_cells = self.ammo_cells - ((ammo - self.ammo_shells) * AMMO_COST_SHELLS);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.ammo_shells = ammo;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (self.ammo_shells < ammo)
|
|
|
|
|
*/ return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
self.ammo_shells = self.ammo_shells - ammo;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (type == 2) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
ammo = DROP_NAILS;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.ammo_nails < ammo) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
/*CH who cares, we need space
|
|
|
|
|
// ENGINEER can make ammo
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.playerclass == PC_ENGINEER) {
|
|
|
|
|
if ((self.ammo_cells / AMMO_COST_NAILS) > (ammo - self.ammo_nails)) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "you make some nails.\n");
|
|
|
|
|
self.ammo_cells = self.ammo_cells - ((ammo - self.ammo_nails) * AMMO_COST_NAILS);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.ammo_nails = ammo;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (self.ammo_nails < ammo)
|
|
|
|
|
*/ return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
self.ammo_nails = self.ammo_nails - ammo;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (type == 3) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
ammo = DROP_ROCKETS;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.ammo_rockets < ammo) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
/*CH who cares, we need space
|
|
|
|
|
// ENGINEER can make ammo
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.playerclass == PC_ENGINEER) {
|
|
|
|
|
if ((self.ammo_cells / AMMO_COST_ROCKETS) > (ammo - self.ammo_rockets)) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "you make some rockets.\n");
|
|
|
|
|
self.ammo_cells = self.ammo_cells - ((ammo - self.ammo_rockets) * AMMO_COST_ROCKETS);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.ammo_rockets = ammo;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (self.ammo_rockets < ammo)
|
|
|
|
|
*/ return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
self.ammo_rockets = self.ammo_rockets - ammo;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (type == 4) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
ammo = DROP_CELLS;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.ammo_cells < ammo) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
/*CH who cares, we need space
|
|
|
|
|
// ENGINEER can make ammo
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.playerclass == PC_ENGINEER) {
|
|
|
|
|
if ((self.ammo_cells / AMMO_COST_CELLS) > (ammo - self.ammo_cells)) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "you make some cells.\n");
|
|
|
|
|
self.ammo_cells = self.ammo_cells - ((ammo - self.ammo_cells) * AMMO_COST_CELLS);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.ammo_cells = ammo;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (self.ammo_cells < ammo)
|
|
|
|
|
*/ return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
self.ammo_cells = self.ammo_cells - ammo;
|
|
|
|
|
}
|
|
|
|
|
W_SetCurrentAmmo();
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.team_no != 0) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
increment_team_ammoboxes(self.team_no);
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (num_team_ammoboxes(self.team_no) > (MAX_WORLD_AMMOBOXES / number_of_teams))
|
2001-07-17 05:58:10 +00:00
|
|
|
|
RemoveOldAmmobox(self.team_no);
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
num_world_ammoboxes = num_world_ammoboxes + 1;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (num_world_ammoboxes > MAX_WORLD_AMMOBOXES)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
RemoveOldAmmobox(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
newmis = spawn();
|
|
|
|
|
newmis.aflag = ammo;
|
|
|
|
|
newmis.weapon = type;
|
|
|
|
|
if (newmis.weapon == 1)
|
|
|
|
|
newmis.ammo_shells = ammo;
|
|
|
|
|
else if (newmis.weapon == 2)
|
|
|
|
|
newmis.ammo_nails = ammo;
|
|
|
|
|
else if (newmis.weapon == 3)
|
|
|
|
|
newmis.ammo_rockets = ammo;
|
|
|
|
|
else if (newmis.weapon == 4)
|
|
|
|
|
newmis.ammo_cells = ammo;
|
|
|
|
|
newmis.enemy = self;
|
|
|
|
|
newmis.health = time;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
newmis.movetype = MOVETYPE_TOSS;
|
|
|
|
|
newmis.solid = SOLID_TRIGGER;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.classname = "ammobox";
|
|
|
|
|
newmis.team_no = self.team_no;
|
|
|
|
|
|
|
|
|
|
makevectors (self.v_angle);
|
|
|
|
|
|
|
|
|
|
if (self.v_angle_x)
|
|
|
|
|
newmis.velocity = v_forward*400 + v_up * 200;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
else {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.velocity = aim(self, 10000);
|
|
|
|
|
newmis.velocity = newmis.velocity * 400;
|
|
|
|
|
newmis.velocity_z = 200;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
newmis.avelocity = '0 300 0';
|
|
|
|
|
setsize (newmis, '0 0 0', '0 0 0');
|
|
|
|
|
setorigin (newmis, self.origin);
|
|
|
|
|
newmis.nextthink = time + 30; // remove after 30 seconds
|
|
|
|
|
newmis.think = SUB_Remove;
|
|
|
|
|
newmis.touch = TeamFortress_AmmoboxTouch;
|
|
|
|
|
newmis.skin = type - 1;
|
|
|
|
|
setmodel (newmis, "progs/ammobox.mdl");
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void () TeamFortress_AmmoboxTouch =
|
|
|
|
|
{
|
|
|
|
|
local float took;
|
|
|
|
|
local string quantity;
|
|
|
|
|
|
|
|
|
|
took = 0;
|
|
|
|
|
|
|
|
|
|
// Cant touch own ammobox for 2 seconds after throwing
|
|
|
|
|
if ((other == self.enemy) && (time < self.health + 2))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (other.health <= 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Return if other is not a player
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (other.classname != "player") { //- OfN - Now grunt can take em
|
|
|
|
|
if (other.classname != "monster_army")
|
|
|
|
|
return;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
num_world_ammoboxes = num_world_ammoboxes - 1;
|
|
|
|
|
decrement_team_ammoboxes(self.team_no);
|
|
|
|
|
|
|
|
|
|
other.ammo_shells = other.ammo_shells + self.ammo_shells;
|
|
|
|
|
other.ammo_nails = other.ammo_nails + self.ammo_nails;
|
|
|
|
|
other.ammo_rockets = other.ammo_rockets + self.ammo_rockets;
|
|
|
|
|
other.ammo_cells = other.ammo_cells + self.ammo_cells;
|
|
|
|
|
|
|
|
|
|
grunty_boundammo(other);
|
|
|
|
|
|
|
|
|
|
PrintFromSoldier(other,other.real_owner,"i picked up some ammo.\n");
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
dremove(self);
|
|
|
|
|
self = other;
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
num_world_ammoboxes = num_world_ammoboxes - 1;
|
|
|
|
|
decrement_team_ammoboxes(self.team_no);
|
|
|
|
|
|
|
|
|
|
// discard backpack
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.weapon == 0) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(other, PRINT_LOW, "You got ");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.ammo_shells > 0) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
other.ammo_shells = other.ammo_shells + self.ammo_shells;
|
|
|
|
|
quantity = ftos(self.ammo_shells);
|
2001-08-04 23:49:44 +00:00
|
|
|
|
sprint(other, PRINT_LOW, quantity, " shells ");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
}
|
|
|
|
|
if (self.ammo_nails > 0) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
other.ammo_nails = other.ammo_nails + self.ammo_nails;
|
|
|
|
|
quantity = ftos(self.ammo_nails);
|
2001-08-04 23:49:44 +00:00
|
|
|
|
sprint(other, PRINT_LOW, quantity, " nails ");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.ammo_rockets > 0) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
other.ammo_rockets = other.ammo_rockets + self.ammo_rockets;
|
|
|
|
|
quantity = ftos(self.ammo_rockets);
|
2001-08-04 23:49:44 +00:00
|
|
|
|
sprint(other, PRINT_LOW, quantity, " rockets ");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.ammo_cells > 0) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
other.ammo_cells = other.ammo_cells + self.ammo_cells;
|
|
|
|
|
quantity = ftos(self.ammo_cells);
|
2001-08-04 23:49:44 +00:00
|
|
|
|
sprint(other, PRINT_LOW, quantity, " cells ");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(other, PRINT_LOW, "\n");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == 1) { // shotgun
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (other.ammo_shells >= TeamFortress_GetMaxAmmo(other,IT_SHELLS))
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return;
|
|
|
|
|
other.ammo_shells = other.ammo_shells + self.aflag;
|
|
|
|
|
self.netname = "shells";
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == 2) { // spikes
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (other.ammo_nails >= TeamFortress_GetMaxAmmo(other,IT_NAILS))
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return;
|
|
|
|
|
other.ammo_nails = other.ammo_nails + self.aflag;
|
|
|
|
|
self.netname = "nails";
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == 3) { // rockets
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (other.ammo_rockets >= TeamFortress_GetMaxAmmo(other,IT_ROCKETS))
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return;
|
|
|
|
|
other.ammo_rockets = other.ammo_rockets + self.aflag;
|
|
|
|
|
self.netname = "rockets";
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == 4) { // cells
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (other.ammo_cells >= TeamFortress_GetMaxAmmo(other,IT_CELLS))
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return;
|
|
|
|
|
other.ammo_cells = other.ammo_cells + self.aflag;
|
|
|
|
|
self.netname = "cells";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bound_other_ammo (other);
|
|
|
|
|
|
|
|
|
|
// Discard backpacks do their own printing
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.weapon > 0) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
quantity = ftos(self.aflag);
|
2001-08-04 23:49:44 +00:00
|
|
|
|
sprint(other, PRINT_LOW, "You picked up ", quantity, " ", self.netname, "\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
stuffcmd (other, "bf\n");
|
|
|
|
|
|
|
|
|
|
dremove(self);
|
|
|
|
|
self = other;
|
|
|
|
|
W_SetCurrentAmmo();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Return the number of pipebombs in existence for a particular team
|
|
|
|
|
float (float tno) num_team_ammoboxes =
|
|
|
|
|
{
|
|
|
|
|
if (tno == 1)
|
|
|
|
|
return num_team_ammoboxes_1;
|
|
|
|
|
else if (tno == 2)
|
|
|
|
|
return num_team_ammoboxes_2;
|
|
|
|
|
else if (tno == 3)
|
|
|
|
|
return num_team_ammoboxes_3;
|
|
|
|
|
else if (tno == 4)
|
|
|
|
|
return num_team_ammoboxes_4;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Remove enough old ammoboxes to bring the count down to the max level
|
|
|
|
|
void(float tno) RemoveOldAmmobox =
|
|
|
|
|
{
|
|
|
|
|
local entity old;
|
|
|
|
|
local float index;
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (tno != 0) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
index = num_team_ammoboxes(tno);
|
2001-07-23 20:52:47 +00:00
|
|
|
|
index = index - (MAX_WORLD_AMMOBOXES / number_of_teams);
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
index = num_world_ammoboxes - MAX_WORLD_AMMOBOXES;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-11-02 17:00:52 +00:00
|
|
|
|
old = find(NIL, classname, "ammobox");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
while (index > 0) {
|
|
|
|
|
if (!old) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
// RPrint("*** ERROR: RemoveOldAmmobox. ***\n");
|
|
|
|
|
// RPrint("*** Shaka thought he fixed this ***\n");
|
|
|
|
|
num_world_ammoboxes = num_world_ammoboxes - 1;
|
|
|
|
|
decrement_team_ammoboxes(old.team_no);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (old.team_no == tno || tno == 0) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
old.think = SUB_Remove;
|
|
|
|
|
old.nextthink = time + 0.1;
|
|
|
|
|
index = index - 1;
|
|
|
|
|
|
|
|
|
|
num_world_ammoboxes = num_world_ammoboxes - 1;
|
|
|
|
|
decrement_team_ammoboxes(old.team_no);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
old = find(old, classname, "ammobox");
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void(float tno) increment_team_ammoboxes =
|
|
|
|
|
{
|
|
|
|
|
if (tno == 1)
|
|
|
|
|
num_team_ammoboxes_1 = num_team_ammoboxes_1 + 1;
|
|
|
|
|
else if (tno == 2)
|
|
|
|
|
num_team_ammoboxes_2 = num_team_ammoboxes_2 + 1;
|
|
|
|
|
else if (tno == 3)
|
|
|
|
|
num_team_ammoboxes_3 = num_team_ammoboxes_3 + 1;
|
|
|
|
|
else if (tno == 4)
|
|
|
|
|
num_team_ammoboxes_4 = num_team_ammoboxes_4 + 1;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void(float tno) decrement_team_ammoboxes =
|
|
|
|
|
{
|
|
|
|
|
if (tno == 1)
|
|
|
|
|
num_team_ammoboxes_1 = num_team_ammoboxes_1 - 1;
|
|
|
|
|
else if (tno == 2)
|
|
|
|
|
num_team_ammoboxes_2 = num_team_ammoboxes_2 - 1;
|
|
|
|
|
else if (tno == 3)
|
|
|
|
|
num_team_ammoboxes_3 = num_team_ammoboxes_3 - 1;
|
|
|
|
|
else if (tno == 4)
|
|
|
|
|
num_team_ammoboxes_4 = num_team_ammoboxes_4 - 1;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// WEAPON HANDLING FUNCTIONS
|
|
|
|
|
//=========================================================================
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Assault Cannon selection function
|
|
|
|
|
void() TeamFortress_AssaultWeapon =
|
|
|
|
|
{
|
|
|
|
|
self.impulse = 0;
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (self.tfstate & TFSTATE_RELOADING)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (!(self.weapons_carried & WEAP_ASSAULT_CANNON))
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.heat > 0) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "the assault cannon is still overheated.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.ammo_shells < 1) { // don't have the ammo
|
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;
|
|
|
|
|
}
|
|
|
|
|
// The cannon also needs 6 cells to power up
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.ammo_cells < 6) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "not enough cells to power the assault cannon.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.current_weapon = WEAP_ASSAULT_CANNON;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
W_SetCurrentAmmo ();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// If this gets called, the players holding onto an exploding grenade :)
|
|
|
|
|
void() TeamFortress_ExplodePerson =
|
|
|
|
|
{
|
|
|
|
|
// Removes the owners grenade
|
2002-09-08 01:44:11 +00:00
|
|
|
|
self.owner.tfstate &= ~TFSTATE_GRENPRIMED;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
KickPlayer(-2, self.owner);
|
|
|
|
|
|
|
|
|
|
newmis = spawn ();
|
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";
|
|
|
|
|
newmis.team_no = self.owner.team_no;
|
|
|
|
|
newmis.owner = self.owner;
|
|
|
|
|
|
|
|
|
|
// Don't bother calculating a velocity
|
|
|
|
|
newmis.velocity = '0 0 0';
|
|
|
|
|
newmis.angles = vectoangles(newmis.velocity);
|
|
|
|
|
|
|
|
|
|
// set the grenades thinktime to now
|
2001-11-10 06:35:43 +00:00
|
|
|
|
newmis.think = dont_think;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.nextthink = time + 0.1;
|
|
|
|
|
|
|
|
|
|
// set the think and touches to the appropriate grenade type
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.weapon == GR_TYPE_NORMAL) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.touch = NormalGrenadeTouch;
|
|
|
|
|
newmis.think = NormalGrenadeExplode;
|
|
|
|
|
newmis.skin = 0;
|
|
|
|
|
newmis.avelocity = '300 300 300';
|
|
|
|
|
setmodel (newmis, "progs/hgren2.mdl");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == GR_TYPE_CONCUSSION) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.touch = ConcussionGrenadeTouch;
|
|
|
|
|
newmis.think = ConcussionGrenadeExplode;
|
|
|
|
|
newmis.skin = 1;
|
|
|
|
|
newmis.avelocity = '300 300 300';
|
|
|
|
|
setmodel (newmis, "progs/hgren2.mdl");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == GR_TYPE_BIO) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.touch = BioGrenadeTouch;
|
|
|
|
|
newmis.think = BioGrenadeExplode;
|
|
|
|
|
newmis.skin = 0;
|
|
|
|
|
newmis.avelocity = '300 300 300';
|
|
|
|
|
setmodel (newmis, "progs/hgren2.mdl");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == GR_TYPE_ANTIGRAV) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.touch = ConcussionGrenadeTouch;
|
|
|
|
|
newmis.think = AntiGravGrenadeExplode;
|
|
|
|
|
newmis.skin = 1;
|
|
|
|
|
newmis.avelocity = '300 300 300';
|
|
|
|
|
setmodel (newmis, "progs/hgren2.mdl");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == GR_TYPE_NAIL) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.touch = NailGrenadeTouch;
|
|
|
|
|
newmis.think = NailGrenadeExplode;
|
|
|
|
|
newmis.skin = 1;
|
|
|
|
|
newmis.avelocity = '0 300 0';
|
|
|
|
|
setmodel (newmis, "progs/biggren.mdl");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == GR_TYPE_CALTROP) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.touch = NormalGrenadeTouch;
|
|
|
|
|
newmis.think = CaltropGrenadeExplode;
|
|
|
|
|
newmis.skin = 0;
|
|
|
|
|
newmis.avelocity = '300 300 300';
|
|
|
|
|
setmodel (newmis, "progs/hgren2.mdl");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == GR_TYPE_MIRV) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.touch = MirvGrenadeTouch;
|
|
|
|
|
newmis.think = MirvGrenadeExplode;
|
|
|
|
|
newmis.skin = 0;
|
|
|
|
|
newmis.avelocity = '0 300 0';
|
|
|
|
|
setmodel (newmis, "progs/biggren.mdl");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == GR_TYPE_NAPALM) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.touch = NapalmGrenadeTouch;
|
|
|
|
|
newmis.think = NapalmGrenadeExplode;
|
|
|
|
|
newmis.skin = 2;
|
|
|
|
|
newmis.avelocity = '0 300 0';
|
|
|
|
|
setmodel (newmis, "progs/biggren.mdl");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == GR_TYPE_FLARE) { //CH no flare //OfN why??
|
|
|
|
|
// sprint(self.owner, PRINT_HIGH, "Flare lit.\n");
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self.owner, PRINT_HIGH, "The flare burns on your hand!\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
T_Damage(self.owner, self.owner, self.owner,12);
|
|
|
|
|
stuffcmd(self.owner, "bf\nbf\n");
|
|
|
|
|
|
|
|
|
|
newmis.touch = FlareBounce;
|
|
|
|
|
newmis.think = FlareGrenadeExplode;
|
|
|
|
|
newmis.skin = 0;
|
|
|
|
|
newmis.has_holo=1;
|
|
|
|
|
newmis.avelocity = '0 0 0';
|
|
|
|
|
setmodel (newmis, "progs/flarefly.mdl");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
/*
|
|
|
|
|
te = spawn();
|
2001-10-17 07:48:11 +00:00
|
|
|
|
te.touch = NIL;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
te.think = SUB_Remove;//FlareGrenadeExplode;//RemoveFlare;
|
|
|
|
|
te.nextthink = time + 25;
|
|
|
|
|
te.owner = self.owner;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
te.solid = SOLID_NOT;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
self.owner.effects = self.owner.effects | EF_BRIGHTLIGHT;
|
|
|
|
|
*/
|
2001-07-17 05:58:10 +00:00
|
|
|
|
setsize (newmis, '0 0 0', '0 0 0');
|
|
|
|
|
setorigin (newmis, self.owner.origin);
|
|
|
|
|
|
|
|
|
|
dremove(self);
|
|
|
|
|
//dremove(newmis);
|
|
|
|
|
return;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == GR_TYPE_GAS) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.touch = GasGrenadeTouch;
|
|
|
|
|
newmis.think = GasGrenadeExplode;
|
|
|
|
|
newmis.skin = 2;
|
|
|
|
|
newmis.avelocity = '300 300 300';
|
|
|
|
|
setmodel (newmis, "progs/grenade2.mdl");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == GR_TYPE_EMP) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.touch = EMPGrenadeTouch;
|
|
|
|
|
newmis.think = EMPGrenadeExplode;
|
|
|
|
|
newmis.skin = 4;
|
|
|
|
|
newmis.avelocity = '300 300 300';
|
|
|
|
|
setmodel (newmis, "progs/grenade2.mdl");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == GR_TYPE_FLASH) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.touch = FlashGrenadeTouch;
|
|
|
|
|
newmis.think = FlashGrenadeExplode;
|
|
|
|
|
newmis.skin = 1;
|
|
|
|
|
newmis.avelocity = '300 300 300';
|
|
|
|
|
setmodel (newmis, "progs/grenade2.mdl");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == GR_TYPE_FRAG) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.touch = FragGrenadeTouch;
|
|
|
|
|
newmis.think = FragGrenadeExplode;
|
|
|
|
|
newmis.skin = 1;
|
|
|
|
|
newmis.avelocity = '300 300 300';
|
|
|
|
|
setmodel (newmis, "progs/grenade2.mdl");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.weapon == GR_TYPE_KRAC) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
newmis.touch = KracGrenadeTouch;
|
|
|
|
|
newmis.think = KracGrenadeExplode;
|
|
|
|
|
newmis.skin = 1;
|
|
|
|
|
newmis.avelocity = '300 300 300';
|
|
|
|
|
setmodel (newmis, "progs/grenade2.mdl");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setsize (newmis, '0 0 0', '0 0 0');
|
|
|
|
|
setorigin (newmis, self.owner.origin);
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
//bprint(PRINT_MEDIUM, "No ");
|
|
|
|
|
//bprint(PRINT_MEDIUM, self.owner.netname);
|
|
|
|
|
//bprint(PRINT_MEDIUM, ", throw the grenade, not the pin!\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
bprint(PRINT_MEDIUM, "No ");
|
|
|
|
|
bprint(PRINT_MEDIUM, self.owner.netname);
|
|
|
|
|
bprint(PRINT_MEDIUM, ", you are supposed to THROW the grenade!\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
//no xxx, your grenade is your friend for another reason!
|
|
|
|
|
//no
|
|
|
|
|
|
|
|
|
|
// Remove primed grenade object
|
|
|
|
|
dremove(self);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Thrown Grenade touch function.
|
|
|
|
|
void() NormalGrenadeTouch =
|
|
|
|
|
{
|
|
|
|
|
if (other == self.owner)
|
|
|
|
|
return; // don't explode on owner
|
|
|
|
|
|
|
|
|
|
// Thrown grenades don't detonate when hitting an enemy
|
|
|
|
|
|
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';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Thrown grenade explosion. 50% more powerful as grenade launcher grenades.
|
|
|
|
|
void() NormalGrenadeExplode =
|
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
|
deathmsg = DMSG_GREN_HAND;
|
2001-11-02 17:00:52 +00:00
|
|
|
|
T_RadiusDamage (self, self.owner, 180, NIL);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
#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
|
|
|
|
dremove(self);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Displays the state of the items in the Detection Entity
|
|
|
|
|
void() TeamFortress_DisplayDetectionItems =
|
|
|
|
|
{
|
|
|
|
|
local entity Goal, te;
|
|
|
|
|
|
2001-11-02 17:00:52 +00:00
|
|
|
|
Goal = find(NIL, classname, "info_tfdetect");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (!Goal)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Check to make sure they've got some strings
|
2001-09-30 22:38:44 +00:00
|
|
|
|
if (!Goal.team_str_home)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (Goal.display_item_status1 != 0) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
te = Finditem(Goal.display_item_status1);
|
|
|
|
|
if (te)
|
|
|
|
|
DisplayItemStatus(Goal, self, te);
|
|
|
|
|
else
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "Item is missing.\n");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (Goal.display_item_status2 != 0) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
te = Finditem(Goal.display_item_status2);
|
|
|
|
|
if (te)
|
|
|
|
|
DisplayItemStatus(Goal, self, te);
|
|
|
|
|
else
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "Item is missing.\n");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (Goal.display_item_status3 != 0) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
te = Finditem(Goal.display_item_status3);
|
|
|
|
|
if (te)
|
|
|
|
|
DisplayItemStatus(Goal, self, te);
|
|
|
|
|
else
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "Item is missing.\n");
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (Goal.display_item_status4 != 0) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
te = Finditem(Goal.display_item_status4);
|
|
|
|
|
if (te)
|
|
|
|
|
DisplayItemStatus(Goal, self, te);
|
|
|
|
|
else
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "Item is missing.\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// ITEM HANDLING FUNCTIONS
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Function for handling the BioInfection Decay of players
|
|
|
|
|
void() BioInfection_Decay =
|
|
|
|
|
{
|
|
|
|
|
// Remove infections which can't hurt the owner
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if ((teamplay & TEAMPLAY_NOEXPLOSIVE) && Teammate(self.owner.team_no,self.enemy.team_no)) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.owner.tfstate = self.owner.tfstate - (self.owner.tfstate & TFSTATE_INFECTED);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
dremove(self);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.invincible_finished > time) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.owner.tfstate = self.owner.tfstate - (self.owner.tfstate & TFSTATE_INFECTED);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
dremove(self);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.owner.current_weapon == WEAP_MEDIKIT) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint(self.owner,PRINT_HIGH,"You heal yourself of your infection.\n");
|
|
|
|
|
self.owner.tfstate = self.owner.tfstate - (self.owner.tfstate & TFSTATE_INFECTED);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
dremove(self);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
self.nextthink = time + 2;
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
deathmsg = DMSG_BIOWEAPON;
|
|
|
|
|
TF_T_Damage(self.owner, self, self.enemy, 5, TF_TD_IGNOREARMOUR, TF_TD_OTHER);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
SpawnBlood(self.owner.origin, 30);
|
|
|
|
|
|
|
|
|
|
// remove this entity if the infection is gone
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if ( !(self.owner.tfstate & TFSTATE_INFECTED) )
|
2001-07-17 05:58:10 +00:00
|
|
|
|
dremove(self);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//========================================================================
|
|
|
|
|
// Function for handling the BioInfection Decay of monsters
|
|
|
|
|
void() BioInfection_MonsterDecay =
|
|
|
|
|
{
|
|
|
|
|
local float drmg;
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (!(self.enemy.tfstate & TFSTATE_INFECTED)) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
dremove(self);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
drmg = 200 * random();
|
|
|
|
|
drmg = drmg * random();
|
|
|
|
|
|
|
|
|
|
self.nextthink = time + 2;
|
|
|
|
|
|
|
|
|
|
T_Damage(self.enemy, self, self.owner, drmg);
|
|
|
|
|
SpawnBlood(self.enemy.origin, drmg+10);
|
|
|
|
|
|
|
|
|
|
if (self.enemy.health < 1)
|
|
|
|
|
dremove(self);
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// UTILITY FUNCTIONS
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Stuff an alias. This is a little messy since we insisted
|
|
|
|
|
// on maintaining the ability to alter the impulse numbers in the defs.qc
|
|
|
|
|
// and not have to change any code.
|
|
|
|
|
void(string halias, float himpulse1, float himpulse2) TeamFortress_Alias =
|
|
|
|
|
{
|
|
|
|
|
local string imp;
|
|
|
|
|
|
|
|
|
|
stuffcmd(self, "alias ");
|
|
|
|
|
stuffcmd(self, halias);
|
|
|
|
|
stuffcmd(self, " \"impulse ");
|
|
|
|
|
imp = ftos(himpulse1);
|
|
|
|
|
stuffcmd(self, imp);
|
|
|
|
|
|
|
|
|
|
// if himpulse2 is not zero, assume that himpulse1 is a preimpulse
|
|
|
|
|
// and complete the alias
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (himpulse2 != 0) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
stuffcmd(self, ";wait; impulse ");
|
|
|
|
|
imp = ftos(himpulse2);
|
|
|
|
|
stuffcmd(self, imp);
|
|
|
|
|
}
|
|
|
|
|
stuffcmd(self, "\"\n");
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// CYCLIC EVENT FUNCTIONS
|
|
|
|
|
//=========================================================================
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Regenerates the entity which owns this cyclictimer
|
|
|
|
|
void() TeamFortress_Regenerate =
|
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
|
//WK if (self.owner.playerclass == PC_MEDIC)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (self.is_abouttodie)
|
|
|
|
|
return;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.owner.weapons_carried & WEAP_MEDIKIT) { //WK Custom class friendly
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.nextthink = time + PC_MEDIC_REGEN_TIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
if (self.owner.health >= self.owner.max_health)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (self.owner.ammo_medikit == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.owner.ammo_medikit < PC_MEDIC_REGEN_AMOUNT) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.owner.health = self.owner.health + self.owner.ammo_medikit;
|
|
|
|
|
self.owner.ammo_medikit = 0;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.owner.health = self.owner.health + PC_MEDIC_REGEN_AMOUNT;
|
|
|
|
|
self.owner.ammo_medikit = self.owner.ammo_medikit - PC_MEDIC_REGEN_AMOUNT;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (self.owner.health > self.owner.max_health)
|
|
|
|
|
self.owner.health = self.owner.max_health;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void() CyberAugSleep =
|
|
|
|
|
{
|
|
|
|
|
if (self.owner.velocity_z == 0 && self.owner.velocity_y == 0 && self.owner.velocity_x == 0)
|
|
|
|
|
self.think = TeamFortress_RegenerateCyber;
|
|
|
|
|
|
|
|
|
|
self.nextthink = time + 2;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void() TeamFortress_RegenerateCyber =
|
|
|
|
|
{
|
|
|
|
|
if (self.is_abouttodie)
|
|
|
|
|
return;
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
//WK if (self.owner.playerclass == PC_MEDIC)
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.owner.velocity_z > 0 || self.owner.velocity_y > 0 || self.owner.velocity_x > 0) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.nextthink = time + 2;
|
|
|
|
|
self.think = CyberAugSleep;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.owner.cutf_items & CUTF_CYBERAUG && !(self.owner.is_malfunctioning)) { //WK Custom class friendly
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.owner.armortype = self.owner.armor_allowed;
|
|
|
|
|
W_SetCurrentAmmo();
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.owner.health < self.owner.max_health) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (self.owner.ammo_medikit == 0)
|
|
|
|
|
self.owner.health = self.owner.health + 1;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
else if (self.owner.ammo_medikit < PC_MEDIC_REGEN_AMOUNT / 2.0) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.owner.health = self.owner.health + self.owner.ammo_medikit * 2;
|
|
|
|
|
self.owner.ammo_medikit = 0;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.owner.health = self.owner.health + PC_MEDIC_REGEN_AMOUNT;
|
2001-07-24 04:37:00 +00:00
|
|
|
|
self.owner.ammo_medikit = self.owner.ammo_medikit - PC_MEDIC_REGEN_AMOUNT / 2.0;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.owner.armorvalue < self.owner.maxarmor) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (self.owner.ammo_cells == 0)
|
|
|
|
|
self.owner.armorvalue = self.owner.armorvalue + 2;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
else if (self.owner.ammo_cells < PC_MEDIC_REGEN_AMOUNT) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.owner.armorvalue = self.owner.armorvalue + self.owner.ammo_cells * 2;
|
|
|
|
|
self.owner.ammo_cells = 0;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.owner.armorvalue = self.owner.armorvalue + PC_MEDIC_REGEN_AMOUNT * 2;
|
|
|
|
|
self.owner.ammo_cells = self.owner.ammo_cells - PC_MEDIC_REGEN_AMOUNT;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UpdateCells(self.owner);
|
|
|
|
|
|
|
|
|
|
if (self.owner.armorvalue > self.owner.maxarmor)
|
|
|
|
|
self.owner.armorvalue = self.owner.maxarmor;
|
|
|
|
|
if (self.owner.health > self.owner.max_health)
|
|
|
|
|
self.owner.health = self.owner.max_health;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else if (self.owner.cutf_items & CUTF_CYBERAUG && self.owner.is_malfunctioning == 1) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (self.owner.health > 3)
|
2001-07-23 20:52:47 +00:00
|
|
|
|
TF_T_Damage(self.owner, self.owner, self.owner, 3, TF_TD_IGNOREARMOUR, TF_TD_OTHER);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
else if (self.owner.health < 3 && self.owner.health > 1)
|
|
|
|
|
self.owner.health = 1;
|
|
|
|
|
if (self.owner.armorvalue > 3)
|
|
|
|
|
self.owner.armorvalue = self.owner.armorvalue - 3;
|
|
|
|
|
else if (self.owner.armorvalue < 3)
|
|
|
|
|
self.owner.armorvalue = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
self.nextthink = time + PC_MEDIC_REGEN_TIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
};
|
2002-09-08 01:44:11 +00:00
|
|
|
|
|
2001-07-17 05:58:10 +00:00
|
|
|
|
//=========================================================================
|
|
|
|
|
// Activates when we go hidden
|
|
|
|
|
// If we're moving, make us not invis
|
|
|
|
|
void() TeamFortress_RegenerateCells =
|
|
|
|
|
{
|
|
|
|
|
//WK Borrow this code from TF, since there's no reason to
|
|
|
|
|
// duplicate it.
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (!(self.owner.job & JOB_THIEF))
|
2001-07-17 05:58:10 +00:00
|
|
|
|
dremove(self);
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if (!(self.owner.job & JOB_ACTIVE))
|
2001-07-17 05:58:10 +00:00
|
|
|
|
dremove(self);
|
|
|
|
|
if (self.owner.health <= 0)
|
|
|
|
|
dremove(self);
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.nextthink = time + PC_SPY_CELL_REGEN_TIME;
|
|
|
|
|
if (self.owner.job & JOB_ACTIVE)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
{
|
|
|
|
|
/*if (self.owner.ammo_cells == 0)
|
|
|
|
|
{
|
2001-07-23 20:52:47 +00:00
|
|
|
|
RevealThief(self.owner,FALSE);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
2001-08-11 10:02:18 +00:00
|
|
|
|
else */
|
2001-07-17 05:58:10 +00:00
|
|
|
|
//if (self.owner.ammo_cells > 100) self.owner.ammo_cells = 100;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
if ((self.owner.velocity_z > 0 || self.owner.velocity_y > 0 || self.owner.velocity_x > 0) && self.owner.job & JOB_FULL_HIDE)
|
2001-07-17 05:58:10 +00:00
|
|
|
|
{
|
|
|
|
|
self.owner.frame = 0;
|
|
|
|
|
self.owner.weaponframe = 0;
|
|
|
|
|
self.owner.modelindex = modelindex_eyes;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.owner.job = self.owner.job - (self.owner.job & JOB_FULL_HIDE);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
TeamFortress_SetSpeed(self.owner);
|
2001-07-23 20:52:47 +00:00
|
|
|
|
/*self.owner.ammo_cells = self.owner.ammo_cells - PC_SPY_CELL_USAGE;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (self.owner.ammo_cells <= 0) {
|
|
|
|
|
self.owner.ammo_cells = 0;
|
2001-08-11 10:02:18 +00:00
|
|
|
|
RevealThief(self.owner,FALSE);
|
|
|
|
|
}*/
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
2001-08-11 10:02:18 +00:00
|
|
|
|
else if ((self.owner.velocity_z == 0 && self.owner.velocity_y == 0 && self.owner.velocity_x == 0)
|
|
|
|
|
&& !(self.owner.job & JOB_FULL_HIDE)
|
2003-12-03 02:43:02 +00:00
|
|
|
|
&& !(self.effects & EF_ANYGLOW))
|
2001-07-17 05:58:10 +00:00
|
|
|
|
{
|
|
|
|
|
self.owner.frame = 0;
|
|
|
|
|
self.owner.weaponframe = 0;
|
|
|
|
|
self.owner.modelindex = modelindex_null;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.owner.job = self.owner.job | JOB_FULL_HIDE;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
/*
|
|
|
|
|
else { // Increase cell ammo
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (self.owner.ammo_cells >= self.owner.maxammo_cells)
|
|
|
|
|
return;
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.owner.ammo_cells = self.owner.ammo_cells + PC_SPY_CELL_REGEN_AMOUNT;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
if (self.owner.ammo_cells > self.owner.maxammo_cells)
|
|
|
|
|
self.owner.ammo_cells = self.owner.maxammo_cells;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
// return;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2002-09-08 01:44:11 +00:00
|
|
|
|
/*
|
|
|
|
|
if (self.owner.playerclass == PC_SPY) {
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.nextthink = time + PC_SPY_CELL_REGEN_TIME;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
// If the spy is undercover, decrease the number of cells
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.owner.is_undercover == 1) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
// If the spy has no cells left, he becomes visible again
|
2002-09-08 01:44:11 +00:00
|
|
|
|
if (self.owner.ammo_cells == 0) {
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.owner.is_undercover = 0;
|
|
|
|
|
self.owner.modelindex = modelindex_player; // return to normal
|
2001-08-10 10:03:36 +00:00
|
|
|
|
self.owner.items = self.owner.items & ~IT_INVISIBILITY;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else { // Decrease cells
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.owner.ammo_cells = self.owner.ammo_cells - PC_SPY_CELL_USAGE;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (self.owner.ammo_cells < 0)
|
|
|
|
|
self.owner.ammo_cells = 0;
|
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
} else { // Increase cell ammo
|
2001-07-17 05:58:10 +00:00
|
|
|
|
if (self.owner.ammo_cells >= self.owner.maxammo_cells)
|
|
|
|
|
return;
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.owner.ammo_cells = self.owner.ammo_cells + PC_SPY_CELL_REGEN_AMOUNT;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
if (self.owner.ammo_cells > self.owner.maxammo_cells)
|
|
|
|
|
self.owner.ammo_cells = self.owner.maxammo_cells;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
2002-09-08 01:44:11 +00:00
|
|
|
|
*/
|
2001-07-17 05:58:10 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
// sends a player to observer mode
|
|
|
|
|
void() PlayerObserverMode =
|
|
|
|
|
{
|
|
|
|
|
DetonateAllGuns();
|
|
|
|
|
kill_my_demon();
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.current_menu = MENU_DEFAULT;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.impulse = 0;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.playerclass = PC_UNDEFINED;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.lives = 0;
|
|
|
|
|
self.health = 1;
|
|
|
|
|
self.gravity = 0; //WK Make em float so prediction doesn't get all annoying-like
|
|
|
|
|
if (self.team_no > 0) self.old_team_no = self.team_no; //WK Save old team for scoreboard
|
|
|
|
|
self.team_no = -1;
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.flags = FL_CLIENT | FL_NOTARGET | FL_ONGROUND;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
self.waterlevel = 3;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.takedamage = DAMAGE_NO;
|
|
|
|
|
self.solid = SOLID_NOT;
|
2002-09-08 01:44:11 +00:00
|
|
|
|
// self.movetype = MOVETYPE_NOCLIP;
|
2001-07-23 20:52:47 +00:00
|
|
|
|
self.movetype = MOVETYPE_FLY;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-09-30 22:38:44 +00:00
|
|
|
|
self.model = "";
|
|
|
|
|
self.mdl = "";
|
|
|
|
|
setmodel(self, "");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
self.velocity = '0 0 0';
|
|
|
|
|
self.avelocity = '0 0 0';
|
|
|
|
|
|
2001-07-23 20:52:47 +00:00
|
|
|
|
sprint (self, PRINT_HIGH, "Observer mode\n");
|
2001-07-17 05:58:10 +00:00
|
|
|
|
CenterPrint(self, "\n");
|
2001-07-24 20:54:19 +00:00
|
|
|
|
SetPlayerColor (self, 0, 0);
|
|
|
|
|
stuffcmd(self, "cl_rollangle 0\n"); // FIXME: does this need a wait?
|
2001-07-17 05:58:10 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
// Return the crossproduct of 2 vectors
|
2001-07-26 16:44:48 +00:00
|
|
|
|
vector(vector veca, vector vecb) crossproduct =
|
2001-07-17 05:58:10 +00:00
|
|
|
|
{
|
2001-07-26 16:44:48 +00:00
|
|
|
|
local vector result;
|
2001-07-17 05:58:10 +00:00
|
|
|
|
|
2001-07-26 16:44:48 +00:00
|
|
|
|
result_x = (veca_y * vecb_z) - (vecb_y * veca_z);
|
|
|
|
|
result_y = (veca_z * vecb_x) - (vecb_z * veca_x);
|
|
|
|
|
result_z = (veca_x * vecb_y) - (vecb_x * veca_y);
|
2001-07-17 05:58:10 +00:00
|
|
|
|
return result;
|
|
|
|
|
};
|