/greeting chat commands now clears greeting if called w/o arguments
authorWuzzy <Wuzzy2@mail.ru>
Sun, 26 Aug 2018 14:59:05 +0200
changeset 13704 54eb4c774ef5
parent 13703 2df519242d41
child 13705 aa1d71ca6c19
/greeting chat commands now clears greeting if called w/o arguments
ChangeLog.txt
gameServer/CommandHelp.hs
gameServer/HWProtoCore.hs
gameServer/HWProtoInRoomState.hs
--- a/ChangeLog.txt	Sun Aug 26 14:37:02 2018 +0200
+++ b/ChangeLog.txt	Sun Aug 26 14:59:05 2018 +0200
@@ -85,6 +85,12 @@
  + Add dust flakes for Cheese and CrazyMission themes
  * Fix repeating sun in Hoggywood theme
 
+Server:
+ + Add “/help” chat command for command help
+ + Can now clear room greeting by using chat command “/greeting” without arguments
+ + Many new error and status messages for improved usability
+ * Fix many server messages being not translated
+
 Lua API:
  + New call: Retreat(time [, respectGetAwayTimeFactor): Force current turn into retreating mode
  + New call: GetAmmoTimer(gearUid, ammoType): Returns current set timer for given ammoType and hog gear in ms. Returns nil for non-timerable ammo
--- a/gameServer/CommandHelp.hs	Sun Aug 26 14:37:02 2018 +0200
+++ b/gameServer/CommandHelp.hs	Sun Aug 26 14:59:05 2018 +0200
@@ -45,7 +45,7 @@
     loc "/callvote [arguments]: Start a vote",
     loc "/vote <yes/no>: Vote 'yes' or 'no' for active vote",
     -- For room master only
-    loc "/greeting <message>: Set greeting message to be shown to players who join the room",
+    loc "/greeting [message]: Set or clear greeting message to be shown to players who join the room",
     loc "/delegate <player>: Surrender room control to player",
     loc "/maxteams <N>: Limit maximum number of teams to N"
     ]
--- a/gameServer/HWProtoCore.hs	Sun Aug 26 14:37:02 2018 +0200
+++ b/gameServer/HWProtoCore.hs	Sun Aug 26 14:59:05 2018 +0200
@@ -86,7 +86,7 @@
         h "WATCH" f = return [QueryReplay f]
         h "FIX" _ = handleCmd ["FIX"]
         h "UNFIX" _ = handleCmd ["UNFIX"]
-        h "GREETING" msg | not $ B.null msg = handleCmd ["GREETING", msg]
+        h "GREETING" msg = handleCmd ["GREETING", msg]
         h "CALLVOTE" msg | B.null msg = handleCmd ["CALLVOTE"]
                          | otherwise = let (c, p) = extractParameters msg in
                                            if B.null p then handleCmd ["CALLVOTE", c] else handleCmd ["CALLVOTE", c, p]
--- a/gameServer/HWProtoInRoomState.hs	Sun Aug 26 14:37:02 2018 +0200
+++ b/gameServer/HWProtoInRoomState.hs	Sun Aug 26 14:59:05 2018 +0200
@@ -433,8 +433,17 @@
 handleCmd_inRoom ["GREETING", msg] = do
     cl <- thisClient
     rm <- thisRoom
-    return [ModifyRoom (\r -> r{greeting = msg}) | isAdministrator cl || (isMaster cl && (not $ isSpecial rm))]
-
+    return $ if (not (isAdministrator cl || (isMaster cl && (not $ isSpecial rm)))) then
+                 [Warning $ loc "You're not the room master or a server admin!"]
+             else
+                 [ModifyRoom (\r -> r{greeting = msg}),
+                  AnswerClients [sendChan cl]
+                      ["CHAT", nickServer,
+                          if msg == "" then
+                              loc "Greeting message cleared."
+                          else
+                              loc "Greeting message set."
+                      ]]
 
 handleCmd_inRoom ["CALLVOTE"] = do
     cl <- thisClient