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
This functions is amongst the most called in JS, so it's important to
make it speedy.
- Bugfix: if 'originalValue' is falsy, the result was never cached. This
in particular affected the minRange of archers, which is 0. It's a large
optimisation on combatDemoHuge, but the effect elsewhere is less likely
to be noticeable.
- Don't go through the helper to get the player Entity ID, in this case
it's slower.
- Concat is slower than Flat() in this case according to my profiling.
- Some micro-optimisation by strict equality.
Differential Revision: https://code.wildfiregames.com/D5012
This was SVN commit r27696.
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.
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.
Since the players/civs already have cmpIdentity, use it.
This forces civs to have corresponding XML in the `special/players/`
folder.
Also moves the files from `special/player/` to `special/players/`
consistent with other folders. And moves the generic `player.xml` one
level up.
Differential revision: https://code.wildfiregames.com/D4473
Help and comments by: @Stan, @wraitii
This was SVN commit r26298.
`ElevationBonus` is vague, as discussions proved. Therefore it is
renamed to `Origin`, which, describes better what the value stands for.
`Delay` is also quite vague, so renamed to `EffectDelay`.
Differential revision: https://code.wildfiregames.com/D2016
Comments by: @bb, @nani, @Nescio, @Silier, @Stan, @wraitii
This was SVN commit r26074.
The task of the production queue should first and foremost be that; a
queue for production items.
Hence, the specifics of training/researching are delegated to specific
components.
As a side effect, this improves the test coverage and fixes:
- Resource not refunding when hitting the entity limit. Introduced in
b8758c8941.
- Autoqueue changing when unable to spawn. Introduced in 956b3f96db.
Modders can change their templates using
https://code.wildfiregames.com/P256.
Differential revision: https://code.wildfiregames.com/D4333Fixes: #6363
Comments by: @Silier
Refs. #6364
This was SVN commit r26000.
Adds a new component effectively handling negative resource trickles.
Prevents resources from going negative and provides an effect for not
being able to pay.
The effect chosen for 0 A.D. is having the entity not being
controllable.
Not used in the public mod itself, but it is in quite some mods.
Based on an idea of @Nescio
Differential revision: D1323
Comments by: @Angen, (@smiley,) @Stan
This was SVN commit r25191.
While they often look alike, their behaviour is totally different.
This split has some implications:
- There are now separate auras for garrisoning and turrets.
- Entities can now have both turret points and garrison slots,
independent of eachother.
In general previous behaviour is maintained as much as possible.
Differential revision: D3150
Comments by: @Nescio, @wraitii
Tested by: @v32itas
This was SVN commit r25123.
Removes some hardcoding and allows for easier modding of treasures.
Refs.: #5888
Differential revision: D3303
Comments by: @Imarok, @Nescio, @Stan, @wraitii
This was SVN commit r24989.
Basically removed in 3521c8f51e, now brought back :) (But split from the
population space.)
Differential revision: D2056
Comments by: @Angen, @Nescio, @Stan, @wraitii
This was SVN commit r24960.
This commit removes two things from the `{civ}.json files, for the
following
reasons:
1. The team-bonus information, as the only thing that was reading it
(the
`civinfo` page) no longer does so.
2. Information about civ-bonuses that have been implemented via a single
auto-researchable technology, as the `civinfo` page is now capable of
displaying information from technology files and, in fact, now does
so.
This was SVN commit r24494.
As of 190d6e7cf5, the `civinfo` page no longer reads information about
Heroes and Special Structures/Technologies from the `{civ}.json` files,
but
from relevant templates.
Nothing else uses the entity/tech descriptive information contained in
the
`{civ}.json` files, so we can safely remove it.
Note: The Team and Civilisation Bonus information contained within the
`{civ}.json` files are not touched in this commit.
This was SVN commit r24493.
Since PopBonus is not a cost.
Patch by: @lonehawk
Differential Revision: D2948
Comments by: @Angen, @Nescio, @wraitii
Closes#4081
This was SVN commit r24394.
- Renames Armour-node to Resistance.
- Support resistance against Capture.
- Puts resistance against effects in separate nodes.
- Some cleaning.
Differential Revision: D2229
Reviewed by: @bb (accepted), @wraitii.
Comments by: @Stan, @Nescio.
This was SVN commit r24001.
Also resolves whitespace issue in WallSet component breaking structree
and rmgen
wallbuilder when wall curve pieces are listed separated with newlines (&
tabs)
instead of single spaces.
Requested by: Nescio
Refs: #2944, D900
This was SVN commit r23684.
Allow templates to define if friendlyfire is enabled for projectiles.
Differential Revision: https://code.wildfiregames.com/D1973
Patch by: Freagarach
Reviewed by: wraitii, Angen
This was SVN commit r23519.
Status effect can apply modifier to the entity (armour strength, walking
speed, ...)
This is also hiding status effect icons by default in selection detail.
Fixing smaller related bugs.
Differential Revision: https://code.wildfiregames.com/D2281
Patch by: @Freagarach
Comments by: Stan, wraitii
This was SVN commit r23448.
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.
This moves most of what was in the Damage system component to a helper,
and renames that component DelayedDamage.
It also introduces a new global script with all possible attack effects.
Comments Taken From: Freagarach, Stan, bb
Differential Revision: https://code.wildfiregames.com/D2092
This was SVN commit r22754.
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.
This changes running speed into a running multiplier (of walk speed).
The advantage is that it simplifies code since you can setup a default
run multiplier at the template level and it'll work for all subsequent
templates, and technologies cannot forget to change it. It makes
specialised unit templates easier to maintain, too.
Formations have a 100 run multiplier which effectively sets their
maximal walking speed at 100
Reviewed By: bb, O2 JS Simulation
Differential Revision: https://code.wildfiregames.com/D438
This was SVN commit r22197.
Right-click on icons of units, structures, technologies, flora, fauna,
etc. and view additional details.
Reviewed By: elexis
Fixes: #3212
Differential Revision: https://code.wildfiregames.com/D297
This was SVN commit r21310.
Spotted By: s0600402
Noticed in review by fatherbushido, but didn't came into patch by
Grugnas, and later forgotten to yell about again by bb when accepting.
This was SVN commit r20643.
Removes the workaround and limitations of globalscripts Resources
(52f311da2b) and loadCivFiles (89055ef858), allowing them to actually
become actually global.
Rename to ListDirectoryFiles as proposed by wraitii.
Differential Revision: https://code.wildfiregames.com/D1103
Reviewed By: s0600204
Proofread by: echotangoecho
Comments by: wraitii
Relevant discussions with leper in #4868, D1062
This was SVN commit r20586.
Unify civ file loading from gui/common/functions_civinfo.js and
rmgen/library.js in globalscripts/Templates.js.
Delete the two forgotton headers in 4275a8a33c.
Refs #4868, #4804, D900.
Differential Revision: https://code.wildfiregames.com/D1062
Discussed with: leper
This was SVN commit r20528.
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.
Useful for f.e. required techs and attack types
Reviewed By: leper
Differential Revision: https://code.wildfiregames.com/D869
This was SVN commit r20188.
Patch by Mate-86.
Advices from leper.
Reviewed by fatherbushido.
Differential Revision: https://code.wildfiregames.com/D451
This was SVN commit r19950.