Entities with a production queue when queueing or unqueueing items for
will set an appropriate animation which is desired for structures, like
the forge producing smoke, but not so for units as it interferes with
UnitAi animation state.
Units don't have animations for training or researching so the idle
animation will be set in that case instead. If such a unit is in motion
this results in the unit gliding. To avoid this just skip setting an
animation for entities having a UnitAI.
Reported-by: wowgetoffyourcellphone
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
During the eslint 8 cycle the formatting rules were split out [1],
deprecating the corresponding rules in core.
This replaces all rules that where moved to @stylistic/eslint-plugin [2]
and accounts for the difference in the indenting rule behaviour.
To allow the pre-commit import hack to continue to work with the
stylisitc plugin for a recent nodejs version to be used.
[1] https://eslint.org/blog/2023/10/deprecating-formatting-rules/
[2] https://eslint.style/packages/default
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Moves the work done from cmpResearcher to cmpTechnologyManager.
No functional changes.
It allows fancy stuff in the future (#6364).
Differential revision: https://code.wildfiregames.com/D4438
This was SVN commit r26252.
To catch e.g. typos.
- Use the same structure in the ProductionQueue item (de)serialisation
as in Trainer and Researcher.
- Also iterate over the serialisable attributes on deserialize, as
proposed by @elexis (on IRC), for its symmetry.
Proposed by: @Stan
Differential revision: D4388
This was SVN commit r26133.
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.
PetraAI can't cope with that and it may be a suprise for other players
as well, when a captures production entity has autoqueue enabled.
Differential revision: https://code.wildfiregames.com/D4185
Refs: #6213
This was SVN commit r25819.
The graphical interface will show autoqueued units as 'ghost' units so
the player gets immediate feedback on what's happening.
The autoqueue disengages if it runs out of resources or entity limits:
this reflects that the autoqueue cannot resume on its own.
By changing the spot where the autoqueue pushes items, the autoqueue no
longer 'buffers' one unit in advance, but remains very slightly less
efficient than manual queuing. This also prevents cheats from leading to
a ton of units accidentally being created.
Accepted By: Freagarach
Refs #6213
Differential Revision: https://code.wildfiregames.com/D4144
This was SVN commit r25779.
Autoqueue can ignore entity limits like Heroes, because AddItem does not
check for them, only commands.js. This changes that, fixing the
autoqueue.
Reported by: Player of 0AD
Tested by: langbart
Refs #6213
Differential Revision: https://code.wildfiregames.com/D4133
This was SVN commit r25753.
This adds a new command button that enables training of units
automatically.
Use:
- Enable auto-queue.
- Train an entity.
This adds a new item to the queue whenever the previous item starts,
such that good micro is more resource-efficient.
Patch by: @azayrahmad
Differential revision: https://code.wildfiregames.com/D3865
Comments by: @Langbart, @nani, @Stan, @wraitii
This was SVN commit r25381.
- Removed some useless comments.
- Don't assume an item only has either a tech or a unit in
ProgressTimeout.
- Don't initialise boolean values (refs. #5979).
Differential revision: D3739
Comment by: @wraitii
This was SVN commit r25119.
The "GARRISONED"-state was quite strange, for entities being garrisoned
can just as well perform other tasks (see e.g. turrets).
Also, the need for keeping a "garrison" order on the stack is removed.
Fixes: #6022
Differential revision: D3656
Refs. #6081
This was SVN commit r25069.
Have an entity cache per item (refs. #6104) (which means it doesn't need
to be created at init; refs. #5979).
Cache the PQ-position instead of querying it for every spawned entity.
One could use any arbitrary player for spawning entities now, increasing
mod support.
Differential revision: D3669
Comment by: @wraitii
This was SVN commit r25064.
Removes indentation.
Adds return value.
Cache owner instead of querying often.
This function can be cleaned even more later.
Differential revision: D3670
Comments by: @wraitii
This was SVN commit r25063.
- Rename `RemoveBatch` to `RemoveItem`.
- Refactor that function. (Don't clear the cached entities when *any*
item is removed.)
Fixes the bug that the training is still blocked when a tech is the next
in the queue and the blocking item is removed.
Based on a patch by: @Polakrity
Differential revision: D1843
Comments by: @Angen, @bb
This was SVN commit r25040.
- Use an interval instead of requesting a timeout every timeout.
- Integrate the lateness-parameter.
- Some other cleanup.
- Don't create objects for null values in messages.
- Don't create this.timer on init.
Based on a patch by: @Polakrity
Differential revision: D1906
Comments by: @Angen, @Stan
This was SVN commit r25038.
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.
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.
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.
This adds a new mode to modifications called "tokens" which allows
clever token parsing.
Technologies, auras and modifiers in general can use this to switch out,
add or delete tokens dynamically.
Currently implemented are production and builder queue tokens.
Reviewed By: Freagarach
Differential Revision: https://code.wildfiregames.com/D270
This was SVN commit r23843.
423b3cbcaa Moved the message sent that an entity garrisons from
`PerformGarrison` to `Garrison`. However, when an entity is
autogarrisoned from `ProductionQueue` `PerformGarrison` is called thus
not triggering the message. When ejecting the entity from the structure
there is a message sent that the entity is removed, thus allowing for a
negative amount of archers/arrows in `BuildingAI` (see
423b3cbcaa#42654).
Note that `PerformGarrison` was explicitly split in 2102648f7c when
introducing autogarrisoning. It probably has something to do with the
position, since that was split. But I couldn't find any reason why it
cannot be used now.
A side effect of this is that when autogarrisoning an entity with
visible garrison points those will be occupied as well now.
Reviewed By: wraitii
Differential Revision: https://code.wildfiregames.com/D2790
This was SVN commit r23743.
Fix redeclarations of variables
Fix variable shadowing
Remove duplicated cmpPlayer
Move querying of the same components out of loop
Change if (foo.length > 0) to if (foo.length)
Change if (foo == 0) to if(!foo)
Fix remaining var -> let
Remove white space from empty object { } to {}
Restyle more complicated objects
Differential Revision: https://code.wildfiregames.com/D2470
Comments by: elexis, Stan, nani
This was SVN commit r23322.
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.
When adding a batch of unit, these in-training units get added to the
production queue and to the entity limit count.
These in-training units need to be removed from the entity limit counts
when spawning them, or we would be double-counting them. This was done
when creating the cached entities, but this was too early: entities
might fail to spawn, for example when there is no room around the
foundation.
Change that so the entity limit count is now decremented right before
giving spawned entities the correct owner (which triggers EntityLimits
OnGlobalOwnershipChanged, which adds the spawned entities to the entity
limit count).
Additionally, add Init to TrainingRestrictions so that the test setup
doesn't complain. Other components have an empty Init instead of
checking for Init in the test setup (and 61/67 have an Init function) so
it seems more standard this way.
Reported By: elexis
Reviewed By: wraitii
Patch By: Angen
Tests By: wraitii
Differential Revision: https://code.wildfiregames.com/D1879
This was SVN commit r22375.
Removes the serialization of JSON files, shrinking savegame files and
rejoin states sent across the network, refs #3834, #4239, #3909,
f24523dc8f.
Removes the AI C++ code to read JSON files from e33d4a52e9 since the AI
can now use the globalscript.
Allows the AI to read Aura templates and removal of GUIInterface code to
improve performance.
Serialization of the JSON objects in other simulation components was
removed in 9c0e37f2c0 / D1109, a6f14f5631 / D1130.
Serialization removal planned by sanderd17
AI part proofread by mimo
Simulation part proofread by bb
Discussed with Itms on irc
Differential Revision: https://code.wildfiregames.com/D1108
This was SVN commit r20737.
Remove the equivalent AI chat notifications.
Differential Revision: https://code.wildfiregames.com/D354
Patch By: Polakrity
Fixes#3512
This was SVN commit r19445.
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.