mirror of
https://git.code.sf.net/p/quake/prozac-qfcc
synced 2024-11-10 07:11:51 +00:00
Engineer fixes including cmd build and cmd detonate (also for pipes)
This commit is contained in:
parent
763804fbf2
commit
4daa987414
3 changed files with 121 additions and 73 deletions
117
cmds.qc
117
cmds.qc
|
@ -1,4 +1,5 @@
|
|||
#include "defs.qh"
|
||||
#include "menu.qh"
|
||||
|
||||
#ifdef NO_USER_CMDS
|
||||
|
||||
|
@ -10,12 +11,16 @@ void(entity client) AddCommandAliases = { };
|
|||
integer commands_added;
|
||||
|
||||
void() Cmd_Weapon_f;
|
||||
void() Cmd_Build_f;
|
||||
void() Cmd_Detonate_f;
|
||||
|
||||
void() AddCommands =
|
||||
{
|
||||
if (!commands_added)
|
||||
{
|
||||
SV_AddUserCommand ("weapon", Cmd_Weapon_f, TRUE);
|
||||
SV_AddUserCommand ("build", Cmd_Build_f, TRUE);
|
||||
SV_AddUserCommand ("detonate", Cmd_Detonate_f, TRUE);
|
||||
}
|
||||
|
||||
commands_added = TRUE;
|
||||
|
@ -24,21 +29,123 @@ void() AddCommands =
|
|||
|
||||
void(entity client) AddCommandAliases =
|
||||
{
|
||||
if (self.got_aliases_num == 4)
|
||||
switch (client.got_aliases_num)
|
||||
{
|
||||
stuffcmd (client, "alias reload \"cmd weapon reload\"\n");
|
||||
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;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
void() Cmd_Weapon_f =
|
||||
{
|
||||
if (Cmd_Argc() < 2)
|
||||
if (Cmd_Argc () < 2)
|
||||
{
|
||||
// do something here
|
||||
}
|
||||
else if (Cmd_Argv(1) == "reload")
|
||||
else if (Cmd_Argv (1) == "reload")
|
||||
{
|
||||
TeamFortress_ReloadCurrentWeapon();
|
||||
TeamFortress_ReloadCurrentWeapon ();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
74
menu.qc
74
menu.qc
|
@ -1203,40 +1203,10 @@ void(float inp) Menu_Engineer_Input =
|
|||
&& (self.has_teleporter == 0 || self.has_teleporter == 1)
|
||||
&& self.ammo_cells >= BUILD_COST_TELEPORTER) //ch if have one out, can build
|
||||
{
|
||||
if (HasFlag(self.team_no) == FALSE) {
|
||||
CenterPrint(self, "No building until your team has the flag!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.has_teleporter == 1)
|
||||
{
|
||||
local float r;
|
||||
te = find(NIL, classname, "building_teleporter");
|
||||
while (te)
|
||||
{
|
||||
if (te.real_owner == self)
|
||||
{
|
||||
r = vlen(te.origin - self.origin);
|
||||
if (r > TELEPORTER_RANGE && !(te.num_mines & IMPROVED_FOUR))
|
||||
{
|
||||
sprint(self, PRINT_HIGH, "Other Teleporter is too far away\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
TeamFortress_Build(BUILD_TELEPORTER);
|
||||
ResetMenu();
|
||||
self.impulse = 0;
|
||||
}
|
||||
}
|
||||
te = find(te, classname, "building_teleporter");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TeamFortress_Build(BUILD_TELEPORTER);
|
||||
ResetMenu();
|
||||
self.impulse = 0;
|
||||
}
|
||||
TeamFortress_Build(BUILD_TELEPORTER);
|
||||
ResetMenu();
|
||||
self.impulse = 0;
|
||||
|
||||
}
|
||||
else if (inp == 6 && (self.has_teleporter == 1 || self.has_teleporter == 2)) //ch if have one out. can destroy
|
||||
|
@ -1262,41 +1232,9 @@ void(float inp) Menu_Engineer_Input =
|
|||
}
|
||||
|
||||
// find if there are other generators too close, if this is our first generator only - nope
|
||||
if (infokey(NIL, "fieldtest") != "1")
|
||||
{
|
||||
local float r, mindist;
|
||||
mindist = 3000;
|
||||
|
||||
te = find(NIL, classname, "building_fieldgen");
|
||||
while (te)
|
||||
{
|
||||
if (te.real_owner != self)
|
||||
{
|
||||
r = vlen(te.origin - self.origin);
|
||||
|
||||
if (r < mindist)
|
||||
mindist = r;
|
||||
}
|
||||
te = find(te, classname, "building_fieldgen");
|
||||
}
|
||||
|
||||
/* if (mindist < FIELDGEN_HACKEDRANGE) // * 2
|
||||
{
|
||||
sprint(self, PRINT_HIGH, "There are interferences with other field generators here!\n");
|
||||
}
|
||||
else
|
||||
{*/
|
||||
TeamFortress_Build(BUILD_FIELDGEN);
|
||||
ResetMenu();
|
||||
self.impulse = 0;
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
TeamFortress_Build(BUILD_FIELDGEN);
|
||||
ResetMenu();
|
||||
self.impulse = 0;
|
||||
}
|
||||
TeamFortress_Build(BUILD_FIELDGEN);
|
||||
ResetMenu();
|
||||
self.impulse = 0;
|
||||
}
|
||||
|
||||
#ifdef FIELD_FORCEMODE
|
||||
|
|
|
@ -76,6 +76,9 @@ void(entity targ, entity atk) Give_Frags_Player =
|
|||
{
|
||||
local float numfrags = 1, chkvamp = 1;
|
||||
|
||||
if (targ.real_owner == atk) // Don't give -1 for killing own builds/monsters
|
||||
return;
|
||||
|
||||
if (targ.classname == "monster_shambler")
|
||||
numfrags = (targ.has_tesla - 4) / 4;
|
||||
|
||||
|
|
Loading…
Reference in a new issue