From: z411 Date: Thu, 27 Aug 2020 03:31:07 +0000 (-0400) Subject: Timer, improved chat tags X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0f9dc8ed3bfd461a5563c2e77c9de159cb110742;p=xonotic%2Fxonotic-data.pk3dir.git Timer, improved chat tags --- diff --git a/qcsrc/client/hud/panel/timer.qc b/qcsrc/client/hud/panel/timer.qc index 83fef5b98..4a38d91d7 100644 --- a/qcsrc/client/hud/panel/timer.qc +++ b/qcsrc/client/hud/panel/timer.qc @@ -38,9 +38,10 @@ void HUD_Timer() } string timer; - float timelimit, timeleft, minutesLeft; + float timelimit, timeleft, minutesLeft, overtimes; timelimit = STAT(TIMELIMIT); + overtimes = STAT(OVERTIMESADDED); timeleft = max(0, timelimit * 60 + STAT(GAMESTARTTIME) - time); timeleft = ceil(timeleft); @@ -68,25 +69,26 @@ void HUD_Timer() if (intermission_time) { timer = seconds_tostring(max(0, floor(intermission_time - STAT(GAMESTARTTIME)))); - } else if (warmup_stage && warmup_timeleft >= 60) { + } else if (warmup_stage) { timer = _("WARMUP"); - } else if (autocvar_hud_panel_timer_increment || (!warmup_stage && timelimit == 0) || (warmup_stage && warmup_timeleft <= 0)) { + } else if (autocvar_hud_panel_timer_increment) { if (time < STAT(GAMESTARTTIME)) timer = seconds_tostring(0); //while restart is still active, show 00:00 else timer = seconds_tostring(floor(time - STAT(GAMESTARTTIME))); } else { - if(warmup_stage) - timer = seconds_tostring(warmup_timeleft); + if (time < STAT(GAMESTARTTIME)) + timer = seconds_tostring(floor(timelimit * 60)); else timer = seconds_tostring(timeleft); } - if(STAT(OVERTIMESADDED) >= 1) - { - timer = sprintf("%s (OT #%d)", timer, floor(STAT(OVERTIMESADDED))); + if(overtimes == 1) { + timer = sprintf("%s (OT)", timer); + } else if (overtimes > 1) { + timer = sprintf("%s (OT #%d)", timer, overtimes); } - + drawstring_aspect(pos, timer, mySize, timer_color, panel_fg_alpha, DRAWFLAG_NORMAL); draw_endBoldFont(); diff --git a/qcsrc/common/notifications/all.inc b/qcsrc/common/notifications/all.inc index 3da7b88c7..ffad793a5 100644 --- a/qcsrc/common/notifications/all.inc +++ b/qcsrc/common/notifications/all.inc @@ -429,6 +429,7 @@ string multiteam_info_sprintf(string input, string teamname) { return ((input != MSG_INFO_NOTIF(POWERUP_STRENGTH, N_CONSOLE, 1, 0, "s1", "s1", "strength", _("^BG%s^K1 picked up Strength"), "") MSG_INFO_NOTIF(QUIT_DISCONNECT, N_CHATCON, 1, 0, "s1", "", "", _("^BG%s^F3 disconnected"), "") + MSG_INFO_NOTIF(QUIT_KICK, N_CHATCON, 1, 0, "s1", "", "", _("^BG%s^F3 was kicked"), "") MSG_INFO_NOTIF(QUIT_KICK_IDLING, N_CHATCON, 1, 0, "s1", "", "", _("^BG%s^F3 was kicked for idling"), "") MSG_INFO_NOTIF(QUIT_KICK_SPECTATING, N_CONSOLE, 0, 0, "", "", "", _("^F2You were kicked from the server because you are a spectator and spectators aren't allowed at the moment."), "") MSG_INFO_NOTIF(QUIT_KICK_TEAMKILL, N_CHATCON, 1, 0, "s1", "", "", _("^BG%s^F3 was kicked for excessive teamkilling"), "") @@ -787,7 +788,7 @@ string multiteam_info_sprintf(string input, string teamname) { return ((input != MSG_CENTER_NOTIF(TIMEOUT_BEGINNING, N_ENABLE, 0, 1, "", CPID_TIMEOUT, "1 f1", _("^F4Timeout begins in ^COUNT"), "") MSG_CENTER_NOTIF(TIMEOUT_ENDING, N_ENABLE, 0, 1, "", CPID_TIMEIN, "1 f1", _("^F4Timeout ends in ^COUNT"), "") - MSG_CENTER_NOTIF(TIMEOUT_ONGOING, N_ENABLE, 0, 0, "", CPID_TIMEIN, "1 f1", _("^F4Match paused."), "") + MSG_CENTER_NOTIF(TIMEOUT_ONGOING, N_ENABLE, 0, 0, "", CPID_TIMEIN, "1 f1", _("^F4Match paused"), "") MSG_CENTER_NOTIF(JOIN_PREVENT_MINIGAME, N_ENABLE, 0, 0, "", CPID_Null, "0 0", _("^K1Cannot join given minigame session!"), "" ) diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index fe92d3667..e60154eee 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -394,13 +394,13 @@ void ClientCommand_ready(entity caller, int request) // todo: anti-spam for tog { caller.ready = false; if(IS_PLAYER(caller) || caller.caplayer == 1) - bprint(playername(caller, false), "^2 is ^1NOT^2 ready\n"); + bprint("\{1}", playername(caller, false), "^2 is ^1NOT^2 ready\n"); } else { caller.ready = true; if(IS_PLAYER(caller) || caller.caplayer == 1) - bprint(playername(caller, false), "^2 is ready\n"); + bprint("\{1}", playername(caller, false), "^2 is ready\n"); } // cannot reset the game while a timeout is active! diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index e8b4ab681..3104b06d4 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -414,14 +414,30 @@ void GetCvars(entity this, entity store, int f) // decolorizes and team colors the player name when needed string playername(entity p, bool team_colorize) { - string t; - if (team_colorize && teamplay && !intermission_running && IS_PLAYER(p)) - { - t = Team_ColorCode(p.team); - return strcat(t, strdecolorize(p.netname)); - } - else - return p.netname; + //string t; + //if (team_colorize && teamplay && !intermission_running && IS_PLAYER(p)) + //{ + // t = Team_ColorCode(p.team); + // return strcat(t, strdecolorize(p.netname)); + //} + //else + // return p.netname; + + string t; + + if (team_colorize && teamplay && p.team != -1) + t = strcat(Team_ColorCode(p.team), strdecolorize(p.netname)); + else + t = p.netname; + + if (IS_DEAD(p) || p.frags == FRAGS_PLAYER_OUT_OF_GAME) + return strcat("(DEAD) ", t); + else if (IS_OBSERVER(p)) + return strcat("(s) ", t); + else + return t; + + //return sprintf("%s (%d) %s", p.classname, p.team, t); } float want_weapon(entity weaponinfo, float allguns)