Add /help chat command for engine
authorWuzzy <Wuzzy2@mail.ru>
Tue, 10 Jul 2018 13:28:47 +0200
changeset 13462 b587cdb03bac
parent 13461 7a0a56c52fd2
child 13463 32032120435c
Add /help chat command for engine
ChangeLog.txt
hedgewars/uChat.pas
hedgewars/uLocale.pas
hedgewars/uTypes.pas
hedgewars/uVariables.pas
share/hedgewars/Data/Locale/de.txt
share/hedgewars/Data/Locale/en.txt
--- a/ChangeLog.txt	Sun Jul 08 02:46:59 2018 +0200
+++ b/ChangeLog.txt	Tue Jul 10 13:28:47 2018 +0200
@@ -2,6 +2,7 @@
 * bugfixes
 ====================== 0.9.25 ======================
 Game:
+ + Add chat command “/help”, displays help for chat commands
  * Fix extreme amounts of droplets when shooting with minigun into ocean world edge
  * Fix hog being unable to walk after using sniper rifle without firing both shots
  * Fix teleport tooltip claiming it doesn't end turn in hog placing phase with inf. attack
--- a/hedgewars/uChat.pas	Sun Jul 08 02:46:59 2018 +0200
+++ b/hedgewars/uChat.pas	Tue Jul 10 13:28:47 2018 +0200
@@ -512,6 +512,7 @@
 
     // debugging commands
     if (copy(s, 2, 7) = 'debugvl') then
+        // This command intentionally not documented in /help
         begin
         cViewLimitsDebug:= (not cViewLimitsDebug);
         UpdateViewLimits();
@@ -539,6 +540,48 @@
         exit
         end;
 
+    // Help commands
+    if (copy(s, 2, 11) = 'help taunts') then
+        begin
+        AddChatString(#3 + trcmd[sidCmdHeaderTaunts]);
+        AddChatString(#3 + trcmd[sidCmdSpeech]);
+        AddChatString(#3 + trcmd[sidCmdThink]);
+        AddChatString(#3 + trcmd[sidCmdYell]);
+        AddChatString(#3 + trcmd[sidCmdSpeechNumberHint]);
+        AddChatString(#3 + trcmd[sidCmdHsa]);
+        AddChatString(#3 + trcmd[sidCmdHta]);
+        AddChatString(#3 + trcmd[sidCmdHya]);
+        AddChatString(#3 + trcmd[sidCmdHurrah]);
+        AddChatString(#3 + trcmd[sidCmdIlovelotsoflemonade]);
+        AddChatString(#3 + trcmd[sidCmdJuggle]);
+        AddChatString(#3 + trcmd[sidCmdRollup]);
+        AddChatString(#3 + trcmd[sidCmdShrug]);
+        AddChatString(#3 + trcmd[sidCmdWave]);
+        exit
+        end;
+
+    if (copy(s, 2, 4) = 'help') then
+        begin
+        AddChatString(#3 + trcmd[sidCmdHeaderBasic]);
+        if gameType = gmtNet then
+            AddChatString(#3 + trcmd[sidCmdPauseNet])
+        else
+            AddChatString(#3 + trcmd[sidCmdPause]);
+        AddChatString(#3 + trcmd[sidCmdFullscreen]);
+        AddChatString(#3 + trcmd[sidCmdQuit]);
+        if gameType <> gmtNet then
+            AddChatString(#3 + trcmd[sidLua]);
+        // history and help commands needs to be close to the end because they are always visible
+        // with a short chat history length.
+        AddChatString(#3 + trcmd[sidCmdTeam]);
+        AddChatString(#3 + trcmd[sidCmdMe]);
+        AddChatString(#3 + trcmd[sidCmdTogglechat]);
+        AddChatString(#3 + trcmd[sidCmdHistory]);
+        AddChatString(#3 + trcmd[sidCmdHelp]);
+        AddChatString(#3 + trcmd[sidCmdHelpTaunts]);
+        exit
+        end;
+
     // hedghog animations/taunts and engine commands
     if (not CurrentTeam^.ExtDriven) and (CurrentTeam^.Hedgehogs[0].BotLevel = 0) then
         begin
--- a/hedgewars/uLocale.pas	Sun Jul 08 02:46:59 2018 +0200
+++ b/hedgewars/uLocale.pas	Tue Jul 10 13:28:47 2018 +0200
@@ -102,6 +102,8 @@
                 trammod[TAmmoStrId(b)]:= s;
             5: if (b >=0) and (b <= ord(High(TGoalStrId))) then
                 trgoal[TGoalStrId(b)]:= s;
+            6: if (b >=0) and (b <= ord(High(TCmdHelpStrId))) then
+                trcmd[TCmdHelpStrId(b)]:= s;
            end;
        end;
    pfsClose(f);
--- a/hedgewars/uTypes.pas	Sun Jul 08 02:46:59 2018 +0200
+++ b/hedgewars/uTypes.pas	Tue Jul 10 13:28:47 2018 +0200
@@ -481,6 +481,16 @@
             sidWinner7, sidWinnerAll, sidTeamGone, sidTeamBack, sidAutoSkip,
             sidFPS);
 
+    TCmdHelpStrId = (
+            sidCmdHeaderBasic, sidCmdTogglechat, sidCmdTeam, sidCmdMe,
+            sidCmdPause, sidCmdPauseNet, sidCmdFullscreen, sidCmdQuit,
+            sidCmdHelp, sidCmdHelpTaunts, sidCmdHistory, sidLua,
+
+            sidCmdHeaderTaunts, sidCmdSpeech, sidCmdThink, sidCmdYell,
+            sidCmdSpeechNumberHint, sidCmdHsa, sidCmdHta, sidCmdHya,
+            sidCmdHurrah, sidCmdIlovelotsoflemonade, sidCmdJuggle,
+            sidCmdRollup, sidCmdShrug, sidCmdWave);
+
     // Events that are important for the course of the game or at least interesting for other reasons
     TEventId = (eidDied, eidDrowned, eidRoundStart, eidRoundWin, eidRoundDraw,
             eidNewHealthPack, eidNewAmmoPack, eidNewUtilityPack, eidTurnSkipped,
--- a/hedgewars/uVariables.pas	Sun Jul 08 02:46:59 2018 +0200
+++ b/hedgewars/uVariables.pas	Tue Jul 10 13:28:47 2018 +0200
@@ -2584,6 +2584,7 @@
     trluaammoe: array[TAmmoStrId] of boolean;   // whether to render extra text (Lua overwrite)
     trmsg:   array[TMsgStrId]  of ansistring;   // message of the event
     trgoal:  array[TGoalStrId] of ansistring;   // message of the goal
+    trcmd:   array[TCmdHelpStrId] of ansistring; // chat command help
     cTestLua : Boolean;
 
 procedure preInitModule;
--- a/share/hedgewars/Data/Locale/de.txt	Sun Jul 08 02:46:59 2018 +0200
+++ b/share/hedgewars/Data/Locale/de.txt	Tue Jul 10 13:28:47 2018 +0200
@@ -1394,3 +1394,31 @@
 05:20=Igelwaffen: Igel teilen Waffen nicht untereinander
 05:21=Staffellauf: Teams gleicher Farbe kommen nacheinander dran|Gemeinsame Zeit: Teams gleicher Farbe teilen sich ihre Zugzeit
 05:22=Starker Wind: Wind beeinflusst fast alles
+
+; Chat command help
+06:00=Liste der grundlegenden Client-Chatbefehle:
+06:01=/togglechat: Chatanzeige umschalten
+06:02=/team <Nachricht>: Nachricht nur an Klanmitglieder schicken
+06:03=/me <Nachricht>: Chataktion, z.B. wird „/me isst Pizza“ zu „* Spieler isst Pizza“
+06:04=/pause: Pause umschalten
+06:05=/pause: Automatisches Überspringen umschalten
+06:06=/fullscreen: Vollbild umschalten
+06:07=/quit [Nachricht]: Hedgewars verlassen, mit optionaler Nachricht
+06:08=/help: Grundlegende Client-Chatbefehle auflisten
+06:09=/help taunts: Spott-Chatbefehle auflisten
+06:10=/history: Langes Chatprotokoll umschalten
+06:11=/lua: Lua-Entwicklerkonsole umschalten
+06:12=Liste der Spott-Chatbefehle:
+06:13="Text": Text in Sprechblase anzeigen
+06:14='Text': Text in Denkblase anzeigen
+06:15=-Text-: Text in Brüllblase anzeigen
+06:16=Füg eine Nummer am Textanfang bei den obigen Befehlen hinzu, um einen Igel auszuwählen.
+06:17=/hsa <Text>: Text in Sprechblase beim nächsten Angriff anzeigen
+06:18=/hta <Text>: Text in Denkblase beim nächsten Angriff anzeigen
+06:19=/hya <Text>: Text in Brüllblase beim nächsten Angriff anzeigen
+06:20=/hurrah: Igel grinsen lassen
+06:21=/ilovelotsoflemonade: Igel pinkeln lassen
+06:22=/juggle: Igel jonglieren lassen
+06:23=/rollup: Igel sich einigeln lassen
+06:24=/shrug: Igel mit den Achseln zucken lassen
+06:25=/wave: Igel winken lassen
--- a/share/hedgewars/Data/Locale/en.txt	Sun Jul 08 02:46:59 2018 +0200
+++ b/share/hedgewars/Data/Locale/en.txt	Tue Jul 10 13:28:47 2018 +0200
@@ -1295,3 +1295,31 @@
 05:20=Per-hog Ammo: Weapons are not shared between hogs
 05:21=Tag Team: Teams in a clan takes successive turns|Shared Time: Teams within a clan share turn time
 05:22=Heavy Wind: Wind affects almost everything
+
+; Chat command help
+06:00=List of basic client chat commands:
+06:01=/togglechat: Toggle chat display
+06:02=/team <message>: Send message to clan members only
+06:03=/me <message>: Chat action, e.g. “/me eats pizza” becomes “* Player eats pizza”
+06:04=/pause: Toggle pause
+06:05=/pause: Toggle auto skip
+06:06=/fullscreen: Toggle fullscreen
+06:07=/quit [message]: Quit Hedgewars with optional message
+06:08=/help: List basic client chat commands
+06:09=/help taunts: List taunt chat commands
+06:10=/history: Toggle long chat history display
+06:11=/lua: Toggle Lua developer console
+06:12=List of taunt chat commands:
+06:13="text": Put text in speech bubble
+06:14='text': Put text in thinking bubble
+06:15=-text-: Put text in yelling bubble
+06:16=For above commands, put a number at start of text to select a hog.
+06:17=/hsa <text>: Put text in speech bubble on next attack
+06:18=/hta <text>: Put text in thinking bubble on next attack
+06:19=/hya <text>: Put text in yelling bubble on next attack
+06:20=/hurrah: Make hedgehog grin
+06:21=/ilovelotsoflemonade: Make hedgehog pee
+06:22=/juggle: Make hedgehog juggle
+06:23=/rollup: Make hedgehog roll up
+06:24=/shrug: Make hedgehog shrug
+06:25=/wave: Make hedgehog wave its hand