Commit graph

22 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
4c4f787c63
Fix eslint rule 'prefer-const' in components/[A-B]*
eslint --no-config-lookup --fix --rule '"prefer-const": 1' \
    binaries/data/mods/public/simulation/components/A* \
    binaries/data/mods/public/simulation/components/B* \

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-11 10:40:23 +02:00
Freagarach
a54dbf4bfd Add brief explanations to the tooltips of the alert buttons.
For a bit of added clarity.

Patch by: @abian
Differential revision: https://code.wildfiregames.com/D5095
Fixes #6850

This was SVN commit r27886.
2023-10-13 09:34:51 +00:00
Freagarach
c917c39a0d Pull Diplomacy out of cmpPlayer.
Who says only players should be able to conduct diplomacy?
Also separation of concerns, more maintainable files.

Differential revision: https://code.wildfiregames.com/D4921
Comments by: @elexis, @Stan
Refs. #5894

This was SVN commit r27722.
2023-06-19 06:33:33 +00:00
Freagarach
fb498d97d9 Fix raising alert.
After 21e866fcf0.
AllertRaiser replaced the order instead of just calling the required
function.
While at it, check for the garrisonable size when looking for buildings.

Differential revision: D3789
Tested by: @Langbart
This was SVN commit r25183.
2021-04-02 17:01:59 +00:00
Freagarach
979636cc57 Ungarrison entities using cmpGarrisonable.
Follow-up to e18001e897.
This moves responsibilities even further to the garrisoning entity.

Fixes the garrison flag when renaming entities cannot garrison (#5906).
Allows easy fixing of #6087.

Ticket: #6081
Differential revision: D3628
Comments by: @Stan, @wraitii (also in length on IRC)
This was SVN commit r25019.
2021-03-06 06:07:32 +00:00
Freagarach
0e6cf11d86 Resupport more garrisoned slots per entity.
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.
2021-02-28 10:02:03 +00:00
wraitii
93a352ad16 Fix UnitAI range queries - allow queries to ignore sizes - partial revert of d0fc8ff67d
Units sometimes ignored targets that entered their LoS. The cause is
d0fc8ff67d: range queries returned units farther away, and those units
might actually be out of range if distance is computed center-to-center,
which both UnitAI and LOS do. This meant that code relying on range
query updates was possibly broken, and indeed units missed things (see
ticket).

This introduces a boolean to switch between pre-d0fc8ff67d behaviour
(entity-as-point, center-to-center range queries) and post-d0fc8ff67d
(entities-as-circumscribing-circle, edge-to-edge range queries).
The former is used for UnitAI (where the new behaviour bugged), auras
(where varying structure sizes made it awkward) and build
restrictions(which simply did not really need it).

Reverts 7f1ee23d88, 050c5401b1 (with the exception of the iber monument
footprint), and the template changes in d0fc8ff67d itself.

It also reduces alertRaiser ranges slightly, this was missed in the
original diff.

#3381 is not reopened as BuildingAI still uses the new range queries.

Reported by: Freagarach
Comments By: Angen
Fixes #5968

Differential Revision: https://code.wildfiregames.com/D3456
This was SVN commit r24776.
2021-01-23 18:57:46 +00:00
Freagarach
e98fce58a6 Move some position-related functions to PositionHelper.
Renames helper Entity.js to Position.js and moves to there:
- `EntitiesNearPoint` (from Attacking.js).
- `InterpolatedLocation` (from Attacking.js).
- `TestCollision` (from Attacking.js).
- `PredictTimeToTarget` (from Attack.js).

Also adds a test for the helper.

Differential Revision: D2940
Reviewed By: @wraitii
Comments by: @Stan, @vladislavbelov
This was SVN commit r24128.
2020-11-04 18:56:45 +00:00
temple
4eb9582e63 Town bell - use matching classes, add a market alert
Replace the alert level with matching classes.
Women respond to bells at the civic center, farmstead, and storehouse.
Trade carts respond to the bell at the market.
Allow garrisoning in allied buildings.
Adapt the GUI to the new behavior.

Differential Revision: https://code.wildfiregames.com/D937
Reviewed by: causative
This was SVN commit r21343.
2018-02-24 04:35:26 +00:00
temple
37d317e01a Remove the alert status on units
Differential Revision: https://code.wildfiregames.com/D681
Reviewed by: causative
Fixes: #4185, #4656

This was SVN commit r21074.
2018-01-30 01:47:12 +00:00
Stan
53186fbf3a Differential Revision: ​https://code.wildfiregames.com/D403
Reviewed By: elexis, temple,
Comments: fatherbushido

This was SVN commit r20617.
2017-12-09 16:12:04 +00:00
Itms
83a2e810da Remove all occurrences of for each in JS scripts.
This will allow us to use some linters that would otherwise crash on
this non-standard SpiderMonkey feature. Refs #4419.

Special thanks to elexis for thoroughly checking and testing all the
changes!
Reviewed By: leper, elexis
Differential Revision: https://code.wildfiregames.com/D40
This was SVN commit r19191.
2017-01-30 12:47:08 +00:00
elexis
6149dd3841 Actually remove trailing whitespace for non-header files as well.
This was SVN commit r18989.
2016-11-23 13:02:58 +00:00
elexis
989df9cb3b Fix lineendings of JS simulation components.
This was SVN commit r18432.
2016-06-24 12:23:39 +00:00
leper
5a7b4e380a Rename some occurences of *Man to cmp*Manager.
This was SVN commit r16948.
2015-08-29 22:49:42 +00:00
mimo
dd6b6779af trained animals in corral should not respond to alert, adresses #2792
This was SVN commit r15736.
2014-09-12 22:01:21 +00:00
mimo
cbc1c9f0ab fixes remaining town bell defects, closes #2353, patch by Itms
This was SVN commit r14689.
2014-01-26 20:37:39 +00:00
mimo
d56595c802 Put into alert units trained during an alert, fixes #2342, patch by Itms
This was SVN commit r14513.
2014-01-05 15:12:17 +00:00
mimo
66de76e026 fixes #2340, patch by itms
This was SVN commit r14484.
2014-01-02 23:11:18 +00:00
sanderd17
41b3dfc89c Implement town bell
* the icons are temporary, and can be replaced later
* The sounds are created by LAVS, but may also need some polishing, so
the current ones are placeholders too
* The patch code is created by Itms
fixes #2154

This was SVN commit r14392.
2013-12-26 10:43:51 +00:00