Commit graph

316 commits

Author SHA1 Message Date
Pentarctagon
d203b061f9
Whitespace cleanup of lua files. 2021-04-25 15:11:09 -05:00
Steve Cotton
ad1c42ca8f Make [store_reachable_locations]range=vision calculate vision
Previously it calculated max movement, and then added the adjacent hexes. This
version should correctly handle:
* units with vp different to max mp
* units with vision costs different to movement costs
* jamming by enemy units

Draft changelog entry for this:
* `[store_reachable_locations]range=vision` now calculates vision, instead of using movement costs and max movement points (issue #4179)
2021-04-16 02:05:42 +02:00
Steve Cotton
147cd90527 Move lua implementation of [store_reachable_locations] to its own file 2021-04-16 02:05:42 +02:00
Celtic Minstrel
a2d7a26365
Fix several Lua issues, mostly unintentional globals (#5587) 2021-03-06 17:01:53 -05:00
Celtic Minstrel
c7b2dcca3f Oh look, a deprecated thing that was missed sometime in the past 2021-02-28 18:16:33 -05:00
Celtic Minstrel
9d3bf196b0 Update everything to use the new wesnoth.map module
- get_terrain and set_terrain replaced with direct indexing operations
- get_map_size mostly replaced with either the iterator or an on_board call.
  Only a few cases really needed to know the size of the map for some other purpose.
- shroud and fog operations, village owner, time areas, and location filters
- get_terrain_info replaced with terrain_types table
- Map generation functions create_map and create_filter
2021-02-28 18:16:33 -05:00
Celtic Minstrel
f473aabe99 Add another note in [test_condition] for a simple case of using [have_location] to verify that a hex has a particular terrain 2021-02-27 21:24:01 -05:00
Celtic Minstrel
a97a04e2e9 Update [test_condition] to be a little more verbose and make use of newer features 2021-02-27 19:43:42 -05:00
Celtic Minstrel
1dca42ca0e
Fix [modify_side]reset_maps=true
I have no idea how this was missed...
2021-02-22 09:52:56 -05:00
Celtic Minstrel
56bdd42815
Fix segfaults and a few other issues in wesnoth.find_path
Co-authored-by: mattsc
2021-02-18 22:15:31 -06:00
Celtic Minstrel
a0ee38a49a
Use to-be-closed variables to scope WML variables in tag definitions (#5536) 2021-02-15 21:11:56 -05:00
Celtic Minstrel
4b2599864a Add [set_variable]min|max= to calculate an extremum value 2020-12-28 15:56:36 -05:00
Celtic Minstrel
927fcbfb47 Add [set_variable]reverse=yes for string reversal operation 2020-12-28 15:56:36 -05:00
Celtic Minstrel
651090cf47 Fix erroneous deprecation warnings from [random_placement] 2020-12-20 15:17:26 -05:00
Celtic Minstrel
6a27473c11
Merge pull request #5188 from wesnoth/sota_zombie_trans
Refactor translatable strings for the SotA zombie recruit dialog
2020-10-12 15:38:54 -04:00
Celtic Minstrel
24d8a249fa Fix [set_variable][join] failing on boolean values 2020-10-12 15:37:37 -04:00
Elvish_Hunter
bfcbe279a2 [harm_unit]: replaced .__cfg.level with .level in unit objects 2020-10-12 20:57:21 +02:00
Elvish_Hunter
61f7fe4749 [harm_unit]: fixed damage calculation for 1.15.x liminal alignment 2020-10-12 20:53:22 +02:00
gfgtdf
116687c983
fix #5184 [modify_unit]profile 2020-10-04 03:06:33 +02:00
gfgtdf
ebc65c9b00
fix [micro_ai] when called from lua
fixes #5134
2020-09-07 18:10:41 +02:00
gfgtdf
2a5ba5ace7 add wesnoth.interface.get_items
returns all items on a locations, this allows is to
remove quite a bit of code in the dropping.lua file
of world conquest since that can now just use items.lua
instead
2020-08-26 14:52:07 +02:00
Pentarctagon
9a0b95f9a0 Separate unit test results from scenario victory/defeat.
This adds an additional `test_result` attribute to [endlevel], intended for use with the automated unit tests. This allows for the unit tests to differentiate a pass/fail result separately from scenario victory or defeat, which allows for more accurately determining the outcome of a test as well as addresses the potential, for example, for a scenario to be expect to pass because of the {SUCCEED} macro but instead passes because the scenario ended as a victory through some other method.

Additional unit tests which were the original motivation for this change are also added as part of this.  They test, as much as possible, that events are executed at all, and are then also executed in the expected order.
2020-04-07 16:45:34 -05:00
Celtic Minstrel
55fa2759a1 Fix the test_move_unit_in_circle test
Just needed to extract the unit earlier, so that it wouldn't be counted as blocking itself

Closes #4635
2019-12-14 12:12:29 -05:00
Celtic Minstrel
b8759f8c19 Add some additional cases to the move_unit test, and fix a few issues that they revealed
One of the cases fails due to something in find_vacant_tile - perhaps someone else can figure out how to fix this?

If nothing else, setting check_passability=no in the [move_unit] should do it, but I'd prefer not to have to do that...
2019-12-10 21:16:06 -05:00
Celtic Minstrel
c366998021 Fix an issue with items and location sets
Fixes #4621
2019-12-07 17:21:03 -05:00
Celtic Minstrel
e009989ec3 Fix some places that were erroneously calling string.format instead of stringx.vformat after 30240aa7cd
Fixes #4621
2019-12-07 17:21:03 -05:00
Steve Cotton
4e92cc46ad Fix move_unit's parsing of to_x and to_y (fixes the unit-test timeout)
Also extend the unit test to at least check the end result of comma-separated
values, as there was previously nothing testing the effect of providing more
than one value.
2019-12-07 18:41:32 +01:00
Celtic Minstrel
7a1390adf7 Remove "wml-utils" require from files that no longer use it 2019-12-04 08:48:53 -05:00
Celtic Minstrel
f2f35cbd38 Fix broken [move_units]dir= 2019-12-04 08:46:22 -05:00
Celtic Minstrel
d9b5e3c4df Replace uses of wml_utils.split with stringx.split 2019-12-04 08:46:04 -05:00
Celtic Minstrel
4eb043bb16 Deprecate wml_utils.trim in favour of stringx.trim and update all use cases 2019-12-04 00:53:59 -05:00
Celtic Minstrel
e81a0377b0 Update uses of moved format functions 2019-12-04 00:50:00 -05:00
Celtic Minstrel
11a57e0fa7 Move helper.find_attack -> wesnoth.units.find_attack 2019-12-02 22:39:34 -05:00
Celtic Minstrel
732b7942bb Replace all references to deprecated functions in the helper module
(and remove the require if this meant it was no longer used)
2019-12-02 01:10:34 -05:00
Celtic Minstrel
74e004c265 Use a location set in the implementation of the item functions and WML tags 2019-12-01 22:30:31 -05:00
Celtic Minstrel
9da5d4adfd fixup! Declare wesnoth.interface.remove_overlay directly instead of declaring it local and then assigning it
Missed updating the deprecation line and used the wrong new name
2019-12-01 21:50:56 -05:00
Celtic Minstrel
57bb4224b0 Declare wesnoth.interface.remove_overlay directly instead of declaring it local and then assigning it 2019-12-01 20:25:47 -05:00
Celtic Minstrel
3734bce276 Lua: Replace uses of deprecated (moved) sides functions 2019-11-23 14:41:03 -05:00
Celtic Minstrel
e0cf8c5982 Fix syntax error (trying to write Lua like C++) 2019-11-16 17:01:43 -05:00
Celtic Minstrel
cd6283f8db Add a few more tags to the [modify_unit] optimized path 2019-11-16 15:14:09 -05:00
Celtic Minstrel
1f36590e80 Add a few more attributes to the [modify_unit] optimized path 2019-11-16 15:14:09 -05:00
Celtic Minstrel
2cc7fe6450 Revert "Add [modify_unit]rebuild=no"
This reverts commit 51d6402453.

After discussion with @gfgtdf it was determined that this is not a useful feature after all, since it was in fact the default behaviour for the optimized path.
2019-11-16 15:14:09 -05:00
Celtic Minstrel
24b11221cf Use wml.array_variables instead of wml.array_access.get/set 2019-11-16 13:09:04 -05:00
Celtic Minstrel
0ee05637d9 Lua: Replace uses of deprecated (moved) interface functions 2019-11-16 12:35:20 -05:00
Celtic Minstrel
aaa2dc4ece Rollback possibility of wesnoth.get_units matching recall list units
Now it's renamed to wesnoth.units.find_on_map.

wesnoth.units.find implements the case of finding units on either the map or a recall list.
2019-11-15 22:39:09 -05:00
Celtic Minstrel
977f05d77f Lua: Replace uses of deprecated (moved) unit functions
Also backtracked the removal of wesnoth.get_recall_units, which is now available as wesnoth.units.find_on_recall - it's just more convenient than passing x=recall to wesnoth.units.find
2019-11-15 22:39:08 -05:00
Celtic Minstrel
3772e633fa Fix [modify_unit] optimized path producing an error on a recall list unit
Addresses #4556
2019-11-15 22:39:08 -05:00
Celtic Minstrel
fda3c9af75 [modify_unit]: fix handling of unrenamable in the optimized path 2019-11-13 07:39:20 -05:00
Celtic Minstrel
51d6402453 Add [modify_unit]rebuild=no 2019-11-13 01:00:36 -05:00
Celtic Minstrel
06a3799b46 Add handling of [modify_unit][effect] on the optimized path 2019-11-13 00:53:19 -05:00