Commit graph

56 commits

Author SHA1 Message Date
phosit
434a1a1905
Remove Engine.SwitchGuiPage from mod 2026-04-26 12:44:41 +02:00
Dunedan
93ce94655d
Use @stylistic/brace-style for eslint
Up to now `eslint-plugin-brace-rules` was used to enforce a common brace
style for JavaScript code. This plugin was however updated the last time
over 9 years ago and will be incompatible with ESLint v10, as that
[removes `context.getSourceCode()`][1], the plugin relies on.

To keep the eslint config working with ESLint v10, this replaces
`eslint-plugin-brace-rules` with the [`@stylistic/brace-style`][2] rule
from `@stylistic/eslint-plugin`, a package we already use.

While `@stylistic/brace-style` doesn't offer an option to format braces
in exactly the same way as before, the "allman" style seems to be the
one closest to the existing code.

[1]: https://eslint.org/blog/2025/11/eslint-v10.0.0-alpha.0-released/#removed-deprecated-rule-context-members
[2]: https://eslint.style/rules/brace-style
2026-01-12 21:33:52 +01:00
Ralph Sennhauser
8b98a7a27c
Enable eslint rule 'no-extra-boolean-cast'
Enable https://eslint.org/docs/latest/rules/no-extra-boolean-cast

Ref: #8068
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-14 12:03:06 +02:00
Ralph Sennhauser
3a2d75af65
Fix eslint rule 'no-irregular-whitespace'
Manual fixes needed for:
eslint --no-config-lookup --rule '"no-irregular-whitespace": 1'

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-14 13:52:12 +02:00
Ralph Sennhauser
7684e12717
Fix eslint rule 'prefer-const' in modmod
eslint --no-config-lookup --fix --rule '"prefer-const": 1' \
    binaries/data/mods/mod

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-06 13:49:13 +02:00
phosit
40762c257d Quit Engine by closing the root page
When the root page gets closed the engine quits instead or crashing.
The root pages are changed to use that mechanism to quit the engine.
This removes the need of `Engine.Exit` for the GUI.
2025-03-12 12:07:37 +01:00
phosit
df5fee6103 Rename PushGuiPage to OpenChildPage
There is no `PopGuiPage` anymore. For symmetry there should also be no
`PushGuiPage`.
2025-03-09 10:39:20 +01:00
Itms
dc830ccf55
Switch main branch to Release 28 2025-01-12 01:27:02 +01:00
bb
157c6af18e Make the space in 0 A.D. non-breaking throughout the codebase.
Avoid cases of filenames
Update years in terms and other legal(ish) documents
Don't update years in license headers, since change is not meaningful

Will add linter rule in seperate commit

Happy recompiling everyone!

Original Patch By: Nescio
Comment By: Gallaecio
Differential Revision: D2620
This was SVN commit r27786.
2023-07-27 20:54:46 +00:00
Angen
281bb0b2ec Remove user.cfg from javascript
remove path from javascript
path is defined by the configuration scope

combine some calls
remove not needed calls

Differential revision: D4616
Accepted by: @Freagarach, @nani
Comments by: @phosit
This was SVN commit r27192.
2022-11-02 07:21:25 +00:00
Stan
f68528777f Bump version to alpha 27.
Last alpha 26 commit was [[SVN:27104]]

Accepted by: @asterix, @vladislavbelov
Discussed with: @Freagarach, @wraitii, @implodedok, @Itms

Refs: #6625

Differential Revision: https://code.wildfiregames.com/D4789
This was SVN commit r27105.
2022-10-04 17:05:11 +00:00
Stan
4a9bac2811 Bump version to alpha 26.
Last alpha 25 commit was [[SVN:25860]]

Accepted by: @Freagarach, @asterix
Comments by: @wraitii
Differential Revision: https://code.wildfiregames.com/D4215
This was SVN commit r25861.
2021-08-27 16:32:34 +00:00
Angen
8f5b5670ff Fix gui objects failing on undefined in modmod
Differential revision: D4209
Since some revision wraitii will probbaly know, I am not going to look
for it, guiobjects require exact data type so casting does not work when
it is not done beforehand.
Error reported by Stan.
Now installing pyromod should not trigger errors.

This was SVN commit r25849.
2021-08-17 17:29:54 +00:00
Angen
dfbc481ec1 [Mod] Fix list and filter in mod selection breaking page when mod is missing some attribute
In case mod is missing some required field, for example label or version
for some reason, mod page would stop functioning.
Adding default to empty string in list and filter.

Differential revision: D4028
This was SVN commit r25639.
2021-06-02 17:58:49 +00:00
Angen
0f8ba775c3 Fix areFilters
Removed in 0d87ec5cf4.

Differential revision: D4041
Tested by: @marder
Reviewed by: @wraitii
This was SVN commit r25638.
2021-06-02 17:45:17 +00:00
Angen
0d87ec5cf4 Fix and simplify areFilters functions
Workaround is not needed anymore since 37e08a4ffb

This was SVN commit r25601.
2021-05-30 09:32:18 +00:00
wraitii
bce26e905f Mod selector: "start mods" saves the configuration.
Differential Revision: https://code.wildfiregames.com/D3992
This was SVN commit r25573.
2021-05-26 13:27:43 +00:00
wraitii
8f8e29c092 Fix incompatible mods start: show both incompatible and enabled mods;
As noted by Angen in a26535d023, refs 3bcf360107
When starting with incompatible mods, the non-incompatible mods were no
longer shown. This fixes that.
I think the code looks cleaner from this new control flow that
explicitly only mounts "mod".

Tested by: Angen
Differential Revision: https://code.wildfiregames.com/D3996
This was SVN commit r25510.
2021-05-22 07:33:49 +00:00
wraitii
a26535d023 Fix mistake in 3bcf360107 which stopped the incompatible mods page from showing.
I didn't quite understand what was supposed to happen here. This makes
things work as before.
While at it, fix a conversion bug & do some more tweaks.

Differential Revision: https://code.wildfiregames.com/D3990
This was SVN commit r25475.
2021-05-20 17:11:26 +00:00
wraitii
3bcf360107 Mod and mod-mounting cleanup and improvements.
- Non-visual replays now automatically try to load the replay mods. This
removes the annoyance that -mod=public usually had to be passed.
- MountMods is no longer called in InitVfs but later, making it possible
to load the game in one pass & simplifying things considerably.
- Explicitly ignore duplicates when loading mods
- Interface cleanup: failed mods and incompatible mods were redundant,
only incompatible mods is kept.
- Interface cleanup: `AreModsCompatible`becomes
`CheckForIncompatibleMods`, which becomes a private pure function,
simplifying the control flow somewhat.
- Interface cleanup: `CheckAndEnableMods` is just `EnableMods`, which
explicitly updates loaded & incompatible mods.
- `CacheEnabledModVersions` becomes private and is called on behalf of
the user, removing the need to be careful about updating that (fixes my
concern at 44ec2e324e)

Overall, the logic around mounting & enabled mods should be easier to
understand.

Differential Revision: https://code.wildfiregames.com/D3982
This was SVN commit r25474.
2021-05-20 14:36:42 +00:00
Angen
f1acd22455 Do not allow to start pyrogenesis with incompatible mods
Fixing following problems:
Issue number one:
Enable mod with a23 compatibility in a23b.
Save configuration.
Start a24.
Better result:
Mod will be enabled and invisible in mod selection screen producing
various errors.
Worse result:
Game will crash and refuse to start.

Issue number two:
Mods can silently set loaded mods without restarting the engine, so mods
can unlist themselves from compatibility detection.

Solution:
Enable necessary mods instead if running with gui and open mod page.
Open information window on top of mod page to infom why mod page is
showing up.
On mod page show mods which failed in compatibility check and color the
resposnible ones.
Disable start button without enabled mods.
Show non existed mods if they failed in compatibility check.

Else just log to mainlog and close.

Another fixes:
Display in enabled mods really enabled mods as current logic confuses
players about which mods they have enabled and is not helpful (ref
#4881)

Note:
this will not solve issue with mods claiming being compatible with
engine version while in fact being incompatible.

Comments by: @vladislavbelov, @Stan, @Imarok
Tested by: @wraitii
Differential revision: D3592
Fixes: #6044 #4881

This was SVN commit r25410.
2021-05-09 13:53:25 +00:00
Angen
57e85c195e Fix wrongly placed parameter in 841bf5f2dd
Correctly colour url of invalid mod.

This was SVN commit r25270.
2021-04-15 20:21:47 +00:00
Angen
841bf5f2dd Color incompatible mods and add filter
This helps to see compatible mods in the list, which can get a bit long.
For incompatible mods in disabled section use gray colour.
For incompatible mods in enabled section use red colour (what can happen
when using arguments to start the game or they can be in config file).
Add option to filter compatible mods, this does not affect enabled
section, because if there is incompatible mod, it is error and it needs
to be always visible.
Add function recomputeCompatibility and g_ModsCompatibility to avoid
recomputing aredependenciesmet when coloring mods, because every column
is colored separately.
Disable enable mod button if mod is incompatible.
Remove all dependencies met messages as they are now replaced by this
mechanism.

fix getSelectedModUrl in process

Differential revision: D3687
Fixes: #6053
Tested by: @Freagarach
Comments by: @vladislavbelov
This was SVN commit r25095.
2021-03-21 10:22:50 +00:00
Angen
1c68d9890b Remove redundant applyFilters method from modmod
All functionality in applyFilters is handled by displayModLists and
modSelected functions.
This is also fixing issue of triggering selected event on the same list
multiple times and not updating mod description and buttons when
applying filters.

Differential revision: D3722
This was SVN commit r25094.
2021-03-21 08:51:17 +00:00
wraitii
831e4a183f Fix a crash in the mod selector when using the mod downloadder.
When closing the mod downloader, the list of enabled mod is reset, which
can lead to an out-of-index assertion failing in the engine if an
enabled mod was selected before.

Reported by: Vas
Fixes #6001

Differential Revision: https://code.wildfiregames.com/D3537
This was SVN commit r24854.
2021-02-08 10:13:06 +00:00
Angen
37e08a4ffb Implement placeholder text for input fields and get rid of hack with mod filter
different font colour
no need to delete the text, when one wants to write there something
text displayed is not a value so field is technically empty
will disappear when user writes some character
will appear when user deletes all characters
we can get rid of text value "Filter" in mod selection screen and ugly
hack around it

Differential Revision: D2460
Comments by: vladislavbelov, elexis
This was SVN commit r24433.
2020-12-21 09:04:12 +00:00
Imarok
0c917a2a52 Fix button caption and enable in modmod
Differential Revision: https://code.wildfiregames.com/D1623
This was SVN commit r23506.
2020-02-17 18:22:52 +00:00
Angen
eb3b7f089e Fix mod list filter
Fixing problem with filters reported in 64bfa089af.

Use filtered version of mods for manipulation in javascript instead non
filtered one.
Fixing following problems when filter is applied:
not enabling selected mod
displaying wrong tooltip
getting out of bounds error when using keyboard arrows to select
next/previous mod

This is also disabling possibility to sort enabled mods manually when
filters are applied. See comment in moveCurrItem for more details.

Differential Revision: https://code.wildfiregames.com/D1944
This was SVN commit r23269.
2019-12-20 20:19:21 +00:00
Itms
5561327d3f Fix some untranslated strings, fixes #5155.
Patch By: Stan
Differential Revision: https://code.wildfiregames.com/D1560
This was SVN commit r21960.
2018-12-28 13:07:22 +00:00
elexis
6fe427664b Bump version to alpha 24.
Last alpha 23 commit was 0044c5c2e8.

Differential Revision: https://code.wildfiregames.com/D1705
Reviewed By: Itms
Comments By: Stan, smiley, bb
This was SVN commit r21951.
2018-12-26 11:28:37 +00:00
elexis
82a89c4eb1 Move openURL function and two strings from public/ to mod/.
Use it for the mod author website now.
Use it for the terms links next, refs #5257, D1627.

This was SVN commit r21889.
2018-09-22 16:23:43 +00:00
elexis
da49aa1541 Refactor lobby terms and conditions UI from 80dbd1f2a3 / D1568 to a new terms dialog UI and reuse that for mod.io and the UserReporter, refs #5257, #5218.
Reuse all existing strings, use a FileExists hack for mod.io until the
new strings are committed.
Rename prelobby/common/terms/terms.js to termslobby.js for easier
distinction from common/terms.js.

Based on patch by: bb
Differential Revision: https://code.wildfiregames.com/D1602
refs https://code.wildfiregames.com/D1601
refs https://github.com/bb-bb/0ad/tree/terms
refs https://github.com/elexis1/0ad/tree/terms

This was SVN commit r21887.
2018-09-14 15:14:48 +00:00
elexis
7f4950cb17 Use https in hyperlinks for sites that support it, refs #5257.
This was SVN commit r21870.
2018-08-23 09:23:06 +00:00
Itms
833c9f108c mod.io support.
mod.io is a new platform for sharing mods, that 0 A.D. can make use of
in order to download mods and install them.

Based on patch by leper, numerous changes from s0600204, vladislavbelov,
Imarok, elexis, temple and myself.
Differential Revision: https://code.wildfiregames.com/D1029
This was SVN commit r21759.
2018-04-22 18:14:45 +00:00
Imarok
724b25bac6 Style adjustments to 936c16050b
This was SVN commit r21738.
2018-04-17 17:31:11 +00:00
Itms
404e1a9a4a Add a mod installer, fixes #4027.
pyrogenesis can now take a zip file (rename it to .pyromod for direct
file association following 943a61e4ea) and install it. It then starts
the mod selector.

Patch by vladislavbelov, with contributions from Imarok, elexis and
myself.
Differential Revision: https://code.wildfiregames.com/D1142
This was SVN commit r21726.
2018-04-15 01:46:28 +00:00
Imarok
936c16050b Make modmod looking nicer
Reviewed by: Itms
Differential Revision: https://code.wildfiregames.com/D1412
This was SVN commit r21721.
2018-04-14 20:04:17 +00:00
elexis
c69b5688bc Revert 8684e06ce0 / D1083 since the translated strings are only accessible while the public mod is enabled.
Reported By: leper
Reviewed By: Vladislav
Alternatively one might consider mod label and description translations
contained in the mod.json.

This was SVN commit r21341.
2018-02-24 00:33:30 +00:00
elexis
adc2bb872d Fix three wrongly chosen variables in 71121b8a89 / D1093, a wrong case-insensitive implementation and extend the tests to catch that.
Differential Revision: https://code.wildfiregames.com/D1151
Reviewed By: mimo
This was SVN commit r20656.
2017-12-15 23:37:43 +00:00
elexis
16dab5a587 Hide the cancel button in the modmod of the mod mod and the quit button when called from the public mod.
Differential Revision: https://code.wildfiregames.com/D1141
Reviewed By: Grugnas
Refs #4890

This was SVN commit r20645.
2017-12-12 16:06:52 +00:00
elexis
71121b8a89 Define, document, validate and test validation of the format of mod.json files.
The mod "name" may only consist of alphanumeric characters, underscore
and dash, because it should be used for mod dependency checks.
Drop two special characters from the "version" property.

Differential Revision: https://code.wildfiregames.com/D1093
Res #4427, d3ce5289b6
Reviewed By: Itms
This was SVN commit r20637.
2017-12-10 16:13:18 +00:00
elexis
8684e06ce0 Support translation of mod labels and description.
Differential Revision: https://code.wildfiregames.com/D1083
Reviewed By: Vladislav
This was SVN commit r20614.
2017-12-08 20:51:36 +00:00
elexis
0d51f0391a Add buttons to visit the website of the selected mod.
Differential Revision: https://code.wildfiregames.com/D1101
Refs #4890
Reviewed By: Grugnas
Comments By: fpre / ffffffff
This was SVN commit r20599.
2017-12-06 19:58:23 +00:00
elexis
54904b1750 Add gui tag color setter function, so that we don't have to read and ensure the color syntax each time.
Differential Revision: https://code.wildfiregames.com/D1088
Patch By: fpre / ffffffff
This was SVN commit r20585.
2017-12-04 17:29:26 +00:00
elexis
5e85ca5d7b Deprecate type property of mods.
Such a property should be well defined, but currently it contains
arbitrary text and is redundant with the description.

Differential Revision: https://code.wildfiregames.com/D1082
Refs #4890
Discussed with: leper
Reviewed By: wraitii
This was SVN commit r20575.
2017-12-03 21:44:16 +00:00
elexis
c670f14812 Fix camouflaged oversight in d3ce5289b6 reported by leper and stupidly forgotton regex.
Complete documentation and validation of loaded mods proposed in D1093.

Differential Revision: https://code.wildfiregames.com/D1081
Reviewed By: wraitii, Itms
This was SVN commit r20574.
2017-12-03 21:14:54 +00:00
elexis
71ef1a6e95 Replace mod selection sorting choice dropdown and checkbox with the column based sorting from b8fce56821, refs #2405.
Use case insensitive sorting iff it's the locale default.

This was SVN commit r20555.
2017-11-29 12:47:16 +00:00
elexis
d3ce5289b6 Cleanup mod selection GUI page.
Refactor functions and unify sort dropdown choices.
Move colors to globals so that they are easily modifiable, even from
external files, refs fd034c9bcd / D911.
Fix broken "Dependency not met" translation and wrong equal comparison
operator description (== vs =), refs 64bfa089af.
Use localeCompare, simpler loops and array functions, JSdoc syntax,
ternaries, deepfreeze, let keyword and prefix increment operator.
Renames to increase descriptiveness and consistency.
Remove duplication, tautologic and unsatisfiable conditions, dead code,
unused variables and GUI object names, example within example,
unneeded variables, parentheses, TODOs, strict checks and keep XML
element, misleading linebreaks, pointless comments and "Mods Loaded"
string and the switch fall-through.

This was SVN commit r20552.
2017-11-28 22:43:27 +00:00
leper
fd034c9bcd Use white text in the mod selection screen. Patch by Nescio.
Differential Revision: https://code.wildfiregames.com/D911
This was SVN commit r20195.
2017-09-18 03:08:25 +00:00
elexis
03550f7595 Fix whitespace and lineendings in few recent commits.
This was SVN commit r19763.
2017-06-11 00:51:11 +00:00