prozac-qfcc/custom.qc

1440 lines
39 KiB
C++
Raw Normal View History

2001-07-17 05:58:10 +00:00
/*======================================================
CUSTOM.QC Custom TeamFortress v3.2
(c) William Kerney 5/21/00
========================================================
All the functions pertaining to custom class generation and
the miscellanious new features of Custom TF
======================================================*/
#include "defs.qh"
#include "menu.qh"
2001-07-17 05:58:10 +00:00
float(float t1, float t2) Teammate; //KK: are team_no's current teammates
void() DropToCustomClassGen; //Called when starting class generation
void() DropFromCustomClassGen; //Called when finished class generation
void() PrintMoney;
void(float in) PrintRefund;
void(float in) PrintNotEnoughMoney;
void(float cost, float type) BuyWeapon;
void(float cost, float type) BuyCuTF;
void(float cost, float type) BuyItem;
void(float cost, float type) BuyJob;
/*void(float cost, float type) BuyGren1;
void(float cost, float type) BuyGren2;*/
void(entity tif, float pain) RevealThief;
void() FragGrenadeTouch;
void() FragGrenadeExplode;
void() KracGrenadeTouch;
void() KracGrenadeExplode;
void(entity bastard,float threshold) createBastard;
void(entity immuner,float timer) makeImmune;
void() UseJobSkill; //Function for handling professions
void() DetonateAllGuns;
void (string temp) DebugSprint;
void (float temp) DebugSprintFloat;
float(entity tester) IsBuilding;
void() autoteam_think;
//Extern
void (vector org, entity death_owner) spawn_tdeath;
void (string gib, float health) ThrowGib;
void() TeamFortress_SetHealth;
void() TeamFortress_SetEquipment;
float() W_BestWeapon;
void() W_SetCurrentAmmo;
void(entity p) TeamFortress_SetSpeed;
void(entity p) TeamFortress_SetSkin;
void(entity Viewer, float pc) TeamFortress_PrintJobName;
void () BecomeExplosion;
void(entity bomb, entity attacker, float rad, entity ignore) T_RadiusDamage;
void() SUB_regen;
float modelindex_eyes, modelindex_player, modelindex_null;
void(float inAuto) W_FireMedikit;
void(float inAuto) TeamFortress_ID;
void(float range,float inAuto) TeamFortress_Scan;
void() kill_my_demon;
void() player_assaultcannondown1;
void (entity rhook) Reset_Grapple;
void() GuerillaExplode;
void(float krac) TeamFortress_DetpackStop;
void (float all) TeamFortress_TeamShowScores;
void () execute_changelevel;
void(entity Item, entity AP, float method) tfgoalitem_RemoveFromPlayer;
//- OfN
void(entity mine_owner) DetonateMines; //external, job.qc
float (float tno) TeamGetNiceColor;
2001-07-17 05:58:10 +00:00
void() SetArmyTimer;
void() RemoveArmyTimer;
entity() SelectSpawnPoint;
void(entity tfield, vector where, entity thing) FieldExplosion;
//KK: are team_no's current teammates
float(float targteam, float attackteam) Teammate =
{
local float teammask;
if (!teamplay) return FALSE;
if (!targteam) return FALSE;
if (targteam == attackteam) return TRUE;
if (number_of_teams < 3) return FALSE;
2001-07-17 05:58:10 +00:00
teammask = 1 << (targteam - 1);
2001-07-17 05:58:10 +00:00
if (attackteam == 1 && (friends1_mask & teammask)) return TRUE;
else if (attackteam == 2 && (friends2_mask & teammask)) return TRUE;
else if (attackteam == 3 && (friends3_mask & teammask)) return TRUE;
else if (attackteam == 4 && (friends4_mask & teammask)) return TRUE;
2001-07-17 05:58:10 +00:00
return FALSE;
2001-07-17 05:58:10 +00:00
};
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
float(entity targ, entity attack) AreTeammates =
{
if (targ == attack)
return TRUE;
else
return Teammate(targ.team_no, attack.team_no);
};
2001-07-17 05:58:10 +00:00
void (string temp) DebugSprint =
{
sprint(self,PRINT_HIGH,temp);
sprint(self,PRINT_HIGH,"\n");
2001-07-17 05:58:10 +00:00
};
void (float foo) DebugSprintFloat =
{
local string temp;
temp = ftos(foo);
sprint(self,PRINT_HIGH,temp);
sprint(self,PRINT_HIGH,"\n");
2001-07-17 05:58:10 +00:00
};
void() DropToCustomClassGen =
{
local float sell_no;
sell_no = 0;
self.gravity = 1;
//st = infokey(NIL, "no_grapple");
2001-07-17 05:58:10 +00:00
self.aura = 0;
//Remove everything he's carrying
self.job = 0;
self.is_malfunctioning = 0;
//self.is_cameraviewing = 0;
self.tf_items = 0;
self.cutf_items = 0;
self.tf_items_flags = 0;
self.items = 0;
self.ammo_rockets = 0;
self.ammo_nails = 0;
self.ammo_shells = 0;
self.ammo_cells = 0;
self.maxammo_rockets = 10; //Give em a minimal carrying capacity
self.maxammo_nails = 10;
self.maxammo_shells = 10;
self.maxammo_cells = 10;
self.maxammo_medikit = 0;
self.maxammo_detpack = 0;
self.ammo_c4det = 0;
self.demon_one = NIL; //SB - this tells us who our demon is for easy reference
self.demon_two = NIL; //- OfN- Used for hacker job, target building and for timer (% on sbar)
2001-07-17 05:58:10 +00:00
self.demon_blood = 0;
//self.demon_points = 5;
self.num_mines = 0; // OfN Number of mines set by the player
self.no_grenades_1 = 0;
self.no_grenades_2 = 0;
self.tp_grenades_1 = 0;
self.tp_grenades_2 = 0;
self.armor_allowed = 0.3; //Red yellow or green
self.armorclass = 0; //Red yellow or green
self.armorvalue = 0; //200 etc
self.maxarmor = 0; //200 etc
self.weapon = 0; // WEAP_HOOK & WEAP_SHOTGUN etc
2001-07-17 05:58:10 +00:00
self.current_weapon = 0; // No current weapon
if ((allow_hook) && (no_grapple != 1)) //If map allows it...
self.weapons_carried = WEAP_HOOK; // Start with grapple
2001-07-17 05:58:10 +00:00
else
self.weapons_carried = 0; // Or remove everything
self.weaponmodel = ""; //Remove the model of a weapon in front
self.solid = SOLID_NOT;
self.movetype = MOVETYPE_NONE;
self.takedamage = DAMAGE_NO;
2001-07-17 05:58:10 +00:00
//Ready to buy
self.maxspeed = 0; //Can't move while buying
self.max_health = 50;
self.health = 50;
#define PRICE_PER_FRAG 100
#define MAX_FRAGS_TO_SELL 50
//Calculate starting money
//This means the most someone can get is 50*100 = $5000
if (self.done_custom & CUSTOM_SELLING)
2001-07-17 05:58:10 +00:00
{
if (self.real_frags >= MAX_FRAGS_TO_SELL)
sell_no = MAX_FRAGS_TO_SELL;
2001-07-17 05:58:10 +00:00
else if (self.real_frags > 0)
sell_no = self.real_frags;
else {
sell_no = 0;
2004-04-12 05:37:50 +00:00
self.done_custom &= ~CUSTOM_SELLING;
2001-07-17 05:58:10 +00:00
}
self.real_frags = self.real_frags - sell_no;
self.frags = self.real_frags; //TODO: Make this work with TEAMFRAGS on
self.money = custom_money + sell_no * PRICE_PER_FRAG;
2001-07-17 05:58:10 +00:00
}
else
self.money = custom_money;
self.custom_speed = 250; //HWGUY Speed
//Overrides the menu handler to always display my menu
//Hack alert! This preserves the selling flag. :p
if (self.done_custom & CUSTOM_SELLING)
self.done_custom = CUSTOM_BUILDING | CUSTOM_SELLING;
2001-07-17 05:58:10 +00:00
else
self.done_custom = CUSTOM_BUILDING;
2001-07-17 05:58:10 +00:00
self.current_menu = MENU_PRIMARY_WEAPON;
2001-07-17 05:58:10 +00:00
Menu_PrimaryWeapon();
return;
};
void(vector org) spawn_tfog;
void() DropFromCustomClassGen =
{
//
self.is_killed = FALSE;
2001-07-17 05:58:10 +00:00
//
self.summon_one = NIL;
self.summon_two = NIL;
2001-07-17 05:58:10 +00:00
self.done_custom = CUSTOM_FINISHED;
2001-07-17 05:58:10 +00:00
self.maxspeed = self.custom_speed;
self.gravity = 1;
if (self.cutf_items & CUTF_TOSSABLEDET)
2001-07-17 05:58:10 +00:00
self.maxammo_detpack = 1;
//Make sure they have at least one axe-like weapon
if (!(self.weapons_carried & (WEAP_MEDIKIT | WEAP_SPANNER)) || (self.cutf_items & CUTF_KNIFE))
2004-04-12 05:37:50 +00:00
self.weapons_carried |= WEAP_AXE;
2001-07-17 05:58:10 +00:00
//CH if you bought Guerilla, you get 20 rockets :)
if (self.job & JOB_GUERILLA)
2001-07-17 05:58:10 +00:00
self.maxammo_rockets = self.maxammo_rockets + 20;
//OfN if we got the holo we get extra cells ammo space
if (self.cutf_items & CUTF_HOLO)
2001-07-17 05:58:10 +00:00
self.maxammo_cells = self.maxammo_cells + 40;
//If they bought weapons, remove their basic ammo allotment
if (self.maxammo_rockets > 10)
self.maxammo_rockets = self.maxammo_rockets - 10;
if (self.maxammo_nails > 10)
self.maxammo_nails = self.maxammo_nails - 10;
if (self.maxammo_shells > 10)
self.maxammo_shells = self.maxammo_shells - 10;
if (self.maxammo_cells > 10)
self.maxammo_cells = self.maxammo_cells - 10;
//Increase their supply if they bought a backpack or bandolier
if (self.tf_items & NIT_AMMO_BACKPACK) {
2001-07-17 05:58:10 +00:00
self.maxammo_rockets = self.maxammo_rockets + 30;
self.maxammo_nails = self.maxammo_nails + 100;
self.maxammo_shells = self.maxammo_shells + 100;
if (self.weapons_carried & WEAP_SPANNER)
2001-07-17 05:58:10 +00:00
self.maxammo_cells = self.maxammo_cells + 170;
else
self.maxammo_cells = self.maxammo_cells + 50;
if (self.maxammo_medikit > 0) //Only increase their medical supplies when...
self.maxammo_medikit = self.maxammo_medikit + 70;
if (self.maxammo_detpack > 0)
self.maxammo_detpack = self.maxammo_detpack + 0.5;
}
if (self.tf_items & NIT_AMMO_BANDOLIER) {
2001-07-17 05:58:10 +00:00
self.maxammo_rockets = self.maxammo_rockets + 10;
self.maxammo_nails = self.maxammo_nails + 50;
self.maxammo_shells = self.maxammo_shells + 50;
self.maxammo_cells = self.maxammo_cells + 30;
if (self.maxammo_medikit > 0)
self.maxammo_medikit = self.maxammo_medikit + 50;
if (self.maxammo_detpack > 1) //Only give extra det if they bought both
self.maxammo_detpack = 2;
}
//Clean up detpack fraction
if (self.maxammo_detpack > 1 && self.maxammo_detpack < 2)
self.maxammo_detpack = 1;
if (self.cutf_items & CUTF_SENSOR) // SB
2001-07-17 05:58:10 +00:00
self.maxammo_cells = self.maxammo_cells + 70;
if (self.cutf_items & CUTF_DISPENSER) // SB
2001-07-17 05:58:10 +00:00
self.maxammo_cells = self.maxammo_cells + 100;
if (self.cutf_items & CUTF_FIELDGEN) // SB
2001-07-17 05:58:10 +00:00
self.maxammo_cells = self.maxammo_cells + 140;
//- OfN
if (self.weapons_carried & WEAP_LASERCANNON) self.maxammo_cells = self.maxammo_cells + 70;
if (self.weapons_carried & WEAP_SNG) self.maxammo_nails = self.maxammo_nails + 70;
2001-07-17 05:58:10 +00:00
//Now cap the max ammo
if (self.maxammo_rockets > 100)
self.maxammo_rockets = 100;
if (self.maxammo_nails > 350)
self.maxammo_nails = 350;
if (self.maxammo_shells > 300)
self.maxammo_shells = 300;
//- ofn
if (self.tf_items & NIT_AMMO_BANDOLIER && self.tf_items & NIT_AMMO_BACKPACK)
2001-07-17 05:58:10 +00:00
{
if (self.maxammo_cells > 400)
self.maxammo_cells = 400;
}
else if (self.tf_items & NIT_AMMO_BACKPACK)
2001-07-17 05:58:10 +00:00
{
if (self.maxammo_cells > 360) // was 400
self.maxammo_cells = 360;
}
else
{
if (self.maxammo_cells > 320) // was 400
self.maxammo_cells = 320;
}
// I don't know if it has to do with the "FRONTLIN HELI BUG FIX" but this shouldn't all be
// duped here. If this breaks something, tell me what
// -Griev
#if 1
if (coop)
setspawnparms(self);
else
SetNewParms();
PutClientInServer();
TeamFortress_SetSpeed(self);
//GR - ofn hid this in the middle of code below, argh
ResetMenu();
self.impulse = 0;
#else
2001-07-17 05:58:10 +00:00
//- OFN HERE FRONTLIN HELI BUG FIX ---//
local entity spot;
spot = SelectSpawnPoint ();
// if (self.playerclass != PC_UNDEFINED)
2001-07-17 05:58:10 +00:00
//spawn_tdeath (spot.origin, self);
self.observer_list = spot;
setorigin (self, spot.origin + '0 0 1');
2001-07-17 05:58:10 +00:00
self.angles = spot.angles;
self.fixangle = TRUE; // turn this way immediately
2004-01-21 16:05:58 +00:00
self.mangle = '0 0 0';
2001-07-17 05:58:10 +00:00
makevectors(self.angles);
spawn_tfog (self.origin + v_forward*20);
//------------------------------------//
//Telefrag anyone sitting on top of us
spawn_tdeath(self.origin,self);
//Remove observer-like mode
self.takedamage = DAMAGE_AIM;
2001-07-17 05:58:10 +00:00
//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 custom class generation!\n");
return;
}
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;
self.solid = SOLID_SLIDEBOX;
2001-07-17 05:58:10 +00:00
self.pausetime = 0;
//Remove invisibility
//setmodel (self, "progs/eyes.mdl");
//setmodel (self, "progs/player.mdl");
self.modelindex = modelindex_player;
// Stock him up
// Display the Player's Class
TeamFortress_PrintJobName(self,self.job);
// Set the weapons and ammo for the player based on class
TeamFortress_SetEquipment();
// Set the health for the player based on class
TeamFortress_SetHealth();
// Set the speed for the player based on class
TeamFortress_SetSpeed(self);
// Set the skin for the player based on class
TeamFortress_SetSkin(self);
stuffcmd(self, "v_idlescale 0\n");
stuffcmd(self, "v_cshift 0 0 0 0\n");
stuffcmd(self, "bf\n");
ResetMenu();
self.impulse = 0;
//Make them invincible if they bought respawn protection
if (self.tf_items & NIT_RESPAWN_GUARD) {
GivePent (self, RESPAWN_GUARD_TIME);
2001-07-17 05:58:10 +00:00
if (self.custom_speed > 300)
self.invincible_finished = self.invincible_finished - 1;
if (self.custom_speed > 400)
self.invincible_finished = self.invincible_finished - 1;
}
//Come again!
sprint(self,PRINT_HIGH,"Type 'custom' at the console to build a new class.\n");
2001-07-17 05:58:10 +00:00
//- OfN - Set army timer //
if (self.job & JOB_ARMY)
2001-07-17 05:58:10 +00:00
{
SetArmyTimer();
}
#endif // removed dup code
2001-07-17 05:58:10 +00:00
return;
};
void() PrintMoney =
{
if (pay_msgs != 1)
return;
local string as;
sprint(self,PRINT_HIGH,"You have ");
2001-07-17 05:58:10 +00:00
as = ftos(self.money);
sprint(self,PRINT_HIGH,as);
sprint(self,PRINT_HIGH," dollars left.\n");
2001-07-17 05:58:10 +00:00
return;
};
void(float in) PrintRefund=
{
local string as;
if (pay_msgs == 1)
{
sprint(self,PRINT_HIGH,"You sell it back for ");
2001-07-17 05:58:10 +00:00
as = ftos(in);
sprint(self,PRINT_HIGH,as);
sprint(self,PRINT_HIGH," dollars.\n");
2001-07-17 05:58:10 +00:00
}
self.money = self.money + in; //Give em a refund
if (pay_msgs == 1)
{
sprint(self,PRINT_HIGH,"You now have ");
2001-07-17 05:58:10 +00:00
as = ftos(self.money);
sprint(self,PRINT_HIGH,as);
sprint(self,PRINT_HIGH," dollars available.\n");
2001-07-17 05:58:10 +00:00
}
return;
};
void(float in) PrintNotEnoughMoney =
{
if (pay_msgs != 1)
{
sprint(self,PRINT_HIGH,"Not enough money!\n");
2001-07-17 05:58:10 +00:00
return;
}
local string as;
sprint(self,PRINT_HIGH,"Sorry, that costs ");
2001-07-17 05:58:10 +00:00
as = ftos(in);
sprint(self,PRINT_HIGH,as);
sprint(self,PRINT_HIGH," dollars.\n");
2001-07-17 05:58:10 +00:00
sprint(self,PRINT_HIGH,"You only have ");
2001-07-17 05:58:10 +00:00
as = ftos(self.money);
sprint(self,PRINT_HIGH,as);
sprint(self,PRINT_HIGH," dollars left.\n");
2001-07-17 05:58:10 +00:00
return;
};
//Functions for determining ammo carrying capacity
float (float item) countshells =
{
/* if (chris)
{
if (item == WEAP_SHOTGUN) return 16;
if (item == WEAP_SPANNER) return 20;
if (item == WEAP_SUPER_SHOTGUN) return 32;
if (item == WEAP_ASSAULT_CANNON) return 75;
2001-07-17 05:58:10 +00:00
}
else
{*/
if (item == WEAP_SHOTGUN) return 25;
if (item == WEAP_SPANNER) return 40;
if (item == WEAP_SUPER_SHOTGUN) return 50;
if (item == WEAP_ASSAULT_CANNON) return 100;
2001-07-17 05:58:10 +00:00
//}
return 0;
};
float (float item) countnails =
{
/*if (chris)
{
if (item == WEAP_MAUSER) return 10;
if (item == WEAP_TRANQ) return 20;
if (item == WEAP_LASER) return 10;
if (item == WEAP_NAILGUN) return 75;
if (item == WEAP_LIGHT_ASSAULT) return 100;
2001-07-17 05:58:10 +00:00
}
else
{*/
if (item == WEAP_MAUSER) return 30;
if (item == WEAP_TRANQ) return 30;
if (item == WEAP_LASER) return 50;
if (item == WEAP_NAILGUN) return 100;
if (item == WEAP_LIGHT_ASSAULT) return 150;
2001-07-17 05:58:10 +00:00
//}
return 0;
};
float (float item) countrockets =
{
/*if (chris)
{
if (item == WEAP_SPANNER) return 2;
if (item == WEAP_ROCKET_LAUNCHER) return 3;
if (item == WEAP_GRENADE_LAUNCHER) return 7;
2001-07-17 05:58:10 +00:00
}
else
{*/
if (item == WEAP_SPANNER) return 30;
if (item == WEAP_ROCKET_LAUNCHER) return 30;
if (item == WEAP_GRENADE_LAUNCHER) return 50;
2001-07-17 05:58:10 +00:00
//}
return 0;
};
float (float item) countcells =
{
/*if (chris)
{
if (item == WEAP_ASSAULT_CANNON) return 16;
if (item == WEAP_DAEDALUS) return 50;
if (item == WEAP_LIGHTNING) return 75;
if (item == WEAP_SPANNER) return 150;
2001-07-17 05:58:10 +00:00
}
else
{*/
if (item == WEAP_ASSAULT_CANNON) return 50;
if (item == WEAP_DAEDALUS) return 100;
if (item == WEAP_LIGHTNING) return 100;
if (item == WEAP_SPANNER) return 150;
2001-07-17 05:58:10 +00:00
//}
return 0;
};
void(float cost, float item) BuyWeapon =
{
if (item == 0) //Make sure we don't buy a null weapon
return;
if (self.weapons_carried & item) //We are selling
{
if (item == WEAP_ROCKET_LAUNCHER && self.tf_items & NIT_RL_LASER_SIGHT)
2001-07-17 05:58:10 +00:00
{
self.money = self.money + 1000;
2004-04-12 05:37:50 +00:00
self.tf_items &= ~NIT_RL_LASER_SIGHT;
2001-07-17 05:58:10 +00:00
}
if (item == WEAP_ROCKET_LAUNCHER && self.tf_items & NIT_CLUSTER_ROCKETS)
2001-07-17 05:58:10 +00:00
{
self.money = self.money + 3250;
2004-04-12 05:37:50 +00:00
self.tf_items &= ~NIT_CLUSTER_ROCKETS;
2001-07-17 05:58:10 +00:00
}
self.maxammo_shells = self.maxammo_shells - countshells(item);
self.maxammo_nails = self.maxammo_nails - countnails(item);
self.maxammo_rockets = self.maxammo_rockets - countrockets(item);
self.maxammo_cells = self.maxammo_cells - countcells(item);
PrintRefund(cost);
self.weapons_carried = self.weapons_carried - item;
return;
}
if (cost > self.money)
{
PrintNotEnoughMoney(cost);
return;
}
//Add to max ammo
self.maxammo_shells = self.maxammo_shells + countshells(item);
self.maxammo_nails = self.maxammo_nails + countnails(item);
self.maxammo_rockets = self.maxammo_rockets + countrockets(item);
self.maxammo_cells = self.maxammo_cells + countcells(item);
2004-04-12 05:37:50 +00:00
self.weapons_carried |= item;
2001-07-17 05:58:10 +00:00
self.money = self.money - cost;
PrintMoney();
};
void(float cost, float item) BuyCuTF =
{
if (item == 0) //Make sure we don't buy a null weapon
return;
if (item == CUTF_OTR && !(self.weapons_carried & WEAP_SNIPER_RIFLE)) {
sprint(self,PRINT_HIGH,"These are special bullets for the sniper rifle, buy one first\n");
2001-07-17 05:58:10 +00:00
return;
}
if (self.cutf_items & item) //We are selling
{
if (item == CUTF_SENTRYGUN) {
2001-07-17 05:58:10 +00:00
self.maxammo_shells = self.maxammo_shells - 130;
self.maxammo_cells = self.maxammo_cells - 130;
}
PrintRefund(cost);
self.cutf_items = self.cutf_items - item;
return;
}
if (cost > self.money)
{
PrintNotEnoughMoney(cost);
return;
}
//Add to max ammo if sentrygun purchase
if (item == CUTF_SENTRYGUN) {
2001-07-17 05:58:10 +00:00
self.maxammo_shells = self.maxammo_shells + 130;
self.maxammo_cells = self.maxammo_cells + 130;
}
2004-04-12 05:37:50 +00:00
self.cutf_items |= item;
2001-07-17 05:58:10 +00:00
self.money = self.money - cost;
PrintMoney();
};
//CH gives ammo for items
void(float item) Apply_Item_Ammo =
{
local float cellsfoo,rocketsfoo;
cellsfoo = rocketsfoo = 0;
if (item == NIT_TESLA)
2001-07-17 05:58:10 +00:00
cellsfoo = 150;
if (item == NIT_SECURITY_CAMERA)
2001-07-17 05:58:10 +00:00
cellsfoo = 60;
if (item == NIT_TELEPORTER)
2001-07-17 05:58:10 +00:00
cellsfoo = 100;
if (item == NIT_RL_LASER_SIGHT)
2001-07-17 05:58:10 +00:00
rocketsfoo = 10;
if (item == NIT_CLUSTER_ROCKETS)
2001-07-17 05:58:10 +00:00
rocketsfoo = 20;
if (self.tf_items & item) { //we selling
self.maxammo_cells = self.maxammo_cells - cellsfoo;
self.maxammo_rockets = self.maxammo_rockets - rocketsfoo;
}
else {
self.maxammo_cells = self.maxammo_cells + cellsfoo;
self.maxammo_rockets = self.maxammo_rockets + rocketsfoo;
}
};
void(float cost, float item) BuyItem =
{
if (item == 0) //Make sure we don't buy a null item
return;
Apply_Item_Ammo(item); //CH
if (self.tf_items & item) //We are selling
{
if (item == NIT_HOVER_BOOTS && self.tf_items & NIT_HOVER_BOOTS_UPGRADE) {
// self.money = self.money + 350; //sync with buying of upgrade
// item &= ~NIT_HOVER_BOOTS_UPGRADE;
BuyItem (350, NIT_HOVER_BOOTS_UPGRADE); // sync with buying of upgrade
2001-07-17 05:58:10 +00:00
}
PrintRefund(cost);
self.tf_items -= item;
2001-07-17 05:58:10 +00:00
return;
}
//Special rules
if (item == NIT_AUTOSCANNER && !(self.tf_items & NIT_SCANNER)) {
sprint(self,PRINT_HIGH,"Sorry, you have to have the scanner first\n");
2001-07-17 05:58:10 +00:00
return;
}
if ((item == NIT_RL_LASER_SIGHT || item == NIT_CLUSTER_ROCKETS) && !(self.weapons_carried & WEAP_ROCKET_LAUNCHER)) {
sprint(self,PRINT_HIGH,"Sorry, you have to have the rocket launcher first\n");
2001-07-17 05:58:10 +00:00
return;
}
if (item == NIT_HOVER_BOOTS)
sprint(self,PRINT_HIGH,"Hold down jump to use the boots\n");
if (item == NIT_HOVER_BOOTS_UPGRADE && !(self.tf_items & NIT_HOVER_BOOTS)) {
sprint(self,PRINT_HIGH,"Sorry, you have to have the hover boots first\n");
2001-07-17 05:58:10 +00:00
return;
}
if (cost > self.money)
{
PrintNotEnoughMoney(cost);
return;
}
2004-04-12 05:37:50 +00:00
self.tf_items |= item;
2001-07-17 05:58:10 +00:00
self.money = self.money - cost;
PrintMoney();
};
void(float cost, float type) BuyJob =
{
if (type == 0) //Make sure we don't buy a null grenade
return;
if (type == self.job) //We are selling
{
if (self.job & JOB_WARLOCK)
2001-07-17 05:58:10 +00:00
{
if (!(self.cutf_items & CUTF_DEMONLORE))
2001-07-17 05:58:10 +00:00
cost = cost - 300; // sync with demonlore cost
else
2004-04-12 05:37:50 +00:00
self.cutf_items &= ~CUTF_DEMONLORE;
2001-07-17 05:58:10 +00:00
}
if (self.job & JOB_RUNNER)
2001-07-17 05:58:10 +00:00
{
if (!(self.cutf_items & CUTF_HIGHJUMP))
2001-07-17 05:58:10 +00:00
cost = cost - 200; // sync with highjump cost
else
2004-04-12 05:37:50 +00:00
self.cutf_items &= ~CUTF_HIGHJUMP;
2001-07-17 05:58:10 +00:00
}
if (self.job & JOB_JUDOKA)
2001-07-17 05:58:10 +00:00
{
if (!(self.cutf_items & CUTF_STEALTH))
2001-07-17 05:58:10 +00:00
cost = cost - 400; // sync with stealth cost
else
2004-04-12 05:37:50 +00:00
self.cutf_items &= ~CUTF_STEALTH;
2001-07-17 05:58:10 +00:00
}
PrintRefund(cost);
self.job = 0;
return;
}
if (cost > self.money)
{
PrintNotEnoughMoney(cost);
return;
}
if (self.job) { //Make sure we haven't bought another kind already
sprint(self,PRINT_HIGH,"You already have a job. Leave your other one first.\n");
2001-07-17 05:58:10 +00:00
return;
}
//Special rules for buying jobs
if (type == JOB_WARLOCK && !(self.cutf_items & CUTF_KNIFE)) {
sprint(self,PRINT_HIGH,"Every Warlock needs a good bloody knife. Buy one.\n");
2001-07-17 05:58:10 +00:00
return;
}
if (type == JOB_WARLOCK)
if (self.cutf_items & CUTF_DEMONLORE)
2001-07-17 05:58:10 +00:00
self.money = self.money + 300; // sync this with demonlore cost
else
2004-04-12 05:37:50 +00:00
self.cutf_items |= CUTF_DEMONLORE; // warlocks see demon health
2001-07-17 05:58:10 +00:00
if (type == JOB_RUNNER)
if (self.cutf_items & CUTF_HIGHJUMP)
2001-07-17 05:58:10 +00:00
self.money = self.money + 200; // sync with highjump cost
else
2004-04-12 05:37:50 +00:00
self.cutf_items |= CUTF_HIGHJUMP; // runner jumps high
2001-07-17 05:58:10 +00:00
if (type == JOB_JUDOKA)
if (self.cutf_items & CUTF_STEALTH)
2001-07-17 05:58:10 +00:00
self.money = self.money + 400; // sync with stealth price
else
2004-04-12 05:37:50 +00:00
self.cutf_items |= CUTF_STEALTH; // Judo is a master of stealth by default
2001-07-17 05:58:10 +00:00
//Ok we buy it
self.job = type;
self.money = self.money - cost;
PrintMoney();
};
void (float cost, float type) BuyGren =
{
///local float level; // This is the level of legs we have.
if (type == 0) // if type is 0 we are buying the NULL GRENADE(tm)
{
sprint(self, PRINT_HIGH, "Congratulations. You have just attempted to buy a null grenade.\n");
RPrint("WARNING: Attempted purchase of NULL GRENADE. BUG BUG BUG BUG BUG BUG BUG\n");
2001-07-17 05:58:10 +00:00
return;
}
// Check whether we're allowing gren purchase.
/*level = ReturnLegLevel(self.custom_speed);
if (level == 1) // grens are a no-no
{
sprint(self, PRINT_HIGH, "Sorry, you are not allowed any grenades at that speed. It is very dangerous.\n");
2001-07-17 05:58:10 +00:00
return;
}
else if (level == 2)
{
local float acc; // Acceptable.
acc = FALSE;
2001-07-17 05:58:10 +00:00
if (type == GR_TYPE_CALTROP)
acc = TRUE;
else if (type == GR_TYPE_CONCUSSION)
acc = TRUE;
2001-07-17 05:58:10 +00:00
else if (type == GR_TYPE_STASIS)
acc = TRUE;
else if (type == GR_TYPE_ANTIGRAV)
acc = TRUE;
else if (type == GR_TYPE_FLARE)
acc = TRUE;
2001-07-17 05:58:10 +00:00
if (!acc)
{
sprint(self, PRINT_HIGH, "Sorry, using those grenades at your speed could be dangerous.\n");
2001-07-17 05:58:10 +00:00
return;
}
}
else if (level == 3)
{
if (type == GR_TYPE_MIRV)
2001-07-17 05:58:10 +00:00
{
sprint(self, PRINT_HIGH, "Sorry, you aren't allowed MIRVs at that speed.\n");
2001-07-17 05:58:10 +00:00
return;
}
}*/
// Grenade and speed is fine.
if (!self.tp_grenades_1 && cost <= self.money) // if we don't have gren1s, make it a gren1
{
/* if (self.money_misc + cost > self.money_spent - self.money_misc)
{
PrintTooHighProportion();
return;
} */
self.tp_grenades_1 = type;
//sprint(self, PRINT_HIGH, "You buy the grenades and add them to your first grenade slot for ");
2001-07-17 05:58:10 +00:00
}
else if (!self.tp_grenades_2 && cost <= self.money) // We already have gren1s, can we buy gren2s?
{
/*if (self.money_misc + cost > self.money_spent - self.money_misc)
{
PrintTooHighProportion();
return;
}*/
self.tp_grenades_2 = type;
//sprint(self, PRINT_HIGH, "You buy the grenades and add them to your second grenade slot for ");
2001-07-17 05:58:10 +00:00
}
else // We have both gren1s and gren2s so now we need to try to sell some
{ // If our type matches gren1 AND gren2s we want to sell both
if (self.tp_grenades_1 == type && self.tp_grenades_2 == type)
{
PrintRefund(cost * 2);
//self.money_misc = self.money_misc - cost * 2;
//self.money = self.money + cost * 2; //*2
self.tp_grenades_1 = 0;
self.tp_grenades_2 = 0;
}
else if (self.tp_grenades_1 == type) // otherwise if our gren1s are the type
{
PrintRefund(cost);
//self.money_misc = self.money_misc - cost;
//self.money = self.money + cost;
self.tp_grenades_1 = 0;
}
else if (self.tp_grenades_2 == type) // otherwise if we have gren2s as the type..
{
PrintRefund(cost);
//self.money_misc = self.money_misc - cost;
//self.money = self.money + cost;
self.tp_grenades_2 = 0;
}
else if (cost <= self.money)
sprint(self,PRINT_HIGH,"You already have a full set of grenades. Sell some back first.\n");
2001-07-17 05:58:10 +00:00
else
PrintNotEnoughMoney(cost);
return;
}
self.money = self.money - cost;
//self.money_misc = self.money_misc + cost;
//self.money_spent = self.money_spent + cost;
/*talk = ftos(cost);
sprint(self, PRINT_HIGH, talk);
sprint(self, PRINT_HIGH, " dollars. You have ");
2001-07-17 05:58:10 +00:00
talk = ftos(self.money);
sprint(self, PRINT_HIGH, talk);
sprint(self, PRINT_HIGH, " dollars left.\n");*/
2001-07-17 05:58:10 +00:00
};
/*
void(float cost, float type) BuyGren1 =
{
if (type == 0) //Make sure we don't buy a null grenade
return;
if (type == self.tp_grenades_1) //We are selling
{
PrintRefund(cost);
self.tp_grenades_1 = 0;
return;
}
if (cost > self.money)
{
PrintNotEnoughMoney(cost);
return;
}
if (self.tp_grenades_1) { //Make sure we haven't bought another kind already
sprint(self,PRINT_HIGH,"You already have grenades. Sell back the ones you bought first.\n");
2001-07-17 05:58:10 +00:00
return;
}
//Ok we buy it
self.tp_grenades_1 = type;
self.money = self.money - cost;
PrintMoney();
};
void(float cost, float type) BuyGren2 =
{
if (type == 0) //Make sure we don't buy a null grenade
return;
if (type == self.tp_grenades_2) //We are selling
{
PrintRefund(cost);
self.tp_grenades_2 = 0;
return;
}
if (cost > self.money)
{
PrintNotEnoughMoney(cost);
return;
}
if (self.tp_grenades_2) { //Make sure we haven't bought another kind already
sprint(self,PRINT_HIGH,"You already have grenades. Sell back the ones you bought first.\n");
2001-07-17 05:58:10 +00:00
return;
}
//Ok we buy it
self.tp_grenades_2 = type;
self.money = self.money - cost;
PrintMoney();
};
*/
//Functions for our new grenades
void() fragspike_touch =
{
//if (pointcontents(self.origin) == CONTENTS_SKY)
if (pointcontents(self.origin) != CONTENTS_EMPTY)
2001-07-17 05:58:10 +00:00
{
dremove(self);
return;
}
// hit something that bleeds
if (other.takedamage)
{
deathmsg = DMSG_GREN_FRAG;
2001-07-17 05:58:10 +00:00
TF_T_Damage (other, self, self.real_owner, 150, TF_TD_NOTTEAM, TF_TD_NAIL);
2001-07-17 05:58:10 +00:00
dremove(self);
}
else
{
//We bounce off NIL since we are fragments
2001-07-17 05:58:10 +00:00
if (self.heat > 0) {
// self.heat = self.heat - 1;
// if (self.velocity = '0 0 0') { //Skip around
if (1) { //Skip around
self.velocity_x = (random() - 0.5) * 200;
self.velocity_y = (random() - 0.5) * 200;
self.velocity_z = random() * 200;
}
}
else {
if (other.classname == "force_field") //- OfN - Makes field explosion b4 removing it
FieldExplosion(other,self.origin,self);
else
{
WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
WriteByte (MSG_MULTICAST, TE_SUPERSPIKE);
WriteCoord (MSG_MULTICAST, self.origin_x);
WriteCoord (MSG_MULTICAST, self.origin_y);
WriteCoord (MSG_MULTICAST, self.origin_z);
multicast (self.origin, MULTICAST_PHS);
2001-07-17 05:58:10 +00:00
}
dremove(self);
}
}
};
void() FragSpikeThink =
{
if (self.heat > 0) {
self.heat = self.heat - 1;
self.angles_y = random() * 360;
self.angles_x = 0;
self.angles_z = 0;
makevectors(self.angles);
2004-01-25 21:59:57 +00:00
if (self.velocity == '0 0 0')
2001-07-17 05:58:10 +00:00
self.origin_z = self.origin_z + 50;
self.velocity = v_forward * 1000;
self.velocity_z = (random() + 0.25) * 1000;
self.nextthink = time + 0.5 + random();
}
else {
WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
WriteByte (MSG_MULTICAST, TE_SUPERSPIKE);
WriteCoord (MSG_MULTICAST, self.origin_x);
WriteCoord (MSG_MULTICAST, self.origin_y);
WriteCoord (MSG_MULTICAST, self.origin_z);
multicast (self.origin, MULTICAST_PHS);
2001-07-17 05:58:10 +00:00
dremove(self);
}
};
void() FragGrenadeTouch =
{
if (other == self.owner)
return; // don't explode on owner
// Thrown grenades don't detonate when hitting an enemy
sound (self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM); // bounce sound
2001-07-17 05:58:10 +00:00
if (self.velocity == '0 0 0')
self.avelocity = '0 0 0';
};
void() FragGrenadeExplode =
{
local float shraps;
local entity newmis;
//Small explosive radius
deathmsg = DMSG_GREN_HAND;
T_RadiusDamage (self, self.owner, 80, NIL);
2001-07-17 05:58:10 +00:00
WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
WriteByte (MSG_MULTICAST, TE_EXPLOSION);
WriteCoord (MSG_MULTICAST, self.origin_x);
WriteCoord (MSG_MULTICAST, self.origin_y);
WriteCoord (MSG_MULTICAST, self.origin_z);
multicast (self.origin, MULTICAST_PHS);
2001-07-17 05:58:10 +00:00
shraps = rint(6 * random()) + 6; //Pieces of shrapmetal;
while (shraps > 0) {
self.angles_y = random() * 360;
self.angles_x = 0;
self.angles_z = 0;
makevectors(self.angles);
deathmsg = DMSG_GREN_NAIL;
2001-07-17 05:58:10 +00:00
newmis = spawn ();
//WK Make shraps hit owner newmis.owner = self.owner;
newmis.real_owner = self.owner;
newmis.movetype = MOVETYPE_BOUNCE;
newmis.solid = SOLID_BBOX;
2001-07-17 05:58:10 +00:00
newmis.angles = '0 0 0';
newmis.classname = "spike";
newmis.think = FragSpikeThink;
// newmis.think = SUB_Remove;
newmis.nextthink = time + 1;
setmodel (newmis, "progs/spike.mdl");
setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);
2001-07-17 05:58:10 +00:00
setorigin (newmis, self.origin);
//Start it over the ground
newmis.origin_z = newmis.origin_z + 10;
newmis.velocity = v_forward * 1000;
if (random() < 0.5)
newmis.velocity_z = 20;
else
newmis.velocity_z = random() * 1000;
newmis.avelocity = '100 100 100';
newmis.touch = fragspike_touch;
newmis.weapon = DMSG_GREN_NAIL;
2001-07-17 05:58:10 +00:00
//Make it bounce six times.
newmis.heat = 5;
shraps = shraps - 1;
}
WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
WriteByte (MSG_MULTICAST, TE_EXPLOSION);
WriteCoord (MSG_MULTICAST, self.origin_x);
WriteCoord (MSG_MULTICAST, self.origin_y);
WriteCoord (MSG_MULTICAST, self.origin_z);
multicast (self.origin, MULTICAST_PHS);
2001-07-17 05:58:10 +00:00
dremove(self);
};
void() KracGrenadeTouch =
{
//WK Have it detonate on impact
if (other == self.owner)
return; // don't explode on owner
sound (self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM); // bounce sound
2001-07-17 05:58:10 +00:00
KracGrenadeExplode();
};
void() KracGrenadeExplode =
{
local entity te;
2001-07-17 05:58:10 +00:00
local entity oldself;
te = findradius(self.origin, 150);
while (te)
{
// Player?
if (te.classname == "player")
{
//WW: Kracs disable detpack
oldself = self;
self = te;
TeamFortress_DetpackStop(TRUE);
2001-07-17 05:58:10 +00:00
self = oldself;
//Gel armor makes kracs do less damage
if (te.armorclass & AT_SAVEMELEE) {
2001-07-17 05:58:10 +00:00
if (te.armorvalue > 75)
te.armorvalue = 75;
} else {
if (te.armorvalue > 10)
te.armorvalue = 10;
}
te.ammo_cells = 0; //Kill their metal supply too
}
else if (te.classname == "pipebomb")
te.nextthink = time + 0.1 + random();
else if (te.classname == "grenade" && te.netname == "land_mine")
{
te.think = GuerillaExplode;
te.nextthink = time + 0.1;
}
else if (te.classname == "building_sentrygun")
TF_T_Damage(te, self, self.owner, 200, 0, 0);
else if (te.classname == "building_tesla")
TF_T_Damage(te, self, self.owner, 200, 0, 0);
else if (te.classname == "building_dispenser")
TF_T_Damage(te, self, self.owner, 500, 0, 0);
else if (te.classname == "building_camera")
TF_T_Damage(te, self, self.owner, 400, 0, 0);
else if (te.classname == "building_teleporter")
TF_T_Damage(te, self, self.owner, 200, 0, 0);
else if (te.classname == "building_sensor") //- Often - needed?
TF_T_Damage(te, self, self.owner, 200, 0, 0);
else if (te.classname == "item_armor1" || te.classname == "item_armor2" || te.classname == "item_armorInv") {
te.solid = SOLID_NOT;
te.model = "";
2001-07-17 05:58:10 +00:00
te.nextthink = time + 45; //WK 20
te.think = SUB_regen;
//SUB_UseTargets();
}
else if (te.classname == "detpack") {
if (te.owner.netname != self.owner.netname) {
bprint (PRINT_MEDIUM, te.owner.netname);
bprint (PRINT_MEDIUM, "'s detpack was Kraced by ");
bprint (PRINT_MEDIUM, self.owner.netname);
bprint (PRINT_MEDIUM, "\n");
2001-07-17 05:58:10 +00:00
} else {
sprint (te.owner, PRINT_MEDIUM, "You Kraced your own detpack!\n");
2001-07-17 05:58:10 +00:00
}
// This code handles disarming a detpack
if (te.weaponmode == 1) // Detpack was being disarmed
{
2004-04-12 05:37:50 +00:00
te.enemy.tfstate &= ~TFSTATE_CANT_MOVE;
2001-07-17 05:58:10 +00:00
TeamFortress_SetSpeed(te.enemy);
dremove(te.oldenemy); // CountDown
dremove(te.observer_list); // Disarm timer
}
else { //Not being disarmed
dremove(te.oldenemy); // CountDown
}
te.think = BecomeExplosion;
te.nextthink = time + 0.1;
}
te = te.chain;
}
WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
WriteByte (MSG_MULTICAST, TE_EXPLOSION);
WriteCoord (MSG_MULTICAST, self.origin_x);
WriteCoord (MSG_MULTICAST, self.origin_y);
WriteCoord (MSG_MULTICAST, self.origin_z);
multicast (self.origin, MULTICAST_PHS);
2001-07-17 05:58:10 +00:00
dremove(self);
};
//Stops us from lowering the time immunity
void(entity immuner,float timeimmune) makeImmune =
{
if (!immuner) return;
2001-07-17 05:58:10 +00:00
if (immuner.immune_to_chec > timeimmune) return;
immuner.immune_to_chec = timeimmune;
};
void() BastardTimer =
{
local entity te;
local float tc, tc2;
2001-07-17 05:58:10 +00:00
te = self.owner;
//makeImmune(te,time+5);
if (te.penance_time < time)
{
stuffcmd(te, "cl_yawspeed 140;-right;-left\n");
//stuffcmd(te, "name \"");
//stuffcmd(te, te.old_netname);
//stuffcmd(te, "\"\n");
// Reset their color
tc = TeamGetColor (te.team_no) - 1;
tc2 = TeamGetNiceColor (te.team_no);
SetPlayerColor (te, tc, tc2);
2001-07-17 05:58:10 +00:00
bprint (PRINT_MEDIUM, te.netname);
bprint (PRINT_MEDIUM, " has his teamkill curse removed\n");
2001-07-17 05:58:10 +00:00
//Don't let up on them. Two more teamkills and its back into the tarpit for them
te.ff_count = self.frags - 1.9;
if (te.ff_count < 0) te.ff_count = 0;
TF_T_Damage(te, NIL, NIL, te.health + 300, TF_TD_IGNOREARMOUR, TF_TD_OTHER);
2001-07-17 05:58:10 +00:00
remove(self);
return;
}
if (random() > 0.5)
{
stuffcmd(te, "cl_yawspeed 500;-left;+right\n");
SetPlayerColor (te, 8, 8);
}
2001-07-17 05:58:10 +00:00
else
{
stuffcmd(te, "cl_yawspeed 500;-right;+left\n");
SetPlayerColor (te, 9, 9);
}
2001-07-17 05:58:10 +00:00
//te.immune_to_check = time + 5;
te.ammo_rockets = 0;
te.ammo_cells = 0;
te.ammo_nails = 0;
te.ammo_shells = 0;
te.ammo_detpack = 0;
te.ammo_c4det = 0;
te.no_grenades_1 = 0;
te.no_grenades_2 = 0;
2001-07-17 05:58:10 +00:00
if (te.health > 50) te.health = 50;
if (te.armorvalue > 10) te.armorvalue = 10;
self.nextthink = time + 2;
};
void(entity bastard,float threshold) createBastard =
{
local entity te;
if (!bastard) return;
2001-07-17 05:58:10 +00:00
if (bastard.penance_time > time) {
bastard.ff_count = bastard.ff_count - 1; //Dont count it
bastard.penance_time = time + 60; //Just reset the clock
makeImmune(bastard,time+65);
return;
}
//---------------------------------------------------------------------------//
// Why do I not like MegaTF? ------------------------------------------------//
// Look at http://www.planetfortress.com/history/people/shaka.html ----------//
if (bastard.ff_count == threshold + 0.1 || bastard.ff_count == threshold + 0.6) {
//- OfN - lol
//bprint(PRINT_HIGH,"<22><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><>M\n");
bprint(PRINT_HIGH,"ok, lets send ");
bprint(PRINT_HIGH,bastard.netname);
bprint(PRINT_HIGH," to a nice megaTF server...\n");
2001-07-17 05:58:10 +00:00
stuffcmd(bastard, "name \"CustomTF reject-wanna play Mega\"\n");
//stuffcmd(bastard, "name \"im gay, wanna make new friends\"\n");
local string st;
st = infokey(NIL,"curseserver");
//if (!st) st = "207.171.0.74";
if (!st) st = "209.39.192.74:27500";
2001-07-17 05:58:10 +00:00
stuffcmd(bastard, "connect ");
stuffcmd(bastard, st);
stuffcmd(bastard, "\n");
return; //- OfN - (missing) OLD BUG?
} //---------------------------------------------------------------------------//
newmis = spawn();
newmis.classname = "timer";
newmis.netname = "bastardtimer";
newmis.owner = bastard;
newmis.think = BastardTimer;
newmis.nextthink = time + 1;
newmis.frags = threshold; //Let the timer know what the thresh is
makeImmune(bastard,time+65);
//bastard.immune_to_check = time + 65; //Make him immune while purple
//bastard.old_netname = bastard.netname;
bprint (PRINT_MEDIUM, bastard.netname);
bprint (PRINT_MEDIUM, " has been struck down by the wrath of the admin.\n");
bprint (PRINT_MEDIUM, "Feel free to frag him at will.\n");
2001-07-17 05:58:10 +00:00
bastard.penance_time = time + 60;
stuffcmd(bastard, "name \"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (");
// stuffcmd(bartard, "name \"\<TeamKiller\> (");
2001-07-17 05:58:10 +00:00
stuffcmd(bastard, bastard.netname);
stuffcmd(bastard, ")\"\n");
// Drop any GoalItems
te = find (NIL, classname, "item_tfgoal");
2001-07-17 05:58:10 +00:00
while (te)
{
if (te.owner == bastard)
{
// Remove it from the player, if it is supposed to be
if (!(te.goal_activation & TFGI_KEEP))
2001-07-17 05:58:10 +00:00
{
tfgoalitem_RemoveFromPlayer(te, bastard, 0);
}
// CTF support
if (CTF_Map == TRUE && te.goal_no == CTF_FLAG1)
2001-07-17 05:58:10 +00:00
{
bprint(PRINT_HIGH, bastard.netname);
bprint(PRINT_HIGH, " <20><><EFBFBD><EFBFBD> the <20><><EFBFBD><EFBFBD> flag!\n");
2001-07-17 05:58:10 +00:00
}
else if (CTF_Map == TRUE && te.goal_no == CTF_FLAG2)
2001-07-17 05:58:10 +00:00
{
bprint(PRINT_HIGH, bastard.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");
}
return;
};
void() Autoitem_think =
{
local entity oself;
local float happy;
if (self.heat == TRUE)
self.heat = FALSE;
2001-07-17 05:58:10 +00:00
else
self.heat = TRUE;
2001-07-17 05:58:10 +00:00
happy = self.heat;
oself = self;
self = self.owner;
if (self.tf_items & NIT_AUTOID) {
2001-07-17 05:58:10 +00:00
//Do an id
TeamFortress_ID(TRUE); //TRUE means we are in autoitemthink
2001-07-17 05:58:10 +00:00
}
if (self.weapons_carried & WEAP_MEDIKIT) {
//Do a heal, passing it TRUE tells it not to "tink"
2001-07-17 05:58:10 +00:00
//Don't automedic whack while fully invisible
if (!(self.job & JOB_THIEF && (self.job & JOB_ACTIVE || self.job & JOB_FULL_HIDE)))
W_FireMedikit(TRUE);
2001-07-17 05:58:10 +00:00
}
if (happy) { //Only do this every two seconds
if (self.tf_items & NIT_AUTOSCANNER) {
2001-07-17 05:58:10 +00:00
//Do a scan15
TeamFortress_Scan(15,TRUE);
2001-07-17 05:58:10 +00:00
}
}
self = oself;
self.nextthink = time + 0.5;
};
void() custom_lay =
{
if (self.last_saveme_sound < time) {
bprint(PRINT_HIGH,self.netname);
bprint(PRINT_HIGH,"'s legs were broken when he tried to 'lay'\n");
sound(self,CHAN_VOICE,"player/pain1.wav",1,ATTN_NONE);
2001-07-17 05:58:10 +00:00
self.last_saveme_sound = time + 60;
}
self.suicide_time = time + 60;
self.leg_damage = 9;
TeamFortress_SetSpeed(self);
if (self.health > 50) self.health = 50;
if (self.armorvalue > 10) self.armorvalue = 10;
};
//Blow up all sentries, dispensers and teslas if we can no longer build them
void() DetonateAllGuns =
{
if (!(self.cutf_items & CUTF_DISPENSER))
2001-07-17 05:58:10 +00:00
Find_And_Dmg("building_dispenser", self, 1);
if (!(self.cutf_items & CUTF_SENTRYGUN))
2001-07-17 05:58:10 +00:00
Find_And_Dmg("building_sentrygun", self, 1);
if (!(self.tf_items & NIT_TESLA)) //WK
2001-07-17 05:58:10 +00:00
Find_And_Dmg("building_tesla", self, 1);
if (!(self.tf_items & NIT_SECURITY_CAMERA)) //CH
2001-07-17 05:58:10 +00:00
Find_And_Dmg("building_camera", self, 1);
if (!(self.tf_items & NIT_TELEPORTER)) //CH
2001-07-17 05:58:10 +00:00
Find_And_Dmg("building_teleporter", self, 1);
if (!(self.cutf_items & CUTF_SENSOR)) //SB
2001-07-17 05:58:10 +00:00
Find_And_Dmg("building_sensor", self, 1);
if (!(self.cutf_items & CUTF_FIELDGEN)) //OfN
2001-07-17 05:58:10 +00:00
Find_And_Dmg("building_fieldgen", self, 1);
};
//Blow up all sentries, dispensers and teslas if we can no longer build them
void() DetonateAllGunsForced =
{
Find_And_Dmg("building_dispenser", self, 1);
Find_And_Dmg("building_sentrygun", self, 1);
Find_And_Dmg("building_tesla", self, 1);
Find_And_Dmg("building_camera", self, 1);
Find_And_Dmg("building_teleporter", self, 1);
Find_And_Dmg("building_sensor", self, 1);
Find_And_Dmg("building_fieldgen", self, 1);
};
//Returns true if the entity is a building -- UPDATE THIS WHEN A NEW ONE IS ADDED
float(entity tester) IsBuilding =
{
if (
tester.classname == "building_sentrygun" ||
tester.classname == "building_sentrygun_base" ||
tester.classname == "building_tesla" ||
tester.classname == "building_dispenser" ||
tester.classname == "building_camera" ||
tester.classname == "building_arawana" ||
tester.classname == "building_teleporter"||
tester.classname == "building_fieldgen"||
tester.classname == "building_sensor"
)
return TRUE;
return FALSE;
2001-07-17 05:58:10 +00:00
};