Add a cheat command to make it easier for developers to try the weapons.

This commit is contained in:
Marco Cawthorne 2023-01-17 12:50:50 -08:00
parent 7f848a6fde
commit f83568c5ef
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
3 changed files with 42 additions and 0 deletions

View File

@ -26,6 +26,10 @@ ClientGame_Init(float apilevel, string enginename, float engineversion)
{
registercommand("build");
registercommand("dismantle");
registercommand("+gren1");
registercommand("-gren1");
registercommand("+gren2");
registercommand("-gren2");
Obituary_Init();
}

View File

@ -30,5 +30,7 @@ class TFCGameRules:CGameRules
virtual void(NSClientPlayer) DropGoalItem;
virtual float ImpulseCommand(NSClient, float);
virtual void(void) LevelNewParms;
};

View File

@ -132,6 +132,42 @@ TFCGameRules::PlayerSpawn(NSClientPlayer pp)
Spawn_ObserverCam(pl);
}
bool
TFCGameRules::ImpulseCommand(NSClient bp, float num)
{
switch (num) {
case 101:
player pl = (player)bp;
if (cvar("sv_cheats") > 0) {
Weapons_AddItem(pl, WEAPON_CROWBAR, -1);
Weapons_AddItem(pl, WEAPON_MEDKIT, -1);
Weapons_AddItem(pl, WEAPON_KNIFE, -1);
Weapons_AddItem(pl, WEAPON_WRENCH, -1);
Weapons_AddItem(pl, WEAPON_UMBRELLA, -1);
Weapons_AddItem(pl, WEAPON_SBS, -1);
Weapons_AddItem(pl, WEAPON_SNIPER, -1);
Weapons_AddItem(pl, WEAPON_TRANQUIL, -1);
Weapons_AddItem(pl, WEAPON_RAILGUN, -1);
Weapons_AddItem(pl, WEAPON_AUTORIFLE, -1);
Weapons_AddItem(pl, WEAPON_DBS, -1);
Weapons_AddItem(pl, WEAPON_NAILGUN, -1);
Weapons_AddItem(pl, WEAPON_GLAUNCHER, -1);
Weapons_AddItem(pl, WEAPON_SUPERNAIL, -1);
Weapons_AddItem(pl, WEAPON_FLAMER, -1);
Weapons_AddItem(pl, WEAPON_RPG, -1);
Weapons_AddItem(pl, WEAPON_PIPEBOMB, -1);
Weapons_AddItem(pl, WEAPON_ASSCAN, -1);
Weapons_AddItem(pl, WEAPON_INCENDIARY, -1);
Weapons_AddItem(pl, WEAPON_GRAPPLE, -1);
}
break;
default:
return super::ImpulseCommand(bp, num);
}
return true;
}
void
TFCGameRules::TFCGameRules(void)
{