2003-12-12 03:51:57 +00:00
|
|
|
#include "defs.qh"
|
2004-01-22 00:44:44 +00:00
|
|
|
#include "menu.qh"
|
2003-12-12 03:51:57 +00:00
|
|
|
|
|
|
|
#ifdef NO_USER_CMDS
|
|
|
|
|
|
|
|
void() AddCommands = { };
|
|
|
|
void(entity client) AddCommandAliases = { };
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
integer commands_added;
|
|
|
|
|
|
|
|
void() Cmd_Weapon_f;
|
2004-01-22 00:44:44 +00:00
|
|
|
void() Cmd_Build_f;
|
|
|
|
void() Cmd_Detonate_f;
|
2003-12-12 03:51:57 +00:00
|
|
|
|
|
|
|
void() AddCommands =
|
|
|
|
{
|
|
|
|
if (!commands_added)
|
|
|
|
{
|
|
|
|
SV_AddUserCommand ("weapon", Cmd_Weapon_f, TRUE);
|
2004-01-22 00:44:44 +00:00
|
|
|
SV_AddUserCommand ("build", Cmd_Build_f, TRUE);
|
|
|
|
SV_AddUserCommand ("detonate", Cmd_Detonate_f, TRUE);
|
2003-12-12 03:51:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
commands_added = TRUE;
|
|
|
|
return;
|
|
|
|
};
|
|
|
|
|
|
|
|
void(entity client) AddCommandAliases =
|
|
|
|
{
|
2004-01-22 00:44:44 +00:00
|
|
|
switch (client.got_aliases_num)
|
2003-12-12 03:51:57 +00:00
|
|
|
{
|
2004-01-22 00:44:44 +00:00
|
|
|
case 4:
|
|
|
|
stuffcmd (client, "alias reload \"cmd weapon reload\"\n");
|
|
|
|
stuffcmd (client, "alias detpipe \"cmd detonate pipes\"\n");
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
stuffcmd (client, "alias build \"cmd build menu\"\n");
|
|
|
|
stuffcmd (client, "alias detdispenser \"cmd detonate dispenser\"\n");
|
|
|
|
break;
|
2003-12-12 03:51:57 +00:00
|
|
|
}
|
2004-01-22 00:44:44 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
void() Cmd_Build_f =
|
|
|
|
{
|
|
|
|
if (Cmd_Argc () < 2 || Cmd_Argv (1) == "menu")
|
|
|
|
{
|
|
|
|
self.current_menu = MENU_ENGINEER;
|
|
|
|
self.menu_count = MENU_REFRESH_RATE;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
local float what_to_build = 0;
|
|
|
|
|
|
|
|
switch (Cmd_Argv (1))
|
|
|
|
{
|
|
|
|
case "sensor":
|
|
|
|
SBBuildSensor ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "dispenser":
|
|
|
|
what_to_build = BUILD_DISPENSER;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "sentrygun":
|
|
|
|
what_to_build = BUILD_SENTRYGUN;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "tesla":
|
|
|
|
what_to_build = BUILD_TESLA;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "fieldgen":
|
|
|
|
what_to_build = BUILD_FIELDGEN;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "teleporter":
|
|
|
|
what_to_build = BUILD_TELEPORTER;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "camera":
|
|
|
|
what_to_build = BUILD_SECURITY_CAMERA;
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (what_to_build)
|
|
|
|
{
|
|
|
|
TeamFortress_Build (what_to_build);
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
2003-12-12 03:51:57 +00:00
|
|
|
};
|
|
|
|
|
2004-01-22 00:44:44 +00:00
|
|
|
void() Cmd_Detonate_f =
|
|
|
|
{
|
|
|
|
if (Cmd_Argc () < 2)
|
|
|
|
return;
|
|
|
|
|
|
|
|
switch (Cmd_Argv (1))
|
|
|
|
{
|
|
|
|
case "pipes":
|
|
|
|
TeamFortress_DetonatePipebombs ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "dispenser":
|
|
|
|
Find_And_Dmg ("building_dispenser", self, 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "sentrygun":
|
|
|
|
Find_And_Dmg ("building_sentrygun", self, 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "tesla":
|
|
|
|
Find_And_Dmg ("building_tesla", self, 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "fieldgen":
|
|
|
|
Find_And_Dmg ("building_fieldgen", self, 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "sensor":
|
|
|
|
Find_And_Dmg ("building_sensor", self, 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "camera":
|
|
|
|
Find_And_Dmg ("building_camera", self, 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "teleporter":
|
|
|
|
Find_And_Dmg ("building_teleporter", self, 1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2003-12-12 03:51:57 +00:00
|
|
|
void() Cmd_Weapon_f =
|
|
|
|
{
|
2004-01-22 00:44:44 +00:00
|
|
|
if (Cmd_Argc () < 2)
|
2003-12-12 03:51:57 +00:00
|
|
|
{
|
|
|
|
// do something here
|
|
|
|
}
|
2004-01-22 00:44:44 +00:00
|
|
|
else if (Cmd_Argv (1) == "reload")
|
2003-12-12 03:51:57 +00:00
|
|
|
{
|
2004-01-22 00:44:44 +00:00
|
|
|
TeamFortress_ReloadCurrentWeapon ();
|
2003-12-12 03:51:57 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|