Commit graph

111 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
519a215e1c
Fix eslint rule 'prefer-const' in gui/common
eslint --no-config-lookup --fix --rule '"prefer-const": 1' \
    binaries/data/mods/public/gui/common

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-09 19:32:43 +02:00
Vantha
fa046392bb Adjust the resource icon placement in tooltips 2025-05-09 13:20:19 +02:00
Ralph Sennhauser
81c119bf39
Fix eslint rule 'semi'
eslint --no-config-lookup --fix --rule '"semi": 1'

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-03 14:13:14 +02:00
Ralph Sennhauser
b6df170303
Fix eslint indent rule
eslint --no-config-lookup --fix --rule 'indent:  ["warn", "tab", { "outerIIFEBody": 0, }]'

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-03 09:39:58 +02:00
abian
798cff1f6f Left-click the portrait to follow the entity
- Left-clicking the portrait of a unit will make the camera follow that
   unit (before: no action). A tooltip informs the player of this
   possibility.

 - Left-clicking the portrait of a structure will make the camera focus on
   that structure (before: no action). A tooltip informs the player of
   this possibility.

 - Double-clicking a hero/treasure icon will make the camera follow that
   hero/treasure (before: just focus on that hero/treasure).

 - Some minor related changes.

Fixes #6879
2024-09-18 06:46:51 +02:00
Freagarach
fe015fdc1e Don't error out on complex requirements without tooltip.
Since it is not nice to make the game unusable (citation needed) we'll
emit a warning, which is less not nice.
Reported by: @Langbart
Differential revision: https://code.wildfiregames.com/D4930
Reviewed by: @Langbart
Fixes #6724

This was SVN commit r27531.
2023-02-07 07:33:22 +00:00
Freagarach
83b786dcf5 Tokens for required technologies.
Use tokens for required technologies, allowing `-tech` and easier
replacements.
Fixes requiring `replace=""` when replacing techs.
Also a minor fix in the TemplateParser.js for upgrade requirements.
Refs. 9bb9ff8b16.

Differential revision: https://code.wildfiregames.com/D4912
Comments by: @Stan
This was SVN commit r27505.
2023-01-30 08:05:34 +00:00
Freagarach
1078277c59 Fix required technology tooltip colour.
Done by creating a function for 'objections' and using that for any
unmet requirements.

Patch by: @abian
Differential revision: https://code.wildfiregames.com/D4899
Comments by: @Langbart
Fixes #6694

This was SVN commit r27484.
2023-01-24 08:03:24 +00: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
Freagarach
f787089588 Ceil the resource costs for insufficient resources.
A controversial change (refs. #3818, #4099,
https://code.wildfiregames.com/D1438), but good to have in some form.

Patch by: @Langbart
Differential revision: https://code.wildfiregames.com/D4332
This was SVN commit r26236.
2022-01-23 07:41:45 +00:00
bb
acc780bcbb Add accelerations in unit movement.
This helps preventing arrow dodging.

Differential Revision: D3200
Reviewed By: Freagarach
Comments By: wraitii, vladislav, Palaxin, Stan
refs: #5106

This was SVN commit r25953.
2021-10-09 21:31:11 +00:00
Freagarach
5e6038eeaf Change the visuals of the counters in the top panel.
- Abbreviate large numbers (fixes #6063).
- Added popMax to the population counter.
- Also show `0` gatherers, highlights and changes the font.

Patch by: @Langbart
Differential revision: https://code.wildfiregames.com/D3911
Reviewed by: @Angen, @Freagarach
Comments by: @asterix, @nwtour, @s0600204, @wraitii
This was SVN commit r25470.
2021-05-20 08:55:08 +00:00
wraitii
cbd91ca999 Translation fixes.
- Fix in tooltip context for healing 'Health'
- Fix in tooltip for splash shape.
- Translate locale_advanced
- Translate specific name in the structure truee
- Translate player name in gamesetup.

Patch by: nwtour
Differential Revision: https://code.wildfiregames.com/D3889
This was SVN commit r25332.
2021-04-28 08:04:13 +00:00
Freagarach
e2f4ce0649 Add Upkeep component.
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.
2021-04-04 06:52:20 +00:00
wraitii
d01a995cbb Fix missing translations (from missing context) in tooltips.
Fixes:
- A logic issue in the attack name tooltip.
- A missing context in the status effects tooltip

Patch by: nwtour
Reviewed By: wraitii
Differential Revision: https://code.wildfiregames.com/D3745
This was SVN commit r25127.
2021-03-26 16:52:09 +00:00
Freagarach
21e866fcf0 Technically seperate Turrets from GarrisonHolder.
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.
2021-03-26 10:18:30 +00:00
Freagarach
ebc2ec5498 Give option to switch between specific and/or generic entity names.
As requested on the forums (e.g.
https://wildfiregames.com/forum/index.php?/topic/25202-transliteration-of-ancient-greek-into-english/&tab=comments#comment-378174).

Differential revision: D2126
Closes: #3397

This was SVN commit r25116.
2021-03-25 06:58:47 +00:00
Freagarach
ea96e81098 Split treasures from ResourceSupply.
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.
2021-03-03 07:47:38 +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
Angen
04a7d95eff Limit gather rate tooltip to 2 decimal places
Gather rates are not rounded, so after some modifiers are applied, they
appear as ugly decimal numbers.
Limiting them into 2 decimal places for readability and it looks nicer.

Differential revision: D3460
Reviewed by: @wraitii
This was SVN commit r24782.
2021-01-24 15:28:13 +00:00
s0600204
bbd808349f Add a "Catafalque Bonuses" page
Permitting easy(ish) comparison of the bonuses granted by each civ's
Catafalque unit.

Accessible from the Main Menu's "Learn to Play" submenu.


Accepted by: @Freagarach
Comments by: @wowgetoffyourcellphone
Screenshot: https://code.wildfiregames.com/F1785729
Differential Revision: https://code.wildfiregames.com/D3332
This was SVN commit r24726.
2021-01-20 15:12:08 +00:00
Angen
7148aa5554 Display gather rates per subtype
Currently gather rates per subtype of resource are averaged , which
hides important information for players. Therefore they do not realise
some units may be better collecting grain or fruit.

Also removing todo from the code.

Thank @Stan for fruit and grain icons without cursor and new fish.

Differential revision: D3310
Accepted by: wraitii
Comments by: Freagarach, Nescio
Ref: #4077

This was SVN commit r24549.
2021-01-11 16:03:16 +00:00
Freagarach
7f6602cffd Show the number of builders together with build time.
Also adds the remaining time to the tooltip.

Differential revision: D2425
Reviewed by: @bb
This was SVN commit r24452.
2020-12-27 06:56:37 +00:00
Freagarach
6ee43b6bcd Allow free upgrades and technologies.
And use that for the seleucids reform/traditional tech.

Noticed by @wraitii
Differential revision: D2654
Reviewed by: @bb
Comments by: @Stan
This was SVN commit r24431.
2020-12-19 20:11:57 +00:00
Freagarach
7f77cf2f3e Move PopulationBonus from cmpCost to new cmpPopulation.
Since PopBonus is not a cost.

Patch by: @lonehawk
Differential Revision: D2948
Comments by: @Angen, @Nescio, @wraitii
Closes #4081

This was SVN commit r24394.
2020-12-14 18:17:59 +00:00
Freagarach
2e79c0a177 Remove health component from relics.
Since relics ought to be undestroyable, a health component makes no
sense. This makes that the Invulnerability-flag can be removed and
relics can be captured again (after 0f91c5ac61#inline-5236).

Differential Revision: D1268
Original patch by: @temple
Reviewed by: @wraitii
Comments by: @bb, @elexis
Fixes #5007, #5847, 0f91c5ac61#inline-5236

This was SVN commit r24327.
2020-12-06 07:22:51 +00:00
s0600204
f230988e0e Add globalscript helper function for Auras
Similar to those for templates and technologies.

This was SVN commit r24290.
2020-11-29 04:44:38 +00:00
bb
85c9a48db0 Generalize to arbitrary translatable attacknames in the GUI
Reviewed By: Nescio, Freagarach
Comments By: wraitii, elexis
Differential Revision: D2995
refs: #252

This was SVN commit r24209.
2020-11-18 21:34:33 +00:00
Freagarach
876b035336 Allow resistances to StatusEffects.
Differential Revision: D2908
Reviewed by: @wraitii
Comments by: @bb.
This was SVN commit r24162.
2020-11-11 20:07:30 +00:00
Freagarach
a330d4c7d7 Get dropsites' accepting resources from simulation instead of hardcoding them in tooltips.
Differential Revision: D2980
Reviewed by: @Angen.
Tested and comments by: @Nescio.
This was SVN commit r24045.
2020-09-16 15:28:44 +00:00
bb
29e2a44f75 Fix broken translations of b606cad5da
This was SVN commit r24025.
2020-09-06 18:37:40 +00:00
bb
b606cad5da Indent attack tooltips
Show splash per attacktype and indent

Patch By: Nescio
Comments By: Freagarach
Differential Revision: D2984
This was SVN commit r24022.
2020-09-04 20:21:59 +00:00
Freagarach
0f91c5ac61 Rename Armour to Resistance and change the way it is processed.
- 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.
2020-08-27 10:24:59 +00:00
bb
e428678b7e Don't assume health is both plural and singular in all languages.
see 47d5422e64

This was SVN commit r23864.
2020-07-21 16:37:43 +00:00
bb
47d5422e64 Heal HP → Health, Rate → Interval
Patch By: Nescio
Differential Revision: D2842
This was SVN commit r23863.
2020-07-21 16:28:29 +00:00
s0600204
b2842e8021 Rewrite Structure Tree and Template Viewer to use OOP principles
Commenters: elexis, Stan, Angen
Refs.: #5387
Differential Revision: https://code.wildfiregames.com/D2734
This was SVN commit r23808.
2020-07-07 19:11:36 +00:00
wraitii
ea67b79667 Handle stacking status effects, modifiers, some related fixes.
Continuation of work on status effects, following 82a5ab6d19.

Allow techs to modify properties.
Enable different behaviour when status effects would stack, such as
extending the duration or stacking the effects.
Fix GUI issue with more than 5 status effects.
Improve tooltips.
Let status effects show a different tooltip for the attacker and the
receiver.

Patch by: Freagarach
Reviewed By: wraitii, Angen (on an older differential).
Differential Revision: https://code.wildfiregames.com/D2296
This was SVN commit r23757.
2020-06-09 11:47:16 +00:00
wraitii
c1ddc0c4b9 Internationalise Damage Types and Status Effects using (optional) JSON files.
.json files in simulation/data/template/helpers/damage_types and
status_effects will be used to internationalise damage types and status
effects, as well as share common text.
Fixes the order of damage types being inconsistent.

Add the possibility for i10n xml extractor to set a custom context.

Fixes #4801
Related to D2296.

Featuring work from: Freagarach

Differential Revision: https://code.wildfiregames.com/D2337
This was SVN commit r23681.
2020-05-20 17:26:37 +00:00
bb
8158fe7b23 Show 2 decimals for gather rates in gui.
Patch By: Nescio
Differential Revision: https://code.wildfiregames.com/D2594
Extremely far away ref: #4099

This was SVN commit r23614.
2020-05-01 16:39:48 +00:00
Angen
82a5ab6d19 Allow status effect to apply modifiers and fix 2333b1814e
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.
2020-01-27 16:51:25 +00:00
Angen
d0403bd3a8 Apply modifications to template values based on entity owner instead watching player
When observer selects some building he can see possible units to be
trained. Data about that templates are returned with id of observer what
means no technologies or bonuses for selected player have been applied
to the template. So observer does not see correct information in
tooltip.

Differential Revision: https://code.wildfiregames.com/D2054
Fixes: #5109
Tested by: Nescio
This was SVN commit r23237.
2019-12-14 20:10:32 +00:00
wraitii
2333b1814e GUI support for Status Effects and extend their functionality to all attack effects following 16b452cf91
This fixes status effects following 16b452cf91 where the GiveStatus name
change broke them.

This lets status effects deal all types of damage, capture, or inflict
other status effects, like any attack.
This further adds some basic GUI spport to status effects, by showing up
to 5 icons in the top-right of the portrait, and including status
effects in the tooltips.

Status effects can specify a custom icon.

Differential Revision: https://code.wildfiregames.com/D2218
This was SVN commit r22901.
2019-09-15 09:24:52 +00:00
wraitii
f29159b935 Generalise attack tooltips after D2092/16b452cf91.
This allows attacks with both capture and damage effects to show both,
and centralises display between regular attack and Splash.
It also reverts a change from e05c8263c5 which incorrectly switched
'Interval' and 'Rate'.

Patch By: Freagarach
Reviewed By: wraitii
Differential Revision: https://code.wildfiregames.com/D2138
This was SVN commit r22866.
2019-09-07 14:47:39 +00:00
wraitii
16b452cf91 Generalise Attack effects. All attacks, including death damage and splash, can deal any number of attack effects (damaging, capture, giving status effects.)
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.
2019-08-22 18:00:33 +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
wraitii
f4babd9b34 Wrap damage types in a Damage element in XML templates to prepare for genericizing them.
Patch By: Freagarach
Reviewed By: Wraitii
Differential Revision: https://code.wildfiregames.com/D1950
This was SVN commit r22379.
2019-06-16 17:08:27 +00:00
s0600204
c8fda40b02 Implement an in-game Template Details Viewer
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.
2018-02-21 21:39:00 +00:00
temple
e43ed4016c Add a repair time tooltip
Differential Revision: https://code.wildfiregames.com/D573
Reviewed by: bb
This was SVN commit r21121.
2018-02-06 19:31:51 +00:00
temple
1ba1e86c5e Use a countdown rather than a tooltip for displaying construction progress
Change the time to completion to a countdown and remove the tooltip on
the health bar.
Move the number of builders to the time speed-up tooltip.
Remove the build rate tooltip.

Differential Revision: https://code.wildfiregames.com/D572
Early review by: wraitii
Comments by: bb
This was SVN commit r21072.
2018-01-30 00:02:10 +00:00