summaryrefslogtreecommitdiffstats
path: root/TemplePushing.c4s
diff options
context:
space:
mode:
Diffstat (limited to 'TemplePushing.c4s')
-rw-r--r--TemplePushing.c4s/Script.c41
1 files changed, 17 insertions, 24 deletions
diff --git a/TemplePushing.c4s/Script.c b/TemplePushing.c4s/Script.c
index d045e3d..da1b3e8 100644
--- a/TemplePushing.c4s/Script.c
+++ b/TemplePushing.c4s/Script.c
@@ -3,10 +3,11 @@
#strict 2
static const MODE_Classic = 0, MODE_Magic = 1, MODE_Festive = 2, MODE_Apocalyptic = 3, MODE_Knightly = 4;
-static const SBRD_RelaunchesCol = 0;
+
+static const SBRD_FirstRow = 0;
+static const SBRD_NameCol = 0, SBRD_RelaunchesCol = 1, SBRD_ScoreCol = 2;
static const MaxTeamCount = 2;
-static SBRD_ScoreCol;
static section, mode;
static numRelaunches;
static deathmatchEnabled, deathmatchWinScore;
@@ -44,8 +45,8 @@ func Initialize()
/*func TeamRow(int team) { return 1 + team * 1000; }
func PlayerRow(int player) { return TeamRow(GetPlayerTeam(player)) + GetPlayerID(player); }*/
-func TeamRow(int team) { return team; }
-func PlayerRow(int player) { return MaxTeamCount + 1 + GetPlayerID(player); }
+func TeamRow(int team) { return SBRD_FirstRow + team; }
+func PlayerRow(int player) { return SBRD_FirstRow + MaxTeamCount + GetPlayerID(player); }
func InitializePlayer(int player)
{
@@ -59,10 +60,10 @@ func InitializePlayer(int player)
var team = GetPlayerTeam(player);
if (team)
{
- SetScoreboardData(TeamRow(team), SBRD_Caption, Format("<c %x>Team %s</c>", GetTeamColor(team), GetTeamName(team)), 0);
+ SetScoreboardData(TeamRow(team), SBRD_NameCol, Format("<c %x>Team %s</c>", GetTeamColor(team), GetTeamName(team)), 1);
}
}
- SetScoreboardData(PlayerRow(player), SBRD_Caption, GetTaggedPlayerName(player), 1);
+ SetScoreboardData(PlayerRow(player), SBRD_NameCol, GetTaggedPlayerName(player), 2);
UpdateScoreboard(player);
LaunchClonk(player, GetCrew(player));
}
@@ -82,9 +83,6 @@ func UpdateScoreboard(int player, bool leaver)
{
var playerID = GetPlayerID(player);
var text;
-
- if (!deathmatchEnabled) SBRD_ScoreCol = 1;
- if (deathmatchEnabled) SBRD_ScoreCol = 0;
// Ignore invalid player numbers
if (!playerID) return;
@@ -118,7 +116,7 @@ func UpdateScoreboard(int player, bool leaver)
SetScoreboardData(PlayerRow(player), SBRD_RelaunchesCol, text, relaunchesLeft);
}
- // Normal and deathmatch mode: Show score
+ // Normal and deathmatch mode: Show player score
if (leaver)
text = "{{SLVR}}";
else
@@ -126,16 +124,10 @@ func UpdateScoreboard(int player, bool leaver)
SetScoreboardData(PlayerRow(player), SBRD_ScoreCol, text, playerScore[playerID]);
-
// Sort rows
- if (!deathmatchEnabled)
- {
- SortScoreboard(SBRD_RelaunchesCol, true);
SortScoreboard(SBRD_ScoreCol, true);
- }
- else SortScoreboard(SBRD_ScoreCol, true);
-
- SortScoreboard(SBRD_Caption);
+ if (!deathmatchEnabled) SortScoreboard(SBRD_RelaunchesCol, true);
+ SortScoreboard(SBRD_NameCol);
}
func ShowLobby()
@@ -224,7 +216,7 @@ func StartGame(object menu, string message)
if (suddendeathEnabled) CreateObject(SDDT, 0, 0, NO_OWNER);
if (rotateInJumpEnabled) CreateObject(RIJP, 0, 0, NO_OWNER);
CreateObject(OFDR, 0, 0, NO_OWNER);
-
+
// Create mode objects
@@ -245,19 +237,20 @@ func StartGame(object menu, string message)
CreateObject(APCE, 0, 0, NO_OWNER);
}
+ SetScoreboardData(SBRD_Caption, SBRD_NameCol, " "); // Make sure the name column gets created first
+ SetScoreboardData(SBRD_Caption, SBRD_ScoreCol, "{{SKIL}}");
+
// Deathmatch?
if (deathmatchEnabled)
{
Log("Creating deathmatch rule");
CreateObject(DTHM, 0, 0, NO_OWNER);
- SetScoreboardData(SBRD_Caption, 0, "{{SKIL}}");
- SetScoreboardData(0, SBRD_Caption, "$WinScore$");
- SetScoreboardData(0, 0, Format("%d $Kills$", deathmatchWinScore));
+ SetScoreboardData(SBRD_FirstRow, SBRD_NameCol, "$WinScore$", 0);
+ SetScoreboardData(SBRD_FirstRow, SBRD_ScoreCol, Format("%d $Kills$", deathmatchWinScore));
}
else
{
- SetScoreboardData(SBRD_Caption, 0, "{{SREL}}");
- SetScoreboardData(SBRD_Caption, 1, "{{SKIL}}");
+ SetScoreboardData(SBRD_Caption, SBRD_RelaunchesCol, "{{SREL}}");
}
// Initialize players