diff --git a/actions.qc b/actions.qc index cfceb44..a474f55 100644 --- a/actions.qc +++ b/actions.qc @@ -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 diff --git a/defs.qc b/defs.qc index 786c61a..c4578ad 100644 --- a/defs.qc +++ b/defs.qc @@ -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 diff --git a/spy.qc b/spy.qc index ab5a3f9..04654a0 100644 --- a/spy.qc +++ b/spy.qc @@ -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"); - } - } } };