diff --git a/.github/workflows/generate-lua-library.yml b/.github/workflows/generate-lua-library.yml new file mode 100644 index 0000000000..ea5a980993 --- /dev/null +++ b/.github/workflows/generate-lua-library.yml @@ -0,0 +1,39 @@ +name: Generate Lua library +on: + workflow_dispatch: + push: + branches: + - master + paths: + - 'rts/Lua/**' +jobs: + generate-library: + name: Regenerate library + runs-on: ubuntu-latest + steps: + - name: Configure git + run: | + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + + - name: Checkout Lua CPP files + uses: actions/checkout@v4 + with: + sparse-checkout: rts/Lua + path: recoil + + - name: Install extractor tool + run: | + npm install rhys-vdw/lua-doc-extractor + + - name: Regenerate docs + working-directory: ./recoil/rts/Lua/ + run: | + rm -rf library/generated + npx lua-doc-extractor *.cpp --dest library/generated + + - name: Commit and push Recoil repo + uses: stefanzweifel/git-auto-commit-action@v5 + with: + repository: ./recoil + commit_message: Update LuaLS library \ No newline at end of file diff --git a/.github/workflows/publish-site.yml b/.github/workflows/publish-site.yml index c714c852f7..ec91db970b 100644 --- a/.github/workflows/publish-site.yml +++ b/.github/workflows/publish-site.yml @@ -13,23 +13,37 @@ jobs: - name: Install Dependencies run: | sudo apt-get update -y - sudo apt-get install --fix-missing -y lua-ldoc lua-markdown jq p7zip-full libsdl2-2.0-0 libopenal1 + sudo apt-get install --fix-missing -y jq p7zip-full libsdl2-2.0-0 libopenal1 + - name: Set up Homebrew + id: set-up-homebrew + uses: Homebrew/actions/setup-homebrew@master + - name: Install Lua Language Server + run: | + brew install lua-language-server - name: Checkout Source Repository uses: actions/checkout@v2 - with: - ref: master - name: Generate Dynamic Content run: | bash doc/site/_scripts/get_release_data.sh bash doc/site/_scripts/get_engine_data.sh git add -f doc/site/_data - - name: Run LDoc + # This step should be removed when https://github.com/LuaLS/lua-language-server/issues/2977 is resolved. + - name: Disable global libaries from Lua config + run: | + cp doc/site/.luarc.doc.json .luarc.json + - name: Export Lua data using Lua Language Server run: | - ldoc -c doc/LDoc/config.ld . - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git config user.name "github-actions[bot]" - git add -f doc/site/ldoc + lua-language-server --doc . --doc_out_path doc/site/_data + git add -f doc/site/_data + - name: Commit changes + run: | + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" git commit -m "Update doc/site" + # This step should be removed when https://github.com/LuaLS/lua-language-server/issues/2977 is resolved. + - name: Discard changes to Lua config + run: | + git checkout -- .luarc.json - name: Check if gh-pages exists id: check-ghpages run: | @@ -39,8 +53,8 @@ jobs: id: site-changes if: steps.check-ghpages.outputs.exists == 'true' run: | - git diff --stat origin/gh-pages master:doc/site - git diff --quiet origin/gh-pages master:doc/site && (echo "modified=false" > $GITHUB_OUTPUT) || (echo "modified=true" > $GITHUB_OUTPUT) + git diff --stat origin/gh-pages ${{ github.ref_name }}:doc/site + git diff --quiet origin/gh-pages ${{ github.ref_name }}:doc/site && (echo "modified=false" > $GITHUB_OUTPUT) || (echo "modified=true" > $GITHUB_OUTPUT) - name: Push gh-pages # Only push gh-pages if doc/site/ was changed or ldoc did changes if: steps.check-ghpages.outputs.exists == 'false' || steps.site-changes.outputs.modified == 'true' run: | diff --git a/.luarc.json b/.luarc.json new file mode 100644 index 0000000000..cb309d9e88 --- /dev/null +++ b/.luarc.json @@ -0,0 +1,45 @@ +{ + "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", + "runtime.version": "Lua 5.1", + "completion.requireSeparator": "/", + "runtime.builtin": { + "basic": "disable", + "bit": "disable", + "bit32": "disable", + "builtin": "disable", + "coroutine": "disable", + "debug": "disable", + "ffi": "disable", + "io": "disable", + "jit": "disable", + "math": "disable", + "os": "disable", + "package": "disable", + "string": "disable", + "table": "disable", + "table.clear": "disable", + "table.new": "disable", + "utf8": "disable" + }, + "runtime.path": [ + "?", + "?.lua" + ], + "workspace.ignoreDir": [ + "cont", + "lib", + "tools" + ], + "workspace.library": [ + // Only add the generator output as "library" to prevent it from being + // modified by refactor commands. + // + // Refactoring is valid on the hand-written library files. + "rts/Lua/library/generated" + ], + "runtime.special": { + "VFS.Include": "require", + "include": "require", + "shard_include": "require" + } +} diff --git a/doc/LDoc/README.md b/doc/LDoc/README.md deleted file mode 100644 index 9793c25b14..0000000000 --- a/doc/LDoc/README.md +++ /dev/null @@ -1,3 +0,0 @@ -Install LDoc for your operating system or from LuaRocks - -Inside `doc/LDoc` run `ldoc .`. diff --git a/doc/LDoc/config.ld b/doc/LDoc/config.ld deleted file mode 100644 index 89375c9e27..0000000000 --- a/doc/LDoc/config.ld +++ /dev/null @@ -1,45 +0,0 @@ -project='Spring Lua API' -title='Spring Lua API documentation' -description='A Lua documentation tool' -not_luadoc=true -no_space_before_args=true -format='markdown' -file={ - '../../rts/Lua/LuaSyncedCtrl.cpp', - '../../rts/Lua/LuaUnsyncedCtrl.cpp', - '../../rts/Lua/LuaSyncedRead.cpp', - '../../rts/Lua/LuaUnsyncedRead.cpp', - '../../rts/Lua/LuaSyncedMoveCtrl.cpp', - '../../rts/Lua/LuaHandle.cpp', - '../../rts/Lua/LuaHandleSynced.cpp', - '../../rts/Lua/LuaVFS.cpp', - '../../rts/Lua/LuaVAO.cpp', - '../../rts/Lua/LuaVAOImpl.cpp', - '../../rts/Lua/LuaVBO.cpp', - '../../rts/Lua/LuaVBOImpl.cpp', - '../../rts/Lua/LuaOpenGL.cpp', - '../../rts/Lua/LuaZip.cpp', - '../../rts/Lua/LuaRules.cpp', - '../../rts/Lua/LuaMetalMap.cpp', - '../../rts/Lua/LuaShaders.cpp', - '../../rts/Lua/LuaFBOs.cpp', - '../../rts/Lua/LuaRBOs.cpp', - '../../rts/Lua/LuaMathExtra.cpp', - '../../rts/Lua/LuaBitOps.cpp', - '../../rts/Lua/LuaConstGame.cpp', - '../../rts/Lua/LuaConstEngine.cpp', - '../../rts/Lua/LuaConstPlatform.cpp', - '../../rts/Lua/LuaConstCMD.cpp', - '../../rts/Lua/LuaConstCMDTYPE.cpp', - '../../rts/Lua/LuaConstCOB.cpp', - '../../rts/Lua/LuaConstGL.cpp', -} -dir='../site/ldoc' -template='./' - -local repoPath = "https://github.com/beyond-all-reason/spring/blob/BAR105/%s" - -custom_see_handler('^(rts/.*)$', function(filename) - local url = repoPath:format(filename) - return filename, url -end) diff --git a/doc/LDoc/ldoc.ltp b/doc/LDoc/ldoc.ltp deleted file mode 100644 index 7750febb22..0000000000 --- a/doc/LDoc/ldoc.ltp +++ /dev/null @@ -1,229 +0,0 @@ -# local localurl = module and module.name and ldoc.ref_to_module(module) or ("../" .. ldoc.output .. ".html") -# localurl = localurl:gsub("%.%./", "ldoc/") -# modname = module and module.name or "Home" -# local function M(txt,item) return ldoc.markup(txt,item,ldoc.plain) end ---- -layout: default -title: $(modname) -permalink: $(localurl) -description: $(module and M(module.summary,module) or "") -parent: Lua API -# -- do not publish if index page -$(module or "published: false") ---- - -{% raw %} -# local no_spaces = ldoc.no_spaces -# local display_name = ldoc.display_name -# local iter = ldoc.modules.iter -# local nowrap = ldoc.wrap and '' or 'nowrap' -# if ldoc.body then -- verbatim HTML as contents; 'non-code' entries - $(ldoc.body) -# elseif module then -- module documentation -

$(ldoc.module_typename(module)) $(module.name)

-

$(M(module.summary,module))

-

$(M(module.description,module))

-# if module.tags.include then - $(M(ldoc.include_file(module.tags.include))) -# end -# if module.see then -

See also:

- -# end -- if see -# if module.usage then -

Usage:

- -# end -- if usage -# if module.info then -

Info:

- -# end -- if module.info - -# if not ldoc.no_summary then -# -- bang out the tables of item types for this module (e.g Functions, Tables, etc) -# for kind,items in module.kinds() do -

$(kind)

-
-# for item in items() do -
- $(item.name) -
-
- $(M(item.summary,item)) -
-# end -- for items -
-# end -- for kinds -# end -- if not no_summary - -# --- currently works for both Functions and Tables. The params field either contains -# --- function parameters or table fields. -# local show_return = not ldoc.no_return_or_parms -# local show_parms = show_return -# for kind, items in module.kinds() do -# local kitem = module.kinds:get_item(kind) -# local has_description = kitem and ldoc.descript(kitem) ~= "" -

- $(kind) -

- $(M(module.kinds:get_section_description(kind),nil)) -# if kitem then -# if has_description then -

$(M(ldoc.descript(kitem),kitem))

-# end -# if kitem.usage then -

Usage:

-
$(ldoc.prettify(kitem.usage[1]))
-# end -# end -# for item in items() do -

-# if ldoc.prettify_files and ldoc.is_file_prettified[item.module.file.filename] then - line $(item.lineno) -# end - $(display_name(item)) -

-

$(item.summary)

-
-

- $(item.description) -

- -# if ldoc.custom_tags then -# for custom in iter(ldoc.custom_tags) do -# local tag = item.tags[custom[1]] -# if tag and not custom.hidden then -

$(custom.title or custom[1]):

- -# end -- iter tags -# end - -# if show_parms and item.params and#item.params > 0 then -# local subnames = module.kinds:type_of(item).subnames -# if subnames then -

$(subnames):

-# end -
    -# for parm in iter(item.params) do -# local param,sublist = item:subparam(parm) -# if sublist then -
  1. $(sublist)$(M(item.params.map[sublist],item)) -
      -# end -# for p in iter(param) do -# local name,tp,def = item:display_name_of(p), ldoc.typename(item:type_of_param(p)), item:default_of_param(p) -
    • - $(name) -# if tp ~= '' then - $(tp) -# end - $(M(item.params.map[p],item)) -# if def == true then - (optional) -# elseif def then - (default $(def)) -# end -# if item:readonly(p) then - readonly -# end -
    • -# end -# if sublist then -
    -# end -# end -- for -
-# end -- if params - -# if show_return and item.retgroups then local groups = item.retgroups -

Returns:

-# for i,group in ldoc.ipairs(groups) do -
    -# for r in group:iter() do local type, ctypes = item:return_type(r); local rt = ldoc.typename(type) -
  1. -# if rt ~= '' then - $(rt) -# end - $(M(r.text,item))
  2. -# if ctypes then - -# end -- if ctypes -# end -- for r -
-# if i <#groups then -

Or

-# end -# end -- for group -# end -- if returns - -# if show_return and item.raise then -

Raises:

- $(M(item.raise,item)) -# end - -# if item.see then -

See also:

- -# end -- if see - -# if item.usage then -

Usage:

- -# end -- if usage -
-# end -- for items -# end -- for kinds - -# else -- if module; project-level contents -# if ldoc.description then -

$(M(ldoc.description,nil))

-# end -# if ldoc.full_description then -

$(M(ldoc.full_description,nil))

-# end - -# for kind, mods in ldoc.kinds() do -

$(kind)

-# kind = kind:lower() - -# for m in mods() do - - - - -# end -- for modules -
$(m.name)$(M(ldoc.strip_header(m.summary),m))
-# end -- for kinds -# end -- if module -{% endraw %} diff --git a/doc/site/.luarc.doc.json b/doc/site/.luarc.doc.json new file mode 100644 index 0000000000..b463b8ef12 --- /dev/null +++ b/doc/site/.luarc.doc.json @@ -0,0 +1,37 @@ +{ + "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", + "runtime.version": "Lua 5.1", + "completion.requireSeparator": "/", + "runtime.builtin": { + "basic": "disable", + "bit": "disable", + "bit32": "disable", + "builtin": "disable", + "coroutine": "disable", + "debug": "disable", + "ffi": "disable", + "io": "disable", + "jit": "disable", + "math": "disable", + "os": "disable", + "package": "disable", + "string": "disable", + "table": "disable", + "table.clear": "disable", + "table.new": "disable", + "utf8": "disable" + }, + "workspace.ignoreDir": [ + "cont", + "lib" + ], + "runtime.path": [ + "?", + "?.lua" + ], + "runtime.special": { + "VFS.Include": "require", + "include": "require", + "shard_include": "require" + } +} diff --git a/doc/site/Gemfile.lock b/doc/site/Gemfile.lock index f78bcafe66..186b67be4b 100644 --- a/doc/site/Gemfile.lock +++ b/doc/site/Gemfile.lock @@ -219,7 +219,7 @@ GEM jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) minitest (5.17.0) - nokogiri (1.14.2-x86_64-linux) + nokogiri (1.17.2-x86_64-linux) racc (~> 1.4) octokit (4.25.1) faraday (>= 1, < 3) diff --git a/doc/site/README.md b/doc/site/README.md index 2fa9462992..141a4456a4 100644 --- a/doc/site/README.md +++ b/doc/site/README.md @@ -4,7 +4,9 @@ The recoil site is a jekyll application, usually hosted on github pages. ## Testing locally -Have a reasonably recent version of Ruby. Inside `doc/site` run: +Install Ruby 3.2.3 ([newer versions can cause problems](https://stackoverflow.com/a/77896791/317135)). + +Inside `doc/site` run: ```bash bundle @@ -13,14 +15,34 @@ bundle exec jekyll build && bundle exec jekyll serve Navigate to http://localhost:4000/spring -## Generating LDoc +## Generating Lua API data + +### Updating the Lua definition files + +First install `lua-doc-extractor`: + +```bash +npm install -g rhys-vdw/lua-doc-extractor +``` + +At root, run: + +```bash +cd rts/Lua/ +rm -rf library/generated +npx lua-doc-extractor *.cpp --dest library/generated +``` + +### Export API data -Have [LDoc](https://github.com/lunarmodules/LDoc) installed or available at your `$PATH`. +Have [Lua Language Server](https://luals.github.io/) installed and available at your `$PATH`. -Inside `doc/LDoc` run: +At root, run: ```bash -ldoc -c config.ld . +lua-language-server --doc . --doc_out_path doc/site/_data ``` +Note: Running this using LLS 3.13.4 from a subdirectory with a relative path seems to cause duplicate class fields to be generated. Presumably a bug in LLS. + Keep in mind to see changes on the site you might have to restart jekyll. diff --git a/doc/site/lua-api.md b/doc/site/lua-api.md index bf947310d8..5b925e95f1 100644 --- a/doc/site/lua-api.md +++ b/doc/site/lua-api.md @@ -8,13 +8,104 @@ permalink: lua-api --- # Lua API -
-{% for pagey in site.pages %} -{% if pagey.parent == 'Lua API' %} -
-{{ pagey.title }} -
-
{{ pagey.description }}
+ +{% comment %} +## Table of Contents + + +{% endcomment %} + +{% for row in site.data.doc %} + +{% assign defines = row["defines"][0] %} + +{% comment %} + Determine the type of the item. This is complicated by functions being defined + as `variables` which are extending a function. +{% endcomment %} + +{% assign type = row.type %} +{% if type == "variable" %} + {% assign type = defines.extends.type %} +{% endif %} + +--- + +{% comment %} + --- Header --- + + Render the name of item, including its type. + Then render the first line of its "view" - the raw code definition. This will + show the full function signature without its return values (which are on + subsequent lines). +{% endcomment %} + +## {{row["name"]}} {{type}} +{% if defines.type == 'doc.class' %} + {% comment %} Do nothing, classes just have their name as the view. {% endcomment %} +{% elsif row.type != 'variable' and defines.view %} +```lua +{{ defines.view | newline_to_br | strip_newlines | split: '
' | first }} +``` +{% elsif defines.extends.view %} +```lua +{{ defines.extends.view | newline_to_br | strip_newlines | split: '
' | first }} +``` +{% endif %} + +{% comment %} + --- Description --- + + `defines.extends.rawdesc` seems to have the description without inlined doc + tags. However it is not always available. +{% endcomment %} + +{% if defines.extends %} +{{ defines.extends.rawdesc }} +{% else %} +{{ defines.desc }} +{% endif %} + +{% if row.fields and row.fields != empty %} +### Fields + + +{% for field in row.fields %} +- {{ field.name }} `{{ field.extends.view }}` {% if field.rawdesc %} — {{field.rawdesc}} {% endif %} +{% endfor %} + {% endif %} + + +{% if defines["extends"] %} +{% assign extends = defines["extends"] %} + +{% if extends["args"] and extends["args"] != empty %} +## Params + + +{% for arg in extends.args %} +1. {{ arg.name }} `{{ arg.view }}` {% if arg.desc %} — {{ arg.desc }} {% endif %} {% endfor %} -
+ +{% endif %} + +{% if extends["returns"] and extends["returns"] != empty %} + +### Returns + +{% for return in extends["returns"] %} +1. `{{ return["view"] }}` {{return["name"]}} {% if return["rawdesc"] %} — {{return["rawdesc"]}} {% endif %} +{% endfor %} +{% endif %} + +{% endif %} + +{% endfor %} \ No newline at end of file diff --git a/rts/Lua/LUA_DOC_GUIDE.md b/rts/Lua/LUA_DOC_GUIDE.md new file mode 100644 index 0000000000..66da9ea8f6 --- /dev/null +++ b/rts/Lua/LUA_DOC_GUIDE.md @@ -0,0 +1,200 @@ +# Lua doc comments guide + +Lua documentation is generated from cpp files. These are automatically exported to be consumed by games that use Recoil (e.g. BAR). The types are compatible with [Lua Language Server](https://luals.github.io/), providing static analysis and intellisense. + +```cpp +/*** + * @function Spring.GetFeaturesInScreenRectangle + * + * Get features inside a rectangle area on the map + * + * @param left number + * @param top number + * @param right number + * @param bottom number + * @return nil|number[] featureIDs + */ +int LuaUnsyncedRead::GetFeaturesInScreenRectangle(lua_State* L) +{ + // CPP code +} +``` + +## Export + +Special comments blocks are parsed by [lua-doc-extractor]( https://github.com/rhys-vdw/lua-doc-extractor) and converted into [definition files](https://luals.github.io/wiki/definition-files/). + +Comment blocks must start with `/**`, and by convention each line starts with `*`. + +The body of the comment is translated literally, but some code generation is required. For these [custom tags](https://github.com/rhys-vdw/lua-doc-extractor?tab=readme-ov-file#custom-tags) must be used. + +Markdown is supported in all text. + +## Annotations + +[Full list of annotations](https://luals.github.io/wiki/annotations/). + +### Common annotations + +- [`@function`](https://github.com/rhys-vdw/lua-doc-extractor?tab=readme-ov-file#function-name) +- [`@table`](https://github.com/rhys-vdw/lua-doc-extractor?tab=readme-ov-file#table-name) +- [`@param`](https://luals.github.io/wiki/annotations/#param) +- [`@return`](https://luals.github.io/wiki/annotations/#return) +- [`@field`](https://luals.github.io/wiki/annotations/#field) + +## Types + +[List of types](https://luals.github.io/wiki/annotations/#documenting-types) + +### Common types + +- `integer` +- `nil` +- `any` +- `boolean` +- `string` +- `number` (for floating point numbers) +- `integer` +- `table<,>` + +> [!TIP] +> Literals (e.g. `true`, `false`, `5`) are also available as types. `true` is useful in the case where a table is being used as a set, e.g. +> ``` +> table +> ``` + +### Unions + +Union types can be specified with `|`. + +``` +string|boolean|number +``` + +Suffix with `?` as a shorthand for a union with `nil`, e.g. + +``` +string|nil +``` +can be expressed as: +``` +string? +``` + +### Arrays + +An array type is expressed as `type[]`. + +Array of numbers +``` +number[] +``` +Array of string or null +``` +string?[] +``` +A single number, or an array of strings: +``` +number|string[] +``` +An array with a mix of number and string. +``` +(number|string)[] +``` + +## Examples + +### Function + +- Must start with `@function TableName.FunctionName`. +- Can have any amount of description. This should be added after the first +- Specify parameters with `@param parameterName type Description...` +- Specify return type with `@return type name Description...` +- For multiple returns use one per line. + +> [!IMPORTANT] +> For `@return` must specify the type _before_ the name, whereas `@param` takes the name before the type. + +```cpp +/** + * @function Math.Add + * + * Add two integers together. + * + * This function will add two numbers together and return the result. + * + * ```lua + * local totalHeight = Math.Add(legLength, upperBodyHeight) + * ``` + * + * @param a integer The first number. + * @param b integer The second number. + * @returns integer result The sum of `a` and `b`. +``` + +### Class + +Structured data is expressed as a class. This represents a table with expected key/value pairs. + +- Must start with `@class ClassName`. This name becomes a type that can be used in annotations. +- Fields are specified by `@field fieldName type Description...`. + +```cpp +/** + * @class Color + * + * Describes an RGB color value. + * + * @field red number The red value. + * @field green number The green value. + * @field blue number The blue value. + */ + +/** + * @function ColorUtility.LerpColor + * @param from Color + * @param to Color + * @param value number The mix (in range `[0,1]`) of colors to combine. `1` will return `to` and `0` will return `from`. + * @return Color color + */ +``` + +### Table + +A global table can be defined like so: + +```cpp +/** + * @table Spring + */ +``` + +This will define a stub table. For functions that are added to a table, one of these must be defined. The table name should be used in the function name e.g. `@function Spring.MyFunction`. + +A table of constants can also be expressed using `@field`: + +```cpp +/** + * @table CoolNumbers + * @field number Pi + * @field integer SixyNine + * @field integer FourTwenty + */ +``` + +> [!NOTE] +> A table is a global that can be accessed in Lua and not a type like `@class`. + +## Library files + +All files under `Lua/Library/` are available to the IDE. + +The `generated` folder is the result of exporting from cpp. + +If a type is used in multiple files, you can define it in `Lua/Library/Types.lua` (or any other file outside of the `generated`) folder. + +## Generation + +Exporting the library is automated by the [Generate Lua library workflow](.github/workflows/generate-lua-library.yml). You can test it locally by following the same steps locally. + +See doc [README](/doc/site/README.md) for info on doc generation. \ No newline at end of file diff --git a/rts/Lua/LuaBitOps.cpp b/rts/Lua/LuaBitOps.cpp index 5b2a91598b..09e0586f02 100644 --- a/rts/Lua/LuaBitOps.cpp +++ b/rts/Lua/LuaBitOps.cpp @@ -16,7 +16,6 @@ const int mask = 0x00FFFFFF; // 2^24 /****************************************************************************** * math bit extensions - * @module BitOps * * Note: there are no bit shift. Use those Lua functions instead for 24 bits bitshift * 24 bits because only the 24 bits of the mantissa can be easily used in a 32 bit float @@ -58,11 +57,10 @@ static inline unsigned int luaL_checkuint(lua_State* L, int index) /*** Returns the bitwise OR of all arguments. Only use up to 24 bit integers. * * @function math.bit_or - * @number a1 - * @number a2 - * @number[opt] a3 - * @number[opt] an - * @treturn number i + * @param a1 integer + * @param a2 integer + * @param ... integer + * @return integer result */ int LuaBitOps::bit_or(lua_State* L) { @@ -78,11 +76,10 @@ int LuaBitOps::bit_or(lua_State* L) /*** Returns the bitwise AND of all arguments. Only use up to 24 bit integers. * * @function math.bit_and - * @number a1 - * @number a2 - * @number[opt] a3 - * @number[opt] an - * @treturn number i + * @param a1 integer + * @param a2 integer + * @param ... integer + * @return integer result */ int LuaBitOps::bit_and(lua_State* L) { @@ -98,11 +95,10 @@ int LuaBitOps::bit_and(lua_State* L) /*** Returns the bitwise XOR of all arguments. Only use up to 24 bit integers. * * @function math.bit_xor - * @number a1 - * @number a2 - * @number[opt] a3 - * @number[opt] an - * @treturn number i + * @param a1 integer + * @param a2 integer + * @param ... integer + * @return integer result */ int LuaBitOps::bit_xor(lua_State* L) { @@ -118,8 +114,8 @@ int LuaBitOps::bit_xor(lua_State* L) /*** Returns the bitwise NOT of the 24 bit integer argument. * * @function math.bit_inv - * @number a1 - * @treturn number i + * @param value integer + * @return integer result */ int LuaBitOps::bit_inv(lua_State* L) { @@ -132,11 +128,10 @@ int LuaBitOps::bit_inv(lua_State* L) /*** Set each of the bits of a 24 bit integer. Returns result = result OR (1 << a1) OR (1 << a2) OR ...;) * * @function math.bit_bits - * @number a1 - * @number a2 - * @number[opt] a3 - * @number[opt] an - * @treturn number i + * @param a1 integer + * @param a2 integer + * @param ... integer + * @return integer result */ int LuaBitOps::bit_bits(lua_State* L) { diff --git a/rts/Lua/LuaConstCMD.cpp b/rts/Lua/LuaConstCMD.cpp index ee8b82a375..19d1ea0e19 100644 --- a/rts/Lua/LuaConstCMD.cpp +++ b/rts/Lua/LuaConstCMD.cpp @@ -11,73 +11,72 @@ /****************************************************************************** * Command constants - * @module CMD * @see rts/Lua/LuaConstCMD.cpp ******************************************************************************/ -/*** @table CMD - * - * @param FIRESTATE_NONE -1 - * @param MOVESTATE_NONE -1 - * @param STOP 0 - * @param MOVESTATE_HOLDPOS 0 - * @param FIRESTATE_HOLDFIRE 0 - * @param INSERT 1 - * @param MOVESTATE_MANEUVER 1 - * @param FIRESTATE_RETURNFIRE 1 - * @param WAITCODE_TIME 1 - * @param WAITCODE_DEATH 2 - * @param MOVESTATE_ROAM 2 - * @param REMOVE 2 - * @param FIRESTATE_FIREATWILL 2 - * @param FIRESTATE_FIREATNEUTRAL 3 - * @param WAITCODE_SQUAD 3 - * @param OPT_META 4 - * @param WAITCODE_GATHER 4 - * @param WAIT 5 - * @param TIMEWAIT 6 - * @param DEATHWAIT 7 - * @param OPT_INTERNAL 8 - * @param SQUADWAIT 8 - * @param GATHERWAIT 9 - * @param MOVE 10 - * @param PATROL 15 - * @param FIGHT 16 - * @param OPT_RIGHT 16 - * @param LOOPBACKATTACK 20 - * @param ATTACK 20 - * @param AREA_ATTACK 21 - * @param GUARD 25 - * @param OPT_SHIFT 32 - * @param GROUPSELECT 35 - * @param GROUPADD 36 - * @param GROUPCLEAR 37 - * @param REPAIR 40 - * @param FIRE_STATE 45 - * @param MOVE_STATE 50 - * @param SETBASE 55 - * @param INTERNAL 60 - * @param OPT_CTRL 64 - * @param SELFD 65 - * @param SET_WANTED_MAX_SPEED 70 - * @param LOAD_UNITS 75 - * @param LOAD_ONTO 76 - * @param UNLOAD_UNITS 80 - * @param UNLOAD_UNIT 81 - * @param ONOFF 85 - * @param RECLAIM 90 - * @param CLOAK 95 - * @param STOCKPILE 100 - * @param MANUALFIRE 105 - * @param DGUN 105 - * @param RESTORE 110 - * @param REPEAT 115 - * @param TRAJECTORY 120 - * @param RESURRECT 125 - * @param OPT_ALT 128 - * @param CAPTURE 130 - * @param AUTOREPAIRLEVEL 135 - * @param IDLEMODE 145 +/*** + * @enum CMD + * @field FIRESTATE_NONE -1 + * @field MOVESTATE_NONE -1 + * @field STOP 0 + * @field MOVESTATE_HOLDPOS 0 + * @field FIRESTATE_HOLDFIRE 0 + * @field INSERT 1 + * @field MOVESTATE_MANEUVER 1 + * @field FIRESTATE_RETURNFIRE 1 + * @field WAITCODE_TIME 1 + * @field WAITCODE_DEATH 2 + * @field MOVESTATE_ROAM 2 + * @field REMOVE 2 + * @field FIRESTATE_FIREATWILL 2 + * @field FIRESTATE_FIREATNEUTRAL 3 + * @field WAITCODE_SQUAD 3 + * @field OPT_META 4 + * @field WAITCODE_GATHER 4 + * @field WAIT 5 + * @field TIMEWAIT 6 + * @field DEATHWAIT 7 + * @field OPT_INTERNAL 8 + * @field SQUADWAIT 8 + * @field GATHERWAIT 9 + * @field MOVE 10 + * @field PATROL 15 + * @field FIGHT 16 + * @field OPT_RIGHT 16 + * @field LOOPBACKATTACK 20 + * @field ATTACK 20 + * @field AREA_ATTACK 21 + * @field GUARD 25 + * @field OPT_SHIFT 32 + * @field GROUPSELECT 35 + * @field GROUPADD 36 + * @field GROUPCLEAR 37 + * @field REPAIR 40 + * @field FIRE_STATE 45 + * @field MOVE_STATE 50 + * @field SETBASE 55 + * @field INTERNAL 60 + * @field OPT_CTRL 64 + * @field SELFD 65 + * @field SET_WANTED_MAX_SPEED 70 + * @field LOAD_UNITS 75 + * @field LOAD_ONTO 76 + * @field UNLOAD_UNITS 80 + * @field UNLOAD_UNIT 81 + * @field ONOFF 85 + * @field RECLAIM 90 + * @field CLOAK 95 + * @field STOCKPILE 100 + * @field MANUALFIRE 105 + * @field DGUN 105 + * @field RESTORE 110 + * @field REPEAT 115 + * @field TRAJECTORY 120 + * @field RESURRECT 125 + * @field OPT_ALT 128 + * @field CAPTURE 130 + * @field AUTOREPAIRLEVEL 135 + * @field IDLEMODE 145 */ diff --git a/rts/Lua/LuaConstCMDTYPE.cpp b/rts/Lua/LuaConstCMDTYPE.cpp index 5fbcff5689..372558a9b6 100644 --- a/rts/Lua/LuaConstCMDTYPE.cpp +++ b/rts/Lua/LuaConstCMDTYPE.cpp @@ -11,29 +11,28 @@ /****************************************************************************** * Command type constants - * @module CMDTYPE * @see rts/Lua/LuaConstCMDTYPE.cpp ******************************************************************************/ /*** Note, the CMDTYPE[] table is bidirectional. That means: CMDTYPE[CMDTYPE.ICON] := "CMDTYPE_ICON" * - * @table CMDTYPE - * @number ICON expect 0 parameters in return - * @number ICON_MODE expect 1 parameter in return (number selected mode) - * @number ICON_MAP expect 3 parameters in return (mappos) - * @number ICON_AREA expect 4 parameters in return (mappos+radius) - * @number ICON_UNIT expect 1 parameters in return (unitid) - * @number ICON_UNIT_OR_MAP expect 1 parameters in return (unitid) or 3 parameters in return (mappos) - * @number ICON_FRONT expect 3 or 6 parameters in return (middle and right side of front if a front was defined) - * @number COMBO_BOX expect 1 parameter in return (number selected option) - * @number ICON_UNIT_OR_AREA expect 1 parameter in return (unitid) or 4 parameters in return (mappos+radius) - * @number ICON_UNIT_FEATURE_OR_AREA expect 1 parameter in return (unitid or Game.maxUnits+featureid) or 4 parameters in return (mappos+radius) - * @number ICON_BUILDING expect 3 parameters in return (mappos) - * @number ICON_UNIT_OR_RECTANGLE expect 1 parameter in return (unitid) or 3 parameters in return (mappos) or 6 parameters in return (startpos+endpos) - * @number NUMBER expect 1 parameter in return (number) - * @number CUSTOM used with CMD_INTERNAL - * @number NEXT next command page used with CMD_INTERNAL - * @number PREV previous command page used with CMD_INTERNAL + * @enum CMDTYPE + * @field ICON number expect 0 parameters in return + * @field ICON_MODE number expect 1 parameter in return (number selected mode) + * @field ICON_MAP number expect 3 parameters in return (mappos) + * @field ICON_AREA number expect 4 parameters in return (mappos+radius) + * @field ICON_UNIT number expect 1 parameters in return (unitid) + * @field ICON_UNIT_OR_MAP number expect 1 parameters in return (unitid) or 3 parameters in return (mappos) + * @field ICON_FRONT number expect 3 or 6 parameters in return (middle and right side of front if a front was defined) + * @field COMBO_BOX number expect 1 parameter in return (number selected option) + * @field ICON_UNIT_OR_AREA number expect 1 parameter in return (unitid) or 4 parameters in return (mappos+radius) + * @field ICON_UNIT_FEATURE_OR_AREA number expect 1 parameter in return (unitid or Game.maxUnits+featureid) or 4 parameters in return (mappos+radius) + * @field ICON_BUILDING number expect 3 parameters in return (mappos) + * @field ICON_UNIT_OR_RECTANGLE number expect 1 parameter in return (unitid) or 3 parameters in return (mappos) or 6 parameters in return (startpos+endpos) + * @field NUMBER number expect 1 parameter in return (number) + * @field CUSTOM number used with CMD_INTERNAL + * @field NEXT number next command page used with CMD_INTERNAL + * @field PREV number previous command page used with CMD_INTERNAL */ bool LuaConstCMDTYPE::PushEntries(lua_State* L) diff --git a/rts/Lua/LuaConstCOB.cpp b/rts/Lua/LuaConstCOB.cpp index a919edc4c3..4078329b56 100644 --- a/rts/Lua/LuaConstCOB.cpp +++ b/rts/Lua/LuaConstCOB.cpp @@ -11,7 +11,6 @@ /****************************************************************************** * COB constants - * @module COB * @see rts/Lua/LuaConstCOB.cpp ******************************************************************************/ @@ -20,85 +19,85 @@ bool LuaConstCOB::PushEntries(lua_State* L) { #define PUSH_COB(cmd) LuaPushNamedNumber(L, #cmd, cmd) - /*** @table COB - * - * @number ACTIVATION - * @number STANDINGMOVEORDERS - * @number STANDINGFIREORDERS - * @number HEALTH - * @number INBUILDSTANCE - * @number BUSY - * @number PIECE_XZ - * @number PIECE_Y - * @number UNIT_XZ - * @number UNIT_Y - * @number UNIT_HEIGHT - * @number XZ_ATAN - * @number XZ_HYPOT - * @number ATAN - * @number HYPOT - * @number GROUND_HEIGHT - * @number BUILD_PERCENT_LEFT - * @number YARD_OPEN - * @number BUGGER_OFF - * @number ARMORED - * @number IN_WATER - * @number CURRENT_SPEED - * @number VETERAN_LEVEL - * @number ON_ROAD - * @number MAX_ID - * @number MY_ID - * @number UNIT_TEAM - * @number UNIT_BUILD_PERCENT_LEFT - * @number UNIT_ALLIED - * @number MAX_SPEED - * @number CLOAKED - * @number WANT_CLOAK - * @number GROUND_WATER_HEIGHT - * @number UPRIGHT - * @number POW - * @number PRINT - * @number HEADING - * @number TARGET_ID - * @number LAST_ATTACKER_ID - * @number LOS_RADIUS - * @number AIR_LOS_RADIUS - * @number RADAR_RADIUS - * @number JAMMER_RADIUS - * @number SONAR_RADIUS - * @number SONAR_JAM_RADIUS - * @number SEISMIC_RADIUS - * @number DO_SEISMIC_PING - * @number CURRENT_FUEL - * @number TRANSPORT_ID - * @number SHIELD_POWER - * @number STEALTH - * @number CRASHING - * @number CHANGE_TARGET - * @number CEG_DAMAGE - * @number COB_ID - * @number PLAY_SOUND - * @number KILL_UNIT - * @number ALPHA_THRESHOLD - * @number SET_WEAPON_UNIT_TARGET - * @number SET_WEAPON_GROUND_TARGET - * @number SONAR_STEALTH - * @number REVERSING - * @number FLANK_B_MODE - * @number FLANK_B_DIR - * @number FLANK_B_MOBILITY_ADD - * @number FLANK_B_MAX_DAMAGE - * @number FLANK_B_MIN_DAMAGE - * @number WEAPON_RELOADSTATE - * @number WEAPON_RELOADTIME - * @number WEAPON_ACCURACY - * @number WEAPON_SPRAY - * @number WEAPON_RANGE - * @number WEAPON_PROJECTILE_SPEED - * @number MIN - * @number MAX - * @number ABS - * @number GAME_FRAME + /*** + * @enum COB + * @field ACTIVATION number + * @field STANDINGMOVEORDERS number + * @field STANDINGFIREORDERS number + * @field HEALTH number + * @field INBUILDSTANCE number + * @field BUSY number + * @field PIECE_XZ number + * @field PIECE_Y number + * @field UNIT_XZ number + * @field UNIT_Y number + * @field UNIT_HEIGHT number + * @field XZ_ATAN number + * @field XZ_HYPOT number + * @field ATAN number + * @field HYPOT number + * @field GROUND_HEIGHT number + * @field BUILD_PERCENT_LEFT number + * @field YARD_OPEN number + * @field BUGGER_OFF number + * @field ARMORED number + * @field IN_WATER number + * @field CURRENT_SPEED number + * @field VETERAN_LEVEL number + * @field ON_ROAD number + * @field MAX_ID number + * @field MY_ID number + * @field UNIT_TEAM number + * @field UNIT_BUILD_PERCENT_LEFT number + * @field UNIT_ALLIED number + * @field MAX_SPEED number + * @field CLOAKED number + * @field WANT_CLOAK number + * @field GROUND_WATER_HEIGHT number + * @field UPRIGHT number + * @field POW number + * @field PRINT number + * @field HEADING number + * @field TARGET_ID number + * @field LAST_ATTACKER_ID number + * @field LOS_RADIUS number + * @field AIR_LOS_RADIUS number + * @field RADAR_RADIUS number + * @field JAMMER_RADIUS number + * @field SONAR_RADIUS number + * @field SONAR_JAM_RADIUS number + * @field SEISMIC_RADIUS number + * @field DO_SEISMIC_PING number + * @field CURRENT_FUEL number + * @field TRANSPORT_ID number + * @field SHIELD_POWER number + * @field STEALTH number + * @field CRASHING number + * @field CHANGE_TARGET number + * @field CEG_DAMAGE number + * @field COB_ID number + * @field PLAY_SOUND number + * @field KILL_UNIT number + * @field ALPHA_THRESHOLD number + * @field SET_WEAPON_UNIT_TARGET number + * @field SET_WEAPON_GROUND_TARGET number + * @field SONAR_STEALTH number + * @field REVERSING number + * @field FLANK_B_MODE number + * @field FLANK_B_DIR number + * @field FLANK_B_MOBILITY_ADD number + * @field FLANK_B_MAX_DAMAGE number + * @field FLANK_B_MIN_DAMAGE number + * @field WEAPON_RELOADSTATE number + * @field WEAPON_RELOADTIME number + * @field WEAPON_ACCURACY number + * @field WEAPON_SPRAY number + * @field WEAPON_RANGE number + * @field WEAPON_PROJECTILE_SPEED number + * @field MIN number + * @field MAX number + * @field ABS number + * @field GAME_FRAME number */ PUSH_COB(ACTIVATION); @@ -201,20 +200,68 @@ bool LuaConstCOB::PushEntries(lua_State* L) bool LuaConstSFX::PushEntries(lua_State* L) { - /*** Piece Flags for Spring.UnitScript.Explode - * - * @table SFX - * - * @number SHATTER - * @number EXPLODE - * @number EXPLODE_ON_HIT - * @number FALL - * @number SMOKE - * @number FIRE - * @number NONE - * @number NO_CEG_TRAIL - * @number NO_HEATCLOUD - * @number RECURSIVE + /*** + * @enum SFX + * + * @field SHATTER number + * Piece Flag for `Spring.UnitScript.Explode` + * + * @field EXPLODE number + * Piece Flag for `Spring.UnitScript.Explode` + * + * @field EXPLODE_ON_HIT number + * Piece Flag for `Spring.UnitScript.Explode` + * + * @field FALL number + * Piece Flag for `Spring.UnitScript.Explode` + * + * @field SMOKE number + * Piece Flag for `Spring.UnitScript.Explode` + * + * @field FIRE number + * Piece Flag for `Spring.UnitScript.Explode` + * + * @field NONE number + * Piece Flag for `Spring.UnitScript.Explode` + * + * @field NO_CEG_TRAIL number + * Piece Flag for `Spring.UnitScript.Explode` + * + * @field NO_HEATCLOUD number + * Piece Flag for `Spring.UnitScript.Explode` + * + * @field RECURSIVE number + * Piece Flag for `Spring.UnitScript.Explode` + * + * @field VTOL number + * For `Spring.UnitScript.EmitSfx`. + * + * @field WAKE number + * For `Spring.UnitScript.EmitSfx`. + * + * @field REVERSE_WAKE number + * For `Spring.UnitScript.EmitSfx`. + * + * @field WHITE_SMOKE number + * For `Spring.UnitScript.EmitSfx`. + * + * @field BLACK_SMOKE number + * For `Spring.UnitScript.EmitSfx`. + * + * @field BUBBLE number + * For `Spring.UnitScript.EmitSfx`. + * + * @field CEG number + * For `Spring.UnitScript.EmitSfx`. + * + * @field FIRE_WEAPON number + * For `Spring.UnitScript.EmitSfx`. + * + * @field DETONATE_WEAPON number + * For `Spring.UnitScript.EmitSfx`. + * + * @field GLOBAL number + * For `Spring.UnitScript.EmitSfx`. */ LuaPushNamedNumber(L, "SHATTER", PF_Shatter); LuaPushNamedNumber(L, "EXPLODE", PF_Explode); @@ -227,21 +274,6 @@ bool LuaConstSFX::PushEntries(lua_State* L) LuaPushNamedNumber(L, "NO_HEATCLOUD", PF_NoHeatCloud); LuaPushNamedNumber(L, "RECURSIVE", PF_Recursive); - /*** For Spring.UnitScript.EmitSfx - * - * @table SFX - * - * @number VTOL - * @number WAKE - * @number REVERSE_WAKE - * @number WHITE_SMOKE - * @number BLACK_SMOKE - * @number BUBBLE - * @number CEG - * @number FIRE_WEAPON - * @number DETONATE_WEAPON - * @number GLOBAL - */ LuaPushNamedNumber(L, "VTOL", SFX_VTOL); LuaPushNamedNumber(L, "WAKE", SFX_WAKE); LuaPushNamedNumber(L, "REVERSE_WAKE", SFX_REVERSE_WAKE); diff --git a/rts/Lua/LuaConstEngine.cpp b/rts/Lua/LuaConstEngine.cpp index f0a47d5937..89d6b14ded 100644 --- a/rts/Lua/LuaConstEngine.cpp +++ b/rts/Lua/LuaConstEngine.cpp @@ -8,19 +8,25 @@ /****************************************************************************** * Engine constants - * @module Engine * @see rts/Lua/LuaConstEngine.cpp ******************************************************************************/ -/*** Engine specific information +/*** + * @class FeatureSupport + * @field hasExitOnlyYardmaps boolean + * @field rmlUiApiVersion integer + */ + +/*** + * Engine specific information. * * @table Engine - * @string version Returns the same as `spring *sync-version`, e.g. "92" - * @string versionFull - * @string versionPatchSet - * @string buildFlags (unsynced only) Gets additional engine buildflags, e.g. "OMP" or "MT-Sim DEBUG" - * @string FeatureSupport table containing various engine features as keys; use for cross-version compat - * @number wordSize indicates the build type and is either 32 or 64 (or 0 in synced code) + * @field version string Returns the same as `spring *sync-version`, e.g. "92" + * @field versionFull string + * @field versionPatchSet string + * @field buildFlags string (unsynced only) Gets additional engine buildflags, e.g. "OMP" or "MT-Sim DEBUG" + * @field FeatureSupport FeatureSupport table containing various engine features as keys; use for cross-version compat + * @field wordSize number indicates the build type and is either 32 or 64 (or 0 in synced code) */ bool LuaConstEngine::PushEntries(lua_State* L) diff --git a/rts/Lua/LuaConstGL.cpp b/rts/Lua/LuaConstGL.cpp index 2b24bc1252..495947b744 100644 --- a/rts/Lua/LuaConstGL.cpp +++ b/rts/Lua/LuaConstGL.cpp @@ -11,7 +11,6 @@ /****************************************************************************** * OpenGL Constants - * @module GL * @see rts/Lua/LuaConstGL.cpp ******************************************************************************/ @@ -24,19 +23,20 @@ bool LuaConstGL::PushEntries(lua_State* L) * @section primitives */ - /*** @table GL + /*** + * @enum GL * - * @number POINTS - * @number LINES - * @number LINE_LOOP - * @number LINE_STRIP - * @number TRIANGLES - * @number TRIANGLE_STRIP - * @number TRIANGLE_FAN - * @number QUADS - * @number QUAD_STRIP - * @number POLYGON - * @number PATCHES + * @field POINTS number + * @field LINES number + * @field LINE_LOOP number + * @field LINE_STRIP number + * @field TRIANGLES number + * @field TRIANGLE_STRIP number + * @field TRIANGLE_FAN number + * @field QUADS number + * @field QUAD_STRIP number + * @field POLYGON number + * @field PATCHES number */ PUSH_GL(POINTS); PUSH_GL(LINES); @@ -62,14 +62,14 @@ bool LuaConstGL::PushEntries(lua_State* L) /*** @table GL * - * @number ZERO - * @number ONE - * @number SRC_COLOR - * @number ONE_MINUS_SRC_COLOR - * @number SRC_ALPHA - * @number ONE_MINUS_SRC_ALPHA - * @number DST_ALPHA - * @number ONE_MINUS_DST_ALPHA + * @field ZERO number + * @field ONE number + * @field SRC_COLOR number + * @field ONE_MINUS_SRC_COLOR number + * @field SRC_ALPHA number + * @field ONE_MINUS_SRC_ALPHA number + * @field DST_ALPHA number + * @field ONE_MINUS_DST_ALPHA number */ PUSH_GL(ZERO); PUSH_GL(ONE); @@ -87,22 +87,22 @@ bool LuaConstGL::PushEntries(lua_State* L) /*** * @table GL - * @number ZERO - * @number ONE - * @number SRC_COLOR - * @number ONE_MINUS_SRC_COLOR - * @number SRC_ALPHA - * @number ONE_MINUS_SRC_ALPHA - * @number DST_ALPHA - * @number ONE_MINUS_DST_ALPHA - * @number DST_COLOR - * @number ONE_MINUS_DST_COLOR - * @number SRC_ALPHA_SATURATE - * @number FUNC_ADD - * @number FUNC_SUBTRACT - * @number FUNC_REVERSE_SUBTRACT - * @number MIN - * @number MAX + * @field ZERO number + * @field ONE number + * @field SRC_COLOR number + * @field ONE_MINUS_SRC_COLOR number + * @field SRC_ALPHA number + * @field ONE_MINUS_SRC_ALPHA number + * @field DST_ALPHA number + * @field ONE_MINUS_DST_ALPHA number + * @field DST_COLOR number + * @field ONE_MINUS_DST_COLOR number + * @field SRC_ALPHA_SATURATE number + * @field FUNC_ADD number + * @field FUNC_SUBTRACT number + * @field FUNC_REVERSE_SUBTRACT number + * @field MIN number + * @field MAX number */ PUSH_GL(DST_COLOR); PUSH_GL(ONE_MINUS_DST_COLOR); @@ -121,14 +121,14 @@ bool LuaConstGL::PushEntries(lua_State* L) /*** @table GL * - * @number NEVER - * @number LESS - * @number EQUAL - * @number LEQUAL - * @number GREATER - * @number NOTEQUAL - * @number GEQUAL - * @number ALWAYS + * @field NEVER number + * @field LESS number + * @field EQUAL number + * @field LEQUAL number + * @field GREATER number + * @field NOTEQUAL number + * @field GEQUAL number + * @field ALWAYS number */ PUSH_GL(NEVER); PUSH_GL(LESS); @@ -146,22 +146,22 @@ bool LuaConstGL::PushEntries(lua_State* L) /*** * @table GL - * @number CLEAR - * @number AND - * @number AND_REVERSE - * @number COPY - * @number AND_INVERTED - * @number NOOP - * @number XOR - * @number OR - * @number NOR - * @number EQUIV - * @number INVERT - * @number OR_REVERSE - * @number COPY_INVERTED - * @number OR_INVERTED - * @number NAND - * @number SET + * @field CLEAR number + * @field AND number + * @field AND_REVERSE number + * @field COPY number + * @field AND_INVERTED number + * @field NOOP number + * @field XOR number + * @field OR number + * @field NOR number + * @field EQUIV number + * @field INVERT number + * @field OR_REVERSE number + * @field COPY_INVERTED number + * @field OR_INVERTED number + * @field NAND number + * @field SET number */ PUSH_GL(CLEAR); PUSH_GL(AND); @@ -187,9 +187,9 @@ bool LuaConstGL::PushEntries(lua_State* L) /*** * @table GL - * @number BACK - * @number FRONT - * @number FRONT_AND_BACK + * @field BACK number + * @field FRONT number + * @field FRONT_AND_BACK number */ PUSH_GL(BACK); PUSH_GL(FRONT); @@ -202,9 +202,9 @@ bool LuaConstGL::PushEntries(lua_State* L) /*** * @table GL - * @number POINT - * @number LINE - * @number FILL + * @field POINT number + * @field LINE number + * @field FILL number */ PUSH_GL(POINT); PUSH_GL(LINE); @@ -217,10 +217,10 @@ bool LuaConstGL::PushEntries(lua_State* L) /*** * @table GL - * @number DEPTH_BUFFER_BIT - * @number ACCUM_BUFFER_BIT - * @number STENCIL_BUFFER_BIT - * @number COLOR_BUFFER_BIT + * @field DEPTH_BUFFER_BIT number + * @field ACCUM_BUFFER_BIT number + * @field STENCIL_BUFFER_BIT number + * @field COLOR_BUFFER_BIT number */ PUSH_GL(DEPTH_BUFFER_BIT); PUSH_GL(ACCUM_BUFFER_BIT); @@ -234,8 +234,8 @@ bool LuaConstGL::PushEntries(lua_State* L) /*** * @table GL - * @number FLAT - * @number SMOOTH + * @field FLAT number + * @field SMOOTH number */ PUSH_GL(FLAT); PUSH_GL(SMOOTH); @@ -247,9 +247,9 @@ bool LuaConstGL::PushEntries(lua_State* L) /*** * @table GL - * @number MODELVIEW - * @number PROJECTION - * @number TEXTURE + * @field MODELVIEW number + * @field PROJECTION number + * @field TEXTURE number */ PUSH_GL(MODELVIEW); PUSH_GL(PROJECTION); @@ -262,12 +262,12 @@ bool LuaConstGL::PushEntries(lua_State* L) /*** * @table GL - * @number NEAREST - * @number LINEAR - * @number NEAREST_MIPMAP_NEAREST - * @number LINEAR_MIPMAP_NEAREST - * @number NEAREST_MIPMAP_LINEAR - * @number LINEAR_MIPMAP_LINEAR + * @field NEAREST number + * @field LINEAR number + * @field NEAREST_MIPMAP_NEAREST number + * @field LINEAR_MIPMAP_NEAREST number + * @field NEAREST_MIPMAP_LINEAR number + * @field LINEAR_MIPMAP_LINEAR number */ PUSH_GL(NEAREST); PUSH_GL(LINEAR); @@ -283,11 +283,11 @@ bool LuaConstGL::PushEntries(lua_State* L) /*** * @table GL - * @number REPEAT - * @number MIRRORED_REPEAT - * @number CLAMP - * @number CLAMP_TO_EDGE - * @number CLAMP_TO_BORDER + * @field REPEAT number + * @field MIRRORED_REPEAT number + * @field CLAMP number + * @field CLAMP_TO_EDGE number + * @field CLAMP_TO_BORDER number */ PUSH_GL(REPEAT); PUSH_GL(MIRRORED_REPEAT); @@ -302,13 +302,13 @@ bool LuaConstGL::PushEntries(lua_State* L) /*** * @table GL - * @number TEXTURE_ENV - * @number TEXTURE_ENV_MODE - * @number TEXTURE_ENV_COLOR - * @number MODULATE - * @number DECAL - * @number BLEND - * @number REPLACE + * @field TEXTURE_ENV number + * @field TEXTURE_ENV_MODE number + * @field TEXTURE_ENV_COLOR number + * @field MODULATE number + * @field DECAL number + * @field BLEND number + * @field REPLACE number */ PUSH_GL(TEXTURE_ENV); PUSH_GL(TEXTURE_ENV_MODE); @@ -330,18 +330,18 @@ bool LuaConstGL::PushEntries(lua_State* L) /*** * @table GL - * @number TEXTURE_GEN_MODE - * @number EYE_PLANE - * @number OBJECT_PLANE - * @number EYE_LINEAR - * @number OBJECT_LINEAR - * @number SPHERE_MAP - * @number NORMAL_MAP - * @number REFLECTION_MAP - * @number S - * @number T - * @number R - * @number Q + * @field TEXTURE_GEN_MODE number + * @field EYE_PLANE number + * @field OBJECT_PLANE number + * @field EYE_LINEAR number + * @field OBJECT_LINEAR number + * @field SPHERE_MAP number + * @field NORMAL_MAP number + * @field REFLECTION_MAP number + * @field S number + * @field T number + * @field R number + * @field Q number */ PUSH_GL(TEXTURE_GEN_MODE); PUSH_GL(EYE_PLANE); @@ -363,27 +363,27 @@ bool LuaConstGL::PushEntries(lua_State* L) /*** * @table GL - * @number CURRENT_BIT - * @number POINT_BIT - * @number LINE_BIT - * @number POLYGON_BIT - * @number POLYGON_STIPPLE_BIT - * @number PIXEL_MODE_BIT - * @number LIGHTING_BIT - * @number FOG_BIT - * @number DEPTH_BUFFER_BIT - * @number ACCUM_BUFFER_BIT - * @number STENCIL_BUFFER_BIT - * @number VIEWPORT_BIT - * @number TRANSFORM_BIT - * @number ENABLE_BIT - * @number COLOR_BUFFER_BIT - * @number HINT_BIT - * @number EVAL_BIT - * @number LIST_BIT - * @number TEXTURE_BIT - * @number SCISSOR_BIT - * @number ALL_ATTRIB_BITS + * @field CURRENT_BIT number + * @field POINT_BIT number + * @field LINE_BIT number + * @field POLYGON_BIT number + * @field POLYGON_STIPPLE_BIT number + * @field PIXEL_MODE_BIT number + * @field LIGHTING_BIT number + * @field FOG_BIT number + * @field DEPTH_BUFFER_BIT number + * @field ACCUM_BUFFER_BIT number + * @field STENCIL_BUFFER_BIT number + * @field VIEWPORT_BIT number + * @field TRANSFORM_BIT number + * @field ENABLE_BIT number + * @field COLOR_BUFFER_BIT number + * @field HINT_BIT number + * @field EVAL_BIT number + * @field LIST_BIT number + * @field TEXTURE_BIT number + * @field SCISSOR_BIT number + * @field ALL_ATTRIB_BITS number */ PUSH_GL(CURRENT_BIT); PUSH_GL(POINT_BIT); @@ -415,11 +415,11 @@ bool LuaConstGL::PushEntries(lua_State* L) /*** * @table GL - * @number FOG_HINT - * @number LINE_SMOOTH_HINT - * @number POINT_SMOOTH_HINT - * @number POLYGON_SMOOTH_HINT - * @number PERSPECTIVE_CORRECTION_HINT + * @field FOG_HINT number + * @field LINE_SMOOTH_HINT number + * @field POINT_SMOOTH_HINT number + * @field POLYGON_SMOOTH_HINT number + * @field PERSPECTIVE_CORRECTION_HINT number */ PUSH_GL(FOG_HINT); PUSH_GL(PERSPECTIVE_CORRECTION_HINT); @@ -431,9 +431,9 @@ bool LuaConstGL::PushEntries(lua_State* L) /*** * @table GL - * @number DONT_CARE - * @number FASTEST - * @number NICEST + * @field DONT_CARE number + * @field FASTEST number + * @field NICEST number */ PUSH_GL(DONT_CARE); PUSH_GL(FASTEST); @@ -446,16 +446,16 @@ bool LuaConstGL::PushEntries(lua_State* L) /*** * @table GL - * @number AMBIENT - * @number DIFFUSE - * @number SPECULAR - * @number POSITION - * @number SPOT_DIRECTION - * @number SPOT_EXPONENT - * @number SPOT_CUTOFF - * @number CONSTANT_ATTENUATION - * @number LINEAR_ATTENUATION - * @number QUADRATIC_ATTENUATION + * @field AMBIENT number + * @field DIFFUSE number + * @field SPECULAR number + * @field POSITION number + * @field SPOT_DIRECTION number + * @field SPOT_EXPONENT number + * @field SPOT_CUTOFF number + * @field CONSTANT_ATTENUATION number + * @field LINEAR_ATTENUATION number + * @field QUADRATIC_ATTENUATION number */ PUSH_GL(AMBIENT); PUSH_GL(DIFFUSE); @@ -475,11 +475,11 @@ bool LuaConstGL::PushEntries(lua_State* L) /*** * @table GL - * @number VERTEX_SHADER - * @number TESS_CONTROL_SHADER - * @number TESS_EVALUATION_SHADER - * @number GEOMETRY_SHADER - * @number FRAGMENT_SHADER + * @field VERTEX_SHADER number + * @field TESS_CONTROL_SHADER number + * @field TESS_EVALUATION_SHADER number + * @field GEOMETRY_SHADER number + * @field FRAGMENT_SHADER number */ PUSH_GL(VERTEX_SHADER); PUSH_GL(TESS_CONTROL_SHADER); @@ -494,9 +494,9 @@ bool LuaConstGL::PushEntries(lua_State* L) /*** * @table GL - * @number GEOMETRY_INPUT_TYPE - * @number GEOMETRY_OUTPUT_TYPE - * @number GEOMETRY_VERTICES_OUT + * @field GEOMETRY_INPUT_TYPE number + * @field GEOMETRY_OUTPUT_TYPE number + * @field GEOMETRY_VERTICES_OUT number */ PUSH_GL(GEOMETRY_INPUT_TYPE_EXT); PUSH_GL(GEOMETRY_OUTPUT_TYPE_EXT); @@ -509,9 +509,9 @@ bool LuaConstGL::PushEntries(lua_State* L) /*** * @table GL - * @number PATCH_VERTICES - * @number PATCH_DEFAULT_OUTER_LEVEL - * @number PATCH_DEFAULT_INNER_LEVEL + * @field PATCH_VERTICES number + * @field PATCH_DEFAULT_OUTER_LEVEL number + * @field PATCH_DEFAULT_INNER_LEVEL number */ PUSH_GL(PATCH_VERTICES); PUSH_GL(PATCH_DEFAULT_OUTER_LEVEL); @@ -524,17 +524,17 @@ bool LuaConstGL::PushEntries(lua_State* L) /*** * @table GL - * @number BYTE - * @number UNSIGNED_BYTE - * @number SHORT - * @number UNSIGNED_SHORT - * @number INT - * @number UNSIGNED_INT - * @number FLOAT - * @number FLOAT_VEC4 - * @number INT_VEC4 - * @number UNSIGNED_INT_VEC4 - * @number FLOAT_MAT4 + * @field BYTE number + * @field UNSIGNED_BYTE number + * @field SHORT number + * @field UNSIGNED_SHORT number + * @field INT number + * @field UNSIGNED_INT number + * @field FLOAT number + * @field FLOAT_VEC4 number + * @field INT_VEC4 number + * @field UNSIGNED_INT_VEC4 number + * @field FLOAT_MAT4 number */ PUSH_GL(BYTE); PUSH_GL(UNSIGNED_BYTE); @@ -555,10 +555,10 @@ bool LuaConstGL::PushEntries(lua_State* L) /*** * @table GL - * @number ELEMENT_ARRAY_BUFFER - * @number ARRAY_BUFFER - * @number UNIFORM_BUFFER - * @number SHADER_STORAGE_BUFFER + * @field ELEMENT_ARRAY_BUFFER number + * @field ARRAY_BUFFER number + * @field UNIFORM_BUFFER number + * @field SHADER_STORAGE_BUFFER number * */ PUSH_GL(ELEMENT_ARRAY_BUFFER); diff --git a/rts/Lua/LuaConstGame.cpp b/rts/Lua/LuaConstGame.cpp index f9851eb4df..52fa02d1ab 100644 --- a/rts/Lua/LuaConstGame.cpp +++ b/rts/Lua/LuaConstGame.cpp @@ -25,65 +25,65 @@ /****************************************************************************** * Game constants - * @module Game * @see rts/Lua/LuaConstGame.cpp ******************************************************************************/ /*** Game specific information * * @table Game - * @number maxUnits - * @number maxTeams - * @number maxPlayers - * @number squareSize Divide Game.mapSizeX or Game.mapSizeZ by this to get engine's "mapDims" coordinates. The resolution of height, yard and type maps. - * @number metalMapSquareSize The resolution of metalmap (for use in API such as Spring.GetMetalAmount etc.) - * @number gameSpeed - * @number startPosType - * @bool ghostedBuildings - * @string mapChecksum - * @string modChecksum - * @bool mapDamage - * @string mapName - * @string mapDescription = string Game.mapHumanName - * @number mapHardness - * @number mapX - * @number mapY - * @number mapSizeX in worldspace/opengl coords. Divide by Game.squareSize to get engine's "mapDims" coordinates - * @number mapSizeZ in worldspace/opengl coords. Divide by Game.squareSize to get engine's "mapDims" coordinates - * @number gravity - * @number tidal - * @number windMin - * @number windMax - * @number extractorRadius - * @number waterDamage - * @tparam table envDamageTypes Containing {def}IDs of environmental-damage sources - * @string gameName - * @string gameShortName - * @string gameVersion - * @string gameMutator - * @string gameDesc - * @bool requireSonarUnderWater - * @number transportAir - * @number transportShip - * @number transportHover - * @number transportGround - * @number fireAtKilled - * @number fireAtCrashing - * @bool constructionDecay - * @bool reclaimAllowEnemies - * @bool reclaimAllowAllies - * @number constructionDecayTime - * @number constructionDecaySpeed - * @number multiReclaim - * @number reclaimMethod - * @number reclaimUnitMethod - * @number reclaimUnitEnergyCostFactor - * @number reclaimUnitEfficiency - * @number reclaimFeatureEnergyCostFactor - * @number repairEnergyCostFactor - * @number resurrectEnergyCostFactor - * @number captureEnergyCostFactor - * @tparam table springCategories + * @field maxUnits number + * @field maxTeams number + * @field maxPlayers number + * @field squareSize number Divide Game.mapSizeX or Game.mapSizeZ by this to get engine's "mapDims" coordinates. The resolution of height, yard and type maps. + * @field metalMapSquareSize number The resolution of metalmap (for use in API such as Spring.GetMetalAmount etc.) + * @field gameSpeed number + * @field startPosType number + * @field ghostedBuildings boolean + * @field mapChecksum string + * @field modChecksum string + * @field mapDamage boolean + * @field mapName string + * @field mapDescription string = string Game.mapHumanName + * @field mapHardness number + * @field mapX number + * @field mapY number + * @field mapSizeX number in worldspace/opengl coords. Divide by Game.squareSize to get engine's "mapDims" coordinates + * @field mapSizeZ number in worldspace/opengl coords. Divide by Game.squareSize to get engine's "mapDims" coordinates + * @field gravity number + * @field tidal number + * @field windMin number + * @field windMax number + * @field extractorRadius number + * @field waterDamage number + * @field envDamageTypes table Containing {def}IDs of environmental-damage sources + * @field gameName string + * @field gameShortName string + * @field gameVersion string + * @field gameMutator string + * @field gameDesc string + * @field requireSonarUnderWater boolean + * @field transportAir number + * @field transportShip number + * @field transportHover number + * @field transportGround number + * @field fireAtKilled number + * @field fireAtCrashing number + * @field constructionDecay boolean + * @field reclaimAllowEnemies boolean + * @field reclaimAllowAllies boolean + * @field constructionDecayTime number + * @field constructionDecaySpeed number + * @field multiReclaim number + * @field reclaimMethod number + * @field reclaimUnitMethod number + * @field reclaimUnitEnergyCostFactor number + * @field reclaimUnitEfficiency number + * @field reclaimFeatureEnergyCostFactor number + * @field repairEnergyCostFactor number + * @field resurrectEnergyCostFactor number + * @field captureEnergyCostFactor number + * @field springCategories table + * ```lua * example: { * ["vtol"] = 0, ["special"] = 1, ["noweapon"] = 2, * ["notair"] = 3, ["notsub"] = 4, ["all"] = 5, @@ -97,7 +97,9 @@ * ["kamikaze"] = 27, ["minelayer"] = 28, ["notstructure"] = 29, * ["air"] = 30 * } - * @tparam table armorTypes (bidirectional) + * ``` + * @field armorTypes table (bidirectional) + * ```lua * example: { * [1] = amphibious, [2] = anniddm, [3] = antibomber, * [4] = antifighter, [5] = antiraider, [6] = atl, @@ -109,6 +111,7 @@ * ["blackhydra"] = 7, ["bombers"] = 8, ["commanders"] = 9 * ["crawlingbombs"]= 10, ... * } + * ``` */ bool LuaConstGame::PushEntries(lua_State* L) diff --git a/rts/Lua/LuaConstPlatform.cpp b/rts/Lua/LuaConstPlatform.cpp index 7f897c0c68..c51b3762da 100644 --- a/rts/Lua/LuaConstPlatform.cpp +++ b/rts/Lua/LuaConstPlatform.cpp @@ -8,38 +8,37 @@ /****************************************************************************** * Platform constants - * @module Platform * @see rts/Lua/LuaConstPlatform.cpp ******************************************************************************/ /*** Platform specific information * * @table Platform - * @string gpu full GPU device name - * @string gpuVendor one of "Nvidia", "Intel", "ATI", "Mesa", "Unknown" - * @string glVersionShort major.minor.buildNumber - * @string glslVersionShort major.minor - * @string glVersion full version - * @string glVendor - * @string glRenderer - * @string glslVersion full version - * @string glewVersion - * @string osName full name of the OS - * @string osFamily one of "Windows", "Linux", "MacOSX", "FreeBSD", "Unknown" - * @number numDisplays - * @number gpuMemorySize size of total GPU memory in MBs; only available for "Nvidia", (rest are 0) - * @number sdlVersionCompiledMajor - * @number sdlVersionCompiledMinor - * @number sdlVersionCompiledPatch - * @number sdlVersionLinkedMajor - * @number sdlVersionLinkedMinor - * @number sdlVersionLinkedPatch - * @bool glSupportNonPowerOfTwoTex - * @bool glSupportTextureQueryLOD - * @bool glSupport24bitDepthBuffer - * @bool glSupportRestartPrimitive - * @bool glSupportClipSpaceControl - * @bool glSupportFragDepthLayout + * @field gpu string Full GPU device name + * @field gpuVendor "Nvidia"|"Intel"|"ATI"|"Mesa"|"Unknown" + * @field glVersionShort string `major.minor.buildNumber` + * @field glslVersionShort string `major.minor` + * @field glVersion string Full version + * @field glVendor string + * @field glRenderer string + * @field glslVersion string Full version + * @field glewVersion string + * @field osName string full name of the OS + * @field osFamily "Windows"|"Linux"|"MacOSX"|"FreeBSD"|"Unknown" + * @field numDisplays number + * @field gpuMemorySize number Size of total GPU memory in MBs; only available for "Nvidia", (rest are 0) + * @field sdlVersionCompiledMajor number + * @field sdlVersionCompiledMinor number + * @field sdlVersionCompiledPatch number + * @field sdlVersionLinkedMajor number + * @field sdlVersionLinkedMinor number + * @field sdlVersionLinkedPatch number + * @field glSupportNonPowerOfTwoTex boolean + * @field glSupportTextureQueryLOD boolean + * @field glSupport24bitDepthBuffer boolean + * @field glSupportRestartPrimitive boolean + * @field glSupportClipSpaceControl boolean + * @field glSupportFragDepthLayout boolean */ bool LuaConstPlatform::PushEntries(lua_State* L) diff --git a/rts/Lua/LuaFBOs.cpp b/rts/Lua/LuaFBOs.cpp index 80ead41aaf..a709116aa8 100644 --- a/rts/Lua/LuaFBOs.cpp +++ b/rts/Lua/LuaFBOs.cpp @@ -22,7 +22,6 @@ /****************************************************************************** * FBO - * @module FBO * @see rts/Lua/LuaFBOs.cpp ******************************************************************************/ @@ -409,36 +408,32 @@ bool LuaFBOs::ApplyDrawBuffers(lua_State* L, int index) /******************************************************************************/ /******************************************************************************/ +/** + * @table gl + */ + /*** - * @table attachment * attachment ::= luaTex or `RBO.rbo` or nil or { luaTex [, num target [, num level ] ] } + * @class attachment */ /*** * User Data FBO - * @table fbo - * @tparam attachment depth - * @tparam attachment stencil - * @tparam attachment color0 - * @tparam attachment color1 - * @tparam attachment color2 - * @tparam attachment colorn - * @tparam attachment color15 - * @tparam table drawbuffers `{ GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT3_EXT, ..}` - * @tparam table readbuffer `GL_COLOR_ATTACHMENT0_EXT` + * @class Fbo + * @field depth attachment + * @field stencil attachment + * @field color0 attachment + * @field color1 attachment + * @field color2 attachment + * @field colorn attachment + * @field color15 attachment + * @field drawbuffers table `{ GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT3_EXT, ..}` + * @field readbuffer table `GL_COLOR_ATTACHMENT0_EXT` */ /*** * @function gl.CreateFBO - * @param data - * @tparam attachment data.depth - * @tparam attachment data.stencil - * @tparam attachment data.color0 - * @tparam attachment data.color1 - * @tparam attachment data.color2 - * @tparam attachment data.colorn - * @tparam attachment data.color15 - * @tparam table data.drawbuffers `{ GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT3_EXT, ..}` + * @param fbo Fbo */ int LuaFBOs::CreateFBO(lua_State* L) { @@ -511,9 +506,10 @@ int LuaFBOs::CreateFBO(lua_State* L) /*** - * @function gl.DeleteFBO * This doesn't delete the attached objects! - * @tparam fbo fbo + * + * @function gl.DeleteFBO + * @param fbo Fbo */ int LuaFBOs::DeleteFBO(lua_State* L) { @@ -529,10 +525,10 @@ int LuaFBOs::DeleteFBO(lua_State* L) /*** * @function gl.IsValidFBO - * @tparam fbo fbo - * @number[opt] target - * @treturn bool valid - * @treturn ?number status + * @param fbo Fbo + * @param target GL? + * @return boolean valid + * @return number? status */ int LuaFBOs::IsValidFBO(lua_State* L) { @@ -571,13 +567,13 @@ int LuaFBOs::IsValidFBO(lua_State* L) /*** * @function gl.ActiveFBO - * @tparam fbo fbo - * @number[opt] target - * @bool[opt] identities - * @func[opt] lua_function - * @param[opt] arg1 - * @param[opt] arg2 - * @param[opt] argn + * @param fbo Fbo + * @param target GL? + * @param identities boolean? + * @param lua_function function? + * @param arg1 any? + * @param arg2 any? + * @param argn any? */ int LuaFBOs::ActiveFBO(lua_State* L) { @@ -643,10 +639,19 @@ int LuaFBOs::ActiveFBO(lua_State* L) /** - *gl.RawBindFBO - * - * ( nil [, number target = GL_FRAMEBUFFER_EXT ] [, number rawFboId = 0] ) -> nil (Bind default or specified via rawFboId numeric id of FBO) - * ( fbo [, number target = fbo.target ] ) -> number previouslyBoundRawFboId + * Bind default or specified via rawFboId numeric id of FBO + * + * @function gl.RawBindFBO + * @param fbo nil + * @param target GL? (Default: `GL_FRAMEBUFFER_EXT`) + * @param rawFboId integer? (Default: 0) + * @return nil + */ +/** + * @function gl.RawBindFBO + * @param fbo Fbo + * @param target GL? (Default: `fbo.target`) + * @return number previouslyBoundRawFboId */ int LuaFBOs::RawBindFBO(lua_State* L) { @@ -678,32 +683,32 @@ int LuaFBOs::RawBindFBO(lua_State* L) /*** needs `GLEW_EXT_framebuffer_blit` * * @function gl.BlitFBO - * @number x0Src - * @number y0Src - * @number x1Src - * @number y1Src - * @number x0Dst - * @number y0Dst - * @number x1Dst - * @number y1Dst - * @number[opt=GL_COLOR_BUFFER_BIT] mask - * @number[opt=GL_NEAREST] filter + * @param x0Src number + * @param y0Src number + * @param x1Src number + * @param y1Src number + * @param x0Dst number + * @param y0Dst number + * @param x1Dst number + * @param y1Dst number + * @param mask number? (Default: GL_COLOR_BUFFER_BIT) + * @param filter number? (Default: GL_NEAREST) */ /*** needs `GLEW_EXT_framebuffer_blit` * * @function gl.BlitFBO - * @tparam fbo fboSrc - * @number x0Src - * @number y0Src - * @number x1Src - * @number y1Src - * @tparam fbo fboDst - * @number x0Dst - * @number y0Dst - * @number x1Dst - * @number y1Dst - * @number[opt=GL_COLOR_BUFFER_BIT] mask - * @number[opt=GL_NEAREST] filter + * @param fboSrc Fbo + * @param x0Src number + * @param y0Src number + * @param x1Src number + * @param y1Src number + * @param fboDst Fbo + * @param x0Dst number + * @param y0Dst number + * @param x1Dst number + * @param y1Dst number + * @param mask number? (Default: GL_COLOR_BUFFER_BIT) + * @param filter number? (Default: GL_NEAREST) */ int LuaFBOs::BlitFBO(lua_State* L) { diff --git a/rts/Lua/LuaHandle.cpp b/rts/Lua/LuaHandle.cpp index d552797e37..28bb293253 100644 --- a/rts/Lua/LuaHandle.cpp +++ b/rts/Lua/LuaHandle.cpp @@ -73,7 +73,6 @@ bool CLuaHandle::devMode = false; /****************************************************************************** * Callins, functions called by the Engine * - * @module LuaHandle * * This page is future looking to unified widget/gadget (aka "addon") handler, which may yet be some way off, c.f. the changelog. * @@ -523,7 +522,7 @@ bool CLuaHandle::LoadCode(lua_State* L, std::string code, const string& debug) /*** Called when the addon or the game is shutdown. * * @function Shutdown - * @treturn nil + * @return nil */ void CLuaHandle::Shutdown() { @@ -545,8 +544,8 @@ void CLuaHandle::Shutdown() /*** Called when a player issues a UI command e.g. types /foo or /luarules foo. * * @function GotChatMsg - * @string msg - * @number playerID + * @param msg string + * @param playerID number */ bool CLuaHandle::GotChatMsg(const string& msg, int playerID) { @@ -577,7 +576,7 @@ bool CLuaHandle::GotChatMsg(const string& msg, int playerID) /*** Called after `GamePreload` and before `GameStart`. See Lua_SaveLoad. * * @function Load - * @tparam table zipReader + * @param zipReader table */ void CLuaHandle::Load(IArchive* archive) { @@ -661,10 +660,10 @@ void CLuaHandle::GamePreload() /*** Called upon the start of the game. - * - * Is not called when a saved game is loaded. * * @function GameStart + * + * Is not called when a saved game is loaded. */ void CLuaHandle::GameStart() { @@ -686,7 +685,7 @@ void CLuaHandle::GameStart() /*** Called when the game ends * * @function GameOver - * @tparam {number,...} winningAllyTeams list of winning allyTeams, if empty the game result was undecided (like when dropping from an host). + * @param winningAllyTeams number[] list of winning allyTeams, if empty the game result was undecided (like when dropping from an host). */ void CLuaHandle::GameOver(const std::vector& winningAllyTeams) { @@ -713,8 +712,8 @@ void CLuaHandle::GameOver(const std::vector& winningAllyTeams) /*** Called when the game is paused. * * @function GamePaused - * @number playerID - * @bool paused + * @param playerID number + * @param paused boolean */ void CLuaHandle::GamePaused(int playerID, bool paused) { @@ -763,7 +762,7 @@ void CLuaHandle::RunDelayedFunctions(int frameNum) /*** Called for every game simulation frame (30 per second). * * @function GameFrame - * @number frame Starts at frame 1 + * @param frame number Starts at frame 1 */ void CLuaHandle::GameFrame(int frameNum) { @@ -797,7 +796,7 @@ void CLuaHandle::GameFrame(int frameNum) /*** Called at the end of every game simulation frame * * @function GameFramePost - * @number frame Starts at frame 1 + * @param frame number Starts at frame 1 */ void CLuaHandle::GameFramePost(int frameNum) { @@ -821,7 +820,7 @@ void CLuaHandle::GameFramePost(int frameNum) /*** Called once to deliver the gameID * * @function GameID - * @string gameID encoded in hex. + * @param gameID string encoded in hex. */ void CLuaHandle::GameID(const unsigned char* gameID, unsigned int numBytes) { @@ -852,7 +851,7 @@ void CLuaHandle::GameID(const unsigned char* gameID, unsigned int numBytes) /*** Called when a team dies (see `Spring.KillTeam`). * * @function TeamDied - * @number teamID + * @param teamID number */ void CLuaHandle::TeamDied(int teamID) { @@ -875,7 +874,7 @@ void CLuaHandle::TeamDied(int teamID) /*** @function TeamChanged * - * @number teamID + * @param teamID number */ void CLuaHandle::TeamChanged(int teamID) { @@ -899,7 +898,7 @@ void CLuaHandle::TeamChanged(int teamID) /*** Called whenever a player's status changes e.g. becoming a spectator. * * @function PlayerChanged - * @number playerID + * @param playerID number */ void CLuaHandle::PlayerChanged(int playerID) { @@ -923,7 +922,7 @@ void CLuaHandle::PlayerChanged(int playerID) /*** Called whenever a new player joins the game. * * @function PlayerAdded - * @number playerID + * @param playerID number */ void CLuaHandle::PlayerAdded(int playerID) { @@ -947,8 +946,8 @@ void CLuaHandle::PlayerAdded(int playerID) /*** Called whenever a player is removed from the game. * * @function PlayerRemoved - * @number playerID - * @string reason + * @param playerID number + * @param reason string */ void CLuaHandle::PlayerRemoved(int playerID, int reason) { @@ -997,10 +996,10 @@ inline void CLuaHandle::UnitCallIn(const LuaHashString& hs, const CUnit* unit) /*** Called at the moment the unit is created. * * @function UnitCreated - * @number unitID - * @number unitDefID - * @number unitTeam - * @number[opt] builderID + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer + * @param builderID number? */ void CLuaHandle::UnitCreated(const CUnit* unit, const CUnit* builder) { @@ -1028,9 +1027,9 @@ void CLuaHandle::UnitCreated(const CUnit* unit, const CUnit* builder) /*** Called at the moment the unit is completed. * * @function UnitFinished - * @number unitID - * @number unitDefID - * @number unitTeam + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer */ void CLuaHandle::UnitFinished(const CUnit* unit) { @@ -1042,12 +1041,12 @@ void CLuaHandle::UnitFinished(const CUnit* unit) /*** Called when a factory finishes construction of a unit. * * @function UnitFromFactory - * @number unitID - * @number unitDefID - * @number unitTeam - * @number factID - * @number factDefID - * @bool userOrders + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer + * @param factID number + * @param factDefID number + * @param userOrders boolean */ void CLuaHandle::UnitFromFactory(const CUnit* unit, const CUnit* factory, bool userOrders) @@ -1076,9 +1075,9 @@ void CLuaHandle::UnitFromFactory(const CUnit* unit, /*** Called when a living unit becomes a nanoframe again. * * @function UnitReverseBuilt - * @number unitID - * @number unitDefID - * @number unitTeam + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer */ void CLuaHandle::UnitReverseBuilt(const CUnit* unit) { @@ -1091,12 +1090,12 @@ void CLuaHandle::UnitReverseBuilt(const CUnit* unit) /*** Called when a unit being built starts decaying. * * @function UnitConstructionDecayed - * @number unitID - * @number unitDefID - * @number unitTeam - * @number timeSinceLastBuild - * @number iterationPeriod - * @number part + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer + * @param timeSinceLastBuild number + * @param iterationPeriod number + * @param part number */ void CLuaHandle::UnitConstructionDecayed(const CUnit* unit, float timeSinceLastBuild, float iterationPeriod, float part) { @@ -1124,13 +1123,13 @@ void CLuaHandle::UnitConstructionDecayed(const CUnit* unit, float timeSinceLastB /*** Called when a unit is destroyed. * * @function UnitDestroyed - * @number unitID - * @number unitDefID - * @number unitTeam - * @number attackerID - * @number attackerDefID - * @number attackerTeam - * @number weaponDefID + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer + * @param attackerID number + * @param attackerDefID number + * @param attackerTeam number + * @param weaponDefID number */ void CLuaHandle::UnitDestroyed(const CUnit* unit, const CUnit* attacker, int weaponDefID) { @@ -1162,10 +1161,10 @@ void CLuaHandle::UnitDestroyed(const CUnit* unit, const CUnit* attacker, int wea /*** Called when a unit is transferred between teams. This is called before `UnitGiven` and in that moment unit is still assigned to the oldTeam. * * @function UnitTaken - * @number unitID - * @number unitDefID - * @number oldTeam - * @number newTeam + * @param unitID integer + * @param unitDefID integer + * @param oldTeam number + * @param newTeam number */ void CLuaHandle::UnitTaken(const CUnit* unit, int oldTeam, int newTeam) { @@ -1191,10 +1190,10 @@ void CLuaHandle::UnitTaken(const CUnit* unit, int oldTeam, int newTeam) /*** Called when a unit is transferred between teams. This is called after `UnitTaken` and in that moment unit is assigned to the newTeam. * * @function UnitGiven - * @number unitID - * @number unitDefID - * @number newTeam - * @number oldTeam + * @param unitID integer + * @param unitDefID integer + * @param newTeam number + * @param oldTeam number */ void CLuaHandle::UnitGiven(const CUnit* unit, int oldTeam, int newTeam) { @@ -1220,9 +1219,9 @@ void CLuaHandle::UnitGiven(const CUnit* unit, int oldTeam, int newTeam) /*** Called when a unit is idle (empty command queue). * * @function UnitIdle - * @number unitID - * @number unitDefID - * @number unitTeam + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer */ void CLuaHandle::UnitIdle(const CUnit* unit) { @@ -1234,13 +1233,13 @@ void CLuaHandle::UnitIdle(const CUnit* unit) /*** Called after when a unit accepts a command, after `AllowCommand` returns true. * * @function UnitCommand - * @number unitID - * @number unitDefID - * @number unitTeam - * @number cmdID - * @tparam table cmdParams - * @tparam cmdOpts options - * @number cmdTag + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer + * @param cmdID number + * @param cmdParams table + * @param options CommandOptions + * @param cmdTag number */ void CLuaHandle::UnitCommand(const CUnit* unit, const Command& command, int playerNum, bool fromSynced, bool fromLua) { @@ -1268,13 +1267,13 @@ void CLuaHandle::UnitCommand(const CUnit* unit, const Command& command, int play /*** Called when a unit completes a command. * * @function UnitCmdDone - * @number unitID - * @number unitDefID - * @number unitTeam - * @number cmdID - * @tparam table cmdParams - * @tparam cmdOpts options - * @number cmdTag + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer + * @param cmdID number + * @param cmdParams table + * @param options CommandOptions + * @param cmdTag number */ void CLuaHandle::UnitCmdDone(const CUnit* unit, const Command& command) { @@ -1298,16 +1297,16 @@ void CLuaHandle::UnitCmdDone(const CUnit* unit, const Command& command) /*** Called when a unit is damaged (after UnitPreDamaged). * * @function UnitDamaged - * @number unitID - * @number unitDefID - * @number unitTeam - * @number damage - * @number paralyzer - * @number weaponDefID - * @number projectileID - * @number attackerID - * @number attackerDefID - * @number attackerTeam + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer + * @param damage number + * @param paralyzer number + * @param weaponDefID number + * @param projectileID number + * @param attackerID number + * @param attackerDefID number + * @param attackerTeam number */ void CLuaHandle::UnitDamaged( const CUnit* unit, @@ -1346,10 +1345,10 @@ void CLuaHandle::UnitDamaged( /*** Called when a unit changes its stun status. * * @function UnitStunned - * @number unitID - * @number unitDefID - * @number unitTeam - * @bool stunned + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer + * @param stunned boolean */ void CLuaHandle::UnitStunned( const CUnit* unit, @@ -1374,17 +1373,18 @@ void CLuaHandle::UnitStunned( } -/*** Called when a unit gains experience greater or equal to the minimum limit set by calling `Spring.SetExperienceGrade`. - * - * @function UnitExperience +/*** + * Called when a unit gains experience greater or equal to the minimum limit set by calling `Spring.SetExperienceGrade`. * * Should be called more reliably with small values of experience grade. - * - * @number unitID - * @number unitDefID - * @number unitTeam - * @number experience - * @number oldExperience + * + * @function UnitExperience + * + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer + * @param experience number + * @param oldExperience number */ void CLuaHandle::UnitExperience(const CUnit* unit, float oldExperience) { @@ -1412,9 +1412,9 @@ void CLuaHandle::UnitExperience(const CUnit* unit, float oldExperience) /*** Called when a unit's harvestStorage is full (according to its unitDef's entry). * * @function UnitHarvestStorageFull - * @number unitID - * @number unitDefID - * @number unitTeam + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer */ void CLuaHandle::UnitHarvestStorageFull(const CUnit* unit) { @@ -1431,13 +1431,13 @@ void CLuaHandle::UnitHarvestStorageFull(const CUnit* unit) * * See `seismicSignature`. * - * @number x - * @number y - * @number z - * @number strength - * @number allyTeam - * @number unitID - * @number unitDefID + * @param x number + * @param y number + * @param z number + * @param strength number + * @param allyTeam integer + * @param unitID integer + * @param unitDefID integer */ void CLuaHandle::UnitSeismicPing(const CUnit* unit, int allyTeam, const float3& pos, float strength) @@ -1492,16 +1492,16 @@ void CLuaHandle::LosCallIn(const LuaHashString& hs, } -/*** Called when a unit enters radar of an allyteam. - * - * @function UnitEnteredRadar +/*** + * Called when a unit enters radar of an allyteam. * * Also called when a unit enters LOS without any radar coverage. - * - * @number unitID - * @number unitTeam - * @number allyTeam - * @number unitDefID + * + * @function UnitEnteredRadar + * @param unitID integer + * @param unitTeam integer + * @param allyTeam integer + * @param unitDefID integer */ void CLuaHandle::UnitEnteredRadar(const CUnit* unit, int allyTeam) { @@ -1511,16 +1511,16 @@ void CLuaHandle::UnitEnteredRadar(const CUnit* unit, int allyTeam) } -/*** Called when a unit enters LOS of an allyteam. - * - * @function UnitEnteredLos +/*** + * Called when a unit enters LOS of an allyteam. * * Its called after the unit is in LOS, so you can query that unit. - * - * @number unitID - * @number unitTeam - * @number allyTeam who's LOS the unit entered. - * @number unitDefID + * + * @function UnitEnteredLos + * @param unitID integer + * @param unitTeam integer + * @param allyTeam integer who's LOS the unit entered. + * @param unitDefID integer */ void CLuaHandle::UnitEnteredLos(const CUnit* unit, int allyTeam) { @@ -1529,17 +1529,18 @@ void CLuaHandle::UnitEnteredLos(const CUnit* unit, int allyTeam) } -/*** Called when a unit leaves radar of an allyteam. - * - * @function UnitLeftRadar +/*** + * Called when a unit leaves radar of an allyteam. * * Also called when a unit leaves LOS without any radar coverage. - * For widgets, this is called just after a unit leaves radar coverage, so widgets cannot get the position of units that left their radar. - * - * @number unitID - * @number unitTeam - * @number allyTeam - * @number unitDefID + * For widgets, this is called just after a unit leaves radar coverage, so + * widgets cannot get the position of units that left their radar. + * + * @function UnitLeftRadar + * @param unitID integer + * @param unitTeam integer + * @param allyTeam integer + * @param unitDefID integer */ void CLuaHandle::UnitLeftRadar(const CUnit* unit, int allyTeam) { @@ -1549,16 +1550,16 @@ void CLuaHandle::UnitLeftRadar(const CUnit* unit, int allyTeam) } -/*** Called when a unit leaves LOS of an allyteam. - * - * @function UnitLeftLos +/*** + * Called when a unit leaves LOS of an allyteam. * * For widgets, this one is called just before the unit leaves los, so you can still get the position of a unit that left los. - * - * @number unitID - * @number unitTeam - * @number allyTeam - * @number unitDefID + * + * @function UnitLeftLos + * @param unitID integer + * @param unitTeam integer + * @param allyTeam integer + * @param unitDefID integer */ void CLuaHandle::UnitLeftLos(const CUnit* unit, int allyTeam) { @@ -1576,11 +1577,11 @@ void CLuaHandle::UnitLeftLos(const CUnit* unit, int allyTeam) /*** Called when a unit is loaded by a transport. * * @function UnitLoaded - * @number unitID - * @number unitDefID - * @number unitTeam - * @number transportID - * @number transportTeam + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer + * @param transportID integer + * @param transportTeam integer */ void CLuaHandle::UnitLoaded(const CUnit* unit, const CUnit* transport) { @@ -1605,14 +1606,14 @@ void CLuaHandle::UnitLoaded(const CUnit* unit, const CUnit* transport) } -/*** Called when a unit is unloaded by a transport. +/***Called when a unit is unloaded by a transport. * * @function UnitUnloaded - * @number unitID - * @number unitDefID - * @number unitTeam - * @number transportID - * @number transportTeam + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer + * @param transportID integer + * @param transportTeam integer */ void CLuaHandle::UnitUnloaded(const CUnit* unit, const CUnit* transport) { @@ -1646,9 +1647,9 @@ void CLuaHandle::UnitUnloaded(const CUnit* unit, const CUnit* transport) /*** * * @function UnitEnteredUnderwater - * @number unitID - * @number unitDefID - * @number unitTeam + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer */ void CLuaHandle::UnitEnteredUnderwater(const CUnit* unit) { @@ -1660,9 +1661,9 @@ void CLuaHandle::UnitEnteredUnderwater(const CUnit* unit) /*** * * @function UnitEnteredWater - * @number unitID - * @number unitDefID - * @number unitTeam + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer */ void CLuaHandle::UnitEnteredWater(const CUnit* unit) { @@ -1675,9 +1676,9 @@ void CLuaHandle::UnitEnteredWater(const CUnit* unit) * * @function UnitLeftAir * - * @number unitID - * @number unitDefID - * @number unitTeam + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer */ void CLuaHandle::UnitEnteredAir(const CUnit* unit) { @@ -1690,9 +1691,9 @@ void CLuaHandle::UnitEnteredAir(const CUnit* unit) * * @function UnitLeftUnderwater * - * @number unitID - * @number unitDefID - * @number unitTeam + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer */ void CLuaHandle::UnitLeftUnderwater(const CUnit* unit) { @@ -1704,9 +1705,9 @@ void CLuaHandle::UnitLeftUnderwater(const CUnit* unit) * * @function UnitLeftWater * - * @number unitID - * @number unitDefID - * @number unitTeam + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer */ void CLuaHandle::UnitLeftWater(const CUnit* unit) { @@ -1719,9 +1720,9 @@ void CLuaHandle::UnitLeftWater(const CUnit* unit) * * @function UnitEnteredAir * - * @number unitID - * @number unitDefID - * @number unitTeam + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer */ void CLuaHandle::UnitLeftAir(const CUnit* unit) { @@ -1734,9 +1735,9 @@ void CLuaHandle::UnitLeftAir(const CUnit* unit) * * @function UnitCloaked * - * @number unitID - * @number unitDefID - * @number unitTeam + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer */ void CLuaHandle::UnitCloaked(const CUnit* unit) { @@ -1749,9 +1750,9 @@ void CLuaHandle::UnitCloaked(const CUnit* unit) * * @function UnitDecloaked * - * @number unitID - * @number unitDefID - * @number unitTeam + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer */ void CLuaHandle::UnitDecloaked(const CUnit* unit) { @@ -1761,13 +1762,12 @@ void CLuaHandle::UnitDecloaked(const CUnit* unit) /*** Called when two units collide. - * - * @function UnitUnitCollision * * Both units must be registered with `Script.SetWatchUnit`. - * - * @number colliderID - * @number collideeID + * + * @function UnitUnitCollision + * @param colliderID number + * @param collideeID number */ bool CLuaHandle::UnitUnitCollision(const CUnit* collider, const CUnit* collidee) { @@ -1818,8 +1818,8 @@ bool CLuaHandle::UnitUnitCollision(const CUnit* collider, const CUnit* collidee) * * The unit must be registered with `Script.SetWatchUnit` and the feature registered with `Script.SetWatchFeature`. * - * @number colliderID - * @number collideeID + * @param colliderID number + * @param collideeID number */ bool CLuaHandle::UnitFeatureCollision(const CUnit* collider, const CFeature* collidee) { @@ -1869,9 +1869,9 @@ bool CLuaHandle::UnitFeatureCollision(const CUnit* collider, const CFeature* col * * @function UnitMoveFailed * - * @number unitID - * @number unitDefID - * @number unitTeam + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer */ void CLuaHandle::UnitMoveFailed(const CUnit* unit) { @@ -1891,9 +1891,9 @@ void CLuaHandle::UnitMoveFailed(const CUnit* unit) * * @function UnitArrivedAtGoal * - * @number unitID - * @number unitDefID - * @number unitTeam + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer */ void CLuaHandle::UnitArrivedAtGoal(const CUnit* unit) { @@ -1908,9 +1908,9 @@ void CLuaHandle::UnitArrivedAtGoal(const CUnit* unit) * * @function RenderUnitDestroyed * - * @number unitID - * @number unitDefID - * @number unitTeam + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer */ void CLuaHandle::RenderUnitDestroyed(const CUnit* unit) { @@ -1946,8 +1946,8 @@ void CLuaHandle::RenderUnitDestroyed(const CUnit* unit) * * @function FeatureCreated * - * @number featureID - * @number allyTeamID + * @param featureID number + * @param allyTeamID number */ void CLuaHandle::FeatureCreated(const CFeature* feature) { @@ -1973,8 +1973,8 @@ void CLuaHandle::FeatureCreated(const CFeature* feature) * * @function FeatureDestroyed * - * @number featureID - * @number allyTeamID + * @param featureID number + * @param allyTeamID number */ void CLuaHandle::FeatureDestroyed(const CFeature* feature) { @@ -2000,15 +2000,15 @@ void CLuaHandle::FeatureDestroyed(const CFeature* feature) * * @function FeatureDamaged * - * @number featureID - * @number featureDefID - * @number featureTeam - * @number damage - * @number weaponDefID - * @number projectileID - * @number attackerID - * @number attackerDefID - * @number attackerTeam + * @param featureID number + * @param featureDefID number + * @param featureTeam number + * @param damage number + * @param weaponDefID number + * @param projectileID number + * @param attackerID number + * @param attackerDefID number + * @param attackerTeam number */ void CLuaHandle::FeatureDamaged( const CFeature* feature, @@ -2056,9 +2056,9 @@ void CLuaHandle::FeatureDamaged( * * Note that weaponDefID is missing if the projectile is spawned as part of a burst, but `Spring.GetProjectileDefID` and `Spring.GetProjectileName` still work in callin scope using proID. * - * @number proID - * @number proOwnerID - * @number weaponDefID + * @param proID number + * @param proOwnerID number + * @param weaponDefID number * */ void CLuaHandle::ProjectileCreated(const CProjectile* p) @@ -2103,9 +2103,9 @@ void CLuaHandle::ProjectileCreated(const CProjectile* p) /*** Called when the projectile is destroyed. * * @function ProjectileDestroyed - * @number proID - * @number ownerID - * @number proWeaponDefID + * @param proID number + * @param ownerID number + * @param proWeaponDefID number */ void CLuaHandle::ProjectileDestroyed(const CProjectile* p) { @@ -2157,13 +2157,13 @@ void CLuaHandle::ProjectileDestroyed(const CProjectile* p) * * @function Explosion * - * @number weaponDefID - * @number px - * @number py - * @number pz - * @number attackerID - * @number projectileID - * @return bool noGfx if then no graphical effects are drawn by the engine for this explosion. + * @param weaponDefID number + * @param px number + * @param py number + * @param pz number + * @param attackerID number + * @param projectileID number + * @return boolean noGfx if then no graphical effects are drawn by the engine for this explosion. */ bool CLuaHandle::Explosion(int weaponDefID, int projectileID, const float3& pos, const CUnit* owner) { @@ -2212,12 +2212,12 @@ bool CLuaHandle::Explosion(int weaponDefID, int projectileID, const float3& pos, * * @function StockpileChanged * - * @number unitID - * @number unitDefID - * @number unitTeam - * @number weaponNum - * @number oldCount - * @number newCount + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer + * @param weaponNum integer + * @param oldCount integer + * @param newCount integer */ void CLuaHandle::StockpileChanged(const CUnit* unit, const CWeapon* weapon, int oldCount) @@ -2246,8 +2246,8 @@ void CLuaHandle::StockpileChanged(const CUnit* unit, /*** Receives messages from unsynced sent via `Spring.SendLuaRulesMsg` or `Spring.SendLuaUIMsg`. * * @function RecvLuaMsg - * @string msg - * @number playerID + * @param msg string + * @param playerID number */ bool CLuaHandle::RecvLuaMsg(const string& msg, int playerID) { @@ -2327,7 +2327,7 @@ void CLuaHandle::HandleLuaMsg(int playerID, int script, int mode, const std::vec /*** Called when a chat command '/save' or '/savegame' is received. * * @function Save - * @tparam table zip a userdatum representing the savegame zip file. See Lua_SaveLoad. + * @param zip table a userdatum representing the savegame zip file. See Lua_SaveLoad. */ void CLuaHandle::Save(zipFile archive) { @@ -2353,10 +2353,10 @@ void CLuaHandle::Save(zipFile archive) /*** Called when the unsynced copy of the height-map is altered. * * @function UnsyncedHeightMapUpdate - * @treturn x1 - * @treturn z1 - * @treturn x2 - * @treturn z2 + * @return number x1 + * @return number z1 + * @return number x2 + * @return number z2 */ void CLuaHandle::UnsyncedHeightMapUpdate(const SRectangle& rect) { @@ -2380,7 +2380,7 @@ void CLuaHandle::UnsyncedHeightMapUpdate(const SRectangle& rect) /*** Called for every draw frame (including when the game is paused) and at least once per sim frame except when catching up. * * @function Update - * @number dt the time since the last update. + * @param dt number the time since the last update. */ void CLuaHandle::Update() { @@ -2399,8 +2399,8 @@ void CLuaHandle::Update() /*** Called whenever the window is resized. * * @function ViewResize - * @number viewSizeX - * @number viewSizeY + * @param viewSizeX number + * @param viewSizeY number */ void CLuaHandle::ViewResize() { @@ -2475,8 +2475,8 @@ void CLuaHandle::SunChanged() /*** Used to set the default command when a unit is selected. First parameter is the type of the object pointed at (either "unit or "feature") and the second is its unitID or featureID respectively. * * @function DefaultCommand - * @string type "unit" | "feature" - * @int id unitID | featureID + * @param type string "unit" | "feature" + * @param id integer unitID | featureID */ bool CLuaHandle::DefaultCommand(const CUnit* unit, const CFeature* feature, int& cmd) @@ -2677,10 +2677,10 @@ DRAW_CALLIN(DrawShadowFeaturesLua) * Each call has a different permutation of values for drawAboveWater, drawBelowWater, drawReflection, and drawRefraction. * * @function DrawWorldPreParticles - * @bool drawAboveWater - * @bool drawBelowWater - * @bool drawReflection - * @bool drawRefraction + * @param drawAboveWater boolean + * @param drawBelowWater boolean + * @param drawReflection boolean + * @param drawRefraction boolean */ void CLuaHandle::DrawWorldPreParticles(bool drawAboveWater, bool drawBelowWater, bool drawReflection, bool drawRefraction) { @@ -2723,8 +2723,8 @@ inline void CLuaHandle::DrawScreenCommon(const LuaHashString& cmdStr) /*** Also available to LuaMenu. * * @function DrawScreen - * @number viewSizeX - * @number viewSizeY + * @param viewSizeX number + * @param viewSizeY number */ void CLuaHandle::DrawScreen() { @@ -2739,8 +2739,8 @@ void CLuaHandle::DrawScreen() /*** * @function DrawScreenEffects - * @number viewSizeX - * @number viewSizeY + * @param viewSizeX number + * @param viewSizeY number */ void CLuaHandle::DrawScreenEffects() { @@ -2756,8 +2756,8 @@ void CLuaHandle::DrawScreenEffects() /*** Similar to DrawScreenEffects, this can be used to alter the contents of a frame after it has been completely rendered (i.e. World, MiniMap, Menu, UI). * * @function DrawScreenPost - * @number viewSizeX - * @number viewSizeY + * @param viewSizeX number + * @param viewSizeY number */ void CLuaHandle::DrawScreenPost() { @@ -2773,8 +2773,8 @@ void CLuaHandle::DrawScreenPost() /*** * * @function DrawInMinimap - * @number sx relative to the minimap's position and scale. - * @number sy relative to the minimap's position and scale. + * @param sx number relative to the minimap's position and scale. + * @param sy number relative to the minimap's position and scale. */ void CLuaHandle::DrawInMiniMap() { @@ -2801,8 +2801,8 @@ void CLuaHandle::DrawInMiniMap() /*** * * @function DrawInMinimapBackground - * @number sx relative to the minimap's position and scale. - * @number sy relative to the minimap's position and scale. + * @param sx number relative to the minimap's position and scale. + * @param sy number relative to the minimap's position and scale. */ void CLuaHandle::DrawInMiniMapBackground() { @@ -2878,7 +2878,7 @@ void CLuaHandle::DrawAlphaFeaturesLua(bool drawReflection, bool drawRefraction) * Can give an ETA about catching up with simulation for mid-game join players. * * @function GameProgress - * @int serverFrameNum + * @param serverFrameNum integer */ void CLuaHandle::GameProgress(int frameNum) { @@ -2949,12 +2949,12 @@ bool CLuaHandle::KeyMapChanged() /*** Key Modifier Params * - * @table mods + * @class KeyModifiers * - * @tparam bool right Right mouse key pressed - * @tparam bool alt Alt key pressed - * @tparam bool ctrl Ctrl key pressed - * @tparam bool shift Shift key pressed + * @field right boolean Right mouse key pressed + * @field alt boolean Alt key pressed + * @field ctrl boolean Ctrl key pressed + * @field shift boolean Shift key pressed */ @@ -2964,14 +2964,14 @@ bool CLuaHandle::KeyMapChanged() * * Return true if you don't want other callins or the engine to also receive this keypress. A list of key codes can be seen at the SDL wiki. * - * @number keyCode - * @tparam mods mods - * @bool isRepeat If you want an action to occur only once check for isRepeat == false. - * @bool label the name of the key - * @number utf32char (deprecated) always 0 - * @number scanCode - * @tparam table actionList the list of actions for this keypress - * @treturn boolean halt whether to halt the chain for consumers of the keypress + * @param keyCode number + * @param mods KeyModifiers + * @param isRepeat boolean If you want an action to occur only once check for isRepeat == false. + * @param label boolean the name of the key + * @param utf32char number (deprecated) always 0 + * @param scanCode number + * @param actionList table the list of actions for this keypress + * @return boolean halt whether to halt the chain for consumers of the keypress */ bool CLuaHandle::KeyPress(int keyCode, int scanCode, bool isRepeat) { @@ -3030,14 +3030,14 @@ bool CLuaHandle::KeyPress(int keyCode, int scanCode, bool isRepeat) * * @function KeyRelease * - * @number keyCode - * @tparam mods mods - * @bool label the name of the key - * @number utf32char (deprecated) always 0 - * @number scanCode - * @tparam table actionList the list of actions for this keyrelease + * @param keyCode number + * @param mods KeyModifiers + * @param label boolean the name of the key + * @param utf32char number (deprecated) always 0 + * @param scanCode number + * @param actionList table the list of actions for this keyrelease * - * @treturn bool + * @return boolean */ bool CLuaHandle::KeyRelease(int keyCode, int scanCode) { @@ -3091,7 +3091,7 @@ bool CLuaHandle::KeyRelease(int keyCode, int scanCode) * * @function TextInput * - * @string utf8char + * @param utf8char string */ bool CLuaHandle::TextInput(const std::string& utf8) { @@ -3119,9 +3119,9 @@ bool CLuaHandle::TextInput(const std::string& utf8) * * @function TextEditing * - * @string utf8 - * @number start - * @number length + * @param utf8 string + * @param start number + * @param length number */ bool CLuaHandle::TextEditing(const std::string& utf8, unsigned int start, unsigned int length) { @@ -3150,10 +3150,10 @@ bool CLuaHandle::TextEditing(const std::string& utf8, unsigned int start, unsign * The button parameter supports up to 7 buttons. Must return true for `MouseRelease` and other functions to be called. * * @function MousePress - * @number x - * @number y - * @number button - * @treturn boolean becomeMouseOwner + * @param x number + * @param y number + * @param button number + * @return boolean becomeMouseOwner */ bool CLuaHandle::MousePress(int x, int y, int button) { @@ -3184,10 +3184,10 @@ bool CLuaHandle::MousePress(int x, int y, int button) * * Please note that in order to have Spring call `Spring.MouseRelease`, you need to have a `Spring.MousePress` call-in in the same addon that returns true. * - * @number x - * @number y - * @number button - * @treturn boolean becomeMouseOwner + * @param x number + * @param y number + * @param button number + * @return boolean becomeMouseOwner */ void CLuaHandle::MouseRelease(int x, int y, int button) { @@ -3211,11 +3211,11 @@ void CLuaHandle::MouseRelease(int x, int y, int button) * * @function MouseMove * - * @number x final x position - * @number y final y position - * @number dx distance travelled in x - * @number dy distance travelled in y - * @number button + * @param x number final x position + * @param y number final y position + * @param dx number distance travelled in x + * @param dy number distance travelled in y + * @param button number */ bool CLuaHandle::MouseMove(int x, int y, int dx, int dy, int button) { @@ -3246,8 +3246,8 @@ bool CLuaHandle::MouseMove(int x, int y, int dx, int dy, int button) * * @function MouseWheel * - * @bool up the direction - * @number value the amount travelled + * @param up boolean the direction + * @param value number the amount travelled */ bool CLuaHandle::MouseWheel(bool up, float value) { @@ -3275,8 +3275,8 @@ bool CLuaHandle::MouseWheel(bool up, float value) * * Must return true for `Mouse*` events and `Spring.GetToolTip` to be called. * - * @number x - * @number y + * @param x number + * @param y number * @return boolean isAbove */ bool CLuaHandle::IsAbove(int x, int y) @@ -3303,8 +3303,8 @@ bool CLuaHandle::IsAbove(int x, int y) /*** Called when `Spring.IsAbove` returns true. * * @function GetTooltip - * @number x - * @number y + * @param x number + * @param y number * @return string tooltip */ string CLuaHandle::GetTooltip(int x, int y) @@ -3328,27 +3328,13 @@ string CLuaHandle::GetTooltip(int x, int y) return retval; } - -/*** Parameters for command options - * - * @table cmdOpts - * - * @int coded - * @bool alt - * @bool ctrl - * @bool shift - * @bool right - * @bool meta - * @bool internal - */ - /*** Called when a command is issued. * * @function CommandNotify - * @int cmdID - * @tparam table cmdParams - * @tparam cmdOpts options - * @treturn boolean Returning true deletes the command and does not send it through the network. + * @param cmdID integer + * @param cmdParams table + * @param options CommandOptions + * @return boolean Returning true deletes the command and does not send it through the network. */ bool CLuaHandle::CommandNotify(const Command& cmd) { @@ -3381,8 +3367,8 @@ bool CLuaHandle::CommandNotify(const Command& cmd) /*** Called when text is entered into the console (e.g. `Spring.Echo`). * * @function AddConsoleLine - * @string msg - * @int priority + * @param msg string + * @param priority integer */ bool CLuaHandle::AddConsoleLine(const string& msg, const string& section, int level) { @@ -3404,7 +3390,7 @@ bool CLuaHandle::AddConsoleLine(const string& msg, const string& section, int le /*** Called when a unit is added to or removed from a control group. * * @function GroupChanged - * @number groupID + * @param groupID number */ bool CLuaHandle::GroupChanged(int groupID) { @@ -3425,11 +3411,11 @@ bool CLuaHandle::GroupChanged(int groupID) /*** * @function WorldTooltip - * @string ttType "unit" | "feature" | "ground" | "selection" - * @number data1 unitID | featureID | posX - * @number[opt] data2 posY - * @number[opt] data3 posZ - * @treturn string newTooltip + * @param ttType string "unit" | "feature" | "ground" | "selection" + * @param data1 number unitID | featureID | posX + * @param data2 number? posY + * @param data3 number? posZ + * @return string newTooltip */ string CLuaHandle::WorldTooltip(const CUnit* unit, const CFeature* feature, @@ -3478,14 +3464,14 @@ string CLuaHandle::WorldTooltip(const CUnit* unit, /*** * * @function MapDrawCmd - * @number playerID - * @string type "point" | "line" | "erase" - * @number posX - * @number posY - * @number posZ - * @tparam string|number data4 point: label, erase: radius, line: pos2X - * @number[opt] pos2Y when type is line - * @number[opt] pos2Z when type is line + * @param playerID number + * @param type string "point" | "line" | "erase" + * @param posX number + * @param posY number + * @param posZ number + * @param data4 string|number point: label, erase: radius, line: pos2X + * @param pos2Y number? when type is line + * @param pos2Z number? when type is line */ bool CLuaHandle::MapDrawCmd(int playerID, int type, const float3* pos0, @@ -3549,11 +3535,11 @@ bool CLuaHandle::MapDrawCmd(int playerID, int type, /*** * * @function GameSetup - * @string state - * @bool ready - * @tparam table playerStates - * @treturn bool success - * @treturn bool newReady + * @param state string + * @param ready boolean + * @param playerStates table + * @return boolean success + * @return boolean newReady */ bool CLuaHandle::GameSetup(const string& state, bool& ready, const std::vector< std::pair >& playerStates) @@ -3599,8 +3585,8 @@ bool CLuaHandle::GameSetup(const string& state, bool& ready, /*** @function RecvSkirmishAIMessage * - * @int aiTeam - * @string dataStr + * @param aiTeam integer + * @param dataStr string */ const char* CLuaHandle::RecvSkirmishAIMessage(int aiTeam, const char* inData, int inSize, size_t* outSize) { @@ -3645,9 +3631,9 @@ const char* CLuaHandle::RecvSkirmishAIMessage(int aiTeam, const char* inData, in /*** Called when a Pr-downloader download is queued * * @function DownloadQueued - * @number id - * @string name - * @string type + * @param id number + * @param name string + * @param type string */ void CLuaHandle::DownloadQueued(int ID, const string& archiveName, const string& archiveType) { @@ -3673,7 +3659,7 @@ void CLuaHandle::DownloadQueued(int ID, const string& archiveName, const string& /*** Called when a Pr-downloader download is started via VFS.DownloadArchive. * * @function DownloadStarted - * @number id + * @param id number */ void CLuaHandle::DownloadStarted(int ID) { @@ -3696,7 +3682,7 @@ void CLuaHandle::DownloadStarted(int ID) /*** Called when a Pr-downloader download finishes successfully. * * @function DownloadFinished - * @number id + * @param id number */ void CLuaHandle::DownloadFinished(int ID) { @@ -3719,8 +3705,8 @@ void CLuaHandle::DownloadFinished(int ID) /*** Called when a Pr-downloader download fails to complete. * * @function DownloadFailed - * @number id - * @number errorID + * @param id number + * @param errorID number */ void CLuaHandle::DownloadFailed(int ID, int errorID) { @@ -3744,9 +3730,9 @@ void CLuaHandle::DownloadFailed(int ID, int errorID) /*** Called incrementally during a Pr-downloader download. * * @function DownloadProgress - * @number id - * @number downloaded - * @number total + * @param id number + * @param downloaded number + * @param total number */ void CLuaHandle::DownloadProgress(int ID, long downloaded, long total) { diff --git a/rts/Lua/LuaHandleSynced.cpp b/rts/Lua/LuaHandleSynced.cpp index 426dad323a..c5eb895f8d 100644 --- a/rts/Lua/LuaHandleSynced.cpp +++ b/rts/Lua/LuaHandleSynced.cpp @@ -166,7 +166,6 @@ bool CUnsyncedLuaHandle::Init(std::string code, const std::string& file) /****************************************************************************** * Callins, functions called by the Engine (Synced) * - * @module LuaHandleSynced * @see rts/Lua/LuaHandleSynced.cpp */ @@ -179,9 +178,9 @@ bool CUnsyncedLuaHandle::Init(std::string code, const std::string& file) /*** Receives data sent via `SendToUnsynced` callout. * * @function RecvFromSynced - * @tparam any arg1 - * @tparam any arg2 - * @tparam any argn + * @param arg1 any + * @param arg2 any + * @param argn any */ void CUnsyncedLuaHandle::RecvFromSynced(lua_State* srcState, int args) { @@ -212,9 +211,9 @@ void CUnsyncedLuaHandle::RecvFromSynced(lua_State* srcState, int args) /*** For custom rendering of units * * @function DrawUnit - * @number unitID - * @number drawMode - * @treturn bool suppressEngineDraw + * @param unitID integer + * @param drawMode number + * @return boolean suppressEngineDraw */ bool CUnsyncedLuaHandle::DrawUnit(const CUnit* unit) { @@ -248,9 +247,9 @@ bool CUnsyncedLuaHandle::DrawUnit(const CUnit* unit) /*** For custom rendering of features * * @function DrawFeature - * @number featureID - * @number drawMode - * @treturn bool suppressEngineDraw + * @param featureID integer + * @param drawMode number + * @return boolean suppressEngineDraw */ bool CUnsyncedLuaHandle::DrawFeature(const CFeature* feature) { @@ -283,10 +282,10 @@ bool CUnsyncedLuaHandle::DrawFeature(const CFeature* feature) /*** For custom rendering of shields. * * @function DrawShield - * @number featureID - * @number weaponID - * @number drawMode - * @treturn bool suppressEngineDraw + * @param featureID integer + * @param weaponID integer + * @param drawMode number + * @return boolean suppressEngineDraw */ bool CUnsyncedLuaHandle::DrawShield(const CUnit* unit, const CWeapon* weapon) { @@ -321,9 +320,9 @@ bool CUnsyncedLuaHandle::DrawShield(const CUnit* unit, const CWeapon* weapon) /*** For custom rendering of weapon (& other) projectiles * * @function DrawProjectile - * @number projectileID - * @number drawMode - * @treturn bool suppressEngineDraw + * @param projectileID integer + * @param drawMode number + * @return boolean suppressEngineDraw */ bool CUnsyncedLuaHandle::DrawProjectile(const CProjectile* projectile) { @@ -358,9 +357,9 @@ bool CUnsyncedLuaHandle::DrawProjectile(const CProjectile* projectile) /*** * * @function DrawMaterial - * @number uuid - * @number drawMode - * @treturn bool suppressEngineDraw + * @param uuid number + * @param drawMode number + * @return boolean suppressEngineDraw */ bool CUnsyncedLuaHandle::DrawMaterial(const LuaMaterial* material) { @@ -566,14 +565,14 @@ bool CSyncedLuaHandle::SyncedActionFallback(const std::string& msg, int playerID /*** Called when the unit reaches an unknown command in its queue (i.e. one not handled by the engine). * * @function CommandFallback - * @number unitID - * @number unitDefID - * @number unitTeam - * @number cmdID - * @tparam {number,...} cmdParams - * @tparam cmdOptions cmdOptions - * @number cmdTag - * @treturn boolean whether to remove the command from the queue + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer + * @param cmdID integer + * @param cmdParams number[] + * @param cmdOptions CommandOptions + * @param cmdTag number + * @return boolean whether to remove the command from the queue */ bool CSyncedLuaHandle::CommandFallback(const CUnit* unit, const Command& cmd) { @@ -602,16 +601,16 @@ bool CSyncedLuaHandle::CommandFallback(const CUnit* unit, const Command& cmd) * * The queue remains untouched when a command is blocked, whether it would be queued or replace the queue. * - * @number unitID - * @number unitDefID - * @number unitTeam - * @number cmdID - * @tparam {number,...} cmdParams - * @tparam cmdOptions cmdOptions - * @number cmdTag - * @bool synced - * @bool fromLua - * @treturn bool whether it should be let into the queue. + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer + * @param cmdID integer + * @param cmdParams number[] + * @param cmdOptions CommandOptions + * @param cmdTag number + * @param synced boolean + * @param fromLua boolean + * @return boolean whether it should be let into the queue. */ bool CSyncedLuaHandle::AllowCommand(const CUnit* unit, const Command& cmd, int playerNum, bool fromSynced, bool fromLua) { @@ -643,14 +642,14 @@ bool CSyncedLuaHandle::AllowCommand(const CUnit* unit, const Command& cmd, int p /*** Called just before unit is created. * * @function AllowUnitCreation - * @number unitDefID - * @number builderID - * @number builderTeam - * @number x - * @number y - * @number z - * @number facing - * @treturn bool allow, bool dropOrder + * @param unitDefID integer + * @param builderID integer + * @param builderTeam integer + * @param x number + * @param y number + * @param z number + * @param facing number + * @return boolean allow, boolean dropOrder */ std::pair CSyncedLuaHandle::AllowUnitCreation( const UnitDef* unitDef, @@ -690,12 +689,12 @@ std::pair CSyncedLuaHandle::AllowUnitCreation( /*** Called just before a unit is transferred to a different team. * * @function AllowUnitTransfer - * @number unitID - * @number unitDefID - * @number oldTeam - * @number newTeam - * @bool capture - * @treturn bool whether or not the transfer is permitted. + * @param unitID integer + * @param unitDefID integer + * @param oldTeam integer + * @param newTeam integer + * @param capture boolean + * @return boolean whether or not the transfer is permitted. */ bool CSyncedLuaHandle::AllowUnitTransfer(const CUnit* unit, int newTeam, bool capture) { @@ -727,12 +726,12 @@ bool CSyncedLuaHandle::AllowUnitTransfer(const CUnit* unit, int newTeam, bool ca /*** Called just before a unit progresses its build percentage. * * @function AllowUnitBuildStep - * @number builderID - * @number builderTeam - * @number unitID - * @number unitDefID - * @number part - * @treturn bool whether or not the build makes progress. + * @param builderID integer + * @param builderTeam integer + * @param unitID integer + * @param unitDefID integer + * @param part number + * @return boolean whether or not the build makes progress. */ bool CSyncedLuaHandle::AllowUnitBuildStep(const CUnit* builder, const CUnit* unit, float part) { @@ -764,12 +763,12 @@ bool CSyncedLuaHandle::AllowUnitBuildStep(const CUnit* builder, const CUnit* uni /*** * * @function AllowUnitCaptureStep - * @number builderID - * @number builderTeam - * @number unitID - * @number unitDefID - * @number part - * @treturn bool whether or not the capture makes progress. + * @param builderID integer + * @param builderTeam integer + * @param unitID integer + * @param unitDefID integer + * @param part number + * @return boolean whether or not the capture makes progress. */ bool CSyncedLuaHandle::AllowUnitCaptureStep(const CUnit* builder, const CUnit* unit, float part) { @@ -801,13 +800,13 @@ bool CSyncedLuaHandle::AllowUnitCaptureStep(const CUnit* builder, const CUnit* u /*** * * @function AllowUnitTransport - * @number transporterID - * @number transporterUnitDefID - * @number transporterTeam - * @number transporteeID - * @number transporteeUnitDefID - * @number transporteeTeam - * @treturn bool whether or not the transport is allowed + * @param transporterID integer + * @param transporterUnitDefID integer + * @param transporterTeam integer + * @param transporteeID integer + * @param transporteeUnitDefID integer + * @param transporteeTeam integer + * @return boolean whether or not the transport is allowed */ bool CSyncedLuaHandle::AllowUnitTransport(const CUnit* transporter, const CUnit* transportee) { @@ -839,16 +838,16 @@ bool CSyncedLuaHandle::AllowUnitTransport(const CUnit* transporter, const CUnit* /*** * * @function AllowUnitTransportLoad - * @number transporterID - * @number transporterUnitDefID - * @number transporterTeam - * @number transporteeID - * @number transporteeUnitDefID - * @number transporteeTeam - * @number x - * @number y - * @number z - * @treturn bool whether or not the transport load is allowed + * @param transporterID integer + * @param transporterUnitDefID integer + * @param transporterTeam integer + * @param transporteeID integer + * @param transporteeUnitDefID integer + * @param transporteeTeam integer + * @param x number + * @param y number + * @param z number + * @return boolean whether or not the transport load is allowed */ bool CSyncedLuaHandle::AllowUnitTransportLoad( const CUnit* transporter, @@ -889,16 +888,16 @@ bool CSyncedLuaHandle::AllowUnitTransportLoad( /*** * * @function AllowUnitTransportUnload - * @number transporterID - * @number transporterUnitDefID - * @number transporterTeam - * @number transporteeID - * @number transporteeUnitDefID - * @number transporteeTeam - * @number x - * @number y - * @number z - * @treturn bool whether or not the transport unload is allowed + * @param transporterID integer + * @param transporterUnitDefID integer + * @param transporterTeam integer + * @param transporteeID integer + * @param transporteeUnitDefID integer + * @param transporteeTeam integer + * @param x number + * @param y number + * @param z number + * @return boolean whether or not the transport unload is allowed */ bool CSyncedLuaHandle::AllowUnitTransportUnload( const CUnit* transporter, @@ -937,9 +936,9 @@ bool CSyncedLuaHandle::AllowUnitTransportUnload( /*** * * @function AllowUnitCloak - * @number unitID - * @number[opt] enemyID - * @treturn bool whether unit is allowed to cloak + * @param unitID integer + * @param enemyID integer? + * @return boolean whether unit is allowed to cloak */ bool CSyncedLuaHandle::AllowUnitCloak(const CUnit* unit, const CUnit* enemy) { @@ -973,10 +972,10 @@ bool CSyncedLuaHandle::AllowUnitCloak(const CUnit* unit, const CUnit* enemy) /*** * * @function AllowUnitCloak - * @number unitID - * @number[opt] objectID - * @number[opt] weaponNum - * @treturn bool whether unit is allowed to decloak + * @param unitID integer + * @param objectID integer? + * @param weaponNum number? + * @return boolean whether unit is allowed to decloak */ bool CSyncedLuaHandle::AllowUnitDecloak(const CUnit* unit, const CSolidObject* object, const CWeapon* weapon) { @@ -1017,9 +1016,9 @@ bool CSyncedLuaHandle::AllowUnitDecloak(const CUnit* unit, const CSolidObject* o /*** * * @function AllowUnitKamikaze - * @number unitID - * @number targetID - * @treturn bool whether unit is allowed to selfd + * @param unitID integer + * @param targetID integer + * @return boolean whether unit is allowed to selfd */ bool CSyncedLuaHandle::AllowUnitKamikaze(const CUnit* unit, const CUnit* target, bool allowed) { @@ -1047,12 +1046,12 @@ bool CSyncedLuaHandle::AllowUnitKamikaze(const CUnit* unit, const CUnit* target, /*** Called just before feature is created. * * @function AllowFeatureCreation - * @number featureDefID - * @number teamID - * @number x - * @number y - * @number z - * @treturn bool whether or not the creation is permitted + * @param featureDefID integer + * @param teamID integer + * @param x number + * @param y number + * @param z number + * @return boolean whether or not the creation is permitted */ bool CSyncedLuaHandle::AllowFeatureCreation(const FeatureDef* featureDef, int teamID, const float3& pos) { @@ -1091,13 +1090,13 @@ bool CSyncedLuaHandle::AllowFeatureCreation(const FeatureDef* featureDef, int te * Eg. for a 30 workertime builder, that's a build power of 1 per frame. * For a 50 buildtime feature reclaimed by this builder, part will be 100/-50(/1) = -2%, or -0.02 numerically. * - * @number builderID - * @number builderTeam - * @number featureID - * @number featureDefID - * @number part + * @param builderID integer + * @param builderTeam integer + * @param featureID integer + * @param featureDefID integer + * @param part number * - * @treturn bool whether or not the change is permitted + * @return boolean whether or not the change is permitted */ bool CSyncedLuaHandle::AllowFeatureBuildStep(const CUnit* builder, const CFeature* feature, float part) { @@ -1129,10 +1128,10 @@ bool CSyncedLuaHandle::AllowFeatureBuildStep(const CUnit* builder, const CFeatur /*** Called when a team sets the sharing level of a resource. * * @function AllowResourceLevel - * @number teamID - * @string res - * @number level - * @treturn bool whether or not the sharing level is permitted + * @param teamID integer + * @param res string + * @param level number + * @return boolean whether or not the sharing level is permitted */ bool CSyncedLuaHandle::AllowResourceLevel(int teamID, const std::string& type, float level) { @@ -1162,11 +1161,11 @@ bool CSyncedLuaHandle::AllowResourceLevel(int teamID, const std::string& type, f /*** Called just before resources are transferred between players. * * @function AllowResourceTransfer - * @number oldTeamID - * @number newTeamID - * @string res - * @number amount - * @treturn bool whether or not the transfer is permitted. + * @param oldTeamID integer + * @param newTeamID integer + * @param res string + * @param amount number + * @return boolean whether or not the transfer is permitted. */ bool CSyncedLuaHandle::AllowResourceTransfer(int oldTeam, int newTeam, const char* type, float amount) { @@ -1197,11 +1196,11 @@ bool CSyncedLuaHandle::AllowResourceTransfer(int oldTeam, int newTeam, const cha /*** Determines if this unit can be controlled directly in FPS view. * * @function AllowDirectUnitControl - * @number unitID - * @number unitDefID - * @number unitTeam - * @number playerID - * @treturn bool allow + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer + * @param playerID integer + * @return boolean allow */ bool CSyncedLuaHandle::AllowDirectUnitControl(int playerID, const CUnit* unit) { @@ -1233,9 +1232,9 @@ bool CSyncedLuaHandle::AllowDirectUnitControl(int playerID, const CUnit* unit) * * @function AllowBuilderHoldFire * - * @number unitID - * @number unitDefID - * @number action one of following: + * @param unitID integer + * @param unitDefID integer + * @param action number one of following: * * -1 Build * CMD.REPAIR Repair @@ -1244,7 +1243,7 @@ bool CSyncedLuaHandle::AllowDirectUnitControl(int playerID, const CUnit* unit) * CMD.RESURRECT Resurrect * CMD.CAPTURE Capture * - * @treturn bool actionAllowed + * @return boolean actionAllowed */ bool CSyncedLuaHandle::AllowBuilderHoldFire(const CUnit* unit, int action) { @@ -1285,17 +1284,17 @@ bool CSyncedLuaHandle::AllowBuilderHoldFire(const CUnit* unit, int action) * 3 - the player failed to load. * The default 'failed to choose' start-position is the north-west point of their startbox, or (0,0,0) if they do not have a startbox. * - * @number playerID - * @number teamID - * @number readyState - * @number clampedX - * @number clampedY - * @number clampedZ - * @number rawX - * @number rawY - * @number rawZ - * - * @treturn bool allow + * @param playerID integer + * @param teamID integer + * @param readyState number + * @param clampedX number + * @param clampedY number + * @param clampedZ number + * @param rawX number + * @param rawY number + * @param rawZ number + * + * @return boolean allow */ bool CSyncedLuaHandle::AllowStartPosition(int playerID, int teamID, unsigned char readyState, const float3& clampedPos, const float3& rawPickPos) { @@ -1333,12 +1332,12 @@ bool CSyncedLuaHandle::AllowStartPosition(int playerID, int teamID, unsigned cha * * @function MoveCtrlNotify * - * @number unitID - * @number unitDefID - * @number unitTeam - * @number data was supposed to indicate the type of notification but currently never has a value other than 1 ("unit hit the ground"). + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer + * @param data number was supposed to indicate the type of notification but currently never has a value other than 1 ("unit hit the ground"). * - * @treturn bool whether or not the unit should remain script-controlled (false) or return to engine controlled movement (true). + * @return boolean whether or not the unit should remain script-controlled (false) or return to engine controlled movement (true). */ bool CSyncedLuaHandle::MoveCtrlNotify(const CUnit* unit, int data) { @@ -1370,13 +1369,13 @@ bool CSyncedLuaHandle::MoveCtrlNotify(const CUnit* unit, int data) /*** Called when pre-building terrain levelling terraforms are completed (c.f. levelGround) * * @function TerraformComplete - * @number unitID - * @number unitDefID - * @number unitTeam - * @number buildUnitID - * @number buildUnitDefID - * @number buildUnitTeam - * @treturn bool if true the current build order is terminated + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer + * @param buildUnitID integer + * @param buildUnitDefID integer + * @param buildUnitTeam integer + * @return boolean if true the current build order is terminated */ bool CSyncedLuaHandle::TerraformComplete(const CUnit* unit, const CUnit* build) { @@ -1435,16 +1434,16 @@ bool CSyncedLuaHandle::TerraformComplete(const CUnit* unit, const CUnit* build) * 1st is stored under *newDamage if newDamage != NULL * 2nd is stored under *impulseMult if impulseMult != NULL * - * @number unitID - * @number unitDefID - * @number unitTeam - * @number damage - * @bool paralyzer - * @number[opt] weaponDefID Synced Only - * @number[opt] projectileID Synced Only - * @number[opt] attackerID Synced Only - * @number[opt] attackerDefID Synced Only - * @number[opt] attackerTeam Synced Only + * @param unitID integer + * @param unitDefID integer + * @param unitTeam integer + * @param damage number + * @param paralyzer boolean + * @param weaponDefID integer? Synced Only + * @param projectileID integer? Synced Only + * @param attackerID integer? Synced Only + * @param attackerDefID integer? Synced Only + * @param attackerTeam integer? Synced Only * * @return number newDamage, number impulseMult */ @@ -1527,17 +1526,17 @@ bool CSyncedLuaHandle::UnitPreDamaged( * * Allows fine control over how much damage and impulse is applied. * - * @number featureID - * @number featureDefID - * @number featureTeam - * @number damage - * @number weaponDefID - * @number projectileID - * @number attackerID - * @number attackerDefID - * @number attackerTeam - * @treturn number newDamage - * @treturn number impulseMult + * @param featureID integer + * @param featureDefID integer + * @param featureTeam integer + * @param damage number + * @param weaponDefID integer + * @param projectileID integer + * @param attackerID integer + * @param attackerDefID integer + * @param attackerTeam integer + * @return number newDamage + * @return number impulseMult */ bool CSyncedLuaHandle::FeaturePreDamaged( const CFeature* feature, @@ -1610,21 +1609,21 @@ bool CSyncedLuaHandle::FeaturePreDamaged( * * If the weapon is a hitscan type (BeamLaser or LightningCanon) then proID is nil and beamEmitterWeaponNum and beamEmitterUnitID are populated instead. * - * @number projectileID - * @number projectileOwnerID - * @number shieldWeaponNum - * @number shieldCarrierID - * @bool bounceProjectile - * @number beamEmitterWeaponNum - * @number beamEmitterUnitID - * @number startX - * @number startY - * @number startZ - * @number hitX - * @number hitY - * @number hitZ - * - * @treturn bool if true the gadget handles the collision event and the engine does not remove the projectile + * @param projectileID integer + * @param projectileOwnerID integer + * @param shieldWeaponNum integer + * @param shieldCarrierID integer + * @param bounceProjectile boolean + * @param beamEmitterWeaponNum integer + * @param beamEmitterUnitID integer + * @param startX number + * @param startY number + * @param startZ number + * @param hitX number + * @param hitY number + * @param hitZ number + * + * @return boolean if true the gadget handles the collision event and the engine does not remove the projectile */ bool CSyncedLuaHandle::ShieldPreDamaged( const CProjectile* projectile, @@ -1689,11 +1688,11 @@ bool CSyncedLuaHandle::ShieldPreDamaged( /*** Determines if this weapon can automatically generate targets itself. See also commandFire weaponDef tag. * * @function AllowWeaponTargetCheck - * @number attackerID - * @number attackerWeaponNum - * @number attackerWeaponDefID - * @treturn bool allowCheck - * @treturn bool ignoreCheck + * @param attackerID integer + * @param attackerWeaponNum integer + * @param attackerWeaponDefID integer + * @return boolean allowCheck + * @return boolean ignoreCheck */ int CSyncedLuaHandle::AllowWeaponTargetCheck(unsigned int attackerID, unsigned int attackerWeaponNum, unsigned int attackerWeaponDefID) { @@ -1729,13 +1728,13 @@ int CSyncedLuaHandle::AllowWeaponTargetCheck(unsigned int attackerID, unsigned i /*** Controls blocking of a specific target from being considered during a weapon's periodic auto-targeting sweep. * * @function AllowWeaponTarget - * @number attackerID - * @number targetID - * @number attackerWeaponNum - * @number attackerWeaponDefID - * @number defPriority - * @treturn bool allowed - * @treturn number the new priority for this target (if you don't want to change it, return defPriority). Lower priority targets are targeted first. + * @param attackerID integer + * @param targetID integer + * @param attackerWeaponNum integer + * @param attackerWeaponDefID integer + * @param defPriority number + * @return boolean allowed + * @return number the new priority for this target (if you don't want to change it, return defPriority). Lower priority targets are targeted first. */ bool CSyncedLuaHandle::AllowWeaponTarget( unsigned int attackerID, @@ -1795,11 +1794,11 @@ bool CSyncedLuaHandle::AllowWeaponTarget( * * Only called for weaponDefIDs registered via Script.SetWatchWeapon. * - * @number interceptorUnitID - * @number interceptorWeaponID - * @number targetProjectileID + * @param interceptorUnitID integer + * @param interceptorWeaponID integer + * @param targetProjectileID integer * - * @treturn bool allowed + * @return boolean allowed */ bool CSyncedLuaHandle::AllowWeaponInterceptTarget( const CUnit* interceptorUnit, diff --git a/rts/Lua/LuaIntro.cpp b/rts/Lua/LuaIntro.cpp index bda9828d30..318fdbc1bf 100644 --- a/rts/Lua/LuaIntro.cpp +++ b/rts/Lua/LuaIntro.cpp @@ -325,9 +325,10 @@ string CLuaIntro::LoadFile(const string& filename) const /******************************************************************************/ /******************************************************************************/ -/*** Draws custom load screens. +/*** + * Draws custom load screens. * - * @function DrawLoadScreen() + * @function DrawLoadScreen */ void CLuaIntro::DrawLoadScreen() { @@ -352,7 +353,9 @@ void CLuaIntro::DrawLoadScreen() /*** - * @function LoadProgress(message, replaceLastLine) + * @function LoadProgress + * @param message string + * @param replaceLastLine boolean */ void CLuaIntro::LoadProgress(const std::string& msg, const bool replace_lastline) { diff --git a/rts/Lua/LuaMathExtra.cpp b/rts/Lua/LuaMathExtra.cpp index 2295d9d7db..86303d2a7a 100644 --- a/rts/Lua/LuaMathExtra.cpp +++ b/rts/Lua/LuaMathExtra.cpp @@ -12,7 +12,6 @@ static const lua_Number POWERS_OF_TEN[] = {1.0f, 10.0f, 100.0f, 1000.0f, 10000.0 /****************************************************************************** * math extensions - * @module MathExtra * @see rts/Lua/LuaMathExtra.cpp ******************************************************************************/ @@ -35,12 +34,15 @@ bool LuaMathExtra::PushEntries(lua_State* L) /******************************************************************************/ -/*** Returns the length of hypotenuse of right angle triangle with sides x and y, equivalent to sqrt(x*x + y*y), but has better numerical stability and internally handles intermediate overflows/underflows, but is also slower. +/*** + * Returns the length of hypotenuse of right angle triangle with sides x and y, + * equivalent to `sqrt(x*x + y*y)`, but has better numerical stability and + * internally handles intermediate overflows/underflows, but is also slower. * * @function math.hypot - * @number x - * @number y - * @treturn number sqrt(x*x+y*y) + * @param x number + * @param y number + * @return number `sqrt(x*x+y*y)` */ int LuaMathExtra::hypot(lua_State* L) { RECOIL_DETAILED_TRACY_ZONE; @@ -49,14 +51,15 @@ int LuaMathExtra::hypot(lua_State* L) { } -/*** Returns the length of the diagonal of an n-dimensional box (or the length of an n-component vector). Rather quick method that does not handle intermediate overflows/underflows nor is made for numerical stability. +/*** + * Returns the length of the diagonal of an n-dimensional box (or the length of + * an n-component vector). Rather quick method that does not handle intermediate + * overflows/underflows nor is made for numerical stability. * * @function math.diag - * @number x1 - * @number[opt] x2 - * @number[opt] x3 - * @number[opt] xn and so on - * @treturn number diagonal + * @param x number + * @param ... number + * @return number diagonal */ int LuaMathExtra::diag(lua_State* L) { RECOIL_DETAILED_TRACY_ZONE; @@ -73,8 +76,11 @@ int LuaMathExtra::diag(lua_State* L) { /*** Returns x clamped to min and max boundaries. * - * @function math.clamp ( number x, number min, number max ) - * @treturn number clamped + * @function math.clamp + * @param value number + * @param min number + * @param max number + * @return number clamped */ int LuaMathExtra::clamp(lua_State* L) { RECOIL_DETAILED_TRACY_ZONE; @@ -89,8 +95,8 @@ int LuaMathExtra::clamp(lua_State* L) { /*** Returns 0 if x == 0, 1 if x > 0, -1 if x < 0 * * @function math.sgn - * @number x - * @treturn number sign + * @param x number + * @return number sign */ int LuaMathExtra::sgn(lua_State* L) { RECOIL_DETAILED_TRACY_ZONE; @@ -110,10 +116,10 @@ int LuaMathExtra::sgn(lua_State* L) { /*** Returns linear interpolation between x and y with ratio a (x+(y-x)*a). * * @function math.mix - * @number x - * @number y - * @number a - * @treturn number (x+(y-x)*a) + * @param x number + * @param y number + * @param a number + * @return number (x+(y-x)*a) */ int LuaMathExtra::mix(lua_State* L) { RECOIL_DETAILED_TRACY_ZONE; @@ -126,12 +132,15 @@ int LuaMathExtra::mix(lua_State* L) { } -/*** Returns x rounded to n decimals, if n is omitted or <=0, rounds to nearest integer. Note that Spring's Lua interpreter uses 32-bit floats for all numbers so max. precision is ~7 decimal digits. +/*** + * Returns x rounded to n decimals, if n is omitted or <=0, rounds to nearest + * integer. Note that Spring's Lua interpreter uses 32-bit floats for all + * numbers so max. precision is ~7 decimal digits. * * @function math.round - * @number x - * @number decimals - * @treturn number rounded + * @param x number + * @param decimals number + * @return number rounded */ int LuaMathExtra::round(lua_State* L) { RECOIL_DETAILED_TRACY_ZONE; @@ -159,8 +168,8 @@ int LuaMathExtra::round(lua_State* L) { /*** Returns erf(x), the Gauss error function, between -1 and 1. * * @function math.erf - * @number x - * @treturn number erf + * @param x number + * @return number erf */ int LuaMathExtra::erf(lua_State* L) { RECOIL_DETAILED_TRACY_ZONE; @@ -174,10 +183,10 @@ int LuaMathExtra::erf(lua_State* L) { * @function math.smoothstep * Clamps and rescales v to a value between [0; 1] based on the edges and then applies the smoothstep function. * For example math.smoothstep(10, 25, 15) is 0.259, because 15 is 0.333 of the way from 10 to 25, and smoothstep(0.333) is 0.259 - * @number edge0 - * @number edge1 - * @number v - * @treturn number smoothstep + * @param edge0 number + * @param edge1 number + * @param v number + * @return number smoothstep */ int LuaMathExtra::smoothstep(lua_State* L) { RECOIL_DETAILED_TRACY_ZONE; @@ -189,11 +198,9 @@ int LuaMathExtra::smoothstep(lua_State* L) { /*** Returns the normalize vector of an given vector. * * @function math.normalize - * @number x1 - * @number[opt] x2 - * @number[opt] xN and so on - * @treturn number normalized1 - * @treturn number normalized2 and so on + * @param x number + * @param ... number + * @return number ... normalized */ int LuaMathExtra::normalize(lua_State* L) { diff --git a/rts/Lua/LuaMenu.cpp b/rts/Lua/LuaMenu.cpp index 067fa1b2a0..44c4af3959 100644 --- a/rts/Lua/LuaMenu.cpp +++ b/rts/Lua/LuaMenu.cpp @@ -33,7 +33,6 @@ CLuaMenu* luaMenu = nullptr; /****************************************************************************** * Lua Menu API - * @module LuaMenu * @see rts/Lua/LuaMenu.cpp ******************************************************************************/ @@ -372,7 +371,7 @@ bool CLuaMenu::Disable() /*** Called whenever LuaMenu is on with no game loaded. * - * @function ActivateMenu() + * @function ActivateMenu */ void CLuaMenu::ActivateMenu(const std::string& msg) { @@ -393,7 +392,7 @@ void CLuaMenu::ActivateMenu(const std::string& msg) /*** Called whenever LuaMenu is on with a game loaded. * - * @function ActivateGame() + * @function ActivateGame */ void CLuaMenu::ActivateGame() { @@ -413,7 +412,7 @@ void CLuaMenu::ActivateGame() /*** Enables Draw{Genesis,Screen,ScreenPost} callins if true is returned, otherwise they are called once every 30 seconds. Only active when a game isn't running. * - * @function AllowDraw() + * @function AllowDraw * @return boolean allowDraw */ bool CLuaMenu::AllowDraw() diff --git a/rts/Lua/LuaMetalMap.cpp b/rts/Lua/LuaMetalMap.cpp index ce9ec6182f..900d40621f 100644 --- a/rts/Lua/LuaMetalMap.cpp +++ b/rts/Lua/LuaMetalMap.cpp @@ -12,7 +12,6 @@ /****************************************************************************** * Metal Map Lua API - * @module MetalMap * @see rts/Lua/LuaMetalMap.cpp ******************************************************************************/ @@ -52,12 +51,10 @@ int LuaMetalMap::GetMetalAmount(lua_State* L) /*** * @function Spring.SetMetalAmount - * @number x in worldspace/16. - * @number z in worldspace/16. - * @number metalAmount must be between 0 and 255*maxMetal (with maxMetal from the .smd or mapinfo.lua). - * @treturn nil - * - * + * @param x integer in worldspace/16. + * @param z integer in worldspace/16. + * @param metalAmount number must be between 0 and 255*maxMetal (with maxMetal from the .smd or mapinfo.lua). + * @return nil */ int LuaMetalMap::SetMetalAmount(lua_State* L) { diff --git a/rts/Lua/LuaOpenGL.cpp b/rts/Lua/LuaOpenGL.cpp index b5dd9c979c..e0e4ad7f73 100644 --- a/rts/Lua/LuaOpenGL.cpp +++ b/rts/Lua/LuaOpenGL.cpp @@ -86,7 +86,6 @@ CONFIG(int, DeprecatedGLWarnLevel).defaultValue(0).headlessValue(0).safemodeValu /****************************************************************************** * Lua OpenGL API * - * @module OpenGL * * @see rts/Lua/LuaOpenGL.cpp ******************************************************************************/ @@ -1288,15 +1287,17 @@ int LuaOpenGL::EndText(lua_State* L) return 0; } +/** + * @table gl + */ /*** - * * @function gl.Text - * @string text - * @number x - * @number y - * @number size - * @string[opt] options concatenated string of option characters. + * @param text string + * @param x number + * @param y number + * @param size number + * @param options string? concatenated string of option characters. * * - horizontal alignment: * - 'c' = center @@ -1314,7 +1315,7 @@ int LuaOpenGL::EndText(lua_State* L) * - 's' = shadow * - other: * - 'n' = don't round vertex coords to nearest integer (font may get blurry) - * @treturn nil + * @return nil */ int LuaOpenGL::Text(lua_State* L) { @@ -2527,14 +2528,19 @@ int LuaOpenGL::MemoryBarrier(lua_State* L) ******************************************************************************/ /*** - * * @function gl.Color - * @tparam number|{number,number,number,number} r red when number, rgba - * quadruple or rgb triple otherwise - * @number[opt] g - * @number[opt] b - * @number[opt] a - * @treturn nil + * @param r number Red + * @param g number Green + * @param b number Blue + * @param a number? Alpha (Default: 1.0f) + */ +/*** + * @function gl.Color + * @param rgbs [number,number,number,number] Red, green, blue, alpha + */ +/*** + * @function gl.Color + * @param rgb [number,number,number] Red, green, blue */ int LuaOpenGL::Color(lua_State* L) { diff --git a/rts/Lua/LuaRBOs.cpp b/rts/Lua/LuaRBOs.cpp index f296d2d884..49ac9dfa5d 100644 --- a/rts/Lua/LuaRBOs.cpp +++ b/rts/Lua/LuaRBOs.cpp @@ -13,7 +13,6 @@ /****************************************************************************** * RBO - * @module RBO * @see rts/Lua/LuaRBOs.cpp ******************************************************************************/ @@ -139,23 +138,28 @@ int LuaRBOs::meta_newindex(lua_State* L) /*** * User Data RBO - * @table rbo - * @number target - * @number format - * @number xsize - * @number ysize - * @bool valid - * @number samples will return globalRendering->msaaLevel for multisampled RBO or 0 otherwise + * @class RBO + * @field target GL + * @field format GL + * @field xsize integer + * @field ysize integer + * @field valid boolean + * @field samples integer will return globalRendering->msaaLevel for multisampled RBO or 0 otherwise + */ + +/** + * @class CreateRBOData + * @field target GL + * @field format GL + * @field samples number? any number here will result in creation of multisampled RBO */ /*** * @function gl.CreateRBO - * @number xsize - * @number ysize - * @tparam table data - * @number data.target `GL_RENDERBUFFER_EXT` - * @number data.format `GL_RGBA` - * @number[opt] data.samples any number here will result in creation of multisampled RBO + * @param xsize integer + * @param ysize integer + * @param data CreateRBOData + * @return RBO */ int LuaRBOs::CreateRBO(lua_State* L) { @@ -228,7 +232,7 @@ int LuaRBOs::CreateRBO(lua_State* L) /*** * @function gl.DeleteRBO - * @tparam rbo rbo + * @param rbo RBO */ int LuaRBOs::DeleteRBO(lua_State* L) { diff --git a/rts/Lua/LuaRules.cpp b/rts/Lua/LuaRules.cpp index 0529d8671c..8c5b0e67dc 100644 --- a/rts/Lua/LuaRules.cpp +++ b/rts/Lua/LuaRules.cpp @@ -78,7 +78,6 @@ int CLuaRules::GetInitSelectTeam() const /****************************************************************************** * Lua Rules - * @module LuaRules * * @see rts/Lua/LuaRules.cpp ******************************************************************************/ diff --git a/rts/Lua/LuaShaders.cpp b/rts/Lua/LuaShaders.cpp index b0b17a5d7b..37f64b568d 100644 --- a/rts/Lua/LuaShaders.cpp +++ b/rts/Lua/LuaShaders.cpp @@ -31,7 +31,6 @@ float fltUniformArrayBuf[1024] = {0.0f}; /****************************************************************************** * Shader creation and management - * @module Shaders * * These functions are ONLY available if the graphics adapter supports GLSL. * Please test in your scripts if one of them exists before you use them. In headless mode, the gl. callouts are nil. @@ -199,7 +198,7 @@ bool LuaShaders::DeleteProgram(Program& p) /*** Returns the shader compilation error log. This is empty if the shader linking failed, in that case, check your in/out blocks and ensure they match. * * @function gl.GetShaderLog - * @treturn string infoLog + * @return string infoLog */ int LuaShaders::GetShaderLog(lua_State* L) { @@ -550,38 +549,81 @@ GLint LuaShaders::GetUniformLocation(LuaShaders::Program* p, const char* name) return iter->second.location; } -/*** Create a shader from shaderParams table: - * - * @function gl.CreateShader ( table shaderParams ) - * @tparam table shaderParams - * @treturn number shaderID - * - * ({[ vertex = "glsl code" ,] - * [ tcs = "glsl code" ,] - * [ tes = "glsl code" ,] - * [ geometry = "glsl code" ,] - * [ fragment = "glsl code" ,] - * [ uniform = { uniformName = number value, ...} ,] (specify a Lua array as an argument to uniformName to initialize GLSL arrays) - * [ uniformInt = { uniformName = number value, ...} ,] (specify a Lua array as an argument to uniformName to initialize GLSL arrays) - * [ uniformFloat = { uniformName = number value, ...} ,] (specify a Lua array as an argument to uniformName to initialize GLSL arrays) - * [ uniformMatrix = { uniformName = number value, ...} ,] - * [ geoInputType = number inType,] - * [ geoOutputType = number outType,] - * [ geoOutputVerts = number maxVerts,] - * [ definitions = "string of shader #defines", ] - * }) +/** + * A table of uniform name to value. * - * - The "Vertex" or vertex-shader is your GLSL-Code as string, its written in a C-Dialect. This shader is busy deforming the geometry of a unit but it can not create new polygons. Use it for waves, wobbling surfaces etc. - * - The "Geometry" or Geometry-shader can create new vertices and vertice-stripes from points. - * - The "TCS" or Tesselation Control Shader controls how much tessellation a particular patch gets; it also defines the size of a patch, thus allowing it to augment data. It can also filter vertex data taken from the vertex shader. The main purpose of the TCS is to feed the tessellation levels to the Tessellation primitive generator stage, as well as to feed patch data (as its output values) to the Tessellation Evaluation Shader stage. - * - The "TES" or Tesselation Evaluation Shader takes the abstract patch generated by the tessellation primitive generation stage, as well as the actual vertex data for the entire patch, and generates a particular vertex from it. Each TES invocation generates a single vertex. It can also take per-patch data provided by the Tessellation Control Shader. - * - The "Fragment" or Fragment-shader (sometimes called pixel-Shader) is post processing the allready rendered picture (for example drawing stars on the sky)- remember textures are not always 2 dimensional pictures. They can contain information about the depth, or the third value marks areas and the strength at which these are processed. - * - The Uniforms are the values, you send along with the shader-program. To use them in the shader-program declare them like this: `uniform float frame;` - * - * The engine will automatically fill in an appropriately named uniform for team colour if it is declared; + * The Uniforms are the values you send along with the shader-program. To use + * them in the shader-program declare them like this: `uniform float frame;` + * + * Specify a Lua array to initialize GLSL arrays. + * + * The engine will automatically fill in an appropriately named uniform for team + * colour if it is declared; * - * uniform vec4 teamColor; + * ```glsl + * uniform vec4 teamColor; + * ``` + * + * @class UniformParam : { [string]: T|T[] } + */ + +/*** + * @class ShaderParams + * + * @field vertex string? + * + * The "Vetex" or vertex-shader is your GLSL-Code as string, its written in a + * C-Dialect. This shader is busy deforming the geometry of a unit but it can + * not create new polygons. Use it for waves, wobbling surfaces etc. + * + * @field tcs string? + * + * The "TCS" or Tesselation Control Shader controls how much tessellation a + * particular patch gets; it also defines the size of a patch, thus allowing it + * to augment data. It can also filter vertex data taken from the vertex shader. + * The main purpose of the TCS is to feed the tessellation levels to the + * Tessellation primitive generator stage, as well as to feed patch data (as its + * output values) to the Tessellation Evaluation Shader stage. + * + * @field tes string? + * + * The "TES" or Tesselation Evaluation Shader takes the abstract patch generated + * by the tessellation primitive generation stage, as well as the actual vertex + * data for the entire patch, and generates a particular vertex from it. Each + * TES invocation generates a single vertex. It can also take per-patch data + * provided by the Tessellation Control Shader. + * + * @field geometry string? + * + * The "Geometry" or Geometry-shader can create new vertices and vertice-stripes + * from points. + * + * @field fragment string? + * + * The "Fragment" or Fragment-shader (sometimes called pixel-Shader) is post + * processing the allready rendered picture (for example drawing stars on the + * sky). + * + * Remember textures are not always 2 dimensional pictures. They can contain + * information about the depth, or the third value marks areas and the strength + * at which these are processed. + * + * @field uniform UniformParam? + * @field uniformInt UniformParam? + * @field uniformFloat UniformParam? + * @field uniformMatrix UniformParam? + * @field geoInputType integer? inType + * @field geoOutputType integer? outType + * @field geoOutputVerts integer? maxVerts + * @field definitions string? string of shader #defines" + */ + +/*** + * Create a shader. * + * @function gl.CreateShader + * @param shaderParams ShaderParams + * @return integer shaderID */ int LuaShaders::CreateShader(lua_State* L) { @@ -745,8 +787,7 @@ int LuaShaders::CreateShader(lua_State* L) /*** Deletes a shader identified by shaderID * * @function gl.DeleteShader - * @number shaderID - * @treturn nil + * @param shaderID integer */ int LuaShaders::DeleteShader(lua_State* L) { @@ -763,8 +804,8 @@ int LuaShaders::DeleteShader(lua_State* L) /*** Binds a shader program identified by shaderID. Pass 0 to disable the shader. Returns wether the shader was successfully bound. * * @function gl.UseShader - * @number shaderID - * @treturn bool linked + * @param shaderID integer + * @return boolean linked */ int LuaShaders::UseShader(lua_State* L) { @@ -793,17 +834,16 @@ int LuaShaders::UseShader(lua_State* L) } -/*** Binds a shader program identified by shaderID, and calls the Lua func with the specified arguments. +/*** + * Binds a shader program identified by shaderID, and calls the Lua func with + * the specified arguments. * * Can be used in NON-drawing events (to update uniforms etc.)! * * @function gl.ActiveShader - * @number shaderID - * @func func - * @tparam[opt] any arg1 - * @tparam[opt] any arg2 - * @tparam[opt] any argn - * @treturn nil + * @param shaderID integer + * @param func function + * @param ... any Arguments */ int LuaShaders::ActiveShader(lua_State* L) { @@ -877,12 +917,22 @@ static const char* UniformTypeString(GLenum type) } } +/*** + * @class ActiveUniform + * @field name string + * @field type string String name of `GL_*` constant. + * @field length integer The character length of `name`. + * @field size integer + * @field location GL + */ -/*** Query the active (actually used) uniforms of a shader and identify their names, types (float, int, uint) and sizes (float, vec4, ...). +/*** + * Query the active (actually used) uniforms of a shader and identify their + * names, types (float, int, uint) and sizes (float, vec4, ...). * * @function gl.GetActiveUniforms - * @number shaderID - * @treturn table `ActiveUniforms = { { name = "name", type = "type", length = number length, size = number size }, ...}` + * @param shaderID integer + * @return ActiveUniform[] activeUniforms */ int LuaShaders::GetActiveUniforms(lua_State* L) { @@ -911,12 +961,14 @@ int LuaShaders::GetActiveUniforms(lua_State* L) } -/*** Returns the locationID of a shaders uniform. Needed for changing uniform values with @function gl.Uniform. +/*** + * Returns the locationID of a shaders uniform. Needed for changing uniform + * values with function `gl.Uniform`. * * @function gl.GetUniformLocation - * @number shaderID - * @string name - * @treturn number locationID + * @param shaderID integer + * @param name string + * @return GL locationID */ int LuaShaders::GetUniformLocation(lua_State* L) { @@ -988,15 +1040,16 @@ int LuaShaders::SetFeatureBufferUniforms(lua_State* L) { return SetObjectBufferU /******************************************************************************/ /******************************************************************************/ -/*** Sets the uniform float value at the locationID for the currently active shader. Shader must be activated before setting uniforms. +/*** + * Sets the uniform float value at the locationID for the currently active + * shader. Shader must be activated before setting uniforms. * * @function gl.Uniform - * @number locationID|string uniformName - * @number f1 - * @number[opt] f2 - * @number[opt] f3 - * @number[opt] f4 - * @treturn nil + * @param locationID GL|string uniformName + * @param f1 number + * @param f2 number? + * @param f3 number? + * @param f4 number? */ int LuaShaders::Uniform(lua_State* L) { @@ -1028,15 +1081,16 @@ int LuaShaders::Uniform(lua_State* L) } -/*** Sets the uniform int value at the locationID for the currently active shader. Shader must be activated before setting uniforms. +/*** + * Sets the uniform int value at the locationID for the currently active shader. + * Shader must be activated before setting uniforms. * * @function gl.UniformInt - * @number locationID|string uniformName - * @number int1 - * @number[opt] int2 - * @number[opt] int3 - * @number[opt] int4 - * @treturn nil + * @param locationID integer|string uniformName + * @param int1 integer + * @param int2 integer? + * @param int3 integer? + * @param int4 integer? */ int LuaShaders::UniformInt(lua_State* L) { @@ -1090,14 +1144,23 @@ static bool GLUniformArray(lua_State* L, UniformFunc uf, ParseArrayFunc pf) } #endif +/*** + * @alias UniformArrayType + * | 1 # int + * | 2 # float + * | 3 # float matrix + */ -/*** Sets the an array of uniform values at the locationID for the currently active shader. Shader must be activated before setting uniforms. Type can be one of {1 = int, 2 = float, 3 = float matrix}. +/*** + * Sets the an array of uniform values at the locationID for the currently + * active shader. + * + * Shader must be activated before setting uniforms. * * @function gl.UniformArray - * @number locationID|string uniformName - * @number type - * @tparam table uniforms Array up to 1024 elements - * @treturn nil + * @param locationID integer|string uniformName + * @param type UniformArrayType + * @param uniforms number[] Array up to 1024 elements */ int LuaShaders::UniformArray(lua_State* L) { @@ -1137,15 +1200,30 @@ int LuaShaders::UniformArray(lua_State* L) return 0; } -/*** Sets the a uniform mat4 locationID for the currently active shader. Shader must be activated before setting uniforms. Can set one one common matrix like shadow, or by passing 16 additional numbers for the matrix. +/*** + * Sets the a uniform mat4 locationID for the currently active shader. + * + * Shader must be activated before setting uniforms. + * + * Can set one one common matrix like shadow, or by passing 16 additional + * numbers for the matrix. * * @function gl.UniformMatrix - * @number locationID|string uniformName - * @tparam ?string|number m1 "shadows" | "camera" | "caminv" | "camprj" - * @number[opt] m2 - * @number[opt] mn - * @number[opt] m16 - * @treturn nil + * @param locationID integer|string uniformName + * @param matrix "shadows"|"camera"|"caminv"|"camprj" Name of common matrix. + */ + +/*** + * Sets the a uniform mat4 locationID for the currently active shader. + * + * Shader must be activated before setting uniforms. + * + * Can set one one common matrix like shadow, or by passing 16 additional + * numbers for the matrix. + * + * @function gl.UniformMatrix + * @param locationID number|string uniformName + * @param matrix number[] A 2x2, 3x3 or 4x4 matrix. */ int LuaShaders::UniformMatrix(lua_State* L) { @@ -1229,8 +1307,8 @@ int LuaShaders::UniformSubroutine(lua_State* L) * * Return the GLSL compliant definition of UniformMatricesBuffer(idx=0) or UniformParamsBuffer(idx=1) structure. * - * @number index - * @treturn string glslDefinition + * @param index number + * @return string glslDefinition */ int LuaShaders::GetEngineUniformBufferDef(lua_State* L) { @@ -1251,8 +1329,8 @@ int LuaShaders::GetEngineUniformBufferDef(lua_State* L) * * Return the GLSL compliant definition of ModelUniformData structure (per Unit/Feature buffer available on GPU) * - * @number index - * @treturn string glslDefinition + * @param index number + * @return string glslDefinition */ int LuaShaders::GetEngineModelUniformDataDef(lua_State* L) { @@ -1266,10 +1344,10 @@ int LuaShaders::GetEngineModelUniformDataDef(lua_State* L) /*** Sets the Geometry shader parameters for shaderID. Needed by geometry shader programs (check the opengl GL_ARB_geometry_shader4 extension for glProgramParameteri) * * @function gl.SetGeometryShaderParameter - * @number shaderID - * @number param - * @number number - * @treturn nil + * @param shaderID integer + * @param param number + * @param number number + * @return nil */ int LuaShaders::SetGeometryShaderParameter(lua_State* L) { @@ -1291,14 +1369,16 @@ int LuaShaders::SetGeometryShaderParameter(lua_State* L) return 0; } -/*** Sets the tesselation shader parameters for shaderID. - * - * Needed by tesselation shader programs (check the opengl GL_ARB_tessellation_shader extension for glProgramParameteri) +/*** + * Sets the tesselation shader parameters for `shaderID`. * + * Needed by tesselation shader programs. (Check the opengl + * `GL_ARB_tessellation_shader` extension for `glProgramParameteri`). + * * @function gl.SetTesselationShaderParameter - * @number param - * @number number - * @treturn nil + * @param param integer + * @param value integer + * @return nil */ int LuaShaders::SetTesselationShaderParameter(lua_State* L) { diff --git a/rts/Lua/LuaSyncedCtrl.cpp b/rts/Lua/LuaSyncedCtrl.cpp index 36567b7cda..282230727f 100644 --- a/rts/Lua/LuaSyncedCtrl.cpp +++ b/rts/Lua/LuaSyncedCtrl.cpp @@ -93,7 +93,6 @@ static float smoothMeshAmountChanged = 0.0f; /*** Synced Lua API -@module SyncedCtrl @see rts/Lua/LuaSyncedCtrl.cpp */ @@ -788,10 +787,10 @@ static inline bool IsPlayerSynced(const CPlayer* player) /*** Changes the value of the (one-sided) alliance between: firstAllyTeamID -> secondAllyTeamID. * * @function Spring.SetAlly - * @number firstAllyTeamID - * @number secondAllyTeamID - * @bool ally - * @treturn nil + * @param firstAllyTeamID integer + * @param secondAllyTeamID integer + * @param ally boolean + * @return nil */ int LuaSyncedCtrl::SetAlly(lua_State* L) { @@ -811,12 +810,12 @@ int LuaSyncedCtrl::SetAlly(lua_State* L) /*** Changes the start box position of an allyTeam. * * @function Spring.SetAllyTeamStartBox - * @number allyTeamID - * @number xMin left start box boundary (elmos) - * @number zMin top start box boundary (elmos) - * @number xMax right start box boundary (elmos) - * @number zMax bottom start box boundary (elmos) - * @treturn nil + * @param allyTeamID integer + * @param xMin number left start box boundary (elmos) + * @param zMin number top start box boundary (elmos) + * @param xMax number right start box boundary (elmos) + * @param zMax number bottom start box boundary (elmos) + * @return nil */ int LuaSyncedCtrl::SetAllyTeamStartBox(lua_State* L) { @@ -843,9 +842,9 @@ int LuaSyncedCtrl::SetAllyTeamStartBox(lua_State* L) /*** Assigns a player to a team. * * @function Spring.AssignPlayerToTeam - * @number playerID - * @number teamID - * @treturn nil + * @param playerID integer + * @param teamID integer + * @return nil */ int LuaSyncedCtrl::AssignPlayerToTeam(lua_State* L) { @@ -871,9 +870,9 @@ int LuaSyncedCtrl::AssignPlayerToTeam(lua_State* L) /*** Changes access to global line of sight for a team and its allies. * * @function Spring.SetGlobalLos - * @number allyTeamID - * @bool globallos - * @treturn nil + * @param allyTeamID integer + * @param globallos boolean + * @return nil */ int LuaSyncedCtrl::SetGlobalLos(lua_State* L) { @@ -898,8 +897,8 @@ int LuaSyncedCtrl::SetGlobalLos(lua_State* L) * * Gaia team cannot be killed. * - * @number teamID - * @treturn nil + * @param teamID integer + * @return nil */ int LuaSyncedCtrl::KillTeam(lua_State* L) { @@ -929,10 +928,10 @@ int LuaSyncedCtrl::KillTeam(lua_State* L) * * A list of winning allyteams can be passed, if undecided (like when dropped from the host) it should be empty (no winner), in the case of a draw with multiple winners, all should be listed. * - * @number[opt] allyTeamID1 - * @number[opt] allyTeamID2 - * @number[opt] allyTeamIDn - * @treturn nil + * @param allyTeamID1 number? + * @param allyTeamID2 number? + * @param allyTeamIDn number? + * @return nil */ int LuaSyncedCtrl::GameOver(lua_State* L) { @@ -973,8 +972,8 @@ int LuaSyncedCtrl::GameOver(lua_State* L) /*** Set tidal strength * * @function Spring.SetTidal - * @number strength - * @treturn nil + * @param strength number + * @return nil */ int LuaSyncedCtrl::SetTidal(lua_State* L) { @@ -986,9 +985,9 @@ int LuaSyncedCtrl::SetTidal(lua_State* L) /*** Set wind strength * * @function Spring.SetWind - * @number minStrength - * @number maxStrength - * @treturn nil + * @param minStrength number + * @param maxStrength number + * @return nil */ int LuaSyncedCtrl::SetWind(lua_State* L) { @@ -999,10 +998,10 @@ int LuaSyncedCtrl::SetWind(lua_State* L) /*** Adds metal or energy resources to the specified team. * * @function Spring.AddTeamResource - * @number teamID - * @string type "metal" | "energy" - * @number amount - * @treturn nil + * @param teamID integer + * @param type ResourceName + * @param amount number + * @return nil */ int LuaSyncedCtrl::AddTeamResource(lua_State* L) { @@ -1032,14 +1031,24 @@ int LuaSyncedCtrl::AddTeamResource(lua_State* L) return 0; } - -/*** Consumes metal and/or energy resources of the specified team. +/*** + * Consumes metal or energy resources of the specified team. + * + * @function Spring.UseTeamResource + * @param teamID integer + * @param type ResourceName Resource type. + * @param amount number Amount of resource to use. + * @return boolean hadEnough + * True if enough of the resource type was available and was consumed, otherwise false. + */ +/*** + * Consumes metal and/or energy resources of the specified team. * * @function Spring.UseTeamResource - * @number teamID - * @string type "metal" | "energy" - * @tparam ?number|table amount `{ metal = number amount, energy = number amount }` - * @treturn ?nil|bool hadEnough + * @param teamID integer + * @param amount ResourceUsage + * @return boolean hadEnough + * True if enough of the resource type(s) were available and was consumed, otherwise false. */ int LuaSyncedCtrl::UseTeamResource(lua_State* L) { @@ -1120,10 +1129,10 @@ int LuaSyncedCtrl::UseTeamResource(lua_State* L) /*** * @function Spring.SetTeamResource - * @number teamID - * @string res "m" = metal "e" = energy "ms" = metal storage "es" = energy storage - * @number amount - * @treturn nil + * @param teamID integer + * @param resource ResourceName|StorageName + * @param amount number + * @return nil */ int LuaSyncedCtrl::SetTeamResource(lua_State* L) { @@ -1171,10 +1180,10 @@ int LuaSyncedCtrl::SetTeamResource(lua_State* L) /*** Changes the resource amount for a team beyond which resources aren't stored but transferred to other allied teams if possible. * * @function Spring.SetTeamShareLevel - * @number teamID - * @string type "metal" | "energy" - * @number amount - * @treturn nil + * @param teamID integer + * @param type ResourceName + * @param amount number + * @return nil */ int LuaSyncedCtrl::SetTeamShareLevel(lua_State* L) { @@ -1208,11 +1217,11 @@ int LuaSyncedCtrl::SetTeamShareLevel(lua_State* L) /*** Transfers resources between two teams. * * @function Spring.ShareTeamResource - * @number teamID_src - * @number teamID_recv - * @string type "metal" | "energy" - * @number amount - * @treturn nil + * @param teamID_src integer + * @param teamID_recv integer + * @param type ResourceName + * @param amount number + * @return nil */ int LuaSyncedCtrl::ShareTeamResource(lua_State* L) { @@ -1280,18 +1289,27 @@ int LuaSyncedCtrl::ShareTeamResource(lua_State* L) * @section rulesparams ******************************************************************************/ -/*** Parameters for los access +/*** + * Parameters for los access + * + * If one condition is fulfilled all beneath it are too (e.g. if an unit is in + * LOS it can read params with `inradar=true` even if the param has + * `inlos=false`) All GameRulesParam are public, TeamRulesParams can just be + * `private`,`allied` and/or `public` You can read RulesParams from any Lua + * enviroments! With those losAccess policies you can limit their access. * - * @table losAccess - * If one condition is fulfilled all beneath it are too (e.g. if an unit is in LOS it can read params with `inradar=true` even if the param has `inlos=false`) - * All GameRulesParam are public, TeamRulesParams can just be `private`,`allied` and/or `public` - * You can read RulesParams from any Lua enviroments! With those losAccess policies you can limit their access. + * NOTE: Need to explicitly declare `public` scope here to prevent LLS from + * detecting field names as access modifiers. + * + * See https://github.com/LuaLS/lua-language-server/issues/1814 + * + * @class losAccess * - * @bool[opt] private only readable by the ally (default) - * @bool[opt] allied readable by ally + ingame allied - * @bool[opt] inlos readable if the unit is in LOS - * @bool[opt] inradar readable if the unit is in AirLOS - * @bool[opt] public readable by all + * @field public private boolean? only readable by the ally (default) + * @field public allied boolean? readable by ally + ingame allied + * @field public inlos boolean? readable if the unit is in LOS + * @field public inradar boolean? readable if the unit is in AirLOS + * @field public public boolean? readable by all */ @@ -1354,10 +1372,10 @@ void SetRulesParam(lua_State* L, const char* caller, int offset, /*** * @function Spring.SetGameRulesParam - * @string paramName - * @tparam ?number|string paramValue numeric paramValues in quotes will be converted to number. - * @tparam[opt] losAccess losAccess - * @treturn nil + * @param paramName string + * @param paramValue ?number|string numeric paramValues in quotes will be converted to number. + * @tparam? losAccess losAccess + * @return nil */ int LuaSyncedCtrl::SetGameRulesParam(lua_State* L) { @@ -1368,11 +1386,11 @@ int LuaSyncedCtrl::SetGameRulesParam(lua_State* L) /*** * @function Spring.SetTeamRulesParam - * @number teamID - * @string paramName - * @tparam ?number|string paramValue numeric paramValues in quotes will be converted to number. - * @tparam[opt] losAccess losAccess - * @treturn nil + * @param teamID integer + * @param paramName string + * @param paramValue ?number|string numeric paramValues in quotes will be converted to number. + * @tparam? losAccess losAccess + * @return nil */ int LuaSyncedCtrl::SetTeamRulesParam(lua_State* L) { @@ -1386,11 +1404,11 @@ int LuaSyncedCtrl::SetTeamRulesParam(lua_State* L) /*** * @function Spring.SetPlayerRulesParam - * @number playerID - * @string paramName - * @tparam ?number|string paramValue numeric paramValues in quotes will be converted to number. - * @tparam[opt] losAccess losAccess - * @treturn nil + * @param playerID integer + * @param paramName string + * @param paramValue ?number|string numeric paramValues in quotes will be converted to number. + * @tparam? losAccess losAccess + * @return nil */ int LuaSyncedCtrl::SetPlayerRulesParam(lua_State* L) { @@ -1410,11 +1428,11 @@ int LuaSyncedCtrl::SetPlayerRulesParam(lua_State* L) /*** * * @function Spring.SetUnitRulesParam - * @number unitID - * @string paramName - * @tparam ?number|string paramValue numeric paramValues in quotes will be converted to number. - * @tparam[opt] losAccess losAccess - * @treturn nil + * @param unitID integer + * @param paramName string + * @param paramValue ?number|string numeric paramValues in quotes will be converted to number. + * @tparam? losAccess losAccess + * @return nil */ int LuaSyncedCtrl::SetUnitRulesParam(lua_State* L) { @@ -1430,11 +1448,11 @@ int LuaSyncedCtrl::SetUnitRulesParam(lua_State* L) /*** * @function Spring.SetFeatureRulesParam - * @number featureID - * @string paramName - * @tparam ?number|string paramValue numeric paramValues in quotes will be converted to number. - * @tparam[opt] losAccess losAccess - * @treturn nil + * @param featureID integer + * @param paramName string + * @param paramValue ?number|string numeric paramValues in quotes will be converted to number. + * @tparam? losAccess losAccess + * @return nil */ int LuaSyncedCtrl::SetFeatureRulesParam(lua_State* L) { @@ -1494,16 +1512,11 @@ static inline void ParseCobArgs( /*** * @function Spring.CallCOBScript - * @number unitID - * @tparam ?number|string funcName - * @number retArgs - * @param[opt] COBArg1 - * @param[opt] COBArg2 - * @param[opt] COBArgn - * @treturn ?nil|number returnValue - * @treturn ?nil|number returnArg1 - * @treturn ?nil|number returnArg2 - * @treturn ?nil|number returnArgn + * @param unitID integer + * @param funcName integer|string? Function ID or name. + * @param retArgs integer Number of values to return. + * @param ... any Arguments + * @return number ... */ int LuaSyncedCtrl::CallCOBScript(lua_State* L) { @@ -1560,9 +1573,9 @@ int LuaSyncedCtrl::CallCOBScript(lua_State* L) /*** * @function Spring.GetCOBScriptID - * @number unitID - * @string funcName - * @treturn ?nil|number funcID + * @param unitID integer + * @param funcName string + * @return integer? funcID */ int LuaSyncedCtrl::GetCOBScriptID(lua_State* L) { @@ -1603,17 +1616,17 @@ int LuaSyncedCtrl::GetCOBScriptID(lua_State* L) * * Offmap positions are clamped! Use MoveCtrl to move to such positions. * - * @tparam string|number unitDefName or unitDefID - * @number x - * @number y - * @number z - * @tparam string|number facing possible values for facing are: "south" | "s" | 0, "east" | "e" | 1, "north" | "n" | 2, "west" | "w" | 3 - * @number teamID - * @bool[opt=false] build the unit is created in "being built" state with buildProgress = 0 - * @bool[opt=true] flattenGround the unit flattens ground, if it normally does so - * @number[opt] unitID requests specific unitID - * @number[opt] builderID - * @treturn number|nil unitID meaning unit was created + * @param unitDefName string|number or unitDefID + * @param x number + * @param y number + * @param z number + * @param facing string|number possible values for facing are: "south" | "s" | 0, "east" | "e" | 1, "north" | "n" | 2, "west" | "w" | 3 + * @param teamID integer + * @param build boolean? (Default: false) the unit is created in "being built" state with buildProgress = 0 + * @param flattenGround boolean? (Default: true) the unit flattens ground, if it normally does so + * @param unitID integer? requests specific unitID + * @param builderID integer? + * @return number|nil unitID meaning unit was created */ int LuaSyncedCtrl::CreateUnit(lua_State* L) { @@ -1702,12 +1715,12 @@ int LuaSyncedCtrl::CreateUnit(lua_State* L) /*** * @function Spring.DestroyUnit * @see Spring.CreateUnit - * @number unitID - * @bool[opt=false] selfd makes the unit act like it self-destructed. - * @bool[opt=false] reclaimed don't show any DeathSequences, don't leave a wreckage. This does not give back the resources to the team! - * @number[opt] attackerID - * @bool[opt=false] cleanupImmediately stronger version of reclaimed, removes the unit unconditionally and makes its ID available for immediate reuse (otherwise it takes a few frames) - * @treturn nil + * @param unitID integer + * @param selfd boolean? (Default: false) makes the unit act like it self-destructed. + * @param reclaimed boolean? (Default: false) don't show any DeathSequences, don't leave a wreckage. This does not give back the resources to the team! + * @param attackerID integer? + * @param cleanupImmediately boolean? (Default: false) stronger version of reclaimed, removes the unit unconditionally and makes its ID available for immediate reuse (otherwise it takes a few frames) + * @return nil */ int LuaSyncedCtrl::DestroyUnit(lua_State* L) { @@ -1746,10 +1759,10 @@ int LuaSyncedCtrl::DestroyUnit(lua_State* L) /*** * @function Spring.TransferUnit - * @number unitID - * @number newTeamID - * @bool[opt=true] given if false, the unit is captured. - * @treturn nil + * @param unitID integer + * @param newTeamID integer + * @param given boolean? (Default: true) if false, the unit is captured. + * @return nil */ int LuaSyncedCtrl::TransferUnit(lua_State* L) { @@ -1791,9 +1804,9 @@ int LuaSyncedCtrl::TransferUnit(lua_State* L) /*** * @function Spring.SetUnitCosts - * @number unitID - * @tparam {[number]=number,...} where keys and values are, respectively and in this order: buildTime=amount, metalCost=amount, energyCost=amount - * @treturn nil + * @param unitID integer + * @param where table keys and values are, respectively and in this order: buildTime=amount, metalCost=amount, energyCost=amount + * @return nil */ int LuaSyncedCtrl::SetUnitCosts(lua_State* L) { @@ -1894,17 +1907,17 @@ static bool SetUnitResourceParam(CUnit* unit, const char* name, float value) /*** * @function Spring.SetUnitResourcing - * @number unitID - * @string res - * @number amount - * @treturn nil + * @param unitID integer + * @param res string + * @param amount number + * @return nil */ /*** * @function Spring.SetUnitResourcing - * @number unitID - * @tparam {[string]=number,...} res keys are: "[u|c][u|m][m|e]" unconditional | conditional, use | make, metal | energy. Values are amounts - * @treturn nil + * @param unitID integer + * @param res table keys are: "[u|c][u|m][m|e]" unconditional | conditional, use | make, metal | energy. Values are amounts + * @return nil */ int LuaSyncedCtrl::SetUnitResourcing(lua_State* L) { @@ -1935,9 +1948,9 @@ int LuaSyncedCtrl::SetUnitResourcing(lua_State* L) /*** * @function Spring.SetUnitTooltip - * @number unitID - * @string tooltip - * @treturn nil + * @param unitID integer + * @param tooltip string + * @return nil */ int LuaSyncedCtrl::SetUnitTooltip(lua_State* L) { @@ -1959,9 +1972,9 @@ int LuaSyncedCtrl::SetUnitTooltip(lua_State* L) /*** * @function Spring.SetUnitHealth - * @number unitID - * @tparam number|{[string]=number,...} health where keys can be one of health|capture|paralyze|build and values are amounts - * @treturn nil + * @param unitID integer + * @param health number|table where keys can be one of health|capture|paralyze|build and values are amounts + * @return nil */ int LuaSyncedCtrl::SetUnitHealth(lua_State* L) { @@ -2014,9 +2027,9 @@ int LuaSyncedCtrl::SetUnitHealth(lua_State* L) /*** * @function Spring.SetUnitMaxHealth - * @number unitID - * @number maxHealth - * @treturn nil + * @param unitID integer + * @param maxHealth number + * @return nil */ int LuaSyncedCtrl::SetUnitMaxHealth(lua_State* L) { @@ -2033,10 +2046,10 @@ int LuaSyncedCtrl::SetUnitMaxHealth(lua_State* L) /*** * @function Spring.SetUnitStockpile - * @number unitID - * @number[opt] stockpile - * @number[opt] buildPercent - * @treturn nil + * @param unitID integer + * @param stockpile number? + * @param buildPercent number? + * @return nil */ int LuaSyncedCtrl::SetUnitStockpile(lua_State* L) { @@ -2062,6 +2075,30 @@ int LuaSyncedCtrl::SetUnitStockpile(lua_State* L) } +/*** Parameter for weapon states + * + * @class WeaponState + * @field reloadState integer? + * @field reloadFrame integer? Alias for `reloadState`. + * @field reloadTime number? + * @field reaimTime integer? + * @field accuracy number? + * @field sprayAngle number? + * @field range number? + * If you change the range of a weapon with dynamic damage make sure you use `SetUnitWeaponDamages` to change dynDamageRange as well. + * @field projectileSpeed number? + * @field burst integer? + * @field burstRate number? + * @field projectiles integer? + * @field salvoLeft integer? + * @field nextSalvo integer? + * @field aimReady number? + * Set to `true` if a non-zero value is passed, `false` is zero is passed. + * @field forceAim integer? + * @field avoidFlags integer? + * @field collisionFlags integer? + */ + static bool SetSingleUnitWeaponState(lua_State* L, CWeapon* weapon, int index) { // FIXME: missing checks and updates? @@ -2145,10 +2182,10 @@ static bool SetSingleUnitWeaponState(lua_State* L, CWeapon* weapon, int index) /*** * * @function Spring.SetUnitUseWeapons - * @number unitID - * @number[opt] forceUseWeapons - * @number[opt] allowUseWeapons - * @treturn nil + * @param unitID integer + * @param forceUseWeapons number? + * @param allowUseWeapons number? + * @return nil */ int LuaSyncedCtrl::SetUnitUseWeapons(lua_State* L) { @@ -2162,39 +2199,21 @@ int LuaSyncedCtrl::SetUnitUseWeapons(lua_State* L) return 0; } -/*** Parameter for weapon states - * - * @table states - * @number reloadState - * @number reloadFrame synonym for reloadState! - * @number reloadTime - * @number accuracy - * @number sprayAngle - * @number range if you change the range of a weapon with dynamic damage make sure you use `SetUnitWeaponDamages` to change dynDamageRange as well. - * @number projectileSpeed - * @number burst - * @number burstRate - * @number projectiles - * @number salvoLeft - * @number nextSalvo - * @number aimReady (<>0.0f := true) - */ - /*** * @function Spring.SetUnitWeaponState - * @number unitID - * @number weaponNum - * @tparam states states - * @treturn nil + * @param unitID integer + * @param weaponNum number + * @param states WeaponState + * @return nil */ /*** * @function Spring.SetUnitWeaponState - * @number unitID - * @number weaponNum - * @string key - * @number value - * @treturn nil + * @param unitID integer + * @param weaponNum number + * @param key string + * @param value number + * @return nil */ int LuaSyncedCtrl::SetUnitWeaponState(lua_State* L) { @@ -2227,6 +2246,24 @@ int LuaSyncedCtrl::SetUnitWeaponState(lua_State* L) return 0; } +/*** Parameters for damage + * + * @class WeaponDamages + * @field paralyzeDamageTime integer + * @field impulseFactor number + * @field impulseBoost number + * @field craterMult number + * @field craterBoost number + * @field dynDamageExp number + * @field dynDamageMin number + * @field dynDamageRange number + * @field dynDamageInverted number + * Set to `true` if a non-zero value is passed, `false` is zero is passed. + * @field craterAreaOfEffect number + * @field damageAreaOfEffect number + * @field edgeEffectiveness number + * @field explosionSpeed number + */ static int SetSingleDynDamagesKey(lua_State* L, DynDamageArray* damages, int index) { @@ -2297,39 +2334,20 @@ static int SetSingleDynDamagesKey(lua_State* L, DynDamageArray* damages, int ind } -/*** Parameters for damage - * - * @table damages - * @number paralyzeDamageTime - * @number impulseFactor - * @number impulseBoost - * @number craterMult - * @number craterBoost - * @number dynDamageExp - * @number dynDamageMin - * @number dynDamageRange - * @number dynDamageInverted (<>0.0f := true) - * @number craterAreaOfEffect - * @number damageAreaOfEffect - * @number edgeEffectiveness - * @number explosionSpeed - * @number armorType - */ - /*** * @function Spring.SetUnitWeaponDamages - * @number unitID - * @tparam ?number|string weaponNum "selfDestruct" | "explode" - * @tparam damages damages - * @treturn nil + * @param unitID integer + * @param weaponNum number|"selfDestruct"|"explode" + * @param damages WeaponDamages + * @return nil */ /*** * @function Spring.SetUnitWeaponDamages - * @number unitID - * @tparam ?number|string weaponNum "selfDestruct" | "explode" - * @string key - * @number value - * @treturn nil + * @param unitID integer + * @param weaponNum number|"selfDestruct"|"explode" + * @param key string + * @param value number + * @return nil */ int LuaSyncedCtrl::SetUnitWeaponDamages(lua_State* L) { @@ -2378,9 +2396,9 @@ int LuaSyncedCtrl::SetUnitWeaponDamages(lua_State* L) /*** @function Spring.SetUnitMaxRange * - * @number unitID - * @number maxRange - * @treturn nil + * @param unitID integer + * @param maxRange number + * @return nil */ int LuaSyncedCtrl::SetUnitMaxRange(lua_State* L) { @@ -2398,9 +2416,9 @@ int LuaSyncedCtrl::SetUnitMaxRange(lua_State* L) * @function Spring.SetUnitExperience * @see Spring.AddUnitExperience * @see Spring.GetUnitExperience - * @number unitID - * @number experience - * @treturn nil + * @param unitID integer + * @param experience number + * @return nil */ int LuaSyncedCtrl::SetUnitExperience(lua_State* L) { @@ -2417,9 +2435,9 @@ int LuaSyncedCtrl::SetUnitExperience(lua_State* L) * @function Spring.AddUnitExperience * @see Spring.SetUnitExperience * @see Spring.GetUnitExperience - * @number unitID - * @number deltaExperience Can be negative to subtract, but the unit will never have negative total afterwards - * @treturn nil + * @param unitID integer + * @param deltaExperience number Can be negative to subtract, but the unit will never have negative total afterwards + * @return nil */ int LuaSyncedCtrl::AddUnitExperience(lua_State* L) { @@ -2436,10 +2454,10 @@ int LuaSyncedCtrl::AddUnitExperience(lua_State* L) /*** * @function Spring.SetUnitArmored - * @number unitID - * @bool[opt] armored - * @number[opt] armorMultiple - * @treturn nil + * @param unitID integer + * @param armored boolean? + * @param armorMultiple number? + * @return nil */ int LuaSyncedCtrl::SetUnitArmored(lua_State* L) { @@ -2527,10 +2545,10 @@ static unsigned char ParseLosBits(lua_State* L, int index, unsigned char bits) * [contRadar = boolean] * } * - * @number unitID - * @number allyTeam - * @tparam number|table losTypes - * @treturn nil + * @param unitID integer + * @param allyTeam number + * @param losTypes number|table + * @return nil */ int LuaSyncedCtrl::SetUnitLosMask(lua_State* L) { @@ -2558,10 +2576,10 @@ int LuaSyncedCtrl::SetUnitLosMask(lua_State* L) /*** * @function Spring.SetUnitLosState - * @number unitID - * @number allyTeam - * @tparam number|table los - * @treturn nil + * @param unitID integer + * @param allyTeam number + * @param los number|table + * @return nil */ int LuaSyncedCtrl::SetUnitLosState(lua_State* L) { @@ -2598,10 +2616,10 @@ int LuaSyncedCtrl::SetUnitLosState(lua_State* L) * - if the boolean is false it takes the default decloak distance for that unitdef, * - if the boolean is true it takes the absolute value of it. * - * @number unitID - * @tparam bool|number cloak - * @tparam bool|number cloakArg - * @treturn nil + * @param unitID integer + * @param cloak boolean|number + * @param cloakArg boolean|number + * @return nil */ int LuaSyncedCtrl::SetUnitCloak(lua_State* L) { @@ -2635,9 +2653,9 @@ int LuaSyncedCtrl::SetUnitCloak(lua_State* L) /*** * @function Spring.SetUnitStealth - * @number unitID - * @bool stealth - * @treturn nil + * @param unitID integer + * @param stealth boolean + * @return nil */ int LuaSyncedCtrl::SetUnitStealth(lua_State* L) { @@ -2653,9 +2671,9 @@ int LuaSyncedCtrl::SetUnitStealth(lua_State* L) /*** * @function Spring.SetUnitSonarStealth - * @number unitID - * @bool sonarStealth - * @treturn nil + * @param unitID integer + * @param sonarStealth boolean + * @return nil */ int LuaSyncedCtrl::SetUnitSonarStealth(lua_State* L) { @@ -2670,9 +2688,9 @@ int LuaSyncedCtrl::SetUnitSonarStealth(lua_State* L) /*** * @function Spring.SetUnitSeismicSignature - * @number unitID - * @number seismicSignature - * @treturn nil + * @param unitID integer + * @param seismicSignature number + * @return nil */ int LuaSyncedCtrl::SetUnitSeismicSignature(lua_State* L) { @@ -2686,9 +2704,9 @@ int LuaSyncedCtrl::SetUnitSeismicSignature(lua_State* L) /*** * @function Spring.SetUnitAlwaysVisible - * @number unitID - * @bool alwaysVisible - * @treturn nil + * @param unitID integer + * @param alwaysVisible boolean + * @return nil */ int LuaSyncedCtrl::SetUnitAlwaysVisible(lua_State* L) { @@ -2699,9 +2717,9 @@ int LuaSyncedCtrl::SetUnitAlwaysVisible(lua_State* L) /*** * * @function Spring.SetUnitUseAirLos - * @number unitID - * @bool useAirLos - * @treturn nil + * @param unitID integer + * @param useAirLos boolean + * @return nil */ int LuaSyncedCtrl::SetUnitUseAirLos(lua_State* L) { @@ -2711,10 +2729,10 @@ int LuaSyncedCtrl::SetUnitUseAirLos(lua_State* L) /*** * @function Spring.SetUnitMetalExtraction - * @number unitID - * @number depth corresponds to metal extraction rate - * @number[opt] range similar to "extractsMetal" in unitDefs. - * @treturn nil + * @param unitID integer + * @param depth number corresponds to metal extraction rate + * @param range number? similar to "extractsMetal" in unitDefs. + * @return nil */ int LuaSyncedCtrl::SetUnitMetalExtraction(lua_State* L) { @@ -2739,9 +2757,9 @@ int LuaSyncedCtrl::SetUnitMetalExtraction(lua_State* L) /*** See also harvestStorage UnitDef tag. * * @function Spring.SetUnitHarvestStorage - * @number unitID - * @number metal - * @treturn nil + * @param unitID integer + * @param metal number + * @return nil */ int LuaSyncedCtrl::SetUnitHarvestStorage(lua_State* L) { @@ -2760,10 +2778,10 @@ int LuaSyncedCtrl::SetUnitHarvestStorage(lua_State* L) /*** * * @function Spring.SetUnitBuildParams - * @number unitID - * @string paramName one of `buildRange`|`buildDistance`|`buildRange3D` - * @number|bool value bool when `paramName` is `buildRange3D`, number otherwise - * @treturn nil + * @param unitID integer + * @param paramName string one of `buildRange`|`buildDistance`|`buildRange3D` + * @number|boolean value boolean when `paramName` is `buildRange3D`, number otherwise + * @return nil */ int LuaSyncedCtrl::SetUnitBuildParams(lua_State* L) { @@ -2793,13 +2811,13 @@ int LuaSyncedCtrl::SetUnitBuildParams(lua_State* L) /*** * @function Spring.SetUnitBuildSpeed - * @number builderID - * @number buildSpeed - * @number[opt] repairSpeed - * @number[opt] reclaimSpeed - * @number[opt] captureSpeed - * @number[opt] terraformSpeed - * @treturn nil + * @param builderID integer + * @param buildSpeed number + * @param repairSpeed number? + * @param reclaimSpeed number? + * @param captureSpeed number? + * @param terraformSpeed number? + * @return nil */ int LuaSyncedCtrl::SetUnitBuildSpeed(lua_State* L) { @@ -2848,9 +2866,9 @@ int LuaSyncedCtrl::SetUnitBuildSpeed(lua_State* L) * This saves a lot of engine calls, by replacing: function script.QueryNanoPiece() return currentpiece end * Use it! * - * @number builderID - * @tparam table pieces - * @treturn nil + * @param builderID integer + * @param pieces table + * @return nil * */ int LuaSyncedCtrl::SetUnitNanoPieces(lua_State* L) @@ -2904,15 +2922,15 @@ int LuaSyncedCtrl::SetUnitNanoPieces(lua_State* L) /*** * @function Spring.SetUnitBlocking - * @number unitID - * @bool isblocking - * @bool isSolidObjectCollidable - * @bool isProjectileCollidable - * @bool isRaySegmentCollidable - * @bool crushable - * @bool blockEnemyPushing - * @bool blockHeightChanges - * @treturn nil + * @param unitID integer + * @param isblocking boolean + * @param isSolidObjectCollidable boolean + * @param isProjectileCollidable boolean + * @param isRaySegmentCollidable boolean + * @param crushable boolean + * @param blockEnemyPushing boolean + * @param blockHeightChanges boolean + * @return nil */ int LuaSyncedCtrl::SetUnitBlocking(lua_State* L) { @@ -2922,9 +2940,9 @@ int LuaSyncedCtrl::SetUnitBlocking(lua_State* L) /*** * @function Spring.SetUnitCrashing - * @number unitID - * @bool crashing - * @treturn bool success + * @param unitID integer + * @param crashing boolean + * @return boolean success */ int LuaSyncedCtrl::SetUnitCrashing(lua_State* L) { CUnit* unit = ParseUnit(L, __func__, 1); @@ -2957,11 +2975,11 @@ int LuaSyncedCtrl::SetUnitCrashing(lua_State* L) { /*** * @function Spring.SetUnitShieldState - * @number unitID - * @number[opt=-1] weaponID - * @bool[opt] enabled - * @number[opt] power - * @treturn nil + * @param unitID integer + * @param weaponID integer? (Default: -1) + * @param enabled boolean? + * @param power number? + * @return nil */ int LuaSyncedCtrl::SetUnitShieldState(lua_State* L) { @@ -2995,10 +3013,10 @@ int LuaSyncedCtrl::SetUnitShieldState(lua_State* L) /*** * @function Spring.SetUnitShieldRechargeDelay - * @number unitID - * @number[opt] weaponID (optional if the unit only has one shield) - * @number[opt] rechargeTime (in seconds; emulates a regular hit if nil) - * @treturn nil + * @param unitID integer + * @param weaponID integer? (optional if the unit only has one shield) + * @param rechargeTime number? (in seconds; emulates a regular hit if nil) + * @return nil */ int LuaSyncedCtrl::SetUnitShieldRechargeDelay(lua_State* L) { @@ -3032,12 +3050,12 @@ int LuaSyncedCtrl::SetUnitShieldRechargeDelay(lua_State* L) /*** * @function Spring.SetUnitFlanking - * @number unitID - * @string type "dir"|"minDamage"|"maxDamage"|"moveFactor"|"mode" - * @number arg1 x|minDamage|maxDamage|moveFactor|mode - * @number[opt] y only when type is "dir" - * @number[opt] z only when type is "dir" - * @treturn nil + * @param unitID integer + * @param type string "dir"|"minDamage"|"maxDamage"|"moveFactor"|"mode" + * @param arg1 number x|minDamage|maxDamage|moveFactor|mode + * @param y number? only when type is "dir" + * @param z number? only when type is "dir" + * @return nil */ int LuaSyncedCtrl::SetUnitFlanking(lua_State* L) { @@ -3079,9 +3097,9 @@ int LuaSyncedCtrl::SetUnitFlanking(lua_State* L) /*** * @function Spring.SetUnitPhysicalStateBit - * @number unitID - * @number[bit] Physical state bit - * @treturn nil + * @param unitID integer + * @param Physical number[bit] state bit + * @return nil */ int LuaSyncedCtrl::SetUnitPhysicalStateBit(lua_State* L) { @@ -3098,8 +3116,8 @@ int LuaSyncedCtrl::SetUnitPhysicalStateBit(lua_State* L) /*** * @function Spring.GetUnitPhysicalState - * @number unitID - * @treturn number Unit's PhysicalState bitmask + * @param unitID integer + * @return number Unit's PhysicalState bitmask */ int LuaSyncedCtrl::GetUnitPhysicalState(lua_State* L) { @@ -3123,9 +3141,9 @@ int LuaSyncedCtrl::SetUnitFuel(lua_State* L) { return 0; } // FIXME: DELETE ME * * @function Spring.SetUnitNeutral * - * @number unitID - * @bool neutral - * @treturn nil|bool setNeutral + * @param unitID integer + * @param neutral boolean + * @return nil|boolean setNeutral */ int LuaSyncedCtrl::SetUnitNeutral(lua_State* L) { @@ -3142,24 +3160,24 @@ int LuaSyncedCtrl::SetUnitNeutral(lua_State* L) /*** Defines a unit's target. * * @function Spring.SetUnitTarget - * @number unitID - * @number[opt] enemyUnitID when nil drops the units current target. - * @bool[opt=false] dgun - * @bool[opt=false] userTarget - * @number[opt=-1] weaponNum - * @treturn bool success + * @param unitID integer + * @param enemyUnitID integer? when nil drops the units current target. + * @param dgun boolean? (Default: false) + * @param userTarget boolean? (Default: false) + * @param weaponNum number? (Default: -1) + * @return boolean success */ /*** * @function Spring.SetUnitTarget - * @number unitID - * @number[opt] x when nil or not passed it will drop target and ignore other parameters - * @number[opt] y - * @number[opt] z - * @bool[opt=false] dgun - * @bool[opt=false] userTarget - * @number[opt=-1] weaponNum - * @treturn bool success + * @param unitID integer + * @param x number? when nil or not passed it will drop target and ignore other parameters + * @param y number? + * @param z number? + * @param dgun boolean? (Default: false) + * @param userTarget boolean? (Default: false) + * @param weaponNum number? (Default: -1) + * @return boolean success */ int LuaSyncedCtrl::SetUnitTarget(lua_State* L) { @@ -3221,15 +3239,15 @@ int LuaSyncedCtrl::SetUnitTarget(lua_State* L) /*** * @function Spring.SetUnitMidAndAimPos - * @number unitID - * @number mpX new middle positionX of unit - * @number mpY new middle positionY of unit - * @number mpZ new middle positionZ of unit - * @number apX new positionX that enemies aim at on this unit - * @number apY new positionY that enemies aim at on this unit - * @number apZ new positionZ that enemies aim at on this unit - * @bool[opt=false] relative are the new coordinates relative to world (false) or unit (true) coordinates? Also, note that apy is inverted! - * @treturn bool success + * @param unitID integer + * @param mpX number new middle positionX of unit + * @param mpY number new middle positionY of unit + * @param mpZ number new middle positionZ of unit + * @param apX number new positionX that enemies aim at on this unit + * @param apY number new positionY that enemies aim at on this unit + * @param apZ number new positionZ that enemies aim at on this unit + * @param relative boolean? (Default: false) are the new coordinates relative to world (false) or unit (true) coordinates? Also, note that apy is inverted! + * @return boolean success */ int LuaSyncedCtrl::SetUnitMidAndAimPos(lua_State* L) { @@ -3269,10 +3287,10 @@ int LuaSyncedCtrl::SetUnitMidAndAimPos(lua_State* L) /*** * @function Spring.SetUnitRadiusAndHeight - * @number unitID - * @number radius - * @number height - * @treturn bool success + * @param unitID integer + * @param radius number + * @param height number + * @return boolean success */ int LuaSyncedCtrl::SetUnitRadiusAndHeight(lua_State* L) { @@ -3306,9 +3324,9 @@ int LuaSyncedCtrl::SetUnitRadiusAndHeight(lua_State* L) /*** * @function Spring.SetUnitBuildeeRadius * Sets the unit's radius for when targeted by build, repair, reclaim-type commands. - * @number unitID - * @number build radius for when targeted by build, repair, reclaim-type commands. - * @treturn nil + * @param unitID integer + * @param build number radius for when targeted by build, repair, reclaim-type commands. + * @return nil */ int LuaSyncedCtrl::SetUnitBuildeeRadius(lua_State* L) { @@ -3326,10 +3344,10 @@ int LuaSyncedCtrl::SetUnitBuildeeRadius(lua_State* L) /*** Changes the pieces hierarchy of a unit by attaching a piece to a new parent. * * @function Spring.SetUnitPieceParent - * @number unitID - * @number AlteredPiece - * @number ParentPiece - * @treturn nil + * @param unitID integer + * @param AlteredPiece number + * @param ParentPiece number + * @return nil */ int LuaSyncedCtrl::SetUnitPieceParent(lua_State* L) { @@ -3370,10 +3388,10 @@ int LuaSyncedCtrl::SetUnitPieceParent(lua_State* L) * * If any of the first three elements are non-zero, and also blocks all script animations from modifying it until {0, 0, 0} is passed. * - * @number unitID - * @number pieceNum - * @tparam {number,...} matrix an array of 16 floats - * @treturn nil + * @param unitID integer + * @param pieceNum number + * @param matrix number[] an array of 16 floats + * @return nil */ int LuaSyncedCtrl::SetUnitPieceMatrix(lua_State* L) { @@ -3402,17 +3420,17 @@ int LuaSyncedCtrl::SetUnitPieceMatrix(lua_State* L) /*** * @function Spring.SetUnitCollisionVolumeData - * @number unitID - * @number scaleX - * @number scaleY - * @number scaleZ - * @number offsetX - * @number offsetY - * @number offsetZ - * @number vType - * @number tType - * @number Axis - * @treturn nil + * @param unitID integer + * @param scaleX number + * @param scaleY number + * @param scaleZ number + * @param offsetX number + * @param offsetY number + * @param offsetZ number + * @param vType number + * @param tType number + * @param Axis number + * @return nil * * enum COLVOL_TYPES { * COLVOL_TYPE_DISABLED = -1, @@ -3442,18 +3460,18 @@ int LuaSyncedCtrl::SetUnitCollisionVolumeData(lua_State* L) /*** * @function Spring.SetUnitPieceCollisionVolumeData - * @number unitID - * @number pieceIndex - * @bool enable - * @number scaleX - * @number scaleY - * @number scaleZ - * @number offsetX - * @number offsetY - * @number offsetZ - * @number[opt] volumeType - * @number[opt] primaryAxis - * @treturn nil + * @param unitID integer + * @param pieceIndex number + * @param enable boolean + * @param scaleX number + * @param scaleY number + * @param scaleZ number + * @param offsetX number + * @param offsetY number + * @param offsetZ number + * @param volumeType number? + * @param primaryAxis number? + * @return nil */ int LuaSyncedCtrl::SetUnitPieceCollisionVolumeData(lua_State* L) { @@ -3464,10 +3482,10 @@ int LuaSyncedCtrl::SetUnitPieceCollisionVolumeData(lua_State* L) /*** * * @function Spring.SetUnitPieceVisible - * @number unitID - * @number pieceIndex - * @bool visible - * @treturn nil + * @param unitID integer + * @param pieceIndex number + * @param visible boolean + * @return nil */ int LuaSyncedCtrl::SetUnitPieceVisible(lua_State* L) { @@ -3477,10 +3495,10 @@ int LuaSyncedCtrl::SetUnitPieceVisible(lua_State* L) /*** * @function Spring.SetUnitSensorRadius - * @number unitID - * @string type "los" | "airLos" | "radar" | "sonar" | "seismic" | "radarJammer" | "sonarJammer" - * @number radius - * @treturn ?nil|number newRadius + * @param unitID integer + * @param type "los"|"airLos"|"radar"|"sonar"|"seismic"|"radarJammer"|"sonarJammer" + * @param radius number + * @return number? New radius, or `nil` if unit is invalid. */ int LuaSyncedCtrl::SetUnitSensorRadius(lua_State* L) { @@ -3532,15 +3550,15 @@ int LuaSyncedCtrl::SetUnitSensorRadius(lua_State* L) * native "is under cursor" checks and some Lua interfaces. * * @function Spring.SetUnitPosErrorParams - * @number unitID - * @number posErrorVectorX - * @number posErrorVectorY - * @number posErrorVectorZ - * @number posErrorDeltaX - * @number posErrorDeltaY - * @number posErrorDeltaZ - * @number[opt] nextPosErrorUpdate - * @treturn nil + * @param unitID integer + * @param posErrorVectorX number + * @param posErrorVectorY number + * @param posErrorVectorZ number + * @param posErrorDeltaX number + * @param posErrorDeltaY number + * @param posErrorDeltaZ number + * @param nextPosErrorUpdate number? + * @return nil */ int LuaSyncedCtrl::SetUnitPosErrorParams(lua_State* L) { @@ -3568,14 +3586,14 @@ int LuaSyncedCtrl::SetUnitPosErrorParams(lua_State* L) /*** Used by default commands to get in build-, attackrange etc. * * @function Spring.SetUnitMoveGoal - * @number unitID - * @number goalX - * @number goalY - * @number goalZ - * @number[opt] goalRadius - * @number[opt] moveSpeed - * @bool[opt] moveRaw - * @treturn nil + * @param unitID integer + * @param goalX number + * @param goalY number + * @param goalZ number + * @param goalRadius number? + * @param moveSpeed number? + * @param moveRaw boolean? + * @return nil */ int LuaSyncedCtrl::SetUnitMoveGoal(lua_State* L) { @@ -3605,12 +3623,12 @@ int LuaSyncedCtrl::SetUnitMoveGoal(lua_State* L) /*** Used in conjunction with Spring.UnitAttach et al. to re-implement old airbase & fuel system in Lua. * * @function Spring.SetUnitLandGoal - * @number unitID - * @number goalX - * @number goalY - * @number goalZ - * @number[opt] goalRadius - * @treturn nil + * @param unitID integer + * @param goalX number + * @param goalY number + * @param goalZ number + * @param goalRadius number? + * @return nil */ int LuaSyncedCtrl::SetUnitLandGoal(lua_State* L) { @@ -3634,8 +3652,8 @@ int LuaSyncedCtrl::SetUnitLandGoal(lua_State* L) /*** * @function Spring.ClearUnitGoal - * @number unitID - * @treturn nil + * @param unitID integer + * @return nil */ int LuaSyncedCtrl::ClearUnitGoal(lua_State* L) { @@ -3651,20 +3669,20 @@ int LuaSyncedCtrl::ClearUnitGoal(lua_State* L) /*** * @function Spring.SetUnitPhysics - * @number unitID - * @number posX - * @number posY - * @number posZ - * @number velX - * @number velY - * @number velZ - * @number rotX - * @number rotY - * @number rotZ - * @number dragX - * @number dragY - * @number dragZ - * @treturn nil + * @param unitID integer + * @param posX number + * @param posY number + * @param posZ number + * @param velX number + * @param velY number + * @param velZ number + * @param rotX number + * @param rotY number + * @param rotZ number + * @param dragX number + * @param dragY number + * @param dragZ number + * @return nil */ int LuaSyncedCtrl::SetUnitPhysics(lua_State* L) { @@ -3673,9 +3691,9 @@ int LuaSyncedCtrl::SetUnitPhysics(lua_State* L) /*** * @function Spring.SetUnitMass - * @number unitID - * @number mass - * @treturn nil + * @param unitID integer + * @param mass number + * @return nil */ int LuaSyncedCtrl::SetUnitMass(lua_State* L) { @@ -3688,11 +3706,11 @@ int LuaSyncedCtrl::SetUnitMass(lua_State* L) * * Sets a unit's position in 2D, at terrain height. * - * @number unitID - * @number x - * @number z - * @bool[opt=false] floating If true, over water the position is on surface. If false, on seafloor. - * @treturn nil + * @param unitID integer + * @param x number + * @param z number + * @param floating boolean? (Default: false) If true, over water the position is on surface. If false, on seafloor. + * @return nil */ @@ -3701,11 +3719,11 @@ int LuaSyncedCtrl::SetUnitMass(lua_State* L) * * Sets a unit's position in 3D, at an arbitrary height. * - * @number unitID - * @number x - * @number y - * @number z - * @treturn nil + * @param unitID integer + * @param x number + * @param y number + * @param z number + * @return nil */ int LuaSyncedCtrl::SetUnitPosition(lua_State* L) { @@ -3740,11 +3758,11 @@ int LuaSyncedCtrl::SetUnitPosition(lua_State* L) /*** * @function Spring.SetUnitRotation - * @number unitID - * @number yaw - * @number pitch - * @number roll - * @treturn nil + * @param unitID integer + * @param yaw number + * @param pitch number + * @param roll number + * @return nil */ int LuaSyncedCtrl::SetUnitRotation(lua_State* L) { @@ -3754,11 +3772,11 @@ int LuaSyncedCtrl::SetUnitRotation(lua_State* L) /*** * @function Spring.SetUnitDirection - * @number unitID - * @number x - * @number y - * @number z - * @treturn nil + * @param unitID integer + * @param x number + * @param y number + * @param z number + * @return nil */ int LuaSyncedCtrl::SetUnitDirection(lua_State* L) { @@ -3768,12 +3786,12 @@ int LuaSyncedCtrl::SetUnitDirection(lua_State* L) /*** * @function Spring.SetUnitHeadingAndUpDir * Use this call to set up unit direction in a robust way. Heading (-32768 to 32767) represents a 2D (xz plane) unit orientation if unit was completely upright, new {upx,upy,upz} direction will be used as new "up" vector, the rotation set by "heading" will remain preserved. - * @number unitID - * @number heading - * @number upx - * @number upy - * @number upz - * @treturn nil + * @param unitID integer + * @param heading number + * @param upx number + * @param upy number + * @param upz number + * @return nil */ int LuaSyncedCtrl::SetUnitHeadingAndUpDir(lua_State* L) { @@ -3782,11 +3800,11 @@ int LuaSyncedCtrl::SetUnitHeadingAndUpDir(lua_State* L) /*** * @function Spring.SetUnitVelocity - * @number unitID - * @number velX - * @number velY - * @number velZ - * @treturn nil + * @param unitID integer + * @param velX number + * @param velY number + * @param velZ number + * @return nil */ int LuaSyncedCtrl::SetUnitVelocity(lua_State* L) { @@ -3797,14 +3815,14 @@ int LuaSyncedCtrl::SetUnitVelocity(lua_State* L) /*** * * @function Spring.SetFactoryBuggerOff - * @number unitID - * @bool[opt] buggerOff - * @number[opt] offset - * @number[opt] radius - * @number[opt] relHeading - * @bool[opt] spherical - * @bool[opt] forced - * @treturn nil|number buggerOff + * @param unitID integer + * @param buggerOff boolean? + * @param offset number? + * @param radius number? + * @param relHeading number? + * @param spherical boolean? + * @param forced boolean? + * @return nil|number buggerOff */ int LuaSyncedCtrl::SetFactoryBuggerOff(lua_State* L) { @@ -3831,16 +3849,16 @@ int LuaSyncedCtrl::SetFactoryBuggerOff(lua_State* L) /*** * * @function Spring.BuggerOff - * @number x - * @number y - * @number[opt] z uses ground height when unspecified - * @number radius - * @number teamID - * @bool[opt=true] spherical - * @bool[opt=true] forced - * @number[opt] excludeUnitID - * @tparam[opt] {[number],...} excludeUnitDefIDs - * @treturn nil + * @param x number + * @param y number + * @param z number? uses ground height when unspecified + * @param radius number + * @param teamID integer + * @param spherical boolean? (Default: true) + * @param forced boolean? (Default: true) + * @param excludeUnitID integer? + * @tparam? number[] excludeUnitDefIDs + * @return nil */ int LuaSyncedCtrl::BuggerOff(lua_State* L) { @@ -3873,15 +3891,15 @@ int LuaSyncedCtrl::BuggerOff(lua_State* L) /*** * @function Spring.AddUnitDamage * - * @number unitID - * @number damage - * @number[opt=0] paralyze equals to the paralyzetime in the WeaponDef. - * @number[opt=-1] attackerID - * @number[opt=-1] weaponID - * @number[opt] impulseX - * @number[opt] impulseY - * @number[opt] impulseZ - * @treturn nil + * @param unitID integer + * @param damage number + * @param paralyze number? (Default: 0) equals to the paralyzetime in the WeaponDef. + * @param attackerID integer? (Default: -1) + * @param weaponID integer? (Default: -1) + * @param impulseX number? + * @param impulseY number? + * @param impulseZ number? + * @return nil */ int LuaSyncedCtrl::AddUnitDamage(lua_State* L) { @@ -3924,12 +3942,12 @@ int LuaSyncedCtrl::AddUnitDamage(lua_State* L) /*** * @function Spring.AddUnitImpulse - * @number unitID - * @number x - * @number y - * @number z - * @number[opt] decayRate - * @treturn nil + * @param unitID integer + * @param x number + * @param y number + * @param z number + * @param decayRate number? + * @return nil */ int LuaSyncedCtrl::AddUnitImpulse(lua_State* L) { @@ -3949,9 +3967,9 @@ int LuaSyncedCtrl::AddUnitImpulse(lua_State* L) /*** * @function Spring.AddUnitSeismicPing - * @number unitID - * @number pindSize - * @treturn nil + * @param unitID integer + * @param pindSize number + * @return nil */ int LuaSyncedCtrl::AddUnitSeismicPing(lua_State* L) { @@ -3969,10 +3987,10 @@ int LuaSyncedCtrl::AddUnitSeismicPing(lua_State* L) /*** * @function Spring.AddUnitResource - * @number unitID - * @string resource "m" | "e" - * @number amount - * @treturn nil + * @param unitID integer + * @param resource string "m" | "e" + * @param amount number + * @return nil */ int LuaSyncedCtrl::AddUnitResource(lua_State* L) { @@ -3995,20 +4013,21 @@ int LuaSyncedCtrl::AddUnitResource(lua_State* L) return 0; } +/* /*** * @function Spring.UseUnitResource - * @number unitID - * @string resource "m" | "e" - * @number amount - * @treturn ?nil|bool okay + * @param unitID integer + * @param resource ResourceName + * @param amount number + * @return boolean? okay */ /*** * @function Spring.UseUnitResource - * @number unitID - * @tparam {[string]=number,...} resources where keys are one of "m"|"metal"|"e"|"energy" and values are amounts - * @treturn ?nil|bool okay + * @param unitID integer + * @param resources ResourceUsage + * @return boolean? okay */ int LuaSyncedCtrl::UseUnitResource(lua_State* L) { @@ -4077,8 +4096,8 @@ int LuaSyncedCtrl::UseUnitResource(lua_State* L) /*** * * @function Spring.AddObjectDecal - * @number unitID - * @treturn nil + * @param unitID integer + * @return nil */ int LuaSyncedCtrl::AddObjectDecal(lua_State* L) { @@ -4094,8 +4113,8 @@ int LuaSyncedCtrl::AddObjectDecal(lua_State* L) /*** * @function Spring.RemoveObjectDecal - * @number unitID - * @treturn nil + * @param unitID integer + * @return nil */ int LuaSyncedCtrl::RemoveObjectDecal(lua_State* L) { @@ -4117,9 +4136,9 @@ int LuaSyncedCtrl::RemoveObjectDecal(lua_State* L) /*** * @function Spring.AddGrass - * @number x - * @number z - * @treturn nil + * @param x number + * @param z number + * @return nil */ int LuaSyncedCtrl::AddGrass(lua_State* L) { @@ -4132,9 +4151,9 @@ int LuaSyncedCtrl::AddGrass(lua_State* L) /*** * @function Spring.RemoveGrass - * @number x - * @number z - * @treturn nil + * @param x number + * @param z number + * @return nil */ int LuaSyncedCtrl::RemoveGrass(lua_State* L) { @@ -4153,14 +4172,14 @@ int LuaSyncedCtrl::RemoveGrass(lua_State* L) /*** * @function Spring.CreateFeature - * @tparam string|number featureDef name or id - * @number x - * @number y - * @number z - * @number[opt] heading - * @number[opt] AllyTeamID - * @number[opt] featureID - * @treturn number featureID + * @param featureDef string|number name or id + * @param x number + * @param y number + * @param z number + * @param heading number? + * @param AllyTeamID integer? + * @param featureID integer? + * @return number featureID */ int LuaSyncedCtrl::CreateFeature(lua_State* L) { @@ -4241,8 +4260,8 @@ int LuaSyncedCtrl::CreateFeature(lua_State* L) /*** * @function Spring.DestroyFeature - * @number featureDefID - * @treturn nil + * @param featureDefID integer + * @return nil */ int LuaSyncedCtrl::DestroyFeature(lua_State* L) { @@ -4265,9 +4284,9 @@ int LuaSyncedCtrl::DestroyFeature(lua_State* L) /*** Feature Control * * @function Spring.TransferFeature - * @number featureDefID - * @number teamID - * @treturn nil + * @param featureDefID integer + * @param teamID integer + * @return nil */ int LuaSyncedCtrl::TransferFeature(lua_State* L) { @@ -4287,9 +4306,9 @@ int LuaSyncedCtrl::TransferFeature(lua_State* L) /*** * @function Spring.SetFeatureAlwaysVisible - * @number featureID - * @bool enable - * @treturn nil + * @param featureID integer + * @param enable boolean + * @return nil */ int LuaSyncedCtrl::SetFeatureAlwaysVisible(lua_State* L) { @@ -4299,9 +4318,9 @@ int LuaSyncedCtrl::SetFeatureAlwaysVisible(lua_State* L) /*** * * @function Spring.SetFeatureUseAirLos - * @number featureID - * @bool useAirLos - * @treturn nil + * @param featureID integer + * @param useAirLos boolean + * @return nil */ int LuaSyncedCtrl::SetFeatureUseAirLos(lua_State* L) { @@ -4311,9 +4330,9 @@ int LuaSyncedCtrl::SetFeatureUseAirLos(lua_State* L) /*** * @function Spring.SetFeatureHealth - * @number featureID - * @number health - * @treturn nil + * @param featureID integer + * @param health number + * @return nil */ int LuaSyncedCtrl::SetFeatureHealth(lua_State* L) { @@ -4330,9 +4349,9 @@ int LuaSyncedCtrl::SetFeatureHealth(lua_State* L) /*** * * @function Spring.SetFeatureMaxHealth - * @number featureID - * @number maxHealth minimum 0.1 - * @treturn nil + * @param featureID integer + * @param maxHealth number minimum 0.1 + * @return nil */ int LuaSyncedCtrl::SetFeatureMaxHealth(lua_State* L) { @@ -4349,9 +4368,9 @@ int LuaSyncedCtrl::SetFeatureMaxHealth(lua_State* L) /*** * @function Spring.SetFeatureReclaim - * @number featureID - * @number reclaimLeft - * @treturn nil + * @param featureID integer + * @param reclaimLeft number + * @return nil */ int LuaSyncedCtrl::SetFeatureReclaim(lua_State* L) { @@ -4366,14 +4385,14 @@ int LuaSyncedCtrl::SetFeatureReclaim(lua_State* L) /*** * @function Spring.SetFeatureResources - * @number featureID - * @number metal - * @number energy - * @number[opt] reclaimTime - * @number[opt] reclaimLeft - * @number[opt] featureDefMetal - * @number[opt] featureDefEnergy - * @treturn nil + * @param featureID integer + * @param metal number + * @param energy number + * @param reclaimTime number? + * @param reclaimLeft number? + * @param featureDefMetal number? + * @param featureDefEnergy number? + * @return nil */ int LuaSyncedCtrl::SetFeatureResources(lua_State* L) { @@ -4404,11 +4423,11 @@ int LuaSyncedCtrl::SetFeatureResources(lua_State* L) * "north" | "n" | 2 * "west" | "w" | 3 * - * @number featureID - * @tparam string|number unitDef id or name - * @tparam[opt] string|number facing - * @number[opt] progress - * @treturn nil + * @param featureID integer + * @param unitDef string|number id or name + * @tparam? string|number facing + * @param progress number? + * @return nil */ int LuaSyncedCtrl::SetFeatureResurrect(lua_State* L) { @@ -4456,13 +4475,13 @@ int LuaSyncedCtrl::SetFeatureResurrect(lua_State* L) * * For example use `Spring.SetFeatureMoveCtrl(featureID,false,1,1,1,1,1,1,1,1,1)` to unlock all movement prior to making `Spring.SetFeatureVelocity` calls. * - * @number featureID - * @bool[opt] enable - * @number[opt] arg1 - * @number[opt] arg2 - * @number[opt] argn + * @param featureID integer + * @param enable boolean? + * @param arg1 number? + * @param arg2 number? + * @param argn number? * - * @treturn nil + * @return nil * */ int LuaSyncedCtrl::SetFeatureMoveCtrl(lua_State* L) @@ -4497,20 +4516,20 @@ int LuaSyncedCtrl::SetFeatureMoveCtrl(lua_State* L) /*** * @function Spring.SetFeaturePhysics - * @number featureID - * @number posX - * @number posY - * @number posZ - * @number velX - * @number velY - * @number velZ - * @number rotX - * @number rotY - * @number rotZ - * @number dragX - * @number dragY - * @number dragZ - * @treturn nil + * @param featureID integer + * @param posX number + * @param posY number + * @param posZ number + * @param velX number + * @param velY number + * @param velZ number + * @param rotX number + * @param rotY number + * @param rotZ number + * @param dragX number + * @param dragY number + * @param dragZ number + * @return nil */ int LuaSyncedCtrl::SetFeaturePhysics(lua_State* L) { @@ -4520,9 +4539,9 @@ int LuaSyncedCtrl::SetFeaturePhysics(lua_State* L) /*** * @function Spring.SetFeatureMass - * @number featureID - * @number mass - * @treturn nil + * @param featureID integer + * @param mass number + * @return nil */ int LuaSyncedCtrl::SetFeatureMass(lua_State* L) { @@ -4532,12 +4551,12 @@ int LuaSyncedCtrl::SetFeatureMass(lua_State* L) /*** * @function Spring.SetFeaturePosition - * @number featureID - * @number x - * @number y - * @number z - * @bool[opt] snapToGround - * @treturn nil + * @param featureID integer + * @param x number + * @param y number + * @param z number + * @param snapToGround boolean? + * @return nil */ int LuaSyncedCtrl::SetFeaturePosition(lua_State* L) { @@ -4558,11 +4577,11 @@ int LuaSyncedCtrl::SetFeaturePosition(lua_State* L) /*** * @function Spring.SetFeatureRotation - * @number featureID - * @number rotX - * @number rotY - * @number rotZ - * @treturn nil + * @param featureID integer + * @param rotX number + * @param rotY number + * @param rotZ number + * @return nil */ int LuaSyncedCtrl::SetFeatureRotation(lua_State* L) { @@ -4572,11 +4591,11 @@ int LuaSyncedCtrl::SetFeatureRotation(lua_State* L) /*** * @function Spring.SetFeatureDirection - * @number featureID - * @number dirX - * @number dirY - * @number dirZ - * @treturn nil + * @param featureID integer + * @param dirX number + * @param dirY number + * @param dirZ number + * @return nil */ int LuaSyncedCtrl::SetFeatureDirection(lua_State* L) { @@ -4586,12 +4605,12 @@ int LuaSyncedCtrl::SetFeatureDirection(lua_State* L) /*** * @function Spring.SetFeatureHeadingAndUpDir * Use this call to set up feature direction in a robust way. Heading (-32768 to 32767) represents a 2D (xz plane) feature orientation if feature was completely upright, new {upx,upy,upz} direction will be used as new "up" vector, the rotation set by "heading" will remain preserved. - * @number featureID - * @number heading - * @number upx - * @number upy - * @number upz - * @treturn nil + * @param featureID integer + * @param heading number + * @param upx number + * @param upy number + * @param upz number + * @return nil */ int LuaSyncedCtrl::SetFeatureHeadingAndUpDir(lua_State* L) { @@ -4600,11 +4619,11 @@ int LuaSyncedCtrl::SetFeatureHeadingAndUpDir(lua_State* L) /*** * @function Spring.SetFeatureVelocity - * @number featureID - * @number velX - * @number velY - * @number velZ - * @treturn nil + * @param featureID integer + * @param velX number + * @param velY number + * @param velZ number + * @return nil */ int LuaSyncedCtrl::SetFeatureVelocity(lua_State* L) { @@ -4614,15 +4633,15 @@ int LuaSyncedCtrl::SetFeatureVelocity(lua_State* L) /*** * @function Spring.SetFeatureBlocking - * @number featureID - * @bool isBlocking - * @bool isSolidObjectCollidable - * @bool isProjectileCollidable - * @bool isRaySegmentCollidable - * @bool crushable - * @bool blockEnemyPushing - * @bool blockHeightChanges - * @treturn nil + * @param featureID integer + * @param isBlocking boolean + * @param isSolidObjectCollidable boolean + * @param isProjectileCollidable boolean + * @param isRaySegmentCollidable boolean + * @param crushable boolean + * @param blockEnemyPushing boolean + * @param blockHeightChanges boolean + * @return nil */ int LuaSyncedCtrl::SetFeatureBlocking(lua_State* L) { @@ -4632,9 +4651,9 @@ int LuaSyncedCtrl::SetFeatureBlocking(lua_State* L) /*** * @function Spring.SetFeatureNoSelect - * @number featureID - * @bool noSelect - * @treturn nil + * @param featureID integer + * @param noSelect boolean + * @return nil */ int LuaSyncedCtrl::SetFeatureNoSelect(lua_State* L) { @@ -4653,15 +4672,15 @@ int LuaSyncedCtrl::SetFeatureNoSelect(lua_State* L) * * Check `Spring.SetUnitMidAndAimPos` for further explanation of the arguments. * - * @number featureID - * @number mpX - * @number mpY - * @number mpZ - * @number apX - * @number apY - * @number apZ - * @bool[opt] relative - * @treturn bool success + * @param featureID integer + * @param mpX number + * @param mpY number + * @param mpZ number + * @param apX number + * @param apY number + * @param apZ number + * @param relative boolean? + * @return boolean success */ int LuaSyncedCtrl::SetFeatureMidAndAimPos(lua_State* L) { @@ -4701,10 +4720,10 @@ int LuaSyncedCtrl::SetFeatureMidAndAimPos(lua_State* L) /*** * @function Spring.SetFeatureRadiusAndHeight - * @number featureID - * @number radius - * @number height - * @treturn bool success + * @param featureID integer + * @param radius number + * @param height number + * @return boolean success */ int LuaSyncedCtrl::SetFeatureRadiusAndHeight(lua_State* L) { @@ -4739,17 +4758,17 @@ int LuaSyncedCtrl::SetFeatureRadiusAndHeight(lua_State* L) * * Check `Spring.SetUnitCollisionVolumeData` for further explanation of the arguments. * - * @number featureID - * @number scaleX - * @number scaleY - * @number scaleZ - * @number offsetX - * @number offsetY - * @number offsetZ - * @number vType - * @number tType - * @number Axis - * @treturn nil + * @param featureID integer + * @param scaleX number + * @param scaleY number + * @param scaleZ number + * @param offsetX number + * @param offsetY number + * @param offsetZ number + * @param vType number + * @param tType number + * @param Axis number + * @return nil */ int LuaSyncedCtrl::SetFeatureCollisionVolumeData(lua_State* L) { @@ -4759,19 +4778,19 @@ int LuaSyncedCtrl::SetFeatureCollisionVolumeData(lua_State* L) /*** * @function Spring.SetFeaturePieceCollisionVolumeData - * @number featureID - * @number pieceIndex - * @bool enable - * @number scaleX - * @number scaleY - * @number scaleZ - * @number offsetX - * @number offsetY - * @number offsetZ - * @number Axis - * @number volumeType - * @number[opt] primaryAxis - * @treturn nil + * @param featureID integer + * @param pieceIndex number + * @param enable boolean + * @param scaleX number + * @param scaleY number + * @param scaleZ number + * @param offsetX number + * @param offsetY number + * @param offsetZ number + * @param Axis number + * @param volumeType number + * @param primaryAxis number? + * @return nil */ int LuaSyncedCtrl::SetFeaturePieceCollisionVolumeData(lua_State* L) { @@ -4781,10 +4800,10 @@ int LuaSyncedCtrl::SetFeaturePieceCollisionVolumeData(lua_State* L) /*** * * @function Spring.SetFeaturePieceVisible - * @number featureID - * @number pieceIndex - * @bool visible - * @treturn nil + * @param featureID integer + * @param pieceIndex number + * @param visible boolean + * @return nil */ int LuaSyncedCtrl::SetFeaturePieceVisible(lua_State* L) { @@ -4797,44 +4816,28 @@ int LuaSyncedCtrl::SetFeaturePieceVisible(lua_State* L) ******************************************************************************/ /*** - * @table projectileParams - * @tparam table pos - * @number pos.x - * @number pos.y - * @number pos.z - * @tparam table end - * @number end.x - * @number end.y - * @number end.z - * @tparam table speed - * @number speed.x - * @number speed.y - * @number speed.z - * @tparam table spread - * @number spread.x - * @number spread.y - * @number spread.z - * @tparam table error - * @number error.x - * @number error.y - * @number error.z - * @number owner - * @number team - * @number ttl - * @number gravity - * @number tracking - * @number maxRange - * @number startAlpha - * @number endAlpha - * @string model - * @string cegTag + * @class ProjectileParams + * @field pos float3 + * @field speed float3 + * @field spread float3 + * @field error float3 + * @field owner integer + * @field team integer + * @field ttl number + * @field gravity number + * @field tracking number + * @field maxRange number + * @field startAlpha number + * @field endAlpha number + * @field model string + * @field cegTag string */ /*** * @function Spring.SetProjectileAlwaysVisible - * @number projectileID - * @bool alwaysVisible - * @treturn nil + * @param projectileID integer + * @param alwaysVisible boolean + * @return nil */ int LuaSyncedCtrl::SetProjectileAlwaysVisible(lua_State* L) { @@ -4845,9 +4848,9 @@ int LuaSyncedCtrl::SetProjectileAlwaysVisible(lua_State* L) /*** * * @function Spring.SetProjectileUseAirLos - * @number projectileID - * @bool useAirLos - * @treturn nil + * @param projectileID integer + * @param useAirLos boolean + * @return nil */ int LuaSyncedCtrl::SetProjectileUseAirLos(lua_State* L) { @@ -4858,9 +4861,9 @@ int LuaSyncedCtrl::SetProjectileUseAirLos(lua_State* L) /*** * Disables engine movecontrol, so lua can fully control the physics. * @function Spring.SetProjectileMoveControl - * @number projectileID - * @bool enable - * @treturn nil + * @param projectileID integer + * @param enable boolean + * @return nil */ int LuaSyncedCtrl::SetProjectileMoveControl(lua_State* L) { @@ -4877,11 +4880,11 @@ int LuaSyncedCtrl::SetProjectileMoveControl(lua_State* L) /*** * @function Spring.SetProjectilePosition - * @number projectileID - * @number[opt=0] posX - * @number[opt=0] posY - * @number[opt=0] posZ - * @treturn nil + * @param projectileID integer + * @param posX number? (Default: 0) + * @param posY number? (Default: 0) + * @param posZ number? (Default: 0) + * @return nil */ int LuaSyncedCtrl::SetProjectilePosition(lua_State* L) { @@ -4899,11 +4902,11 @@ int LuaSyncedCtrl::SetProjectilePosition(lua_State* L) /*** * @function Spring.SetProjectileVelocity - * @number projectileID - * @number[opt=0] velX - * @number[opt=0] velY - * @number[opt=0] velZ - * @treturn nil + * @param projectileID integer + * @param velX number? (Default: 0) + * @param velY number? (Default: 0) + * @param velZ number? (Default: 0) + * @return nil * */ int LuaSyncedCtrl::SetProjectileVelocity(lua_State* L) @@ -4913,8 +4916,8 @@ int LuaSyncedCtrl::SetProjectileVelocity(lua_State* L) /*** * @function Spring.SetProjectileCollision - * @number projectileID - * @treturn nil + * @param projectileID integer + * @return nil */ int LuaSyncedCtrl::SetProjectileCollision(lua_State* L) { @@ -4940,11 +4943,11 @@ int LuaSyncedCtrl::SetProjectileCollision(lua_State* L) * string.byte('f') := FEATURE * string.byte('p') := PROJECTILE * - * @number projectileID - * @number[opt=0] arg1 targetID or posX - * @number[opt=0] arg2 targetType or posY - * @number[opt=0] posZ - * @treturn ?nil|bool validTarget + * @param projectileID integer + * @param arg1 number? (Default: 0) targetID or posX + * @param arg2 number? (Default: 0) targetType or posY + * @param posZ number? (Default: 0) + * @return boolean? validTarget */ int LuaSyncedCtrl::SetProjectileTarget(lua_State* L) { @@ -5018,8 +5021,8 @@ int LuaSyncedCtrl::SetProjectileTarget(lua_State* L) /*** * @function Spring.SetProjectileIsIntercepted - * @number projectileID - * @treturn nil + * @param projectileID integer + * @return nil */ int LuaSyncedCtrl::SetProjectileIsIntercepted(lua_State* L) { @@ -5038,11 +5041,11 @@ int LuaSyncedCtrl::SetProjectileIsIntercepted(lua_State* L) /*** * @function Spring.SetProjectileDamages - * @number unitID - * @number weaponNum - * @string key - * @number value - * @treturn nil + * @param unitID integer + * @param weaponNum number + * @param key string + * @param value number + * @return nil */ int LuaSyncedCtrl::SetProjectileDamages(lua_State* L) { @@ -5075,9 +5078,9 @@ int LuaSyncedCtrl::SetProjectileDamages(lua_State* L) /*** * @function Spring.SetProjectileIgnoreTrackingError - * @number projectileID - * @bool ignore - * @treturn nil + * @param projectileID integer + * @param ignore boolean + * @return nil */ int LuaSyncedCtrl::SetProjectileIgnoreTrackingError(lua_State* L) { @@ -5105,9 +5108,9 @@ int LuaSyncedCtrl::SetProjectileIgnoreTrackingError(lua_State* L) /*** * @function Spring.SetProjectileGravity - * @number projectileID - * @number[opt=0] grav - * @treturn nil + * @param projectileID integer + * @param grav number? (Default: 0) + * @return nil */ int LuaSyncedCtrl::SetProjectileGravity(lua_State* L) { @@ -5128,14 +5131,14 @@ int LuaSyncedCtrl::SetProjectileSpinVec(lua_State* L) { return 0; } // FIXME: DE /*** * @function Spring.SetPieceProjectileParams - * @number projectileID - * @number[opt] explosionFlags - * @number[opt] spinAngle - * @number[opt] spinSpeed - * @number[opt] spinVectorX - * @number[opt] spinVectorY - * @number[opt] spinVectorZ - * @treturn nil + * @param projectileID integer + * @param explosionFlags number? + * @param spinAngle number? + * @param spinSpeed number? + * @param spinVectorX number? + * @param spinVectorY number? + * @param spinVectorZ number? + * @return nil */ int LuaSyncedCtrl::SetPieceProjectileParams(lua_State* L) { @@ -5160,9 +5163,9 @@ int LuaSyncedCtrl::SetPieceProjectileParams(lua_State* L) // /*** * @function Spring.SetProjectileCEG - * @number projectileID - * @string ceg_name - * @treturn nil + * @param projectileID integer + * @param ceg_name string + * @return nil */ int LuaSyncedCtrl::SetProjectileCEG(lua_State* L) { @@ -5197,34 +5200,9 @@ int LuaSyncedCtrl::SetProjectileCEG(lua_State* L) */ -/*** Command Options params - * - * @table cmdOpts - * - * @tparam bool right Right mouse key pressed - * @tparam bool alt Alt key pressed - * @tparam bool ctrl Ctrl key pressed - * @tparam bool shift Shift key pressed - */ - - -/*** Command spec - * - * @table cmdSpec - * - * Used when assigning multiple commands at once - * - * @number cmdID - * @tparam {number,...} params - * @tparam cmdOpts options - */ - - /*** - * * @function Spring.UnitFinishCommand - * @number unitID - * @treturn nil + * @param unitID integer */ int LuaSyncedCtrl::UnitFinishCommand(lua_State* L) { @@ -5243,11 +5221,11 @@ int LuaSyncedCtrl::UnitFinishCommand(lua_State* L) /*** * @function Spring.GiveOrderToUnit - * @number unitID - * @number cmdID - * @tparam {number,...} params - * @tparam cmdOpts options - * @treturn bool unitOrdered + * @param unitID integer + * @param cmdID integer + * @param params number[] + * @param options CommandOptions + * @return boolean unitOrdered */ int LuaSyncedCtrl::GiveOrderToUnit(lua_State* L) { @@ -5279,11 +5257,11 @@ int LuaSyncedCtrl::GiveOrderToUnit(lua_State* L) /*** * @function Spring.GiveOrderToUnitMap - * @tparam {[number]=table,...} unitMap table with unitIDs as keys - * @number cmdID - * @tparam {number,...} params - * @tparam cmdOpts options - * @treturn number unitsOrdered + * @param unitMap table table with unitIDs as keys + * @param cmdID integer + * @param params number[] + * @param options CommandOptions + * @return number unitsOrdered */ int LuaSyncedCtrl::GiveOrderToUnitMap(lua_State* L) { @@ -5322,11 +5300,11 @@ int LuaSyncedCtrl::GiveOrderToUnitMap(lua_State* L) /*** * * @function Spring.GiveOrderToUnitArray - * @tparam {number,...} unitIDs - * @number cmdID - * @tparam {number,...} params - * @tparam cmdOpts options - * @treturn number unitsOrdered + * @param unitIDs number[] + * @param cmdID integer + * @param params number[] + * @param options CommandOptions + * @return number unitsOrdered */ int LuaSyncedCtrl::GiveOrderToUnitArray(lua_State* L) { @@ -5367,9 +5345,9 @@ int LuaSyncedCtrl::GiveOrderToUnitArray(lua_State* L) /*** * * @function Spring.GiveOrderArrayToUnit - * @number unitID - * @tparam {cmdSpec,...} cmdArray - * @treturn bool ordersGiven + * @param unitID integer + * @param cmdArray Command[] + * @return boolean ordersGiven */ int LuaSyncedCtrl::GiveOrderArrayToUnit(lua_State* L) { @@ -5407,9 +5385,9 @@ int LuaSyncedCtrl::GiveOrderArrayToUnit(lua_State* L) /*** * @function Spring.GiveOrderArrayToUnitMap - * @tparam {[number]=table} unitMap table with unitIDs as keys - * @tparam {cmdSpec,...} orderArray - * @treturn number unitsOrdered + * @param unitMap {[number]: any} table with unitIDs as keys + * @param commands Command[] + * @return number unitsOrdered */ int LuaSyncedCtrl::GiveOrderArrayToUnitMap(lua_State* L) { @@ -5449,9 +5427,9 @@ int LuaSyncedCtrl::GiveOrderArrayToUnitMap(lua_State* L) /*** * @function Spring.GiveOrderArrayToUnitArray - * @tparam {number,...} unitArray containing unitIDs - * @tparam {cmdSpec,...} orderArray - * @treturn nil + * @param unitArray number[] containing unitIDs + * @param commands Command[] + * @return nil */ int LuaSyncedCtrl::GiveOrderArrayToUnitArray(lua_State* L) { @@ -5559,12 +5537,12 @@ static inline void ParseMapParams(lua_State* L, const char* caller, /*** Set a certain height to a point or rectangle area on the world * * @function Spring.LevelHeightMap - * @number x1 - * @number z1 - * @number x2_height if y2 and height are nil then this parameter is the height - * @number[opt] z2 - * @number[opt] height - * @treturn nil + * @param x1 number + * @param z1 number + * @param x2_height number if y2 and height are nil then this parameter is the height + * @param z2 number? + * @param height number? + * @return nil */ int LuaSyncedCtrl::LevelHeightMap(lua_State* L) { @@ -5589,12 +5567,12 @@ int LuaSyncedCtrl::LevelHeightMap(lua_State* L) /*** Add a certain height to a point or rectangle area on the world * * @function Spring.AdjustHeightMap - * @number x1 - * @number y1 - * @number x2_height if y2 and height are nil then this parameter is the height - * @number[opt] y2 - * @number[opt] height - * @treturn nil + * @param x1 number + * @param y1 number + * @param x2_height number if y2 and height are nil then this parameter is the height + * @param y2 number? + * @param height number? + * @return nil */ int LuaSyncedCtrl::AdjustHeightMap(lua_State* L) { @@ -5621,12 +5599,12 @@ int LuaSyncedCtrl::AdjustHeightMap(lua_State* L) /*** Restore original map height to a point or rectangle area on the world * * @function Spring.RevertHeightMap - * @number x1 - * @number y1 - * @number x2_factor if y2 and factor are nil then this parameter is the factor - * @number[opt] y2 - * @number[opt] factor - * @treturn nil + * @param x1 number + * @param y1 number + * @param x2_factor number if y2 and factor are nil then this parameter is the factor + * @param y2 number? + * @param factor number? + * @return nil */ int LuaSyncedCtrl::RevertHeightMap(lua_State* L) { @@ -5669,10 +5647,10 @@ int LuaSyncedCtrl::RevertHeightMap(lua_State* L) /*** Can only be called in `Spring.SetHeightMapFunc` * * @function Spring.AddHeightMap - * @number x - * @number z - * @number height - * @treturn ?nil|number newHeight + * @param x number + * @param z number + * @param height number + * @return integer? newHeight */ int LuaSyncedCtrl::AddHeightMap(lua_State* L) { @@ -5717,11 +5695,11 @@ int LuaSyncedCtrl::AddHeightMap(lua_State* L) * * Can only be called in `Spring.SetHeightMapFunc`. The terraform argument is * - * @number x - * @number z - * @number height - * @number[opt=1] terraform a scaling factor. - * @treturn ?nil|number absHeightDiff =0 nothing will be changed (the terraform starts) and if =1 the terraform will be finished. + * @param x number + * @param z number + * @param height number + * @param terraform number? (Default: 1) a scaling factor. + * @return integer? absHeightDiff =0 nothing will be changed (the terraform starts) and if =1 the terraform will be finished. * */ int LuaSyncedCtrl::SetHeightMap(lua_State* L) @@ -5775,19 +5753,20 @@ int LuaSyncedCtrl::SetHeightMap(lua_State* L) * * Example code: * - * function Spring.SetHeightMapFunc(function() - * for z=0,Game.mapSizeZ, Game.squareSize do - * for x=0,Game.mapSizeX, Game.squareSize do - * Spring.SetHeightMap( x, z, 200 + 20 * math.cos((x + z) / 90) ) - * end - * end - * end) - * - * @func lua_function - * @param[opt] arg1 - * @param[opt] arg2 - * @param[opt] argn - * @treturn ?nil|number absTotalHeightMapAmountChanged + * ```lua + * function Spring.SetHeightMapFunc(function() + * for z=0,Game.mapSizeZ, Game.squareSize do + * for x=0,Game.mapSizeX, Game.squareSize do + * Spring.SetHeightMap( x, z, 200 + 20 * math.cos((x + z) / 90) ) + * end + * end + * end) + * ``` + * + * @param luaFunction function + * @param arg number + * @param ... number + * @return integer? absTotalHeightMapAmountChanged */ int LuaSyncedCtrl::SetHeightMapFunc(lua_State* L) { @@ -5837,12 +5816,12 @@ int LuaSyncedCtrl::SetHeightMapFunc(lua_State* L) /*** Set a height to a point or rectangle area to the original map height cache * * @function Spring.LevelOriginalHeightMap - * @number x1 - * @number y1 - * @number x2_height if y2 and height are nil then this parameter is the height - * @number[opt] y2 - * @number[opt] height - * @treturn nil + * @param x1 number + * @param y1 number + * @param x2_height number if y2 and height are nil then this parameter is the height + * @param y2 number? + * @param height number? + * @return nil */ int LuaSyncedCtrl::LevelOriginalHeightMap(lua_State* L) { @@ -5866,12 +5845,12 @@ int LuaSyncedCtrl::LevelOriginalHeightMap(lua_State* L) /*** Add height to a point or rectangle area to the original map height cache * * @function Spring.AdjustOriginalHeightMap - * @number x1 - * @number y1 - * @number x2_height if y2 and height are nil then this parameter is the height - * @number[opt] y2 - * @number[opt] height - * @treturn nil + * @param x1 number + * @param y1 number + * @param x2_height number if y2 and height are nil then this parameter is the height + * @param y2 number? + * @param height number? + * @return nil */ int LuaSyncedCtrl::AdjustOriginalHeightMap(lua_State* L) { @@ -5897,12 +5876,12 @@ int LuaSyncedCtrl::AdjustOriginalHeightMap(lua_State* L) /*** Restore original map height cache to a point or rectangle area on the world * * @function Spring.RevertOriginalHeightMap - * @number x1 - * @number y1 - * @number x2_factor if y2 and factor are nil then this parameter is the factor - * @number[opt] y2 - * @number[opt] factor - * @treturn nil + * @param x1 number + * @param y1 number + * @param x2_factor number if y2 and factor are nil then this parameter is the factor + * @param y2 number? + * @param factor number? + * @return nil */ int LuaSyncedCtrl::RevertOriginalHeightMap(lua_State* L) { @@ -5947,10 +5926,10 @@ int LuaSyncedCtrl::RevertOriginalHeightMap(lua_State* L) * * Can only be called in `Spring.SetOriginalHeightMapFunc` * - * @number x - * @number y - * @number height - * @treturn nil + * @param x number + * @param y number + * @param height number + * @return nil */ int LuaSyncedCtrl::AddOriginalHeightMap(lua_State* L) { @@ -5989,11 +5968,11 @@ int LuaSyncedCtrl::AddOriginalHeightMap(lua_State* L) * * Can only be called in `Spring.SetOriginalHeightMapFunc` * - * @number x - * @number y - * @number height - * @number[opt] factor - * @treturn nil + * @param x number + * @param y number + * @param height number + * @param factor number? + * @return nil */ int LuaSyncedCtrl::SetOriginalHeightMap(lua_State* L) { @@ -6041,8 +6020,8 @@ int LuaSyncedCtrl::SetOriginalHeightMap(lua_State* L) * * Cannot recurse on itself * - * @func heightMapFunc - * @treturn nil + * @param heightMapFunc function + * @return nil */ int LuaSyncedCtrl::SetOriginalHeightMapFunc(lua_State* L) { @@ -6093,7 +6072,7 @@ static inline void ParseSmoothMeshParams(lua_State* L, const char* caller, * Heightmap changes normally take up to 25s to propagate to the smooth mesh. * Use to force a mapwide update immediately. * - * @treturn nil + * @return nil */ int LuaSyncedCtrl::RebuildSmoothMesh(lua_State* L) { @@ -6104,12 +6083,12 @@ int LuaSyncedCtrl::RebuildSmoothMesh(lua_State* L) /*** * @function Spring.LevelSmoothMesh - * @number x1 - * @number z1 - * @number[opt] x2 - * @number[opt] z2 - * @number height - * @treturn nil + * @param x1 number + * @param z1 number + * @param x2 number? + * @param z2 number? + * @param height number + * @return nil */ int LuaSyncedCtrl::LevelSmoothMesh(lua_State* L) { @@ -6130,12 +6109,12 @@ int LuaSyncedCtrl::LevelSmoothMesh(lua_State* L) /*** * @function Spring.AdjustSmoothMesh - * @number x1 - * @number z1 - * @number[opt] x2 - * @number[opt] z2 - * @number height - * @treturn nil + * @param x1 number + * @param z1 number + * @param x2 number? + * @param z2 number? + * @param height number + * @return nil */ int LuaSyncedCtrl::AdjustSmoothMesh(lua_State* L) { @@ -6156,12 +6135,12 @@ int LuaSyncedCtrl::AdjustSmoothMesh(lua_State* L) /*** * * @function Spring.RevertSmoothMesh - * @number x1 - * @number z1 - * @number[opt] x2 - * @number[opt] z2 - * @number origFactor - * @treturn nil + * @param x1 number + * @param z1 number + * @param x2 number? + * @param z2 number? + * @param origFactor number + * @return nil */ int LuaSyncedCtrl::RevertSmoothMesh(lua_State* L) { @@ -6199,10 +6178,10 @@ int LuaSyncedCtrl::RevertSmoothMesh(lua_State* L) /*** Can only be called in `Spring.SetSmoothMeshFunc`. * * @function Spring.AddSmoothMesh - * @number x - * @number z - * @number height - * @treturn ?nil|number newHeight + * @param x number + * @param z number + * @param height number + * @return number? The new height, or `nil` if coordinates are invalid. */ int LuaSyncedCtrl::AddSmoothMesh(lua_State* L) { @@ -6234,14 +6213,14 @@ int LuaSyncedCtrl::AddSmoothMesh(lua_State* L) return 1; } -/*** Can only be called in `Spring.SetSmoothMeshFunc`. +/***Can only be called in `Spring.SetSmoothMeshFunc`. * * @function Spring.SetSmoothMesh - * @number x - * @number z - * @number height - * @number[opt=1] terraform - * @treturn ?nil|number absHeightDiff + * @param x number + * @param z number + * @param height number + * @param terraform number? (Default: 1) + * @return number? The absolute height difference, or `nil` if coordinates are invalid. */ int LuaSyncedCtrl::SetSmoothMesh(lua_State* L) { @@ -6284,11 +6263,10 @@ int LuaSyncedCtrl::SetSmoothMesh(lua_State* L) /*** * @function Spring.SetSmoothMeshFunc - * @func lua_function - * @param arg1[opt] - * @param arg2[opt] - * @param argn[opt] - * @treturn ?nil|number absTotalHeightMapAmountChanged + * @param luaFunction function + * @param arg any? + * @param ... any? + * @return number? absTotalHeightMapAmountChanged */ int LuaSyncedCtrl::SetSmoothMeshFunc(lua_State* L) { @@ -6326,10 +6304,10 @@ int LuaSyncedCtrl::SetSmoothMeshFunc(lua_State* L) /*** * @function Spring.SetMapSquareTerrainType - * @number x - * @number z - * @number newType - * @treturn ?nil|number oldType + * @param x number + * @param z number + * @param newType number + * @return integer? oldType */ int LuaSyncedCtrl::SetMapSquareTerrainType(lua_State* L) { @@ -6356,12 +6334,12 @@ int LuaSyncedCtrl::SetMapSquareTerrainType(lua_State* L) /*** * @function Spring.SetTerrainTypeData - * @number typeIndex - * @number[opt=nil] speedTanks - * @number[opt=nil] speedKBOts - * @number[opt=nil] speedHovers - * @number[opt=nil] speedShips - * @treturn ?nil|bool true + * @param typeIndex number + * @param speedTanks number? (Default: nil) + * @param speedKBOts number? (Default: nil) + * @param speedHovers number? (Default: nil) + * @param speedShips number? (Default: nil) + * @return boolean? true */ int LuaSyncedCtrl::SetTerrainTypeData(lua_State* L) { @@ -6403,10 +6381,10 @@ int LuaSyncedCtrl::SetTerrainTypeData(lua_State* L) /*** * @function Spring.SetSquareBuildingMask - * @number x - * @number z - * @number mask - * @treturn nil + * @param x number + * @param z number + * @param mask number + * @return nil * * See also buildingMask unitdef tag. */ @@ -6435,9 +6413,9 @@ int LuaSyncedCtrl::SetSquareBuildingMask(lua_State* L) /*** * @function Spring.UnitWeaponFire - * @number unitID - * @number weaponID - * @treturn nil + * @param unitID integer + * @param weaponID integer + * @return nil */ int LuaSyncedCtrl::UnitWeaponFire(lua_State* L) { @@ -6458,9 +6436,9 @@ int LuaSyncedCtrl::UnitWeaponFire(lua_State* L) // NB: not permanent /*** * @function Spring.UnitWeaponHoldFire - * @number unitID - * @number weaponID - * @treturn nil + * @param unitID integer + * @param weaponID integer + * @return nil */ int LuaSyncedCtrl::UnitWeaponHoldFire(lua_State* L) { @@ -6489,8 +6467,8 @@ int LuaSyncedCtrl::UnitWeaponHoldFire(lua_State* L) * the normal update rate is set. * * @function Spring.ForceUnitCollisionUpdate - * @number unitID - * @treturn nil + * @param unitID integer + * @return nil */ int LuaSyncedCtrl::ForceUnitCollisionUpdate(lua_State* L) { @@ -6507,10 +6485,10 @@ int LuaSyncedCtrl::ForceUnitCollisionUpdate(lua_State* L) /*** * * @function Spring.UnitAttach - * @number transporterID - * @number passengerID - * @number pieceNum - * @treturn nil + * @param transporterID integer + * @param passengerID integer + * @param pieceNum number + * @return nil */ int LuaSyncedCtrl::UnitAttach(lua_State* L) { @@ -6545,8 +6523,8 @@ int LuaSyncedCtrl::UnitAttach(lua_State* L) /*** * @function Spring.UnitDetach - * @number passengerID - * @treturn nil + * @param passengerID integer + * @return nil */ int LuaSyncedCtrl::UnitDetach(lua_State* L) { @@ -6567,8 +6545,8 @@ int LuaSyncedCtrl::UnitDetach(lua_State* L) /*** * @function Spring.UnitDetachFromAir - * @number passengerID - * @treturn nil + * @param passengerID integer + * @return nil */ int LuaSyncedCtrl::UnitDetachFromAir(lua_State* L) { @@ -6600,9 +6578,9 @@ int LuaSyncedCtrl::UnitDetachFromAir(lua_State* L) /*** Disables collisions between the two units to allow colvol intersection during the approach. * * @function Spring.SetUnitLoadingTransport - * @number passengerID - * @number transportID - * @treturn nil + * @param passengerID integer + * @param transportID integer + * @return nil */ int LuaSyncedCtrl::SetUnitLoadingTransport(lua_State* L) { @@ -6630,9 +6608,9 @@ int LuaSyncedCtrl::SetUnitLoadingTransport(lua_State* L) /*** * * @function Spring.SpawnProjectile - * @number weaponDefID - * @tparam projectileParams projectileParams - * @treturn ?nil|number projectileID + * @param weaponDefID integer + * @param projectileParams ProjectileParams + * @return integer? projectileID */ int LuaSyncedCtrl::SpawnProjectile(lua_State* L) { @@ -6652,8 +6630,8 @@ int LuaSyncedCtrl::SpawnProjectile(lua_State* L) /*** Silently removes projectiles (no explosion). * * @function Spring.DeleteProjectile - * @number projectileID - * @treturn nil + * @param projectileID integer + * @return nil */ int LuaSyncedCtrl::DeleteProjectile(lua_State* L) { @@ -6774,36 +6752,37 @@ static int SetExplosionParam(lua_State* L, CExplosionParams& params, DamageArray return 0; } -/*** Parameters for explosion +/*** + * Parameters for explosion. * * Please note the explosion defaults to 1 damage regardless of what it's defined in the weaponDef. * The weapondefID is only used for visuals and for passing into callins like UnitDamaged. * - * @table explosionParams - * @number weaponDef - * @number owner - * @number hitUnit - * @number hitFeature - * @number craterAreaOfEffect - * @number damageAreaOfEffect - * @number edgeEffectiveness - * @number explosionSpeed - * @number gfxMod - * @bool impactOnly - * @bool ignoreOwner - * @bool damageGround + * @class ExplosionParams + * @field weaponDef number + * @field owner number + * @field hitUnit number + * @field hitFeature number + * @field craterAreaOfEffect number + * @field damageAreaOfEffect number + * @field edgeEffectiveness number + * @field explosionSpeed number + * @field gfxMod number + * @field impactOnly boolean + * @field ignoreOwner boolean + * @field damageGround boolean */ /*** * @function Spring.SpawnExplosion - * @number[opt=0] posX - * @number[opt=0] posY - * @number[opt=0] posZ - * @number[opt=0] dirX - * @number[opt=0] dirY - * @number[opt=0] dirZ - * @tparam explosionParams explosionParams - * @treturn nil + * @param posX number? (Default: 0) + * @param posY number? (Default: 0) + * @param posZ number? (Default: 0) + * @param dirX number? (Default: 0) + * @param dirY number? (Default: 0) + * @param dirZ number? (Default: 0) + * @param explosionParams ExplosionParams + * @return nil */ int LuaSyncedCtrl::SpawnExplosion(lua_State* L) { @@ -6868,17 +6847,17 @@ int LuaSyncedCtrl::SpawnExplosion(lua_State* L) /*** * @function Spring.SpawnCEG - * @string cegname - * @number[opt=0] posX - * @number[opt=0] posY - * @number[opt=0] posZ - * @number[opt=0] dirX - * @number[opt=0] dirY - * @number[opt=0] dirZ - * @number[opt=0] radius - * @number[opt=0] damage - * @treturn ?nil|bool success - * @treturn number cegID + * @param cegname string + * @param posX number? (Default: 0) + * @param posY number? (Default: 0) + * @param posZ number? (Default: 0) + * @param dirX number? (Default: 0) + * @param dirY number? (Default: 0) + * @param dirZ number? (Default: 0) + * @param radius number? (Default: 0) + * @param damage number? (Default: 0) + * @return boolean? success + * @return number cegID */ int LuaSyncedCtrl::SpawnCEG(lua_State* L) { @@ -6901,18 +6880,18 @@ int LuaSyncedCtrl::SpawnCEG(lua_State* L) /*** Equal to the UnitScript versions of EmitSFX, but takes position and direction arguments (in either unit- or piece-space) instead of a piece index. * * @function Spring.SpawnSFX - * @number[opt=0] unitID - * @number[opt=0] sfxID - * @number[opt=0] posX - * @number[opt=0] posY - * @number[opt=0] posZ - * @number[opt=0] dirX - * @number[opt=0] dirY - * @number[opt=0] dirZ - * @number[opt=0] radius - * @number[opt=0] damage - * @bool[opt] absolute - * @treturn ?nil|bool success + * @param unitID integer? (Default: 0) + * @param sfxID integer? (Default: 0) + * @param posX number? (Default: 0) + * @param posY number? (Default: 0) + * @param posZ number? (Default: 0) + * @param dirX number? (Default: 0) + * @param dirY number? (Default: 0) + * @param dirZ number? (Default: 0) + * @param radius number? (Default: 0) + * @param damage number? (Default: 0) + * @param absolute boolean? + * @return boolean? success */ int LuaSyncedCtrl::SpawnSFX(lua_State* L) { @@ -6940,8 +6919,8 @@ int LuaSyncedCtrl::SpawnSFX(lua_State* L) /*** * @function Spring.SetNoPause - * @bool noPause - * @treturn nil + * @param noPause boolean + * @return nil */ int LuaSyncedCtrl::SetNoPause(lua_State* L) { @@ -6959,11 +6938,11 @@ int LuaSyncedCtrl::SetNoPause(lua_State* L) /*** Defines how often `Callins.UnitExperience` will be called. * * @function Spring.SetExperienceGrade - * @number expGrade - * @number[opt] ExpPowerScale - * @number[opt] ExpHealthScale - * @number[opt] ExpReloadScale - * @treturn nil + * @param expGrade number + * @param ExpPowerScale number? + * @param ExpHealthScale number? + * @param ExpReloadScale number? + * @return nil */ int LuaSyncedCtrl::SetExperienceGrade(lua_State* L) { @@ -6991,11 +6970,11 @@ int LuaSyncedCtrl::SetExperienceGrade(lua_State* L) /*** * * @function Spring.SetRadarErrorParams - * @number allyTeamID - * @number allyteamErrorSize - * @number[opt] baseErrorSize - * @number[opt] baseErrorMult - * @treturn nil + * @param allyTeamID integer + * @param allyteamErrorSize number + * @param baseErrorSize number? + * @param baseErrorMult number? + * @return nil */ int LuaSyncedCtrl::SetRadarErrorParams(lua_State* L) { @@ -7123,28 +7102,11 @@ static bool ParseCommandDescription(lua_State* L, int table, return true; } - /*** * @function Spring.EditUnitCmdDesc - * @number unitID - * @number cmdDescID - * @tparam table cmdArray structure of cmdArray: - * { - * [ id = int ], - * [ type = int ], - * [ name = string ], - * [ action = string ], - * [ tooltip = string ], - * [ texture = string ], - * [ cursor = string ], - * [ queueing = boolean ], - * [ hidden = boolean ], - * [ disabled = boolean ], - * [ showUnique = boolean ], - * [ onlyTexture = boolean ], - * [ params = { string = string, ... } ] - * } - * @treturn nil + * @param unitID integer + * @param cmdDescID integer + * @param cmdArray CommandDescription */ int LuaSyncedCtrl::EditUnitCmdDesc(lua_State* L) { @@ -7174,10 +7136,9 @@ int LuaSyncedCtrl::EditUnitCmdDesc(lua_State* L) /*** * @function Spring.InsertUnitCmdDesc - * @number unitID - * @number[opt] cmdDescID - * @tparam table cmdArray - * @treturn nil + * @param unitID integer + * @param cmdDescID integer? + * @param cmdArray CommandDescription */ int LuaSyncedCtrl::InsertUnitCmdDesc(lua_State* L) { @@ -7215,9 +7176,8 @@ int LuaSyncedCtrl::InsertUnitCmdDesc(lua_State* L) /*** * @function Spring.RemoveUnitCmdDesc - * @number unitID - * @number[opt] cmdDescID - * @treturn nil + * @param unitID integer + * @param cmdDescID integer? */ int LuaSyncedCtrl::RemoveUnitCmdDesc(lua_State* L) { diff --git a/rts/Lua/LuaSyncedMoveCtrl.cpp b/rts/Lua/LuaSyncedMoveCtrl.cpp index 60ef06f106..952f45e5c2 100644 --- a/rts/Lua/LuaSyncedMoveCtrl.cpp +++ b/rts/Lua/LuaSyncedMoveCtrl.cpp @@ -25,7 +25,6 @@ /****************************************************************************** * MoveCtrl - * @module MoveCtrl * * @see rts/Lua/LuaSyncedMoveCtrl.cpp ******************************************************************************/ diff --git a/rts/Lua/LuaSyncedRead.cpp b/rts/Lua/LuaSyncedRead.cpp index e642404011..235bfb45f8 100644 --- a/rts/Lua/LuaSyncedRead.cpp +++ b/rts/Lua/LuaSyncedRead.cpp @@ -90,7 +90,6 @@ static const LuaHashString hs_n("n"); /****************************************************************************** * Synced Read * - * @module SyncedRead * @see rts/Lua/LuaSyncedRead.cpp ******************************************************************************/ @@ -754,7 +753,7 @@ static int GetRulesParam(lua_State* L, const char* caller, int index, * * @function Spring.IsCheatingEnabled * - * @treturn bool enabled + * @return boolean enabled */ int LuaSyncedRead::IsCheatingEnabled(lua_State* L) { @@ -767,7 +766,7 @@ int LuaSyncedRead::IsCheatingEnabled(lua_State* L) * * @function Spring.IsGodModeEnabled * - * @treturn bool enabled + * @return boolean enabled */ int LuaSyncedRead::IsGodModeEnabled(lua_State* L) { @@ -782,7 +781,7 @@ int LuaSyncedRead::IsGodModeEnabled(lua_State* L) * * @function Spring.IsDevLuaEnabled * - * @treturn bool enabled + * @return boolean enabled */ int LuaSyncedRead::IsDevLuaEnabled(lua_State* L) { @@ -795,7 +794,7 @@ int LuaSyncedRead::IsDevLuaEnabled(lua_State* L) * * @function Spring.IsEditDefsEnabled * - * @treturn bool enabled + * @return boolean enabled */ int LuaSyncedRead::IsEditDefsEnabled(lua_State* L) { @@ -808,7 +807,7 @@ int LuaSyncedRead::IsEditDefsEnabled(lua_State* L) * * @function Spring.IsNoCostEnabled * - * @treturn bool enabled + * @return boolean enabled */ int LuaSyncedRead::IsNoCostEnabled(lua_State* L) { @@ -821,9 +820,9 @@ int LuaSyncedRead::IsNoCostEnabled(lua_State* L) * * @function Spring.GetGlobalLos * - * @number[opt] teamID + * @param teamID integer? * - * @treturn bool enabled + * @return boolean enabled */ int LuaSyncedRead::GetGlobalLos(lua_State* L) { @@ -840,7 +839,7 @@ int LuaSyncedRead::GetGlobalLos(lua_State* L) * * @function Spring.AreHelperAIsEnabled * - * @treturn bool enabled + * @return boolean enabled */ int LuaSyncedRead::AreHelperAIsEnabled(lua_State* L) { @@ -853,7 +852,7 @@ int LuaSyncedRead::AreHelperAIsEnabled(lua_State* L) * * @function Spring.FixedAllies * - * @treturn bool|nil enabled + * @return boolean|nil enabled */ int LuaSyncedRead::FixedAllies(lua_State* L) { @@ -866,7 +865,7 @@ int LuaSyncedRead::FixedAllies(lua_State* L) * * @function Spring.IsGameOver * - * @treturn bool isGameOver + * @return boolean isGameOver */ int LuaSyncedRead::IsGameOver(lua_State* L) { @@ -888,8 +887,8 @@ int LuaSyncedRead::IsGameOver(lua_State* L) * * @function Spring.GetGameFrame * - * @treturn number t1 frameNum % dayFrames - * @treturn number t2 frameNum / dayFrames + * @return number t1 frameNum % dayFrames + * @return number t2 frameNum / dayFrames */ int LuaSyncedRead::GetGameFrame(lua_State* L) { @@ -906,7 +905,7 @@ int LuaSyncedRead::GetGameFrame(lua_State* L) * * @function Spring.GetGameSeconds * - * @treturn number seconds + * @return number seconds */ int LuaSyncedRead::GetGameSeconds(lua_State* L) { @@ -925,7 +924,7 @@ int LuaSyncedRead::GetGameSeconds(lua_State* L) * * @function Spring.GetTidal * - * @treturn number tidalStrength + * @return number tidalStrength */ int LuaSyncedRead::GetTidal(lua_State* L) { @@ -938,7 +937,7 @@ int LuaSyncedRead::GetTidal(lua_State* L) * * @function Spring.GetWind * - * @treturn number windStrength + * @return number windStrength */ int LuaSyncedRead::GetWind(lua_State* L) { @@ -962,12 +961,15 @@ int LuaSyncedRead::GetWind(lua_State* L) * The advantage of it is that it can be read from anywhere (even from LuaUI and AIs!) ******************************************************************************/ +/** + * @class RulesParams : table + */ /*** * * @function Spring.GetGameRulesParams * - * @treturn {[string] = number,...} rulesParams map with rules names as key and values as values + * @return RulesParams rulesParams map with rules names as key and values as values */ int LuaSyncedRead::GetGameRulesParams(lua_State* L) { @@ -980,9 +982,9 @@ int LuaSyncedRead::GetGameRulesParams(lua_State* L) * * @function Spring.GetTeamRulesParams * - * @tparam number teamID + * @param teamID integer * - * @treturn {[string] = number,...} rulesParams map with rules names as key and values as values + * @return RulesParams rulesParams map with rules names as key and values as values */ int LuaSyncedRead::GetTeamRulesParams(lua_State* L) { @@ -1006,9 +1008,9 @@ int LuaSyncedRead::GetTeamRulesParams(lua_State* L) * * @function Spring.GetPlayerRulesParams * - * @tparam number playerID + * @param playerID integer * - * @treturn {[string] = number,...} rulesParams map with rules names as key and values as values + * @return RulesParams rulesParams map with rules names as key and values as values */ int LuaSyncedRead::GetPlayerRulesParams(lua_State* L) { @@ -1075,9 +1077,9 @@ static int GetUnitRulesParamLosMask(lua_State* L, const CUnit* unit) * * @function Spring.GetUnitRulesParams * - * @tparam number unitID + * @param unitID integer * - * @treturn {[string] = number,...} rulesParams map with rules names as key and values as values + * @return RulesParams rulesParams map with rules names as key and values as values */ int LuaSyncedRead::GetUnitRulesParams(lua_State* L) { @@ -1093,9 +1095,9 @@ int LuaSyncedRead::GetUnitRulesParams(lua_State* L) * * @function Spring.GetFeatureRulesParams * - * @tparam number featureID + * @param featureID integer * - * @treturn {[string] = number,...} rulesParams map with rules names as key and values as values + * @return RulesParams rulesParams map with rules names as key and values as values */ int LuaSyncedRead::GetFeatureRulesParams(lua_State* L) { @@ -1129,9 +1131,9 @@ int LuaSyncedRead::GetFeatureRulesParams(lua_State* L) * * @function Spring.GetGameRulesParam * - * @tparam number|string ruleRef the rule index or name + * @param ruleRef number|string the rule index or name * - * @treturn nil|number|string value + * @return number?|string value */ int LuaSyncedRead::GetGameRulesParam(lua_State* L) { @@ -1144,10 +1146,10 @@ int LuaSyncedRead::GetGameRulesParam(lua_State* L) * * @function Spring.GetTeamRulesParam * - * @number teamID - * @tparam number|string ruleRef the rule index or name + * @param teamID integer + * @param ruleRef number|string the rule index or name * - * @treturn nil|number|string value + * @return nil|number|string value */ int LuaSyncedRead::GetTeamRulesParam(lua_State* L) { @@ -1172,10 +1174,10 @@ int LuaSyncedRead::GetTeamRulesParam(lua_State* L) * * @function Spring.GetPlayerRulesParam * - * @number playerID - * @tparam number|string ruleRef the rule index or name + * @param playerID integer + * @param ruleRef number|string the rule index or name * - * @treturn nil|number|string value + * @return nil|number|string value */ int LuaSyncedRead::GetPlayerRulesParam(lua_State* L) { @@ -1203,10 +1205,10 @@ int LuaSyncedRead::GetPlayerRulesParam(lua_State* L) * * @function Spring.GetUnitRulesParam * - * @number unitID - * @tparam number|string ruleRef the rule index or name + * @param unitID integer + * @param ruleRef number|string the rule index or name * - * @treturn nil|number|string value + * @return nil|number|string value */ int LuaSyncedRead::GetUnitRulesParam(lua_State* L) { @@ -1222,10 +1224,10 @@ int LuaSyncedRead::GetUnitRulesParam(lua_State* L) * * @function Spring.GetFeatureRulesParam * - * @number featureID - * @tparam number|string ruleRef the rule index or name + * @param featureID integer + * @param ruleRef number|string the rule index or name * - * @treturn nil|number|string value + * @return nil|number|string value */ int LuaSyncedRead::GetFeatureRulesParam(lua_State* L) { @@ -1298,9 +1300,9 @@ static int PushAllOptions(lua_State* L, const auto &options) * * @function Spring.GetMapOption * - * @string mapOption + * @param mapOption string * - * @treturn string value of mapOption + * @return string value of mapOption * */ int LuaSyncedRead::GetMapOption(lua_State* L) { @@ -1310,7 +1312,7 @@ int LuaSyncedRead::GetMapOption(lua_State* L) * * @function Spring.GetMapOptions * - * @treturn {[string] = string,...} options map with options names as keys and values as values + * @return [string] = string[] options map with options names as keys and values as values */ int LuaSyncedRead::GetMapOptions(lua_State* L) { @@ -1322,9 +1324,9 @@ int LuaSyncedRead::GetMapOptions(lua_State* L) * * @function Spring.GetModOption * - * @string modOption + * @param modOption string * - * @treturn string value of modOption in option map + * @return string value of modOption in option map */ int LuaSyncedRead::GetModOption(lua_State* L) { @@ -1336,7 +1338,7 @@ int LuaSyncedRead::GetModOption(lua_State* L) * * @function Spring.GetModOptions * - * @treturn {[string] = string,...} options map with options names as keys and values as values + * @return [string] = string[] options map with options names as keys and values as values */ int LuaSyncedRead::GetModOptions(lua_State* L) { @@ -1355,10 +1357,10 @@ int LuaSyncedRead::GetModOptions(lua_State* L) * * @function Spring.GetHeadingFromVector * - * @number x - * @number z + * @param x number + * @param z number * - * @treturn number heading + * @return number heading */ int LuaSyncedRead::GetHeadingFromVector(lua_State* L) { @@ -1374,10 +1376,10 @@ int LuaSyncedRead::GetHeadingFromVector(lua_State* L) * * @function Spring.GetVectorFromHeading * - * @number heading + * @param heading number * - * @treturn number x - * @treturn number z + * @return number x + * @return number z */ int LuaSyncedRead::GetVectorFromHeading(lua_State* L) { @@ -1390,8 +1392,8 @@ int LuaSyncedRead::GetVectorFromHeading(lua_State* L) /*** * @function Spring.GetFacingFromHeading - * @number heading - * @treturn number facing + * @param heading number + * @return number facing */ int LuaSyncedRead::GetFacingFromHeading(lua_State* L) { @@ -1401,8 +1403,8 @@ int LuaSyncedRead::GetFacingFromHeading(lua_State* L) /*** * @function Spring.GetHeadingFromFacing - * @number facing - * @treturn number heading + * @param facing number + * @return number heading */ int LuaSyncedRead::GetHeadingFromFacing(lua_State* L) { @@ -1420,14 +1422,14 @@ int LuaSyncedRead::GetHeadingFromFacing(lua_State* L) /*** Side spec * - * @table sideSpec + * @class SideSpec * * Used when returning arrays of side specifications, is itself an array with * positional values as below: * - * @string sideName - * @string caseName - * @string startUnit + * @field sideName string + * @field caseName string + * @field startUnit string */ @@ -1435,28 +1437,28 @@ int LuaSyncedRead::GetHeadingFromFacing(lua_State* L) * * @function Spring.GetSideData * - * @string sideName + * @param sideName string * - * @treturn nil|string startUnit - * @treturn string caseSensitiveSideName + * @return nil|string startUnit + * @return string caseSensitiveSideName */ /*** * * @function Spring.GetSideData * - * @number sideID + * @param sideID integer * - * @treturn nil|string sideName - * @treturn string startUnit - * @treturn string caseSensitiveSideName + * @return nil|string sideName + * @return string startUnit + * @return string caseSensitiveSideName */ /*** * * @function Spring.GetSideData * - * @treturn {[sideSpec],...} sideArray + * @return SideSpec[] sideArray */ int LuaSyncedRead::GetSideData(lua_State* L) { @@ -1508,7 +1510,7 @@ int LuaSyncedRead::GetSideData(lua_State* L) * * @function Spring.GetGaiaTeamID * - * @treturn number teamID + * @return number teamID */ int LuaSyncedRead::GetGaiaTeamID(lua_State* L) { @@ -1524,12 +1526,12 @@ int LuaSyncedRead::GetGaiaTeamID(lua_State* L) * * @function Spring.GetAllyTeamStartBox * - * @number allyID + * @param allyID integer * - * @treturn[opt] number xMin - * @treturn[opt] number zMin - * @treturn[opt] number xMax - * @treturn[opt] number zMax + * @return number? xMin + * @return number? zMin + * @return number? xMax + * @return number? zMax */ int LuaSyncedRead::GetAllyTeamStartBox(lua_State* L) { @@ -1556,11 +1558,11 @@ int LuaSyncedRead::GetAllyTeamStartBox(lua_State* L) * * @function Spring.GetTeamStartPosition * - * @number teamID + * @param teamID integer * - * @treturn[opt] number x - * @treturn[opt] number y - * @treturn[opt] number x + * @return number? x + * @return number? y + * @return number? x */ int LuaSyncedRead::GetTeamStartPosition(lua_State* L) { @@ -1580,19 +1582,10 @@ int LuaSyncedRead::GetTeamStartPosition(lua_State* L) return 4; } - -/*** Cartesian triple (XYZ) - * @table xyz - * @number x - * @number y - * @number z - */ - - /*** * * @function Spring.GetMapStartPositions - * @treturn {xyz,...} array of positions indexed by teamID + * @return float3[] array of positions indexed by teamID */ int LuaSyncedRead::GetMapStartPositions(lua_State* L) { @@ -1618,7 +1611,7 @@ int LuaSyncedRead::GetMapStartPositions(lua_State* L) /*** * * @function Spring.GetAllyTeamList - * @treturn {number,...} list of allyTeamIDs + * @return number[] list of allyTeamIDs */ int LuaSyncedRead::GetAllyTeamList(lua_State* L) { @@ -1638,8 +1631,8 @@ int LuaSyncedRead::GetAllyTeamList(lua_State* L) /*** * * @function Spring.GetTeamList - * @number[opt=-1] allyTeamID to filter teams belonging to when >= 0 - * @treturn nil|{number,...} list of teamIDs + * @param allyTeamID integer? (Default: -1) to filter teams belonging to when >= 0 + * @return number[]? list of teamIDs */ int LuaSyncedRead::GetTeamList(lua_State* L) { @@ -1679,9 +1672,9 @@ int LuaSyncedRead::GetTeamList(lua_State* L) /*** * * @function Spring.GetPlayerList - * @number[opt=-1] teamID to filter by when >= 0 - * @bool[opt=false] active whether to filter only active teams - * @treturn nil|{number,...} list of playerIDs + * @param teamID integer? (Default: -1) to filter by when >= 0 + * @param active boolean? (Default: false) whether to filter only active teams + * @return number[]? list of playerIDs */ int LuaSyncedRead::GetPlayerList(lua_State* L) { @@ -1733,16 +1726,16 @@ int LuaSyncedRead::GetPlayerList(lua_State* L) /*** * * @function Spring.GetTeamInfo - * @number teamID - * @bool[opt=true] getTeamKeys whether to return the customTeamKeys table - * @treturn nil|number teamID - * @treturn number leader - * @treturn number isDead - * @treturn number hasAI - * @treturn string side - * @treturn number allyTeam - * @treturn number incomeMultiplier - * @treturn {[string]=string,...} customTeamKeys when getTeamKeys is true, otherwise nil + * @param teamID integer + * @param getTeamKeys boolean? (Default: true) whether to return the customTeamKeys table + * @return number? teamID + * @return number leader + * @return number isDead + * @return number hasAI + * @return string side + * @return number allyTeam + * @return number incomeMultiplier + * @return table customTeamKeys when getTeamKeys is true, otherwise nil */ int LuaSyncedRead::GetTeamInfo(lua_State* L) { @@ -1784,8 +1777,8 @@ int LuaSyncedRead::GetTeamInfo(lua_State* L) /*** * * @function Spring.GetTeamAllyTeamID - * @number teamID - * @treturn nil|allyTeamID + * @param teamID integer + * @return integer? allyTeamID */ int LuaSyncedRead::GetTeamAllyTeamID(lua_State* L) { @@ -1805,16 +1798,17 @@ int LuaSyncedRead::GetTeamAllyTeamID(lua_State* L) /*** * * @function Spring.GetTeamResources - * @number teamID - * @string resource one of "m(etal)?|e(nergy)?" - * @treturn nil|number currentLevel - * @treturn number storage - * @treturn number pull - * @treturn number income - * @treturn number expense - * @treturn number share - * @treturn number sent - * @treturn number received + * @param teamID integer + * @param resource ResourceName + * @return number? currentLevel + * @return number storage + * @return number pull + * @return number income + * @return number expense + * @return number share + * @return number sent + * @return number received + * @return number excess */ int LuaSyncedRead::GetTeamResources(lua_State* L) { @@ -1863,13 +1857,13 @@ int LuaSyncedRead::GetTeamResources(lua_State* L) /*** * * @function Spring.GetTeamUnitStats - * @number teamID - * @treturn nil|number killed - * @treturn number died - * @treturn number capturedBy - * @treturn number capturedFrom - * @treturn number received - * @treturn number sent + * @param teamID integer + * @return number? killed + * @return number died + * @return number capturedBy + * @return number capturedFrom + * @return number received + * @return number sent */ int LuaSyncedRead::GetTeamUnitStats(lua_State* L) { @@ -1898,13 +1892,13 @@ int LuaSyncedRead::GetTeamUnitStats(lua_State* L) /*** * * @function Spring.GetTeamResourceStats - * @number teamID - * @string resource one of "m(etal)?|e(nergy)?" - * @treturn nil|number used - * @treturn number produced - * @treturn number excessed - * @treturn number received - * @treturn number sent + * @param teamID integer + * @param resource ResourceName + * @return number? used + * @return number produced + * @return number excessed + * @return number received + * @return number sent */ int LuaSyncedRead::GetTeamResourceStats(lua_State* L) { @@ -1951,9 +1945,9 @@ int LuaSyncedRead::GetTeamResourceStats(lua_State* L) * Returns a team's damage stats. Note that all damage is counted, * including self-inflicted and unconfirmed out-of-sight. * - * @number teamID - * @treturn number damageDealt - * @treturn number damageReceived + * @param teamID integer + * @return number damageDealt + * @return number damageReceived */ int LuaSyncedRead::GetTeamDamageStats(lua_State* L) { @@ -1975,37 +1969,43 @@ int LuaSyncedRead::GetTeamDamageStats(lua_State* L) } -/*** @table teamStats - * @number time - * @number frame - * @number metalUsed - * @number metalProduced - * @number metalExcess - * @number metalReceived - * @number metalSent - * @number energyUsed - * @number energyProduced - * @number energyExcess - * @number energyReceived - * @number energySent - * @number damageDealt - * @number damageReceived - * @number unitsProduced - * @number unitsDied - * @number unitsReceived - * @number unitsSent - * @number unitsCaptured - * @number unitsOutCaptured +/*** + * @class TeamStats + * @field time number + * @field frame number + * @field metalUsed number + * @field metalProduced number + * @field metalExcess number + * @field metalReceived number + * @field metalSent number + * @field energyUsed number + * @field energyProduced number + * @field energyExcess number + * @field energyReceived number + * @field energySent number + * @field damageDealt number + * @field damageReceived number + * @field unitsProduced integer + * @field unitsDied integer + * @field unitsReceived integer + * @field unitsSent integer + * @field unitsCaptured integer + * @field unitsOutCaptured integer */ - /*** - * + * Get the number of history entries. + * @function Spring.GetTeamStatsHistory + * @param teamID integer + * @return integer? historyCount The number of history entries, or `nil` if unable to resolve team. + */ +/*** + * Get team stats history. * @function Spring.GetTeamStatsHistory - * @number teamID - * @number[opt] startIndex when not specified return the number of history entries - * @number[opt=startIndex] endIndex - * @treturn nil|number|{teamStats,...} + * @param teamID integer + * @param startIndex integer + * @param endIndex integer? (Default: startIndex) + * @return TeamStats[] The team stats history, or `nil` if unable to resolve team. */ int LuaSyncedRead::GetTeamStatsHistory(lua_State* L) { @@ -2095,8 +2095,8 @@ int LuaSyncedRead::GetTeamStatsHistory(lua_State* L) /*** * * @function Spring.GetTeamLuaAI - * @number teamID - * @treturn string + * @param teamID integer + * @return string */ int LuaSyncedRead::GetTeamLuaAI(lua_State* L) { @@ -2130,9 +2130,9 @@ int LuaSyncedRead::GetTeamLuaAI(lua_State* L) * Also returns the current unit count for readable teams as the 2nd value. * * @function Spring.GetTeamMaxUnits - * @number teamID - * @treturn number maxUnits - * @treturn nil|number currentUnits + * @param teamID integer + * @return number maxUnits + * @return number? currentUnits */ int LuaSyncedRead::GetTeamMaxUnits(lua_State* L) { @@ -2153,20 +2153,20 @@ int LuaSyncedRead::GetTeamMaxUnits(lua_State* L) /*** * * @function Spring.GetPlayerInfo - * @number playerID - * @bool[opt=true] getPlayerOpts whether to return custom player options - * @treturn nil|string name - * @treturn bool active - * @treturn bool spectator - * @treturn number teamID - * @treturn number allyTeamID - * @treturn number pingTime - * @treturn number cpuUsage - * @treturn string country - * @treturn number rank - * @treturn bool hasSkirmishAIsInTeam - * @treturn {[string]=string} playerOpts when playerOpts is true - * @treturn bool desynced + * @param playerID integer + * @param getPlayerOpts boolean? (Default: true) whether to return custom player options + * @return string name + * @return boolean active + * @return boolean spectator + * @return number teamID + * @return number allyTeamID + * @return number pingTime + * @return number cpuUsage + * @return string country + * @return number rank + * @return boolean hasSkirmishAIsInTeam + * @return {[string]: string} playerOpts when playerOpts is true + * @return boolean desynced */ int LuaSyncedRead::GetPlayerInfo(lua_State* L) { @@ -2218,8 +2218,8 @@ int LuaSyncedRead::GetPlayerInfo(lua_State* L) /*** Returns unit controlled by player on FPS mode * * @function Spring.GetPlayerControlledUnit - * @number playerID - * @treturn nil|number + * @param playerID integer + * @return number? */ int LuaSyncedRead::GetPlayerControlledUnit(lua_State* L) { @@ -2254,13 +2254,13 @@ int LuaSyncedRead::GetPlayerControlledUnit(lua_State* L) /*** * * @function Spring.GetAIInfo - * @number teamID - * @treturn number skirmishAIID - * @treturn string name - * @treturn number hostingPlayerID - * @treturn string shortName when synced "SYNCED_NOSHORTNAME", otherwise the AI shortname or "UNKNOWN" - * @treturn string version when synced "SYNCED_NOVERSION", otherwise the AI version or "UNKNOWN" - * @treturn {[string]=string,...} options + * @param teamID integer + * @return number skirmishAIID + * @return string name + * @return number hostingPlayerID + * @return string shortName when synced "SYNCED_NOSHORTNAME", otherwise the AI shortname or "UNKNOWN" + * @return string version when synced "SYNCED_NOVERSION", otherwise the AI version or "UNKNOWN" + * @return table options */ int LuaSyncedRead::GetAIInfo(lua_State* L) { @@ -2313,8 +2313,8 @@ int LuaSyncedRead::GetAIInfo(lua_State* L) /*** * * @function Spring.GetAllyTeamInfo - * @number allyTeamID - * @treturn nil|{[string]=string,...} + * @param allyTeamID integer + * @return nil|table */ int LuaSyncedRead::GetAllyTeamInfo(lua_State* L) { @@ -2339,9 +2339,9 @@ int LuaSyncedRead::GetAllyTeamInfo(lua_State* L) /*** * * @function Spring.AreTeamsAllied - * @number teamID1 - * @number teamID2 - * @treturn nil|bool + * @param teamID1 number + * @param teamID2 number + * @return nil|boolean */ int LuaSyncedRead::AreTeamsAllied(lua_State* L) { @@ -2359,9 +2359,9 @@ int LuaSyncedRead::AreTeamsAllied(lua_State* L) /*** * * @function Spring.ArePlayersAllied - * @number playerID1 - * @number playerID2 - * @treturn nil|bool + * @param playerID1 number + * @param playerID2 number + * @return nil|boolean */ int LuaSyncedRead::ArePlayersAllied(lua_State* L) { @@ -2404,7 +2404,7 @@ int LuaSyncedRead::ArePlayersAllied(lua_State* L) * * @see UnsyncedRead.GetVisibleUnits * - * @treturn {number,...} unitIDs + * @return number[] unitIDs */ int LuaSyncedRead::GetAllUnits(lua_State* L) { @@ -2433,8 +2433,8 @@ int LuaSyncedRead::GetAllUnits(lua_State* L) /*** * * @function Spring.GetTeamUnits - * @number teamID - * @treturn nil|{number,...} unitIDs + * @param teamID integer + * @return number[]? unitIDs */ int LuaSyncedRead::GetTeamUnits(lua_State* L) { @@ -2533,8 +2533,8 @@ static inline void InsertSearchUnitDefs(const UnitDef* ud, bool allied) /*** * * @function Spring.GetTeamUnitsSorted - * @number teamID - * @treturn nil|{[number]={number,...}} where keys are unitDefIDs and values are unitIDs + * @param teamID integer + * @return table unitsByDef A table where keys are unitDefIDs and values are unitIDs */ int LuaSyncedRead::GetTeamUnitsSorted(lua_State* L) { @@ -2629,8 +2629,8 @@ int LuaSyncedRead::GetTeamUnitsSorted(lua_State* L) /*** * * @function Spring.GetTeamUnitsCounts - * @number teamID - * @treturn nil|{[number]=number} where keys are unitDefIDs and values are counts + * @param teamID integer + * @return table? countByUnit A table where keys are unitDefIDs and values are counts. */ int LuaSyncedRead::GetTeamUnitsCounts(lua_State* L) { @@ -2712,9 +2712,9 @@ int LuaSyncedRead::GetTeamUnitsCounts(lua_State* L) /*** * * @function Spring.GetTeamUnitsByDefs - * @number teamID - * @tparam number|{number,...} unitDefIDs - * @treturn nil|{number,...} unitIDs + * @param teamID integer + * @param unitDefIDs number|number[] + * @return number[]? unitIDs */ int LuaSyncedRead::GetTeamUnitsByDefs(lua_State* L) { @@ -2788,9 +2788,9 @@ int LuaSyncedRead::GetTeamUnitsByDefs(lua_State* L) /*** * * @function Spring.GetTeamUnitDefCount - * @number teamID - * @number unitDefID - * @treturn nil|number count + * @param teamID integer + * @param unitDefID integer + * @return number? count */ int LuaSyncedRead::GetTeamUnitDefCount(lua_State* L) { @@ -2849,8 +2849,8 @@ int LuaSyncedRead::GetTeamUnitDefCount(lua_State* L) /*** * * @function Spring.GetTeamUnitCount - * @number teamID - * @treturn nil|number count + * @param teamID integer + * @return number? count */ int LuaSyncedRead::GetTeamUnitCount(lua_State* L) { @@ -2962,12 +2962,12 @@ void ApplyPlanarTeamError(lua_State* L, int allegiance, float3& mins, float3& ma /*** * * @function Spring.GetUnitsInRectangle - * @number xmin - * @number zmin - * @number xmax - * @number zmax - * @number[opt] allegiance - * @treturn {number,...} unitIDs + * @param xmin number + * @param zmin number + * @param xmax number + * @param zmax number + * @param allegiance number? + * @return number[] unitIDs */ int LuaSyncedRead::GetUnitsInRectangle(lua_State* L) { @@ -3028,14 +3028,14 @@ int LuaSyncedRead::GetUnitsInRectangle(lua_State* L) /*** * * @function Spring.GetUnitsInBox - * @number xmin - * @number ymin - * @number zmin - * @number xmax - * @number ymax - * @number zmax - * @number[opt] allegiance - * @treturn {number,...} unitIDs + * @param xmin number + * @param ymin number + * @param zmin number + * @param xmax number + * @param ymax number + * @param zmax number + * @param allegiance number? + * @return number[] unitIDs */ int LuaSyncedRead::GetUnitsInBox(lua_State* L) { @@ -3098,10 +3098,10 @@ int LuaSyncedRead::GetUnitsInBox(lua_State* L) /*** * * @function Spring.GetUnitsInCylinder - * @number x - * @number z - * @number radius - * @treturn {number,...} unitIDs + * @param x number + * @param z number + * @param radius number + * @return number[] unitIDs */ int LuaSyncedRead::GetUnitsInCylinder(lua_State* L) { @@ -3160,11 +3160,11 @@ int LuaSyncedRead::GetUnitsInCylinder(lua_State* L) /*** * * @function Spring.GetUnitsInSphere - * @number x - * @number y - * @number z - * @number radius - * @treturn {number,...} unitIDs + * @param x number + * @param y number + * @param z number + * @param radius number + * @return number[] unitIDs */ int LuaSyncedRead::GetUnitsInSphere(lua_State* L) { @@ -3240,28 +3240,29 @@ static inline bool UnitInPlanes(const float3& pos, const float radius, const vec return true; } - -/*** @table planeSpec - * @number normalVecX - * @number normalVecY - * @number normalVecZ - * @number d +/*** + * @class Plane + * @field normalVecX number + * @field normalVecY number + * @field normalVecZ number + * @field d number */ - /*** * * @function Spring.GetUnitsInPlanes * * Plane normals point towards accepted space, so the acceptance criteria for each plane is: * - * radius = unit radius - * px, py, pz = unit position - * [(nx * px) + (ny * py) + (nz * pz) + (d - radius)] <= 0 + * ``` + * radius = unit radius + * px, py, pz = unit position + * [(nx * px) + (ny * py) + (nz * pz) + (d - radius)] <= 0 + * ``` * - * @tparam {planeSpec,...} planes - * @number[opt] allegiance - * @treturn nil|{number,...} unitIDs + * @param planes Plane[] + * @param allegiance integer? + * @return integer[] unitIDs */ int LuaSyncedRead::GetUnitsInPlanes(lua_State* L) { @@ -3386,10 +3387,10 @@ static int GetUnitTableCentroid(lua_State *const L, const int indexWithinTable, * Returns nil for an empty array * * @function Spring.GetUnitArrayCentroid - * @tparam table units { unitID, unitID, ... } - * @treturn number centerX - * @treturn number centerY - * @treturn number centerZ + * @param units table { unitID, unitID, ... } + * @return number centerX + * @return number centerY + * @return number centerZ */ int LuaSyncedRead::GetUnitArrayCentroid(lua_State* L) { @@ -3401,10 +3402,10 @@ int LuaSyncedRead::GetUnitArrayCentroid(lua_State* L) * Returns nil for an empty map * * @function Spring.GetUnitMapCentroid - * @tparam table units { [unitID] = true, [unitID] = true, ... } - * @treturn number centerX - * @treturn number centerY - * @treturn number centerZ + * @param units table { [unitID] = true, [unitID] = true, ... } + * @return number centerX + * @return number centerY + * @return number centerZ */ int LuaSyncedRead::GetUnitMapCentroid(lua_State* L) { @@ -3415,9 +3416,9 @@ int LuaSyncedRead::GetUnitMapCentroid(lua_State* L) /*** * * @function Spring.GetUnitNearestAlly - * @number unitID - * @number[opt=1.0e9f] range - * @treturn nil|number unitID + * @param unitID integer + * @param range number? (Default: 1.0e9f) + * @return number? unitID */ int LuaSyncedRead::GetUnitNearestAlly(lua_State* L) { @@ -3440,10 +3441,10 @@ int LuaSyncedRead::GetUnitNearestAlly(lua_State* L) /*** * * @function Spring.GetUnitNearestEnemy - * @number unitID - * @number[opt=1.0e9f] range - * @bool[opt=true] useLOS - * @treturn nil|number unitID + * @param unitID integer + * @param range number? (Default: 1.0e9f) + * @param useLOS boolean? (Default: true) + * @return number? unitID */ int LuaSyncedRead::GetUnitNearestEnemy(lua_State* L) { @@ -3511,11 +3512,11 @@ inline void ProcessFeatures(lua_State* L, const vector& features) { /*** * * @function Spring.GetFeaturesInRectangle - * @number xmin - * @number zmin - * @number xmax - * @number zmax - * @treturn {number,...} featureIDs + * @param xmin number + * @param zmin number + * @param xmax number + * @param zmax number + * @return number[] featureIDs */ int LuaSyncedRead::GetFeaturesInRectangle(lua_State* L) { @@ -3537,11 +3538,11 @@ int LuaSyncedRead::GetFeaturesInRectangle(lua_State* L) /*** * * @function Spring.GetFeaturesInSphere - * @number x - * @number y - * @number z - * @number radius - * @treturn {number,...} featureIDs + * @param x number + * @param y number + * @param z number + * @param radius number + * @return number[] featureIDs */ int LuaSyncedRead::GetFeaturesInSphere(lua_State* L) { @@ -3562,11 +3563,11 @@ int LuaSyncedRead::GetFeaturesInSphere(lua_State* L) /*** * * @function Spring.GetFeaturesInCylinder - * @number x - * @number z - * @number radius - * @number[opt] allegiance - * @treturn {number,...} featureIDs + * @param x number + * @param z number + * @param radius number + * @param allegiance number? + * @return number[] featureIDs */ int LuaSyncedRead::GetFeaturesInCylinder(lua_State* L) { @@ -3586,13 +3587,13 @@ int LuaSyncedRead::GetFeaturesInCylinder(lua_State* L) /*** * * @function Spring.GetProjectilesInRectangle - * @number xmin - * @number zmin - * @number xmax - * @number zmax - * @bool[opt=false] excludeWeaponProjectiles - * @bool[opt=false] excludePieceProjectiles - * @treturn {number,...} projectileIDs + * @param xmin number + * @param zmin number + * @param xmax number + * @param zmax number + * @param excludeWeaponProjectiles boolean? (Default: false) + * @param excludePieceProjectiles boolean? (Default: false) + * @return number[] projectileIDs */ int LuaSyncedRead::GetProjectilesInRectangle(lua_State* L) { @@ -3669,8 +3670,8 @@ int LuaSyncedRead::GetProjectilesInRectangle(lua_State* L) /*** * * @function Spring.ValidUnitID - * @number unitID - * @treturn bool + * @param unitID integer + * @return boolean */ int LuaSyncedRead::ValidUnitID(lua_State* L) { @@ -3679,24 +3680,25 @@ int LuaSyncedRead::ValidUnitID(lua_State* L) } -/*** @table unitState - * @number firestate - * @number movestate - * @bool repeat - * @bool cloak - * @bool active - * @bool trajectory - * @bool autoland optional - * @number autorepairlevel optional - * @bool loopbackattack optional +/*** + * @class UnitState + * @field firestate number + * @field movestate number + * @field repeat boolean + * @field cloak boolean + * @field active boolean + * @field trajectory boolean + * @field autoland boolean? + * @field autorepairlevel number? + * @field loopbackattack boolean? */ /*** * * @function Spring.GetUnitStates - * @number unitID - * @treturn {unitState,...} + * @param unitID integer + * @return UnitState[] */ int LuaSyncedRead::GetUnitStates(lua_State* L) { @@ -3788,9 +3790,9 @@ int LuaSyncedRead::GetUnitStates(lua_State* L) /*** * * @function Spring.GetUnitArmored - * @number unitID - * @treturn nil|bool armored - * @treturn number armorMultiple + * @param unitID integer + * @return nil|boolean armored + * @return number armorMultiple */ int LuaSyncedRead::GetUnitArmored(lua_State* L) { @@ -3807,8 +3809,8 @@ int LuaSyncedRead::GetUnitArmored(lua_State* L) /*** * * @function Spring.GetUnitIsActive - * @number unitID - * @treturn nil|bool + * @param unitID integer + * @return boolean? isActive */ int LuaSyncedRead::GetUnitIsActive(lua_State* L) { @@ -3824,8 +3826,8 @@ int LuaSyncedRead::GetUnitIsActive(lua_State* L) /*** * * @function Spring.GetUnitIsCloaked - * @number unitID - * @treturn nil|bool + * @param unitID integer + * @return boolean? isCloaked */ int LuaSyncedRead::GetUnitIsCloaked(lua_State* L) { @@ -3841,8 +3843,8 @@ int LuaSyncedRead::GetUnitIsCloaked(lua_State* L) /*** * * @function Spring.GetUnitSeismicSignature - * @number unitID - * @treturn nil|number + * @param unitID integer + * @return number? seismicSignature */ int LuaSyncedRead::GetUnitSeismicSignature(lua_State* L) { @@ -3857,8 +3859,8 @@ int LuaSyncedRead::GetUnitSeismicSignature(lua_State* L) /*** * * @function Spring.GetUnitSelfDTime - * @number unitID - * @treturn nil|number + * @param unitID integer + * @return integer? selfDTime */ int LuaSyncedRead::GetUnitSelfDTime(lua_State* L) { @@ -3874,10 +3876,10 @@ int LuaSyncedRead::GetUnitSelfDTime(lua_State* L) /*** * * @function Spring.GetUnitStockpile - * @number unitID - * @treturn nil|number numStockpiled - * @treturn number numStockpileQued - * @treturn number buildPercent + * @param unitID integer + * @return integer? numStockpiled + * @return integer? numStockpileQued + * @return number? buildPercent */ int LuaSyncedRead::GetUnitStockpile(lua_State* L) { @@ -3898,9 +3900,9 @@ int LuaSyncedRead::GetUnitStockpile(lua_State* L) /*** * * @function Spring.GetUnitSensorRadius - * @number unitID - * @string type one of los, airLos, radar, sonar, seismic, radarJammer, sonarJammer - * @treturn nil|number radius + * @param unitID integer + * @param type string one of los, airLos, radar, sonar, seismic, radarJammer, sonarJammer + * @return number? radius */ int LuaSyncedRead::GetUnitSensorRadius(lua_State* L) { @@ -3941,16 +3943,16 @@ int LuaSyncedRead::GetUnitSensorRadius(lua_State* L) /*** * * @function Spring.GetUnitPosErrorParams - * @number unitID - * @number[opt] allyTeamID - * @treturn nil|number posErrorVectorX - * @treturn number posErrorVectorY - * @treturn number posErrorVectorZ - * @treturn number posErrorDeltaX - * @treturn number posErrorDeltaY - * @treturn number posErrorDeltaZ - * @treturn number nextPosErrorUpdatebaseErrorMult - * @treturn bool posErrorBit + * @param unitID integer + * @param allyTeamID integer? + * @return number? posErrorVectorX + * @return number posErrorVectorY + * @return number posErrorVectorZ + * @return number posErrorDeltaX + * @return number posErrorDeltaY + * @return number posErrorDeltaZ + * @return number nextPosErrorUpdatebaseErrorMult + * @return boolean posErrorBit */ int LuaSyncedRead::GetUnitPosErrorParams(lua_State* L) { @@ -3978,8 +3980,8 @@ int LuaSyncedRead::GetUnitPosErrorParams(lua_State* L) /*** * * @function Spring.GetUnitTooltip - * @number unitID - * @treturn nil|string + * @param unitID integer + * @return nil|string */ int LuaSyncedRead::GetUnitTooltip(lua_State* L) { @@ -4018,8 +4020,8 @@ int LuaSyncedRead::GetUnitTooltip(lua_State* L) /*** * * @function Spring.GetUnitDefID - * @number unitID - * @treturn nil|number + * @param unitID integer + * @return number? */ int LuaSyncedRead::GetUnitDefID(lua_State* L) { @@ -4043,8 +4045,8 @@ int LuaSyncedRead::GetUnitDefID(lua_State* L) /*** * * @function Spring.GetUnitTeam - * @number unitID - * @treturn nil|number + * @param unitID integer + * @return number? */ int LuaSyncedRead::GetUnitTeam(lua_State* L) { @@ -4060,8 +4062,8 @@ int LuaSyncedRead::GetUnitTeam(lua_State* L) /*** * * @function Spring.GetUnitAllyTeam - * @number unitID - * @treturn nil|number + * @param unitID integer + * @return number? */ int LuaSyncedRead::GetUnitAllyTeam(lua_State* L) { @@ -4081,8 +4083,8 @@ int LuaSyncedRead::GetUnitAllyTeam(lua_State* L) * Note that a "neutral" unit can belong to any ally-team (ally, enemy, Gaia). * To check if a unit is Gaia, check its owner team. * - * @number unitID - * @treturn nil|bool + * @param unitID integer + * @return nil|boolean */ int LuaSyncedRead::GetUnitNeutral(lua_State* L) { @@ -4098,12 +4100,12 @@ int LuaSyncedRead::GetUnitNeutral(lua_State* L) /*** * * @function Spring.GetUnitHealth - * @number unitID - * @treturn nil|number health - * @treturn number maxHealth - * @treturn number paralyzeDamage - * @treturn number captureProgress - * @treturn number buildProgress between 0.0-1.0 + * @param unitID integer + * @return number? health + * @return number maxHealth + * @return number paralyzeDamage + * @return number captureProgress + * @return number buildProgress between 0.0-1.0 */ int LuaSyncedRead::GetUnitHealth(lua_State* L) { @@ -4137,8 +4139,8 @@ int LuaSyncedRead::GetUnitHealth(lua_State* L) /*** * * @function Spring.GetUnitIsDead - * @number unitID - * @treturn nil|bool + * @param unitID integer + * @return nil|boolean */ int LuaSyncedRead::GetUnitIsDead(lua_State* L) { @@ -4160,10 +4162,10 @@ int LuaSyncedRead::GetUnitIsDead(lua_State* L) * Use other callouts to differentiate them if you need to. * * @function Spring.GetUnitIsStunned - * @number unitID - * @treturn nil|bool stunnedOrBuilt unit is disabled - * @treturn bool stunned unit is either stunned via EMP or being transported by a non-fireplatform - * @treturn bool beingBuilt unit is under construction + * @param unitID integer + * @return nil|boolean stunnedOrBuilt unit is disabled + * @return boolean stunned unit is either stunned via EMP or being transported by a non-fireplatform + * @return boolean beingBuilt unit is under construction */ int LuaSyncedRead::GetUnitIsStunned(lua_State* L) { @@ -4181,9 +4183,9 @@ int LuaSyncedRead::GetUnitIsStunned(lua_State* L) /*** * * @function Spring.GetUnitIsBeingBuilt - * @number unitID - * @treturn bool beingBuilt - * @treturn number buildProgress + * @param unitID integer + * @return boolean beingBuilt + * @return number buildProgress */ int LuaSyncedRead::GetUnitIsBeingBuilt(lua_State* L) { @@ -4199,11 +4201,11 @@ int LuaSyncedRead::GetUnitIsBeingBuilt(lua_State* L) /*** * * @function Spring.GetUnitResources - * @number unitID - * @treturn nil|number metalMake - * @treturn number metalUse - * @treturn number energyMake - * @treturn number energyUse + * @param unitID integer + * @return number? metalMake + * @return number metalUse + * @return number energyMake + * @return number energyUse */ int LuaSyncedRead::GetUnitResources(lua_State* L) { @@ -4220,10 +4222,10 @@ int LuaSyncedRead::GetUnitResources(lua_State* L) /*** * @function Spring.GetUnitCosts - * @number unitID - * @treturn nil|number buildTime - * @treturn number metalCost - * @treturn number energyCost + * @param unitID integer + * @return number? buildTime + * @return number metalCost + * @return number energyCost */ int LuaSyncedRead::GetUnitCosts(lua_State* L) { @@ -4236,11 +4238,18 @@ int LuaSyncedRead::GetUnitCosts(lua_State* L) lua_pushnumber(L, unit->cost.energy); return 3; } + +/** + * @class ResourceCost + * @field metal number + * @field energy number + */ + /*** * @function Spring.GetUnitCostTable - * @number unitID - * @treturn nil|{ metal = number, energy = number } - * @treturn number buildTime + * @param unitID integer + * @return ResourceCost? cost The cost of the unit, or `nil` if invalid. + * @return number? buildTime The build time the unit, or `nil` if invalid. */ int LuaSyncedRead::GetUnitCostTable(lua_State* L) { @@ -4262,8 +4271,8 @@ int LuaSyncedRead::GetUnitCostTable(lua_State* L) /*** * * @function Spring.GetUnitMetalExtraction - * @number unitID - * @treturn nil|number + * @param unitID integer + * @return number? metalExtraction */ int LuaSyncedRead::GetUnitMetalExtraction(lua_State* L) { @@ -4282,9 +4291,9 @@ int LuaSyncedRead::GetUnitMetalExtraction(lua_State* L) /*** * * @function Spring.GetUnitExperience - * @number unitID - * @treturn number XP [0.0; +∞) - * @treturn number limXP [0.0; 1.0) as experience approaches infinity + * @param unitID integer + * @return number xp [0.0; +∞) + * @return number limXp [0.0; 1.0) as experience approaches infinity */ int LuaSyncedRead::GetUnitExperience(lua_State* L) { @@ -4301,8 +4310,8 @@ int LuaSyncedRead::GetUnitExperience(lua_State* L) /*** * * @function Spring.GetUnitHeight - * @number unitID - * @treturn nil|number + * @param unitID integer + * @return number? */ int LuaSyncedRead::GetUnitHeight(lua_State* L) { @@ -4318,8 +4327,8 @@ int LuaSyncedRead::GetUnitHeight(lua_State* L) /*** * * @function Spring.GetUnitRadius - * @number unitID - * @treturn nil|number + * @param unitID integer + * @return number? */ int LuaSyncedRead::GetUnitRadius(lua_State* L) { @@ -4335,8 +4344,8 @@ int LuaSyncedRead::GetUnitRadius(lua_State* L) * * @function Spring.GetUnitBuildeeRadius * Gets the unit's radius for when targeted by build, repair, reclaim-type commands. - * @number unitID - * @treturn nil|number + * @param unitID integer + * @return number? */ int LuaSyncedRead::GetUnitBuildeeRadius(lua_State* L) { @@ -4351,8 +4360,8 @@ int LuaSyncedRead::GetUnitBuildeeRadius(lua_State* L) /*** * * @function Spring.GetUnitMass - * @number unitID - * @treturn nil|number + * @param unitID integer + * @return number? */ int LuaSyncedRead::GetUnitMass(lua_State* L) { @@ -4362,18 +4371,18 @@ int LuaSyncedRead::GetUnitMass(lua_State* L) /*** * * @function Spring.GetUnitPosition - * @number unitID - * @bool[opt=false] midPos return midpoint as well - * @bool[opt=false] aimPos return aimpoint as well - * @treturn nil|number basePointX - * @treturn number basePointY - * @treturn number basePointZ - * @treturn nil|number midPointX - * @treturn number midPointY - * @treturn number midPointZ - * @treturn nil|number aimPointX - * @treturn number aimPointY - * @treturn number aimPointZ + * @param unitID integer + * @param midPos boolean? (Default: false) return midpoint as well + * @param aimPos boolean? (Default: false) return aimpoint as well + * @return number? basePointX + * @return number basePointY + * @return number basePointZ + * @return number? midPointX + * @return number midPointY + * @return number midPointZ + * @return number? aimPointX + * @return number aimPointY + * @return number aimPointZ */ int LuaSyncedRead::GetUnitPosition(lua_State* L) { @@ -4383,10 +4392,10 @@ int LuaSyncedRead::GetUnitPosition(lua_State* L) /*** * * @function Spring.GetUnitBasePosition - * @number unitID - * @treturn nil|number posX - * @treturn number posY - * @treturn number posZ + * @param unitID integer + * @return number? posX + * @return number posY + * @return number posZ */ int LuaSyncedRead::GetUnitBasePosition(lua_State* L) { @@ -4397,10 +4406,10 @@ int LuaSyncedRead::GetUnitBasePosition(lua_State* L) /*** * * @function Spring.GetUnitVectors - * @number unitID - * @treturn nil|xyz front - * @treturn xyz up - * @treturn xyz right + * @param unitID integer + * @return float3? front + * @return float3 up + * @return float3 right */ int LuaSyncedRead::GetUnitVectors(lua_State* L) { @@ -4425,10 +4434,10 @@ int LuaSyncedRead::GetUnitVectors(lua_State* L) /*** * * @function Spring.GetUnitRotation - * @number unitID - * @treturn nil|number pitch, rotation in X axis - * @treturn number yaw, rotation in Y axis - * @treturn number roll, rotation in Z axis + * @param unitID integer + * @return number? pitch Rotation in X axis + * @return number? yaw Rotation in Y axis + * @return number? roll Rotation in Z axis */ int LuaSyncedRead::GetUnitRotation(lua_State* L) { @@ -4439,10 +4448,10 @@ int LuaSyncedRead::GetUnitRotation(lua_State* L) /*** * * @function Spring.GetUnitDirection - * @number unitID - * @treturn nil|dirX - * @treturn dirY - * @treturn dirZ + * @param unitID integer + * @return number? dirX + * @return number? dirY + * @return number? dirZ */ int LuaSyncedRead::GetUnitDirection(lua_State* L) { @@ -4461,9 +4470,9 @@ int LuaSyncedRead::GetUnitDirection(lua_State* L) /*** * * @function Spring.GetUnitHeading - * @number unitID - * @bool[opt=false] convertToRadians - * @treturn heading + * @param unitID integer + * @param convertToRadians boolean? (Default: false) + * @return number heading */ int LuaSyncedRead::GetUnitHeading(lua_State* L) { @@ -4484,7 +4493,7 @@ int LuaSyncedRead::GetUnitHeading(lua_State* L) /*** * * @function Spring.GetUnitVelocity - * @number unitID + * @param unitID integer */ int LuaSyncedRead::GetUnitVelocity(lua_State* L) { @@ -4495,7 +4504,7 @@ int LuaSyncedRead::GetUnitVelocity(lua_State* L) /*** * * @function Spring.GetUnitBuildFacing - * @number unitID + * @param unitID integer */ int LuaSyncedRead::GetUnitBuildFacing(lua_State* L) { @@ -4514,8 +4523,8 @@ int LuaSyncedRead::GetUnitBuildFacing(lua_State* L) * * Works for both mobile builders and factories. * - * @number unitID - * @treturn number buildeeUnitID or nil + * @param unitID integer + * @return number buildeeUnitID or nil */ int LuaSyncedRead::GetUnitIsBuilding(lua_State* L) { @@ -4611,9 +4620,9 @@ static int GetFactoryWorkerTask(lua_State* L, const CFactory *factory) * The possible commands returned are repair, reclaim, resurrect, capture, restore, * and build commands (negative buildee unitDefID). * - * @number unitID - * @treturn number cmdID of the relevant command - * @treturn number targetID if applicable (all except RESTORE) + * @param unitID integer + * @return number cmdID of the relevant command + * @return number targetID if applicable (all except RESTORE) */ int LuaSyncedRead::GetUnitWorkerTask(lua_State* L) { @@ -4634,9 +4643,9 @@ int LuaSyncedRead::GetUnitWorkerTask(lua_State* L) * * @function Spring.GetUnitEffectiveBuildRange * Useful for setting move goals manually. - * @number unitID - * @number buildeeDefID or nil - * @treturn number effectiveBuildRange counted to the center of prospective buildee; buildRange if buildee nil + * @param unitID integer + * @param buildeeDefID integer or nil + * @return number effectiveBuildRange counted to the center of prospective buildee; buildRange if buildee nil */ int LuaSyncedRead::GetUnitEffectiveBuildRange(lua_State* L) { @@ -4689,7 +4698,7 @@ int LuaSyncedRead::GetUnitEffectiveBuildRange(lua_State* L) /*** * * @function Spring.GetUnitCurrentBuildPower - * @number unitID + * @param unitID integer */ int LuaSyncedRead::GetUnitCurrentBuildPower(lua_State* L) { @@ -4725,11 +4734,11 @@ int LuaSyncedRead::GetUnitCurrentBuildPower(lua_State* L) * * Checks resources being carried internally by the unit. * - * @number unitID - * @treturn number storedMetal - * @treturn number maxStoredMetal - * @treturn number storedEnergy - * @treturn number maxStoredEnergy + * @param unitID integer + * @return number storedMetal + * @return number maxStoredMetal + * @return number storedEnergy + * @return number maxStoredEnergy */ int LuaSyncedRead::GetUnitHarvestStorage(lua_State* L) { @@ -4747,7 +4756,7 @@ int LuaSyncedRead::GetUnitHarvestStorage(lua_State* L) /*** * * @function Spring.GetUnitBuildParams - * @number unitID + * @param unitID integer */ int LuaSyncedRead::GetUnitBuildParams(lua_State* L) { @@ -4784,8 +4793,8 @@ int LuaSyncedRead::GetUnitBuildParams(lua_State* L) * Checks if a builder is in build stance, i.e. can create nanoframes. * Returns nil for non-builders. * - * @number unitID - * @treturn bool inBuildStance + * @param unitID integer + * @return boolean inBuildStance */ int LuaSyncedRead::GetUnitInBuildStance(lua_State* L) { @@ -4814,8 +4823,8 @@ int LuaSyncedRead::GetUnitInBuildStance(lua_State* L) * Only works on builders and factories, returns nil (NOT empty table) * for other units. * - * @number unitID - * @return pieceArray {pieceID, pieceID, ...} + * @param unitID integer + * @return integer[] pieceArray */ int LuaSyncedRead::GetUnitNanoPieces(lua_State* L) { @@ -4865,8 +4874,8 @@ int LuaSyncedRead::GetUnitNanoPieces(lua_State* L) * Returns the unit ID of the transport, if any. * Returns nil if the unit is not being transported. * - * @number unitID - * @treturn number|nil transportUnitID + * @param unitID integer + * @return number|nil transportUnitID */ int LuaSyncedRead::GetUnitTransporter(lua_State* L) { @@ -4882,15 +4891,13 @@ int LuaSyncedRead::GetUnitTransporter(lua_State* L) } -/*** Get units being transported +/*** + * Get units being transported * * @function Spring.GetUnitIsTransporting - * - * Returns an array of unitIDs being transported by this unit. - * Returns nil (NOT an empty array) for units that are not transports. - * - * @number unitID - * @return transporteeArray {unitID, unitID, ...} + * @param unitID integer + * @return integer[]? transporteeArray + * An array of unitIDs being transported by this unit, or `nil` if not a transport. */ int LuaSyncedRead::GetUnitIsTransporting(lua_State* L) { @@ -4916,10 +4923,10 @@ int LuaSyncedRead::GetUnitIsTransporting(lua_State* L) /*** * * @function Spring.GetUnitShieldState - * @number unitID - * @number[opt] weaponNum Optional if the unit has just one shield - * @treturn number isEnabled Warning, number not bool. 0 or 1 - * @treturn number currentPower + * @param unitID integer + * @param weaponNum number? Optional if the unit has just one shield + * @return number isEnabled Warning, number not boolean. 0 or 1 + * @return number currentPower */ int LuaSyncedRead::GetUnitShieldState(lua_State* L) { @@ -4948,7 +4955,7 @@ int LuaSyncedRead::GetUnitShieldState(lua_State* L) /*** * * @function Spring.GetUnitFlanking - * @number unitID + * @param unitID integer */ int LuaSyncedRead::GetUnitFlanking(lua_State* L) { @@ -5012,8 +5019,8 @@ int LuaSyncedRead::GetUnitFlanking(lua_State* L) * By default this is the highest among the unit's weapon ranges (hence name), * but can be changed dynamically. Also note that unarmed units ignore this. * - * @number unitID - * @treturn number maxRange + * @param unitID integer + * @return number maxRange */ int LuaSyncedRead::GetUnitMaxRange(lua_State* L) { @@ -5059,9 +5066,9 @@ int LuaSyncedRead::GetUnitMaxRange(lua_State* L) * The state "salvoError" is an exception and returns a table: {x, y, z}, * which represents the inaccuracy error of the ongoing burst. * - * @number unitID - * @number weaponNum - * @string stateName + * @param unitID integer + * @param weaponNum number + * @param stateName string * @return number stateValue */ int LuaSyncedRead::GetUnitWeaponState(lua_State* L) @@ -5242,7 +5249,7 @@ static inline int PushDamagesKey(lua_State* L, const DynDamageArray& damages, in /*** * * @function Spring.GetUnitWeaponDamages - * @number unitID + * @param unitID integer */ int LuaSyncedRead::GetUnitWeaponDamages(lua_State* L) { @@ -5281,7 +5288,7 @@ int LuaSyncedRead::GetUnitWeaponDamages(lua_State* L) /*** * * @function Spring.GetUnitWeaponVectors - * @number unitID + * @param unitID integer */ int LuaSyncedRead::GetUnitWeaponVectors(lua_State* L) { @@ -5321,7 +5328,7 @@ int LuaSyncedRead::GetUnitWeaponVectors(lua_State* L) /*** * * @function Spring.GetUnitWeaponTryTarget - * @number unitID + * @param unitID integer */ int LuaSyncedRead::GetUnitWeaponTryTarget(lua_State* L) { @@ -5366,7 +5373,7 @@ int LuaSyncedRead::GetUnitWeaponTryTarget(lua_State* L) /*** * * @function Spring.GetUnitWeaponTestTarget - * @number unitID + * @param unitID integer */ int LuaSyncedRead::GetUnitWeaponTestTarget(lua_State* L) { @@ -5404,7 +5411,7 @@ int LuaSyncedRead::GetUnitWeaponTestTarget(lua_State* L) /*** * * @function Spring.GetUnitWeaponTestRange - * @number unitID + * @param unitID integer */ int LuaSyncedRead::GetUnitWeaponTestRange(lua_State* L) { @@ -5442,7 +5449,7 @@ int LuaSyncedRead::GetUnitWeaponTestRange(lua_State* L) /*** * * @function Spring.GetUnitWeaponHaveFreeLineOfFire - * @number unitID + * @param unitID integer */ int LuaSyncedRead::GetUnitWeaponHaveFreeLineOfFire(lua_State* L) { @@ -5508,7 +5515,7 @@ int LuaSyncedRead::GetUnitWeaponHaveFreeLineOfFire(lua_State* L) /*** * * @function Spring.GetUnitWeaponCanFire - * @number unitID + * @param unitID integer */ int LuaSyncedRead::GetUnitWeaponCanFire(lua_State* L) { @@ -5530,15 +5537,64 @@ int LuaSyncedRead::GetUnitWeaponCanFire(lua_State* L) return 1; } -/*** Checks a weapon's target +/*** + * @alias TargetType + * | 0 # none + * | 1 # unit + * | 2 # position + * | 3 # projectile + */ + +/*** + * Checks a weapon's target * - * Note that this doesn't need to reflect the unit's Attack orders or such, and that weapons can aim individually unless slaved. + * Note that this doesn't need to reflect the unit's Attack orders or such, and + * that weapons can aim individually unless slaved. + * * @function Spring.GetUnitWeaponTarget - * @number unitID - * @number weaponNum - * @treturn number targetType (0: none, 1: unit, 2: position, 3: projectile) - * @treturn boolean isUserTarget - * @return target (depending on type, 0: nil, 1: unitID, 2: table {x, y, z}, 3: projectileID) + * @param unitID integer + * @param weaponNum integer + * @return 0 TargetType none + * @return boolean isUserTarget + */ +/*** + * Checks a weapon's target + * + * Note that this doesn't need to reflect the unit's Attack orders or such, and + * that weapons can aim individually unless slaved. + * + * @function Spring.GetUnitWeaponTarget + * @param unitID integer + * @param weaponNum integer + * @return 1 TargetType unit + * @return boolean isUserTarget + * @return integer targetUnitID + */ +/*** + * Checks a weapon's target + * + * Note that this doesn't need to reflect the unit's Attack orders or such, and + * that weapons can aim individually unless slaved. + * + * @function Spring.GetUnitWeaponTarget + * @param unitID integer + * @param weaponNum integer + * @return 2 TargetType position + * @return boolean isUserTarget + * @return float3 targetPosition + */ +/*** + * Checks a weapon's target + * + * Note that this doesn't need to reflect the unit's Attack orders or such, and + * that weapons can aim individually unless slaved. + * + * @function Spring.GetUnitWeaponTarget + * @param unitID integer + * @param weaponNum integer + * @return 3 TargetType projectileID + * @return boolean isUserTarget + * @return integer targetProjectileId */ int LuaSyncedRead::GetUnitWeaponTarget(lua_State* L) { @@ -5599,7 +5655,7 @@ int LuaSyncedRead::GetUnitFuel(lua_State* L) { lua_pushnumber(L, 0.0f); return 1 /*** * * @function Spring.GetUnitEstimatedPath - * @number unitID + * @param unitID integer */ int LuaSyncedRead::GetUnitEstimatedPath(lua_State* L) { @@ -5619,7 +5675,7 @@ int LuaSyncedRead::GetUnitEstimatedPath(lua_State* L) /*** * * @function Spring.GetUnitLastAttacker - * @number unitID + * @param unitID integer */ int LuaSyncedRead::GetUnitLastAttacker(lua_State* L) { @@ -5639,7 +5695,7 @@ int LuaSyncedRead::GetUnitLastAttacker(lua_State* L) /*** * * @function Spring.GetUnitLastAttackedPiece - * @number unitID + * @param unitID integer */ int LuaSyncedRead::GetUnitLastAttackedPiece(lua_State* L) { @@ -5649,7 +5705,7 @@ int LuaSyncedRead::GetUnitLastAttackedPiece(lua_State* L) /*** * * @function Spring.GetUnitCollisionVolumeData - * @number unitID + * @param unitID integer */ int LuaSyncedRead::GetUnitCollisionVolumeData(lua_State* L) { @@ -5670,11 +5726,11 @@ int LuaSyncedRead::GetUnitPieceCollisionVolumeData(lua_State* L) /*** * * @function Spring.GetUnitSeparation - * @number unitID1 - * @number unitID2 - * @bool[opt=false] direction to subtract from, default unitID1 - unitID2 - * @bool[opt=false] subtractRadii whether units radii should be subtracted from the total - * @treturn nil|number + * @param unitID1 number + * @param unitID2 number + * @param direction boolean? (Default: false) to subtract from, default unitID1 - unitID2 + * @param subtractRadii boolean? (Default: false) whether units radii should be subtracted from the total + * @return number? */ int LuaSyncedRead::GetUnitSeparation(lua_State* L) { @@ -5712,7 +5768,7 @@ int LuaSyncedRead::GetUnitSeparation(lua_State* L) /*** * * @function Spring.GetUnitFeatureSeparation - * @number unitID + * @param unitID integer */ int LuaSyncedRead::GetUnitFeatureSeparation(lua_State* L) { @@ -5747,7 +5803,7 @@ int LuaSyncedRead::GetUnitFeatureSeparation(lua_State* L) /*** * * @function Spring.GetUnitDefDimensions - * @number unitDefID + * @param unitDefID integer */ int LuaSyncedRead::GetUnitDefDimensions(lua_State* L) { @@ -5792,14 +5848,14 @@ int LuaSyncedRead::GetCEGID(lua_State* L) /*** * * @function Spring.GetUnitBlocking - * @number unitID - * @treturn nil|bool isBlocking - * @treturn bool isSolidObjectCollidable - * @treturn bool isProjectileCollidable - * @treturn bool isRaySegmentCollidable - * @treturn bool crushable - * @treturn bool blockEnemyPushing - * @treturn bool blockHeightChanges + * @param unitID integer + * @return nil|boolean isBlocking + * @return boolean isSolidObjectCollidable + * @return boolean isProjectileCollidable + * @return boolean isRaySegmentCollidable + * @return boolean crushable + * @return boolean blockEnemyPushing + * @return boolean blockHeightChanges */ int LuaSyncedRead::GetUnitBlocking(lua_State* L) { @@ -5810,7 +5866,7 @@ int LuaSyncedRead::GetUnitBlocking(lua_State* L) /*** * * @function Spring.GetUnitMoveTypeData - * @number unitID + * @param unitID integer */ int LuaSyncedRead::GetUnitMoveTypeData(lua_State* L) { @@ -6074,40 +6130,28 @@ int LuaSyncedRead::GetUnitCurrentCommand(lua_State* L) return 3 + numParams; } - -/*** Parameters for command options - * - * @table cmdOpts - * - * @number coded - * @bool alt - * @bool ctrl - * @bool shift - * @bool right - * @bool meta - * @bool internal - */ - -/*** Command +/*** + * Get the commands for a unit. + * + * @function Spring.GetUnitCommands * - * @table cmd + * Same as `Spring.GetCommandQueue` * - * @number id - * @tparam {number,...} params - * @tparam cmdOpts options - * @number tag + * @param unitID integer + * @param count integer Number of commands to return, `-1` returns all commands, `0` returns command count. + * @return Command[] commands */ - - -/*** Get the number or list of commands for a unit - * +/** + * Get the count of commands for a unit. + * * @function Spring.GetUnitCommands * - * Same as Spring.GetCommandQueue + * Same as `Spring.GetCommandQueue` * - * @number unitID - * @number count when 0 returns the number of commands in the units queue, when -1 returns all commands, number of commands to return otherwise - * @treturn number|{cmd,...} commands + * @param unitID integer + * @param count 0 Returns the number of commands in the units queue. + * @return integer The number of commands in the unit queue. + * */ int LuaSyncedRead::GetUnitCommands(lua_State* L) { @@ -6144,9 +6188,9 @@ int LuaSyncedRead::GetUnitCommands(lua_State* L) * * @function Spring.GetFactoryCommands * - * @number unitID - * @number count when 0 returns the number of commands in the units queue, when -1 returns all commands, number of commands to return otherwise - * @treturn number|{cmd,...} commands + * @param unitID integer + * @param count number when 0 returns the number of commands in the units queue, when -1 returns all commands, number of commands to return otherwise + * @return number|Command[] commands */ int LuaSyncedRead::GetFactoryCommands(lua_State* L) { @@ -6200,7 +6244,7 @@ int LuaSyncedRead::GetUnitCommandCount(lua_State* L) /*** * * @function Spring.GetFactoryBuggerOff - * @number unitID + * @param unitID integer */ int LuaSyncedRead::GetFactoryBuggerOff(lua_State* L) { @@ -6280,11 +6324,11 @@ static void PackFactoryCounts(lua_State* L, /*** Gets the build queue of a factory * * @function Spring.GetFactoryCounts - * @number unitID - * @number[opt=-1] count then number of commands to retrieve, when -1 all - * @bool[opt=false] addCmds if commands other than buildunit are retrieved + * @param unitID integer + * @param count integer? (Default: -1) Number of commands to retrieve, `-1` for all. + * @param addCmds boolean? (Default: false) Retrieve commands other than buildunit * - * @treturn nil|{{[number]=number,...}} counts indexed by unitDefID or -cmdID + * @return table? counts Build queue count by `unitDefID` or `-cmdID`, or `nil` if unit is not found. */ int LuaSyncedRead::GetFactoryCounts(lua_State* L) { @@ -6313,16 +6357,30 @@ int LuaSyncedRead::GetFactoryCounts(lua_State* L) } -/*** Get the number or list of commands for a unit +/*** + * Get the commands for a unit. + * + * @function Spring.GetCommandQueue + * + * Same as `Spring.GetUnitCommands` * + * @param unitID integer + * @param count integer Number of commands to return, `-1` returns all commands, `0` returns command count. + * @return Command[] commands + */ +/** + * Get the count of commands for a unit. + * * @function Spring.GetCommandQueue * - * Same as Spring.GetUnitCommands + * Same as `Spring.GetUnitCommands` * - * @number unitID - * @number count when 0 returns the number of commands in the units queue, when -1 returns all commands, number of commands to return otherwise - * @treturn number|{cmd,...} commands + * @param unitID integer + * @param count 0 Returns the number of commands in the units queue. + * @return integer The number of commands in the unit queue. + * */ + int LuaSyncedRead::GetCommandQueue(lua_State* L) { return (GetUnitCommands(L)); @@ -6404,8 +6462,8 @@ static int PackBuildQueue(lua_State* L, bool canBuild, const char* caller) /*** Returns the build queue * * @function Spring.GetFullBuildQueue - * @number unitID - * @treturn nil|{[number]=number,...} buildqueue indexed by unitDefID with count values + * @param unitID integer + * @return nil|table buildqueue indexed by unitDefID with count values */ int LuaSyncedRead::GetFullBuildQueue(lua_State* L) { @@ -6416,8 +6474,8 @@ int LuaSyncedRead::GetFullBuildQueue(lua_State* L) /*** Returns the build queue cleaned of things the unit can't build itself * * @function Spring.GetRealBuildQueue - * @number unitID - * @treturn nil|{[number]=number,...} buildqueue indexed by unitDefID with count values + * @param unitID integer + * @return nil|table buildqueue indexed by unitDefID with count values */ int LuaSyncedRead::GetRealBuildQueue(lua_State* L) { @@ -6431,7 +6489,7 @@ int LuaSyncedRead::GetRealBuildQueue(lua_State* L) /*** * * @function Spring.GetUnitCmdDescs - * @number unitID + * @param unitID integer */ int LuaSyncedRead::GetUnitCmdDescs(lua_State* L) { @@ -6470,7 +6528,7 @@ int LuaSyncedRead::GetUnitCmdDescs(lua_State* L) /*** * * @function Spring.FindUnitCmdDesc - * @number unitID + * @param unitID integer */ int LuaSyncedRead::FindUnitCmdDesc(lua_State* L) { @@ -6497,8 +6555,8 @@ int LuaSyncedRead::FindUnitCmdDesc(lua_State* L) /*** * * @function Spring.ValidFeatureID - * @number featureID - * @treturn bool + * @param featureID integer + * @return boolean */ int LuaSyncedRead::ValidFeatureID(lua_State* L) { @@ -6538,8 +6596,8 @@ int LuaSyncedRead::GetAllFeatures(lua_State* L) /*** * * @function Spring.GetFeatureDefID - * @number featureID - * @treturn nil|number + * @param featureID integer + * @return number? */ int LuaSyncedRead::GetFeatureDefID(lua_State* L) { @@ -6555,8 +6613,8 @@ int LuaSyncedRead::GetFeatureDefID(lua_State* L) /*** * * @function Spring.GetFeatureTeam - * @number featureID - * @treturn nil|number + * @param featureID integer + * @return number? */ int LuaSyncedRead::GetFeatureTeam(lua_State* L) { @@ -6576,8 +6634,8 @@ int LuaSyncedRead::GetFeatureTeam(lua_State* L) /*** * * @function Spring.GetFeatureAllyTeam - * @number featureID - * @treturn nil|number + * @param featureID integer + * @return number? */ int LuaSyncedRead::GetFeatureAllyTeam(lua_State* L) { @@ -6593,10 +6651,10 @@ int LuaSyncedRead::GetFeatureAllyTeam(lua_State* L) /*** * * @function Spring.GetFeatureHealth - * @number featureID - * @treturn nil|number health - * @treturn number defHealth - * @treturn number resurrectProgress + * @param featureID integer + * @return number? health + * @return number defHealth + * @return number resurrectProgress */ int LuaSyncedRead::GetFeatureHealth(lua_State* L) { @@ -6614,8 +6672,8 @@ int LuaSyncedRead::GetFeatureHealth(lua_State* L) /*** * * @function Spring.GetFeatureHeight - * @number featureID - * @treturn nil|number + * @param featureID integer + * @return number? */ int LuaSyncedRead::GetFeatureHeight(lua_State* L) { @@ -6631,8 +6689,8 @@ int LuaSyncedRead::GetFeatureHeight(lua_State* L) /*** * * @function Spring.GetFeatureRadius - * @number featureID - * @treturn nil|number + * @param featureID integer + * @return number? */ int LuaSyncedRead::GetFeatureRadius(lua_State* L) { @@ -6647,8 +6705,8 @@ int LuaSyncedRead::GetFeatureRadius(lua_State* L) /*** * * @function Spring.GetFeatureMass - * @number featureID - * @treturn nil|number + * @param featureID integer + * @return number? */ int LuaSyncedRead::GetFeatureMass(lua_State* L) { @@ -6658,7 +6716,7 @@ int LuaSyncedRead::GetFeatureMass(lua_State* L) /*** * * @function Spring.GetFeaturePosition - * @number featureID + * @param featureID integer */ int LuaSyncedRead::GetFeaturePosition(lua_State* L) { @@ -6669,10 +6727,10 @@ int LuaSyncedRead::GetFeaturePosition(lua_State* L) /*** * * @function Spring.GetFeatureSeparation - * @number featureID1 - * @number featureID2 - * @bool[opt=false] direction to subtract from, default featureID1 - featureID2 - * @treturn nil|number + * @param featureID1 number + * @param featureID2 number + * @param direction boolean? (Default: false) to subtract from, default featureID1 - featureID2 + * @return number? */ int LuaSyncedRead::GetFeatureSeparation(lua_State* L) { @@ -6701,10 +6759,10 @@ int LuaSyncedRead::GetFeatureSeparation(lua_State* L) /*** * * @function Spring.GetFeatureRotation - * @number featureID - * @treturn nil|number pitch, rotation in X axis - * @treturn number yaw, rotation in Y axis - * @treturn number roll, rotation in Z axis + * @param featureID integer + * @return number? pitch Rotation in X axis + * @return number? yaw Rotation in Y axis + * @return number? roll Rotation in Z axis */ int LuaSyncedRead::GetFeatureRotation(lua_State* L) { @@ -6718,10 +6776,10 @@ int LuaSyncedRead::GetFeatureRotation(lua_State* L) /*** * * @function Spring.GetFeatureDirection - * @number featureID - * @treturn nil|dirX - * @treturn dirY - * @treturn dirZ + * @param featureID integer + * @return number? dirX + * @return number? dirY + * @return number? dirZ */ int LuaSyncedRead::GetFeatureDirection(lua_State* L) { @@ -6742,7 +6800,7 @@ int LuaSyncedRead::GetFeatureDirection(lua_State* L) /*** * * @function Spring.GetFeatureVelocity - * @number featureID + * @param featureID integer */ int LuaSyncedRead::GetFeatureVelocity(lua_State* L) { @@ -6753,7 +6811,7 @@ int LuaSyncedRead::GetFeatureVelocity(lua_State* L) /*** * * @function Spring.GetFeatureHeading - * @number featureID + * @param featureID integer */ int LuaSyncedRead::GetFeatureHeading(lua_State* L) { @@ -6769,13 +6827,13 @@ int LuaSyncedRead::GetFeatureHeading(lua_State* L) /*** * * @function Spring.GetFeatureResources - * @number featureID - * @treturn nil|number metal - * @treturn number defMetal - * @treturn number energy - * @treturn number defEnergy - * @treturn number reclaimLeft - * @treturn number reclaimTime + * @param featureID integer + * @return number? metal + * @return number defMetal + * @return number energy + * @return number defEnergy + * @return number reclaimLeft + * @return number reclaimTime */ int LuaSyncedRead::GetFeatureResources(lua_State* L) { @@ -6796,14 +6854,14 @@ int LuaSyncedRead::GetFeatureResources(lua_State* L) /*** * * @function Spring.GetFeatureBlocking - * @number featureID - * @treturn nil|bool isBlocking - * @treturn bool isSolidObjectCollidable - * @treturn bool isProjectileCollidable - * @treturn bool isRaySegmentCollidable - * @treturn bool crushable - * @treturn bool blockEnemyPushing - * @treturn bool blockHeightChanges + * @param featureID integer + * @return nil|boolean isBlocking + * @return boolean isSolidObjectCollidable + * @return boolean isProjectileCollidable + * @return boolean isRaySegmentCollidable + * @return boolean crushable + * @return boolean blockEnemyPushing + * @return boolean blockHeightChanges */ int LuaSyncedRead::GetFeatureBlocking(lua_State* L) { @@ -6814,8 +6872,8 @@ int LuaSyncedRead::GetFeatureBlocking(lua_State* L) /*** * * @function Spring.GetFeatureNoSelect - * @number featureID - * @treturn nil|bool + * @param featureID integer + * @return nil|boolean */ int LuaSyncedRead::GetFeatureNoSelect(lua_State* L) { @@ -6832,7 +6890,7 @@ int LuaSyncedRead::GetFeatureNoSelect(lua_State* L) /*** * * @function Spring.GetFeatureResurrect - * @number featureID + * @param featureID integer */ int LuaSyncedRead::GetFeatureResurrect(lua_State* L) { @@ -6855,7 +6913,7 @@ int LuaSyncedRead::GetFeatureResurrect(lua_State* L) /*** * * @function Spring.GetFeatureLastAttackedPiece - * @number featureID + * @param featureID integer */ int LuaSyncedRead::GetFeatureLastAttackedPiece(lua_State* L) { @@ -6865,7 +6923,7 @@ int LuaSyncedRead::GetFeatureLastAttackedPiece(lua_State* L) /*** * * @function Spring.GetFeatureCollisionVolumeData - * @number featureID + * @param featureID integer */ int LuaSyncedRead::GetFeatureCollisionVolumeData(lua_State* L) { @@ -6880,7 +6938,7 @@ int LuaSyncedRead::GetFeatureCollisionVolumeData(lua_State* L) /*** * * @function Spring.GetFeaturePieceCollisionVolumeData - * @number featureID + * @param featureID integer */ int LuaSyncedRead::GetFeaturePieceCollisionVolumeData(lua_State* L) { @@ -6898,10 +6956,10 @@ int LuaSyncedRead::GetFeaturePieceCollisionVolumeData(lua_State* L) /*** * * @function Spring.GetProjectilePosition - * @number projectileID - * @treturn nil|number posX - * @treturn number posY - * @treturn number posZ + * @param projectileID integer + * @return number? posX + * @return number posY + * @return number posZ */ int LuaSyncedRead::GetProjectilePosition(lua_State* L) { @@ -6919,10 +6977,10 @@ int LuaSyncedRead::GetProjectilePosition(lua_State* L) /*** * * @function Spring.GetProjectileDirection - * @number projectileID - * @treturn nil|number dirX - * @treturn number dirY - * @treturn number dirZ + * @param projectileID integer + * @return number? dirX + * @return number dirY + * @return number dirZ */ int LuaSyncedRead::GetProjectileDirection(lua_State* L) { @@ -6940,11 +6998,11 @@ int LuaSyncedRead::GetProjectileDirection(lua_State* L) /*** * * @function Spring.GetProjectileVelocity - * @number projectileID - * @treturn nil|number velX - * @treturn number velY - * @treturn number velZ - * @treturn number velW + * @param projectileID integer + * @return number? velX + * @return number velY + * @return number velZ + * @return number velW */ int LuaSyncedRead::GetProjectileVelocity(lua_State* L) { @@ -6955,8 +7013,8 @@ int LuaSyncedRead::GetProjectileVelocity(lua_State* L) /*** * * @function Spring.GetProjectileGravity - * @number projectileID - * @treturn nil|number + * @param projectileID integer + * @return number? */ int LuaSyncedRead::GetProjectileGravity(lua_State* L) { @@ -6974,13 +7032,13 @@ int LuaSyncedRead::GetProjectileGravity(lua_State* L) /*** * * @function Spring.GetPieceProjectileParams - * @number projectileID - * @treturn nil|number explosionFlags encoded bitwise with SHATTER = 1, EXPLODE = 2, EXPLODE_ON_HIT = 2, FALL = 4, SMOKE = 8, FIRE = 16, NONE = 32, NO_CEG_TRAIL = 64, NO_HEATCLOUD = 128 - * @treturn number spinAngle - * @treturn number spinSpeed - * @treturn number spinVectorX - * @treturn number spinVectorY - * @treturn number spinVectorZ + * @param projectileID integer + * @return number? explosionFlags encoded bitwise with SHATTER = 1, EXPLODE = 2, EXPLODE_ON_HIT = 2, FALL = 4, SMOKE = 8, FIRE = 16, NONE = 32, NO_CEG_TRAIL = 64, NO_HEATCLOUD = 128 + * @return number spinAngle + * @return number spinSpeed + * @return number spinVectorX + * @return number spinVectorY + * @return number spinVectorZ */ int LuaSyncedRead::GetPieceProjectileParams(lua_State* L) { @@ -7004,13 +7062,13 @@ int LuaSyncedRead::GetPieceProjectileParams(lua_State* L) /*** * * @function Spring.GetProjectileTarget - * @number projectileID - * @treturn nil|number targetTypeInt where + * @param projectileID integer + * @return number? targetTypeInt where * string.byte('g') := GROUND * string.byte('u') := UNIT * string.byte('f') := FEATURE * string.byte('p') := PROJECTILE - * @treturn number|xyz target targetID or targetPos when targetTypeInt == string.byte('g') + * @return number|float3 target targetID or targetPos when targetTypeInt == string.byte('g') */ int LuaSyncedRead::GetProjectileTarget(lua_State* L) { @@ -7056,8 +7114,8 @@ int LuaSyncedRead::GetProjectileTarget(lua_State* L) /*** * * @function Spring.GetProjectileIsIntercepted - * @number projectileID - * @treturn nil|bool + * @param projectileID integer + * @return nil|boolean */ int LuaSyncedRead::GetProjectileIsIntercepted(lua_State* L) { @@ -7076,8 +7134,8 @@ int LuaSyncedRead::GetProjectileIsIntercepted(lua_State* L) /*** * * @function Spring.GetProjectileTimeToLive - * @number projectileID - * @treturn nil|number + * @param projectileID integer + * @return number? */ int LuaSyncedRead::GetProjectileTimeToLive(lua_State* L) { @@ -7096,8 +7154,8 @@ int LuaSyncedRead::GetProjectileTimeToLive(lua_State* L) /*** * * @function Spring.GetProjectileOwnerID - * @number projectileID - * @treturn nil|number + * @param projectileID integer + * @return number? */ int LuaSyncedRead::GetProjectileOwnerID(lua_State* L) { @@ -7118,8 +7176,8 @@ int LuaSyncedRead::GetProjectileOwnerID(lua_State* L) /*** * * @function Spring.GetProjectileTeamID - * @number projectileID - * @treturn nil|number + * @param projectileID integer + * @return number? */ int LuaSyncedRead::GetProjectileTeamID(lua_State* L) { @@ -7139,8 +7197,8 @@ int LuaSyncedRead::GetProjectileTeamID(lua_State* L) /*** * * @function Spring.GetProjectileAllyTeamID - * @number projectileID - * @treturn nil|number + * @param projectileID integer + * @return number? */ int LuaSyncedRead::GetProjectileAllyTeamID(lua_State* L) { @@ -7160,9 +7218,9 @@ int LuaSyncedRead::GetProjectileAllyTeamID(lua_State* L) /*** * * @function Spring.GetProjectileType - * @number projectileID - * @treturn nil|bool weapon - * @treturn bool piece + * @param projectileID integer + * @return nil|boolean weapon + * @return boolean piece */ int LuaSyncedRead::GetProjectileType(lua_State* L) { @@ -7183,8 +7241,8 @@ int LuaSyncedRead::GetProjectileType(lua_State* L) * * Using this to get a weaponDefID is HIGHLY preferred to indexing WeaponDefNames via GetProjectileName * - * @number projectileID - * @treturn nil|number + * @param projectileID integer + * @return number? */ int LuaSyncedRead::GetProjectileDefID(lua_State* L) { @@ -7209,8 +7267,8 @@ int LuaSyncedRead::GetProjectileDefID(lua_State* L) /*** * * @function Spring.GetProjectileDamages - * @number projectileID - * @string tag one of: + * @param projectileID integer + * @param tag string one of: * "paralyzeDamageTime" * "impulseFactor" * "impulseBoost" @@ -7226,7 +7284,7 @@ int LuaSyncedRead::GetProjectileDefID(lua_State* L) * "explosionSpeed" * - or - * an armor type index to get the damage against it. - * @treturn nil|number + * @return number? */ int LuaSyncedRead::GetProjectileDamages(lua_State* L) { @@ -7257,10 +7315,10 @@ int LuaSyncedRead::GetProjectileDamages(lua_State* L) /*** * * @function Spring.IsPosInMap - * @number x - * @number z - * @treturn boolean inPlayArea whether the position is in the active play area - * @treturn boolean inMap whether the position is in the full map area (currently this is the same as above) + * @param x number + * @param z number + * @return boolean inPlayArea whether the position is in the active play area + * @return boolean inMap whether the position is in the full map area (currently this is the same as above) */ int LuaSyncedRead::IsPosInMap(lua_State* L) { @@ -7300,9 +7358,9 @@ int LuaSyncedRead::IsPosInMap(lua_State* L) * On sea, this returns the negative depth of the seafloor * * @function Spring.GetGroundHeight - * @number x - * @number z - * @treturn number + * @param x number + * @param z number + * @return number */ int LuaSyncedRead::GetGroundHeight(lua_State* L) { @@ -7319,7 +7377,7 @@ int LuaSyncedRead::GetGroundHeight(lua_State* L) * * @see Spring.GetWaterLevel * @function Spring.GetWaterPlaneLevel - * @treturn number waterPlaneLevel + * @return number waterPlaneLevel */ int LuaSyncedRead::GetWaterPlaneLevel(lua_State* L) { @@ -7333,9 +7391,9 @@ int LuaSyncedRead::GetWaterPlaneLevel(lua_State* L) * However water may become more dynamic at some point so by using this you are future-proof. * * @function Spring.GetWaterLevel - * @number x - * @number z - * @treturn number waterLevel + * @param x number + * @param z number + * @return number waterLevel */ int LuaSyncedRead::GetWaterLevel(lua_State* L) { @@ -7351,9 +7409,9 @@ int LuaSyncedRead::GetWaterLevel(lua_State* L) * Returns the original height before the ground got deformed * * @function Spring.GetGroundOrigHeight - * @number x - * @number z - * @treturn number + * @param x number + * @param z number + * @return number */ int LuaSyncedRead::GetGroundOrigHeight(lua_State* L) { @@ -7367,13 +7425,13 @@ int LuaSyncedRead::GetGroundOrigHeight(lua_State* L) /*** * * @function Spring.GetGroundNormal - * @number x - * @number z - * @bool[opt=false] smoothed raw or smoothed center normal - * @treturn number normalX - * @treturn number normalY - * @treturn number normalZ - * @treturn number slope + * @param x number + * @param z number + * @param smoothed boolean? (Default: false) raw or smoothed center normal + * @return number normalX + * @return number normalY + * @return number normalZ + * @return number slope */ int LuaSyncedRead::GetGroundNormal(lua_State* L) { @@ -7397,19 +7455,19 @@ int LuaSyncedRead::GetGroundNormal(lua_State* L) /*** * * @function Spring.GetGroundInfo - * @number x - * @number z - * @treturn number ix - * @treturn number iz - * @treturn number terrainTypeIndex - * @treturn string name - * @treturn number metalExtraction - * @treturn number hardness - * @treturn number tankSpeed - * @treturn number kbotSpeed - * @treturn number hoverSpeed - * @treturn number shipSpeed - * @treturn bool receiveTracks + * @param x number + * @param z number + * @return number ix + * @return number iz + * @return number terrainTypeIndex + * @return string name + * @return number metalExtraction + * @return number hardness + * @return number tankSpeed + * @return number kbotSpeed + * @return number hoverSpeed + * @return number shipSpeed + * @return boolean receiveTracks */ int LuaSyncedRead::GetGroundInfo(lua_State* L) { @@ -7513,10 +7571,10 @@ int LuaSyncedRead::GetGroundBlocked(lua_State* L) /*** * * @function Spring.GetGroundExtremes - * @treturn number initMinHeight - * @treturn number initMaxHeight - * @treturn number currMinHeight - * @treturn number currMaxHeight + * @return number initMinHeight + * @return number initMaxHeight + * @return number currMinHeight + * @return number currMaxHeight */ int LuaSyncedRead::GetGroundExtremes(lua_State* L) { @@ -7531,15 +7589,15 @@ int LuaSyncedRead::GetGroundExtremes(lua_State* L) /*** * * @function Spring.GetTerrainTypeData - * @number terrainTypeInfo - * @treturn number index - * @treturn string name - * @treturn number hardness - * @treturn number tankSpeed - * @treturn number kbotSpeed - * @treturn number hoverSpeed - * @treturn number shipSpeed - * @treturn bool receiveTracks + * @param terrainTypeInfo number + * @return number index + * @return string name + * @return number hardness + * @return number tankSpeed + * @return number kbotSpeed + * @return number hoverSpeed + * @return number shipSpeed + * @return boolean receiveTracks */ int LuaSyncedRead::GetTerrainTypeData(lua_State* L) { @@ -7555,9 +7613,9 @@ int LuaSyncedRead::GetTerrainTypeData(lua_State* L) /*** * * @function Spring.GetGrass - * @number x - * @number z - * @treturn number + * @param x number + * @param z number + * @return number */ int LuaSyncedRead::GetGrass(lua_State* L) { @@ -7571,9 +7629,9 @@ int LuaSyncedRead::GetGrass(lua_State* L) /*** * * @function Spring.GetSmoothMeshHeight - * @number x - * @number z - * @treturn number height + * @param x number + * @param z number + * @return number height */ int LuaSyncedRead::GetSmoothMeshHeight(lua_State* L) { @@ -7595,17 +7653,13 @@ int LuaSyncedRead::GetSmoothMeshHeight(lua_State* L) /*** * * @function Spring.TestMoveOrder - * @number unitDefID - * @number pos.x - * @number pos.y - * @number pos.z - * @number[opt=0] dir.x - * @number[opt=0] dir.y - * @number[opt=0] dir.z - * @bool[opt=true] testTerrain - * @bool[opt=true] testObjects - * @bool[opt=false] centerOnly - * @treturn bool + * @param unitDefID integer + * @param pos float3 + * @param dir float3? (Default: `{ x: 0, y: 0, z: 0 }`) + * @param testTerrain boolean? (Default: true) + * @param testObjects boolean? (Default: true) + * @param centerOnly boolean? (Default: false) + * @return boolean */ int LuaSyncedRead::TestMoveOrder(lua_State* L) { @@ -7650,15 +7704,22 @@ int LuaSyncedRead::TestMoveOrder(lua_State* L) } /*** - * + * @alias BuildOrderBlockedStatus + * | 0 # blocked + * | 1 # mobile unit on the way + * | 2 # reclaimable + * | 3 # open + */ + +/*** * @function Spring.TestBuildOrder - * @number unitDefID - * @number x - * @number y - * @number z - * @tparam number|string facing one of: 0-s,1-e,2-n,3-w - * @treturn number blocking one of: 0 = blocked, 1 = mobile unit on the way, 2 = reclaimable, 3 = open - * @treturn nil|featureID when there's a reclaimable feature on the way + * @param unitDefID integer + * @param x number + * @param y number + * @param z number + * @param facing 0|"s"|1|"e"|2|"n"|3|"w" + * @return BuildOrderBlockedStatus blocking + * @return integer? featureID A reclaimable feature in the way. */ int LuaSyncedRead::TestBuildOrder(lua_State* L) { @@ -7703,14 +7764,14 @@ int LuaSyncedRead::TestBuildOrder(lua_State* L) /*** Snaps a position to the building grid * * @function Spring.Pos2BuildPos - * @number unitDefID - * @number posX - * @number posY - * @number posZ - * @number[opt=0] buildFacing one of SOUTH = 0, EAST = 1, NORTH = 2, WEST = 3 - * @treturn number buildPosX - * @treturn number buildPosY - * @treturn number buildPosZ + * @param unitDefID integer + * @param posX number + * @param posY number + * @param posZ number + * @param buildFacing number? (Default: 0) one of SOUTH = 0, EAST = 1, NORTH = 2, WEST = 3 + * @return number buildPosX + * @return number buildPosY + * @return number buildPosZ */ int LuaSyncedRead::Pos2BuildPos(lua_State* L) { @@ -7732,17 +7793,17 @@ int LuaSyncedRead::Pos2BuildPos(lua_State* L) /*** * * @function Spring.ClosestBuildPos - * @number teamID - * @number unitDefID - * @number posX - * @number posY - * @number posZ - * @number searchRadius - * @number minDistance - * @number buildFacing one of SOUTH = 0, EAST = 1, NORTH = 2, WEST = 3 - * @treturn number buildPosX - * @treturn number buildPosY - * @treturn number buildPosZ + * @param teamID integer + * @param unitDefID integer + * @param posX number + * @param posY number + * @param posZ number + * @param searchRadius number + * @param minDistance number + * @param buildFacing number one of SOUTH = 0, EAST = 1, NORTH = 2, WEST = 3 + * @return number buildPosX + * @return number buildPosY + * @return number buildPosZ */ int LuaSyncedRead::ClosestBuildPos(lua_State* L) { @@ -7800,14 +7861,14 @@ static int GetEffectiveLosAllyTeam(lua_State* L, int arg) /*** * * @function Spring.GetPositionLosState - * @number posX - * @number posY - * @number posZ - * @number[opt] allyTeamID - * @treturn bool inLosOrRadar - * @treturn inLos - * @treturn inRadar - * @treturn inJammer + * @param posX number + * @param posY number + * @param posZ number + * @param allyTeamID integer? + * @return boolean inLosOrRadar + * @return boolean inLos + * @return boolean inRadar + * @return boolean inJammer */ int LuaSyncedRead::GetPositionLosState(lua_State* L) { @@ -7840,11 +7901,11 @@ int LuaSyncedRead::GetPositionLosState(lua_State* L) /*** * * @function Spring.IsPosInLos - * @number posX - * @number posY - * @number posZ - * @number[opt] allyTeamID - * @treturn bool + * @param posX number + * @param posY number + * @param posZ number + * @param allyTeamID integer? + * @return boolean */ int LuaSyncedRead::IsPosInLos(lua_State* L) { @@ -7866,11 +7927,11 @@ int LuaSyncedRead::IsPosInLos(lua_State* L) /*** * * @function Spring.IsPosInRadar - * @number posX - * @number posY - * @number posZ - * @number[opt] allyTeamID - * @treturn bool + * @param posX number + * @param posY number + * @param posZ number + * @param allyTeamID integer? + * @return boolean */ int LuaSyncedRead::IsPosInRadar(lua_State* L) { @@ -7892,11 +7953,11 @@ int LuaSyncedRead::IsPosInRadar(lua_State* L) /*** * * @function Spring.IsPosInAirLos - * @number posX - * @number posY - * @number posZ - * @number[opt] allyTeamID - * @treturn bool + * @param posX number + * @param posY number + * @param posZ number + * @param allyTeamID integer? + * @return boolean */ int LuaSyncedRead::IsPosInAirLos(lua_State* L) { @@ -7916,20 +7977,26 @@ int LuaSyncedRead::IsPosInAirLos(lua_State* L) /*** - * * @function Spring.GetUnitLosState - * @number unitID - * @number[opt] allyTeamID - * @bool[opt=false] raw - * @treturn nil|number|{los=bool,radar=bool,typed=bool} los - * - * Raw is only available in gadgets and when raw parameter is true. - * - * RAW returns an bitmask integer, where the bits are: - * 1: LOS_INLOS, the unit is currently in the los of the allyteam, - * 2: LOS_INRADAR the unit is currently in radar from the allyteam, - * 4: LOS_PREVLOS the unit has previously been in los from the allyteam, - * 8: LOS_CONTRADAR the unit has continuously been in radar since it was last inlos by the allyteam + * @param unitID integer + * @param allyTeamID integer? + * @param raw true Return a bitmask. + * @return integer? bitmask + * A bitmask integer, or `nil` if `unitID` is invalid. + * + * Bitmask bits: + * - `1`: `LOS_INLOS` the unit is currently in the los of the allyteam, + * - `2`: `LOS_INRADAR` the unit is currently in radar from the allyteam, + * - `4`: `LOS_PREVLOS` the unit has previously been in los from the allyteam, + * - `8`: `LOS_CONTRADAR` the unit has continuously been in radar since it was last inlos by the allyteam + */ +/*** + * @function Spring.GetUnitLosState + * @param unitID integer + * @param allyTeamID integer? + * @param raw false? Return a bitmask. + * @return { los: boolean, radar: boolean, typed: boolean }? los + * A table of LOS state, or `nil` if `unitID` is invalid. */ int LuaSyncedRead::GetUnitLosState(lua_State* L) { @@ -7976,9 +8043,9 @@ int LuaSyncedRead::GetUnitLosState(lua_State* L) /*** * * @function Spring.IsUnitInLos - * @number unitID - * @number allyTeamID - * @treturn bool inLos + * @param unitID integer + * @param allyTeamID integer + * @return boolean inLos */ int LuaSyncedRead::IsUnitInLos(lua_State* L) { @@ -8000,9 +8067,9 @@ int LuaSyncedRead::IsUnitInLos(lua_State* L) /*** * * @function Spring.IsUnitInAirLos - * @number unitID - * @number allyTeamID - * @treturn bool inAirLos + * @param unitID integer + * @param allyTeamID integer + * @return boolean inAirLos */ int LuaSyncedRead::IsUnitInAirLos(lua_State* L) { @@ -8024,9 +8091,9 @@ int LuaSyncedRead::IsUnitInAirLos(lua_State* L) /*** * * @function Spring.IsUnitInRadar - * @number unitID - * @number allyTeamID - * @treturn bool inRadar + * @param unitID integer + * @param allyTeamID integer + * @return boolean inRadar */ int LuaSyncedRead::IsUnitInRadar(lua_State* L) { @@ -8048,9 +8115,9 @@ int LuaSyncedRead::IsUnitInRadar(lua_State* L) /*** * * @function Spring.IsUnitInJammer - * @number unitID - * @number allyTeamID - * @treturn bool inJammer + * @param unitID integer + * @param allyTeamID integer + * @return boolean inJammer */ int LuaSyncedRead::IsUnitInJammer(lua_State* L) { @@ -8193,17 +8260,15 @@ static int GetSolidObjectPieceList(lua_State* L, const CSolidObject* o) } -/*** Piece spec - * - * @table pieceSpec - * - * @string name - * @string parent - * @tparam {[string],...} children names - * @bool empty - * @tparam {number,number,number} min (x,y,z) - * @tparam {number,number,number} max (x,y,z) - * @tparam {number,number,number} offset (x,y,z) +/*** + * @class PieceInfo + * @field name string + * @field parent string + * @field children string[] names + * @field empty boolean + * @field min [number,number,number] (x,y,z) + * @field max [number,number,number] (x,y,z) + * @field offset [number,number,number] (x,y,z) */ @@ -8349,8 +8414,8 @@ static int GetSolidObjectPieceMatrix(lua_State* L, const CSolidObject* o) /*** * * @function Spring.GetModelRootPiece - * @string modelName - * @treturn number index of the root piece + * @param modelName string + * @return number index of the root piece */ int LuaSyncedRead::GetModelRootPiece(lua_State* L) { return ::GetModelRootPiece(L, luaL_optsstring(L, 1, "")); @@ -8359,8 +8424,8 @@ int LuaSyncedRead::GetModelRootPiece(lua_State* L) { /*** * * @function Spring.GetModelPieceMap - * @string modelName - * @treturn nil|{[string]=number,...} pieceInfos where keys are piece names and values are indices + * @param modelName string + * @return nil|table pieceInfos where keys are piece names and values are indices */ int LuaSyncedRead::GetModelPieceMap(lua_State* L) { return ::GetModelPieceMap(L, luaL_optsstring(L, 1, "")); @@ -8370,8 +8435,8 @@ int LuaSyncedRead::GetModelPieceMap(lua_State* L) { /*** * * @function Spring.GetModelPieceList - * @string modelName - * @treturn nil|{[string],...} pieceNames + * @param modelName string + * @return nil|string[] pieceNames */ int LuaSyncedRead::GetModelPieceList(lua_State* L) { return ::GetModelPieceList(L, luaL_optsstring(L, 1, "")); @@ -8381,8 +8446,8 @@ int LuaSyncedRead::GetModelPieceList(lua_State* L) { /*** * * @function Spring.GetUnitRootPiece - * @number unitID - * @treturn number index of the root piece + * @param unitID integer + * @return number index of the root piece */ int LuaSyncedRead::GetUnitRootPiece(lua_State* L) { return (GetSolidObjectRootPiece(L, ParseTypedUnit(L, __func__, 1))); @@ -8391,8 +8456,8 @@ int LuaSyncedRead::GetUnitRootPiece(lua_State* L) { /*** * * @function Spring.GetUnitPieceMap - * @number unitID - * @treturn nil|{[string]=number,...} pieceInfos where keys are piece names and values are indices + * @param unitID integer + * @return nil|table pieceInfos where keys are piece names and values are indices */ int LuaSyncedRead::GetUnitPieceMap(lua_State* L) { return (GetSolidObjectPieceMap(L, ParseTypedUnit(L, __func__, 1))); @@ -8402,8 +8467,8 @@ int LuaSyncedRead::GetUnitPieceMap(lua_State* L) { /*** * * @function Spring.GetUnitPieceList - * @number unitID - * @treturn {[string],...} pieceNames + * @param unitID integer + * @return string[] pieceNames */ int LuaSyncedRead::GetUnitPieceList(lua_State* L) { return (GetSolidObjectPieceList(L, ParseTypedUnit(L, __func__, 1))); @@ -8413,9 +8478,9 @@ int LuaSyncedRead::GetUnitPieceList(lua_State* L) { /*** * * @function Spring.GetUnitPieceInfo - * @number unitID - * @number pieceIndex - * @treturn nil|pieceSpec pieceInfo + * @param unitID integer + * @param pieceIndex integer + * @return PieceInfo? pieceInfo */ int LuaSyncedRead::GetUnitPieceInfo(lua_State* L) { return (GetSolidObjectPieceInfo(L, ParseTypedUnit(L, __func__, 1))); @@ -8425,14 +8490,14 @@ int LuaSyncedRead::GetUnitPieceInfo(lua_State* L) { /*** * * @function Spring.GetUnitPiecePosDir - * @number unitID - * @number pieceIndex - * @treturn number|nil posX - * @treturn number posY - * @treturn number posZ - * @treturn number dirX - * @treturn number dirY - * @treturn number dirZ + * @param unitID integer + * @param pieceIndex integer + * @return number|nil posX + * @return number posY + * @return number posZ + * @return number dirX + * @return number dirY + * @return number dirZ */ int LuaSyncedRead::GetUnitPiecePosDir(lua_State* L) { return (GetSolidObjectPiecePosDir(L, ParseTypedUnit(L, __func__, 1))); @@ -8442,11 +8507,11 @@ int LuaSyncedRead::GetUnitPiecePosDir(lua_State* L) { /*** * * @function Spring.GetUnitPiecePosition - * @number unitID - * @number pieceIndex - * @treturn number|nil posX - * @treturn number posY - * @treturn number posZ + * @param unitID integer + * @param pieceIndex integer + * @return number|nil posX + * @return number posY + * @return number posZ */ int LuaSyncedRead::GetUnitPiecePosition(lua_State* L) { return (GetSolidObjectPiecePosition(L, ParseTypedUnit(L, __func__, 1))); @@ -8456,11 +8521,11 @@ int LuaSyncedRead::GetUnitPiecePosition(lua_State* L) { /*** * * @function Spring.GetUnitPieceDirection - * @number unitID - * @number pieceIndex - * @treturn number|nil dirX - * @treturn number dirY - * @treturn number dirZ + * @param unitID integer + * @param pieceIndex integer + * @return number|nil dirX + * @return number dirY + * @return number dirZ */ int LuaSyncedRead::GetUnitPieceDirection(lua_State* L) { return (GetSolidObjectPieceDirection(L, ParseTypedUnit(L, __func__, 1))); @@ -8470,23 +8535,23 @@ int LuaSyncedRead::GetUnitPieceDirection(lua_State* L) { /*** * * @function Spring.GetUnitPieceMatrix - * @number unitID - * @treturn number|nil m11 - * @treturn number m12 - * @treturn number m13 - * @treturn number m14 - * @treturn number m21 - * @treturn number m22 - * @treturn number m23 - * @treturn number m24 - * @treturn number m31 - * @treturn number m32 - * @treturn number m33 - * @treturn number m34 - * @treturn number m41 - * @treturn number m42 - * @treturn number m43 - * @treturn number m44 + * @param unitID integer + * @return number|nil m11 + * @return number m12 + * @return number m13 + * @return number m14 + * @return number m21 + * @return number m22 + * @return number m23 + * @return number m24 + * @return number m31 + * @return number m32 + * @return number m33 + * @return number m34 + * @return number m41 + * @return number m42 + * @return number m43 + * @return number m44 */ int LuaSyncedRead::GetUnitPieceMatrix(lua_State* L) { return (GetSolidObjectPieceMatrix(L, ParseTypedUnit(L, __func__, 1))); @@ -8495,8 +8560,8 @@ int LuaSyncedRead::GetUnitPieceMatrix(lua_State* L) { /*** * * @function Spring.GetFeatureRootPiece - * @number featureID - * @treturn number index of the root piece + * @param featureID integer + * @return number index of the root piece */ int LuaSyncedRead::GetFeatureRootPiece(lua_State* L) { return (GetSolidObjectRootPiece(L, ParseFeature(L, __func__, 1))); @@ -8505,8 +8570,8 @@ int LuaSyncedRead::GetFeatureRootPiece(lua_State* L) { /*** * * @function Spring.GetFeaturePieceMap - * @number featureID - * @treturn {[string]=number,...} pieceInfos where keys are piece names and values are indices + * @param featureID integer + * @return table pieceInfos where keys are piece names and values are indices */ int LuaSyncedRead::GetFeaturePieceMap(lua_State* L) { return (GetSolidObjectPieceMap(L, ParseFeature(L, __func__, 1))); @@ -8516,8 +8581,8 @@ int LuaSyncedRead::GetFeaturePieceMap(lua_State* L) { /*** * * @function Spring.GetFeaturePieceList - * @number featureID - * @treturn {[string],...} pieceNames + * @param featureID integer + * @return string[] pieceNames */ int LuaSyncedRead::GetFeaturePieceList(lua_State* L) { return (GetSolidObjectPieceList(L, ParseFeature(L, __func__, 1))); @@ -8527,9 +8592,9 @@ int LuaSyncedRead::GetFeaturePieceList(lua_State* L) { /*** * * @function Spring.GetFeaturePieceInfo - * @number featureID - * @number pieceIndex - * @treturn nil|pieceSpec pieceInfo + * @param featureID integer + * @param pieceIndex integer + * @return PieceInfo? pieceInfo */ int LuaSyncedRead::GetFeaturePieceInfo(lua_State* L) { return (GetSolidObjectPieceInfo(L, ParseFeature(L, __func__, 1))); @@ -8539,14 +8604,14 @@ int LuaSyncedRead::GetFeaturePieceInfo(lua_State* L) { /*** * * @function Spring.GetFeaturePiecePosDir - * @number featureID - * @number pieceIndex - * @treturn number|nil posX - * @treturn number posY - * @treturn number posZ - * @treturn number dirX - * @treturn number dirY - * @treturn number dirZ + * @param featureID integer + * @param pieceIndex integer + * @return number|nil posX + * @return number posY + * @return number posZ + * @return number dirX + * @return number dirY + * @return number dirZ */ int LuaSyncedRead::GetFeaturePiecePosDir(lua_State* L) { return (GetSolidObjectPiecePosDir(L, ParseFeature(L, __func__, 1))); @@ -8556,11 +8621,11 @@ int LuaSyncedRead::GetFeaturePiecePosDir(lua_State* L) { /*** * * @function Spring.GetFeaturePiecePosition - * @number featureID - * @number pieceIndex - * @treturn number|nil posX - * @treturn number posY - * @treturn number posZ + * @param featureID integer + * @param pieceIndex integer + * @return number|nil posX + * @return number posY + * @return number posZ */ int LuaSyncedRead::GetFeaturePiecePosition(lua_State* L) { return (GetSolidObjectPiecePosition(L, ParseFeature(L, __func__, 1))); @@ -8570,11 +8635,11 @@ int LuaSyncedRead::GetFeaturePiecePosition(lua_State* L) { /*** * * @function Spring.GetFeaturePieceDirection - * @number featureID - * @number pieceIndex - * @treturn number|nil dirX - * @treturn number dirY - * @treturn number dirZ + * @param featureID integer + * @param pieceIndex integer + * @return number|nil dirX + * @return number dirY + * @return number dirZ */ int LuaSyncedRead::GetFeaturePieceDirection(lua_State* L) { return (GetSolidObjectPieceDirection(L, ParseFeature(L, __func__, 1))); @@ -8584,37 +8649,42 @@ int LuaSyncedRead::GetFeaturePieceDirection(lua_State* L) { /*** * * @function Spring.GetFeaturePieceMatrix - * @number featureID - * @treturn number|nil m11 - * @treturn number m12 - * @treturn number m13 - * @treturn number m14 - * @treturn number m21 - * @treturn number m22 - * @treturn number m23 - * @treturn number m24 - * @treturn number m31 - * @treturn number m32 - * @treturn number m33 - * @treturn number m34 - * @treturn number m41 - * @treturn number m42 - * @treturn number m43 - * @treturn number m44 + * @param featureID integer + * @return number|nil m11 + * @return number m12 + * @return number m13 + * @return number m14 + * @return number m21 + * @return number m22 + * @return number m23 + * @return number m24 + * @return number m31 + * @return number m32 + * @return number m33 + * @return number m34 + * @return number m41 + * @return number m42 + * @return number m43 + * @return number m44 */ int LuaSyncedRead::GetFeaturePieceMatrix(lua_State* L) { return (GetSolidObjectPieceMatrix(L, ParseFeature(L, __func__, 1))); } - /*** * * @function Spring.GetUnitScriptPiece * - * @number unitID - * @number[opt] scriptPiece + * @param unitID integer + * @return integer[] pieceIndices + */ +/*** * - * @treturn {number,...}|number pieceIndices when scriptPiece is not specified, pieceIndex otherwise + * @function Spring.GetUnitScriptPiece + * + * @param unitID integer + * @param scriptPiece integer + * @return integer pieceIndex */ int LuaSyncedRead::GetUnitScriptPiece(lua_State* L) { @@ -8651,9 +8721,9 @@ int LuaSyncedRead::GetUnitScriptPiece(lua_State* L) * * @function Spring.GetUnitScriptNames * - * @number unitID + * @param unitID integer * - * @treturn {[string]=number,...} where keys are piece names and values are piece indices + * @return table where keys are piece names and values are piece indices */ int LuaSyncedRead::GetUnitScriptNames(lua_State* L) { @@ -8761,11 +8831,11 @@ int LuaSyncedRead::TraceRayGroundBetweenPositions(lua_State* L) * * @function Spring.GetRadarErrorParams * - * @number allyTeamID + * @param allyTeamID integer * - * @treturn nil|number radarErrorSize actual radar error size (when allyTeamID is allied to current team) or base radar error size - * @treturn number baseRadarErrorSize - * @treturn number baseRadarErrorMult + * @return number? radarErrorSize actual radar error size (when allyTeamID is allied to current team) or base radar error size + * @return number baseRadarErrorSize + * @return number baseRadarErrorMult */ int LuaSyncedRead::GetRadarErrorParams(lua_State* L) { diff --git a/rts/Lua/LuaTableExtra.cpp b/rts/Lua/LuaTableExtra.cpp index c29cea6fb9..01a51689fe 100644 --- a/rts/Lua/LuaTableExtra.cpp +++ b/rts/Lua/LuaTableExtra.cpp @@ -4,9 +4,7 @@ #include "LuaUtils.h" /****************************************************************************** - * table extensions - * @module TableExtra - * @see rts/Lua/LuaTableExtra.cpp + * Table extensions ******************************************************************************/ /*** Returns a table with preallocated memory @@ -17,9 +15,9 @@ * such as one for each UnitDef, by avoiding reallocation. * * @function table.new - * @number nArray hint for count of array elements - * @number nHashed hint for count of hashtable elements - * @treturn table + * @param nArray number hint for count of array elements + * @param nHashed number hint for count of hashtable elements + * @return table */ static int TableExtra_new(lua_State* L) { diff --git a/rts/Lua/LuaTracyExtra.cpp b/rts/Lua/LuaTracyExtra.cpp index c1f82468d8..617bb0e7dc 100644 --- a/rts/Lua/LuaTracyExtra.cpp +++ b/rts/Lua/LuaTracyExtra.cpp @@ -29,15 +29,19 @@ static const std::string& GetImmanentPlotName(const char *plotName) return *tracyLuaPlots.emplace(plotName).first; } +/** + * Tracy extensions + * @table tracy + */ + /*** Configure custom appearance for a Tracy plot for use in debugging or profiling * * @function tracy.LuaTracyPlotConfig - * @string plotName name of the plot to customize - * @string[opt="Number"] plotFormatType "Number"|"Percentage"|"Memory" - * @bool[opt=true] stepwise stepwise chart - * @bool[opt=false] fill whether to fill color - * @number[opt=0xFFFFFF] color uint32 number as BGR color - * @treturn nil + * @param plotName string name of the plot to customize + * @param plotFormatType "Number"|"Percentage"|"Memory"|nil (Default: `"Number"`) + * @param stepwise boolean? (Default: `true`) stepwise chart + * @param fill boolean? (Default: `false`) whether to fill color + * @param color integer? (Default: `0xFFFFFF`) uint32 number as BGR color */ static int LuaTracyPlotConfig(lua_State* L) @@ -63,9 +67,8 @@ static int LuaTracyPlotConfig(lua_State* L) /*** Update a Tracy plot with a value * * @function tracy.LuaTracyPlot - * @string plotName which LuaPlot should be updated - * @number plotValue the number to show on the Tracy plot - * @treturn nil + * @param plotName string Which LuaPlot should be updated + * @param plotValue number the number to show on the Tracy plot */ static int LuaTracyPlot(lua_State* L) { @@ -76,12 +79,6 @@ static int LuaTracyPlot(lua_State* L) return 0; } -/****************************************************************************** - * tracy extensions - * @module TracyExtra - * @see rts/Lua/LuaTracyExtra.cpp -******************************************************************************/ - bool LuaTracyExtra::PushEntries(lua_State* L) { LuaPushNamedCFunc(L, "LuaTracyPlot" , LuaTracyPlot ); diff --git a/rts/Lua/LuaUnsyncedCtrl.cpp b/rts/Lua/LuaUnsyncedCtrl.cpp index 04ccfc41da..7498aae351 100644 --- a/rts/Lua/LuaUnsyncedCtrl.cpp +++ b/rts/Lua/LuaUnsyncedCtrl.cpp @@ -115,27 +115,10 @@ /****************************************************************************** * Callouts to set state * - * @module UnsyncedCtrl * @see rts/Lua/LuaUnsyncedCtrl.cpp ******************************************************************************/ -/*** Color triple (RGB) - * @table rgb - * @number r - * @number g - * @number b - */ - -/*** Color quadruple (RGBA) - * @table rgba - * @number r - * @number g - * @number b - * @number a - */ - - bool LuaUnsyncedCtrl::PushEntries(lua_State* L) { REGISTER_LUA_CFUNC(Ping); @@ -468,9 +451,9 @@ static inline CUnit* ParseSelectUnit(lua_State* L, const char* caller, int index * * @function Spring.Ping * - * @number pingTag + * @param pingTag number * - * @treturn nil + * @return nil */ int LuaUnsyncedCtrl::Ping(lua_State* L) { @@ -485,38 +468,38 @@ int LuaUnsyncedCtrl::Ping(lua_State* L) /*** Useful for debugging. * + * Prints values in the spring chat console. + * Hint: the default print() writes to STDOUT. + * * @function Spring.Echo + * @param arg any + * @param ... any * - * @param arg1 - * @param[opt] arg2 - * @param[opt] argn - * - * Prints values in the spring chat console. - * Hint: the default print() writes to STDOUT. - * - * @treturn nil + * @return nil */ int LuaUnsyncedCtrl::Echo(lua_State* L) { return LuaUtils::Echo(L); } +/*** + * @alias LogLevel + * | integer + * | "debug" # LOG.DEBUG + * | "info" # LOG.INFO + * | "notice" # LOG.NOTICE (engine default) + * | "warning" # LOG.WARNING + * | "error" # LOG.ERROR + * | "fatal" # LOG.FATAL + */ -/*** @function Spring.Log - * @string section - * @tparam ?number|string logLevel - * Possible values for logLevel are: - * "debug" | LOG.DEBUG - * "info" | LOG.INFO - * "notice" | LOG.NOTICE (engine default) - * "warning" | LOG.WARNING - * "error" | LOG.ERROR - * "fatal" | LOG.FATAL - * @string logMessage1 - * @string[opt] logMessage2 - * @string[opt] logMessagen +/*** + * @function Spring.Log + * @param section string + * @param logLevel LogLevel? (Default: "notice") + * @param ... string messages * - * @treturn nil + * @return nil */ int LuaUnsyncedCtrl::Log(lua_State* L) { @@ -524,10 +507,16 @@ int LuaUnsyncedCtrl::Log(lua_State* L) } -/*** @function Spring.SendCommands - * @tparam ?string|table command1 | { command1, command 2, ...} - * @string command2 - * @treturn nil +/*** + * @function Spring.SendCommands + * @param commands string[] + */ + +/*** + * @function Spring.SendCommands + * @param command string + * @param ... string additional commands + * @return nil */ int LuaUnsyncedCtrl::SendCommands(lua_State* L) { @@ -610,8 +599,8 @@ static void PrintMessage(lua_State* L, const string& msg) /*** @function Spring.SendMessage - * @string message - * @treturn nil + * @param message string + * @return nil */ int LuaUnsyncedCtrl::SendMessage(lua_State* L) { @@ -621,8 +610,8 @@ int LuaUnsyncedCtrl::SendMessage(lua_State* L) /*** @function Spring.SendMessageToSpectators - * @string message `` (with # being a playerid) inside the string will be replaced with the players name - i.e. : Spring.SendMessage ("`` did something") might display as "ProRusher did something" - * @treturn nil + * @param message string `` (with # being a playerid) inside the string will be replaced with the players name - i.e. : Spring.SendMessage ("`` did something") might display as "ProRusher did something" + * @return nil */ int LuaUnsyncedCtrl::SendMessageToSpectators(lua_State* L) { @@ -634,9 +623,9 @@ int LuaUnsyncedCtrl::SendMessageToSpectators(lua_State* L) /*** @function Spring.SendMessageToPlayer - * @number playerID - * @string message - * @treturn nil + * @param playerID number + * @param message string + * @return nil */ int LuaUnsyncedCtrl::SendMessageToPlayer(lua_State* L) { @@ -648,9 +637,9 @@ int LuaUnsyncedCtrl::SendMessageToPlayer(lua_State* L) /*** @function Spring.SendMessageToTeam - * @number teamID - * @string message - * @treturn nil + * @param teamID number + * @param message string + * @return nil */ int LuaUnsyncedCtrl::SendMessageToTeam(lua_State* L) { @@ -662,9 +651,9 @@ int LuaUnsyncedCtrl::SendMessageToTeam(lua_State* L) /*** @function Spring.SendMessageToAllyTeam - * @number allyID - * @string message - * @treturn nil + * @param allyID number + * @param message string + * @return nil */ int LuaUnsyncedCtrl::SendMessageToAllyTeam(lua_State* L) { @@ -684,8 +673,8 @@ int LuaUnsyncedCtrl::SendMessageToAllyTeam(lua_State* L) /*** Loads a SoundDefs file, the format is the same as in `gamedata/sounds.lua`. * * @function Spring.LoadSoundDef - * @string soundfile - * @treturn ?nil|bool success + * @param soundfile string + * @return boolean success */ int LuaUnsyncedCtrl::LoadSoundDef(lua_State* L) { @@ -698,24 +687,32 @@ int LuaUnsyncedCtrl::LoadSoundDef(lua_State* L) return 1; } +/*** + * @alias SoundChannel + * | "general" # 0 + * | "battle" # Same as `"sfx" | 1` + * | "sfx" # Same as `"battle" | 1` + * | "unitreply" # Same as `"voice" | 2` + * | "voice" # Same as `"unitreply" | 2` + * | "userinterface" # Same as "ui" | 3` + * | "ui" # Same as "userinterface" | 3` + * | 0 # General + * | 1 # SFX + * | 2 # Voice + * | 3 # User interface + */ /*** @function Spring.PlaySoundFile - * @string soundfile - * @number[opt=1.0] volume - * @number[opt] posx - * @number[opt] posy - * @number[opt] posz - * @number[opt] speedx - * @number[opt] speedy - * @number[opt] speedz - * @tparam[opt] ?number|string channel - * Possible arguments for channel argument: - * "general" || 0 || nil (default) - * "battle" || "sfx" | 1 - * "unitreply" || "voice" || 2 - * "userinterface" || "ui" || 3 - * - * @treturn ?nil|bool playSound + * @param soundfile string + * @param volume number? (Default: 1.0) + * @param posx number? + * @param posy number? + * @param posz number? + * @param speedx number? + * @param speedy number? + * @param speedz number? + * @param channel SoundChannel? (Default: `0|"general"`) + * @return boolean playSound */ int LuaUnsyncedCtrl::PlaySoundFile(lua_State* L) { @@ -802,11 +799,11 @@ int LuaUnsyncedCtrl::PlaySoundFile(lua_State* L) * * Multiple sound streams may be played at once. * - * @string oggfile - * @number[opt=1.0] volume - * @bool[opt] enqueue + * @param oggfile string + * @param volume number? (Default: 1.0) + * @param enqueue boolean? * - * @treturn ?nil|bool success + * @return boolean success */ int LuaUnsyncedCtrl::PlaySoundStream(lua_State* L) { @@ -823,7 +820,7 @@ int LuaUnsyncedCtrl::PlaySoundStream(lua_State* L) /*** Terminates any SoundStream currently running. * * @function Spring.StopSoundStream - * @treturn nil + * @return nil */ int LuaUnsyncedCtrl::StopSoundStream(lua_State*) { @@ -835,7 +832,7 @@ int LuaUnsyncedCtrl::StopSoundStream(lua_State*) /*** Pause any SoundStream currently running. * * @function Spring.PauseSoundStream - * @treturn nil + * @return nil */ int LuaUnsyncedCtrl::PauseSoundStream(lua_State*) { @@ -847,8 +844,8 @@ int LuaUnsyncedCtrl::PauseSoundStream(lua_State*) /*** Set volume for SoundStream * * @function Spring.SetSoundStreamVolume - * @number volume - * @treturn nil + * @param volume number + * @return nil */ int LuaUnsyncedCtrl::SetSoundStreamVolume(lua_State* L) { @@ -970,11 +967,11 @@ int LuaUnsyncedCtrl::SetSoundEffectParams(lua_State* L) /*** * * @function Spring.AddWorldIcon - * @number cmdID - * @number posX - * @number posY - * @number posZ - * @treturn nil + * @param cmdID number + * @param posX number + * @param posY number + * @param posZ number + * @return nil */ int LuaUnsyncedCtrl::AddWorldIcon(lua_State* L) { @@ -990,11 +987,11 @@ int LuaUnsyncedCtrl::AddWorldIcon(lua_State* L) /*** * * @function Spring.AddWorldText - * @string text - * @number posX - * @number posY - * @number posZ - * @treturn nil + * @param text string + * @param posX number + * @param posY number + * @param posZ number + * @return nil */ int LuaUnsyncedCtrl::AddWorldText(lua_State* L) { @@ -1010,13 +1007,13 @@ int LuaUnsyncedCtrl::AddWorldText(lua_State* L) /*** * * @function Spring.AddWorldUnit - * @number unitDefID - * @number posX - * @number posY - * @number posZ - * @number teamID - * @number facing - * @treturn nil + * @param unitDefID number + * @param posX number + * @param posY number + * @param posZ number + * @param teamID number + * @param facing number + * @return nil */ int LuaUnsyncedCtrl::AddWorldUnit(lua_State* L) { @@ -1043,16 +1040,16 @@ int LuaUnsyncedCtrl::AddWorldUnit(lua_State* L) /*** * * @function Spring.DrawUnitCommands - * @number unitID - * @treturn nil + * @param unitID number + * @return nil */ /*** * * @function Spring.DrawUnitCommands - * @tparam table units array of unit ids - * @bool tableOrArray[opt=false] when true `units` is interpreted as a table in the format `{ [unitID] = arg1, ... }` - * @treturn nil + * @param units table array of unit ids + * @param tableOrArray boolean? (Default: false] when true `units` is interpreted as a table in the format `{ [unitID) = arg1, ... }` + * @return nil */ int LuaUnsyncedCtrl::DrawUnitCommands(lua_State* L) { @@ -1091,29 +1088,30 @@ int LuaUnsyncedCtrl::DrawUnitCommands(lua_State* L) * @section camera *****************************************************************************/ -/*** Parameters for camera state - * - * @table camState +/*** + * Parameters for camera state * * Highly dependent on the type of the current camera controller - * - * @string name "ta"|"spring"|"rot"|"ov"|"free"|"fps"|"dummy" - * @number mode the camera mode: 0 (fps), 1 (ta), 2 (spring), 3 (rot), 4 (free), 5 (ov), 6 (dummy) - * @number fov - * @number px Position X of the ground point in screen center - * @number py Position Y of the ground point in screen center - * @number pz Position Z of the ground point in screen center - * @number dx Camera direction vector X - * @number dy Camera direction vector Y - * @number dz Camera direction vector Z - * @number rx Camera rotation angle on X axis (spring) - * @number ry Camera rotation angle on Y axis (spring) - * @number rz Camera rotation angle on Z axis (spring) - * @number angle Camera rotation angle on X axis (aka tilt/pitch) (ta) - * @number flipped -1 for when south is down, 1 for when north is down (ta) - * @number dist Camera distance from the ground (spring) - * @number height Camera distance from the ground (ta) - * @number oldHeight Camera distance from the ground, cannot be changed (rot) + * + * @class camState + * + * @field name "ta"|"spring"|"rot"|"ov"|"free"|"fps"|"dummy" + * @field mode number the camera mode: 0 (fps), 1 (ta), 2 (spring), 3 (rot), 4 (free), 5 (ov), 6 (dummy) + * @field fov number + * @field px number Position X of the ground point in screen center + * @field py number Position Y of the ground point in screen center + * @field pz number Position Z of the ground point in screen center + * @field dx number Camera direction vector X + * @field dy number Camera direction vector Y + * @field dz number Camera direction vector Z + * @field rx number Camera rotation angle on X axis (spring) + * @field ry number Camera rotation angle on Y axis (spring) + * @field rz number Camera rotation angle on Z axis (spring) + * @field angle number Camera rotation angle on X axis (aka tilt/pitch) (ta) + * @field flipped number -1 for when south is down, 1 for when north is down (ta) + * @field dist number Camera distance from the ground (spring) + * @field height number Camera distance from the ground (ta) + * @field oldHeight number Camera distance from the ground, cannot be changed (rot) */ static CCameraController::StateMap ParseCamStateMap(lua_State* L, int tableIdx) @@ -1142,11 +1140,11 @@ static CCameraController::StateMap ParseCamStateMap(lua_State* L, int tableIdx) * * @function Spring.SetCameraTarget * - * @number x - * @number y - * @number z - * @number[opt] transTime - * @treturn nil + * @param x number + * @param y number + * @param z number + * @param transTime number? + * @return nil */ int LuaUnsyncedCtrl::SetCameraTarget(lua_State* L) { @@ -1180,13 +1178,13 @@ int LuaUnsyncedCtrl::SetCameraTarget(lua_State* L) * * @function Spring.SetCameraOffset * - * @number[opt=0] posX - * @number[opt=0] posY - * @number[opt=0] posZ - * @number[opt=0] tiltX - * @number[opt=0] tiltY - * @number[opt=0] tiltZ - * @treturn nil + * @param posX number? (Default: 0) + * @param posY number? (Default: 0) + * @param posZ number? (Default: 0) + * @param tiltX number? (Default: 0) + * @param tiltY number? (Default: 0) + * @param tiltZ number? (Default: 0) + * @return nil */ int LuaUnsyncedCtrl::SetCameraOffset(lua_State* L) { @@ -1207,22 +1205,22 @@ int LuaUnsyncedCtrl::SetCameraOffset(lua_State* L) * * The fields in `camState` must be consistent with the name/mode and current/new camera mode * - * @tparam camState camState - * @number[opt=0] transitionTime in nanoseconds + * @param camState camState + * @param transitionTime number? (Default: 0) in nanoseconds * - * @number[opt] transitionTimeFactor + * @param transitionTimeFactor number? * multiplicative factor applied to this and all subsequent transition times for * this camera mode. * * Defaults to "CamTimeFactor" springsetting unless set previously. * - * @number[opt] transitionTimeExponent + * @param transitionTimeExponent number? * tween factor applied to this and all subsequent transitions for this camera * mode. * * Defaults to "CamTimeExponent" springsetting unless set previously. * - * @treturn bool set + * @return boolean set */ int LuaUnsyncedCtrl::SetCameraState(lua_State* L) { @@ -1249,8 +1247,8 @@ int LuaUnsyncedCtrl::SetCameraState(lua_State* L) /*** Runs Dolly Camera * * @function Spring.RunDollyCamera - * @number runtime in milliseconds - * @treturn nil + * @param runtime number in milliseconds + * @return nil */ int LuaUnsyncedCtrl::RunDollyCamera(lua_State* L) { @@ -1264,8 +1262,8 @@ int LuaUnsyncedCtrl::RunDollyCamera(lua_State* L) /*** Pause Dolly Camera * * @function Spring.PauseDollyCamera - * @number fraction fraction of the total runtime to pause at, 0 to 1 inclusive. A null value pauses at current percent - * @treturn nil + * @param fraction number fraction of the total runtime to pause at, 0 to 1 inclusive. A null value pauses at current percent + * @return nil */ int LuaUnsyncedCtrl::PauseDollyCamera(lua_State* L) { @@ -1279,7 +1277,7 @@ int LuaUnsyncedCtrl::PauseDollyCamera(lua_State* L) /*** Resume Dolly Camera * * @function Spring.ResumeDollyCamera - * @treturn nil + * @return nil */ int LuaUnsyncedCtrl::ResumeDollyCamera(lua_State* L) { @@ -1291,10 +1289,10 @@ int LuaUnsyncedCtrl::ResumeDollyCamera(lua_State* L) /*** Sets Dolly Camera Position * * @function Spring.SetDollyCameraPosition - * @number x - * @number y - * @number z - * @treturn nil + * @param x number + * @param y number + * @param z number + * @return nil */ int LuaUnsyncedCtrl::SetDollyCameraPosition(lua_State* L) { @@ -1310,10 +1308,10 @@ int LuaUnsyncedCtrl::SetDollyCameraPosition(lua_State* L) /*** Sets Dolly Camera movement Curve * * @function Spring.SetDollyCameraCurve - * @number degree - * @tparam table cpoints NURBS control point positions {{x,y,z,weight}, ...} - * @tparam table knots - * @treturn nil + * @param degree number + * @param cpoints table NURBS control point positions {{x,y,z,weight}, ...} + * @param knots table + * @return nil */ int LuaUnsyncedCtrl::SetDollyCameraCurve(lua_State* L) { @@ -1333,8 +1331,8 @@ int LuaUnsyncedCtrl::SetDollyCameraCurve(lua_State* L) /*** Sets Dolly Camera movement mode * * @function Spring.SetDollyCameraMode - * @number mode 1 static position, 2 nurbs curve - * @treturn nil + * @param mode number 1 static position, 2 nurbs curve + * @return nil */ int LuaUnsyncedCtrl::SetDollyCameraMode(lua_State* L) { @@ -1348,8 +1346,8 @@ int LuaUnsyncedCtrl::SetDollyCameraMode(lua_State* L) /*** Sets Dolly Camera movement curve to world relative or look target relative * * @function Spring.SetDollyCameraRelativeMode - * @number relativeMode 1 world, 2 look target - * @treturn nil + * @param relativeMode number 1 world, 2 look target + * @return nil */ int LuaUnsyncedCtrl::SetDollyCameraRelativeMode(lua_State* L) { @@ -1364,10 +1362,10 @@ int LuaUnsyncedCtrl::SetDollyCameraRelativeMode(lua_State* L) /*** Sets Dolly Camera Look Curve * * @function Spring.SetDollyCameraLookCurve - * @number degree - * @tparam table cpoints NURBS control point positions {{x,y,z,weight}, ...} - * @tparam table knots - * @treturn nil + * @param degree number + * @param cpoints table NURBS control point positions {{x,y,z,weight}, ...} + * @param knots table + * @return nil */ int LuaUnsyncedCtrl::SetDollyCameraLookCurve(lua_State* L) { @@ -1388,10 +1386,10 @@ int LuaUnsyncedCtrl::SetDollyCameraLookCurve(lua_State* L) /*** Sets Dolly Camera Look Position * * @function Spring.SetDollyCameraLookPosition - * @number x - * @number y - * @number z - * @treturn nil + * @param x number + * @param y number + * @param z number + * @return nil */ int LuaUnsyncedCtrl::SetDollyCameraLookPosition(lua_State* L) { @@ -1408,8 +1406,8 @@ int LuaUnsyncedCtrl::SetDollyCameraLookPosition(lua_State* L) /*** Sets target unit for Dolly Camera to look towards * * @function Spring.SetDollyCameraLookUnit - * @number unitID the unit to look at - * @treturn nil + * @param unitID number the unit to look at + * @return nil */ int LuaUnsyncedCtrl::SetDollyCameraLookUnit(lua_State* L) { @@ -1431,9 +1429,9 @@ int LuaUnsyncedCtrl::SetDollyCameraLookUnit(lua_State* L) /*** Selects a single unit * * @function Spring.SelectUnit - * @number unitID or nil - * @bool[opt=false] append append to current selection - * @treturn nil + * @param unitID number or nil + * @param append boolean? (Default: false) append to current selection + * @return nil */ int LuaUnsyncedCtrl::SelectUnit(lua_State* L) { @@ -1455,8 +1453,8 @@ int LuaUnsyncedCtrl::SelectUnit(lua_State* L) /*** * * @function Spring.DeselectUnit - * @number unitID - * @treturn nil + * @param unitID number + * @return nil */ int LuaUnsyncedCtrl::DeselectUnit(lua_State* L) { @@ -1494,22 +1492,22 @@ static int TableSelectionCommonFunc(lua_State* L, int unitIndexInTable, bool isS return 0; } -/*** Deselects multiple units. Accepts a table with unitIDs as values +/*** Deselects multiple units. * * @function Spring.DeselectUnitArray - * @tparam {[any] = unitID, ...} unitIDs - * @treturn nil + * @param unitIDs table Table with unit IDs as value. + * @return nil */ int LuaUnsyncedCtrl::DeselectUnitArray(lua_State* L) { return TableSelectionCommonFunc(L, -1, false, __func__); } -/*** Deselects multiple units. Accepts a table with unitIDs as keys +/*** Deselects multiple units. * * @function Spring.DeselectUnitMap - * @tparam {[unitID] = any, ...} unitMap where keys are unitIDs - * @treturn nil + * @param unitMap table Table with unit IDs as keys. + * @return nil */ int LuaUnsyncedCtrl::DeselectUnitMap(lua_State* L) { @@ -1519,9 +1517,9 @@ int LuaUnsyncedCtrl::DeselectUnitMap(lua_State* L) /*** Selects multiple units, or appends to selection. Accepts a table with unitIDs as values * * @function Spring.SelectUnitArray - * @tparam {[any] = unitID, ...} unitIDs - * @bool[opt=false] append append to current selection - * @treturn nil + * @param unitMap table Table with unit IDs as values. + * @param append boolean? (Default: false) append to current selection + * @return nil */ int LuaUnsyncedCtrl::SelectUnitArray(lua_State* L) { @@ -1531,9 +1529,9 @@ int LuaUnsyncedCtrl::SelectUnitArray(lua_State* L) /*** Selects multiple units, or appends to selection. Accepts a table with unitIDs as keys * * @function Spring.SelectUnitMap - * @tparam {[unitID] = any, ...} unitMap where keys are unitIDs - * @bool[opt=false] append append to current selection - * @treturn nil + * @param unitMap table Table with unit IDs as keys. + * @param append boolean? (Default: false) append to current selection + * @return nil */ int LuaUnsyncedCtrl::SelectUnitMap(lua_State* L) { @@ -1548,52 +1546,31 @@ int LuaUnsyncedCtrl::SelectUnitMap(lua_State* L) ******************************************************************************/ /*** Parameters for lighting - * @table lightParams - * @tparam table position - * @number position.px - * @number position.py - * @number position.pz - * @tparam table direction - * @number direction.dx - * @number direction.dy - * @number direction.dz - * @tparam table ambientColor - * @number ambientColor.red - * @number ambientColor.green - * @number ambientColor.blue - * @tparam table diffuseColor - * @number diffuseColor.red - * @number diffuseColor.green - * @number diffuseColor.blue - * @tparam table specularColor - * @number specularColor.red - * @number specularColor.green - * @number specularColor.blue - * @tparam table intensityWeight - * @number intensityWeight.ambientWeight - * @number intensityWeight.diffuseWeight - * @number intensityWeight.specularWeight - * @tparam table ambientDecayRate per-frame decay of ambientColor (spread over TTL frames) - * @number ambientDecayRate.ambientRedDecay - * @number ambientDecayRate.ambientGreenDecay - * @number ambientDecayRate.ambientBlueDecay - * @tparam table diffuseDecayRate per-frame decay of diffuseColor (spread over TTL frames) - * @number diffuseDecayRate.diffuseRedDecay - * @number diffuseDecayRate.diffuseGreenDecay - * @number diffuseDecayRate.diffuseBlueDecay - * @tparam table specularDecayRate per-frame decay of specularColor (spread over TTL frames) - * @number specularDecayRate.specularRedDecay - * @number specularDecayRate.specularGreenDecay - * @number specularDecayRate.specularBlueDecay - * @tparam table decayFunctionType *DecayType = 0.0 -> interpret *DecayRate values as linear, else as exponential - * @number decayFunctionType.ambientDecayType - * @number decayFunctionType.diffuseDecayType - * @number decayFunctionType.specularDecayType - * @number radius - * @number fov - * @number ttl - * @number priority - * @bool ignoreLOS + * + * @class LightParams + * @field position { px: number, py: number, pz: number } + * @field direction { dx: number, dy: number, dz: number } + * @field ambientColor { red: number, green: number, blue: number } + * @field diffuseColor { red: number, green: number, blue: number } + * @field specularColor { red: number, green: number, blue: number } + * @field intensityWeight { ambientWeight: number, diffuseWeight: number, specularWeight: number } + * + * @field ambientDecayRate { ambientRedDecay: number, ambientGreenDecay: number, ambientBlueDecay: number } + * Per-frame decay of `ambientColor` (spread over TTL frames) + * + * @field diffuseDecayRate { diffuseRedDecay: number, diffuseGreenDecay: number, diffuseBlueDecay: number } + * Per-frame decay of `diffuseColor` (spread over TTL frames) + * + * @field specularDecayRate { specularRedDecay: number, specularGreenDecay: number, specularBlueDecay: number } + * Per-frame decay of `specularColor` (spread over TTL frames) + * @field decayFunctionType { ambientDecayType: number, diffuseDecayType: number, specularDecayType: number } + * If value is `0.0` then the `*DecayRate` values will be interpreted as linear, otherwise exponential. + * + * @field radius number + * @field fov number + * @field ttl number + * @field priority number + * @field ignoreLOS boolean */ static bool ParseLight(lua_State* L, GL::Light& light, const int tblIdx, const char* caller) @@ -1711,8 +1688,8 @@ static bool ParseLight(lua_State* L, GL::Light& light, const int tblIdx, const c * * requires MaxDynamicMapLights > 0 * - * @tparam lightParams lightParams - * @treturn number lightHandle + * @param lightParams LightParams + * @return integer lightHandle */ int LuaUnsyncedCtrl::AddMapLight(lua_State* L) { @@ -1737,8 +1714,8 @@ int LuaUnsyncedCtrl::AddMapLight(lua_State* L) * * requires MaxDynamicMapLights > 0 * - * @tparam lightParams lightParams - * @treturn number lightHandle + * @param lightParams LightParams + * @return number lightHandle */ int LuaUnsyncedCtrl::AddModelLight(lua_State* L) { @@ -1761,9 +1738,9 @@ int LuaUnsyncedCtrl::AddModelLight(lua_State* L) /*** * @function Spring.UpdateMapLight * - * @number lightHandle - * @tparam lightParams lightParams - * @treturn bool success + * @param lightHandle number + * @param lightParams LightParams + * @return boolean success */ int LuaUnsyncedCtrl::UpdateMapLight(lua_State* L) { @@ -1783,9 +1760,9 @@ int LuaUnsyncedCtrl::UpdateMapLight(lua_State* L) /*** * @function Spring.UpdateModelLight * - * @number lightHandle - * @tparam lightParams lightParams - * @treturn bool success + * @param lightHandle number + * @param lightParams LightParams + * @return boolean success */ int LuaUnsyncedCtrl::UpdateModelLight(lua_State* L) { @@ -1863,11 +1840,11 @@ static bool AddLightTrackingTarget(lua_State* L, GL::Light* light, bool trackEna * * @function Spring.SetMapLightTrackingState * - * @number lightHandle - * @number unitOrProjectileID - * @bool enableTracking - * @bool unitOrProjectile - * @treturn bool success + * @param lightHandle number + * @param unitOrProjectileID number + * @param enableTracking boolean + * @param unitOrProjectile boolean + * @return boolean success */ int LuaUnsyncedCtrl::SetMapLightTrackingState(lua_State* L) { @@ -1899,11 +1876,11 @@ int LuaUnsyncedCtrl::SetMapLightTrackingState(lua_State* L) * * @function Spring.SetModelLightTrackingState * - * @number lightHandle - * @number unitOrProjectileID - * @bool enableTracking - * @bool unitOrProjectile - * @treturn bool success + * @param lightHandle number + * @param unitOrProjectileID number + * @param enableTracking boolean + * @param unitOrProjectile boolean + * @return boolean success */ int LuaUnsyncedCtrl::SetModelLightTrackingState(lua_State* L) { @@ -1943,9 +1920,9 @@ int LuaUnsyncedCtrl::SetModelLightTrackingState(lua_State* L) * Passing in a value of 0 will cause the respective shader to revert back to its engine default. * Custom map shaders that declare a uniform ivec2 named "texSquare" can sample from the default diffuse texture(s), which are always bound to TU 0. * - * @number standardShaderID - * @number deferredShaderID - * @treturn nil + * @param standardShaderID number + * @param deferredShaderID number + * @return nil */ int LuaUnsyncedCtrl::SetMapShader(lua_State* L) { @@ -1967,10 +1944,10 @@ int LuaUnsyncedCtrl::SetMapShader(lua_State* L) /*** @function Spring.SetMapSquareTexture - * @number texSqrX - * @number texSqrY - * @string luaTexName - * @treturn bool success + * @param texSqrX number + * @param texSqrY number + * @param luaTexName string + * @return boolean success */ int LuaUnsyncedCtrl::SetMapSquareTexture(lua_State* L) { @@ -2064,9 +2041,9 @@ static MapTextureData ParseLuaTextureData(lua_State* L, bool mapTex) /*** @function Spring.SetMapShadingTexture - * @string texType - * @string texName - * @treturn bool success + * @param texType string + * @param texName string + * @return boolean success * @usage Spring.SetMapShadingTexture("$ssmf_specular", "name_of_my_shiny_texture") */ int LuaUnsyncedCtrl::SetMapShadingTexture(lua_State* L) @@ -2085,8 +2062,8 @@ int LuaUnsyncedCtrl::SetMapShadingTexture(lua_State* L) /*** @function Spring.SetSkyBoxTexture - * @string texName - * @treturn nil + * @param texName string + * @return nil */ int LuaUnsyncedCtrl::SetSkyBoxTexture(lua_State* L) { @@ -2109,9 +2086,9 @@ int LuaUnsyncedCtrl::SetSkyBoxTexture(lua_State* L) /*** * * @function Spring.SetUnitNoDraw - * @number unitID - * @bool noDraw - * @treturn nil + * @param unitID number + * @param noDraw boolean + * @return nil */ int LuaUnsyncedCtrl::SetUnitNoDraw(lua_State* L) { @@ -2128,9 +2105,9 @@ int LuaUnsyncedCtrl::SetUnitNoDraw(lua_State* L) /*** * * @function Spring.SetUnitEngineDrawMask - * @number unitID - * @number drawMask - * @treturn nil + * @param unitID number + * @param drawMask number + * @return nil */ int LuaUnsyncedCtrl::SetUnitEngineDrawMask(lua_State* L) { @@ -2147,9 +2124,9 @@ int LuaUnsyncedCtrl::SetUnitEngineDrawMask(lua_State* L) /*** * * @function Spring.SetUnitAlwaysUpdateMatrix - * @number unitID - * @bool alwaysUpdateMatrix - * @treturn nil + * @param unitID number + * @param alwaysUpdateMatrix boolean + * @return nil */ int LuaUnsyncedCtrl::SetUnitAlwaysUpdateMatrix(lua_State* L) { @@ -2166,9 +2143,9 @@ int LuaUnsyncedCtrl::SetUnitAlwaysUpdateMatrix(lua_State* L) /*** * * @function Spring.SetUnitNoMinimap - * @number unitID - * @bool unitNoMinimap - * @treturn nil + * @param unitID number + * @param unitNoMinimap boolean + * @return nil */ int LuaUnsyncedCtrl::SetUnitNoMinimap(lua_State* L) { @@ -2185,9 +2162,9 @@ int LuaUnsyncedCtrl::SetUnitNoMinimap(lua_State* L) /*** * * @function Spring.SetUnitNoSelect - * @number unitID - * @bool unitNoSelect whether unit can be selected or not - * @treturn nil + * @param unitID number + * @param unitNoSelect boolean whether unit can be selected or not + * @return nil */ int LuaUnsyncedCtrl::SetUnitNoSelect(lua_State* L) { @@ -2213,9 +2190,9 @@ int LuaUnsyncedCtrl::SetUnitNoSelect(lua_State* L) /*** * * @function Spring.SetUnitLeaveTracks - * @number unitID - * @bool unitLeaveTracks whether unit leaves tracks on movement - * @treturn nil + * @param unitID number + * @param unitLeaveTracks boolean whether unit leaves tracks on movement + * @return nil */ int LuaUnsyncedCtrl::SetUnitLeaveTracks(lua_State* L) { @@ -2232,18 +2209,18 @@ int LuaUnsyncedCtrl::SetUnitLeaveTracks(lua_State* L) /*** * * @function Spring.SetUnitSelectionVolumeData - * @number unitID - * @number featureID - * @number scaleX - * @number scaleY - * @number scaleZ - * @number offsetX - * @number offsetY - * @number offsetZ - * @number vType - * @number tType - * @number Axis - * @treturn nil + * @param unitID number + * @param featureID number + * @param scaleX number + * @param scaleY number + * @param scaleZ number + * @param offsetX number + * @param offsetY number + * @param offsetZ number + * @param vType number + * @param tType number + * @param Axis number + * @return nil */ int LuaUnsyncedCtrl::SetUnitSelectionVolumeData(lua_State* L) { @@ -2266,10 +2243,10 @@ int LuaUnsyncedCtrl::SetUnitSelectionVolumeData(lua_State* L) * * @function Spring.SetFeatureNoDraw * - * @number featureID - * @bool noDraw + * @param featureID number + * @param noDraw boolean * - * @treturn nil + * @return nil */ int LuaUnsyncedCtrl::SetFeatureNoDraw(lua_State* L) { @@ -2286,9 +2263,9 @@ int LuaUnsyncedCtrl::SetFeatureNoDraw(lua_State* L) /*** * * @function Spring.SetFeatureEngineDrawMask - * @number featureID - * @number engineDrawMask - * @treturn nil + * @param featureID number + * @param engineDrawMask number + * @return nil */ int LuaUnsyncedCtrl::SetFeatureEngineDrawMask(lua_State* L) { @@ -2305,9 +2282,9 @@ int LuaUnsyncedCtrl::SetFeatureEngineDrawMask(lua_State* L) /*** * * @function Spring.SetFeatureAlwaysUpdateMatrix - * @number featureID - * @number alwaysUpdateMat - * @treturn nil + * @param featureID number + * @param alwaysUpdateMat number + * @return nil */ int LuaUnsyncedCtrl::SetFeatureAlwaysUpdateMatrix(lua_State* L) { @@ -2325,10 +2302,10 @@ int LuaUnsyncedCtrl::SetFeatureAlwaysUpdateMatrix(lua_State* L) * * @function Spring.SetFeatureFade * - * @number featureID - * @bool allow + * @param featureID number + * @param allow boolean * - * @treturn nil + * @return nil */ int LuaUnsyncedCtrl::SetFeatureFade(lua_State* L) { @@ -2346,17 +2323,17 @@ int LuaUnsyncedCtrl::SetFeatureFade(lua_State* L) * * @function Spring.SetFeatureSelectionVolumeData * - * @number featureID - * @number scaleX - * @number scaleY - * @number scaleZ - * @number offsetX - * @number offsetY - * @number offsetZ - * @number vType - * @number tType - * @number Axis - * @treturn nil + * @param featureID number + * @param scaleX number + * @param scaleY number + * @param scaleZ number + * @param offsetX number + * @param offsetY number + * @param offsetZ number + * @param vType number + * @param tType number + * @param Axis number + * @return nil */ int LuaUnsyncedCtrl::SetFeatureSelectionVolumeData(lua_State* L) { @@ -2380,13 +2357,13 @@ int LuaUnsyncedCtrl::SetFeatureSelectionVolumeData(lua_State* L) * * @function Spring.AddUnitIcon * - * @string iconName - * @string texFile - * @number[opt] size - * @number[opt] dist - * @number[opt] radAdjust + * @param iconName string + * @param texFile string + * @param size number? + * @param dist number? + * @param radAdjust number? * - * @treturn ?nil|bool added + * @return boolean added */ int LuaUnsyncedCtrl::AddUnitIcon(lua_State* L) { @@ -2410,9 +2387,9 @@ int LuaUnsyncedCtrl::AddUnitIcon(lua_State* L) * * @function Spring.FreeUnitIcon * - * @string iconName + * @param iconName string * - * @treturn ?nil|bool freed + * @return boolean? freed */ int LuaUnsyncedCtrl::FreeUnitIcon(lua_State* L) { @@ -2427,11 +2404,11 @@ int LuaUnsyncedCtrl::FreeUnitIcon(lua_State* L) /*** * * @function Spring.UnitIconSetDraw - * Deprecated: use Spring.SetUnitIconDraw instead. - * @see Spring.SetUnitIconDraw - * @number unitID - * @bool drawIcon - * @treturn nil + * Use Spring.SetUnitIconDraw instead. + * @deprecated + * @param unitID number + * @param drawIcon boolean + * @return nil */ int LuaUnsyncedCtrl::UnitIconSetDraw(lua_State* L) { @@ -2467,10 +2444,10 @@ int LuaUnsyncedCtrl::SetUnitIconDraw(lua_State* L) * * @function Spring.SetUnitDefIcon * - * @number unitDefID - * @string iconName + * @param unitDefID number + * @param iconName string * - * @treturn nil + * @return nil */ int LuaUnsyncedCtrl::SetUnitDefIcon(lua_State* L) { @@ -2507,10 +2484,10 @@ int LuaUnsyncedCtrl::SetUnitDefIcon(lua_State* L) * * @function Spring.SetUnitDefImage * - * @number unitDefID - * @string image luaTexture|texFile + * @param unitDefID number + * @param image string luaTexture|texFile * - * @treturn nil + * @return nil */ int LuaUnsyncedCtrl::SetUnitDefImage(lua_State* L) { @@ -2558,8 +2535,8 @@ int LuaUnsyncedCtrl::SetUnitDefImage(lua_State* L) /*** * * @function Spring.ExtractModArchiveFile - * @string modfile - * @treturn bool extracted + * @param modfile string + * @return boolean extracted */ int LuaUnsyncedCtrl::ExtractModArchiveFile(lua_State* L) { @@ -2622,8 +2599,8 @@ int LuaUnsyncedCtrl::ExtractModArchiveFile(lua_State* L) /*** * * @function Spring.CreateDir - * @string path - * @treturn ?nil|bool dirCreated + * @param path string + * @return boolean? dirCreated */ int LuaUnsyncedCtrl::CreateDir(lua_State* L) { @@ -2697,22 +2674,23 @@ static int SetActiveCommandByAction(lua_State* L) } -/*** @function Spring.SetActiveCommand - * @string action - * @string[opt] actionExtra - * @treturn ?nil|bool commandSet +/*** + * @function Spring.SetActiveCommand + * @param action string + * @param actionExtra string? + * @return boolean? commandSet */ /*** @function Spring.SetActiveCommand - * @number cmdIndex - * @number[opt=1] button - * @bool[opt] leftClick - * @tparam ?bool rightClick - * @tparam ?bool alt - * @tparam ?bool ctrl - * @tparam ?bool meta - * @tparam ?bool shift - * @treturn ?nil|bool commandSet + * @param cmdIndex number + * @param button number? (Default: 1) + * @param leftClick boolean? + * @param rightClick boolean? + * @param alt boolean? + * @param ctrl boolean? + * @param meta boolean? + * @param shift boolean? + * @return boolean? commandSet */ int LuaUnsyncedCtrl::SetActiveCommand(lua_State* L) { @@ -2736,8 +2714,8 @@ int LuaUnsyncedCtrl::SetActiveCommand(lua_State* L) /*** @function Spring.LoadCmdColorsConfig - * @string config - * @treturn nil + * @param config string + * @return nil */ int LuaUnsyncedCtrl::LoadCmdColorsConfig(lua_State* L) { @@ -2747,8 +2725,8 @@ int LuaUnsyncedCtrl::LoadCmdColorsConfig(lua_State* L) /*** @function Spring.LoadCtrlPanelConfig - * @string config - * @treturn nil + * @param config string + * @return nil */ int LuaUnsyncedCtrl::LoadCtrlPanelConfig(lua_State* L) { @@ -2761,7 +2739,7 @@ int LuaUnsyncedCtrl::LoadCtrlPanelConfig(lua_State* L) /*** @function Spring.ForceLayoutUpdate - * @treturn nil + * @return nil */ int LuaUnsyncedCtrl::ForceLayoutUpdate(lua_State* L) { @@ -2776,8 +2754,8 @@ int LuaUnsyncedCtrl::ForceLayoutUpdate(lua_State* L) /*** Disables the "Selected Units x" box in the GUI. * * @function Spring.SetDrawSelectionInfo - * @bool enable - * @treturn nil + * @param enable boolean + * @return nil */ int LuaUnsyncedCtrl::SetDrawSelectionInfo(lua_State* L) { @@ -2791,8 +2769,8 @@ int LuaUnsyncedCtrl::SetDrawSelectionInfo(lua_State* L) /*** * * @function Spring.SetBoxSelectionByEngine - * @bool state - * @treturn nil + * @param state boolean + * @return nil */ int LuaUnsyncedCtrl::SetBoxSelectionByEngine(lua_State* L) { @@ -2805,11 +2783,11 @@ int LuaUnsyncedCtrl::SetBoxSelectionByEngine(lua_State* L) /*** * * @function Spring.SetTeamColor - * @number teamID - * @number r - * @number g - * @number b - * @treturn nil + * @param teamID number + * @param r number + * @param g number + * @param b number + * @return nil */ int LuaUnsyncedCtrl::SetTeamColor(lua_State* L) { @@ -2833,13 +2811,13 @@ int LuaUnsyncedCtrl::SetTeamColor(lua_State* L) * * @function Spring.AssignMouseCursor * - * @string cmdName - * @string iconFileName not the full filename, instead it is like this: + * @param cmdName string + * @param iconFileName string not the full filename, instead it is like this: * Wanted filename: Anims/cursorattack_0.bmp * => iconFileName: cursorattack - * @bool[opt=true] overwrite - * @bool[opt=false] hotSpotTopLeft - * @treturn ?nil|bool assigned + * @param overwrite boolean? (Default: true) + * @param hotSpotTopLeft boolean? (Default: false) + * @return boolean? assigned */ int LuaUnsyncedCtrl::AssignMouseCursor(lua_State* L) { @@ -2859,10 +2837,10 @@ int LuaUnsyncedCtrl::AssignMouseCursor(lua_State* L) /*** Mass replace all occurrences of the cursor in all CursorCmds. * * @function Spring.ReplaceMouseCursor - * @string oldFileName - * @string newFileName - * @bool[opt=false] hotSpotTopLeft - * @treturn ?nil|bool assigned + * @param oldFileName string + * @param newFileName string + * @param hotSpotTopLeft boolean? (Default: false) + * @return boolean? assigned */ int LuaUnsyncedCtrl::ReplaceMouseCursor(lua_State* L) { @@ -2884,9 +2862,9 @@ int LuaUnsyncedCtrl::ReplaceMouseCursor(lua_State* L) /*** Register your custom cmd so it gets visible in the unit's cmd queue * * @function Spring.SetCustomCommandDrawData - * @number cmdID - * @tparam[opt] string|number cmdReference iconname | cmdID_cloneIcon - * @treturn ?nil|bool assigned + * @param cmdID number + * @tparam? string|number cmdReference iconname | cmdID_cloneIcon + * @return boolean? assigned */ int LuaUnsyncedCtrl::SetCustomCommandDrawData(lua_State* L) { @@ -2927,9 +2905,9 @@ int LuaUnsyncedCtrl::SetCustomCommandDrawData(lua_State* L) /*** @function Spring.WarpMouse - * @number x - * @number y - * @treturn nil + * @param x number + * @param y number + * @return nil */ int LuaUnsyncedCtrl::WarpMouse(lua_State* L) { @@ -2941,9 +2919,9 @@ int LuaUnsyncedCtrl::WarpMouse(lua_State* L) /*** @function Spring.SetMouseCursor - * @string cursorName - * @number[opt=1.0] cursorScale - * @treturn nil + * @param cursorName string + * @param cursorScale number? (Default: 1.0) + * @return nil */ int LuaUnsyncedCtrl::SetMouseCursor(lua_State* L) { @@ -2962,12 +2940,12 @@ int LuaUnsyncedCtrl::SetMouseCursor(lua_State* L) ******************************************************************************/ /*** @function Spring.SetLosViewColors - * @tparam table always {r,g,b} - * @tparam table LOS = {r,g,b} - * @tparam table radar = {r,g,b} - * @tparam table jam = {r,g,b} - * @tparam table radar2 = {r,g,b} - * @treturn nil + * @param always table {r,g,b} + * @param LOS table = {r,g,b} + * @param radar table = {r,g,b} + * @param jam table = {r,g,b} + * @param radar2 table = {r,g,b} + * @return nil */ int LuaUnsyncedCtrl::SetLosViewColors(lua_State* L) { @@ -3010,13 +2988,13 @@ int LuaUnsyncedCtrl::SetLosViewColors(lua_State* L) /*** * * @function Spring.SetNanoProjectileParams - * @number[opt=0] rotVal in degrees - * @number[opt=0] rotVel in degrees - * @number[opt=0] rotAcc in degrees - * @number[opt=0] rotValRng in degrees - * @number[opt=0] rotVelRng in degrees - * @number[opt=0] rotAccRng in degrees - * @treturn nil + * @param rotVal number? (Default: 0) in degrees + * @param rotVel number? (Default: 0) in degrees + * @param rotAcc number? (Default: 0) in degrees + * @param rotValRng number? (Default: 0) in degrees + * @param rotVelRng number? (Default: 0) in degrees + * @param rotAccRng number? (Default: 0) in degrees + * @return nil */ int LuaUnsyncedCtrl::SetNanoProjectileParams(lua_State* L) { @@ -3044,10 +3022,10 @@ int LuaUnsyncedCtrl::SetNanoProjectileParams(lua_State* L) /*** * * @function Spring.SetConfigInt - * @string name - * @number value - * @bool[opt=false] useOverlay the value will only be set in memory, and not be restored for the next game. - * @treturn nil + * @param name string + * @param value number + * @param useOverlay boolean? (Default: false) the value will only be set in memory, and not be restored for the next game. + * @return nil */ int LuaUnsyncedCtrl::SetConfigInt(lua_State* L) { @@ -3072,10 +3050,10 @@ int LuaUnsyncedCtrl::SetConfigInt(lua_State* L) /*** * * @function Spring.SetConfigFloat - * @string name - * @number value - * @bool[opt=false] useOverla the value will only be set in memory, and not be restored for the next game.y - * @treturn nil + * @param name string + * @param value number + * @param useOverla boolean? (Default: false) the value will only be set in memory, and not be restored for the next game.y + * @return nil */ int LuaUnsyncedCtrl::SetConfigFloat(lua_State* L) { @@ -3095,10 +3073,10 @@ int LuaUnsyncedCtrl::SetConfigFloat(lua_State* L) /*** * * @function Spring.SetConfigString - * @string name - * @number value - * @bool[opt=false] useOverlay the value will only be set in memory, and not be restored for the next game. - * @treturn nil + * @param name string + * @param value number + * @param useOverlay boolean? (Default: false) the value will only be set in memory, and not be restored for the next game. + * @return nil */ int LuaUnsyncedCtrl::SetConfigString(lua_State* L) { @@ -3173,7 +3151,7 @@ static int ReloadOrRestart(const std::string& springArgs, const std::string& scr /*** Closes the application * * @function Spring.Quit - * @treturn nil + * @return nil */ int LuaUnsyncedCtrl::Quit(lua_State* L) { @@ -3189,9 +3167,9 @@ int LuaUnsyncedCtrl::Quit(lua_State* L) /*** * * @function Spring.SetUnitGroup - * @number unitID - * @number groupID the group number to be assigned, or -1 for deassignment - * @treturn nil + * @param unitID number + * @param groupID number the group number to be assigned, or -1 for deassignment + * @return nil */ int LuaUnsyncedCtrl::SetUnitGroup(lua_State* L) { @@ -3283,26 +3261,26 @@ static bool CanGiveOrders(const lua_State* L) /*** Command Options params * - * @table cmdOpts + * @class cmdOpts * * Can be specified as a table, or as an array containing any of the keys * below. * - * @tparam bool right Right mouse key pressed - * @tparam bool alt Alt key pressed - * @tparam bool ctrl Ctrl key pressed - * @tparam bool shift Shift key pressed - * @tparam bool meta Meta (windows/mac/mod4) key pressed + * @field right boolean Right mouse key pressed + * @field alt boolean Alt key pressed + * @field ctrl boolean Ctrl key pressed + * @field shift boolean Shift key pressed + * @field meta boolean Meta (windows/mac/mod4) key pressed */ /*** * * @function Spring.GiveOrder - * @number cmdID - * @tparam table params - * @tparam cmdOpts options - * @treturn nil|true + * @param cmdID number + * @param params table + * @param options cmdOpts + * @return nil|true */ int LuaUnsyncedCtrl::GiveOrder(lua_State* L) { @@ -3319,11 +3297,11 @@ int LuaUnsyncedCtrl::GiveOrder(lua_State* L) /*** * * @function Spring.GiveOrderToUnit - * @number unitID - * @number cmdID - * @tparam table params - * @tparam cmdOpts options - * @treturn nil|true + * @param unitID number + * @param cmdID number + * @param params table + * @param options cmdOpts + * @return nil|true */ int LuaUnsyncedCtrl::GiveOrderToUnit(lua_State* L) { @@ -3351,11 +3329,11 @@ int LuaUnsyncedCtrl::GiveOrderToUnit(lua_State* L) /*** * * @function Spring.GiveOrderToUnitMap - * @tparam table unitMap { [unitID] = arg1, ... } - * @number cmdID - * @tparam table params - * @tparam cmdOpts options - * @treturn nil|true + * @param unitMap table { [unitID] = arg1, ... } + * @param cmdID number + * @param params table + * @param options cmdOpts + * @return nil|true */ int LuaUnsyncedCtrl::GiveOrderToUnitMap(lua_State* L) { @@ -3383,11 +3361,11 @@ int LuaUnsyncedCtrl::GiveOrderToUnitMap(lua_State* L) /*** * * @function Spring.GiveOrderToUnitArray - * @tparam {number,...} unitArray array of unit ids - * @number cmdID - * @tparam table params - * @tparam cmdOpts options - * @treturn nil|true + * @param unitArray number[] array of unit ids + * @param cmdID number + * @param params table + * @param options cmdOpts + * @return nil|true */ int LuaUnsyncedCtrl::GiveOrderToUnitArray(lua_State* L) { @@ -3411,25 +3389,12 @@ int LuaUnsyncedCtrl::GiveOrderToUnitArray(lua_State* L) return 1; } - -/*** Command spec - * - * @table cmdSpec - * - * Used when assigning multiple commands at once - * - * @number cmdID - * @tparam table params - * @tparam cmdOpts options - */ - - /*** * * @function Spring.GiveOrderArrayToUnit - * @number unitID - * @tparam {cmdSpec,...} cmdArray - * @treturn bool ordersGiven + * @param unitID number + * @param cmdArray Command[] + * @return boolean ordersGiven */ int LuaUnsyncedCtrl::GiveOrderArrayToUnit(lua_State* L) { @@ -3461,9 +3426,9 @@ int LuaUnsyncedCtrl::GiveOrderArrayToUnit(lua_State* L) /*** * * @function Spring.GiveOrderArrayToUnitMap - * @tparam table unitMap { [unitID] = arg1, ... } - * @tparam {cmdSpec,...} cmdArray - * @treturn bool ordersGiven + * @param unitMap table { [unitID] = arg1, ... } + * @param cmdArray Command[] + * @return boolean ordersGiven */ int LuaUnsyncedCtrl::GiveOrderArrayToUnitMap(lua_State* L) { @@ -3495,16 +3460,16 @@ int LuaUnsyncedCtrl::GiveOrderArrayToUnitMap(lua_State* L) /*** * * @function Spring.GiveOrderArrayToUnitArray - * @tparam {number,...} unitArray array of unit ids - * @tparam {cmdSpec,...} cmdArray - * @tparam[opt=false] bool pairwise When false, assign all commands to each unit. + * @param unitArray number[] array of unit ids + * @param cmdArray Command[] + * @tparam[opt=false] boolean pairwise When false, assign all commands to each unit. * * When true, assign commands according to index between units and cmds arrays. * * If len(unitArray) < len(cmdArray) only the first len(unitArray) commands * will be assigned, and vice-versa. * - * @treturn nil|bool + * @return nil|boolean */ int LuaUnsyncedCtrl::GiveOrderArrayToUnitArray(lua_State* L) { @@ -3538,8 +3503,8 @@ int LuaUnsyncedCtrl::GiveOrderArrayToUnitArray(lua_State* L) /*** * * @function Spring.SetBuildSpacing - * @tparam number spacing - * @treturn nil + * @param spacing number + * @return nil */ int LuaUnsyncedCtrl::SetBuildSpacing(lua_State* L) { @@ -3553,8 +3518,8 @@ int LuaUnsyncedCtrl::SetBuildSpacing(lua_State* L) /*** * * @function Spring.SetBuildFacing - * @tparam number facing - * @treturn nil + * @param facing number + * @return nil */ int LuaUnsyncedCtrl::SetBuildFacing(lua_State* L) { @@ -3573,9 +3538,9 @@ int LuaUnsyncedCtrl::SetBuildFacing(lua_State* L) /*** @function Spring.SendLuaUIMsg - * @string message - * @string mode "s"/"specs" | "a"/"allies" - * @treturn nil + * @param message string + * @param mode string "s"/"specs" | "a"/"allies" + * @return nil */ int LuaUnsyncedCtrl::SendLuaUIMsg(lua_State* L) { @@ -3598,8 +3563,8 @@ int LuaUnsyncedCtrl::SendLuaUIMsg(lua_State* L) /*** @function Spring.SendLuaGaiaMsg - * @string message - * @treturn nil + * @param message string + * @return nil */ int LuaUnsyncedCtrl::SendLuaGaiaMsg(lua_State* L) { @@ -3617,8 +3582,8 @@ int LuaUnsyncedCtrl::SendLuaGaiaMsg(lua_State* L) /*** @function Spring.SendLuaRulesMsg - * @string message - * @treturn nil + * @param message string + * @return nil */ int LuaUnsyncedCtrl::SendLuaRulesMsg(lua_State* L) { @@ -3638,7 +3603,7 @@ int LuaUnsyncedCtrl::SendLuaRulesMsg(lua_State* L) * * @function Spring.SendLuaMenuMsg * - * @string msg + * @param msg string */ int LuaUnsyncedCtrl::SendLuaMenuMsg(lua_State* L) { @@ -3659,9 +3624,9 @@ int LuaUnsyncedCtrl::SendLuaMenuMsg(lua_State* L) * * @function Spring.SetShareLevel * - * @string resource metal | energy - * @number shareLevel - * @treturn nil + * @param resource string metal | energy + * @param shareLevel number + * @return nil */ int LuaUnsyncedCtrl::SetShareLevel(lua_State* L) { @@ -3690,19 +3655,19 @@ int LuaUnsyncedCtrl::SetShareLevel(lua_State* L) * * @function Spring.ShareResources * - * @number teamID - * @string units - * @treturn nil + * @param teamID number + * @param units string + * @return nil */ /*** * * @function Spring.ShareResources * - * @number teamID - * @string resource metal | energy - * @number amount - * @treturn nil + * @param teamID number + * @param resource string metal | energy + * @param amount number + * @return nil */ int LuaUnsyncedCtrl::ShareResources(lua_State* L) { @@ -3752,10 +3717,10 @@ int LuaUnsyncedCtrl::ShareResources(lua_State* L) /*** @function Spring.SetLastMessagePosition - * @number x - * @number y - * @number z - * @treturn nil + * @param x number + * @param y number + * @param z number + * @return nil */ int LuaUnsyncedCtrl::SetLastMessagePosition(lua_State* L) { @@ -3775,12 +3740,12 @@ int LuaUnsyncedCtrl::SetLastMessagePosition(lua_State* L) /*** @function Spring.MarkerAddPoint - * @number x - * @number y - * @number z - * @string[opt=""] text - * @bool[opt] localOnly - * @treturn nil + * @param x number + * @param y number + * @param z number + * @param text string? (Default: "") + * @param localOnly boolean? + * @return nil */ int LuaUnsyncedCtrl::MarkerAddPoint(lua_State* L) { @@ -3804,15 +3769,15 @@ int LuaUnsyncedCtrl::MarkerAddPoint(lua_State* L) /*** @function Spring.MarkerAddLine - * @number x1 - * @number y1 - * @number z1 - * @number x2 - * @number y2 - * @number z2 - * @bool[opt=false] localOnly - * @number[opt] playerId - * @treturn nil + * @param x1 number + * @param y1 number + * @param z1 number + * @param x2 number + * @param y2 number + * @param z2 number + * @param localOnly boolean? (Default: false) + * @param playerId number? + * @return nil */ int LuaUnsyncedCtrl::MarkerAddLine(lua_State* L) { @@ -3841,14 +3806,14 @@ int LuaUnsyncedCtrl::MarkerAddLine(lua_State* L) * * Issue an erase command for markers on the map. * - * @number x - * @number y - * @number z - * @param noop - * @bool[opt=false] localOnly do not issue a network message, erase only for the current player - * @number[opt] playerId when not specified it uses the issuer playerId - * @bool[opt=false] alwaysErase erase any marker when `localOnly` and current player is spectating. Allows spectators to erase players markers locally - * @treturn nil + * @param x number + * @param y number + * @param z number + * @param unused nil This argument is ignored. + * @param localOnly boolean? (Default: false) do not issue a network message, erase only for the current player + * @param playerId number? when not specified it uses the issuer playerId + * @param alwaysErase boolean? (Default: false) erase any marker when `localOnly` and current player is spectating. Allows spectators to erase players markers locally + * @return nil */ int LuaUnsyncedCtrl::MarkerErasePosition(lua_State* L) { @@ -3880,17 +3845,24 @@ int LuaUnsyncedCtrl::MarkerErasePosition(lua_State* L) * @section sun ******************************************************************************/ -/*** It can be used to modify the following atmosphere parameters +/*** + * @class AtmosphereParams + * @field fogStart number + * @field fogEnd number + * @field sunColor rgba + * @field skyColor rgba + * @field cloudColor rgba + */ +/*** + * It can be used to modify the following atmosphere parameters * + * Usage: + * ```lua + * Spring.SetAtmosphere({ fogStart = 0, fogEnd = 0.5, fogColor = { 0.7, 0.2, 0.2, 1 }}) + * ``` + * * @function Spring.SetAtmosphere - * @tparam table params - * @number params.fogStart - * @number params.fogEnd - * @tparam rgb params.sunColor - * @tparam rgb params.skyColor - * @tparam rgb params.cloudColor - * @usage Spring.SetAtmosphere({ fogStart = 0, fogEnd = 0.5, fogColor = { 0.7, 0.2, 0.2, 1 }}) - * @treturn nil + * @param params AtmosphereParams */ int LuaUnsyncedCtrl::SetAtmosphere(lua_State* L) { @@ -3956,11 +3928,11 @@ int LuaUnsyncedCtrl::SetAtmosphere(lua_State* L) /*** * * @function Spring.SetSunDirection - * @number dirX - * @number dirY - * @number dirZ - * @number[opt=true] intensity - * @treturn nil + * @param dirX number + * @param dirY number + * @param dirZ number + * @param intensity number? (Default: `1.0`) + * @return nil */ int LuaUnsyncedCtrl::SetSunDirection(lua_State* L) { @@ -3971,14 +3943,15 @@ int LuaUnsyncedCtrl::SetSunDirection(lua_State* L) } -/*** It can be used to modify the following sun lighting parameters +/*** + * Modify sun lighting parameters. * + * ```lua + * Spring.SetSunLighting({groundAmbientColor = {1, 0.1, 1}, groundDiffuseColor = {1, 0.1, 1} }) + * ``` + * * @function Spring.SetSunLighting - * @tparam table params - * @tparam rgb params.groundAmbientColor - * @tparam rgb params.groundDiffuseColor - * @usage Spring.SetSunLighting({groundAmbientColor = {1, 0.1, 1}, groundDiffuseColor = {1, 0.1, 1} }) - * @treturn nil + * @param params { groundAmbientColor: rgb, groundDiffuseColor: rgb } */ int LuaUnsyncedCtrl::SetSunLighting(lua_State* L) { @@ -4018,21 +3991,20 @@ int LuaUnsyncedCtrl::SetSunLighting(lua_State* L) /*** Map rendering params * - * @table mapRenderingParams - * - * @tparam rgba splatTexMults - * @tparam rgba splatTexScales - * @bool voidWater - * @bool voidGround - * @bool splatDetailNormalDiffuseAlpha + * @class MapRenderingParams + * @field splatTexMults rgba + * @field splatTexScales rgba + * @field voidWater boolean + * @field voidGround boolean + * @field splatDetailNormalDiffuseAlpha boolean */ /*** Allows to change map rendering params at runtime. * * @function Spring.SetMapRenderingParams - * @tparam mapRenderingParams params - * @treturn nil + * @param params MapRenderingParams + * @return nil */ int LuaUnsyncedCtrl::SetMapRenderingParams(lua_State* L) { @@ -4097,9 +4069,9 @@ int LuaUnsyncedCtrl::SetMapRenderingParams(lua_State* L) /*** * * @function Spring.ForceTesselationUpdate - * @bool[opt=true] normal - * @bool[opt=false] shadow - * @treturn bool updated + * @param normal boolean? (Default: true) + * @param shadow boolean? (Default: false) + * @return boolean updated */ int LuaUnsyncedCtrl::ForceTesselationUpdate(lua_State* L) { @@ -4133,9 +4105,9 @@ int LuaUnsyncedCtrl::ForceTesselationUpdate(lua_State* L) /*** @function Spring.SendSkirmishAIMessage - * @number aiTeam - * @string message - * @treturn ?nil|bool ai_processed + * @param aiTeam number + * @param message string + * @return boolean? ai_processed */ int LuaUnsyncedCtrl::SendSkirmishAIMessage(lua_State* L) { if (CLuaHandle::GetHandleSynced(L)) @@ -4167,9 +4139,9 @@ int LuaUnsyncedCtrl::SendSkirmishAIMessage(lua_State* L) { /*** @function Spring.SetLogSectionFilterLevel - * @string sectionName - * @tparam ?string|number logLevel - * @treturn nil + * @param sectionName string + * @param logLevel ?string|number + * @return nil */ int LuaUnsyncedCtrl::SetLogSectionFilterLevel(lua_State* L) { const int loglevel = LuaUtils::ParseLogLevel(L, 2); @@ -4183,15 +4155,15 @@ int LuaUnsyncedCtrl::SetLogSectionFilterLevel(lua_State* L) { /*** @function Spring.GarbageCollectCtrl * - * @int[opt] itersPerBatch - * @int[opt] numStepsPerIter - * @int[opt] minStepsPerIter - * @int[opt] maxStepsPerIter - * @number[opt] minLoopRunTime - * @number[opt] maxLoopRunTime - * @number[opt] baseRunTimeMult - * @number[opt] baseMemLoadMult - * @treturn nil + * @int? itersPerBatch + * @int? numStepsPerIter + * @int? minStepsPerIter + * @int? maxStepsPerIter + * @param minLoopRunTime number? + * @param maxLoopRunTime number? + * @param baseRunTimeMult number? + * @param baseMemLoadMult number? + * @return nil */ int LuaUnsyncedCtrl::GarbageCollectCtrl(lua_State* L) { luaContextData* ctxData = GetLuaContextData(L); @@ -4214,8 +4186,8 @@ int LuaUnsyncedCtrl::GarbageCollectCtrl(lua_State* L) { /*** @function Spring.SetDrawSky - * @bool drawSky - * @treturn nil + * @param drawSky boolean + * @return nil */ int LuaUnsyncedCtrl::SetDrawSky(lua_State* L) { @@ -4225,8 +4197,8 @@ int LuaUnsyncedCtrl::SetDrawSky(lua_State* L) /*** @function Spring.SetDrawWater - * @bool drawWater - * @treturn nil + * @param drawWater boolean + * @return nil */ int LuaUnsyncedCtrl::SetDrawWater(lua_State* L) { @@ -4236,8 +4208,8 @@ int LuaUnsyncedCtrl::SetDrawWater(lua_State* L) /*** @function Spring.SetDrawGround - * @bool drawGround - * @treturn nil + * @param drawGround boolean + * @return nil */ int LuaUnsyncedCtrl::SetDrawGround(lua_State* L) { @@ -4247,8 +4219,8 @@ int LuaUnsyncedCtrl::SetDrawGround(lua_State* L) /*** @function Spring.SetDrawGroundDeferred - * @bool drawGroundDeferred - * @bool[opt] drawGroundForward allows disabling of the forward pass + * @param drawGroundDeferred boolean + * @param drawGroundForward boolean? allows disabling of the forward pass * treturn nil */ int LuaUnsyncedCtrl::SetDrawGroundDeferred(lua_State* L) @@ -4264,11 +4236,11 @@ int LuaUnsyncedCtrl::SetDrawGroundDeferred(lua_State* L) } /*** @function Spring.SetDrawModelsDeferred - * @bool drawUnitsDeferred - * @bool drawFeaturesDeferred - * @bool[opt] drawUnitsForward allows disabling of the respective forward passes - * @bool[opt] drawFeaturesForward allows disabling of the respective forward passes - * @treturn nil + * @param drawUnitsDeferred boolean + * @param drawFeaturesDeferred boolean + * @param drawUnitsForward boolean? allows disabling of the respective forward passes + * @param drawFeaturesForward boolean? allows disabling of the respective forward passes + * @return nil */ int LuaUnsyncedCtrl::SetDrawModelsDeferred(lua_State* L) { @@ -4290,8 +4262,8 @@ int LuaUnsyncedCtrl::SetDrawModelsDeferred(lua_State* L) /*** This doesn't actually record the game in any way, it just regulates the framerate and interpolations. * * @function Spring.SetVideoCapturingMode - * @bool allowCaptureMode - * @treturn nil + * @param allowCaptureMode boolean + * @return nil */ int LuaUnsyncedCtrl::SetVideoCapturingMode(lua_State* L) { @@ -4301,8 +4273,8 @@ int LuaUnsyncedCtrl::SetVideoCapturingMode(lua_State* L) /*** @function Spring.SetVideoCapturingTimeOffset - * @bool timeOffset - * @treturn nil + * @param timeOffset boolean + * @return nil */ int LuaUnsyncedCtrl::SetVideoCapturingTimeOffset(lua_State* L) { @@ -4311,51 +4283,60 @@ int LuaUnsyncedCtrl::SetVideoCapturingTimeOffset(lua_State* L) } -/*** Water params - * - * @table waterParams - * - * @tparam rgb absorb - * @tparam rgb baseColor - * @tparam rgb minColor - * @tparam rgb surfaceColor - * @tparam rgb diffuseColor - * @tparam rgb specularColor - * @tparam rgb planeColor - * @string texture file - * @string foamTexture file - * @string normalTexture file - * @number damage - * @number repeatX - * @number repeatY - * @number surfaceAlpha - * @number ambientFactor - * @number diffuseFactor - * @number specularFactor - * @number specularPower - * @number fresnelMin - * @number fresnelMax - * @number fresnelPower - * @number reflectionDistortion - * @number blurBase - * @number blurExponent - * @number perlinStartFreq - * @number perlinLacunarity - * @number perlinAmplitude - * @number numTiles - * @bool shoreWaves - * @bool forceRendering - * @bool hasWaterPlane - */ - - -/*** @function Spring.SetWaterParams - * - * Does not need cheating enabled. - * Allows to change water params (mostly BumpWater ones) at runtime. You may want to set BumpWaterUseUniforms in your springrc to 1, then you don't even need to restart BumpWater via `/water 4`. - * - * @tparam waterParams waterParams - * @treturn nil +/*** + * Water params + * + * @class WaterParams + * @field absorb rgb + * @field baseColor rgb + * @field minColor rgb + * @field surfaceColor rgb + * @field diffuseColor rgb + * @field specularColor rgb + * @field planeColor rgb + * @field texture string file + * @field foamTexture string file + * @field normalTexture string file + * @field damage number + * @field repeatX number + * @field repeatY number + * @field surfaceAlpha number + * @field ambientFactor number + * @field diffuseFactor number + * @field specularFactor number + * @field specularPower number + * @field fresnelMin number + * @field fresnelMax number + * @field fresnelPower number + * @field reflectionDistortion number + * @field blurBase number + * @field blurExponent number + * @field perlinStartFreq number + * @field perlinLacunarity number + * @field perlinAmplitude number + * @field windSpeed number + * @field waveOffsetFactor number + * @field waveLength number + * @field waveFoamDistortion number + * @field waveFoamIntensity number + * @field causticsResolution number + * @field causticsStrength number + * @field numTiles integer + * @field shoreWaves boolean + * @field forceRendering boolean + * @field hasWaterPlane boolean + */ + +/*** + * Does not need cheating enabled. + * + * Allows to change water params (mostly `BumpWater` ones) at runtime. You may + * want to set `BumpWaterUseUniforms` in your `springrc` to 1, then you don't even + * need to restart `BumpWater` via `/water 4`. + * + * @function Spring.SetWaterParams + * @param waterParams WaterParams + * @return nil */ int LuaUnsyncedCtrl::SetWaterParams(lua_State* L) { @@ -4571,8 +4552,8 @@ int LuaUnsyncedCtrl::SetWaterParams(lua_State* L) * Allow the engine to load the unit's model (and texture) in a background thread. * Wreckages and buildOptions of a unit are automatically preloaded. * - * @number unitDefID - * @treturn nil + * @param unitDefID number + * @return nil */ int LuaUnsyncedCtrl::PreloadUnitDefModel(lua_State* L) { const UnitDef* ud = unitDefHandler->GetUnitDefByID(luaL_checkint(L, 1)); @@ -4587,8 +4568,8 @@ int LuaUnsyncedCtrl::PreloadUnitDefModel(lua_State* L) { /*** @function Spring.PreloadFeatureDefModel * - * @number featureDefID - * @treturn nil + * @param featureDefID number + * @return nil */ int LuaUnsyncedCtrl::PreloadFeatureDefModel(lua_State* L) { const FeatureDef* fd = featureDefHandler->GetFeatureDefByID(luaL_checkint(L, 1)); @@ -4603,8 +4584,8 @@ int LuaUnsyncedCtrl::PreloadFeatureDefModel(lua_State* L) { /*** @function Spring.PreloadSoundItem * - * @string name - * @treturn nil + * @param name string + * @return nil */ int LuaUnsyncedCtrl::PreloadSoundItem(lua_State* L) { @@ -4619,8 +4600,8 @@ int LuaUnsyncedCtrl::PreloadSoundItem(lua_State* L) /*** @function Spring.LoadModelTextures * - * @string modelName - * @treturn ?nil|bool success + * @param modelName string + * @return boolean? success */ int LuaUnsyncedCtrl::LoadModelTextures(lua_State* L) { @@ -4656,7 +4637,7 @@ int LuaUnsyncedCtrl::LoadModelTextures(lua_State* L) /*** * * @function Spring.CreateGroundDecal - * @treturn nil|number decalID + * @return nil|number decalID */ int LuaUnsyncedCtrl::CreateGroundDecal(lua_State* L) { @@ -4672,8 +4653,8 @@ int LuaUnsyncedCtrl::CreateGroundDecal(lua_State* L) /*** * * @function Spring.DestroyGroundDecal - * @number decalID - * @treturn bool delSuccess + * @param decalID number + * @return boolean delSuccess */ int LuaUnsyncedCtrl::DestroyGroundDecal(lua_State* L) { @@ -4685,13 +4666,13 @@ int LuaUnsyncedCtrl::DestroyGroundDecal(lua_State* L) /*** * * @function Spring.SetGroundDecalPosAndDims - * @number decalID - * @number[opt=currMidPosX] midPosX - * @number[opt=currMidPosZ] midPosZ - * @number[opt=currSizeX] sizeX - * @number[opt=currSizeZ] sizeZ - * @number[opt=calculateProjCubeHeight] projCubeHeight - * @treturn bool decalSet + * @param decalID number + * @param midPosX number? (Default: currMidPosX) + * @param midPosZ number? (Default: currMidPosZ) + * @param sizeX number? (Default: currSizeX) + * @param sizeZ number? (Default: currSizeZ) + * @param projCubeHeight number? (Default: calculateProjCubeHeight) + * @return boolean decalSet */ int LuaUnsyncedCtrl::SetGroundDecalPosAndDims(lua_State* L) { @@ -4726,23 +4707,24 @@ int LuaUnsyncedCtrl::SetGroundDecalPosAndDims(lua_State* L) return 1; } +/*** + * @class xz + * @field x number + * @field y number + */ /*** * * @function Spring.SetGroundDecalQuadPosAndHeight * * Use for non-rectangular decals * - * @number decalID - * @number[opt=currPosTL.x] posTL.x - * @number[opt=currPosTL.z] posTL.z - * @number[opt=currPosTR.x] posTR.x - * @number[opt=currPosTR.z] posTR.z - * @number[opt=currPosBR.x] posBR.x - * @number[opt=currPosBR.z] posBR.z - * @number[opt=currPosBL.x] posBL.x - * @number[opt=currPosBL.z] posBL.z - * @number[opt=calculateProjCubeHeight] projCubeHeight - * @treturn bool decalSet + * @param decalID integer + * @param posTL xz? (Default: currPosTL) + * @param posTR xz? (Default: currPosTR) + * @param posBR xz? (Default: currPosBR) + * @param posBL xz? (Default: currPosBL) + * @param projCubeHeight number? (Default: calculateProjCubeHeight) + * @return boolean decalSet */ int LuaUnsyncedCtrl::SetGroundDecalQuadPosAndHeight(lua_State* L) { @@ -4769,9 +4751,9 @@ int LuaUnsyncedCtrl::SetGroundDecalQuadPosAndHeight(lua_State* L) /*** * * @function Spring.SetGroundDecalRotation - * @number decalID - * @number[opt=random] rot in radians - * @treturn bool decalSet + * @param decalID number + * @param rot number? (Default: random) in radians + * @return boolean decalSet */ int LuaUnsyncedCtrl::SetGroundDecalRotation(lua_State* L) { @@ -4791,10 +4773,10 @@ int LuaUnsyncedCtrl::SetGroundDecalRotation(lua_State* L) /*** * * @function Spring.SetGroundDecalTexture - * @number decalID - * @string textureName The texture has to be on the atlas which seems to mean it's defined as an explosion, unit tracks, or building plate decal on some unit already (no arbitrary textures) - * @bool[opt=true] isMainTex If false, it sets the normals/glow map - * @treturn nil|bool decalSet + * @param decalID number + * @param textureName string The texture has to be on the atlas which seems to mean it's defined as an explosion, unit tracks, or building plate decal on some unit already (no arbitrary textures) + * @param isMainTex boolean? (Default: true) If false, it sets the normals/glow map + * @return nil|boolean decalSet */ int LuaUnsyncedCtrl::SetGroundDecalTexture(lua_State* L) { @@ -4807,10 +4789,10 @@ int LuaUnsyncedCtrl::SetGroundDecalTexture(lua_State* L) /*** * * @function Spring.SetGroundDecalTextureParams - * @number decalID - * @number texWrapDistance[opt=currTexWrapDistance] if non-zero sets the mode to repeat the texture along the left-right direction of the decal every texWrapFactor elmos - * @number texTraveledDistance[opt=currTexTraveledDistance] shifts the texture repetition defined by texWrapFactor so the texture of a next line in the continuous multiline can start where the previous finished. For that it should collect all elmo lengths of the previously set multiline segments. - * @treturn nil|bool decalSet + * @param decalID number + * @param texWrapDistance number? (Default: currTexWrapDistance) if non-zero sets the mode to repeat the texture along the left-right direction of the decal every texWrapFactor elmos + * @param texTraveledDistance number? (Default: currTexTraveledDistance) shifts the texture repetition defined by texWrapFactor so the texture of a next line in the continuous multiline can start where the previous finished. For that it should collect all elmo lengths of the previously set multiline segments. + * @return nil|boolean decalSet */ int LuaUnsyncedCtrl::SetGroundDecalTextureParams(lua_State* L) { @@ -4831,10 +4813,10 @@ int LuaUnsyncedCtrl::SetGroundDecalTextureParams(lua_State* L) /*** * * @function Spring.SetGroundDecalAlpha - * @number decalID - * @number[opt=currAlpha] alpha Between 0 and 1 - * @number[opt=currAlphaFalloff] alphaFalloff Between 0 and 1, per second - * @treturn bool decalSet + * @param decalID number + * @param alpha number? (Default: currAlpha) Between 0 and 1 + * @param alphaFalloff number? (Default: currAlphaFalloff) Between 0 and 1, per second + * @return boolean decalSet */ int LuaUnsyncedCtrl::SetGroundDecalAlpha(lua_State* L) { @@ -4856,11 +4838,11 @@ int LuaUnsyncedCtrl::SetGroundDecalAlpha(lua_State* L) * @function Spring.SetGroundDecalNormal * Sets projection cube normal to orient in 3D space. * In case the normal (0,0,0) then normal is picked from the terrain - * @number decalID - * @number[opt=0] normalX - * @number[opt=0] normalY - * @number[opt=0] normalZ - * @treturn bool decalSet + * @param decalID number + * @param normalX number? (Default: 0) + * @param normalY number? (Default: 0) + * @param normalZ number? (Default: 0) + * @return boolean decalSet */ int LuaUnsyncedCtrl::SetGroundDecalNormal(lua_State* L) { @@ -4888,12 +4870,12 @@ int LuaUnsyncedCtrl::SetGroundDecalNormal(lua_State* L) * @function Spring.SetGroundDecalTint * Sets the tint of the ground decal. Color = 2 * textureColor * tintColor * Respectively a color of (0.5, 0.5, 0.5, 0.5) is effectively no tint - * @number decalID - * @number[opt=curTintColR] tintColR - * @number[opt=curTintColG] tintColG - * @number[opt=curTintColB] tintColB - * @number[opt=curTintColA] tintColA - * @treturn bool decalSet + * @param decalID number + * @param tintColR number? (Default: curTintColR) + * @param tintColG number? (Default: curTintColG) + * @param tintColB number? (Default: curTintColB) + * @param tintColA number? (Default: curTintColA) + * @return boolean decalSet */ int LuaUnsyncedCtrl::SetGroundDecalTint(lua_State* L) { @@ -4919,13 +4901,13 @@ int LuaUnsyncedCtrl::SetGroundDecalTint(lua_State* L) * * @function Spring.SetGroundDecalMisc * Sets varios secondary parameters of a decal - * @number decalID - * @number[opt=curValue] dotElimExp pow(max(dot(decalProjVector, SurfaceNormal), 0.0), dotElimExp), used to reduce decal artifacts on surfaces non-collinear with the projection vector - * @number[opt=curValue] refHeight - * @number[opt=curValue] minHeight - * @number[opt=curValue] maxHeight - * @number[opt=curValue] forceHeightMode in case forceHeightMode==1.0 ==> force relative height: midPoint.y = refHeight + clamp(midPoint.y - refHeight, minHeight); forceHeightMode==2.0 ==> force absolute height: midPoint.y = midPoint.y, clamp(midPoint.y, minHeight, maxHeight); other forceHeightMode values do not enforce the height of the center position - * @treturn bool decalSet + * @param decalID number + * @param dotElimExp number? (Default: curValue) pow(max(dot(decalProjVector, SurfaceNormal), 0.0), dotElimExp), used to reduce decal artifacts on surfaces non-collinear with the projection vector + * @param refHeight number? (Default: curValue) + * @param minHeight number? (Default: curValue) + * @param maxHeight number? (Default: curValue) + * @param forceHeightMode number? (Default: curValue) in case forceHeightMode==1.0 ==> force relative height: midPoint.y = refHeight + clamp(midPoint.y - refHeight, minHeight); forceHeightMode==2.0 ==> force absolute height: midPoint.y = midPoint.y, clamp(midPoint.y, minHeight, maxHeight); other forceHeightMode values do not enforce the height of the center position + * @return boolean decalSet */ int LuaUnsyncedCtrl::SetGroundDecalMisc(lua_State* L) { @@ -4951,10 +4933,10 @@ int LuaUnsyncedCtrl::SetGroundDecalMisc(lua_State* L) * * Use separate min and max for "gradient" style decals such as tank tracks * - * @number decalID - * @number[opt=currCreationFrameMin] creationFrameMin - * @number[opt=currCreationFrameMax] creationFrameMax - * @treturn bool decalSet + * @param decalID number + * @param creationFrameMin number? (Default: currCreationFrameMin) + * @param creationFrameMax number? (Default: currCreationFrameMax) + * @return boolean decalSet */ int LuaUnsyncedCtrl::SetGroundDecalCreationFrame(lua_State* L) { @@ -4981,11 +4963,11 @@ int LuaUnsyncedCtrl::SetGroundDecalCreationFrame(lua_State* L) /*** * * @function Spring.SDLSetTextInputRect - * @number x - * @number y - * @number width - * @number height - * @treturn nil + * @param x number + * @param y number + * @param width number + * @param height number + * @return nil */ int LuaUnsyncedCtrl::SDLSetTextInputRect(lua_State* L) { @@ -5001,7 +4983,7 @@ int LuaUnsyncedCtrl::SDLSetTextInputRect(lua_State* L) /*** * * @function Spring.SDLStartTextInput - * @treturn nil + * @return nil */ int LuaUnsyncedCtrl::SDLStartTextInput(lua_State* L) { @@ -5012,7 +4994,7 @@ int LuaUnsyncedCtrl::SDLStartTextInput(lua_State* L) /*** * * @function Spring.SDLStopTextInput - * @treturn nil + * @return nil */ int LuaUnsyncedCtrl::SDLStopTextInput(lua_State* L) { @@ -5029,14 +5011,14 @@ int LuaUnsyncedCtrl::SDLStopTextInput(lua_State* L) /*** * * @function Spring.SetWindowGeometry - * @number displayIndex - * @number winRelPosX - * @number winRelPosY - * @number winSizeX - * @number winSizeY - * @bool fullScreen - * @bool borderless - * @treturn nil + * @param displayIndex number + * @param winRelPosX number + * @param winRelPosY number + * @param winSizeX number + * @param winSizeY number + * @param fullScreen boolean + * @param borderless boolean + * @return nil */ int LuaUnsyncedCtrl::SetWindowGeometry(lua_State* L) { @@ -5059,7 +5041,7 @@ int LuaUnsyncedCtrl::SetWindowGeometry(lua_State* L) /*** * * @function Spring.SetWindowMinimized - * @treturn bool minimized + * @return boolean minimized */ int LuaUnsyncedCtrl::SetWindowMinimized(lua_State* L) { @@ -5070,7 +5052,7 @@ int LuaUnsyncedCtrl::SetWindowMinimized(lua_State* L) /*** * * @function Spring.SetWindowMaximized - * @treturn bool maximized + * @return boolean maximized */ int LuaUnsyncedCtrl::SetWindowMaximized(lua_State* L) { @@ -5086,8 +5068,8 @@ int LuaUnsyncedCtrl::SetWindowMaximized(lua_State* L) /*** @function Spring.Reload - * @string startScript the CONTENT of the script.txt spring should use to start. - * @treturn nil + * @param startScript string the CONTENT of the script.txt spring should use to start. + * @return nil */ int LuaUnsyncedCtrl::Reload(lua_State* L) { @@ -5099,9 +5081,9 @@ int LuaUnsyncedCtrl::Reload(lua_State* L) * * If this call returns, something went wrong * - * @string commandline_args commandline arguments passed to spring executable. - * @string startScript - * @treturn nil + * @param commandline_args string commandline arguments passed to spring executable. + * @param startScript string + * @return nil */ int LuaUnsyncedCtrl::Restart(lua_State* L) { @@ -5116,9 +5098,9 @@ int LuaUnsyncedCtrl::Restart(lua_State* L) * * If this call returns, something went wrong * - * @string commandline_args commandline arguments passed to spring executable. - * @string startScript the CONTENT of the script.txt spring should use to start (if empty, no start-script is added, you can still point spring to your custom script.txt when you add the file-path to commandline_args. - * @treturn nil + * @param commandline_args string commandline arguments passed to spring executable. + * @param startScript string the CONTENT of the script.txt spring should use to start (if empty, no start-script is added, you can still point spring to your custom script.txt when you add the file-path to commandline_args. + * @return nil */ int LuaUnsyncedCtrl::Start(lua_State* L) { @@ -5140,8 +5122,8 @@ int LuaUnsyncedCtrl::Start(lua_State* L) * Note: *.bmp images have to be in BGR format (default for m$ ones). * Note: *.ico images are not supported. * - * @string iconFileName - * @treturn nil + * @param iconFileName string + * @return nil */ int LuaUnsyncedCtrl::SetWMIcon(lua_State* L) { @@ -5168,9 +5150,9 @@ int LuaUnsyncedCtrl::SetWMIcon(lua_State* L) * * NOTE: shortTitle is only ever possibly used under X11 (Linux & OS X), but not with QT (KDE) and never under Windows. * - * @string title - * @string[opt=title] titleShort - * @treturn nil + * @param title string + * @param titleShort string? (Default: title) + * @return nil */ int LuaUnsyncedCtrl::SetWMCaption(lua_State* L) { @@ -5180,8 +5162,8 @@ int LuaUnsyncedCtrl::SetWMCaption(lua_State* L) /*** @function Spring.ClearWatchDogTimer - * @string[opt=main] threadName - * @treturn nil + * @param threadName string? (Default: main) + * @return nil */ int LuaUnsyncedCtrl::ClearWatchDogTimer(lua_State* L) { if (lua_gettop(L) == 0) { @@ -5201,8 +5183,8 @@ int LuaUnsyncedCtrl::ClearWatchDogTimer(lua_State* L) { /*** @function Spring.SetClipboard - * @string text - * @treturn nil + * @param text string + * @return nil */ int LuaUnsyncedCtrl::SetClipboard(lua_State* L) { @@ -5224,7 +5206,7 @@ int LuaUnsyncedCtrl::SetClipboard(lua_State* L) * wantYield = wantYield and Spring.Yield() * end * - * @treturn bool when true caller should continue calling `Spring.Yield` during the widgets/gadgets load, when false it shouldn't call it any longer. + * @return boolean when true caller should continue calling `Spring.Yield` during the widgets/gadgets load, when false it shouldn't call it any longer. */ int LuaUnsyncedCtrl::Yield(lua_State* L) { diff --git a/rts/Lua/LuaUnsyncedRead.cpp b/rts/Lua/LuaUnsyncedRead.cpp index 8ce2e17e85..e4034ac2ef 100644 --- a/rts/Lua/LuaUnsyncedRead.cpp +++ b/rts/Lua/LuaUnsyncedRead.cpp @@ -91,7 +91,6 @@ /****************************************************************************** * Callouts to get state * - * @module UnsyncedRead * @see rts/Lua/LuaUnsyncedRead.cpp ******************************************************************************/ @@ -465,7 +464,7 @@ static size_t PushSparseUnitTallyByDef(lua_State *const L, const T &v) * * @function Spring.IsReplay * - * @treturn ?nil|bool isReplay + * @return boolean? isReplay */ int LuaUnsyncedRead::IsReplay(lua_State* L) { @@ -478,7 +477,7 @@ int LuaUnsyncedRead::IsReplay(lua_State* L) * * @function Spring.GetReplayLength * - * @treturn ?nil|number timeInSeconds + * @return number? timeInSeconds */ int LuaUnsyncedRead::GetReplayLength(lua_State* L) { @@ -498,7 +497,7 @@ int LuaUnsyncedRead::GetReplayLength(lua_State* L) * * @function Spring.GetGameName * - * @treturn string name + * @return string name */ int LuaUnsyncedRead::GetGameName(lua_State* L) { @@ -510,7 +509,7 @@ int LuaUnsyncedRead::GetGameName(lua_State* L) * * @function Spring.GetMenuName * - * @treturn string name name .. version from Modinfo.lua. E.g. "Spring: 1944 test-5640-ac2d15b". + * @return string name name .. version from Modinfo.lua. E.g. "Spring: 1944 test-5640-ac2d15b". */ int LuaUnsyncedRead::GetMenuName(lua_State* L) { @@ -529,15 +528,15 @@ int LuaUnsyncedRead::GetMenuName(lua_State* L) * * @function Spring.GetProfilerTimeRecord * - * @string profilerName - * @bool[opt=false] frameData + * @param profilerName string + * @param frameData boolean? (Default: false) * - * @treturn number total in ms - * @treturn number current in ms - * @treturn number max_dt - * @treturn number time_pct - * @treturn number peak_pct - * @treturn ?nil|{[number]=number,...} frameData where key is the frame index and value is duration + * @return number total in ms + * @return number current in ms + * @return number max_dt + * @return number time_pct + * @return number peak_pct + * @return table? frameData Table where key is the frame index and value is duration. */ int LuaUnsyncedRead::GetProfilerTimeRecord(lua_State* L) { @@ -566,7 +565,7 @@ int LuaUnsyncedRead::GetProfilerTimeRecord(lua_State* L) * * @function Spring.GetProfilerRecordNames * - * @treturn {string,...} profilerNames + * @return string[] profilerNames */ int LuaUnsyncedRead::GetProfilerRecordNames(lua_State* L) { @@ -588,14 +587,14 @@ int LuaUnsyncedRead::GetProfilerRecordNames(lua_State* L) * * @function Spring.GetLuaMemUsage * - * @treturn number luaHandleAllocedMem in kilobytes - * @treturn number luaHandleNumAllocs divided by 1000 - * @treturn number luaGlobalAllocedMem in kilobytes - * @treturn number luaGlobalNumAllocs divided by 1000 - * @treturn number luaUnsyncedGlobalAllocedMem in kilobytes - * @treturn number luaUnsyncedGlobalNumAllocs divided by 1000 - * @treturn number luaSyncedGlobalAllocedMem in kilobytes - * @treturn number luaSyncedGlobalNumAllocs divided by 1000 + * @return number luaHandleAllocedMem in kilobytes + * @return number luaHandleNumAllocs divided by 1000 + * @return number luaGlobalAllocedMem in kilobytes + * @return number luaGlobalNumAllocs divided by 1000 + * @return number luaUnsyncedGlobalAllocedMem in kilobytes + * @return number luaUnsyncedGlobalNumAllocs divided by 1000 + * @return number luaSyncedGlobalAllocedMem in kilobytes + * @return number luaSyncedGlobalNumAllocs divided by 1000 */ int LuaUnsyncedRead::GetLuaMemUsage(lua_State* L) { @@ -639,8 +638,8 @@ int LuaUnsyncedRead::GetLuaMemUsage(lua_State* L) * * @function Spring.GetVidMemUsage * - * @treturn number usedMem in MB - * @treturn number availableMem in MB + * @return number usedMem in MB + * @return number availableMem in MB */ int LuaUnsyncedRead::GetVidMemUsage(lua_State* L) { @@ -689,15 +688,10 @@ static void PushTimer(lua_State* L, const spring_time& time, bool microseconds) lua_pushlightuserdata(L, reinterpret_cast(p)); } -/*** - * @type Timer - */ - - /*** Get a timer with millisecond resolution * * @function Spring.GetTimer - * @treturn Timer + * @return integer */ int LuaUnsyncedRead::GetTimer(lua_State* L) { @@ -709,7 +703,7 @@ int LuaUnsyncedRead::GetTimer(lua_State* L) /*** Get a timer with microsecond resolution * * @function Spring.GetTimerMicros - * @treturn Timer + * @return integer */ int LuaUnsyncedRead::GetTimerMicros(lua_State* L) { @@ -724,8 +718,8 @@ int LuaUnsyncedRead::GetTimerMicros(lua_State* L) * * This should give better results for camera interpolations * - * @bool[opt=false] lastFrameTime whether to use last frame time instead of last frame start - * @treturn Timer + * @param lastFrameTime boolean? (Default: false) whether to use last frame time instead of last frame start + * @return integer */ int LuaUnsyncedRead::GetFrameTimer(lua_State* L) { @@ -741,11 +735,11 @@ int LuaUnsyncedRead::GetFrameTimer(lua_State* L) /*** * * @function Spring.DiffTimers - * @tparam Timer endTimer - * @tparam Timer startTimer - * @bool[opt=false] returnMs whether to return `timeAmount` in milliseconds as opposed to seconds - * @bool[opt=false] fromMicroSecs whether timers are in microseconds instead of milliseconds - * @treturn number timeAmount + * @param endTimer integer + * @param startTimer integer + * @param returnMs boolean? (Default: false) whether to return `timeAmount` in milliseconds as opposed to seconds + * @param fromMicroSecs boolean? (Default: false) whether timers are in microseconds instead of milliseconds + * @return number timeAmount */ int LuaUnsyncedRead::DiffTimers(lua_State* L) { @@ -800,7 +794,7 @@ int LuaUnsyncedRead::DiffTimers(lua_State* L) * * @function Spring.GetNumDisplays * - * @treturn number numDisplays as returned by `SDL_GetNumVideoDisplays` + * @return number numDisplays as returned by `SDL_GetNumVideoDisplays` */ int LuaUnsyncedRead::GetNumDisplays(lua_State* L) { @@ -813,10 +807,10 @@ int LuaUnsyncedRead::GetNumDisplays(lua_State* L) * * @function Spring.GetViewGeometry * - * @treturn number viewSizeX in px - * @treturn number viewSizeY in px - * @treturn number viewPosX offset from leftmost screen left border in px - * @treturn number viewPosY offset from bottommost screen bottom border in px + * @return number viewSizeX in px + * @return number viewSizeY in px + * @return number viewPosX offset from leftmost screen left border in px + * @return number viewPosY offset from bottommost screen bottom border in px */ int LuaUnsyncedRead::GetViewGeometry(lua_State* L) { @@ -832,10 +826,10 @@ int LuaUnsyncedRead::GetViewGeometry(lua_State* L) * * @function Spring.GetDualViewGeometry * - * @treturn number dualViewSizeX in px - * @treturn number dualViewSizeY in px - * @treturn number dualViewPosX offset from leftmost screen left border in px - * @treturn number dualViewPosY offset from bottommost screen bottom border in px + * @return number dualViewSizeX in px + * @return number dualViewSizeY in px + * @return number dualViewPosX offset from leftmost screen left border in px + * @return number dualViewPosY offset from bottommost screen bottom border in px */ int LuaUnsyncedRead::GetDualViewGeometry(lua_State* L) { @@ -851,14 +845,14 @@ int LuaUnsyncedRead::GetDualViewGeometry(lua_State* L) * * @function Spring.GetWindowGeometry * - * @treturn number winSizeX in px - * @treturn number winSizeY in px - * @treturn number winPosX in px - * @treturn number winPosY in px - * @treturn number windowBorderTop in px - * @treturn number windowBorderLeft in px - * @treturn number windowBorderBottom in px - * @treturn number windowBorderRight in px + * @return number winSizeX in px + * @return number winSizeY in px + * @return number winPosX in px + * @return number winPosY in px + * @return number windowBorderTop in px + * @return number windowBorderLeft in px + * @return number windowBorderBottom in px + * @return number windowBorderRight in px */ int LuaUnsyncedRead::GetWindowGeometry(lua_State* L) { @@ -880,10 +874,10 @@ int LuaUnsyncedRead::GetWindowGeometry(lua_State* L) /*** Get main window display mode * * @function Spring.GetWindowDisplayMode - * @treturn number width in px - * @treturn number height in px - * @treturn number bits per pixel - * @treturn number refresh rate in Hz + * @return number width in px + * @return number height in px + * @return number bits per pixel + * @return number refresh rate in Hz */ int LuaUnsyncedRead::GetWindowDisplayMode(lua_State* L) { @@ -904,21 +898,21 @@ int LuaUnsyncedRead::GetWindowDisplayMode(lua_State* L) * * @function Spring.GetScreenGeometry * - * @number[opt=-1] displayIndex - * @bool[opt=false] queryUsable - * - * @treturn number screenSizeX in px - * @treturn number screenSizeY in px - * @treturn number screenPosX in px - * @treturn number screenPosY in px - * @treturn number windowBorderTop in px - * @treturn number windowBorderLeft in px - * @treturn number windowBorderBottom in px - * @treturn number windowBorderRight in px - * @treturn ?nil|number screenUsableSizeX in px - * @treturn ?nil|number screenUsableSizeY in px - * @treturn ?nil|number screenUsablePosX in px - * @treturn ?nil|number screenUsablePosY in px + * @param displayIndex number? (Default: -1) + * @param queryUsable boolean? (Default: false) + * + * @return number screenSizeX in px + * @return number screenSizeY in px + * @return number screenPosX in px + * @return number screenPosY in px + * @return number windowBorderTop in px + * @return number windowBorderLeft in px + * @return number windowBorderBottom in px + * @return number windowBorderRight in px + * @return number? screenUsableSizeX in px + * @return number? screenUsableSizeY in px + * @return number? screenUsablePosX in px + * @return number? screenUsablePosY in px */ int LuaUnsyncedRead::GetScreenGeometry(lua_State* L) { @@ -961,12 +955,12 @@ int LuaUnsyncedRead::GetScreenGeometry(lua_State* L) * * @function Spring.GetMiniMapGeometry * - * @treturn number minimapPosX in px - * @treturn number minimapPosY in px - * @treturn number minimapSizeX in px - * @treturn number minimapSizeY in px - * @treturn bool minimized - * @treturn bool maximized + * @return number minimapPosX in px + * @return number minimapPosY in px + * @return number minimapSizeX in px + * @return number minimapSizeY in px + * @return boolean minimized + * @return boolean maximized */ int LuaUnsyncedRead::GetMiniMapGeometry(lua_State* L) { @@ -987,7 +981,7 @@ int LuaUnsyncedRead::GetMiniMapGeometry(lua_State* L) /*** Get minimap rotation * * @function Spring.GetMiniMapRotation - * @treturn number amount in radians + * @return number amount in radians */ int LuaUnsyncedRead::GetMiniMapRotation(lua_State* L) { @@ -1003,7 +997,7 @@ int LuaUnsyncedRead::GetMiniMapRotation(lua_State* L) /*** * * @function Spring.GetMiniMapDualScreen - * @treturn string|false position "left"|"right" when dual screen is enabled, false when not + * @return string|false position "left"|"right" when dual screen is enabled, false when not */ int LuaUnsyncedRead::GetMiniMapDualScreen(lua_State* L) { @@ -1029,10 +1023,10 @@ int LuaUnsyncedRead::GetMiniMapDualScreen(lua_State* L) * * Returns nil when selection box is inactive * - * @treturn ?nil|number left - * @treturn ?nil|number top - * @treturn ?nil|number right - * @treturn ?nil|number bottom + * @return number? left + * @return number? top + * @return number? right + * @return number? bottom * * @see Spring.GetUnitsInScreenRectangle */ @@ -1060,7 +1054,7 @@ int LuaUnsyncedRead::GetSelectionBox(lua_State* L) /*** * * @function Spring.GetDrawSelectionInfo - * @treturn bool + * @return boolean */ int LuaUnsyncedRead::GetDrawSelectionInfo(lua_State* L) { @@ -1073,10 +1067,10 @@ int LuaUnsyncedRead::GetDrawSelectionInfo(lua_State* L) * * @function Spring.IsAboveMiniMap * - * @number x - * @number y + * @param x number + * @param y number * - * @treturn bool isAbove + * @return boolean isAbove */ int LuaUnsyncedRead::IsAboveMiniMap(lua_State* L) { @@ -1105,8 +1099,8 @@ int LuaUnsyncedRead::IsAboveMiniMap(lua_State* L) * * @function Spring.GetDrawFrame * - * @treturn number low_16bit - * @treturn number high_16bit + * @return number low_16bit + * @return number high_16bit */ int LuaUnsyncedRead::GetDrawFrame(lua_State* L) { @@ -1126,7 +1120,7 @@ int LuaUnsyncedRead::GetDrawFrame(lua_State* L) * When draw frames are not integer multiples of sim frames, some interpolation * happens, and this timeoffset shows how far along it is. * - * @treturn nil|number offset of the current draw frame from the last sim frame, expressed in fractions of a frame + * @return number? offset of the current draw frame from the last sim frame, expressed in fractions of a frame */ int LuaUnsyncedRead::GetFrameTimeOffset(lua_State* L) { @@ -1138,7 +1132,7 @@ int LuaUnsyncedRead::GetFrameTimeOffset(lua_State* L) * * Returns the game time, taking the interpolated draw frame into account. * - * @treturn number game time in seconds + * @return number game time in seconds */ int LuaUnsyncedRead::GetGameSecondsInterpolated(lua_State* L) { @@ -1150,7 +1144,7 @@ int LuaUnsyncedRead::GetGameSecondsInterpolated(lua_State* L) * * @function Spring.GetLastUpdateSeconds * - * @treturn nil|number lastUpdateSeconds + * @return number? lastUpdateSeconds */ int LuaUnsyncedRead::GetLastUpdateSeconds(lua_State* L) { @@ -1163,7 +1157,7 @@ int LuaUnsyncedRead::GetLastUpdateSeconds(lua_State* L) * * @function Spring.GetVideoCapturingMode * - * @treturn bool allowRecord + * @return boolean allowRecord */ int LuaUnsyncedRead::GetVideoCapturingMode(lua_State* L) { @@ -1181,8 +1175,8 @@ int LuaUnsyncedRead::GetVideoCapturingMode(lua_State* L) /*** * * @function Spring.IsUnitAllied - * @number unitID - * @treturn nil|bool isAllied nil with unitID cannot be parsed + * @param unitID integer + * @return boolean? isAllied nil with unitID cannot be parsed */ int LuaUnsyncedRead::IsUnitAllied(lua_State* L) { @@ -1205,8 +1199,8 @@ int LuaUnsyncedRead::IsUnitAllied(lua_State* L) /*** * * @function Spring.IsUnitSelected - * @number unitID - * @treturn nil|bool isSelected nil when unitID cannot be parsed + * @param unitID integer + * @return boolean? isSelected nil when unitID cannot be parsed */ int LuaUnsyncedRead::IsUnitSelected(lua_State* L) { @@ -1223,8 +1217,8 @@ int LuaUnsyncedRead::IsUnitSelected(lua_State* L) /*** * * @function Spring.GetUnitLuaDraw - * @number unitID - * @treturn nil|bool draw nil when unitID cannot be parsed + * @param unitID integer + * @return boolean? draw nil when unitID cannot be parsed */ int LuaUnsyncedRead::GetUnitLuaDraw(lua_State* L) { @@ -1234,8 +1228,8 @@ int LuaUnsyncedRead::GetUnitLuaDraw(lua_State* L) /*** * * @function Spring.GetUnitNoDraw - * @number unitID - * @treturn nil|bool nil when unitID cannot be parsed + * @param unitID integer + * @return boolean? nil when unitID cannot be parsed */ int LuaUnsyncedRead::GetUnitNoDraw(lua_State* L) { @@ -1245,8 +1239,8 @@ int LuaUnsyncedRead::GetUnitNoDraw(lua_State* L) /*** * * @function Spring.GetUnitEngineDrawMask - * @number unitID - * @treturn nil|bool nil when unitID cannot be parsed + * @param unitID integer + * @return boolean? nil when unitID cannot be parsed */ int LuaUnsyncedRead::GetUnitEngineDrawMask(lua_State* L) { @@ -1256,8 +1250,8 @@ int LuaUnsyncedRead::GetUnitEngineDrawMask(lua_State* L) /*** * * @function Spring.GetUnitAlwaysUpdateMatrix - * @number unitID - * @treturn nil|bool nil when unitID cannot be parsed + * @param unitID integer + * @return boolean? nil when unitID cannot be parsed */ int LuaUnsyncedRead::GetUnitAlwaysUpdateMatrix(lua_State* L) { @@ -1273,8 +1267,8 @@ int LuaUnsyncedRead::GetUnitAlwaysUpdateMatrix(lua_State* L) /*** * * @function Spring.GetUnitDrawFlag - * @number unitID - * @treturn nil|number nil when unitID cannot be parsed + * @param unitID integer + * @return number? nil when unitID cannot be parsed */ int LuaUnsyncedRead::GetUnitDrawFlag(lua_State* L) { @@ -1290,8 +1284,8 @@ int LuaUnsyncedRead::GetUnitDrawFlag(lua_State* L) /*** * * @function Spring.GetUnitNoMinimap - * @number unitID - * @treturn nil|bool nil when unitID cannot be parsed + * @param unitID integer + * @return boolean? nil when unitID cannot be parsed */ int LuaUnsyncedRead::GetUnitNoMinimap(lua_State* L) { @@ -1307,8 +1301,8 @@ int LuaUnsyncedRead::GetUnitNoMinimap(lua_State* L) /*** * * @function Spring.GetUnitNoSelect - * @number unitID - * @treturn nil|bool nil when unitID cannot be parsed + * @param unitID integer + * @return boolean? nil when unitID cannot be parsed */ int LuaUnsyncedRead::GetUnitNoSelect(lua_State* L) { @@ -1325,8 +1319,9 @@ int LuaUnsyncedRead::GetUnitNoSelect(lua_State* L) /*** * * @function Spring.UnitIconGetDraw - * @number unitID - * @tparam nil|bool nil when unitID is invalid + * @param unitID integer + * @return boolean? drawIcon + * `true` if icon is being drawn, `nil` when unitID is invalid, otherwise `false`. */ int LuaUnsyncedRead::UnitIconGetDraw(lua_State* L) { CUnit* unit = ParseUnit(L, __func__, 1); @@ -1342,17 +1337,17 @@ int LuaUnsyncedRead::UnitIconGetDraw(lua_State* L) { /*** * * @function Spring.GetUnitSelectionVolumeData - * @number unitID - * @treturn number|nil scaleX nil when unitID cannot be parsed - * @treturn number scaleY - * @treturn number scaleZ - * @treturn number offsetX - * @treturn number offsetY - * @treturn number offsetZ - * @treturn number volumeType - * @treturn number useContHitTest - * @treturn number getPrimaryAxis - * @treturn bool ignoreHits + * @param unitID integer + * @return number? scaleX nil when unitID cannot be parsed + * @return number scaleY + * @return number scaleZ + * @return number offsetX + * @return number offsetY + * @return number offsetZ + * @return number volumeType + * @return number useContHitTest + * @return number getPrimaryAxis + * @return boolean ignoreHits */ int LuaUnsyncedRead::GetUnitSelectionVolumeData(lua_State* L) { @@ -1369,8 +1364,8 @@ int LuaUnsyncedRead::GetUnitSelectionVolumeData(lua_State* L) /*** * * @function Spring.GetFeatureLuaDraw - * @number featureID - * @treturn nil|bool nil when featureID cannot be parsed + * @param featureID integer + * @return boolean? nil when featureID cannot be parsed */ int LuaUnsyncedRead::GetFeatureLuaDraw(lua_State* L) { @@ -1380,8 +1375,8 @@ int LuaUnsyncedRead::GetFeatureLuaDraw(lua_State* L) /*** * * @function Spring.GetFeatureNoDraw - * @number featureID - * @treturn nil|bool nil when featureID cannot be parsed + * @param featureID integer + * @return boolean? nil when featureID cannot be parsed */ int LuaUnsyncedRead::GetFeatureNoDraw(lua_State* L) { @@ -1391,8 +1386,8 @@ int LuaUnsyncedRead::GetFeatureNoDraw(lua_State* L) /*** * * @function Spring.GetFeatureEngineDrawMask - * @number featureID - * @treturn nil|bool nil when featureID cannot be parsed + * @param featureID integer + * @return boolean? nil when featureID cannot be parsed */ int LuaUnsyncedRead::GetFeatureEngineDrawMask(lua_State* L) { @@ -1402,8 +1397,8 @@ int LuaUnsyncedRead::GetFeatureEngineDrawMask(lua_State* L) /*** * * @function Spring.GetFeatureAlwaysUpdateMatrix - * @number featureID - * @treturn nil|bool nil when featureID cannot be parsed + * @param featureID integer + * @return boolean? nil when featureID cannot be parsed */ int LuaUnsyncedRead::GetFeatureAlwaysUpdateMatrix(lua_State* L) { @@ -1419,8 +1414,8 @@ int LuaUnsyncedRead::GetFeatureAlwaysUpdateMatrix(lua_State* L) /*** * * @function Spring.GetFeatureDrawFlag - * @number featureID - * @treturn nil|number nil when featureID cannot be parsed + * @param featureID integer + * @return number? nil when featureID cannot be parsed */ int LuaUnsyncedRead::GetFeatureDrawFlag(lua_State* L) { @@ -1436,17 +1431,17 @@ int LuaUnsyncedRead::GetFeatureDrawFlag(lua_State* L) /*** * * @function Spring.GetFeatureSelectionVolumeData - * @number featureID - * @treturn number|nil scaleX nil when unitID cannot be parsed - * @treturn number scaleY - * @treturn number scaleZ - * @treturn number offsetX - * @treturn number offsetY - * @treturn number offsetZ - * @treturn number volumeType - * @treturn number useContHitTest - * @treturn number getPrimaryAxis - * @treturn bool ignoreHits + * @param featureID integer + * @return number? scaleX nil when unitID cannot be parsed + * @return number scaleY + * @return number scaleZ + * @return number offsetX + * @return number offsetY + * @return number offsetZ + * @return number volumeType + * @return number useContHitTest + * @return number getPrimaryAxis + * @return boolean ignoreHits */ int LuaUnsyncedRead::GetFeatureSelectionVolumeData(lua_State* L) { @@ -1485,23 +1480,23 @@ static int GetObjectTransformMatrix(const CSolidObject* o, lua_State* L) /*** * * @function Spring.GetUnitTransformMatrix - * @number unitID - * @treturn number|nil m11 nil when unitID cannot be parsed - * @treturn number m12 - * @treturn number m13 - * @treturn number m14 - * @treturn number m21 - * @treturn number m22 - * @treturn number m23 - * @treturn number m24 - * @treturn number m31 - * @treturn number m32 - * @treturn number m33 - * @treturn number m34 - * @treturn number m41 - * @treturn number m42 - * @treturn number m43 - * @treturn number m44 + * @param unitID integer + * @return number? m11 nil when unitID cannot be parsed + * @return number m12 + * @return number m13 + * @return number m14 + * @return number m21 + * @return number m22 + * @return number m23 + * @return number m24 + * @return number m31 + * @return number m32 + * @return number m33 + * @return number m34 + * @return number m41 + * @return number m42 + * @return number m43 + * @return number m44 */ int LuaUnsyncedRead::GetUnitTransformMatrix(lua_State* L) { return (GetObjectTransformMatrix(ParseUnit(L, __func__, 1), L)); } @@ -1509,23 +1504,23 @@ int LuaUnsyncedRead::GetUnitTransformMatrix(lua_State* L) { return (GetObjectTra /*** * * @function Spring.GetFeatureTransformMatrix - * @number featureID - * @treturn number|nil m11 nil when featureID cannot be parsed - * @treturn number m12 - * @treturn number m13 - * @treturn number m14 - * @treturn number m21 - * @treturn number m22 - * @treturn number m23 - * @treturn number m24 - * @treturn number m31 - * @treturn number m32 - * @treturn number m33 - * @treturn number m34 - * @treturn number m41 - * @treturn number m42 - * @treturn number m43 - * @treturn number m44 + * @param featureID integer + * @return number? m11 nil when featureID cannot be parsed + * @return number m12 + * @return number m13 + * @return number m14 + * @return number m21 + * @return number m22 + * @return number m23 + * @return number m24 + * @return number m31 + * @return number m32 + * @return number m33 + * @return number m34 + * @return number m41 + * @return number m42 + * @return number m43 + * @return number m44 */ int LuaUnsyncedRead::GetFeatureTransformMatrix(lua_State* L) { return (GetObjectTransformMatrix(ParseFeature(L, __func__, 1), L)); } @@ -1539,8 +1534,8 @@ int LuaUnsyncedRead::GetFeatureTransformMatrix(lua_State* L) { return (GetObject /*** * * @function Spring.IsUnitInView - * @number unitID - * @treturn nil|bool inView nil when unitID cannot be parsed + * @param unitID integer + * @return boolean? inView nil when unitID cannot be parsed */ int LuaUnsyncedRead::IsUnitInView(lua_State* L) { @@ -1557,10 +1552,10 @@ int LuaUnsyncedRead::IsUnitInView(lua_State* L) /*** * * @function Spring.IsUnitVisible - * @number unitID - * @number[opt] radius unitRadius when not specified - * @bool checkIcon - * @treturn nil|bool isVisible nil when unitID cannot be parsed + * @param unitID integer + * @param radius number? unitRadius when not specified + * @param checkIcon boolean + * @return boolean? isVisible nil when unitID cannot be parsed */ int LuaUnsyncedRead::IsUnitVisible(lua_State* L) { @@ -1599,8 +1594,8 @@ int LuaUnsyncedRead::IsUnitVisible(lua_State* L) /*** * * @function Spring.IsUnitIcon - * @number unitID - * @treturn nil|bool isUnitIcon nil when unitID cannot be parsed + * @param unitID integer + * @return boolean? isUnitIcon nil when unitID cannot be parsed */ int LuaUnsyncedRead::IsUnitIcon(lua_State* L) { @@ -1617,13 +1612,13 @@ int LuaUnsyncedRead::IsUnitIcon(lua_State* L) /*** * * @function Spring.IsAABBInView - * @number minX - * @number minY - * @number minZ - * @number maxX - * @number maxY - * @number maxZ - * @treturn bool inView + * @param minX number + * @param minY number + * @param minZ number + * @param maxX number + * @param maxY number + * @param maxZ number + * @return boolean inView */ int LuaUnsyncedRead::IsAABBInView(lua_State* L) { @@ -1646,11 +1641,11 @@ int LuaUnsyncedRead::IsAABBInView(lua_State* L) /*** * * @function Spring.IsSphereInView - * @number posX - * @number posY - * @number posZ - * @number[opt=0] radius - * @treturn bool inView + * @param posX number + * @param posY number + * @param posZ number + * @param radius number? (Default: 0) + * @return boolean inView */ int LuaUnsyncedRead::IsSphereInView(lua_State* L) { @@ -1667,11 +1662,11 @@ int LuaUnsyncedRead::IsSphereInView(lua_State* L) /*** * * @function Spring.GetUnitViewPosition - * @number unitID - * @bool[opt=false] midPos - * @treturn number|nil x nil when unitID cannot be parsed - * @treturn number y - * @treturn number z + * @param unitID integer + * @param midPos boolean? (Default: false) + * @return number? x nil when unitID cannot be parsed + * @return number y + * @return number z */ int LuaUnsyncedRead::GetUnitViewPosition(lua_State* L) { @@ -1762,10 +1757,10 @@ class CVisProjectileQuadDrawer: public CWorldObjectQuadDrawer { /*** * * @function Spring.GetVisibleUnits - * @number[opt=-1] teamID - * @number[opt=30] radius - * @bool[opt=true] icons - * @treturn nil|{[number],...} unitIDs + * @param teamID integer? (Default: -1) + * @param radius number? (Default: 30) + * @param icons boolean? (Default: true) + * @return nil|number[] unitIDs */ int LuaUnsyncedRead::GetVisibleUnits(lua_State* L) { @@ -1860,11 +1855,11 @@ int LuaUnsyncedRead::GetVisibleUnits(lua_State* L) /*** * * @function Spring.GetVisibleFeatures - * @number[opt=-1] teamID - * @number[opt=30] radius - * @bool[opt=true] icons - * @bool[opt=true] geos - * @treturn nil|{[number],...} featureIDs + * @param teamID integer? (Default: -1) + * @param radius number? (Default: 30) + * @param icons boolean? (Default: true) + * @param geos boolean? (Default: true) + * @return nil|number[] featureIDs */ int LuaUnsyncedRead::GetVisibleFeatures(lua_State* L) { @@ -1941,11 +1936,11 @@ int LuaUnsyncedRead::GetVisibleFeatures(lua_State* L) /*** * * @function Spring.GetVisibleProjectiles - * @number[opt=-1] allyTeamID - * @bool[opt=true] addSyncedProjectiles - * @bool[opt=true] addWeaponProjectiles - * @bool[opt=true] addPieceProjectiles - * @treturn nil|{[number],...} projectileIDs + * @param allyTeamID integer? (Default: -1) + * @param addSyncedProjectiles boolean? (Default: true) + * @param addWeaponProjectiles boolean? (Default: true) + * @param addPieceProjectiles boolean? (Default: true) + * @return nil|number[] projectileIDs */ int LuaUnsyncedRead::GetVisibleProjectiles(lua_State* L) { @@ -2131,7 +2126,7 @@ int LuaUnsyncedRead::GetRenderFeaturesDrawFlagChanged(lua_State* L) /*** * * @function Spring.ClearUnitsPreviousDrawFlag - * @treturn nil + * @return nil */ int LuaUnsyncedRead::ClearUnitsPreviousDrawFlag(lua_State* L) { @@ -2142,7 +2137,7 @@ int LuaUnsyncedRead::ClearUnitsPreviousDrawFlag(lua_State* L) /*** * * @function Spring.ClearFeaturesPreviousDrawFlag - * @treturn nil + * @return nil */ int LuaUnsyncedRead::ClearFeaturesPreviousDrawFlag(lua_State* L) { @@ -2153,12 +2148,12 @@ int LuaUnsyncedRead::ClearFeaturesPreviousDrawFlag(lua_State* L) /*** Get units inside a rectangle area on the map * * @function Spring.GetUnitsInScreenRectangle - * @number left - * @number top - * @number right - * @number bottom - * @number[opt=-1] allegiance teamID when > 0, when < 0 one of AllUnits = -1, MyUnits = -2, AllyUnits = -3, EnemyUnits = -4 - * @treturn nil|{[number],...} unitIDs + * @param left number + * @param top number + * @param right number + * @param bottom number + * @param allegiance number? (Default: -1) teamID when > 0, when < 0 one of AllUnits = -1, MyUnits = -2, AllyUnits = -3, EnemyUnits = -4 + * @return nil|number[] unitIDs */ int LuaUnsyncedRead::GetUnitsInScreenRectangle(lua_State* L) { @@ -2252,11 +2247,11 @@ int LuaUnsyncedRead::GetUnitsInScreenRectangle(lua_State* L) /*** Get features inside a rectangle area on the map * * @function Spring.GetFeaturesInScreenRectangle - * @number left - * @number top - * @number right - * @number bottom - * @treturn nil|{[number],...} featureIDs + * @param left number + * @param top number + * @param right number + * @param bottom number + * @return nil|number[] featureIDs */ int LuaUnsyncedRead::GetFeaturesInScreenRectangle(lua_State* L) { @@ -2308,7 +2303,7 @@ int LuaUnsyncedRead::GetFeaturesInScreenRectangle(lua_State* L) /*** * * @function Spring.GetLocalPlayerID - * @treturn number playerID + * @return number playerID */ int LuaUnsyncedRead::GetLocalPlayerID(lua_State* L) { @@ -2320,7 +2315,7 @@ int LuaUnsyncedRead::GetLocalPlayerID(lua_State* L) /*** * * @function Spring.GetLocalTeamID - * @treturn number teamID + * @return number teamID */ int LuaUnsyncedRead::GetLocalTeamID(lua_State* L) { @@ -2332,7 +2327,7 @@ int LuaUnsyncedRead::GetLocalTeamID(lua_State* L) /*** * * @function Spring.GetLocalAllyTeamID - * @treturn number allyTeamID + * @return number allyTeamID */ int LuaUnsyncedRead::GetLocalAllyTeamID(lua_State* L) { @@ -2344,9 +2339,9 @@ int LuaUnsyncedRead::GetLocalAllyTeamID(lua_State* L) /*** * * @function Spring.GetSpectatingState - * @treturn bool spectating - * @treturn bool spectatingFullView - * @treturn bool spectatingFullSelect + * @return boolean spectating + * @return boolean spectatingFullView + * @return boolean spectatingFullSelect */ int LuaUnsyncedRead::GetSpectatingState(lua_State* L) { @@ -2363,7 +2358,7 @@ int LuaUnsyncedRead::GetSpectatingState(lua_State* L) /*** * * @function Spring.GetSelectedUnits - * @treturn {[number],...} unitIDs + * @return number[] unitIDs */ int LuaUnsyncedRead::GetSelectedUnits(lua_State* L) { @@ -2374,8 +2369,8 @@ int LuaUnsyncedRead::GetSelectedUnits(lua_State* L) /*** Get selected units aggregated by unitDefID * * @function Spring.GetSelectedUnitsSorted - * @treturn {[number]={number,...},...} where keys are unitDefIDs and values are unitIDs - * @treturn n the number of unitDefIDs + * @return table where keys are unitDefIDs and values are unitIDs + * @return integer the number of unitDefIDs */ int LuaUnsyncedRead::GetSelectedUnitsSorted(lua_State* L) { @@ -2390,8 +2385,8 @@ int LuaUnsyncedRead::GetSelectedUnitsSorted(lua_State* L) * * @function Spring.GetSelectedUnitsCounts * - * @treturn {[number]=number,...} unitsCounts where keys are unitDefIDs and values are counts - * @treturn n the number of unitDefIDs + * @return table unitsCounts where keys are unitDefIDs and values are counts + * @return integer the number of unitDefIDs */ int LuaUnsyncedRead::GetSelectedUnitsCounts(lua_State* L) { @@ -2405,7 +2400,7 @@ int LuaUnsyncedRead::GetSelectedUnitsCounts(lua_State* L) /*** Returns the amount of selected units * * @function Spring.GetSelectedUnitsCount - * @treturn number selectedUnitsCount + * @return number selectedUnitsCount */ int LuaUnsyncedRead::GetSelectedUnitsCount(lua_State* L) { @@ -2417,7 +2412,7 @@ int LuaUnsyncedRead::GetSelectedUnitsCount(lua_State* L) * * @function Spring.GetBoxSelectionByEngine * - * @treturn bool when true engine won't select units inside selection box when released + * @return boolean when true engine won't select units inside selection box when released * * @see Spring.GetSelectionBox * @see Spring.SetBoxSelectionByEngine @@ -2435,7 +2430,7 @@ int LuaUnsyncedRead::GetBoxSelectionByEngine(lua_State* L) /*** * * @function Spring.IsGUIHidden - * @treturn bool + * @return boolean */ int LuaUnsyncedRead::IsGUIHidden(lua_State* L) { @@ -2447,7 +2442,7 @@ int LuaUnsyncedRead::IsGUIHidden(lua_State* L) /*** * * @function Spring.HaveShadows - * @treturn shadowsLoaded + * @return boolean shadowsLoaded */ int LuaUnsyncedRead::HaveShadows(lua_State* L) { @@ -2459,8 +2454,8 @@ int LuaUnsyncedRead::HaveShadows(lua_State* L) /*** * * @function Spring.HaveAdvShading - * @treturn bool useAdvShading - * @treturn bool groundUseAdvShading + * @return boolean useAdvShading + * @return boolean groundUseAdvShading */ int LuaUnsyncedRead::HaveAdvShading(lua_State* L) { @@ -2473,8 +2468,8 @@ int LuaUnsyncedRead::HaveAdvShading(lua_State* L) /*** * * @function Spring.GetWaterMode - * @treturn number waterRendererID - * @treturn string waterRendererName + * @return number waterRendererID + * @return string waterRendererName * @see rts/Rendering/Env/IWater.h */ int LuaUnsyncedRead::GetWaterMode(lua_State* L) @@ -2489,7 +2484,7 @@ int LuaUnsyncedRead::GetWaterMode(lua_State* L) /*** * * @function Spring.GetMapDrawMode - * @treturn nil|string "normal"|"height"|"metal"|"pathTraversability"|"los" + * @return "normal"|"height"|"metal"|"pathTraversability"|"los" */ int LuaUnsyncedRead::GetMapDrawMode(lua_State* L) { @@ -2518,12 +2513,12 @@ int LuaUnsyncedRead::GetMapDrawMode(lua_State* L) /*** * * @function Spring.GetMapSquareTexture - * @number texSquareX - * @number texSquareY - * @number lodMin - * @string luaTexName - * @number[opt=lodMin] lodMax - * @treturn nil|bool success + * @param texSquareX number + * @param texSquareY number + * @param lodMin number + * @param luaTexName string + * @param lodMax number? (Default: lodMin) + * @return boolean? success */ int LuaUnsyncedRead::GetMapSquareTexture(lua_State* L) { @@ -2572,19 +2567,13 @@ int LuaUnsyncedRead::GetMapSquareTexture(lua_State* L) return 1; } - -/*** Color triple (RGB) - * @table rgb - * @number r - * @number g - * @number b - */ - - /*** - * * @function Spring.GetLosViewColors - * @treturn { always=rgb, LOS=rgb, radar=rgb, jam=rgb, radar2=rgb } + * @return rgb always + * @return rgb LOS + * @return rgb radar + * @return rgb jam + * @return rgb radar2 */ int LuaUnsyncedRead::GetLosViewColors(lua_State* L) { @@ -2609,12 +2598,12 @@ int LuaUnsyncedRead::GetLosViewColors(lua_State* L) /*** * * @function Spring.GetNanoProjectileParams - * @treturn number rotVal in degrees - * @treturn number rotVel in degrees - * @treturn number rotAcc in degrees - * @treturn number rotValRng in degrees - * @treturn number rotVelRng in degrees - * @treturn number rotAccRng in degrees + * @return number rotVal in degrees + * @return number rotVel in degrees + * @return number rotAcc in degrees + * @return number rotValRng in degrees + * @return number rotVelRng in degrees + * @return number rotAccRng in degrees */ int LuaUnsyncedRead::GetNanoProjectileParams(lua_State* L) { @@ -2630,10 +2619,11 @@ int LuaUnsyncedRead::GetNanoProjectileParams(lua_State* L) } -/*** Get available cameras - * +/*** + * Get available cameras. + * * @function Spring.GetCameraNames - * @treturn {[string] = number} where keys are names and values are indices + * @return table Table where where keys are names and values are indices. */ int LuaUnsyncedRead::GetCameraNames(lua_State* L) { @@ -2650,40 +2640,16 @@ int LuaUnsyncedRead::GetCameraNames(lua_State* L) return 1; } - -/*** Parameters for camera state - * - * @table camState - * - * Highly dependent on the type of the current camera controller - * - * @string name "ta"|"spring"|"rot"|"ov"|"free"|"fps"|"dummy" - * @number mode the camera mode: 0 (fps), 1 (ta), 2 (spring), 3 (rot), 4 (free), 5 (ov), 6 (dummy) - * @number fov - * @number px Position X of the ground point in screen center - * @number py Position Y of the ground point in screen center - * @number pz Position Z of the ground point in screen center - * @number dx Camera direction vector X - * @number dy Camera direction vector Y - * @number dz Camera direction vector Z - * @number rx Camera rotation angle on X axis (spring) - * @number ry Camera rotation angle on Y axis (spring) - * @number rz Camera rotation angle on Z axis (spring) - * @number angle Camera rotation angle on X axis (aka tilt/pitch) (ta) - * @number flipped -1 for when south is down, 1 for when north is down (ta) - * @number dist Camera distance from the ground (spring) - * @number height Camera distance from the ground (ta) - * @number oldHeight Camera distance from the ground, cannot be changed (rot) +/*** + * @function Spring.GetCameraState + * @param useReturns false + * @return CameraState cameraState */ - - /*** - * * @function Spring.GetCameraState - * @bool[opt=true] useReturns when true return multiple values instead of table - * @treturn any|camState ret1 - * @treturn any|nil ret2 - * @treturn any|nil retn + * @param useReturns true? (Default: `true`) Return multiple values instead of a table. + * @return "ta"|"spring"|"rot"|"ov"|"free"|"fps"|"dummy" name + * @return any Fields depending on current controller mode. */ int LuaUnsyncedRead::GetCameraState(lua_State* L) { @@ -2751,11 +2717,10 @@ int LuaUnsyncedRead::GetCameraState(lua_State* L) /*** - * * @function Spring.GetCameraPosition - * @treturn posX - * @treturn posY - * @treturn posZ + * @return number posX + * @return number posY + * @return number posZ */ int LuaUnsyncedRead::GetCameraPosition(lua_State* L) { @@ -2766,11 +2731,10 @@ int LuaUnsyncedRead::GetCameraPosition(lua_State* L) } /*** - * * @function Spring.GetCameraDirection - * @treturn dirX - * @treturn dirY - * @treturn dirZ + * @return number dirX + * @return number dirY + * @return number dirZ */ int LuaUnsyncedRead::GetCameraDirection(lua_State* L) { @@ -2781,11 +2745,10 @@ int LuaUnsyncedRead::GetCameraDirection(lua_State* L) } /*** - * * @function Spring.GetCameraRotation - * @treturn rotX in radians - * @treturn rotY in radians - * @treturn rotZ in radians + * @return number rotX in radians + * @return number rotY in radians + * @return number rotZ in radians */ int LuaUnsyncedRead::GetCameraRotation(lua_State* L) { @@ -2796,10 +2759,9 @@ int LuaUnsyncedRead::GetCameraRotation(lua_State* L) } /*** - * * @function Spring.GetCameraFOV - * @treturn number vFOV - * @treturn number hFOV + * @return number vFOV + * @return number hFOV */ int LuaUnsyncedRead::GetCameraFOV(lua_State* L) { @@ -2808,19 +2770,20 @@ int LuaUnsyncedRead::GetCameraFOV(lua_State* L) return 2; } - -/*** Cartesian triple (XYZ) - * @table xyz - * @number x - * @number y - * @number z +/** + * @class CameraVectors + * @field forward xyz + * @field up xyz + * @field right xyz + * @field topFrustumPlane xyz + * @field botFrustumPlane xyz + * @field lftFrustumPlane xyz + * @field rgtFrustumPlane xyz */ - /*** - * * @function Spring.GetCameraVectors - * @treturn { forward = xyz, up = xyz, right = xyz, topFrustumPlane = xyz, botFrustumPlane = xyz, lftFrustumPlane = xyz, rgtFrustumPlane = xyz } + * @return CameraVectors */ int LuaUnsyncedRead::GetCameraVectors(lua_State* L) { @@ -2848,12 +2811,12 @@ int LuaUnsyncedRead::GetCameraVectors(lua_State* L) /*** * * @function Spring.WorldToScreenCoords - * @number x - * @number y - * @number z - * @treturn viewPortX - * @treturn viewPortY - * @treturn viewPortZ + * @param x number + * @param y number + * @param z number + * @return number viewPortX + * @return number viewPortY + * @return number viewPortZ */ int LuaUnsyncedRead::WorldToScreenCoords(lua_State* L) { @@ -2880,17 +2843,17 @@ int LuaUnsyncedRead::WorldToScreenCoords(lua_State* L) * * The unit must be selectable, to appear to a screen trace ray. * - * @number screenX position on x axis in mouse coordinates (origin on left border of view) - * @number screenY position on y axis in mouse coordinates (origin on top border of view) - * @bool[opt=false] onlyCoords return only description (1st return value) and coordinates (2nd return value) - * @bool[opt=false] useMinimap if position arguments are contained by minimap, use the minimap corresponding world position - * @bool[opt=false] includeSky - * @bool[opt=false] ignoreWater - * @number[opt=0] heightOffset - * @treturn nil|string description of traced position - * @treturn nil|number|string|xyz unitID or feature, position triple when onlyCoords=true - * @treturn nil|number|string featureID or ground - * @treturn nil|xyz coords + * @param screenX number position on x axis in mouse coordinates (origin on left border of view) + * @param screenY number position on y axis in mouse coordinates (origin on top border of view) + * @param onlyCoords boolean? (Default: false) return only description (1st return value) and coordinates (2nd return value) + * @param useMinimap boolean? (Default: false) if position arguments are contained by minimap, use the minimap corresponding world position + * @param includeSky boolean? (Default: false) + * @param ignoreWater boolean? (Default: false) + * @param heightOffset number? (Default: 0) + * @return nil|string description of traced position + * @return nil|number|string|xyz unitID or feature, position triple when onlyCoords=true + * @return nil|number|string featureID or ground + * @return nil|xyz coords */ int LuaUnsyncedRead::TraceScreenRay(lua_State* L) { @@ -2997,11 +2960,11 @@ int LuaUnsyncedRead::TraceScreenRay(lua_State* L) /*** * * @function Spring.GetPixelDir - * @number x - * @number y - * @treturn dirX - * @treturn dirY - * @treturn dirZ + * @param x number + * @param y number + * @return number dirX + * @return number dirY + * @return number dirZ */ int LuaUnsyncedRead::GetPixelDir(lua_State* L) { @@ -3052,11 +3015,11 @@ static bool AddPlayerToRoster(lua_State* L, int playerID, bool onlyActivePlayers /*** * * @function Spring.GetTeamColor - * @number teamID - * @treturn nil|number r factor from 0 to 1 - * @treturn nil|number g factor from 0 to 1 - * @treturn nil|number b factor from 0 to 1 - * @treturn nil|number a factor from 0 to 1 + * @param teamID integer + * @return number? r factor from 0 to 1 + * @return number? g factor from 0 to 1 + * @return number? b factor from 0 to 1 + * @return number? a factor from 0 to 1 */ int LuaUnsyncedRead::GetTeamColor(lua_State* L) { @@ -3079,11 +3042,11 @@ int LuaUnsyncedRead::GetTeamColor(lua_State* L) /*** * * @function Spring.GetTeamOrigColor - * @number teamID - * @treturn nil|number r factor from 0 to 1 - * @treturn nil|number g factor from 0 to 1 - * @treturn nil|number b factor from 0 to 1 - * @treturn nil|number a factor from 0 to 1 + * @param teamID integer + * @return number? r factor from 0 to 1 + * @return number? g factor from 0 to 1 + * @return number? b factor from 0 to 1 + * @return number? a factor from 0 to 1 */ int LuaUnsyncedRead::GetTeamOrigColor(lua_State* L) { @@ -3106,7 +3069,7 @@ int LuaUnsyncedRead::GetTeamOrigColor(lua_State* L) /*** * * @function Spring.GetDrawSeconds - * @treturn time in seconds + * @return integer Time in seconds */ int LuaUnsyncedRead::GetDrawSeconds(lua_State* L) { @@ -3124,8 +3087,8 @@ int LuaUnsyncedRead::GetDrawSeconds(lua_State* L) /*** * * @function Spring.GetSoundStreamTime - * @treturn number playTime - * @treturn number time + * @return number playTime + * @return number time */ int LuaUnsyncedRead::GetSoundStreamTime(lua_State* L) { @@ -3228,7 +3191,7 @@ int LuaUnsyncedRead::GetSoundEffectParams(lua_State* L) /*** * * @function Spring.GetFPS - * @treturn number fps + * @return number fps */ int LuaUnsyncedRead::GetFPS(lua_State* L) { @@ -3242,9 +3205,9 @@ int LuaUnsyncedRead::GetFPS(lua_State* L) /*** * * @function Spring.GetGameSpeed - * @treturn number wantedSpeedFactor - * @treturn number speedFactor - * @treturn bool paused + * @return number wantedSpeedFactor + * @return number speedFactor + * @return boolean paused */ int LuaUnsyncedRead::GetGameSpeed(lua_State* L) { @@ -3257,11 +3220,11 @@ int LuaUnsyncedRead::GetGameSpeed(lua_State* L) /*** * * @function Spring.GetGameState - * @number[opt=500] maxLatency used for `isSimLagging` return parameter - * @treturn bool doneLoading - * @treturn bool isSavedGame - * @treturn bool isClientPaused - * @treturn bool isSimLagging + * @param maxLatency number? (Default: 500) used for `isSimLagging` return parameter + * @return boolean doneLoading + * @return boolean isSavedGame + * @return boolean isClientPaused + * @return boolean isSimLagging */ int LuaUnsyncedRead::GetGameState(lua_State* L) { @@ -3284,10 +3247,10 @@ int LuaUnsyncedRead::GetGameState(lua_State* L) /*** * * @function Spring.GetActiveCommand - * @treturn nil|number cmdIndex - * @treturn nil|number cmdID - * @treturn nil|number cmdType - * @treturn nil|string cmdName + * @return number? cmdIndex + * @return number? cmdID + * @return number? cmdType + * @return nil|string cmdName */ int LuaUnsyncedRead::GetActiveCommand(lua_State* L) { @@ -3313,10 +3276,10 @@ int LuaUnsyncedRead::GetActiveCommand(lua_State* L) /*** * * @function Spring.GetDefaultCommand - * @treturn nil|number cmdIndex - * @treturn nil|number cmdID - * @treturn nil|number cmdType - * @treturn nil|string cmdName + * @return number? cmdIndex + * @return number? cmdID + * @return number? cmdType + * @return nil|string cmdName */ int LuaUnsyncedRead::GetDefaultCommand(lua_State* L) { @@ -3339,33 +3302,10 @@ int LuaUnsyncedRead::GetDefaultCommand(lua_State* L) return 4; } - -/*** Command Description - * - * @table cmdDesc - * - * Contains data about a command - * - * @number id - * @number type - * @string name - * @string action - * @string tooltip - * @string texture - * @string cursor - * @bool queueing - * @bool hidden - * @bool disabled - * @bool showUnique - * @bool onlyTexture - * @tparam {[string],...} params - */ - - /*** * * @function Spring.GetActiveCmdDescs - * @treturn {[cmdDesc],...} cmdDescs + * @return CommandDescription[] cmdDescs */ int LuaUnsyncedRead::GetActiveCmdDescs(lua_State* L) { @@ -3394,8 +3334,8 @@ int LuaUnsyncedRead::GetActiveCmdDescs(lua_State* L) /*** * * @function Spring.GetActiveCmdDesc - * @number cmdIndex - * @treturn nil|cmdDesc + * @param cmdIndex integer + * @return CommandDescription? */ int LuaUnsyncedRead::GetActiveCmdDesc(lua_State* L) { @@ -3418,8 +3358,8 @@ int LuaUnsyncedRead::GetActiveCmdDesc(lua_State* L) /*** * * @function Spring.GetCmdDescIndex - * @number cmdID - * @treturn nil|number cmdDescIndex + * @param cmdID integer + * @return integer? cmdDescIndex */ int LuaUnsyncedRead::GetCmdDescIndex(lua_State* L) { @@ -3442,10 +3382,18 @@ int LuaUnsyncedRead::GetCmdDescIndex(lua_State* L) /******************************************************************************/ +/*** + * @alias Facing + * | 0 # South + * | 1 # East + * | 2 # North + * | 3 # West + */ + /*** * * @function Spring.GetBuildFacing - * @treturn number buildFacing + * @return Facing buildFacing */ int LuaUnsyncedRead::GetBuildFacing(lua_State* L) { @@ -3460,7 +3408,7 @@ int LuaUnsyncedRead::GetBuildFacing(lua_State* L) /*** * * @function Spring.GetBuildSpacing - * @treturn number buildSpacing + * @return number buildSpacing */ int LuaUnsyncedRead::GetBuildSpacing(lua_State* L) { @@ -3475,7 +3423,7 @@ int LuaUnsyncedRead::GetBuildSpacing(lua_State* L) /*** * * @function Spring.GetGatherMode - * @treturn number gatherMode + * @return number gatherMode */ int LuaUnsyncedRead::GetGatherMode(lua_State* L) { @@ -3492,8 +3440,8 @@ int LuaUnsyncedRead::GetGatherMode(lua_State* L) /*** * * @function Spring.GetActivePage - * @treturn number activePage - * @treturn number maxPage + * @return number activePage + * @return number maxPage */ int LuaUnsyncedRead::GetActivePage(lua_State* L) { @@ -3515,13 +3463,13 @@ int LuaUnsyncedRead::GetActivePage(lua_State* L) /*** * * @function Spring.GetMouseState - * @treturn number x - * @treturn number y - * @treturn number lmbPressed left mouse button pressed - * @treturn number mmbPressed middle mouse button pressed - * @treturn number rmbPressed right mouse button pressed - * @treturn bool offscreen - * @treturn bool mmbScroll + * @return number x + * @return number y + * @return number lmbPressed left mouse button pressed + * @return number mmbPressed middle mouse button pressed + * @return number rmbPressed right mouse button pressed + * @return boolean offscreen + * @return boolean mmbScroll */ int LuaUnsyncedRead::GetMouseState(lua_State* L) { @@ -3543,8 +3491,8 @@ int LuaUnsyncedRead::GetMouseState(lua_State* L) /*** * * @function Spring.GetMouseCursor - * @treturn string cursorName - * @treturn number cursorScale + * @return string cursorName + * @return number cursorScale */ int LuaUnsyncedRead::GetMouseCursor(lua_State* L) { @@ -3559,15 +3507,15 @@ int LuaUnsyncedRead::GetMouseCursor(lua_State* L) /*** * * @function Spring.GetMouseStartPosition - * @number button - * @treturn number x - * @treturn number y - * @treturn number camPosX - * @treturn number camPosY - * @treturn number camPosZ - * @treturn number dirX - * @treturn number dirY - * @treturn number dirZ + * @param button number + * @return number x + * @return number y + * @return number camPosX + * @return number camPosY + * @return number camPosZ + * @return number dirX + * @return number dirY + * @return number dirZ */ int LuaUnsyncedRead::GetMouseStartPosition(lua_State* L) { @@ -3600,7 +3548,7 @@ int LuaUnsyncedRead::GetMouseStartPosition(lua_State* L) /*** * * @function Spring.GetClipboard - * @treturn string text + * @return string text */ int LuaUnsyncedRead::GetClipboard(lua_State* L) { @@ -3616,7 +3564,7 @@ int LuaUnsyncedRead::GetClipboard(lua_State* L) /*** * * @function Spring.IsUserWriting - * @treturn bool + * @return boolean */ int LuaUnsyncedRead::IsUserWriting(lua_State* L) { @@ -3634,7 +3582,7 @@ int LuaUnsyncedRead::IsUserWriting(lua_State* L) /*** * * @function Spring.GetLastMessagePositions - * @treturn {xyz,...} message positions + * @return xyz[] message positions */ int LuaUnsyncedRead::GetLastMessagePositions(lua_State* L) { @@ -3655,10 +3603,9 @@ int LuaUnsyncedRead::GetLastMessagePositions(lua_State* L) /*** - * * @function Spring.GetConsoleBuffer - * @number maxLines - * @treturn nil|{{text=string,priority=number},...} pair array of (text, priority) + * @param maxLines number + * @return { text: string, priority: integer }[] buffer */ int LuaUnsyncedRead::GetConsoleBuffer(lua_State* L) { @@ -3692,9 +3639,8 @@ int LuaUnsyncedRead::GetConsoleBuffer(lua_State* L) /*** - * * @function Spring.GetCurrentTooltip - * @treturn string tooltip + * @return string tooltip */ int LuaUnsyncedRead::GetCurrentTooltip(lua_State* L) { @@ -3710,10 +3656,9 @@ int LuaUnsyncedRead::GetCurrentTooltip(lua_State* L) /*** - * * @function Spring.GetKeyFromScanSymbol - * @string scanSymbol - * @treturn string keyName + * @param scanSymbol string + * @return string keyName */ int LuaUnsyncedRead::GetKeyFromScanSymbol(lua_State* L) { @@ -3748,8 +3693,8 @@ int LuaUnsyncedRead::GetKeyFromScanSymbol(lua_State* L) /*** * * @function Spring.GetKeyState - * @number keyCode - * @treturn bool pressed + * @param keyCode number + * @return boolean pressed */ int LuaUnsyncedRead::GetKeyState(lua_State* L) { @@ -3762,10 +3707,10 @@ int LuaUnsyncedRead::GetKeyState(lua_State* L) /*** * * @function Spring.GetModKeyState - * @treturn bool alt - * @treturn bool ctrl - * @treturn bool meta - * @treturn bool shift + * @return boolean alt + * @return boolean ctrl + * @return boolean meta + * @return boolean shift */ int LuaUnsyncedRead::GetModKeyState(lua_State* L) { @@ -3780,7 +3725,7 @@ int LuaUnsyncedRead::GetModKeyState(lua_State* L) /*** * * @function Spring.GetPressedKeys - * @treturn {[number|string]=true,...} where keys are keyCodes or key names + * @return table where keys are keyCodes or key names */ int LuaUnsyncedRead::GetPressedKeys(lua_State* L) { @@ -3811,7 +3756,7 @@ int LuaUnsyncedRead::GetPressedKeys(lua_State* L) /*** * * @function Spring.GetPressedScans - * @treturn {[number|string]=true,...} where keys are scanCodes or scan names + * @return table where keys are scanCodes or scan names */ int LuaUnsyncedRead::GetPressedScans(lua_State* L) { @@ -3842,7 +3787,7 @@ int LuaUnsyncedRead::GetPressedScans(lua_State* L) /*** * * @function Spring.GetInvertQueueKey - * @treturn nil|number queueKey + * @return number? queueKey */ int LuaUnsyncedRead::GetInvertQueueKey(lua_State* L) { @@ -3857,8 +3802,8 @@ int LuaUnsyncedRead::GetInvertQueueKey(lua_State* L) /*** * * @function Spring.GetKeyCode - * @string keySym - * @treturn number keyCode + * @param keySym string + * @return number keyCode */ int LuaUnsyncedRead::GetKeyCode(lua_State* L) { @@ -3870,9 +3815,9 @@ int LuaUnsyncedRead::GetKeyCode(lua_State* L) /*** * * @function Spring.GetKeySymbol - * @number keyCode - * @treturn string keyCodeName - * @treturn string keyCodeDefaultName name when there are not aliases + * @param keyCode number + * @return string keyCodeName + * @return string keyCodeDefaultName name when there are not aliases */ int LuaUnsyncedRead::GetKeySymbol(lua_State* L) { @@ -3886,9 +3831,9 @@ int LuaUnsyncedRead::GetKeySymbol(lua_State* L) /*** * * @function Spring.GetScanSymbol - * @number scanCode - * @treturn string scanCodeName - * @treturn string scanCodeDefaultName name when there are not aliases + * @param scanCode number + * @return string scanCodeName + * @return string scanCodeDefaultName name when there are not aliases */ int LuaUnsyncedRead::GetScanSymbol(lua_State* L) { @@ -3899,24 +3844,23 @@ int LuaUnsyncedRead::GetScanSymbol(lua_State* L) } -/*** Keybinding spec - * - * @table keybindingSpec +/*** + * Keybinding * * Contains data about a keybinding - * - * @string command - * @string extra - * @string boundWith + * + * @class KeyBinding + * @field command string + * @field extra string + * @field boundWith string */ /*** - * * @function Spring.GetKeyBindings - * @string[opt] keySet1 filters keybindings bound to this keyset - * @string[opt] keySet2 OR bound to this keyset - * @treturn {[keybindingSpec],...} + * @param keySet1 string? filters keybindings bound to this keyset + * @param keySet2 string? OR bound to this keyset + * @return KeyBinding[] */ int LuaUnsyncedRead::GetKeyBindings(lua_State* L) { @@ -3968,8 +3912,8 @@ int LuaUnsyncedRead::GetKeyBindings(lua_State* L) /*** * * @function Spring.GetActionHotKeys - * @string actionName - * @treturn nil|{[string],...} hotkeys + * @param actionName string + * @return string[]? hotkeys */ int LuaUnsyncedRead::GetActionHotKeys(lua_State* L) { @@ -3994,7 +3938,7 @@ int LuaUnsyncedRead::GetActionHotKeys(lua_State* L) /*** * * @function Spring.GetGroupList - * @treturn nil|{[number]=number,...} where keys are groupIDs and values are counts + * @return nil|table where keys are groupIDs and values are counts */ int LuaUnsyncedRead::GetGroupList(lua_State* L) { @@ -4022,7 +3966,7 @@ int LuaUnsyncedRead::GetGroupList(lua_State* L) /*** * * @function Spring.GetSelectedGroup - * @treturn number groupID -1 when no group selected + * @return number groupID -1 when no group selected */ int LuaUnsyncedRead::GetSelectedGroup(lua_State* L) { @@ -4034,8 +3978,8 @@ int LuaUnsyncedRead::GetSelectedGroup(lua_State* L) /*** * * @function Spring.GetUnitGroup - * @number unitID - * @treturn nil|number groupID + * @param unitID integer + * @return number? groupID */ int LuaUnsyncedRead::GetUnitGroup(lua_State* L) { @@ -4069,8 +4013,8 @@ static inline const CGroup* GetGroupFromArg(lua_State* L, int arg) /*** * * @function Spring.GetGroupUnits - * @number groupID - * @treturn nil|{[number],...} unitIDs + * @param groupID integer + * @return nil|number[] unitIDs */ int LuaUnsyncedRead::GetGroupUnits(lua_State* L) { @@ -4086,8 +4030,8 @@ int LuaUnsyncedRead::GetGroupUnits(lua_State* L) /*** * * @function Spring.GetGroupUnitsSorted - * @number groupID - * @treturn nil|{[number]={[number],...},...} where keys are unitDefIDs and values are unitIDs + * @param groupID integer + * @return nil|table where keys are unitDefIDs and values are unitIDs */ int LuaUnsyncedRead::GetGroupUnitsSorted(lua_State* L) { @@ -4103,8 +4047,8 @@ int LuaUnsyncedRead::GetGroupUnitsSorted(lua_State* L) /*** * * @function Spring.GetGroupUnitsCounts - * @number groupID - * @treturn nil|{[number]=number,...} where keys are unitDefIDs and values are counts + * @param groupID integer + * @return nil|table where keys are unitDefIDs and values are counts */ int LuaUnsyncedRead::GetGroupUnitsCounts(lua_State* L) { @@ -4120,8 +4064,8 @@ int LuaUnsyncedRead::GetGroupUnitsCounts(lua_State* L) /*** * * @function Spring.GetGroupUnitsCount - * @number groupID - * @treturn nil|number groupSize + * @param groupID integer + * @return number? groupSize */ int LuaUnsyncedRead::GetGroupUnitsCount(lua_State* L) { @@ -4140,28 +4084,27 @@ int LuaUnsyncedRead::GetGroupUnitsCount(lua_State* L) ******************************************************************************/ -/*** Roster spec - * - * @table rosterSpec +/*** Roster * * Contains data about a player - * - * @string name - * @number playerID - * @number teamID - * @number allyTeamID - * @bool spectator - * @number cpuUsage in order to find the progress, use: cpuUsage&0x1 if it's PC or BO, cpuUsage& 0xFE to get path res, (cpuUsage>>8)*1000 for the progress - * @number pingTime if -1, the player is pathfinding + * + * @class Roster + * @field name string + * @field playerID integer + * @field teamID integer + * @field allyTeamID integer + * @field spectator boolean + * @field cpuUsage number in order to find the progress, use: cpuUsage&0x1 if it's PC or BO, cpuUsage& 0xFE to get path res, (cpuUsage>>8)*1000 for the progress + * @field pingTime number if -1, the player is pathfinding */ /*** * * @function Spring.GetPlayerRoster - * @number[opt] sortType return unsorted if unspecified. Disabled = 0, Allies = 1, TeamID = 2, PlayerName = 3, PlayerCPU = 4, PlayerPing = 5 - * @bool[opt=false] showPathingPlayers - * @treturn nil|{[rosterSpec],...} playerTable + * @param sortType number? return unsorted if unspecified. Disabled = 0, Allies = 1, TeamID = 2, PlayerName = 3, PlayerCPU = 4, PlayerPing = 5 + * @param showPathingPlayers boolean? (Default: false) + * @return Roster[]? playerTable */ int LuaUnsyncedRead::GetPlayerRoster(lua_State* L) { @@ -4195,9 +4138,9 @@ int LuaUnsyncedRead::GetPlayerRoster(lua_State* L) /*** * * @function Spring.GetPlayerTraffic - * @number playerID - * @number packetID[opt] - * @treturn number traffic + * @param playerID integer + * @param packetID integer? + * @return number traffic */ int LuaUnsyncedRead::GetPlayerTraffic(lua_State* L) { @@ -4247,12 +4190,12 @@ int LuaUnsyncedRead::GetPlayerTraffic(lua_State* L) /*** * * @function Spring.GetPlayerStatistics - * @number playerID - * @treturn nil|number mousePixels nil when invalid playerID - * @treturn number mouseClicks - * @treturn number keyPresses - * @treturn number numCommands - * @treturn number unitCommands + * @param playerID integer + * @return number? mousePixels nil when invalid playerID + * @return number mouseClicks + * @return number keyPresses + * @return number numCommands + * @return number unitCommands */ int LuaUnsyncedRead::GetPlayerStatistics(lua_State* L) { @@ -4282,29 +4225,28 @@ int LuaUnsyncedRead::GetPlayerStatistics(lua_State* L) ******************************************************************************/ -/*** Configuration spec - * - * @table configSpec +/*** Configuration * * Contains data about a configuration, only name and type are guaranteed - * - * @string name - * @string type - * @string description - * @string defaultValue - * @string minimumValue - * @string maximumValue - * @string safemodeValue - * @string declarationFile - * @string declarationLine - * @bool readOnly + * + * @class Configuration + * @field name string + * @field type string + * @field description string + * @field defaultValue string + * @field minimumValue string + * @field maximumValue string + * @field safemodeValue string + * @field declarationFile string + * @field declarationLine string + * @field readOnly boolean */ /*** * * @function Spring.GetConfigParams - * @treturn {[configSpec],...} + * @return Configuration[] */ int LuaUnsyncedRead::GetConfigParams(lua_State* L) { @@ -4378,9 +4320,9 @@ int LuaUnsyncedRead::GetConfigParams(lua_State* L) /*** * * @function Spring.GetConfigInt - * @string name + * @param name string * @tparam[opt=0] number|nil default - * @treturn nil|number configInt + * @return number? configInt */ int LuaUnsyncedRead::GetConfigInt(lua_State* L) { @@ -4399,9 +4341,9 @@ int LuaUnsyncedRead::GetConfigInt(lua_State* L) /*** * * @function Spring.GetConfigFloat - * @string name + * @param name string * @tparam[opt=0] number|nil default - * @treturn nil|number configFloat + * @return number? configFloat */ int LuaUnsyncedRead::GetConfigFloat(lua_State* L) { @@ -4420,9 +4362,9 @@ int LuaUnsyncedRead::GetConfigFloat(lua_State* L) /*** * * @function Spring.GetConfigString - * @string name + * @param name string * @tparam[opt=""] string|nil default - * @treturn nil|number configString + * @return number? configString */ int LuaUnsyncedRead::GetConfigString(lua_State* L) { @@ -4441,7 +4383,7 @@ int LuaUnsyncedRead::GetConfigString(lua_State* L) /*** * * @function Spring.GetLogSections - * @treturn {[string]=number,...} sections where keys are names and loglevel are values. E.g. `{ "KeyBindings" = LOG.INFO, "Font" = LOG.INFO, "Sound" = LOG.WARNING, ... }` + * @return table sections where keys are names and loglevel are values. E.g. `{ "KeyBindings" = LOG.INFO, "Font" = LOG.INFO, "Sound" = LOG.WARNING, ... }` */ int LuaUnsyncedRead::GetLogSections(lua_State* L) { const int numLogSections = log_filter_section_getNumRegisteredSections(); @@ -4470,7 +4412,7 @@ int LuaUnsyncedRead::GetLogSections(lua_State* L) { * * @function Spring.GetAllGroundDecals * - * @treturn {[number],...} decalIDs + * @return number[] decalIDs */ int LuaUnsyncedRead::GetAllGroundDecals(lua_State* L) { @@ -4503,9 +4445,9 @@ int LuaUnsyncedRead::GetAllGroundDecals(lua_State* L) /*** * * @function Spring.GetGroundDecalMiddlePos - * @number decalID - * @treturn nil|number posX - * @treturn number posZ + * @param decalID integer + * @return number? posX + * @return number posZ */ int LuaUnsyncedRead::GetGroundDecalMiddlePos(lua_State* L) { @@ -4524,15 +4466,15 @@ int LuaUnsyncedRead::GetGroundDecalMiddlePos(lua_State* L) /*** * * @function Spring.GetDecalQuadPos - * @number decalID - * @treturn nil|number posTL.x - * @treturn number posTL.z - * @treturn number posTR.x - * @treturn number posTR.z - * @treturn number posBR.x - * @treturn number posBR.z - * @treturn number posBL.x - * @treturn number posBL.z + * @param decalID integer + * @return number? posTL.x + * @return number posTL.z + * @return number posTR.x + * @return number posTR.z + * @return number posBR.x + * @return number posBR.z + * @return number posBL.x + * @return number posBL.z */ int LuaUnsyncedRead::GetGroundDecalQuadPos(lua_State* L) { @@ -4557,10 +4499,10 @@ int LuaUnsyncedRead::GetGroundDecalQuadPos(lua_State* L) /*** * * @function Spring.GetGroundDecalSizeAndHeight - * @number decalID - * @treturn nil|number sizeX - * @treturn number sizeY - * @treturn number projCubeHeight + * @param decalID integer + * @return number? sizeX + * @return number sizeY + * @return number projCubeHeight */ int LuaUnsyncedRead::GetGroundDecalSizeAndHeight(lua_State* L) { @@ -4581,8 +4523,8 @@ int LuaUnsyncedRead::GetGroundDecalSizeAndHeight(lua_State* L) /*** * * @function Spring.GetGroundDecalRotation - * @number decalID - * @treturn nil|number rotation in radians + * @param decalID integer + * @return number? rotation in radians */ int LuaUnsyncedRead::GetGroundDecalRotation(lua_State* L) { @@ -4600,9 +4542,9 @@ int LuaUnsyncedRead::GetGroundDecalRotation(lua_State* L) /*** * * @function Spring.GetGroundDecalTexture - * @number decalID - * @bool[opt=true] isMainTex If false, it gets the normals/glow map - * @treturn nil|string texture + * @param decalID integer + * @param isMainTex boolean? (Default: true) If false, it gets the normals/glow map + * @return nil|string texture */ int LuaUnsyncedRead::GetGroundDecalTexture(lua_State* L) { @@ -4615,8 +4557,8 @@ int LuaUnsyncedRead::GetGroundDecalTexture(lua_State* L) /*** * * @function Spring.GetDecalTextures - * @bool[opt=true] isMainTex If false, it gets the texture for normals/glow maps - * @treturn {[string],...} textureNames All textures on the atlas and available for use in SetGroundDecalTexture + * @param isMainTex boolean? (Default: true) If false, it gets the texture for normals/glow maps + * @return string[] textureNames All textures on the atlas and available for use in SetGroundDecalTexture */ int LuaUnsyncedRead::GetGroundDecalTextures(lua_State* L) { @@ -4630,9 +4572,9 @@ int LuaUnsyncedRead::GetGroundDecalTextures(lua_State* L) /*** * * @function Spring.SetGroundDecalTextureParams - * @number decalID - * @treturn nil|number texWrapDistance if non-zero sets the mode to repeat the texture along the left-right direction of the decal every texWrapFactor elmos - * @treturn number texTraveledDistance shifts the texture repetition defined by texWrapFactor so the texture of a next line in the continuous multiline can start where the previous finished. For that it should collect all elmo lengths of the previously set multiline segments. + * @param decalID integer + * @return number? texWrapDistance if non-zero sets the mode to repeat the texture along the left-right direction of the decal every texWrapFactor elmos + * @return number texTraveledDistance shifts the texture repetition defined by texWrapFactor so the texture of a next line in the continuous multiline can start where the previous finished. For that it should collect all elmo lengths of the previously set multiline segments. */ int LuaUnsyncedRead::GetGroundDecalTextureParams(lua_State* L) { @@ -4651,9 +4593,9 @@ int LuaUnsyncedRead::GetGroundDecalTextureParams(lua_State* L) /*** * * @function Spring.GetGroundDecalAlpha - * @number decalID - * @treturn nil|number alpha Between 0 and 1 - * @treturn number alphaFalloff Between 0 and 1, per second + * @param decalID integer + * @return number? alpha Between 0 and 1 + * @return number alphaFalloff Between 0 and 1, per second */ int LuaUnsyncedRead::GetGroundDecalAlpha(lua_State* L) { @@ -4674,10 +4616,10 @@ int LuaUnsyncedRead::GetGroundDecalAlpha(lua_State* L) * * If all three equal 0, the decal follows the normals of ground at midpoint * - * @number decalID - * @treturn nil|number normal.x - * @treturn number normal.y - * @treturn number normal.z + * @param decalID integer + * @return number? normal.x + * @return number normal.y + * @return number normal.z */ int LuaUnsyncedRead::GetGroundDecalNormal(lua_State* L) { @@ -4698,11 +4640,11 @@ int LuaUnsyncedRead::GetGroundDecalNormal(lua_State* L) * @function Spring.GetGroundDecalTint * Gets the tint of the ground decal. * A color of (0.5, 0.5, 0.5, 0.5) is effectively no tint - * @number decalID - * @treturn nil|number tintR - * @treturn number tintG - * @treturn number tintB - * @treturn number tintA + * @param decalID integer + * @return number? tintR + * @return number tintG + * @return number tintB + * @return number tintA */ int LuaUnsyncedRead::GetGroundDecalTint(lua_State* L) { @@ -4724,12 +4666,12 @@ int LuaUnsyncedRead::GetGroundDecalTint(lua_State* L) * * @function Spring.GetGroundDecalMisc * Returns less important parameters of a ground decal - * @number decalID - * @treturn nil|number dotElimExp - * @treturn number refHeight - * @treturn number minHeight - * @treturn number maxHeight - * @treturn number forceHeightMode + * @param decalID integer + * @return number? dotElimExp + * @return number refHeight + * @return number minHeight + * @return number maxHeight + * @return number forceHeightMode */ int LuaUnsyncedRead::GetGroundDecalMisc(lua_State* L) { @@ -4752,9 +4694,9 @@ int LuaUnsyncedRead::GetGroundDecalMisc(lua_State* L) * * Min can be not equal to max for "gradient" style decals, e.g. unit tracks * - * @number decalID - * @treturn nil|number creationFrameMin - * @treturn number creationFrameMax + * @param decalID integer + * @return number? creationFrameMin + * @return number creationFrameMax */ int LuaUnsyncedRead::GetGroundDecalCreationFrame(lua_State* L) { @@ -4773,8 +4715,8 @@ int LuaUnsyncedRead::GetGroundDecalCreationFrame(lua_State* L) /*** * * @function Spring.GetGroundDecalOwner - * @number decalID - * @treturn nil|number unitID|number featureID(+MAX_UNITS) + * @param decalID integer + * @return number? unitID|number featureID(+MAX_UNITS) */ int LuaUnsyncedRead::GetGroundDecalOwner(lua_State* L) { @@ -4794,8 +4736,8 @@ int LuaUnsyncedRead::GetGroundDecalOwner(lua_State* L) /*** * * @function Spring.GetGroundDecalType - * @number decalID - * @treturn nil|string type "explosion"|"plate"|"lua"|"track"|"unknown" + * @param decalID integer + * @return nil|string type "explosion"|"plate"|"lua"|"track"|"unknown" */ int LuaUnsyncedRead::GetGroundDecalType(lua_State* L) { @@ -4836,8 +4778,8 @@ int LuaUnsyncedRead::GetGroundDecalType(lua_State* L) /*** * * @function Spring.GetSyncedGCInfo - * @bool[opt=false] collectGC collect before returning metric - * @treturn nil|number GC values are expressed in Kbytes: #bytes/2^10 + * @param collectGC boolean? (Default: false) collect before returning metric + * @return number? GC values are expressed in Kbytes: #bytes/2^10 */ int LuaUnsyncedRead::GetSyncedGCInfo(lua_State* L) { if (luaRules == nullptr) @@ -4863,8 +4805,8 @@ int LuaUnsyncedRead::GetSyncedGCInfo(lua_State* L) { /*** * * @function Spring.SolveNURBSCurve - * @number groupID - * @treturn nil|{[number],...} unitIDs + * @param groupID integer + * @return number[]? unitIDs */ int LuaUnsyncedRead::SolveNURBSCurve(lua_State* L) { diff --git a/rts/Lua/LuaVAO.cpp b/rts/Lua/LuaVAO.cpp index 90d0212690..ca33bffb04 100644 --- a/rts/Lua/LuaVAO.cpp +++ b/rts/Lua/LuaVAO.cpp @@ -7,7 +7,6 @@ /****************************************************************************** - * @module LuaVAO * * @see rts/Lua/LuaVAO.cpp ******************************************************************************/ @@ -73,14 +72,15 @@ LuaVAOs::~LuaVAOs() luaVAOs.clear(); } - /*** - * - * @function gl.GetVAO - * @treturn nil|VAO the VAO ref on success, else nil - * @usage + * Example: + * ``` * local myVAO = gl.GetVAO() * if myVAO == nil then Spring.Echo("Failed to get VAO") end + * ``` + * + * @function gl.GetVAO + * @return VAO? vao The VAO ref on success, else `nil` */ int LuaVAOs::GetVAO(lua_State* L) { diff --git a/rts/Lua/LuaVAOImpl.cpp b/rts/Lua/LuaVAOImpl.cpp index 7194740bc4..03567ba54e 100644 --- a/rts/Lua/LuaVAOImpl.cpp +++ b/rts/Lua/LuaVAOImpl.cpp @@ -15,14 +15,14 @@ #include "LuaUtils.h" - -/****************************************************************************** +/*** * Vertex Array Object - * @classmod VAO - * + * + * @class VAO + * @table VAO * @see LuaVAO.GetVAO * @see rts/Lua/LuaVAOImpl.cpp -******************************************************************************/ + */ LuaVAOImpl::LuaVAOImpl() @@ -39,7 +39,7 @@ LuaVAOImpl::LuaVAOImpl() /*** * * @function VAO:Delete - * @treturn nil + * @return nil */ void LuaVAOImpl::Delete() { @@ -93,8 +93,8 @@ void LuaVAOImpl::AttachBufferImpl(const std::shared_ptr& luaVBO, std /*** Attachs a VBO to be used as a vertex buffer * * @function VAO:AttachVertexBuffer - * @tparam VBO vbo - * @treturn nil + * @param vbo VBO + * @return nil */ void LuaVAOImpl::AttachVertexBuffer(const LuaVBOImplSP& luaVBO) { @@ -105,8 +105,8 @@ void LuaVAOImpl::AttachVertexBuffer(const LuaVBOImplSP& luaVBO) /*** Attachs a VBO to be used as an instance buffer * * @function VAO:AttachInstanceBuffer - * @tparam VBO vbo - * @treturn nil + * @param vbo VBO + * @return nil */ void LuaVAOImpl::AttachInstanceBuffer(const LuaVBOImplSP& luaVBO) { @@ -117,8 +117,8 @@ void LuaVAOImpl::AttachInstanceBuffer(const LuaVBOImplSP& luaVBO) /*** Attachs a VBO to be used as an index buffer * * @function VAO:AttachIndexBuffer - * @tparam VBO vbo - * @treturn nil + * @param vbo VBO + * @return nil */ void LuaVAOImpl::AttachIndexBuffer(const LuaVBOImplSP& luaVBO) { @@ -367,12 +367,12 @@ LuaVAOImpl::DrawCheckResult LuaVAOImpl::DrawCheck(GLenum mode, const DrawCheckIn /*** * * @function VAO:DrawArrays - * @number glEnum primitivesMode - * @number[opt] vertexCount - * @number[opt] vertexFirst - * @number[opt] instanceCount - * @number[opt] instanceFirst - * @treturn nil + * @param glEnum number primitivesMode + * @param vertexCount number? + * @param vertexFirst number? + * @param instanceCount number? + * @param instanceFirst number? + * @return nil */ void LuaVAOImpl::DrawArrays(GLenum mode, sol::optional vertCountOpt, sol::optional vertexFirstOpt, sol::optional instanceCountOpt, sol::optional instanceFirstOpt) { @@ -404,13 +404,13 @@ void LuaVAOImpl::DrawArrays(GLenum mode, sol::optional vertCountOpt, sol::o /*** * * @function VAO:DrawElements - * @number glEnum primitivesMode - * @number[opt] drawCount - * @number[opt] baseIndex - * @number[opt] instanceCount - * @number[opt] baseVertex - * @number[opt] baseInstance - * @treturn nil + * @param glEnum number primitivesMode + * @param drawCount number? + * @param baseIndex number? + * @param instanceCount number? + * @param baseVertex number? + * @param baseInstance number? + * @return nil */ void LuaVAOImpl::DrawElements(GLenum mode, sol::optional indCountOpt, sol::optional indElemOffsetOpt, sol::optional instanceCountOpt, sol::optional baseVertexOpt, sol::optional instanceFirstOpt) { @@ -466,8 +466,8 @@ void LuaVAOImpl::ClearSubmission() /*** * * @function VAO:AddUnitsToSubmission - * @tparam number|{number,...} unitIDs - * @treturn number submittedCount + * @param unitIDs number|number[] + * @return number submittedCount */ int LuaVAOImpl::AddUnitsToSubmission(int id) { return AddObjectsToSubmissionImpl(id); } int LuaVAOImpl::AddUnitsToSubmission(const sol::stack_table& ids) { return AddObjectsToSubmissionImpl(ids); } @@ -476,8 +476,8 @@ int LuaVAOImpl::AddUnitsToSubmission(const sol::stack_table& ids) { return AddO /*** * * @function VAO:AddFeaturesToSubmission - * @tparam number|{number,...} featureIDs - * @treturn number submittedCount + * @param featureIDs number|number[] + * @return number submittedCount */ int LuaVAOImpl::AddFeaturesToSubmission(int id) { return AddObjectsToSubmissionImpl(id); } int LuaVAOImpl::AddFeaturesToSubmission(const sol::stack_table& ids) { return AddObjectsToSubmissionImpl(ids); } @@ -486,8 +486,8 @@ int LuaVAOImpl::AddFeaturesToSubmission(const sol::stack_table& ids) { return Ad /*** * * @function VAO:AddUnitDefsToSubmission - * @tparam number|{number,...} unitDefIDs - * @treturn number submittedCount + * @param unitDefIDs number|number[] + * @return number submittedCount */ int LuaVAOImpl::AddUnitDefsToSubmission(int id) { return AddObjectsToSubmissionImpl(id); } int LuaVAOImpl::AddUnitDefsToSubmission(const sol::stack_table& ids) { return AddObjectsToSubmissionImpl(ids); } @@ -496,8 +496,8 @@ int LuaVAOImpl::AddUnitDefsToSubmission(const sol::stack_table& ids) { return Ad /*** * * @function VAO:AddFeatureDefsToSubmission - * @tparam number|{number,...} featureDefIDs - * @treturn number submittedCount + * @param featureDefIDs number|number[] + * @return number submittedCount */ int LuaVAOImpl::AddFeatureDefsToSubmission(int id) { return AddObjectsToSubmissionImpl(id); } int LuaVAOImpl::AddFeatureDefsToSubmission(const sol::stack_table& ids) { return AddObjectsToSubmissionImpl(ids); } @@ -506,8 +506,8 @@ int LuaVAOImpl::AddFeatureDefsToSubmission(const sol::stack_table& ids) { return /*** * * @function VAO:RemoveFromSubmission - * @tparam number index - * @treturn nil + * @param index number + * @return nil */ void LuaVAOImpl::RemoveFromSubmission(int idx) { @@ -529,7 +529,7 @@ void LuaVAOImpl::RemoveFromSubmission(int idx) /*** * * @function VAO:Submit - * @treturn nil + * @return nil */ void LuaVAOImpl::Submit() { diff --git a/rts/Lua/LuaVBO.cpp b/rts/Lua/LuaVBO.cpp index 5e21066f35..9a725c5d87 100644 --- a/rts/Lua/LuaVBO.cpp +++ b/rts/Lua/LuaVBO.cpp @@ -12,7 +12,6 @@ /****************************************************************************** - * @module LuaVBO * * @see rts/Lua/LuaVBO.cpp ******************************************************************************/ @@ -120,22 +119,39 @@ LuaVBOs::~LuaVBOs() luaVBOs.clear(); } +/*** + * @alias GLBufferType + * | GL.ARRAY_BUFFER + * | GL.ELEMENT_ARRAY_BUFFER + * | GL.UNIFORM_BUFFER + * | GL.SHADER_STORAGE_BUFFER + */ + /*** + * Example: + * + * ```lua + * local myVBO = gl.GetVBO() + * if myVBO == nil then Spring.Echo("Failed to get VBO") end + * ``` * * @function gl.GetVBO - * @number[opt=GL.ARRAY_BUFFER] bufferType one of [`GL.ARRAY_BUFFER`, - * `GL.ELEMENT_ARRAY_BUFFER`, `GL.UNIFORM_BUFFER`, `GL.SHADER_STORAGE_BUFFER`]. + * + * @param bufferType GLBufferType? (Default: GL.ARRAY_BUFFER) * - * Defaults to `GL.ARRAY_BUFFER`, which you should use for vertex data, and - * `GL.ELEMENT_ARRAY_BUFFER` should be used for vertex indices. - * @bool[opt=true] freqUpdated whether should be updated frequently, when false - * will be updated only once - * @treturn nil|VBO the VBO ref on success, nil if not supported/or other error + * Use `GL.ARRAY_BUFFER` for vertex data and + * `GL.ELEMENT_ARRAY_BUFFER` for vertex indices. + * + * @param freqUpdated boolean? (Default: true) + * + * `true` to updated frequently, `false` to update only once. + * + * @return VBO? VBO + * + * The VBO ref on success, or nil if not supported or an error occurred. + * * @see GL.OpenGL_Buffer_Types - * @usage - * local myVBO = gl.GetVBO() - * if myVBO == nil then Spring.Echo("Failed to get VBO") end */ int LuaVBOs::GetVBO(lua_State* L) { diff --git a/rts/Lua/LuaVBOImpl.cpp b/rts/Lua/LuaVBOImpl.cpp index 8f13e3148c..8e2dd52c96 100644 --- a/rts/Lua/LuaVBOImpl.cpp +++ b/rts/Lua/LuaVBOImpl.cpp @@ -34,7 +34,7 @@ /****************************************************************************** * Vertex Buffer Object - * @classmod VBO + * @class VBO * * @see LuaVBO.GetVBO * @see rts/Lua/LuaVBOImpl.cpp @@ -109,7 +109,7 @@ inline void LuaVBOImpl::InstanceBufferCheckAndFormatCheck(int attrID, const char /*** * * @function VBO:Delete - * @treturn nil + * @return nil */ void LuaVBOImpl::Delete() { @@ -456,11 +456,54 @@ bool LuaVBOImpl::DefineElementArray(const sol::optional attribDefAr return true; } +/** + * @alias VBODataType + * | GL.BYTE + * | GL.UNSIGNED_BYTE + * | GL.SHORT + * | GL.UNSIGNED_SHORT + * | GL.INT + * | GL.UNSIGNED_INT + * | GL.FLOAT + */ -/*** Allows you to specify what kind of VBO you will be using. - * - * @function VBO:Define +/** + * @class VBOAttributeDef + * + * @field id integer + * The location in the vertex shader layout e.g.: layout (location = 0) in vec2 + * aPos. optional attrib, specifies location in the vertex shader. If not + * specified the implementation will increment the counter starting from 0. + * There can be maximum 16 attributes (so id of 15 is max). + * + * @field name string + * + * The name for this VBO, only used for debugging. + * + * @field size integer? + * + * Defaults to to 4 for VBO. The number of floats that constitute 1 element in + * this buffer. e.g. for the previous layout (location = 0) in vec2 aPos, it + * would be size = 2. + * + * @field type VBODataType (Default: `GL.FLOAT`) + * + * The datatype of this element. + * + * @field normalized boolean? (Defaults: `false`) + * + * It's possible to submit say normal without normalizing them first, normalized + * will make sure data is normalized. + */ + + +/*** + * Specify the kind of VBO you will be using. * + * ```lua + * @usage terrainVertexVBO:Define(numPoints, {{ id = 0, name = "pos", size = 2 }}) + * ``` + * * It is usually an array of vertex/color/uv data, but can also be an array of * instance uniforms. * @@ -470,40 +513,26 @@ bool LuaVBOImpl::DefineElementArray(const sol::optional attribDefAr * * If you want say 5 elements, and each element is defined in the layout: * - * {id = 0, name = "first", size = 1},{id = 1, name = "second", size = 2}} + * ```lua + * {id = 0, name = "first", size = 1},{id = 1, name = "second", size = 2}} + * ``` * - * , then the total size of your VBO will be 5 * (1 + 2). + * Then the total size of your VBO will be `5 * (1 + 2)`. * - * They will be laid out consecutively: [1,2],[1,2],[1,2],[1,2],[1,2]. + * They will be laid out consecutively: `[1,2],[1,2],[1,2],[1,2],[1,2]`. * - * This is important for when you call VBO:Upload, you need to make sure you + * This is important for when you call `VBO:Upload`, you need to make sure you * enter your data into the Lua array correctly. * - * @number size the maximum number of elements this VBO can have. - * @tparam number|{{number,number,number,number,number},...} attribs + * @function VBO:Define + * @param size number The maximum number of elements this VBO can have. + * @param attribs number|VBOAttributeDef[] * * When number, the maximum number of elements this VBO can have. * - * Otherwise, an array of arrays specifying the layout composed of: - * - * - `id`: the location in the vertex shader layout e.g.: layout (location = 0) - * in vec2 aPos. optional attrib, specifies location in the vertex shader. - * If not specified the implementation will increment the counter starting from 0. - * There can be maximum 16 attributes (so id of 15 is max). - * - `name`: the name for this VBO, only used for debugging - * - `size`: optional, defaults to 4 for VBO. The number of floats that - * constitute 1 element in this buffer. O.g. for the previous layout - * (location = 0) in vec2 aPos, it would be size = 2. - * - `type`: is the datatype of this element, can be: `GL.BYTE`, - * `GL.UNSIGNED_BYTE`, `GL.SHORT`, `GL.UNSIGNED_SHORT`, `GL.INT`, - * `GL.UNSIGNED_INT`, `GL.FLOAT`. Default is `GL.FLOAT`. - * - `normalized`: it's possible to submit say normal without normalizing them - * first, normalized will make sure data is normalized. - * Optional attrib, defaults to false. - * - * @treturn nil + * Otherwise, an array of arrays specifying the layout. * - * @usage terrainVertexVBO:Define(numPoints, { {id = 0, name = "pos", size = 2}, }) + * @return nil * @see GL.OpenGL_Data_Types * @see VBO:Upload */ @@ -557,9 +586,9 @@ void LuaVBOImpl::Define(const int elementsCount, const sol::optional LuaVBOImpl::GetBufferSize() { @@ -571,28 +600,37 @@ std::tuple LuaVBOImpl::GetBufferSize() } -/*** Uploads the data (array of floats) into the VBO +/*** + * Uploads the data (array of floats) into the VBO * - * @function VBO:Upload - * @tparam {number,...} vboData a lua array of values to upload into the - * VBO - * @number[opt=-1] attributeIndex If supplied with non-default value then the - * data from vboData will only be used to upload the data to this particular - * attribute. - * The whole vboData is expected to contain only attributeIndex data. - * Otherwise all attributes get updated sequentially across attributes and elements. - * @number[opt=0] elemOffset which VBO element to start uploading data from Lua array into - * @number[opt=0] luaStartIndex start uploading from that element in supplied Lua array - * @number[opt] luaFinishIndex consider this element the last element in Lua array - * @treturn {number, ...} indexData - * @treturn number elemOffset - * @treturn number|{number,number,number,number} attrID - * @usage + * ```lua * vbo:Upload(posArray, 0, 1) * -- 0 is offset into vbo (on GPU) in this case no offset * -- 1 is lua index index into the Lua table, in this case it's same as default * -- Upload will upload from luaOffset to end of lua array + * ``` + * + * ```lua * @usage rectInstanceVBO:Upload({1},0) + * ``` + * + * @function VBO:Upload + * @param vboData number[] a lua array of values to upload into the VBO + * @param attributeIndex integer? (Default: -1) + * + * If supplied with non-default value then the data from vboData will only be + * used to upload the data to this particular attribute. + * + * The whole vboData is expected to contain only attributeIndex data. + * + * Otherwise all attributes get updated sequentially across attributes and elements. + * + * @param elemOffset integer? (Default: 0) Which VBO element to start uploading data from Lua array into. + * @param luaStartIndex integer? (Default: 1) Start uploading from that element in supplied Lua array. + * @param luaFinishIndex integer? Consider this element the last element in Lua array. + * @return number[] indexData + * @return integer elemOffset + * @return integer|[integer,integer,integer,integer] attrID * @see VBO:Define */ size_t LuaVBOImpl::Upload(const sol::stack_table& luaTblData, sol::optional attribIdxOpt, sol::optional elemOffsetOpt, sol::optional luaStartIndexOpt, sol::optional luaFinishIndexOpt) @@ -640,14 +678,14 @@ size_t LuaVBOImpl::Upload(const sol::stack_table& luaTblData, sol::optional /*** * * @function VBO:Download - * @number[opt=-1] attributeIndex when supplied with non-default value: only data + * @param attributeIndex integer? (Default: -1) when supplied with non-default value: only data * from specified attribute will be downloaded - otherwise all attributes are * downloaded - * @number[opt=0] elementOffset download data starting from this element - * @number[opt] elementCount number of elements to download - * @bool[opt=false] forceGPURead force downloading the data from GPU buffer as opposed + * @param elementOffset integer? (Default: 0) download data starting from this element + * @param elementCount number? number of elements to download + * @param forceGPURead boolean? (Default: false) force downloading the data from GPU buffer as opposed * to using shadow RAM buffer - * @treturn {{number,...},...} vboData + * @return [number, ...][] vboData */ sol::as_table_t> LuaVBOImpl::Download(sol::optional attribIdxOpt, sol::optional elemOffsetOpt, sol::optional elemCountOpt, sol::optional forceGPUReadOpt) { @@ -1153,7 +1191,7 @@ size_t LuaVBOImpl::UploadImpl(const std::vector& dataVec, uint32_t elemOffs * * Also fills in VBO definition data as they're set for engine models (no need to do VBO:Define()). * - * @treturn nil|number buffer size in bytes + * @return nil|number buffer size in bytes */ size_t LuaVBOImpl::ModelsVBO() { @@ -1174,22 +1212,23 @@ size_t LuaVBOImpl::ModelsVBO() * matrix in global matrices SSBO and offset to uniform buffer structure in * global per unit/feature uniform SSBO (unused for Unit/FeatureDefs), as * well as some auxiliary data ushc as draw flags and team index. - * - * @tparam number|{number,...} unitDefIDs - * @number attrID - * @number[opt] teamIdOpt - * @number[opt] elementOffset - * @treturn {number,number,number,number} instanceData - * @treturn number elementOffset - * @treturn attrID - * @usage - * Data Layout - * + * + * Data Layout: + * ``` * SInstanceData: * , matOffset{ matOffset_ } // updated during the following draw frames * , uniOffset{ uniOffset_ } // updated during the following draw frames * , info{ teamIndex, drawFlags, 0, 0 } // not updated during the following draw frames * , aux1 { 0u } + * ``` + * + * @param unitDefIDs number|number[] + * @param attrID integer + * @param teamIdOpt integer? + * @param elementOffset integer? + * @return [number,number,number,number] instanceData + * @return integer elementOffset + * @return integer attrID */ size_t LuaVBOImpl::InstanceDataFromUnitDefIDs(int id, int attrID, sol::optional teamIdOpt, sol::optional elemOffsetOpt) { @@ -1212,22 +1251,23 @@ size_t LuaVBOImpl::InstanceDataFromUnitDefIDs(const sol::stack_table& ids, int a * matrix in global matrices SSBO and offset to uniform buffer structure in * global per unit/feature uniform SSBO (unused for Unit/FeatureDefs), as * well as some auxiliary data ushc as draw flags and team index. - * - * @tparam number|{number,...} featureDefIDs - * @number attrID - * @number[opt] teamIdOpt - * @number[opt] elementOffset - * @treturn {number,number,number,number} instanceData - * @treturn number elementOffset - * @treturn attrID - * @usage + * * Data Layout - * + * ``` * SInstanceData: * , matOffset{ matOffset_ } // updated during the following draw frames * , uniOffset{ uniOffset_ } // updated during the following draw frames * , info{ teamIndex, drawFlags, 0, 0 } // not updated during the following draw frames * , aux1 { 0u } + * ``` + * + * @param featureDefIDs number|number[] + * @param attrID integer + * @param teamIdOpt integer? + * @param elementOffset integer? + * @return [number,number,number,number] instanceData + * @return integer elementOffset + * @return integer attrID */ size_t LuaVBOImpl::InstanceDataFromFeatureDefIDs(int id, int attrID, sol::optional teamIdOpt, sol::optional elemOffsetOpt) { @@ -1250,22 +1290,24 @@ size_t LuaVBOImpl::InstanceDataFromFeatureDefIDs(const sol::stack_table& ids, in * matrix in global matrices SSBO and offset to uniform buffer structure in * global per unit/feature uniform SSBO (unused for Unit/FeatureDefs), as * well as some auxiliary data ushc as draw flags and team index. - * - * @tparam number|{number,...} unitIDs - * @number attrID - * @number[opt] teamIdOpt - * @number[opt] elementOffset - * @treturn {number,number,number,number} instanceData - * @treturn number elementOffset - * @treturn attrID - * @usage + * * Data Layout * + * ``` * SInstanceData: * , matOffset{ matOffset_ } // updated during the following draw frames * , uniOffset{ uniOffset_ } // updated during the following draw frames * , info{ teamIndex, drawFlags, 0, 0 } // not updated during the following draw frames * , aux1 { 0u } + * ``` + * + * @param unitIDs number|number[] + * @param attrID integer + * @param teamIdOpt integer? + * @param elementOffset integer? + * @return [number,number,number,number] instanceData + * @return integer elementOffset + * @return integer attrID */ size_t LuaVBOImpl::InstanceDataFromUnitIDs(int id, int attrID, sol::optional elemOffsetOpt) { @@ -1287,13 +1329,13 @@ size_t LuaVBOImpl::InstanceDataFromUnitIDs(const sol::stack_table& ids, int attr * global per unit/feature uniform SSBO (unused for Unit/FeatureDefs), as * well as some auxiliary data ushc as draw flags and team index. * - * @tparam number|{number,...} featureIDs - * @number attrID - * @number[opt] teamIdOpt - * @number[opt] elementOffset - * @treturn {number,number,number,number} instanceData - * @treturn number elementOffset - * @treturn attrID + * @param featureIDs number|number[] + * @param attrID integer + * @param teamIdOpt integer? + * @param elementOffset integer? + * @return [number,number,number,number] instanceData + * @return integer elementOffset + * @return integer attrID */ size_t LuaVBOImpl::InstanceDataFromFeatureIDs(int id, int attrID, sol::optional elemOffsetOpt) { @@ -1309,13 +1351,13 @@ size_t LuaVBOImpl::InstanceDataFromFeatureIDs(const sol::stack_table& ids, int a /*** * * @function VBO:MatrixDataFromProjectileIDs - * @tparam number|{number,...} projectileIDs - * @number attrID - * @number[opt] teamIdOpt - * @number[opt] elementOffset - * @treturn {number, ...} matDataVec 4x4 matrix - * @treturn number elemOffset - * @treturn number|{number,number,number,number} attrID + * @param projectileIDs integer|integer[] + * @param attrID integer + * @param teamIdOpt integer? + * @param elementOffset integer? + * @return number[] matDataVec 4x4 matrix + * @return integer elemOffset + * @return integer|[integer,integer,integer,integer] attrID */ size_t LuaVBOImpl::MatrixDataFromProjectileIDs(int id, int attrID, sol::optional elemOffsetOpt) { @@ -1396,12 +1438,12 @@ int LuaVBOImpl::BindBufferRangeImpl(GLuint bindingIndex, const sol::optional elemOffsetOpt, const sol::optional elemCountOpt, const sol::optional targetOpt) { @@ -1412,11 +1454,11 @@ int LuaVBOImpl::BindBufferRange(const GLuint index, const sol::optional ele /*** * * @function VBO:UnbindBufferRange - * @tparam number index - * @number[opt] elementOffset - * @number[opt] elementCount - * @number[opt] target glEnum - * @treturn number bindingIndex when successful, -1 otherwise + * @param index integer + * @param elementOffset integer? + * @param elementCount number? + * @param target number? glEnum + * @return number bindingIndex when successful, -1 otherwise */ int LuaVBOImpl::UnbindBufferRange(const GLuint index, const sol::optional elemOffsetOpt, const sol::optional elemCountOpt, const sol::optional targetOpt) { @@ -1427,7 +1469,7 @@ int LuaVBOImpl::UnbindBufferRange(const GLuint index, const sol::optional e /*** Logs the definition of the VBO to the console * * @function VBO:DumpDefinition - * @treturn nil + * @return nil */ void LuaVBOImpl::DumpDefinition() { diff --git a/rts/Lua/LuaVFS.cpp b/rts/Lua/LuaVFS.cpp index 07769bd976..b0acbc4ac4 100644 --- a/rts/Lua/LuaVFS.cpp +++ b/rts/Lua/LuaVFS.cpp @@ -26,7 +26,6 @@ /****************************************************************************** * Virtual File System - * @module VFS * * @see rts/Lua/LuaVFS.cpp ******************************************************************************/ diff --git a/rts/Lua/LuaZip.cpp b/rts/Lua/LuaZip.cpp index 6282e1317d..daf209b7d6 100644 --- a/rts/Lua/LuaZip.cpp +++ b/rts/Lua/LuaZip.cpp @@ -3,7 +3,6 @@ /****************************************************************************** * LuaZip - * @module LuaZip * * @see rts/Lua/LuaZip.cpp ******************************************************************************/ diff --git a/rts/Lua/library/Types.lua b/rts/Lua/library/Types.lua new file mode 100644 index 0000000000..005270b966 --- /dev/null +++ b/rts/Lua/library/Types.lua @@ -0,0 +1,120 @@ +---@meta + +-------------------------------------------------------------------------------- +-- Vectors +-------------------------------------------------------------------------------- + +---Cartesian triple (XYZ) +--- +---@class xyz +---@field x number +---@field y number +---@field z number + +---@alias float3 xyz + +-------------------------------------------------------------------------------- +-- Color +-------------------------------------------------------------------------------- + +---Color triple (RGB) +--- +---@class rgb +---@field r number +---@field g number +---@field b number + +---Color quadruple (RGBA) +--- +---@class rgba +---@field r number +---@field g number +---@field b number +---@field a number + +-------------------------------------------------------------------------------- +-- Camera +-------------------------------------------------------------------------------- + +---@alias CameraMode +---| 0 # fps +---| 1 # ta +---| 2 # spring +---| 3 # rot +---| 4 # free +---| 5 # ov +---| 6 # dummy + +---Parameters for camera state +--- +---@class CameraState +--- +---Highly dependent on the type of the current camera controller +---@field name "ta"|"spring"|"rot"|"ov"|"free"|"fps"|"dummy" +---@field mode CameraMode The camera mode +---@field fov number? +---@field px number? Position X of the ground point in screen center +---@field py number? Position Y of the ground point in screen center +---@field pz number? Position Z of the ground point in screen center +---@field dx number? Camera direction vector X +---@field dy number? Camera direction vector Y +---@field dz number? Camera direction vector Z +---@field rx number? Camera rotation angle on X axis (spring) +---@field ry number? Camera rotation angle on Y axis (spring) +---@field rz number? Camera rotation angle on Z axis (spring) +---@field angle number? Camera rotation angle on X axis (aka tilt/pitch) (ta) +---@field flipped number? -1 for when south is down, 1 for when north is down (ta) +---@field dist number? Camera distance from the ground (spring) +---@field height number? Camera distance from the ground (ta) +---@field oldHeight number? Camera distance from the ground, cannot be changed (rot) + +-------------------------------------------------------------------------------- +-- Commands +-------------------------------------------------------------------------------- + +---Parameters for command options +--- +---@class CommandOptions +---@field coded integer +---@field alt boolean +---@field ctrl boolean +---@field shift boolean +---@field right boolean +---@field meta boolean +---@field internal boolean + +---Used when assigning multiple commands at once +--- +---@class Command +---@field cmdID integer +---@field params number[] +---@field options CommandOptions + +---Command Description +--- +---Contains data about a command. +--- +---@class CommandDescription +---@field id integer? +---@field type integer? +---@field name string? +---@field action string? +---@field tooltip string? +---@field texture string? +---@field cursor string? +---@field queueing boolean? +---@field hidden boolean? +---@field disabled boolean? +---@field showUnique boolean? +---@field onlyTexture boolean? +---@field params table? + +-------------------------------------------------------------------------------- +-- Resources +-------------------------------------------------------------------------------- + +---@alias ResourceName "metal"|"energy"|"m"|"e" + +---@alias StorageName "metalStorage"|"energyStorage"|"ms"|"es" + +---@alias ResourceUsage table \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaArchive.lua b/rts/Lua/library/generated/LuaArchive.lua new file mode 100644 index 0000000000..71e952f20a --- /dev/null +++ b/rts/Lua/library/generated/LuaArchive.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaArchive.cpp +--- +---@meta + diff --git a/rts/Lua/library/generated/LuaAtlasTextures.lua b/rts/Lua/library/generated/LuaAtlasTextures.lua new file mode 100644 index 0000000000..efdc7209ed --- /dev/null +++ b/rts/Lua/library/generated/LuaAtlasTextures.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaAtlasTextures.cpp +--- +---@meta + diff --git a/rts/Lua/library/generated/LuaBitOps.lua b/rts/Lua/library/generated/LuaBitOps.lua new file mode 100644 index 0000000000..5d447236ed --- /dev/null +++ b/rts/Lua/library/generated/LuaBitOps.lua @@ -0,0 +1,64 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaBitOps.cpp +--- +---@meta + +---math bit extensions +--- +---Note: there are no bit shift. Use those Lua functions instead for 24 bits bitshift +---24 bits because only the 24 bits of the mantissa can be easily used in a 32 bit float +---bitshift functions (<<, >> equivalent) +--- +----- left shift +---local function lsh(value,shift) +---return (value*(2^shift)) % 2^24 +---end +--- +----- right shift +---local function rsh(value,shift) +---return math.floor(value/2^shift) % 2^24 +---end +--- +---@see rts/Lua/LuaBitOps.cpp + +---Returns the bitwise OR of all arguments. Only use up to 24 bit integers. +--- +---@param a1 integer +---@param a2 integer +---@param ... integer +---@return integer result +function math.bit_or(a1, a2, ...) end + +---Returns the bitwise AND of all arguments. Only use up to 24 bit integers. +--- +---@param a1 integer +---@param a2 integer +---@param ... integer +---@return integer result +function math.bit_and(a1, a2, ...) end + +---Returns the bitwise XOR of all arguments. Only use up to 24 bit integers. +--- +---@param a1 integer +---@param a2 integer +---@param ... integer +---@return integer result +function math.bit_xor(a1, a2, ...) end + +---Returns the bitwise NOT of the 24 bit integer argument. +--- +---@param value integer +---@return integer result +function math.bit_inv(value) end + +---Set each of the bits of a 24 bit integer. Returns result = result OR (1 << a1) OR (1 << a2) OR ...;) +--- +---@param a1 integer +---@param a2 integer +---@param ... integer +---@return integer result +function math.bit_bits(a1, a2, ...) end \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaConstCMD.lua b/rts/Lua/library/generated/LuaConstCMD.lua new file mode 100644 index 0000000000..a854a38699 --- /dev/null +++ b/rts/Lua/library/generated/LuaConstCMD.lua @@ -0,0 +1,198 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaConstCMD.cpp +--- +---@meta + +---Command constants +--- +---@see rts/Lua/LuaConstCMD.cpp + +---@enum CMD +CMD = { + ---@type -1 + FIRESTATE_NONE = nil, + + ---@type -1 + MOVESTATE_NONE = nil, + + ---@type 0 + STOP = nil, + + ---@type 0 + MOVESTATE_HOLDPOS = nil, + + ---@type 0 + FIRESTATE_HOLDFIRE = nil, + + ---@type 1 + INSERT = nil, + + ---@type 1 + MOVESTATE_MANEUVER = nil, + + ---@type 1 + FIRESTATE_RETURNFIRE = nil, + + ---@type 1 + WAITCODE_TIME = nil, + + ---@type 2 + WAITCODE_DEATH = nil, + + ---@type 2 + MOVESTATE_ROAM = nil, + + ---@type 2 + REMOVE = nil, + + ---@type 2 + FIRESTATE_FIREATWILL = nil, + + ---@type 3 + FIRESTATE_FIREATNEUTRAL = nil, + + ---@type 3 + WAITCODE_SQUAD = nil, + + ---@type 4 + OPT_META = nil, + + ---@type 4 + WAITCODE_GATHER = nil, + + ---@type 5 + WAIT = nil, + + ---@type 6 + TIMEWAIT = nil, + + ---@type 7 + DEATHWAIT = nil, + + ---@type 8 + OPT_INTERNAL = nil, + + ---@type 8 + SQUADWAIT = nil, + + ---@type 9 + GATHERWAIT = nil, + + ---@type 10 + MOVE = nil, + + ---@type 15 + PATROL = nil, + + ---@type 16 + FIGHT = nil, + + ---@type 16 + OPT_RIGHT = nil, + + ---@type 20 + LOOPBACKATTACK = nil, + + ---@type 20 + ATTACK = nil, + + ---@type 21 + AREA_ATTACK = nil, + + ---@type 25 + GUARD = nil, + + ---@type 32 + OPT_SHIFT = nil, + + ---@type 35 + GROUPSELECT = nil, + + ---@type 36 + GROUPADD = nil, + + ---@type 37 + GROUPCLEAR = nil, + + ---@type 40 + REPAIR = nil, + + ---@type 45 + FIRE_STATE = nil, + + ---@type 50 + MOVE_STATE = nil, + + ---@type 55 + SETBASE = nil, + + ---@type 60 + INTERNAL = nil, + + ---@type 64 + OPT_CTRL = nil, + + ---@type 65 + SELFD = nil, + + ---@type 70 + SET_WANTED_MAX_SPEED = nil, + + ---@type 75 + LOAD_UNITS = nil, + + ---@type 76 + LOAD_ONTO = nil, + + ---@type 80 + UNLOAD_UNITS = nil, + + ---@type 81 + UNLOAD_UNIT = nil, + + ---@type 85 + ONOFF = nil, + + ---@type 90 + RECLAIM = nil, + + ---@type 95 + CLOAK = nil, + + ---@type 100 + STOCKPILE = nil, + + ---@type 105 + MANUALFIRE = nil, + + ---@type 105 + DGUN = nil, + + ---@type 110 + RESTORE = nil, + + ---@type 115 + REPEAT = nil, + + ---@type 120 + TRAJECTORY = nil, + + ---@type 125 + RESURRECT = nil, + + ---@type 128 + OPT_ALT = nil, + + ---@type 130 + CAPTURE = nil, + + ---@type 135 + AUTOREPAIRLEVEL = nil, + + ---@type 145 + IDLEMODE = nil +} \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaConstCMDTYPE.lua b/rts/Lua/library/generated/LuaConstCMDTYPE.lua new file mode 100644 index 0000000000..af40a88b5d --- /dev/null +++ b/rts/Lua/library/generated/LuaConstCMDTYPE.lua @@ -0,0 +1,65 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaConstCMDTYPE.cpp +--- +---@meta + +---Command type constants +--- +---@see rts/Lua/LuaConstCMDTYPE.cpp + +---Note, the CMDTYPE[] table is bidirectional. That means: CMDTYPE[CMDTYPE.ICON] := "CMDTYPE_ICON" +--- +---@enum CMDTYPE +CMDTYPE = { + ---@type number expect 0 parameters in return + ICON = nil, + + ---@type number expect 1 parameter in return (number selected mode) + ICON_MODE = nil, + + ---@type number expect 3 parameters in return (mappos) + ICON_MAP = nil, + + ---@type number expect 4 parameters in return (mappos+radius) + ICON_AREA = nil, + + ---@type number expect 1 parameters in return (unitid) + ICON_UNIT = nil, + + ---@type number expect 1 parameters in return (unitid) or 3 parameters in return (mappos) + ICON_UNIT_OR_MAP = nil, + + ---@type number expect 3 or 6 parameters in return (middle and right side of front if a front was defined) + ICON_FRONT = nil, + + ---@type number expect 1 parameter in return (number selected option) + COMBO_BOX = nil, + + ---@type number expect 1 parameter in return (unitid) or 4 parameters in return (mappos+radius) + ICON_UNIT_OR_AREA = nil, + + ---@type number expect 1 parameter in return (unitid or Game.maxUnits+featureid) or 4 parameters in return (mappos+radius) + ICON_UNIT_FEATURE_OR_AREA = nil, + + ---@type number expect 3 parameters in return (mappos) + ICON_BUILDING = nil, + + ---@type number expect 1 parameter in return (unitid) or 3 parameters in return (mappos) or 6 parameters in return (startpos+endpos) + ICON_UNIT_OR_RECTANGLE = nil, + + ---@type number expect 1 parameter in return (number) + NUMBER = nil, + + ---@type number used with CMD_INTERNAL + CUSTOM = nil, + + ---@type number next command page used with CMD_INTERNAL + NEXT = nil, + + ---@type number previous command page used with CMD_INTERNAL + PREV = nil +} \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaConstCOB.lua b/rts/Lua/library/generated/LuaConstCOB.lua new file mode 100644 index 0000000000..721a4f0508 --- /dev/null +++ b/rts/Lua/library/generated/LuaConstCOB.lua @@ -0,0 +1,329 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaConstCOB.cpp +--- +---@meta + +---COB constants +--- +---@see rts/Lua/LuaConstCOB.cpp + +---@enum COB +COB = { + ---@type number + ACTIVATION = nil, + + ---@type number + STANDINGMOVEORDERS = nil, + + ---@type number + STANDINGFIREORDERS = nil, + + ---@type number + HEALTH = nil, + + ---@type number + INBUILDSTANCE = nil, + + ---@type number + BUSY = nil, + + ---@type number + PIECE_XZ = nil, + + ---@type number + PIECE_Y = nil, + + ---@type number + UNIT_XZ = nil, + + ---@type number + UNIT_Y = nil, + + ---@type number + UNIT_HEIGHT = nil, + + ---@type number + XZ_ATAN = nil, + + ---@type number + XZ_HYPOT = nil, + + ---@type number + ATAN = nil, + + ---@type number + HYPOT = nil, + + ---@type number + GROUND_HEIGHT = nil, + + ---@type number + BUILD_PERCENT_LEFT = nil, + + ---@type number + YARD_OPEN = nil, + + ---@type number + BUGGER_OFF = nil, + + ---@type number + ARMORED = nil, + + ---@type number + IN_WATER = nil, + + ---@type number + CURRENT_SPEED = nil, + + ---@type number + VETERAN_LEVEL = nil, + + ---@type number + ON_ROAD = nil, + + ---@type number + MAX_ID = nil, + + ---@type number + MY_ID = nil, + + ---@type number + UNIT_TEAM = nil, + + ---@type number + UNIT_BUILD_PERCENT_LEFT = nil, + + ---@type number + UNIT_ALLIED = nil, + + ---@type number + MAX_SPEED = nil, + + ---@type number + CLOAKED = nil, + + ---@type number + WANT_CLOAK = nil, + + ---@type number + GROUND_WATER_HEIGHT = nil, + + ---@type number + UPRIGHT = nil, + + ---@type number + POW = nil, + + ---@type number + PRINT = nil, + + ---@type number + HEADING = nil, + + ---@type number + TARGET_ID = nil, + + ---@type number + LAST_ATTACKER_ID = nil, + + ---@type number + LOS_RADIUS = nil, + + ---@type number + AIR_LOS_RADIUS = nil, + + ---@type number + RADAR_RADIUS = nil, + + ---@type number + JAMMER_RADIUS = nil, + + ---@type number + SONAR_RADIUS = nil, + + ---@type number + SONAR_JAM_RADIUS = nil, + + ---@type number + SEISMIC_RADIUS = nil, + + ---@type number + DO_SEISMIC_PING = nil, + + ---@type number + CURRENT_FUEL = nil, + + ---@type number + TRANSPORT_ID = nil, + + ---@type number + SHIELD_POWER = nil, + + ---@type number + STEALTH = nil, + + ---@type number + CRASHING = nil, + + ---@type number + CHANGE_TARGET = nil, + + ---@type number + CEG_DAMAGE = nil, + + ---@type number + COB_ID = nil, + + ---@type number + PLAY_SOUND = nil, + + ---@type number + KILL_UNIT = nil, + + ---@type number + ALPHA_THRESHOLD = nil, + + ---@type number + SET_WEAPON_UNIT_TARGET = nil, + + ---@type number + SET_WEAPON_GROUND_TARGET = nil, + + ---@type number + SONAR_STEALTH = nil, + + ---@type number + REVERSING = nil, + + ---@type number + FLANK_B_MODE = nil, + + ---@type number + FLANK_B_DIR = nil, + + ---@type number + FLANK_B_MOBILITY_ADD = nil, + + ---@type number + FLANK_B_MAX_DAMAGE = nil, + + ---@type number + FLANK_B_MIN_DAMAGE = nil, + + ---@type number + WEAPON_RELOADSTATE = nil, + + ---@type number + WEAPON_RELOADTIME = nil, + + ---@type number + WEAPON_ACCURACY = nil, + + ---@type number + WEAPON_SPRAY = nil, + + ---@type number + WEAPON_RANGE = nil, + + ---@type number + WEAPON_PROJECTILE_SPEED = nil, + + ---@type number + MIN = nil, + + ---@type number + MAX = nil, + + ---@type number + ABS = nil, + + ---@type number + GAME_FRAME = nil +} + +---@enum SFX +SFX = { + ---@type number + ---Piece Flag for `Spring.UnitScript.Explode` + SHATTER = nil, + + ---@type number + ---Piece Flag for `Spring.UnitScript.Explode` + EXPLODE = nil, + + ---@type number + ---Piece Flag for `Spring.UnitScript.Explode` + EXPLODE_ON_HIT = nil, + + ---@type number + ---Piece Flag for `Spring.UnitScript.Explode` + FALL = nil, + + ---@type number + ---Piece Flag for `Spring.UnitScript.Explode` + SMOKE = nil, + + ---@type number + ---Piece Flag for `Spring.UnitScript.Explode` + FIRE = nil, + + ---@type number + ---Piece Flag for `Spring.UnitScript.Explode` + NONE = nil, + + ---@type number + ---Piece Flag for `Spring.UnitScript.Explode` + NO_CEG_TRAIL = nil, + + ---@type number + ---Piece Flag for `Spring.UnitScript.Explode` + NO_HEATCLOUD = nil, + + ---@type number + ---Piece Flag for `Spring.UnitScript.Explode` + RECURSIVE = nil, + + ---@type number + ---For `Spring.UnitScript.EmitSfx`. + VTOL = nil, + + ---@type number + ---For `Spring.UnitScript.EmitSfx`. + WAKE = nil, + + ---@type number + ---For `Spring.UnitScript.EmitSfx`. + REVERSE_WAKE = nil, + + ---@type number + ---For `Spring.UnitScript.EmitSfx`. + WHITE_SMOKE = nil, + + ---@type number + ---For `Spring.UnitScript.EmitSfx`. + BLACK_SMOKE = nil, + + ---@type number + ---For `Spring.UnitScript.EmitSfx`. + BUBBLE = nil, + + ---@type number + ---For `Spring.UnitScript.EmitSfx`. + CEG = nil, + + ---@type number + ---For `Spring.UnitScript.EmitSfx`. + FIRE_WEAPON = nil, + + ---@type number + ---For `Spring.UnitScript.EmitSfx`. + DETONATE_WEAPON = nil, + + ---@type number + ---For `Spring.UnitScript.EmitSfx`. + GLOBAL = nil +} \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaConstEngine.lua b/rts/Lua/library/generated/LuaConstEngine.lua new file mode 100644 index 0000000000..3f59c71099 --- /dev/null +++ b/rts/Lua/library/generated/LuaConstEngine.lua @@ -0,0 +1,38 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaConstEngine.cpp +--- +---@meta + +---Engine constants +--- +---@see rts/Lua/LuaConstEngine.cpp + +---@class FeatureSupport +---@field hasExitOnlyYardmaps boolean +---@field rmlUiApiVersion integer +local FeatureSupport = {} + +---Engine specific information. +Engine = { + ---@type string Returns the same as `spring *sync-version`, e.g. "92" + version = nil, + + ---@type string + versionFull = nil, + + ---@type string + versionPatchSet = nil, + + ---@type string (unsynced only) Gets additional engine buildflags, e.g. "OMP" or "MT-Sim DEBUG" + buildFlags = nil, + + ---@type FeatureSupport table containing various engine features as keys; use for cross-version compat + FeatureSupport = nil, + + ---@type number indicates the build type and is either 32 or 64 (or 0 in synced code) + wordSize = nil +} \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaConstGL.lua b/rts/Lua/library/generated/LuaConstGL.lua new file mode 100644 index 0000000000..7d16aa50f0 --- /dev/null +++ b/rts/Lua/library/generated/LuaConstGL.lua @@ -0,0 +1,634 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaConstGL.cpp +--- +---@meta + +---OpenGL Constants +--- +---@see rts/Lua/LuaConstGL.cpp + +---Drawing Primitives +--- +---@section primitives + +---@enum GL +GL = { + ---@type number + POINTS = nil, + + ---@type number + LINES = nil, + + ---@type number + LINE_LOOP = nil, + + ---@type number + LINE_STRIP = nil, + + ---@type number + TRIANGLES = nil, + + ---@type number + TRIANGLE_STRIP = nil, + + ---@type number + TRIANGLE_FAN = nil, + + ---@type number + QUADS = nil, + + ---@type number + QUAD_STRIP = nil, + + ---@type number + POLYGON = nil, + + ---@type number + PATCHES = nil, + + ---@type number + ZERO = nil, + + ---@type number + ONE = nil, + + ---@type number + SRC_COLOR = nil, + + ---@type number + ONE_MINUS_SRC_COLOR = nil, + + ---@type number + SRC_ALPHA = nil, + + ---@type number + ONE_MINUS_SRC_ALPHA = nil, + + ---@type number + DST_ALPHA = nil, + + ---@type number + ONE_MINUS_DST_ALPHA = nil, + + ---@type number + ZERO = nil, + + ---@type number + ONE = nil, + + ---@type number + SRC_COLOR = nil, + + ---@type number + ONE_MINUS_SRC_COLOR = nil, + + ---@type number + SRC_ALPHA = nil, + + ---@type number + ONE_MINUS_SRC_ALPHA = nil, + + ---@type number + DST_ALPHA = nil, + + ---@type number + ONE_MINUS_DST_ALPHA = nil, + + ---@type number + DST_COLOR = nil, + + ---@type number + ONE_MINUS_DST_COLOR = nil, + + ---@type number + SRC_ALPHA_SATURATE = nil, + + ---@type number + FUNC_ADD = nil, + + ---@type number + FUNC_SUBTRACT = nil, + + ---@type number + FUNC_REVERSE_SUBTRACT = nil, + + ---@type number + MIN = nil, + + ---@type number + MAX = nil, + + ---@type number + NEVER = nil, + + ---@type number + LESS = nil, + + ---@type number + EQUAL = nil, + + ---@type number + LEQUAL = nil, + + ---@type number + GREATER = nil, + + ---@type number + NOTEQUAL = nil, + + ---@type number + GEQUAL = nil, + + ---@type number + ALWAYS = nil, + + ---@type number + CLEAR = nil, + + ---@type number + AND = nil, + + ---@type number + AND_REVERSE = nil, + + ---@type number + COPY = nil, + + ---@type number + AND_INVERTED = nil, + + ---@type number + NOOP = nil, + + ---@type number + XOR = nil, + + ---@type number + OR = nil, + + ---@type number + NOR = nil, + + ---@type number + EQUIV = nil, + + ---@type number + INVERT = nil, + + ---@type number + OR_REVERSE = nil, + + ---@type number + COPY_INVERTED = nil, + + ---@type number + OR_INVERTED = nil, + + ---@type number + NAND = nil, + + ---@type number + SET = nil, + + ---@type number + BACK = nil, + + ---@type number + FRONT = nil, + + ---@type number + FRONT_AND_BACK = nil, + + ---@type number + POINT = nil, + + ---@type number + LINE = nil, + + ---@type number + FILL = nil, + + ---@type number + DEPTH_BUFFER_BIT = nil, + + ---@type number + ACCUM_BUFFER_BIT = nil, + + ---@type number + STENCIL_BUFFER_BIT = nil, + + ---@type number + COLOR_BUFFER_BIT = nil, + + ---@type number + FLAT = nil, + + ---@type number + SMOOTH = nil, + + ---@type number + MODELVIEW = nil, + + ---@type number + PROJECTION = nil, + + ---@type number + TEXTURE = nil, + + ---@type number + NEAREST = nil, + + ---@type number + LINEAR = nil, + + ---@type number + NEAREST_MIPMAP_NEAREST = nil, + + ---@type number + LINEAR_MIPMAP_NEAREST = nil, + + ---@type number + NEAREST_MIPMAP_LINEAR = nil, + + ---@type number + LINEAR_MIPMAP_LINEAR = nil, + + ---@type number + REPEAT = nil, + + ---@type number + MIRRORED_REPEAT = nil, + + ---@type number + CLAMP = nil, + + ---@type number + CLAMP_TO_EDGE = nil, + + ---@type number + CLAMP_TO_BORDER = nil, + + ---@type number + TEXTURE_ENV = nil, + + ---@type number + TEXTURE_ENV_MODE = nil, + + ---@type number + TEXTURE_ENV_COLOR = nil, + + ---@type number + MODULATE = nil, + + ---@type number + DECAL = nil, + + ---@type number + BLEND = nil, + + ---@type number + REPLACE = nil, + + ---@type number + TEXTURE_GEN_MODE = nil, + + ---@type number + EYE_PLANE = nil, + + ---@type number + OBJECT_PLANE = nil, + + ---@type number + EYE_LINEAR = nil, + + ---@type number + OBJECT_LINEAR = nil, + + ---@type number + SPHERE_MAP = nil, + + ---@type number + NORMAL_MAP = nil, + + ---@type number + REFLECTION_MAP = nil, + + ---@type number + S = nil, + + ---@type number + T = nil, + + ---@type number + R = nil, + + ---@type number + Q = nil, + + ---@type number + CURRENT_BIT = nil, + + ---@type number + POINT_BIT = nil, + + ---@type number + LINE_BIT = nil, + + ---@type number + POLYGON_BIT = nil, + + ---@type number + POLYGON_STIPPLE_BIT = nil, + + ---@type number + PIXEL_MODE_BIT = nil, + + ---@type number + LIGHTING_BIT = nil, + + ---@type number + FOG_BIT = nil, + + ---@type number + DEPTH_BUFFER_BIT = nil, + + ---@type number + ACCUM_BUFFER_BIT = nil, + + ---@type number + STENCIL_BUFFER_BIT = nil, + + ---@type number + VIEWPORT_BIT = nil, + + ---@type number + TRANSFORM_BIT = nil, + + ---@type number + ENABLE_BIT = nil, + + ---@type number + COLOR_BUFFER_BIT = nil, + + ---@type number + HINT_BIT = nil, + + ---@type number + EVAL_BIT = nil, + + ---@type number + LIST_BIT = nil, + + ---@type number + TEXTURE_BIT = nil, + + ---@type number + SCISSOR_BIT = nil, + + ---@type number + ALL_ATTRIB_BITS = nil, + + ---@type number + FOG_HINT = nil, + + ---@type number + LINE_SMOOTH_HINT = nil, + + ---@type number + POINT_SMOOTH_HINT = nil, + + ---@type number + POLYGON_SMOOTH_HINT = nil, + + ---@type number + PERSPECTIVE_CORRECTION_HINT = nil, + + ---@type number + DONT_CARE = nil, + + ---@type number + FASTEST = nil, + + ---@type number + NICEST = nil, + + ---@type number + AMBIENT = nil, + + ---@type number + DIFFUSE = nil, + + ---@type number + SPECULAR = nil, + + ---@type number + POSITION = nil, + + ---@type number + SPOT_DIRECTION = nil, + + ---@type number + SPOT_EXPONENT = nil, + + ---@type number + SPOT_CUTOFF = nil, + + ---@type number + CONSTANT_ATTENUATION = nil, + + ---@type number + LINEAR_ATTENUATION = nil, + + ---@type number + QUADRATIC_ATTENUATION = nil, + + ---@type number + VERTEX_SHADER = nil, + + ---@type number + TESS_CONTROL_SHADER = nil, + + ---@type number + TESS_EVALUATION_SHADER = nil, + + ---@type number + GEOMETRY_SHADER = nil, + + ---@type number + FRAGMENT_SHADER = nil, + + ---@type number + GEOMETRY_INPUT_TYPE = nil, + + ---@type number + GEOMETRY_OUTPUT_TYPE = nil, + + ---@type number + GEOMETRY_VERTICES_OUT = nil, + + ---@type number + PATCH_VERTICES = nil, + + ---@type number + PATCH_DEFAULT_OUTER_LEVEL = nil, + + ---@type number + PATCH_DEFAULT_INNER_LEVEL = nil, + + ---@type number + BYTE = nil, + + ---@type number + UNSIGNED_BYTE = nil, + + ---@type number + SHORT = nil, + + ---@type number + UNSIGNED_SHORT = nil, + + ---@type number + INT = nil, + + ---@type number + UNSIGNED_INT = nil, + + ---@type number + FLOAT = nil, + + ---@type number + FLOAT_VEC4 = nil, + + ---@type number + INT_VEC4 = nil, + + ---@type number + UNSIGNED_INT_VEC4 = nil, + + ---@type number + FLOAT_MAT4 = nil, + + ---@type number + ELEMENT_ARRAY_BUFFER = nil, + + ---@type number + ARRAY_BUFFER = nil, + + ---@type number + UNIFORM_BUFFER = nil, + + ---@type number + SHADER_STORAGE_BUFFER = nil +} + +---BlendingFactorDest +--- +---@section blendingfactordest + +---BlendingFactorSrc +--- +---@section blendingfactorsrc + +---AlphaFunction and DepthFunction +--- +---@section alphadepth + +---LogicOp +--- +---@section logicop + +---Culling +--- +---@section culling + +---PolygonMode +--- +---@section polygonmode + +---Clear Bits +--- +---@section clearbits + +---ShadeModel +--- +---@section shademodel + +---MatrixMode +--- +---@section matrixmode + +---Texture Filtering +--- +---@section texturefiltering + +---Texture Clamping +--- +---@section textureclamping + +---Texture Environment +--- +---@section textureenvironment + +---Texture Generation +--- +---@section texturegeneration + +---glPushAttrib() bits +--- +---@section glpushattribbits + +---glHint() targets +--- +---@section glhinttargets + +---glHint() modes +--- +---@section glhintmodes + +---Light Specification +--- +---@section lightspecification + +---Shader Types +--- +---@section shadertypes + +---Geometry Shader Parameters +--- +---@section geometryshaderparameters + +---Tesselation control shader parameters +--- +---@section tesselationcontrolshaderparameters + +---OpenGL Data Types +--- +---@section OpenGL_Data_Types + +---OpenGL Buffer Types +--- +---@section OpenGL_Buffer_Types + +---FBO Attachments +--- +---@section fboattachments + +---Not included, but useful texture Formats +--- +---@section textureformats + +---Not included, but useful RBO Formats +--- +---@section rboformats + +---Not included, but useful FBO Targets +--- +---@section fbotargets + +---Not included, but useful FBO Status +--- +---@section fbostatus \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaConstGame.lua b/rts/Lua/library/generated/LuaConstGame.lua new file mode 100644 index 0000000000..4b7bed84cb --- /dev/null +++ b/rts/Lua/library/generated/LuaConstGame.lua @@ -0,0 +1,202 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaConstGame.cpp +--- +---@meta + +---Game constants +--- +---@see rts/Lua/LuaConstGame.cpp + +---Game specific information +Game = { + ---@type number + maxUnits = nil, + + ---@type number + maxTeams = nil, + + ---@type number + maxPlayers = nil, + + ---@type number Divide Game.mapSizeX or Game.mapSizeZ by this to get engine's "mapDims" coordinates. The resolution of height, yard and type maps. + squareSize = nil, + + ---@type number The resolution of metalmap (for use in API such as Spring.GetMetalAmount etc.) + metalMapSquareSize = nil, + + ---@type number + gameSpeed = nil, + + ---@type number + startPosType = nil, + + ---@type boolean + ghostedBuildings = nil, + + ---@type string + mapChecksum = nil, + + ---@type string + modChecksum = nil, + + ---@type boolean + mapDamage = nil, + + ---@type string + mapName = nil, + + ---@type string = string Game.mapHumanName + mapDescription = nil, + + ---@type number + mapHardness = nil, + + ---@type number + mapX = nil, + + ---@type number + mapY = nil, + + ---@type number in worldspace/opengl coords. Divide by Game.squareSize to get engine's "mapDims" coordinates + mapSizeX = nil, + + ---@type number in worldspace/opengl coords. Divide by Game.squareSize to get engine's "mapDims" coordinates + mapSizeZ = nil, + + ---@type number + gravity = nil, + + ---@type number + tidal = nil, + + ---@type number + windMin = nil, + + ---@type number + windMax = nil, + + ---@type number + extractorRadius = nil, + + ---@type number + waterDamage = nil, + + ---@type table Containing {def}IDs of environmental-damage sources + envDamageTypes = nil, + + ---@type string + gameName = nil, + + ---@type string + gameShortName = nil, + + ---@type string + gameVersion = nil, + + ---@type string + gameMutator = nil, + + ---@type string + gameDesc = nil, + + ---@type boolean + requireSonarUnderWater = nil, + + ---@type number + transportAir = nil, + + ---@type number + transportShip = nil, + + ---@type number + transportHover = nil, + + ---@type number + transportGround = nil, + + ---@type number + fireAtKilled = nil, + + ---@type number + fireAtCrashing = nil, + + ---@type boolean + constructionDecay = nil, + + ---@type boolean + reclaimAllowEnemies = nil, + + ---@type boolean + reclaimAllowAllies = nil, + + ---@type number + constructionDecayTime = nil, + + ---@type number + constructionDecaySpeed = nil, + + ---@type number + multiReclaim = nil, + + ---@type number + reclaimMethod = nil, + + ---@type number + reclaimUnitMethod = nil, + + ---@type number + reclaimUnitEnergyCostFactor = nil, + + ---@type number + reclaimUnitEfficiency = nil, + + ---@type number + reclaimFeatureEnergyCostFactor = nil, + + ---@type number + repairEnergyCostFactor = nil, + + ---@type number + resurrectEnergyCostFactor = nil, + + ---@type number + captureEnergyCostFactor = nil, + + ---@type table + ---```lua + ---example: { + ---["vtol"] = 0, ["special"] = 1, ["noweapon"] = 2, + ---["notair"] = 3, ["notsub"] = 4, ["all"] = 5, + ---["weapon"] = 6, ["notship"] = 7, ["notland"] = 8, + ---["mobile"] = 9, ["kbot"] = 10, ["antigator"] = 11, + ---["tank"] = 12, ["plant"] = 13, ["ship"] = 14, + ---["antiemg"] = 15, ["antilaser"] = 16, ["antiflame"] = 17, + ---["underwater"] = 18, ["hover"] = 19, ["phib"] = 20, + ---["constr"] = 21, ["strategic"] = 22, ["commander"] = 23, + ---["paral"] = 24, ["jam"] = 25, ["mine"] = 26, + ---["kamikaze"] = 27, ["minelayer"] = 28, ["notstructure"] = 29, + ---["air"] = 30 + ---} + ---``` + springCategories = nil, + + ---@type table (bidirectional) + ---```lua + ---example: { + ---[1] = amphibious, [2] = anniddm, [3] = antibomber, + ---[4] = antifighter, [5] = antiraider, [6] = atl, + ---[7] = blackhydra, [8] = bombers, [9] = commanders, + ---[10] = crawlingbombs, ... + --- + ---["amphibious"] = 1, ["anniddm"] = 2, ["antibomber"] = 3 + ---["antifighter"] = 4, ["antiraider"] = 5, ["atl"] = 6 + ---["blackhydra"] = 7, ["bombers"] = 8, ["commanders"] = 9 + ---["crawlingbombs"]= 10, ... + ---} + ---``` + armorTypes = nil +} \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaConstPlatform.lua b/rts/Lua/library/generated/LuaConstPlatform.lua new file mode 100644 index 0000000000..de80a2bb8c --- /dev/null +++ b/rts/Lua/library/generated/LuaConstPlatform.lua @@ -0,0 +1,90 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaConstPlatform.cpp +--- +---@meta + +---Platform constants +--- +---@see rts/Lua/LuaConstPlatform.cpp + +---Platform specific information +Platform = { + ---@type string Full GPU device name + gpu = nil, + + ---@type "Nvidia"|"Intel"|"ATI"|"Mesa"|"Unknown" + gpuVendor = nil, + + ---@type string `major.minor.buildNumber` + glVersionShort = nil, + + ---@type string `major.minor` + glslVersionShort = nil, + + ---@type string Full version + glVersion = nil, + + ---@type string + glVendor = nil, + + ---@type string + glRenderer = nil, + + ---@type string Full version + glslVersion = nil, + + ---@type string + glewVersion = nil, + + ---@type string full name of the OS + osName = nil, + + ---@type "Windows"|"Linux"|"MacOSX"|"FreeBSD"|"Unknown" + osFamily = nil, + + ---@type number + numDisplays = nil, + + ---@type number Size of total GPU memory in MBs; only available for "Nvidia", (rest are 0) + gpuMemorySize = nil, + + ---@type number + sdlVersionCompiledMajor = nil, + + ---@type number + sdlVersionCompiledMinor = nil, + + ---@type number + sdlVersionCompiledPatch = nil, + + ---@type number + sdlVersionLinkedMajor = nil, + + ---@type number + sdlVersionLinkedMinor = nil, + + ---@type number + sdlVersionLinkedPatch = nil, + + ---@type boolean + glSupportNonPowerOfTwoTex = nil, + + ---@type boolean + glSupportTextureQueryLOD = nil, + + ---@type boolean + glSupport24bitDepthBuffer = nil, + + ---@type boolean + glSupportRestartPrimitive = nil, + + ---@type boolean + glSupportClipSpaceControl = nil, + + ---@type boolean + glSupportFragDepthLayout = nil +} \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaFBOs.lua b/rts/Lua/library/generated/LuaFBOs.lua new file mode 100644 index 0000000000..f3a1c1d2f2 --- /dev/null +++ b/rts/Lua/library/generated/LuaFBOs.lua @@ -0,0 +1,101 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaFBOs.cpp +--- +---@meta + +---FBO +--- +---@see rts/Lua/LuaFBOs.cpp + +gl = { + +} + +---attachment ::= luaTex or `RBO.rbo` or nil or { luaTex [, num target [, num level ] ] } +--- +---@class attachment +local attachment = {} + +---User Data FBO +--- +---@class Fbo +---@field depth attachment +---@field stencil attachment +---@field color0 attachment +---@field color1 attachment +---@field color2 attachment +---@field colorn attachment +---@field color15 attachment +---@field drawbuffers table `{ GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT3_EXT, ..}` +---@field readbuffer table `GL_COLOR_ATTACHMENT0_EXT` +local Fbo = {} + +---@param fbo Fbo +function gl.CreateFBO(fbo) end + +---This doesn't delete the attached objects! +--- +---@param fbo Fbo +function gl.DeleteFBO(fbo) end + +---@param fbo Fbo +---@param target GL? +---@return boolean valid +---@return number? status +function gl.IsValidFBO(fbo, target) end + +---@param fbo Fbo +---@param target GL? +---@param identities boolean? +---@param lua_function function? +---@param arg1 any? +---@param arg2 any? +---@param argn any? +function gl.ActiveFBO(fbo, target, identities, lua_function, arg1, arg2, argn) end + +---Bind default or specified via rawFboId numeric id of FBO +--- +---@param fbo nil +---@param target GL? (Default: `GL_FRAMEBUFFER_EXT`) +---@param rawFboId integer? (Default: 0) +---@return nil +function gl.RawBindFBO(fbo, target, rawFboId) end + +---@param fbo Fbo +---@param target GL? (Default: `fbo.target`) +---@return number previouslyBoundRawFboId +function gl.RawBindFBO(fbo, target) end + +---needs `GLEW_EXT_framebuffer_blit` +--- +---@param x0Src number +---@param y0Src number +---@param x1Src number +---@param y1Src number +---@param x0Dst number +---@param y0Dst number +---@param x1Dst number +---@param y1Dst number +---@param mask number? (Default: GL_COLOR_BUFFER_BIT) +---@param filter number? (Default: GL_NEAREST) +function gl.BlitFBO(x0Src, y0Src, x1Src, y1Src, x0Dst, y0Dst, x1Dst, y1Dst, mask, filter) end + +---needs `GLEW_EXT_framebuffer_blit` +--- +---@param fboSrc Fbo +---@param x0Src number +---@param y0Src number +---@param x1Src number +---@param y1Src number +---@param fboDst Fbo +---@param x0Dst number +---@param y0Dst number +---@param x1Dst number +---@param y1Dst number +---@param mask number? (Default: GL_COLOR_BUFFER_BIT) +---@param filter number? (Default: GL_NEAREST) +function gl.BlitFBO(fboSrc, x0Src, y0Src, x1Src, y1Src, fboDst, x0Dst, y0Dst, x1Dst, y1Dst, mask, filter) end \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaFeatureDefs.lua b/rts/Lua/library/generated/LuaFeatureDefs.lua new file mode 100644 index 0000000000..44671ca1bd --- /dev/null +++ b/rts/Lua/library/generated/LuaFeatureDefs.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaFeatureDefs.cpp +--- +---@meta + diff --git a/rts/Lua/library/generated/LuaFonts.lua b/rts/Lua/library/generated/LuaFonts.lua new file mode 100644 index 0000000000..fdcfc812a8 --- /dev/null +++ b/rts/Lua/library/generated/LuaFonts.lua @@ -0,0 +1,33 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaFonts.cpp +--- +---@meta + +---Adds a fallback font for the font rendering engine. +--- +---Fonts added first will have higher priority. +---When a glyph isn't found when rendering a font, the fallback fonts +---will be searched first, otherwise os fonts will be used. +--- +---The application should listen for the unsynced 'FontsChanged' callin so +---modules can clear any already reserved display lists or other relevant +---caches. +--- +---Note the callin won't be executed at the time of calling this method, +---but later, on the Update cycle (before other Update and Draw callins). +--- +---@string filePath VFS path to the file, for example "fonts/myfont.ttf". Uses VFS.RAW_FIRST access mode. +---@treturn bool success +function gl.AddFallbackFont() end + +---Clears all fallback fonts. +--- +---See the note at 'AddFallbackFont' about the 'FontsChanged' callin, +---it also applies when calling this method. +--- +---@treturn nil +function gl.ClearFallbackFonts() end \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaGaia.lua b/rts/Lua/library/generated/LuaGaia.lua new file mode 100644 index 0000000000..ba387b4605 --- /dev/null +++ b/rts/Lua/library/generated/LuaGaia.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaGaia.cpp +--- +---@meta + diff --git a/rts/Lua/library/generated/LuaHandle.lua b/rts/Lua/library/generated/LuaHandle.lua new file mode 100644 index 0000000000..b2487e6725 --- /dev/null +++ b/rts/Lua/library/generated/LuaHandle.lua @@ -0,0 +1,825 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaHandle.cpp +--- +---@meta + +---Callins, functions called by the Engine +--- +--- +---This page is future looking to unified widget/gadget (aka "addon") handler, which may yet be some way off, c.f. the changelog. +--- +---Related Sourcecode: [LuaHandle.cpp](https://github.com/beyond-all-reason/spring/blob/BAR105/rts/Lua/LuaHandle.cpp) +--- +---For now, to use these addons in a widget, prepend widget: and, for a gadget, prepend gadget:. For example, +--- +---function widget:UnitCreated(unitID, unitDefID, unitTeam, builderID) +---... +---end +--- +---Some functions may differ between (synced) gadget and widgets; those are in the [Synced - Unsynced Shared](#Synced___Unsynced_Shared) section. Essentially the reason is that all information should be available to synced (game logic controlling) gadgets, but restricted to unsynced gadget/widget (e.g. information about an enemy unit only detected via radar and not yet in LOS). In such cases the full (synced) param list is documented. +--- +---Attention: some callins will only work on the unsynced portion of the gadget. Due to the type-unsafe nature of lua parsing, those callins not firing up might be hard to trace. This document will be continuously updated to properly alert about those situations. +--- +---@see rts/Lua/LuaHandle.cpp + +---Common +--- +---@section common + +---Called when the addon is (re)loaded. +function Initialize() end + +---Called when the game is (re)loaded. +function LoadCode() end + +---Called when the addon or the game is shutdown. +--- +---@return nil +function Shutdown() end + +---Called when a player issues a UI command e.g. types /foo or /luarules foo. +--- +---@param msg string +---@param playerID number +function GotChatMsg(msg, playerID) end + +---Called after `GamePreload` and before `GameStart`. See Lua_SaveLoad. +--- +---@param zipReader table +function Load(zipReader) end + +---Game +--- +---@section game + +---Called before the 0 gameframe. +--- +---Is not called when a saved game is loaded. +function GamePreload() end + +---Called upon the start of the game. +--- +---Is not called when a saved game is loaded. +function GameStart() end + +---Called when the game ends +--- +---@param winningAllyTeams number[] list of winning allyTeams, if empty the game result was undecided (like when dropping from an host). +function GameOver(winningAllyTeams) end + +---Called when the game is paused. +--- +---@param playerID number +---@param paused boolean +function GamePaused(playerID, paused) end + +---Called for every game simulation frame (30 per second). +--- +---@param frame number Starts at frame 1 +function GameFrame(frame) end + +---Called at the end of every game simulation frame +--- +---@param frame number Starts at frame 1 +function GameFramePost(frame) end + +---Called once to deliver the gameID +--- +---@param gameID string encoded in hex. +function GameID(gameID) end + +---Teams +--- +---@section teams + +---Called when a team dies (see `Spring.KillTeam`). +--- +---@param teamID number +function TeamDied(teamID) end + +---@param teamID number +function TeamChanged(teamID) end + +---Called whenever a player's status changes e.g. becoming a spectator. +--- +---@param playerID number +function PlayerChanged(playerID) end + +---Called whenever a new player joins the game. +--- +---@param playerID number +function PlayerAdded(playerID) end + +---Called whenever a player is removed from the game. +--- +---@param playerID number +---@param reason string +function PlayerRemoved(playerID, reason) end + +---Units +--- +---@section units + +---Called at the moment the unit is created. +--- +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +---@param builderID number? +function UnitCreated(unitID, unitDefID, unitTeam, builderID) end + +---Called at the moment the unit is completed. +--- +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +function UnitFinished(unitID, unitDefID, unitTeam) end + +---Called when a factory finishes construction of a unit. +--- +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +---@param factID number +---@param factDefID number +---@param userOrders boolean +function UnitFromFactory(unitID, unitDefID, unitTeam, factID, factDefID, userOrders) end + +---Called when a living unit becomes a nanoframe again. +--- +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +function UnitReverseBuilt(unitID, unitDefID, unitTeam) end + +---Called when a unit being built starts decaying. +--- +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +---@param timeSinceLastBuild number +---@param iterationPeriod number +---@param part number +function UnitConstructionDecayed(unitID, unitDefID, unitTeam, timeSinceLastBuild, iterationPeriod, part) end + +---Called when a unit is destroyed. +--- +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +---@param attackerID number +---@param attackerDefID number +---@param attackerTeam number +---@param weaponDefID number +function UnitDestroyed(unitID, unitDefID, unitTeam, attackerID, attackerDefID, attackerTeam, weaponDefID) end + +---Called when a unit is transferred between teams. This is called before `UnitGiven` and in that moment unit is still assigned to the oldTeam. +--- +---@param unitID integer +---@param unitDefID integer +---@param oldTeam number +---@param newTeam number +function UnitTaken(unitID, unitDefID, oldTeam, newTeam) end + +---Called when a unit is transferred between teams. This is called after `UnitTaken` and in that moment unit is assigned to the newTeam. +--- +---@param unitID integer +---@param unitDefID integer +---@param newTeam number +---@param oldTeam number +function UnitGiven(unitID, unitDefID, newTeam, oldTeam) end + +---Called when a unit is idle (empty command queue). +--- +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +function UnitIdle(unitID, unitDefID, unitTeam) end + +---Called after when a unit accepts a command, after `AllowCommand` returns true. +--- +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +---@param cmdID number +---@param cmdParams table +---@param options CommandOptions +---@param cmdTag number +function UnitCommand(unitID, unitDefID, unitTeam, cmdID, cmdParams, options, cmdTag) end + +---Called when a unit completes a command. +--- +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +---@param cmdID number +---@param cmdParams table +---@param options CommandOptions +---@param cmdTag number +function UnitCmdDone(unitID, unitDefID, unitTeam, cmdID, cmdParams, options, cmdTag) end + +---Called when a unit is damaged (after UnitPreDamaged). +--- +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +---@param damage number +---@param paralyzer number +---@param weaponDefID number +---@param projectileID number +---@param attackerID number +---@param attackerDefID number +---@param attackerTeam number +function UnitDamaged(unitID, unitDefID, unitTeam, damage, paralyzer, weaponDefID, projectileID, attackerID, attackerDefID, attackerTeam) end + +---Called when a unit changes its stun status. +--- +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +---@param stunned boolean +function UnitStunned(unitID, unitDefID, unitTeam, stunned) end + +---Called when a unit gains experience greater or equal to the minimum limit set by calling `Spring.SetExperienceGrade`. +--- +---Should be called more reliably with small values of experience grade. +--- +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +---@param experience number +---@param oldExperience number +function UnitExperience(unitID, unitDefID, unitTeam, experience, oldExperience) end + +---Called when a unit's harvestStorage is full (according to its unitDef's entry). +--- +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +function UnitHarvestStorageFull(unitID, unitDefID, unitTeam) end + +---Called when a unit emits a seismic ping. +--- +---See `seismicSignature`. +--- +---@param x number +---@param y number +---@param z number +---@param strength number +---@param allyTeam integer +---@param unitID integer +---@param unitDefID integer +function UnitSeismicPing(x, y, z, strength, allyTeam, unitID, unitDefID) end + +---Called when a unit enters radar of an allyteam. +--- +---Also called when a unit enters LOS without any radar coverage. +--- +---@param unitID integer +---@param unitTeam integer +---@param allyTeam integer +---@param unitDefID integer +function UnitEnteredRadar(unitID, unitTeam, allyTeam, unitDefID) end + +---Called when a unit enters LOS of an allyteam. +--- +---Its called after the unit is in LOS, so you can query that unit. +--- +---@param unitID integer +---@param unitTeam integer +---@param allyTeam integer who's LOS the unit entered. +---@param unitDefID integer +function UnitEnteredLos(unitID, unitTeam, allyTeam, unitDefID) end + +---Called when a unit leaves radar of an allyteam. +--- +---Also called when a unit leaves LOS without any radar coverage. +---For widgets, this is called just after a unit leaves radar coverage, so +---widgets cannot get the position of units that left their radar. +--- +---@param unitID integer +---@param unitTeam integer +---@param allyTeam integer +---@param unitDefID integer +function UnitLeftRadar(unitID, unitTeam, allyTeam, unitDefID) end + +---Called when a unit leaves LOS of an allyteam. +--- +---For widgets, this one is called just before the unit leaves los, so you can still get the position of a unit that left los. +--- +---@param unitID integer +---@param unitTeam integer +---@param allyTeam integer +---@param unitDefID integer +function UnitLeftLos(unitID, unitTeam, allyTeam, unitDefID) end + +---Transport +--- +---@section transport + +---Called when a unit is loaded by a transport. +--- +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +---@param transportID integer +---@param transportTeam integer +function UnitLoaded(unitID, unitDefID, unitTeam, transportID, transportTeam) end + +---Called when a unit is unloaded by a transport. +--- +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +---@param transportID integer +---@param transportTeam integer +function UnitUnloaded(unitID, unitDefID, unitTeam, transportID, transportTeam) end + +---Unit Interactions +--- +---@section unit_interactions + +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +function UnitEnteredUnderwater(unitID, unitDefID, unitTeam) end + +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +function UnitEnteredWater(unitID, unitDefID, unitTeam) end + +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +function UnitLeftAir(unitID, unitDefID, unitTeam) end + +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +function UnitLeftUnderwater(unitID, unitDefID, unitTeam) end + +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +function UnitLeftWater(unitID, unitDefID, unitTeam) end + +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +function UnitEnteredAir(unitID, unitDefID, unitTeam) end + +---Called when a unit cloaks. +--- +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +function UnitCloaked(unitID, unitDefID, unitTeam) end + +---Called when a unit decloaks. +--- +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +function UnitDecloaked(unitID, unitDefID, unitTeam) end + +---Called when two units collide. +--- +---Both units must be registered with `Script.SetWatchUnit`. +--- +---@param colliderID number +---@param collideeID number +function UnitUnitCollision(colliderID, collideeID) end + +---Called when a unit collides with a feature. +--- +---The unit must be registered with `Script.SetWatchUnit` and the feature registered with `Script.SetWatchFeature`. +--- +---@param colliderID number +---@param collideeID number +function UnitFeatureCollision(colliderID, collideeID) end + +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +function UnitMoveFailed(unitID, unitDefID, unitTeam) end + +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +function UnitArrivedAtGoal(unitID, unitDefID, unitTeam) end + +---Called just before a unit is invalid, after it finishes its death animation. +--- +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +function RenderUnitDestroyed(unitID, unitDefID, unitTeam) end + +---Features +--- +---@section features + +---Called when a feature is created. +--- +---@param featureID number +---@param allyTeamID number +function FeatureCreated(featureID, allyTeamID) end + +---Called when a feature is destroyed. +--- +---@param featureID number +---@param allyTeamID number +function FeatureDestroyed(featureID, allyTeamID) end + +---Called when a feature is damaged. +--- +---@param featureID number +---@param featureDefID number +---@param featureTeam number +---@param damage number +---@param weaponDefID number +---@param projectileID number +---@param attackerID number +---@param attackerDefID number +---@param attackerTeam number +function FeatureDamaged(featureID, featureDefID, featureTeam, damage, weaponDefID, projectileID, attackerID, attackerDefID, attackerTeam) end + +---Projectiles +--- +---@section projectiles +--- +---The following Callins are only called for weaponDefIDs registered via Script.SetWatchWeapon. + +---Called when the projectile is created. +--- +---Note that weaponDefID is missing if the projectile is spawned as part of a burst, but `Spring.GetProjectileDefID` and `Spring.GetProjectileName` still work in callin scope using proID. +--- +---@param proID number +---@param proOwnerID number +---@param weaponDefID number +function ProjectileCreated(proID, proOwnerID, weaponDefID) end + +---Called when the projectile is destroyed. +--- +---@param proID number +---@param ownerID number +---@param proWeaponDefID number +function ProjectileDestroyed(proID, ownerID, proWeaponDefID) end + +---Called when an explosion occurs. +--- +---@param weaponDefID number +---@param px number +---@param py number +---@param pz number +---@param attackerID number +---@param projectileID number +---@return boolean noGfx if then no graphical effects are drawn by the engine for this explosion. +function Explosion(weaponDefID, px, py, pz, attackerID, projectileID) end + +---Called when a units stockpile of weapons increases or decreases. +--- +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +---@param weaponNum integer +---@param oldCount integer +---@param newCount integer +function StockpileChanged(unitID, unitDefID, unitTeam, weaponNum, oldCount, newCount) end + +---Receives messages from unsynced sent via `Spring.SendLuaRulesMsg` or `Spring.SendLuaUIMsg`. +--- +---@param msg string +---@param playerID number +function RecvLuaMsg(msg, playerID) end + +---Called when a chat command '/save' or '/savegame' is received. +--- +---@param zip table a userdatum representing the savegame zip file. See Lua_SaveLoad. +function Save(zip) end + +---Called when the unsynced copy of the height-map is altered. +--- +---@return number x1 +---@return number z1 +---@return number x2 +---@return number z2 +function UnsyncedHeightMapUpdate() end + +---Called for every draw frame (including when the game is paused) and at least once per sim frame except when catching up. +--- +---@param dt number the time since the last update. +function Update(dt) end + +---Called whenever the window is resized. +--- +---@param viewSizeX number +---@param viewSizeY number +function ViewResize(viewSizeX, viewSizeY) end + +---Called whenever fonts are updated. Signals the game display lists +---and other caches should be discarded. +--- +---Gets called before other Update and Draw callins. +function FontsChanged() end + +function SunChanged() end + +---Used to set the default command when a unit is selected. First parameter is the type of the object pointed at (either "unit or "feature") and the second is its unitID or featureID respectively. +--- +---@param type string "unit" | "feature" +---@param id integer unitID | featureID +function DefaultCommand(type, id) end + +---Draw* Functions +--- +---@section draw +--- +---Inside the Draw* functions, you can use the Lua OpenGL Api to draw graphics. +--- +---Avoid doing heavy calculations inside these callins; ideally, do the calculations elsewhere and use Draw callins only for drawing. + +---Use this callin to update textures, shaders, etc. +--- +---Doesn't render to screen! +---Also available to LuaMenu. +function DrawGenesis() end + +---Spring draws command queues, 'map stuff', and map marks. +function DrawWorld() end + +---Spring draws units, features, some water types, cloaked units, and the sun. +function DrawWorldPreUnit() end + +---Called before decals are drawn +function DrawPreDecals() end + +function DrawWaterPost() end + +---Invoked after semi-transparent shadows pass is about to conclude +--- +---This callin has depth and color buffer of shadowmap bound via FBO as well as the FFP state to do "semi-transparent" shadows pass (traditionally only used to draw shadows of shadow casting semi-transparent particles). Can be used to draw nice colored shadows. +function DrawShadowPassTransparent() end + +function DrawWorldShadow() end + +function DrawWorldReflection() end + +function DrawWorldRefraction() end + +---Runs at the start of the forward pass when a custom map shader has been assigned via `Spring.SetMapShader` (convenient for setting uniforms). +function DrawGroundPreForward() end + +function DrawGroundPostForward() end + +---Runs at the start of the deferred pass when a custom map shader has been assigned via `Spring.SetMapShader` (convenient for setting uniforms). +function DrawGroundPreDeferred() end + +function DrawGroundDeferred() end + +---This runs at the end of its respective deferred pass. +--- +---Allows proper frame compositing (with ground flashes/decals/foliage/etc, which are drawn between it and `DrawWorldPreUnit`) via `gl.CopyToTexture`. +function DrawGroundPostDeferred() end + +---Runs at the end of the unit deferred pass. +--- +---Informs Lua code it should make use of the $model_gbuffer_* textures before another pass overwrites them (and to allow proper blending with e.g. cloaked objects which are drawn between these events and DrawWorld via gl.CopyToTexture). N.B. The *PostDeferred events are only sent (and only have a real purpose) if forward drawing is disabled. +function DrawUnitsPostDeferred() end + +---Runs at the end of the feature deferred pass to inform Lua code it should make use of the $model_gbuffer_* textures before another pass overwrites them (and to allow proper blending with e.g. cloaked objects which are drawn between these events and DrawWorld via gl.CopyToTexture). N.B. The *PostDeferred events are only sent (and only have a real purpose) if forward drawing is disabled. +function DrawFeaturesPostDeferred() end + +function DrawShadowUnitsLua() end + +function DrawShadowFeaturesLua() end + +---DrawWorldPreParticles is called multiples times per draw frame. +---Each call has a different permutation of values for drawAboveWater, drawBelowWater, drawReflection, and drawRefraction. +--- +---@param drawAboveWater boolean +---@param drawBelowWater boolean +---@param drawReflection boolean +---@param drawRefraction boolean +function DrawWorldPreParticles(drawAboveWater, drawBelowWater, drawReflection, drawRefraction) end + +---Also available to LuaMenu. +--- +---@param viewSizeX number +---@param viewSizeY number +function DrawScreen(viewSizeX, viewSizeY) end + +---@param viewSizeX number +---@param viewSizeY number +function DrawScreenEffects(viewSizeX, viewSizeY) end + +---Similar to DrawScreenEffects, this can be used to alter the contents of a frame after it has been completely rendered (i.e. World, MiniMap, Menu, UI). +--- +---@param viewSizeX number +---@param viewSizeY number +function DrawScreenPost(viewSizeX, viewSizeY) end + +---@param sx number relative to the minimap's position and scale. +---@param sy number relative to the minimap's position and scale. +function DrawInMinimap(sx, sy) end + +---@param sx number relative to the minimap's position and scale. +---@param sy number relative to the minimap's position and scale. +function DrawInMinimapBackground(sx, sy) end + +---Called every 60 frames, calculating delta between `GameFrame` and `GameProgress`. +--- +---Can give an ETA about catching up with simulation for mid-game join players. +--- +---@param serverFrameNum integer +function GameProgress(serverFrameNum) end + +---Called when the keymap changes +--- +---Can be caused due to a change in language or keyboard +function KeyMapChanged() end + +---Input +--- +---@section input + +---Key Modifier Params +--- +---@class KeyModifiers +---@field right boolean Right mouse key pressed +---@field alt boolean Alt key pressed +---@field ctrl boolean Ctrl key pressed +---@field shift boolean Shift key pressed +local KeyModifiers = {} + +---Called repeatedly when a key is pressed down. +--- +---Return true if you don't want other callins or the engine to also receive this keypress. A list of key codes can be seen at the SDL wiki. +--- +---@param keyCode number +---@param mods KeyModifiers +---@param isRepeat boolean If you want an action to occur only once check for isRepeat == false. +---@param label boolean the name of the key +---@param utf32char number (deprecated) always 0 +---@param scanCode number +---@param actionList table the list of actions for this keypress +---@return boolean halt whether to halt the chain for consumers of the keypress +function KeyPress(keyCode, mods, isRepeat, label, utf32char, scanCode, actionList) end + +---Called when the key is released. +--- +---@param keyCode number +---@param mods KeyModifiers +---@param label boolean the name of the key +---@param utf32char number (deprecated) always 0 +---@param scanCode number +---@param actionList table the list of actions for this keyrelease +---@return boolean +function KeyRelease(keyCode, mods, label, utf32char, scanCode, actionList) end + +---Called whenever a key press results in text input. +--- +---@param utf8char string +function TextInput(utf8char) end + +---@param utf8 string +---@param start number +---@param length number +function TextEditing(utf8, start, length) end + +---Called when a mouse button is pressed. +--- +---The button parameter supports up to 7 buttons. Must return true for `MouseRelease` and other functions to be called. +--- +---@param x number +---@param y number +---@param button number +---@return boolean becomeMouseOwner +function MousePress(x, y, button) end + +---Called when a mouse button is released. +--- +---Please note that in order to have Spring call `Spring.MouseRelease`, you need to have a `Spring.MousePress` call-in in the same addon that returns true. +--- +---@param x number +---@param y number +---@param button number +---@return boolean becomeMouseOwner +function MouseRelease(x, y, button) end + +---Called when the mouse is moved. +--- +---@param x number final x position +---@param y number final y position +---@param dx number distance travelled in x +---@param dy number distance travelled in y +---@param button number +function MouseMove(x, y, dx, dy, button) end + +---Called when the mouse wheel is moved. +--- +---@param up boolean the direction +---@param value number the amount travelled +function MouseWheel(up, value) end + +---Called every `Update`. +--- +---Must return true for `Mouse*` events and `Spring.GetToolTip` to be called. +--- +---@param x number +---@param y number +---@return boolean isAbove +function IsAbove(x, y) end + +---Called when `Spring.IsAbove` returns true. +--- +---@param x number +---@param y number +---@return string tooltip +function GetTooltip(x, y) end + +---Called when a command is issued. +--- +---@param cmdID integer +---@param cmdParams table +---@param options CommandOptions +---@return boolean Returning true deletes the command and does not send it through the network. +function CommandNotify(cmdID, cmdParams, options) end + +---Called when text is entered into the console (e.g. `Spring.Echo`). +--- +---@param msg string +---@param priority integer +function AddConsoleLine(msg, priority) end + +---Called when a unit is added to or removed from a control group. +--- +---@param groupID number +function GroupChanged(groupID) end + +---@param ttType string "unit" | "feature" | "ground" | "selection" +---@param data1 number unitID | featureID | posX +---@param data2 number? posY +---@param data3 number? posZ +---@return string newTooltip +function WorldTooltip(ttType, data1, data2, data3) end + +---@param playerID number +---@param type string "point" | "line" | "erase" +---@param posX number +---@param posY number +---@param posZ number +---@param data4 string|number point: label, erase: radius, line: pos2X +---@param pos2Y number? when type is line +---@param pos2Z number? when type is line +function MapDrawCmd(playerID, type, posX, posY, posZ, data4, pos2Y, pos2Z) end + +---@param state string +---@param ready boolean +---@param playerStates table +---@return boolean success +---@return boolean newReady +function GameSetup(state, ready, playerStates) end + +---@param aiTeam integer +---@param dataStr string +function RecvSkirmishAIMessage(aiTeam, dataStr) end + +---Downloads +--- +---@section downloads + +---Called when a Pr-downloader download is queued +--- +---@param id number +---@param name string +---@param type string +function DownloadQueued(id, name, type) end + +---Called when a Pr-downloader download is started via VFS.DownloadArchive. +--- +---@param id number +function DownloadStarted(id) end + +---Called when a Pr-downloader download finishes successfully. +--- +---@param id number +function DownloadFinished(id) end + +---Called when a Pr-downloader download fails to complete. +--- +---@param id number +---@param errorID number +function DownloadFailed(id, errorID) end + +---Called incrementally during a Pr-downloader download. +--- +---@param id number +---@param downloaded number +---@param total number +function DownloadProgress(id, downloaded, total) end \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaHandleSynced.lua b/rts/Lua/library/generated/LuaHandleSynced.lua new file mode 100644 index 0000000000..530f36c335 --- /dev/null +++ b/rts/Lua/library/generated/LuaHandleSynced.lua @@ -0,0 +1,391 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaHandleSynced.cpp +--- +---@meta + +---Callins, functions called by the Engine (Synced) +--- +---@see rts/Lua/LuaHandleSynced.cpp + +---Misc +--- +---@section misc + +---Receives data sent via `SendToUnsynced` callout. +--- +---@param arg1 any +---@param arg2 any +---@param argn any +function RecvFromSynced(arg1, arg2, argn) end + +---Custom Object Rendering +--- +---For the following calls drawMode can be one of the following, notDrawing = 0, normalDraw = 1, shadowDraw = 2, reflectionDraw = 3, refractionDraw = 4, and finally gameDeferredDraw = 5 which was added in 102.0. +--- +---@section custom_object + +---For custom rendering of units +--- +---@param unitID integer +---@param drawMode number +---@return boolean suppressEngineDraw +function DrawUnit(unitID, drawMode) end + +---For custom rendering of features +--- +---@param featureID integer +---@param drawMode number +---@return boolean suppressEngineDraw +function DrawFeature(featureID, drawMode) end + +---For custom rendering of shields. +--- +---@param featureID integer +---@param weaponID integer +---@param drawMode number +---@return boolean suppressEngineDraw +function DrawShield(featureID, weaponID, drawMode) end + +---For custom rendering of weapon (& other) projectiles +--- +---@param projectileID integer +---@param drawMode number +---@return boolean suppressEngineDraw +function DrawProjectile(projectileID, drawMode) end + +---@param uuid number +---@param drawMode number +---@return boolean suppressEngineDraw +function DrawMaterial(uuid, drawMode) end + +---Called when the unit reaches an unknown command in its queue (i.e. one not handled by the engine). +--- +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +---@param cmdID integer +---@param cmdParams number[] +---@param cmdOptions CommandOptions +---@param cmdTag number +---@return boolean whether to remove the command from the queue +function CommandFallback(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOptions, cmdTag) end + +---Called when the command is given, before the unit's queue is altered. +--- +---The queue remains untouched when a command is blocked, whether it would be queued or replace the queue. +--- +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +---@param cmdID integer +---@param cmdParams number[] +---@param cmdOptions CommandOptions +---@param cmdTag number +---@param synced boolean +---@param fromLua boolean +---@return boolean whether it should be let into the queue. +function AllowCommand(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOptions, cmdTag, synced, fromLua) end + +---Called just before unit is created. +--- +---@param unitDefID integer +---@param builderID integer +---@param builderTeam integer +---@param x number +---@param y number +---@param z number +---@param facing number +---@return boolean allow, boolean dropOrder +function AllowUnitCreation(unitDefID, builderID, builderTeam, x, y, z, facing) end + +---Called just before a unit is transferred to a different team. +--- +---@param unitID integer +---@param unitDefID integer +---@param oldTeam integer +---@param newTeam integer +---@param capture boolean +---@return boolean whether or not the transfer is permitted. +function AllowUnitTransfer(unitID, unitDefID, oldTeam, newTeam, capture) end + +---Called just before a unit progresses its build percentage. +--- +---@param builderID integer +---@param builderTeam integer +---@param unitID integer +---@param unitDefID integer +---@param part number +---@return boolean whether or not the build makes progress. +function AllowUnitBuildStep(builderID, builderTeam, unitID, unitDefID, part) end + +---@param builderID integer +---@param builderTeam integer +---@param unitID integer +---@param unitDefID integer +---@param part number +---@return boolean whether or not the capture makes progress. +function AllowUnitCaptureStep(builderID, builderTeam, unitID, unitDefID, part) end + +---@param transporterID integer +---@param transporterUnitDefID integer +---@param transporterTeam integer +---@param transporteeID integer +---@param transporteeUnitDefID integer +---@param transporteeTeam integer +---@return boolean whether or not the transport is allowed +function AllowUnitTransport(transporterID, transporterUnitDefID, transporterTeam, transporteeID, transporteeUnitDefID, transporteeTeam) end + +---@param transporterID integer +---@param transporterUnitDefID integer +---@param transporterTeam integer +---@param transporteeID integer +---@param transporteeUnitDefID integer +---@param transporteeTeam integer +---@param x number +---@param y number +---@param z number +---@return boolean whether or not the transport load is allowed +function AllowUnitTransportLoad(transporterID, transporterUnitDefID, transporterTeam, transporteeID, transporteeUnitDefID, transporteeTeam, x, y, z) end + +---@param transporterID integer +---@param transporterUnitDefID integer +---@param transporterTeam integer +---@param transporteeID integer +---@param transporteeUnitDefID integer +---@param transporteeTeam integer +---@param x number +---@param y number +---@param z number +---@return boolean whether or not the transport unload is allowed +function AllowUnitTransportUnload(transporterID, transporterUnitDefID, transporterTeam, transporteeID, transporteeUnitDefID, transporteeTeam, x, y, z) end + +---@param unitID integer +---@param enemyID integer? +---@return boolean whether unit is allowed to cloak +function AllowUnitCloak(unitID, enemyID) end + +---@param unitID integer +---@param objectID integer? +---@param weaponNum number? +---@return boolean whether unit is allowed to decloak +function AllowUnitCloak(unitID, objectID, weaponNum) end + +---@param unitID integer +---@param targetID integer +---@return boolean whether unit is allowed to selfd +function AllowUnitKamikaze(unitID, targetID) end + +---Called just before feature is created. +--- +---@param featureDefID integer +---@param teamID integer +---@param x number +---@param y number +---@param z number +---@return boolean whether or not the creation is permitted +function AllowFeatureCreation(featureDefID, teamID, x, y, z) end + +---Called just before a feature changes its build percentage. +--- +---Note that this is also called for resurrecting features, and for refilling features with resources before resurrection. +---On reclaim the part values are negative, and on refill and ressurect they are positive. +---Part is the percentage the feature be built or reclaimed per frame. +---Eg. for a 30 workertime builder, that's a build power of 1 per frame. +---For a 50 buildtime feature reclaimed by this builder, part will be 100/-50(/1) = -2%, or -0.02 numerically. +--- +---@param builderID integer +---@param builderTeam integer +---@param featureID integer +---@param featureDefID integer +---@param part number +---@return boolean whether or not the change is permitted +function AllowFeatureBuildStep(builderID, builderTeam, featureID, featureDefID, part) end + +---Called when a team sets the sharing level of a resource. +--- +---@param teamID integer +---@param res string +---@param level number +---@return boolean whether or not the sharing level is permitted +function AllowResourceLevel(teamID, res, level) end + +---Called just before resources are transferred between players. +--- +---@param oldTeamID integer +---@param newTeamID integer +---@param res string +---@param amount number +---@return boolean whether or not the transfer is permitted. +function AllowResourceTransfer(oldTeamID, newTeamID, res, amount) end + +---Determines if this unit can be controlled directly in FPS view. +--- +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +---@param playerID integer +---@return boolean allow +function AllowDirectUnitControl(unitID, unitDefID, unitTeam, playerID) end + +---Called when a construction unit wants to "use his nano beams". +--- +---@param unitID integer +---@param unitDefID integer +---@param action number one of following: +--- +----1 Build +---CMD.REPAIR Repair +---CMD.RECLAIM Reclaim +---CMD.RESTORE Restore +---CMD.RESURRECT Resurrect +---CMD.CAPTURE Capture +---@return boolean actionAllowed +function AllowBuilderHoldFire(unitID, unitDefID, action) end + +---Whether a start position should be allowed +--- +---clamped{X,Y,Z} are the coordinates clamped into start-boxes, raw is where player tried to place their marker. +--- +---The readyState can be any one of: +--- +---0 - player picked a position, +---1 - player clicked ready, +---2 - player pressed ready OR the game was force-started (player did not click ready, but is now forcibly readied) or +---3 - the player failed to load. +---The default 'failed to choose' start-position is the north-west point of their startbox, or (0,0,0) if they do not have a startbox. +--- +---@param playerID integer +---@param teamID integer +---@param readyState number +---@param clampedX number +---@param clampedY number +---@param clampedZ number +---@param rawX number +---@param rawY number +---@param rawZ number +---@return boolean allow +function AllowStartPosition(playerID, teamID, readyState, clampedX, clampedY, clampedZ, rawX, rawY, rawZ) end + +---Enable both Spring.MoveCtrl.SetCollideStop and Spring.MoveCtrl.SetTrackGround to enable this call-in. +--- +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +---@param data number was supposed to indicate the type of notification but currently never has a value other than 1 ("unit hit the ground"). +---@return boolean whether or not the unit should remain script-controlled (false) or return to engine controlled movement (true). +function MoveCtrlNotify(unitID, unitDefID, unitTeam, data) end + +---Called when pre-building terrain levelling terraforms are completed (c.f. levelGround) +--- +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +---@param buildUnitID integer +---@param buildUnitDefID integer +---@param buildUnitTeam integer +---@return boolean if true the current build order is terminated +function TerraformComplete(unitID, unitDefID, unitTeam, buildUnitID, buildUnitDefID, buildUnitTeam) end + +---Damage Controllers +--- +---For the following callins, in addition to being a regular weapon, weaponDefID may be one of the following: +--- +----1 - debris collision, also default of Spring.AddUnitDamage +----2 - ground collision +----3 - object collision +----4 - fire damage +----5 - water damage +----6 - kill damage +----7 - crush damage + +---Called before damage is applied to the unit, allows fine control over how much damage and impulse is applied. +--- +---Called after every damage modification (even `HitByWeaponId`) but before the damage is applied +--- +---expects two numbers returned by lua code: +---1st is stored under *newDamage if newDamage != NULL +---2nd is stored under *impulseMult if impulseMult != NULL +--- +---@param unitID integer +---@param unitDefID integer +---@param unitTeam integer +---@param damage number +---@param paralyzer boolean +---@param weaponDefID integer? Synced Only +---@param projectileID integer? Synced Only +---@param attackerID integer? Synced Only +---@param attackerDefID integer? Synced Only +---@param attackerTeam integer? Synced Only +---@return number newDamage, number impulseMult +function UnitPreDamaged(unitID, unitDefID, unitTeam, damage, paralyzer, weaponDefID, projectileID, attackerID, attackerDefID, attackerTeam) end + +---Called before damage is applied to the feature. +--- +---Allows fine control over how much damage and impulse is applied. +--- +---@param featureID integer +---@param featureDefID integer +---@param featureTeam integer +---@param damage number +---@param weaponDefID integer +---@param projectileID integer +---@param attackerID integer +---@param attackerDefID integer +---@param attackerTeam integer +---@return number newDamage +---@return number impulseMult +function FeaturePreDamaged(featureID, featureDefID, featureTeam, damage, weaponDefID, projectileID, attackerID, attackerDefID, attackerTeam) end + +---Called before any engine shield-vs-projectile logic executes. +--- +---If the weapon is a hitscan type (BeamLaser or LightningCanon) then proID is nil and beamEmitterWeaponNum and beamEmitterUnitID are populated instead. +--- +---@param projectileID integer +---@param projectileOwnerID integer +---@param shieldWeaponNum integer +---@param shieldCarrierID integer +---@param bounceProjectile boolean +---@param beamEmitterWeaponNum integer +---@param beamEmitterUnitID integer +---@param startX number +---@param startY number +---@param startZ number +---@param hitX number +---@param hitY number +---@param hitZ number +---@return boolean if true the gadget handles the collision event and the engine does not remove the projectile +function ShieldPreDamaged(projectileID, projectileOwnerID, shieldWeaponNum, shieldCarrierID, bounceProjectile, beamEmitterWeaponNum, beamEmitterUnitID, startX, startY, startZ, hitX, hitY, hitZ) end + +---Determines if this weapon can automatically generate targets itself. See also commandFire weaponDef tag. +--- +---@param attackerID integer +---@param attackerWeaponNum integer +---@param attackerWeaponDefID integer +---@return boolean allowCheck +---@return boolean ignoreCheck +function AllowWeaponTargetCheck(attackerID, attackerWeaponNum, attackerWeaponDefID) end + +---Controls blocking of a specific target from being considered during a weapon's periodic auto-targeting sweep. +--- +---@param attackerID integer +---@param targetID integer +---@param attackerWeaponNum integer +---@param attackerWeaponDefID integer +---@param defPriority number +---@return boolean allowed +---@return number the new priority for this target (if you don't want to change it, return defPriority). Lower priority targets are targeted first. +function AllowWeaponTarget(attackerID, targetID, attackerWeaponNum, attackerWeaponDefID, defPriority) end + +---Controls blocking of a specific intercept target from being considered during an interceptor weapon's periodic auto-targeting sweep. +--- +---Only called for weaponDefIDs registered via Script.SetWatchWeapon. +--- +---@param interceptorUnitID integer +---@param interceptorWeaponID integer +---@param targetProjectileID integer +---@return boolean allowed +function AllowWeaponInterceptTarget(interceptorUnitID, interceptorWeaponID, targetProjectileID) end \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaIO.lua b/rts/Lua/library/generated/LuaIO.lua new file mode 100644 index 0000000000..b571985bbe --- /dev/null +++ b/rts/Lua/library/generated/LuaIO.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaIO.cpp +--- +---@meta + diff --git a/rts/Lua/library/generated/LuaInputReceiver.lua b/rts/Lua/library/generated/LuaInputReceiver.lua new file mode 100644 index 0000000000..86afcfa149 --- /dev/null +++ b/rts/Lua/library/generated/LuaInputReceiver.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaInputReceiver.cpp +--- +---@meta + diff --git a/rts/Lua/library/generated/LuaInterCall.lua b/rts/Lua/library/generated/LuaInterCall.lua new file mode 100644 index 0000000000..da17e9470e --- /dev/null +++ b/rts/Lua/library/generated/LuaInterCall.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaInterCall.cpp +--- +---@meta + diff --git a/rts/Lua/library/generated/LuaIntro.lua b/rts/Lua/library/generated/LuaIntro.lua new file mode 100644 index 0000000000..ba021f0459 --- /dev/null +++ b/rts/Lua/library/generated/LuaIntro.lua @@ -0,0 +1,15 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaIntro.cpp +--- +---@meta + +---Draws custom load screens. +function DrawLoadScreen() end + +---@param message string +---@param replaceLastLine boolean +function LoadProgress(message, replaceLastLine) end \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaMaterial.lua b/rts/Lua/library/generated/LuaMaterial.lua new file mode 100644 index 0000000000..ec2c9c3f73 --- /dev/null +++ b/rts/Lua/library/generated/LuaMaterial.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaMaterial.cpp +--- +---@meta + diff --git a/rts/Lua/library/generated/LuaMathExtra.lua b/rts/Lua/library/generated/LuaMathExtra.lua new file mode 100644 index 0000000000..dde20555b9 --- /dev/null +++ b/rts/Lua/library/generated/LuaMathExtra.lua @@ -0,0 +1,85 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaMathExtra.cpp +--- +---@meta + +---math extensions +--- +---@see rts/Lua/LuaMathExtra.cpp + +---Returns the length of hypotenuse of right angle triangle with sides x and y, +---equivalent to `sqrt(x*x + y*y)`, but has better numerical stability and +---internally handles intermediate overflows/underflows, but is also slower. +--- +---@param x number +---@param y number +---@return number `sqrt(x*x+y*y)` +function math.hypot(x, y) end + +---Returns the length of the diagonal of an n-dimensional box (or the length of +---an n-component vector). Rather quick method that does not handle intermediate +---overflows/underflows nor is made for numerical stability. +--- +---@param x number +---@param ... number +---@return number diagonal +function math.diag(x, ...) end + +---Returns x clamped to min and max boundaries. +--- +---@param value number +---@param min number +---@param max number +---@return number clamped +function math.clamp(value, min, max) end + +---Returns 0 if x == 0, 1 if x > 0, -1 if x < 0 +--- +---@param x number +---@return number sign +function math.sgn(x) end + +---Returns linear interpolation between x and y with ratio a (x+(y-x)*a). +--- +---@param x number +---@param y number +---@param a number +---@return number (x+(y-x)*a) +function math.mix(x, y, a) end + +---Returns x rounded to n decimals, if n is omitted or <=0, rounds to nearest +---integer. Note that Spring's Lua interpreter uses 32-bit floats for all +---numbers so max. precision is ~7 decimal digits. +--- +---@param x number +---@param decimals number +---@return number rounded +function math.round(x, decimals) end + +---Returns erf(x), the Gauss error function, between -1 and 1. +--- +---@param x number +---@return number erf +function math.erf(x) end + +---Applies the smoothstep function +--- +---Clamps and rescales v to a value between [0; 1] based on the edges and then applies the smoothstep function. +---For example math.smoothstep(10, 25, 15) is 0.259, because 15 is 0.333 of the way from 10 to 25, and smoothstep(0.333) is 0.259 +--- +---@param edge0 number +---@param edge1 number +---@param v number +---@return number smoothstep +function math.smoothstep(edge0, edge1, v) end + +---Returns the normalize vector of an given vector. +--- +---@param x number +---@param ... number +---@return number ... normalized +function math.normalize(x, ...) end \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaMemPool.lua b/rts/Lua/library/generated/LuaMemPool.lua new file mode 100644 index 0000000000..d05e2a0700 --- /dev/null +++ b/rts/Lua/library/generated/LuaMemPool.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaMemPool.cpp +--- +---@meta + diff --git a/rts/Lua/library/generated/LuaMenu.lua b/rts/Lua/library/generated/LuaMenu.lua new file mode 100644 index 0000000000..6d08810eb4 --- /dev/null +++ b/rts/Lua/library/generated/LuaMenu.lua @@ -0,0 +1,23 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaMenu.cpp +--- +---@meta + +---Lua Menu API +--- +---@see rts/Lua/LuaMenu.cpp + +---Called whenever LuaMenu is on with no game loaded. +function ActivateMenu() end + +---Called whenever LuaMenu is on with a game loaded. +function ActivateGame() end + +---Enables Draw{Genesis,Screen,ScreenPost} callins if true is returned, otherwise they are called once every 30 seconds. Only active when a game isn't running. +--- +---@return boolean allowDraw +function AllowDraw() end \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaMetalMap.lua b/rts/Lua/library/generated/LuaMetalMap.lua new file mode 100644 index 0000000000..33ddd14ed5 --- /dev/null +++ b/rts/Lua/library/generated/LuaMetalMap.lua @@ -0,0 +1,18 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaMetalMap.cpp +--- +---@meta + +---Metal Map Lua API +--- +---@see rts/Lua/LuaMetalMap.cpp + +---@param x integer in worldspace/16. +---@param z integer in worldspace/16. +---@param metalAmount number must be between 0 and 255*maxMetal (with maxMetal from the .smd or mapinfo.lua). +---@return nil +function Spring.SetMetalAmount(x, z, metalAmount) end \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaObjectRendering.lua b/rts/Lua/library/generated/LuaObjectRendering.lua new file mode 100644 index 0000000000..e41ea5785c --- /dev/null +++ b/rts/Lua/library/generated/LuaObjectRendering.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaObjectRendering.cpp +--- +---@meta + diff --git a/rts/Lua/library/generated/LuaOpenGL.lua b/rts/Lua/library/generated/LuaOpenGL.lua new file mode 100644 index 0000000000..6f49933fa6 --- /dev/null +++ b/rts/Lua/library/generated/LuaOpenGL.lua @@ -0,0 +1,61 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaOpenGL.cpp +--- +---@meta + +---Lua OpenGL API +--- +---@see rts/Lua/LuaOpenGL.cpp + +---Text +--- +---@section text + +gl = { + +} + +---@param text string +---@param x number +---@param y number +---@param size number +---@param options string? concatenated string of option characters. +--- +---- horizontal alignment: +---- 'c' = center +---- 'r' = right +---- vertical alignment: +---- 'a' = ascender +---- 't' = top +---- 'v' = vertical center +---- 'x' = baseline +---- 'b' = bottom +---- 'd' = descender +---- decorations: +---- 'o' = black outline +---- 'O' = white outline +---- 's' = shadow +---- other: +---- 'n' = don't round vertex coords to nearest integer (font may get blurry) +---@return nil +function gl.Text(text, x, y, size, options) end + +---Draw Basics +--- +---@section draw_basics + +---@param r number Red +---@param g number Green +---@param b number Blue +---@param a number? Alpha (Default: 1.0f) +function gl.Color(r, g, b, a) end + +---@param rgbs [number,number,number,number] Red, green, blue, alpha +function gl.Color(rgbs) end + +---@param rgb [number,number,number] Red, green, blue +function gl.Color(rgb) end \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaOpenGLUtils.lua b/rts/Lua/library/generated/LuaOpenGLUtils.lua new file mode 100644 index 0000000000..4a309d86f4 --- /dev/null +++ b/rts/Lua/library/generated/LuaOpenGLUtils.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaOpenGLUtils.cpp +--- +---@meta + diff --git a/rts/Lua/library/generated/LuaParser.lua b/rts/Lua/library/generated/LuaParser.lua new file mode 100644 index 0000000000..fea6ec3817 --- /dev/null +++ b/rts/Lua/library/generated/LuaParser.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaParser.cpp +--- +---@meta + diff --git a/rts/Lua/library/generated/LuaPathFinder.lua b/rts/Lua/library/generated/LuaPathFinder.lua new file mode 100644 index 0000000000..505ac54e04 --- /dev/null +++ b/rts/Lua/library/generated/LuaPathFinder.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaPathFinder.cpp +--- +---@meta + diff --git a/rts/Lua/library/generated/LuaRBOs.lua b/rts/Lua/library/generated/LuaRBOs.lua new file mode 100644 index 0000000000..dbfa89a899 --- /dev/null +++ b/rts/Lua/library/generated/LuaRBOs.lua @@ -0,0 +1,38 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaRBOs.cpp +--- +---@meta + +---RBO +--- +---@see rts/Lua/LuaRBOs.cpp + +---User Data RBO +--- +---@class RBO +---@field target GL +---@field format GL +---@field xsize integer +---@field ysize integer +---@field valid boolean +---@field samples integer will return globalRendering->msaaLevel for multisampled RBO or 0 otherwise +local RBO = {} + +---@class CreateRBOData +---@field target GL +---@field format GL +---@field samples number? any number here will result in creation of multisampled RBO +local CreateRBOData = {} + +---@param xsize integer +---@param ysize integer +---@param data CreateRBOData +---@return RBO +function gl.CreateRBO(xsize, ysize, data) end + +---@param rbo RBO +function gl.DeleteRBO(rbo) end \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaRules.lua b/rts/Lua/library/generated/LuaRules.lua new file mode 100644 index 0000000000..1b4d19c9c8 --- /dev/null +++ b/rts/Lua/library/generated/LuaRules.lua @@ -0,0 +1,12 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaRules.cpp +--- +---@meta + +---Lua Rules +--- +---@see rts/Lua/LuaRules.cpp \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaRulesParams.lua b/rts/Lua/library/generated/LuaRulesParams.lua new file mode 100644 index 0000000000..dc11f54473 --- /dev/null +++ b/rts/Lua/library/generated/LuaRulesParams.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaRulesParams.cpp +--- +---@meta + diff --git a/rts/Lua/library/generated/LuaScream.lua b/rts/Lua/library/generated/LuaScream.lua new file mode 100644 index 0000000000..0961a2f9e6 --- /dev/null +++ b/rts/Lua/library/generated/LuaScream.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaScream.cpp +--- +---@meta + diff --git a/rts/Lua/library/generated/LuaShaders.lua b/rts/Lua/library/generated/LuaShaders.lua new file mode 100644 index 0000000000..28762bf072 --- /dev/null +++ b/rts/Lua/library/generated/LuaShaders.lua @@ -0,0 +1,220 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaShaders.cpp +--- +---@meta + +---Shader creation and management +--- +---These functions are ONLY available if the graphics adapter supports GLSL. +---Please test in your scripts if one of them exists before you use them. In headless mode, the gl. callouts are nil. +--- +---@see rts/Lua/LuaShaders.cpp + +---Returns the shader compilation error log. This is empty if the shader linking failed, in that case, check your in/out blocks and ensure they match. +--- +---@return string infoLog +function gl.GetShaderLog() end + +---A table of uniform name to value. +--- +---The Uniforms are the values you send along with the shader-program. To use +---them in the shader-program declare them like this: `uniform float frame;` +--- +---Specify a Lua array to initialize GLSL arrays. +--- +---The engine will automatically fill in an appropriately named uniform for team +---colour if it is declared; +--- +---```glsl +---uniform vec4 teamColor; +---``` +--- +---@class UniformParam : { [string]: T|T[] } +local UniformParam = {} + +---@class ShaderParams +---@field vertex string? +--- +---The "Vetex" or vertex-shader is your GLSL-Code as string, its written in a +---C-Dialect. This shader is busy deforming the geometry of a unit but it can +---not create new polygons. Use it for waves, wobbling surfaces etc. +---@field tcs string? +--- +---The "TCS" or Tesselation Control Shader controls how much tessellation a +---particular patch gets; it also defines the size of a patch, thus allowing it +---to augment data. It can also filter vertex data taken from the vertex shader. +---The main purpose of the TCS is to feed the tessellation levels to the +---Tessellation primitive generator stage, as well as to feed patch data (as its +---output values) to the Tessellation Evaluation Shader stage. +---@field tes string? +--- +---The "TES" or Tesselation Evaluation Shader takes the abstract patch generated +---by the tessellation primitive generation stage, as well as the actual vertex +---data for the entire patch, and generates a particular vertex from it. Each +---TES invocation generates a single vertex. It can also take per-patch data +---provided by the Tessellation Control Shader. +---@field geometry string? +--- +---The "Geometry" or Geometry-shader can create new vertices and vertice-stripes +---from points. +---@field fragment string? +--- +---The "Fragment" or Fragment-shader (sometimes called pixel-Shader) is post +---processing the allready rendered picture (for example drawing stars on the +---sky). +--- +---Remember textures are not always 2 dimensional pictures. They can contain +---information about the depth, or the third value marks areas and the strength +---at which these are processed. +---@field uniform UniformParam? +---@field uniformInt UniformParam? +---@field uniformFloat UniformParam? +---@field uniformMatrix UniformParam? +---@field geoInputType integer? inType +---@field geoOutputType integer? outType +---@field geoOutputVerts integer? maxVerts +---@field definitions string? string of shader #defines" +local ShaderParams = {} + +---Create a shader. +--- +---@param shaderParams ShaderParams +---@return integer shaderID +function gl.CreateShader(shaderParams) end + +---Deletes a shader identified by shaderID +--- +---@param shaderID integer +function gl.DeleteShader(shaderID) end + +---Binds a shader program identified by shaderID. Pass 0 to disable the shader. Returns wether the shader was successfully bound. +--- +---@param shaderID integer +---@return boolean linked +function gl.UseShader(shaderID) end + +---Binds a shader program identified by shaderID, and calls the Lua func with +---the specified arguments. +--- +---Can be used in NON-drawing events (to update uniforms etc.)! +--- +---@param shaderID integer +---@param func function +---@param ... any Arguments +function gl.ActiveShader(shaderID, func, ...) end + +---@class ActiveUniform +---@field name string +---@field type string String name of `GL_*` constant. +---@field length integer The character length of `name`. +---@field size integer +---@field location GL +local ActiveUniform = {} + +---Query the active (actually used) uniforms of a shader and identify their +---names, types (float, int, uint) and sizes (float, vec4, ...). +--- +---@param shaderID integer +---@return ActiveUniform[] activeUniforms +function gl.GetActiveUniforms(shaderID) end + +---Returns the locationID of a shaders uniform. Needed for changing uniform +---values with function `gl.Uniform`. +--- +---@param shaderID integer +---@param name string +---@return GL locationID +function gl.GetUniformLocation(shaderID, name) end + +---Sets the uniform float value at the locationID for the currently active +---shader. Shader must be activated before setting uniforms. +--- +---@param locationID GL|string uniformName +---@param f1 number +---@param f2 number? +---@param f3 number? +---@param f4 number? +function gl.Uniform(locationID, f1, f2, f3, f4) end + +---Sets the uniform int value at the locationID for the currently active shader. +---Shader must be activated before setting uniforms. +--- +---@param locationID integer|string uniformName +---@param int1 integer +---@param int2 integer? +---@param int3 integer? +---@param int4 integer? +function gl.UniformInt(locationID, int1, int2, int3, int4) end + +---@alias UniformArrayType +---| 1 # int +---| 2 # float +---| 3 # float matrix + +---Sets the an array of uniform values at the locationID for the currently +---active shader. +--- +---Shader must be activated before setting uniforms. +--- +---@param locationID integer|string uniformName +---@param type UniformArrayType +---@param uniforms number[] Array up to 1024 elements +function gl.UniformArray(locationID, type, uniforms) end + +---Sets the a uniform mat4 locationID for the currently active shader. +--- +---Shader must be activated before setting uniforms. +--- +---Can set one one common matrix like shadow, or by passing 16 additional +---numbers for the matrix. +--- +---@param locationID integer|string uniformName +---@param matrix "shadows"|"camera"|"caminv"|"camprj" Name of common matrix. +function gl.UniformMatrix(locationID, matrix) end + +---Sets the a uniform mat4 locationID for the currently active shader. +--- +---Shader must be activated before setting uniforms. +--- +---Can set one one common matrix like shadow, or by passing 16 additional +---numbers for the matrix. +--- +---@param locationID number|string uniformName +---@param matrix number[] A 2x2, 3x3 or 4x4 matrix. +function gl.UniformMatrix(locationID, matrix) end + +--- +---Return the GLSL compliant definition of UniformMatricesBuffer(idx=0) or UniformParamsBuffer(idx=1) structure. +--- +---@param index number +---@return string glslDefinition +function gl.GetEngineUniformBufferDef(index) end + +--- +---Return the GLSL compliant definition of ModelUniformData structure (per Unit/Feature buffer available on GPU) +--- +---@param index number +---@return string glslDefinition +function gl.GetEngineModelUniformDataDef(index) end + +---Sets the Geometry shader parameters for shaderID. Needed by geometry shader programs (check the opengl GL_ARB_geometry_shader4 extension for glProgramParameteri) +--- +---@param shaderID integer +---@param param number +---@param number number +---@return nil +function gl.SetGeometryShaderParameter(shaderID, param, number) end + +---Sets the tesselation shader parameters for `shaderID`. +--- +---Needed by tesselation shader programs. (Check the opengl +---`GL_ARB_tessellation_shader` extension for `glProgramParameteri`). +--- +---@param param integer +---@param value integer +---@return nil +function gl.SetTesselationShaderParameter(param, value) end \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaSyncedCtrl.lua b/rts/Lua/library/generated/LuaSyncedCtrl.lua new file mode 100644 index 0000000000..2a0eaf478e --- /dev/null +++ b/rts/Lua/library/generated/LuaSyncedCtrl.lua @@ -0,0 +1,1644 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaSyncedCtrl.cpp +--- +---@meta + +---Synced Lua API +--- +---@see rts/Lua/LuaSyncedCtrl.cpp + +---Teams +--- +---@section teams + +---Changes the value of the (one-sided) alliance between: firstAllyTeamID -> secondAllyTeamID. +--- +---@param firstAllyTeamID integer +---@param secondAllyTeamID integer +---@param ally boolean +---@return nil +function Spring.SetAlly(firstAllyTeamID, secondAllyTeamID, ally) end + +---Changes the start box position of an allyTeam. +--- +---@param allyTeamID integer +---@param xMin number left start box boundary (elmos) +---@param zMin number top start box boundary (elmos) +---@param xMax number right start box boundary (elmos) +---@param zMax number bottom start box boundary (elmos) +---@return nil +function Spring.SetAllyTeamStartBox(allyTeamID, xMin, zMin, xMax, zMax) end + +---Assigns a player to a team. +--- +---@param playerID integer +---@param teamID integer +---@return nil +function Spring.AssignPlayerToTeam(playerID, teamID) end + +---Changes access to global line of sight for a team and its allies. +--- +---@param allyTeamID integer +---@param globallos boolean +---@return nil +function Spring.SetGlobalLos(allyTeamID, globallos) end + +---Game End +--- +---@section gameend + +---Will declare a team to be dead (no further orders can be assigned to such teams units). +--- +---Gaia team cannot be killed. +--- +---@param teamID integer +---@return nil +function Spring.KillTeam(teamID) end + +---Will declare game over. +--- +---A list of winning allyteams can be passed, if undecided (like when dropped from the host) it should be empty (no winner), in the case of a draw with multiple winners, all should be listed. +--- +---@param allyTeamID1 number? +---@param allyTeamID2 number? +---@param allyTeamIDn number? +---@return nil +function Spring.GameOver(allyTeamID1, allyTeamID2, allyTeamIDn) end + +---Resources +--- +---@section resources + +---Set tidal strength +--- +---@param strength number +---@return nil +function Spring.SetTidal(strength) end + +---Set wind strength +--- +---@param minStrength number +---@param maxStrength number +---@return nil +function Spring.SetWind(minStrength, maxStrength) end + +---Adds metal or energy resources to the specified team. +--- +---@param teamID integer +---@param type ResourceName +---@param amount number +---@return nil +function Spring.AddTeamResource(teamID, type, amount) end + +---Consumes metal or energy resources of the specified team. +--- +---@param teamID integer +---@param type ResourceName Resource type. +---@param amount number Amount of resource to use. +---@return boolean hadEnough +---True if enough of the resource type was available and was consumed, otherwise false. +function Spring.UseTeamResource(teamID, type, amount) end + +---Consumes metal and/or energy resources of the specified team. +--- +---@param teamID integer +---@param amount ResourceUsage +---@return boolean hadEnough +---True if enough of the resource type(s) were available and was consumed, otherwise false. +function Spring.UseTeamResource(teamID, amount) end + +---@param teamID integer +---@param resource ResourceName|StorageName +---@param amount number +---@return nil +function Spring.SetTeamResource(teamID, resource, amount) end + +---Changes the resource amount for a team beyond which resources aren't stored but transferred to other allied teams if possible. +--- +---@param teamID integer +---@param type ResourceName +---@param amount number +---@return nil +function Spring.SetTeamShareLevel(teamID, type, amount) end + +---Transfers resources between two teams. +--- +---@param teamID_src integer +---@param teamID_recv integer +---@param type ResourceName +---@param amount number +---@return nil +function Spring.ShareTeamResource(teamID_src, teamID_recv, type, amount) end + +---Rules Params +--- +---@section rulesparams + +---Parameters for los access +--- +---If one condition is fulfilled all beneath it are too (e.g. if an unit is in +---LOS it can read params with `inradar=true` even if the param has +---`inlos=false`) All GameRulesParam are public, TeamRulesParams can just be +---`private`,`allied` and/or `public` You can read RulesParams from any Lua +---enviroments! With those losAccess policies you can limit their access. +--- +---NOTE: Need to explicitly declare `public` scope here to prevent LLS from +---detecting field names as access modifiers. +--- +---See https://github.com/LuaLS/lua-language-server/issues/1814 +--- +---@class losAccess +---@field public private boolean? only readable by the ally (default) +---@field public allied boolean? readable by ally + ingame allied +---@field public inlos boolean? readable if the unit is in LOS +---@field public inradar boolean? readable if the unit is in AirLOS +---@field public public boolean? readable by all +local losAccess = {} + +---@param paramName string +---@param paramValue ?number|string numeric paramValues in quotes will be converted to number. +---@tparam +---@return nil +function Spring.SetGameRulesParam(paramName, paramValue) end + +---@param teamID integer +---@param paramName string +---@param paramValue ?number|string numeric paramValues in quotes will be converted to number. +---@tparam +---@return nil +function Spring.SetTeamRulesParam(teamID, paramName, paramValue) end + +---@param playerID integer +---@param paramName string +---@param paramValue ?number|string numeric paramValues in quotes will be converted to number. +---@tparam +---@return nil +function Spring.SetPlayerRulesParam(playerID, paramName, paramValue) end + +---@param unitID integer +---@param paramName string +---@param paramValue ?number|string numeric paramValues in quotes will be converted to number. +---@tparam +---@return nil +function Spring.SetUnitRulesParam(unitID, paramName, paramValue) end + +---@param featureID integer +---@param paramName string +---@param paramValue ?number|string numeric paramValues in quotes will be converted to number. +---@tparam +---@return nil +function Spring.SetFeatureRulesParam(featureID, paramName, paramValue) end + +---Lua to COB +--- +---@section luatocob + +---@param unitID integer +---@param funcName integer|string? Function ID or name. +---@param retArgs integer Number of values to return. +---@param ... any Arguments +---@return number ... +function Spring.CallCOBScript(unitID, funcName, retArgs, ...) end + +---@param unitID integer +---@param funcName string +---@return integer? funcID +function Spring.GetCOBScriptID(unitID, funcName) end + +---Unit Handling +--- +---@section unithandling + +---@see Spring.DestroyUnit +--- +---Offmap positions are clamped! Use MoveCtrl to move to such positions. +---@param unitDefName string|number or unitDefID +---@param x number +---@param y number +---@param z number +---@param facing string|number possible values for facing are: "south" | "s" | 0, "east" | "e" | 1, "north" | "n" | 2, "west" | "w" | 3 +---@param teamID integer +---@param build boolean? (Default: false) the unit is created in "being built" state with buildProgress = 0 +---@param flattenGround boolean? (Default: true) the unit flattens ground, if it normally does so +---@param unitID integer? requests specific unitID +---@param builderID integer? +---@return number|nil unitID meaning unit was created +function Spring.CreateUnit(unitDefName, x, y, z, facing, teamID, build, flattenGround, unitID, builderID) end + +---@see Spring.CreateUnit +---@param unitID integer +---@param selfd boolean? (Default: false) makes the unit act like it self-destructed. +---@param reclaimed boolean? (Default: false) don't show any DeathSequences, don't leave a wreckage. This does not give back the resources to the team! +---@param attackerID integer? +---@param cleanupImmediately boolean? (Default: false) stronger version of reclaimed, removes the unit unconditionally and makes its ID available for immediate reuse (otherwise it takes a few frames) +---@return nil +function Spring.DestroyUnit(unitID, selfd, reclaimed, attackerID, cleanupImmediately) end + +---@param unitID integer +---@param newTeamID integer +---@param given boolean? (Default: true) if false, the unit is captured. +---@return nil +function Spring.TransferUnit(unitID, newTeamID, given) end + +---Unit Control +--- +---@section unitcontrol + +---@param unitID integer +---@param where table keys and values are, respectively and in this order: buildTime=amount, metalCost=amount, energyCost=amount +---@return nil +function Spring.SetUnitCosts(unitID, where) end + +---Unit Resourcing +--- +---@section unitresourcing + +---@param unitID integer +---@param res string +---@param amount number +---@return nil +function Spring.SetUnitResourcing(unitID, res, amount) end + +---@param unitID integer +---@param res table keys are: "[u|c][u|m][m|e]" unconditional | conditional, use | make, metal | energy. Values are amounts +---@return nil +function Spring.SetUnitResourcing(unitID, res) end + +---@param unitID integer +---@param tooltip string +---@return nil +function Spring.SetUnitTooltip(unitID, tooltip) end + +---@param unitID integer +---@param health number|table where keys can be one of health|capture|paralyze|build and values are amounts +---@return nil +function Spring.SetUnitHealth(unitID, health) end + +---@param unitID integer +---@param maxHealth number +---@return nil +function Spring.SetUnitMaxHealth(unitID, maxHealth) end + +---@param unitID integer +---@param stockpile number? +---@param buildPercent number? +---@return nil +function Spring.SetUnitStockpile(unitID, stockpile, buildPercent) end + +---Parameter for weapon states +--- +---@class WeaponState +---@field reloadState integer? +---@field reloadFrame integer? Alias for `reloadState`. +---@field reloadTime number? +---@field reaimTime integer? +---@field accuracy number? +---@field sprayAngle number? +---@field range number? +---If you change the range of a weapon with dynamic damage make sure you use `SetUnitWeaponDamages` to change dynDamageRange as well. +---@field projectileSpeed number? +---@field burst integer? +---@field burstRate number? +---@field projectiles integer? +---@field salvoLeft integer? +---@field nextSalvo integer? +---@field aimReady number? +---Set to `true` if a non-zero value is passed, `false` is zero is passed. +---@field forceAim integer? +---@field avoidFlags integer? +---@field collisionFlags integer? +local WeaponState = {} + +---@param unitID integer +---@param forceUseWeapons number? +---@param allowUseWeapons number? +---@return nil +function Spring.SetUnitUseWeapons(unitID, forceUseWeapons, allowUseWeapons) end + +---@param unitID integer +---@param weaponNum number +---@param states WeaponState +---@return nil +function Spring.SetUnitWeaponState(unitID, weaponNum, states) end + +---@param unitID integer +---@param weaponNum number +---@param key string +---@param value number +---@return nil +function Spring.SetUnitWeaponState(unitID, weaponNum, key, value) end + +---Parameters for damage +--- +---@class WeaponDamages +---@field paralyzeDamageTime integer +---@field impulseFactor number +---@field impulseBoost number +---@field craterMult number +---@field craterBoost number +---@field dynDamageExp number +---@field dynDamageMin number +---@field dynDamageRange number +---@field dynDamageInverted number +---Set to `true` if a non-zero value is passed, `false` is zero is passed. +---@field craterAreaOfEffect number +---@field damageAreaOfEffect number +---@field edgeEffectiveness number +---@field explosionSpeed number +local WeaponDamages = {} + +---@param unitID integer +---@param weaponNum number|"selfDestruct"|"explode" +---@param damages WeaponDamages +---@return nil +function Spring.SetUnitWeaponDamages(unitID, weaponNum, damages) end + +---@param unitID integer +---@param weaponNum number|"selfDestruct"|"explode" +---@param key string +---@param value number +---@return nil +function Spring.SetUnitWeaponDamages(unitID, weaponNum, key, value) end + +---@param unitID integer +---@param maxRange number +---@return nil +function Spring.SetUnitMaxRange(unitID, maxRange) end + +---@see Spring.AddUnitExperience +---@see Spring.GetUnitExperience +---@param unitID integer +---@param experience number +---@return nil +function Spring.SetUnitExperience(unitID, experience) end + +---@see Spring.SetUnitExperience +---@see Spring.GetUnitExperience +---@param unitID integer +---@param deltaExperience number Can be negative to subtract, but the unit will never have negative total afterwards +---@return nil +function Spring.AddUnitExperience(unitID, deltaExperience) end + +---@param unitID integer +---@param armored boolean? +---@param armorMultiple number? +---@return nil +function Spring.SetUnitArmored(unitID, armored, armorMultiple) end + +---Unit LOS +--- +---@section unitlos + +--- +---The 3rd argument is either the bit-and combination of the following numbers: +--- +---LOS_INLOS = 1 +---LOS_INRADAR = 2 +---LOS_PREVLOS = 4 +---LOS_CONTRADAR = 8 +--- +---or a table of the following form: +--- +---losTypes = { +---[los = boolean,] +---[radar = boolean,] +---[prevLos = boolean,] +---[contRadar = boolean] +---} +--- +---@param unitID integer +---@param allyTeam number +---@param losTypes number|table +---@return nil +function Spring.SetUnitLosMask(unitID, allyTeam, losTypes) end + +---@param unitID integer +---@param allyTeam number +---@param los number|table +---@return nil +function Spring.SetUnitLosState(unitID, allyTeam, los) end + +--- +---If the 2nd argument is a number, the value works like this: +---1:=normal cloak +---2:=for free cloak (cost no E) +---3:=for free + no decloaking (except the unit is stunned) +---4:=ultimative cloak (no ecost, no decloaking, no stunned decloak) +--- +---The decloak distance is only changed: +---- if the 3th argument is a number or a boolean. +---- if the boolean is false it takes the default decloak distance for that unitdef, +---- if the boolean is true it takes the absolute value of it. +--- +---@param unitID integer +---@param cloak boolean|number +---@param cloakArg boolean|number +---@return nil +function Spring.SetUnitCloak(unitID, cloak, cloakArg) end + +---@param unitID integer +---@param stealth boolean +---@return nil +function Spring.SetUnitStealth(unitID, stealth) end + +---@param unitID integer +---@param sonarStealth boolean +---@return nil +function Spring.SetUnitSonarStealth(unitID, sonarStealth) end + +---@param unitID integer +---@param seismicSignature number +---@return nil +function Spring.SetUnitSeismicSignature(unitID, seismicSignature) end + +---@param unitID integer +---@param alwaysVisible boolean +---@return nil +function Spring.SetUnitAlwaysVisible(unitID, alwaysVisible) end + +---@param unitID integer +---@param useAirLos boolean +---@return nil +function Spring.SetUnitUseAirLos(unitID, useAirLos) end + +---@param unitID integer +---@param depth number corresponds to metal extraction rate +---@param range number? similar to "extractsMetal" in unitDefs. +---@return nil +function Spring.SetUnitMetalExtraction(unitID, depth, range) end + +---See also harvestStorage UnitDef tag. +--- +---@param unitID integer +---@param metal number +---@return nil +function Spring.SetUnitHarvestStorage(unitID, metal) end + +---@param unitID integer +---@param paramName string one of `buildRange`|`buildDistance`|`buildRange3D` +---@number +---@return nil +function Spring.SetUnitBuildParams(unitID, paramName) end + +---@param builderID integer +---@param buildSpeed number +---@param repairSpeed number? +---@param reclaimSpeed number? +---@param captureSpeed number? +---@param terraformSpeed number? +---@return nil +function Spring.SetUnitBuildSpeed(builderID, buildSpeed, repairSpeed, reclaimSpeed, captureSpeed, terraformSpeed) end + +--- +---This saves a lot of engine calls, by replacing: function script.QueryNanoPiece() return currentpiece end +---Use it! +--- +---@param builderID integer +---@param pieces table +---@return nil +function Spring.SetUnitNanoPieces(builderID, pieces) end + +---@param unitID integer +---@param isblocking boolean +---@param isSolidObjectCollidable boolean +---@param isProjectileCollidable boolean +---@param isRaySegmentCollidable boolean +---@param crushable boolean +---@param blockEnemyPushing boolean +---@param blockHeightChanges boolean +---@return nil +function Spring.SetUnitBlocking(unitID, isblocking, isSolidObjectCollidable, isProjectileCollidable, isRaySegmentCollidable, crushable, blockEnemyPushing, blockHeightChanges) end + +---@param unitID integer +---@param crashing boolean +---@return boolean success +function Spring.SetUnitCrashing(unitID, crashing) end + +---@param unitID integer +---@param weaponID integer? (Default: -1) +---@param enabled boolean? +---@param power number? +---@return nil +function Spring.SetUnitShieldState(unitID, weaponID, enabled, power) end + +---@param unitID integer +---@param weaponID integer? (optional if the unit only has one shield) +---@param rechargeTime number? (in seconds; emulates a regular hit if nil) +---@return nil +function Spring.SetUnitShieldRechargeDelay(unitID, weaponID, rechargeTime) end + +---@param unitID integer +---@param type string "dir"|"minDamage"|"maxDamage"|"moveFactor"|"mode" +---@param arg1 number x|minDamage|maxDamage|moveFactor|mode +---@param y number? only when type is "dir" +---@param z number? only when type is "dir" +---@return nil +function Spring.SetUnitFlanking(unitID, type, arg1, y, z) end + +---@param unitID integer +---@param Physical number[bit] state bit +---@return nil +function Spring.SetUnitPhysicalStateBit(unitID, Physical) end + +---@param unitID integer +---@return number Unit's PhysicalState bitmask +function Spring.GetUnitPhysicalState(unitID) end + +---@param unitID integer +---@param neutral boolean +---@return nil|boolean setNeutral +function Spring.SetUnitNeutral(unitID, neutral) end + +---Defines a unit's target. +--- +---@param unitID integer +---@param enemyUnitID integer? when nil drops the units current target. +---@param dgun boolean? (Default: false) +---@param userTarget boolean? (Default: false) +---@param weaponNum number? (Default: -1) +---@return boolean success +function Spring.SetUnitTarget(unitID, enemyUnitID, dgun, userTarget, weaponNum) end + +---@param unitID integer +---@param x number? when nil or not passed it will drop target and ignore other parameters +---@param y number? +---@param z number? +---@param dgun boolean? (Default: false) +---@param userTarget boolean? (Default: false) +---@param weaponNum number? (Default: -1) +---@return boolean success +function Spring.SetUnitTarget(unitID, x, y, z, dgun, userTarget, weaponNum) end + +---@param unitID integer +---@param mpX number new middle positionX of unit +---@param mpY number new middle positionY of unit +---@param mpZ number new middle positionZ of unit +---@param apX number new positionX that enemies aim at on this unit +---@param apY number new positionY that enemies aim at on this unit +---@param apZ number new positionZ that enemies aim at on this unit +---@param relative boolean? (Default: false) are the new coordinates relative to world (false) or unit (true) coordinates? Also, note that apy is inverted! +---@return boolean success +function Spring.SetUnitMidAndAimPos(unitID, mpX, mpY, mpZ, apX, apY, apZ, relative) end + +---@param unitID integer +---@param radius number +---@param height number +---@return boolean success +function Spring.SetUnitRadiusAndHeight(unitID, radius, height) end + +--- +---Sets the unit's radius for when targeted by build, repair, reclaim-type commands. +--- +---@param unitID integer +---@param build number radius for when targeted by build, repair, reclaim-type commands. +---@return nil +function Spring.SetUnitBuildeeRadius(unitID, build) end + +---Changes the pieces hierarchy of a unit by attaching a piece to a new parent. +--- +---@param unitID integer +---@param AlteredPiece number +---@param ParentPiece number +---@return nil +function Spring.SetUnitPieceParent(unitID, AlteredPiece, ParentPiece) end + +---Sets the local (i.e. parent-relative) matrix of the given piece. +--- +---If any of the first three elements are non-zero, and also blocks all script animations from modifying it until {0, 0, 0} is passed. +--- +---@param unitID integer +---@param pieceNum number +---@param matrix number[] an array of 16 floats +---@return nil +function Spring.SetUnitPieceMatrix(unitID, pieceNum, matrix) end + +---@param unitID integer +---@param scaleX number +---@param scaleY number +---@param scaleZ number +---@param offsetX number +---@param offsetY number +---@param offsetZ number +---@param vType number +---@param tType number +---@param Axis number +---@return nil +--- +---enum COLVOL_TYPES { +---COLVOL_TYPE_DISABLED = -1, +---COLVOL_TYPE_ELLIPSOID = 0, +---COLVOL_TYPE_CYLINDER, +---COLVOL_TYPE_BOX, +---COLVOL_TYPE_SPHERE, +---COLVOL_NUM_TYPES // number of non-disabled collision volume types +---}; +---enum COLVOL_TESTS { +---COLVOL_TEST_DISC = 0, +---COLVOL_TEST_CONT = 1, +---COLVOL_NUM_TESTS = 2 // number of tests +---}; +---enum COLVOL_AXES { +---COLVOL_AXIS_X = 0, +---COLVOL_AXIS_Y = 1, +---COLVOL_AXIS_Z = 2, +---COLVOL_NUM_AXES = 3 // number of collision volume axes +---}; +function Spring.SetUnitCollisionVolumeData(unitID, scaleX, scaleY, scaleZ, offsetX, offsetY, offsetZ, vType, tType, Axis) end + +---@param unitID integer +---@param pieceIndex number +---@param enable boolean +---@param scaleX number +---@param scaleY number +---@param scaleZ number +---@param offsetX number +---@param offsetY number +---@param offsetZ number +---@param volumeType number? +---@param primaryAxis number? +---@return nil +function Spring.SetUnitPieceCollisionVolumeData(unitID, pieceIndex, enable, scaleX, scaleY, scaleZ, offsetX, offsetY, offsetZ, volumeType, primaryAxis) end + +---@param unitID integer +---@param pieceIndex number +---@param visible boolean +---@return nil +function Spring.SetUnitPieceVisible(unitID, pieceIndex, visible) end + +---@param unitID integer +---@param type "los"|"airLos"|"radar"|"sonar"|"seismic"|"radarJammer"|"sonarJammer" +---@param radius number +---@return number? New radius, or `nil` if unit is invalid. +function Spring.SetUnitSensorRadius(unitID, type, radius) end + +---Sets a unit's radar wobble +--- +---Controls how much a unit's radar dot will wobble. Note that setting +---this above the allyTeam's default wobble may result in the edgemost +---dot positions failing to register in ray traces, i.e. things like +---native "is under cursor" checks and some Lua interfaces. +--- +---@param unitID integer +---@param posErrorVectorX number +---@param posErrorVectorY number +---@param posErrorVectorZ number +---@param posErrorDeltaX number +---@param posErrorDeltaY number +---@param posErrorDeltaZ number +---@param nextPosErrorUpdate number? +---@return nil +function Spring.SetUnitPosErrorParams(unitID, posErrorVectorX, posErrorVectorY, posErrorVectorZ, posErrorDeltaX, posErrorDeltaY, posErrorDeltaZ, nextPosErrorUpdate) end + +---Used by default commands to get in build-, attackrange etc. +--- +---@param unitID integer +---@param goalX number +---@param goalY number +---@param goalZ number +---@param goalRadius number? +---@param moveSpeed number? +---@param moveRaw boolean? +---@return nil +function Spring.SetUnitMoveGoal(unitID, goalX, goalY, goalZ, goalRadius, moveSpeed, moveRaw) end + +---Used in conjunction with Spring.UnitAttach et al. to re-implement old airbase & fuel system in Lua. +--- +---@param unitID integer +---@param goalX number +---@param goalY number +---@param goalZ number +---@param goalRadius number? +---@return nil +function Spring.SetUnitLandGoal(unitID, goalX, goalY, goalZ, goalRadius) end + +---@param unitID integer +---@return nil +function Spring.ClearUnitGoal(unitID) end + +---@param unitID integer +---@param posX number +---@param posY number +---@param posZ number +---@param velX number +---@param velY number +---@param velZ number +---@param rotX number +---@param rotY number +---@param rotZ number +---@param dragX number +---@param dragY number +---@param dragZ number +---@return nil +function Spring.SetUnitPhysics(unitID, posX, posY, posZ, velX, velY, velZ, rotX, rotY, rotZ, dragX, dragY, dragZ) end + +---@param unitID integer +---@param mass number +---@return nil +function Spring.SetUnitMass(unitID, mass) end + +---Set unit position (2D) +--- +---Sets a unit's position in 2D, at terrain height. +--- +---@param unitID integer +---@param x number +---@param z number +---@param floating boolean? (Default: false) If true, over water the position is on surface. If false, on seafloor. +---@return nil +function Spring.SetUnitPosition(unitID, x, z, floating) end + +---Set unit position (3D) +--- +---Sets a unit's position in 3D, at an arbitrary height. +--- +---@param unitID integer +---@param x number +---@param y number +---@param z number +---@return nil +function Spring.SetUnitPosition(unitID, x, y, z) end + +---@param unitID integer +---@param yaw number +---@param pitch number +---@param roll number +---@return nil +function Spring.SetUnitRotation(unitID, yaw, pitch, roll) end + +---@param unitID integer +---@param x number +---@param y number +---@param z number +---@return nil +function Spring.SetUnitDirection(unitID, x, y, z) end + +--- +---Use this call to set up unit direction in a robust way. Heading (-32768 to 32767) represents a 2D (xz plane) unit orientation if unit was completely upright, new {upx,upy,upz} direction will be used as new "up" vector, the rotation set by "heading" will remain preserved. +--- +---@param unitID integer +---@param heading number +---@param upx number +---@param upy number +---@param upz number +---@return nil +function Spring.SetUnitHeadingAndUpDir(unitID, heading, upx, upy, upz) end + +---@param unitID integer +---@param velX number +---@param velY number +---@param velZ number +---@return nil +function Spring.SetUnitVelocity(unitID, velX, velY, velZ) end + +---@param unitID integer +---@param buggerOff boolean? +---@param offset number? +---@param radius number? +---@param relHeading number? +---@param spherical boolean? +---@param forced boolean? +---@return nil|number buggerOff +function Spring.SetFactoryBuggerOff(unitID, buggerOff, offset, radius, relHeading, spherical, forced) end + +---@param x number +---@param y number +---@param z number? uses ground height when unspecified +---@param radius number +---@param teamID integer +---@param spherical boolean? (Default: true) +---@param forced boolean? (Default: true) +---@param excludeUnitID integer? +---@tparam +---@return nil +function Spring.BuggerOff(x, y, z, radius, teamID, spherical, forced, excludeUnitID) end + +---@param unitID integer +---@param damage number +---@param paralyze number? (Default: 0) equals to the paralyzetime in the WeaponDef. +---@param attackerID integer? (Default: -1) +---@param weaponID integer? (Default: -1) +---@param impulseX number? +---@param impulseY number? +---@param impulseZ number? +---@return nil +function Spring.AddUnitDamage(unitID, damage, paralyze, attackerID, weaponID, impulseX, impulseY, impulseZ) end + +---@param unitID integer +---@param x number +---@param y number +---@param z number +---@param decayRate number? +---@return nil +function Spring.AddUnitImpulse(unitID, x, y, z, decayRate) end + +---@param unitID integer +---@param pindSize number +---@return nil +function Spring.AddUnitSeismicPing(unitID, pindSize) end + +---@param unitID integer +---@param resource string "m" | "e" +---@param amount number +---@return nil +function Spring.AddUnitResource(unitID, resource, amount) end + +---@param unitID integer +---@param resource ResourceName +---@param amount number +---@return boolean? okay +function Spring.UseUnitResource(unitID, resource, amount) end + +---@param unitID integer +---@param resources ResourceUsage +---@return boolean? okay +function Spring.UseUnitResource(unitID, resources) end + +---Decals +--- +---@section decals + +---@param unitID integer +---@return nil +function Spring.AddObjectDecal(unitID) end + +---@param unitID integer +---@return nil +function Spring.RemoveObjectDecal(unitID) end + +---Grass +--- +---@section grass + +---@param x number +---@param z number +---@return nil +function Spring.AddGrass(x, z) end + +---@param x number +---@param z number +---@return nil +function Spring.RemoveGrass(x, z) end + +---Feature Handling +--- +---@section featurehandling + +---@param featureDef string|number name or id +---@param x number +---@param y number +---@param z number +---@param heading number? +---@param AllyTeamID integer? +---@param featureID integer? +---@return number featureID +function Spring.CreateFeature(featureDef, x, y, z, heading, AllyTeamID, featureID) end + +---@param featureDefID integer +---@return nil +function Spring.DestroyFeature(featureDefID) end + +---Feature Control +--- +---@param featureDefID integer +---@param teamID integer +---@return nil +function Spring.TransferFeature(featureDefID, teamID) end + +---@param featureID integer +---@param enable boolean +---@return nil +function Spring.SetFeatureAlwaysVisible(featureID, enable) end + +---@param featureID integer +---@param useAirLos boolean +---@return nil +function Spring.SetFeatureUseAirLos(featureID, useAirLos) end + +---@param featureID integer +---@param health number +---@return nil +function Spring.SetFeatureHealth(featureID, health) end + +---@param featureID integer +---@param maxHealth number minimum 0.1 +---@return nil +function Spring.SetFeatureMaxHealth(featureID, maxHealth) end + +---@param featureID integer +---@param reclaimLeft number +---@return nil +function Spring.SetFeatureReclaim(featureID, reclaimLeft) end + +---@param featureID integer +---@param metal number +---@param energy number +---@param reclaimTime number? +---@param reclaimLeft number? +---@param featureDefMetal number? +---@param featureDefEnergy number? +---@return nil +function Spring.SetFeatureResources(featureID, metal, energy, reclaimTime, reclaimLeft, featureDefMetal, featureDefEnergy) end + +--- +---Second param can now be a number id instead of a string name, this also allows cancelling ressurection by passing -1. +---The level of progress can now be set via the additional 4th param. +---Possible values for facing are: +---"south" | "s" | 0 +---"east" | "e" | 1 +---"north" | "n" | 2 +---"west" | "w" | 3 +--- +---@param featureID integer +---@param unitDef string|number id or name +---@tparam +---@param progress number? +---@return nil +function Spring.SetFeatureResurrect(featureID, unitDef, progress) end + +--- +---Use this callout to control feature movement. The arg* arguments are parsed as follows and all optional: +--- +---If enable is true: +---[, velVector(x,y,z) * initial velocity for feature +---[, accVector(x,y,z) * acceleration added every frame]] +--- +---If enable is false: +---[, velocityMask(x,y,z) * dimensions in which velocity is allowed to build when not using MoveCtrl +---[, impulseMask(x,y,z) * dimensions in which impulse is allowed to apply when not using MoveCtrl +---[, movementMask(x,y,z) * dimensions in which feature is allowed to move when not using MoveCtrl]]] +--- +---It is necessary to unlock feature movement on x,z axis before changing feature physics. +--- +---For example use `Spring.SetFeatureMoveCtrl(featureID,false,1,1,1,1,1,1,1,1,1)` to unlock all movement prior to making `Spring.SetFeatureVelocity` calls. +--- +---@param featureID integer +---@param enable boolean? +---@param arg1 number? +---@param arg2 number? +---@param argn number? +---@return nil +function Spring.SetFeatureMoveCtrl(featureID, enable, arg1, arg2, argn) end + +---@param featureID integer +---@param posX number +---@param posY number +---@param posZ number +---@param velX number +---@param velY number +---@param velZ number +---@param rotX number +---@param rotY number +---@param rotZ number +---@param dragX number +---@param dragY number +---@param dragZ number +---@return nil +function Spring.SetFeaturePhysics(featureID, posX, posY, posZ, velX, velY, velZ, rotX, rotY, rotZ, dragX, dragY, dragZ) end + +---@param featureID integer +---@param mass number +---@return nil +function Spring.SetFeatureMass(featureID, mass) end + +---@param featureID integer +---@param x number +---@param y number +---@param z number +---@param snapToGround boolean? +---@return nil +function Spring.SetFeaturePosition(featureID, x, y, z, snapToGround) end + +---@param featureID integer +---@param rotX number +---@param rotY number +---@param rotZ number +---@return nil +function Spring.SetFeatureRotation(featureID, rotX, rotY, rotZ) end + +---@param featureID integer +---@param dirX number +---@param dirY number +---@param dirZ number +---@return nil +function Spring.SetFeatureDirection(featureID, dirX, dirY, dirZ) end + +--- +---Use this call to set up feature direction in a robust way. Heading (-32768 to 32767) represents a 2D (xz plane) feature orientation if feature was completely upright, new {upx,upy,upz} direction will be used as new "up" vector, the rotation set by "heading" will remain preserved. +--- +---@param featureID integer +---@param heading number +---@param upx number +---@param upy number +---@param upz number +---@return nil +function Spring.SetFeatureHeadingAndUpDir(featureID, heading, upx, upy, upz) end + +---@param featureID integer +---@param velX number +---@param velY number +---@param velZ number +---@return nil +function Spring.SetFeatureVelocity(featureID, velX, velY, velZ) end + +---@param featureID integer +---@param isBlocking boolean +---@param isSolidObjectCollidable boolean +---@param isProjectileCollidable boolean +---@param isRaySegmentCollidable boolean +---@param crushable boolean +---@param blockEnemyPushing boolean +---@param blockHeightChanges boolean +---@return nil +function Spring.SetFeatureBlocking(featureID, isBlocking, isSolidObjectCollidable, isProjectileCollidable, isRaySegmentCollidable, crushable, blockEnemyPushing, blockHeightChanges) end + +---@param featureID integer +---@param noSelect boolean +---@return nil +function Spring.SetFeatureNoSelect(featureID, noSelect) end + +--- +---Check `Spring.SetUnitMidAndAimPos` for further explanation of the arguments. +--- +---@param featureID integer +---@param mpX number +---@param mpY number +---@param mpZ number +---@param apX number +---@param apY number +---@param apZ number +---@param relative boolean? +---@return boolean success +function Spring.SetFeatureMidAndAimPos(featureID, mpX, mpY, mpZ, apX, apY, apZ, relative) end + +---@param featureID integer +---@param radius number +---@param height number +---@return boolean success +function Spring.SetFeatureRadiusAndHeight(featureID, radius, height) end + +--- +---Check `Spring.SetUnitCollisionVolumeData` for further explanation of the arguments. +--- +---@param featureID integer +---@param scaleX number +---@param scaleY number +---@param scaleZ number +---@param offsetX number +---@param offsetY number +---@param offsetZ number +---@param vType number +---@param tType number +---@param Axis number +---@return nil +function Spring.SetFeatureCollisionVolumeData(featureID, scaleX, scaleY, scaleZ, offsetX, offsetY, offsetZ, vType, tType, Axis) end + +---@param featureID integer +---@param pieceIndex number +---@param enable boolean +---@param scaleX number +---@param scaleY number +---@param scaleZ number +---@param offsetX number +---@param offsetY number +---@param offsetZ number +---@param Axis number +---@param volumeType number +---@param primaryAxis number? +---@return nil +function Spring.SetFeaturePieceCollisionVolumeData(featureID, pieceIndex, enable, scaleX, scaleY, scaleZ, offsetX, offsetY, offsetZ, Axis, volumeType, primaryAxis) end + +---@param featureID integer +---@param pieceIndex number +---@param visible boolean +---@return nil +function Spring.SetFeaturePieceVisible(featureID, pieceIndex, visible) end + +---Projectiles +--- +---@section projectiles + +---@class ProjectileParams +---@field pos float3 +---@field speed float3 +---@field spread float3 +---@field error float3 +---@field owner integer +---@field team integer +---@field ttl number +---@field gravity number +---@field tracking number +---@field maxRange number +---@field startAlpha number +---@field endAlpha number +---@field model string +---@field cegTag string +local ProjectileParams = {} + +---@param projectileID integer +---@param alwaysVisible boolean +---@return nil +function Spring.SetProjectileAlwaysVisible(projectileID, alwaysVisible) end + +---@param projectileID integer +---@param useAirLos boolean +---@return nil +function Spring.SetProjectileUseAirLos(projectileID, useAirLos) end + +---Disables engine movecontrol, so lua can fully control the physics. +--- +---@param projectileID integer +---@param enable boolean +---@return nil +function Spring.SetProjectileMoveControl(projectileID, enable) end + +---@param projectileID integer +---@param posX number? (Default: 0) +---@param posY number? (Default: 0) +---@param posZ number? (Default: 0) +---@return nil +function Spring.SetProjectilePosition(projectileID, posX, posY, posZ) end + +---@param projectileID integer +---@param velX number? (Default: 0) +---@param velY number? (Default: 0) +---@param velZ number? (Default: 0) +---@return nil +function Spring.SetProjectileVelocity(projectileID, velX, velY, velZ) end + +---@param projectileID integer +---@return nil +function Spring.SetProjectileCollision(projectileID) end + +--- +---targetTypeStr can be one of: +---'u' - unit +---'f' - feature +---'p' - projectile +---while targetTypeInt is one of: +---string.byte('g') := GROUND +---string.byte('u') := UNIT +---string.byte('f') := FEATURE +---string.byte('p') := PROJECTILE +--- +---@param projectileID integer +---@param arg1 number? (Default: 0) targetID or posX +---@param arg2 number? (Default: 0) targetType or posY +---@param posZ number? (Default: 0) +---@return boolean? validTarget +function Spring.SetProjectileTarget(projectileID, arg1, arg2, posZ) end + +---@param projectileID integer +---@return nil +function Spring.SetProjectileIsIntercepted(projectileID) end + +---@param unitID integer +---@param weaponNum number +---@param key string +---@param value number +---@return nil +function Spring.SetProjectileDamages(unitID, weaponNum, key, value) end + +---@param projectileID integer +---@param ignore boolean +---@return nil +function Spring.SetProjectileIgnoreTrackingError(projectileID, ignore) end + +---@param projectileID integer +---@param grav number? (Default: 0) +---@return nil +function Spring.SetProjectileGravity(projectileID, grav) end + +---@param projectileID integer +---@param explosionFlags number? +---@param spinAngle number? +---@param spinSpeed number? +---@param spinVectorX number? +---@param spinVectorY number? +---@param spinVectorZ number? +---@return nil +function Spring.SetPieceProjectileParams(projectileID, explosionFlags, spinAngle, spinSpeed, spinVectorX, spinVectorY, spinVectorZ) end + +---@param projectileID integer +---@param ceg_name string +---@return nil +function Spring.SetProjectileCEG(projectileID, ceg_name) end + +---Give Order +--- +---@section giveorder +---Options can also be a bitmask; e.g. 0 instead of an empty table (can avoid performance hit on table creation) +---See `Constants.CMD` for relevant constants. + +---@param unitID integer +function Spring.UnitFinishCommand(unitID) end + +---@param unitID integer +---@param cmdID integer +---@param params number[] +---@param options CommandOptions +---@return boolean unitOrdered +function Spring.GiveOrderToUnit(unitID, cmdID, params, options) end + +---@param unitMap table table with unitIDs as keys +---@param cmdID integer +---@param params number[] +---@param options CommandOptions +---@return number unitsOrdered +function Spring.GiveOrderToUnitMap(unitMap, cmdID, params, options) end + +---@param unitIDs number[] +---@param cmdID integer +---@param params number[] +---@param options CommandOptions +---@return number unitsOrdered +function Spring.GiveOrderToUnitArray(unitIDs, cmdID, params, options) end + +---@param unitID integer +---@param cmdArray Command[] +---@return boolean ordersGiven +function Spring.GiveOrderArrayToUnit(unitID, cmdArray) end + +---@param unitMap {[number]: any} table with unitIDs as keys +---@param commands Command[] +---@return number unitsOrdered +function Spring.GiveOrderArrayToUnitMap(unitMap, commands) end + +---@param unitArray number[] containing unitIDs +---@param commands Command[] +---@return nil +function Spring.GiveOrderArrayToUnitArray(unitArray, commands) end + +---Heightmap +--- +---@section heightmap +---Note that x & z coords are in worldspace (Game.mapSizeX/Z), still the heightmap resolution is Game.squareSize. + +---Set a certain height to a point or rectangle area on the world +--- +---@param x1 number +---@param z1 number +---@param x2_height number if y2 and height are nil then this parameter is the height +---@param z2 number? +---@param height number? +---@return nil +function Spring.LevelHeightMap(x1, z1, x2_height, z2, height) end + +---Add a certain height to a point or rectangle area on the world +--- +---@param x1 number +---@param y1 number +---@param x2_height number if y2 and height are nil then this parameter is the height +---@param y2 number? +---@param height number? +---@return nil +function Spring.AdjustHeightMap(x1, y1, x2_height, y2, height) end + +---Restore original map height to a point or rectangle area on the world +--- +---@param x1 number +---@param y1 number +---@param x2_factor number if y2 and factor are nil then this parameter is the factor +---@param y2 number? +---@param factor number? +---@return nil +function Spring.RevertHeightMap(x1, y1, x2_factor, y2, factor) end + +---Can only be called in `Spring.SetHeightMapFunc` +--- +---@param x number +---@param z number +---@param height number +---@return integer? newHeight +function Spring.AddHeightMap(x, z, height) end + +--- +---Can only be called in `Spring.SetHeightMapFunc`. The terraform argument is +--- +---@param x number +---@param z number +---@param height number +---@param terraform number? (Default: 1) a scaling factor. +---@return integer? absHeightDiff =0 nothing will be changed (the terraform starts) and if =1 the terraform will be finished. +function Spring.SetHeightMap(x, z, height, terraform) end + +--- +---Example code: +--- +---```lua +---function Spring.SetHeightMapFunc(function() +---for z=0,Game.mapSizeZ, Game.squareSize do +---for x=0,Game.mapSizeX, Game.squareSize do +---Spring.SetHeightMap( x, z, 200 + 20 * math.cos((x + z) / 90) ) +---end +---end +---end) +---``` +--- +---@param luaFunction function +---@param arg number +---@param ... number +---@return integer? absTotalHeightMapAmountChanged +function Spring.SetHeightMapFunc(luaFunction, arg, ...) end + +---Height Map/Smooth Mesh +--- +---@section heightmap + +---Set a height to a point or rectangle area to the original map height cache +--- +---@param x1 number +---@param y1 number +---@param x2_height number if y2 and height are nil then this parameter is the height +---@param y2 number? +---@param height number? +---@return nil +function Spring.LevelOriginalHeightMap(x1, y1, x2_height, y2, height) end + +---Add height to a point or rectangle area to the original map height cache +--- +---@param x1 number +---@param y1 number +---@param x2_height number if y2 and height are nil then this parameter is the height +---@param y2 number? +---@param height number? +---@return nil +function Spring.AdjustOriginalHeightMap(x1, y1, x2_height, y2, height) end + +---Restore original map height cache to a point or rectangle area on the world +--- +---@param x1 number +---@param y1 number +---@param x2_factor number if y2 and factor are nil then this parameter is the factor +---@param y2 number? +---@param factor number? +---@return nil +function Spring.RevertOriginalHeightMap(x1, y1, x2_factor, y2, factor) end + +--- +---Can only be called in `Spring.SetOriginalHeightMapFunc` +--- +---@param x number +---@param y number +---@param height number +---@return nil +function Spring.AddOriginalHeightMap(x, y, height) end + +--- +---Can only be called in `Spring.SetOriginalHeightMapFunc` +--- +---@param x number +---@param y number +---@param height number +---@param factor number? +---@return nil +function Spring.SetOriginalHeightMap(x, y, height, factor) end + +--- +---Cannot recurse on itself +--- +---@param heightMapFunc function +---@return nil +function Spring.SetOriginalHeightMapFunc(heightMapFunc) end + +--- +---Heightmap changes normally take up to 25s to propagate to the smooth mesh. +---Use to force a mapwide update immediately. +--- +---@return nil +function Spring.RebuildSmoothMesh() end + +---@param x1 number +---@param z1 number +---@param x2 number? +---@param z2 number? +---@param height number +---@return nil +function Spring.LevelSmoothMesh(x1, z1, x2, z2, height) end + +---@param x1 number +---@param z1 number +---@param x2 number? +---@param z2 number? +---@param height number +---@return nil +function Spring.AdjustSmoothMesh(x1, z1, x2, z2, height) end + +---@param x1 number +---@param z1 number +---@param x2 number? +---@param z2 number? +---@param origFactor number +---@return nil +function Spring.RevertSmoothMesh(x1, z1, x2, z2, origFactor) end + +---Can only be called in `Spring.SetSmoothMeshFunc`. +--- +---@param x number +---@param z number +---@param height number +---@return number? The new height, or `nil` if coordinates are invalid. +function Spring.AddSmoothMesh(x, z, height) end + +---Can only be called in `Spring.SetSmoothMeshFunc`. +--- +---@param x number +---@param z number +---@param height number +---@param terraform number? (Default: 1) +---@return number? The absolute height difference, or `nil` if coordinates are invalid. +function Spring.SetSmoothMesh(x, z, height, terraform) end + +---@param luaFunction function +---@param arg any? +---@param ... any? +---@return number? absTotalHeightMapAmountChanged +function Spring.SetSmoothMeshFunc(luaFunction, arg, ...) end + +---TerrainTypes +--- +---@section terraintypes + +---@param x number +---@param z number +---@param newType number +---@return integer? oldType +function Spring.SetMapSquareTerrainType(x, z, newType) end + +---@param typeIndex number +---@param speedTanks number? (Default: nil) +---@param speedKBOts number? (Default: nil) +---@param speedHovers number? (Default: nil) +---@param speedShips number? (Default: nil) +---@return boolean? true +function Spring.SetTerrainTypeData(typeIndex, speedTanks, speedKBOts, speedHovers, speedShips) end + +---@param x number +---@param z number +---@param mask number +---@return nil +--- +---See also buildingMask unitdef tag. +function Spring.SetSquareBuildingMask(x, z, mask) end + +---@param unitID integer +---@param weaponID integer +---@return nil +function Spring.UnitWeaponFire(unitID, weaponID) end + +---@param unitID integer +---@param weaponID integer +---@return nil +function Spring.UnitWeaponHoldFire(unitID, weaponID) end + +---Prevent collision checks from working on outdated data +--- +---There's a rare edge case that requires units to be in specific positions +---and being shot by specific weapons but which can result in shots ghosting +---through the unit. This is because the unit's collision volume is stale. +---The `movement.unitQuadPositionUpdateRate` modrule controls this behaviour +---and can guarantee 100% correctness if set to 1, but the default value is 3 +---and large-scale games generally don't want to set it so low. This function +---lets you guarantee success for important weapons regardless of how high +---the normal update rate is set. +--- +---@param unitID integer +---@return nil +function Spring.ForceUnitCollisionUpdate(unitID) end + +---@param transporterID integer +---@param passengerID integer +---@param pieceNum number +---@return nil +function Spring.UnitAttach(transporterID, passengerID, pieceNum) end + +---@param passengerID integer +---@return nil +function Spring.UnitDetach(passengerID) end + +---@param passengerID integer +---@return nil +function Spring.UnitDetachFromAir(passengerID) end + +---Disables collisions between the two units to allow colvol intersection during the approach. +--- +---@param passengerID integer +---@param transportID integer +---@return nil +function Spring.SetUnitLoadingTransport(passengerID, transportID) end + +---@param weaponDefID integer +---@param projectileParams ProjectileParams +---@return integer? projectileID +function Spring.SpawnProjectile(weaponDefID, projectileParams) end + +---Silently removes projectiles (no explosion). +--- +---@param projectileID integer +---@return nil +function Spring.DeleteProjectile(projectileID) end + +---Parameters for explosion. +--- +---Please note the explosion defaults to 1 damage regardless of what it's defined in the weaponDef. +---The weapondefID is only used for visuals and for passing into callins like UnitDamaged. +--- +---@class ExplosionParams +---@field weaponDef number +---@field owner number +---@field hitUnit number +---@field hitFeature number +---@field craterAreaOfEffect number +---@field damageAreaOfEffect number +---@field edgeEffectiveness number +---@field explosionSpeed number +---@field gfxMod number +---@field impactOnly boolean +---@field ignoreOwner boolean +---@field damageGround boolean +local ExplosionParams = {} + +---@param posX number? (Default: 0) +---@param posY number? (Default: 0) +---@param posZ number? (Default: 0) +---@param dirX number? (Default: 0) +---@param dirY number? (Default: 0) +---@param dirZ number? (Default: 0) +---@param explosionParams ExplosionParams +---@return nil +function Spring.SpawnExplosion(posX, posY, posZ, dirX, dirY, dirZ, explosionParams) end + +---@param cegname string +---@param posX number? (Default: 0) +---@param posY number? (Default: 0) +---@param posZ number? (Default: 0) +---@param dirX number? (Default: 0) +---@param dirY number? (Default: 0) +---@param dirZ number? (Default: 0) +---@param radius number? (Default: 0) +---@param damage number? (Default: 0) +---@return boolean? success +---@return number cegID +function Spring.SpawnCEG(cegname, posX, posY, posZ, dirX, dirY, dirZ, radius, damage) end + +---Equal to the UnitScript versions of EmitSFX, but takes position and direction arguments (in either unit- or piece-space) instead of a piece index. +--- +---@param unitID integer? (Default: 0) +---@param sfxID integer? (Default: 0) +---@param posX number? (Default: 0) +---@param posY number? (Default: 0) +---@param posZ number? (Default: 0) +---@param dirX number? (Default: 0) +---@param dirY number? (Default: 0) +---@param dirZ number? (Default: 0) +---@param radius number? (Default: 0) +---@param damage number? (Default: 0) +---@param absolute boolean? +---@return boolean? success +function Spring.SpawnSFX(unitID, sfxID, posX, posY, posZ, dirX, dirY, dirZ, radius, damage, absolute) end + +---Other +--- +---@section other + +---@param noPause boolean +---@return nil +function Spring.SetNoPause(noPause) end + +---Defines how often `Callins.UnitExperience` will be called. +--- +---@param expGrade number +---@param ExpPowerScale number? +---@param ExpHealthScale number? +---@param ExpReloadScale number? +---@return nil +function Spring.SetExperienceGrade(expGrade, ExpPowerScale, ExpHealthScale, ExpReloadScale) end + +---@param allyTeamID integer +---@param allyteamErrorSize number +---@param baseErrorSize number? +---@param baseErrorMult number? +---@return nil +function Spring.SetRadarErrorParams(allyTeamID, allyteamErrorSize, baseErrorSize, baseErrorMult) end + +---Command Descriptions +--- +---@section commanddescriptions +---Doesn't work in unsynced code! + +---@param unitID integer +---@param cmdDescID integer +---@param cmdArray CommandDescription +function Spring.EditUnitCmdDesc(unitID, cmdDescID, cmdArray) end + +---@param unitID integer +---@param cmdDescID integer? +---@param cmdArray CommandDescription +function Spring.InsertUnitCmdDesc(unitID, cmdDescID, cmdArray) end + +---@param unitID integer +---@param cmdDescID integer? +function Spring.RemoveUnitCmdDesc(unitID, cmdDescID) end \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaSyncedMoveCtrl.lua b/rts/Lua/library/generated/LuaSyncedMoveCtrl.lua new file mode 100644 index 0000000000..3e26bc719d --- /dev/null +++ b/rts/Lua/library/generated/LuaSyncedMoveCtrl.lua @@ -0,0 +1,12 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaSyncedMoveCtrl.cpp +--- +---@meta + +---MoveCtrl +--- +---@see rts/Lua/LuaSyncedMoveCtrl.cpp \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaSyncedRead.lua b/rts/Lua/library/generated/LuaSyncedRead.lua new file mode 100644 index 0000000000..6fa0d525d8 --- /dev/null +++ b/rts/Lua/library/generated/LuaSyncedRead.lua @@ -0,0 +1,1742 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaSyncedRead.cpp +--- +---@meta + +---Synced Read +--- +---@see rts/Lua/LuaSyncedRead.cpp + +---Game States +--- +---@section gamestates + +---@return boolean enabled +function Spring.IsCheatingEnabled() end + +---@return boolean enabled +function Spring.IsGodModeEnabled() end + +---@return boolean enabled +function Spring.IsDevLuaEnabled() end + +---@return boolean enabled +function Spring.IsEditDefsEnabled() end + +---@return boolean enabled +function Spring.IsNoCostEnabled() end + +---@param teamID integer? +---@return boolean enabled +function Spring.GetGlobalLos(teamID) end + +---@return boolean enabled +function Spring.AreHelperAIsEnabled() end + +---@return boolean|nil enabled +function Spring.FixedAllies() end + +---@return boolean isGameOver +function Spring.IsGameOver() end + +---Speed/Time +--- +---@section speedtime + +---@return number t1 frameNum % dayFrames +---@return number t2 frameNum / dayFrames +function Spring.GetGameFrame() end + +---@return number seconds +function Spring.GetGameSeconds() end + +---Environment +--- +---@section environment + +---@return number tidalStrength +function Spring.GetTidal() end + +---@return number windStrength +function Spring.GetWind() end + +---Rules/Params +--- +---@section environment +--- +---The following functions allow to save data per game, team and unit. +---The advantage of it is that it can be read from anywhere (even from LuaUI and AIs!) + +---@class RulesParams : table +local RulesParams = {} + +---@return RulesParams rulesParams map with rules names as key and values as values +function Spring.GetGameRulesParams() end + +---@param teamID integer +---@return RulesParams rulesParams map with rules names as key and values as values +function Spring.GetTeamRulesParams(teamID) end + +---@param playerID integer +---@return RulesParams rulesParams map with rules names as key and values as values +function Spring.GetPlayerRulesParams(playerID) end + +---@param unitID integer +---@return RulesParams rulesParams map with rules names as key and values as values +function Spring.GetUnitRulesParams(unitID) end + +---@param featureID integer +---@return RulesParams rulesParams map with rules names as key and values as values +function Spring.GetFeatureRulesParams(featureID) end + +---@param ruleRef number|string the rule index or name +---@return number?|string value +function Spring.GetGameRulesParam(ruleRef) end + +---@param teamID integer +---@param ruleRef number|string the rule index or name +---@return nil|number|string value +function Spring.GetTeamRulesParam(teamID, ruleRef) end + +---@param playerID integer +---@param ruleRef number|string the rule index or name +---@return nil|number|string value +function Spring.GetPlayerRulesParam(playerID, ruleRef) end + +---@param unitID integer +---@param ruleRef number|string the rule index or name +---@return nil|number|string value +function Spring.GetUnitRulesParam(unitID, ruleRef) end + +---@param featureID integer +---@param ruleRef number|string the rule index or name +---@return nil|number|string value +function Spring.GetFeatureRulesParam(featureID, ruleRef) end + +---Mod and Map options +--- +---@section modmapoptions +--- +---*Warning*: boolean values are not transfered from C to Lua correctly. +---For this reason the respective option has to be converted to a number +---and checked accordingly via an IF statement as shown below: +--- +---if (tonumber(Spring.GetModOptions.exampleOption) == 1) then...end +--- +---The following check therefore is insufficient! +--- +---if (Spring.GetModOptions.exampleOption) then...end + +---@param mapOption string +---@return string value of mapOption +function Spring.GetMapOption(mapOption) end + +---@return [string] = string[] options map with options names as keys and values as values +function Spring.GetMapOptions() end + +---@param modOption string +---@return string value of modOption in option map +function Spring.GetModOption(modOption) end + +---@return [string] = string[] options map with options names as keys and values as values +function Spring.GetModOptions() end + +---Vectors +--- +---@section vectors + +---@param x number +---@param z number +---@return number heading +function Spring.GetHeadingFromVector(x, z) end + +---@param heading number +---@return number x +---@return number z +function Spring.GetVectorFromHeading(heading) end + +---@param heading number +---@return number facing +function Spring.GetFacingFromHeading(heading) end + +---@param facing number +---@return number heading +function Spring.GetHeadingFromFacing(facing) end + +---Sides and Factions +--- +---@section sidesfactions + +---Side spec +--- +---@class SideSpec +--- +---Used when returning arrays of side specifications, is itself an array with +---positional values as below: +---@field sideName string +---@field caseName string +---@field startUnit string +local SideSpec = {} + +---@param sideName string +---@return nil|string startUnit +---@return string caseSensitiveSideName +function Spring.GetSideData(sideName) end + +---@param sideID integer +---@return nil|string sideName +---@return string startUnit +---@return string caseSensitiveSideName +function Spring.GetSideData(sideID) end + +---@return SideSpec[] sideArray +function Spring.GetSideData() end + +---Teams +--- +---@section Teams + +---@return number teamID +function Spring.GetGaiaTeamID() end + +---@param allyID integer +---@return number? xMin +---@return number? zMin +---@return number? xMax +---@return number? zMax +function Spring.GetAllyTeamStartBox(allyID) end + +---@param teamID integer +---@return number? x +---@return number? y +---@return number? x +function Spring.GetTeamStartPosition(teamID) end + +---@return float3[] array of positions indexed by teamID +function Spring.GetMapStartPositions() end + +---@return number[] list of allyTeamIDs +function Spring.GetAllyTeamList() end + +---@param allyTeamID integer? (Default: -1) to filter teams belonging to when >= 0 +---@return number[]? list of teamIDs +function Spring.GetTeamList(allyTeamID) end + +---@param teamID integer? (Default: -1) to filter by when >= 0 +---@param active boolean? (Default: false) whether to filter only active teams +---@return number[]? list of playerIDs +function Spring.GetPlayerList(teamID, active) end + +---@param teamID integer +---@param getTeamKeys boolean? (Default: true) whether to return the customTeamKeys table +---@return number? teamID +---@return number leader +---@return number isDead +---@return number hasAI +---@return string side +---@return number allyTeam +---@return number incomeMultiplier +---@return table customTeamKeys when getTeamKeys is true, otherwise nil +function Spring.GetTeamInfo(teamID, getTeamKeys) end + +---@param teamID integer +---@return integer? allyTeamID +function Spring.GetTeamAllyTeamID(teamID) end + +---@param teamID integer +---@param resource ResourceName +---@return number? currentLevel +---@return number storage +---@return number pull +---@return number income +---@return number expense +---@return number share +---@return number sent +---@return number received +---@return number excess +function Spring.GetTeamResources(teamID, resource) end + +---@param teamID integer +---@return number? killed +---@return number died +---@return number capturedBy +---@return number capturedFrom +---@return number received +---@return number sent +function Spring.GetTeamUnitStats(teamID) end + +---@param teamID integer +---@param resource ResourceName +---@return number? used +---@return number produced +---@return number excessed +---@return number received +---@return number sent +function Spring.GetTeamResourceStats(teamID, resource) end + +---Gets team damage dealt/received totals +--- +---Returns a team's damage stats. Note that all damage is counted, +---including self-inflicted and unconfirmed out-of-sight. +--- +---@param teamID integer +---@return number damageDealt +---@return number damageReceived +function Spring.GetTeamDamageStats(teamID) end + +---@class TeamStats +---@field time number +---@field frame number +---@field metalUsed number +---@field metalProduced number +---@field metalExcess number +---@field metalReceived number +---@field metalSent number +---@field energyUsed number +---@field energyProduced number +---@field energyExcess number +---@field energyReceived number +---@field energySent number +---@field damageDealt number +---@field damageReceived number +---@field unitsProduced integer +---@field unitsDied integer +---@field unitsReceived integer +---@field unitsSent integer +---@field unitsCaptured integer +---@field unitsOutCaptured integer +local TeamStats = {} + +---Get the number of history entries. +--- +---@param teamID integer +---@return integer? historyCount The number of history entries, or `nil` if unable to resolve team. +function Spring.GetTeamStatsHistory(teamID) end + +---Get team stats history. +--- +---@param teamID integer +---@param startIndex integer +---@param endIndex integer? (Default: startIndex) +---@return TeamStats[] The team stats history, or `nil` if unable to resolve team. +function Spring.GetTeamStatsHistory(teamID, startIndex, endIndex) end + +---@param teamID integer +---@return string +function Spring.GetTeamLuaAI(teamID) end + +---Returns a team's unit cap. +--- +---Also returns the current unit count for readable teams as the 2nd value. +--- +---@param teamID integer +---@return number maxUnits +---@return number? currentUnits +function Spring.GetTeamMaxUnits(teamID) end + +---@param playerID integer +---@param getPlayerOpts boolean? (Default: true) whether to return custom player options +---@return string name +---@return boolean active +---@return boolean spectator +---@return number teamID +---@return number allyTeamID +---@return number pingTime +---@return number cpuUsage +---@return string country +---@return number rank +---@return boolean hasSkirmishAIsInTeam +---@return {[string]: string} playerOpts when playerOpts is true +---@return boolean desynced +function Spring.GetPlayerInfo(playerID, getPlayerOpts) end + +---Returns unit controlled by player on FPS mode +--- +---@param playerID integer +---@return number? +function Spring.GetPlayerControlledUnit(playerID) end + +---@param teamID integer +---@return number skirmishAIID +---@return string name +---@return number hostingPlayerID +---@return string shortName when synced "SYNCED_NOSHORTNAME", otherwise the AI shortname or "UNKNOWN" +---@return string version when synced "SYNCED_NOVERSION", otherwise the AI version or "UNKNOWN" +---@return table options +function Spring.GetAIInfo(teamID) end + +---@param allyTeamID integer +---@return nil|table +function Spring.GetAllyTeamInfo(allyTeamID) end + +---@param teamID1 number +---@param teamID2 number +---@return nil|boolean +function Spring.AreTeamsAllied(teamID1, teamID2) end + +---@param playerID1 number +---@param playerID2 number +---@return nil|boolean +function Spring.ArePlayersAllied(playerID1, playerID2) end + +---Unit queries +--- +---@section unit_queries + +---Get a list of all unitIDs +--- +---Note that when called from a widget, this also returns units that are only +---radar blips. +--- +---For units that are radar blips, you may want to check if they are in los, +---as GetUnitDefID() will still return true if they have previously been seen. +--- +---@see UnsyncedRead.GetVisibleUnits +---@return number[] unitIDs +function Spring.GetAllUnits() end + +---@param teamID integer +---@return number[]? unitIDs +function Spring.GetTeamUnits(teamID) end + +---@param teamID integer +---@return table unitsByDef A table where keys are unitDefIDs and values are unitIDs +function Spring.GetTeamUnitsSorted(teamID) end + +---@param teamID integer +---@return table? countByUnit A table where keys are unitDefIDs and values are counts. +function Spring.GetTeamUnitsCounts(teamID) end + +---@param teamID integer +---@param unitDefIDs number|number[] +---@return number[]? unitIDs +function Spring.GetTeamUnitsByDefs(teamID, unitDefIDs) end + +---@param teamID integer +---@param unitDefID integer +---@return number? count +function Spring.GetTeamUnitDefCount(teamID, unitDefID) end + +---@param teamID integer +---@return number? count +function Spring.GetTeamUnitCount(teamID) end + +---Spatial unit queries +--- +---@section spatial_unit_queries +--- +---For the allegiance parameters: AllUnits = -1, MyUnits = -2, AllyUnits = -3, EnemyUnits = -4 + +---@param xmin number +---@param zmin number +---@param xmax number +---@param zmax number +---@param allegiance number? +---@return number[] unitIDs +function Spring.GetUnitsInRectangle(xmin, zmin, xmax, zmax, allegiance) end + +---@param xmin number +---@param ymin number +---@param zmin number +---@param xmax number +---@param ymax number +---@param zmax number +---@param allegiance number? +---@return number[] unitIDs +function Spring.GetUnitsInBox(xmin, ymin, zmin, xmax, ymax, zmax, allegiance) end + +---@param x number +---@param z number +---@param radius number +---@return number[] unitIDs +function Spring.GetUnitsInCylinder(x, z, radius) end + +---@param x number +---@param y number +---@param z number +---@param radius number +---@return number[] unitIDs +function Spring.GetUnitsInSphere(x, y, z, radius) end + +---@class Plane +---@field normalVecX number +---@field normalVecY number +---@field normalVecZ number +---@field d number +local Plane = {} + +--- +---Plane normals point towards accepted space, so the acceptance criteria for each plane is: +--- +---``` +---radius = unit radius +---px, py, pz = unit position +---[(nx * px) + (ny * py) + (nz * pz) + (d - radius)] <= 0 +---``` +--- +---@param planes Plane[] +---@param allegiance integer? +---@return integer[] unitIDs +function Spring.GetUnitsInPlanes(planes, allegiance) end + +---Returns the centroid of an array of units +--- +---Returns nil for an empty array +--- +---@param units table { unitID, unitID, ... } +---@return number centerX +---@return number centerY +---@return number centerZ +function Spring.GetUnitArrayCentroid(units) end + +---Returns the centroid of a map of units +--- +---Returns nil for an empty map +--- +---@param units table { [unitID] = true, [unitID] = true, ... } +---@return number centerX +---@return number centerY +---@return number centerZ +function Spring.GetUnitMapCentroid(units) end + +---@param unitID integer +---@param range number? (Default: 1.0e9f) +---@return number? unitID +function Spring.GetUnitNearestAlly(unitID, range) end + +---@param unitID integer +---@param range number? (Default: 1.0e9f) +---@param useLOS boolean? (Default: true) +---@return number? unitID +function Spring.GetUnitNearestEnemy(unitID, range, useLOS) end + +---Spatial feature queries +--- +---@section spatial_feature_queries + +---@param xmin number +---@param zmin number +---@param xmax number +---@param zmax number +---@return number[] featureIDs +function Spring.GetFeaturesInRectangle(xmin, zmin, xmax, zmax) end + +---@param x number +---@param y number +---@param z number +---@param radius number +---@return number[] featureIDs +function Spring.GetFeaturesInSphere(x, y, z, radius) end + +---@param x number +---@param z number +---@param radius number +---@param allegiance number? +---@return number[] featureIDs +function Spring.GetFeaturesInCylinder(x, z, radius, allegiance) end + +---@param xmin number +---@param zmin number +---@param xmax number +---@param zmax number +---@param excludeWeaponProjectiles boolean? (Default: false) +---@param excludePieceProjectiles boolean? (Default: false) +---@return number[] projectileIDs +function Spring.GetProjectilesInRectangle(xmin, zmin, xmax, zmax, excludeWeaponProjectiles, excludePieceProjectiles) end + +---Unit state +--- +---@section unit_state + +---@param unitID integer +---@return boolean +function Spring.ValidUnitID(unitID) end + +---@class UnitState +---@field firestate number +---@field movestate number +---@field repeat boolean +---@field cloak boolean +---@field active boolean +---@field trajectory boolean +---@field autoland boolean? +---@field autorepairlevel number? +---@field loopbackattack boolean? +local UnitState = {} + +---@param unitID integer +---@return UnitState[] +function Spring.GetUnitStates(unitID) end + +---@param unitID integer +---@return nil|boolean armored +---@return number armorMultiple +function Spring.GetUnitArmored(unitID) end + +---@param unitID integer +---@return boolean? isActive +function Spring.GetUnitIsActive(unitID) end + +---@param unitID integer +---@return boolean? isCloaked +function Spring.GetUnitIsCloaked(unitID) end + +---@param unitID integer +---@return number? seismicSignature +function Spring.GetUnitSeismicSignature(unitID) end + +---@param unitID integer +---@return integer? selfDTime +function Spring.GetUnitSelfDTime(unitID) end + +---@param unitID integer +---@return integer? numStockpiled +---@return integer? numStockpileQued +---@return number? buildPercent +function Spring.GetUnitStockpile(unitID) end + +---@param unitID integer +---@param type string one of los, airLos, radar, sonar, seismic, radarJammer, sonarJammer +---@return number? radius +function Spring.GetUnitSensorRadius(unitID, type) end + +---@param unitID integer +---@param allyTeamID integer? +---@return number? posErrorVectorX +---@return number posErrorVectorY +---@return number posErrorVectorZ +---@return number posErrorDeltaX +---@return number posErrorDeltaY +---@return number posErrorDeltaZ +---@return number nextPosErrorUpdatebaseErrorMult +---@return boolean posErrorBit +function Spring.GetUnitPosErrorParams(unitID, allyTeamID) end + +---@param unitID integer +---@return nil|string +function Spring.GetUnitTooltip(unitID) end + +---@param unitID integer +---@return number? +function Spring.GetUnitDefID(unitID) end + +---@param unitID integer +---@return number? +function Spring.GetUnitTeam(unitID) end + +---@param unitID integer +---@return number? +function Spring.GetUnitAllyTeam(unitID) end + +---Checks if a unit is neutral (NOT Gaia!) +--- +---Note that a "neutral" unit can belong to any ally-team (ally, enemy, Gaia). +---To check if a unit is Gaia, check its owner team. +--- +---@param unitID integer +---@return nil|boolean +function Spring.GetUnitNeutral(unitID) end + +---@param unitID integer +---@return number? health +---@return number maxHealth +---@return number paralyzeDamage +---@return number captureProgress +---@return number buildProgress between 0.0-1.0 +function Spring.GetUnitHealth(unitID) end + +---@param unitID integer +---@return nil|boolean +function Spring.GetUnitIsDead(unitID) end + +---Checks whether a unit is disabled and can't act +--- +---The first return value is a simple OR of the following ones, +---any of those conditions is sufficient to disable the unit. +--- +---Note that EMP and being transported are mechanically the same and thus lumped together. +---Use other callouts to differentiate them if you need to. +--- +---@param unitID integer +---@return nil|boolean stunnedOrBuilt unit is disabled +---@return boolean stunned unit is either stunned via EMP or being transported by a non-fireplatform +---@return boolean beingBuilt unit is under construction +function Spring.GetUnitIsStunned(unitID) end + +---@param unitID integer +---@return boolean beingBuilt +---@return number buildProgress +function Spring.GetUnitIsBeingBuilt(unitID) end + +---@param unitID integer +---@return number? metalMake +---@return number metalUse +---@return number energyMake +---@return number energyUse +function Spring.GetUnitResources(unitID) end + +---@param unitID integer +---@return number? buildTime +---@return number metalCost +---@return number energyCost +function Spring.GetUnitCosts(unitID) end + +---@class ResourceCost +---@field metal number +---@field energy number +local ResourceCost = {} + +---@param unitID integer +---@return ResourceCost? cost The cost of the unit, or `nil` if invalid. +---@return number? buildTime The build time the unit, or `nil` if invalid. +function Spring.GetUnitCostTable(unitID) end + +---@param unitID integer +---@return number? metalExtraction +function Spring.GetUnitMetalExtraction(unitID) end + +---@param unitID integer +---@return number xp [0.0; +∞) +---@return number limXp [0.0; 1.0) as experience approaches infinity +function Spring.GetUnitExperience(unitID) end + +---@param unitID integer +---@return number? +function Spring.GetUnitHeight(unitID) end + +---@param unitID integer +---@return number? +function Spring.GetUnitRadius(unitID) end + +--- +---Gets the unit's radius for when targeted by build, repair, reclaim-type commands. +--- +---@param unitID integer +---@return number? +function Spring.GetUnitBuildeeRadius(unitID) end + +---@param unitID integer +---@return number? +function Spring.GetUnitMass(unitID) end + +---@param unitID integer +---@param midPos boolean? (Default: false) return midpoint as well +---@param aimPos boolean? (Default: false) return aimpoint as well +---@return number? basePointX +---@return number basePointY +---@return number basePointZ +---@return number? midPointX +---@return number midPointY +---@return number midPointZ +---@return number? aimPointX +---@return number aimPointY +---@return number aimPointZ +function Spring.GetUnitPosition(unitID, midPos, aimPos) end + +---@param unitID integer +---@return number? posX +---@return number posY +---@return number posZ +function Spring.GetUnitBasePosition(unitID) end + +---@param unitID integer +---@return float3? front +---@return float3 up +---@return float3 right +function Spring.GetUnitVectors(unitID) end + +---@param unitID integer +---@return number? pitch Rotation in X axis +---@return number? yaw Rotation in Y axis +---@return number? roll Rotation in Z axis +function Spring.GetUnitRotation(unitID) end + +---@param unitID integer +---@return number? dirX +---@return number? dirY +---@return number? dirZ +function Spring.GetUnitDirection(unitID) end + +---@param unitID integer +---@param convertToRadians boolean? (Default: false) +---@return number heading +function Spring.GetUnitHeading(unitID, convertToRadians) end + +---@param unitID integer +function Spring.GetUnitVelocity(unitID) end + +---@param unitID integer +function Spring.GetUnitBuildFacing(unitID) end + +---Checks whether a unit is currently building another (NOT for checking if it's a structure) +--- +---Works for both mobile builders and factories. +--- +---@param unitID integer +---@return number buildeeUnitID or nil +function Spring.GetUnitIsBuilding(unitID) end + +---Checks a builder's current task +--- +---Checks what a builder is currently doing. This is not the same as `Spring.GetUnitCurrentCommand`, +---because you can have a command at the front of the queue and not be doing it (for example because +---the target is still too far away), and on the other hand you can also be doing a task despite not +---having it in front of the queue (for example you're Guarding another builder who does). Also, it +---resolves the Repair command into either actual repair, or construction assist (in which case it +---returns the appropriate "build" command). Only build-related commands are returned (no Move or any +---custom commands). +--- +---The possible commands returned are repair, reclaim, resurrect, capture, restore, +---and build commands (negative buildee unitDefID). +--- +---@param unitID integer +---@return number cmdID of the relevant command +---@return number targetID if applicable (all except RESTORE) +function Spring.GetUnitWorkerTask(unitID) end + +--- +---Useful for setting move goals manually. +--- +---@param unitID integer +---@param buildeeDefID integer or nil +---@return number effectiveBuildRange counted to the center of prospective buildee; buildRange if buildee nil +function Spring.GetUnitEffectiveBuildRange(unitID, buildeeDefID) end + +---@param unitID integer +function Spring.GetUnitCurrentBuildPower(unitID) end + +---Get a unit's carried resources +--- +---Checks resources being carried internally by the unit. +--- +---@param unitID integer +---@return number storedMetal +---@return number maxStoredMetal +---@return number storedEnergy +---@return number maxStoredEnergy +function Spring.GetUnitHarvestStorage(unitID) end + +---@param unitID integer +function Spring.GetUnitBuildParams(unitID) end + +---Is builder in build stance +--- +---Checks if a builder is in build stance, i.e. can create nanoframes. +---Returns nil for non-builders. +--- +---@param unitID integer +---@return boolean inBuildStance +function Spring.GetUnitInBuildStance(unitID) end + +---Get construction FX attachment points +--- +---Returns an array of pieces which represent construction +---points. Default engine construction FX (nano spray) will +---originate there. +--- +---Only works on builders and factories, returns nil (NOT empty table) +---for other units. +--- +---@param unitID integer +---@return integer[] pieceArray +function Spring.GetUnitNanoPieces(unitID) end + +---Get the transport carrying the unit +--- +---Returns the unit ID of the transport, if any. +---Returns nil if the unit is not being transported. +--- +---@param unitID integer +---@return number|nil transportUnitID +function Spring.GetUnitTransporter(unitID) end + +---Get units being transported +--- +---@param unitID integer +---@return integer[]? transporteeArray +---An array of unitIDs being transported by this unit, or `nil` if not a transport. +function Spring.GetUnitIsTransporting(unitID) end + +---@param unitID integer +---@param weaponNum number? Optional if the unit has just one shield +---@return number isEnabled Warning, number not boolean. 0 or 1 +---@return number currentPower +function Spring.GetUnitShieldState(unitID, weaponNum) end + +---@param unitID integer +function Spring.GetUnitFlanking(unitID) end + +---Get a unit's engagement range +--- +---Returns the range at which a unit will stop to engage. +---By default this is the highest among the unit's weapon ranges (hence name), +---but can be changed dynamically. Also note that unarmed units ignore this. +--- +---@param unitID integer +---@return number maxRange +function Spring.GetUnitMaxRange(unitID) end + +---Unit weapon state +--- +---@section unit_weapon_state + +---Check the state of a unit's weapon +--- +---Available states to poll: +---"reloadFrame" (frame on which the weapon will be ready to fire), +---"reloadSpeed" (reload time in seconds), +---"range" (in elmos), +---"autoTargetRangeBoost" (predictive aiming range buffer, in elmos), +---"projectileSpeed" (in elmos/frame), +---"reloadTimeXP" (reload time after XP bonus, in seconds), +---"reaimTime" (frames between AimWeapon calls), +---"burst" (shots in a burst), +---"burstRate" (delay between shots in a burst, in seconds), +---"projectiles" (projectiles per shot), +---"salvoLeft" (shots remaining in ongoing burst), +---"nextSalvo" (simframe of the next shot in an ongoing burst), +---"accuracy" (INaccuracy after XP bonus), +---"sprayAngle" (spray angle after XP bonus), +---"targetMoveError" (extra inaccuracy against moving targets, after XP bonus) +---"avoidFlags" (bitmask for targeting avoidance), +---"collisionFlags" (bitmask for collisions). +--- +---The state "salvoError" is an exception and returns a table: {x, y, z}, +---which represents the inaccuracy error of the ongoing burst. +--- +---@param unitID integer +---@param weaponNum number +---@param stateName string +---@return number stateValue +function Spring.GetUnitWeaponState(unitID, weaponNum, stateName) end + +---@param unitID integer +function Spring.GetUnitWeaponDamages(unitID) end + +---@param unitID integer +function Spring.GetUnitWeaponVectors(unitID) end + +---@param unitID integer +function Spring.GetUnitWeaponTryTarget(unitID) end + +---@param unitID integer +function Spring.GetUnitWeaponTestTarget(unitID) end + +---@param unitID integer +function Spring.GetUnitWeaponTestRange(unitID) end + +---@param unitID integer +function Spring.GetUnitWeaponHaveFreeLineOfFire(unitID) end + +---@param unitID integer +function Spring.GetUnitWeaponCanFire(unitID) end + +---@alias TargetType +---| 0 # none +---| 1 # unit +---| 2 # position +---| 3 # projectile + +---Checks a weapon's target +--- +---Note that this doesn't need to reflect the unit's Attack orders or such, and +---that weapons can aim individually unless slaved. +--- +---@param unitID integer +---@param weaponNum integer +---@return 0 TargetType none +---@return boolean isUserTarget +function Spring.GetUnitWeaponTarget(unitID, weaponNum) end + +---Checks a weapon's target +--- +---Note that this doesn't need to reflect the unit's Attack orders or such, and +---that weapons can aim individually unless slaved. +--- +---@param unitID integer +---@param weaponNum integer +---@return 1 TargetType unit +---@return boolean isUserTarget +---@return integer targetUnitID +function Spring.GetUnitWeaponTarget(unitID, weaponNum) end + +---Checks a weapon's target +--- +---Note that this doesn't need to reflect the unit's Attack orders or such, and +---that weapons can aim individually unless slaved. +--- +---@param unitID integer +---@param weaponNum integer +---@return 2 TargetType position +---@return boolean isUserTarget +---@return float3 targetPosition +function Spring.GetUnitWeaponTarget(unitID, weaponNum) end + +---Checks a weapon's target +--- +---Note that this doesn't need to reflect the unit's Attack orders or such, and +---that weapons can aim individually unless slaved. +--- +---@param unitID integer +---@param weaponNum integer +---@return 3 TargetType projectileID +---@return boolean isUserTarget +---@return integer targetProjectileId +function Spring.GetUnitWeaponTarget(unitID, weaponNum) end + +---Misc +--- +---@section misc + +---@param unitID integer +function Spring.GetUnitEstimatedPath(unitID) end + +---@param unitID integer +function Spring.GetUnitLastAttacker(unitID) end + +---@param unitID integer +function Spring.GetUnitLastAttackedPiece(unitID) end + +---@param unitID integer +function Spring.GetUnitCollisionVolumeData(unitID) end + +---@param unitID1 number +---@param unitID2 number +---@param direction boolean? (Default: false) to subtract from, default unitID1 - unitID2 +---@param subtractRadii boolean? (Default: false) whether units radii should be subtracted from the total +---@return number? +function Spring.GetUnitSeparation(unitID1, unitID2, direction, subtractRadii) end + +---@param unitID integer +function Spring.GetUnitFeatureSeparation(unitID) end + +---@param unitDefID integer +function Spring.GetUnitDefDimensions(unitDefID) end + +function Spring.GetCEGID() end + +---@param unitID integer +---@return nil|boolean isBlocking +---@return boolean isSolidObjectCollidable +---@return boolean isProjectileCollidable +---@return boolean isRaySegmentCollidable +---@return boolean crushable +---@return boolean blockEnemyPushing +---@return boolean blockHeightChanges +function Spring.GetUnitBlocking(unitID) end + +---@param unitID integer +function Spring.GetUnitMoveTypeData(unitID) end + +---@number unitID Unit id. +---@number cmdIndex Command index to get. If negative will count from the end of the queue, +---for example -1 will be the last command. +function Spring.GetUnitCurrentCommand() end + +---Get the commands for a unit. +--- +---Same as `Spring.GetCommandQueue` +--- +---@param unitID integer +---@param count integer Number of commands to return, `-1` returns all commands, `0` returns command count. +---@return Command[] commands +function Spring.GetUnitCommands(unitID, count) end + +---Get the count of commands for a unit. +--- +---Same as `Spring.GetCommandQueue` +--- +---@param unitID integer +---@param count 0 Returns the number of commands in the units queue. +---@return integer The number of commands in the unit queue. +function Spring.GetUnitCommands(unitID, count) end + +---Get the number or list of commands for a factory +--- +---@param unitID integer +---@param count number when 0 returns the number of commands in the units queue, when -1 returns all commands, number of commands to return otherwise +---@return number|Command[] commands +function Spring.GetFactoryCommands(unitID, count) end + +---Get the number of commands in a units queue. +--- +---@number unitID + +---@param unitID integer +function Spring.GetFactoryBuggerOff(unitID) end + +---Gets the build queue of a factory +--- +---@param unitID integer +---@param count integer? (Default: -1) Number of commands to retrieve, `-1` for all. +---@param addCmds boolean? (Default: false) Retrieve commands other than buildunit +---@return table? counts Build queue count by `unitDefID` or `-cmdID`, or `nil` if unit is not found. +function Spring.GetFactoryCounts(unitID, count, addCmds) end + +---Get the commands for a unit. +--- +---Same as `Spring.GetUnitCommands` +--- +---@param unitID integer +---@param count integer Number of commands to return, `-1` returns all commands, `0` returns command count. +---@return Command[] commands +function Spring.GetCommandQueue(unitID, count) end + +---Get the count of commands for a unit. +--- +---Same as `Spring.GetUnitCommands` +--- +---@param unitID integer +---@param count 0 Returns the number of commands in the units queue. +---@return integer The number of commands in the unit queue. +function Spring.GetCommandQueue(unitID, count) end + +---Returns the build queue +--- +---@param unitID integer +---@return nil|table buildqueue indexed by unitDefID with count values +function Spring.GetFullBuildQueue(unitID) end + +---Returns the build queue cleaned of things the unit can't build itself +--- +---@param unitID integer +---@return nil|table buildqueue indexed by unitDefID with count values +function Spring.GetRealBuildQueue(unitID) end + +---@param unitID integer +function Spring.GetUnitCmdDescs(unitID) end + +---@param unitID integer +function Spring.FindUnitCmdDesc(unitID) end + +---@param featureID integer +---@return boolean +function Spring.ValidFeatureID(featureID) end + +function Spring.GetAllFeatures() end + +---@param featureID integer +---@return number? +function Spring.GetFeatureDefID(featureID) end + +---@param featureID integer +---@return number? +function Spring.GetFeatureTeam(featureID) end + +---@param featureID integer +---@return number? +function Spring.GetFeatureAllyTeam(featureID) end + +---@param featureID integer +---@return number? health +---@return number defHealth +---@return number resurrectProgress +function Spring.GetFeatureHealth(featureID) end + +---@param featureID integer +---@return number? +function Spring.GetFeatureHeight(featureID) end + +---@param featureID integer +---@return number? +function Spring.GetFeatureRadius(featureID) end + +---@param featureID integer +---@return number? +function Spring.GetFeatureMass(featureID) end + +---@param featureID integer +function Spring.GetFeaturePosition(featureID) end + +---@param featureID1 number +---@param featureID2 number +---@param direction boolean? (Default: false) to subtract from, default featureID1 - featureID2 +---@return number? +function Spring.GetFeatureSeparation(featureID1, featureID2, direction) end + +---@param featureID integer +---@return number? pitch Rotation in X axis +---@return number? yaw Rotation in Y axis +---@return number? roll Rotation in Z axis +function Spring.GetFeatureRotation(featureID) end + +---@param featureID integer +---@return number? dirX +---@return number? dirY +---@return number? dirZ +function Spring.GetFeatureDirection(featureID) end + +---@param featureID integer +function Spring.GetFeatureVelocity(featureID) end + +---@param featureID integer +function Spring.GetFeatureHeading(featureID) end + +---@param featureID integer +---@return number? metal +---@return number defMetal +---@return number energy +---@return number defEnergy +---@return number reclaimLeft +---@return number reclaimTime +function Spring.GetFeatureResources(featureID) end + +---@param featureID integer +---@return nil|boolean isBlocking +---@return boolean isSolidObjectCollidable +---@return boolean isProjectileCollidable +---@return boolean isRaySegmentCollidable +---@return boolean crushable +---@return boolean blockEnemyPushing +---@return boolean blockHeightChanges +function Spring.GetFeatureBlocking(featureID) end + +---@param featureID integer +---@return nil|boolean +function Spring.GetFeatureNoSelect(featureID) end + +---@param featureID integer +function Spring.GetFeatureResurrect(featureID) end + +---@param featureID integer +function Spring.GetFeatureLastAttackedPiece(featureID) end + +---@param featureID integer +function Spring.GetFeatureCollisionVolumeData(featureID) end + +---@param featureID integer +function Spring.GetFeaturePieceCollisionVolumeData(featureID) end + +---Projectile state +--- +---@section projectile_state + +---@param projectileID integer +---@return number? posX +---@return number posY +---@return number posZ +function Spring.GetProjectilePosition(projectileID) end + +---@param projectileID integer +---@return number? dirX +---@return number dirY +---@return number dirZ +function Spring.GetProjectileDirection(projectileID) end + +---@param projectileID integer +---@return number? velX +---@return number velY +---@return number velZ +---@return number velW +function Spring.GetProjectileVelocity(projectileID) end + +---@param projectileID integer +---@return number? +function Spring.GetProjectileGravity(projectileID) end + +---@param projectileID integer +---@return number? explosionFlags encoded bitwise with SHATTER = 1, EXPLODE = 2, EXPLODE_ON_HIT = 2, FALL = 4, SMOKE = 8, FIRE = 16, NONE = 32, NO_CEG_TRAIL = 64, NO_HEATCLOUD = 128 +---@return number spinAngle +---@return number spinSpeed +---@return number spinVectorX +---@return number spinVectorY +---@return number spinVectorZ +function Spring.GetPieceProjectileParams(projectileID) end + +---@param projectileID integer +---@return number? targetTypeInt where +---string.byte('g') := GROUND +---string.byte('u') := UNIT +---string.byte('f') := FEATURE +---string.byte('p') := PROJECTILE +---@return number|float3 target targetID or targetPos when targetTypeInt == string.byte('g') +function Spring.GetProjectileTarget(projectileID) end + +---@param projectileID integer +---@return nil|boolean +function Spring.GetProjectileIsIntercepted(projectileID) end + +---@param projectileID integer +---@return number? +function Spring.GetProjectileTimeToLive(projectileID) end + +---@param projectileID integer +---@return number? +function Spring.GetProjectileOwnerID(projectileID) end + +---@param projectileID integer +---@return number? +function Spring.GetProjectileTeamID(projectileID) end + +---@param projectileID integer +---@return number? +function Spring.GetProjectileAllyTeamID(projectileID) end + +---@param projectileID integer +---@return nil|boolean weapon +---@return boolean piece +function Spring.GetProjectileType(projectileID) end + +--- +---Using this to get a weaponDefID is HIGHLY preferred to indexing WeaponDefNames via GetProjectileName +--- +---@param projectileID integer +---@return number? +function Spring.GetProjectileDefID(projectileID) end + +---@param projectileID integer +---@param tag string one of: +---"paralyzeDamageTime" +---"impulseFactor" +---"impulseBoost" +---"craterMult" +---"craterBoost" +---"dynDamageExp" +---"dynDamageMin" +---"dynDamageRange" +---"dynDamageInverted" +---"craterAreaOfEffect" +---"damageAreaOfEffect" +---"edgeEffectiveness" +---"explosionSpeed" +---- or - +---an armor type index to get the damage against it. +---@return number? +function Spring.GetProjectileDamages(projectileID, tag) end + +---Ground +--- +---@section ground + +---@param x number +---@param z number +---@return boolean inPlayArea whether the position is in the active play area +---@return boolean inMap whether the position is in the full map area (currently this is the same as above) +function Spring.IsPosInMap(x, z) end + +---Get ground height +--- +---On sea, this returns the negative depth of the seafloor +--- +---@param x number +---@param z number +---@return number +function Spring.GetGroundHeight(x, z) end + +---Get water plane height +--- +---Water may at some point become shaped (rivers etc) but for now it is always a flat plane. +---Use this function instead of GetWaterLevel to denote you are relying on that assumption. +--- +---@see Spring.GetWaterLevel +---@return number waterPlaneLevel +function Spring.GetWaterPlaneLevel() end + +---Get water level in a specific position +--- +---Water is currently a flat plane, so this returns the same value regardless of XZ. +---However water may become more dynamic at some point so by using this you are future-proof. +--- +---@param x number +---@param z number +---@return number waterLevel +function Spring.GetWaterLevel(x, z) end + +---Get ground height as it was at game start +--- +---Returns the original height before the ground got deformed +--- +---@param x number +---@param z number +---@return number +function Spring.GetGroundOrigHeight(x, z) end + +---@param x number +---@param z number +---@param smoothed boolean? (Default: false) raw or smoothed center normal +---@return number normalX +---@return number normalY +---@return number normalZ +---@return number slope +function Spring.GetGroundNormal(x, z, smoothed) end + +---@param x number +---@param z number +---@return number ix +---@return number iz +---@return number terrainTypeIndex +---@return string name +---@return number metalExtraction +---@return number hardness +---@return number tankSpeed +---@return number kbotSpeed +---@return number hoverSpeed +---@return number shipSpeed +---@return boolean receiveTracks +function Spring.GetGroundInfo(x, z) end + +function Spring.GetGroundBlocked() end + +---@return number initMinHeight +---@return number initMaxHeight +---@return number currMinHeight +---@return number currMaxHeight +function Spring.GetGroundExtremes() end + +---@param terrainTypeInfo number +---@return number index +---@return string name +---@return number hardness +---@return number tankSpeed +---@return number kbotSpeed +---@return number hoverSpeed +---@return number shipSpeed +---@return boolean receiveTracks +function Spring.GetTerrainTypeData(terrainTypeInfo) end + +---@param x number +---@param z number +---@return number +function Spring.GetGrass(x, z) end + +---@param x number +---@param z number +---@return number height +function Spring.GetSmoothMeshHeight(x, z) end + +---Tests +--- +---@section tests + +---@param unitDefID integer +---@param pos float3 +---@param dir float3? (Default: `{ x: 0, y: 0, z: 0 }`) +---@param testTerrain boolean? (Default: true) +---@param testObjects boolean? (Default: true) +---@param centerOnly boolean? (Default: false) +---@return boolean +function Spring.TestMoveOrder(unitDefID, pos, dir, testTerrain, testObjects, centerOnly) end + +---@alias BuildOrderBlockedStatus +---| 0 # blocked +---| 1 # mobile unit on the way +---| 2 # reclaimable +---| 3 # open + +---@param unitDefID integer +---@param x number +---@param y number +---@param z number +---@param facing 0|"s"|1|"e"|2|"n"|3|"w" +---@return BuildOrderBlockedStatus blocking +---@return integer? featureID A reclaimable feature in the way. +function Spring.TestBuildOrder(unitDefID, x, y, z, facing) end + +---Snaps a position to the building grid +--- +---@param unitDefID integer +---@param posX number +---@param posY number +---@param posZ number +---@param buildFacing number? (Default: 0) one of SOUTH = 0, EAST = 1, NORTH = 2, WEST = 3 +---@return number buildPosX +---@return number buildPosY +---@return number buildPosZ +function Spring.Pos2BuildPos(unitDefID, posX, posY, posZ, buildFacing) end + +---@param teamID integer +---@param unitDefID integer +---@param posX number +---@param posY number +---@param posZ number +---@param searchRadius number +---@param minDistance number +---@param buildFacing number one of SOUTH = 0, EAST = 1, NORTH = 2, WEST = 3 +---@return number buildPosX +---@return number buildPosY +---@return number buildPosZ +function Spring.ClosestBuildPos(teamID, unitDefID, posX, posY, posZ, searchRadius, minDistance, buildFacing) end + +---Visibility +--- +---@section visibility + +---@param posX number +---@param posY number +---@param posZ number +---@param allyTeamID integer? +---@return boolean inLosOrRadar +---@return boolean inLos +---@return boolean inRadar +---@return boolean inJammer +function Spring.GetPositionLosState(posX, posY, posZ, allyTeamID) end + +---@param posX number +---@param posY number +---@param posZ number +---@param allyTeamID integer? +---@return boolean +function Spring.IsPosInLos(posX, posY, posZ, allyTeamID) end + +---@param posX number +---@param posY number +---@param posZ number +---@param allyTeamID integer? +---@return boolean +function Spring.IsPosInRadar(posX, posY, posZ, allyTeamID) end + +---@param posX number +---@param posY number +---@param posZ number +---@param allyTeamID integer? +---@return boolean +function Spring.IsPosInAirLos(posX, posY, posZ, allyTeamID) end + +---@param unitID integer +---@param allyTeamID integer? +---@param raw true Return a bitmask. +---@return integer? bitmask +---A bitmask integer, or `nil` if `unitID` is invalid. +--- +---Bitmask bits: +---- `1`: `LOS_INLOS` the unit is currently in the los of the allyteam, +---- `2`: `LOS_INRADAR` the unit is currently in radar from the allyteam, +---- `4`: `LOS_PREVLOS` the unit has previously been in los from the allyteam, +---- `8`: `LOS_CONTRADAR` the unit has continuously been in radar since it was last inlos by the allyteam +function Spring.GetUnitLosState(unitID, allyTeamID, raw) end + +---@param unitID integer +---@param allyTeamID integer? +---@param raw false? Return a bitmask. +---@return { los: boolean, radar: boolean, typed: boolean }? los +---A table of LOS state, or `nil` if `unitID` is invalid. +function Spring.GetUnitLosState(unitID, allyTeamID, raw) end + +---@param unitID integer +---@param allyTeamID integer +---@return boolean inLos +function Spring.IsUnitInLos(unitID, allyTeamID) end + +---@param unitID integer +---@param allyTeamID integer +---@return boolean inAirLos +function Spring.IsUnitInAirLos(unitID, allyTeamID) end + +---@param unitID integer +---@param allyTeamID integer +---@return boolean inRadar +function Spring.IsUnitInRadar(unitID, allyTeamID) end + +---@param unitID integer +---@param allyTeamID integer +---@return boolean inJammer +function Spring.IsUnitInJammer(unitID, allyTeamID) end + +---Piece/Script +--- +---@section piecescript + +---@class PieceInfo +---@field name string +---@field parent string +---@field children string[] names +---@field empty boolean +---@field min [number,number,number] (x,y,z) +---@field max [number,number,number] (x,y,z) +---@field offset [number,number,number] (x,y,z) +local PieceInfo = {} + +---@param modelName string +---@return number index of the root piece +function Spring.GetModelRootPiece(modelName) end + +---@param modelName string +---@return nil|table pieceInfos where keys are piece names and values are indices +function Spring.GetModelPieceMap(modelName) end + +---@param modelName string +---@return nil|string[] pieceNames +function Spring.GetModelPieceList(modelName) end + +---@param unitID integer +---@return number index of the root piece +function Spring.GetUnitRootPiece(unitID) end + +---@param unitID integer +---@return nil|table pieceInfos where keys are piece names and values are indices +function Spring.GetUnitPieceMap(unitID) end + +---@param unitID integer +---@return string[] pieceNames +function Spring.GetUnitPieceList(unitID) end + +---@param unitID integer +---@param pieceIndex integer +---@return PieceInfo? pieceInfo +function Spring.GetUnitPieceInfo(unitID, pieceIndex) end + +---@param unitID integer +---@param pieceIndex integer +---@return number|nil posX +---@return number posY +---@return number posZ +---@return number dirX +---@return number dirY +---@return number dirZ +function Spring.GetUnitPiecePosDir(unitID, pieceIndex) end + +---@param unitID integer +---@param pieceIndex integer +---@return number|nil posX +---@return number posY +---@return number posZ +function Spring.GetUnitPiecePosition(unitID, pieceIndex) end + +---@param unitID integer +---@param pieceIndex integer +---@return number|nil dirX +---@return number dirY +---@return number dirZ +function Spring.GetUnitPieceDirection(unitID, pieceIndex) end + +---@param unitID integer +---@return number|nil m11 +---@return number m12 +---@return number m13 +---@return number m14 +---@return number m21 +---@return number m22 +---@return number m23 +---@return number m24 +---@return number m31 +---@return number m32 +---@return number m33 +---@return number m34 +---@return number m41 +---@return number m42 +---@return number m43 +---@return number m44 +function Spring.GetUnitPieceMatrix(unitID) end + +---@param featureID integer +---@return number index of the root piece +function Spring.GetFeatureRootPiece(featureID) end + +---@param featureID integer +---@return table pieceInfos where keys are piece names and values are indices +function Spring.GetFeaturePieceMap(featureID) end + +---@param featureID integer +---@return string[] pieceNames +function Spring.GetFeaturePieceList(featureID) end + +---@param featureID integer +---@param pieceIndex integer +---@return PieceInfo? pieceInfo +function Spring.GetFeaturePieceInfo(featureID, pieceIndex) end + +---@param featureID integer +---@param pieceIndex integer +---@return number|nil posX +---@return number posY +---@return number posZ +---@return number dirX +---@return number dirY +---@return number dirZ +function Spring.GetFeaturePiecePosDir(featureID, pieceIndex) end + +---@param featureID integer +---@param pieceIndex integer +---@return number|nil posX +---@return number posY +---@return number posZ +function Spring.GetFeaturePiecePosition(featureID, pieceIndex) end + +---@param featureID integer +---@param pieceIndex integer +---@return number|nil dirX +---@return number dirY +---@return number dirZ +function Spring.GetFeaturePieceDirection(featureID, pieceIndex) end + +---@param featureID integer +---@return number|nil m11 +---@return number m12 +---@return number m13 +---@return number m14 +---@return number m21 +---@return number m22 +---@return number m23 +---@return number m24 +---@return number m31 +---@return number m32 +---@return number m33 +---@return number m34 +---@return number m41 +---@return number m42 +---@return number m43 +---@return number m44 +function Spring.GetFeaturePieceMatrix(featureID) end + +---@param unitID integer +---@return integer[] pieceIndices +function Spring.GetUnitScriptPiece(unitID) end + +---@param unitID integer +---@param scriptPiece integer +---@return integer pieceIndex +function Spring.GetUnitScriptPiece(unitID, scriptPiece) end + +---@param unitID integer +---@return table where keys are piece names and values are piece indices +function Spring.GetUnitScriptNames(unitID) end + +---Checks for a ground collision in given direction +--- +---Checks if there is surface (ground, optionally water) towards a vector +---and returns the distance to the closest hit and its position, if any. +--- +---@number posX +---@number posY +---@number posZ +---@number dirX +---@number dirY +---@number dirZ +---@bool +---@treturn number rayLength +---@treturn number posX +---@treturn number posY +---@treturn number posZ +function Spring.TraceRayGroundInDirection() end + +---Checks for a ground collision between two positions +--- +---Checks if there is surface (ground, optionally water) between two positions +---and returns the distance to the closest hit and its position, if any. +--- +---@number startX +---@number startY +---@number startZ +---@number endX +---@number endY +---@number endZ +---@bool +---@treturn number rayLength +---@treturn number posX +---@treturn number posY +---@treturn number posZ +function Spring.TraceRayGroundBetweenPositions() end + +---Misc +--- +---@section misc + +---@param allyTeamID integer +---@return number? radarErrorSize actual radar error size (when allyTeamID is allied to current team) or base radar error size +---@return number baseRadarErrorSize +---@return number baseRadarErrorMult +function Spring.GetRadarErrorParams(allyTeamID) end \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaSyncedTable.lua b/rts/Lua/library/generated/LuaSyncedTable.lua new file mode 100644 index 0000000000..d0e2d381c1 --- /dev/null +++ b/rts/Lua/library/generated/LuaSyncedTable.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaSyncedTable.cpp +--- +---@meta + diff --git a/rts/Lua/library/generated/LuaTableExtra.lua b/rts/Lua/library/generated/LuaTableExtra.lua new file mode 100644 index 0000000000..0a6d6ef19b --- /dev/null +++ b/rts/Lua/library/generated/LuaTableExtra.lua @@ -0,0 +1,22 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaTableExtra.cpp +--- +---@meta + +---Table extensions + +---Returns a table with preallocated memory +--- +---Returns an empty table with more memory allocated. +---This lets you microoptimize cases where a table receives +---a lot of elements and you know the number beforehand, +---such as one for each UnitDef, by avoiding reallocation. +--- +---@param nArray number hint for count of array elements +---@param nHashed number hint for count of hashtable elements +---@return table +function table.new(nArray, nHashed) end \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaTextures.lua b/rts/Lua/library/generated/LuaTextures.lua new file mode 100644 index 0000000000..5b9cd041c0 --- /dev/null +++ b/rts/Lua/library/generated/LuaTextures.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaTextures.cpp +--- +---@meta + diff --git a/rts/Lua/library/generated/LuaTracyExtra.lua b/rts/Lua/library/generated/LuaTracyExtra.lua new file mode 100644 index 0000000000..58c5ba3efe --- /dev/null +++ b/rts/Lua/library/generated/LuaTracyExtra.lua @@ -0,0 +1,28 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaTracyExtra.cpp +--- +---@meta + +---Tracy extensions +tracy = { + +} + +---Configure custom appearance for a Tracy plot for use in debugging or profiling +--- +---@param plotName string name of the plot to customize +---@param plotFormatType "Number"|"Percentage"|"Memory"|nil (Default: `"Number"`) +---@param stepwise boolean? (Default: `true`) stepwise chart +---@param fill boolean? (Default: `false`) whether to fill color +---@param color integer? (Default: `0xFFFFFF`) uint32 number as BGR color +function tracy.LuaTracyPlotConfig(plotName, plotFormatType, stepwise, fill, color) end + +---Update a Tracy plot with a value +--- +---@param plotName string Which LuaPlot should be updated +---@param plotValue number the number to show on the Tracy plot +function tracy.LuaTracyPlot(plotName, plotValue) end \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaUI.lua b/rts/Lua/library/generated/LuaUI.lua new file mode 100644 index 0000000000..909e09661c --- /dev/null +++ b/rts/Lua/library/generated/LuaUI.lua @@ -0,0 +1,10 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaUI.cpp +--- +---@meta + +function ConfigureLayout() end \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaUICommand.lua b/rts/Lua/library/generated/LuaUICommand.lua new file mode 100644 index 0000000000..062135c76c --- /dev/null +++ b/rts/Lua/library/generated/LuaUICommand.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaUICommand.cpp +--- +---@meta + diff --git a/rts/Lua/library/generated/LuaUnitDefs.lua b/rts/Lua/library/generated/LuaUnitDefs.lua new file mode 100644 index 0000000000..f883b7d119 --- /dev/null +++ b/rts/Lua/library/generated/LuaUnitDefs.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaUnitDefs.cpp +--- +---@meta + diff --git a/rts/Lua/library/generated/LuaUnsyncedCtrl.lua b/rts/Lua/library/generated/LuaUnsyncedCtrl.lua new file mode 100644 index 0000000000..7c0d3766c3 --- /dev/null +++ b/rts/Lua/library/generated/LuaUnsyncedCtrl.lua @@ -0,0 +1,1305 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaUnsyncedCtrl.cpp +--- +---@meta + +---Callouts to set state +--- +---@see rts/Lua/LuaUnsyncedCtrl.cpp + +---Ingame Console +--- +---@section console + +---Send a ping request to the server +--- +---@param pingTag number +---@return nil +function Spring.Ping(pingTag) end + +---Useful for debugging. +--- +---Prints values in the spring chat console. +---Hint: the default print() writes to STDOUT. +--- +---@param arg any +---@param ... any +---@return nil +function Spring.Echo(arg, ...) end + +---@alias LogLevel +---| integer +---| "debug" # LOG.DEBUG +---| "info" # LOG.INFO +---| "notice" # LOG.NOTICE (engine default) +---| "warning" # LOG.WARNING +---| "error" # LOG.ERROR +---| "fatal" # LOG.FATAL + +---@param section string +---@param logLevel LogLevel? (Default: "notice") +---@param ... string messages +---@return nil +function Spring.Log(section, logLevel, ...) end + +---@param commands string[] +function Spring.SendCommands(commands) end + +---@param command string +---@param ... string additional commands +---@return nil +function Spring.SendCommands(command, ...) end + +---Messages +--- +---@section messages + +---@param message string +---@return nil +function Spring.SendMessage(message) end + +---@param message string `` (with # being a playerid) inside the string will be replaced with the players name - i.e. : Spring.SendMessage ("`` did something") might display as "ProRusher did something" +---@return nil +function Spring.SendMessageToSpectators(message) end + +---@param playerID number +---@param message string +---@return nil +function Spring.SendMessageToPlayer(playerID, message) end + +---@param teamID number +---@param message string +---@return nil +function Spring.SendMessageToTeam(teamID, message) end + +---@param allyID number +---@param message string +---@return nil +function Spring.SendMessageToAllyTeam(allyID, message) end + +---Sounds +--- +---@section sounds + +---Loads a SoundDefs file, the format is the same as in `gamedata/sounds.lua`. +--- +---@param soundfile string +---@return boolean success +function Spring.LoadSoundDef(soundfile) end + +---@alias SoundChannel +---| "general" # 0 +---| "battle" # Same as `"sfx" | 1` +---| "sfx" # Same as `"battle" | 1` +---| "unitreply" # Same as `"voice" | 2` +---| "voice" # Same as `"unitreply" | 2` +---| "userinterface" # Same as "ui" | 3` +---| "ui" # Same as "userinterface" | 3` +---| 0 # General +---| 1 # SFX +---| 2 # Voice +---| 3 # User interface + +---@param soundfile string +---@param volume number? (Default: 1.0) +---@param posx number? +---@param posy number? +---@param posz number? +---@param speedx number? +---@param speedy number? +---@param speedz number? +---@param channel SoundChannel? (Default: `0|"general"`) +---@return boolean playSound +function Spring.PlaySoundFile(soundfile, volume, posx, posy, posz, speedx, speedy, speedz, channel) end + +---Allows to play an Ogg Vorbis (.OGG) and mp3 compressed sound file. +--- +---Multiple sound streams may be played at once. +--- +---@param oggfile string +---@param volume number? (Default: 1.0) +---@param enqueue boolean? +---@return boolean success +function Spring.PlaySoundStream(oggfile, volume, enqueue) end + +---Terminates any SoundStream currently running. +--- +---@return nil +function Spring.StopSoundStream() end + +---Pause any SoundStream currently running. +--- +---@return nil +function Spring.PauseSoundStream() end + +---Set volume for SoundStream +--- +---@param volume number +---@return nil +function Spring.SetSoundStreamVolume(volume) end + +function Spring.SetSoundEffectParams() end + +---@param cmdID number +---@param posX number +---@param posY number +---@param posZ number +---@return nil +function Spring.AddWorldIcon(cmdID, posX, posY, posZ) end + +---@param text string +---@param posX number +---@param posY number +---@param posZ number +---@return nil +function Spring.AddWorldText(text, posX, posY, posZ) end + +---@param unitDefID number +---@param posX number +---@param posY number +---@param posZ number +---@param teamID number +---@param facing number +---@return nil +function Spring.AddWorldUnit(unitDefID, posX, posY, posZ, teamID, facing) end + +---@param unitID number +---@return nil +function Spring.DrawUnitCommands(unitID) end + +---@param units table array of unit ids +---@param tableOrArray boolean? (Default: false] when true `units` is interpreted as a table in the format `{ [unitID) = arg1, ... }` +---@return nil +function Spring.DrawUnitCommands(units, tableOrArray) end + +---Camera +--- +---@section camera + +---Parameters for camera state +--- +---Highly dependent on the type of the current camera controller +--- +---@class camState +---@field name "ta"|"spring"|"rot"|"ov"|"free"|"fps"|"dummy" +---@field mode number the camera mode: 0 (fps), 1 (ta), 2 (spring), 3 (rot), 4 (free), 5 (ov), 6 (dummy) +---@field fov number +---@field px number Position X of the ground point in screen center +---@field py number Position Y of the ground point in screen center +---@field pz number Position Z of the ground point in screen center +---@field dx number Camera direction vector X +---@field dy number Camera direction vector Y +---@field dz number Camera direction vector Z +---@field rx number Camera rotation angle on X axis (spring) +---@field ry number Camera rotation angle on Y axis (spring) +---@field rz number Camera rotation angle on Z axis (spring) +---@field angle number Camera rotation angle on X axis (aka tilt/pitch) (ta) +---@field flipped number -1 for when south is down, 1 for when north is down (ta) +---@field dist number Camera distance from the ground (spring) +---@field height number Camera distance from the ground (ta) +---@field oldHeight number Camera distance from the ground, cannot be changed (rot) +local camState = {} + +---For Spring Engine XZ represents horizontal, from north west corner of map and Y vertical, from water level and rising. +--- +---@param x number +---@param y number +---@param z number +---@param transTime number? +---@return nil +function Spring.SetCameraTarget(x, y, z, transTime) end + +---@param posX number? (Default: 0) +---@param posY number? (Default: 0) +---@param posZ number? (Default: 0) +---@param tiltX number? (Default: 0) +---@param tiltY number? (Default: 0) +---@param tiltZ number? (Default: 0) +---@return nil +function Spring.SetCameraOffset(posX, posY, posZ, tiltX, tiltY, tiltZ) end + +---Sets camera state +--- +---The fields in `camState` must be consistent with the name/mode and current/new camera mode +--- +---@param camState camState +---@param transitionTime number? (Default: 0) in nanoseconds +---@param transitionTimeFactor number? +---multiplicative factor applied to this and all subsequent transition times for +---this camera mode. +--- +---Defaults to "CamTimeFactor" springsetting unless set previously. +---@param transitionTimeExponent number? +---tween factor applied to this and all subsequent transitions for this camera +---mode. +--- +---Defaults to "CamTimeExponent" springsetting unless set previously. +---@return boolean set +function Spring.SetCameraState(camState, transitionTime, transitionTimeFactor, transitionTimeExponent) end + +---Runs Dolly Camera +--- +---@param runtime number in milliseconds +---@return nil +function Spring.RunDollyCamera(runtime) end + +---Pause Dolly Camera +--- +---@param fraction number fraction of the total runtime to pause at, 0 to 1 inclusive. A null value pauses at current percent +---@return nil +function Spring.PauseDollyCamera(fraction) end + +---Resume Dolly Camera +--- +---@return nil +function Spring.ResumeDollyCamera() end + +---Sets Dolly Camera Position +--- +---@param x number +---@param y number +---@param z number +---@return nil +function Spring.SetDollyCameraPosition(x, y, z) end + +---Sets Dolly Camera movement Curve +--- +---@param degree number +---@param cpoints table NURBS control point positions {{x,y,z,weight}, ...} +---@param knots table +---@return nil +function Spring.SetDollyCameraCurve(degree, cpoints, knots) end + +---Sets Dolly Camera movement mode +--- +---@param mode number 1 static position, 2 nurbs curve +---@return nil +function Spring.SetDollyCameraMode(mode) end + +---Sets Dolly Camera movement curve to world relative or look target relative +--- +---@param relativeMode number 1 world, 2 look target +---@return nil +function Spring.SetDollyCameraRelativeMode(relativeMode) end + +---Sets Dolly Camera Look Curve +--- +---@param degree number +---@param cpoints table NURBS control point positions {{x,y,z,weight}, ...} +---@param knots table +---@return nil +function Spring.SetDollyCameraLookCurve(degree, cpoints, knots) end + +---Sets Dolly Camera Look Position +--- +---@param x number +---@param y number +---@param z number +---@return nil +function Spring.SetDollyCameraLookPosition(x, y, z) end + +---Sets target unit for Dolly Camera to look towards +--- +---@param unitID number the unit to look at +---@return nil +function Spring.SetDollyCameraLookUnit(unitID) end + +---Unit Selection +--- +---@section unit_selection + +---Selects a single unit +--- +---@param unitID number or nil +---@param append boolean? (Default: false) append to current selection +---@return nil +function Spring.SelectUnit(unitID, append) end + +---@param unitID number +---@return nil +function Spring.DeselectUnit(unitID) end + +---Deselects multiple units. +--- +---@param unitIDs table Table with unit IDs as value. +---@return nil +function Spring.DeselectUnitArray(unitIDs) end + +---Deselects multiple units. +--- +---@param unitMap table Table with unit IDs as keys. +---@return nil +function Spring.DeselectUnitMap(unitMap) end + +---Selects multiple units, or appends to selection. Accepts a table with unitIDs as values +--- +---@param unitMap table Table with unit IDs as values. +---@param append boolean? (Default: false) append to current selection +---@return nil +function Spring.SelectUnitArray(unitMap, append) end + +---Selects multiple units, or appends to selection. Accepts a table with unitIDs as keys +--- +---@param unitMap table Table with unit IDs as keys. +---@param append boolean? (Default: false) append to current selection +---@return nil +function Spring.SelectUnitMap(unitMap, append) end + +---Lighting +--- +---@section lighting + +---Parameters for lighting +--- +---@class LightParams +---@field position { px: number, py: number, pz: number } +---@field direction { dx: number, dy: number, dz: number } +---@field ambientColor { red: number, green: number, blue: number } +---@field diffuseColor { red: number, green: number, blue: number } +---@field specularColor { red: number, green: number, blue: number } +---@field intensityWeight { ambientWeight: number, diffuseWeight: number, specularWeight: number } +---@field ambientDecayRate { ambientRedDecay: number, ambientGreenDecay: number, ambientBlueDecay: number } +---Per-frame decay of `ambientColor` (spread over TTL frames) +---@field diffuseDecayRate { diffuseRedDecay: number, diffuseGreenDecay: number, diffuseBlueDecay: number } +---Per-frame decay of `diffuseColor` (spread over TTL frames) +---@field specularDecayRate { specularRedDecay: number, specularGreenDecay: number, specularBlueDecay: number } +---Per-frame decay of `specularColor` (spread over TTL frames) +---@field decayFunctionType { ambientDecayType: number, diffuseDecayType: number, specularDecayType: number } +---If value is `0.0` then the `*DecayRate` values will be interpreted as linear, otherwise exponential. +---@field radius number +---@field fov number +---@field ttl number +---@field priority number +---@field ignoreLOS boolean +local LightParams = {} + +--- +---requires MaxDynamicMapLights > 0 +--- +---@param lightParams LightParams +---@return integer lightHandle +function Spring.AddMapLight(lightParams) end + +--- +---requires MaxDynamicMapLights > 0 +--- +---@param lightParams LightParams +---@return number lightHandle +function Spring.AddModelLight(lightParams) end + +---@param lightHandle number +---@param lightParams LightParams +---@return boolean success +function Spring.UpdateMapLight(lightHandle, lightParams) end + +---@param lightHandle number +---@param lightParams LightParams +---@return boolean success +function Spring.UpdateModelLight(lightHandle, lightParams) end + +function Spring.AddLightTrackingTarget() end + +---Set a map-illuminating light to start/stop tracking the position of a moving object (unit or projectile) +--- +---@param lightHandle number +---@param unitOrProjectileID number +---@param enableTracking boolean +---@param unitOrProjectile boolean +---@return boolean success +function Spring.SetMapLightTrackingState(lightHandle, unitOrProjectileID, enableTracking, unitOrProjectile) end + +---Set a model-illuminating light to start/stop tracking the position of a moving object (unit or projectile) +--- +---@param lightHandle number +---@param unitOrProjectileID number +---@param enableTracking boolean +---@param unitOrProjectile boolean +---@return boolean success +function Spring.SetModelLightTrackingState(lightHandle, unitOrProjectileID, enableTracking, unitOrProjectile) end + +---Ingame Console +--- +---@section console + +--- +---The ID's must refer to valid programs returned by `gl.CreateShader`. +---Passing in a value of 0 will cause the respective shader to revert back to its engine default. +---Custom map shaders that declare a uniform ivec2 named "texSquare" can sample from the default diffuse texture(s), which are always bound to TU 0. +--- +---@param standardShaderID number +---@param deferredShaderID number +---@return nil +function Spring.SetMapShader(standardShaderID, deferredShaderID) end + +---@param texSqrX number +---@param texSqrY number +---@param luaTexName string +---@return boolean success +function Spring.SetMapSquareTexture(texSqrX, texSqrY, luaTexName) end + +---@param texType string +---@param texName string +---@return boolean success +---@usage Spring.SetMapShadingTexture("$ssmf_specular", "name_of_my_shiny_texture") +function Spring.SetMapShadingTexture(texType, texName) end + +---@param texName string +---@return nil +function Spring.SetSkyBoxTexture(texName) end + +---Unit custom rendering +--- +---@section unitcustomrendering + +---@param unitID number +---@param noDraw boolean +---@return nil +function Spring.SetUnitNoDraw(unitID, noDraw) end + +---@param unitID number +---@param drawMask number +---@return nil +function Spring.SetUnitEngineDrawMask(unitID, drawMask) end + +---@param unitID number +---@param alwaysUpdateMatrix boolean +---@return nil +function Spring.SetUnitAlwaysUpdateMatrix(unitID, alwaysUpdateMatrix) end + +---@param unitID number +---@param unitNoMinimap boolean +---@return nil +function Spring.SetUnitNoMinimap(unitID, unitNoMinimap) end + +---@param unitID number +---@param unitNoSelect boolean whether unit can be selected or not +---@return nil +function Spring.SetUnitNoSelect(unitID, unitNoSelect) end + +---@param unitID number +---@param unitLeaveTracks boolean whether unit leaves tracks on movement +---@return nil +function Spring.SetUnitLeaveTracks(unitID, unitLeaveTracks) end + +---@param unitID number +---@param featureID number +---@param scaleX number +---@param scaleY number +---@param scaleZ number +---@param offsetX number +---@param offsetY number +---@param offsetZ number +---@param vType number +---@param tType number +---@param Axis number +---@return nil +function Spring.SetUnitSelectionVolumeData(unitID, featureID, scaleX, scaleY, scaleZ, offsetX, offsetY, offsetZ, vType, tType, Axis) end + +---Features +--- +---@section features + +---@param featureID number +---@param noDraw boolean +---@return nil +function Spring.SetFeatureNoDraw(featureID, noDraw) end + +---@param featureID number +---@param engineDrawMask number +---@return nil +function Spring.SetFeatureEngineDrawMask(featureID, engineDrawMask) end + +---@param featureID number +---@param alwaysUpdateMat number +---@return nil +function Spring.SetFeatureAlwaysUpdateMatrix(featureID, alwaysUpdateMat) end + +---Control whether a feature will fade or not when zoomed out. +--- +---@param featureID number +---@param allow boolean +---@return nil +function Spring.SetFeatureFade(featureID, allow) end + +---@param featureID number +---@param scaleX number +---@param scaleY number +---@param scaleZ number +---@param offsetX number +---@param offsetY number +---@param offsetZ number +---@param vType number +---@param tType number +---@param Axis number +---@return nil +function Spring.SetFeatureSelectionVolumeData(featureID, scaleX, scaleY, scaleZ, offsetX, offsetY, offsetZ, vType, tType, Axis) end + +---Unit Icons +--- +---@section unit_icons + +---@param iconName string +---@param texFile string +---@param size number? +---@param dist number? +---@param radAdjust number? +---@return boolean added +function Spring.AddUnitIcon(iconName, texFile, size, dist, radAdjust) end + +---@param iconName string +---@return boolean? freed +function Spring.FreeUnitIcon(iconName) end + +--- +---Use Spring.SetUnitIconDraw instead. +--- +---@deprecated +---@param unitID number +---@param drawIcon boolean +---@return nil +function Spring.UnitIconSetDraw(unitID, drawIcon) end + +---@number unitID +---@bool drawIcon +---@treturn nil +function Spring.SetUnitIconDraw() end + +---@param unitDefID number +---@param iconName string +---@return nil +function Spring.SetUnitDefIcon(unitDefID, iconName) end + +---@param unitDefID number +---@param image string luaTexture|texFile +---@return nil +function Spring.SetUnitDefImage(unitDefID, image) end + +---Virtual File System +--- +---@section vfs +--- +---Prefer using `VFS` whenever possible + +---@param modfile string +---@return boolean extracted +function Spring.ExtractModArchiveFile(modfile) end + +---@param path string +---@return boolean? dirCreated +function Spring.CreateDir(path) end + +---GUI +--- +---@section gui + +---@param action string +---@param actionExtra string? +---@return boolean? commandSet +function Spring.SetActiveCommand(action, actionExtra) end + +---@param cmdIndex number +---@param button number? (Default: 1) +---@param leftClick boolean? +---@param rightClick boolean? +---@param alt boolean? +---@param ctrl boolean? +---@param meta boolean? +---@param shift boolean? +---@return boolean? commandSet +function Spring.SetActiveCommand(cmdIndex, button, leftClick, rightClick, alt, ctrl, meta, shift) end + +---@param config string +---@return nil +function Spring.LoadCmdColorsConfig(config) end + +---@param config string +---@return nil +function Spring.LoadCtrlPanelConfig(config) end + +---@return nil +function Spring.ForceLayoutUpdate() end + +---Disables the "Selected Units x" box in the GUI. +--- +---@param enable boolean +---@return nil +function Spring.SetDrawSelectionInfo(enable) end + +---@param state boolean +---@return nil +function Spring.SetBoxSelectionByEngine(state) end + +---@param teamID number +---@param r number +---@param g number +---@param b number +---@return nil +function Spring.SetTeamColor(teamID, r, g, b) end + +---Changes/creates the cursor of a single CursorCmd. +--- +---@param cmdName string +---@param iconFileName string not the full filename, instead it is like this: +---Wanted filename: Anims/cursorattack_0.bmp +---=> iconFileName: cursorattack +---@param overwrite boolean? (Default: true) +---@param hotSpotTopLeft boolean? (Default: false) +---@return boolean? assigned +function Spring.AssignMouseCursor(cmdName, iconFileName, overwrite, hotSpotTopLeft) end + +---Mass replace all occurrences of the cursor in all CursorCmds. +--- +---@param oldFileName string +---@param newFileName string +---@param hotSpotTopLeft boolean? (Default: false) +---@return boolean? assigned +function Spring.ReplaceMouseCursor(oldFileName, newFileName, hotSpotTopLeft) end + +---Register your custom cmd so it gets visible in the unit's cmd queue +--- +---@param cmdID number +---@tparam +---@return boolean? assigned +function Spring.SetCustomCommandDrawData(cmdID) end + +---Mouse +--- +---@section mouse + +---@param x number +---@param y number +---@return nil +function Spring.WarpMouse(x, y) end + +---@param cursorName string +---@param cursorScale number? (Default: 1.0) +---@return nil +function Spring.SetMouseCursor(cursorName, cursorScale) end + +---LOS Colors +--- +---@section loscolors + +---@param always table {r,g,b} +---@param LOS table = {r,g,b} +---@param radar table = {r,g,b} +---@param jam table = {r,g,b} +---@param radar2 table = {r,g,b} +---@return nil +function Spring.SetLosViewColors(always, LOS, radar, jam, radar2) end + +---@param rotVal number? (Default: 0) in degrees +---@param rotVel number? (Default: 0) in degrees +---@param rotAcc number? (Default: 0) in degrees +---@param rotValRng number? (Default: 0) in degrees +---@param rotVelRng number? (Default: 0) in degrees +---@param rotAccRng number? (Default: 0) in degrees +---@return nil +function Spring.SetNanoProjectileParams(rotVal, rotVel, rotAcc, rotValRng, rotVelRng, rotAccRng) end + +---Engine Config +--- +---@section engineconfig +--- +---The following functions read the engine configs saved in `Springsettings.cfg`, a version-ed instance of these or a custom file supplied on the command line. + +---@param name string +---@param value number +---@param useOverlay boolean? (Default: false) the value will only be set in memory, and not be restored for the next game. +---@return nil +function Spring.SetConfigInt(name, value, useOverlay) end + +---@param name string +---@param value number +---@param useOverla boolean? (Default: false) the value will only be set in memory, and not be restored for the next game.y +---@return nil +function Spring.SetConfigFloat(name, value, useOverla) end + +---@param name string +---@param value number +---@param useOverlay boolean? (Default: false) the value will only be set in memory, and not be restored for the next game. +---@return nil +function Spring.SetConfigString(name, value, useOverlay) end + +---Closes the application +--- +---@return nil +function Spring.Quit() end + +---Unit Group +--- +---@section unitgroup + +---@param unitID number +---@param groupID number the group number to be assigned, or -1 for deassignment +---@return nil +function Spring.SetUnitGroup(unitID, groupID) end + +---Give Order +--- +---@section giveorder + +---Command Options params +--- +---@class cmdOpts +--- +---Can be specified as a table, or as an array containing any of the keys +---below. +---@field right boolean Right mouse key pressed +---@field alt boolean Alt key pressed +---@field ctrl boolean Ctrl key pressed +---@field shift boolean Shift key pressed +---@field meta boolean Meta (windows/mac/mod4) key pressed +local cmdOpts = {} + +---@param cmdID number +---@param params table +---@param options cmdOpts +---@return nil|true +function Spring.GiveOrder(cmdID, params, options) end + +---@param unitID number +---@param cmdID number +---@param params table +---@param options cmdOpts +---@return nil|true +function Spring.GiveOrderToUnit(unitID, cmdID, params, options) end + +---@param unitMap table { [unitID] = arg1, ... } +---@param cmdID number +---@param params table +---@param options cmdOpts +---@return nil|true +function Spring.GiveOrderToUnitMap(unitMap, cmdID, params, options) end + +---@param unitArray number[] array of unit ids +---@param cmdID number +---@param params table +---@param options cmdOpts +---@return nil|true +function Spring.GiveOrderToUnitArray(unitArray, cmdID, params, options) end + +---@param unitID number +---@param cmdArray Command[] +---@return boolean ordersGiven +function Spring.GiveOrderArrayToUnit(unitID, cmdArray) end + +---@param unitMap table { [unitID] = arg1, ... } +---@param cmdArray Command[] +---@return boolean ordersGiven +function Spring.GiveOrderArrayToUnitMap(unitMap, cmdArray) end + +---@param unitArray number[] array of unit ids +---@param cmdArray Command[] +---@tparam When true, assign commands according to index between units and cmds arrays. +--- +---If len(unitArray) < len(cmdArray) only the first len(unitArray) commands +---will be assigned, and vice-versa. +---@return nil|boolean +function Spring.GiveOrderArrayToUnitArray(unitArray, cmdArray) end + +---@param spacing number +---@return nil +function Spring.SetBuildSpacing(spacing) end + +---@param facing number +---@return nil +function Spring.SetBuildFacing(facing) end + +---UI +--- +---@section ui +---Very important! (allows synced inter-lua-enviroment communications) + +---@param message string +---@param mode string "s"/"specs" | "a"/"allies" +---@return nil +function Spring.SendLuaUIMsg(message, mode) end + +---@param message string +---@return nil +function Spring.SendLuaGaiaMsg(message) end + +---@param message string +---@return nil +function Spring.SendLuaRulesMsg(message) end + +---@param msg string +function Spring.SendLuaMenuMsg(msg) end + +---Sharing +--- +---@section sharing + +---@param resource string metal | energy +---@param shareLevel number +---@return nil +function Spring.SetShareLevel(resource, shareLevel) end + +---@param teamID number +---@param units string +---@return nil +function Spring.ShareResources(teamID, units) end + +---@param teamID number +---@param resource string metal | energy +---@param amount number +---@return nil +function Spring.ShareResources(teamID, resource, amount) end + +---UI +--- +---@section ui + +---@param x number +---@param y number +---@param z number +---@return nil +function Spring.SetLastMessagePosition(x, y, z) end + +---Markers +--- +---@section markers + +---@param x number +---@param y number +---@param z number +---@param text string? (Default: "") +---@param localOnly boolean? +---@return nil +function Spring.MarkerAddPoint(x, y, z, text, localOnly) end + +---@param x1 number +---@param y1 number +---@param z1 number +---@param x2 number +---@param y2 number +---@param z2 number +---@param localOnly boolean? (Default: false) +---@param playerId number? +---@return nil +function Spring.MarkerAddLine(x1, y1, z1, x2, y2, z2, localOnly, playerId) end + +--- +---Issue an erase command for markers on the map. +--- +---@param x number +---@param y number +---@param z number +---@param unused nil This argument is ignored. +---@param localOnly boolean? (Default: false) do not issue a network message, erase only for the current player +---@param playerId number? when not specified it uses the issuer playerId +---@param alwaysErase boolean? (Default: false) erase any marker when `localOnly` and current player is spectating. Allows spectators to erase players markers locally +---@return nil +function Spring.MarkerErasePosition(x, y, z, unused, localOnly, playerId, alwaysErase) end + +---Sun +--- +---@section sun + +---@class AtmosphereParams +---@field fogStart number +---@field fogEnd number +---@field sunColor rgba +---@field skyColor rgba +---@field cloudColor rgba +local AtmosphereParams = {} + +---It can be used to modify the following atmosphere parameters +--- +---Usage: +---```lua +---Spring.SetAtmosphere({ fogStart = 0, fogEnd = 0.5, fogColor = { 0.7, 0.2, 0.2, 1 }}) +---``` +--- +---@param params AtmosphereParams +function Spring.SetAtmosphere(params) end + +---@param dirX number +---@param dirY number +---@param dirZ number +---@param intensity number? (Default: `1.0`) +---@return nil +function Spring.SetSunDirection(dirX, dirY, dirZ, intensity) end + +---Modify sun lighting parameters. +--- +---```lua +---Spring.SetSunLighting({groundAmbientColor = {1, 0.1, 1}, groundDiffuseColor = {1, 0.1, 1} }) +---``` +--- +---@param params { groundAmbientColor: rgb, groundDiffuseColor: rgb } +function Spring.SetSunLighting(params) end + +---Map rendering params +--- +---@class MapRenderingParams +---@field splatTexMults rgba +---@field splatTexScales rgba +---@field voidWater boolean +---@field voidGround boolean +---@field splatDetailNormalDiffuseAlpha boolean +local MapRenderingParams = {} + +---Allows to change map rendering params at runtime. +--- +---@param params MapRenderingParams +---@return nil +function Spring.SetMapRenderingParams(params) end + +---@param normal boolean? (Default: true) +---@param shadow boolean? (Default: false) +---@return boolean updated +function Spring.ForceTesselationUpdate(normal, shadow) end + +---AI +--- +---@section ai + +---@param aiTeam number +---@param message string +---@return boolean? ai_processed +function Spring.SendSkirmishAIMessage(aiTeam, message) end + +---Developers +--- +---@section developers + +---@param sectionName string +---@param logLevel ?string|number +---@return nil +function Spring.SetLogSectionFilterLevel(sectionName, logLevel) end + +---@int +---@int +---@int +---@int +---@param minLoopRunTime number? +---@param maxLoopRunTime number? +---@param baseRunTimeMult number? +---@param baseMemLoadMult number? +---@return nil +function Spring.GarbageCollectCtrl(minLoopRunTime, maxLoopRunTime, baseRunTimeMult, baseMemLoadMult) end + +---@param drawSky boolean +---@return nil +function Spring.SetDrawSky(drawSky) end + +---@param drawWater boolean +---@return nil +function Spring.SetDrawWater(drawWater) end + +---@param drawGround boolean +---@return nil +function Spring.SetDrawGround(drawGround) end + +---@param drawGroundDeferred boolean +---@param drawGroundForward boolean? allows disabling of the forward pass +---treturn nil +function Spring.SetDrawGroundDeferred(drawGroundDeferred, drawGroundForward) end + +---@param drawUnitsDeferred boolean +---@param drawFeaturesDeferred boolean +---@param drawUnitsForward boolean? allows disabling of the respective forward passes +---@param drawFeaturesForward boolean? allows disabling of the respective forward passes +---@return nil +function Spring.SetDrawModelsDeferred(drawUnitsDeferred, drawFeaturesDeferred, drawUnitsForward, drawFeaturesForward) end + +---This doesn't actually record the game in any way, it just regulates the framerate and interpolations. +--- +---@param allowCaptureMode boolean +---@return nil +function Spring.SetVideoCapturingMode(allowCaptureMode) end + +---@param timeOffset boolean +---@return nil +function Spring.SetVideoCapturingTimeOffset(timeOffset) end + +---Water params +--- +---@class WaterParams +---@field absorb rgb +---@field baseColor rgb +---@field minColor rgb +---@field surfaceColor rgb +---@field diffuseColor rgb +---@field specularColor rgb +---@field planeColor rgb +---@field texture string file +---@field foamTexture string file +---@field normalTexture string file +---@field damage number +---@field repeatX number +---@field repeatY number +---@field surfaceAlpha number +---@field ambientFactor number +---@field diffuseFactor number +---@field specularFactor number +---@field specularPower number +---@field fresnelMin number +---@field fresnelMax number +---@field fresnelPower number +---@field reflectionDistortion number +---@field blurBase number +---@field blurExponent number +---@field perlinStartFreq number +---@field perlinLacunarity number +---@field perlinAmplitude number +---@field windSpeed number +---@field waveOffsetFactor number +---@field waveLength number +---@field waveFoamDistortion number +---@field waveFoamIntensity number +---@field causticsResolution number +---@field causticsStrength number +---@field numTiles integer +---@field shoreWaves boolean +---@field forceRendering boolean +---@field hasWaterPlane boolean +local WaterParams = {} + +---Does not need cheating enabled. +--- +---Allows to change water params (mostly `BumpWater` ones) at runtime. You may +---want to set `BumpWaterUseUniforms` in your `springrc` to 1, then you don't even +---need to restart `BumpWater` via `/water 4`. +--- +---@param waterParams WaterParams +---@return nil +function Spring.SetWaterParams(waterParams) end + +---Preload +--- +---@section preload + +--- +---Allow the engine to load the unit's model (and texture) in a background thread. +---Wreckages and buildOptions of a unit are automatically preloaded. +--- +---@param unitDefID number +---@return nil +function Spring.PreloadUnitDefModel(unitDefID) end + +---@param featureDefID number +---@return nil +function Spring.PreloadFeatureDefModel(featureDefID) end + +---@param name string +---@return nil +function Spring.PreloadSoundItem(name) end + +---@param modelName string +---@return boolean? success +function Spring.LoadModelTextures(modelName) end + +---Decals +--- +---@section decals + +---@return nil|number decalID +function Spring.CreateGroundDecal() end + +---@param decalID number +---@return boolean delSuccess +function Spring.DestroyGroundDecal(decalID) end + +---@param decalID number +---@param midPosX number? (Default: currMidPosX) +---@param midPosZ number? (Default: currMidPosZ) +---@param sizeX number? (Default: currSizeX) +---@param sizeZ number? (Default: currSizeZ) +---@param projCubeHeight number? (Default: calculateProjCubeHeight) +---@return boolean decalSet +function Spring.SetGroundDecalPosAndDims(decalID, midPosX, midPosZ, sizeX, sizeZ, projCubeHeight) end + +---@class xz +---@field x number +---@field y number +local xz = {} + +--- +---Use for non-rectangular decals +--- +---@param decalID integer +---@param posTL xz? (Default: currPosTL) +---@param posTR xz? (Default: currPosTR) +---@param posBR xz? (Default: currPosBR) +---@param posBL xz? (Default: currPosBL) +---@param projCubeHeight number? (Default: calculateProjCubeHeight) +---@return boolean decalSet +function Spring.SetGroundDecalQuadPosAndHeight(decalID, posTL, posTR, posBR, posBL, projCubeHeight) end + +---@param decalID number +---@param rot number? (Default: random) in radians +---@return boolean decalSet +function Spring.SetGroundDecalRotation(decalID, rot) end + +---@param decalID number +---@param textureName string The texture has to be on the atlas which seems to mean it's defined as an explosion, unit tracks, or building plate decal on some unit already (no arbitrary textures) +---@param isMainTex boolean? (Default: true) If false, it sets the normals/glow map +---@return nil|boolean decalSet +function Spring.SetGroundDecalTexture(decalID, textureName, isMainTex) end + +---@param decalID number +---@param texWrapDistance number? (Default: currTexWrapDistance) if non-zero sets the mode to repeat the texture along the left-right direction of the decal every texWrapFactor elmos +---@param texTraveledDistance number? (Default: currTexTraveledDistance) shifts the texture repetition defined by texWrapFactor so the texture of a next line in the continuous multiline can start where the previous finished. For that it should collect all elmo lengths of the previously set multiline segments. +---@return nil|boolean decalSet +function Spring.SetGroundDecalTextureParams(decalID, texWrapDistance, texTraveledDistance) end + +---@param decalID number +---@param alpha number? (Default: currAlpha) Between 0 and 1 +---@param alphaFalloff number? (Default: currAlphaFalloff) Between 0 and 1, per second +---@return boolean decalSet +function Spring.SetGroundDecalAlpha(decalID, alpha, alphaFalloff) end + +--- +---Sets projection cube normal to orient in 3D space. +---In case the normal (0,0,0) then normal is picked from the terrain +--- +---@param decalID number +---@param normalX number? (Default: 0) +---@param normalY number? (Default: 0) +---@param normalZ number? (Default: 0) +---@return boolean decalSet +function Spring.SetGroundDecalNormal(decalID, normalX, normalY, normalZ) end + +--- +---Sets the tint of the ground decal. Color = 2 * textureColor * tintColor +---Respectively a color of (0.5, 0.5, 0.5, 0.5) is effectively no tint +--- +---@param decalID number +---@param tintColR number? (Default: curTintColR) +---@param tintColG number? (Default: curTintColG) +---@param tintColB number? (Default: curTintColB) +---@param tintColA number? (Default: curTintColA) +---@return boolean decalSet +function Spring.SetGroundDecalTint(decalID, tintColR, tintColG, tintColB, tintColA) end + +--- +---Sets varios secondary parameters of a decal +--- +---@param decalID number +---@param dotElimExp number? (Default: curValue) pow(max(dot(decalProjVector, SurfaceNormal), 0.0), dotElimExp), used to reduce decal artifacts on surfaces non-collinear with the projection vector +---@param refHeight number? (Default: curValue) +---@param minHeight number? (Default: curValue) +---@param maxHeight number? (Default: curValue) +---@param forceHeightMode number? (Default: curValue) in case forceHeightMode==1.0 ==> force relative height: midPoint.y = refHeight + clamp(midPoint.y - refHeight, minHeight); forceHeightMode==2.0 ==> force absolute height: midPoint.y = midPoint.y, clamp(midPoint.y, minHeight, maxHeight); other forceHeightMode values do not enforce the height of the center position +---@return boolean decalSet +function Spring.SetGroundDecalMisc(decalID, dotElimExp, refHeight, minHeight, maxHeight, forceHeightMode) end + +--- +---Use separate min and max for "gradient" style decals such as tank tracks +--- +---@param decalID number +---@param creationFrameMin number? (Default: currCreationFrameMin) +---@param creationFrameMax number? (Default: currCreationFrameMax) +---@return boolean decalSet +function Spring.SetGroundDecalCreationFrame(decalID, creationFrameMin, creationFrameMax) end + +---SDL Text +--- +---@section sdltext + +---@param x number +---@param y number +---@param width number +---@param height number +---@return nil +function Spring.SDLSetTextInputRect(x, y, width, height) end + +---@return nil +function Spring.SDLStartTextInput() end + +---@return nil +function Spring.SDLStopTextInput() end + +---Window Management +--- +---@section window + +---@param displayIndex number +---@param winRelPosX number +---@param winRelPosY number +---@param winSizeX number +---@param winSizeY number +---@param fullScreen boolean +---@param borderless boolean +---@return nil +function Spring.SetWindowGeometry(displayIndex, winRelPosX, winRelPosY, winSizeX, winSizeY, fullScreen, borderless) end + +---@return boolean minimized +function Spring.SetWindowMinimized() end + +---@return boolean maximized +function Spring.SetWindowMaximized() end + +---Misc +--- +---@section misc + +---@param startScript string the CONTENT of the script.txt spring should use to start. +---@return nil +function Spring.Reload(startScript) end + +--- +---If this call returns, something went wrong +--- +---@param commandline_args string commandline arguments passed to spring executable. +---@param startScript string +---@return nil +function Spring.Restart(commandline_args, startScript) end + +---Launches a new Spring instance without terminating the existing one. +--- +---If this call returns, something went wrong +--- +---@param commandline_args string commandline arguments passed to spring executable. +---@param startScript string the CONTENT of the script.txt spring should use to start (if empty, no start-script is added, you can still point spring to your custom script.txt when you add the file-path to commandline_args. +---@return nil +function Spring.Start(commandline_args, startScript) end + +---Sets the icon for the process which is seen in the OS task-bar and other places (default: spring-logo). +--- +---Note: has to be 24bit or 32bit. +---Note: on windows, it has to be 32x32 pixels in size (recommended for cross-platform) +---Note: *.bmp images have to be in BGR format (default for m$ ones). +---Note: *.ico images are not supported. +--- +---@param iconFileName string +---@return nil +function Spring.SetWMIcon(iconFileName) end + +---Sets the window title for the process (default: "Spring "). +--- +---The shortTitle is displayed in the OS task-bar (default: "Spring "). +--- +---NOTE: shortTitle is only ever possibly used under X11 (Linux & OS X), but not with QT (KDE) and never under Windows. +--- +---@param title string +---@param titleShort string? (Default: title) +---@return nil +function SetWMCaption(title, titleShort) end + +---@param threadName string? (Default: main) +---@return nil +function Spring.ClearWatchDogTimer(threadName) end + +---@param text string +---@return nil +function Spring.SetClipboard(text) end + +---Relinquish control of the game loading thread and OpenGL context back to the UI (LuaIntro). +--- +---Should be called after each widget/unsynced gadget is loaded in widget/gadget handler. Use it to draw screen updates and process windows events. +--- +---@usage local wantYield = Spring.Yield and Spring.Yield() -- nil check: not present in synced +---for wupget in pairs(wupgetsToLoad) do +---loadWupget(wupget) +---wantYield = wantYield and Spring.Yield() +---end +---@return boolean when true caller should continue calling `Spring.Yield` during the widgets/gadgets load, when false it shouldn't call it any longer. +function Spring.Yield() end \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaUnsyncedRead.lua b/rts/Lua/library/generated/LuaUnsyncedRead.lua new file mode 100644 index 0000000000..9fcadd8417 --- /dev/null +++ b/rts/Lua/library/generated/LuaUnsyncedRead.lua @@ -0,0 +1,1032 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaUnsyncedRead.cpp +--- +---@meta + +---Callouts to get state +--- +---@see rts/Lua/LuaUnsyncedRead.cpp + +---Replay +--- +---@section replay + +---@return boolean? isReplay +function Spring.IsReplay() end + +---@return number? timeInSeconds +function Spring.GetReplayLength() end + +---Game/Menu Name +--- +---@section gamename + +---@return string name +function Spring.GetGameName() end + +---@return string name name .. version from Modinfo.lua. E.g. "Spring: 1944 test-5640-ac2d15b". +function Spring.GetMenuName() end + +---Profiling +--- +---@section profiling + +---@param profilerName string +---@param frameData boolean? (Default: false) +---@return number total in ms +---@return number current in ms +---@return number max_dt +---@return number time_pct +---@return number peak_pct +---@return table? frameData Table where key is the frame index and value is duration. +function Spring.GetProfilerTimeRecord(profilerName, frameData) end + +---@return string[] profilerNames +function Spring.GetProfilerRecordNames() end + +---@return number luaHandleAllocedMem in kilobytes +---@return number luaHandleNumAllocs divided by 1000 +---@return number luaGlobalAllocedMem in kilobytes +---@return number luaGlobalNumAllocs divided by 1000 +---@return number luaUnsyncedGlobalAllocedMem in kilobytes +---@return number luaUnsyncedGlobalNumAllocs divided by 1000 +---@return number luaSyncedGlobalAllocedMem in kilobytes +---@return number luaSyncedGlobalNumAllocs divided by 1000 +function Spring.GetLuaMemUsage() end + +---@return number usedMem in MB +---@return number availableMem in MB +function Spring.GetVidMemUsage() end + +---Get a timer with millisecond resolution +--- +---@return integer +function Spring.GetTimer() end + +---Get a timer with microsecond resolution +--- +---@return integer +function Spring.GetTimerMicros() end + +---Get a timer for the start of the frame +--- +---This should give better results for camera interpolations +--- +---@param lastFrameTime boolean? (Default: false) whether to use last frame time instead of last frame start +---@return integer +function Spring.GetFrameTimer(lastFrameTime) end + +---@param endTimer integer +---@param startTimer integer +---@param returnMs boolean? (Default: false) whether to return `timeAmount` in milliseconds as opposed to seconds +---@param fromMicroSecs boolean? (Default: false) whether timers are in microseconds instead of milliseconds +---@return number timeAmount +function Spring.DiffTimers(endTimer, startTimer, returnMs, fromMicroSecs) end + +---Screen/Rendering Info +--- +---@section screeninfo + +---@return number numDisplays as returned by `SDL_GetNumVideoDisplays` +function Spring.GetNumDisplays() end + +---Get main view geometry (map and game rendering) +--- +---@return number viewSizeX in px +---@return number viewSizeY in px +---@return number viewPosX offset from leftmost screen left border in px +---@return number viewPosY offset from bottommost screen bottom border in px +function Spring.GetViewGeometry() end + +---Get dual view geometry (minimap when enabled) +--- +---@return number dualViewSizeX in px +---@return number dualViewSizeY in px +---@return number dualViewPosX offset from leftmost screen left border in px +---@return number dualViewPosY offset from bottommost screen bottom border in px +function Spring.GetDualViewGeometry() end + +---Get main window geometry +--- +---@return number winSizeX in px +---@return number winSizeY in px +---@return number winPosX in px +---@return number winPosY in px +---@return number windowBorderTop in px +---@return number windowBorderLeft in px +---@return number windowBorderBottom in px +---@return number windowBorderRight in px +function Spring.GetWindowGeometry() end + +---Get main window display mode +--- +---@return number width in px +---@return number height in px +---@return number bits per pixel +---@return number refresh rate in Hz +function Spring.GetWindowDisplayMode() end + +---Get screen geometry +--- +---@param displayIndex number? (Default: -1) +---@param queryUsable boolean? (Default: false) +---@return number screenSizeX in px +---@return number screenSizeY in px +---@return number screenPosX in px +---@return number screenPosY in px +---@return number windowBorderTop in px +---@return number windowBorderLeft in px +---@return number windowBorderBottom in px +---@return number windowBorderRight in px +---@return number? screenUsableSizeX in px +---@return number? screenUsableSizeY in px +---@return number? screenUsablePosX in px +---@return number? screenUsablePosY in px +function Spring.GetScreenGeometry(displayIndex, queryUsable) end + +---Get minimap geometry +--- +---@return number minimapPosX in px +---@return number minimapPosY in px +---@return number minimapSizeX in px +---@return number minimapSizeY in px +---@return boolean minimized +---@return boolean maximized +function Spring.GetMiniMapGeometry() end + +---Get minimap rotation +--- +---@return number amount in radians +function Spring.GetMiniMapRotation() end + +---@return string|false position "left"|"right" when dual screen is enabled, false when not +function Spring.GetMiniMapDualScreen() end + +---Get vertices from currently active selection box +--- +---Returns nil when selection box is inactive +--- +---@return number? left +---@return number? top +---@return number? right +---@return number? bottom +---@see Spring.GetUnitsInScreenRectangle +function Spring.GetSelectionBox() end + +---@return boolean +function Spring.GetDrawSelectionInfo() end + +---@param x number +---@param y number +---@return boolean isAbove +function Spring.IsAboveMiniMap(x, y) end + +---@return number low_16bit +---@return number high_16bit +function Spring.GetDrawFrame() end + +--- +---Ideally, when running 30hz sim, and 60hz rendering, the draw frames should +---have and offset of either 0.0 frames, or 0.5 frames. +--- +---When draw frames are not integer multiples of sim frames, some interpolation +---happens, and this timeoffset shows how far along it is. +--- +---@return number? offset of the current draw frame from the last sim frame, expressed in fractions of a frame +function Spring.GetFrameTimeOffset() end + +---Gets game time for drawing purposes +--- +---Returns the game time, taking the interpolated draw frame into account. +--- +---@return number game time in seconds + +---@return number? lastUpdateSeconds +function Spring.GetLastUpdateSeconds() end + +---@return boolean allowRecord +function Spring.GetVideoCapturingMode() end + +---Unit attributes +--- +---@section unitattributes + +---@param unitID integer +---@return boolean? isAllied nil with unitID cannot be parsed +function Spring.IsUnitAllied(unitID) end + +---@param unitID integer +---@return boolean? isSelected nil when unitID cannot be parsed +function Spring.IsUnitSelected(unitID) end + +---@param unitID integer +---@return boolean? draw nil when unitID cannot be parsed +function Spring.GetUnitLuaDraw(unitID) end + +---@param unitID integer +---@return boolean? nil when unitID cannot be parsed +function Spring.GetUnitNoDraw(unitID) end + +---@param unitID integer +---@return boolean? nil when unitID cannot be parsed +function Spring.GetUnitEngineDrawMask(unitID) end + +---@param unitID integer +---@return boolean? nil when unitID cannot be parsed +function Spring.GetUnitAlwaysUpdateMatrix(unitID) end + +---@param unitID integer +---@return number? nil when unitID cannot be parsed +function Spring.GetUnitDrawFlag(unitID) end + +---@param unitID integer +---@return boolean? nil when unitID cannot be parsed +function Spring.GetUnitNoMinimap(unitID) end + +---@param unitID integer +---@return boolean? nil when unitID cannot be parsed +function Spring.GetUnitNoSelect(unitID) end + +---@param unitID integer +---@return boolean? drawIcon +---`true` if icon is being drawn, `nil` when unitID is invalid, otherwise `false`. +function Spring.UnitIconGetDraw(unitID) end + +---@param unitID integer +---@return number? scaleX nil when unitID cannot be parsed +---@return number scaleY +---@return number scaleZ +---@return number offsetX +---@return number offsetY +---@return number offsetZ +---@return number volumeType +---@return number useContHitTest +---@return number getPrimaryAxis +---@return boolean ignoreHits +function Spring.GetUnitSelectionVolumeData(unitID) end + +---Feature attributes +--- +---@section featureattributes + +---@param featureID integer +---@return boolean? nil when featureID cannot be parsed +function Spring.GetFeatureLuaDraw(featureID) end + +---@param featureID integer +---@return boolean? nil when featureID cannot be parsed +function Spring.GetFeatureNoDraw(featureID) end + +---@param featureID integer +---@return boolean? nil when featureID cannot be parsed +function Spring.GetFeatureEngineDrawMask(featureID) end + +---@param featureID integer +---@return boolean? nil when featureID cannot be parsed +function Spring.GetFeatureAlwaysUpdateMatrix(featureID) end + +---@param featureID integer +---@return number? nil when featureID cannot be parsed +function Spring.GetFeatureDrawFlag(featureID) end + +---@param featureID integer +---@return number? scaleX nil when unitID cannot be parsed +---@return number scaleY +---@return number scaleZ +---@return number offsetX +---@return number offsetY +---@return number offsetZ +---@return number volumeType +---@return number useContHitTest +---@return number getPrimaryAxis +---@return boolean ignoreHits +function Spring.GetFeatureSelectionVolumeData(featureID) end + +---Misc +--- +---@section misc + +---@param unitID integer +---@return number? m11 nil when unitID cannot be parsed +---@return number m12 +---@return number m13 +---@return number m14 +---@return number m21 +---@return number m22 +---@return number m23 +---@return number m24 +---@return number m31 +---@return number m32 +---@return number m33 +---@return number m34 +---@return number m41 +---@return number m42 +---@return number m43 +---@return number m44 +function Spring.GetUnitTransformMatrix(unitID) end + +---@param featureID integer +---@return number? m11 nil when featureID cannot be parsed +---@return number m12 +---@return number m13 +---@return number m14 +---@return number m21 +---@return number m22 +---@return number m23 +---@return number m24 +---@return number m31 +---@return number m32 +---@return number m33 +---@return number m34 +---@return number m41 +---@return number m42 +---@return number m43 +---@return number m44 +function Spring.GetFeatureTransformMatrix(featureID) end + +---Inview +--- +---@section inview + +---@param unitID integer +---@return boolean? inView nil when unitID cannot be parsed +function Spring.IsUnitInView(unitID) end + +---@param unitID integer +---@param radius number? unitRadius when not specified +---@param checkIcon boolean +---@return boolean? isVisible nil when unitID cannot be parsed +function Spring.IsUnitVisible(unitID, radius, checkIcon) end + +---@param unitID integer +---@return boolean? isUnitIcon nil when unitID cannot be parsed +function Spring.IsUnitIcon(unitID) end + +---@param minX number +---@param minY number +---@param minZ number +---@param maxX number +---@param maxY number +---@param maxZ number +---@return boolean inView +function Spring.IsAABBInView(minX, minY, minZ, maxX, maxY, maxZ) end + +---@param posX number +---@param posY number +---@param posZ number +---@param radius number? (Default: 0) +---@return boolean inView +function Spring.IsSphereInView(posX, posY, posZ, radius) end + +---@param unitID integer +---@param midPos boolean? (Default: false) +---@return number? x nil when unitID cannot be parsed +---@return number y +---@return number z +function Spring.GetUnitViewPosition(unitID, midPos) end + +---@param teamID integer? (Default: -1) +---@param radius number? (Default: 30) +---@param icons boolean? (Default: true) +---@return nil|number[] unitIDs +function Spring.GetVisibleUnits(teamID, radius, icons) end + +---@param teamID integer? (Default: -1) +---@param radius number? (Default: 30) +---@param icons boolean? (Default: true) +---@param geos boolean? (Default: true) +---@return nil|number[] featureIDs +function Spring.GetVisibleFeatures(teamID, radius, icons, geos) end + +---@param allyTeamID integer? (Default: -1) +---@param addSyncedProjectiles boolean? (Default: true) +---@param addWeaponProjectiles boolean? (Default: true) +---@param addPieceProjectiles boolean? (Default: true) +---@return nil|number[] projectileIDs +function Spring.GetVisibleProjectiles(allyTeamID, addSyncedProjectiles, addWeaponProjectiles, addPieceProjectiles) end + +function Spring.GetRenderUnits() end + +function Spring.GetRenderUnitsDrawFlagChanged() end + +function Spring.GetRenderFeatures() end + +function Spring.GetRenderFeaturesDrawFlagChanged() end + +---@return nil +function Spring.ClearUnitsPreviousDrawFlag() end + +---@return nil +function Spring.ClearFeaturesPreviousDrawFlag() end + +---Get units inside a rectangle area on the map +--- +---@param left number +---@param top number +---@param right number +---@param bottom number +---@param allegiance number? (Default: -1) teamID when > 0, when < 0 one of AllUnits = -1, MyUnits = -2, AllyUnits = -3, EnemyUnits = -4 +---@return nil|number[] unitIDs +function Spring.GetUnitsInScreenRectangle(left, top, right, bottom, allegiance) end + +---Get features inside a rectangle area on the map +--- +---@param left number +---@param top number +---@param right number +---@param bottom number +---@return nil|number[] featureIDs +function Spring.GetFeaturesInScreenRectangle(left, top, right, bottom) end + +---@return number playerID +function Spring.GetLocalPlayerID() end + +---@return number teamID +function Spring.GetLocalTeamID() end + +---@return number allyTeamID +function Spring.GetLocalAllyTeamID() end + +---@return boolean spectating +---@return boolean spectatingFullView +---@return boolean spectatingFullSelect +function Spring.GetSpectatingState() end + +---@return number[] unitIDs +function Spring.GetSelectedUnits() end + +---Get selected units aggregated by unitDefID +--- +---@return table where keys are unitDefIDs and values are unitIDs +---@return integer the number of unitDefIDs +function Spring.GetSelectedUnitsSorted() end + +---Get an aggregate count of selected units per unitDefID +--- +---@return table unitsCounts where keys are unitDefIDs and values are counts +---@return integer the number of unitDefIDs +function Spring.GetSelectedUnitsCounts() end + +---Returns the amount of selected units +--- +---@return number selectedUnitsCount +function Spring.GetSelectedUnitsCount() end + +---Get if selection box is handled by engine +--- +---@return boolean when true engine won't select units inside selection box when released +---@see Spring.GetSelectionBox +---@see Spring.SetBoxSelectionByEngine +function Spring.GetBoxSelectionByEngine() end + +---@return boolean +function Spring.IsGUIHidden() end + +---@return boolean shadowsLoaded +function Spring.HaveShadows() end + +---@return boolean useAdvShading +---@return boolean groundUseAdvShading +function Spring.HaveAdvShading() end + +---@return number waterRendererID +---@return string waterRendererName +---@see rts/Rendering/Env/IWater.h +function Spring.GetWaterMode() end + +---@return "normal"|"height"|"metal"|"pathTraversability"|"los" +function Spring.GetMapDrawMode() end + +---@param texSquareX number +---@param texSquareY number +---@param lodMin number +---@param luaTexName string +---@param lodMax number? (Default: lodMin) +---@return boolean? success +function Spring.GetMapSquareTexture(texSquareX, texSquareY, lodMin, luaTexName, lodMax) end + +---@return rgb always +---@return rgb LOS +---@return rgb radar +---@return rgb jam +---@return rgb radar2 +function Spring.GetLosViewColors() end + +---@return number rotVal in degrees +---@return number rotVel in degrees +---@return number rotAcc in degrees +---@return number rotValRng in degrees +---@return number rotVelRng in degrees +---@return number rotAccRng in degrees +function Spring.GetNanoProjectileParams() end + +---Get available cameras. +--- +---@return table Table where where keys are names and values are indices. +function Spring.GetCameraNames() end + +---@param useReturns false +---@return CameraState cameraState +function Spring.GetCameraState(useReturns) end + +---@param useReturns true? (Default: `true`) Return multiple values instead of a table. +---@return "ta"|"spring"|"rot"|"ov"|"free"|"fps"|"dummy" name +---@return any Fields depending on current controller mode. +function Spring.GetCameraState(useReturns) end + +---@return number posX +---@return number posY +---@return number posZ +function Spring.GetCameraPosition() end + +---@return number dirX +---@return number dirY +---@return number dirZ +function Spring.GetCameraDirection() end + +---@return number rotX in radians +---@return number rotY in radians +---@return number rotZ in radians +function Spring.GetCameraRotation() end + +---@return number vFOV +---@return number hFOV +function Spring.GetCameraFOV() end + +---@class CameraVectors +---@field forward xyz +---@field up xyz +---@field right xyz +---@field topFrustumPlane xyz +---@field botFrustumPlane xyz +---@field lftFrustumPlane xyz +---@field rgtFrustumPlane xyz +local CameraVectors = {} + +---@return CameraVectors +function Spring.GetCameraVectors() end + +---@param x number +---@param y number +---@param z number +---@return number viewPortX +---@return number viewPortY +---@return number viewPortZ +function Spring.WorldToScreenCoords(x, y, z) end + +---Get information about a ray traced from screen to world position +--- +---Extended to allow a custom plane, parameters are (0, 1, 0, D=0) where D is the offset D can be specified in the third argument (if all the bools are false) or in the seventh (as shown). +--- +---Intersection coordinates are returned in t[4],t[5],t[6] when the ray goes offmap and includeSky is true), or when no unit or feature is hit (or onlyCoords is true). +--- +---This will only work for units & objects with the default collission sphere. Per Piece collission and custom collission objects are not supported. +--- +---The unit must be selectable, to appear to a screen trace ray. +--- +---@param screenX number position on x axis in mouse coordinates (origin on left border of view) +---@param screenY number position on y axis in mouse coordinates (origin on top border of view) +---@param onlyCoords boolean? (Default: false) return only description (1st return value) and coordinates (2nd return value) +---@param useMinimap boolean? (Default: false) if position arguments are contained by minimap, use the minimap corresponding world position +---@param includeSky boolean? (Default: false) +---@param ignoreWater boolean? (Default: false) +---@param heightOffset number? (Default: 0) +---@return nil|string description of traced position +---@return nil|number|string|xyz unitID or feature, position triple when onlyCoords=true +---@return nil|number|string featureID or ground +---@return nil|xyz coords +function Spring.TraceScreenRay(screenX, screenY, onlyCoords, useMinimap, includeSky, ignoreWater, heightOffset) end + +---@param x number +---@param y number +---@return number dirX +---@return number dirY +---@return number dirZ +function Spring.GetPixelDir(x, y) end + +---@param teamID integer +---@return number? r factor from 0 to 1 +---@return number? g factor from 0 to 1 +---@return number? b factor from 0 to 1 +---@return number? a factor from 0 to 1 +function Spring.GetTeamColor(teamID) end + +---@param teamID integer +---@return number? r factor from 0 to 1 +---@return number? g factor from 0 to 1 +---@return number? b factor from 0 to 1 +---@return number? a factor from 0 to 1 +function Spring.GetTeamOrigColor(teamID) end + +---@return integer Time in seconds +function Spring.GetDrawSeconds() end + +---Sound +--- +---@section sound + +---@return number playTime +---@return number time +function Spring.GetSoundStreamTime() end + +function Spring.GetSoundEffectParams() end + +---Game Speed +--- +---@section gamespeed + +---@return number fps +function Spring.GetFPS() end + +---@return number wantedSpeedFactor +---@return number speedFactor +---@return boolean paused +function Spring.GetGameSpeed() end + +---@param maxLatency number? (Default: 500) used for `isSimLagging` return parameter +---@return boolean doneLoading +---@return boolean isSavedGame +---@return boolean isClientPaused +---@return boolean isSimLagging +function Spring.GetGameState(maxLatency) end + +---Commands +--- +---@section commands + +---@return number? cmdIndex +---@return number? cmdID +---@return number? cmdType +---@return nil|string cmdName +function Spring.GetActiveCommand() end + +---@return number? cmdIndex +---@return number? cmdID +---@return number? cmdType +---@return nil|string cmdName +function Spring.GetDefaultCommand() end + +---@return CommandDescription[] cmdDescs +function Spring.GetActiveCmdDescs() end + +---@param cmdIndex integer +---@return CommandDescription? +function Spring.GetActiveCmdDesc(cmdIndex) end + +---@param cmdID integer +---@return integer? cmdDescIndex +function Spring.GetCmdDescIndex(cmdID) end + +---@alias Facing +---| 0 # South +---| 1 # East +---| 2 # North +---| 3 # West + +---@return Facing buildFacing +function Spring.GetBuildFacing() end + +---@return number buildSpacing +function Spring.GetBuildSpacing() end + +---@return number gatherMode +function Spring.GetGatherMode() end + +---@return number activePage +---@return number maxPage +function Spring.GetActivePage() end + +---Mouse State +--- +---@section mousestate + +---@return number x +---@return number y +---@return number lmbPressed left mouse button pressed +---@return number mmbPressed middle mouse button pressed +---@return number rmbPressed right mouse button pressed +---@return boolean offscreen +---@return boolean mmbScroll +function Spring.GetMouseState() end + +---@return string cursorName +---@return number cursorScale +function Spring.GetMouseCursor() end + +---@param button number +---@return number x +---@return number y +---@return number camPosX +---@return number camPosY +---@return number camPosZ +---@return number dirX +---@return number dirY +---@return number dirZ +function Spring.GetMouseStartPosition(button) end + +---Text +--- +---@section text + +---@return string text +function Spring.GetClipboard() end + +---@return boolean +function Spring.IsUserWriting() end + +---Console +--- +---@section console + +---@return xyz[] message positions +function Spring.GetLastMessagePositions() end + +---@param maxLines number +---@return { text: string, priority: integer }[] buffer +function Spring.GetConsoleBuffer(maxLines) end + +---@return string tooltip +function Spring.GetCurrentTooltip() end + +---Key Input +--- +---@section keyinput + +---@param scanSymbol string +---@return string keyName +function Spring.GetKeyFromScanSymbol(scanSymbol) end + +---@param keyCode number +---@return boolean pressed +function Spring.GetKeyState(keyCode) end + +---@return boolean alt +---@return boolean ctrl +---@return boolean meta +---@return boolean shift +function Spring.GetModKeyState() end + +---@return table where keys are keyCodes or key names +function Spring.GetPressedKeys() end + +---@return table where keys are scanCodes or scan names +function Spring.GetPressedScans() end + +---@return number? queueKey +function Spring.GetInvertQueueKey() end + +---@param keySym string +---@return number keyCode +function Spring.GetKeyCode(keySym) end + +---@param keyCode number +---@return string keyCodeName +---@return string keyCodeDefaultName name when there are not aliases +function Spring.GetKeySymbol(keyCode) end + +---@param scanCode number +---@return string scanCodeName +---@return string scanCodeDefaultName name when there are not aliases +function Spring.GetScanSymbol(scanCode) end + +---Keybinding +--- +---Contains data about a keybinding +--- +---@class KeyBinding +---@field command string +---@field extra string +---@field boundWith string +local KeyBinding = {} + +---@param keySet1 string? filters keybindings bound to this keyset +---@param keySet2 string? OR bound to this keyset +---@return KeyBinding[] +function Spring.GetKeyBindings(keySet1, keySet2) end + +---@param actionName string +---@return string[]? hotkeys +function Spring.GetActionHotKeys(actionName) end + +---Unit Groups +--- +---@section unitgroups + +---@return nil|table where keys are groupIDs and values are counts +function Spring.GetGroupList() end + +---@return number groupID -1 when no group selected +function Spring.GetSelectedGroup() end + +---@param unitID integer +---@return number? groupID +function Spring.GetUnitGroup(unitID) end + +---@param groupID integer +---@return nil|number[] unitIDs +function Spring.GetGroupUnits(groupID) end + +---@param groupID integer +---@return nil|table where keys are unitDefIDs and values are unitIDs +function Spring.GetGroupUnitsSorted(groupID) end + +---@param groupID integer +---@return nil|table where keys are unitDefIDs and values are counts +function Spring.GetGroupUnitsCounts(groupID) end + +---@param groupID integer +---@return number? groupSize +function Spring.GetGroupUnitsCount(groupID) end + +---Team/Player Info +--- +---@section teamplayerinfo + +---Roster +--- +---Contains data about a player +--- +---@class Roster +---@field name string +---@field playerID integer +---@field teamID integer +---@field allyTeamID integer +---@field spectator boolean +---@field cpuUsage number in order to find the progress, use: cpuUsage&0x1 if it's PC or BO, cpuUsage& 0xFE to get path res, (cpuUsage>>8)*1000 for the progress +---@field pingTime number if -1, the player is pathfinding +local Roster = {} + +---@param sortType number? return unsorted if unspecified. Disabled = 0, Allies = 1, TeamID = 2, PlayerName = 3, PlayerCPU = 4, PlayerPing = 5 +---@param showPathingPlayers boolean? (Default: false) +---@return Roster[]? playerTable +function Spring.GetPlayerRoster(sortType, showPathingPlayers) end + +---@param playerID integer +---@param packetID integer? +---@return number traffic +function Spring.GetPlayerTraffic(playerID, packetID) end + +---@param playerID integer +---@return number? mousePixels nil when invalid playerID +---@return number mouseClicks +---@return number keyPresses +---@return number numCommands +---@return number unitCommands +function Spring.GetPlayerStatistics(playerID) end + +---Configuration +--- +---@section configuration + +---Configuration +--- +---Contains data about a configuration, only name and type are guaranteed +--- +---@class Configuration +---@field name string +---@field type string +---@field description string +---@field defaultValue string +---@field minimumValue string +---@field maximumValue string +---@field safemodeValue string +---@field declarationFile string +---@field declarationLine string +---@field readOnly boolean +local Configuration = {} + +---@return Configuration[] +function Spring.GetConfigParams() end + +---@param name string +---@tparam +---@return number? configInt +function Spring.GetConfigInt(name) end + +---@param name string +---@tparam +---@return number? configFloat +function Spring.GetConfigFloat(name) end + +---@param name string +---@tparam +---@return number? configString +function Spring.GetConfigString(name) end + +---@return table sections where keys are names and loglevel are values. E.g. `{ "KeyBindings" = LOG.INFO, "Font" = LOG.INFO, "Sound" = LOG.WARNING, ... }` +function Spring.GetLogSections() end + +---Decals +--- +---@section decals + +---@return number[] decalIDs +function Spring.GetAllGroundDecals() end + +---@param decalID integer +---@return number? posX +---@return number posZ +function Spring.GetGroundDecalMiddlePos(decalID) end + +---@param decalID integer +---@return number? posTL.x +---@return number posTL.z +---@return number posTR.x +---@return number posTR.z +---@return number posBR.x +---@return number posBR.z +---@return number posBL.x +---@return number posBL.z +function Spring.GetDecalQuadPos(decalID) end + +---@param decalID integer +---@return number? sizeX +---@return number sizeY +---@return number projCubeHeight +function Spring.GetGroundDecalSizeAndHeight(decalID) end + +---@param decalID integer +---@return number? rotation in radians +function Spring.GetGroundDecalRotation(decalID) end + +---@param decalID integer +---@param isMainTex boolean? (Default: true) If false, it gets the normals/glow map +---@return nil|string texture +function Spring.GetGroundDecalTexture(decalID, isMainTex) end + +---@param isMainTex boolean? (Default: true) If false, it gets the texture for normals/glow maps +---@return string[] textureNames All textures on the atlas and available for use in SetGroundDecalTexture +function Spring.GetDecalTextures(isMainTex) end + +---@param decalID integer +---@return number? texWrapDistance if non-zero sets the mode to repeat the texture along the left-right direction of the decal every texWrapFactor elmos +---@return number texTraveledDistance shifts the texture repetition defined by texWrapFactor so the texture of a next line in the continuous multiline can start where the previous finished. For that it should collect all elmo lengths of the previously set multiline segments. +function Spring.SetGroundDecalTextureParams(decalID) end + +---@param decalID integer +---@return number? alpha Between 0 and 1 +---@return number alphaFalloff Between 0 and 1, per second +function Spring.GetGroundDecalAlpha(decalID) end + +--- +---If all three equal 0, the decal follows the normals of ground at midpoint +--- +---@param decalID integer +---@return number? normal.x +---@return number normal.y +---@return number normal.z +function Spring.GetGroundDecalNormal(decalID) end + +--- +---Gets the tint of the ground decal. +---A color of (0.5, 0.5, 0.5, 0.5) is effectively no tint +--- +---@param decalID integer +---@return number? tintR +---@return number tintG +---@return number tintB +---@return number tintA +function Spring.GetGroundDecalTint(decalID) end + +--- +---Returns less important parameters of a ground decal +--- +---@param decalID integer +---@return number? dotElimExp +---@return number refHeight +---@return number minHeight +---@return number maxHeight +---@return number forceHeightMode +function Spring.GetGroundDecalMisc(decalID) end + +--- +---Min can be not equal to max for "gradient" style decals, e.g. unit tracks +--- +---@param decalID integer +---@return number? creationFrameMin +---@return number creationFrameMax +function Spring.GetGroundDecalCreationFrame(decalID) end + +---@param decalID integer +---@return number? unitID|number featureID(+MAX_UNITS) +function Spring.GetGroundDecalOwner(decalID) end + +---@param decalID integer +---@return nil|string type "explosion"|"plate"|"lua"|"track"|"unknown" +function Spring.GetGroundDecalType(decalID) end + +---Misc +--- +---@section misc + +---@param collectGC boolean? (Default: false) collect before returning metric +---@return number? GC values are expressed in Kbytes: #bytes/2^10 +function Spring.GetSyncedGCInfo(collectGC) end + +---@param groupID integer +---@return number[]? unitIDs +function Spring.SolveNURBSCurve(groupID) end \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaUtils.lua b/rts/Lua/library/generated/LuaUtils.lua new file mode 100644 index 0000000000..a5adc9598a --- /dev/null +++ b/rts/Lua/library/generated/LuaUtils.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaUtils.cpp +--- +---@meta + diff --git a/rts/Lua/library/generated/LuaVAO.lua b/rts/Lua/library/generated/LuaVAO.lua new file mode 100644 index 0000000000..fa824a853a --- /dev/null +++ b/rts/Lua/library/generated/LuaVAO.lua @@ -0,0 +1,19 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaVAO.cpp +--- +---@meta + +---@see rts/Lua/LuaVAO.cpp + +---Example: +---``` +---local myVAO = gl.GetVAO() +---if myVAO == nil then Spring.Echo("Failed to get VAO") end +---``` +--- +---@return VAO? vao The VAO ref on success, else `nil` +function gl.GetVAO() end \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaVAOImpl.lua b/rts/Lua/library/generated/LuaVAOImpl.lua new file mode 100644 index 0000000000..a0317ae1b9 --- /dev/null +++ b/rts/Lua/library/generated/LuaVAOImpl.lua @@ -0,0 +1,76 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaVAOImpl.cpp +--- +---@meta + +---Vertex Array Object +--- +---@class VAO +---@see LuaVAO.GetVAO +---@see rts/Lua/LuaVAOImpl.cpp +VAO = {} + +---@return nil +function VAO:Delete() end + +---Attachs a VBO to be used as a vertex buffer +--- +---@param vbo VBO +---@return nil +function VAO:AttachVertexBuffer(vbo) end + +---Attachs a VBO to be used as an instance buffer +--- +---@param vbo VBO +---@return nil +function VAO:AttachInstanceBuffer(vbo) end + +---Attachs a VBO to be used as an index buffer +--- +---@param vbo VBO +---@return nil +function VAO:AttachIndexBuffer(vbo) end + +---@param glEnum number primitivesMode +---@param vertexCount number? +---@param vertexFirst number? +---@param instanceCount number? +---@param instanceFirst number? +---@return nil +function VAO:DrawArrays(glEnum, vertexCount, vertexFirst, instanceCount, instanceFirst) end + +---@param glEnum number primitivesMode +---@param drawCount number? +---@param baseIndex number? +---@param instanceCount number? +---@param baseVertex number? +---@param baseInstance number? +---@return nil +function VAO:DrawElements(glEnum, drawCount, baseIndex, instanceCount, baseVertex, baseInstance) end + +---@param unitIDs number|number[] +---@return number submittedCount +function VAO:AddUnitsToSubmission(unitIDs) end + +---@param featureIDs number|number[] +---@return number submittedCount +function VAO:AddFeaturesToSubmission(featureIDs) end + +---@param unitDefIDs number|number[] +---@return number submittedCount +function VAO:AddUnitDefsToSubmission(unitDefIDs) end + +---@param featureDefIDs number|number[] +---@return number submittedCount +function VAO:AddFeatureDefsToSubmission(featureDefIDs) end + +---@param index number +---@return nil +function VAO:RemoveFromSubmission(index) end + +---@return nil +function VAO:Submit() end \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaVBO.lua b/rts/Lua/library/generated/LuaVBO.lua new file mode 100644 index 0000000000..4fe538b251 --- /dev/null +++ b/rts/Lua/library/generated/LuaVBO.lua @@ -0,0 +1,36 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaVBO.cpp +--- +---@meta + +---@see rts/Lua/LuaVBO.cpp + +---@alias GLBufferType +---| GL.ARRAY_BUFFER +---| GL.ELEMENT_ARRAY_BUFFER +---| GL.UNIFORM_BUFFER +---| GL.SHADER_STORAGE_BUFFER + +---Example: +--- +---```lua +---local myVBO = gl.GetVBO() +---if myVBO == nil then Spring.Echo("Failed to get VBO") end +---``` +--- +---@param bufferType GLBufferType? (Default: GL.ARRAY_BUFFER) +--- +---Use `GL.ARRAY_BUFFER` for vertex data and +---`GL.ELEMENT_ARRAY_BUFFER` for vertex indices. +---@param freqUpdated boolean? (Default: true) +--- +---`true` to updated frequently, `false` to update only once. +---@return VBO? VBO +--- +---The VBO ref on success, or nil if not supported or an error occurred. +---@see GL.OpenGL_Buffer_Types +function gl.GetVBO(bufferType, freqUpdated) end \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaVBOImpl.lua b/rts/Lua/library/generated/LuaVBOImpl.lua new file mode 100644 index 0000000000..ff97b88046 --- /dev/null +++ b/rts/Lua/library/generated/LuaVBOImpl.lua @@ -0,0 +1,267 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaVBOImpl.cpp +--- +---@meta + +---Vertex Buffer Object +--- +---@class VBO +---@see LuaVBO.GetVBO +---@see rts/Lua/LuaVBOImpl.cpp +local VBO = {} + +---@return nil +function VBO:Delete() end + +---@alias VBODataType +---| GL.BYTE +---| GL.UNSIGNED_BYTE +---| GL.SHORT +---| GL.UNSIGNED_SHORT +---| GL.INT +---| GL.UNSIGNED_INT +---| GL.FLOAT + +---@class VBOAttributeDef +---@field id integer +---The location in the vertex shader layout e.g.: layout (location = 0) in vec2 +---aPos. optional attrib, specifies location in the vertex shader. If not +---specified the implementation will increment the counter starting from 0. +---There can be maximum 16 attributes (so id of 15 is max). +---@field name string +--- +---The name for this VBO, only used for debugging. +---@field size integer? +--- +---Defaults to to 4 for VBO. The number of floats that constitute 1 element in +---this buffer. e.g. for the previous layout (location = 0) in vec2 aPos, it +---would be size = 2. +---@field type VBODataType (Default: `GL.FLOAT`) +--- +---The datatype of this element. +---@field normalized boolean? (Defaults: `false`) +--- +---It's possible to submit say normal without normalizing them first, normalized +---will make sure data is normalized. +local VBOAttributeDef = {} + +---Specify the kind of VBO you will be using. +--- +---```lua +--- +---@usage terrainVertexVBO:Define(numPoints, {{ id = 0, name = "pos", size = 2 }}) +---``` +--- +---It is usually an array of vertex/color/uv data, but can also be an array of +---instance uniforms. +--- +---If you want to specify multiple instances of something to render, you will +---need to create another VBO, which also specifies the number of instances you +---wish to render, and the size of the data passed to each instance. +--- +---If you want say 5 elements, and each element is defined in the layout: +--- +---```lua +---{id = 0, name = "first", size = 1},{id = 1, name = "second", size = 2}} +---``` +--- +---Then the total size of your VBO will be `5 * (1 + 2)`. +--- +---They will be laid out consecutively: `[1,2],[1,2],[1,2],[1,2],[1,2]`. +--- +---This is important for when you call `VBO:Upload`, you need to make sure you +---enter your data into the Lua array correctly. +---@param size number The maximum number of elements this VBO can have. +---@param attribs number|VBOAttributeDef[] +--- +---When number, the maximum number of elements this VBO can have. +--- +---Otherwise, an array of arrays specifying the layout. +---@return nil +---@see GL.OpenGL_Data_Types +---@see VBO:Upload +function VBO:Define(size, attribs) end + +---@return number elementsCount +---@return number bufferSizeInBytes +---@return number size +function VBO:GetBufferSize() end + +---Uploads the data (array of floats) into the VBO +--- +---```lua +---vbo:Upload(posArray, 0, 1) +----- 0 is offset into vbo (on GPU) in this case no offset +----- 1 is lua index index into the Lua table, in this case it's same as default +----- Upload will upload from luaOffset to end of lua array +---``` +--- +---```lua +--- +---@usage rectInstanceVBO:Upload({1},0) +---``` +---@param vboData number[] a lua array of values to upload into the VBO +---@param attributeIndex integer? (Default: -1) +--- +---If supplied with non-default value then the data from vboData will only be +---used to upload the data to this particular attribute. +--- +---The whole vboData is expected to contain only attributeIndex data. +--- +---Otherwise all attributes get updated sequentially across attributes and elements. +---@param elemOffset integer? (Default: 0) Which VBO element to start uploading data from Lua array into. +---@param luaStartIndex integer? (Default: 1) Start uploading from that element in supplied Lua array. +---@param luaFinishIndex integer? Consider this element the last element in Lua array. +---@return number[] indexData +---@return integer elemOffset +---@return integer|[integer,integer,integer,integer] attrID +---@see VBO:Define +function VBO:Upload(vboData, attributeIndex, elemOffset, luaStartIndex, luaFinishIndex) end + +---@param attributeIndex integer? (Default: -1) when supplied with non-default value: only data +---from specified attribute will be downloaded - otherwise all attributes are +---downloaded +---@param elementOffset integer? (Default: 0) download data starting from this element +---@param elementCount number? number of elements to download +---@param forceGPURead boolean? (Default: false) force downloading the data from GPU buffer as opposed +---to using shadow RAM buffer +---@return [number, ...][] vboData +function VBO:Download(attributeIndex, elementOffset, elementCount, forceGPURead) end + +---Binds engine side vertex or index VBO containing models (units, features) data. +--- +---Also fills in VBO definition data as they're set for engine models (no need to do VBO:Define()). +--- +---@return nil|number buffer size in bytes +function VBO:ModelsVBO() end + +---Fills in attribute data for each specified unitDefID +--- +---The instance data in that attribute will contain the offset to bind position +---matrix in global matrices SSBO and offset to uniform buffer structure in +---global per unit/feature uniform SSBO (unused for Unit/FeatureDefs), as +---well as some auxiliary data ushc as draw flags and team index. +--- +---Data Layout: +---``` +---SInstanceData: +---, matOffset{ matOffset_ } // updated during the following draw frames +---, uniOffset{ uniOffset_ } // updated during the following draw frames +---, info{ teamIndex, drawFlags, 0, 0 } // not updated during the following draw frames +---, aux1 { 0u } +---``` +--- +---@param unitDefIDs number|number[] +---@param attrID integer +---@param teamIdOpt integer? +---@param elementOffset integer? +---@return [number,number,number,number] instanceData +---@return integer elementOffset +---@return integer attrID +function VBO:InstanceDataFromUnitDefIDs(unitDefIDs, attrID, teamIdOpt, elementOffset) end + +---Fills in attribute data for each specified featureDefID +--- +---The instance data in that attribute will contain the offset to bind position +---matrix in global matrices SSBO and offset to uniform buffer structure in +---global per unit/feature uniform SSBO (unused for Unit/FeatureDefs), as +---well as some auxiliary data ushc as draw flags and team index. +--- +---Data Layout +---``` +---SInstanceData: +---, matOffset{ matOffset_ } // updated during the following draw frames +---, uniOffset{ uniOffset_ } // updated during the following draw frames +---, info{ teamIndex, drawFlags, 0, 0 } // not updated during the following draw frames +---, aux1 { 0u } +---``` +--- +---@param featureDefIDs number|number[] +---@param attrID integer +---@param teamIdOpt integer? +---@param elementOffset integer? +---@return [number,number,number,number] instanceData +---@return integer elementOffset +---@return integer attrID +function VBO:InstanceDataFromFeatureDefIDs(featureDefIDs, attrID, teamIdOpt, elementOffset) end + +---Fills in attribute data for each specified unitID +--- +---The instance data in that attribute will contain the offset to bind position +---matrix in global matrices SSBO and offset to uniform buffer structure in +---global per unit/feature uniform SSBO (unused for Unit/FeatureDefs), as +---well as some auxiliary data ushc as draw flags and team index. +--- +---Data Layout +--- +---``` +---SInstanceData: +---, matOffset{ matOffset_ } // updated during the following draw frames +---, uniOffset{ uniOffset_ } // updated during the following draw frames +---, info{ teamIndex, drawFlags, 0, 0 } // not updated during the following draw frames +---, aux1 { 0u } +---``` +--- +---@param unitIDs number|number[] +---@param attrID integer +---@param teamIdOpt integer? +---@param elementOffset integer? +---@return [number,number,number,number] instanceData +---@return integer elementOffset +---@return integer attrID +function VBO:InstanceDataFromUnitIDs(unitIDs, attrID, teamIdOpt, elementOffset) end + +---Fills in attribute data for each specified featureID +--- +---The instance data in that attribute will contain the offset to bind position +---matrix in global matrices SSBO and offset to uniform buffer structure in +---global per unit/feature uniform SSBO (unused for Unit/FeatureDefs), as +---well as some auxiliary data ushc as draw flags and team index. +--- +---@param featureIDs number|number[] +---@param attrID integer +---@param teamIdOpt integer? +---@param elementOffset integer? +---@return [number,number,number,number] instanceData +---@return integer elementOffset +---@return integer attrID +function VBO:InstanceDataFromFeatureIDs(featureIDs, attrID, teamIdOpt, elementOffset) end + +---@param projectileIDs integer|integer[] +---@param attrID integer +---@param teamIdOpt integer? +---@param elementOffset integer? +---@return number[] matDataVec 4x4 matrix +---@return integer elemOffset +---@return integer|[integer,integer,integer,integer] attrID +function VBO:MatrixDataFromProjectileIDs(projectileIDs, attrID, teamIdOpt, elementOffset) end + +---Bind a range within a buffer object to an indexed buffer target +--- +---Generally mimics +---https://registry.khronos.org/OpenGL-Refpages/gl4/html/glBindBufferRange.xhtml +---except offset and size are specified in number of elements / element indices. +--- +---@param index integer should be in the range between +---`5 < index < GL_MAX_UNIFORM_BUFFER_BINDINGS` value (usually 31) +---@param elementOffset integer? +---@param elementCount number? +---@param target number? glEnum +---@return integer bindingIndex when successful, -1 otherwise +function VBO:BindBufferRange(index, elementOffset, elementCount, target) end + +---@param index integer +---@param elementOffset integer? +---@param elementCount number? +---@param target number? glEnum +---@return number bindingIndex when successful, -1 otherwise +function VBO:UnbindBufferRange(index, elementOffset, elementCount, target) end + +---Logs the definition of the VBO to the console +--- +---@return nil +function VBO:DumpDefinition() end \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaVFS.lua b/rts/Lua/library/generated/LuaVFS.lua new file mode 100644 index 0000000000..3ef57a705f --- /dev/null +++ b/rts/Lua/library/generated/LuaVFS.lua @@ -0,0 +1,12 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaVFS.cpp +--- +---@meta + +---Virtual File System +--- +---@see rts/Lua/LuaVFS.cpp \ No newline at end of file diff --git a/rts/Lua/library/generated/LuaVFSDownload.lua b/rts/Lua/library/generated/LuaVFSDownload.lua new file mode 100644 index 0000000000..af5ba89eb0 --- /dev/null +++ b/rts/Lua/library/generated/LuaVFSDownload.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaVFSDownload.cpp +--- +---@meta + diff --git a/rts/Lua/library/generated/LuaWeaponDefs.lua b/rts/Lua/library/generated/LuaWeaponDefs.lua new file mode 100644 index 0000000000..85a7d5898a --- /dev/null +++ b/rts/Lua/library/generated/LuaWeaponDefs.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaWeaponDefs.cpp +--- +---@meta + diff --git a/rts/Lua/library/generated/LuaZip.lua b/rts/Lua/library/generated/LuaZip.lua new file mode 100644 index 0000000000..f89521b8d9 --- /dev/null +++ b/rts/Lua/library/generated/LuaZip.lua @@ -0,0 +1,60 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 0.0.1 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaZip.cpp +--- +---@meta + +---LuaZip +--- +---@see rts/Lua/LuaZip.cpp + +---@class LuaZipFileWriter +---@brief A Lua userdatum to write zip files +--- +---This class defines functions for a Lua userdatum to write to zip files. +---Such a userdatum supports the following methods: +---- close() : close the zipFile, after this open and write raise an error +---- open(name) : opens a new file within the zipFile (for writing) +---- write(...) : writes data to the open file within the zipFile (similar to io.write) +local LuaZipFileWriter = {} + +---@class LuaZipFileReader +---@brief A Lua userdatum to read zip files +--- +---This class defines functions for a Lua userdatum to read archive files. +---The type is currently forced to a zip-file, while allowing any file extension. +---Such a userdatum supports the following methods: +---- close() : close the archive, after this open and read raise an error +---- open(name) : opens a new file within the archive (for reading) +---- read(...) : reads data from the open file within the archive (similar to io.read) +local LuaZipFileReader = {} + +---@brief Pushes a new ZipFileWriter userdatum on the Lua stack. +--- +---If zip != nullptr: +---- the userdatum is made to point to the zipFile, +---- the zipFile will never be closed by Lua (close()->no-op, GC->no-op) +---Otherwise: +---- a new zipFile is opened (without overwrite, with directory creation) +---- this zipFile may be closed by Lua (close() or GC) + +---@brief Pushes a new ZipFileReader userdatum on the Lua stack. +--- +---If archive != nullptr: +---- the userdatum is made to point to the archive, +---- the archive will never be closed by Lua (close()->no-op, GC->no-op) +---Otherwise: +---- a new archive is opened +---- the type is currently forced to a zip-file, while allowing any file extension +---- this archive may be closed by Lua (close() or GC) + +---Similar to Lua's built-in (I/O library) read function. +--- +---Except that "*number" and *line" aren't supported; only "*all" and \ are +---supported. The special case read(0) (test for end of file) is handled. +--- +---Note that reading is only possible after a chunk has been opened using +---openchunk(). \ No newline at end of file