Commit graph

500 commits

Author SHA1 Message Date
Celtic Minstrel
233237be1e [Lua] Add some TODO notes on things to come back to later. 2024-08-13 08:54:04 -04:00
Celtic Minstrel
9e79a627c3 [Lua] Fix some accidental global warnings 2024-08-13 08:54:04 -04:00
Celtic Minstrel
058d0502e5 [Lua] Update obsolete use of [1],[2] to refer to locations, and simplify some code by leveraging the fact that any object with x,y qualifies as a location; also use moves_left for reachmaps instead of [3] 2024-05-19 12:54:35 -04:00
Celtic Minstrel
f5c4f2e841 [Lua] Update obsolete usage of [1],[2] to refer to a tag's name and contents 2024-05-19 12:54:35 -04:00
Celtic Minstrel
0f6fe67477 [Lua] Use wml.tag to construct WML tables 2024-05-19 12:54:35 -04:00
Celtic Minstrel
94adca0fff [LuaDoc] Fix some non-nullable warnings by adding explicit type annotations on local variables 2024-02-13 19:29:21 -05:00
Celtic Minstrel
b506010a8f [LuaDoc] Correct some dumb errors 2024-02-13 19:29:21 -05:00
Celtic Minstrel
dc75045eea [LuaDoc] Add comments for micro_ai_helper.lua 2024-02-06 19:04:01 -05:00
Celtic Minstrel
795bb22be9 [LuaDoc] Add annotations for micro_ai_self_data.lua 2024-02-06 19:04:00 -05:00
gfgtdf
e08676d6a8 Fix Lua errors when checking abilities #7890
Nowdays ability.value and similar attributes can also contain formulas
(That for example make a heal amount dependent on the remaining hitpointsthe unit has
)
With this the lua ai code should no longer crash in these cases.
2023-12-24 00:51:57 +01:00
Wedge009
45e537505f Use 'curly' quotes as per typography standard.
[ci skip]
2023-10-23 09:44:50 +02:00
Wedge009
4037e2a138 Replace non-standard spacing.
[ci skip]
2023-10-23 09:44:50 +02:00
Wedge009
94b48615f0 Use em-dash as per typography standard.
[ci skip]
2023-10-23 09:44:50 +02:00
Wedge009
93df584adb po hints
[ci skip]
2023-10-21 09:35:25 +11:00
Steve Cotton
49ebbb9709 Make fix_whitespace complain about mixing tabs and spaces
Ensures that files either use tabs for indentation or spaces for indentation,
but don't switch between the two within the same file.

This doesn't fix the whitespace, it's a simple check to flag it up
on the assumption that it's better to use an editor or code formatter
to clean up the file.

Elsewhere in the CI we use the luacheck tool - while that can detect
mixing tabs and spaces in a single line's indent, it doesn't check for
inconsistent indentation within a file.
2023-02-05 02:22:53 +01:00
mattsc
2424d5705f Micro AI CAs: add handle_user_interact calls 2022-07-12 22:57:16 -04:00
mattsc
0092c141d2 Micro AIs: fix image paths 2022-06-27 20:21:28 -07:00
mattsc
2f3f70a709 Micro AIs: add warning messages if invalid parameters are used 2022-06-27 20:21:21 -07:00
mattsc
21475ced4f Micro AIs: add error messages if parameters are of wrong type
Fixes #6408.
2022-06-27 20:20:06 -07:00
mattsc
e4b776cbb8 ExpAI: do not use generic_recruit_engine
This removes the need for the Generic Recruit Engine and makes Recruit Rushers a "clean" candidate action.  In the process, it fixes a bug of data leakage between the Experimental AIs of different sides.
2022-06-22 16:31:28 -07:00
Celtic Minstrel
473c6e468e
Fix wmlindent quote detection (#6764)
* wmlindent: Fix parsing quotes in comments

* Remove unnecessary wmlindent ignores

* Run wmlindent
2022-06-18 09:37:55 +02:00
mattsc
1769b6cf01 Protect Unit MAI: fix typo in MAI removal code 2022-06-11 06:18:51 -07:00
Celtic Minstrel
d886ddf61c Lua: Fix a leaky global function 2022-06-10 23:31:40 -04:00
mattsc
84531b834e Bottleneck Micro AI: fix bug involving units without moves
An integral part of this MAI is that it moves weaker units out of the way for stronger ones.  Units without moves are taken into account by giving them a very high rating.  This was previously only done on what's considered the AI's territory (the AI side of the bottleneck) which works fine most of the time since the AI does not try to move onto enemy territory.  However, it breaks down on more open maps, where there are way for units to move around the bottleneck, as AI territory is not always well defined on them.  However, there is no need to restrict this to AI territory only.

This fixes #6599.
2022-06-09 06:29:14 -07:00
Pentarctagon
9bfd432abe Update image pages for webp extension. 2022-04-30 14:23:32 -05:00
Celtic Minstrel
759b040069 fix whitespace
The whitespace-fixing script seems to be slightly different depending on the platform.
Even though it produces no effect in the CI, it made these changes locally on my Mac.
I'm committing them now so as to avoid unrelated files being changed in other pull requests.
2022-02-06 00:05:09 -05:00
mattsc
7746f75f11 Wolves multipack MAI: prevent potential for infinite loop
The MAI was set up to be blacklisted if no attacks were found, but that did not always work. In addition, removing attacks from the wolves also means that no other CA can use them for other attacks instead.
2021-12-28 18:31:19 +01:00
Pentarctagon
370d03ccb7 Fix luacheck warnings and add to CI.
Note the `exclude_files` in .luacheckrc should be deleted once the eventual Ubuntu 22.04 base image has an updated luacheck that supports lua 5.4.
2021-11-28 14:26:02 -06:00
Pentarctagon
254716e41e Expand lua whitespace check. 2021-11-28 14:26:02 -06:00
Celtic Minstrel
ce9bea0537 AI: Add an example of using [micro_ai] in [side][ai] 2021-09-04 22:20:28 -04:00
Celtic Minstrel
9fdaea5893 AI: Fix error in stationed_guardian 2021-09-04 22:20:28 -04:00
mattsc
b73078884c Messenger MAI: fix bug of own units blocking waypoint
ignore_own_units=true was accidentally dropped when adding [avoid] tag functionality to the Micro AI in a60736b6c7
2021-09-01 08:49:54 -07:00
Celtic Minstrel
4ec60b99d9 Lua: Update all mainline references to the helper module 2021-07-07 01:32:05 -04:00
Celtic Minstrel
91f6bf93a4 Fix a broken deprecation and replace some deprecated uses
Fixes #5877
2021-06-20 00:59:59 -04:00
Celtic Minstrel
7f162cbd24 Lua: Rename find_vacant_tile to find_vacant_hex for naming consistency 2021-06-19 17:09:31 -04:00
Celtic Minstrel
1f62eae3ce Replace uses of wesnoth.find_path 2021-06-19 15:43:33 -04:00
Celtic Minstrel
5a1e38e99b
Add wesnoth.sync module for the synchronization-related commands (#5862) 2021-06-19 15:39:10 -04:00
Celtic Minstrel
0c42cdc038
Enable translation mark validation by the schema (#5800)
- The t_string type is now a schema built-in type and no longer attempts a regex match.
- You can also specify that non-t_string types may be optionally-translatable; this case supports a regex match on the string (but note that the translation mark is not part of the match).
- Error messages involving keys with very large values ( > 128 characters) will now truncate the value.
- To account for occasional cases where the schema is intentionally violated, the --validate command-line option now automatically defines the SCHEMA_VALIDATION preprocessor define.

A key validates as type t_string if one of the following is true:
- The key is not present
- The key has at least one segment with a translation mark
- The key is blank (an empty string)

Any type other than t_string is not allowed to be translatable by default, unless you specify allow_translatable=yes in the [type] tag.

An optionally-translatable string could also be defined as a union of t_string and some other type.
2021-06-14 23:59:52 -04:00
mattsc
d8e472e753
Merge pull request #5609 from mattsc/mai_fix_replay
Micro AIs: fix unit variables being lost in replays
2021-06-10 11:42:50 -07:00
Celtic Minstrel
e8381ea9da Update uses of eval_conditional 2021-05-11 14:52:20 -04:00
Steve Cotton
de3e798e72 Update the animals Micro-AI demo with boars and piglets
This adjusts to the change in e7b5996e98.

The micro ai itself is unchanged, it's still controlled by `tusker_type` and
`tusklet_type`, it simply needed the new unit ids to be used in this scenario.
2021-04-04 20:23:46 +02:00
mattsc
f1c37f64ac
Merge pull request #5630 from mattsc/remove_fai_uses
Remove Formula AI uses
2021-03-24 08:04:47 -07:00
Celtic Minstrel
7c95e9d1a4 Lurker FAI: map(x, self) is exactly the same as just self
This caused the crash fixed in the previous commit. Although the crash is fixed, it's still stupid and we shouldn't do it.
2021-03-23 00:34:44 -04:00
mattsc
8d03d3ef08 Swarm Micro AI: add optional parameter [filter] 2021-03-22 09:09:30 -07:00
mattsc
4086758214 Remove Formula AI lurkers from Lurkers test scenario
This is part of removing Formula AI uses from mainline.
2021-03-21 17:15:43 -07:00
mattsc
92d22f18e6 Remove Home Guardian Formula AI from Guardians test scenario
This is part of removing Formula AI uses from mainline.
2021-03-21 17:03:50 -07:00
mattsc
4fe45bf22a Patrol Micro AI: add two optional parameters
attack_range: the patrol interrupts its route to attack enemies within this distance, not just enemies that it happens to end up next to

attack_invisible_enemies: include invisible enemies when considering whether there are enemies within attack_range

The default behavior is unchanged.
2021-03-21 14:56:37 -07:00
mattsc
ac9246aba1 Micro AIs: fix unit variables being lost in replays
Some Micro AIs save information in unit variables. Examples are the patrol and messenger AIs, which save the next waypoint for a unit. This needs to be done as a synced command, so that the information is not lost when continuing a game from a replay.
2021-03-13 19:36:56 -08:00
mattsc
a60736b6c7 Messenger Micro AI: add [avoid] tag functionality 2021-03-13 17:20:09 -08:00
mattsc
373559b6bf Protect Unit Micro AI test scenario: fix deprecated WML 2021-03-06 16:45:57 -08:00