Scoreboard error checking
This commit is contained in:
@@ -38,13 +38,34 @@ function initScoreBoardListFont() {
|
||||
// ===========================================================================
|
||||
|
||||
function processScoreBoardRendering() {
|
||||
if (isAnyGUIActive()) {
|
||||
if (!renderScoreBoard) {
|
||||
logToConsole(LOG_VERBOSE | LOG_ERROR, `[V.RP.ScoreBoard] Could not render scoreboard. Scoreboard rendering is disabled!`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (scoreBoardListFont == null) {
|
||||
logToConsole(LOG_VERBOSE | LOG_ERROR, `[V.RP.ScoreBoard] Could not render scoreboard. List font is null!`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (scoreBoardTitleFont == null) {
|
||||
logToConsole(LOG_VERBOSE | LOG_ERROR, `[V.RP.ScoreBoard] Could not render scoreboard. Title font is null!`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isAnyGUIActive()) {
|
||||
logToConsole(LOG_VERBOSE | LOG_ERROR, `[V.RP.ScoreBoard] Could not render scoreboard. A GUI window is active!`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (scoreBoardKey == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isKeyDown(scoreBoardKey)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (renderScoreBoard) {
|
||||
if (isKeyDown(scoreBoardKey)) {
|
||||
if (scoreBoardListFont != null && scoreBoardTitleFont != null) {
|
||||
let scoreboardStart = (game.height / 2) - (Math.floor(getClients().length / 2) * 20);
|
||||
let titleSize = scoreBoardTitleFont.measure("PLAYERS", game.width, 0.0, 1.0, 10, false, false);
|
||||
scoreBoardTitleFont.render("PLAYERS", [game.width / 2, scoreboardStart - 50], 0, 0.5, 0.0, scoreBoardTitleFont.size, COLOUR_WHITE, false, false, false, true);
|
||||
@@ -99,9 +120,6 @@ function processScoreBoardRendering() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user