Allows the cheat "retro me"(rP20734) even if cheats are disabled. Currently it has one bug: retro me off doesn't work for observers, but I guess that has something to do with how we play music.
Details
- Reviewers
- None
Do retro me and retro me off in different situations.
Diff Detail
- Repository
- rP 0 A.D. Public Repository
- Branch
- /ps/trunk
- Lint
Lint OK - Unit
No Unit Test Coverage - Build Status
Buildable 5793 Build 9712: Vulcan Build Jenkins Build 9711: arc lint + arc unit
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... binaries/data/mods/public/simulation/helpers/Cheat.js | 103| » » var·cmpTechnologyManager·=·Engine.QueryInterface(playerEnt,·IID_TechnologyManager); | | [NORMAL] JSHintBear: | | 'cmpTechnologyManager' is already defined. binaries/data/mods/public/simulation/helpers/Cheat.js | 110| » » » var·cmpProductionQueue·=·Engine.QueryInterface(input.selected[0],·IID_ProductionQueue); | | [NORMAL] JSHintBear: | | 'cmpProductionQueue' is already defined. | | [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 | 473| 473| }; | 474| 474| | 475| 475| var g_GuiCheats = { | 476| |- "playRetro": function (parameter) | | 476|+ "playRetro": function(parameter) | 477| 477| { | 478| 478| let play = parameter.toLowerCase() != "off"; | 479| 479| if (play) | | [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 | 583| 583| let notificationText = | 584| 584| notification.instructions.reduce((instructions, item) => | 585| 585| instructions + (typeof item == "string" ? translate(item) : colorizeHotkey(translate(item.text), item.hotkey)), | 586| |- ""); | | 586|+ ""); | 587| 587| | 588| 588| Engine.GetGUIObjectByName("tutorialText").caption = g_TutorialMessages.concat(setStringTags(notificationText, g_TutorialNewMessageTags)).join("\n"); | 589| 589| 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 |1091|1091| |1092|1092| let message = ""; |1093|1093| if (notifyPhase == "all") |1094| |- { | |1094|+ |1095|1095| if (msg.phaseState == "started") |1096|1096| message = translate("%(player)s is advancing to the %(phaseName)s."); |1097|1097| else if (msg.phaseState == "aborted") |1098|1098| message = translate("The %(phaseName)s of %(player)s has been aborted."); |1099| |- } | |1099|+ |1100|1100| if (msg.phaseState == "completed") |1101|1101| message = translate("%(player)s has reached the %(phaseName)s."); |1102|1102| binaries/data/mods/public/gui/session/messages.js | 642| » while·(true) | | [NORMAL] ESLintBear (no-constant-condition): | | Unexpected constant condition.
Link to build: https://jenkins.wildfiregames.com/job/differential/361/display/redirect
It would be cleaner if all cheats would take the same path, f.e. first go through a g_Cheats array of functions in gui/ and then the cheat in there could decide if it wants to to call the simulation or not.
As mentioned in the revision proposal of the musicplayer cheat, a GUI to play music would be nice if time permits.
Also mentioned before, the cheat JSON files seem a bit useless, because their code still has to be hardcoded in some switch. (I've never seen a switch that I was happy to see in JS.)
It should be an interface so that mods can be plugged in by only adding new files.
The developer overlay also contains many GUI cheats.
Reducing the complexity while adding features is more ideal than increasing an already too complex system.
binaries/data/mods/public/gui/session/messages.js | ||
---|---|---|
531 | GUI cheats should also be disabled if cheats are disabled. |