From 93dee8fcbc85317e1046d53e655d2f7b1cf2e01e Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Wed, 31 Dec 2025 21:18:46 +0800 Subject: [PATCH 01/40] luarc --- .luarc.json | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .luarc.json diff --git a/.luarc.json b/.luarc.json new file mode 100644 index 0000000000..613db10025 --- /dev/null +++ b/.luarc.json @@ -0,0 +1,44 @@ +{ + "$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json", + "diagnostics.globalsRegex": ["CMD_.*"], + "diagnostics.globals": [ + "VFS", + "UnitDefs", + "UnitDefNames", + "FeatureDefs", + "ModularCommDefsShared", + "piece", + "GG", + "Script", + "WG", + "widgetHandler", + "widget", + "GameData", + "Shared", + "gadget", + "DEFS", + "LOG", + "FeatureDefNames", + "SendToUnsynced", + "CMD", + "WeaponDefs", + "CMDTYPE", + "WeaponDefNames" + //,{ "name": "script", "include": "scripts/**.lua" } + ], + "runtime.version": "Lua 5.1", + "diagnostics.disable": [ + "duplicate-set-field" + ], + "runtime.special": { + "include":"require", + "VFS.Include":"require" + }, + "Lua.workspace.library": [ + "../zk-stable" + ], + "Lua.workspace.checkThirdParty": false, + "Lua.workspace.ignoreDir": [ + "scripts/**" + ] +} \ No newline at end of file From 5f8764f81a7ab9d102f1198cf3482b0dd257c574 Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Wed, 31 Dec 2025 21:19:07 +0800 Subject: [PATCH 02/40] scripts .luarc.json --- scripts/.luarc.json | 70 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 scripts/.luarc.json diff --git a/scripts/.luarc.json b/scripts/.luarc.json new file mode 100644 index 0000000000..6863e48062 --- /dev/null +++ b/scripts/.luarc.json @@ -0,0 +1,70 @@ +{ + "$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json", + "diagnostics.globalsRegex": ["CMD_.*"], + "diagnostics.globals": [ + "VFS", + "UnitDefs", + "UnitDefNames", + "FeatureDefs", + "ModularCommDefsShared", + "piece", + "GG", + "Script", + "WG", + "widgetHandler", + "widget", + "GameData", + "Shared", + "gadget", + "DEFS", + "LOG", + "FeatureDefNames", + "SendToUnsynced", + "CMD", + "WeaponDefs", + "CMDTYPE", + "WeaponDefNames", + "script", + "StartThread", + "unitID", + "y_axis", + "x_axis", + "z_axis", + "Spin", + "StopSpin", + "SetSignalMask", + "Signal", + "EmitSfx", + "unitID", + "Turn", + "WaitForTurn", + "Sleep", + "UnitDef", + "Hide", + "Move", + "Explode", + "WaitForMove", + "Show", + "unitDefID", + "GetUnitValue", + "hat", + "SetUnitValue", + "cross", + "IsInMove" + //,{ "name": "script", "include": "scripts/**.lua" } + ], + "runtime.version": "Lua 5.1", + "diagnostics.disable": [ + "duplicate-set-field", + "lowercase-global" + ], + "runtime.special": { + "include":"require", + "VFS.Include":"require" + }, + "Lua.workspace.library": [ + ".." + ], + "Lua.workspace.checkThirdParty": false + +} \ No newline at end of file From 43fb1f2105c50eb2424dbb0a483eeb4399bc4daa Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Wed, 31 Dec 2025 21:19:16 +0800 Subject: [PATCH 03/40] .typedefs --- .typedefs/LuaVFS.lua | 40 + .typedefs/Script.lua | 16 + .typedefs/SpringDefines less.lua | 127 ++ .typedefs/SpringDefines then .lua .txt | 147 ++ .typedefs/SpringDefines.lua.txt | 224 +++ .typedefs/Types.lua | 124 ++ .typedefs/generated/LuaArchive.lua | 9 + .typedefs/generated/LuaAtlasTextures.lua | 9 + .typedefs/generated/LuaBitOps.lua | 56 + .typedefs/generated/LuaConstCMD.lua | 198 +++ .typedefs/generated/LuaConstCMDTYPE.lua | 65 + .typedefs/generated/LuaConstCOB.lua | 329 ++++ .typedefs/generated/LuaConstEngine.lua | 48 + .typedefs/generated/LuaConstGL.lua | 606 +++++++ .typedefs/generated/LuaConstGame.lua | 202 +++ .typedefs/generated/LuaConstPlatform.lua | 93 + .typedefs/generated/LuaFBOs.lua | 112 ++ .typedefs/generated/LuaFeatureDefs.lua | 9 + .typedefs/generated/LuaFonts.lua | 33 + .typedefs/generated/LuaGaia.lua | 9 + .typedefs/generated/LuaHandle.lua | 831 +++++++++ .typedefs/generated/LuaHandleSynced.lua | 391 +++++ .typedefs/generated/LuaIO.lua | 9 + .typedefs/generated/LuaInputReceiver.lua | 9 + .typedefs/generated/LuaInterCall.lua | 9 + .typedefs/generated/LuaIntro.lua | 15 + .typedefs/generated/LuaMaterial.lua | 9 + .typedefs/generated/LuaMathExtra.lua | 85 + .typedefs/generated/LuaMemPool.lua | 9 + .typedefs/generated/LuaMenu.lua | 23 + .typedefs/generated/LuaMetalMap.lua | 18 + .typedefs/generated/LuaObjectRendering.lua | 9 + .typedefs/generated/LuaOpenGL.lua | 85 + .typedefs/generated/LuaOpenGLUtils.lua | 9 + .typedefs/generated/LuaParser.lua | 9 + .typedefs/generated/LuaPathFinder.lua | 9 + .typedefs/generated/LuaRBOs.lua | 38 + .typedefs/generated/LuaRules.lua | 12 + .typedefs/generated/LuaRulesParams.lua | 9 + .typedefs/generated/LuaScream.lua | 9 + .typedefs/generated/LuaShaders.lua | 220 +++ .typedefs/generated/LuaSyncedCtrl.lua | 1660 ++++++++++++++++++ .typedefs/generated/LuaSyncedMoveCtrl.lua | 12 + .typedefs/generated/LuaSyncedRead.lua | 1823 ++++++++++++++++++++ .typedefs/generated/LuaSyncedTable.lua | 9 + .typedefs/generated/LuaTableExtra.lua | 22 + .typedefs/generated/LuaTextures.lua | 9 + .typedefs/generated/LuaTracyExtra.lua | 28 + .typedefs/generated/LuaUI.lua | 10 + .typedefs/generated/LuaUICommand.lua | 9 + .typedefs/generated/LuaUnitDefs.lua | 9 + .typedefs/generated/LuaUnsyncedCtrl.lua | 1320 ++++++++++++++ .typedefs/generated/LuaUnsyncedRead.lua | 1039 +++++++++++ .typedefs/generated/LuaUtils.lua | 22 + .typedefs/generated/LuaVAO.lua | 19 + .typedefs/generated/LuaVAOImpl.lua | 76 + .typedefs/generated/LuaVBO.lua | 36 + .typedefs/generated/LuaVBOImpl.lua | 272 +++ .typedefs/generated/LuaVFS.lua | 12 + .typedefs/generated/LuaVFSDownload.lua | 9 + .typedefs/generated/LuaWeaponDefs.lua | 9 + .typedefs/generated/LuaZip.lua | 60 + .typedefs/types 2.lua.txt | 76 + 63 files changed, 10814 insertions(+) create mode 100644 .typedefs/LuaVFS.lua create mode 100644 .typedefs/Script.lua create mode 100644 .typedefs/SpringDefines less.lua create mode 100644 .typedefs/SpringDefines then .lua .txt create mode 100644 .typedefs/SpringDefines.lua.txt create mode 100644 .typedefs/Types.lua create mode 100644 .typedefs/generated/LuaArchive.lua create mode 100644 .typedefs/generated/LuaAtlasTextures.lua create mode 100644 .typedefs/generated/LuaBitOps.lua create mode 100644 .typedefs/generated/LuaConstCMD.lua create mode 100644 .typedefs/generated/LuaConstCMDTYPE.lua create mode 100644 .typedefs/generated/LuaConstCOB.lua create mode 100644 .typedefs/generated/LuaConstEngine.lua create mode 100644 .typedefs/generated/LuaConstGL.lua create mode 100644 .typedefs/generated/LuaConstGame.lua create mode 100644 .typedefs/generated/LuaConstPlatform.lua create mode 100644 .typedefs/generated/LuaFBOs.lua create mode 100644 .typedefs/generated/LuaFeatureDefs.lua create mode 100644 .typedefs/generated/LuaFonts.lua create mode 100644 .typedefs/generated/LuaGaia.lua create mode 100644 .typedefs/generated/LuaHandle.lua create mode 100644 .typedefs/generated/LuaHandleSynced.lua create mode 100644 .typedefs/generated/LuaIO.lua create mode 100644 .typedefs/generated/LuaInputReceiver.lua create mode 100644 .typedefs/generated/LuaInterCall.lua create mode 100644 .typedefs/generated/LuaIntro.lua create mode 100644 .typedefs/generated/LuaMaterial.lua create mode 100644 .typedefs/generated/LuaMathExtra.lua create mode 100644 .typedefs/generated/LuaMemPool.lua create mode 100644 .typedefs/generated/LuaMenu.lua create mode 100644 .typedefs/generated/LuaMetalMap.lua create mode 100644 .typedefs/generated/LuaObjectRendering.lua create mode 100644 .typedefs/generated/LuaOpenGL.lua create mode 100644 .typedefs/generated/LuaOpenGLUtils.lua create mode 100644 .typedefs/generated/LuaParser.lua create mode 100644 .typedefs/generated/LuaPathFinder.lua create mode 100644 .typedefs/generated/LuaRBOs.lua create mode 100644 .typedefs/generated/LuaRules.lua create mode 100644 .typedefs/generated/LuaRulesParams.lua create mode 100644 .typedefs/generated/LuaScream.lua create mode 100644 .typedefs/generated/LuaShaders.lua create mode 100644 .typedefs/generated/LuaSyncedCtrl.lua create mode 100644 .typedefs/generated/LuaSyncedMoveCtrl.lua create mode 100644 .typedefs/generated/LuaSyncedRead.lua create mode 100644 .typedefs/generated/LuaSyncedTable.lua create mode 100644 .typedefs/generated/LuaTableExtra.lua create mode 100644 .typedefs/generated/LuaTextures.lua create mode 100644 .typedefs/generated/LuaTracyExtra.lua create mode 100644 .typedefs/generated/LuaUI.lua create mode 100644 .typedefs/generated/LuaUICommand.lua create mode 100644 .typedefs/generated/LuaUnitDefs.lua create mode 100644 .typedefs/generated/LuaUnsyncedCtrl.lua create mode 100644 .typedefs/generated/LuaUnsyncedRead.lua create mode 100644 .typedefs/generated/LuaUtils.lua create mode 100644 .typedefs/generated/LuaVAO.lua create mode 100644 .typedefs/generated/LuaVAOImpl.lua create mode 100644 .typedefs/generated/LuaVBO.lua create mode 100644 .typedefs/generated/LuaVBOImpl.lua create mode 100644 .typedefs/generated/LuaVFS.lua create mode 100644 .typedefs/generated/LuaVFSDownload.lua create mode 100644 .typedefs/generated/LuaWeaponDefs.lua create mode 100644 .typedefs/generated/LuaZip.lua create mode 100644 .typedefs/types 2.lua.txt diff --git a/.typedefs/LuaVFS.lua b/.typedefs/LuaVFS.lua new file mode 100644 index 0000000000..3c1856fa0f --- /dev/null +++ b/.typedefs/LuaVFS.lua @@ -0,0 +1,40 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaVFS.cpp +--- +---@meta + +---Virtual File System +--- +---@see rts/Lua/LuaVFS.cpp + +VFS={} +---Load, compiles, run, return +---@param filename string +---@param enviroment table|nil +---@param mode number|nil +---@return any +function VFS.Include(filename,enviroment ,mode ) end + +---check whether a file exist +---@param filename string +---@param mode number|nil +---@return boolean +function VFS.FileExists(filename,mode) end + +---get a list of files +---@param directory string +---@param pattern string|nil +---@param mode number|nil +---@return {[integer]:string} +function VFS.DirList(directory,pattern,mode ) end + +---get a list of dirs +---@param directory string +---@param pattern string|nil +---@param mode number|nil +---@return {[integer]:string} +function VFS.SubDirs(directory,pattern,mode)end \ No newline at end of file diff --git a/.typedefs/Script.lua b/.typedefs/Script.lua new file mode 100644 index 0000000000..e9a5ca0ae4 --- /dev/null +++ b/.typedefs/Script.lua @@ -0,0 +1,16 @@ + + + +---@meta + + +Script={} + +---check whether ergine's version is higher than given +---@param major number +---@param minor number +---@param commit number +---@return boolean|nil +function Script.IsEngineMinVersion(major,minor,commit) + +end \ No newline at end of file diff --git a/.typedefs/SpringDefines less.lua b/.typedefs/SpringDefines less.lua new file mode 100644 index 0000000000..118701adb8 --- /dev/null +++ b/.typedefs/SpringDefines less.lua @@ -0,0 +1,127 @@ +-- ---@diagnostic disable: missing-return +---@meta Spring + +---@class table:{[any]:any} + +Spring=Spring or {} +---@class UnitId : integer +---@class UnitDefId:integer + +---@class PlayerId:integer +---@class TeamId:integer +---@class AllyteamId:integer +--[==[ +---@class timeSec:number + +---@class frame:integer +---@operator div(framePerSec):timeSec +---@class framePerSec:integer +---@operator mul(timeSec):frame + +---@class WldDist:number +---@operator div(frame):WldSpeed +---@operator add(WldDist):WldDist +---@operator add(WldSpeed):WldDist +---@alias WldxPos WldDist +---@alias WldyPos WldDist +---@alias WldzPos WldDist +--[=[ +---@class WldxPos:number +---@operator div(frame):WldxVel +---@operator add(WldxPos):WldxPos +---@operator add(WldxVel):WldxPos +---@class WldyPos:number +---@operator div(frame):WldyVel +---@operator add(WldyPos):WldyPos +---@operator add(WldyVel):WldyPos +---@class WldzPos:number +---@operator div(frame):WldzVel +---@operator add(WldzPos):WldzPos +---@operator add(WldzVel):WldzPos +]=] + +---@class WldSpeed:number +---@operator mul(frame):WldDist +---@operator unm:WldSpeed + +---@alias WldxVel WldSpeed +---@alias WldyVel WldSpeed +---@alias WldzVel WldSpeed +]==] + +Game={} +--- framePerSec +Game.gameSpeed=30 +Game.mapSizeX=512 +Game.mapSizeZ=512 + +---@type {[UnitDefId]:table} +UnitDefs={} + +---@alias WeaponDefName string + +---@class WeaponDefId:integer +---@class WeaponDef --:{id:WeaponDefId,[any]:any} +---@field id WeaponDefId +---@field name WeaponDefName +---@field damageAreaOfEffect number +---@field damages list +---@field flightTime number +---@field projectilespeed number +---@field range number +---@field reload number +---@field salvoSize number +---@field salvoDelay number +---@field projectiles number +---@field type string +---@field beamTTL number +---@field tracks boolean +---@field sprayAngle number +---@field craterMult number +---@field myGravity number +---@field customParams {[string]:string|number|nil} +---@field accuracy number +---@field turret boolean +---@field explosionSpeed number + + +---@type table +WeaponDefs={} + +---@type table +WeaponDefNames={} + + +---@class ProjectileId:number + + +--[=[ +---@class WldxVel:number +---@operator mul(frame):WldxPos +---@operator add(WldxVel):WldxVel +---@operator sub(WldxVel):WldxVel +---@operator unm:WldxVel +---@class WldyVel:number +---@operator mul(frame):WldyPos +---@operator add(WldyVel):WldyVel +---@operator sub(WldyVel):WldyVel +---@operator unm:WldyVel +---@class WldzVel:number +---@operator mul(frame):WldzPos +---@operator add(WldzVel):WldzVel +---@operator sub(WldzVel):WldzVel +---@operator unm:WldzVel +]=] + +--- show message to console. `"game_message: ".. msg` to show `msg` at chat (client only) +---@param ... any message to be shown +function Spring.Echo(...)end + +--CMD={} + +---@generic T +---@param v T +---@param recurse boolean|nil +---@param appendTo T|nil +---@return T +function Spring.Utilities.CopyTable(v,recurse,appendTo) end \ No newline at end of file diff --git a/.typedefs/SpringDefines then .lua .txt b/.typedefs/SpringDefines then .lua .txt new file mode 100644 index 0000000000..616f8daf2d --- /dev/null +++ b/.typedefs/SpringDefines then .lua .txt @@ -0,0 +1,147 @@ + +--[=[ +---@class WldxVel:number +---@operator mul(frame):WldxPos +---@operator add(WldxVel):WldxVel +---@operator sub(WldxVel):WldxVel +---@operator unm:WldxVel +---@class WldyVel:number +---@operator mul(frame):WldyPos +---@operator add(WldyVel):WldyVel +---@operator sub(WldyVel):WldyVel +---@operator unm:WldyVel +---@class WldzVel:number +---@operator mul(frame):WldzPos +---@operator add(WldzVel):WldzVel +---@operator sub(WldzVel):WldzVel +---@operator unm:WldzVel +]=] + +--- show message to console. `"game_message: ".. msg` to show `msg` at chat (client only) +---@param ... any message to be shown +function Spring.Echo(...)end + + +---@param UnitId UnitId +---@return UnitDefId +---@nodiscard +function Spring.GetUnitDefID(UnitId)end + +---check whether UnitId is valid +---@param UnitId UnitId +---@return boolean +function Spring.ValidUnitID(UnitId)end + +---check whether unit is dead +---@param UnitId UnitId +---@return boolean +function Spring.GetUnitIsDead(UnitId)end + +---check whether unit belongs to you +---@param UnitId UnitId +function Spring.IsUnitAllied(UnitId)end + +--- return unit's base position (bottom),
+--- unit's middle position with returnMidPos
+--- unit's aim position with returnAimPos
+--- extra values are pushed behind
+--- eg `posx,posy,posz,aimx,aimy,aimz=spGetUnitPosition(UnitId,false,true)` +---@param UnitId UnitId +---@return WldxPos +---@return WldyPos +---@return WldzPos +---@return WldxPos +---@return WldyPos +---@return WldzPos +---@return WldxPos +---@return WldyPos +---@return WldzPos +function Spring.GetUnitPosition(UnitId,returnMidPos,returnAimPos)end + +---@param UnitId UnitId +---@return WldxVel +---@return WldyVel +---@return WldzVel +---@return WldSpeed +function Spring.GetUnitVelocity(UnitId)end + +--- get the height of the ground at the pos +---@param x WldxPos +---@param z WldzPos +---@return WldyPos +function Spring.GetGroundHeight(x,z)end + +---@return AllyteamId +function Spring.GetMyAllyTeamID()end + +---@return TeamId +function Spring.GetMyTeamID()end + +--- return true when spec +---@return boolean +function Spring.GetSpectatingState()end + +---whether pos is in radar of AllyteamId +---@param x WldxPos +---@param y WldyPos +---@param z WldzPos +---@param AllyteamId AllyteamId +---@return boolean +function Spring.IsPosInRadar(x,y,z,AllyteamId)end + +---whether pos is in los of AllyteamId +---@param x WldxPos +---@param y WldyPos +---@param z WldzPos +---@param AllyteamId AllyteamId +---@return boolean +function Spring.IsPosInLos(x,y,z,AllyteamId)end + +---add a marker +---@param x WldxPos +---@param y WldyPos +---@param z WldzPos +---@param msg string +---@param onlyLocal boolean|nil true to add marker to local only +function Spring.MarkerAddPoint(x,y,z,msg,onlyLocal)end + +---remove marker at pos +---@param x WldxPos +---@param y WldyPos +---@param z WldzPos +function Spring.MarkerErasePosition(x,y,z)end + +---returns units in Cylinder +---@param x WldxPos +---@param z WldzPos +---@param radius WldDist +---@param TeamId TeamId +---@return list +function Spring.GetUnitsInCylinder(x,z,radius,TeamId)end + + +---comment +---@param projectileID ProjectileId +---@return WldxPos +---@return WldyPos +---@return WldzPos +function Spring.GetProjectilePosition(projectileID)end + + +---@param projectileID ProjectileId +---@return WldxVel +---@return WldyVel +---@return WldzVel +function Spring.GetProjectileVelocity(projectileID)end + +---@param projId ProjectileId +---@return WeaponDefId +function Spring.GetProjectileDefID(projId)end + +CMD={} + +---@generic T +---@param v T +---@param recurse boolean|nil +---@return T +function Spring.Utilities.CopyTable(v,recurse) end \ No newline at end of file diff --git a/.typedefs/SpringDefines.lua.txt b/.typedefs/SpringDefines.lua.txt new file mode 100644 index 0000000000..507dc165c0 --- /dev/null +++ b/.typedefs/SpringDefines.lua.txt @@ -0,0 +1,224 @@ +-- ---@diagnostic disable: missing-return +---@meta Spring + +Spring=Spring or {} +---@class UnitId : integer +---@class UnitDefId:integer + +---@class PlayerId:integer +---@class TeamId:integer +---@class AllyteamId:integer + +---@class timeSec:number + +---@class frame:integer +---@operator div(framePerSec):timeSec +---@class framePerSec:integer +---@operator mul(timeSec):frame + +---@class WldDist:number +---@operator div(frame):WldSpeed +---@operator add(WldDist):WldDist +---@operator add(WldSpeed):WldDist +---@alias WldxPos WldDist +---@alias WldyPos WldDist +---@alias WldzPos WldDist +--[=[ +---@class WldxPos:number +---@operator div(frame):WldxVel +---@operator add(WldxPos):WldxPos +---@operator add(WldxVel):WldxPos +---@class WldyPos:number +---@operator div(frame):WldyVel +---@operator add(WldyPos):WldyPos +---@operator add(WldyVel):WldyPos +---@class WldzPos:number +---@operator div(frame):WldzVel +---@operator add(WldzPos):WldzPos +---@operator add(WldzVel):WldzPos +]=] + +---@class WldSpeed:number +---@operator mul(frame):WldDist +---@operator unm:WldSpeed + +---@alias WldxVel WldSpeed +---@alias WldyVel WldSpeed +---@alias WldzVel WldSpeed + + +Game={} +--- framePerSec +---@type framePerSec +Game.gameSpeed=30 +---@type WldxPos +Game.mapSizeX=512 +---@type WldzPos +Game.mapSizeZ=512 + + +---@class WeaponDefId:integer +---@class WeaponDefName:string +---@class WeaponDef:any --:{id:WeaponDefId,[any]:any} +---@field id WeaponDefId +---@field name WeaponDefName +---@field damageAreaOfEffect number +---@field damages list +---@field flightTime number + +---@type table +WeaponDefs={} + +---@type table +WeaponDefNames={} + + +---@class ProjectileId:number + + +--[=[ +---@class WldxVel:number +---@operator mul(frame):WldxPos +---@operator add(WldxVel):WldxVel +---@operator sub(WldxVel):WldxVel +---@operator unm:WldxVel +---@class WldyVel:number +---@operator mul(frame):WldyPos +---@operator add(WldyVel):WldyVel +---@operator sub(WldyVel):WldyVel +---@operator unm:WldyVel +---@class WldzVel:number +---@operator mul(frame):WldzPos +---@operator add(WldzVel):WldzVel +---@operator sub(WldzVel):WldzVel +---@operator unm:WldzVel +]=] + +--- show message to console. `"game_message: ".. msg` to show `msg` at chat (client only) +---@param ... any message to be shown +function Spring.Echo(...)end + + +---@param UnitId UnitId +---@return UnitDefId +---@nodiscard +function Spring.GetUnitDefID(UnitId)end + +---check whether UnitId is valid +---@param UnitId UnitId +---@return boolean +function Spring.ValidUnitID(UnitId)end + +---check whether unit is dead +---@param UnitId UnitId +---@return boolean +function Spring.GetUnitIsDead(UnitId)end + +---check whether unit belongs to you +---@param UnitId UnitId +function Spring.IsUnitAllied(UnitId)end + +--- return unit's base position (bottom),
+--- unit's middle position with returnMidPos
+--- unit's aim position with returnAimPos
+--- extra values are pushed behind
+--- eg `posx,posy,posz,aimx,aimy,aimz=spGetUnitPosition(UnitId,false,true)` +---@param UnitId UnitId +---@return WldxPos +---@return WldyPos +---@return WldzPos +---@return WldxPos +---@return WldyPos +---@return WldzPos +---@return WldxPos +---@return WldyPos +---@return WldzPos +function Spring.GetUnitPosition(UnitId,returnMidPos,returnAimPos)end + +---@param UnitId UnitId +---@return WldxVel +---@return WldyVel +---@return WldzVel +---@return WldSpeed +function Spring.GetUnitVelocity(UnitId)end + +--- get the height of the ground at the pos +---@param x WldxPos +---@param z WldzPos +---@return WldyPos +function Spring.GetGroundHeight(x,z)end + +---@return AllyteamId +function Spring.GetMyAllyTeamID()end + +---@return TeamId +function Spring.GetMyTeamID()end + +--- return true when spec +---@return boolean +function Spring.GetSpectatingState()end + +---whether pos is in radar of AllyteamId +---@param x WldxPos +---@param y WldyPos +---@param z WldzPos +---@param AllyteamId AllyteamId +---@return boolean +function Spring.IsPosInRadar(x,y,z,AllyteamId)end + +---whether pos is in los of AllyteamId +---@param x WldxPos +---@param y WldyPos +---@param z WldzPos +---@param AllyteamId AllyteamId +---@return boolean +function Spring.IsPosInLos(x,y,z,AllyteamId)end + +---add a marker +---@param x WldxPos +---@param y WldyPos +---@param z WldzPos +---@param msg string +---@param onlyLocal boolean|nil true to add marker to local only +function Spring.MarkerAddPoint(x,y,z,msg,onlyLocal)end + +---remove marker at pos +---@param x WldxPos +---@param y WldyPos +---@param z WldzPos +function Spring.MarkerErasePosition(x,y,z)end + +---returns units in Cylinder +---@param x WldxPos +---@param z WldzPos +---@param radius WldDist +---@param TeamId TeamId +---@return list +function Spring.GetUnitsInCylinder(x,z,radius,TeamId)end + + +---comment +---@param projectileID ProjectileId +---@return WldxPos +---@return WldyPos +---@return WldzPos +function Spring.GetProjectilePosition(projectileID)end + + +---@param projectileID ProjectileId +---@return WldxVel +---@return WldyVel +---@return WldzVel +function Spring.GetProjectileVelocity(projectileID)end + +---@param projId ProjectileId +---@return WeaponDefId +function Spring.GetProjectileDefID(projId)end + +CMD={} + +---@generic T +---@param v T +---@param recurse boolean|nil +---@return T +function Spring.Utilities.CopyTable(v,recurse) end \ No newline at end of file diff --git a/.typedefs/Types.lua b/.typedefs/Types.lua new file mode 100644 index 0000000000..2473b41163 --- /dev/null +++ b/.typedefs/Types.lua @@ -0,0 +1,124 @@ +---@meta + +-------------------------------------------------------------------------------- +-- Vectors +-------------------------------------------------------------------------------- + +---Cartesian triple (XYZ) +--- +---@class xyz:{[1]:number,[2]:number,[3]:number} +--[=[ +---@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 Alt key pressed +---@field ctrl boolean Ctrl key pressed +---@field shift boolean Shift key pressed +---@field right boolean Right mouse key pressed +---@field meta boolean Meta key pressed (space) +---@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 + + +---@class list:{[integer]:T} \ No newline at end of file diff --git a/.typedefs/generated/LuaArchive.lua b/.typedefs/generated/LuaArchive.lua new file mode 100644 index 0000000000..777c2fefce --- /dev/null +++ b/.typedefs/generated/LuaArchive.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaArchive.cpp +--- +---@meta + diff --git a/.typedefs/generated/LuaAtlasTextures.lua b/.typedefs/generated/LuaAtlasTextures.lua new file mode 100644 index 0000000000..839d5d9fb5 --- /dev/null +++ b/.typedefs/generated/LuaAtlasTextures.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaAtlasTextures.cpp +--- +---@meta + diff --git a/.typedefs/generated/LuaBitOps.lua b/.typedefs/generated/LuaBitOps.lua new file mode 100644 index 0000000000..19fd7bab39 --- /dev/null +++ b/.typedefs/generated/LuaBitOps.lua @@ -0,0 +1,56 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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 ... integer +---@return integer result +function math.bit_or(...) end + +---Returns the bitwise AND of all arguments. Only use up to 24 bit integers. +--- +---@param ... integer +---@return integer result +function math.bit_and(...) end + +---Returns the bitwise XOR of all arguments. Only use up to 24 bit integers. +--- +---@param ... integer +---@return integer result +function math.bit_xor(...) 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 ... integer +---@return integer result +function math.bit_bits(...) end \ No newline at end of file diff --git a/.typedefs/generated/LuaConstCMD.lua b/.typedefs/generated/LuaConstCMD.lua new file mode 100644 index 0000000000..fadea4a34c --- /dev/null +++ b/.typedefs/generated/LuaConstCMD.lua @@ -0,0 +1,198 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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/.typedefs/generated/LuaConstCMDTYPE.lua b/.typedefs/generated/LuaConstCMDTYPE.lua new file mode 100644 index 0000000000..f7c4cd8ed9 --- /dev/null +++ b/.typedefs/generated/LuaConstCMDTYPE.lua @@ -0,0 +1,65 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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/.typedefs/generated/LuaConstCOB.lua b/.typedefs/generated/LuaConstCOB.lua new file mode 100644 index 0000000000..78ea55866f --- /dev/null +++ b/.typedefs/generated/LuaConstCOB.lua @@ -0,0 +1,329 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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/.typedefs/generated/LuaConstEngine.lua b/.typedefs/generated/LuaConstEngine.lua new file mode 100644 index 0000000000..2e05d4c58d --- /dev/null +++ b/.typedefs/generated/LuaConstEngine.lua @@ -0,0 +1,48 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaConstEngine.cpp +--- +---@meta + +---Engine constants +--- +---@see rts/Lua/LuaConstEngine.cpp + +---@class FeatureSupport +---@field NegativeGetUnitCurrentCommand boolean +---@field hasExitOnlyYardmaps boolean +---@field rmlUiApiVersion integer +local FeatureSupport = {} + +---Engine specific information. +Engine = { + ---@type string "Major.Minor.PatchSet" for releases, "Major.Minor.PatchSet-CommitNum-gHash branch" otherwise + version = nil, + + ---@type string "Major.Minor.PatchSet" for releases, "Major.Minor.PatchSet-CommitNum-gHash branch" otherwise. Will also include (buildFlags), if there're any. + versionFull = nil, + + ---@type string Major part of the named release version + versionMajor = nil, + + ---@type string Minor part of the named release version + versionMinor = nil, + + ---@type string Build number of the named release version + versionPatchSet = nil, + + ---@type string Number of commits after the latest named release, non-zero indicates a "dev" build + commitsNumber = nil, + + ---@type string Gets additional engine buildflags, e.g. "Debug" or "Sync-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 always 64 these days + wordSize = nil +} \ No newline at end of file diff --git a/.typedefs/generated/LuaConstGL.lua b/.typedefs/generated/LuaConstGL.lua new file mode 100644 index 0000000000..189898ce2d --- /dev/null +++ b/.typedefs/generated/LuaConstGL.lua @@ -0,0 +1,606 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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 + 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 + 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, + + ---??? + ---@type number + LINE_BITS=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 + +---OpenGL Object Types +--- +---@section objecttypes + +---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/.typedefs/generated/LuaConstGame.lua b/.typedefs/generated/LuaConstGame.lua new file mode 100644 index 0000000000..408f3df43e --- /dev/null +++ b/.typedefs/generated/LuaConstGame.lua @@ -0,0 +1,202 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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/.typedefs/generated/LuaConstPlatform.lua b/.typedefs/generated/LuaConstPlatform.lua new file mode 100644 index 0000000000..d96cff0a17 --- /dev/null +++ b/.typedefs/generated/LuaConstPlatform.lua @@ -0,0 +1,93 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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 + gladVersion = 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 number Total physical system RAM in MBs. + totalRAM = 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/.typedefs/generated/LuaFBOs.lua b/.typedefs/generated/LuaFBOs.lua new file mode 100644 index 0000000000..1d59f17477 --- /dev/null +++ b/.typedefs/generated/LuaFBOs.lua @@ -0,0 +1,112 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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 `GLAD_GL_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 `GLAD_GL_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 + +---needs `Platform.glVersionNum >= 30` +---Clears the "attachment" of the currently bound FBO type "target" with "clearValues" +--- +---@param target number? (Default: GL.FRAMEBUFFER) +---@param attachment GL|string (e.g. `"color0"` or `GL.COLOR_ATTACHMENT0`) +---@param clearValue0 number +---@param clearValue1 number +---@param clearValue2 number +---@param clearValue3 number +function gl.ClearAttachmentFBO(target, attachment, clearValue0, clearValue1, clearValue2, clearValue3) end \ No newline at end of file diff --git a/.typedefs/generated/LuaFeatureDefs.lua b/.typedefs/generated/LuaFeatureDefs.lua new file mode 100644 index 0000000000..4cc07ea9e1 --- /dev/null +++ b/.typedefs/generated/LuaFeatureDefs.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaFeatureDefs.cpp +--- +---@meta + diff --git a/.typedefs/generated/LuaFonts.lua b/.typedefs/generated/LuaFonts.lua new file mode 100644 index 0000000000..5546f1fbc7 --- /dev/null +++ b/.typedefs/generated/LuaFonts.lua @@ -0,0 +1,33 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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). +--- +---@param filePath string VFS path to the file, for example "fonts/myfont.ttf". Uses VFS.RAW_FIRST access mode. +---@return boolean success +function gl.AddFallbackFont(filePath) end + +---Clears all fallback fonts. +--- +---See the note at 'AddFallbackFont' about the 'FontsChanged' callin, +---it also applies when calling this method. +--- +---@return nil +function gl.ClearFallbackFonts() end \ No newline at end of file diff --git a/.typedefs/generated/LuaGaia.lua b/.typedefs/generated/LuaGaia.lua new file mode 100644 index 0000000000..1a030a00e0 --- /dev/null +++ b/.typedefs/generated/LuaGaia.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaGaia.cpp +--- +---@meta + diff --git a/.typedefs/generated/LuaHandle.lua b/.typedefs/generated/LuaHandle.lua new file mode 100644 index 0000000000..a5e7e46c91 --- /dev/null +++ b/.typedefs/generated/LuaHandle.lua @@ -0,0 +1,831 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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 UnitDefId +---@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 UnitDefId +---@param unitTeam integer +function UnitFinished(unitID, unitDefID, unitTeam) end + +---Called when a factory finishes construction of a unit. +--- +---@param unitID integer +---@param unitDefID UnitDefId +---@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 UnitDefId +---@param unitTeam integer +function UnitReverseBuilt(unitID, unitDefID, unitTeam) end + +---Called when a unit being built starts decaying. +--- +---@param unitID integer +---@param unitDefID UnitDefId +---@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 UnitDefId +---@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 UnitDefId +---@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 UnitDefId +---@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 UnitDefId +---@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 UnitDefId +---@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 UnitDefId +---@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 UnitDefId +---@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 UnitDefId +---@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 UnitDefId +---@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 UnitDefId +---@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 UnitDefId +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 UnitDefId +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 UnitDefId +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 UnitDefId +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 UnitDefId +function UnitLeftLos(unitID, unitTeam, allyTeam, unitDefID) end + +---Transport +--- +---@section transport + +---Called when a unit is loaded by a transport. +--- +---@param unitID integer +---@param unitDefID UnitDefId +---@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 UnitDefId +---@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 UnitDefId +---@param unitTeam integer +function UnitEnteredUnderwater(unitID, unitDefID, unitTeam) end + +---@param unitID integer +---@param unitDefID UnitDefId +---@param unitTeam integer +function UnitEnteredWater(unitID, unitDefID, unitTeam) end + +---@param unitID integer +---@param unitDefID UnitDefId +---@param unitTeam integer +function UnitLeftAir(unitID, unitDefID, unitTeam) end + +---@param unitID integer +---@param unitDefID UnitDefId +---@param unitTeam integer +function UnitLeftUnderwater(unitID, unitDefID, unitTeam) end + +---@param unitID integer +---@param unitDefID UnitDefId +---@param unitTeam integer +function UnitLeftWater(unitID, unitDefID, unitTeam) end + +---@param unitID integer +---@param unitDefID UnitDefId +---@param unitTeam integer +function UnitEnteredAir(unitID, unitDefID, unitTeam) end + +---Called when a unit cloaks. +--- +---@param unitID integer +---@param unitDefID UnitDefId +---@param unitTeam integer +function UnitCloaked(unitID, unitDefID, unitTeam) end + +---Called when a unit decloaks. +--- +---@param unitID integer +---@param unitDefID UnitDefId +---@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 UnitDefId +---@param unitTeam integer +function UnitMoveFailed(unitID, unitDefID, unitTeam) end + +---@param unitID integer +---@param unitDefID UnitDefId +---@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 UnitDefId +---@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 UnitDefId +---@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 cmdType integer? +function ActiveCommandChanged(cmdId, cmdType) 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/.typedefs/generated/LuaHandleSynced.lua b/.typedefs/generated/LuaHandleSynced.lua new file mode 100644 index 0000000000..5bcc72dc30 --- /dev/null +++ b/.typedefs/generated/LuaHandleSynced.lua @@ -0,0 +1,391 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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 UnitDefId +---@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 UnitDefId +---@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 UnitDefId +---@param builderID UnitId +---@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 UnitDefId +---@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 UnitId +---@param builderTeam integer +---@param unitID integer +---@param unitDefID UnitDefId +---@param part number +---@return boolean whether or not the build makes progress. +function AllowUnitBuildStep(builderID, builderTeam, unitID, unitDefID, part) end + +---@param builderID UnitId +---@param builderTeam integer +---@param unitID integer +---@param unitDefID UnitDefId +---@param part number +---@return boolean whether or not the capture makes progress. +function AllowUnitCaptureStep(builderID, builderTeam, unitID, unitDefID, part) end + +---@param transporterID UnitId +---@param transporterUnitDefID UnitDefId +---@param transporterTeam integer +---@param transporteeID integer +---@param transporteeUnitDefID UnitDefId +---@param transporteeTeam integer +---@return boolean whether or not the transport is allowed +function AllowUnitTransport(transporterID, transporterUnitDefID, transporterTeam, transporteeID, transporteeUnitDefID, transporteeTeam) end + +---@param transporterID UnitId +---@param transporterUnitDefID UnitDefId +---@param transporterTeam integer +---@param transporteeID integer +---@param transporteeUnitDefID UnitDefId +---@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 UnitId +---@param transporterUnitDefID UnitDefId +---@param transporterTeam integer +---@param transporteeID integer +---@param transporteeUnitDefID UnitDefId +---@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 TeamId +---@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 resurrect 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 UnitId +---@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 TeamId +---@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 TeamId +---@param newTeamID TeamId +---@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 UnitDefId +---@param unitTeam integer +---@param playerID PlayerId +---@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 UnitDefId +---@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 PlayerId +---@param teamID TeamId +---@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 UnitDefId +---@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 UnitDefId +---@param unitTeam integer +---@param buildUnitID integer +---@param buildUnitDefID UnitDefId +---@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 UnitDefId +---@param unitTeam integer +---@param damage number +---@param paralyzer boolean +---@param weaponDefID integer? Synced Only +---@param projectileID integer? Synced Only +---@param attackerID UnitId? 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 UnitId +---@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 UnitId +---@param shieldWeaponNum integer +---@param shieldCarrierID UnitId +---@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 UnitId +---@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 UnitId +---@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/.typedefs/generated/LuaIO.lua b/.typedefs/generated/LuaIO.lua new file mode 100644 index 0000000000..37fbc9b896 --- /dev/null +++ b/.typedefs/generated/LuaIO.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaIO.cpp +--- +---@meta + diff --git a/.typedefs/generated/LuaInputReceiver.lua b/.typedefs/generated/LuaInputReceiver.lua new file mode 100644 index 0000000000..be0ff925c6 --- /dev/null +++ b/.typedefs/generated/LuaInputReceiver.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaInputReceiver.cpp +--- +---@meta + diff --git a/.typedefs/generated/LuaInterCall.lua b/.typedefs/generated/LuaInterCall.lua new file mode 100644 index 0000000000..529034812e --- /dev/null +++ b/.typedefs/generated/LuaInterCall.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaInterCall.cpp +--- +---@meta + diff --git a/.typedefs/generated/LuaIntro.lua b/.typedefs/generated/LuaIntro.lua new file mode 100644 index 0000000000..f8e9b44776 --- /dev/null +++ b/.typedefs/generated/LuaIntro.lua @@ -0,0 +1,15 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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/.typedefs/generated/LuaMaterial.lua b/.typedefs/generated/LuaMaterial.lua new file mode 100644 index 0000000000..4a5c874d72 --- /dev/null +++ b/.typedefs/generated/LuaMaterial.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaMaterial.cpp +--- +---@meta + diff --git a/.typedefs/generated/LuaMathExtra.lua b/.typedefs/generated/LuaMathExtra.lua new file mode 100644 index 0000000000..9016636b05 --- /dev/null +++ b/.typedefs/generated/LuaMathExtra.lua @@ -0,0 +1,85 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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/.typedefs/generated/LuaMemPool.lua b/.typedefs/generated/LuaMemPool.lua new file mode 100644 index 0000000000..951cb96b4b --- /dev/null +++ b/.typedefs/generated/LuaMemPool.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaMemPool.cpp +--- +---@meta + diff --git a/.typedefs/generated/LuaMenu.lua b/.typedefs/generated/LuaMenu.lua new file mode 100644 index 0000000000..929f65eeb6 --- /dev/null +++ b/.typedefs/generated/LuaMenu.lua @@ -0,0 +1,23 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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/.typedefs/generated/LuaMetalMap.lua b/.typedefs/generated/LuaMetalMap.lua new file mode 100644 index 0000000000..3b54a9c8ff --- /dev/null +++ b/.typedefs/generated/LuaMetalMap.lua @@ -0,0 +1,18 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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/.typedefs/generated/LuaObjectRendering.lua b/.typedefs/generated/LuaObjectRendering.lua new file mode 100644 index 0000000000..60f97cd703 --- /dev/null +++ b/.typedefs/generated/LuaObjectRendering.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaObjectRendering.cpp +--- +---@meta + diff --git a/.typedefs/generated/LuaOpenGL.lua b/.typedefs/generated/LuaOpenGL.lua new file mode 100644 index 0000000000..f87907e8f0 --- /dev/null +++ b/.typedefs/generated/LuaOpenGL.lua @@ -0,0 +1,85 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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 + +---@class GLenum:number +---@class GLuint:number + +--- +---labels an object for use with debugging tools +--- +---@param objectTypeIdentifier GLenum Specifies the type of object being labeled. +---@param objectID GLuint Specifies the name or ID of the object to label. +---@param label string A string containing the label to be assigned to the object. +---@return nil +function gl.ObjectLabel(objectTypeIdentifier, objectID, label) end + +--- +---pushes a debug marker for nVidia nSight 2024.04, does not seem to work when FBO's are raw bound +--- +---@param id GLuint A numeric identifier for the group. +---@param message string A human-readable string describing the debug group. +---@param sourceIsThirdParty boolean Set the source tag, true for GL_DEBUG_SOURCE_THIRD_PARTY, false for GL_DEBUG_SOURCE_APPLICATION. default false +---@return nil +function gl.PushDebugGroup(id, message, sourceIsThirdParty) end + +---@return nil +function gl.PopDebugGroup() end \ No newline at end of file diff --git a/.typedefs/generated/LuaOpenGLUtils.lua b/.typedefs/generated/LuaOpenGLUtils.lua new file mode 100644 index 0000000000..6a08557a61 --- /dev/null +++ b/.typedefs/generated/LuaOpenGLUtils.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaOpenGLUtils.cpp +--- +---@meta + diff --git a/.typedefs/generated/LuaParser.lua b/.typedefs/generated/LuaParser.lua new file mode 100644 index 0000000000..f30c9e91e2 --- /dev/null +++ b/.typedefs/generated/LuaParser.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaParser.cpp +--- +---@meta + diff --git a/.typedefs/generated/LuaPathFinder.lua b/.typedefs/generated/LuaPathFinder.lua new file mode 100644 index 0000000000..96dbcf9ef8 --- /dev/null +++ b/.typedefs/generated/LuaPathFinder.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaPathFinder.cpp +--- +---@meta + diff --git a/.typedefs/generated/LuaRBOs.lua b/.typedefs/generated/LuaRBOs.lua new file mode 100644 index 0000000000..b1d3e4ca8a --- /dev/null +++ b/.typedefs/generated/LuaRBOs.lua @@ -0,0 +1,38 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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/.typedefs/generated/LuaRules.lua b/.typedefs/generated/LuaRules.lua new file mode 100644 index 0000000000..87a71920e3 --- /dev/null +++ b/.typedefs/generated/LuaRules.lua @@ -0,0 +1,12 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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/.typedefs/generated/LuaRulesParams.lua b/.typedefs/generated/LuaRulesParams.lua new file mode 100644 index 0000000000..1bd6514795 --- /dev/null +++ b/.typedefs/generated/LuaRulesParams.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaRulesParams.cpp +--- +---@meta + diff --git a/.typedefs/generated/LuaScream.lua b/.typedefs/generated/LuaScream.lua new file mode 100644 index 0000000000..1ef3bd8bdf --- /dev/null +++ b/.typedefs/generated/LuaScream.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaScream.cpp +--- +---@meta + diff --git a/.typedefs/generated/LuaShaders.lua b/.typedefs/generated/LuaShaders.lua new file mode 100644 index 0000000000..ac61d8ba75 --- /dev/null +++ b/.typedefs/generated/LuaShaders.lua @@ -0,0 +1,220 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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 "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. +---@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 already 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 whether 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/.typedefs/generated/LuaSyncedCtrl.lua b/.typedefs/generated/LuaSyncedCtrl.lua new file mode 100644 index 0000000000..1c50a63b9f --- /dev/null +++ b/.typedefs/generated/LuaSyncedCtrl.lua @@ -0,0 +1,1660 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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 AllyteamId +---@param secondAllyTeamID AllyteamId +---@param ally boolean +---@return nil +function Spring.SetAlly(firstAllyTeamID, secondAllyTeamID, ally) end + +---Changes the start box position of an allyTeam. +--- +---@param allyTeamID AllyteamId +---@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 PlayerId +---@param teamID TeamId +---@return nil +function Spring.AssignPlayerToTeam(playerID, teamID) end + +---Changes access to global line of sight for a team and its allies. +--- +---@param allyTeamID AllyteamId +---@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 TeamId +---@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 ... AllyteamId +---@return nil +function Spring.GameOver(...) 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 TeamId +---@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 TeamId +---@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 TeamId +---@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 TeamId +---@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 TeamId +---@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 +---environments! With those losAccess policies you can limit their access. +--- +---All GameRulesParam are public, TeamRulesParams can just be `private`,`allied` and/or `public` +---You can read RulesParams from any Lua environments! With those losAccess policies you can limit their access. +--- +---@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. +---@param losAccess losAccess? +---@return nil +function Spring.SetGameRulesParam(paramName, paramValue, losAccess) end + +---@param teamID TeamId +---@param paramName string +---@param paramValue ?number|string numeric paramValues in quotes will be converted to number. +---@param losAccess losAccess? +---@return nil +function Spring.SetTeamRulesParam(teamID, paramName, paramValue, losAccess) end + +---@param playerID PlayerId +---@param paramName string +---@param paramValue ?number|string numeric paramValues in quotes will be converted to number. +---@param losAccess losAccess? +---@return nil +function Spring.SetPlayerRulesParam(playerID, paramName, paramValue, losAccess) end + +---@param unitID UnitId +---@param paramName string +---@param paramValue ?number|string numeric paramValues in quotes will be converted to number. +---@param losAccess losAccess? +---@return nil +function Spring.SetUnitRulesParam(unitID, paramName, paramValue, losAccess) end + +---@param featureID integer +---@param paramName string +---@param paramValue ?number|string numeric paramValues in quotes will be converted to number. +---@param losAccess losAccess? +---@return nil +function Spring.SetFeatureRulesParam(featureID, paramName, paramValue, losAccess) end + +---Lua to COB +--- +---@section luatocob + +---@param unitID UnitId +---@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 UnitId +---@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 Facing +---@param teamID TeamId +---@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 UnitId? requests specific unitID +---@param builderID UnitId? +---@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 UnitId +---@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 UnitId? +---@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 UnitId +---@param newTeamID TeamId +---@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 UnitId +---@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 UnitId +---@param res string +---@param amount number +---@return nil +function Spring.SetUnitResourcing(unitID, res, amount) end + +---@param unitID UnitId +---@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 + +---Unit Storage +--- +---@section unitstorage + +---@param unitID UnitId +---@param res string +---@param amount number +function Spring.SetUnitStorage(unitID, res, amount) end + +---@param unitID UnitId +---@param res ResourceUsage keys are: "[m|e]" metal | energy. Values are amounts +function Spring.SetUnitStorage(unitID, res) end + +---@param unitID UnitId +---@param tooltip string +---@return nil +function Spring.SetUnitTooltip(unitID, tooltip) end + +---@param unitID UnitId +---@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 UnitId +---@param maxHealth number +---@return nil +function Spring.SetUnitMaxHealth(unitID, maxHealth) end + +---@param unitID UnitId +---@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 UnitId +---@param forceUseWeapons number? +---@param allowUseWeapons number? +---@return nil +function Spring.SetUnitUseWeapons(unitID, forceUseWeapons, allowUseWeapons) end + +---@param unitID UnitId +---@param weaponNum number +---@param states WeaponState +---@return nil +function Spring.SetUnitWeaponState(unitID, weaponNum, states) end + +---@param unitID UnitId +---@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 UnitId +---@param weaponNum number|"selfDestruct"|"explode" +---@param damages WeaponDamages +---@return nil +function Spring.SetUnitWeaponDamages(unitID, weaponNum, damages) end + +---@param unitID UnitId +---@param weaponNum number|"selfDestruct"|"explode" +---@param key string +---@param value number +---@return nil +function Spring.SetUnitWeaponDamages(unitID, weaponNum, key, value) end + +---@param unitID UnitId +---@param maxRange number +---@return nil +function Spring.SetUnitMaxRange(unitID, maxRange) end + +---@see Spring.AddUnitExperience +---@see Spring.GetUnitExperience +---@param unitID UnitId +---@param experience number +---@return nil +function Spring.SetUnitExperience(unitID, experience) end + +---@see Spring.SetUnitExperience +---@see Spring.GetUnitExperience +---@param unitID UnitId +---@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 UnitId +---@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 UnitId +---@param allyTeam AllyteamId +---@param losTypes number|table +---@return nil +function Spring.SetUnitLosMask(unitID, allyTeam, losTypes) end + +---@param unitID UnitId +---@param allyTeam AllyteamId +---@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:=ultimate 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 UnitId +---@param cloak boolean|number +---@param cloakArg boolean|number|nil +---@return nil +function Spring.SetUnitCloak(unitID, cloak, cloakArg) end + +---@param unitID UnitId +---@param stealth boolean +---@return nil +function Spring.SetUnitStealth(unitID, stealth) end + +---@param unitID UnitId +---@param sonarStealth boolean +---@return nil +function Spring.SetUnitSonarStealth(unitID, sonarStealth) end + +---@param unitID UnitId +---@param seismicSignature number +---@return nil +function Spring.SetUnitSeismicSignature(unitID, seismicSignature) end + +---@param unitID UnitId +---@param alwaysVisible boolean +---@return nil +function Spring.SetUnitAlwaysVisible(unitID, alwaysVisible) end + +---@param unitID UnitId +---@param useAirLos boolean +---@return nil +function Spring.SetUnitUseAirLos(unitID, useAirLos) end + +---@param unitID UnitId +---@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 UnitId +---@param metal number +---@return nil +function Spring.SetUnitHarvestStorage(unitID, metal) end + +---@param unitID UnitId +---@param paramName string one of `buildRange`|`buildDistance`|`buildRange3D` +---@param value number|boolean boolean when `paramName` is `buildRange3D`, otherwise number. +---@return nil +function Spring.SetUnitBuildParams(unitID, paramName, value) end + +---@param builderID UnitId +---@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 UnitId +---@param pieces table +---@return nil +function Spring.SetUnitNanoPieces(builderID, pieces) end + +---@param unitID UnitId +---@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 UnitId +---@param crashing boolean +---@return boolean success +function Spring.SetUnitCrashing(unitID, crashing) end + +---@param unitID UnitId +---@param weaponID integer? (Default: -1) +---@param enabled boolean? +---@param power number? +---@return nil +function Spring.SetUnitShieldState(unitID, weaponID, enabled, power) end + +---@param unitID UnitId +---@param weaponID integer? (Default: -1) +---@param power number? +---@return nil +function Spring.SetUnitShieldState(unitID, weaponID, power) end + +---@param unitID UnitId +---@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 UnitId +---@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 UnitId +---@param Physical number[bit] state bit +---@return nil +function Spring.SetUnitPhysicalStateBit(unitID, Physical) end + +---@param unitID UnitId +---@return number Unit's PhysicalState bitmask +function Spring.GetUnitPhysicalState(unitID) end + +---@param unitID UnitId +---@param neutral boolean +---@return nil|boolean setNeutral +function Spring.SetUnitNeutral(unitID, neutral) end + +---Defines a unit's target. +--- +---@param unitID UnitId +---@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 UnitId +---@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 UnitId +---@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 UnitId +---@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 UnitId +---@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 UnitId +---@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 UnitId +---@param pieceNum number +---@param matrix number[] an array of 16 floats +---@return nil +function Spring.SetUnitPieceMatrix(unitID, pieceNum, matrix) end + +---@param unitID UnitId +---@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 UnitId +---@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 UnitId +---@param pieceIndex number +---@param visible boolean +---@return nil +function Spring.SetUnitPieceVisible(unitID, pieceIndex, visible) end + +---@param unitID UnitId +---@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 UnitId +---@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 UnitId +---@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 UnitId +---@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 UnitId +---@return nil +function Spring.ClearUnitGoal(unitID) end + +---@param unitID UnitId +---@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 UnitId +---@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 UnitId +---@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 UnitId +---@param x number +---@param y number +---@param z number +---@return nil +function Spring.SetUnitPosition(unitID, x, y, z) end + +---@param unitID UnitId +---@param yaw number +---@param pitch number +---@param roll number +---@return nil +function Spring.SetUnitRotation(unitID, yaw, pitch, roll) end + +---@param unitID UnitId +---@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 UnitId +---@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 UnitId +---@param velX number +---@param velY number +---@param velZ number +---@return nil +function Spring.SetUnitVelocity(unitID, velX, velY, velZ) end + +---@param unitID UnitId +---@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 TeamId +---@param spherical boolean? (Default: true) +---@param forced boolean? (Default: true) +---@param excludeUnitID integer? +---@param excludeUnitDefIDs number[]? +---@return nil +function Spring.BuggerOff(x, y, z, radius, teamID, spherical, forced, excludeUnitID, excludeUnitDefIDs) end + +---@param unitID UnitId +---@param damage number +---@param paralyze number? (Default: 0) equals to the paralyzetime in the WeaponDef. +---@param attackerID UnitId? (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 UnitId +---@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 UnitId +---@param pindSize number +---@return nil +function Spring.AddUnitSeismicPing(unitID, pindSize) end + +---@param unitID UnitId +---@param resource string "m" | "e" +---@param amount number +---@return nil +function Spring.AddUnitResource(unitID, resource, amount) end + +---@param unitID UnitId +---@param resource ResourceName +---@param amount number +---@return boolean? okay +function Spring.UseUnitResource(unitID, resource, amount) end + +---@param unitID UnitId +---@param resources ResourceUsage +---@return boolean? okay +function Spring.UseUnitResource(unitID, resources) end + +---Decals +--- +---@section decals + +---@param unitID UnitId +---@return nil +function Spring.AddObjectDecal(unitID) end + +---@param unitID UnitId +---@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 AllyteamId? +---@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 TeamId +---@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 + +---@param featureID integer +---@param unitDef string|integer Can be a number id or a string name, this allows cancelling resurrection by passing `-1`. +---@param facing Facing? (Default: `"south"`) +---@param progress number? Set the level of progress. +---@return nil +function Spring.SetFeatureResurrect(featureID, unitDef, facing, 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|boolean? +---@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 +---@param ttl number Remaining time to live in frames +---@return nil +function Spring.SetProjectileTimeToLive(projectileID, ttl) end + +---@param projectileID integer +---@return nil +function Spring.SetProjectileIsIntercepted(projectileID) end + +---@param unitID UnitId +---@param weaponNum number +---@param key string|WeaponDamages +---@param value number|nil +---@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 UnitId +function Spring.UnitFinishCommand(unitID) end + +---@param unitID UnitId +---@param cmdID integer +---@param params number[]|number? +---@param options CommandOptions|number? +---@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 UnitId +---@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) Scaling factor. +---@return integer? absHeightDiff If `0`, nothing will be changed (the terraform starts), 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 ... number +---@return integer? absTotalHeightMapAmountChanged +function Spring.SetHeightMapFunc(luaFunction, ...) 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 UnitId +---@param weaponID integer +---@return nil +function Spring.UnitWeaponFire(unitID, weaponID) end + +---@param unitID UnitId +---@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 UnitId +---@return nil +function Spring.ForceUnitCollisionUpdate(unitID) end + +---@param transporterID UnitId +---@param passengerID UnitId +---@param pieceNum number +---@return nil +function Spring.UnitAttach(transporterID, passengerID, pieceNum) end + +---@param passengerID UnitId +---@return nil +function Spring.UnitDetach(passengerID) end + +---@param passengerID UnitId +---@return nil +function Spring.UnitDetachFromAir(passengerID) end + +---Disables collisions between the two units to allow colvol intersection during the approach. +--- +---@param passengerID UnitId +---@param transportID integer +---@return nil +function Spring.SetUnitLoadingTransport(passengerID, transportID) end + +---@param weaponDefID integer +---@param projectileParams ProjectileParams +---@return ProjectileId? 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 UnitId? (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 AllyteamId +---@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 UnitId +---@param cmdDescID integer +---@param cmdArray CommandDescription +function Spring.EditUnitCmdDesc(unitID, cmdDescID, cmdArray) end + +---@param unitID UnitId +---@param cmdDescID integer +---@param cmdArray CommandDescription +function Spring.InsertUnitCmdDesc(unitID, cmdDescID, cmdArray) end + + +---@param unitID UnitId +---@param cmdArray CommandDescription +function Spring.InsertUnitCmdDesc(unitID, cmdArray) end + +---@param unitID UnitId +---@param cmdDescID integer? +function Spring.RemoveUnitCmdDesc(unitID, cmdDescID) end \ No newline at end of file diff --git a/.typedefs/generated/LuaSyncedMoveCtrl.lua b/.typedefs/generated/LuaSyncedMoveCtrl.lua new file mode 100644 index 0000000000..62773246d1 --- /dev/null +++ b/.typedefs/generated/LuaSyncedMoveCtrl.lua @@ -0,0 +1,12 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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/.typedefs/generated/LuaSyncedRead.lua b/.typedefs/generated/LuaSyncedRead.lua new file mode 100644 index 0000000000..45fc34f26c --- /dev/null +++ b/.typedefs/generated/LuaSyncedRead.lua @@ -0,0 +1,1823 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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 TeamId? +---@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 +---@return number dirX, number dirY, number dirZ, number strength, number normDirX, number normDirY, number normDirZ +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 TeamId +---@return RulesParams rulesParams map with rules names as key and values as values +function Spring.GetTeamRulesParams(teamID) end + +---@param playerID PlayerId +---@return RulesParams rulesParams map with rules names as key and values as values +function Spring.GetPlayerRulesParams(playerID) end + +---@param unitID UnitId +---@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|nil value +function Spring.GetGameRulesParam(ruleRef) end + +---@param teamID TeamId +---@param ruleRef number|string the rule index or name +---@return nil|number|string value +function Spring.GetTeamRulesParam(teamID, ruleRef) end + +---@param playerID PlayerId +---@param ruleRef number|string the rule index or name +---@return nil|number|string value +function Spring.GetPlayerRulesParam(playerID, ruleRef) end + +---@param unitID UnitId +---@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 transferred 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 Value of `modOption`. +function Spring.GetMapOption(mapOption) end + +---@return table mapOptions Table with options names as keys and values as values. +function Spring.GetMapOptions() end + +---@param modOption string +---@return string value Value of `modOption`. +function Spring.GetModOption(modOption) end + +---@return table modOptions Table 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 TeamId +---@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 AllyteamId? (Default: -1) to filter teams belonging to when >= 0 +---@return number[] list of teamIDs +function Spring.GetTeamList(allyTeamID) end + +---@param teamID TeamId? (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 TeamId +---@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 TeamId +---@return integer? allyTeamID +function Spring.GetTeamAllyTeamID(teamID) end + +---@param teamID TeamId +---@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 TeamId +---@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 TeamId +---@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 TeamId +---@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 TeamId +---@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 TeamId +---@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 TeamId +---@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 TeamId +---@return number maxUnits +---@return number? currentUnits +function Spring.GetTeamMaxUnits(teamID) end + +---@param playerID PlayerId +---@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 PlayerId +---@return number? +function Spring.GetPlayerControlledUnit(playerID) end + +---@param teamID TeamId +---@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 AllyteamId +---@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 UnitId[] unitIDs +function Spring.GetAllUnits() end + +---@param teamID TeamId +---@return number[]? unitIDs +function Spring.GetTeamUnits(teamID) end + +---@param teamID TeamId +---@return table unitsByDef A table where keys are unitDefIDs and values are unitIDs +function Spring.GetTeamUnitsSorted(teamID) end + +---@param teamID TeamId +---@return table? countByUnit A table where keys are unitDefIDs and values are counts. +function Spring.GetTeamUnitsCounts(teamID) end + +---@param teamID TeamId +---@param unitDefIDs number|number[] +---@return number[]? unitIDs +function Spring.GetTeamUnitsByDefs(teamID, unitDefIDs) end + +---@param teamID TeamId +---@param unitDefID UnitDefId +---@return number? count +function Spring.GetTeamUnitDefCount(teamID, unitDefID) end + +---@param teamID TeamId +---@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 UnitId[] 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 UnitId[] unitIDs +function Spring.GetUnitsInBox(xmin, ymin, zmin, xmax, ymax, zmax, allegiance) end + +---@param x number +---@param z number +---@param radius number +---@return UnitId[] unitIDs +function Spring.GetUnitsInCylinder(x, z, radius) end + +---@param x number +---@param y number +---@param z number +---@param radius number +---@return UnitId[] 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 UnitId +---@param range number? (Default: 1.0e9f) +---@return number? unitID +function Spring.GetUnitNearestAlly(unitID, range) end + +---@param unitID UnitId +---@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 UnitId +---@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 UnitId +---@return UnitState +function Spring.GetUnitStates(unitID) end + +---@param unitID UnitId +---@return nil|boolean armored +---@return number armorMultiple +function Spring.GetUnitArmored(unitID) end + +---@param unitID UnitId +---@return boolean? isActive +function Spring.GetUnitIsActive(unitID) end + +---@param unitID UnitId +---@return boolean? isCloaked +function Spring.GetUnitIsCloaked(unitID) end + +---@param unitID UnitId +---@return number? seismicSignature +function Spring.GetUnitSeismicSignature(unitID) end + +---@param unitID UnitId +---@return integer? selfDTime +function Spring.GetUnitSelfDTime(unitID) end + +---@param unitID UnitId +---@return integer? numStockpiled +---@return integer? numStockpileQued +---@return number? buildPercent +function Spring.GetUnitStockpile(unitID) end + +---@param unitID UnitId +---@param type string one of los, airLos, radar, sonar, seismic, radarJammer, sonarJammer +---@return number? radius +function Spring.GetUnitSensorRadius(unitID, type) end + +---@param unitID UnitId +---@param allyTeamID AllyteamId? +---@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 UnitId +---@return nil|string +function Spring.GetUnitTooltip(unitID) end + +---@param unitID UnitId +---@return UnitDefId? +function Spring.GetUnitDefID(unitID) end + +---@param unitID UnitId +---@return number? +function Spring.GetUnitTeam(unitID) end + +---@param unitID UnitId +---@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 UnitId +---@return nil|boolean +function Spring.GetUnitNeutral(unitID) end + +---@param unitID UnitId +---@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 UnitId +---@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 UnitId +---@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 UnitId +---@return boolean beingBuilt +---@return number buildProgress +function Spring.GetUnitIsBeingBuilt(unitID) end + +---@param unitID UnitId +---@return number? metalMake +---@return number metalUse +---@return number energyMake +---@return number energyUse +function Spring.GetUnitResources(unitID) end + +---@param unitID UnitId +---@return number Unit's metal storage +---@return number Unit's energy storage +function Spring.GetUnitStorage(unitID) end + +---@param unitID UnitId +---@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 UnitId +---@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 UnitId +---@return number? metalExtraction +function Spring.GetUnitMetalExtraction(unitID) end + +---@param unitID UnitId +---@return number xp [0.0; +∞) +---@return number limXp [0.0; 1.0) as experience approaches infinity +function Spring.GetUnitExperience(unitID) end + +---@param unitID UnitId +---@return number? +function Spring.GetUnitHeight(unitID) end + +---@param unitID UnitId +---@return number? +function Spring.GetUnitRadius(unitID) end + +--- +---Gets the unit's radius for when targeted by build, repair, reclaim-type commands. +--- +---@param unitID UnitId +---@return number? +function Spring.GetUnitBuildeeRadius(unitID) end + +---@param unitID UnitId +---@return number? +function Spring.GetUnitMass(unitID) end + +---@param unitID UnitId +---@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 UnitId +---@return number? posX +---@return number posY +---@return number posZ +function Spring.GetUnitBasePosition(unitID) end + +---@param unitID UnitId +---@return float3? front +---@return float3 up +---@return float3 right +function Spring.GetUnitVectors(unitID) end + +---@param unitID UnitId +---@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 UnitId +---@return number? dirX +---@return number? dirY +---@return number? dirZ +function Spring.GetUnitDirection(unitID) end + +---@param unitID UnitId +---@param convertToRadians boolean? (Default: false) +---@return number heading +function Spring.GetUnitHeading(unitID, convertToRadians) end + +---@param unitID UnitId +---@return number? vx +---@return number? vy +---@return number? vz +function Spring.GetUnitVelocity(unitID) end + +---@param unitID UnitId +---@return Facing +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 UnitId +---@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 UnitId +---@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 UnitId +---@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 UnitId +function Spring.GetUnitCurrentBuildPower(unitID) end + +---Get a unit's carried resources +--- +---Checks resources being carried internally by the unit. +--- +---@param unitID UnitId +---@return number storedMetal +---@return number maxStoredMetal +---@return number storedEnergy +---@return number maxStoredEnergy +function Spring.GetUnitHarvestStorage(unitID) end + +---@param unitID UnitId +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 UnitId +---@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 UnitId +---@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 UnitId +---@return number|nil transportUnitID +function Spring.GetUnitTransporter(unitID) end + +---Get units being transported +--- +---@param unitID UnitId +---@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 UnitId +---@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 UnitId +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 UnitId +---@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 UnitId +---@param weaponNum number +---@param stateName string +---@return number stateValue +function Spring.GetUnitWeaponState(unitID, weaponNum, stateName) 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 UnitId +---@param weaponNum number +---@return list damageTable +function Spring.GetUnitWeaponState(unitID, weaponNum) end + +---@param unitID UnitId +function Spring.GetUnitWeaponDamages(unitID) end + +---@param unitID UnitId +function Spring.GetUnitWeaponVectors(unitID) end + +---@param unitID UnitId +function Spring.GetUnitWeaponTryTarget(unitID) end + +---@param unitID UnitId +function Spring.GetUnitWeaponTestTarget(unitID) end + +---@param unitID UnitId +function Spring.GetUnitWeaponTestRange(unitID) end + +---@param unitID UnitId +function Spring.GetUnitWeaponHaveFreeLineOfFire(unitID) end + +---@param unitID UnitId +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 UnitId +---@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 UnitId +---@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 UnitId +---@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 UnitId +---@param weaponNum integer +---@return 3 TargetType projectileID +---@return boolean isUserTarget +---@return integer targetProjectileId +function Spring.GetUnitWeaponTarget(unitID, weaponNum) end + +---Misc +--- +---@section misc + +---@param unitID UnitId +function Spring.GetUnitEstimatedPath(unitID) end + +---@param unitID UnitId +function Spring.GetUnitLastAttacker(unitID) end + +---@param unitID UnitId +function Spring.GetUnitLastAttackedPiece(unitID) end + +---@param unitID UnitId +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 UnitId +function Spring.GetUnitFeatureSeparation(unitID) end + +---@param unitDefID UnitDefId +function Spring.GetUnitDefDimensions(unitDefID) end + +function Spring.GetCEGID() end + +---@param unitID UnitId +---@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 + +---@class MoveTypeData +---@field name string? +---@field maxSpeed number? +---@field maxWantedSpeed number? +---@field maneuverLeash number? +---@field waterline number? +---@field useWantedSpeed {[integer]:boolean?} +--- +---@field accRate number? +---@field decRate number? +---@field turnRate number? +--- +---@field atGoal boolean? +---@field atEndOfPath boolean? +---@field pushResistant boolean? +---@field minScriptChangeHeading integer? +---@field turnAccel number? +---@field myGravity number? +---@field maxReverseDist number? +---@field minReverseAngle number? +---@field maxReverseSpeed number? +---@field sqSkidSpeedMult number? +--- +---@field collide boolean? +---@field dontLand boolean? +---@field airStrafe boolean? +---@field useSmoothMesh boolean? +---@field bankingAllowed boolean? +---@field wantedHeight boolean? +---@field altitudeRate number? +---@field currentBank number? +---@field currentPitch number? +---@field maxDrift number? +---@field aircraftState string? + +---@param unitID UnitId +---@return MoveTypeData +function Spring.GetUnitMoveTypeData(unitID) end + +---@param unitID UnitId Unit id. +---@param cmdIndex integer? 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(unitID, cmdIndex) end + +---Get the commands for a unit. +--- +---Same as `Spring.GetCommandQueue` +--- +---@param unitID UnitId +---@param count integer Number of commands to return, `-1` returns all commands, `0` returns command count. +---@return list commands +function Spring.GetUnitCommands(unitID, count) end + +---Get the count of commands for a unit. +--- +---Same as `Spring.GetCommandQueue` +--- +---@param unitID UnitId +---@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 UnitId +---@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. +--- + +---@param unitID UnitId +function Spring.GetFactoryBuggerOff(unitID) end + +---Gets the build queue of a factory +--- +---@param unitID UnitId +---@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 UnitId +---@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 UnitId +---@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 UnitId +---@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 UnitId +---@return nil|table buildqueue indexed by unitDefID with count values +function Spring.GetRealBuildQueue(unitID) end + +---@param unitID UnitId +function Spring.GetUnitCmdDescs(unitID) end + +---@param unitID UnitId +---@param cmdID CMD +function Spring.FindUnitCmdDesc(unitID,cmdID) 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 +---@return number x,number y,number z +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 ProjectileId +---@return number? posX +---@return number posY +---@return number posZ +function Spring.GetProjectilePosition(projectileID) end + +---@param projectileID ProjectileId +---@return number? dirX +---@return number dirY +---@return number dirZ +function Spring.GetProjectileDirection(projectileID) end + +---@param projectileID ProjectileId +---@return number? velX +---@return number velY +---@return number velZ +---@return number velW +function Spring.GetProjectileVelocity(projectileID) end + +---@param projectileID ProjectileId +---@return number? +function Spring.GetProjectileGravity(projectileID) end + +---@param projectileID ProjectileId +---@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 ProjectileId +---@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 ProjectileId +---@return nil|boolean +function Spring.GetProjectileIsIntercepted(projectileID) end + +---@param projectileID ProjectileId +---@return number? +function Spring.GetProjectileTimeToLive(projectileID) end + +---@param projectileID ProjectileId +---@return number? +function Spring.GetProjectileOwnerID(projectileID) end + +---@param projectileID ProjectileId +---@return number? +function Spring.GetProjectileTeamID(projectileID) end + +---@param projectileID ProjectileId +---@return number? +function Spring.GetProjectileAllyTeamID(projectileID) end + +---@param projectileID ProjectileId +---@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 ProjectileId +---@return WeaponDefId? +function Spring.GetProjectileDefID(projectileID) end + +---@param projectileID ProjectileId +---@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 UnitDefId +---@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 UnitDefId +---@param x number +---@param y number +---@param z number +---@param facing Facing +---@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 UnitDefId +---@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 TeamId +---@param unitDefID UnitDefId +---@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 AllyteamId? +---@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 AllyteamId? +---@return boolean +function Spring.IsPosInLos(posX, posY, posZ, allyTeamID) end + +---@param posX number +---@param posY number +---@param posZ number +---@param allyTeamID AllyteamId? +---@return boolean +function Spring.IsPosInRadar(posX, posY, posZ, allyTeamID) end + +---@param posX number +---@param posY number +---@param posZ number +---@param allyTeamID AllyteamId? +---@return boolean +function Spring.IsPosInAirLos(posX, posY, posZ, allyTeamID) end + +---@param unitID UnitId +---@param allyTeamID AllyteamId? +---@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 UnitId +---@param allyTeamID AllyteamId? +---@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 UnitId +---@param allyTeamID AllyteamId +---@return boolean inLos +function Spring.IsUnitInLos(unitID, allyTeamID) end + +---@param unitID UnitId +---@param allyTeamID AllyteamId +---@return boolean inAirLos +function Spring.IsUnitInAirLos(unitID, allyTeamID) end + +---@param unitID UnitId +---@param allyTeamID AllyteamId +---@return boolean inRadar +function Spring.IsUnitInRadar(unitID, allyTeamID) end + +---@param unitID UnitId +---@param allyTeamID AllyteamId +---@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 UnitId +---@return number index of the root piece +function Spring.GetUnitRootPiece(unitID) end + +---@param unitID UnitId +---@return table pieceInfos where keys are piece names and values are indices +function Spring.GetUnitPieceMap(unitID) end + +---@param unitID UnitId +---@return string[] pieceNames +function Spring.GetUnitPieceList(unitID) end + +---@param unitID UnitId +---@param pieceIndex integer +---@return PieceInfo? pieceInfo +function Spring.GetUnitPieceInfo(unitID, pieceIndex) end + +---@param unitID UnitId +---@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 UnitId +---@param pieceIndex integer +---@return number|nil posX +---@return number posY +---@return number posZ +function Spring.GetUnitPiecePosition(unitID, pieceIndex) end + +---@param unitID UnitId +---@param pieceIndex integer +---@return number|nil dirX +---@return number dirY +---@return number dirZ +function Spring.GetUnitPieceDirection(unitID, pieceIndex) end + +---@param unitID UnitId +---@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,piece) 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 UnitId +---@return integer[] pieceIndices +function Spring.GetUnitScriptPiece(unitID) end + +---@param unitID UnitId +---@param scriptPiece integer +---@return integer pieceIndex +function Spring.GetUnitScriptPiece(unitID, scriptPiece) end + +---@param unitID UnitId +---@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. +--- +---@param posX number +---@param posY number +---@param posZ number +---@param dirX number +---@param dirY number +---@param dirZ number +---@param testWater boolean? (Default: `true`) +---@return number rayLength +---@return number posX +---@return number posY +---@return number posZ +function Spring.TraceRayGroundInDirection(posX, posY, posZ, dirX, dirY, dirZ, testWater) 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. +--- +---@param startX number +---@param startY number +---@param startZ number +---@param endX number +---@param endY number +---@param endZ number +---@param testWater boolean? (Default: `true`) +---@return number rayLength +---@return number posX +---@return number posY +---@return number posZ +function Spring.TraceRayGroundBetweenPositions(startX, startY, startZ, endX, endY, endZ, testWater) end + +---Misc +--- +---@section misc + +---@param allyTeamID AllyteamId +---@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/.typedefs/generated/LuaSyncedTable.lua b/.typedefs/generated/LuaSyncedTable.lua new file mode 100644 index 0000000000..3ed8e5f673 --- /dev/null +++ b/.typedefs/generated/LuaSyncedTable.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaSyncedTable.cpp +--- +---@meta + diff --git a/.typedefs/generated/LuaTableExtra.lua b/.typedefs/generated/LuaTableExtra.lua new file mode 100644 index 0000000000..901fe0d73b --- /dev/null +++ b/.typedefs/generated/LuaTableExtra.lua @@ -0,0 +1,22 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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/.typedefs/generated/LuaTextures.lua b/.typedefs/generated/LuaTextures.lua new file mode 100644 index 0000000000..bda8e99261 --- /dev/null +++ b/.typedefs/generated/LuaTextures.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaTextures.cpp +--- +---@meta + diff --git a/.typedefs/generated/LuaTracyExtra.lua b/.typedefs/generated/LuaTracyExtra.lua new file mode 100644 index 0000000000..0a1a824b8a --- /dev/null +++ b/.typedefs/generated/LuaTracyExtra.lua @@ -0,0 +1,28 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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/.typedefs/generated/LuaUI.lua b/.typedefs/generated/LuaUI.lua new file mode 100644 index 0000000000..135250ae3a --- /dev/null +++ b/.typedefs/generated/LuaUI.lua @@ -0,0 +1,10 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaUI.cpp +--- +---@meta + +function ConfigureLayout() end \ No newline at end of file diff --git a/.typedefs/generated/LuaUICommand.lua b/.typedefs/generated/LuaUICommand.lua new file mode 100644 index 0000000000..1efbcfb4ff --- /dev/null +++ b/.typedefs/generated/LuaUICommand.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaUICommand.cpp +--- +---@meta + diff --git a/.typedefs/generated/LuaUnitDefs.lua b/.typedefs/generated/LuaUnitDefs.lua new file mode 100644 index 0000000000..bc3c5ec51a --- /dev/null +++ b/.typedefs/generated/LuaUnitDefs.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaUnitDefs.cpp +--- +---@meta + diff --git a/.typedefs/generated/LuaUnsyncedCtrl.lua b/.typedefs/generated/LuaUnsyncedCtrl.lua new file mode 100644 index 0000000000..775ec33b84 --- /dev/null +++ b/.typedefs/generated/LuaUnsyncedCtrl.lua @@ -0,0 +1,1320 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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 +---| "deprecated" # LOG.DEPRECATED +---| "error" # LOG.ERROR +---| "fatal" # LOG.FATAL + +---@param section string +---@param logLevel LogLevel? (Default: "notice") +---@param ... string messages +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 ``"``"`` where `#` is a player ID. +--- +---This will be replaced with the player's name. e.g. +---```lua +---Spring.SendMessage("`` did something") -- "ProRusher did something" +---``` +---@return nil +function Spring.SendMessageToSpectators(message) end + +---@param playerID PlayerId +---@param message string +---@return nil +function Spring.SendMessageToPlayer(playerID, message) end + +---@param teamID TeamId +---@param message string +---@return nil +function Spring.SendMessageToTeam(teamID, message) end + +---@param allyID integer +---@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 integer +---@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 UnitDefId +---@param posX number +---@param posY number +---@param posZ number +---@param teamID TeamId +---@param facing number +---@return nil +function Spring.AddWorldUnit(unitDefID, posX, posY, posZ, teamID, facing) end + +---@param unitID UnitId +---@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 Runtime 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 1|2 `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 UnitId The unit to look at. +---@return nil +function Spring.SetDollyCameraLookUnit(unitID) end + +---Unit Selection +--- +---@section unit_selection + +---Selects a single unit +--- +---@param unitID UnitId? +---@param append boolean? (Default: false) Append to current selection. +---@return nil +function Spring.SelectUnit(unitID, append) end + +---@param unitID UnitId +---@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 integer +---@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 integer +---@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 integer +---@param deferredShaderID integer +---@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 UnitId +---@param noDraw boolean +---@return nil +function Spring.SetUnitNoDraw(unitID, noDraw) end + +---@param unitID UnitId +---@param drawMask number +---@return nil +function Spring.SetUnitEngineDrawMask(unitID, drawMask) end + +---@param unitID UnitId +---@param alwaysUpdateMatrix boolean +---@return nil +function Spring.SetUnitAlwaysUpdateMatrix(unitID, alwaysUpdateMatrix) end + +---@param unitID UnitId +---@param unitNoMinimap boolean +---@return nil +function Spring.SetUnitNoMinimap(unitID, unitNoMinimap) end + +---@param unitID UnitId +---@param unitNoGroup boolean Whether unit can be added to selection groups +function Spring.SetUnitNoGroup(unitID, unitNoGroup) end + +---@param unitID UnitId +---@param unitNoSelect boolean whether unit can be selected or not +---@return nil +function Spring.SetUnitNoSelect(unitID, unitNoSelect) end + +---@param unitID UnitId +---@param unitLeaveTracks boolean whether unit leaves tracks on movement +---@return nil +function Spring.SetUnitLeaveTracks(unitID, unitLeaveTracks) end + +---@param unitID UnitId +-- ---@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.SetUnitSelectionVolumeData(unitID,--[=[ featureID,]=] scaleX, scaleY, scaleZ, offsetX, offsetY, offsetZ, vType, tType, Axis) end + +---Features +--- +---@section features + +---@param featureID integer +---@param noDraw boolean +---@return nil +function Spring.SetFeatureNoDraw(featureID, noDraw) end + +---@param featureID integer +---@param engineDrawMask number +---@return nil +function Spring.SetFeatureEngineDrawMask(featureID, engineDrawMask) end + +---@param featureID integer +---@param alwaysUpdateMat number +---@return nil +function Spring.SetFeatureAlwaysUpdateMatrix(featureID, alwaysUpdateMat) end + +---Control whether a feature will fade or not when zoomed out. +--- +---@param featureID integer +---@param allow boolean +---@return nil +function Spring.SetFeatureFade(featureID, allow) end + +---@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.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 UnitId +---@param drawIcon boolean +---@return nil +function Spring.UnitIconSetDraw(unitID, drawIcon) end + +---@param unitID UnitId +---@param drawIcon boolean +---@return nil +function Spring.SetUnitIconDraw(unitID, drawIcon) end + +---@param unitDefID UnitDefId +---@param iconName string +---@return nil +function Spring.SetUnitDefIcon(unitDefID, iconName) end + +---@param unitDefID UnitDefId +---@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 TeamId +---@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 integer +---@param cmdReference (string|number)? iconname | cmdID_cloneIcon +---@return boolean? assigned +function Spring.SetCustomCommandDrawData(cmdID, cmdReference) 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 rgb +---@param LOS rgb +---@param radar rgb +---@param jam rgb +---@param radar2 rgb +---@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 UnitId +---@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 integer +---@param params table +---@param options cmdOpts +---@return nil|true +function Spring.GiveOrder(cmdID, params, options) end + +---@param unitID UnitId +---@param cmdID integer +---@param params table +---@param options cmdOpts +---@return nil|true +function Spring.GiveOrderToUnit(unitID, cmdID, params, options) end + +---@param unitMap table { [unitID] = arg1, ... } +---@param cmdID integer +---@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 integer +---@param params table +---@param options cmdOpts +---@return nil|true +function Spring.GiveOrderToUnitArray(unitArray, cmdID, params, options) end + +---@param unitID UnitId +---@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[] +---@param pairwise boolean? (Default: `false`) 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. +---@return nil|boolean +function Spring.GiveOrderArrayToUnitArray(unitArray, cmdArray, pairwise) 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-environment 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 TeamId +---@param units string +---@return nil +function Spring.ShareResources(teamID, units) end + +---@param teamID TeamId +---@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 + +---@param itersPerBatch integer? +---@param numStepsPerIter integer? +---@param minStepsPerIter integer? +---@param maxStepsPerIter integer? +---@param minLoopRunTime number? +---@param maxLoopRunTime number? +---@param baseRunTimeMult number? +---@param baseMemLoadMult number? +---@return nil +function Spring.GarbageCollectCtrl(itersPerBatch, numStepsPerIter, minStepsPerIter, maxStepsPerIter, minLoopRunTime, maxLoopRunTime, baseRunTimeMult, baseMemLoadMult) end + +---@param autoShow boolean +---@return nil +function Spring.SetAutoShowMetal(autoShow) 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 +---@return 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 UnitDefId +---@return nil +function Spring.PreloadUnitDefModel(unitDefID) end + +---@param featureDefID integer +---@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 integer +---@return boolean delSuccess +function Spring.DestroyGroundDecal(decalID) end + +---@param decalID integer +---@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 integer +---@param rot number? (Default: random) in radians +---@return boolean decalSet +function Spring.SetGroundDecalRotation(decalID, rot) end + +---@param decalID integer +---@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 integer +---@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 integer +---@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 integer +---@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 integer +---@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 integer +---@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 integer +---@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/.typedefs/generated/LuaUnsyncedRead.lua b/.typedefs/generated/LuaUnsyncedRead.lua new file mode 100644 index 0000000000..7379c94831 --- /dev/null +++ b/.typedefs/generated/LuaUnsyncedRead.lua @@ -0,0 +1,1039 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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 UnitId +---@return boolean? isAllied nil with unitID cannot be parsed +function Spring.IsUnitAllied(unitID) end + +---@param unitID UnitId +---@return boolean? isSelected nil when unitID cannot be parsed +function Spring.IsUnitSelected(unitID) end + +---@param unitID UnitId +---@return boolean? draw nil when unitID cannot be parsed +function Spring.GetUnitLuaDraw(unitID) end + +---@param unitID UnitId +---@return boolean? nil when unitID cannot be parsed +function Spring.GetUnitNoDraw(unitID) end + +---@param unitID UnitId +---@return boolean? nil when unitID cannot be parsed +function Spring.GetUnitEngineDrawMask(unitID) end + +---@param unitID UnitId +---@return boolean? nil when unitID cannot be parsed +function Spring.GetUnitAlwaysUpdateMatrix(unitID) end + +---@param unitID UnitId +---@return number? nil when unitID cannot be parsed +function Spring.GetUnitDrawFlag(unitID) end + +---@param unitID UnitId +---@return boolean? nil when unitID cannot be parsed +function Spring.GetUnitNoMinimap(unitID) end + +---@param unitID UnitId +---@return nil|boolean noGroup `nil` when `unitID` cannot be parsed. +function Spring.GetUnitNoGroup(unitID) end + +---@param unitID UnitId +---@return boolean? noSelect `nil` when `unitID` cannot be parsed. +function Spring.GetUnitNoSelect(unitID) end + +---@param unitID UnitId +---@return boolean? drawIcon +---`true` if icon is being drawn, `nil` when unitID is invalid, otherwise `false`. +function Spring.UnitIconGetDraw(unitID) end + +---@param unitID UnitId +---@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 UnitId +---@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 UnitId +---@return boolean? inView nil when unitID cannot be parsed +function Spring.IsUnitInView(unitID) end + +---@param unitID UnitId +---@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 UnitId +---@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 UnitId +---@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 TeamId? (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 TeamId? (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 AllyteamId? (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 UnitId[] 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 collision sphere. Per Piece collision and custom collision 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 TeamId +---@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 TeamId +---@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 + +---@class SoundDeviceSpec +--- +---Contains data about a sound device. +---@field name string +local SoundDeviceSpec = {} + +---@return SoundDeviceSpec[] devices Sound devices. +function Spring.GetSoundDevices() end + +---@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 + +---@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 UnitId +---@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 PlayerId +---@field teamID TeamId +---@field allyTeamID AllyteamId +---@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 PlayerId +---@param packetID integer? +---@return number traffic +function Spring.GetPlayerTraffic(playerID, packetID) end + +---@param playerID PlayerId +---@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 +---@param default number? (Default: `0`) +---@return number? configInt +function Spring.GetConfigInt(name, default) end + +---@param name string +---@param default number? (Default: `0`) +---@return number? configFloat +function Spring.GetConfigFloat(name, default) end + +---@param name string +---@param default string? (Default: `""`) +---@return number? configString +function Spring.GetConfigString(name, default) 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/.typedefs/generated/LuaUtils.lua b/.typedefs/generated/LuaUtils.lua new file mode 100644 index 0000000000..a6e187c788 --- /dev/null +++ b/.typedefs/generated/LuaUtils.lua @@ -0,0 +1,22 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaUtils.cpp +--- +---@meta + +---@alias Facing +---| 0 # South +---| 1 # East +---| 2 # North +---| 3 # West +---| "s" # South +---| "e" # East +---| "n" # North +---| "w" # West +---| "south" # South +---| "east" # East +---| "north" # North +---| "west" # West \ No newline at end of file diff --git a/.typedefs/generated/LuaVAO.lua b/.typedefs/generated/LuaVAO.lua new file mode 100644 index 0000000000..534c9bf0d2 --- /dev/null +++ b/.typedefs/generated/LuaVAO.lua @@ -0,0 +1,19 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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/.typedefs/generated/LuaVAOImpl.lua b/.typedefs/generated/LuaVAOImpl.lua new file mode 100644 index 0000000000..868436dd50 --- /dev/null +++ b/.typedefs/generated/LuaVAOImpl.lua @@ -0,0 +1,76 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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 + +---Attaches a VBO to be used as a vertex buffer +--- +---@param vbo VBO +---@return nil +function VAO:AttachVertexBuffer(vbo) end + +---Attaches a VBO to be used as an instance buffer +--- +---@param vbo VBO +---@return nil +function VAO:AttachInstanceBuffer(vbo) end + +---Attaches 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/.typedefs/generated/LuaVBO.lua b/.typedefs/generated/LuaVBO.lua new file mode 100644 index 0000000000..f6eb94affb --- /dev/null +++ b/.typedefs/generated/LuaVBO.lua @@ -0,0 +1,36 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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/.typedefs/generated/LuaVBOImpl.lua b/.typedefs/generated/LuaVBOImpl.lua new file mode 100644 index 0000000000..7967db1253 --- /dev/null +++ b/.typedefs/generated/LuaVBOImpl.lua @@ -0,0 +1,272 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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 + +---Gets the OpenGL Buffer ID +--- +---@return number bufferID +function VBO:GetID() end \ No newline at end of file diff --git a/.typedefs/generated/LuaVFS.lua b/.typedefs/generated/LuaVFS.lua new file mode 100644 index 0000000000..35da3e7dc2 --- /dev/null +++ b/.typedefs/generated/LuaVFS.lua @@ -0,0 +1,12 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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/.typedefs/generated/LuaVFSDownload.lua b/.typedefs/generated/LuaVFSDownload.lua new file mode 100644 index 0000000000..66e13b2195 --- /dev/null +++ b/.typedefs/generated/LuaVFSDownload.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaVFSDownload.cpp +--- +---@meta + diff --git a/.typedefs/generated/LuaWeaponDefs.lua b/.typedefs/generated/LuaWeaponDefs.lua new file mode 100644 index 0000000000..b3c8ffd3f8 --- /dev/null +++ b/.typedefs/generated/LuaWeaponDefs.lua @@ -0,0 +1,9 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---https://github.com/rhys-vdw/lua-doc-extractor +--- +---Source: LuaWeaponDefs.cpp +--- +---@meta + diff --git a/.typedefs/generated/LuaZip.lua b/.typedefs/generated/LuaZip.lua new file mode 100644 index 0000000000..85dc6b7b22 --- /dev/null +++ b/.typedefs/generated/LuaZip.lua @@ -0,0 +1,60 @@ + +---!!! DO NOT MANUALLY EDIT THIS FILE !!! +---Generated by lua-doc-extractor 1.0.0 +---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 diff --git a/.typedefs/types 2.lua.txt b/.typedefs/types 2.lua.txt new file mode 100644 index 0000000000..6048b3d71f --- /dev/null +++ b/.typedefs/types 2.lua.txt @@ -0,0 +1,76 @@ +-- ---@diagnostic disable: missing-return +---@meta Spring + +Spring=Spring or {} +---@class UnitId : integer +---@class UnitDefId:integer + +---@class PlayerId:integer +---@class TeamId:integer +---@class AllyteamId:integer + +---@class timeSec:number + +---@class frame:integer +---@operator div(framePerSec):timeSec +---@class framePerSec:integer +---@operator mul(timeSec):frame + +---@class WldDist:number +---@operator div(frame):WldSpeed +---@operator add(WldDist):WldDist +---@operator add(WldSpeed):WldDist +---@alias WldxPos WldDist +---@alias WldyPos WldDist +---@alias WldzPos WldDist +--[=[ +---@class WldxPos:number +---@operator div(frame):WldxVel +---@operator add(WldxPos):WldxPos +---@operator add(WldxVel):WldxPos +---@class WldyPos:number +---@operator div(frame):WldyVel +---@operator add(WldyPos):WldyPos +---@operator add(WldyVel):WldyPos +---@class WldzPos:number +---@operator div(frame):WldzVel +---@operator add(WldzPos):WldzPos +---@operator add(WldzVel):WldzPos +]=] + +---@class WldSpeed:number +---@operator mul(frame):WldDist +---@operator unm:WldSpeed + +---@alias WldxVel WldSpeed +---@alias WldyVel WldSpeed +---@alias WldzVel WldSpeed + + +Game={} +--- framePerSec +---@type framePerSec +Game.gameSpeed=30 +---@type WldxPos +Game.mapSizeX=512 +---@type WldzPos +Game.mapSizeZ=512 + + +---@class WeaponDefId:integer +---@class WeaponDefName:string +---@class WeaponDef:any --:{id:WeaponDefId,[any]:any} +---@field id WeaponDefId +---@field name WeaponDefName +---@field damageAreaOfEffect number +---@field damages list +---@field flightTime number + +---@type table +WeaponDefs={} + +---@type table +WeaponDefNames={} + + +---@class ProjectileId:number From 3a96d9db7c0a0b6b5b62ddf48347bc750faad5be Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Wed, 31 Dec 2025 21:24:45 +0800 Subject: [PATCH 04/40] workspace --- Zero-K fork.sdd.code-workspace | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Zero-K fork.sdd.code-workspace diff --git a/Zero-K fork.sdd.code-workspace b/Zero-K fork.sdd.code-workspace new file mode 100644 index 0000000000..dbeec103a0 --- /dev/null +++ b/Zero-K fork.sdd.code-workspace @@ -0,0 +1,11 @@ +{ + "folders": [ + { + "path": "." + }, + { + "path": "scripts" + } + ], + "settings": {} +} \ No newline at end of file From b0108ace8db0552b06b022b0f7e7f7dee6895f67 Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Wed, 31 Dec 2025 22:10:29 +0800 Subject: [PATCH 05/40] remove VFS.Include nil check --- .luarc.json | 8 ++++---- .typedefs/LuaVFS.lua | 2 +- LuaRules/Gadgets/unit_tech_k.lua | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.luarc.json b/.luarc.json index 613db10025..0f7febab9f 100644 --- a/.luarc.json +++ b/.luarc.json @@ -30,10 +30,10 @@ "diagnostics.disable": [ "duplicate-set-field" ], - "runtime.special": { - "include":"require", - "VFS.Include":"require" - }, + // "runtime.special": { + // "include":"require", + // "VFS.Include":"require" + // }, "Lua.workspace.library": [ "../zk-stable" ], diff --git a/.typedefs/LuaVFS.lua b/.typedefs/LuaVFS.lua index 3c1856fa0f..a7019bc950 100644 --- a/.typedefs/LuaVFS.lua +++ b/.typedefs/LuaVFS.lua @@ -16,7 +16,7 @@ VFS={} ---@param filename string ---@param enviroment table|nil ---@param mode number|nil ----@return any +---@return any ...any function VFS.Include(filename,enviroment ,mode ) end ---check whether a file exist diff --git a/LuaRules/Gadgets/unit_tech_k.lua b/LuaRules/Gadgets/unit_tech_k.lua index c576d81f64..74b528d89b 100644 --- a/LuaRules/Gadgets/unit_tech_k.lua +++ b/LuaRules/Gadgets/unit_tech_k.lua @@ -26,6 +26,7 @@ local autoAiTech = Spring.GetModOptions().aiusetechk ~= "0" local IterableMap = VFS.Include("LuaRules/Gadgets/Include/IterableMap.lua") local modCommands, modCmdMap = VFS.Include("LuaRules/Configs/modCommandsDefs.lua") local CMD_TECH_UP = Spring.Utilities.CMD.TECH_UP + local techCommandData = modCmdMap[CMD_TECH_UP] if not gadgetHandler:IsSyncedCode() then From c37b3cd62a74822de761a9abce4a09bb307a906d Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Wed, 31 Dec 2025 22:48:07 +0800 Subject: [PATCH 06/40] type annotation for include --- LuaUI/utils.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/LuaUI/utils.lua b/LuaUI/utils.lua index 3bf4f599f6..6aac391d9c 100644 --- a/LuaUI/utils.lua +++ b/LuaUI/utils.lua @@ -12,6 +12,12 @@ function Basename(fullpath) return base, path end +---Load, compiles, run, return +---@param filename string +---@param envTable table|nil +---@param VFSMODE number|nil +---@return any ...any +---@diagnostic disable-next-line: lowercase-global function include(filename, envTable, VFSMODE) --[[ support legacy header paths for the time being in case people use them in their local widgets ]] From d83be1d0f04e429caf44c274b52e970d0acd4faa Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Wed, 31 Dec 2025 22:49:30 +0800 Subject: [PATCH 07/40] . --- LuaUI/Widgets/chili/Headers/autolocalizer.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/LuaUI/Widgets/chili/Headers/autolocalizer.lua b/LuaUI/Widgets/chili/Headers/autolocalizer.lua index 982bf73c6f..e8bd729b11 100644 --- a/LuaUI/Widgets/chili/Headers/autolocalizer.lua +++ b/LuaUI/Widgets/chili/Headers/autolocalizer.lua @@ -152,7 +152,6 @@ local function MyLoadString(str, filename) return chunk, str2 end - function VFS.Include(filename, enviroment, mode) local str = LoadFileSafe(filename, mode) From cf84b8c674167d74ce51fddb74a804562ce15e2e Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Wed, 31 Dec 2025 22:50:50 +0800 Subject: [PATCH 08/40] Gadget unit_target_priority.lua typo visiblity -> visibility --- LuaRules/Gadgets/unit_target_priority.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/LuaRules/Gadgets/unit_target_priority.lua b/LuaRules/Gadgets/unit_target_priority.lua index 8bacaeb98a..1b5dad6157 100644 --- a/LuaRules/Gadgets/unit_target_priority.lua +++ b/LuaRules/Gadgets/unit_target_priority.lua @@ -356,18 +356,18 @@ function gadget:AllowWeaponTarget(unitID, targetID, attackerWeaponNum, attackerW --// Radar dot handling. Radar dots are not handled by subsequent areas because a unit which is -- identified but not visible cannot have priority based on health or other status effects. - local visiblity = cache_GetUnitVisibility(targetID, allyTeam) + local visibility = cache_GetUnitVisibility(targetID, allyTeam) - if visiblity ~= 2 then + if visibility ~= 2 then local wobbleAdd = (radarDotPenalty[attackerWeaponDefID] or 0) -- Mobile units get a penalty for radar wobble. Identified statics experience no wobble. if radarWobblePenalty[attackerWeaponDefID] and (visibility == 0 or not remStatic[enemyUnitDefID]) then wobbleAdd = radarWobblePenalty[attackerWeaponDefID] end - if visiblity == 0 then + if visibility == 0 then return true, 25 + wobbleAdd + velocityAdd + lastShotBonus - elseif visiblity == 1 then + elseif visibility == 1 then -- If the unit type is accessible then it can be included in the priority calculation. return true, GetPriority(enemyUnitDefID, attackerWeaponDefID) + wobbleAdd + velocityAdd + 1.5 + lastShotBonus end From 52a3fa2ff5d8e18ad5a2839be8f67adc9343f8e2 Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Wed, 31 Dec 2025 22:58:29 +0800 Subject: [PATCH 09/40] add field tag for type Command --- .typedefs/Types.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/.typedefs/Types.lua b/.typedefs/Types.lua index 2473b41163..1cc00a5003 100644 --- a/.typedefs/Types.lua +++ b/.typedefs/Types.lua @@ -90,6 +90,7 @@ ---@field cmdID integer ---@field params number[]? ---@field options CommandOptions? +---@field tag integer? ---Command Description --- From 52f5b1ee8320ab4fbecd896f2674da5594a5d6ae Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Wed, 31 Dec 2025 22:59:03 +0800 Subject: [PATCH 10/40] add field tag for type Command --- .typedefs/Types.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.typedefs/Types.lua b/.typedefs/Types.lua index 1cc00a5003..4e1a3015df 100644 --- a/.typedefs/Types.lua +++ b/.typedefs/Types.lua @@ -90,7 +90,7 @@ ---@field cmdID integer ---@field params number[]? ---@field options CommandOptions? ----@field tag integer? +---@field tag integer ---Command Description --- From a582b2e18f1c8c1bd2fe61df485941820cbae406 Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Wed, 31 Dec 2025 23:00:49 +0800 Subject: [PATCH 11/40] add param for Spring.SetCustomCommandDrawData --- .typedefs/generated/LuaUnsyncedCtrl.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.typedefs/generated/LuaUnsyncedCtrl.lua b/.typedefs/generated/LuaUnsyncedCtrl.lua index 775ec33b84..f49a4b6872 100644 --- a/.typedefs/generated/LuaUnsyncedCtrl.lua +++ b/.typedefs/generated/LuaUnsyncedCtrl.lua @@ -672,8 +672,10 @@ function Spring.ReplaceMouseCursor(oldFileName, newFileName, hotSpotTopLeft) end --- ---@param cmdID integer ---@param cmdReference (string|number)? iconname | cmdID_cloneIcon +---@param RGBA { r:number, g:number, b:number, a:number }? +---@param showArea boolean? ---@return boolean? assigned -function Spring.SetCustomCommandDrawData(cmdID, cmdReference) end +function Spring.SetCustomCommandDrawData(cmdID, cmdReference, RGBA, showArea ) end ---Mouse --- From 33669c18798bd361efd0a91622754ac8b1c1019f Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Wed, 31 Dec 2025 23:02:49 +0800 Subject: [PATCH 12/40] add param for Spring.SetCustomCommandDrawData --- .typedefs/generated/LuaUnsyncedCtrl.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.typedefs/generated/LuaUnsyncedCtrl.lua b/.typedefs/generated/LuaUnsyncedCtrl.lua index f49a4b6872..799f7a627a 100644 --- a/.typedefs/generated/LuaUnsyncedCtrl.lua +++ b/.typedefs/generated/LuaUnsyncedCtrl.lua @@ -672,7 +672,7 @@ function Spring.ReplaceMouseCursor(oldFileName, newFileName, hotSpotTopLeft) end --- ---@param cmdID integer ---@param cmdReference (string|number)? iconname | cmdID_cloneIcon ----@param RGBA { r:number, g:number, b:number, a:number }? +---@param RGBA rgba? ---@param showArea boolean? ---@return boolean? assigned function Spring.SetCustomCommandDrawData(cmdID, cmdReference, RGBA, showArea ) end From b5ed7588abd57110dacee38ad5985598305d07ff Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Wed, 31 Dec 2025 23:04:11 +0800 Subject: [PATCH 13/40] set param of Spring.SetUnitBlocking --- .typedefs/generated/LuaSyncedCtrl.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.typedefs/generated/LuaSyncedCtrl.lua b/.typedefs/generated/LuaSyncedCtrl.lua index 1c50a63b9f..112d27f4cd 100644 --- a/.typedefs/generated/LuaSyncedCtrl.lua +++ b/.typedefs/generated/LuaSyncedCtrl.lua @@ -513,8 +513,8 @@ function Spring.SetUnitBuildSpeed(builderID, buildSpeed, repairSpeed, reclaimSpe function Spring.SetUnitNanoPieces(builderID, pieces) end ---@param unitID UnitId ----@param isblocking boolean ----@param isSolidObjectCollidable boolean +---@param isblocking boolean? +---@param isSolidObjectCollidable boolean? ---@param isProjectileCollidable boolean? ---@param isRaySegmentCollidable boolean? ---@param crushable boolean? From fd1108c04188a09f4b69985aac2350e7fb786342 Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Wed, 31 Dec 2025 23:09:33 +0800 Subject: [PATCH 14/40] remove Spring.GetUnitDefID's nil return --- .typedefs/generated/LuaSyncedRead.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.typedefs/generated/LuaSyncedRead.lua b/.typedefs/generated/LuaSyncedRead.lua index 45fc34f26c..f7271d664f 100644 --- a/.typedefs/generated/LuaSyncedRead.lua +++ b/.typedefs/generated/LuaSyncedRead.lua @@ -622,7 +622,7 @@ function Spring.GetUnitPosErrorParams(unitID, allyTeamID) end function Spring.GetUnitTooltip(unitID) end ---@param unitID UnitId ----@return UnitDefId? +---@return UnitDefId function Spring.GetUnitDefID(unitID) end ---@param unitID UnitId From c0b7c8c49e8ea03c9522a2eac45dca0c01550c3a Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Wed, 31 Dec 2025 23:09:46 +0800 Subject: [PATCH 15/40] Spring.CreateUnit's teamID is optional --- .typedefs/generated/LuaSyncedCtrl.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.typedefs/generated/LuaSyncedCtrl.lua b/.typedefs/generated/LuaSyncedCtrl.lua index 112d27f4cd..af6603e8bf 100644 --- a/.typedefs/generated/LuaSyncedCtrl.lua +++ b/.typedefs/generated/LuaSyncedCtrl.lua @@ -218,7 +218,7 @@ function Spring.GetCOBScriptID(unitID, funcName) end ---@param y number ---@param z number ---@param facing Facing ----@param teamID TeamId +---@param teamID TeamId? ---@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 UnitId? requests specific unitID From 05e3bb4754673bb2c860dffea9b1c9610b3ca1ff Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Wed, 31 Dec 2025 23:11:19 +0800 Subject: [PATCH 16/40] Spring.GetAllFeatures --- .typedefs/generated/LuaSyncedRead.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/.typedefs/generated/LuaSyncedRead.lua b/.typedefs/generated/LuaSyncedRead.lua index f7271d664f..0cf53d86e5 100644 --- a/.typedefs/generated/LuaSyncedRead.lua +++ b/.typedefs/generated/LuaSyncedRead.lua @@ -1197,6 +1197,7 @@ function Spring.FindUnitCmdDesc(unitID,cmdID) end ---@return boolean function Spring.ValidFeatureID(featureID) end +---@return integer[] featureIDs function Spring.GetAllFeatures() end ---@param featureID integer From dcf8577f61d3fcaf8c1e3cda3132c4cd77d2be99 Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Wed, 31 Dec 2025 23:22:51 +0800 Subject: [PATCH 17/40] Spring.SetCustomCommandDrawData --- .typedefs/Types.lua | 2 ++ .typedefs/generated/LuaUnsyncedCtrl.lua | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.typedefs/Types.lua b/.typedefs/Types.lua index 4e1a3015df..dd3ce3f3a2 100644 --- a/.typedefs/Types.lua +++ b/.typedefs/Types.lua @@ -33,6 +33,8 @@ ---@field b number ---@field a number +---@class rgba_list:{[1]:number,[2]:number,[3]:number,[4]:number} + -------------------------------------------------------------------------------- -- Camera -------------------------------------------------------------------------------- diff --git a/.typedefs/generated/LuaUnsyncedCtrl.lua b/.typedefs/generated/LuaUnsyncedCtrl.lua index 799f7a627a..a8f36ef3cc 100644 --- a/.typedefs/generated/LuaUnsyncedCtrl.lua +++ b/.typedefs/generated/LuaUnsyncedCtrl.lua @@ -672,7 +672,7 @@ function Spring.ReplaceMouseCursor(oldFileName, newFileName, hotSpotTopLeft) end --- ---@param cmdID integer ---@param cmdReference (string|number)? iconname | cmdID_cloneIcon ----@param RGBA rgba? +---@param RGBA rgba_list? ---@param showArea boolean? ---@return boolean? assigned function Spring.SetCustomCommandDrawData(cmdID, cmdReference, RGBA, showArea ) end From 9281e309eaf79a7e0982509f72c82be2cc7e1ec1 Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Wed, 31 Dec 2025 23:23:01 +0800 Subject: [PATCH 18/40] Spring.GetFeatureResurrect --- .typedefs/generated/LuaSyncedRead.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.typedefs/generated/LuaSyncedRead.lua b/.typedefs/generated/LuaSyncedRead.lua index 0cf53d86e5..7892fb7c20 100644 --- a/.typedefs/generated/LuaSyncedRead.lua +++ b/.typedefs/generated/LuaSyncedRead.lua @@ -1282,6 +1282,8 @@ function Spring.GetFeatureBlocking(featureID) end function Spring.GetFeatureNoSelect(featureID) end ---@param featureID integer +---@return string|""|nil featureDefName +---@return Facing buildFacing function Spring.GetFeatureResurrect(featureID) end ---@param featureID integer From 352fb4552adec216f02b2f14e18a997c5da02c46 Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Wed, 31 Dec 2025 23:23:07 +0800 Subject: [PATCH 19/40] Spring.SetFeatureMoveCtrl --- .typedefs/generated/LuaSyncedCtrl.lua | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.typedefs/generated/LuaSyncedCtrl.lua b/.typedefs/generated/LuaSyncedCtrl.lua index af6603e8bf..3ce5d22c5e 100644 --- a/.typedefs/generated/LuaSyncedCtrl.lua +++ b/.typedefs/generated/LuaSyncedCtrl.lua @@ -984,11 +984,17 @@ function Spring.SetFeatureResurrect(featureID, unitDef, facing, progress) end --- ---@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 arg1 number? initialVelocityX or velocityMaskX +---@param arg2 number? initialVelocityY or velocityMaskY +---@param arg3 number? initialVelocityZ or velocityMaskZ +---@param arg4 number? accelerationX or impulseMaskX +---@param arg5 number? accelerationY or impulseMaskY +---@param arg6 number? accelerationZ or impulseMaskZ +---@param arg7 number? movementMaskX +---@param arg8 number? movementMaskY +---@param arg9 number? movementMaskZ +---@return nil +function Spring.SetFeatureMoveCtrl(featureID, enable, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) end ---@param featureID integer ---@param posX number From b1cefef0019bee89632972e3a406280fd31c0a27 Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Wed, 31 Dec 2025 23:28:31 +0800 Subject: [PATCH 20/40] Spring.GetFeaturePosition Note recoil doc missing --- .typedefs/generated/LuaSyncedRead.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.typedefs/generated/LuaSyncedRead.lua b/.typedefs/generated/LuaSyncedRead.lua index 7892fb7c20..e48a60fda4 100644 --- a/.typedefs/generated/LuaSyncedRead.lua +++ b/.typedefs/generated/LuaSyncedRead.lua @@ -1231,8 +1231,18 @@ function Spring.GetFeatureRadius(featureID) end function Spring.GetFeatureMass(featureID) end ---@param featureID integer ----@return number x,number y,number z -function Spring.GetFeaturePosition(featureID) end +---@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.GetFeaturePosition(featureID,midPos,aimPos) end ---@param featureID1 number ---@param featureID2 number From 8b8b91e8751e27f20fb0cc2573b0620021cccd5a Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Wed, 31 Dec 2025 23:36:57 +0800 Subject: [PATCH 21/40] .luarc.json runtime.path --- .luarc.json | 13 +++++++++---- scripts/.luarc.json | 4 ++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.luarc.json b/.luarc.json index 0f7febab9f..9612139275 100644 --- a/.luarc.json +++ b/.luarc.json @@ -30,10 +30,15 @@ "diagnostics.disable": [ "duplicate-set-field" ], - // "runtime.special": { - // "include":"require", - // "VFS.Include":"require" - // }, + "runtime.path": [ + "?", + "?.lua" + ], + "runtime.special": { + "include":"require", + "VFS.Include":"require", + "shard_include": "require" + }, "Lua.workspace.library": [ "../zk-stable" ], diff --git a/scripts/.luarc.json b/scripts/.luarc.json index 6863e48062..675986f439 100644 --- a/scripts/.luarc.json +++ b/scripts/.luarc.json @@ -58,6 +58,10 @@ "duplicate-set-field", "lowercase-global" ], + "runtime.path": [ + "?", + "?.lua" + ], "runtime.special": { "include":"require", "VFS.Include":"require" From dcb4173b21164daf85340e47018eb4cc6e9af5df Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Wed, 31 Dec 2025 23:41:41 +0800 Subject: [PATCH 22/40] wait we can just use https://github.com/beyond-all-reason/recoil-lua-library --- .gitmodules | 3 + .typedefs/LuaVFS.lua | 40 - .typedefs/Script.lua | 16 - .typedefs/SpringDefines less.lua | 127 -- .typedefs/SpringDefines then .lua .txt | 147 -- .typedefs/SpringDefines.lua.txt | 224 --- .typedefs/Types.lua | 127 -- .typedefs/generated/LuaArchive.lua | 9 - .typedefs/generated/LuaAtlasTextures.lua | 9 - .typedefs/generated/LuaBitOps.lua | 56 - .typedefs/generated/LuaConstCMD.lua | 198 --- .typedefs/generated/LuaConstCMDTYPE.lua | 65 - .typedefs/generated/LuaConstCOB.lua | 329 ---- .typedefs/generated/LuaConstEngine.lua | 48 - .typedefs/generated/LuaConstGL.lua | 606 ------- .typedefs/generated/LuaConstGame.lua | 202 --- .typedefs/generated/LuaConstPlatform.lua | 93 - .typedefs/generated/LuaFBOs.lua | 112 -- .typedefs/generated/LuaFeatureDefs.lua | 9 - .typedefs/generated/LuaFonts.lua | 33 - .typedefs/generated/LuaGaia.lua | 9 - .typedefs/generated/LuaHandle.lua | 831 --------- .typedefs/generated/LuaHandleSynced.lua | 391 ----- .typedefs/generated/LuaIO.lua | 9 - .typedefs/generated/LuaInputReceiver.lua | 9 - .typedefs/generated/LuaInterCall.lua | 9 - .typedefs/generated/LuaIntro.lua | 15 - .typedefs/generated/LuaMaterial.lua | 9 - .typedefs/generated/LuaMathExtra.lua | 85 - .typedefs/generated/LuaMemPool.lua | 9 - .typedefs/generated/LuaMenu.lua | 23 - .typedefs/generated/LuaMetalMap.lua | 18 - .typedefs/generated/LuaObjectRendering.lua | 9 - .typedefs/generated/LuaOpenGL.lua | 85 - .typedefs/generated/LuaOpenGLUtils.lua | 9 - .typedefs/generated/LuaParser.lua | 9 - .typedefs/generated/LuaPathFinder.lua | 9 - .typedefs/generated/LuaRBOs.lua | 38 - .typedefs/generated/LuaRules.lua | 12 - .typedefs/generated/LuaRulesParams.lua | 9 - .typedefs/generated/LuaScream.lua | 9 - .typedefs/generated/LuaShaders.lua | 220 --- .typedefs/generated/LuaSyncedCtrl.lua | 1666 ------------------ .typedefs/generated/LuaSyncedMoveCtrl.lua | 12 - .typedefs/generated/LuaSyncedRead.lua | 1836 -------------------- .typedefs/generated/LuaSyncedTable.lua | 9 - .typedefs/generated/LuaTableExtra.lua | 22 - .typedefs/generated/LuaTextures.lua | 9 - .typedefs/generated/LuaTracyExtra.lua | 28 - .typedefs/generated/LuaUI.lua | 10 - .typedefs/generated/LuaUICommand.lua | 9 - .typedefs/generated/LuaUnitDefs.lua | 9 - .typedefs/generated/LuaUnsyncedCtrl.lua | 1322 -------------- .typedefs/generated/LuaUnsyncedRead.lua | 1039 ----------- .typedefs/generated/LuaUtils.lua | 22 - .typedefs/generated/LuaVAO.lua | 19 - .typedefs/generated/LuaVAOImpl.lua | 76 - .typedefs/generated/LuaVBO.lua | 36 - .typedefs/generated/LuaVBOImpl.lua | 272 --- .typedefs/generated/LuaVFS.lua | 12 - .typedefs/generated/LuaVFSDownload.lua | 9 - .typedefs/generated/LuaWeaponDefs.lua | 9 - .typedefs/generated/LuaZip.lua | 60 - .typedefs/types 2.lua.txt | 76 - recoil-lua-library | 1 + 65 files changed, 4 insertions(+), 10838 deletions(-) create mode 100644 .gitmodules delete mode 100644 .typedefs/LuaVFS.lua delete mode 100644 .typedefs/Script.lua delete mode 100644 .typedefs/SpringDefines less.lua delete mode 100644 .typedefs/SpringDefines then .lua .txt delete mode 100644 .typedefs/SpringDefines.lua.txt delete mode 100644 .typedefs/Types.lua delete mode 100644 .typedefs/generated/LuaArchive.lua delete mode 100644 .typedefs/generated/LuaAtlasTextures.lua delete mode 100644 .typedefs/generated/LuaBitOps.lua delete mode 100644 .typedefs/generated/LuaConstCMD.lua delete mode 100644 .typedefs/generated/LuaConstCMDTYPE.lua delete mode 100644 .typedefs/generated/LuaConstCOB.lua delete mode 100644 .typedefs/generated/LuaConstEngine.lua delete mode 100644 .typedefs/generated/LuaConstGL.lua delete mode 100644 .typedefs/generated/LuaConstGame.lua delete mode 100644 .typedefs/generated/LuaConstPlatform.lua delete mode 100644 .typedefs/generated/LuaFBOs.lua delete mode 100644 .typedefs/generated/LuaFeatureDefs.lua delete mode 100644 .typedefs/generated/LuaFonts.lua delete mode 100644 .typedefs/generated/LuaGaia.lua delete mode 100644 .typedefs/generated/LuaHandle.lua delete mode 100644 .typedefs/generated/LuaHandleSynced.lua delete mode 100644 .typedefs/generated/LuaIO.lua delete mode 100644 .typedefs/generated/LuaInputReceiver.lua delete mode 100644 .typedefs/generated/LuaInterCall.lua delete mode 100644 .typedefs/generated/LuaIntro.lua delete mode 100644 .typedefs/generated/LuaMaterial.lua delete mode 100644 .typedefs/generated/LuaMathExtra.lua delete mode 100644 .typedefs/generated/LuaMemPool.lua delete mode 100644 .typedefs/generated/LuaMenu.lua delete mode 100644 .typedefs/generated/LuaMetalMap.lua delete mode 100644 .typedefs/generated/LuaObjectRendering.lua delete mode 100644 .typedefs/generated/LuaOpenGL.lua delete mode 100644 .typedefs/generated/LuaOpenGLUtils.lua delete mode 100644 .typedefs/generated/LuaParser.lua delete mode 100644 .typedefs/generated/LuaPathFinder.lua delete mode 100644 .typedefs/generated/LuaRBOs.lua delete mode 100644 .typedefs/generated/LuaRules.lua delete mode 100644 .typedefs/generated/LuaRulesParams.lua delete mode 100644 .typedefs/generated/LuaScream.lua delete mode 100644 .typedefs/generated/LuaShaders.lua delete mode 100644 .typedefs/generated/LuaSyncedCtrl.lua delete mode 100644 .typedefs/generated/LuaSyncedMoveCtrl.lua delete mode 100644 .typedefs/generated/LuaSyncedRead.lua delete mode 100644 .typedefs/generated/LuaSyncedTable.lua delete mode 100644 .typedefs/generated/LuaTableExtra.lua delete mode 100644 .typedefs/generated/LuaTextures.lua delete mode 100644 .typedefs/generated/LuaTracyExtra.lua delete mode 100644 .typedefs/generated/LuaUI.lua delete mode 100644 .typedefs/generated/LuaUICommand.lua delete mode 100644 .typedefs/generated/LuaUnitDefs.lua delete mode 100644 .typedefs/generated/LuaUnsyncedCtrl.lua delete mode 100644 .typedefs/generated/LuaUnsyncedRead.lua delete mode 100644 .typedefs/generated/LuaUtils.lua delete mode 100644 .typedefs/generated/LuaVAO.lua delete mode 100644 .typedefs/generated/LuaVAOImpl.lua delete mode 100644 .typedefs/generated/LuaVBO.lua delete mode 100644 .typedefs/generated/LuaVBOImpl.lua delete mode 100644 .typedefs/generated/LuaVFS.lua delete mode 100644 .typedefs/generated/LuaVFSDownload.lua delete mode 100644 .typedefs/generated/LuaWeaponDefs.lua delete mode 100644 .typedefs/generated/LuaZip.lua delete mode 100644 .typedefs/types 2.lua.txt create mode 160000 recoil-lua-library diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..09569d3c28 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "recoil-lua-library"] + path = recoil-lua-library + url = https://github.com/beyond-all-reason/recoil-lua-library diff --git a/.typedefs/LuaVFS.lua b/.typedefs/LuaVFS.lua deleted file mode 100644 index a7019bc950..0000000000 --- a/.typedefs/LuaVFS.lua +++ /dev/null @@ -1,40 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----https://github.com/rhys-vdw/lua-doc-extractor ---- ----Source: LuaVFS.cpp ---- ----@meta - ----Virtual File System ---- ----@see rts/Lua/LuaVFS.cpp - -VFS={} ----Load, compiles, run, return ----@param filename string ----@param enviroment table|nil ----@param mode number|nil ----@return any ...any -function VFS.Include(filename,enviroment ,mode ) end - ----check whether a file exist ----@param filename string ----@param mode number|nil ----@return boolean -function VFS.FileExists(filename,mode) end - ----get a list of files ----@param directory string ----@param pattern string|nil ----@param mode number|nil ----@return {[integer]:string} -function VFS.DirList(directory,pattern,mode ) end - ----get a list of dirs ----@param directory string ----@param pattern string|nil ----@param mode number|nil ----@return {[integer]:string} -function VFS.SubDirs(directory,pattern,mode)end \ No newline at end of file diff --git a/.typedefs/Script.lua b/.typedefs/Script.lua deleted file mode 100644 index e9a5ca0ae4..0000000000 --- a/.typedefs/Script.lua +++ /dev/null @@ -1,16 +0,0 @@ - - - ----@meta - - -Script={} - ----check whether ergine's version is higher than given ----@param major number ----@param minor number ----@param commit number ----@return boolean|nil -function Script.IsEngineMinVersion(major,minor,commit) - -end \ No newline at end of file diff --git a/.typedefs/SpringDefines less.lua b/.typedefs/SpringDefines less.lua deleted file mode 100644 index 118701adb8..0000000000 --- a/.typedefs/SpringDefines less.lua +++ /dev/null @@ -1,127 +0,0 @@ --- ---@diagnostic disable: missing-return ----@meta Spring - ----@class table:{[any]:any} - -Spring=Spring or {} ----@class UnitId : integer ----@class UnitDefId:integer - ----@class PlayerId:integer ----@class TeamId:integer ----@class AllyteamId:integer ---[==[ ----@class timeSec:number - ----@class frame:integer ----@operator div(framePerSec):timeSec ----@class framePerSec:integer ----@operator mul(timeSec):frame - ----@class WldDist:number ----@operator div(frame):WldSpeed ----@operator add(WldDist):WldDist ----@operator add(WldSpeed):WldDist ----@alias WldxPos WldDist ----@alias WldyPos WldDist ----@alias WldzPos WldDist ---[=[ ----@class WldxPos:number ----@operator div(frame):WldxVel ----@operator add(WldxPos):WldxPos ----@operator add(WldxVel):WldxPos ----@class WldyPos:number ----@operator div(frame):WldyVel ----@operator add(WldyPos):WldyPos ----@operator add(WldyVel):WldyPos ----@class WldzPos:number ----@operator div(frame):WldzVel ----@operator add(WldzPos):WldzPos ----@operator add(WldzVel):WldzPos -]=] - ----@class WldSpeed:number ----@operator mul(frame):WldDist ----@operator unm:WldSpeed - ----@alias WldxVel WldSpeed ----@alias WldyVel WldSpeed ----@alias WldzVel WldSpeed -]==] - -Game={} ---- framePerSec -Game.gameSpeed=30 -Game.mapSizeX=512 -Game.mapSizeZ=512 - ----@type {[UnitDefId]:table} -UnitDefs={} - ----@alias WeaponDefName string - ----@class WeaponDefId:integer ----@class WeaponDef --:{id:WeaponDefId,[any]:any} ----@field id WeaponDefId ----@field name WeaponDefName ----@field damageAreaOfEffect number ----@field damages list ----@field flightTime number ----@field projectilespeed number ----@field range number ----@field reload number ----@field salvoSize number ----@field salvoDelay number ----@field projectiles number ----@field type string ----@field beamTTL number ----@field tracks boolean ----@field sprayAngle number ----@field craterMult number ----@field myGravity number ----@field customParams {[string]:string|number|nil} ----@field accuracy number ----@field turret boolean ----@field explosionSpeed number - - ----@type table -WeaponDefs={} - ----@type table -WeaponDefNames={} - - ----@class ProjectileId:number - - ---[=[ ----@class WldxVel:number ----@operator mul(frame):WldxPos ----@operator add(WldxVel):WldxVel ----@operator sub(WldxVel):WldxVel ----@operator unm:WldxVel ----@class WldyVel:number ----@operator mul(frame):WldyPos ----@operator add(WldyVel):WldyVel ----@operator sub(WldyVel):WldyVel ----@operator unm:WldyVel ----@class WldzVel:number ----@operator mul(frame):WldzPos ----@operator add(WldzVel):WldzVel ----@operator sub(WldzVel):WldzVel ----@operator unm:WldzVel -]=] - ---- show message to console. `"game_message: ".. msg` to show `msg` at chat (client only) ----@param ... any message to be shown -function Spring.Echo(...)end - ---CMD={} - ----@generic T ----@param v T ----@param recurse boolean|nil ----@param appendTo T|nil ----@return T -function Spring.Utilities.CopyTable(v,recurse,appendTo) end \ No newline at end of file diff --git a/.typedefs/SpringDefines then .lua .txt b/.typedefs/SpringDefines then .lua .txt deleted file mode 100644 index 616f8daf2d..0000000000 --- a/.typedefs/SpringDefines then .lua .txt +++ /dev/null @@ -1,147 +0,0 @@ - ---[=[ ----@class WldxVel:number ----@operator mul(frame):WldxPos ----@operator add(WldxVel):WldxVel ----@operator sub(WldxVel):WldxVel ----@operator unm:WldxVel ----@class WldyVel:number ----@operator mul(frame):WldyPos ----@operator add(WldyVel):WldyVel ----@operator sub(WldyVel):WldyVel ----@operator unm:WldyVel ----@class WldzVel:number ----@operator mul(frame):WldzPos ----@operator add(WldzVel):WldzVel ----@operator sub(WldzVel):WldzVel ----@operator unm:WldzVel -]=] - ---- show message to console. `"game_message: ".. msg` to show `msg` at chat (client only) ----@param ... any message to be shown -function Spring.Echo(...)end - - ----@param UnitId UnitId ----@return UnitDefId ----@nodiscard -function Spring.GetUnitDefID(UnitId)end - ----check whether UnitId is valid ----@param UnitId UnitId ----@return boolean -function Spring.ValidUnitID(UnitId)end - ----check whether unit is dead ----@param UnitId UnitId ----@return boolean -function Spring.GetUnitIsDead(UnitId)end - ----check whether unit belongs to you ----@param UnitId UnitId -function Spring.IsUnitAllied(UnitId)end - ---- return unit's base position (bottom),
---- unit's middle position with returnMidPos
---- unit's aim position with returnAimPos
---- extra values are pushed behind
---- eg `posx,posy,posz,aimx,aimy,aimz=spGetUnitPosition(UnitId,false,true)` ----@param UnitId UnitId ----@return WldxPos ----@return WldyPos ----@return WldzPos ----@return WldxPos ----@return WldyPos ----@return WldzPos ----@return WldxPos ----@return WldyPos ----@return WldzPos -function Spring.GetUnitPosition(UnitId,returnMidPos,returnAimPos)end - ----@param UnitId UnitId ----@return WldxVel ----@return WldyVel ----@return WldzVel ----@return WldSpeed -function Spring.GetUnitVelocity(UnitId)end - ---- get the height of the ground at the pos ----@param x WldxPos ----@param z WldzPos ----@return WldyPos -function Spring.GetGroundHeight(x,z)end - ----@return AllyteamId -function Spring.GetMyAllyTeamID()end - ----@return TeamId -function Spring.GetMyTeamID()end - ---- return true when spec ----@return boolean -function Spring.GetSpectatingState()end - ----whether pos is in radar of AllyteamId ----@param x WldxPos ----@param y WldyPos ----@param z WldzPos ----@param AllyteamId AllyteamId ----@return boolean -function Spring.IsPosInRadar(x,y,z,AllyteamId)end - ----whether pos is in los of AllyteamId ----@param x WldxPos ----@param y WldyPos ----@param z WldzPos ----@param AllyteamId AllyteamId ----@return boolean -function Spring.IsPosInLos(x,y,z,AllyteamId)end - ----add a marker ----@param x WldxPos ----@param y WldyPos ----@param z WldzPos ----@param msg string ----@param onlyLocal boolean|nil true to add marker to local only -function Spring.MarkerAddPoint(x,y,z,msg,onlyLocal)end - ----remove marker at pos ----@param x WldxPos ----@param y WldyPos ----@param z WldzPos -function Spring.MarkerErasePosition(x,y,z)end - ----returns units in Cylinder ----@param x WldxPos ----@param z WldzPos ----@param radius WldDist ----@param TeamId TeamId ----@return list -function Spring.GetUnitsInCylinder(x,z,radius,TeamId)end - - ----comment ----@param projectileID ProjectileId ----@return WldxPos ----@return WldyPos ----@return WldzPos -function Spring.GetProjectilePosition(projectileID)end - - ----@param projectileID ProjectileId ----@return WldxVel ----@return WldyVel ----@return WldzVel -function Spring.GetProjectileVelocity(projectileID)end - ----@param projId ProjectileId ----@return WeaponDefId -function Spring.GetProjectileDefID(projId)end - -CMD={} - ----@generic T ----@param v T ----@param recurse boolean|nil ----@return T -function Spring.Utilities.CopyTable(v,recurse) end \ No newline at end of file diff --git a/.typedefs/SpringDefines.lua.txt b/.typedefs/SpringDefines.lua.txt deleted file mode 100644 index 507dc165c0..0000000000 --- a/.typedefs/SpringDefines.lua.txt +++ /dev/null @@ -1,224 +0,0 @@ --- ---@diagnostic disable: missing-return ----@meta Spring - -Spring=Spring or {} ----@class UnitId : integer ----@class UnitDefId:integer - ----@class PlayerId:integer ----@class TeamId:integer ----@class AllyteamId:integer - ----@class timeSec:number - ----@class frame:integer ----@operator div(framePerSec):timeSec ----@class framePerSec:integer ----@operator mul(timeSec):frame - ----@class WldDist:number ----@operator div(frame):WldSpeed ----@operator add(WldDist):WldDist ----@operator add(WldSpeed):WldDist ----@alias WldxPos WldDist ----@alias WldyPos WldDist ----@alias WldzPos WldDist ---[=[ ----@class WldxPos:number ----@operator div(frame):WldxVel ----@operator add(WldxPos):WldxPos ----@operator add(WldxVel):WldxPos ----@class WldyPos:number ----@operator div(frame):WldyVel ----@operator add(WldyPos):WldyPos ----@operator add(WldyVel):WldyPos ----@class WldzPos:number ----@operator div(frame):WldzVel ----@operator add(WldzPos):WldzPos ----@operator add(WldzVel):WldzPos -]=] - ----@class WldSpeed:number ----@operator mul(frame):WldDist ----@operator unm:WldSpeed - ----@alias WldxVel WldSpeed ----@alias WldyVel WldSpeed ----@alias WldzVel WldSpeed - - -Game={} ---- framePerSec ----@type framePerSec -Game.gameSpeed=30 ----@type WldxPos -Game.mapSizeX=512 ----@type WldzPos -Game.mapSizeZ=512 - - ----@class WeaponDefId:integer ----@class WeaponDefName:string ----@class WeaponDef:any --:{id:WeaponDefId,[any]:any} ----@field id WeaponDefId ----@field name WeaponDefName ----@field damageAreaOfEffect number ----@field damages list ----@field flightTime number - ----@type table -WeaponDefs={} - ----@type table -WeaponDefNames={} - - ----@class ProjectileId:number - - ---[=[ ----@class WldxVel:number ----@operator mul(frame):WldxPos ----@operator add(WldxVel):WldxVel ----@operator sub(WldxVel):WldxVel ----@operator unm:WldxVel ----@class WldyVel:number ----@operator mul(frame):WldyPos ----@operator add(WldyVel):WldyVel ----@operator sub(WldyVel):WldyVel ----@operator unm:WldyVel ----@class WldzVel:number ----@operator mul(frame):WldzPos ----@operator add(WldzVel):WldzVel ----@operator sub(WldzVel):WldzVel ----@operator unm:WldzVel -]=] - ---- show message to console. `"game_message: ".. msg` to show `msg` at chat (client only) ----@param ... any message to be shown -function Spring.Echo(...)end - - ----@param UnitId UnitId ----@return UnitDefId ----@nodiscard -function Spring.GetUnitDefID(UnitId)end - ----check whether UnitId is valid ----@param UnitId UnitId ----@return boolean -function Spring.ValidUnitID(UnitId)end - ----check whether unit is dead ----@param UnitId UnitId ----@return boolean -function Spring.GetUnitIsDead(UnitId)end - ----check whether unit belongs to you ----@param UnitId UnitId -function Spring.IsUnitAllied(UnitId)end - ---- return unit's base position (bottom),
---- unit's middle position with returnMidPos
---- unit's aim position with returnAimPos
---- extra values are pushed behind
---- eg `posx,posy,posz,aimx,aimy,aimz=spGetUnitPosition(UnitId,false,true)` ----@param UnitId UnitId ----@return WldxPos ----@return WldyPos ----@return WldzPos ----@return WldxPos ----@return WldyPos ----@return WldzPos ----@return WldxPos ----@return WldyPos ----@return WldzPos -function Spring.GetUnitPosition(UnitId,returnMidPos,returnAimPos)end - ----@param UnitId UnitId ----@return WldxVel ----@return WldyVel ----@return WldzVel ----@return WldSpeed -function Spring.GetUnitVelocity(UnitId)end - ---- get the height of the ground at the pos ----@param x WldxPos ----@param z WldzPos ----@return WldyPos -function Spring.GetGroundHeight(x,z)end - ----@return AllyteamId -function Spring.GetMyAllyTeamID()end - ----@return TeamId -function Spring.GetMyTeamID()end - ---- return true when spec ----@return boolean -function Spring.GetSpectatingState()end - ----whether pos is in radar of AllyteamId ----@param x WldxPos ----@param y WldyPos ----@param z WldzPos ----@param AllyteamId AllyteamId ----@return boolean -function Spring.IsPosInRadar(x,y,z,AllyteamId)end - ----whether pos is in los of AllyteamId ----@param x WldxPos ----@param y WldyPos ----@param z WldzPos ----@param AllyteamId AllyteamId ----@return boolean -function Spring.IsPosInLos(x,y,z,AllyteamId)end - ----add a marker ----@param x WldxPos ----@param y WldyPos ----@param z WldzPos ----@param msg string ----@param onlyLocal boolean|nil true to add marker to local only -function Spring.MarkerAddPoint(x,y,z,msg,onlyLocal)end - ----remove marker at pos ----@param x WldxPos ----@param y WldyPos ----@param z WldzPos -function Spring.MarkerErasePosition(x,y,z)end - ----returns units in Cylinder ----@param x WldxPos ----@param z WldzPos ----@param radius WldDist ----@param TeamId TeamId ----@return list -function Spring.GetUnitsInCylinder(x,z,radius,TeamId)end - - ----comment ----@param projectileID ProjectileId ----@return WldxPos ----@return WldyPos ----@return WldzPos -function Spring.GetProjectilePosition(projectileID)end - - ----@param projectileID ProjectileId ----@return WldxVel ----@return WldyVel ----@return WldzVel -function Spring.GetProjectileVelocity(projectileID)end - ----@param projId ProjectileId ----@return WeaponDefId -function Spring.GetProjectileDefID(projId)end - -CMD={} - ----@generic T ----@param v T ----@param recurse boolean|nil ----@return T -function Spring.Utilities.CopyTable(v,recurse) end \ No newline at end of file diff --git a/.typedefs/Types.lua b/.typedefs/Types.lua deleted file mode 100644 index dd3ce3f3a2..0000000000 --- a/.typedefs/Types.lua +++ /dev/null @@ -1,127 +0,0 @@ ----@meta - --------------------------------------------------------------------------------- --- Vectors --------------------------------------------------------------------------------- - ----Cartesian triple (XYZ) ---- ----@class xyz:{[1]:number,[2]:number,[3]:number} ---[=[ ----@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 - ----@class rgba_list:{[1]:number,[2]:number,[3]:number,[4]: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 Alt key pressed ----@field ctrl boolean Ctrl key pressed ----@field shift boolean Shift key pressed ----@field right boolean Right mouse key pressed ----@field meta boolean Meta key pressed (space) ----@field internal boolean - ----Used when assigning multiple commands at once ---- ----@class Command ----@field cmdID integer ----@field params number[]? ----@field options CommandOptions? ----@field tag integer - ----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 - - ----@class list:{[integer]:T} \ No newline at end of file diff --git a/.typedefs/generated/LuaArchive.lua b/.typedefs/generated/LuaArchive.lua deleted file mode 100644 index 777c2fefce..0000000000 --- a/.typedefs/generated/LuaArchive.lua +++ /dev/null @@ -1,9 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----https://github.com/rhys-vdw/lua-doc-extractor ---- ----Source: LuaArchive.cpp ---- ----@meta - diff --git a/.typedefs/generated/LuaAtlasTextures.lua b/.typedefs/generated/LuaAtlasTextures.lua deleted file mode 100644 index 839d5d9fb5..0000000000 --- a/.typedefs/generated/LuaAtlasTextures.lua +++ /dev/null @@ -1,9 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----https://github.com/rhys-vdw/lua-doc-extractor ---- ----Source: LuaAtlasTextures.cpp ---- ----@meta - diff --git a/.typedefs/generated/LuaBitOps.lua b/.typedefs/generated/LuaBitOps.lua deleted file mode 100644 index 19fd7bab39..0000000000 --- a/.typedefs/generated/LuaBitOps.lua +++ /dev/null @@ -1,56 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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 ... integer ----@return integer result -function math.bit_or(...) end - ----Returns the bitwise AND of all arguments. Only use up to 24 bit integers. ---- ----@param ... integer ----@return integer result -function math.bit_and(...) end - ----Returns the bitwise XOR of all arguments. Only use up to 24 bit integers. ---- ----@param ... integer ----@return integer result -function math.bit_xor(...) 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 ... integer ----@return integer result -function math.bit_bits(...) end \ No newline at end of file diff --git a/.typedefs/generated/LuaConstCMD.lua b/.typedefs/generated/LuaConstCMD.lua deleted file mode 100644 index fadea4a34c..0000000000 --- a/.typedefs/generated/LuaConstCMD.lua +++ /dev/null @@ -1,198 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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/.typedefs/generated/LuaConstCMDTYPE.lua b/.typedefs/generated/LuaConstCMDTYPE.lua deleted file mode 100644 index f7c4cd8ed9..0000000000 --- a/.typedefs/generated/LuaConstCMDTYPE.lua +++ /dev/null @@ -1,65 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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/.typedefs/generated/LuaConstCOB.lua b/.typedefs/generated/LuaConstCOB.lua deleted file mode 100644 index 78ea55866f..0000000000 --- a/.typedefs/generated/LuaConstCOB.lua +++ /dev/null @@ -1,329 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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/.typedefs/generated/LuaConstEngine.lua b/.typedefs/generated/LuaConstEngine.lua deleted file mode 100644 index 2e05d4c58d..0000000000 --- a/.typedefs/generated/LuaConstEngine.lua +++ /dev/null @@ -1,48 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----https://github.com/rhys-vdw/lua-doc-extractor ---- ----Source: LuaConstEngine.cpp ---- ----@meta - ----Engine constants ---- ----@see rts/Lua/LuaConstEngine.cpp - ----@class FeatureSupport ----@field NegativeGetUnitCurrentCommand boolean ----@field hasExitOnlyYardmaps boolean ----@field rmlUiApiVersion integer -local FeatureSupport = {} - ----Engine specific information. -Engine = { - ---@type string "Major.Minor.PatchSet" for releases, "Major.Minor.PatchSet-CommitNum-gHash branch" otherwise - version = nil, - - ---@type string "Major.Minor.PatchSet" for releases, "Major.Minor.PatchSet-CommitNum-gHash branch" otherwise. Will also include (buildFlags), if there're any. - versionFull = nil, - - ---@type string Major part of the named release version - versionMajor = nil, - - ---@type string Minor part of the named release version - versionMinor = nil, - - ---@type string Build number of the named release version - versionPatchSet = nil, - - ---@type string Number of commits after the latest named release, non-zero indicates a "dev" build - commitsNumber = nil, - - ---@type string Gets additional engine buildflags, e.g. "Debug" or "Sync-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 always 64 these days - wordSize = nil -} \ No newline at end of file diff --git a/.typedefs/generated/LuaConstGL.lua b/.typedefs/generated/LuaConstGL.lua deleted file mode 100644 index 189898ce2d..0000000000 --- a/.typedefs/generated/LuaConstGL.lua +++ /dev/null @@ -1,606 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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 - 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 - 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, - - ---??? - ---@type number - LINE_BITS=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 - ----OpenGL Object Types ---- ----@section objecttypes - ----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/.typedefs/generated/LuaConstGame.lua b/.typedefs/generated/LuaConstGame.lua deleted file mode 100644 index 408f3df43e..0000000000 --- a/.typedefs/generated/LuaConstGame.lua +++ /dev/null @@ -1,202 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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/.typedefs/generated/LuaConstPlatform.lua b/.typedefs/generated/LuaConstPlatform.lua deleted file mode 100644 index d96cff0a17..0000000000 --- a/.typedefs/generated/LuaConstPlatform.lua +++ /dev/null @@ -1,93 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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 - gladVersion = 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 number Total physical system RAM in MBs. - totalRAM = 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/.typedefs/generated/LuaFBOs.lua b/.typedefs/generated/LuaFBOs.lua deleted file mode 100644 index 1d59f17477..0000000000 --- a/.typedefs/generated/LuaFBOs.lua +++ /dev/null @@ -1,112 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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 `GLAD_GL_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 `GLAD_GL_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 - ----needs `Platform.glVersionNum >= 30` ----Clears the "attachment" of the currently bound FBO type "target" with "clearValues" ---- ----@param target number? (Default: GL.FRAMEBUFFER) ----@param attachment GL|string (e.g. `"color0"` or `GL.COLOR_ATTACHMENT0`) ----@param clearValue0 number ----@param clearValue1 number ----@param clearValue2 number ----@param clearValue3 number -function gl.ClearAttachmentFBO(target, attachment, clearValue0, clearValue1, clearValue2, clearValue3) end \ No newline at end of file diff --git a/.typedefs/generated/LuaFeatureDefs.lua b/.typedefs/generated/LuaFeatureDefs.lua deleted file mode 100644 index 4cc07ea9e1..0000000000 --- a/.typedefs/generated/LuaFeatureDefs.lua +++ /dev/null @@ -1,9 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----https://github.com/rhys-vdw/lua-doc-extractor ---- ----Source: LuaFeatureDefs.cpp ---- ----@meta - diff --git a/.typedefs/generated/LuaFonts.lua b/.typedefs/generated/LuaFonts.lua deleted file mode 100644 index 5546f1fbc7..0000000000 --- a/.typedefs/generated/LuaFonts.lua +++ /dev/null @@ -1,33 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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). ---- ----@param filePath string VFS path to the file, for example "fonts/myfont.ttf". Uses VFS.RAW_FIRST access mode. ----@return boolean success -function gl.AddFallbackFont(filePath) end - ----Clears all fallback fonts. ---- ----See the note at 'AddFallbackFont' about the 'FontsChanged' callin, ----it also applies when calling this method. ---- ----@return nil -function gl.ClearFallbackFonts() end \ No newline at end of file diff --git a/.typedefs/generated/LuaGaia.lua b/.typedefs/generated/LuaGaia.lua deleted file mode 100644 index 1a030a00e0..0000000000 --- a/.typedefs/generated/LuaGaia.lua +++ /dev/null @@ -1,9 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----https://github.com/rhys-vdw/lua-doc-extractor ---- ----Source: LuaGaia.cpp ---- ----@meta - diff --git a/.typedefs/generated/LuaHandle.lua b/.typedefs/generated/LuaHandle.lua deleted file mode 100644 index a5e7e46c91..0000000000 --- a/.typedefs/generated/LuaHandle.lua +++ /dev/null @@ -1,831 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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 UnitDefId ----@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 UnitDefId ----@param unitTeam integer -function UnitFinished(unitID, unitDefID, unitTeam) end - ----Called when a factory finishes construction of a unit. ---- ----@param unitID integer ----@param unitDefID UnitDefId ----@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 UnitDefId ----@param unitTeam integer -function UnitReverseBuilt(unitID, unitDefID, unitTeam) end - ----Called when a unit being built starts decaying. ---- ----@param unitID integer ----@param unitDefID UnitDefId ----@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 UnitDefId ----@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 UnitDefId ----@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 UnitDefId ----@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 UnitDefId ----@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 UnitDefId ----@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 UnitDefId ----@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 UnitDefId ----@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 UnitDefId ----@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 UnitDefId ----@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 UnitDefId ----@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 UnitDefId -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 UnitDefId -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 UnitDefId -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 UnitDefId -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 UnitDefId -function UnitLeftLos(unitID, unitTeam, allyTeam, unitDefID) end - ----Transport ---- ----@section transport - ----Called when a unit is loaded by a transport. ---- ----@param unitID integer ----@param unitDefID UnitDefId ----@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 UnitDefId ----@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 UnitDefId ----@param unitTeam integer -function UnitEnteredUnderwater(unitID, unitDefID, unitTeam) end - ----@param unitID integer ----@param unitDefID UnitDefId ----@param unitTeam integer -function UnitEnteredWater(unitID, unitDefID, unitTeam) end - ----@param unitID integer ----@param unitDefID UnitDefId ----@param unitTeam integer -function UnitLeftAir(unitID, unitDefID, unitTeam) end - ----@param unitID integer ----@param unitDefID UnitDefId ----@param unitTeam integer -function UnitLeftUnderwater(unitID, unitDefID, unitTeam) end - ----@param unitID integer ----@param unitDefID UnitDefId ----@param unitTeam integer -function UnitLeftWater(unitID, unitDefID, unitTeam) end - ----@param unitID integer ----@param unitDefID UnitDefId ----@param unitTeam integer -function UnitEnteredAir(unitID, unitDefID, unitTeam) end - ----Called when a unit cloaks. ---- ----@param unitID integer ----@param unitDefID UnitDefId ----@param unitTeam integer -function UnitCloaked(unitID, unitDefID, unitTeam) end - ----Called when a unit decloaks. ---- ----@param unitID integer ----@param unitDefID UnitDefId ----@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 UnitDefId ----@param unitTeam integer -function UnitMoveFailed(unitID, unitDefID, unitTeam) end - ----@param unitID integer ----@param unitDefID UnitDefId ----@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 UnitDefId ----@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 UnitDefId ----@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 cmdType integer? -function ActiveCommandChanged(cmdId, cmdType) 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/.typedefs/generated/LuaHandleSynced.lua b/.typedefs/generated/LuaHandleSynced.lua deleted file mode 100644 index 5bcc72dc30..0000000000 --- a/.typedefs/generated/LuaHandleSynced.lua +++ /dev/null @@ -1,391 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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 UnitDefId ----@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 UnitDefId ----@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 UnitDefId ----@param builderID UnitId ----@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 UnitDefId ----@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 UnitId ----@param builderTeam integer ----@param unitID integer ----@param unitDefID UnitDefId ----@param part number ----@return boolean whether or not the build makes progress. -function AllowUnitBuildStep(builderID, builderTeam, unitID, unitDefID, part) end - ----@param builderID UnitId ----@param builderTeam integer ----@param unitID integer ----@param unitDefID UnitDefId ----@param part number ----@return boolean whether or not the capture makes progress. -function AllowUnitCaptureStep(builderID, builderTeam, unitID, unitDefID, part) end - ----@param transporterID UnitId ----@param transporterUnitDefID UnitDefId ----@param transporterTeam integer ----@param transporteeID integer ----@param transporteeUnitDefID UnitDefId ----@param transporteeTeam integer ----@return boolean whether or not the transport is allowed -function AllowUnitTransport(transporterID, transporterUnitDefID, transporterTeam, transporteeID, transporteeUnitDefID, transporteeTeam) end - ----@param transporterID UnitId ----@param transporterUnitDefID UnitDefId ----@param transporterTeam integer ----@param transporteeID integer ----@param transporteeUnitDefID UnitDefId ----@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 UnitId ----@param transporterUnitDefID UnitDefId ----@param transporterTeam integer ----@param transporteeID integer ----@param transporteeUnitDefID UnitDefId ----@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 TeamId ----@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 resurrect 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 UnitId ----@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 TeamId ----@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 TeamId ----@param newTeamID TeamId ----@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 UnitDefId ----@param unitTeam integer ----@param playerID PlayerId ----@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 UnitDefId ----@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 PlayerId ----@param teamID TeamId ----@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 UnitDefId ----@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 UnitDefId ----@param unitTeam integer ----@param buildUnitID integer ----@param buildUnitDefID UnitDefId ----@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 UnitDefId ----@param unitTeam integer ----@param damage number ----@param paralyzer boolean ----@param weaponDefID integer? Synced Only ----@param projectileID integer? Synced Only ----@param attackerID UnitId? 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 UnitId ----@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 UnitId ----@param shieldWeaponNum integer ----@param shieldCarrierID UnitId ----@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 UnitId ----@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 UnitId ----@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/.typedefs/generated/LuaIO.lua b/.typedefs/generated/LuaIO.lua deleted file mode 100644 index 37fbc9b896..0000000000 --- a/.typedefs/generated/LuaIO.lua +++ /dev/null @@ -1,9 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----https://github.com/rhys-vdw/lua-doc-extractor ---- ----Source: LuaIO.cpp ---- ----@meta - diff --git a/.typedefs/generated/LuaInputReceiver.lua b/.typedefs/generated/LuaInputReceiver.lua deleted file mode 100644 index be0ff925c6..0000000000 --- a/.typedefs/generated/LuaInputReceiver.lua +++ /dev/null @@ -1,9 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----https://github.com/rhys-vdw/lua-doc-extractor ---- ----Source: LuaInputReceiver.cpp ---- ----@meta - diff --git a/.typedefs/generated/LuaInterCall.lua b/.typedefs/generated/LuaInterCall.lua deleted file mode 100644 index 529034812e..0000000000 --- a/.typedefs/generated/LuaInterCall.lua +++ /dev/null @@ -1,9 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----https://github.com/rhys-vdw/lua-doc-extractor ---- ----Source: LuaInterCall.cpp ---- ----@meta - diff --git a/.typedefs/generated/LuaIntro.lua b/.typedefs/generated/LuaIntro.lua deleted file mode 100644 index f8e9b44776..0000000000 --- a/.typedefs/generated/LuaIntro.lua +++ /dev/null @@ -1,15 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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/.typedefs/generated/LuaMaterial.lua b/.typedefs/generated/LuaMaterial.lua deleted file mode 100644 index 4a5c874d72..0000000000 --- a/.typedefs/generated/LuaMaterial.lua +++ /dev/null @@ -1,9 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----https://github.com/rhys-vdw/lua-doc-extractor ---- ----Source: LuaMaterial.cpp ---- ----@meta - diff --git a/.typedefs/generated/LuaMathExtra.lua b/.typedefs/generated/LuaMathExtra.lua deleted file mode 100644 index 9016636b05..0000000000 --- a/.typedefs/generated/LuaMathExtra.lua +++ /dev/null @@ -1,85 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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/.typedefs/generated/LuaMemPool.lua b/.typedefs/generated/LuaMemPool.lua deleted file mode 100644 index 951cb96b4b..0000000000 --- a/.typedefs/generated/LuaMemPool.lua +++ /dev/null @@ -1,9 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----https://github.com/rhys-vdw/lua-doc-extractor ---- ----Source: LuaMemPool.cpp ---- ----@meta - diff --git a/.typedefs/generated/LuaMenu.lua b/.typedefs/generated/LuaMenu.lua deleted file mode 100644 index 929f65eeb6..0000000000 --- a/.typedefs/generated/LuaMenu.lua +++ /dev/null @@ -1,23 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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/.typedefs/generated/LuaMetalMap.lua b/.typedefs/generated/LuaMetalMap.lua deleted file mode 100644 index 3b54a9c8ff..0000000000 --- a/.typedefs/generated/LuaMetalMap.lua +++ /dev/null @@ -1,18 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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/.typedefs/generated/LuaObjectRendering.lua b/.typedefs/generated/LuaObjectRendering.lua deleted file mode 100644 index 60f97cd703..0000000000 --- a/.typedefs/generated/LuaObjectRendering.lua +++ /dev/null @@ -1,9 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----https://github.com/rhys-vdw/lua-doc-extractor ---- ----Source: LuaObjectRendering.cpp ---- ----@meta - diff --git a/.typedefs/generated/LuaOpenGL.lua b/.typedefs/generated/LuaOpenGL.lua deleted file mode 100644 index f87907e8f0..0000000000 --- a/.typedefs/generated/LuaOpenGL.lua +++ /dev/null @@ -1,85 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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 - ----@class GLenum:number ----@class GLuint:number - ---- ----labels an object for use with debugging tools ---- ----@param objectTypeIdentifier GLenum Specifies the type of object being labeled. ----@param objectID GLuint Specifies the name or ID of the object to label. ----@param label string A string containing the label to be assigned to the object. ----@return nil -function gl.ObjectLabel(objectTypeIdentifier, objectID, label) end - ---- ----pushes a debug marker for nVidia nSight 2024.04, does not seem to work when FBO's are raw bound ---- ----@param id GLuint A numeric identifier for the group. ----@param message string A human-readable string describing the debug group. ----@param sourceIsThirdParty boolean Set the source tag, true for GL_DEBUG_SOURCE_THIRD_PARTY, false for GL_DEBUG_SOURCE_APPLICATION. default false ----@return nil -function gl.PushDebugGroup(id, message, sourceIsThirdParty) end - ----@return nil -function gl.PopDebugGroup() end \ No newline at end of file diff --git a/.typedefs/generated/LuaOpenGLUtils.lua b/.typedefs/generated/LuaOpenGLUtils.lua deleted file mode 100644 index 6a08557a61..0000000000 --- a/.typedefs/generated/LuaOpenGLUtils.lua +++ /dev/null @@ -1,9 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----https://github.com/rhys-vdw/lua-doc-extractor ---- ----Source: LuaOpenGLUtils.cpp ---- ----@meta - diff --git a/.typedefs/generated/LuaParser.lua b/.typedefs/generated/LuaParser.lua deleted file mode 100644 index f30c9e91e2..0000000000 --- a/.typedefs/generated/LuaParser.lua +++ /dev/null @@ -1,9 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----https://github.com/rhys-vdw/lua-doc-extractor ---- ----Source: LuaParser.cpp ---- ----@meta - diff --git a/.typedefs/generated/LuaPathFinder.lua b/.typedefs/generated/LuaPathFinder.lua deleted file mode 100644 index 96dbcf9ef8..0000000000 --- a/.typedefs/generated/LuaPathFinder.lua +++ /dev/null @@ -1,9 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----https://github.com/rhys-vdw/lua-doc-extractor ---- ----Source: LuaPathFinder.cpp ---- ----@meta - diff --git a/.typedefs/generated/LuaRBOs.lua b/.typedefs/generated/LuaRBOs.lua deleted file mode 100644 index b1d3e4ca8a..0000000000 --- a/.typedefs/generated/LuaRBOs.lua +++ /dev/null @@ -1,38 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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/.typedefs/generated/LuaRules.lua b/.typedefs/generated/LuaRules.lua deleted file mode 100644 index 87a71920e3..0000000000 --- a/.typedefs/generated/LuaRules.lua +++ /dev/null @@ -1,12 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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/.typedefs/generated/LuaRulesParams.lua b/.typedefs/generated/LuaRulesParams.lua deleted file mode 100644 index 1bd6514795..0000000000 --- a/.typedefs/generated/LuaRulesParams.lua +++ /dev/null @@ -1,9 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----https://github.com/rhys-vdw/lua-doc-extractor ---- ----Source: LuaRulesParams.cpp ---- ----@meta - diff --git a/.typedefs/generated/LuaScream.lua b/.typedefs/generated/LuaScream.lua deleted file mode 100644 index 1ef3bd8bdf..0000000000 --- a/.typedefs/generated/LuaScream.lua +++ /dev/null @@ -1,9 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----https://github.com/rhys-vdw/lua-doc-extractor ---- ----Source: LuaScream.cpp ---- ----@meta - diff --git a/.typedefs/generated/LuaShaders.lua b/.typedefs/generated/LuaShaders.lua deleted file mode 100644 index ac61d8ba75..0000000000 --- a/.typedefs/generated/LuaShaders.lua +++ /dev/null @@ -1,220 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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 "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. ----@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 already 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 whether 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/.typedefs/generated/LuaSyncedCtrl.lua b/.typedefs/generated/LuaSyncedCtrl.lua deleted file mode 100644 index 3ce5d22c5e..0000000000 --- a/.typedefs/generated/LuaSyncedCtrl.lua +++ /dev/null @@ -1,1666 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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 AllyteamId ----@param secondAllyTeamID AllyteamId ----@param ally boolean ----@return nil -function Spring.SetAlly(firstAllyTeamID, secondAllyTeamID, ally) end - ----Changes the start box position of an allyTeam. ---- ----@param allyTeamID AllyteamId ----@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 PlayerId ----@param teamID TeamId ----@return nil -function Spring.AssignPlayerToTeam(playerID, teamID) end - ----Changes access to global line of sight for a team and its allies. ---- ----@param allyTeamID AllyteamId ----@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 TeamId ----@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 ... AllyteamId ----@return nil -function Spring.GameOver(...) 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 TeamId ----@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 TeamId ----@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 TeamId ----@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 TeamId ----@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 TeamId ----@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 ----environments! With those losAccess policies you can limit their access. ---- ----All GameRulesParam are public, TeamRulesParams can just be `private`,`allied` and/or `public` ----You can read RulesParams from any Lua environments! With those losAccess policies you can limit their access. ---- ----@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. ----@param losAccess losAccess? ----@return nil -function Spring.SetGameRulesParam(paramName, paramValue, losAccess) end - ----@param teamID TeamId ----@param paramName string ----@param paramValue ?number|string numeric paramValues in quotes will be converted to number. ----@param losAccess losAccess? ----@return nil -function Spring.SetTeamRulesParam(teamID, paramName, paramValue, losAccess) end - ----@param playerID PlayerId ----@param paramName string ----@param paramValue ?number|string numeric paramValues in quotes will be converted to number. ----@param losAccess losAccess? ----@return nil -function Spring.SetPlayerRulesParam(playerID, paramName, paramValue, losAccess) end - ----@param unitID UnitId ----@param paramName string ----@param paramValue ?number|string numeric paramValues in quotes will be converted to number. ----@param losAccess losAccess? ----@return nil -function Spring.SetUnitRulesParam(unitID, paramName, paramValue, losAccess) end - ----@param featureID integer ----@param paramName string ----@param paramValue ?number|string numeric paramValues in quotes will be converted to number. ----@param losAccess losAccess? ----@return nil -function Spring.SetFeatureRulesParam(featureID, paramName, paramValue, losAccess) end - ----Lua to COB ---- ----@section luatocob - ----@param unitID UnitId ----@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 UnitId ----@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 Facing ----@param teamID TeamId? ----@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 UnitId? requests specific unitID ----@param builderID UnitId? ----@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 UnitId ----@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 UnitId? ----@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 UnitId ----@param newTeamID TeamId ----@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 UnitId ----@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 UnitId ----@param res string ----@param amount number ----@return nil -function Spring.SetUnitResourcing(unitID, res, amount) end - ----@param unitID UnitId ----@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 - ----Unit Storage ---- ----@section unitstorage - ----@param unitID UnitId ----@param res string ----@param amount number -function Spring.SetUnitStorage(unitID, res, amount) end - ----@param unitID UnitId ----@param res ResourceUsage keys are: "[m|e]" metal | energy. Values are amounts -function Spring.SetUnitStorage(unitID, res) end - ----@param unitID UnitId ----@param tooltip string ----@return nil -function Spring.SetUnitTooltip(unitID, tooltip) end - ----@param unitID UnitId ----@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 UnitId ----@param maxHealth number ----@return nil -function Spring.SetUnitMaxHealth(unitID, maxHealth) end - ----@param unitID UnitId ----@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 UnitId ----@param forceUseWeapons number? ----@param allowUseWeapons number? ----@return nil -function Spring.SetUnitUseWeapons(unitID, forceUseWeapons, allowUseWeapons) end - ----@param unitID UnitId ----@param weaponNum number ----@param states WeaponState ----@return nil -function Spring.SetUnitWeaponState(unitID, weaponNum, states) end - ----@param unitID UnitId ----@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 UnitId ----@param weaponNum number|"selfDestruct"|"explode" ----@param damages WeaponDamages ----@return nil -function Spring.SetUnitWeaponDamages(unitID, weaponNum, damages) end - ----@param unitID UnitId ----@param weaponNum number|"selfDestruct"|"explode" ----@param key string ----@param value number ----@return nil -function Spring.SetUnitWeaponDamages(unitID, weaponNum, key, value) end - ----@param unitID UnitId ----@param maxRange number ----@return nil -function Spring.SetUnitMaxRange(unitID, maxRange) end - ----@see Spring.AddUnitExperience ----@see Spring.GetUnitExperience ----@param unitID UnitId ----@param experience number ----@return nil -function Spring.SetUnitExperience(unitID, experience) end - ----@see Spring.SetUnitExperience ----@see Spring.GetUnitExperience ----@param unitID UnitId ----@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 UnitId ----@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 UnitId ----@param allyTeam AllyteamId ----@param losTypes number|table ----@return nil -function Spring.SetUnitLosMask(unitID, allyTeam, losTypes) end - ----@param unitID UnitId ----@param allyTeam AllyteamId ----@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:=ultimate 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 UnitId ----@param cloak boolean|number ----@param cloakArg boolean|number|nil ----@return nil -function Spring.SetUnitCloak(unitID, cloak, cloakArg) end - ----@param unitID UnitId ----@param stealth boolean ----@return nil -function Spring.SetUnitStealth(unitID, stealth) end - ----@param unitID UnitId ----@param sonarStealth boolean ----@return nil -function Spring.SetUnitSonarStealth(unitID, sonarStealth) end - ----@param unitID UnitId ----@param seismicSignature number ----@return nil -function Spring.SetUnitSeismicSignature(unitID, seismicSignature) end - ----@param unitID UnitId ----@param alwaysVisible boolean ----@return nil -function Spring.SetUnitAlwaysVisible(unitID, alwaysVisible) end - ----@param unitID UnitId ----@param useAirLos boolean ----@return nil -function Spring.SetUnitUseAirLos(unitID, useAirLos) end - ----@param unitID UnitId ----@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 UnitId ----@param metal number ----@return nil -function Spring.SetUnitHarvestStorage(unitID, metal) end - ----@param unitID UnitId ----@param paramName string one of `buildRange`|`buildDistance`|`buildRange3D` ----@param value number|boolean boolean when `paramName` is `buildRange3D`, otherwise number. ----@return nil -function Spring.SetUnitBuildParams(unitID, paramName, value) end - ----@param builderID UnitId ----@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 UnitId ----@param pieces table ----@return nil -function Spring.SetUnitNanoPieces(builderID, pieces) end - ----@param unitID UnitId ----@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 UnitId ----@param crashing boolean ----@return boolean success -function Spring.SetUnitCrashing(unitID, crashing) end - ----@param unitID UnitId ----@param weaponID integer? (Default: -1) ----@param enabled boolean? ----@param power number? ----@return nil -function Spring.SetUnitShieldState(unitID, weaponID, enabled, power) end - ----@param unitID UnitId ----@param weaponID integer? (Default: -1) ----@param power number? ----@return nil -function Spring.SetUnitShieldState(unitID, weaponID, power) end - ----@param unitID UnitId ----@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 UnitId ----@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 UnitId ----@param Physical number[bit] state bit ----@return nil -function Spring.SetUnitPhysicalStateBit(unitID, Physical) end - ----@param unitID UnitId ----@return number Unit's PhysicalState bitmask -function Spring.GetUnitPhysicalState(unitID) end - ----@param unitID UnitId ----@param neutral boolean ----@return nil|boolean setNeutral -function Spring.SetUnitNeutral(unitID, neutral) end - ----Defines a unit's target. ---- ----@param unitID UnitId ----@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 UnitId ----@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 UnitId ----@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 UnitId ----@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 UnitId ----@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 UnitId ----@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 UnitId ----@param pieceNum number ----@param matrix number[] an array of 16 floats ----@return nil -function Spring.SetUnitPieceMatrix(unitID, pieceNum, matrix) end - ----@param unitID UnitId ----@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 UnitId ----@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 UnitId ----@param pieceIndex number ----@param visible boolean ----@return nil -function Spring.SetUnitPieceVisible(unitID, pieceIndex, visible) end - ----@param unitID UnitId ----@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 UnitId ----@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 UnitId ----@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 UnitId ----@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 UnitId ----@return nil -function Spring.ClearUnitGoal(unitID) end - ----@param unitID UnitId ----@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 UnitId ----@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 UnitId ----@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 UnitId ----@param x number ----@param y number ----@param z number ----@return nil -function Spring.SetUnitPosition(unitID, x, y, z) end - ----@param unitID UnitId ----@param yaw number ----@param pitch number ----@param roll number ----@return nil -function Spring.SetUnitRotation(unitID, yaw, pitch, roll) end - ----@param unitID UnitId ----@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 UnitId ----@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 UnitId ----@param velX number ----@param velY number ----@param velZ number ----@return nil -function Spring.SetUnitVelocity(unitID, velX, velY, velZ) end - ----@param unitID UnitId ----@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 TeamId ----@param spherical boolean? (Default: true) ----@param forced boolean? (Default: true) ----@param excludeUnitID integer? ----@param excludeUnitDefIDs number[]? ----@return nil -function Spring.BuggerOff(x, y, z, radius, teamID, spherical, forced, excludeUnitID, excludeUnitDefIDs) end - ----@param unitID UnitId ----@param damage number ----@param paralyze number? (Default: 0) equals to the paralyzetime in the WeaponDef. ----@param attackerID UnitId? (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 UnitId ----@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 UnitId ----@param pindSize number ----@return nil -function Spring.AddUnitSeismicPing(unitID, pindSize) end - ----@param unitID UnitId ----@param resource string "m" | "e" ----@param amount number ----@return nil -function Spring.AddUnitResource(unitID, resource, amount) end - ----@param unitID UnitId ----@param resource ResourceName ----@param amount number ----@return boolean? okay -function Spring.UseUnitResource(unitID, resource, amount) end - ----@param unitID UnitId ----@param resources ResourceUsage ----@return boolean? okay -function Spring.UseUnitResource(unitID, resources) end - ----Decals ---- ----@section decals - ----@param unitID UnitId ----@return nil -function Spring.AddObjectDecal(unitID) end - ----@param unitID UnitId ----@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 AllyteamId? ----@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 TeamId ----@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 - ----@param featureID integer ----@param unitDef string|integer Can be a number id or a string name, this allows cancelling resurrection by passing `-1`. ----@param facing Facing? (Default: `"south"`) ----@param progress number? Set the level of progress. ----@return nil -function Spring.SetFeatureResurrect(featureID, unitDef, facing, 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? initialVelocityX or velocityMaskX ----@param arg2 number? initialVelocityY or velocityMaskY ----@param arg3 number? initialVelocityZ or velocityMaskZ ----@param arg4 number? accelerationX or impulseMaskX ----@param arg5 number? accelerationY or impulseMaskY ----@param arg6 number? accelerationZ or impulseMaskZ ----@param arg7 number? movementMaskX ----@param arg8 number? movementMaskY ----@param arg9 number? movementMaskZ ----@return nil -function Spring.SetFeatureMoveCtrl(featureID, enable, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) 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|boolean? ----@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 ----@param ttl number Remaining time to live in frames ----@return nil -function Spring.SetProjectileTimeToLive(projectileID, ttl) end - ----@param projectileID integer ----@return nil -function Spring.SetProjectileIsIntercepted(projectileID) end - ----@param unitID UnitId ----@param weaponNum number ----@param key string|WeaponDamages ----@param value number|nil ----@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 UnitId -function Spring.UnitFinishCommand(unitID) end - ----@param unitID UnitId ----@param cmdID integer ----@param params number[]|number? ----@param options CommandOptions|number? ----@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 UnitId ----@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) Scaling factor. ----@return integer? absHeightDiff If `0`, nothing will be changed (the terraform starts), 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 ... number ----@return integer? absTotalHeightMapAmountChanged -function Spring.SetHeightMapFunc(luaFunction, ...) 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 UnitId ----@param weaponID integer ----@return nil -function Spring.UnitWeaponFire(unitID, weaponID) end - ----@param unitID UnitId ----@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 UnitId ----@return nil -function Spring.ForceUnitCollisionUpdate(unitID) end - ----@param transporterID UnitId ----@param passengerID UnitId ----@param pieceNum number ----@return nil -function Spring.UnitAttach(transporterID, passengerID, pieceNum) end - ----@param passengerID UnitId ----@return nil -function Spring.UnitDetach(passengerID) end - ----@param passengerID UnitId ----@return nil -function Spring.UnitDetachFromAir(passengerID) end - ----Disables collisions between the two units to allow colvol intersection during the approach. ---- ----@param passengerID UnitId ----@param transportID integer ----@return nil -function Spring.SetUnitLoadingTransport(passengerID, transportID) end - ----@param weaponDefID integer ----@param projectileParams ProjectileParams ----@return ProjectileId? 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 UnitId? (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 AllyteamId ----@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 UnitId ----@param cmdDescID integer ----@param cmdArray CommandDescription -function Spring.EditUnitCmdDesc(unitID, cmdDescID, cmdArray) end - ----@param unitID UnitId ----@param cmdDescID integer ----@param cmdArray CommandDescription -function Spring.InsertUnitCmdDesc(unitID, cmdDescID, cmdArray) end - - ----@param unitID UnitId ----@param cmdArray CommandDescription -function Spring.InsertUnitCmdDesc(unitID, cmdArray) end - ----@param unitID UnitId ----@param cmdDescID integer? -function Spring.RemoveUnitCmdDesc(unitID, cmdDescID) end \ No newline at end of file diff --git a/.typedefs/generated/LuaSyncedMoveCtrl.lua b/.typedefs/generated/LuaSyncedMoveCtrl.lua deleted file mode 100644 index 62773246d1..0000000000 --- a/.typedefs/generated/LuaSyncedMoveCtrl.lua +++ /dev/null @@ -1,12 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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/.typedefs/generated/LuaSyncedRead.lua b/.typedefs/generated/LuaSyncedRead.lua deleted file mode 100644 index e48a60fda4..0000000000 --- a/.typedefs/generated/LuaSyncedRead.lua +++ /dev/null @@ -1,1836 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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 TeamId? ----@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 ----@return number dirX, number dirY, number dirZ, number strength, number normDirX, number normDirY, number normDirZ -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 TeamId ----@return RulesParams rulesParams map with rules names as key and values as values -function Spring.GetTeamRulesParams(teamID) end - ----@param playerID PlayerId ----@return RulesParams rulesParams map with rules names as key and values as values -function Spring.GetPlayerRulesParams(playerID) end - ----@param unitID UnitId ----@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|nil value -function Spring.GetGameRulesParam(ruleRef) end - ----@param teamID TeamId ----@param ruleRef number|string the rule index or name ----@return nil|number|string value -function Spring.GetTeamRulesParam(teamID, ruleRef) end - ----@param playerID PlayerId ----@param ruleRef number|string the rule index or name ----@return nil|number|string value -function Spring.GetPlayerRulesParam(playerID, ruleRef) end - ----@param unitID UnitId ----@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 transferred 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 Value of `modOption`. -function Spring.GetMapOption(mapOption) end - ----@return table mapOptions Table with options names as keys and values as values. -function Spring.GetMapOptions() end - ----@param modOption string ----@return string value Value of `modOption`. -function Spring.GetModOption(modOption) end - ----@return table modOptions Table 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 TeamId ----@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 AllyteamId? (Default: -1) to filter teams belonging to when >= 0 ----@return number[] list of teamIDs -function Spring.GetTeamList(allyTeamID) end - ----@param teamID TeamId? (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 TeamId ----@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 TeamId ----@return integer? allyTeamID -function Spring.GetTeamAllyTeamID(teamID) end - ----@param teamID TeamId ----@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 TeamId ----@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 TeamId ----@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 TeamId ----@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 TeamId ----@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 TeamId ----@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 TeamId ----@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 TeamId ----@return number maxUnits ----@return number? currentUnits -function Spring.GetTeamMaxUnits(teamID) end - ----@param playerID PlayerId ----@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 PlayerId ----@return number? -function Spring.GetPlayerControlledUnit(playerID) end - ----@param teamID TeamId ----@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 AllyteamId ----@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 UnitId[] unitIDs -function Spring.GetAllUnits() end - ----@param teamID TeamId ----@return number[]? unitIDs -function Spring.GetTeamUnits(teamID) end - ----@param teamID TeamId ----@return table unitsByDef A table where keys are unitDefIDs and values are unitIDs -function Spring.GetTeamUnitsSorted(teamID) end - ----@param teamID TeamId ----@return table? countByUnit A table where keys are unitDefIDs and values are counts. -function Spring.GetTeamUnitsCounts(teamID) end - ----@param teamID TeamId ----@param unitDefIDs number|number[] ----@return number[]? unitIDs -function Spring.GetTeamUnitsByDefs(teamID, unitDefIDs) end - ----@param teamID TeamId ----@param unitDefID UnitDefId ----@return number? count -function Spring.GetTeamUnitDefCount(teamID, unitDefID) end - ----@param teamID TeamId ----@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 UnitId[] 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 UnitId[] unitIDs -function Spring.GetUnitsInBox(xmin, ymin, zmin, xmax, ymax, zmax, allegiance) end - ----@param x number ----@param z number ----@param radius number ----@return UnitId[] unitIDs -function Spring.GetUnitsInCylinder(x, z, radius) end - ----@param x number ----@param y number ----@param z number ----@param radius number ----@return UnitId[] 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 UnitId ----@param range number? (Default: 1.0e9f) ----@return number? unitID -function Spring.GetUnitNearestAlly(unitID, range) end - ----@param unitID UnitId ----@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 UnitId ----@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 UnitId ----@return UnitState -function Spring.GetUnitStates(unitID) end - ----@param unitID UnitId ----@return nil|boolean armored ----@return number armorMultiple -function Spring.GetUnitArmored(unitID) end - ----@param unitID UnitId ----@return boolean? isActive -function Spring.GetUnitIsActive(unitID) end - ----@param unitID UnitId ----@return boolean? isCloaked -function Spring.GetUnitIsCloaked(unitID) end - ----@param unitID UnitId ----@return number? seismicSignature -function Spring.GetUnitSeismicSignature(unitID) end - ----@param unitID UnitId ----@return integer? selfDTime -function Spring.GetUnitSelfDTime(unitID) end - ----@param unitID UnitId ----@return integer? numStockpiled ----@return integer? numStockpileQued ----@return number? buildPercent -function Spring.GetUnitStockpile(unitID) end - ----@param unitID UnitId ----@param type string one of los, airLos, radar, sonar, seismic, radarJammer, sonarJammer ----@return number? radius -function Spring.GetUnitSensorRadius(unitID, type) end - ----@param unitID UnitId ----@param allyTeamID AllyteamId? ----@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 UnitId ----@return nil|string -function Spring.GetUnitTooltip(unitID) end - ----@param unitID UnitId ----@return UnitDefId -function Spring.GetUnitDefID(unitID) end - ----@param unitID UnitId ----@return number? -function Spring.GetUnitTeam(unitID) end - ----@param unitID UnitId ----@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 UnitId ----@return nil|boolean -function Spring.GetUnitNeutral(unitID) end - ----@param unitID UnitId ----@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 UnitId ----@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 UnitId ----@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 UnitId ----@return boolean beingBuilt ----@return number buildProgress -function Spring.GetUnitIsBeingBuilt(unitID) end - ----@param unitID UnitId ----@return number? metalMake ----@return number metalUse ----@return number energyMake ----@return number energyUse -function Spring.GetUnitResources(unitID) end - ----@param unitID UnitId ----@return number Unit's metal storage ----@return number Unit's energy storage -function Spring.GetUnitStorage(unitID) end - ----@param unitID UnitId ----@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 UnitId ----@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 UnitId ----@return number? metalExtraction -function Spring.GetUnitMetalExtraction(unitID) end - ----@param unitID UnitId ----@return number xp [0.0; +∞) ----@return number limXp [0.0; 1.0) as experience approaches infinity -function Spring.GetUnitExperience(unitID) end - ----@param unitID UnitId ----@return number? -function Spring.GetUnitHeight(unitID) end - ----@param unitID UnitId ----@return number? -function Spring.GetUnitRadius(unitID) end - ---- ----Gets the unit's radius for when targeted by build, repair, reclaim-type commands. ---- ----@param unitID UnitId ----@return number? -function Spring.GetUnitBuildeeRadius(unitID) end - ----@param unitID UnitId ----@return number? -function Spring.GetUnitMass(unitID) end - ----@param unitID UnitId ----@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 UnitId ----@return number? posX ----@return number posY ----@return number posZ -function Spring.GetUnitBasePosition(unitID) end - ----@param unitID UnitId ----@return float3? front ----@return float3 up ----@return float3 right -function Spring.GetUnitVectors(unitID) end - ----@param unitID UnitId ----@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 UnitId ----@return number? dirX ----@return number? dirY ----@return number? dirZ -function Spring.GetUnitDirection(unitID) end - ----@param unitID UnitId ----@param convertToRadians boolean? (Default: false) ----@return number heading -function Spring.GetUnitHeading(unitID, convertToRadians) end - ----@param unitID UnitId ----@return number? vx ----@return number? vy ----@return number? vz -function Spring.GetUnitVelocity(unitID) end - ----@param unitID UnitId ----@return Facing -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 UnitId ----@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 UnitId ----@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 UnitId ----@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 UnitId -function Spring.GetUnitCurrentBuildPower(unitID) end - ----Get a unit's carried resources ---- ----Checks resources being carried internally by the unit. ---- ----@param unitID UnitId ----@return number storedMetal ----@return number maxStoredMetal ----@return number storedEnergy ----@return number maxStoredEnergy -function Spring.GetUnitHarvestStorage(unitID) end - ----@param unitID UnitId -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 UnitId ----@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 UnitId ----@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 UnitId ----@return number|nil transportUnitID -function Spring.GetUnitTransporter(unitID) end - ----Get units being transported ---- ----@param unitID UnitId ----@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 UnitId ----@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 UnitId -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 UnitId ----@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 UnitId ----@param weaponNum number ----@param stateName string ----@return number stateValue -function Spring.GetUnitWeaponState(unitID, weaponNum, stateName) 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 UnitId ----@param weaponNum number ----@return list damageTable -function Spring.GetUnitWeaponState(unitID, weaponNum) end - ----@param unitID UnitId -function Spring.GetUnitWeaponDamages(unitID) end - ----@param unitID UnitId -function Spring.GetUnitWeaponVectors(unitID) end - ----@param unitID UnitId -function Spring.GetUnitWeaponTryTarget(unitID) end - ----@param unitID UnitId -function Spring.GetUnitWeaponTestTarget(unitID) end - ----@param unitID UnitId -function Spring.GetUnitWeaponTestRange(unitID) end - ----@param unitID UnitId -function Spring.GetUnitWeaponHaveFreeLineOfFire(unitID) end - ----@param unitID UnitId -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 UnitId ----@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 UnitId ----@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 UnitId ----@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 UnitId ----@param weaponNum integer ----@return 3 TargetType projectileID ----@return boolean isUserTarget ----@return integer targetProjectileId -function Spring.GetUnitWeaponTarget(unitID, weaponNum) end - ----Misc ---- ----@section misc - ----@param unitID UnitId -function Spring.GetUnitEstimatedPath(unitID) end - ----@param unitID UnitId -function Spring.GetUnitLastAttacker(unitID) end - ----@param unitID UnitId -function Spring.GetUnitLastAttackedPiece(unitID) end - ----@param unitID UnitId -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 UnitId -function Spring.GetUnitFeatureSeparation(unitID) end - ----@param unitDefID UnitDefId -function Spring.GetUnitDefDimensions(unitDefID) end - -function Spring.GetCEGID() end - ----@param unitID UnitId ----@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 - ----@class MoveTypeData ----@field name string? ----@field maxSpeed number? ----@field maxWantedSpeed number? ----@field maneuverLeash number? ----@field waterline number? ----@field useWantedSpeed {[integer]:boolean?} ---- ----@field accRate number? ----@field decRate number? ----@field turnRate number? ---- ----@field atGoal boolean? ----@field atEndOfPath boolean? ----@field pushResistant boolean? ----@field minScriptChangeHeading integer? ----@field turnAccel number? ----@field myGravity number? ----@field maxReverseDist number? ----@field minReverseAngle number? ----@field maxReverseSpeed number? ----@field sqSkidSpeedMult number? ---- ----@field collide boolean? ----@field dontLand boolean? ----@field airStrafe boolean? ----@field useSmoothMesh boolean? ----@field bankingAllowed boolean? ----@field wantedHeight boolean? ----@field altitudeRate number? ----@field currentBank number? ----@field currentPitch number? ----@field maxDrift number? ----@field aircraftState string? - ----@param unitID UnitId ----@return MoveTypeData -function Spring.GetUnitMoveTypeData(unitID) end - ----@param unitID UnitId Unit id. ----@param cmdIndex integer? 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(unitID, cmdIndex) end - ----Get the commands for a unit. ---- ----Same as `Spring.GetCommandQueue` ---- ----@param unitID UnitId ----@param count integer Number of commands to return, `-1` returns all commands, `0` returns command count. ----@return list commands -function Spring.GetUnitCommands(unitID, count) end - ----Get the count of commands for a unit. ---- ----Same as `Spring.GetCommandQueue` ---- ----@param unitID UnitId ----@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 UnitId ----@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. ---- - ----@param unitID UnitId -function Spring.GetFactoryBuggerOff(unitID) end - ----Gets the build queue of a factory ---- ----@param unitID UnitId ----@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 UnitId ----@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 UnitId ----@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 UnitId ----@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 UnitId ----@return nil|table buildqueue indexed by unitDefID with count values -function Spring.GetRealBuildQueue(unitID) end - ----@param unitID UnitId -function Spring.GetUnitCmdDescs(unitID) end - ----@param unitID UnitId ----@param cmdID CMD -function Spring.FindUnitCmdDesc(unitID,cmdID) end - ----@param featureID integer ----@return boolean -function Spring.ValidFeatureID(featureID) end - ----@return integer[] featureIDs -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 ----@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.GetFeaturePosition(featureID,midPos,aimPos) 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 ----@return string|""|nil featureDefName ----@return Facing buildFacing -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 ProjectileId ----@return number? posX ----@return number posY ----@return number posZ -function Spring.GetProjectilePosition(projectileID) end - ----@param projectileID ProjectileId ----@return number? dirX ----@return number dirY ----@return number dirZ -function Spring.GetProjectileDirection(projectileID) end - ----@param projectileID ProjectileId ----@return number? velX ----@return number velY ----@return number velZ ----@return number velW -function Spring.GetProjectileVelocity(projectileID) end - ----@param projectileID ProjectileId ----@return number? -function Spring.GetProjectileGravity(projectileID) end - ----@param projectileID ProjectileId ----@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 ProjectileId ----@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 ProjectileId ----@return nil|boolean -function Spring.GetProjectileIsIntercepted(projectileID) end - ----@param projectileID ProjectileId ----@return number? -function Spring.GetProjectileTimeToLive(projectileID) end - ----@param projectileID ProjectileId ----@return number? -function Spring.GetProjectileOwnerID(projectileID) end - ----@param projectileID ProjectileId ----@return number? -function Spring.GetProjectileTeamID(projectileID) end - ----@param projectileID ProjectileId ----@return number? -function Spring.GetProjectileAllyTeamID(projectileID) end - ----@param projectileID ProjectileId ----@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 ProjectileId ----@return WeaponDefId? -function Spring.GetProjectileDefID(projectileID) end - ----@param projectileID ProjectileId ----@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 UnitDefId ----@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 UnitDefId ----@param x number ----@param y number ----@param z number ----@param facing Facing ----@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 UnitDefId ----@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 TeamId ----@param unitDefID UnitDefId ----@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 AllyteamId? ----@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 AllyteamId? ----@return boolean -function Spring.IsPosInLos(posX, posY, posZ, allyTeamID) end - ----@param posX number ----@param posY number ----@param posZ number ----@param allyTeamID AllyteamId? ----@return boolean -function Spring.IsPosInRadar(posX, posY, posZ, allyTeamID) end - ----@param posX number ----@param posY number ----@param posZ number ----@param allyTeamID AllyteamId? ----@return boolean -function Spring.IsPosInAirLos(posX, posY, posZ, allyTeamID) end - ----@param unitID UnitId ----@param allyTeamID AllyteamId? ----@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 UnitId ----@param allyTeamID AllyteamId? ----@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 UnitId ----@param allyTeamID AllyteamId ----@return boolean inLos -function Spring.IsUnitInLos(unitID, allyTeamID) end - ----@param unitID UnitId ----@param allyTeamID AllyteamId ----@return boolean inAirLos -function Spring.IsUnitInAirLos(unitID, allyTeamID) end - ----@param unitID UnitId ----@param allyTeamID AllyteamId ----@return boolean inRadar -function Spring.IsUnitInRadar(unitID, allyTeamID) end - ----@param unitID UnitId ----@param allyTeamID AllyteamId ----@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 UnitId ----@return number index of the root piece -function Spring.GetUnitRootPiece(unitID) end - ----@param unitID UnitId ----@return table pieceInfos where keys are piece names and values are indices -function Spring.GetUnitPieceMap(unitID) end - ----@param unitID UnitId ----@return string[] pieceNames -function Spring.GetUnitPieceList(unitID) end - ----@param unitID UnitId ----@param pieceIndex integer ----@return PieceInfo? pieceInfo -function Spring.GetUnitPieceInfo(unitID, pieceIndex) end - ----@param unitID UnitId ----@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 UnitId ----@param pieceIndex integer ----@return number|nil posX ----@return number posY ----@return number posZ -function Spring.GetUnitPiecePosition(unitID, pieceIndex) end - ----@param unitID UnitId ----@param pieceIndex integer ----@return number|nil dirX ----@return number dirY ----@return number dirZ -function Spring.GetUnitPieceDirection(unitID, pieceIndex) end - ----@param unitID UnitId ----@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,piece) 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 UnitId ----@return integer[] pieceIndices -function Spring.GetUnitScriptPiece(unitID) end - ----@param unitID UnitId ----@param scriptPiece integer ----@return integer pieceIndex -function Spring.GetUnitScriptPiece(unitID, scriptPiece) end - ----@param unitID UnitId ----@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. ---- ----@param posX number ----@param posY number ----@param posZ number ----@param dirX number ----@param dirY number ----@param dirZ number ----@param testWater boolean? (Default: `true`) ----@return number rayLength ----@return number posX ----@return number posY ----@return number posZ -function Spring.TraceRayGroundInDirection(posX, posY, posZ, dirX, dirY, dirZ, testWater) 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. ---- ----@param startX number ----@param startY number ----@param startZ number ----@param endX number ----@param endY number ----@param endZ number ----@param testWater boolean? (Default: `true`) ----@return number rayLength ----@return number posX ----@return number posY ----@return number posZ -function Spring.TraceRayGroundBetweenPositions(startX, startY, startZ, endX, endY, endZ, testWater) end - ----Misc ---- ----@section misc - ----@param allyTeamID AllyteamId ----@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/.typedefs/generated/LuaSyncedTable.lua b/.typedefs/generated/LuaSyncedTable.lua deleted file mode 100644 index 3ed8e5f673..0000000000 --- a/.typedefs/generated/LuaSyncedTable.lua +++ /dev/null @@ -1,9 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----https://github.com/rhys-vdw/lua-doc-extractor ---- ----Source: LuaSyncedTable.cpp ---- ----@meta - diff --git a/.typedefs/generated/LuaTableExtra.lua b/.typedefs/generated/LuaTableExtra.lua deleted file mode 100644 index 901fe0d73b..0000000000 --- a/.typedefs/generated/LuaTableExtra.lua +++ /dev/null @@ -1,22 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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/.typedefs/generated/LuaTextures.lua b/.typedefs/generated/LuaTextures.lua deleted file mode 100644 index bda8e99261..0000000000 --- a/.typedefs/generated/LuaTextures.lua +++ /dev/null @@ -1,9 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----https://github.com/rhys-vdw/lua-doc-extractor ---- ----Source: LuaTextures.cpp ---- ----@meta - diff --git a/.typedefs/generated/LuaTracyExtra.lua b/.typedefs/generated/LuaTracyExtra.lua deleted file mode 100644 index 0a1a824b8a..0000000000 --- a/.typedefs/generated/LuaTracyExtra.lua +++ /dev/null @@ -1,28 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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/.typedefs/generated/LuaUI.lua b/.typedefs/generated/LuaUI.lua deleted file mode 100644 index 135250ae3a..0000000000 --- a/.typedefs/generated/LuaUI.lua +++ /dev/null @@ -1,10 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----https://github.com/rhys-vdw/lua-doc-extractor ---- ----Source: LuaUI.cpp ---- ----@meta - -function ConfigureLayout() end \ No newline at end of file diff --git a/.typedefs/generated/LuaUICommand.lua b/.typedefs/generated/LuaUICommand.lua deleted file mode 100644 index 1efbcfb4ff..0000000000 --- a/.typedefs/generated/LuaUICommand.lua +++ /dev/null @@ -1,9 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----https://github.com/rhys-vdw/lua-doc-extractor ---- ----Source: LuaUICommand.cpp ---- ----@meta - diff --git a/.typedefs/generated/LuaUnitDefs.lua b/.typedefs/generated/LuaUnitDefs.lua deleted file mode 100644 index bc3c5ec51a..0000000000 --- a/.typedefs/generated/LuaUnitDefs.lua +++ /dev/null @@ -1,9 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----https://github.com/rhys-vdw/lua-doc-extractor ---- ----Source: LuaUnitDefs.cpp ---- ----@meta - diff --git a/.typedefs/generated/LuaUnsyncedCtrl.lua b/.typedefs/generated/LuaUnsyncedCtrl.lua deleted file mode 100644 index a8f36ef3cc..0000000000 --- a/.typedefs/generated/LuaUnsyncedCtrl.lua +++ /dev/null @@ -1,1322 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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 ----| "deprecated" # LOG.DEPRECATED ----| "error" # LOG.ERROR ----| "fatal" # LOG.FATAL - ----@param section string ----@param logLevel LogLevel? (Default: "notice") ----@param ... string messages -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 ``"``"`` where `#` is a player ID. ---- ----This will be replaced with the player's name. e.g. ----```lua ----Spring.SendMessage("`` did something") -- "ProRusher did something" ----``` ----@return nil -function Spring.SendMessageToSpectators(message) end - ----@param playerID PlayerId ----@param message string ----@return nil -function Spring.SendMessageToPlayer(playerID, message) end - ----@param teamID TeamId ----@param message string ----@return nil -function Spring.SendMessageToTeam(teamID, message) end - ----@param allyID integer ----@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 integer ----@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 UnitDefId ----@param posX number ----@param posY number ----@param posZ number ----@param teamID TeamId ----@param facing number ----@return nil -function Spring.AddWorldUnit(unitDefID, posX, posY, posZ, teamID, facing) end - ----@param unitID UnitId ----@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 Runtime 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 1|2 `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 UnitId The unit to look at. ----@return nil -function Spring.SetDollyCameraLookUnit(unitID) end - ----Unit Selection ---- ----@section unit_selection - ----Selects a single unit ---- ----@param unitID UnitId? ----@param append boolean? (Default: false) Append to current selection. ----@return nil -function Spring.SelectUnit(unitID, append) end - ----@param unitID UnitId ----@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 integer ----@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 integer ----@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 integer ----@param deferredShaderID integer ----@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 UnitId ----@param noDraw boolean ----@return nil -function Spring.SetUnitNoDraw(unitID, noDraw) end - ----@param unitID UnitId ----@param drawMask number ----@return nil -function Spring.SetUnitEngineDrawMask(unitID, drawMask) end - ----@param unitID UnitId ----@param alwaysUpdateMatrix boolean ----@return nil -function Spring.SetUnitAlwaysUpdateMatrix(unitID, alwaysUpdateMatrix) end - ----@param unitID UnitId ----@param unitNoMinimap boolean ----@return nil -function Spring.SetUnitNoMinimap(unitID, unitNoMinimap) end - ----@param unitID UnitId ----@param unitNoGroup boolean Whether unit can be added to selection groups -function Spring.SetUnitNoGroup(unitID, unitNoGroup) end - ----@param unitID UnitId ----@param unitNoSelect boolean whether unit can be selected or not ----@return nil -function Spring.SetUnitNoSelect(unitID, unitNoSelect) end - ----@param unitID UnitId ----@param unitLeaveTracks boolean whether unit leaves tracks on movement ----@return nil -function Spring.SetUnitLeaveTracks(unitID, unitLeaveTracks) end - ----@param unitID UnitId --- ---@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.SetUnitSelectionVolumeData(unitID,--[=[ featureID,]=] scaleX, scaleY, scaleZ, offsetX, offsetY, offsetZ, vType, tType, Axis) end - ----Features ---- ----@section features - ----@param featureID integer ----@param noDraw boolean ----@return nil -function Spring.SetFeatureNoDraw(featureID, noDraw) end - ----@param featureID integer ----@param engineDrawMask number ----@return nil -function Spring.SetFeatureEngineDrawMask(featureID, engineDrawMask) end - ----@param featureID integer ----@param alwaysUpdateMat number ----@return nil -function Spring.SetFeatureAlwaysUpdateMatrix(featureID, alwaysUpdateMat) end - ----Control whether a feature will fade or not when zoomed out. ---- ----@param featureID integer ----@param allow boolean ----@return nil -function Spring.SetFeatureFade(featureID, allow) end - ----@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.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 UnitId ----@param drawIcon boolean ----@return nil -function Spring.UnitIconSetDraw(unitID, drawIcon) end - ----@param unitID UnitId ----@param drawIcon boolean ----@return nil -function Spring.SetUnitIconDraw(unitID, drawIcon) end - ----@param unitDefID UnitDefId ----@param iconName string ----@return nil -function Spring.SetUnitDefIcon(unitDefID, iconName) end - ----@param unitDefID UnitDefId ----@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 TeamId ----@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 integer ----@param cmdReference (string|number)? iconname | cmdID_cloneIcon ----@param RGBA rgba_list? ----@param showArea boolean? ----@return boolean? assigned -function Spring.SetCustomCommandDrawData(cmdID, cmdReference, RGBA, showArea ) 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 rgb ----@param LOS rgb ----@param radar rgb ----@param jam rgb ----@param radar2 rgb ----@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 UnitId ----@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 integer ----@param params table ----@param options cmdOpts ----@return nil|true -function Spring.GiveOrder(cmdID, params, options) end - ----@param unitID UnitId ----@param cmdID integer ----@param params table ----@param options cmdOpts ----@return nil|true -function Spring.GiveOrderToUnit(unitID, cmdID, params, options) end - ----@param unitMap table { [unitID] = arg1, ... } ----@param cmdID integer ----@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 integer ----@param params table ----@param options cmdOpts ----@return nil|true -function Spring.GiveOrderToUnitArray(unitArray, cmdID, params, options) end - ----@param unitID UnitId ----@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[] ----@param pairwise boolean? (Default: `false`) 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. ----@return nil|boolean -function Spring.GiveOrderArrayToUnitArray(unitArray, cmdArray, pairwise) 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-environment 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 TeamId ----@param units string ----@return nil -function Spring.ShareResources(teamID, units) end - ----@param teamID TeamId ----@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 - ----@param itersPerBatch integer? ----@param numStepsPerIter integer? ----@param minStepsPerIter integer? ----@param maxStepsPerIter integer? ----@param minLoopRunTime number? ----@param maxLoopRunTime number? ----@param baseRunTimeMult number? ----@param baseMemLoadMult number? ----@return nil -function Spring.GarbageCollectCtrl(itersPerBatch, numStepsPerIter, minStepsPerIter, maxStepsPerIter, minLoopRunTime, maxLoopRunTime, baseRunTimeMult, baseMemLoadMult) end - ----@param autoShow boolean ----@return nil -function Spring.SetAutoShowMetal(autoShow) 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 ----@return 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 UnitDefId ----@return nil -function Spring.PreloadUnitDefModel(unitDefID) end - ----@param featureDefID integer ----@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 integer ----@return boolean delSuccess -function Spring.DestroyGroundDecal(decalID) end - ----@param decalID integer ----@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 integer ----@param rot number? (Default: random) in radians ----@return boolean decalSet -function Spring.SetGroundDecalRotation(decalID, rot) end - ----@param decalID integer ----@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 integer ----@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 integer ----@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 integer ----@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 integer ----@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 integer ----@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 integer ----@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/.typedefs/generated/LuaUnsyncedRead.lua b/.typedefs/generated/LuaUnsyncedRead.lua deleted file mode 100644 index 7379c94831..0000000000 --- a/.typedefs/generated/LuaUnsyncedRead.lua +++ /dev/null @@ -1,1039 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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 UnitId ----@return boolean? isAllied nil with unitID cannot be parsed -function Spring.IsUnitAllied(unitID) end - ----@param unitID UnitId ----@return boolean? isSelected nil when unitID cannot be parsed -function Spring.IsUnitSelected(unitID) end - ----@param unitID UnitId ----@return boolean? draw nil when unitID cannot be parsed -function Spring.GetUnitLuaDraw(unitID) end - ----@param unitID UnitId ----@return boolean? nil when unitID cannot be parsed -function Spring.GetUnitNoDraw(unitID) end - ----@param unitID UnitId ----@return boolean? nil when unitID cannot be parsed -function Spring.GetUnitEngineDrawMask(unitID) end - ----@param unitID UnitId ----@return boolean? nil when unitID cannot be parsed -function Spring.GetUnitAlwaysUpdateMatrix(unitID) end - ----@param unitID UnitId ----@return number? nil when unitID cannot be parsed -function Spring.GetUnitDrawFlag(unitID) end - ----@param unitID UnitId ----@return boolean? nil when unitID cannot be parsed -function Spring.GetUnitNoMinimap(unitID) end - ----@param unitID UnitId ----@return nil|boolean noGroup `nil` when `unitID` cannot be parsed. -function Spring.GetUnitNoGroup(unitID) end - ----@param unitID UnitId ----@return boolean? noSelect `nil` when `unitID` cannot be parsed. -function Spring.GetUnitNoSelect(unitID) end - ----@param unitID UnitId ----@return boolean? drawIcon ----`true` if icon is being drawn, `nil` when unitID is invalid, otherwise `false`. -function Spring.UnitIconGetDraw(unitID) end - ----@param unitID UnitId ----@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 UnitId ----@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 UnitId ----@return boolean? inView nil when unitID cannot be parsed -function Spring.IsUnitInView(unitID) end - ----@param unitID UnitId ----@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 UnitId ----@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 UnitId ----@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 TeamId? (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 TeamId? (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 AllyteamId? (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 UnitId[] 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 collision sphere. Per Piece collision and custom collision 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 TeamId ----@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 TeamId ----@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 - ----@class SoundDeviceSpec ---- ----Contains data about a sound device. ----@field name string -local SoundDeviceSpec = {} - ----@return SoundDeviceSpec[] devices Sound devices. -function Spring.GetSoundDevices() end - ----@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 - ----@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 UnitId ----@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 PlayerId ----@field teamID TeamId ----@field allyTeamID AllyteamId ----@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 PlayerId ----@param packetID integer? ----@return number traffic -function Spring.GetPlayerTraffic(playerID, packetID) end - ----@param playerID PlayerId ----@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 ----@param default number? (Default: `0`) ----@return number? configInt -function Spring.GetConfigInt(name, default) end - ----@param name string ----@param default number? (Default: `0`) ----@return number? configFloat -function Spring.GetConfigFloat(name, default) end - ----@param name string ----@param default string? (Default: `""`) ----@return number? configString -function Spring.GetConfigString(name, default) 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/.typedefs/generated/LuaUtils.lua b/.typedefs/generated/LuaUtils.lua deleted file mode 100644 index a6e187c788..0000000000 --- a/.typedefs/generated/LuaUtils.lua +++ /dev/null @@ -1,22 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----https://github.com/rhys-vdw/lua-doc-extractor ---- ----Source: LuaUtils.cpp ---- ----@meta - ----@alias Facing ----| 0 # South ----| 1 # East ----| 2 # North ----| 3 # West ----| "s" # South ----| "e" # East ----| "n" # North ----| "w" # West ----| "south" # South ----| "east" # East ----| "north" # North ----| "west" # West \ No newline at end of file diff --git a/.typedefs/generated/LuaVAO.lua b/.typedefs/generated/LuaVAO.lua deleted file mode 100644 index 534c9bf0d2..0000000000 --- a/.typedefs/generated/LuaVAO.lua +++ /dev/null @@ -1,19 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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/.typedefs/generated/LuaVAOImpl.lua b/.typedefs/generated/LuaVAOImpl.lua deleted file mode 100644 index 868436dd50..0000000000 --- a/.typedefs/generated/LuaVAOImpl.lua +++ /dev/null @@ -1,76 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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 - ----Attaches a VBO to be used as a vertex buffer ---- ----@param vbo VBO ----@return nil -function VAO:AttachVertexBuffer(vbo) end - ----Attaches a VBO to be used as an instance buffer ---- ----@param vbo VBO ----@return nil -function VAO:AttachInstanceBuffer(vbo) end - ----Attaches 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/.typedefs/generated/LuaVBO.lua b/.typedefs/generated/LuaVBO.lua deleted file mode 100644 index f6eb94affb..0000000000 --- a/.typedefs/generated/LuaVBO.lua +++ /dev/null @@ -1,36 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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/.typedefs/generated/LuaVBOImpl.lua b/.typedefs/generated/LuaVBOImpl.lua deleted file mode 100644 index 7967db1253..0000000000 --- a/.typedefs/generated/LuaVBOImpl.lua +++ /dev/null @@ -1,272 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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 - ----Gets the OpenGL Buffer ID ---- ----@return number bufferID -function VBO:GetID() end \ No newline at end of file diff --git a/.typedefs/generated/LuaVFS.lua b/.typedefs/generated/LuaVFS.lua deleted file mode 100644 index 35da3e7dc2..0000000000 --- a/.typedefs/generated/LuaVFS.lua +++ /dev/null @@ -1,12 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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/.typedefs/generated/LuaVFSDownload.lua b/.typedefs/generated/LuaVFSDownload.lua deleted file mode 100644 index 66e13b2195..0000000000 --- a/.typedefs/generated/LuaVFSDownload.lua +++ /dev/null @@ -1,9 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----https://github.com/rhys-vdw/lua-doc-extractor ---- ----Source: LuaVFSDownload.cpp ---- ----@meta - diff --git a/.typedefs/generated/LuaWeaponDefs.lua b/.typedefs/generated/LuaWeaponDefs.lua deleted file mode 100644 index b3c8ffd3f8..0000000000 --- a/.typedefs/generated/LuaWeaponDefs.lua +++ /dev/null @@ -1,9 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----https://github.com/rhys-vdw/lua-doc-extractor ---- ----Source: LuaWeaponDefs.cpp ---- ----@meta - diff --git a/.typedefs/generated/LuaZip.lua b/.typedefs/generated/LuaZip.lua deleted file mode 100644 index 85dc6b7b22..0000000000 --- a/.typedefs/generated/LuaZip.lua +++ /dev/null @@ -1,60 +0,0 @@ - ----!!! DO NOT MANUALLY EDIT THIS FILE !!! ----Generated by lua-doc-extractor 1.0.0 ----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 diff --git a/.typedefs/types 2.lua.txt b/.typedefs/types 2.lua.txt deleted file mode 100644 index 6048b3d71f..0000000000 --- a/.typedefs/types 2.lua.txt +++ /dev/null @@ -1,76 +0,0 @@ --- ---@diagnostic disable: missing-return ----@meta Spring - -Spring=Spring or {} ----@class UnitId : integer ----@class UnitDefId:integer - ----@class PlayerId:integer ----@class TeamId:integer ----@class AllyteamId:integer - ----@class timeSec:number - ----@class frame:integer ----@operator div(framePerSec):timeSec ----@class framePerSec:integer ----@operator mul(timeSec):frame - ----@class WldDist:number ----@operator div(frame):WldSpeed ----@operator add(WldDist):WldDist ----@operator add(WldSpeed):WldDist ----@alias WldxPos WldDist ----@alias WldyPos WldDist ----@alias WldzPos WldDist ---[=[ ----@class WldxPos:number ----@operator div(frame):WldxVel ----@operator add(WldxPos):WldxPos ----@operator add(WldxVel):WldxPos ----@class WldyPos:number ----@operator div(frame):WldyVel ----@operator add(WldyPos):WldyPos ----@operator add(WldyVel):WldyPos ----@class WldzPos:number ----@operator div(frame):WldzVel ----@operator add(WldzPos):WldzPos ----@operator add(WldzVel):WldzPos -]=] - ----@class WldSpeed:number ----@operator mul(frame):WldDist ----@operator unm:WldSpeed - ----@alias WldxVel WldSpeed ----@alias WldyVel WldSpeed ----@alias WldzVel WldSpeed - - -Game={} ---- framePerSec ----@type framePerSec -Game.gameSpeed=30 ----@type WldxPos -Game.mapSizeX=512 ----@type WldzPos -Game.mapSizeZ=512 - - ----@class WeaponDefId:integer ----@class WeaponDefName:string ----@class WeaponDef:any --:{id:WeaponDefId,[any]:any} ----@field id WeaponDefId ----@field name WeaponDefName ----@field damageAreaOfEffect number ----@field damages list ----@field flightTime number - ----@type table -WeaponDefs={} - ----@type table -WeaponDefNames={} - - ----@class ProjectileId:number diff --git a/recoil-lua-library b/recoil-lua-library new file mode 160000 index 0000000000..dd7ecc7789 --- /dev/null +++ b/recoil-lua-library @@ -0,0 +1 @@ +Subproject commit dd7ecc7789c124c72ce3f616bf8531d61b42dfdd From 647ae7b3996fe38e2bc0a2f5ee3b8e1b6fdb5046 Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Wed, 31 Dec 2025 23:43:24 +0800 Subject: [PATCH 23/40] bomberassault.lua duplicate selfDestructAs --- units/bomberassault.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/units/bomberassault.lua b/units/bomberassault.lua index ecff00c01e..c21b9a0ebe 100644 --- a/units/bomberassault.lua +++ b/units/bomberassault.lua @@ -28,8 +28,6 @@ return { bomberassault = { air_manual_fire_weapon = 3, manualfire_desc = [[Fire Special Weapon: Fire a cluster of temporary shield generators.]], }, - - selfDestructAs = [[ESTOR_BUILDING]], floater = true, footprintX = 4, footprintZ = 4, From c5b50b706b0d3520193f24dab5c4b92d223e5128 Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Thu, 1 Jan 2026 00:15:21 +0800 Subject: [PATCH 24/40] .luarc.json --- .luarc.json | 54 ++++++++++++++++++++++----------------------- scripts/.luarc.json | 2 +- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/.luarc.json b/.luarc.json index 9612139275..16af05744a 100644 --- a/.luarc.json +++ b/.luarc.json @@ -2,33 +2,36 @@ "$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json", "diagnostics.globalsRegex": ["CMD_.*"], "diagnostics.globals": [ - "VFS", - "UnitDefs", - "UnitDefNames", - "FeatureDefs", - "ModularCommDefsShared", - "piece", - "GG", - "Script", - "WG", - "widgetHandler", - "widget", - "GameData", - "Shared", "gadget", - "DEFS", - "LOG", - "FeatureDefNames", - "SendToUnsynced", - "CMD", - "WeaponDefs", - "CMDTYPE", - "WeaponDefNames" + "widget" + // "VFS", + // "UnitDefs", + // "UnitDefNames", + // "FeatureDefs", + // "ModularCommDefsShared", + // "piece", + // "GG", + // "Script", + // "WG", + // "widgetHandler", + // "widget", + // "GameData", + // "Shared", + // "gadget", + // "DEFS", + // "LOG", + // "FeatureDefNames", + // "SendToUnsynced", + // "CMD", + // "WeaponDefs", + // "CMDTYPE", + // "WeaponDefNames" //,{ "name": "script", "include": "scripts/**.lua" } ], "runtime.version": "Lua 5.1", "diagnostics.disable": [ - "duplicate-set-field" + "duplicate-set-field", + "cast-local-type" // because it is frequently used ], "runtime.path": [ "?", @@ -39,11 +42,8 @@ "VFS.Include":"require", "shard_include": "require" }, - "Lua.workspace.library": [ - "../zk-stable" - ], - "Lua.workspace.checkThirdParty": false, - "Lua.workspace.ignoreDir": [ + + "workspace.ignoreDir": [ "scripts/**" ] } \ No newline at end of file diff --git a/scripts/.luarc.json b/scripts/.luarc.json index 675986f439..9b064ed73f 100644 --- a/scripts/.luarc.json +++ b/scripts/.luarc.json @@ -66,7 +66,7 @@ "include":"require", "VFS.Include":"require" }, - "Lua.workspace.library": [ + "workspace.library": [ ".." ], "Lua.workspace.checkThirdParty": false From 2ea30cb4f88beec78b6737beb8d7f0f6a7632b3e Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Thu, 1 Jan 2026 00:37:01 +0800 Subject: [PATCH 25/40] .luarc.json --- .luarc.json | 50 +++++++++++++++++++++++---------------------- scripts/.luarc.json | 1 + 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/.luarc.json b/.luarc.json index 16af05744a..6e3e8678be 100644 --- a/.luarc.json +++ b/.luarc.json @@ -3,29 +3,29 @@ "diagnostics.globalsRegex": ["CMD_.*"], "diagnostics.globals": [ "gadget", - "widget" - // "VFS", - // "UnitDefs", - // "UnitDefNames", - // "FeatureDefs", - // "ModularCommDefsShared", - // "piece", - // "GG", - // "Script", - // "WG", - // "widgetHandler", - // "widget", - // "GameData", - // "Shared", - // "gadget", - // "DEFS", - // "LOG", - // "FeatureDefNames", - // "SendToUnsynced", - // "CMD", - // "WeaponDefs", - // "CMDTYPE", - // "WeaponDefNames" + "widget", + "VFS", + "UnitDefs", + "UnitDefNames", + "FeatureDefs", + "ModularCommDefsShared", + "piece", + "GG", + "Script", + "WG", + "widgetHandler", + "widget", + "GameData", + "Shared", + "gadget", + "DEFS", + "LOG", + "FeatureDefNames", + "SendToUnsynced", + "CMD", + "WeaponDefs", + "CMDTYPE", + "WeaponDefNames" //,{ "name": "script", "include": "scripts/**.lua" } ], "runtime.version": "Lua 5.1", @@ -42,7 +42,9 @@ "VFS.Include":"require", "shard_include": "require" }, - + "workspace.library": [ + "recoil-lua-library/**" + ], "workspace.ignoreDir": [ "scripts/**" ] diff --git a/scripts/.luarc.json b/scripts/.luarc.json index 9b064ed73f..a6e11d09fe 100644 --- a/scripts/.luarc.json +++ b/scripts/.luarc.json @@ -51,6 +51,7 @@ "SetUnitValue", "cross", "IsInMove" + //,{ "name": "script", "include": "scripts/**.lua" } ], "runtime.version": "Lua 5.1", From 34dd11979813a65abfb923fa6ee04c04e1e5e414 Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Thu, 1 Jan 2026 00:42:36 +0800 Subject: [PATCH 26/40] .luarc.json --- .luarc.json | 1 + scripts/.luarc.json | 1 + 2 files changed, 2 insertions(+) diff --git a/.luarc.json b/.luarc.json index 6e3e8678be..46a24981ff 100644 --- a/.luarc.json +++ b/.luarc.json @@ -33,6 +33,7 @@ "duplicate-set-field", "cast-local-type" // because it is frequently used ], + "completion.requireSeparator": "/", "runtime.path": [ "?", "?.lua" diff --git a/scripts/.luarc.json b/scripts/.luarc.json index a6e11d09fe..fdb4362b6b 100644 --- a/scripts/.luarc.json +++ b/scripts/.luarc.json @@ -59,6 +59,7 @@ "duplicate-set-field", "lowercase-global" ], + "completion.requireSeparator": "/", "runtime.path": [ "?", "?.lua" From 148e13cd15acf5591a7aaab5fa92e96bb0fe40bd Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Fri, 2 Jan 2026 12:01:40 +0800 Subject: [PATCH 27/40] rename workspace file --- Zero-K fork.sdd.code-workspace => .code-workspace | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Zero-K fork.sdd.code-workspace => .code-workspace (100%) diff --git a/Zero-K fork.sdd.code-workspace b/.code-workspace similarity index 100% rename from Zero-K fork.sdd.code-workspace rename to .code-workspace From ad7f3e8a671a90b49809e2a77524e1e638f86793 Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Fri, 2 Jan 2026 12:43:10 +0800 Subject: [PATCH 28/40] rename workspace file --- .code-workspace => zero k.code-workspace | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .code-workspace => zero k.code-workspace (100%) diff --git a/.code-workspace b/zero k.code-workspace similarity index 100% rename from .code-workspace rename to zero k.code-workspace From 2cfa2df90463a5c744e96ad233fd65e367a005e1 Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Fri, 2 Jan 2026 13:12:44 +0800 Subject: [PATCH 29/40] gui_sensor_ranges_radar_preview.lua --- LuaUI/Widgets/gui_sensor_ranges_radar_preview.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LuaUI/Widgets/gui_sensor_ranges_radar_preview.lua b/LuaUI/Widgets/gui_sensor_ranges_radar_preview.lua index 219bc3d6d7..a781ad4505 100644 --- a/LuaUI/Widgets/gui_sensor_ranges_radar_preview.lua +++ b/LuaUI/Widgets/gui_sensor_ranges_radar_preview.lua @@ -118,7 +118,7 @@ end local function GetRadarUnitToDraw() if selectedRadarUnitID and options.showOnSelected.value then - unitDefID = Spring.GetUnitDefID(selectedRadarUnitID) + local unitDefID = Spring.GetUnitDefID(selectedRadarUnitID) if not unitDefID then selectedRadarUnitID = false return From 51563eac1b9a044b4eb7dc682e88d25bba92de64 Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Fri, 2 Jan 2026 14:04:35 +0800 Subject: [PATCH 30/40] scripts' typedefs --- scripts/.luarc.json | 28 +----- scripts/.typedef.lua | 223 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 224 insertions(+), 27 deletions(-) create mode 100644 scripts/.typedef.lua diff --git a/scripts/.luarc.json b/scripts/.luarc.json index fdb4362b6b..c8e5d2098a 100644 --- a/scripts/.luarc.json +++ b/scripts/.luarc.json @@ -24,33 +24,7 @@ "WeaponDefs", "CMDTYPE", "WeaponDefNames", - "script", - "StartThread", - "unitID", - "y_axis", - "x_axis", - "z_axis", - "Spin", - "StopSpin", - "SetSignalMask", - "Signal", - "EmitSfx", - "unitID", - "Turn", - "WaitForTurn", - "Sleep", - "UnitDef", - "Hide", - "Move", - "Explode", - "WaitForMove", - "Show", - "unitDefID", - "GetUnitValue", - "hat", - "SetUnitValue", - "cross", - "IsInMove" + "script" //,{ "name": "script", "include": "scripts/**.lua" } ], diff --git a/scripts/.typedef.lua b/scripts/.typedef.lua new file mode 100644 index 0000000000..b833ff420e --- /dev/null +++ b/scripts/.typedef.lua @@ -0,0 +1,223 @@ +---@meta + +---@type integer +unitID=unitID + +---@type integer +unitDefID=unitDefID + +---@type table +UnitDef=UnitDef + +---@enum axis +local axises={ + x_axis=1, + y_axis=2, + z_axis=3, +} + +x_axis=axises.x_axis +y_axis=axises.y_axis +z_axis=axises.z_axis + +---@class Piece:integer + +---Get the piece number by piece name +---@param ... string +---@return Piece ...Piece +function piece(...)end + +---@param piece Piece +---@param visible boolean +function SetPieceVisibility(piece,visible)end + +-- local su=Spring.UnitScript + +---@param piece Piece +function Show(piece)end + +---@param piece Piece +function Hide(piece)end + +---Move piece along axis to the destination position. +--- +---If speed is given, the piece isn't moved immediately, but will move there at the desired speed. +--- +---The X axis is mirrored compared to BOS/COB scripts, to match the direction of the X axis in Spring world space. +---@param piece Piece +---@param axis axis +---@param destination number +---@param speed? number +function Move(piece, axis, destination, speed)end + +---Turn piece around axis to the destination angle. +--- +---If speed is given, the piece isn't rotated immediately, but will turn at the desired angular velocity. +--- +---Angles are in radians. +--- +---Always uses the shortest angular towards destination degree, and if at exactly 180 degrees opposite, will go counter-clockwise. +---@param piece Piece +---@param axis axis +---@param destination number +---@param speed? number +function Turn(piece, axis, destination, speed)end + +---Makes piece spin around axis at the desired angular velocity. +--- +---If accel is given, the piece does not start at this velocity at once, but will accelerate to it. +--- +---Both negative and positive angular velocities are supported. +--- +---Accel should always be positive, even if speed is negative. +---@param piece Piece +---@param axis axis +---@param speed number +---@param accel? number +function Spin(piece, axis, speed, accel)end + +---Stops a piece from spinning around the given axis. +--- +---If decel is given, the piece does not stop at once, but will decelerate to it. +--- +---Decel should always be positive. +--- +---This function is similar to Spin(piece, axis, 0, decel), however, StopSpin also frees up the animation record. +---@param piece Piece +---@param axis axis +---@param decel? number +function StopSpin(piece, axis, decel)end + +---@param piece Piece +---@param axis axis +function IsInTurn(piece, axis)end + +---@param piece Piece +---@param axis axis +function IsInMove(piece, axis)end + +---@param piece Piece +---@param axis axis +function IsInSpin(piece, axis)end + +---Get the current translation of a piece. The returned numbers match the values passed into Move and Turn. +---@param piece Piece +---@return number x,number y,number z +function GetPieceTranslation(piece)end + + +---Get the current Rotation of a piece. The returned numbers match the values passed into Move and Turn. +---@param piece Piece +---@return number x,number y,number z +function GetPieceRotation(piece)end + +---Get the piece's position (px, py, pz) and direction (dx, dy, dz) in unit space. +--- +---This is quite similar to Spring.GetUnitPiecePosDir, however that function returns in world space. +---@param piece Piece +---@return number px,number py,number pz,number dx,number dy,number dz +function GetPiecePosDir(piece)end + +---Starts a new (animation) thread, which will execute the function 'fun'. +--- +---All arguments except the function to run are passed as-is as arguments to 'fun'. +--- +---COB-Threads has a decent description on COB threads, which are mimicked here in Lua using coroutines. +---@generic params +---@param fun fun(...:params) +---@param ... `params` +function StartThread(fun,...)end + +---SetSignalMask assigns a mask to the currently running thread (any new threads started by this one will inherit the signal mask). +---@param mask integer +function SetSignalMask(mask)end + +---Signal immediately stops all threads of this unit for which the bitwise and of mask and signal is not zero. +---@param signal integer +function Signal(signal)end + +---Waits until the piece has stopped moving along the axis. +---If the piece is not animating, this functions return at once. +---@param piece Piece +---@param axis axis +function WaitForMove(piece, axis)end + +---Waits until the piece has stopped turning around the axis. +---If the piece is not animating, this functions return at once. +---@param piece Piece +---@param axis axis +function WaitForTurn(piece, axis)end + +---Waits a number of milliseconds before returning. +---@param milliseconds number +function Sleep(milliseconds)end + +---Emits a CEG effect or weapon from the given piece. The id is based on one of the effect or weapon ids defined in the units unitdef. +--- +---If the piece has no geometry, then the sfx is emitted in the +z direction from the origin of the piece. +--- +---If the piece has 1 vertex, the emit dir is the vector from the origin to the the position of the first vertex the emit position is the origin of the piece. +--- +---If there is more than one vertex in the piece, then the emit vector is the vector pointing from v[0] to v[1], and the emit position is v[0]. +---@param piece Piece +---@param sfxid SFX|integer +function EmitSfx(piece, sfxid)end + +---Same as COB's show _inside_ FireWeaponX. +---@param piece Piece +function ShowFlare(piece)end + +---Explodes a piece, optionally creating a particle which flies off. Typically used inside Killed. +--- +---Explode does not hide the piece by itself; if using it outside Killed you may want to Hide the piece immediately after. +--- +---The flags may be any combination of: +--- +---`SFX.NONE`: do nothing after creating a heatcloud. Other flags have no effect, except NO_HEATCLOUD. If that is given too, the call is a no-op. +--- +---`SFX.SHATTER`: shatter the piece in many fragments. Only the NO_HEATCLOUD flag has any effect if this is present. +--- +---`SFX.EXPLODE` | `SFX.EXPLODE_ON_HIT`: the piece that flies of should explode when it hits something. +--- +---`SFX.FALL`: the piece should be affected by gravity (this is currently always forced on by Spring, to prevent pieces that float in air indefinitely). +--- +---`SFX.SMOKE`: leave smoke trail. +--- +---`SFX.FIRE`: the piece is on fire when it flies off. +--- +---`SFX.NO_CEG_TRAIL`: disable a CEG trail, if present. +--- +---`SFX.NO_HEATCLOUD`: suppress the heat cloud that's shown by default. +---@param piece Piece +---@param ... SFX flags +function Explode(piece,...)end + + +---Attaches another unit (a passenger, as this is designed for transports) to this unit. For AttachUnit, piece specifies the attachment point. +--- +---Attaching to piece -1 makes the passenger unit enter a void state whereby it will never: +--- +---take damage, even from Lua (but can be killed by Lua) +--- +---be rendered through any engine path (nor their icons) +--- +---be intersect-able by either synced or unsynced rays +--- +---block any other objects from existing on top of them +--- +---be selectable +---@param piece Piece +---@param passengerID integer +function AttachUnit(piece, passengerID)end + +---Detaches passenger +---@param passengerID integer +function DropUnit(passengerID)end + +---@param cobValue COB +---@param ... any +function GetUnitValue(cobValue,...)end + +---@param cobValue COB +---@param ... any +function SetUnitValue(cobValue,...)end \ No newline at end of file From 77df3e5d6b216f3cdc7742cbcd8232eddb0ea28a Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Fri, 2 Jan 2026 14:04:50 +0800 Subject: [PATCH 31/40] some missing typedefs --- .typedefs/others.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .typedefs/others.lua diff --git a/.typedefs/others.lua b/.typedefs/others.lua new file mode 100644 index 0000000000..a0d80684d8 --- /dev/null +++ b/.typedefs/others.lua @@ -0,0 +1,13 @@ +---Just nil, number, string and boolean datatypes are allowed as arguments! NO tables, userdatas, ... +---@param ... nil|number|string|boolean +function SendToUnsynced(...)end + +---@param teamID integer +---@param f function +---@param ... any +function CallAsTeam(teamID,f,...)end + +---@param access {ctrl:number|nil,read:number|nil,select:number|nil} +---@param f function +---@param ... any +function CallAsTeam(access,f,...)end \ No newline at end of file From 9a5056ddd743fc27539e87fe3686ad9476b3540d Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Fri, 2 Jan 2026 14:04:58 +0800 Subject: [PATCH 32/40] .luarc.json --- .luarc.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.luarc.json b/.luarc.json index 46a24981ff..6f20e54ef9 100644 --- a/.luarc.json +++ b/.luarc.json @@ -2,6 +2,7 @@ "$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json", "diagnostics.globalsRegex": ["CMD_.*"], "diagnostics.globals": [ + "Spring", "gadget", "widget", "VFS", From a6e82dd70720aad9c9ae51bca9f38f87a3558f58 Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Fri, 2 Jan 2026 14:05:54 +0800 Subject: [PATCH 33/40] scripts/dronelight.lua missing pivotSpeed --- scripts/dronelight.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/dronelight.lua b/scripts/dronelight.lua index 72d9611272..15896c179a 100644 --- a/scripts/dronelight.lua +++ b/scripts/dronelight.lua @@ -7,6 +7,7 @@ local blades = {piece('b1', 'b2', 'b3', 'b4', 'b5', 'b6')} --constants local rotorSpeed = math.rad(1080) local rotorAccel = math.rad(240) +local pivotSpeed = math.rad(180) --variables From c3f0e1e701409152ebbb4bba3a6bf809e309c8cb Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Fri, 2 Jan 2026 14:11:23 +0800 Subject: [PATCH 34/40] scripts/shipheavyarty.lua what is Hide(barrels[num][i], SFX.FALL + SFX.SMOKE + SFX.EXPLODE) --- scripts/shipheavyarty.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/shipheavyarty.lua b/scripts/shipheavyarty.lua index 04800f3517..ef500895ce 100644 --- a/scripts/shipheavyarty.lua +++ b/scripts/shipheavyarty.lua @@ -152,7 +152,7 @@ local function ExplodeTurret(num) for i=1,3 do if math.random() > 0.5 then Explode(barrels[num][i], SFX.FALL + SFX.SMOKE + SFX.EXPLODE) - Hide(barrels[num][i], SFX.FALL + SFX.SMOKE + SFX.EXPLODE) + Hide(barrels[num][i]) else Explode(barrels[num][i], SFX.SHATTER) end From 02ea2cce0b5c52470d0bcd6e68208d11e35be669 Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Fri, 2 Jan 2026 14:14:13 +0800 Subject: [PATCH 35/40] scripts/platehover.lua typo fals --- scripts/platehover.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/platehover.lua b/scripts/platehover.lua index 9c8a1eb387..821d174406 100644 --- a/scripts/platehover.lua +++ b/scripts/platehover.lua @@ -32,7 +32,7 @@ local function Close() SetUnitValue(COB.YARD_OPEN, 0) --SetUnitValue(COB.BUGGER_OFF, 0) - SetInBuildDistance(fals) + SetInBuildDistance(false) Move (nano, y_axis, 0, 17.5) WaitForMove (nano, y_axis) From bb2479834f26af374475d7778476b27585dc7340 Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Fri, 2 Jan 2026 14:16:34 +0800 Subject: [PATCH 36/40] scripts/raveparty.lua missing LOS_ACCESS --- scripts/raveparty.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/raveparty.lua b/scripts/raveparty.lua index 77ae798743..c190d48b0c 100644 --- a/scripts/raveparty.lua +++ b/scripts/raveparty.lua @@ -23,6 +23,7 @@ local hpi = math.pi*0.5 local headingSpeed = math.rad(4) local pitchSpeed = math.rad(61) -- Float maths makes this exactly one revolution every 6 seconds. +local LOS_ACCESS = {inlos = true} guns[5].y = 11 guns[5].z = 7 From da753da05a30cfba3c050391c6138d3b8687cb5a Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Fri, 2 Jan 2026 14:16:53 +0800 Subject: [PATCH 37/40] scripts/.luarc.json add cast-local-type --- scripts/.luarc.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/.luarc.json b/scripts/.luarc.json index c8e5d2098a..d3bfccb1ef 100644 --- a/scripts/.luarc.json +++ b/scripts/.luarc.json @@ -31,7 +31,8 @@ "runtime.version": "Lua 5.1", "diagnostics.disable": [ "duplicate-set-field", - "lowercase-global" + "lowercase-global", + "cast-local-type" ], "completion.requireSeparator": "/", "runtime.path": [ From d5070eb4b729799f710785ca26efa624433b9ef2 Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Sat, 3 Jan 2026 10:43:25 +0800 Subject: [PATCH 38/40] . --- scripts/.typedefs.lua | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 scripts/.typedefs.lua diff --git a/scripts/.typedefs.lua b/scripts/.typedefs.lua new file mode 100644 index 0000000000..7f4a35f648 --- /dev/null +++ b/scripts/.typedefs.lua @@ -0,0 +1,4 @@ +---@meta + +---@class script +script={} From fbfd40a9840a1a46e13e024a2a7dcc4c27129b00 Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Sat, 3 Jan 2026 14:08:11 +0800 Subject: [PATCH 39/40] . --- scripts/.typedef.lua | 223 ------------------------------------------ scripts/.typedefs.lua | 223 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 221 insertions(+), 225 deletions(-) delete mode 100644 scripts/.typedef.lua diff --git a/scripts/.typedef.lua b/scripts/.typedef.lua deleted file mode 100644 index b833ff420e..0000000000 --- a/scripts/.typedef.lua +++ /dev/null @@ -1,223 +0,0 @@ ----@meta - ----@type integer -unitID=unitID - ----@type integer -unitDefID=unitDefID - ----@type table -UnitDef=UnitDef - ----@enum axis -local axises={ - x_axis=1, - y_axis=2, - z_axis=3, -} - -x_axis=axises.x_axis -y_axis=axises.y_axis -z_axis=axises.z_axis - ----@class Piece:integer - ----Get the piece number by piece name ----@param ... string ----@return Piece ...Piece -function piece(...)end - ----@param piece Piece ----@param visible boolean -function SetPieceVisibility(piece,visible)end - --- local su=Spring.UnitScript - ----@param piece Piece -function Show(piece)end - ----@param piece Piece -function Hide(piece)end - ----Move piece along axis to the destination position. ---- ----If speed is given, the piece isn't moved immediately, but will move there at the desired speed. ---- ----The X axis is mirrored compared to BOS/COB scripts, to match the direction of the X axis in Spring world space. ----@param piece Piece ----@param axis axis ----@param destination number ----@param speed? number -function Move(piece, axis, destination, speed)end - ----Turn piece around axis to the destination angle. ---- ----If speed is given, the piece isn't rotated immediately, but will turn at the desired angular velocity. ---- ----Angles are in radians. ---- ----Always uses the shortest angular towards destination degree, and if at exactly 180 degrees opposite, will go counter-clockwise. ----@param piece Piece ----@param axis axis ----@param destination number ----@param speed? number -function Turn(piece, axis, destination, speed)end - ----Makes piece spin around axis at the desired angular velocity. ---- ----If accel is given, the piece does not start at this velocity at once, but will accelerate to it. ---- ----Both negative and positive angular velocities are supported. ---- ----Accel should always be positive, even if speed is negative. ----@param piece Piece ----@param axis axis ----@param speed number ----@param accel? number -function Spin(piece, axis, speed, accel)end - ----Stops a piece from spinning around the given axis. ---- ----If decel is given, the piece does not stop at once, but will decelerate to it. ---- ----Decel should always be positive. ---- ----This function is similar to Spin(piece, axis, 0, decel), however, StopSpin also frees up the animation record. ----@param piece Piece ----@param axis axis ----@param decel? number -function StopSpin(piece, axis, decel)end - ----@param piece Piece ----@param axis axis -function IsInTurn(piece, axis)end - ----@param piece Piece ----@param axis axis -function IsInMove(piece, axis)end - ----@param piece Piece ----@param axis axis -function IsInSpin(piece, axis)end - ----Get the current translation of a piece. The returned numbers match the values passed into Move and Turn. ----@param piece Piece ----@return number x,number y,number z -function GetPieceTranslation(piece)end - - ----Get the current Rotation of a piece. The returned numbers match the values passed into Move and Turn. ----@param piece Piece ----@return number x,number y,number z -function GetPieceRotation(piece)end - ----Get the piece's position (px, py, pz) and direction (dx, dy, dz) in unit space. ---- ----This is quite similar to Spring.GetUnitPiecePosDir, however that function returns in world space. ----@param piece Piece ----@return number px,number py,number pz,number dx,number dy,number dz -function GetPiecePosDir(piece)end - ----Starts a new (animation) thread, which will execute the function 'fun'. ---- ----All arguments except the function to run are passed as-is as arguments to 'fun'. ---- ----COB-Threads has a decent description on COB threads, which are mimicked here in Lua using coroutines. ----@generic params ----@param fun fun(...:params) ----@param ... `params` -function StartThread(fun,...)end - ----SetSignalMask assigns a mask to the currently running thread (any new threads started by this one will inherit the signal mask). ----@param mask integer -function SetSignalMask(mask)end - ----Signal immediately stops all threads of this unit for which the bitwise and of mask and signal is not zero. ----@param signal integer -function Signal(signal)end - ----Waits until the piece has stopped moving along the axis. ----If the piece is not animating, this functions return at once. ----@param piece Piece ----@param axis axis -function WaitForMove(piece, axis)end - ----Waits until the piece has stopped turning around the axis. ----If the piece is not animating, this functions return at once. ----@param piece Piece ----@param axis axis -function WaitForTurn(piece, axis)end - ----Waits a number of milliseconds before returning. ----@param milliseconds number -function Sleep(milliseconds)end - ----Emits a CEG effect or weapon from the given piece. The id is based on one of the effect or weapon ids defined in the units unitdef. ---- ----If the piece has no geometry, then the sfx is emitted in the +z direction from the origin of the piece. ---- ----If the piece has 1 vertex, the emit dir is the vector from the origin to the the position of the first vertex the emit position is the origin of the piece. ---- ----If there is more than one vertex in the piece, then the emit vector is the vector pointing from v[0] to v[1], and the emit position is v[0]. ----@param piece Piece ----@param sfxid SFX|integer -function EmitSfx(piece, sfxid)end - ----Same as COB's show _inside_ FireWeaponX. ----@param piece Piece -function ShowFlare(piece)end - ----Explodes a piece, optionally creating a particle which flies off. Typically used inside Killed. ---- ----Explode does not hide the piece by itself; if using it outside Killed you may want to Hide the piece immediately after. ---- ----The flags may be any combination of: ---- ----`SFX.NONE`: do nothing after creating a heatcloud. Other flags have no effect, except NO_HEATCLOUD. If that is given too, the call is a no-op. ---- ----`SFX.SHATTER`: shatter the piece in many fragments. Only the NO_HEATCLOUD flag has any effect if this is present. ---- ----`SFX.EXPLODE` | `SFX.EXPLODE_ON_HIT`: the piece that flies of should explode when it hits something. ---- ----`SFX.FALL`: the piece should be affected by gravity (this is currently always forced on by Spring, to prevent pieces that float in air indefinitely). ---- ----`SFX.SMOKE`: leave smoke trail. ---- ----`SFX.FIRE`: the piece is on fire when it flies off. ---- ----`SFX.NO_CEG_TRAIL`: disable a CEG trail, if present. ---- ----`SFX.NO_HEATCLOUD`: suppress the heat cloud that's shown by default. ----@param piece Piece ----@param ... SFX flags -function Explode(piece,...)end - - ----Attaches another unit (a passenger, as this is designed for transports) to this unit. For AttachUnit, piece specifies the attachment point. ---- ----Attaching to piece -1 makes the passenger unit enter a void state whereby it will never: ---- ----take damage, even from Lua (but can be killed by Lua) ---- ----be rendered through any engine path (nor their icons) ---- ----be intersect-able by either synced or unsynced rays ---- ----block any other objects from existing on top of them ---- ----be selectable ----@param piece Piece ----@param passengerID integer -function AttachUnit(piece, passengerID)end - ----Detaches passenger ----@param passengerID integer -function DropUnit(passengerID)end - ----@param cobValue COB ----@param ... any -function GetUnitValue(cobValue,...)end - ----@param cobValue COB ----@param ... any -function SetUnitValue(cobValue,...)end \ No newline at end of file diff --git a/scripts/.typedefs.lua b/scripts/.typedefs.lua index 7f4a35f648..b833ff420e 100644 --- a/scripts/.typedefs.lua +++ b/scripts/.typedefs.lua @@ -1,4 +1,223 @@ ---@meta ----@class script -script={} +---@type integer +unitID=unitID + +---@type integer +unitDefID=unitDefID + +---@type table +UnitDef=UnitDef + +---@enum axis +local axises={ + x_axis=1, + y_axis=2, + z_axis=3, +} + +x_axis=axises.x_axis +y_axis=axises.y_axis +z_axis=axises.z_axis + +---@class Piece:integer + +---Get the piece number by piece name +---@param ... string +---@return Piece ...Piece +function piece(...)end + +---@param piece Piece +---@param visible boolean +function SetPieceVisibility(piece,visible)end + +-- local su=Spring.UnitScript + +---@param piece Piece +function Show(piece)end + +---@param piece Piece +function Hide(piece)end + +---Move piece along axis to the destination position. +--- +---If speed is given, the piece isn't moved immediately, but will move there at the desired speed. +--- +---The X axis is mirrored compared to BOS/COB scripts, to match the direction of the X axis in Spring world space. +---@param piece Piece +---@param axis axis +---@param destination number +---@param speed? number +function Move(piece, axis, destination, speed)end + +---Turn piece around axis to the destination angle. +--- +---If speed is given, the piece isn't rotated immediately, but will turn at the desired angular velocity. +--- +---Angles are in radians. +--- +---Always uses the shortest angular towards destination degree, and if at exactly 180 degrees opposite, will go counter-clockwise. +---@param piece Piece +---@param axis axis +---@param destination number +---@param speed? number +function Turn(piece, axis, destination, speed)end + +---Makes piece spin around axis at the desired angular velocity. +--- +---If accel is given, the piece does not start at this velocity at once, but will accelerate to it. +--- +---Both negative and positive angular velocities are supported. +--- +---Accel should always be positive, even if speed is negative. +---@param piece Piece +---@param axis axis +---@param speed number +---@param accel? number +function Spin(piece, axis, speed, accel)end + +---Stops a piece from spinning around the given axis. +--- +---If decel is given, the piece does not stop at once, but will decelerate to it. +--- +---Decel should always be positive. +--- +---This function is similar to Spin(piece, axis, 0, decel), however, StopSpin also frees up the animation record. +---@param piece Piece +---@param axis axis +---@param decel? number +function StopSpin(piece, axis, decel)end + +---@param piece Piece +---@param axis axis +function IsInTurn(piece, axis)end + +---@param piece Piece +---@param axis axis +function IsInMove(piece, axis)end + +---@param piece Piece +---@param axis axis +function IsInSpin(piece, axis)end + +---Get the current translation of a piece. The returned numbers match the values passed into Move and Turn. +---@param piece Piece +---@return number x,number y,number z +function GetPieceTranslation(piece)end + + +---Get the current Rotation of a piece. The returned numbers match the values passed into Move and Turn. +---@param piece Piece +---@return number x,number y,number z +function GetPieceRotation(piece)end + +---Get the piece's position (px, py, pz) and direction (dx, dy, dz) in unit space. +--- +---This is quite similar to Spring.GetUnitPiecePosDir, however that function returns in world space. +---@param piece Piece +---@return number px,number py,number pz,number dx,number dy,number dz +function GetPiecePosDir(piece)end + +---Starts a new (animation) thread, which will execute the function 'fun'. +--- +---All arguments except the function to run are passed as-is as arguments to 'fun'. +--- +---COB-Threads has a decent description on COB threads, which are mimicked here in Lua using coroutines. +---@generic params +---@param fun fun(...:params) +---@param ... `params` +function StartThread(fun,...)end + +---SetSignalMask assigns a mask to the currently running thread (any new threads started by this one will inherit the signal mask). +---@param mask integer +function SetSignalMask(mask)end + +---Signal immediately stops all threads of this unit for which the bitwise and of mask and signal is not zero. +---@param signal integer +function Signal(signal)end + +---Waits until the piece has stopped moving along the axis. +---If the piece is not animating, this functions return at once. +---@param piece Piece +---@param axis axis +function WaitForMove(piece, axis)end + +---Waits until the piece has stopped turning around the axis. +---If the piece is not animating, this functions return at once. +---@param piece Piece +---@param axis axis +function WaitForTurn(piece, axis)end + +---Waits a number of milliseconds before returning. +---@param milliseconds number +function Sleep(milliseconds)end + +---Emits a CEG effect or weapon from the given piece. The id is based on one of the effect or weapon ids defined in the units unitdef. +--- +---If the piece has no geometry, then the sfx is emitted in the +z direction from the origin of the piece. +--- +---If the piece has 1 vertex, the emit dir is the vector from the origin to the the position of the first vertex the emit position is the origin of the piece. +--- +---If there is more than one vertex in the piece, then the emit vector is the vector pointing from v[0] to v[1], and the emit position is v[0]. +---@param piece Piece +---@param sfxid SFX|integer +function EmitSfx(piece, sfxid)end + +---Same as COB's show _inside_ FireWeaponX. +---@param piece Piece +function ShowFlare(piece)end + +---Explodes a piece, optionally creating a particle which flies off. Typically used inside Killed. +--- +---Explode does not hide the piece by itself; if using it outside Killed you may want to Hide the piece immediately after. +--- +---The flags may be any combination of: +--- +---`SFX.NONE`: do nothing after creating a heatcloud. Other flags have no effect, except NO_HEATCLOUD. If that is given too, the call is a no-op. +--- +---`SFX.SHATTER`: shatter the piece in many fragments. Only the NO_HEATCLOUD flag has any effect if this is present. +--- +---`SFX.EXPLODE` | `SFX.EXPLODE_ON_HIT`: the piece that flies of should explode when it hits something. +--- +---`SFX.FALL`: the piece should be affected by gravity (this is currently always forced on by Spring, to prevent pieces that float in air indefinitely). +--- +---`SFX.SMOKE`: leave smoke trail. +--- +---`SFX.FIRE`: the piece is on fire when it flies off. +--- +---`SFX.NO_CEG_TRAIL`: disable a CEG trail, if present. +--- +---`SFX.NO_HEATCLOUD`: suppress the heat cloud that's shown by default. +---@param piece Piece +---@param ... SFX flags +function Explode(piece,...)end + + +---Attaches another unit (a passenger, as this is designed for transports) to this unit. For AttachUnit, piece specifies the attachment point. +--- +---Attaching to piece -1 makes the passenger unit enter a void state whereby it will never: +--- +---take damage, even from Lua (but can be killed by Lua) +--- +---be rendered through any engine path (nor their icons) +--- +---be intersect-able by either synced or unsynced rays +--- +---block any other objects from existing on top of them +--- +---be selectable +---@param piece Piece +---@param passengerID integer +function AttachUnit(piece, passengerID)end + +---Detaches passenger +---@param passengerID integer +function DropUnit(passengerID)end + +---@param cobValue COB +---@param ... any +function GetUnitValue(cobValue,...)end + +---@param cobValue COB +---@param ... any +function SetUnitValue(cobValue,...)end \ No newline at end of file From dc9a16d62b3d3e6114715d845269db2ff47bc7a1 Mon Sep 17 00:00:00 2001 From: XNTEABDSC <2364400855@qq.com> Date: Sat, 3 Jan 2026 14:13:58 +0800 Subject: [PATCH 40/40] some other typedefs --- .typedefs/{others.lua => LuaGlobal.lua} | 0 .typedefs/SpringDefines less.lua | 73 +++++++++++++++++++++++++ 2 files changed, 73 insertions(+) rename .typedefs/{others.lua => LuaGlobal.lua} (100%) create mode 100644 .typedefs/SpringDefines less.lua diff --git a/.typedefs/others.lua b/.typedefs/LuaGlobal.lua similarity index 100% rename from .typedefs/others.lua rename to .typedefs/LuaGlobal.lua diff --git a/.typedefs/SpringDefines less.lua b/.typedefs/SpringDefines less.lua new file mode 100644 index 0000000000..b7df339b16 --- /dev/null +++ b/.typedefs/SpringDefines less.lua @@ -0,0 +1,73 @@ +-- ---@diagnostic disable: missing-return + +---@class table:{[any]:any} +---@class list:{[integer]:T} + +---@class UnitId : integer +---@class UnitDefId:integer + +---@class PlayerId:integer +---@class TeamId:integer +---@class AllyteamId:integer +--[==[ +---@class timeSec:number + +---@class frame:integer +---@operator div(framePerSec):timeSec +---@class framePerSec:integer +---@operator mul(timeSec):frame + +---@class WldDist:number +---@operator div(frame):WldSpeed +---@operator add(WldDist):WldDist +---@operator add(WldSpeed):WldDist +---@alias WldxPos WldDist +---@alias WldyPos WldDist +---@alias WldzPos WldDist +--[=[ +---@class WldxPos:number +---@operator div(frame):WldxVel +---@operator add(WldxPos):WldxPos +---@operator add(WldxVel):WldxPos +---@class WldyPos:number +---@operator div(frame):WldyVel +---@operator add(WldyPos):WldyPos +---@operator add(WldyVel):WldyPos +---@class WldzPos:number +---@operator div(frame):WldzVel +---@operator add(WldzPos):WldzPos +---@operator add(WldzVel):WldzPos +]=] + +---@class WldSpeed:number +---@operator mul(frame):WldDist +---@operator unm:WldSpeed + +---@alias WldxVel WldSpeed +---@alias WldyVel WldSpeed +---@alias WldzVel WldSpeed +]==] + +---@type {[UnitDefId]:table} +UnitDefs={} + +---@type {[string]:table} +UnitDefNames={} + +---@class WeaponDefId:integer + + +---@type table +WeaponDefs={} + +---@type table +WeaponDefNames={} + +---@class ProjectileId:number + +---@generic T +---@param v T +---@param recurse boolean|nil +---@param appendTo T|nil +---@return T +function Spring.Utilities.CopyTable(v,recurse,appendTo) end \ No newline at end of file