summaryrefslogtreecommitdiffstats
path: root/TemplePushing.c4s
diff options
context:
space:
mode:
authorMittendrein Markus <maxmitti@gmx.net>2015-09-02 18:20:13 +0200
committerMittendrein Markus <maxmitti@gmx.net>2015-09-03 19:22:38 +0200
commitaba072f6403cbc9acd818da36e7baeec1a43fd06 (patch)
tree2a824169db3084e4428697ec11951b23329abf86 /TemplePushing.c4s
parent736efdaf6aea46dc44322e84656a7a489face44a (diff)
downloadtempelschubsen-gamecomment.tar.gz
tempelschubsen-gamecomment.zip
Show a option to disable GameComments if the host has the GameComment-featuregamecomment
Diffstat (limited to 'TemplePushing.c4s')
-rw-r--r--TemplePushing.c4s/Misc.c4d/SetupMenu.c4d/Script.c17
-rw-r--r--TemplePushing.c4s/Misc.c4d/SetupMenu.c4d/StringTblDE.txt3
-rw-r--r--TemplePushing.c4s/Misc.c4d/SetupMenu.c4d/StringTblUS.txt3
-rw-r--r--TemplePushing.c4s/Script.c8
-rw-r--r--TemplePushing.c4s/System.c4g/Compatibility.c16
5 files changed, 43 insertions, 4 deletions
diff --git a/TemplePushing.c4s/Misc.c4d/SetupMenu.c4d/Script.c b/TemplePushing.c4s/Misc.c4d/SetupMenu.c4d/Script.c
index 11c2587..a3ec201 100644
--- a/TemplePushing.c4s/Misc.c4d/SetupMenu.c4d/Script.c
+++ b/TemplePushing.c4s/Misc.c4d/SetupMenu.c4d/Script.c
@@ -6,7 +6,7 @@ static const
SETTING_Deathmatch = 0, SETTING_SuddenDeath = 1, SETTING_RotateInJump = 2,
SETTING_RelaunchesInc = 3, SETTING_RelaunchesDec = 4,
SETTING_DeathmatchScoreInc = 5, SETTING_DeathmatchScoreDec = 6,
- SETTING_Ambience = 7;
+ SETTING_Ambience = 7, SETTING_GameComment = 8;
local Sections, Modes;
local clonk, setupPlayer;
@@ -18,6 +18,8 @@ local ambienceEnabled;
local numRelaunches;
local deathmatchEnabled, deathmatchWinScore;
+local useGameComment;
+
public func GetModes()
{
return
@@ -38,6 +40,8 @@ protected func Initialize()
section = Sections[0];
Modes = GetModes();
+
+ useGameComment = true;
}
private func ShowSetup()
@@ -127,6 +131,13 @@ private func ShowSettingsMenu(bool preselect, int selectedSetting)
CheckPreselect(preselect && selectedSetting == SETTING_DeathmatchScoreDec, menuItemIndex++);
}
+ if (HaveHostFeature("GameComment"))
+ {
+ // GameComment entry
+ AddOptionMenuItem("$GameComment$", useGameComment, "SelectSetting(SETTING_GameComment)", ROCK);
+ CheckPreselect(preselect && selectedSetting == SETTING_GameComment, menuItemIndex++);
+ }
+
clonk->AddMenuItem("$Done$", "SetupDone()", SDNE);
CheckPreselect(!preselect, menuItemIndex++);
clonk->AddMenuItem("$Back$", "ShowModeMenu()", SBCK);
@@ -166,6 +177,10 @@ private func SelectSetting(int selectedSetting)
{
deathmatchWinScore = Max(deathmatchWinScore - 1, 1);
}
+ else if (selectedSetting == SETTING_GameComment)
+ {
+ useGameComment = !useGameComment;
+ }
ShowMessage();
diff --git a/TemplePushing.c4s/Misc.c4d/SetupMenu.c4d/StringTblDE.txt b/TemplePushing.c4s/Misc.c4d/SetupMenu.c4d/StringTblDE.txt
index ffe51b6..1b418d1 100644
--- a/TemplePushing.c4s/Misc.c4d/SetupMenu.c4d/StringTblDE.txt
+++ b/TemplePushing.c4s/Misc.c4d/SetupMenu.c4d/StringTblDE.txt
@@ -12,4 +12,5 @@ Mode=Modus
Enabled=Aktiviert
Disabled=Deaktiviert
Ambience=Ambiente
-Random=Zufällig \ No newline at end of file
+Random=Zufällig
+GameComment=Info im Netzwerkkommentar
diff --git a/TemplePushing.c4s/Misc.c4d/SetupMenu.c4d/StringTblUS.txt b/TemplePushing.c4s/Misc.c4d/SetupMenu.c4d/StringTblUS.txt
index 07240dd..f53c996 100644
--- a/TemplePushing.c4s/Misc.c4d/SetupMenu.c4d/StringTblUS.txt
+++ b/TemplePushing.c4s/Misc.c4d/SetupMenu.c4d/StringTblUS.txt
@@ -12,4 +12,5 @@ Mode=Mode
Enabled=Enabled
Disabled=Disabled
Ambience=Ambience
-Random=Random \ No newline at end of file
+Random=Random
+GameComment=Info in network comment
diff --git a/TemplePushing.c4s/Script.c b/TemplePushing.c4s/Script.c
index a75c6cf..bc2dfcd 100644
--- a/TemplePushing.c4s/Script.c
+++ b/TemplePushing.c4s/Script.c
@@ -25,9 +25,12 @@ static suddendeathEnabled;
static loadingSection;
static eliminatedPlayers;
static gameStartMessage, countdown, gameStarted, gameOver;
+static useGameComment;
func Initialize()
{
+ RequestHostFeature("GameComment");
+
ShowLobby();
eliminatedPlayers = [];
@@ -175,6 +178,7 @@ func SetupDone(object menu, string message)
numRelaunches = BoundBy(menu->LocalN("numRelaunches"), 3, 10);
deathmatchEnabled = menu->LocalN("deathmatchEnabled");
deathmatchWinScore = menu->LocalN("deathmatchWinScore");
+ useGameComment = HaveHostFeature("GameComment") && menu->LocalN("useGameComment");
menu->RemoveObject();
gameStartMessage = message;
@@ -725,8 +729,9 @@ func ToggleAmbienceSounds(int player)
func UpdateComment(bool inLobby)
{
+ if (!IsHost()) return;
if (inLobby) SetGameComment(" $LobbyComment$");
- else
+ else if (useGameComment)
{
var score = "";
var teams = [];
@@ -759,4 +764,5 @@ func UpdateComment(bool inLobby)
SetGameComment(Format(" $GameComment$", GetName(0, sectionID), modes[mode][1], sudden, goalDesc, score));
}
+ else SetGameComment("");
}
diff --git a/TemplePushing.c4s/System.c4g/Compatibility.c b/TemplePushing.c4s/System.c4g/Compatibility.c
index 5d3865e..d4e9b09 100644
--- a/TemplePushing.c4s/System.c4g/Compatibility.c
+++ b/TemplePushing.c4s/System.c4g/Compatibility.c
@@ -2,4 +2,20 @@
#strict 2
+static hostFeatures;
+
global func SetGameComment() { return _inherited(...); }
+global func IsHost() { return _inherited(...); }
+global func RequestHostFeature(string feature) { if(!HaveHostFeature(feature)) return _inherited(feature, ...); }
+
+global func AnnounceHostFeature(string feature)
+{
+ hostFeatures || (hostFeatures = []);
+ hostFeatures[GetLength(hostFeatures)] = feature;
+}
+
+global func HaveHostFeature(string feature)
+{
+ hostFeatures || (hostFeatures = []);
+ return GetIndexOf(feature, hostFeatures) != -1;
+}