Sometimes one wants to only read who connected/disconnected/started-rejoin/finished-rejoin/got-kicked/got-banned/got-attacked/was-defeated/has-won.
Details
- Reviewers
- None
- Commits
- rP22999: Chat filter to allow players to only read network or game notifications during…
Should the network-connection status messages have a filter separate to the ingame notifications?
Diff Detail
- Repository
- rP 0 A.D. Public Repository
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
Successful build - Chance fights ever on the side of the prudent.
Linter detected issues: Executing section Default... Executing section Source... Executing section JS... | | [NORMAL] ESLintBear (space-before-function-paren): | | Unexpected space before function parentheses. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/messages.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/messages.js | 475| 475| g_Selection.reset(); | 476| 476| g_Selection.addList(selection, false, cmd.type == "gather"); | 477| 477| }, | 478| |- "play-tracks": function (notification, player) | | 478|+ "play-tracks": function(notification, player) | 479| 479| { | 480| 480| if (notification.lock) | 481| 481| { | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/messages.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/messages.js | 582| 582| let notificationText = | 583| 583| notification.instructions.reduce((instructions, item) => | 584| 584| instructions + (typeof item == "string" ? translate(item) : colorizeHotkey(translate(item.text), item.hotkey)), | 585| |- ""); | | 585|+ ""); | 586| 586| | 587| 587| Engine.GetGUIObjectByName("tutorialText").caption = g_TutorialMessages.concat(setStringTags(notificationText, g_TutorialNewMessageTags)).join("\n"); | 588| 588| g_TutorialMessages.push(notificationText); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/messages.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/messages.js |1090|1090| |1091|1091| let message = ""; |1092|1092| if (notifyPhase == "all") |1093| |- { | |1093|+ |1094|1094| if (msg.phaseState == "started") |1095|1095| message = translate("%(player)s is advancing to the %(phaseName)s."); |1096|1096| else if (msg.phaseState == "aborted") |1097|1097| message = translate("The %(phaseName)s of %(player)s has been aborted."); |1098| |- } | |1098|+ |1099|1099| if (msg.phaseState == "completed") |1100|1100| message = translate("%(player)s has reached the %(phaseName)s."); |1101|1101| binaries/data/mods/public/gui/session/messages.js | 641| » while·(true) | | [NORMAL] ESLintBear (no-constant-condition): | | Unexpected constant condition.
Link to build: https://jenkins.wildfiregames.com/job/differential/713/display/redirect
The messages that are included as well:
- someone phased up (broken in a24 for the cheat actions discovered during testing)
- diplomacy changes
- someone won or lost
- ceasefire ended (could be added)
- someone bartered
- someone tributed resources
So
Should the network-connection status messages have a filter separate to the ingame notifications?
Is a Yes if the purpose is finding out what clients connected and disconnected by hiding player chat noise (as tribute and bartering is noisy too).
- Splitting into game and network notifications.
- Moving notifications to the bottom, since chat is the main purpose of the window.
- Distinguishing network and game notifications
- Hiding network notifications in singleplayer mode
- Tested with ban, join, rejoin, disconnect, attack notification, tribute, resign
- Looked at how g_ChatHistory works, got confused, then again understood that the filter is applied when the message arrives originally, so it's fine to test for presence of GUID even if it is not saved to g_ChatHistory.
addChatMessage({ "type": "clientlist" }) This one shows up as game notificaiton, not network notification, but I won't add a new parameter to be kept in sync for that. With the type != "message" && msg.guid criteria, perhaps it would be more precisely qualified as `client notification", but I'd rather include serverside network messages later too.
The remaining 14 chat messages are treated most correctly.
Edit: At last I noticed that attack request responses sent by the AI are not shown in the Players chat but in the Ally chat they are.