From 1052feb17bd3bad9db01536dc6d10773cca1d96c Mon Sep 17 00:00:00 2001 From: Sheldon Johnson Date: Thu, 8 Aug 2024 00:14:28 +1000 Subject: [PATCH] Maybe fix wrong teamcolour on occasion, refactor --- ssqc/client.qc | 7 +++++-- ssqc/tfort.qc | 35 ++++++++++++++++------------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/ssqc/client.qc b/ssqc/client.qc index 52c6a0cf..af202fd3 100644 --- a/ssqc/client.qc +++ b/ssqc/client.qc @@ -2257,11 +2257,14 @@ void () PutClientInServer = { TeamFortress_SetEquipment(); TeamFortress_SetHealth(); TeamFortress_SetSpeed(self); - + TeamFortress_SetSkin(self); te = find(world, classname, "player"); while (te != world) { - TeamFortress_SetSkin(te); + if (te != self) { + TeamFortress_SetSkin(te); + } + te = find(te, classname, "player"); } diff --git a/ssqc/tfort.qc b/ssqc/tfort.qc index e1c74bc9..99ab7a57 100644 --- a/ssqc/tfort.qc +++ b/ssqc/tfort.qc @@ -1176,28 +1176,25 @@ string(float pc) TeamFortress_GetSkin = void (entity player) TeamFortress_SetSkinInfos = { local string st = TeamFortress_GetSkin(player.playerclass); - stuffcmd(player, "skin "); - stuffcmd(player, st); - stuffcmd(player, "\n"); - // please fix mvd recording - forceinfokey(player, "skin", st); + stuffcmd(player, sprintf("skin %s\n", st)); + forceinfokey(player, "skin", st); // please fix mvd recording local string color; - local entity te; - - te = find(world, classname, "player"); + local entity te = find(world, classname, "player"); while (te != world) { - msg_entity = te; - color = TeamFortress_TeamGetColorFor(te, player.team_no); - - WriteByte(MSG_ONE, SVC_SETINFO); - WriteByte(MSG_ONE, player.colormap-1); // ???? Copied from spy.qc - WriteString(MSG_ONE, "topcolor"); - WriteString(MSG_ONE, color); - WriteByte(MSG_ONE, SVC_SETINFO); - WriteByte(MSG_ONE, player.colormap-1); // ???? Copied from spy.qc - WriteString(MSG_ONE, "bottomcolor"); - WriteString(MSG_ONE, color); + if (te != player) { + msg_entity = te; + color = TeamFortress_TeamGetColorFor(te, player.team_no); + + WriteByte(MSG_ONE, SVC_SETINFO); + WriteByte(MSG_ONE, player.colormap-1); // ???? Copied from spy.qc + WriteString(MSG_ONE, "topcolor"); + WriteString(MSG_ONE, color); + WriteByte(MSG_ONE, SVC_SETINFO); + WriteByte(MSG_ONE, player.colormap-1); // ???? Copied from spy.qc + WriteString(MSG_ONE, "bottomcolor"); + WriteString(MSG_ONE, color); + } te = find(te, classname, "player"); }