[LuaDoc] Avoid "Missing required fields" warnings by annotating the fields as optional.
This is probably rather unfortunate in the case of the unit fields, as it may now interpret it as meaning the fields can be nil. We'll see if this causes issues.
This commit is contained in:
parent
c7741907c2
commit
3bf903e2a4
5 changed files with 90 additions and 90 deletions
|
@ -35,15 +35,15 @@ function wesnoth.game_events.on_mouse_move(x, y) end
|
|||
---@field second_attack WML|string
|
||||
|
||||
---@class game_event_options
|
||||
---@field name string|string[] Event to handle, as a string or list of strings
|
||||
---@field id string Event ID
|
||||
---@field menu_item boolean True if this is a menu item (an ID is required); this means removing the menu item will automatically remove this event. Default false.
|
||||
---@field first_time_only boolean Whether this event should fire again after the first time; default true.
|
||||
---@field priority number Events execute in order of decreasing priority, and secondarily in order of addition
|
||||
---@field filter WML|event_filter|fun(cfg:WML):boolean Event filters as a config with filter tags, a table of the form {filter_type = filter_contents}, or a function
|
||||
---@field filter_args WML Arbitrary data that will be passed to the filter, if it is a function. Ignored if the filter is specified as WML or a table.
|
||||
---@field content WML The content of the event. This is a WML table passed verbatim into the event when it fires. If no function is specified, it will be interpreted as ActionWML.
|
||||
---@field action fun(cfg:WML) The function to call when the event triggers. Defaults to wesnoth.wml_actions.command.
|
||||
---@field name? string|string[] Event to handle, as a string or list of strings
|
||||
---@field id? string Event ID
|
||||
---@field menu_item? boolean True if this is a menu item (an ID is required); this means removing the menu item will automatically remove this event. Default false.
|
||||
---@field first_time_only? boolean Whether this event should fire again after the first time; default true.
|
||||
---@field priority? number Events execute in order of decreasing priority, and secondarily in order of addition
|
||||
---@field filter? WML|event_filter|fun(cfg:WML):boolean Event filters as a config with filter tags, a table of the form {filter_type = filter_contents}, or a function
|
||||
---@field filter_args? WML Arbitrary data that will be passed to the filter, if it is a function. Ignored if the filter is specified as WML or a table.
|
||||
---@field content? WML The content of the event. This is a WML table passed verbatim into the event when it fires. If no function is specified, it will be interpreted as ActionWML.
|
||||
---@field action? fun(cfg:WML) The function to call when the event triggers. Defaults to wesnoth.wml_actions.command.
|
||||
|
||||
---Add a game event handler
|
||||
---@param opts game_event_options
|
||||
|
|
|
@ -85,16 +85,16 @@ function wesnoth.interface.clear_chat_messages() end
|
|||
---@alias horizontal_align "'left'"|"'center'"|"'right'"
|
||||
---@alias vertical_align "'top'"|"'center'"|"'bottom'"
|
||||
---@class overlay_text_options
|
||||
---@field size integer The default font size
|
||||
---@field max_width integer|string The maximum width in which to display the text, as either a pixel width or a percentage (a string ending in %); if longer, it will be word-wrapped
|
||||
---@field color string|integer[] The default text colour as either a hex string or an RGB triple
|
||||
---@field bgcolor string|integer[] The default background colour as either a hex string or an RGB triple; the default is no background (fully transparent)
|
||||
---@field bgalpha integer Alpha value for the background, in the range [0,255]; defaults to 255 if a bgcolor is specified
|
||||
---@field duration integer|"'unlimited'" How long the text should be displayed, in milliseconds
|
||||
---@field fade_time integer This is how long it takes to fade out when the label is removed, either explicitly or because the duration expired
|
||||
---@field location location The screen location of the text, relative to the specified anchor (default: center of the screen)
|
||||
---@field halign horizontal_align How the text should be anchored horizontally to the screen
|
||||
---@field valign vertical_align How the text should be anchored vertically to the screen
|
||||
---@field size? integer The default font size
|
||||
---@field max_width? integer|string The maximum width in which to display the text, as either a pixel width or a percentage (a string ending in %); if longer, it will be word-wrapped
|
||||
---@field color? string|integer[] The default text colour as either a hex string or an RGB triple
|
||||
---@field bgcolor? string|integer[] The default background colour as either a hex string or an RGB triple; the default is no background (fully transparent)
|
||||
---@field bgalpha? integer Alpha value for the background, in the range [0,255]; defaults to 255 if a bgcolor is specified
|
||||
---@field duration? integer|"'unlimited'" How long the text should be displayed, in milliseconds
|
||||
---@field fade_time? integer This is how long it takes to fade out when the label is removed, either explicitly or because the duration expired
|
||||
---@field location? location The screen location of the text, relative to the specified anchor (default: center of the screen)
|
||||
---@field halign? horizontal_align How the text should be anchored horizontally to the screen
|
||||
---@field valign? vertical_align How the text should be anchored vertically to the screen
|
||||
|
||||
---Add overlay text on the screen
|
||||
---@param text string|tstring The text to display. Supports Pango markup.
|
||||
|
|
|
@ -122,14 +122,14 @@ function wesnoth.map.terrain_mask(map, pivot, mask, options) end
|
|||
|
||||
---@class label_info : location
|
||||
---@field text tstring
|
||||
---@field team_name string
|
||||
---@field color color|integer[]
|
||||
---@field visible_in_fog boolean
|
||||
---@field visible_in_shroud boolean
|
||||
---@field immutable boolean
|
||||
---@field category string|tstring
|
||||
---@field tooltip tstring
|
||||
---@field side integer
|
||||
---@field team_name? string
|
||||
---@field color? color|integer[]
|
||||
---@field visible_in_fog? boolean
|
||||
---@field visible_in_shroud? boolean
|
||||
---@field immutable? boolean
|
||||
---@field category? string|tstring
|
||||
---@field tooltip? tstring
|
||||
---@field side? integer
|
||||
|
||||
---Place a label on the map
|
||||
---@param label_info label_info
|
||||
|
|
|
@ -5,14 +5,14 @@ wesnoth.paths = {}
|
|||
---@alias path_function fun(x:integer, y:integer, cost:integer):integer
|
||||
|
||||
---@class path_options
|
||||
---@field max_cost integer
|
||||
---@field ignore_units boolean
|
||||
---@field ignore_teleport boolean
|
||||
---@field viewing_side integer
|
||||
---@field width integer
|
||||
---@field height integer
|
||||
---@field include_borders boolean
|
||||
---@field calculate path_function
|
||||
---@field max_cost? integer
|
||||
---@field ignore_units? boolean
|
||||
---@field ignore_teleport? boolean
|
||||
---@field viewing_side? integer
|
||||
---@field width? integer
|
||||
---@field height? integer
|
||||
---@field include_borders? boolean
|
||||
---@field calculate? path_function
|
||||
|
||||
---Find a good path between two hexes
|
||||
---@param start location
|
||||
|
@ -37,10 +37,10 @@ function wesnoth.paths.find_path(start, finish, options) end
|
|||
function wesnoth.paths.find_vacant_hex(loc, unit) end
|
||||
|
||||
---@class reach_options
|
||||
---@field additional_turns integer
|
||||
---@field ignore_units boolean
|
||||
---@field ignore_teleport boolean
|
||||
---@field viewing_side integer
|
||||
---@field additional_turns? integer
|
||||
---@field ignore_units? boolean
|
||||
---@field ignore_teleport? boolean
|
||||
---@field viewing_side? integer
|
||||
|
||||
---Get all locations a unit can reach
|
||||
---@param unit unit
|
||||
|
|
|
@ -57,52 +57,52 @@
|
|||
---Defines an individual unit
|
||||
---@class unit : wesnoth.units, location
|
||||
---@field valid "'map'"|"'recall'"|"'private'"|nil
|
||||
---@field id string
|
||||
---@field id? string
|
||||
---@field side integer
|
||||
---@field type string
|
||||
---@field variation string
|
||||
---@field gender "'male'"|"'female'"
|
||||
---@field race string
|
||||
---@field portrait string
|
||||
---@field image_mods string
|
||||
---@field ellipse string
|
||||
---@field halo string
|
||||
---@field hidden boolean
|
||||
---@field name tstring
|
||||
---@field description tstring
|
||||
---@field facing direction
|
||||
---@field overlays string[]
|
||||
---@field hitpoints integer
|
||||
---@field max_hitpoints integer
|
||||
---@field experience integer
|
||||
---@field max_experience integer
|
||||
---@field moves integer
|
||||
---@field max_moves integer
|
||||
---@field attacks_left integer
|
||||
---@field max_attacks integer
|
||||
---@field level integer
|
||||
---@field recall_cost integer
|
||||
---@field cost integer
|
||||
---@field canrecruit boolean
|
||||
---@field zoc boolean
|
||||
---@field alignment string
|
||||
---@field upkeep integer|"'full'"|"'free'"|"'loyal'"
|
||||
---@field usage string
|
||||
---@field renamable boolean
|
||||
---@field undead_variation string
|
||||
---@field role string
|
||||
---@field resting boolean
|
||||
---@field recall_filter WML
|
||||
---@field extra_recruit string[]
|
||||
---@field advances_to string[]
|
||||
---@field advancements WMLTable[]
|
||||
---@field status table<string, boolean>
|
||||
---@field variables table<string, WML>
|
||||
---@field attacks unit_weapon[]
|
||||
---@field traits string[]
|
||||
---@field abilities string[]
|
||||
---@field animations string[]
|
||||
---@field __cfg WMLTable
|
||||
---@field variation? string
|
||||
---@field gender? "'male'"|"'female'"
|
||||
---@field race? string
|
||||
---@field portrait? string
|
||||
---@field image_mods? string
|
||||
---@field ellipse? string
|
||||
---@field halo? string
|
||||
---@field hidden? boolean
|
||||
---@field name? tstring
|
||||
---@field description? tstring
|
||||
---@field facing? direction
|
||||
---@field overlays? string[]
|
||||
---@field hitpoints? integer
|
||||
---@field max_hitpoints? integer
|
||||
---@field experience? integer
|
||||
---@field max_experience? integer
|
||||
---@field moves? integer
|
||||
---@field max_moves? integer
|
||||
---@field attacks_left? integer
|
||||
---@field max_attacks? integer
|
||||
---@field level? integer
|
||||
---@field recall_cost? integer
|
||||
---@field cost? integer
|
||||
---@field canrecruit? boolean
|
||||
---@field zoc? boolean
|
||||
---@field alignment? string
|
||||
---@field upkeep? integer|"'full'"|"'free'"|"'loyal'"
|
||||
---@field usage? string
|
||||
---@field renamable? boolean
|
||||
---@field undead_variation? string
|
||||
---@field role? string
|
||||
---@field resting? boolean
|
||||
---@field recall_filter? WML
|
||||
---@field extra_recruit? string[]
|
||||
---@field advances_to? string[]
|
||||
---@field advancements? WMLTable[]
|
||||
---@field status? table<string, boolean>
|
||||
---@field variables? table<string, WML>
|
||||
---@field attacks? unit_weapon[]
|
||||
---@field traits? string[]
|
||||
---@field abilities? string[]
|
||||
---@field animations? string[]
|
||||
---@field __cfg? WMLTable
|
||||
|
||||
---@class wesnoth.units
|
||||
wesnoth.units = {}
|
||||
|
@ -227,13 +227,13 @@ function animator:run() end
|
|||
function animator:clear() end
|
||||
|
||||
---@class unit_animator_params
|
||||
---@field facing location
|
||||
---@field value number|number[]
|
||||
---@field with_bars boolean
|
||||
---@field text tstring
|
||||
---@field color color
|
||||
---@field primary unit_weapon
|
||||
---@field secondary unit_weapon
|
||||
---@field facing? location
|
||||
---@field value? number|number[]
|
||||
---@field with_bars? boolean
|
||||
---@field text? tstring
|
||||
---@field color? color
|
||||
---@field primary? unit_weapon
|
||||
---@field secondary? unit_weapon
|
||||
|
||||
---Add a unit to the animation
|
||||
---@param unit unit
|
||||
|
|
Loading…
Add table
Reference in a new issue