Make spy a little stealthier

This commit is contained in:
Finny Merrill 2004-04-06 04:11:43 +00:00
parent 4a1f4ffcaf
commit 2aa5d42857
3 changed files with 47 additions and 40 deletions

View file

@ -225,52 +225,48 @@ void(float inAuto) TeamFortress_ID =
if (trace_ent.cutf_items & CUTF_SPY_KIT)
{
cls = TeamFortress_GetClassName(trace_ent.undercover_skin);
if (trace_ent.undercover_skin) {
if (trace_ent.undercover_job != -1) {
cls = TeamFortress_GetJobName (trace_ent.undercover_job);
} else {
cls = TeamFortress_GetClassName (trace_ent.undercover_skin);
}
} else if (trace_ent.playerclass == PC_CUSTOM) {
cls = TeamFortress_GetJobName (trace_ent.job);
} else {
cls = TeamFortress_GetClassName (trace_ent.playerclass);
}
// Report a false name
if (self.team_no != 0 && (self.team_no == trace_ent.undercover_team))
{
if (self.weapons_carried & WEAP_MEDIKIT)
{
st = ftos(trace_ent.health);
if (trace_ent.undercover_skin != 0)
centerprint(self, spacer, trace_ent.undercover_name, "\n\nFriendly ", cls, "\n\n", st, " health\n");
else
centerprint(self, spacer, trace_ent.undercover_name, "\n\nFriendly Spy\n\n", st, " health\n");
centerprint(self, spacer, trace_ent.undercover_name, "\n\nFriendly ", cls, "\n\n", st, " health\n");
return;
}
else if (self.weapons_carried & WEAP_SPANNER)
{
st = ftos(trace_ent.armorvalue);
if (trace_ent.undercover_skin != 0)
centerprint(self, spacer, trace_ent.undercover_name, "\n\nFriendly ", cls, "\n\n", st, " armor\n");
else
centerprint(self, spacer, trace_ent.undercover_name, "\n\nFriendly Spy\n\n", st, " armor\n");
centerprint(self, spacer, trace_ent.undercover_name, "\n\nFriendly ", cls, "\n\n", st, " armor\n");
return;
}
else
{
st = ftos(trace_ent.armorvalue);
if (trace_ent.undercover_skin != 0)
centerprint(self, spacer, trace_ent.undercover_name, "\n\nFriendly ", cls, "\n");
else
centerprint(self, spacer, trace_ent.undercover_name, "\n\nFriendly Spy\n");
centerprint(self, spacer, trace_ent.undercover_name, "\n\nFriendly ", cls, "\n");
return;
}
}
if (trace_ent.undercover_name)
{
if (trace_ent.undercover_skin != 0)
centerprint(self, spacer, trace_ent.undercover_name, "\n\nÅîåíù ", cls, "\n");
else
centerprint(self, spacer, trace_ent.undercover_name, "\n\nÅîåíù Spy");
centerprint(self, spacer, trace_ent.undercover_name, "\n\nÅîåíù ", cls, "\n");
}
else
{
if (trace_ent.undercover_skin != 0)
centerprint(self, spacer, trace_ent.netname, "\n\nÅîåíù ", cls, "\n");
else
centerprint(self, spacer, trace_ent.netname, "\n\nÅîåíù Spy");
centerprint(self, spacer, trace_ent.netname, "\n\nÅîåíù ", cls, "\n");
}
}
else

View file

@ -1071,6 +1071,7 @@ float num_team_ammoboxes_4;
/*==================================================*/
.float undercover_team; // The team the Spy is pretending to be in
.float undercover_skin; // The skin the Spy is pretending to have
.float undercover_job; // The job "" ""
.string undercover_name; // The name of the player the Spy is pretending to be

48
spy.qc
View file

@ -475,39 +475,49 @@ void() TeamFortress_SpyGoUndercover =
void(entity spy) TeamFortress_SpyCalcName =
{
local entity te;
local float teamnum;
spy.undercover_name = "";
// Find a player on the team the spy is disguised as to pretend to be
if (spy.undercover_team != 0)
// Don't get "Blahblah friendly spy" anymore :/
spy.undercover_job = -1;
if (!spy.undercover_team)
teamnum = spy.team_no;
te = find(NIL, classname, "player");
while (te)
{
// First, try to find a player with same color and skins
if (te.team_no == spy.undercover_team && te.skin == spy.undercover_skin)
{
spy.undercover_name = te.netname;
if (te.playerclass == PC_CUSTOM)
spy.undercover_job = te.job;
te = NIL;
}
else
te = find(te, classname, "player");
}
// If we couldn't, just find one of that team
if (!spy.undercover_name)
{
te = find(NIL, classname, "player");
while (te)
{
// First, try to find a player with same color and skins
if (te.team_no == spy.undercover_team && te.skin == spy.undercover_skin)
if (te.team_no == spy.undercover_team)
{
spy.undercover_name = te.netname;
if (te.playerclass == PC_CUSTOM)
spy.undercover_job = te.job;
te = NIL;
}
else
te = find(te, classname, "player");
}
// If we couldn't, just find one of that team
if (!spy.undercover_name)
{
te = find(NIL, classname, "player");
while (te)
{
if (te.team_no == spy.undercover_team)
{
spy.undercover_name = te.netname;
te = NIL;
}
else
te = find(te, classname, "player");
}
}
}
};