Commit graph

15 commits

Author SHA1 Message Date
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
7b4cf11e25
Fix eslint rule 'no-shadow'
Manual fixes needed for:
eslint --no-config-lookup --rule '"no-shadow": 1'

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-17 09:48:36 +02:00
Ralph Sennhauser
88eea5c7e3
Fix eslint rule 'prefer-const' in components/tests
eslint --no-config-lookup --fix --rule '"prefer-const": 1' \
    binaries/data/mods/public/simulation/components/tests

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-11 10:03:30 +02:00
Freagarach
9bb9ff8b16 Add Requirements helper.
Allows more flexibility in e.g. the Identity requirements and unifies
the checking of requirements.
One can use the script at https://code.wildfiregames.com/P265 to fix
templates.

Differential revision: https://code.wildfiregames.com/D4514
Comments by: @elexis, @Stan
Fixes #6421

This was SVN commit r27245.
2022-11-24 11:20:11 +00:00
marder
a80ce526b7 [Fix] Patch globalscripts technology template helper after 8d80a2186e and the ProductionQueue split
Patch by @s0600204.

This lets all technologies show up correctly in-game and in the
structure tree again.

accepted by: @marder @Freagarach
Fixes: #6587

Differential Revision: https://code.wildfiregames.com/D4755
This was SVN commit r27042.
2022-08-10 21:49:15 +00:00
Freagarach
fd08ab051f Fix other civs being able to upgrade Han CC to Court.
This ensures the `{civ}` and `{native}` tags are (properly) supported
for upgrades and uses it for the Han CC.

Reported on the forums
(https://wildfiregames.com/forum/topic/82754-alpha-26-pre-releaserelease-candidate-build-testing/page/10/#comment-508908)
by @Gurken Khan.
Differential revision: https://code.wildfiregames.com/D4733
Comments by: @Stan, @wowgetoffyourcellphone
This was SVN commit r27008.
2022-07-15 17:16:00 +00:00
Freagarach
b57abe806c Move civ-specific templates to subfolders.
See also
https://wildfiregames.com/forum/index.php?/topic/28614-template-folder-structure/.

Differential Revision: D2952
Reviewed By: @Nescio
This was SVN commit r24216.
2020-11-19 10:20:25 +00:00
Angen
0bfaedb78d Do not allow upgrading when entity is producing and vice versa.
Before this patch, when entity was upgrading and producing and finished
upgrading before production, production was canceled. That meant player
assumed unit/tech will be ready in certain time but it will not. Also
fixing interference between upgrade and production animations.

Differential Revision: D2652
Reviewed by: bb
Comments by: Stan, Freagarach
Fixes: #5749
Refs: #2706

This was SVN commit r24088.
2020-10-04 10:20:20 +00:00
wraitii
026ce76e3f Update the fast-actions cheat and AI bonuses to use the modifiers manager
This deletes custom-code and shows how to use this system component for
triggers.

Differential Revision: https://code.wildfiregames.com/D1011
This was SVN commit r22964.
2019-09-22 07:46:29 +00:00
elexis
b7c59622ec Remove two GetTemplateDataHelper unused arguments following 1b20ac7671 and 6643613b54, refs #3934, #4801 / D1938.
Reported By: Polakrity
This was SVN commit r22836.
2019-09-03 09:42:37 +00:00
wraitii
e16c4c4800 Add a system component to handle stat modifiers, make technologies and auras use this common interface.
The ModifiersManager system component provides an interface to add and
remove modifiers, and get modified stats.
The goal is to merge all the different stat-modifying systems 0 A.D. has
implemented over the years.
This commit makes technologies and auras use ModifiersManager. Some
cheats and AI bonuses also have a similar stat-modifying effect that
have not yet been updated.

Further, this system component makes it possible for e.g. triggers to
easily add modifiers, enabling the writing of Castle Blood Automatic,
RPG or Tower Defense maps without the need for mods or hacks.

The 'Modifier' name was preferred over 'Modification' as it is shorter
and more readable, along with the logic that 'modifiers' store
'modifications' and this stores modifiers. Renaming of other functions
and classes has been left for future work for now.

Internally, this uses a JS data structure. If performance issues arise
with it in the future, this data structure or the whole component could
be moved to C++.
The performance has been tested to be about as fast as the current
implementations (and specifically much faster for global auras with no
icons). Testing showed that sending value modification messages was by
far the slowest part.

Comments by: leper, Stan, elexis
Differential Revision: https://code.wildfiregames.com/D274
This was SVN commit r22767.
2019-08-24 07:37:07 +00:00
wraitii
6643613b54 Easier introduction of new damage types.
725aa8a686 introduced a DamageTypes.js global script similar to the
resources one. However, we never actually need to refer to this script
since we can always use the damage types provided by the
template/context/object we are looping over/...
There is one exception to this for AI weighting of damage types.
However, since damage types are not stored in files, this is strictly
equivalent to hardcoding them in the global script and was deemed
acceptable.

Patch By: freagarach
Reviewed By: wraitii
Refs #4801 (by invalidating it for now, though such helper files might
be useful in the future if damage types require more metadata).

Differential Revision: https://code.wildfiregames.com/D1938
This was SVN commit r22527.
2019-07-22 18:37:18 +00:00
mimo
5b314fc0ac Add a time multiplier for AI levels
Differential Revision: https://code.wildfiregames.com/D1350
This was SVN commit r21423.
2018-03-03 10:05:04 +00:00
leper
725aa8a686 Move damage types definition to a new helper similar to how resources are handled.
This should make adding new damage types a little easier, however such
an
extension would still need changes to the AI, and to all templates that
have Armour, Attack, or DeathDamage.

Reviewed By: elexis
Differential Revision: https://code.wildfiregames.com/D866
This was SVN commit r20203.
2017-09-18 16:33:56 +00:00
s0600204
10f8d019e5 Add a test for the Upgrade Component, focusing on tech modifications.
Also tests the appropriate function in `globalscripts/Templates.js`.

Reviewed By: fatherbushido
Differential Revision: https://code.wildfiregames.com/D519
This was SVN commit r19686.
2017-05-28 21:09:16 +00:00