[Lua] Make f.is_loc work either with a location object or with separate x,y parameters
This commit is contained in:
parent
e92ee5cb1b
commit
a72ec39f79
1 changed files with 7 additions and 3 deletions
|
@ -411,10 +411,14 @@ if wesnoth.kernel_type() == "Mapgen Lua Kernel" then
|
|||
return { "y", terrain }
|
||||
end,
|
||||
---Match a specific location
|
||||
---@param loc location
|
||||
---@param x integer
|
||||
---@param y integer
|
||||
---@return terrain_filter_tag
|
||||
is_loc = function(loc)
|
||||
return f.all(f.x(loc[1]), f.y(loc[2]))
|
||||
---@overload fun(loc:location):terrain_filter_tag
|
||||
is_loc = function(x, y)
|
||||
local loc = wesnoth.map.read_location(x, y)
|
||||
if not loc then return { "any" } end
|
||||
return f.all(f.x(loc.x), f.y(loc.y))
|
||||
end,
|
||||
---Match terrain by Wesnoth Formula Language
|
||||
---@param formula string|formula
|
||||
|
|
Loading…
Add table
Reference in a new issue