27670 Commits

Author SHA1 Message Date
Iris Morelle
3d7842c43e gui2/mp_faction_select: Use a disambiguator for the Random gender option
You just know sooner or later someone's going to try to use "random" for
something other than gender and some translations will end up looking
wrong as a result.
2021-03-12 20:01:52 -03:00
Iris Morelle
2de931cfa0 wc: Fix mapgen-related strings being in the wrong textdomain
The _ locals are there to ensure that if _ is overridden anywhere else
in the enclosing scope (which I haven't properly determined *where* it
is yet) it gets overridden again with the right textdomain object.
It *does* tell wmlxgettext what the correct textdomain is without using
the `-- #textdomain` hack anyway, so might as well just do it this way
regardless of the global-looking _ in map/main.lua.

CC #5311
2021-03-12 20:01:52 -03:00
nemaara
bb2dcfc7d5 Liberty: revise dialogue 2021-03-11 02:01:17 -05:00
Iris Morelle
cc75fe2a23 scenario-test: Reuse translatable strings from the right textdomains
Addresses part of #5311.
2021-03-11 03:42:38 -03:00
nemaara
8eb0bc3151 DiD: use redraw instead of setting vision 2021-03-10 02:07:40 -05:00
nemaara
0a3c09aa03 DiD: remove allow_undos 2021-03-10 02:03:14 -05:00
nemaara
fb1ed14b0a DiD: fix drunk jaime 2021-03-10 01:58:37 -05:00
nemaara
f0df337865 DiD: give Mal Keshar better movement 2021-03-10 01:56:49 -05:00
mattsc
b56a44ed66 ExpAI recruiting: prevent potential divide-by-zero 2021-03-07 14:46:04 -08:00
mattsc
373559b6bf Protect Unit Micro AI test scenario: fix deprecated WML 2021-03-06 16:45:57 -08:00
Celtic Minstrel
37fde7aaee
Allow hex references to hold auxiliary user values 2021-03-06 18:44:29 -05:00
mattsc
51e4b56a1e ai_helper.lua: fix a typo 2021-03-06 15:35:43 -08:00
mattsc
cadb233d6c Update some deprecated Lua uses 2021-03-06 15:08:54 -08:00
Celtic Minstrel
a2d7a26365
Fix several Lua issues, mostly unintentional globals (#5587) 2021-03-06 17:01:53 -05:00
mattsc
44e279cb2f Lua location_set: fix a variable name 2021-03-06 10:53:02 -08:00
mattsc
d9e8f69718 Lua AIs: fix some incorrectly used variables
Fixes #5586
2021-03-06 09:53:53 -08:00
mattsc
cab4446580 Lua AI helper functions: remove trailing spaces 2021-03-06 09:53:27 -08:00
Celtic Minstrel
9fb200e57a
Fix the schema 2021-03-05 22:17:41 -05:00
Celtic Minstrel
a12de1f90f Fix several races using the Markov name generator instead of the new CFG generator 2021-03-05 09:29:11 -05:00
Celtic Minstrel
93398ae3a4
Fix another syntax error 2021-03-04 23:43:24 -05:00
Celtic Minstrel
86c3c30c46
Fix a syntax error 2021-03-04 23:33:33 -05:00
Celtic Minstrel
3a7eef0310 Merge pull request #4580 from wesnoth/lua_gamemap
Refactor the game map to permit exposing it to Lua
2021-03-04 14:00:43 -05:00
mattsc
28ea6e82c6 Multipack Wolves MAI: fix error when a wolf is surrounded 2021-03-03 17:41:41 -08:00
mattsc
ea4657c6d4 Goto Micro AI: add remove_movement option
By default, the MAI removes movement points from units even when they cannot find a hex to move to.  When this option is set to 'no' (default is 'yes'), this step is skipped, so that other candidate actions can take over.

This implements feature request #5580
2021-03-03 12:49:35 -08:00
mattsc
7e8cedaea8
Merge pull request #5573 from mattsc/ca_retreat_injured
AI: Improve behavior of the retreat_injured CA
2021-03-03 08:22:21 -08:00
mattsc
043ee7a80b Protect Unit Micro AI: ensure units are on AI side
In general, the units specified in the MAI setup should be on the AI side.  However, that might change during a scenario, for example when there is an event that switches units to other sides.
2021-03-03 08:14:46 -08:00
doofus-01
ac7dc6f3e6 UtBS - undead variations for the rider/mounted Quenoths 2021-03-02 16:41:37 -08:00
nemaara
3e59f2ef5b SotA: rebalance campaign 2021-03-02 02:36:20 -05:00
nemaara
df10b80cae SotBE: balance campaign 2021-03-02 00:35:40 -05:00
Elvish_Hunter
c1c80e3a7f wmllint: implemented Xol terrain conversion 2021-03-01 20:30:07 +01:00
Elvish_Hunter
780797e3bc wmllint: enable checks inside Lua [args] tags
Completes PR #5470
2021-03-01 18:43:03 +01:00
doofus-01
edd405fbff
Update Corpse_Soulless.cfg 2021-03-01 04:27:06 -08:00
doofus-01
1527f3174a
Update Corpse_Walking.cfg 2021-03-01 04:26:01 -08:00
doofus-01
17093158b1
Merge pull request #5551 from doofus-01/beastmountWC_20210215
units - Walking Corpse beast-rider (taurus) variation
2021-02-28 20:09:52 -08:00
doofus-01
a834c78728 units - soulless beastrider sprite, animations, and portrait 2021-02-28 19:26:19 -08: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
6558c7981b Add a wesnoth.terrain_types table 2021-02-28 18:16:33 -05:00
Celtic Minstrel
cf71af4e11 Add a terrain hex reference API
This adds a metatable to all locations returned from wesnoth.map.find.
2021-02-28 18:16:32 -05:00
Celtic Minstrel
90e6db0330 Rename two functions for consistency of terminology 2021-02-28 18:16:31 -05:00
Celtic Minstrel
7e1414e249 Rename existing map functions in the map generation kernel 2021-02-28 18:16:31 -05:00
Celtic Minstrel
2d5ea6312e Move various functions into the map module 2021-02-28 18:16:31 -05:00
Celtic Minstrel
e6efc7de6c Refactor the game map to permit exposing it to Lua via wesnoth.current.map
The method of accessing terrain on the map has drastically changed.
- wesnoth.get_terrain and wesnoth.set_terrain are both deprecated
- wesnoth.terrain_mask still works but is moved into the wesnoth.map module and now takes the map object as the first parameter
- The map's terrain is now accessed exclusively via indexing on the map object, ie map[{x,y}]
- You set terrain by assigning a terrain code; the position of ^ in the terrain code now determines the merge mode
- The replace_if_failed option is now manifested as a function that converts any terrain code into a special value that, when assigned to a location on the map, uses the replace if failed logic.

The map object has a few attributes in it:
- width and height are the total size, including borders
- playable_width and playable_height are the values returned from wesnoth.get_map_size, which is now deprecated
- border_size is the third value from wesnoth.get_map_size
- data converts the map to a string
- Special locations are now part of the map object. The length operator is deprecated.
- other than that, wesnoth.map is treated as if it were the metatable of the map object
2021-02-28 18:16:30 -05:00
Celtic Minstrel
51cf2621f7 Add a utility function to extract a location from the front of a variadic parameter pack
The purpose of this is to make it easy for functions implemented in Lua to handle locations
in the same way as functions implemented in C++.

The location_set module has been updated to make use of this functionality in its setter functions.

Usage example:

Imagine a function foo with the following signature:

foo(bar : string, home : location, mode : string, target : location, moo : boolean) -> boolean

With the new read_location function it could be implemented as follows:

function foo(...)
	-- First argument goes in bar
	local bar = ...
	-- Read location starting at the second argument
	local home, n = wesnoth.mP.read_location(select(2, ...))
	-- note: n will be 0 if a location wasn't found at that position
	-- This could be an error, or it could be handled as an optional parameter
	-- Next argument after that goes in mode
	local mode = select(n + 2, ...)
	-- Then read a location into target
	local target, m = wesnoth.map.read_location(select(n + 2, ...))
	-- Finally, read a parameter into moo
	local moo = select(m + n + 2, ...)
	-- Do stuff with all these parameters
	return true
end

With that code, all the following invocations of foo work:

foo('a', 'b', true) -- both optional locations omitted
foo('a', 1, 2, 'q', 5, 6, false) -- locations given as separate integer parameters
foo('a', 'm', {1, 7},  true) -- first location omitted, second given as 2-element array
foo('a', some_unit, 'z', {x = 5, y = 10}, false) -- a unit also functions as a location
foo('a', 7, 12, 'q', my_leader, true) -- mixing different forms also works
2021-02-28 18:16:30 -05:00
Celtic Minstrel
dacd5b323e Add some utility functions to help clarify the merge mode being used when assigning terrains 2021-02-28 18:16:30 -05:00
mattsc
287530a43f Goto Micro AI: change how avoid_map is taken into account
There were two issues with the previous method:
- ai_helper.get_avoid_map() never returns nil, but at most an empty location set. Thus, the 'else' clause in that conditional was never reached.
- The presence of an [avoid] tag should not prevent the keys ignoring enemies from taking effect. Instead, [avoid] needs to be taken into account for all possible code paths.
2021-02-28 10:22:11 -08:00
mattsc
94bd2ec993 Goto Micro AI: fix possible error when ignoring enemies
The final determination of the hex to move to must take enemies into account, otherwise the MAI might try to move the unit to a hex it cannot actually reach.
2021-02-28 10:15:07 -08:00
mattsc
fd0c00cfb0 Goto Micro AI: fix checks of avoid_enemies key
Numerical values are sometimes transferred from WML to Lua using the string type. This applies, for example, to very small numbers, such as 0.0000000000001. This needs to be taken into account when checking whether avoid_enemies is a number.
2021-02-28 10:11:49 -08:00
Steve Cotton
37bf7f9333 Update the schema for [terrain_mask] 2021-02-28 15:47:00 +01:00
Celtic Minstrel
9e1677612b Add some unit tests for [terrain_mask] 2021-02-27 21:24:47 -05:00