diff --git a/_data/configs.json b/_data/configs.json index 3b8dc3bac7..c1a0eba56a 100644 --- a/_data/configs.json +++ b/_data/configs.json @@ -1,7 +1,7 @@ { "AdvMapShading": { "declarationFile": "/spring/rts/Map/SMF/SMFGroundDrawer.cpp", - "declarationLine": 43, + "declarationLine": 45, "description": "Enable shaders for terrain rendering.", "defaultValue": 1, "safemodeValue": 0, @@ -24,7 +24,8 @@ }, "AllowDeferredMapRendering": { "declarationFile": "/spring/rts/Map/SMF/SMFGroundDrawer.cpp", - "declarationLine": 44, + "declarationLine": 46, + "description": "Enable rendering the map to the map deferred buffers.", "defaultValue": 0, "safemodeValue": 0, "type": "bool" @@ -39,31 +40,36 @@ "AllowDeferredModelRendering": { "declarationFile": "/spring/rts/Rendering/LuaObjectDrawer.cpp", "declarationLine": 31, + "description": "Allows the rendering of model deferred buffers.", "defaultValue": 0, "safemodeValue": 0, "type": "bool" }, "AllowDrawMapDeferredEvents": { "declarationFile": "/spring/rts/Map/SMF/SMFGroundDrawer.cpp", - "declarationLine": 46, + "declarationLine": 48, + "description": "Enable DrawMapDeferred Lua callins.", "defaultValue": 0, "type": "bool" }, "AllowDrawMapPostDeferredEvents": { "declarationFile": "/spring/rts/Map/SMF/SMFGroundDrawer.cpp", - "declarationLine": 45, + "declarationLine": 47, + "description": "Enable DrawMapPostDeferred Lua callins.", "defaultValue": 0, "type": "bool" }, "AllowDrawModelPostDeferredEvents": { "declarationFile": "/spring/rts/Rendering/LuaObjectDrawer.cpp", "declarationLine": 33, + "description": "Enable DrawModelPostDeferred Lua callins.", "defaultValue": 1, "type": "bool" }, "AllowMultiSampledFrameBuffers": { "declarationFile": "/spring/rts/Rendering/LuaObjectDrawer.cpp", "declarationLine": 34, + "description": "Enable FBOs that can have multisampled anti-aliasing.", "defaultValue": 0, "type": "bool" }, @@ -77,7 +83,7 @@ }, "AlwaysSendDrawGroundEvents": { "declarationFile": "/spring/rts/Map/SMF/SMFGroundDrawer.cpp", - "declarationLine": 55, + "declarationLine": 57, "description": "Always send DrawGround{Pre,Post}{Forward,Deferred} events", "defaultValue": 0, "type": "bool" @@ -120,6 +126,7 @@ "AutohostPort": { "declarationFile": "/spring/rts/Net/GameServer.cpp", "declarationLine": 69, + "description": "Which port should the engine listen on for Autohost interfact connections.", "defaultValue": 0, "type": "int" }, @@ -460,12 +467,14 @@ "CubeTexGenerateMipMaps": { "declarationFile": "/spring/rts/Rendering/Env/CubeMapHandler.cpp", "declarationLine": 21, + "description": "Generate mipmaps for the reflection and specular cubemap textures, useful for efficient subsampling and blurring.", "defaultValue": 0, "type": "bool" }, "CubeTexSizeReflection": { "declarationFile": "/spring/rts/Rendering/Env/CubeMapHandler.cpp", "declarationLine": 20, + "description": "The square resolution of each face of the environment reflection cubemap.", "defaultValue": 128, "minimumValue": 1, "type": "int" @@ -473,6 +482,7 @@ "CubeTexSizeSpecular": { "declarationFile": "/spring/rts/Rendering/Env/CubeMapHandler.cpp", "declarationLine": 19, + "description": "The square resolution of each face of the specular cubemap.", "defaultValue": 128, "minimumValue": 1, "type": "int" @@ -500,7 +510,7 @@ }, "DefaultStartScript": { "declarationFile": "/spring/rts/System/SpringApp.cpp", - "declarationLine": 112, + "declarationLine": 114, "description": "filename of script.txt to use when no command line parameters are specified.", "defaultValue": "", "type": "std::string" @@ -508,6 +518,7 @@ "DemoFromDemo": { "declarationFile": "/spring/rts/Game/PreGame.cpp", "declarationLine": 60, + "description": "Enable recording a demo while playing back a demo.", "defaultValue": 0, "type": "bool" }, @@ -535,7 +546,7 @@ }, "DualScreenMiniMapAspectRatio": { "declarationFile": "/spring/rts/Game/UI/MiniMap.cpp", - "declarationLine": 71, + "declarationLine": 73, "description": "Whether minimap preserves aspect ratio on dual screen mode.", "defaultValue": 1, "type": "bool" @@ -557,6 +568,7 @@ "DumpGameStateOnDesync": { "declarationFile": "/spring/rts/System/GlobalConfig.cpp", "declarationLine": 63, + "description": "Enable writing clientgamestate and servergamestate dumps when a desync is detected", "defaultValue": 0, "type": "bool" }, @@ -785,7 +797,7 @@ }, "GroundDetail": { "declarationFile": "/spring/rts/Map/SMF/SMFGroundDrawer.cpp", - "declarationLine": 30, + "declarationLine": 32, "description": "Controls how detailed the map geometry will be. On lowered settings, cliffs may appear to be jagged or \"melting\".", "defaultValue": 60, "minimumValue": 4, @@ -815,13 +827,14 @@ }, "GroundNormalTextureHighPrecision": { "declarationFile": "/spring/rts/Map/SMF/SMFReadMap.cpp", - "declarationLine": 35, - "defaultValue": 0, + "declarationLine": 37, + "deprecated": 1, "type": "bool" }, "GroundScarAlphaFade": { "declarationFile": "/spring/rts/Rendering/Env/Decals/GroundDecalHandler.cpp", "declarationLine": 55, + "description": "How fast ground scars like explosion scars and tracks fade out.", "defaultValue": 0, "type": "int" }, @@ -853,6 +866,7 @@ "HighResInfoTexture": { "declarationFile": "/spring/rts/Rendering/Map/InfoTexture/Modern/Combiner.cpp", "declarationLine": 14, + "description": "Use full heightmap resolution info texture (true), or half resolution (false)", "defaultValue": 1, "type": "bool" }, @@ -896,6 +910,7 @@ "InitialNetworkTimeout": { "declarationFile": "/spring/rts/System/GlobalConfig.cpp", "declarationLine": 15, + "description": "Time to wait for the initial connection to the game server.", "defaultValue": 30, "minimumValue": 10, "type": "int" @@ -1057,6 +1072,7 @@ "LuaGarbageCollectionMemLoadMult": { "declarationFile": "/spring/rts/Lua/LuaHandle.cpp", "declarationLine": 59, + "description": "How much the amount of Lua memory in use increases the rate of garbage collection.", "defaultValue": 1.33, "minimumValue": 1, "maximumValue": 100, @@ -1065,7 +1081,7 @@ "LuaGarbageCollectionRunTimeMult": { "declarationFile": "/spring/rts/Lua/LuaHandle.cpp", "declarationLine": 60, - "description": "in milliseconds", + "description": "How many milliseconds the garbage collected can run for in each GC cycle", "defaultValue": 5, "minimumValue": 1, "type": "float" @@ -1103,14 +1119,15 @@ }, "MapBorder": { "declarationFile": "/spring/rts/Map/SMF/SMFGroundDrawer.cpp", - "declarationLine": 36, + "declarationLine": 38, "description": "Draws a solid border at the edges of the map.", "defaultValue": 1, "type": "bool" }, "MaxDynamicMapLights": { "declarationFile": "/spring/rts/Map/SMF/SMFGroundDrawer.cpp", - "declarationLine": 39, + "declarationLine": 41, + "description": "Maximum number of map-global dynamic lights that will be rendered at once. High numbers of lights cost performance, as they affect every map fragment.", "defaultValue": 1, "minimumValue": 0, "type": "int" @@ -1150,7 +1167,8 @@ "MaxTextureAtlasSizeX": { "declarationFile": "/spring/rts/Rendering/Textures/TextureAtlas.cpp", "declarationLine": 22, - "defaultValue": 2048, + "description": "The max X size of the projectile and Lua texture atlasses", + "defaultValue": 4096, "minimumValue": 512, "maximumValue": 32768, "type": "int" @@ -1158,7 +1176,8 @@ "MaxTextureAtlasSizeY": { "declarationFile": "/spring/rts/Rendering/Textures/TextureAtlas.cpp", "declarationLine": 23, - "defaultValue": 2048, + "description": "The max Y size of the projectile and Lua texture atlasses", + "defaultValue": 4096, "minimumValue": 512, "maximumValue": 32768, "type": "int" @@ -1183,9 +1202,23 @@ "defaultValue": 0.01, "type": "float" }, + "MinDrawFPS": { + "declarationFile": "/spring/rts/System/GlobalConfig.cpp", + "declarationLine": 66, + "description": "Defines how many frames per second should minimally be rendered. To reach this number we will delay simframes.", + "defaultValue": 2, + "type": "int" + }, + "MinSimDrawBalance": { + "declarationFile": "/spring/rts/System/GlobalConfig.cpp", + "declarationLine": 65, + "description": "Percent of the time for simulation is minimum spend for drawing. E.g. if set to 0.15 then 15% of the total cpu time is exclusively reserved for drawing.", + "defaultValue": 0.15, + "type": "float" + }, "MiniMapButtonSize": { "declarationFile": "/spring/rts/Game/UI/MiniMap.cpp", - "declarationLine": 53, + "declarationLine": 55, "defaultValue": 16, "type": "int" }, @@ -1198,20 +1231,20 @@ }, "MiniMapCanFlip": { "declarationFile": "/spring/rts/Game/UI/MiniMap.cpp", - "declarationLine": 73, + "declarationLine": 75, "description": "Whether minimap inverts coordinates when camera Y rotation is between 90 and 270 degrees.", "defaultValue": 0, "type": "bool" }, "MiniMapCursorScale": { "declarationFile": "/spring/rts/Game/UI/MiniMap.cpp", - "declarationLine": 60, + "declarationLine": 62, "defaultValue": -0.5, "type": "float" }, "MiniMapDrawCommands": { "declarationFile": "/spring/rts/Game/UI/MiniMap.cpp", - "declarationLine": 63, + "declarationLine": 65, "defaultValue": 1, "minimumValue": 0, "headlessValue": 0, @@ -1219,26 +1252,26 @@ }, "MiniMapDrawProjectiles": { "declarationFile": "/spring/rts/Game/UI/MiniMap.cpp", - "declarationLine": 65, + "declarationLine": 67, "defaultValue": 1, "headlessValue": 0, "type": "bool" }, "MiniMapFullProxy": { "declarationFile": "/spring/rts/Game/UI/MiniMap.cpp", - "declarationLine": 52, + "declarationLine": 54, "defaultValue": 1, "type": "bool" }, "MiniMapGeometry": { "declarationFile": "/spring/rts/Game/UI/MiniMap.cpp", - "declarationLine": 51, + "declarationLine": 53, "defaultValue": "2 2 200 200", "type": "std::string" }, "MiniMapIcons": { "declarationFile": "/spring/rts/Game/UI/MiniMap.cpp", - "declarationLine": 61, + "declarationLine": 63, "defaultValue": 1, "headlessValue": 0, "type": "bool" @@ -1259,7 +1292,7 @@ }, "MiniMapRefreshRate": { "declarationFile": "/spring/rts/Game/UI/MiniMap.cpp", - "declarationLine": 69, + "declarationLine": 71, "description": "The refresh rate of the async MiniMap texture. Needs MiniMapRenderToTexture to be true. Value of \"0\" autoselects between 10-60FPS.", "defaultValue": 0, "minimumValue": 0, @@ -1267,7 +1300,7 @@ }, "MiniMapRenderToTexture": { "declarationFile": "/spring/rts/Game/UI/MiniMap.cpp", - "declarationLine": 68, + "declarationLine": 70, "description": "Asynchronous render MiniMap to a texture independent of screen FPS.", "defaultValue": 1, "safemodeValue": 0, @@ -1275,13 +1308,13 @@ }, "MiniMapUnitExp": { "declarationFile": "/spring/rts/Game/UI/MiniMap.cpp", - "declarationLine": 59, + "declarationLine": 61, "defaultValue": 0.25, "type": "float" }, "MiniMapUnitSize": { "declarationFile": "/spring/rts/Game/UI/MiniMap.cpp", - "declarationLine": 55, + "declarationLine": 57, "defaultValue": 2.5, "minimumValue": 0, "type": "float" @@ -1346,6 +1379,7 @@ "NetworkTimeout": { "declarationFile": "/spring/rts/System/GlobalConfig.cpp", "declarationLine": 19, + "description": "Number of seconds before connection to game server is considered lost.", "defaultValue": 120, "minimumValue": 0, "type": "int" @@ -1405,14 +1439,14 @@ }, "PreloadModels": { "declarationFile": "/spring/rts/Rendering/WorldDrawer.cpp", - "declarationLine": 53, + "declarationLine": 54, "description": "The engine will preload all models", "defaultValue": 1, "type": "bool" }, "ROAM": { "declarationFile": "/spring/rts/Map/SMF/SMFGroundDrawer.cpp", - "declarationLine": 49, + "declarationLine": 51, "description": "Use ROAM for terrain mesh rendering: 0 to disable, 1=VBO mode to enable.", "defaultValue": 1, "minimumValue": 0, @@ -1480,14 +1514,14 @@ }, "SMFTexAniso": { "declarationFile": "/spring/rts/Map/SMF/SMFReadMap.cpp", - "declarationLine": 36, + "declarationLine": 38, "defaultValue": 4, "minimumValue": 0, "type": "float" }, "SSMFTexAniso": { "declarationFile": "/spring/rts/Map/SMF/SMFReadMap.cpp", - "declarationLine": 37, + "declarationLine": 39, "defaultValue": 4, "minimumValue": 0, "type": "float" @@ -1528,13 +1562,13 @@ "ServerSleepTime": { "declarationFile": "/spring/rts/Net/GameServer.cpp", "declarationLine": 70, - "description": "number of milliseconds to sleep per tick", + "description": "Number of milliseconds to sleep per tick for the server thread. Lower values have marginally higher CPU load, while high values can introduce additional latency.", "defaultValue": 5, "type": "int" }, "SetCoreAffinity": { "declarationFile": "/spring/rts/System/SpringApp.cpp", - "declarationLine": 105, + "declarationLine": 107, "description": "Defines a bitmask indicating which CPU cores the main-thread should use.", "defaultValue": "0", "safemodeValue": "1", @@ -1542,14 +1576,14 @@ }, "ShadowColorMode": { "declarationFile": "/spring/rts/Rendering/ShadowHandler.cpp", - "declarationLine": 34, + "declarationLine": 35, "description": "Whether the colorbuffer of shadowmap FBO is RGB vs greyscale(to conserve some VRAM)", "defaultValue": 1, "type": "bool" }, "ShadowMapSize": { "declarationFile": "/spring/rts/Rendering/ShadowHandler.cpp", - "declarationLine": 32, + "declarationLine": 33, "description": "Sets the resolution of shadows. Higher numbers increase quality at the cost of performance.", "defaultValue": 2048, "minimumValue": 32, @@ -1557,13 +1591,13 @@ }, "ShadowProjectionMode": { "declarationFile": "/spring/rts/Rendering/ShadowHandler.cpp", - "declarationLine": 33, + "declarationLine": 34, "defaultValue": 1, "type": "int" }, "Shadows": { "declarationFile": "/spring/rts/Rendering/ShadowHandler.cpp", - "declarationLine": 31, + "declarationLine": 32, "description": "Sets whether shadows are rendered.\n-1:=forceoff, 0:=off, 1:=full, 2:=fast (skip terrain)", "defaultValue": 2, "minimumValue": -1, @@ -1602,7 +1636,7 @@ }, "SimpleMiniMapColors": { "declarationFile": "/spring/rts/Game/UI/MiniMap.cpp", - "declarationLine": 66, + "declarationLine": 68, "defaultValue": 0, "type": "bool" }, @@ -1644,7 +1678,7 @@ }, "SoftParticles": { "declarationFile": "/spring/rts/Rendering/Env/Particles/ProjectileDrawer.cpp", - "declarationLine": 44, + "declarationLine": 41, "description": "Soften up CEG particles on clipping edges", "defaultValue": 1, "safemodeValue": 0, @@ -1674,7 +1708,7 @@ }, "SplashScreenDir": { "declarationFile": "/spring/rts/System/SpringApp.cpp", - "declarationLine": 113, + "declarationLine": 115, "defaultValue": ".", "type": "std::string" }, @@ -1694,6 +1728,13 @@ "defaultValue": "", "type": "std::string" }, + "StoreDefaultSettings": { + "declarationFile": "/spring/rts/System/Config/ConfigHandler.cpp", + "declarationLine": 18, + "description": "springsettings.cfg will save the settings values, if they match the implicit defaults and were set by a user explicitly", + "defaultValue": 0, + "type": "bool" + }, "TCPAllowConnect": { "declarationFile": "/spring/rts/lib/luasocket/src/restrictions.cpp", "declarationLine": 24, @@ -1725,7 +1766,7 @@ }, "TextureMemPoolSize": { "declarationFile": "/spring/rts/System/SpringApp.cpp", - "declarationLine": 106, + "declarationLine": 108, "description": "Set to 0 to disable, otherwise specify a predefined memory to serve Bitmap allocation requests", "defaultValue": "512", "minimumValue": "0", @@ -1838,21 +1879,21 @@ }, "UseFontConfigLib": { "declarationFile": "/spring/rts/System/SpringApp.cpp", - "declarationLine": 109, + "declarationLine": 111, "description": "Whether the system fontconfig library (if present and enabled at compile-time) should be used for handling fonts.", "defaultValue": 1, "type": "bool" }, "UseHighResTimer": { "declarationFile": "/spring/rts/System/SpringApp.cpp", - "declarationLine": 108, + "declarationLine": 110, "description": "On Windows, sets whether Spring will use low- or high-resolution timer functions for tasks like graphical interpolation between game frames.", "defaultValue": 0, "type": "bool" }, "UseLuaMemPools": { "declarationFile": "/spring/rts/System/SpringApp.cpp", - "declarationLine": 107, + "declarationLine": 109, "description": "Whether Lua VM memory allocations are made from pools.", "defaultValue": 1, "type": "bool" @@ -1860,6 +1901,7 @@ "UseNetMessageSmoothingBuffer": { "declarationFile": "/spring/rts/System/GlobalConfig.cpp", "declarationLine": 58, + "description": "Buffer network packets for a few frames in an attempt to reduce lag from packet time variance. Introduces a fixed lag.", "defaultValue": 1, "type": "bool" }, @@ -2007,7 +2049,7 @@ }, "name": { "declarationFile": "/spring/rts/System/SpringApp.cpp", - "declarationLine": 111, + "declarationLine": 113, "description": "Sets your name in the game. Since this is overridden by lobbies with your lobby username when playing, it usually only comes up when viewing replays or starting the engine directly for testing purposes.", "defaultValue": "UnnamedPlayer", "type": "std::string" diff --git a/_data/latest_release.json b/_data/latest_release.json index 53209deac8..2e96cccd91 100644 --- a/_data/latest_release.json +++ b/_data/latest_release.json @@ -1,9 +1,9 @@ { - "url": "https://api.github.com/repos/beyond-all-reason/spring/releases/92924750", - "assets_url": "https://api.github.com/repos/beyond-all-reason/spring/releases/92924750/assets", - "upload_url": "https://uploads.github.com/repos/beyond-all-reason/spring/releases/92924750/assets{?name,label}", - "html_url": "https://github.com/beyond-all-reason/spring/releases/tag/spring_bar_%7BBAR105%7D105.1.1-1544-g058c8ea", - "id": 92924750, + "url": "https://api.github.com/repos/beyond-all-reason/spring/releases/106171969", + "assets_url": "https://api.github.com/repos/beyond-all-reason/spring/releases/106171969/assets", + "upload_url": "https://uploads.github.com/repos/beyond-all-reason/spring/releases/106171969/assets{?name,label}", + "html_url": "https://github.com/beyond-all-reason/spring/releases/tag/spring_bar_%7BBAR105%7D105.1.1-1775-g441af87", + "id": 106171969, "author": { "login": "github-actions[bot]", "id": 41898282, @@ -24,19 +24,19 @@ "type": "Bot", "site_admin": false }, - "node_id": "RE_kwDOEgT4Wc4FietO", - "tag_name": "spring_bar_{BAR105}105.1.1-1544-g058c8ea", + "node_id": "RE_kwDOEgT4Wc4GVA5B", + "tag_name": "spring_bar_{BAR105}105.1.1-1775-g441af87", "target_commitish": "BAR105", - "name": "spring_bar_{BAR105}105.1.1-1544-g058c8ea", + "name": "spring_bar_{BAR105}105.1.1-1775-g441af87", "draft": false, "prerelease": false, - "created_at": "2023-02-18T18:40:26Z", - "published_at": "2023-02-18T20:36:43Z", + "created_at": "2023-05-30T12:38:37Z", + "published_at": "2023-06-03T07:25:04Z", "assets": [ { - "url": "https://api.github.com/repos/beyond-all-reason/spring/releases/assets/96209637", - "id": 96209637, - "node_id": "RA_kwDOEgT4Wc4FvArl", + "url": "https://api.github.com/repos/beyond-all-reason/spring/releases/assets/111086235", + "id": 111086235, + "node_id": "RA_kwDOEgT4Wc4Gnwqb", "name": "buildoptions_linux-64.txt", "label": "", "uploader": { @@ -59,18 +59,18 @@ "type": "Bot", "site_admin": false }, - "content_type": "binary/octet-stream", + "content_type": "text/plain", "state": "uploaded", "size": 662, "download_count": 3, - "created_at": "2023-02-18T20:36:44Z", - "updated_at": "2023-02-18T20:36:44Z", - "browser_download_url": "https://github.com/beyond-all-reason/spring/releases/download/spring_bar_%7BBAR105%7D105.1.1-1544-g058c8ea/buildoptions_linux-64.txt" + "created_at": "2023-06-03T07:23:41Z", + "updated_at": "2023-06-03T07:23:41Z", + "browser_download_url": "https://github.com/beyond-all-reason/spring/releases/download/spring_bar_%7BBAR105%7D105.1.1-1775-g441af87/buildoptions_linux-64.txt" }, { - "url": "https://api.github.com/repos/beyond-all-reason/spring/releases/assets/96209638", - "id": 96209638, - "node_id": "RA_kwDOEgT4Wc4FvArm", + "url": "https://api.github.com/repos/beyond-all-reason/spring/releases/assets/111086237", + "id": 111086237, + "node_id": "RA_kwDOEgT4Wc4Gnwqd", "name": "buildoptions_windows-64.txt", "label": "", "uploader": { @@ -93,19 +93,19 @@ "type": "Bot", "site_admin": false }, - "content_type": "binary/octet-stream", + "content_type": "text/plain", "state": "uploaded", "size": 551, - "download_count": 3, - "created_at": "2023-02-18T20:36:44Z", - "updated_at": "2023-02-18T20:36:45Z", - "browser_download_url": "https://github.com/beyond-all-reason/spring/releases/download/spring_bar_%7BBAR105%7D105.1.1-1544-g058c8ea/buildoptions_windows-64.txt" + "download_count": 5, + "created_at": "2023-06-03T07:23:41Z", + "updated_at": "2023-06-03T07:23:41Z", + "browser_download_url": "https://github.com/beyond-all-reason/spring/releases/download/spring_bar_%7BBAR105%7D105.1.1-1775-g441af87/buildoptions_windows-64.txt" }, { - "url": "https://api.github.com/repos/beyond-all-reason/spring/releases/assets/96209640", - "id": 96209640, - "node_id": "RA_kwDOEgT4Wc4FvAro", - "name": "spring_bar_.BAR105.105.1.1-1544-g058c8ea_linux-64-minimal-portable.7z", + "url": "https://api.github.com/repos/beyond-all-reason/spring/releases/assets/111086234", + "id": 111086234, + "node_id": "RA_kwDOEgT4Wc4Gnwqa", + "name": "spring_bar_.BAR105.105.1.1-1775-g441af87_linux-64-minimal-portable.7z", "label": "", "uploader": { "login": "github-actions[bot]", @@ -127,19 +127,19 @@ "type": "Bot", "site_admin": false }, - "content_type": "binary/octet-stream", + "content_type": "application/x-7z-compressed", "state": "uploaded", - "size": 16976427, - "download_count": 830, - "created_at": "2023-02-18T20:36:45Z", - "updated_at": "2023-02-18T20:36:46Z", - "browser_download_url": "https://github.com/beyond-all-reason/spring/releases/download/spring_bar_%7BBAR105%7D105.1.1-1544-g058c8ea/spring_bar_.BAR105.105.1.1-1544-g058c8ea_linux-64-minimal-portable.7z" + "size": 17559743, + "download_count": 296, + "created_at": "2023-06-03T07:23:40Z", + "updated_at": "2023-06-03T07:23:42Z", + "browser_download_url": "https://github.com/beyond-all-reason/spring/releases/download/spring_bar_%7BBAR105%7D105.1.1-1775-g441af87/spring_bar_.BAR105.105.1.1-1775-g441af87_linux-64-minimal-portable.7z" }, { - "url": "https://api.github.com/repos/beyond-all-reason/spring/releases/assets/96209642", - "id": 96209642, - "node_id": "RA_kwDOEgT4Wc4FvArq", - "name": "spring_bar_.BAR105.105.1.1-1544-g058c8ea_linux-64-minimal-symbols.tgz", + "url": "https://api.github.com/repos/beyond-all-reason/spring/releases/assets/111086236", + "id": 111086236, + "node_id": "RA_kwDOEgT4Wc4Gnwqc", + "name": "spring_bar_.BAR105.105.1.1-1775-g441af87_linux-64-minimal-symbols.tgz", "label": "", "uploader": { "login": "github-actions[bot]", @@ -161,19 +161,19 @@ "type": "Bot", "site_admin": false }, - "content_type": "binary/octet-stream", + "content_type": "application/octet-stream", "state": "uploaded", - "size": 407813530, - "download_count": 3, - "created_at": "2023-02-18T20:36:46Z", - "updated_at": "2023-02-18T20:36:54Z", - "browser_download_url": "https://github.com/beyond-all-reason/spring/releases/download/spring_bar_%7BBAR105%7D105.1.1-1544-g058c8ea/spring_bar_.BAR105.105.1.1-1544-g058c8ea_linux-64-minimal-symbols.tgz" + "size": 431092702, + "download_count": 2, + "created_at": "2023-06-03T07:23:41Z", + "updated_at": "2023-06-03T07:23:51Z", + "browser_download_url": "https://github.com/beyond-all-reason/spring/releases/download/spring_bar_%7BBAR105%7D105.1.1-1775-g441af87/spring_bar_.BAR105.105.1.1-1775-g441af87_linux-64-minimal-symbols.tgz" }, { - "url": "https://api.github.com/repos/beyond-all-reason/spring/releases/assets/96209648", - "id": 96209648, - "node_id": "RA_kwDOEgT4Wc4FvArw", - "name": "spring_bar_.BAR105.105.1.1-1544-g058c8ea_windows-64-minimal-portable.7z", + "url": "https://api.github.com/repos/beyond-all-reason/spring/releases/assets/111086238", + "id": 111086238, + "node_id": "RA_kwDOEgT4Wc4Gnwqe", + "name": "spring_bar_.BAR105.105.1.1-1775-g441af87_windows-64-minimal-portable.7z", "label": "", "uploader": { "login": "github-actions[bot]", @@ -195,19 +195,19 @@ "type": "Bot", "site_admin": false }, - "content_type": "binary/octet-stream", + "content_type": "application/x-7z-compressed", "state": "uploaded", - "size": 16499276, - "download_count": 6563, - "created_at": "2023-02-18T20:36:54Z", - "updated_at": "2023-02-18T20:36:55Z", - "browser_download_url": "https://github.com/beyond-all-reason/spring/releases/download/spring_bar_%7BBAR105%7D105.1.1-1544-g058c8ea/spring_bar_.BAR105.105.1.1-1544-g058c8ea_windows-64-minimal-portable.7z" + "size": 17007379, + "download_count": 56, + "created_at": "2023-06-03T07:23:41Z", + "updated_at": "2023-06-03T07:23:42Z", + "browser_download_url": "https://github.com/beyond-all-reason/spring/releases/download/spring_bar_%7BBAR105%7D105.1.1-1775-g441af87/spring_bar_.BAR105.105.1.1-1775-g441af87_windows-64-minimal-portable.7z" }, { - "url": "https://api.github.com/repos/beyond-all-reason/spring/releases/assets/96209651", - "id": 96209651, - "node_id": "RA_kwDOEgT4Wc4FvArz", - "name": "spring_bar_.BAR105.105.1.1-1544-g058c8ea_windows-64-minimal-symbols.tgz", + "url": "https://api.github.com/repos/beyond-all-reason/spring/releases/assets/111086239", + "id": 111086239, + "node_id": "RA_kwDOEgT4Wc4Gnwqf", + "name": "spring_bar_.BAR105.105.1.1-1775-g441af87_windows-64-minimal-symbols.tgz", "label": "", "uploader": { "login": "github-actions[bot]", @@ -229,16 +229,16 @@ "type": "Bot", "site_admin": false }, - "content_type": "binary/octet-stream", + "content_type": "application/octet-stream", "state": "uploaded", - "size": 435054551, - "download_count": 2, - "created_at": "2023-02-18T20:36:55Z", - "updated_at": "2023-02-18T20:37:04Z", - "browser_download_url": "https://github.com/beyond-all-reason/spring/releases/download/spring_bar_%7BBAR105%7D105.1.1-1544-g058c8ea/spring_bar_.BAR105.105.1.1-1544-g058c8ea_windows-64-minimal-symbols.tgz" + "size": 467952163, + "download_count": 7, + "created_at": "2023-06-03T07:23:41Z", + "updated_at": "2023-06-03T07:23:53Z", + "browser_download_url": "https://github.com/beyond-all-reason/spring/releases/download/spring_bar_%7BBAR105%7D105.1.1-1775-g441af87/spring_bar_.BAR105.105.1.1-1775-g441af87_windows-64-minimal-symbols.tgz" } ], - "tarball_url": "https://api.github.com/repos/beyond-all-reason/spring/tarball/spring_bar_{BAR105}105.1.1-1544-g058c8ea", - "zipball_url": "https://api.github.com/repos/beyond-all-reason/spring/zipball/spring_bar_{BAR105}105.1.1-1544-g058c8ea", + "tarball_url": "https://api.github.com/repos/beyond-all-reason/spring/tarball/spring_bar_{BAR105}105.1.1-1775-g441af87", + "zipball_url": "https://api.github.com/repos/beyond-all-reason/spring/zipball/spring_bar_{BAR105}105.1.1-1775-g441af87", "body": "Github Action Upload" } diff --git a/_data/unsynced_commands.json b/_data/unsynced_commands.json index ae59b8b3ed..af817c71d2 100644 --- a/_data/unsynced_commands.json +++ b/_data/unsynced_commands.json @@ -209,12 +209,24 @@ "command" : "DebugPath", "description" : "Enable/Disable drawing of pathfinder debug-data" }, + "debugshadowfrustum" : { + "arguments" : {}, + "cheatRequired" : false, + "command" : "DebugShadowFrustum", + "description" : "Enable/Disable drawing of shadow frustum shape" + }, "debugtraceray" : { "arguments" : {}, "cheatRequired" : false, "command" : "DebugTraceRay", "description" : "Enable/Disable drawing of traceray debug-data" }, + "debugvisibility" : { + "arguments" : {}, + "cheatRequired" : false, + "command" : "DebugVisibility", + "description" : "Enable/Disable drawing of visible terrain" + }, "decguiopacity" : { "arguments" : {}, "cheatRequired" : false, @@ -239,12 +251,6 @@ "command" : "Destroy", "description" : "Destroys one or multiple units by unit-ID, instantly" }, - "desync" : { - "arguments" : {}, - "cheatRequired" : false, - "command" : "Desync", - "description" : "Redirects command /Desync to its synced processor" - }, "disticon" : { "arguments" : {}, "cheatRequired" : false, diff --git a/_data/weapondefs.json b/_data/weapondefs.json index f9851ed553..a44510a735 100644 --- a/_data/weapondefs.json +++ b/_data/weapondefs.json @@ -55,10 +55,22 @@ "defaultValue": 1, "type": "bool" }, + "collideFireBase": { + "defaultValue": 0, + "type": "bool" + }, + "collideNonTarget": { + "defaultValue": 1, + "type": "bool" + }, "collideGround": { "defaultValue": 1, "type": "bool" }, + "collideCloaked": { + "defaultValue": 1, + "type": "bool" + }, "damage": { "type": "table" }, @@ -98,7 +110,7 @@ }, "edgeEffectiveness": { "defaultValue": 0, - "maximumValue": 1, + "maximumValue": 0.999, "type": "float" }, "collisionSize": { diff --git a/ldoc/classes/VAO.html b/ldoc/classes/VAO.html new file mode 100644 index 0000000000..05d95d66f9 --- /dev/null +++ b/ldoc/classes/VAO.html @@ -0,0 +1,566 @@ +--- +layout: default +title: VAO +permalink: ldoc/classes/VAO.html +description: Vertex Array Object +parent: Lua API +table: 0x55a54eb4a790 +--- + +{% raw %} +

Class VAO

+

Vertex Array Object

+

+ +


+

+

See also:

+ + +

Methods

+
+
+ VAO:Delete +
+
+ + + +
+
+ VAO:AttachVertexBuffer +
+
+ Attachs a VBO to be used as a vertex buffer +
+
+ VAO:AttachInstanceBuffer +
+
+ Attachs a VBO to be used as an instance buffer +
+
+ VAO:AttachIndexBuffer +
+
+ Attachs a VBO to be used as an index buffer +
+
+ VAO:DrawArrays +
+
+ + + +
+
+ VAO:DrawElements +
+
+ + + +
+
+ VAO:AddUnitsToSubmission +
+
+ + + +
+
+ VAO:AddFeaturesToSubmission +
+
+ + + +
+
+ VAO:AddUnitDefsToSubmission +
+
+ + + +
+
+ VAO:AddFeatureDefsToSubmission +
+
+ + + +
+
+ VAO:RemoveFromSubmission +
+
+ + + +
+
+ VAO:Submit +
+
+ + + +
+
+ +

+ Methods +

+ +

+ VAO:Delete() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ VAO:AttachVertexBuffer(vbo) +

+

Attachs a VBO to be used as a vertex buffer

+
+

+ +

+ + +

Parameters:

+
    +
  1. + vbo + VBO + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ VAO:AttachInstanceBuffer(vbo) +

+

Attachs a VBO to be used as an instance buffer

+
+

+ +

+ + +

Parameters:

+
    +
  1. + vbo + VBO + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ VAO:AttachIndexBuffer(vbo) +

+

Attachs a VBO to be used as an index buffer

+
+

+ +

+ + +

Parameters:

+
    +
  1. + vbo + VBO + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ VAO:DrawArrays(glEnum[, numVertices[, vertexCount[, vertexFirst[, instanceCount[, instanceFirst]]]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + glEnum + number + primitivesMode +
  2. +
  3. + numVertices + number + + + + (optional) +
  4. +
  5. + vertexCount + number + + + + (optional) +
  6. +
  7. + vertexFirst + number + + + + (optional) +
  8. +
  9. + instanceCount + number + + + + (optional) +
  10. +
  11. + instanceFirst + number + + + + (optional) +
  12. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ VAO:DrawElements(glEnum[, drawCount[, baseIndex[, instanceCount[, baseVertex[, baseInstance]]]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + glEnum + number + primitivesMode +
  2. +
  3. + drawCount + number + + + + (optional) +
  4. +
  5. + baseIndex + number + + + + (optional) +
  6. +
  7. + instanceCount + number + + + + (optional) +
  8. +
  9. + baseVertex + number + + + + (optional) +
  10. +
  11. + baseInstance + number + + + + (optional) +
  12. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ VAO:AddUnitsToSubmission(unitIDs) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitIDs + number or {number,...} + + + +
  2. +
+ +

Returns:

+
    +
  1. + number + submittedCount
  2. +
+ + + +
+

+ VAO:AddFeaturesToSubmission(featureIDs) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureIDs + number or {number,...} + + + +
  2. +
+ +

Returns:

+
    +
  1. + number + submittedCount
  2. +
+ + + +
+

+ VAO:AddUnitDefsToSubmission(unitDefIDs) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitDefIDs + number or {number,...} + + + +
  2. +
+ +

Returns:

+
    +
  1. + number + submittedCount
  2. +
+ + + +
+

+ VAO:AddFeatureDefsToSubmission(featureDefIDs) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureDefIDs + number or {number,...} + + + +
  2. +
+ +

Returns:

+
    +
  1. + number + submittedCount
  2. +
+ + + +
+

+ VAO:RemoveFromSubmission(index) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + index + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ VAO:Submit() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+ +{% endraw %} diff --git a/ldoc/classes/VBO.html b/ldoc/classes/VBO.html new file mode 100644 index 0000000000..10afb71f7a --- /dev/null +++ b/ldoc/classes/VBO.html @@ -0,0 +1,910 @@ +--- +layout: default +title: VBO +permalink: ldoc/classes/VBO.html +description: Vertex Buffer Object +parent: Lua API +table: 0x55a54e6e32a0 +--- + +{% raw %} +

Class VBO

+

Vertex Buffer Object

+

+ +


+

+

See also:

+ + +

Methods

+
+
+ VBO:Delete +
+
+ + + +
+
+ VBO:Define +
+
+ Allows you to specify what kind of VBO you will be using. +
+
+ VBO:GetBufferSize +
+
+ + + +
+
+ VBO:Upload +
+
+ Uploads the data (array of floats) into the VBO +
+
+ VBO:Download +
+
+ + + +
+
+ VBO:ModelsVBO +
+
+ Binds engine side vertex or index VBO containing models (units, features) data. +
+
+ VBO:InstanceDataFromUnitDefIDs +
+
+ Fills in attribute data for each specified unitDefID +
+
+ VBO:InstanceDataFromFeatureDefIDs +
+
+ Fills in attribute data for each specified featureDefID +
+
+ VBO:InstanceDataFromUnitIDs +
+
+ Fills in attribute data for each specified unitID +
+
+ VBO:InstanceDataFromFeatureIDs +
+
+ Fills in attribute data for each specified featureID +
+
+ VBO:MatrixDataFromProjectileIDs +
+
+ + + +
+
+ VBO:BindBufferRange +
+
+ Bind a range within a buffer object to an indexed buffer target +
+
+ VBO:UnbindBufferRange +
+
+ + + +
+
+ VBO:DumpDefinition +
+
+ Logs the definition of the VBO to the console +
+
+ +

+ Methods +

+ +

+ VBO:Delete() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ VBO:Define(size, attribs) +

+

Allows you to specify what kind of VBO you will be using.

+
+

+ + + 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: + + {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. + +

+ + +

Parameters:

+
    +
  1. + size + number + the maximum number of elements this VBO can have. +
  2. +
  3. + attribs + number or {{number,number,number,number,number},...} + + + +

    When number, the maximum number of elements this VBO can have.

    + +

    Otherwise, an array of arrays specifying the layout composed of:

    + +
      +
    • id: the location in the vertex shader layout e.g.: layout (location = 0) + in vec2 aPos. optional attrib, specifies location in the vertex shader. + If not specified the implementation will increment the counter starting from 0. + There can be maximum 16 attributes (so id of 15 is max).
    • +
    • name: the name for this VBO, only used for debugging
    • +
    • size: optional, defaults to 4 for VBO. The number of floats that + constitute 1 element in this buffer. O.g. for the previous layout + (location = 0) in vec2 aPos, it would be size = 2.
    • +
    • type: is the datatype of this element, can be: GL.BYTE, + GL.UNSIGNED_BYTE, GL.SHORT, GL.UNSIGNED_SHORT, GL.INT, + GL.UNSIGNED_INT, GL.FLOAT. Default is GL.FLOAT.
    • +
    • normalized: it's possible to submit say normal without normalizing them + first, normalized will make sure data is normalized. + Optional attrib, defaults to false.
    • +
    + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + +

See also:

+ + +

Usage:

+ +
+

+ VBO:GetBufferSize() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + elementsCount
  2. +
  3. + number + bufferSizeInBytes
  4. +
  5. + number + size
  6. +
+ + + +
+

+ VBO:Upload(vboData[, attributeIndex=-1[, elemOffset=0[, luaStartIndex=0[, luaFinishIndex]]]]) +

+

Uploads the data (array of floats) into the VBO

+
+

+ +

+ + +

Parameters:

+
    +
  1. + vboData + {number,...} + a lua array of values to upload into the + VBO +
  2. +
  3. + attributeIndex + number + 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. + (default -1) +
  4. +
  5. + elemOffset + number + which VBO element to start uploading data from Lua array into + (default 0) +
  6. +
  7. + luaStartIndex + number + start uploading from that element in supplied Lua array + (default 0) +
  8. +
  9. + luaFinishIndex + number + consider this element the last element in Lua array + (optional) +
  10. +
+ +

Returns:

+
    +
  1. + {number, + ...} indexData
  2. +
  3. + number + elemOffset
  4. +
  5. + number or {number,number,number,number} + attrID
  6. +
+ + +

See also:

+ + +

Usage:

+ +
+

+ VBO:Download([attributeIndex=-1[, elementOffset=0[, elementCount[, forceGPURead=false]]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + attributeIndex + number + when supplied with non-default value: only data + from specified attribute will be downloaded - otherwise all attributes are + downloaded + (default -1) +
  2. +
  3. + elementOffset + number + download data starting from this element + (default 0) +
  4. +
  5. + elementCount + number + number of elements to download + (optional) +
  6. +
  7. + forceGPURead + bool + force downloading the data from GPU buffer as opposed + to using shadow RAM buffer + (default false) +
  8. +
+ +

Returns:

+
    +
  1. + {{number,...},...} + vboData
  2. +
+ + + +
+

+ VBO:ModelsVBO() +

+

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()). + +

+ + + +

Returns:

+
    +
  1. + nil or number + buffer size in bytes
  2. +
+ + + +
+

+ VBO:InstanceDataFromUnitDefIDs(unitDefIDs, attrID[, teamIdOpt[, elementOffset]]) +

+

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. + +

+ + +

Parameters:

+
    +
  1. + unitDefIDs + number or {number,...} + + + +
  2. +
  3. + attrID + number + + + +
  4. +
  5. + teamIdOpt + number + + + + (optional) +
  6. +
  7. + elementOffset + number + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + {number,number,number,number} + instanceData
  2. +
  3. + number + elementOffset
  4. +
  5. + attrID + + +
  6. +
+ + + +

Usage:

+ +
+

+ VBO:InstanceDataFromFeatureDefIDs(featureDefIDs, attrID[, teamIdOpt[, elementOffset]]) +

+

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. + +

+ + +

Parameters:

+
    +
  1. + featureDefIDs + number or {number,...} + + + +
  2. +
  3. + attrID + number + + + +
  4. +
  5. + teamIdOpt + number + + + + (optional) +
  6. +
  7. + elementOffset + number + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + {number,number,number,number} + instanceData
  2. +
  3. + number + elementOffset
  4. +
  5. + attrID + + +
  6. +
+ + + +

Usage:

+ +
+

+ VBO:InstanceDataFromUnitIDs(unitIDs, attrID[, teamIdOpt[, elementOffset]]) +

+

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. + +

+ + +

Parameters:

+
    +
  1. + unitIDs + number or {number,...} + + + +
  2. +
  3. + attrID + number + + + +
  4. +
  5. + teamIdOpt + number + + + + (optional) +
  6. +
  7. + elementOffset + number + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + {number,number,number,number} + instanceData
  2. +
  3. + number + elementOffset
  4. +
  5. + attrID + + +
  6. +
+ + + +

Usage:

+ +
+

+ VBO:InstanceDataFromFeatureIDs(featureIDs, attrID[, teamIdOpt[, elementOffset]]) +

+

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. + +

+ + +

Parameters:

+
    +
  1. + featureIDs + number or {number,...} + + + +
  2. +
  3. + attrID + number + + + +
  4. +
  5. + teamIdOpt + number + + + + (optional) +
  6. +
  7. + elementOffset + number + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + {number,number,number,number} + instanceData
  2. +
  3. + number + elementOffset
  4. +
  5. + attrID + + +
  6. +
+ + + +
+

+ VBO:MatrixDataFromProjectileIDs(projectileIDs, attrID[, teamIdOpt[, elementOffset]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + projectileIDs + number or {number,...} + + + +
  2. +
  3. + attrID + number + + + +
  4. +
  5. + teamIdOpt + number + + + + (optional) +
  6. +
  7. + elementOffset + number + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + {number, + ...} matDataVec 4x4 matrix
  2. +
  3. + number + elemOffset
  4. +
  5. + number or {number,number,number,number} + attrID
  6. +
+ + + +
+

+ VBO:BindBufferRange(index[, elementOffset[, elementCount[, target]]]) +

+

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. + +

+ + +

Parameters:

+
    +
  1. + index + number + should be in the range between + 5 < index < GL_MAX_UNIFORM_BUFFER_BINDINGS value (usually 31) +
  2. +
  3. + elementOffset + number + + + + (optional) +
  4. +
  5. + elementCount + number + + + + (optional) +
  6. +
  7. + target + number + glEnum + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + number + bindingIndex when successful, -1 otherwise
  2. +
+ + + +
+

+ VBO:UnbindBufferRange(index[, elementOffset[, elementCount[, target]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + index + number + + + +
  2. +
  3. + elementOffset + number + + + + (optional) +
  4. +
  5. + elementCount + number + + + + (optional) +
  6. +
  7. + target + number + glEnum + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + number + bindingIndex when successful, -1 otherwise
  2. +
+ + + +
+

+ VBO:DumpDefinition() +

+

Logs the definition of the VBO to the console

+
+

+ +

+ + + +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+ +{% endraw %} diff --git a/ldoc/index.html b/ldoc/index.html new file mode 100644 index 0000000000..c132102b7b --- /dev/null +++ b/ldoc/index.html @@ -0,0 +1,135 @@ +--- +layout: default +title: Home +permalink: ldoc/index.html +description: +parent: Lua API +published: false +--- + +{% raw %} +

A Lua documentation tool

+ +

Modules

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SyncedCtrlSynced Lua API
UnsyncedCtrlCallouts to set state
SyncedReadSynced Read
UnsyncedReadCallouts to get state
MoveCtrlMoveCtrl
LuaHandleCallins, functions called by the Engine
LuaHandleSyncedCallins, functions called by the Engine (Synced)
VFSVirtual File System
LuaVAO + +
LuaVBO + +
OpenGLLua OpenGL API
LuaZipLuaZip
LuaRulesLua Rules
MetalMapMetal Map Lua API
ShadersShader creation and management
FBOFBO
RBORBO
MathExtramath extensions
BitOpsmath bit extensions
GameGame constants
EngineEngine constants
PlatformPlatform constants
CMDCommand constants
CMDTYPECommand type constants
COBCOB constants
GLOpenGL Constants
+

Classes

+ + + + + + + + + +
VAOVertex Array Object
VBOVertex Buffer Object
+{% endraw %} diff --git a/ldoc/ldoc.css b/ldoc/ldoc.css new file mode 100644 index 0000000000..52c4ad2bd8 --- /dev/null +++ b/ldoc/ldoc.css @@ -0,0 +1,303 @@ +/* BEGIN RESET + +Copyright (c) 2010, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.com/yui/license.html +version: 2.8.2r1 +*/ +html { + color: #000; + background: #FFF; +} +body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td { + margin: 0; + padding: 0; +} +table { + border-collapse: collapse; + border-spacing: 0; +} +fieldset,img { + border: 0; +} +address,caption,cite,code,dfn,em,strong,th,var,optgroup { + font-style: inherit; + font-weight: inherit; +} +del,ins { + text-decoration: none; +} +li { + margin-left: 20px; +} +caption,th { + text-align: left; +} +h1,h2,h3,h4,h5,h6 { + font-size: 100%; + font-weight: bold; +} +q:before,q:after { + content: ''; +} +abbr,acronym { + border: 0; + font-variant: normal; +} +sup { + vertical-align: baseline; +} +sub { + vertical-align: baseline; +} +legend { + color: #000; +} +input,button,textarea,select,optgroup,option { + font-family: inherit; + font-size: inherit; + font-style: inherit; + font-weight: inherit; +} +input,button,textarea,select {*font-size:100%; +} +/* END RESET */ + +body { + margin-left: 1em; + margin-right: 1em; + font-family: arial, helvetica, geneva, sans-serif; + background-color: #ffffff; margin: 0px; +} + +code, tt { font-family: monospace; font-size: 1.1em; } +span.parameter { font-family:monospace; } +span.parameter:after { content:":"; } +span.types:before { content:"("; } +span.types:after { content:")"; } +.type { font-weight: bold; font-style:italic } + +body, p, td, th { font-size: .95em; line-height: 1.2em;} + +p, ul { margin: 10px 0 0 0px;} + +strong { font-weight: bold;} + +em { font-style: italic;} + +h1 { + font-size: 1.5em; + margin: 20px 0 20px 0; +} +h2, h3, h4 { margin: 15px 0 10px 0; } +h2 { font-size: 1.25em; } +h3 { font-size: 1.15em; } +h4 { font-size: 1.06em; } + +a:link { font-weight: bold; color: #004080; text-decoration: none; } +a:visited { font-weight: bold; color: #006699; text-decoration: none; } +a:link:hover { text-decoration: underline; } + +hr { + color:#cccccc; + background: #00007f; + height: 1px; +} + +blockquote { margin-left: 3em; } + +ul { list-style-type: disc; } + +p.name { + font-family: "Andale Mono", monospace; + padding-top: 1em; +} + +pre { + background-color: rgb(245, 245, 245); + border: 1px solid #C0C0C0; /* silver */ + padding: 10px; + margin: 10px 0 10px 0; + overflow: auto; + font-family: "Andale Mono", monospace; +} + +pre.example { + font-size: .85em; +} + +table.index { border: 1px #00007f; } +table.index td { text-align: left; vertical-align: top; } + +#container { + margin-left: 1em; + margin-right: 1em; + background-color: #f0f0f0; +} + +#product { + text-align: center; + border-bottom: 1px solid #cccccc; + background-color: #ffffff; +} + +#product big { + font-size: 2em; +} + +#main { + background-color: #f0f0f0; + border-left: 2px solid #cccccc; +} + +#navigation { + float: left; + width: 14em; + vertical-align: top; + background-color: #f0f0f0; + overflow: visible; +} + +#navigation h2 { + background-color:#e7e7e7; + font-size:1.1em; + color:#000000; + text-align: left; + padding:0.2em; + border-top:1px solid #dddddd; + border-bottom:1px solid #dddddd; +} + +#navigation ul +{ + font-size:1em; + list-style-type: none; + margin: 1px 1px 10px 1px; +} + +#navigation li { + text-indent: -1em; + display: block; + margin: 3px 0px 0px 22px; +} + +#navigation li li a { + margin: 0px 3px 0px -1em; +} + +#content { + margin-left: 14em; + padding: 1em; + width: 700px; + border-left: 2px solid #cccccc; + border-right: 2px solid #cccccc; + background-color: #ffffff; +} + +#about { + clear: both; + padding: 5px; + border-top: 2px solid #cccccc; + background-color: #ffffff; +} + +@media print { + body { + font: 12pt "Times New Roman", "TimeNR", Times, serif; + } + a { font-weight: bold; color: #004080; text-decoration: underline; } + + #main { + background-color: #ffffff; + border-left: 0px; + } + + #container { + margin-left: 2%; + margin-right: 2%; + background-color: #ffffff; + } + + #content { + padding: 1em; + background-color: #ffffff; + } + + #navigation { + display: none; + } + pre.example { + font-family: "Andale Mono", monospace; + font-size: 10pt; + page-break-inside: avoid; + } +} + +table.module_list { + border-width: 1px; + border-style: solid; + border-color: #cccccc; + border-collapse: collapse; +} +table.module_list td { + border-width: 1px; + padding: 3px; + border-style: solid; + border-color: #cccccc; +} +table.module_list td.name { background-color: #f0f0f0; min-width: 200px; } +table.module_list td.summary { width: 100%; } + + +table.function_list { + border-width: 1px; + border-style: solid; + border-color: #cccccc; + border-collapse: collapse; +} +table.function_list td { + border-width: 1px; + padding: 3px; + border-style: solid; + border-color: #cccccc; +} +table.function_list td.name { background-color: #f0f0f0; min-width: 200px; } +table.function_list td.summary { width: 100%; } + +ul.nowrap { + overflow:auto; + white-space:nowrap; +} + +dl.table dt, dl.function dt {border-top: 1px solid #ccc; padding-top: 1em;} +dl.table dd, dl.function dd {padding-bottom: 1em; margin: 10px 0 0 20px;} +dl.table h3, dl.function h3 {font-size: .95em;} + +/* stop sublists from having initial vertical space */ +ul ul { margin-top: 0px; } +ol ul { margin-top: 0px; } +ol ol { margin-top: 0px; } +ul ol { margin-top: 0px; } + +/* make the target distinct; helps when we're navigating to a function */ +a:target + * { + background-color: #FF9; +} + + +/* styles for prettification of source */ +pre .comment { color: #558817; } +pre .constant { color: #a8660d; } +pre .escape { color: #844631; } +pre .keyword { color: #aa5050; font-weight: bold; } +pre .library { color: #0e7c6b; } +pre .marker { color: #512b1e; background: #fedc56; font-weight: bold; } +pre .string { color: #8080ff; } +pre .number { color: #f8660d; } +pre .operator { color: #2239a8; font-weight: bold; } +pre .preprocessor, pre .prepro { color: #a33243; } +pre .global { color: #800080; } +pre .user-keyword { color: #800080; } +pre .prompt { color: #558817; } +pre .url { color: #272fc2; text-decoration: underline; } + diff --git a/ldoc/modules/BitOps.html b/ldoc/modules/BitOps.html new file mode 100644 index 0000000000..101f96b8ca --- /dev/null +++ b/ldoc/modules/BitOps.html @@ -0,0 +1,330 @@ +--- +layout: default +title: BitOps +permalink: ldoc/modules/BitOps.html +description: math bit extensions +parent: Lua API +table: 0x55a54eab98c0 +--- + +{% raw %} +

Module BitOps

+

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 also:

+ + +

Functions

+
+
+ math.bit_or +
+
+ Returns the bitwise OR of all arguments. +
+
+ math.bit_and +
+
+ Returns the bitwise AND of all arguments. +
+
+ math.bit_xor +
+
+ Returns the bitwise XOR of all arguments. +
+
+ math.bit_inv +
+
+ Returns the bitwise NOT of the 24 bit integer argument. +
+
+ math.bit_bits +
+
+ Set each of the bits of a 24 bit integer. +
+
+ +

+ Functions +

+ +

+ math.bit_or(a1, a2[, a3[, an]]) +

+

Returns the bitwise OR of all arguments.

+
+

+ Only use up to 24 bit integers. + +

+ + +

Parameters:

+
    +
  1. + a1 + number + + + +
  2. +
  3. + a2 + number + + + +
  4. +
  5. + a3 + number + + + + (optional) +
  6. +
  7. + an + number + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + number + i
  2. +
+ + + +
+

+ math.bit_and(a1, a2[, a3[, an]]) +

+

Returns the bitwise AND of all arguments.

+
+

+ Only use up to 24 bit integers. + +

+ + +

Parameters:

+
    +
  1. + a1 + number + + + +
  2. +
  3. + a2 + number + + + +
  4. +
  5. + a3 + number + + + + (optional) +
  6. +
  7. + an + number + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + number + i
  2. +
+ + + +
+

+ math.bit_xor(a1, a2[, a3[, an]]) +

+

Returns the bitwise XOR of all arguments.

+
+

+ Only use up to 24 bit integers. + +

+ + +

Parameters:

+
    +
  1. + a1 + number + + + +
  2. +
  3. + a2 + number + + + +
  4. +
  5. + a3 + number + + + + (optional) +
  6. +
  7. + an + number + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + number + i
  2. +
+ + + +
+

+ math.bit_inv(a1) +

+

Returns the bitwise NOT of the 24 bit integer argument.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + a1 + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + number + i
  2. +
+ + + +
+

+ math.bit_bits(a1, a2[, a3[, an]]) +

+

Set each of the bits of a 24 bit integer.

+
+

+ Returns result = result OR (1 << a1) OR (1 << a2) OR ...;) + +

+ + +

Parameters:

+
    +
  1. + a1 + number + + + +
  2. +
  3. + a2 + number + + + +
  4. +
  5. + a3 + number + + + + (optional) +
  6. +
  7. + an + number + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + number + i
  2. +
+ + + +
+ +{% endraw %} diff --git a/ldoc/modules/CMD.html b/ldoc/modules/CMD.html new file mode 100644 index 0000000000..ead47ff4d8 --- /dev/null +++ b/ldoc/modules/CMD.html @@ -0,0 +1,305 @@ +--- +layout: default +title: CMD +permalink: ldoc/modules/CMD.html +description: Command constants +parent: Lua API +table: 0x55a54e865f80 +--- + +{% raw %} +

Module CMD

+

Command constants

+

+ +


+

+

See also:

+ + +

Tables

+
+
+ CMD +
+
+ + + +
+
+ +

+ Tables +

+ +

+ CMD +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + FIRESTATE_NONE + -1 +
  2. +
  3. + MOVESTATE_NONE + -1 +
  4. +
  5. + STOP + 0 +
  6. +
  7. + MOVESTATE_HOLDPOS + 0 +
  8. +
  9. + FIRESTATE_HOLDFIRE + 0 +
  10. +
  11. + INSERT + 1 +
  12. +
  13. + MOVESTATE_MANEUVER + 1 +
  14. +
  15. + FIRESTATE_RETURNFIRE + 1 +
  16. +
  17. + WAITCODE_TIME + 1 +
  18. +
  19. + WAITCODE_DEATH + 2 +
  20. +
  21. + MOVESTATE_ROAM + 2 +
  22. +
  23. + REMOVE + 2 +
  24. +
  25. + FIRESTATE_FIREATWILL + 2 +
  26. +
  27. + FIRESTATE_FIREATNEUTRAL + 3 +
  28. +
  29. + WAITCODE_SQUAD + 3 +
  30. +
  31. + OPT_META + 4 +
  32. +
  33. + WAITCODE_GATHER + 4 +
  34. +
  35. + WAIT + 5 +
  36. +
  37. + TIMEWAIT + 6 +
  38. +
  39. + DEATHWAIT + 7 +
  40. +
  41. + OPT_INTERNAL + 8 +
  42. +
  43. + SQUADWAIT + 8 +
  44. +
  45. + GATHERWAIT + 9 +
  46. +
  47. + MOVE + 10 +
  48. +
  49. + PATROL + 15 +
  50. +
  51. + FIGHT + 16 +
  52. +
  53. + OPT_RIGHT + 16 +
  54. +
  55. + LOOPBACKATTACK + 20 +
  56. +
  57. + ATTACK + 20 +
  58. +
  59. + AREA_ATTACK + 21 +
  60. +
  61. + GUARD + 25 +
  62. +
  63. + AISELECT + 30 +
  64. +
  65. + OPT_SHIFT + 32 +
  66. +
  67. + GROUPSELECT + 35 +
  68. +
  69. + GROUPADD + 36 +
  70. +
  71. + GROUPCLEAR + 37 +
  72. +
  73. + REPAIR + 40 +
  74. +
  75. + FIRE_STATE + 45 +
  76. +
  77. + MOVE_STATE + 50 +
  78. +
  79. + SETBASE + 55 +
  80. +
  81. + INTERNAL + 60 +
  82. +
  83. + OPT_CTRL + 64 +
  84. +
  85. + SELFD + 65 +
  86. +
  87. + SET_WANTED_MAX_SPEED + 70 +
  88. +
  89. + LOAD_UNITS + 75 +
  90. +
  91. + LOAD_ONTO + 76 +
  92. +
  93. + UNLOAD_UNITS + 80 +
  94. +
  95. + UNLOAD_UNIT + 81 +
  96. +
  97. + ONOFF + 85 +
  98. +
  99. + RECLAIM + 90 +
  100. +
  101. + CLOAK + 95 +
  102. +
  103. + STOCKPILE + 100 +
  104. +
  105. + MANUALFIRE + 105 +
  106. +
  107. + DGUN + 105 +
  108. +
  109. + RESTORE + 110 +
  110. +
  111. + REPEAT + 115 +
  112. +
  113. + TRAJECTORY + 120 +
  114. +
  115. + RESURRECT + 125 +
  116. +
  117. + OPT_ALT + 128 +
  118. +
  119. + CAPTURE + 130 +
  120. +
  121. + AUTOREPAIRLEVEL + 135 +
  122. +
  123. + IDLEMODE + 145 +
  124. +
+ + + + +
+ +{% endraw %} diff --git a/ldoc/modules/CMDTYPE.html b/ldoc/modules/CMDTYPE.html new file mode 100644 index 0000000000..ef5b0e249a --- /dev/null +++ b/ldoc/modules/CMDTYPE.html @@ -0,0 +1,136 @@ +--- +layout: default +title: CMDTYPE +permalink: ldoc/modules/CMDTYPE.html +description: Command type constants +parent: Lua API +table: 0x55a54eb4f7e0 +--- + +{% raw %} +

Module CMDTYPE

+

Command type constants

+

+ +


+

+

See also:

+ + +

Tables

+
+
+ CMDTYPE +
+
+ Note, the CMDTYPE[] table is bidirectional. +
+
+ +

+ Tables +

+ +

+ CMDTYPE +

+

Note, the CMDTYPE[] table is bidirectional.

+
+

+ That means: CMDTYPE[CMDTYPE.ICON] := "CMDTYPE_ICON" + +

+ + +

Fields:

+
    +
  1. + ICON + number + expect 0 parameters in return +
  2. +
  3. + ICON_MODE + number + expect 1 parameter in return (number selected mode) +
  4. +
  5. + ICON_MAP + number + expect 3 parameters in return (mappos) +
  6. +
  7. + ICON_AREA + number + expect 4 parameters in return (mappos+radius) +
  8. +
  9. + ICON_UNIT + number + expect 1 parameters in return (unitid) +
  10. +
  11. + ICON_UNIT_OR_MAP + number + expect 1 parameters in return (unitid) or 3 parameters in return (mappos) +
  12. +
  13. + ICON_FRONT + number + expect 3 or 6 parameters in return (middle and right side of front if a front was defined) +
  14. +
  15. + COMBO_BOX + number + expect 1 parameter in return (number selected option) +
  16. +
  17. + ICON_UNIT_OR_AREA + number + expect 1 parameter in return (unitid) or 4 parameters in return (mappos+radius) +
  18. +
  19. + ICON_UNIT_FEATURE_OR_AREA + number + expect 1 parameter in return (unitid or Game.maxUnits+featureid) or 4 parameters in return (mappos+radius) +
  20. +
  21. + ICON_BUILDING + number + expect 3 parameters in return (mappos) +
  22. +
  23. + ICON_UNIT_OR_RECTANGLE + number + expect 1 parameter in return (unitid) or 3 parameters in return (mappos) or 6 parameters in return (startpos+endpos) +
  24. +
  25. + NUMBER + number + expect 1 parameter in return (number) +
  26. +
  27. + CUSTOM + number + used with CMD_INTERNAL +
  28. +
  29. + NEXT + number + next command page used with CMD_INTERNAL +
  30. +
  31. + PREV + number + previous command page used with CMD_INTERNAL +
  32. +
+ + + + +
+ +{% endraw %} diff --git a/ldoc/modules/COB.html b/ldoc/modules/COB.html new file mode 100644 index 0000000000..470725c387 --- /dev/null +++ b/ldoc/modules/COB.html @@ -0,0 +1,784 @@ +--- +layout: default +title: COB +permalink: ldoc/modules/COB.html +description: COB constants +parent: Lua API +table: 0x55a54ea59d40 +--- + +{% raw %} +

Module COB

+

COB constants

+

+ +


+

+

See also:

+ + +

Tables

+
+
+ COB +
+
+ + + +
+
+ SFX +
+
+ Piece Flags for Spring.UnitScript.Explode +
+
+ SFX +
+
+ For Spring.UnitScript.EmitSfx +
+
+ +

+ Tables +

+ +

+ COB +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + ACTIVATION + number + + + +
  2. +
  3. + STANDINGMOVEORDERS + number + + + +
  4. +
  5. + STANDINGFIREORDERS + number + + + +
  6. +
  7. + HEALTH + number + + + +
  8. +
  9. + INBUILDSTANCE + number + + + +
  10. +
  11. + BUSY + number + + + +
  12. +
  13. + PIECE_XZ + number + + + +
  14. +
  15. + PIECE_Y + number + + + +
  16. +
  17. + UNIT_XZ + number + + + +
  18. +
  19. + UNIT_Y + number + + + +
  20. +
  21. + UNIT_HEIGHT + number + + + +
  22. +
  23. + XZ_ATAN + number + + + +
  24. +
  25. + XZ_HYPOT + number + + + +
  26. +
  27. + ATAN + number + + + +
  28. +
  29. + HYPOT + number + + + +
  30. +
  31. + GROUND_HEIGHT + number + + + +
  32. +
  33. + BUILD_PERCENT_LEFT + number + + + +
  34. +
  35. + YARD_OPEN + number + + + +
  36. +
  37. + BUGGER_OFF + number + + + +
  38. +
  39. + ARMORED + number + + + +
  40. +
  41. + IN_WATER + number + + + +
  42. +
  43. + CURRENT_SPEED + number + + + +
  44. +
  45. + VETERAN_LEVEL + number + + + +
  46. +
  47. + ON_ROAD + number + + + +
  48. +
  49. + MAX_ID + number + + + +
  50. +
  51. + MY_ID + number + + + +
  52. +
  53. + UNIT_TEAM + number + + + +
  54. +
  55. + UNIT_BUILD_PERCENT_LEFT + number + + + +
  56. +
  57. + UNIT_ALLIED + number + + + +
  58. +
  59. + MAX_SPEED + number + + + +
  60. +
  61. + CLOAKED + number + + + +
  62. +
  63. + WANT_CLOAK + number + + + +
  64. +
  65. + GROUND_WATER_HEIGHT + number + + + +
  66. +
  67. + UPRIGHT + number + + + +
  68. +
  69. + POW + number + + + +
  70. +
  71. + PRINT + number + + + +
  72. +
  73. + HEADING + number + + + +
  74. +
  75. + TARGET_ID + number + + + +
  76. +
  77. + LAST_ATTACKER_ID + number + + + +
  78. +
  79. + LOS_RADIUS + number + + + +
  80. +
  81. + AIR_LOS_RADIUS + number + + + +
  82. +
  83. + RADAR_RADIUS + number + + + +
  84. +
  85. + JAMMER_RADIUS + number + + + +
  86. +
  87. + SONAR_RADIUS + number + + + +
  88. +
  89. + SONAR_JAM_RADIUS + number + + + +
  90. +
  91. + SEISMIC_RADIUS + number + + + +
  92. +
  93. + DO_SEISMIC_PING + number + + + +
  94. +
  95. + CURRENT_FUEL + number + + + +
  96. +
  97. + TRANSPORT_ID + number + + + +
  98. +
  99. + SHIELD_POWER + number + + + +
  100. +
  101. + STEALTH + number + + + +
  102. +
  103. + CRASHING + number + + + +
  104. +
  105. + CHANGE_TARGET + number + + + +
  106. +
  107. + CEG_DAMAGE + number + + + +
  108. +
  109. + COB_ID + number + + + +
  110. +
  111. + PLAY_SOUND + number + + + +
  112. +
  113. + KILL_UNIT + number + + + +
  114. +
  115. + ALPHA_THRESHOLD + number + + + +
  116. +
  117. + SET_WEAPON_UNIT_TARGET + number + + + +
  118. +
  119. + SET_WEAPON_GROUND_TARGET + number + + + +
  120. +
  121. + SONAR_STEALTH + number + + + +
  122. +
  123. + REVERSING + number + + + +
  124. +
  125. + FLANK_B_MODE + number + + + +
  126. +
  127. + FLANK_B_DIR + number + + + +
  128. +
  129. + FLANK_B_MOBILITY_ADD + number + + + +
  130. +
  131. + FLANK_B_MAX_DAMAGE + number + + + +
  132. +
  133. + FLANK_B_MIN_DAMAGE + number + + + +
  134. +
  135. + WEAPON_RELOADSTATE + number + + + +
  136. +
  137. + WEAPON_RELOADTIME + number + + + +
  138. +
  139. + WEAPON_ACCURACY + number + + + +
  140. +
  141. + WEAPON_SPRAY + number + + + +
  142. +
  143. + WEAPON_RANGE + number + + + +
  144. +
  145. + WEAPON_PROJECTILE_SPEED + number + + + +
  146. +
  147. + MIN + number + + + +
  148. +
  149. + MAX + number + + + +
  150. +
  151. + ABS + number + + + +
  152. +
  153. + GAME_FRAME + number + + + +
  154. +
+ + + + +
+

+ SFX +

+

Piece Flags for Spring.UnitScript.Explode

+
+

+ +

+ + +

Fields:

+
    +
  1. + SHATTER + number + + + +
  2. +
  3. + EXPLODE + number + + + +
  4. +
  5. + EXPLODE_ON_HIT + number + + + +
  6. +
  7. + FALL + number + + + +
  8. +
  9. + SMOKE + number + + + +
  10. +
  11. + FIRE + number + + + +
  12. +
  13. + NONE + number + + + +
  14. +
  15. + NO_CEG_TRAIL + number + + + +
  16. +
  17. + NO_HEATCLOUD + number + + + +
  18. +
  19. + RECURSIVE + number + + + +
  20. +
+ + + + +
+

+ SFX +

+

For Spring.UnitScript.EmitSfx

+
+

+ +

+ + +

Fields:

+
    +
  1. + VTOL + number + + + +
  2. +
  3. + WAKE + number + + + +
  4. +
  5. + REVERSE_WAKE + number + + + +
  6. +
  7. + WHITE_SMOKE + number + + + +
  8. +
  9. + BLACK_SMOKE + number + + + +
  10. +
  11. + BUBBLE + number + + + +
  12. +
  13. + CEG + number + + + +
  14. +
  15. + FIRE_WEAPON + number + + + +
  16. +
  17. + DETONATE_WEAPON + number + + + +
  18. +
  19. + GLOBAL + number + + + +
  20. +
+ + + + +
+ +{% endraw %} diff --git a/ldoc/modules/Engine.html b/ldoc/modules/Engine.html new file mode 100644 index 0000000000..04027654ed --- /dev/null +++ b/ldoc/modules/Engine.html @@ -0,0 +1,84 @@ +--- +layout: default +title: Engine +permalink: ldoc/modules/Engine.html +description: Engine constants +parent: Lua API +table: 0x55a54e8941d0 +--- + +{% raw %} +

Module Engine

+

Engine constants

+

+ +


+

+

See also:

+ + +

Tables

+
+
+ Engine +
+
+ Engine specific information +
+
+ +

+ Tables +

+ +

+ Engine +

+

Engine specific information

+
+

+ +

+ + +

Fields:

+
    +
  1. + version + string + Returns the same as spring *sync-version, e.g. "92" +
  2. +
  3. + versionFull + string + + + +
  4. +
  5. + versionPatchSet + string + + + +
  6. +
  7. + buildFlags + string + (unsynced only) Gets additional engine buildflags, e.g. "OMP" or "MT-Sim DEBUG" +
  8. +
  9. + wordSize + number + indicates the build type and is either 32 or 64 (or 0 in synced code) +
  10. +
+ + + + +
+ +{% endraw %} diff --git a/ldoc/modules/FBO.html b/ldoc/modules/FBO.html new file mode 100644 index 0000000000..40930a7243 --- /dev/null +++ b/ldoc/modules/FBO.html @@ -0,0 +1,598 @@ +--- +layout: default +title: FBO +permalink: ldoc/modules/FBO.html +description: FBO +parent: Lua API +table: 0x55a54e88a7f0 +--- + +{% raw %} +

Module FBO

+

FBO

+

+ +


+

+

See also:

+ + +

Functions

+
+
+ gl.CreateFBO +
+
+ + + +
+
+ gl.DeleteFBO +
+
+ + + +
+
+ gl.IsValidFBO +
+
+ + + +
+
+ gl.ActiveFBO +
+
+ + + +
+
+ gl.BlitFBO +
+
+ needs GLEW_EXT_framebuffer_blit +
+
+ gl.BlitFBO +
+
+ needs GLEW_EXT_framebuffer_blit +
+
+

Tables

+
+
+ attachment +
+
+ + + +
+
+ fbo +
+
+ User Data FBO +
+
+ +

+ Functions +

+ +

+ gl.CreateFBO(data) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. data + + + +
+ + + + +
+

+ gl.DeleteFBO(fbo) +

+

+
+

+ + This doesn't delete the attached objects! +

+ + +

Parameters:

+
    +
  1. + fbo + fbo + + + +
  2. +
+ + + + +
+

+ gl.IsValidFBO(fbo[, target]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + fbo + fbo + + + +
  2. +
  3. + target + number + + + + (optional) +
  4. +
+ +

Returns:

+
    +
  1. + bool + valid
  2. +
  3. + optional number + status
  4. +
+ + + +
+

+ gl.ActiveFBO(fbo[, target[, identities[, lua_function[, arg1[, arg2[, argn]]]]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + fbo + fbo + + + +
  2. +
  3. + target + number + + + + (optional) +
  4. +
  5. + identities + bool + + + + (optional) +
  6. +
  7. + lua_function + func + + + + (optional) +
  8. +
  9. + arg1 + + + + (optional) +
  10. +
  11. + arg2 + + + + (optional) +
  12. +
  13. + argn + + + + (optional) +
  14. +
+ + + + +
+

+ gl.BlitFBO(x0Src, y0Src, x1Src, y1Src, x0Dst, y0Dst, x1Dst, y1Dst[, mask=GL_COLOR_BUFFER_BIT[, filter=GL_NEAREST]]) +

+

needs `GLEW_EXT_framebuffer_blit`

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x0Src + number + + + +
  2. +
  3. + y0Src + number + + + +
  4. +
  5. + x1Src + number + + + +
  6. +
  7. + y1Src + number + + + +
  8. +
  9. + x0Dst + number + + + +
  10. +
  11. + y0Dst + number + + + +
  12. +
  13. + x1Dst + number + + + +
  14. +
  15. + y1Dst + number + + + +
  16. +
  17. + mask + number + + + + (default GL_COLOR_BUFFER_BIT) +
  18. +
  19. + filter + number + + + + (default GL_NEAREST) +
  20. +
+ + + + +
+

+ gl.BlitFBO(fboSrc, x0Src, y0Src, x1Src, y1Src, fboDst, x0Dst, y0Dst, x1Dst, y1Dst[, mask=GL_COLOR_BUFFER_BIT[, filter=GL_NEAREST]]) +

+

needs `GLEW_EXT_framebuffer_blit`

+
+

+ +

+ + +

Parameters:

+
    +
  1. + fboSrc + fbo + + + +
  2. +
  3. + x0Src + number + + + +
  4. +
  5. + y0Src + number + + + +
  6. +
  7. + x1Src + number + + + +
  8. +
  9. + y1Src + number + + + +
  10. +
  11. + fboDst + fbo + + + +
  12. +
  13. + x0Dst + number + + + +
  14. +
  15. + y0Dst + number + + + +
  16. +
  17. + x1Dst + number + + + +
  18. +
  19. + y1Dst + number + + + +
  20. +
  21. + mask + number + + + + (default GL_COLOR_BUFFER_BIT) +
  22. +
  23. + filter + number + + + + (default GL_NEAREST) +
  24. +
+ + + + +
+

+ Tables +

+ +

+ attachment +

+

+
+

+ + attachment ::= luaTex or `RBO.rbo` or nil or { luaTex [, num target [, num level ] ] } +

+ + + + + + +
+

+ fbo +

+

User Data FBO

+
+

+ +

+ + +

Fields:

+
    +
  1. + depth + attachment + + + +
  2. +
  3. + stencil + attachment + + + +
  4. +
  5. + color0 + attachment + + + +
  6. +
  7. + color1 + attachment + + + +
  8. +
  9. + color2 + attachment + + + +
  10. +
  11. + colorn + attachment + + + +
  12. +
  13. + color15 + attachment + + + +
  14. +
  15. + drawbuffers + table + { GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT3_EXT, ..} +
  16. +
  17. + readbuffer + table + GL_COLOR_ATTACHMENT0_EXT +
  18. +
+ + + + +
+ +{% endraw %} diff --git a/ldoc/modules/GL.html b/ldoc/modules/GL.html new file mode 100644 index 0000000000..572d707c2f --- /dev/null +++ b/ldoc/modules/GL.html @@ -0,0 +1,3185 @@ +--- +layout: default +title: GL +permalink: ldoc/modules/GL.html +description: OpenGL Constants +parent: Lua API +table: 0x55a54e870290 +--- + +{% raw %} +

Module GL

+

OpenGL Constants

+

+ +


+

+

See also:

+ + +

Drawing Primitives

+
+
+ GL +
+
+ + + +
+
+

BlendingFactorDest

+
+
+ GL +
+
+ + + +
+
+

BlendingFactorSrc

+
+
+ GL +
+
+ + + +
+
+

AlphaFunction and DepthFunction

+
+
+ GL +
+
+ + + +
+
+

LogicOp

+
+
+ GL +
+
+ + + +
+
+

Culling

+
+
+ GL +
+
+ + + +
+
+

PolygonMode

+
+
+ GL +
+
+ + + +
+
+

Clear Bits

+
+
+ GL +
+
+ + + +
+
+

ShadeModel

+
+
+ GL +
+
+ + + +
+
+

MatrixMode

+
+
+ GL +
+
+ + + +
+
+

Texture Filtering

+
+
+ GL +
+
+ + + +
+
+

Texture Clamping

+
+
+ GL +
+
+ + + +
+
+

Texture Environment

+
+
+ GL +
+
+ + + +
+
+ GL_TEXTURE_FILTER_CONTROL +
+
+ + + +
+
+ GL_TEXTURE_LOD_BIAS +
+
+ + + +
+
+

Texture Generation

+
+
+ GL +
+
+ + + +
+
+

glPushAttrib() bits

+
+
+ GL +
+
+ + + +
+
+

glHint() targets

+
+
+ GL +
+
+ + + +
+
+

glHint() modes

+
+
+ GL +
+
+ + + +
+
+

Light Specification

+
+
+ GL +
+
+ + + +
+
+

Shader Types

+
+
+ GL +
+
+ + + +
+
+

Geometry Shader Parameters

+
+
+ GL +
+
+ + + +
+
+

Tesselation control shader parameters

+
+
+ GL +
+
+ + + +
+
+

OpenGL Data Types

+
+
+ GL +
+
+ + + +
+
+

OpenGL Buffer Types

+
+
+ GL +
+
+ + + +
+
+

FBO Attachments

+
+
+ GL_COLOR_ATTACHMENT0_EXT +
+
+ + + +
+
+ GL_COLOR_ATTACHMENT1_EXT +
+
+ + + +
+
+ GL_COLOR_ATTACHMENT2_EXT +
+
+ + + +
+
+ GL_COLOR_ATTACHMENT3_EXT +
+
+ + + +
+
+ GL_COLOR_ATTACHMENT4_EXT +
+
+ + + +
+
+ GL_COLOR_ATTACHMENT5_EXT +
+
+ + + +
+
+ GL_COLOR_ATTACHMENT6_EXT +
+
+ + + +
+
+ GL_COLOR_ATTACHMENT7_EXT +
+
+ + + +
+
+ GL_COLOR_ATTACHMENT8_EXT +
+
+ + + +
+
+ GL_COLOR_ATTACHMENT9_EXT +
+
+ + + +
+
+ GL_COLOR_ATTACHMENT10_EXT +
+
+ + + +
+
+ GL_COLOR_ATTACHMENT11_EXT +
+
+ + + +
+
+ GL_COLOR_ATTACHMENT12_EXT +
+
+ + + +
+
+ GL_COLOR_ATTACHMENT13_EXT +
+
+ + + +
+
+ GL_COLOR_ATTACHMENT14_EXT +
+
+ + + +
+
+ GL_COLOR_ATTACHMENT15_EXT +
+
+ + + +
+
+ GL_DEPTH_ATTACHMENT_EXT +
+
+ + + +
+
+ GL_STENCIL_ATTACHMENT_EXT +
+
+ + + +
+
+

Not included, but useful texture Formats

+
+
+ GL_RGBA16F_ARB +
+
+ + + +
+
+ GL_RGBA32F_ARB +
+
+ + + +
+
+ GL_DEPTH_COMPONENT +
+
+ + + +
+
+

Not included, but useful RBO Formats

+
+
+ GL_RGB +
+
+ + + +
+
+ GL_RGBA +
+
+ + + +
+
+ GL_DEPTH_COMPONENT +
+
+ + + +
+
+ GL_STENCIL_INDEX +
+
+ + + +
+
+

Not included, but useful FBO Targets

+
+
+ GL_FRAMEBUFFER_EXT +
+
+ + + +
+
+ GL_READ_FRAMEBUFFER_EXT +
+
+ + + +
+
+ GL_DRAW_FRAMEBUFFER_EXT +
+
+ + + +
+
+

Not included, but useful FBO Status

+
+
+ GL_FRAMEBUFFER_COMPLETE_EXT +
+
+ + + +
+
+ GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT +
+
+ + + +
+
+ GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT +
+
+ + + +
+
+ GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT +
+
+ + + +
+
+ GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT +
+
+ + + +
+
+ GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT +
+
+ + + +
+
+ GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT +
+
+ + + +
+
+ GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT +
+
+ + + +
+
+ GL_FRAMEBUFFER_UNSUPPORTED_EXT +
+
+ + + +
+
+ GL_FRAMEBUFFER_STATUS_ERROR_EXT +
+
+ + + +
+
+ +

+ Drawing Primitives +

+ +

+ GL +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + POINTS + number + + + +
  2. +
  3. + LINES + number + + + +
  4. +
  5. + LINE_LOOP + number + + + +
  6. +
  7. + LINE_STRIP + number + + + +
  8. +
  9. + TRIANGLES + number + + + +
  10. +
  11. + TRIANGLE_STRIP + number + + + +
  12. +
  13. + TRIANGLE_FAN + number + + + +
  14. +
  15. + QUADS + number + + + +
  16. +
  17. + QUAD_STRIP + number + + + +
  18. +
  19. + POLYGON + number + + + +
  20. +
  21. + PATCHES + number + + + +
  22. +
+ + + + +
+

+ BlendingFactorDest +

+ +

+ GL +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + ZERO + number + + + +
  2. +
  3. + ONE + number + + + +
  4. +
  5. + SRC_COLOR + number + + + +
  6. +
  7. + ONE_MINUS_SRC_COLOR + number + + + +
  8. +
  9. + SRC_ALPHA + number + + + +
  10. +
  11. + ONE_MINUS_SRC_ALPHA + number + + + +
  12. +
  13. + DST_ALPHA + number + + + +
  14. +
  15. + ONE_MINUS_DST_ALPHA + number + + + +
  16. +
+ + + + +
+

+ BlendingFactorSrc +

+ +

+ GL +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + ZERO + number + + + +
  2. +
  3. + ONE + number + + + +
  4. +
  5. + SRC_COLOR + number + + + +
  6. +
  7. + ONE_MINUS_SRC_COLOR + number + + + +
  8. +
  9. + SRC_ALPHA + number + + + +
  10. +
  11. + ONE_MINUS_SRC_ALPHA + number + + + +
  12. +
  13. + DST_ALPHA + number + + + +
  14. +
  15. + ONE_MINUS_DST_ALPHA + number + + + +
  16. +
  17. + DST_COLOR + number + + + +
  18. +
  19. + ONE_MINUS_DST_COLOR + number + + + +
  20. +
  21. + SRC_ALPHA_SATURATE + number + + + +
  22. +
  23. + FUNC_ADD + number + + + +
  24. +
  25. + FUNC_SUBTRACT + number + + + +
  26. +
  27. + FUNC_REVERSE_SUBTRACT + number + + + +
  28. +
  29. + MIN + number + + + +
  30. +
  31. + MAX + number + + + +
  32. +
+ + + + +
+

+ AlphaFunction and DepthFunction +

+ +

+ GL +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + NEVER + number + + + +
  2. +
  3. + LESS + number + + + +
  4. +
  5. + EQUAL + number + + + +
  6. +
  7. + LEQUAL + number + + + +
  8. +
  9. + GREATER + number + + + +
  10. +
  11. + NOTEQUAL + number + + + +
  12. +
  13. + GEQUAL + number + + + +
  14. +
  15. + ALWAYS + number + + + +
  16. +
+ + + + +
+

+ LogicOp +

+ +

+ GL +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + CLEAR + number + + + +
  2. +
  3. + AND + number + + + +
  4. +
  5. + AND_REVERSE + number + + + +
  6. +
  7. + COPY + number + + + +
  8. +
  9. + AND_INVERTED + number + + + +
  10. +
  11. + NOOP + number + + + +
  12. +
  13. + XOR + number + + + +
  14. +
  15. + OR + number + + + +
  16. +
  17. + NOR + number + + + +
  18. +
  19. + EQUIV + number + + + +
  20. +
  21. + INVERT + number + + + +
  22. +
  23. + OR_REVERSE + number + + + +
  24. +
  25. + COPY_INVERTED + number + + + +
  26. +
  27. + OR_INVERTED + number + + + +
  28. +
  29. + NAND + number + + + +
  30. +
  31. + SET + number + + + +
  32. +
+ + + + +
+

+ Culling +

+ +

+ GL +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + BACK + number + + + +
  2. +
  3. + FRONT + number + + + +
  4. +
  5. + FRONT_AND_BACK + number + + + +
  6. +
+ + + + +
+

+ PolygonMode +

+ +

+ GL +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + POINT + number + + + +
  2. +
  3. + LINE + number + + + +
  4. +
  5. + FILL + number + + + +
  6. +
+ + + + +
+

+ Clear Bits +

+ +

+ GL +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + DEPTH_BUFFER_BIT + number + + + +
  2. +
  3. + ACCUM_BUFFER_BIT + number + + + +
  4. +
  5. + STENCIL_BUFFER_BIT + number + + + +
  6. +
  7. + COLOR_BUFFER_BIT + number + + + +
  8. +
+ + + + +
+

+ ShadeModel +

+ +

+ GL +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + FLAT + number + + + +
  2. +
  3. + SMOOTH + number + + + +
  4. +
+ + + + +
+

+ MatrixMode +

+ +

+ GL +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + MODELVIEW + number + + + +
  2. +
  3. + PROJECTION + number + + + +
  4. +
  5. + TEXTURE + number + + + +
  6. +
+ + + + +
+

+ Texture Filtering +

+ +

+ GL +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + NEAREST + number + + + +
  2. +
  3. + LINEAR + number + + + +
  4. +
  5. + NEAREST_MIPMAP_NEAREST + number + + + +
  6. +
  7. + LINEAR_MIPMAP_NEAREST + number + + + +
  8. +
  9. + NEAREST_MIPMAP_LINEAR + number + + + +
  10. +
  11. + LINEAR_MIPMAP_LINEAR + number + + + +
  12. +
+ + + + +
+

+ Texture Clamping +

+ +

+ GL +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + REPEAT + number + + + +
  2. +
  3. + MIRRORED_REPEAT + number + + + +
  4. +
  5. + CLAMP + number + + + +
  6. +
  7. + CLAMP_TO_EDGE + number + + + +
  8. +
  9. + CLAMP_TO_BORDER + number + + + +
  10. +
+ + + + +
+

+ Texture Environment +

+ +

+ GL +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + TEXTURE_ENV + number + + + +
  2. +
  3. + TEXTURE_ENV_MODE + number + + + +
  4. +
  5. + TEXTURE_ENV_COLOR + number + + + +
  6. +
  7. + MODULATE + number + + + +
  8. +
  9. + DECAL + number + + + +
  10. +
  11. + BLEND + number + + + +
  12. +
  13. + REPLACE + number + + + +
  14. +
+ + + + +
+

+ GL_TEXTURE_FILTER_CONTROL +

+

+
+

+ +

+ + +
    +
  1. + GL_TEXTURE_FILTER_CONTROL + + + +
  2. +
+ + + + +
+

+ GL_TEXTURE_LOD_BIAS +

+

+
+

+ +

+ + +
    +
  1. + GL_TEXTURE_LOD_BIAS + + + +
  2. +
+ + + + +
+

+ Texture Generation +

+ +

+ GL +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + TEXTURE_GEN_MODE + number + + + +
  2. +
  3. + EYE_PLANE + number + + + +
  4. +
  5. + OBJECT_PLANE + number + + + +
  6. +
  7. + EYE_LINEAR + number + + + +
  8. +
  9. + OBJECT_LINEAR + number + + + +
  10. +
  11. + SPHERE_MAP + number + + + +
  12. +
  13. + NORMAL_MAP + number + + + +
  14. +
  15. + REFLECTION_MAP + number + + + +
  16. +
  17. + S + number + + + +
  18. +
  19. + T + number + + + +
  20. +
  21. + R + number + + + +
  22. +
  23. + Q + number + + + +
  24. +
+ + + + +
+

+ glPushAttrib() bits +

+ +

+ GL +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + CURRENT_BIT + number + + + +
  2. +
  3. + POINT_BIT + number + + + +
  4. +
  5. + LINE_BIT + number + + + +
  6. +
  7. + POLYGON_BIT + number + + + +
  8. +
  9. + POLYGON_STIPPLE_BIT + number + + + +
  10. +
  11. + PIXEL_MODE_BIT + number + + + +
  12. +
  13. + LIGHTING_BIT + number + + + +
  14. +
  15. + FOG_BIT + number + + + +
  16. +
  17. + DEPTH_BUFFER_BIT + number + + + +
  18. +
  19. + ACCUM_BUFFER_BIT + number + + + +
  20. +
  21. + STENCIL_BUFFER_BIT + number + + + +
  22. +
  23. + VIEWPORT_BIT + number + + + +
  24. +
  25. + TRANSFORM_BIT + number + + + +
  26. +
  27. + ENABLE_BIT + number + + + +
  28. +
  29. + COLOR_BUFFER_BIT + number + + + +
  30. +
  31. + HINT_BIT + number + + + +
  32. +
  33. + EVAL_BIT + number + + + +
  34. +
  35. + LIST_BIT + number + + + +
  36. +
  37. + TEXTURE_BIT + number + + + +
  38. +
  39. + SCISSOR_BIT + number + + + +
  40. +
  41. + ALL_ATTRIB_BITS + number + + + +
  42. +
+ + + + +
+

+ glHint() targets +

+ +

+ GL +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + FOG_HINT + number + + + +
  2. +
  3. + LINE_SMOOTH_HINT + number + + + +
  4. +
  5. + POINT_SMOOTH_HINT + number + + + +
  6. +
  7. + POLYGON_SMOOTH_HINT + number + + + +
  8. +
  9. + PERSPECTIVE_CORRECTION_HINT + number + + + +
  10. +
+ + + + +
+

+ glHint() modes +

+ +

+ GL +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + DONT_CARE + number + + + +
  2. +
  3. + FASTEST + number + + + +
  4. +
  5. + NICEST + number + + + +
  6. +
+ + + + +
+

+ Light Specification +

+ +

+ GL +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + AMBIENT + number + + + +
  2. +
  3. + DIFFUSE + number + + + +
  4. +
  5. + SPECULAR + number + + + +
  6. +
  7. + POSITION + number + + + +
  8. +
  9. + SPOT_DIRECTION + number + + + +
  10. +
  11. + SPOT_EXPONENT + number + + + +
  12. +
  13. + SPOT_CUTOFF + number + + + +
  14. +
  15. + CONSTANT_ATTENUATION + number + + + +
  16. +
  17. + LINEAR_ATTENUATION + number + + + +
  18. +
  19. + QUADRATIC_ATTENUATION + number + + + +
  20. +
+ + + + +
+

+ Shader Types +

+ +

+ GL +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + VERTEX_SHADER + number + + + +
  2. +
  3. + TESS_CONTROL_SHADER + number + + + +
  4. +
  5. + TESS_EVALUATION_SHADER + number + + + +
  6. +
  7. + GEOMETRY_SHADER + number + + + +
  8. +
  9. + FRAGMENT_SHADER + number + + + +
  10. +
+ + + + +
+

+ Geometry Shader Parameters +

+ +

+ GL +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + GEOMETRY_INPUT_TYPE + number + + + +
  2. +
  3. + GEOMETRY_OUTPUT_TYPE + number + + + +
  4. +
  5. + GEOMETRY_VERTICES_OUT + number + + + +
  6. +
+ + + + +
+

+ Tesselation control shader parameters +

+ +

+ GL +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + PATCH_VERTICES + number + + + +
  2. +
  3. + PATCH_DEFAULT_OUTER_LEVEL + number + + + +
  4. +
  5. + PATCH_DEFAULT_INNER_LEVEL + number + + + +
  6. +
+ + + + +
+

+ OpenGL Data Types +

+ +

+ GL +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + BYTE + number + + + +
  2. +
  3. + UNSIGNED_BYTE + number + + + +
  4. +
  5. + SHORT + number + + + +
  6. +
  7. + UNSIGNED_SHORT + number + + + +
  8. +
  9. + INT + number + + + +
  10. +
  11. + UNSIGNED_INT + number + + + +
  12. +
  13. + FLOAT + number + + + +
  14. +
  15. + FLOAT_VEC4 + number + + + +
  16. +
  17. + INT_VEC4 + number + + + +
  18. +
  19. + UNSIGNED_INT_VEC4 + number + + + +
  20. +
  21. + FLOAT_MAT4 + number + + + +
  22. +
+ + + + +
+

+ OpenGL Buffer Types +

+ +

+ GL +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + ELEMENT_ARRAY_BUFFER + number + + + +
  2. +
  3. + ARRAY_BUFFER + number + + + +
  4. +
  5. + UNIFORM_BUFFER + number + + + +
  6. +
  7. + SHADER_STORAGE_BUFFER + number + + + +
  8. +
+ + + + +
+

+ FBO Attachments +

+ +

+ +


+

+

+ GL_COLOR_ATTACHMENT0_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_COLOR_ATTACHMENT0_EXT + 0x8CE0 +
  2. +
+ + + + +
+

+ GL_COLOR_ATTACHMENT1_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_COLOR_ATTACHMENT1_EXT + 0x8CE1 +
  2. +
+ + + + +
+

+ GL_COLOR_ATTACHMENT2_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_COLOR_ATTACHMENT2_EXT + 0x8CE2 +
  2. +
+ + + + +
+

+ GL_COLOR_ATTACHMENT3_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_COLOR_ATTACHMENT3_EXT + 0x8CE3 +
  2. +
+ + + + +
+

+ GL_COLOR_ATTACHMENT4_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_COLOR_ATTACHMENT4_EXT + 0x8CE4 +
  2. +
+ + + + +
+

+ GL_COLOR_ATTACHMENT5_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_COLOR_ATTACHMENT5_EXT + 0x8CE5 +
  2. +
+ + + + +
+

+ GL_COLOR_ATTACHMENT6_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_COLOR_ATTACHMENT6_EXT + 0x8CE6 +
  2. +
+ + + + +
+

+ GL_COLOR_ATTACHMENT7_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_COLOR_ATTACHMENT7_EXT + 0x8CE7 +
  2. +
+ + + + +
+

+ GL_COLOR_ATTACHMENT8_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_COLOR_ATTACHMENT8_EXT + 0x8CE8 +
  2. +
+ + + + +
+

+ GL_COLOR_ATTACHMENT9_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_COLOR_ATTACHMENT9_EXT + 0x8CE9 +
  2. +
+ + + + +
+

+ GL_COLOR_ATTACHMENT10_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_COLOR_ATTACHMENT10_EXT + 0x8CEA +
  2. +
+ + + + +
+

+ GL_COLOR_ATTACHMENT11_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_COLOR_ATTACHMENT11_EXT + 0x8CEB +
  2. +
+ + + + +
+

+ GL_COLOR_ATTACHMENT12_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_COLOR_ATTACHMENT12_EXT + 0x8CEC +
  2. +
+ + + + +
+

+ GL_COLOR_ATTACHMENT13_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_COLOR_ATTACHMENT13_EXT + 0x8CED +
  2. +
+ + + + +
+

+ GL_COLOR_ATTACHMENT14_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_COLOR_ATTACHMENT14_EXT + 0x8CEE +
  2. +
+ + + + +
+

+ GL_COLOR_ATTACHMENT15_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_COLOR_ATTACHMENT15_EXT + 0x8CEF +
  2. +
+ + + + +
+

+ GL_DEPTH_ATTACHMENT_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_DEPTH_ATTACHMENT_EXT + 0x8D00 +
  2. +
+ + + + +
+

+ GL_STENCIL_ATTACHMENT_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_STENCIL_ATTACHMENT_EXT + 0x8D20 +
  2. +
+ + + + +
+

+ Not included, but useful texture Formats +

+ +

+ +


+

+

+ GL_RGBA16F_ARB +

+

+
+

+ +

+ + +
    +
  1. + GL_RGBA16F_ARB + 0x881A +
  2. +
+ + + + +
+

+ GL_RGBA32F_ARB +

+

+
+

+ +

+ + +
    +
  1. + GL_RGBA32F_ARB + 0x8814 +
  2. +
+ + + + +
+

+ GL_DEPTH_COMPONENT +

+

+
+

+ +

+ + +
    +
  1. + GL_DEPTH_COMPONENT + 0x1902 +
  2. +
+ + + + +
+

+ Not included, but useful RBO Formats +

+ +

+ +


+

+

+ GL_RGB +

+

+
+

+ +

+ + +
    +
  1. + GL_RGB + 0x1907 +
  2. +
+ + + + +
+

+ GL_RGBA +

+

+
+

+ +

+ + +
    +
  1. + GL_RGBA + 0x1908 +
  2. +
+ + + + +
+

+ GL_DEPTH_COMPONENT +

+

+
+

+ +

+ + +
    +
  1. + GL_DEPTH_COMPONENT + 0x1902 +
  2. +
+ + + + +
+

+ GL_STENCIL_INDEX +

+

+
+

+ +

+ + +
    +
  1. + GL_STENCIL_INDEX + 0x1901 +
  2. +
+ + + + +
+

+ Not included, but useful FBO Targets +

+ +

+ +


+

+

+ GL_FRAMEBUFFER_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_FRAMEBUFFER_EXT + 0x8D40 +
  2. +
+ + + + +
+

+ GL_READ_FRAMEBUFFER_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_READ_FRAMEBUFFER_EXT + 0x8CA8 +
  2. +
+ + + + +
+

+ GL_DRAW_FRAMEBUFFER_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_DRAW_FRAMEBUFFER_EXT + 0x8CA9 +
  2. +
+ + + + +
+

+ Not included, but useful FBO Status +

+ +

+ +


+

+

+ GL_FRAMEBUFFER_COMPLETE_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_FRAMEBUFFER_COMPLETE_EXT + 0x8CD5 +
  2. +
+ + + + +
+

+ GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT + 0x8CD6 +
  2. +
+ + + + +
+

+ GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT + 0x8CD7 +
  2. +
+ + + + +
+

+ GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT + 0x8CD8 +
  2. +
+ + + + +
+

+ GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT + 0x8CD9 +
  2. +
+ + + + +
+

+ GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT + 0x8CDA +
  2. +
+ + + + +
+

+ GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT + 0x8CDB +
  2. +
+ + + + +
+

+ GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT + 0x8CDC +
  2. +
+ + + + +
+

+ GL_FRAMEBUFFER_UNSUPPORTED_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_FRAMEBUFFER_UNSUPPORTED_EXT + 0x8CDD +
  2. +
+ + + + +
+

+ GL_FRAMEBUFFER_STATUS_ERROR_EXT +

+

+
+

+ +

+ + +
    +
  1. + GL_FRAMEBUFFER_STATUS_ERROR_EXT + 0x8CDE +
  2. +
+ + + + +
+ +{% endraw %} diff --git a/ldoc/modules/Game.html b/ldoc/modules/Game.html new file mode 100644 index 0000000000..dd8007020d --- /dev/null +++ b/ldoc/modules/Game.html @@ -0,0 +1,440 @@ +--- +layout: default +title: Game +permalink: ldoc/modules/Game.html +description: Game constants +parent: Lua API +table: 0x55a54e8e5500 +--- + +{% raw %} +

Module Game

+

Game constants

+

+ +


+

+

See also:

+ + +

Tables

+
+
+ Game +
+
+ Game specific information +
+
+ +

+ Tables +

+ +

+ Game +

+

Game specific information

+
+

+ +

+ + +

Fields:

+
    +
  1. + maxUnits + number + + + +
  2. +
  3. + maxTeams + number + + + +
  4. +
  5. + maxPlayers + number + + + +
  6. +
  7. + squareSize + number + Divide Game.mapSizeX or Game.mapSizeZ by this to get engine's "mapDims" coordinates. The resolution of height, yard and type maps. +
  8. +
  9. + metalMapSquareSize + number + The resolution of metalmap (for use in API such as Spring.GetMetalAmount etc.) +
  10. +
  11. + gameSpeed + number + + + +
  12. +
  13. + startPosType + number + + + +
  14. +
  15. + ghostedBuildings + bool + + + +
  16. +
  17. + mapChecksum + string + + + +
  18. +
  19. + modChecksum + string + + + +
  20. +
  21. + mapDamage + bool + + + +
  22. +
  23. + mapName + string + + + +
  24. +
  25. + mapDescription + string + = string Game.mapHumanName +
  26. +
  27. + mapHardness + number + + + +
  28. +
  29. + mapX + number + + + +
  30. +
  31. + mapY + number + + + +
  32. +
  33. + mapSizeX + number + in worldspace/opengl coords. Divide by Game.squareSize to get engine's "mapDims" coordinates +
  34. +
  35. + mapSizeZ + number + in worldspace/opengl coords. Divide by Game.squareSize to get engine's "mapDims" coordinates +
  36. +
  37. + gravity + number + + + +
  38. +
  39. + tidal + number + + + +
  40. +
  41. + windMin + number + + + +
  42. +
  43. + windMax + number + + + +
  44. +
  45. + extractorRadius + number + + + +
  46. +
  47. + waterDamage + number + + + +
  48. +
  49. + envDamageTypes + table + Containing {def}IDs of environmental-damage sources +
  50. +
  51. + gameName + string + + + +
  52. +
  53. + gameShortName + string + + + +
  54. +
  55. + gameVersion + string + + + +
  56. +
  57. + gameMutator + string + + + +
  58. +
  59. + gameDesc + string + + + +
  60. +
  61. + requireSonarUnderWater + bool + + + +
  62. +
  63. + transportAir + number + + + +
  64. +
  65. + transportShip + number + + + +
  66. +
  67. + transportHover + number + + + +
  68. +
  69. + transportGround + number + + + +
  70. +
  71. + fireAtKilled + number + + + +
  72. +
  73. + fireAtCrashing + number + + + +
  74. +
  75. + constructionDecay + bool + + + +
  76. +
  77. + reclaimAllowEnemies + bool + + + +
  78. +
  79. + reclaimAllowAllies + bool + + + +
  80. +
  81. + constructionDecayTime + number + + + +
  82. +
  83. + constructionDecaySpeed + number + + + +
  84. +
  85. + multiReclaim + number + + + +
  86. +
  87. + reclaimMethod + number + + + +
  88. +
  89. + reclaimUnitMethod + number + + + +
  90. +
  91. + reclaimUnitEnergyCostFactor + number + + + +
  92. +
  93. + reclaimUnitEfficiency + number + + + +
  94. +
  95. + reclaimFeatureEnergyCostFactor + number + + + +
  96. +
  97. + repairEnergyCostFactor + number + + + +
  98. +
  99. + resurrectEnergyCostFactor + number + + + +
  100. +
  101. + captureEnergyCostFactor + number + + + +
  102. +
  103. + springCategories + table + + +
     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
    + }
    +
    + +
  104. +
  105. + armorTypes + table + +

    (bidirectional)

    +
     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, ...
    + }
    +
    + +
  106. +
+ + + + +
+ +{% endraw %} diff --git a/ldoc/modules/LuaHandle.html b/ldoc/modules/LuaHandle.html new file mode 100644 index 0000000000..f42ac21886 --- /dev/null +++ b/ldoc/modules/LuaHandle.html @@ -0,0 +1,4868 @@ +--- +layout: default +title: LuaHandle +permalink: ldoc/modules/LuaHandle.html +description: Callins, functions called by the Engine +parent: Lua API +table: 0x55a54ea032b0 +--- + +{% raw %} +

Module LuaHandle

+

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

+ +

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 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 also:

+ + +

Teams

+
+
+ TeamDied +
+
+ Called when a team dies (see Spring.KillTeam). +
+
+ TeamChanged +
+
+ + + +
+
+ PlayerChanged +
+
+ Called whenever a player's status changes e.g. +
+
+ PlayerAdded +
+
+ Called whenever a new player joins the game. +
+
+ PlayerRemoved +
+
+ Called whenever a player is removed from the game. +
+
+

Projectiles

+
+
+ ProjectileCreated +
+
+ Called when the projectile is created. +
+
+ ProjectileDestroyed +
+
+ Called when the projectile is destroyed. +
+
+ Explosion +
+
+ Called when an explosion occurs. +
+
+ StockpileChanged +
+
+ Called when a units stockpile of weapons increases or decreases. +
+
+ RecvLuaMsg +
+
+ Receives messages from unsynced sent via Spring.SendLuaRulesMsg or Spring.SendLuaUIMsg. +
+
+ Save +
+
+ Called when a chat command '/save' or '/savegame' is received. +
+
+ UnsyncedHeightMapUpdate +
+
+ Called when the unsynced copy of the height-map is altered. +
+
+ Update +
+
+ Called for every draw frame (including when the game is paused) and at least once per sim frame except when catching up. +
+
+ ViewResize +
+
+ Called whenever the window is resized. +
+
+ SunChanged +
+
+ + + +
+
+ DefaultCommand +
+
+ Used to set the default command when a unit is selected. +
+
+

Features

+
+
+ FeatureCreated +
+
+ Called when a feature is created. +
+
+ FeatureDestroyed +
+
+ Called when a feature is destroyed. +
+
+ FeatureDamaged +
+
+ Called when a feature is damaged. +
+
+

Common

+
+
+ Initialize +
+
+ Called when the addon is (re)loaded. +
+
+ LoadCode +
+
+ Called when the game is (re)loaded. +
+
+ Shutdown +
+
+ Called when the addon or the game is shutdown. +
+
+ GotChatMsg +
+
+ Called when a player issues a UI command e.g. +
+
+ Load +
+
+ Called after GamePreload and before GameStart. +
+
+

Game

+
+
+ GamePreload +
+
+ Called before the 0 gameframe. +
+
+ GameStart +
+
+ Called upon the start of the game. +
+
+ GameOver +
+
+ Called when the game ends +
+
+ GamePaused +
+
+ Called when the game is paused. +
+
+ GameFrame +
+
+ Called for every game simulation frame (30 per second). +
+
+ GameID +
+
+ Called once to deliver the gameID +
+
+

Units

+
+
+ UnitCreated +
+
+ Called at the moment the unit is created. +
+
+ UnitFinished +
+
+ Called at the moment the unit is completed. +
+
+ UnitFromFactory +
+
+ Called when a factory finishes construction of a unit. +
+
+ UnitReverseBuilt +
+
+ Called when a living unit becomes a nanoframe again. +
+
+ UnitDestroyed +
+
+ Called when a unit is destroyed. +
+
+ UnitTaken +
+
+ Called when a unit is transferred between teams. +
+
+ UnitGiven +
+
+ Called when a unit is transferred between teams. +
+
+ UnitIdle +
+
+ Called when a unit is idle (empty command queue). +
+
+ UnitCommand +
+
+ Called after when a unit accepts a command, after AllowCommand returns true. +
+
+ UnitCmdDone +
+
+ Called when a unit completes a command. +
+
+ UnitDamaged +
+
+ Called when a unit is damaged (after UnitPreDamaged). +
+
+ UnitStunned +
+
+ Called when a unit changes its stun status. +
+
+ UnitExperience +
+
+ Called when a unit gains experience greater or equal to the minimum limit set by calling Spring.SetExperienceGrade. +
+
+ UnitHarvestStorageFull +
+
+ Called when a unit's harvestStorage is full (according to its unitDef's entry). +
+
+ UnitSeismicPing +
+
+ Called when a unit emits a seismic ping. +
+
+ UnitEnteredRadar +
+
+ Called when a unit enters radar of an allyteam. +
+
+ UnitEnteredLos +
+
+ Called when a unit enters LOS of an allyteam. +
+
+ UnitLeftRadar +
+
+ Called when a unit leaves radar of an allyteam. +
+
+ UnitLeftLos +
+
+ Called when a unit leaves LOS of an allyteam. +
+
+

Transport

+
+
+ UnitLoaded +
+
+ Called when a unit is loaded by a transport. +
+
+ UnitUnloaded +
+
+ Called when a unit is unloaded by a transport. +
+
+

Unit Interactions

+
+
+ UnitEnteredUnderwater +
+
+ + + +
+
+ UnitEnteredWater +
+
+ + + +
+
+ UnitLeftAir +
+
+ + + +
+
+ UnitLeftUnderwater +
+
+ + + +
+
+ UnitLeftWater +
+
+ + + +
+
+ UnitEnteredAir +
+
+ + + +
+
+ UnitCloaked +
+
+ Called when a unit cloaks. +
+
+ UnitDecloaked +
+
+ Called when a unit decloaks. +
+
+ UnitUnitCollision +
+
+ Called when two units collide. +
+
+ UnitFeatureCollision +
+
+ Called when a unit collides with a feature. +
+
+ UnitMoveFailed +
+
+ + + +
+
+ RenderUnitDestroyed +
+
+ Called just before a unit is invalid, after it finishes its death animation. +
+
+

Draw* Functions

+
+
+ DrawGenesis +
+
+ Use this callin to update textures, shaders, etc. +
+
+ DrawWorld +
+
+ Spring draws command queues, 'map stuff', and map marks. +
+
+ DrawWorldPreUnit +
+
+ Spring draws units, features, some water types, cloaked units, and the sun. +
+
+ DrawPreDecals +
+
+ Called before decals are drawn +
+
+ DrawWorldPreParticles +
+
+ + + +
+
+ DrawWaterPost +
+
+ + + +
+
+ DrawShadowPassTransparent +
+
+ Invoked after semi-transparent shadows pass is about to conclude +
+
+ DrawWorldShadow +
+
+ + + +
+
+ DrawWorldReflection +
+
+ + + +
+
+ DrawWorldRefraction +
+
+ + + +
+
+ DrawGroundPreForward +
+
+ Runs at the start of the forward pass when a custom map shader has been assigned via Spring.SetMapShader (convenient for setting uniforms). +
+
+ DrawGroundPostForward +
+
+ + + +
+
+ DrawGroundPreDeferred +
+
+ Runs at the start of the deferred pass when a custom map shader has been assigned via Spring.SetMapShader (convenient for setting uniforms). +
+
+ DrawGroundDeferred +
+
+ + + +
+
+ DrawGroundPostDeferred +
+
+ This runs at the end of its respective deferred pass. +
+
+ DrawUnitsPostDeferred +
+
+ Runs at the end of the unit deferred pass. +
+
+ DrawFeaturesPostDeferred +
+
+ Runs at the end of the feature deferred pass to inform Lua code it should make use of the $modelgbuffer* textures before another pass overwrites them (and to allow proper blending with e.g. +
+
+ DrawShadowUnitsLua +
+
+ + + +
+
+ DrawShadowFeaturesLua +
+
+ + + +
+
+ DrawScreen +
+
+ Also available to LuaMenu. +
+
+ DrawScreenEffects +
+
+ + + +
+
+ DrawScreenPost +
+
+ Similar to DrawScreenEffects, this can be used to alter the contents of a frame after it has been completely rendered (i.e. +
+
+ DrawInMinimap +
+
+ + + +
+
+ DrawInMinimapBackground +
+
+ + + +
+
+ GameProgress +
+
+ Called every 60 frames, calculating delta between GameFrame and GameProgress. +
+
+ KeyMapChanged +
+
+ Called when the keymap changes +
+
+

Input

+
+
+ mods +
+
+ Key Modifier Params +
+
+ KeyPress +
+
+ Called repeatedly when a key is pressed down. +
+
+ KeyRelease +
+
+ Called when the key is released. +
+
+ TextInput +
+
+ Called whenever a key press results in text input. +
+
+ TextEditing +
+
+ + + +
+
+ MousePress +
+
+ Called when a mouse button is pressed. +
+
+ MouseRelease +
+
+ Called when a mouse button is released. +
+
+ MouseMove +
+
+ Called when the mouse is moved. +
+
+ MouseWheel +
+
+ Called when the mouse wheel is moved. +
+
+ IsAbove +
+
+ Called every Update. +
+
+ GetTooltip +
+
+ Called when Spring.IsAbove returns true. +
+
+ cmdOpts +
+
+ Parameters for command options +
+
+ CommandNotify +
+
+ Called when a command is issued. +
+
+ AddConsoleLine +
+
+ Called when text is entered into the console (e.g. +
+
+ GroupChanged +
+
+ Called when a unit is added to or removed from a control group. +
+
+ WorldTooltip +
+
+ + + +
+
+ MapDrawCmd +
+
+ + + +
+
+ GameSetup +
+
+ + + +
+
+ RecvSkirmishAIMessage +
+
+ + + +
+
+

Downloads

+
+
+ DownloadQueued +
+
+ Called when a Pr-downloader download is queued +
+
+ DownloadStarted +
+
+ Called when a Pr-downloader download is started via VFS.DownloadArchive. +
+
+ DownloadFinished +
+
+ Called when a Pr-downloader download finishes successfully. +
+
+ DownloadFailed +
+
+ Called when a Pr-downloader download fails to complete. +
+
+ DownloadProgress +
+
+ Called incrementally during a Pr-downloader download. +
+
+ +

+ Teams +

+ +

+ +


+

+

+ TeamDied(teamID) +

+

Called when a team dies (see `Spring.KillTeam`).

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
+ + + + +
+

+ TeamChanged(teamID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
+ + + + +
+

+ PlayerChanged(playerID) +

+

Called whenever a player's status changes e.g.

+
+

+ becoming a spectator. + +

+ + +

Parameters:

+
    +
  1. + playerID + number + + + +
  2. +
+ + + + +
+

+ PlayerAdded(playerID) +

+

Called whenever a new player joins the game.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + playerID + number + + + +
  2. +
+ + + + +
+

+ PlayerRemoved(playerID, reason) +

+

Called whenever a player is removed from the game.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + playerID + number + + + +
  2. +
  3. + reason + string + + + +
  4. +
+ + + + +
+

+ Projectiles +

+ +

+ +


+

+

+ ProjectileCreated(proID, proOwnerID, weaponDefID) +

+

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. + +

+ + +

Parameters:

+
    +
  1. + proID + number + + + +
  2. +
  3. + proOwnerID + number + + + +
  4. +
  5. + weaponDefID + number + + + +
  6. +
+ + + + +
+

+ ProjectileDestroyed(proID, ownerID, proWeaponDefID) +

+

Called when the projectile is destroyed.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + proID + number + + + +
  2. +
  3. + ownerID + number + + + +
  4. +
  5. + proWeaponDefID + number + + + +
  6. +
+ + + + +
+

+ Explosion(weaponDefID, px, py, pz, attackerID, projectileID) +

+

Called when an explosion occurs.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + weaponDefID + number + + + +
  2. +
  3. + px + number + + + +
  4. +
  5. + py + number + + + +
  6. +
  7. + pz + number + + + +
  8. +
  9. + attackerID + number + + + +
  10. +
  11. + projectileID + number + + + +
  12. +
+ +

Returns:

+
    +
  1. + bool noGfx if then no graphical effects are drawn by the engine for this explosion.
  2. +
+ + + +
+

+ StockpileChanged(unitID, unitDefID, unitTeam, weaponNum, oldCount, newCount) +

+

Called when a units stockpile of weapons increases or decreases.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
  7. + weaponNum + number + + + +
  8. +
  9. + oldCount + number + + + +
  10. +
  11. + newCount + number + + + +
  12. +
+ + + + +
+

+ RecvLuaMsg(msg, playerID) +

+

Receives messages from unsynced sent via `Spring.SendLuaRulesMsg` or `Spring.SendLuaUIMsg`.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + msg + string + + + +
  2. +
  3. + playerID + number + + + +
  4. +
+ + + + +
+

+ Save(zip) +

+

Called when a chat command '/save' or '/savegame' is received.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + zip + table + a userdatum representing the savegame zip file. See Lua_SaveLoad. +
  2. +
+ + + + +
+

+ UnsyncedHeightMapUpdate() +

+

Called when the unsynced copy of the height-map is altered.

+
+

+ +

+ + + +

Returns:

+
    +
  1. + x1 + + +
  2. +
  3. + z1 + + +
  4. +
  5. + x2 + + +
  6. +
  7. + z2 + + +
  8. +
+ + + +
+

+ Update(dt) +

+

Called for every draw frame (including when the game is paused) and at least once per sim frame except when catching up.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + dt + number + the time since the last update. +
  2. +
+ + + + +
+

+ ViewResize(viewSizeX, viewSizeY) +

+

Called whenever the window is resized.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + viewSizeX + number + + + +
  2. +
  3. + viewSizeY + number + + + +
  4. +
+ + + + +
+

+ SunChanged() +

+

+
+

+ +

+ + + + + + +
+

+ DefaultCommand(type, id) +

+

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. + +

+ + +

Parameters:

+
    +
  1. + type + string + "unit" | "feature" +
  2. +
  3. + id + int + unitID | featureID +
  4. +
+ + + + +
+

+ Features +

+ +

+ +


+

+

+ FeatureCreated(featureID, allyTeamID) +

+

Called when a feature is created.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + allyTeamID + number + + + +
  4. +
+ + + + +
+

+ FeatureDestroyed(featureID, allyTeamID) +

+

Called when a feature is destroyed.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + allyTeamID + number + + + +
  4. +
+ + + + +
+

+ FeatureDamaged(featureID, featureDefID, featureTeam, damage, weaponDefID, projectileID, attackerID, attackerDefID, attackerTeam) +

+

Called when a feature is damaged.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + featureDefID + number + + + +
  4. +
  5. + featureTeam + number + + + +
  6. +
  7. + damage + number + + + +
  8. +
  9. + weaponDefID + number + + + +
  10. +
  11. + projectileID + number + + + +
  12. +
  13. + attackerID + number + + + +
  14. +
  15. + attackerDefID + number + + + +
  16. +
  17. + attackerTeam + number + + + +
  18. +
+ + + + +
+

+ Common +

+ +

+ +


+

+

+ Initialize() +

+

Called when the addon is (re)loaded.

+
+

+ +

+ + + + + + +
+

+ LoadCode() +

+

Called when the game is (re)loaded.

+
+

+ +

+ + + + + + +
+

+ Shutdown() +

+

Called when the addon or the game is shutdown.

+
+

+ +

+ + + +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ GotChatMsg(msg, playerID) +

+

Called when a player issues a UI command e.g.

+
+

+ types /foo or /luarules foo. + +

+ + +

Parameters:

+
    +
  1. + msg + string + + + +
  2. +
  3. + playerID + number + + + +
  4. +
+ + + + +
+

+ Load(zipReader) +

+

Called after `GamePreload` and before `GameStart`.

+
+

+ See Lua_SaveLoad. + +

+ + +

Parameters:

+
    +
  1. + zipReader + table + + + +
  2. +
+ + + + +
+

+ Game +

+ +

+ GamePreload() +

+

Called before the 0 gameframe.

+
+

+ + + Is not called when a saved game is loaded. + +

+ + + + + + +
+

+ GameStart() +

+

Called upon the start of the game.

+
+

+ + + Is not called when a saved game is loaded. + +

+ + + + + + +
+

+ GameOver(winningAllyTeams) +

+

Called when the game ends

+
+

+ +

+ + +

Parameters:

+
    +
  1. + winningAllyTeams + {number,...} + list of winning allyTeams, if empty the game result was undecided (like when dropping from an host). +
  2. +
+ + + + +
+

+ GamePaused(playerID, paused) +

+

Called when the game is paused.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + playerID + number + + + +
  2. +
  3. + paused + bool + + + +
  4. +
+ + + + +
+

+ GameFrame(frame) +

+

Called for every game simulation frame (30 per second).

+
+

+ +

+ + +

Parameters:

+
    +
  1. + frame + number + Starts at frame 1 +
  2. +
+ + + + +
+

+ GameID(gameID) +

+

Called once to deliver the gameID

+
+

+ +

+ + +

Parameters:

+
    +
  1. + gameID + string + encoded in hex. +
  2. +
+ + + + +
+

+ Units +

+ +

+ UnitCreated(unitID, unitDefID, unitTeam[, builderID]) +

+

Called at the moment the unit is created.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
  7. + builderID + number + + + + (optional) +
  8. +
+ + + + +
+

+ UnitFinished(unitID, unitDefID, unitTeam) +

+

Called at the moment the unit is completed.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
+ + + + +
+

+ UnitFromFactory(unitID, unitDefID, unitTeam, factID, factDefID, userOrders) +

+

Called when a factory finishes construction of a unit.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
  7. + factID + number + + + +
  8. +
  9. + factDefID + number + + + +
  10. +
  11. + userOrders + bool + + + +
  12. +
+ + + + +
+

+ UnitReverseBuilt(unitID, unitDefID, unitTeam) +

+

Called when a living unit becomes a nanoframe again.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
+ + + + +
+

+ UnitDestroyed(unitID, unitDefID, unitTeam, attackerID, attackerDefID, attackerTeam) +

+

Called when a unit is destroyed.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
  7. + attackerID + number + + + +
  8. +
  9. + attackerDefID + number + + + +
  10. +
  11. + attackerTeam + number + + + +
  12. +
+ + + + +
+

+ UnitTaken(unitID, unitDefID, oldTeam, newTeam) +

+

Called when a unit is transferred between teams.

+
+

+ This is called before `UnitGiven` and in that moment unit is still assigned to the oldTeam. + +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + oldTeam + number + + + +
  6. +
  7. + newTeam + number + + + +
  8. +
+ + + + +
+

+ UnitGiven(unitID, unitDefID, oldTeam, newTeam) +

+

Called when a unit is transferred between teams.

+
+

+ This is called after `UnitTaken` and in that moment unit is assigned to the newTeam. + +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + oldTeam + number + + + +
  6. +
  7. + newTeam + number + + + +
  8. +
+ + + + +
+

+ UnitIdle(unitID, unitDefID, unitTeam) +

+

Called when a unit is idle (empty command queue).

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
+ + + + +
+

+ UnitCommand(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOpts, cmdTag) +

+

Called after when a unit accepts a command, after `AllowCommand` returns true.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
  7. + cmdID + number + + + +
  8. +
  9. + cmdParams + table + + + +
  10. +
  11. + cmdOpts + cmdOpts + + + +
  12. +
  13. + cmdTag + number + + + +
  14. +
+ + + + +
+

+ UnitCmdDone(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOpts, cmdTag) +

+

Called when a unit completes a command.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
  7. + cmdID + number + + + +
  8. +
  9. + cmdParams + table + + + +
  10. +
  11. + cmdOpts + cmdOpts + + + +
  12. +
  13. + cmdTag + number + + + +
  14. +
+ + + + +
+

+ UnitDamaged(unitID, unitDefID, unitTeam, damage, paralyzer, weaponDefID, projectileID, attackerID, attackerDefID, attackerTeam) +

+

Called when a unit is damaged (after UnitPreDamaged).

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
  7. + damage + number + + + +
  8. +
  9. + paralyzer + number + + + +
  10. +
  11. + weaponDefID + number + + + +
  12. +
  13. + projectileID + number + + + +
  14. +
  15. + attackerID + number + + + +
  16. +
  17. + attackerDefID + number + + + +
  18. +
  19. + attackerTeam + number + + + +
  20. +
+ + + + +
+

+ UnitStunned(unitID, unitDefID, unitTeam, stunned) +

+

Called when a unit changes its stun status.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
  7. + stunned + bool + + + +
  8. +
+ + + + +
+

+ UnitExperience(unitID, unitDefID, unitTeam, experience, oldExperience) +

+

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. + +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
  7. + experience + number + + + +
  8. +
  9. + oldExperience + number + + + +
  10. +
+ + + + +
+

+ UnitHarvestStorageFull(unitID, unitDefID, unitTeam) +

+

Called when a unit's harvestStorage is full (according to its unitDef's entry).

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
+ + + + +
+

+ UnitSeismicPing(x, y, z, strength, allyTeam, unitID, unitDefID) +

+

Called when a unit emits a seismic ping.

+
+

+ + + See `seismicSignature`. + +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + y + number + + + +
  4. +
  5. + z + number + + + +
  6. +
  7. + strength + number + + + +
  8. +
  9. + allyTeam + number + + + +
  10. +
  11. + unitID + number + + + +
  12. +
  13. + unitDefID + number + + + +
  14. +
+ + + + +
+

+ UnitEnteredRadar(unitID, unitTeam, allyTeam, unitDefID) +

+

Called when a unit enters radar of an allyteam.

+
+

+ + + Also called when a unit enters LOS without any radar coverage. + +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitTeam + number + + + +
  4. +
  5. + allyTeam + number + + + +
  6. +
  7. + unitDefID + number + + + +
  8. +
+ + + + +
+

+ UnitEnteredLos(unitID, unitTeam, allyTeam, unitDefID) +

+

Called when a unit enters LOS of an allyteam.

+
+

+ + + Its called after the unit is in LOS, so you can query that unit. + +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitTeam + number + + + +
  4. +
  5. + allyTeam + number + who's LOS the unit entered. +
  6. +
  7. + unitDefID + number + + + +
  8. +
+ + + + +
+

+ UnitLeftRadar(unitID, unitTeam, allyTeam, unitDefID) +

+

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. + +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitTeam + number + + + +
  4. +
  5. + allyTeam + number + + + +
  6. +
  7. + unitDefID + number + + + +
  8. +
+ + + + +
+

+ UnitLeftLos(unitID, unitTeam, allyTeam, unitDefID) +

+

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. + +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitTeam + number + + + +
  4. +
  5. + allyTeam + number + + + +
  6. +
  7. + unitDefID + number + + + +
  8. +
+ + + + +
+

+ Transport +

+ +

+ +


+

+

+ UnitLoaded(unitID, unitDefID, unitTeam, transportID, transportTeam) +

+

Called when a unit is loaded by a transport.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
  7. + transportID + number + + + +
  8. +
  9. + transportTeam + number + + + +
  10. +
+ + + + +
+

+ UnitUnloaded(unitID, unitDefID, unitTeam, transportID, transportTeam) +

+

Called when a unit is unloaded by a transport.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
  7. + transportID + number + + + +
  8. +
  9. + transportTeam + number + + + +
  10. +
+ + + + +
+

+ Unit Interactions +

+ +

+ +


+

+

+ UnitEnteredUnderwater(unitID, unitDefID, unitTeam) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
+ + + + +
+

+ UnitEnteredWater(unitID, unitDefID, unitTeam) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
+ + + + +
+

+ UnitLeftAir(unitID, unitDefID, unitTeam) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
+ + + + +
+

+ UnitLeftUnderwater(unitID, unitDefID, unitTeam) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
+ + + + +
+

+ UnitLeftWater(unitID, unitDefID, unitTeam) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
+ + + + +
+

+ UnitEnteredAir(unitID, unitDefID, unitTeam) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
+ + + + +
+

+ UnitCloaked(unitID, unitDefID, unitTeam) +

+

Called when a unit cloaks.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
+ + + + +
+

+ UnitDecloaked(unitID, unitDefID, unitTeam) +

+

Called when a unit decloaks.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
+ + + + +
+

+ UnitUnitCollision(colliderID, collideeID) +

+

Called when two units collide.

+
+

+ + + Both units must be registered with `Script.SetWatchUnit`. + +

+ + +

Parameters:

+
    +
  1. + colliderID + number + + + +
  2. +
  3. + collideeID + number + + + +
  4. +
+ + + + +
+

+ UnitFeatureCollision(colliderID, collideeID) +

+

Called when a unit collides with a feature.

+
+

+ + + The unit must be registered with `Script.SetWatchUnit` and the feature registered with `Script.SetWatchFeature`. + +

+ + +

Parameters:

+
    +
  1. + colliderID + number + + + +
  2. +
  3. + collideeID + number + + + +
  4. +
+ + + + +
+

+ UnitMoveFailed(unitID, unitDefID, unitTeam) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
+ + + + +
+

+ RenderUnitDestroyed(unitID, unitDefID, unitTeam) +

+

Called just before a unit is invalid, after it finishes its death animation.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
+ + + + +
+

+ Draw* Functions +

+ +

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.

+

+ DrawGenesis() +

+

Use this callin to update textures, shaders, etc.

+
+

+ + + Doesn't render to screen! + Also available to LuaMenu. +

+ + + + + + +
+

+ DrawWorld() +

+

Spring draws command queues, 'map stuff', and map marks.

+
+

+ +

+ + + + + + +
+

+ DrawWorldPreUnit() +

+

Spring draws units, features, some water types, cloaked units, and the sun.

+
+

+ +

+ + + + + + +
+

+ DrawPreDecals() +

+

Called before decals are drawn

+
+

+ +

+ + + + + + +
+

+ DrawWorldPreParticles() +

+

+
+

+ +

+ + + + + + +
+

+ DrawWaterPost() +

+

+
+

+ +

+ + + + + + +
+

+ DrawShadowPassTransparent() +

+

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. +

+ + + + + + +
+

+ DrawWorldShadow() +

+

+
+

+ +

+ + + + + + +
+

+ DrawWorldReflection() +

+

+
+

+ +

+ + + + + + +
+

+ DrawWorldRefraction() +

+

+
+

+ +

+ + + + + + +
+

+ DrawGroundPreForward() +

+

Runs at the start of the forward pass when a custom map shader has been assigned via `Spring.SetMapShader` (convenient for setting uniforms).

+
+

+ +

+ + + + + + +
+

+ DrawGroundPostForward() +

+

+
+

+ +

+ + + + + + +
+

+ DrawGroundPreDeferred() +

+

Runs at the start of the deferred pass when a custom map shader has been assigned via `Spring.SetMapShader` (convenient for setting uniforms).

+
+

+ +

+ + + + + + +
+

+ DrawGroundDeferred() +

+

+
+

+ +

+ + + + + + +
+

+ DrawGroundPostDeferred() +

+

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`. +

+ + + + + + +
+

+ DrawUnitsPostDeferred() +

+

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. +

+ + + + + + +
+

+ DrawFeaturesPostDeferred() +

+

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. + +

+ + + + + + +
+

+ DrawShadowUnitsLua() +

+

+
+

+ +

+ + + + + + +
+

+ DrawShadowFeaturesLua() +

+

+
+

+ +

+ + + + + + +
+

+ DrawScreen(viewSizeX, viewSizeY) +

+

Also available to LuaMenu.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + viewSizeX + number + + + +
  2. +
  3. + viewSizeY + number + + + +
  4. +
+ + + + +
+

+ DrawScreenEffects(viewSizeX, viewSizeY) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + viewSizeX + number + + + +
  2. +
  3. + viewSizeY + number + + + +
  4. +
+ + + + +
+

+ DrawScreenPost(viewSizeX, viewSizeY) +

+

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). + +

+ + +

Parameters:

+
    +
  1. + viewSizeX + number + + + +
  2. +
  3. + viewSizeY + number + + + +
  4. +
+ + + + +
+

+ DrawInMinimap(sx, sy) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + sx + number + relative to the minimap's position and scale. +
  2. +
  3. + sy + number + relative to the minimap's position and scale. +
  4. +
+ + + + +
+

+ DrawInMinimapBackground(sx, sy) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + sx + number + relative to the minimap's position and scale. +
  2. +
  3. + sy + number + relative to the minimap's position and scale. +
  4. +
+ + + + +
+

+ GameProgress(serverFrameNum) +

+

Called every 60 frames, calculating delta between `GameFrame` and `GameProgress`.

+
+

+ + + Can give an ETA about catching up with simulation for mid-game join players. + +

+ + +

Parameters:

+
    +
  1. + serverFrameNum + int + + + +
  2. +
+ + + + +
+

+ KeyMapChanged() +

+

Called when the keymap changes

+
+

+ + + Can be caused due to a change in language or keyboard +

+ + + + + + +
+

+ Input +

+ +

+ mods +

+

Key Modifier Params

+
+

+ +

+ + +

Fields:

+
    +
  1. + right + bool + Right mouse key pressed +
  2. +
  3. + alt + bool + Alt key pressed +
  4. +
  5. + ctrl + bool + Ctrl key pressed +
  6. +
  7. + shift + bool + Shift key pressed +
  8. +
+ + + + +
+

+ KeyPress(keyCode, mods, isRepeat, label, utf32char, scanCode, actionList) +

+

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. + +

+ + +

Parameters:

+
    +
  1. + keyCode + number + + + +
  2. +
  3. + mods + mods + + + +
  4. +
  5. + isRepeat + bool + If you want an action to occur only once check for isRepeat == false. +
  6. +
  7. + label + bool + the name of the key +
  8. +
  9. + utf32char + number + (deprecated) always 0 +
  10. +
  11. + scanCode + number + + + +
  12. +
  13. + actionList + table + the list of actions for this keypress +
  14. +
+ +

Returns:

+
    +
  1. + boolean + halt whether to halt the chain for consumers of the keypress
  2. +
+ + + +
+

+ KeyRelease(keyCode, mods, label, utf32char, scanCode, actionList) +

+

Called when the key is released.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + keyCode + number + + + +
  2. +
  3. + mods + mods + + + +
  4. +
  5. + label + bool + the name of the key +
  6. +
  7. + utf32char + number + (deprecated) always 0 +
  8. +
  9. + scanCode + number + + + +
  10. +
  11. + actionList + table + the list of actions for this keyrelease +
  12. +
+ +

Returns:

+
    +
  1. + bool + + +
  2. +
+ + + +
+

+ TextInput(utf8char) +

+

Called whenever a key press results in text input.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + utf8char + string + + + +
  2. +
+ + + + +
+

+ TextEditing(utf8, start, length) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + utf8 + string + + + +
  2. +
  3. + start + number + + + +
  4. +
  5. + length + number + + + +
  6. +
+ + + + +
+

+ MousePress(x, y, button) +

+

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. + +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + y + number + + + +
  4. +
  5. + button + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + boolean + becomeMouseOwner
  2. +
+ + + +
+

+ MouseRelease(x, y, button) +

+

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. + +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + y + number + + + +
  4. +
  5. + button + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + boolean + becomeMouseOwner
  2. +
+ + + +
+

+ MouseMove(x, y, dx, dy, button) +

+

Called when the mouse is moved.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + final x position +
  2. +
  3. + y + number + final y position +
  4. +
  5. + dx + number + distance travelled in x +
  6. +
  7. + dy + number + distance travelled in y +
  8. +
  9. + button + number + + + +
  10. +
+ + + + +
+

+ MouseWheel(up, value) +

+

Called when the mouse wheel is moved.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + up + bool + the direction +
  2. +
  3. + value + number + the amount travelled +
  4. +
+ + + + +
+

+ IsAbove(x, y) +

+

Called every `Update`.

+
+

+ + + Must return true for `Mouse*` events and `Spring.GetToolTip` to be called. + +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + y + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + boolean isAbove
  2. +
+ + + +
+

+ GetTooltip(x, y) +

+

Called when `Spring.IsAbove` returns true.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + y + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + string tooltip
  2. +
+ + + +
+

+ cmdOpts +

+

Parameters for command options

+
+

+ +

+ + +

Fields:

+
    +
  1. + coded + int + + + +
  2. +
  3. + alt + bool + + + +
  4. +
  5. + ctrl + bool + + + +
  6. +
  7. + shift + bool + + + +
  8. +
  9. + right + bool + + + +
  10. +
  11. + meta + bool + + + +
  12. +
  13. + internal + bool + + + +
  14. +
+ + + + +
+

+ CommandNotify(cmdID, cmdParams, cmdOpts) +

+

Called when a command is issued.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + cmdID + int + + + +
  2. +
  3. + cmdParams + table + + + +
  4. +
  5. + cmdOpts + cmdOpts + + + +
  6. +
+ +

Returns:

+
    +
  1. + boolean + Returning true deletes the command and does not send it through the network.
  2. +
+ + + +
+

+ AddConsoleLine(msg, priority) +

+

Called when text is entered into the console (e.g.

+
+

+ `Spring.Echo`). + +

+ + +

Parameters:

+
    +
  1. + msg + string + + + +
  2. +
  3. + priority + int + + + +
  4. +
+ + + + +
+

+ GroupChanged(groupID) +

+

Called when a unit is added to or removed from a control group.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + groupID + number + + + +
  2. +
+ + + + +
+

+ WorldTooltip(ttType, data1[, data2[, data3]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + ttType + string + "unit" | "feature" | "ground" | "selection" +
  2. +
  3. + data1 + number + unitID | featureID | posX +
  4. +
  5. + data2 + number + posY + (optional) +
  6. +
  7. + data3 + number + posZ + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + string + newTooltip
  2. +
+ + + +
+

+ MapDrawCmd(playerID, type, posX, posY, posZ, data4[, pos2Y[, pos2Z]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + playerID + number + + + +
  2. +
  3. + type + string + "point" | "line" | "erase" +
  4. +
  5. + posX + number + + + +
  6. +
  7. + posY + number + + + +
  8. +
  9. + posZ + number + + + +
  10. +
  11. + data4 + string or number + point: label, erase: radius, line: pos2X +
  12. +
  13. + pos2Y + number + when type is line + (optional) +
  14. +
  15. + pos2Z + number + when type is line + (optional) +
  16. +
+ + + + +
+

+ GameSetup(state, ready, playerStates) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + state + string + + + +
  2. +
  3. + ready + bool + + + +
  4. +
  5. + playerStates + table + + + +
  6. +
+ +

Returns:

+
    +
  1. + bool + success
  2. +
  3. + bool + newReady
  4. +
+ + + +
+

+ RecvSkirmishAIMessage(aiTeam, dataStr) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + aiTeam + int + + + +
  2. +
  3. + dataStr + string + + + +
  4. +
+ + + + +
+

+ Downloads +

+ +

+ DownloadQueued(id, name, type) +

+

Called when a Pr-downloader download is queued

+
+

+ +

+ + +

Parameters:

+
    +
  1. + id + number + + + +
  2. +
  3. + name + string + + + +
  4. +
  5. + type + string + + + +
  6. +
+ + + + +
+

+ DownloadStarted(id) +

+

Called when a Pr-downloader download is started via VFS.DownloadArchive.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + id + number + + + +
  2. +
+ + + + +
+

+ DownloadFinished(id) +

+

Called when a Pr-downloader download finishes successfully.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + id + number + + + +
  2. +
+ + + + +
+

+ DownloadFailed(id, errorID) +

+

Called when a Pr-downloader download fails to complete.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + id + number + + + +
  2. +
  3. + errorID + number + + + +
  4. +
+ + + + +
+

+ DownloadProgress(id, downloaded, total) +

+

Called incrementally during a Pr-downloader download.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + id + number + + + +
  2. +
  3. + downloaded + number + + + +
  4. +
  5. + total + number + + + +
  6. +
+ + + + +
+ +{% endraw %} diff --git a/ldoc/modules/LuaHandleSynced.html b/ldoc/modules/LuaHandleSynced.html new file mode 100644 index 0000000000..28c710ad1f --- /dev/null +++ b/ldoc/modules/LuaHandleSynced.html @@ -0,0 +1,2276 @@ +--- +layout: default +title: LuaHandleSynced +permalink: ldoc/modules/LuaHandleSynced.html +description: Callins, functions called by the Engine (Synced) +parent: Lua API +table: 0x55a54eb31c20 +--- + +{% raw %} +

Module LuaHandleSynced

+

Callins, functions called by the Engine (Synced)

+

+ +

+

See also:

+ + +

Misc

+
+
+ RecvFromSynced +
+
+ Receives data sent via SendToUnsynced callout. +
+
+

Custom Object Rendering

+
+
+ DrawUnit +
+
+ For custom rendering of units +
+
+ DrawFeature +
+
+ For custom rendering of features +
+
+ DrawShield +
+
+ For custom rendering of shields. +
+
+ DrawProjectile +
+
+ For custom rendering of weapon (& other) projectiles +
+
+ DrawMaterial +
+
+ + + +
+
+ CommandFallback +
+
+ Called when the unit reaches an unknown command in its queue (i.e. +
+
+ AllowCommand +
+
+ Called when the command is given, before the unit's queue is altered. +
+
+ AllowUnitCreation +
+
+ Called just before unit is created. +
+
+ AllowUnitTransfer +
+
+ Called just before a unit is transferred to a different team. +
+
+ AllowUnitBuildStep +
+
+ Called just before a unit progresses its build percentage. +
+
+ AllowUnitCaptureStep +
+
+ + + +
+
+ AllowUnitTransport +
+
+ + + +
+
+ AllowUnitTransportLoad +
+
+ + + +
+
+ AllowUnitTransportUnload +
+
+ + + +
+
+ AllowUnitCloak +
+
+ + + +
+
+ AllowUnitCloak +
+
+ + + +
+
+ AllowUnitKamikaze +
+
+ + + +
+
+ AllowFeatureCreation +
+
+ Called just before feature is created. +
+
+ AllowFeatureBuildStep +
+
+ Called just before a feature changes its build percentage. +
+
+ AllowResourceLevel +
+
+ Called when a team sets the sharing level of a resource. +
+
+ AllowResourceTransfer +
+
+ Called just before resources are transferred between players. +
+
+ AllowDirectUnitControl +
+
+ Determines if this unit can be controlled directly in FPS view. +
+
+ AllowBuilderHoldFire +
+
+ Called when a construction unit wants to "use his nano beams". +
+
+ AllowStartPosition +
+
+ Whether a start position should be allowed +
+
+ MoveCtrlNotify +
+
+ Enable both Spring.MoveCtrl.SetCollideStop and Spring.MoveCtrl.SetTrackGround to enable this call-in. +
+
+ TerraformComplete +
+
+ Called when pre-building terrain levelling terraforms are completed (c.f. +
+
+ UnitPreDamaged +
+
+ Called before damage is applied to the unit, allows fine control over how much damage and impulse is applied. +
+
+ FeaturePreDamaged +
+
+ Called before damage is applied to the feature. +
+
+ ShieldPreDamaged +
+
+ Called before any engine shield-vs-projectile logic executes. +
+
+ AllowWeaponTargetCheck +
+
+ Determines if this weapon can automatically generate targets itself. +
+
+ AllowWeaponTarget +
+
+ Controls blocking of a specific target from being considered during a weapon's periodic auto-targeting sweep. +
+
+ AllowWeaponInterceptTarget +
+
+ Controls blocking of a specific intercept target from being considered during an interceptor weapon's periodic auto-targeting sweep. +
+
+ +

+ Misc +

+ +

+ +


+

+

+ RecvFromSynced(arg1, arg2, argn) +

+

Receives data sent via `SendToUnsynced` callout.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + arg1 + any + + + +
  2. +
  3. + arg2 + any + + + +
  4. +
  5. + argn + any + + + +
  6. +
+ + + + +
+

+ 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.

+

+ DrawUnit(unitID, drawMode) +

+

For custom rendering of units

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + drawMode + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + bool + suppressEngineDraw
  2. +
+ + + +
+

+ DrawFeature(featureID, drawMode) +

+

For custom rendering of features

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + drawMode + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + bool + suppressEngineDraw
  2. +
+ + + +
+

+ DrawShield(featureID, weaponID, drawMode) +

+

For custom rendering of shields.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + weaponID + number + + + +
  4. +
  5. + drawMode + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + bool + suppressEngineDraw
  2. +
+ + + +
+

+ DrawProjectile(projectileID, drawMode) +

+

For custom rendering of weapon (& other) projectiles

+
+

+ +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
  3. + drawMode + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + bool + suppressEngineDraw
  2. +
+ + + +
+

+ DrawMaterial(uuid, drawMode) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + uuid + number + + + +
  2. +
  3. + drawMode + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + bool + suppressEngineDraw
  2. +
+ + + +
+

+ CommandFallback(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOptions, cmdTag) +

+

Called when the unit reaches an unknown command in its queue (i.e.

+
+

+ one not handled by the engine). + +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
  7. + cmdID + number + + + +
  8. +
  9. + cmdParams + {number,...} + + + +
  10. +
  11. + cmdOptions + cmdOptions + + + +
  12. +
  13. + cmdTag + number + + + +
  14. +
+ +

Returns:

+
    +
  1. + boolean + whether to remove the command from the queue
  2. +
+ + + +
+

+ AllowCommand(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOptions, cmdTag, synced, fromLua) +

+

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. + +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
  7. + cmdID + number + + + +
  8. +
  9. + cmdParams + {number,...} + + + +
  10. +
  11. + cmdOptions + cmdOptions + + + +
  12. +
  13. + cmdTag + number + + + +
  14. +
  15. + synced + bool + + + +
  16. +
  17. + fromLua + bool + + + +
  18. +
+ +

Returns:

+
    +
  1. + bool + whether it should be let into the queue.
  2. +
+ + + +
+

+ AllowUnitCreation(unitDefID, builderID, builderTeam, x, y, z, facing) +

+

Called just before unit is created.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitDefID + number + + + +
  2. +
  3. + builderID + number + + + +
  4. +
  5. + builderTeam + number + + + +
  6. +
  7. + x + number + + + +
  8. +
  9. + y + number + + + +
  10. +
  11. + z + number + + + +
  12. +
  13. + facing + number + + + +
  14. +
+ +

Returns:

+
    +
  1. + bool + allow, bool dropOrder
  2. +
+ + + +
+

+ AllowUnitTransfer(unitID, unitDefID, oldTeam, newTeam, capture) +

+

Called just before a unit is transferred to a different team.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + oldTeam + number + + + +
  6. +
  7. + newTeam + number + + + +
  8. +
  9. + capture + bool + + + +
  10. +
+ +

Returns:

+
    +
  1. + bool + whether or not the transfer is permitted.
  2. +
+ + + +
+

+ AllowUnitBuildStep(builderID, builderTeam, unitID, unitDefID, part) +

+

Called just before a unit progresses its build percentage.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + builderID + number + + + +
  2. +
  3. + builderTeam + number + + + +
  4. +
  5. + unitID + number + + + +
  6. +
  7. + unitDefID + number + + + +
  8. +
  9. + part + number + + + +
  10. +
+ +

Returns:

+
    +
  1. + bool + whether or not the build makes progress.
  2. +
+ + + +
+

+ AllowUnitCaptureStep(builderID, builderTeam, unitID, unitDefID, part) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + builderID + number + + + +
  2. +
  3. + builderTeam + number + + + +
  4. +
  5. + unitID + number + + + +
  6. +
  7. + unitDefID + number + + + +
  8. +
  9. + part + number + + + +
  10. +
+ +

Returns:

+
    +
  1. + bool + whether or not the capture makes progress.
  2. +
+ + + +
+

+ AllowUnitTransport(transporterID, transporterUnitDefID, transporterTeam, transporteeID, transporteeUnitDefID, transporteeTeam) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + transporterID + number + + + +
  2. +
  3. + transporterUnitDefID + number + + + +
  4. +
  5. + transporterTeam + number + + + +
  6. +
  7. + transporteeID + number + + + +
  8. +
  9. + transporteeUnitDefID + number + + + +
  10. +
  11. + transporteeTeam + number + + + +
  12. +
+ +

Returns:

+
    +
  1. + bool + whether or not the transport is allowed
  2. +
+ + + +
+

+ AllowUnitTransportLoad(transporterID, transporterUnitDefID, transporterTeam, transporteeID, transporteeUnitDefID, transporteeTeam, x, y, z) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + transporterID + number + + + +
  2. +
  3. + transporterUnitDefID + number + + + +
  4. +
  5. + transporterTeam + number + + + +
  6. +
  7. + transporteeID + number + + + +
  8. +
  9. + transporteeUnitDefID + number + + + +
  10. +
  11. + transporteeTeam + number + + + +
  12. +
  13. + x + number + + + +
  14. +
  15. + y + number + + + +
  16. +
  17. + z + number + + + +
  18. +
+ +

Returns:

+
    +
  1. + bool + whether or not the transport load is allowed
  2. +
+ + + +
+

+ AllowUnitTransportUnload(transporterID, transporterUnitDefID, transporterTeam, transporteeID, transporteeUnitDefID, transporteeTeam, x, y, z) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + transporterID + number + + + +
  2. +
  3. + transporterUnitDefID + number + + + +
  4. +
  5. + transporterTeam + number + + + +
  6. +
  7. + transporteeID + number + + + +
  8. +
  9. + transporteeUnitDefID + number + + + +
  10. +
  11. + transporteeTeam + number + + + +
  12. +
  13. + x + number + + + +
  14. +
  15. + y + number + + + +
  16. +
  17. + z + number + + + +
  18. +
+ +

Returns:

+
    +
  1. + bool + whether or not the transport unload is allowed
  2. +
+ + + +
+

+ AllowUnitCloak(unitID[, enemyID]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + enemyID + number + + + + (optional) +
  4. +
+ +

Returns:

+
    +
  1. + bool + whether unit is allowed to cloak
  2. +
+ + + +
+

+ AllowUnitCloak(unitID[, objectID[, weaponNum]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + objectID + number + + + + (optional) +
  4. +
  5. + weaponNum + number + + + + (optional) +
  6. +
+ +

Returns:

+
    +
  1. + bool + whether unit is allowed to decloak
  2. +
+ + + +
+

+ AllowUnitKamikaze(unitID, targetID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + targetID + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + bool + whether unit is allowed to selfd
  2. +
+ + + +
+

+ AllowFeatureCreation(featureDefID, teamID, x, y, z) +

+

Called just before feature is created.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureDefID + number + + + +
  2. +
  3. + teamID + number + + + +
  4. +
  5. + x + number + + + +
  6. +
  7. + y + number + + + +
  8. +
  9. + z + number + + + +
  10. +
+ +

Returns:

+
    +
  1. + bool + whether or not the creation is permitted
  2. +
+ + + +
+

+ AllowFeatureBuildStep(builderID, builderTeam, featureID, featureDefID, part) +

+

Called just before a feature changes its build percentage.

+
+

+ + + Note that this is also called for resurrecting features, and for refilling features with resources before resurrection. + On reclaim the part values are negative, and on refill and ressurect they are positive. + Part is the percentage the feature be built or reclaimed per frame. + Eg. for a 30 workertime builder, that's a build power of 1 per frame. + For a 50 buildtime feature reclaimed by this builder, part will be 100/-50(/1) = -2%, or -0.02 numerically. + +

+ + +

Parameters:

+
    +
  1. + builderID + number + + + +
  2. +
  3. + builderTeam + number + + + +
  4. +
  5. + featureID + number + + + +
  6. +
  7. + featureDefID + number + + + +
  8. +
  9. + part + number + + + +
  10. +
+ +

Returns:

+
    +
  1. + bool + whether or not the change is permitted
  2. +
+ + + +
+

+ AllowResourceLevel(teamID, res, level) +

+

Called when a team sets the sharing level of a resource.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
  3. + res + string + + + +
  4. +
  5. + level + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + bool + whether or not the sharing level is permitted
  2. +
+ + + +
+

+ AllowResourceTransfer(oldTeamID, newTeamID, res, amount) +

+

Called just before resources are transferred between players.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + oldTeamID + number + + + +
  2. +
  3. + newTeamID + number + + + +
  4. +
  5. + res + string + + + +
  6. +
  7. + amount + number + + + +
  8. +
+ +

Returns:

+
    +
  1. + bool + whether or not the transfer is permitted.
  2. +
+ + + +
+

+ AllowDirectUnitControl(unitID, unitDefID, unitTeam, playerID) +

+

Determines if this unit can be controlled directly in FPS view.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
  7. + playerID + number + + + +
  8. +
+ +

Returns:

+
    +
  1. + bool + allow
  2. +
+ + + +
+

+ AllowBuilderHoldFire(unitID, unitDefID, action) +

+

Called when a construction unit wants to "use his nano beams".

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + action + number + one of following:

    + +

    -1 Build + CMD.REPAIR Repair + CMD.RECLAIM Reclaim + CMD.RESTORE Restore + CMD.RESURRECT Resurrect + CMD.CAPTURE Capture +

  6. +
+ +

Returns:

+
    +
  1. + bool + actionAllowed
  2. +
+ + + +
+

+ AllowStartPosition(playerID, teamID, readyState, clampedX, clampedY, clampedZ, rawX, rawY, rawZ) +

+

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. + + NB: The order of the parameters changed with the addition of teamID in 104.0. Previouly it was: clampedX, clampedY, clampedZ, playerID, readyState, rawX, rawY, rawZ + +

+ + +

Parameters:

+
    +
  1. + playerID + number + + + +
  2. +
  3. + teamID + number + + + +
  4. +
  5. + readyState + number + + + +
  6. +
  7. + clampedX + number + + + +
  8. +
  9. + clampedY + number + + + +
  10. +
  11. + clampedZ + number + + + +
  12. +
  13. + rawX + number + + + +
  14. +
  15. + rawY + number + + + +
  16. +
  17. + rawZ + number + + + +
  18. +
+ +

Returns:

+
    +
  1. + bool + allow
  2. +
+ + + +
+

+ MoveCtrlNotify(unitID, unitDefID, unitTeam, data) +

+

Enable both Spring.MoveCtrl.SetCollideStop and Spring.MoveCtrl.SetTrackGround to enable this call-in.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
  7. + data + number + was supposed to indicate the type of notification but currently never has a value other than 1 ("unit hit the ground"). +
  8. +
+ +

Returns:

+
    +
  1. + bool + whether or not the unit should remain script-controlled (false) or return to engine controlled movement (true).
  2. +
+ + + +
+

+ TerraformComplete(unitID, unitDefID, unitTeam, buildUnitID, buildUnitDefID, buildUnitTeam) +

+

Called when pre-building terrain levelling terraforms are completed (c.f.

+
+

+ levelGround) + +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
  7. + buildUnitID + number + + + +
  8. +
  9. + buildUnitDefID + number + + + +
  10. +
  11. + buildUnitTeam + number + + + +
  12. +
+ +

Returns:

+
    +
  1. + bool + if true the current build order is terminated
  2. +
+ + + +
+

+ UnitPreDamaged(unitID, unitDefID, unitTeam, damage, paralyzer[, weaponDefID[, projectileID[, attackerID[, attackerDefID[, attackerTeam]]]]]) +

+

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 + +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + unitTeam + number + + + +
  6. +
  7. + damage + number + + + +
  8. +
  9. + paralyzer + bool + + + +
  10. +
  11. + weaponDefID + number + Synced Only + (optional) +
  12. +
  13. + projectileID + number + Synced Only + (optional) +
  14. +
  15. + attackerID + number + Synced Only + (optional) +
  16. +
  17. + attackerDefID + number + Synced Only + (optional) +
  18. +
  19. + attackerTeam + number + Synced Only + (optional) +
  20. +
+ +

Returns:

+
    +
  1. + number newDamage, number impulseMult
  2. +
+ + + +
+

+ FeaturePreDamaged(featureID, featureDefID, featureTeam, damage, weaponDefID, projectileID, attackerID, attackerDefID, attackerTeam) +

+

Called before damage is applied to the feature.

+
+

+ + + Allows fine control over how much damage and impulse is applied. + +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + featureDefID + number + + + +
  4. +
  5. + featureTeam + number + + + +
  6. +
  7. + damage + number + + + +
  8. +
  9. + weaponDefID + number + + + +
  10. +
  11. + projectileID + number + + + +
  12. +
  13. + attackerID + number + + + +
  14. +
  15. + attackerDefID + number + + + +
  16. +
  17. + attackerTeam + number + + + +
  18. +
+ +

Returns:

+
    +
  1. + number + newDamage
  2. +
  3. + number + impulseMult
  4. +
+ + + +
+

+ ShieldPreDamaged(projectileID, projectileOwnerID, shieldWeaponNum, shieldCarrierID, bounceProjectile, beamEmitterWeaponNum, beamEmitterUnitID, startX, startY, startZ, hitX, hitY, hitZ) +

+

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. + +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
  3. + projectileOwnerID + number + + + +
  4. +
  5. + shieldWeaponNum + number + + + +
  6. +
  7. + shieldCarrierID + number + + + +
  8. +
  9. + bounceProjectile + bool + + + +
  10. +
  11. + beamEmitterWeaponNum + number + + + +
  12. +
  13. + beamEmitterUnitID + number + + + +
  14. +
  15. + startX + number + + + +
  16. +
  17. + startY + number + + + +
  18. +
  19. + startZ + number + + + +
  20. +
  21. + hitX + number + + + +
  22. +
  23. + hitY + number + + + +
  24. +
  25. + hitZ + number + + + +
  26. +
+ +

Returns:

+
    +
  1. + bool + if true the gadget handles the collision event and the engine does not remove the projectile
  2. +
+ + + +
+

+ AllowWeaponTargetCheck(attackerID, attackerWeaponNum, attackerWeaponDefID) +

+

Determines if this weapon can automatically generate targets itself.

+
+

+ See also commandFire weaponDef tag. + +

+ + +

Parameters:

+
    +
  1. + attackerID + number + + + +
  2. +
  3. + attackerWeaponNum + number + + + +
  4. +
  5. + attackerWeaponDefID + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + bool + allowCheck
  2. +
  3. + bool + ignoreCheck
  4. +
+ + + +
+

+ AllowWeaponTarget(attackerID, targetID, attackerWeaponNum, attackerWeaponDefID, defPriority) +

+

Controls blocking of a specific target from being considered during a weapon's periodic auto-targeting sweep.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + attackerID + number + + + +
  2. +
  3. + targetID + number + + + +
  4. +
  5. + attackerWeaponNum + number + + + +
  6. +
  7. + attackerWeaponDefID + number + + + +
  8. +
  9. + defPriority + number + + + +
  10. +
+ +

Returns:

+
    +
  1. + bool + allowed
  2. +
  3. + number + the new priority for this target (if you don't want to change it, return defPriority). Lower priority targets are targeted first.
  4. +
+ + + +
+

+ AllowWeaponInterceptTarget(interceptorUnitID, interceptorWeaponID, targetProjectileID) +

+

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. + +

+ + +

Parameters:

+
    +
  1. + interceptorUnitID + number + + + +
  2. +
  3. + interceptorWeaponID + number + + + +
  4. +
  5. + targetProjectileID + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + bool + allowed
  2. +
+ + + +
+ +{% endraw %} diff --git a/ldoc/modules/LuaRules.html b/ldoc/modules/LuaRules.html new file mode 100644 index 0000000000..c2f17336d3 --- /dev/null +++ b/ldoc/modules/LuaRules.html @@ -0,0 +1,24 @@ +--- +layout: default +title: LuaRules +permalink: ldoc/modules/LuaRules.html +description: Lua Rules +parent: Lua API +table: 0x55a54eaf61b0 +--- + +{% raw %} +

Module LuaRules

+

Lua Rules

+

+ +


+

+

See also:

+ + + + +{% endraw %} diff --git a/ldoc/modules/LuaVAO.html b/ldoc/modules/LuaVAO.html new file mode 100644 index 0000000000..51fd27f03b --- /dev/null +++ b/ldoc/modules/LuaVAO.html @@ -0,0 +1,69 @@ +--- +layout: default +title: LuaVAO +permalink: ldoc/modules/LuaVAO.html +description: + + +parent: Lua API +table: 0x55a54eaa1410 +--- + +{% raw %} +

Module LuaVAO

+

+ +

+

+ +


+

+

See also:

+ + +

Functions

+
+
+ gl.GetVAO +
+
+ + + +
+
+ +

+ Functions +

+ +

+ gl.GetVAO() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + nil or VAO + the VAO ref on success, else nil
  2. +
+ + + +

Usage:

+ +
+ +{% endraw %} diff --git a/ldoc/modules/LuaVBO.html b/ldoc/modules/LuaVBO.html new file mode 100644 index 0000000000..6ad98be6fc --- /dev/null +++ b/ldoc/modules/LuaVBO.html @@ -0,0 +1,93 @@ +--- +layout: default +title: LuaVBO +permalink: ldoc/modules/LuaVBO.html +description: + + +parent: Lua API +table: 0x55a54e5f4bc0 +--- + +{% raw %} +

Module LuaVBO

+

+ +

+

+ +


+

+

See also:

+ + +

Functions

+
+
+ gl.GetVBO +
+
+ + + +
+
+ +

+ Functions +

+ +

+ gl.GetVBO([bufferType=GL.ARRAY_BUFFER[, freqUpdated=true]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + bufferType + number + one of [GL.ARRAY_BUFFER, + GL.ELEMENT_ARRAY_BUFFER, GL.UNIFORM_BUFFER, GL.SHADER_STORAGE_BUFFER].

    + +

    Defaults to GL.ARRAY_BUFFER, which you should use for vertex data, and + GL.ELEMENT_ARRAY_BUFFER should be used for vertex indices. + (default GL.ARRAY_BUFFER) +

  2. +
  3. + freqUpdated + bool + whether should be updated frequently, when false + will be updated only once + (default true) +
  4. +
+ +

Returns:

+
    +
  1. + nil or VBO + the VBO ref on success, nil if not supported/or other error
  2. +
+ + +

See also:

+ + +

Usage:

+ +
+ +{% endraw %} diff --git a/ldoc/modules/LuaZip.html b/ldoc/modules/LuaZip.html new file mode 100644 index 0000000000..0fe9fe0fff --- /dev/null +++ b/ldoc/modules/LuaZip.html @@ -0,0 +1,24 @@ +--- +layout: default +title: LuaZip +permalink: ldoc/modules/LuaZip.html +description: LuaZip +parent: Lua API +table: 0x55a54e885a50 +--- + +{% raw %} +

Module LuaZip

+

LuaZip

+

+ +


+

+

See also:

+ + + + +{% endraw %} diff --git a/ldoc/modules/MathExtra.html b/ldoc/modules/MathExtra.html new file mode 100644 index 0000000000..04c86b6bc9 --- /dev/null +++ b/ldoc/modules/MathExtra.html @@ -0,0 +1,385 @@ +--- +layout: default +title: MathExtra +permalink: ldoc/modules/MathExtra.html +description: math extensions +parent: Lua API +table: 0x55a54e813b40 +--- + +{% raw %} +

Module MathExtra

+

math extensions

+

+ +


+

+

See also:

+ + +

Functions

+
+
+ math.hypot +
+
+ Returns the length of hypotenuse of right angle triangle with sides x and y, equivalent to sqrt(xx + yy), but has better numerical stability and internally handles intermediate overflows/underflows, but is also slower. +
+
+ math.diag +
+
+ Returns the length of the diagonal of an n-dimensional box (or the length of an n-component vector). +
+
+ math.clamp +
+
+ Returns x clamped to min and max boundaries. +
+
+ math.sgn +
+
+ Returns 0 if x == 0, 1 if x > 0, -1 if x < 0 +
+
+ math.mix +
+
+ Returns linear interpolation between x and y with ratio a (x+(y-x)*a). +
+
+ math.round +
+
+ Returns x rounded to n decimals, if n is omitted or <=0, rounds to nearest integer. +
+
+ math.erf +
+
+ Returns erf(x), the Gauss error function, between -1 and 1. +
+
+ math.smoothstep +
+
+ Applies the smoothstep function +
+
+ +

+ Functions +

+ +

+ math.hypot(x, y) +

+

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.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + y + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + number + sqrt(xx+yy)
  2. +
+ + + +
+

+ math.diag(x1[, x2[, x3[, xn]]]) +

+

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. + +

+ + +

Parameters:

+
    +
  1. + x1 + number + + + +
  2. +
  3. + x2 + number + + + + (optional) +
  4. +
  5. + x3 + number + + + + (optional) +
  6. +
  7. + xn + number + and so on + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + number + diagonal
  2. +
+ + + +
+

+ math.clamp() +

+

Returns x clamped to min and max boundaries.

+
+

+ ( number x, number min, number max ) +

+ + + +

Returns:

+
    +
  1. + number + clamped
  2. +
+ + + +
+

+ math.sgn(x) +

+

Returns 0 if x == 0, 1 if x > 0, -1 if x < 0

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + number + sign
  2. +
+ + + +
+

+ math.mix(x, y, a) +

+

Returns linear interpolation between x and y with ratio a (x+(y-x)*a).

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + y + number + + + +
  4. +
  5. + a + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + number + (x+(y-x)*a)
  2. +
+ + + +
+

+ math.round(x, decimals) +

+

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. + +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + decimals + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + number + rounded
  2. +
+ + + +
+

+ math.erf(x) +

+

Returns erf(x), the Gauss error function, between -1 and 1.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + number + erf
  2. +
+ + + +
+

+ math.smoothstep(edge0, edge1, v) +

+

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 +

+ + +

Parameters:

+
    +
  1. + edge0 + number + + + +
  2. +
  3. + edge1 + number + + + +
  4. +
  5. + v + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + number + smoothstep
  2. +
+ + + +
+ +{% endraw %} diff --git a/ldoc/modules/MetalMap.html b/ldoc/modules/MetalMap.html new file mode 100644 index 0000000000..18fb5b5341 --- /dev/null +++ b/ldoc/modules/MetalMap.html @@ -0,0 +1,80 @@ +--- +layout: default +title: MetalMap +permalink: ldoc/modules/MetalMap.html +description: Metal Map Lua API +parent: Lua API +table: 0x55a54e93c1b0 +--- + +{% raw %} +

Module MetalMap

+

Metal Map Lua API

+

+ +


+

+

See also:

+ + +

Functions

+
+
+ Spring.SetMetalAmount +
+
+ + + +
+
+ +

+ Functions +

+ +

+ Spring.SetMetalAmount(x, z, metalAmount) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + in worldspace/16. +
  2. +
  3. + z + number + in worldspace/16. +
  4. +
  5. + metalAmount + number + must be between 0 and 255*maxMetal (with maxMetal from the .smd or mapinfo.lua). +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+ +{% endraw %} diff --git a/ldoc/modules/MoveCtrl.html b/ldoc/modules/MoveCtrl.html new file mode 100644 index 0000000000..06a562f44f --- /dev/null +++ b/ldoc/modules/MoveCtrl.html @@ -0,0 +1,24 @@ +--- +layout: default +title: MoveCtrl +permalink: ldoc/modules/MoveCtrl.html +description: MoveCtrl +parent: Lua API +table: 0x55a54e9b9440 +--- + +{% raw %} +

Module MoveCtrl

+

MoveCtrl

+

+ +


+

+

See also:

+ + + + +{% endraw %} diff --git a/ldoc/modules/OpenGL.html b/ldoc/modules/OpenGL.html new file mode 100644 index 0000000000..48d9d7d59c --- /dev/null +++ b/ldoc/modules/OpenGL.html @@ -0,0 +1,207 @@ +--- +layout: default +title: OpenGL +permalink: ldoc/modules/OpenGL.html +description: Lua OpenGL API +parent: Lua API +table: 0x55a54e52bd90 +--- + +{% raw %} +

Module OpenGL

+

Lua OpenGL API

+

+ +


+

+

See also:

+ + +

Text

+
+
+ gl.Text +
+
+ + + +
+
+

Draw Basics

+
+
+ gl.Color +
+
+ + + +
+
+ +

+ Text +

+ +

+ +


+

+

+ gl.Text(text, x, y, size[, options]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + text + string + + + +
  2. +
  3. + x + number + + + +
  4. +
  5. + y + number + + + +
  6. +
  7. + size + number + + + +
  8. +
  9. + 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)
      • +
    • +
    + + (optional) +
  10. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Draw Basics +

+ +

+ +


+

+

+ gl.Color(r[, g[, b[, a]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + r + number or {number,number,number,number} + red when number, rgba + quadruple or rgb triple otherwise +
  2. +
  3. + g + number + + + + (optional) +
  4. +
  5. + b + number + + + + (optional) +
  6. +
  7. + a + number + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+ +{% endraw %} diff --git a/ldoc/modules/Platform.html b/ldoc/modules/Platform.html new file mode 100644 index 0000000000..5ea4d1812c --- /dev/null +++ b/ldoc/modules/Platform.html @@ -0,0 +1,212 @@ +--- +layout: default +title: Platform +permalink: ldoc/modules/Platform.html +description: Platform constants +parent: Lua API +table: 0x55a54e4f6cf0 +--- + +{% raw %} +

Module Platform

+

Platform constants

+

+ +


+

+

See also:

+ + +

Tables

+
+
+ Platform +
+
+ Platform specific information +
+
+ +

+ Tables +

+ +

+ Platform +

+

Platform specific information

+
+

+ +

+ + +

Fields:

+
    +
  1. + gpu + string + full GPU device name +
  2. +
  3. + gpuVendor + string + one of "Nvidia", "Intel", "ATI", "Mesa", "Unknown" +
  4. +
  5. + glVersionShort + string + major.minor.buildNumber +
  6. +
  7. + glslVersionShort + string + major.minor +
  8. +
  9. + glVersion + string + full version +
  10. +
  11. + glVendor + string + + + +
  12. +
  13. + glRenderer + string + + + +
  14. +
  15. + glslVersion + string + full version +
  16. +
  17. + glewVersion + string + + + +
  18. +
  19. + osName + string + full name of the OS +
  20. +
  21. + osFamily + string + one of "Windows", "Linux", "MacOSX", "FreeBSD", "Unknown" +
  22. +
  23. + numDisplays + number + + + +
  24. +
  25. + gpuMemorySize + number + size of total GPU memory in MBs; only available for "Nvidia", (rest are 0) +
  26. +
  27. + sdlVersionCompiledMajor + number + + + +
  28. +
  29. + sdlVersionCompiledMinor + number + + + +
  30. +
  31. + sdlVersionCompiledPatch + number + + + +
  32. +
  33. + sdlVersionLinkedMajor + number + + + +
  34. +
  35. + sdlVersionLinkedMinor + number + + + +
  36. +
  37. + sdlVersionLinkedPatch + number + + + +
  38. +
  39. + glSupportNonPowerOfTwoTex + bool + + + +
  40. +
  41. + glSupportTextureQueryLOD + bool + + + +
  42. +
  43. + glSupport24bitDepthBuffer + bool + + + +
  44. +
  45. + glSupportRestartPrimitive + bool + + + +
  46. +
  47. + glSupportClipSpaceControl + bool + + + +
  48. +
  49. + glSupportFragDepthLayout + bool + + + +
  50. +
+ + + + +
+ +{% endraw %} diff --git a/ldoc/modules/RBO.html b/ldoc/modules/RBO.html new file mode 100644 index 0000000000..fd2a36178f --- /dev/null +++ b/ldoc/modules/RBO.html @@ -0,0 +1,196 @@ +--- +layout: default +title: RBO +permalink: ldoc/modules/RBO.html +description: RBO +parent: Lua API +table: 0x55a54e8efe60 +--- + +{% raw %} +

Module RBO

+

RBO

+

+ +


+

+

See also:

+ + +

Functions

+
+
+ gl.CreateRBO +
+
+ + + +
+
+ gl.DeleteRBO +
+
+ + + +
+
+

Tables

+
+
+ rbo +
+
+ User Data RBO +
+
+ +

+ Functions +

+ +

+ gl.CreateRBO(xsize, ysize, data) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + xsize + number + + + +
  2. +
  3. + ysize + number + + + +
  4. +
  5. data + + +
      +
    • + target + number + GL_RENDERBUFFER_EXT +
    • +
    • + format + number + GL_RGBA +
    • +
    • + samples + number + any number here will result in creation of multisampled RBO + (optional) +
    • +
    +
+ + + + +
+

+ gl.DeleteRBO(rbo) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + rbo + rbo + + + +
  2. +
+ + + + +
+

+ Tables +

+ +

+ rbo +

+

User Data RBO

+
+

+ +

+ + +

Fields:

+
    +
  1. + target + number + + + +
  2. +
  3. + format + number + + + +
  4. +
  5. + xsize + number + + + +
  6. +
  7. + ysize + number + + + +
  8. +
  9. + valid + bool + + + +
  10. +
  11. + samples + number + will return globalRendering->msaaLevel for multisampled RBO or 0 otherwise +
  12. +
+ + + + +
+ +{% endraw %} diff --git a/ldoc/modules/Shaders.html b/ldoc/modules/Shaders.html new file mode 100644 index 0000000000..f0a6b41828 --- /dev/null +++ b/ldoc/modules/Shaders.html @@ -0,0 +1,732 @@ +--- +layout: default +title: Shaders +permalink: ldoc/modules/Shaders.html +description: Shader creation and management +parent: Lua API +table: 0x55a54e897e30 +--- + +{% raw %} +

Module Shaders

+

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 also:

+ + +

Functions

+
+
+ gl.GetShaderLog +
+
+ Returns the shader compilation error log. +
+
+ gl.CreateShader +
+
+ Create a shader from shaderParams table: +
+
+ gl.DeleteShader +
+
+ Deletes a shader identified by shaderID +
+
+ gl.UseShader +
+
+ Binds a shader program identified by shaderID. +
+
+ gl.ActiveShader +
+
+ Binds a shader program identified by shaderID, and calls the Lua func with the specified arguments. +
+
+ gl.GetActiveUniforms +
+
+ Query the active (actually used) uniforms of a shader and identify their names, types (float, int, uint) and sizes (float, vec4, ...). +
+
+ gl.GetUniformLocation +
+
+ Returns the locationID of a shaders uniform. +
+
+ gl.Uniform +
+
+ Sets the uniform float value at the locationID for the currently active shader. +
+
+ gl.UniformInt +
+
+ Sets the uniform int value at the locationID for the currently active shader. +
+
+ gl.UniformArray +
+
+ Sets the an array of uniform values at the locationID for the currently active shader. +
+
+ gl.UniformMatrix +
+
+ Sets the a uniform mat4 locationID for the currently active shader. +
+
+ gl.SetGeometryShaderParameter +
+
+ Sets the Geometry shader parameters for shaderID. +
+
+ gl.SetTesselationShaderParameter +
+
+ Sets the tesselation shader parameters for shaderID. +
+
+ +

+ Functions +

+ +

+ gl.GetShaderLog() +

+

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. + +

+ + + +

Returns:

+
    +
  1. + string + infoLog
  2. +
+ + + +
+

+ gl.CreateShader(shaderParams) +

+

Create a shader from shaderParams table:

+
+

+ ( table shaderParams ) +

+ + +

Parameters:

+
    +
  1. + shaderParams + table + + + +
  2. +
+ +

Returns:

+
    +
  1. + number + +

    shaderID

    + +
    ({[ vertex   = "glsl code" ,]
    +  [ tcs      = "glsl code" ,]
    +  [ tes      = "glsl code" ,]
    +  [ geometry = "glsl code" ,]
    +  [ fragment = "glsl code" ,]
    +  [ uniform       = { uniformName = number value, ...} ,] (specify a Lua array as an argument to uniformName to initialize GLSL arrays)
    +  [ uniformInt    = { uniformName = number value, ...} ,] (specify a Lua array as an argument to uniformName to initialize GLSL arrays)
    +  [ uniformFloat  = { uniformName = number value, ...} ,] (specify a Lua array as an argument to uniformName to initialize GLSL arrays)
    +  [ uniformMatrix = { uniformName = number value, ...} ,]
    +  [ geoInputType = number inType,]
    +  [ geoOutputType = number outType,]
    +  [ geoOutputVerts = number maxVerts,]
    +  [ definitions = "string of shader #defines", ]
    +})
    +
    + +
      +
    • The "Vertex" or vertex-shader is your GLSL-Code as string, its written in a C-Dialect. This shader is busy deforming the geometry of a unit but it can not create new polygons. Use it for waves, wobbling surfaces etc.
    • +
    • The "Geometry" or Geometry-shader can create new vertices and vertice-stripes from points.
    • +
    • The "TCS" or Tesselation Control Shader controls how much tessellation a particular patch gets; it also defines the size of a patch, thus allowing it to augment data. It can also filter vertex data taken from the vertex shader. The main purpose of the TCS is to feed the tessellation levels to the Tessellation primitive generator stage, as well as to feed patch data (as its output values) to the Tessellation Evaluation Shader stage.
    • +
    • The "TES" or Tesselation Evaluation Shader takes the abstract patch generated by the tessellation primitive generation stage, as well as the actual vertex data for the entire patch, and generates a particular vertex from it. Each TES invocation generates a single vertex. It can also take per-patch data provided by the Tessellation Control Shader.
    • +
    • The "Fragment" or Fragment-shader (sometimes called pixel-Shader) is post processing the allready rendered picture (for example drawing stars on the sky)- remember textures are not always 2 dimensional pictures. They can contain information about the depth, or the third value marks areas and the strength at which these are processed.
    • +
    • The Uniforms are the values, you send along with the shader-program. To use them in the shader-program declare them like this: uniform float frame;
    • +
    + +

    The engine will automatically fill in an appropriately named uniform for team colour if it is declared;

    + +
    uniform vec4 teamColor;
    +
    +
  2. +
+ + + +
+

+ gl.DeleteShader(shaderID) +

+

Deletes a shader identified by shaderID

+
+

+ +

+ + +

Parameters:

+
    +
  1. + shaderID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ gl.UseShader(shaderID) +

+

Binds a shader program identified by shaderID.

+
+

+ Pass 0 to disable the shader. Returns wether the shader was successfully bound. + +

+ + +

Parameters:

+
    +
  1. + shaderID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + bool + linked
  2. +
+ + + +
+

+ gl.ActiveShader(shaderID, func[, arg1[, arg2[, argn]]]) +

+

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.)! + +

+ + +

Parameters:

+
    +
  1. + shaderID + number + + + +
  2. +
  3. + func + func + + + +
  4. +
  5. + arg1 + any + + + + (optional) +
  6. +
  7. + arg2 + any + + + + (optional) +
  8. +
  9. + argn + any + + + + (optional) +
  10. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ gl.GetActiveUniforms(shaderID) +

+

Query the active (actually used) uniforms of a shader and identify their names, types (float, int, uint) and sizes (float, vec4, ...).

+
+

+ +

+ + +

Parameters:

+
    +
  1. + shaderID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + table + ActiveUniforms = { { name = "name", type = "type", length = number length, size = number size }, ...}
  2. +
+ + + +
+

+ gl.GetUniformLocation(shaderID, name) +

+

Returns the locationID of a shaders uniform.

+
+

+ Needed for changing uniform values with @function gl.Uniform. + +

+ + +

Parameters:

+
    +
  1. + shaderID + number + + + +
  2. +
  3. + name + string + + + +
  4. +
+ +

Returns:

+
    +
  1. + number + locationID
  2. +
+ + + +
+

+ gl.Uniform(locationID, f1[, f2[, f3[, f4]]]) +

+

Sets the uniform float value at the locationID for the currently active shader.

+
+

+ Shader must be activated before setting uniforms. + +

+ + +

Parameters:

+
    +
  1. + locationID + number + + + +
  2. +
  3. + f1 + number + + + +
  4. +
  5. + f2 + number + + + + (optional) +
  6. +
  7. + f3 + number + + + + (optional) +
  8. +
  9. + f4 + number + + + + (optional) +
  10. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ gl.UniformInt(locationID, int1[, int2[, int3[, int4]]]) +

+

Sets the uniform int value at the locationID for the currently active shader.

+
+

+ Shader must be activated before setting uniforms. + +

+ + +

Parameters:

+
    +
  1. + locationID + number + + + +
  2. +
  3. + int1 + number + + + +
  4. +
  5. + int2 + number + + + + (optional) +
  6. +
  7. + int3 + number + + + + (optional) +
  8. +
  9. + int4 + number + + + + (optional) +
  10. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ gl.UniformArray(locationID, type, uniforms) +

+

Sets the an array of uniform values at the locationID for the currently active shader.

+
+

+ Shader must be activated before setting uniforms. Type can be one of {1 = int, 2 = float, 3 = float matrix}. In 104.0 the maximum length of the uniforms table increased from 32 entries to 1024. + +

+ + +

Parameters:

+
    +
  1. + locationID + number + + + +
  2. +
  3. + type + number + + + +
  4. +
  5. + uniforms + table + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ gl.UniformMatrix(locationID, m1[, m2[, mn[, m16]]]) +

+

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. + +

+ + +

Parameters:

+
    +
  1. + locationID + number + + + +
  2. +
  3. + m1 + string or number + "shadows" | "camera" | "caminv" | "camprj" +
  4. +
  5. + m2 + number + + + + (optional) +
  6. +
  7. + mn + number + + + + (optional) +
  8. +
  9. + m16 + number + + + + (optional) +
  10. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ gl.SetGeometryShaderParameter(shaderID, param, number) +

+

Sets the Geometry shader parameters for shaderID.

+
+

+ Needed by geometry shader programs (check the opengl GL_ARB_geometry_shader4 extension for glProgramParameteri) + +

+ + +

Parameters:

+
    +
  1. + shaderID + number + + + +
  2. +
  3. + param + number + + + +
  4. +
  5. + number + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ gl.SetTesselationShaderParameter(param, number) +

+

Sets the tesselation shader parameters for shaderID.

+
+

+ + + Needed by tesselation shader programs (check the opengl GL_ARB_tessellation_shader extension for glProgramParameteri) + +

+ + +

Parameters:

+
    +
  1. + param + number + + + +
  2. +
  3. + number + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+ +{% endraw %} diff --git a/ldoc/modules/SyncedCtrl.html b/ldoc/modules/SyncedCtrl.html new file mode 100644 index 0000000000..a49300ecc4 --- /dev/null +++ b/ldoc/modules/SyncedCtrl.html @@ -0,0 +1,11410 @@ +--- +layout: default +title: SyncedCtrl +permalink: ldoc/modules/SyncedCtrl.html +description: Synced Lua API +parent: Lua API +table: 0x55a54e405510 +--- + +{% raw %} +

Module SyncedCtrl

+

Synced Lua API

+

+ +

+

See also:

+ + +

Teams

+
+
+ Spring.SetAlly +
+
+ Changes the value of the (one-sided) alliance between: firstAllyTeamID -> secondAllyTeamID. +
+
+ Spring.SetAllyTeamStartBox +
+
+ Changes the start box position of an allyTeam. +
+
+ Spring.AssignPlayerToTeam +
+
+ Assigns a player to a team. +
+
+ Spring.SetGlobalLos +
+
+ Changes access to global line of sight for a team and its allies. +
+
+

Game End

+
+
+ Spring.KillTeam +
+
+ Will declare a team to be dead (no further orders can be assigned to such teams units). +
+
+ Spring.GameOver +
+
+ Will declare game over. +
+
+

Resources

+
+
+ Spring.SetTidal +
+
+ Set tidal strength +
+
+ Spring.SetWind +
+
+ Set wind strength +
+
+ Spring.AddTeamResource +
+
+ Adds metal or energy resources to the specified team. +
+
+ Spring.UseTeamResource +
+
+ Consumes metal and/or energy resources of the specified team. +
+
+ Spring.SetTeamResource +
+
+ + + +
+
+ Spring.SetTeamShareLevel +
+
+ Changes the resource amount for a team beyond which resources aren't stored but transferred to other allied teams if possible. +
+
+ Spring.ShareTeamResource +
+
+ Transfers resources between two teams. +
+
+

Rules Params

+
+
+ losAccess +
+
+ Parameters for los access +
+
+ Spring.SetGameRulesParam +
+
+ + + +
+
+ Spring.SetTeamRulesParam +
+
+ + + +
+
+ Spring.SetPlayerRulesParam +
+
+ + + +
+
+ Spring.SetUnitRulesParam +
+
+ + + +
+
+ Spring.SetFeatureRulesParam +
+
+ + + +
+
+

Lua to COB

+
+
+ Spring.CallCOBScript +
+
+ + + +
+
+ Spring.GetCOBScriptID +
+
+ + + +
+
+

Unit Handling

+
+
+ Spring.CreateUnit +
+
+ + + +
+
+ Spring.DestroyUnit +
+
+ + + +
+
+ Spring.TransferUnit +
+
+ + + +
+
+

Unit Control

+
+
+ Spring.SetUnitCosts +
+
+ + + +
+
+

Unit Resourcing

+
+
+ Spring.SetUnitResourcing +
+
+ + + +
+
+ Spring.SetUnitResourcing +
+
+ + + +
+
+ Spring.SetUnitTooltip +
+
+ + + +
+
+ Spring.SetUnitHealth +
+
+ + + +
+
+ Spring.SetUnitMaxHealth +
+
+ + + +
+
+ Spring.SetUnitStockpile +
+
+ + + +
+
+ Spring.SetUnitUseWeapons +
+
+ + + +
+
+ states +
+
+ Parameter for weapon states +
+
+ Spring.SetUnitWeaponState +
+
+ + + +
+
+ Spring.SetUnitWeaponState +
+
+ + + +
+
+ damages +
+
+ Parameters for damage +
+
+ Spring.SetUnitWeaponDamages +
+
+ + + +
+
+ Spring.SetUnitWeaponDamages +
+
+ + + +
+
+ Spring.SetUnitMaxRange +
+
+ + + +
+
+ Spring.SetUnitExperience +
+
+ + + +
+
+ Spring.AddUnitExperience +
+
+ + + +
+
+ Spring.SetUnitArmored +
+
+ + + +
+
+

Unit LOS

+
+
+ Spring.SetUnitLosMask +
+
+ + + +
+
+ Spring.SetUnitLosState +
+
+ + + +
+
+ Spring.SetUnitCloak +
+
+ + + +
+
+ Spring.SetUnitStealth +
+
+ + + +
+
+ Spring.SetUnitSonarStealth +
+
+ + + +
+
+ Spring.SetUnitSeismicSignature +
+
+ + + +
+
+ Spring.SetUnitAlwaysVisible +
+
+ + + +
+
+ Spring.SetUnitUseAirLos +
+
+ + + +
+
+ Spring.SetUnitMetalExtraction +
+
+ + + +
+
+ Spring.SetUnitHarvestStorage +
+
+ See also harvestStorage UnitDef tag. +
+
+ Spring.SetUnitBuildParams +
+
+ + + +
+
+ Spring.SetUnitBuildSpeed +
+
+ + + +
+
+ Spring.SetUnitNanoPieces +
+
+ + + +
+
+ Spring.SetUnitBlocking +
+
+ + + +
+
+ Spring.SetUnitCrashing +
+
+ + + +
+
+ Spring.SetUnitShieldState +
+
+ + + +
+
+ Spring.SetUnitShieldRechargeDelay +
+
+ + + +
+
+ Spring.SetUnitFlanking +
+
+ + + +
+
+ Spring.SetUnitNeutral +
+
+ + + +
+
+ Spring.SetUnitTarget +
+
+ Defines a unit's target. +
+
+ Spring.SetUnitTarget +
+
+ + + +
+
+ Spring.SetUnitMidAndAimPos +
+
+ + + +
+
+ Spring.SetUnitRadiusAndHeight +
+
+ + + +
+
+ Spring.SetUnitPieceParent +
+
+ Changes the pieces hierarchy of a unit by attaching a piece to a new parent. +
+
+ Spring.SetUnitPieceMatrix +
+
+ Sets the local (i.e. +
+
+ Spring.SetUnitCollisionVolumeData +
+
+ + + +
+
+ Spring.SetUnitPieceCollisionVolumeData +
+
+ + + +
+
+ Spring.SetUnitPieceVisible +
+
+ + + +
+
+ Spring.SetUnitSensorRadius +
+
+ + + +
+
+ Spring.SetUnitPosErrorParams +
+
+ + + +
+
+ Spring.SetUnitMoveGoal +
+
+ Used by default commands to get in build-, attackrange etc. +
+
+ Spring.SetUnitLandGoal +
+
+ Used in conjunction with Spring.UnitAttach et al. +
+
+ Spring.ClearUnitGoal +
+
+ + + +
+
+ Spring.SetUnitPhysics +
+
+ + + +
+
+ Spring.SetUnitMass +
+
+ + + +
+
+ Spring.SetUnitPosition +
+
+ + + +
+
+ Spring.SetUnitRotation +
+
+ + + +
+
+ Spring.SetUnitDirection +
+
+ + + +
+
+ Spring.SetUnitHeadingAndUpDir +
+
+ + + +
+
+ Spring.SetUnitVelocity +
+
+ + + +
+
+ Spring.SetFactoryBuggerOff +
+
+ + + +
+
+ Spring.BuggerOff +
+
+ + + +
+
+ Spring.AddUnitDamage +
+
+ + + +
+
+ Spring.AddUnitImpulse +
+
+ + + +
+
+ Spring.AddUnitSeismicPing +
+
+ + + +
+
+ Spring.AddUnitResource +
+
+ + + +
+
+ Spring.UseUnitResource +
+
+ + + +
+
+ Spring.UseUnitResource +
+
+ + + +
+
+

Decals

+
+
+ Spring.AddObjectDecal +
+
+ + + +
+
+ Spring.RemoveObjectDecal +
+
+ + + +
+
+

Grass

+
+
+ Spring.AddGrass +
+
+ + + +
+
+ Spring.RemoveGrass +
+
+ + + +
+
+

Feature Handling

+
+
+ Spring.CreateFeature +
+
+ + + +
+
+ Spring.DestroyFeature +
+
+ + + +
+
+ Spring.TransferFeature +
+
+ Feature Control +
+
+ Spring.SetFeatureAlwaysVisible +
+
+ + + +
+
+ Spring.SetFeatureUseAirLos +
+
+ + + +
+
+ Spring.SetFeatureHealth +
+
+ + + +
+
+ Spring.SetFeatureMaxHealth +
+
+ + + +
+
+ Spring.SetFeatureReclaim +
+
+ + + +
+
+ Spring.SetFeatureResources +
+
+ + + +
+
+ Spring.SetFeatureResurrect +
+
+ + + +
+
+ Spring.SetFeatureMoveCtrl +
+
+ + + +
+
+ Spring.SetFeaturePhysics +
+
+ + + +
+
+ Spring.SetFeatureMass +
+
+ + + +
+
+ Spring.SetFeaturePosition +
+
+ + + +
+
+ Spring.SetFeatureRotation +
+
+ + + +
+
+ Spring.SetFeatureDirection +
+
+ + + +
+
+ Spring.SetFeatureHeadingAndUpDir +
+
+ + + +
+
+ Spring.SetFeatureVelocity +
+
+ + + +
+
+ Spring.SetFeatureBlocking +
+
+ + + +
+
+ Spring.SetFeatureNoSelect +
+
+ + + +
+
+ Spring.SetFeatureMidAndAimPos +
+
+ + + +
+
+ Spring.SetFeatureRadiusAndHeight +
+
+ + + +
+
+ Spring.SetFeatureCollisionVolumeData +
+
+ + + +
+
+ Spring.SetFeaturePieceCollisionVolumeData +
+
+ + + +
+
+ Spring.SetFeaturePieceVisible +
+
+ + + +
+
+

Projectiles

+
+
+ projectileParams +
+
+ + + +
+
+ Spring.SetProjectileAlwaysVisible +
+
+ + + +
+
+ Spring.SetProjectileUseAirLos +
+
+ + + +
+
+ Spring.SetProjectileMoveControl +
+
+ Disables engine movecontrol, so lua can fully control the physics. +
+
+ Spring.SetProjectilePosition +
+
+ + + +
+
+ Spring.SetProjectileVelocity +
+
+ + + +
+
+ Spring.SetProjectileCollision +
+
+ + + +
+
+ Spring.SetProjectileTarget +
+
+ + + +
+
+ Spring.SetProjectileIsIntercepted +
+
+ + + +
+
+ Spring.SetProjectileDamages +
+
+ + + +
+
+ Spring.SetProjectileIgnoreTrackingError +
+
+ + + +
+
+ Spring.SetProjectileGravity +
+
+ + + +
+
+ Spring.SetPieceProjectileParams +
+
+ + + +
+
+

Give Order

+
+
+ cmdOpts +
+
+ Command Options params +
+
+ cmdSpec +
+
+ Command spec +
+
+ Spring.UnitFinishCommand +
+
+ + + +
+
+ Spring.GiveOrderToUnit +
+
+ + + +
+
+ Spring.GiveOrderToUnitMap +
+
+ + + +
+
+ Spring.GiveOrderToUnitArray +
+
+ + + +
+
+ Spring.GiveOrderArrayToUnit +
+
+ + + +
+
+ Spring.GiveOrderArrayToUnitMap +
+
+ + + +
+
+ Spring.GiveOrderArrayToUnitArray +
+
+ + + +
+
+

Heightmap

+
+
+ Spring.LevelHeightMap +
+
+ Set a certain height to a point or rectangle area on the world +
+
+ Spring.AdjustHeightMap +
+
+ Add a certain height to a point or rectangle area on the world +
+
+ Spring.RevertHeightMap +
+
+ Restore original map height to a point or rectangle area on the world +
+
+ Spring.AddHeightMap +
+
+ Can only be called in Spring.SetHeightMapFunc +
+
+ Spring.SetHeightMap +
+
+ + + +
+
+ Spring.SetHeightMapFunc +
+
+ + + +
+
+

Height Map/Smooth Mesh

+
+
+ Spring.LevelOriginalHeightMap +
+
+ Set a height to a point or rectangle area to the original map height cache +
+
+ Spring.AdjustOriginalHeightMap +
+
+ Add height to a point or rectangle area to the original map height cache +
+
+ Spring.RevertOriginalHeightMap +
+
+ Restore original map height cache to a point or rectangle area on the world +
+
+ Spring.AddOriginalHeightMap +
+
+ + + +
+
+ Spring.SetOriginalHeightMap +
+
+ + + +
+
+ Spring.SetOriginalHeightMapFunc +
+
+ + + +
+
+ Spring.LevelSmoothMesh +
+
+ + + +
+
+ Spring.AdjustSmoothMesh +
+
+ + + +
+
+ Spring.RevertSmoothMesh +
+
+ + + +
+
+ Spring.AddSmoothMesh +
+
+ Can only be called in Spring.SetSmoothMeshFunc. +
+
+ Spring.SetSmoothMesh +
+
+ Can only be called in Spring.SetSmoothMeshFunc. +
+
+ Spring.SetSmoothMeshFunc +
+
+ + + +
+
+

TerrainTypes

+
+
+ Spring.SetMapSquareTerrainType +
+
+ + + +
+
+ Spring.SetTerrainTypeData +
+
+ + + +
+
+ Spring.SetSquareBuildingMask +
+
+ + + +
+
+ Spring.UnitWeaponFire +
+
+ + + +
+
+ Spring.UnitAttach +
+
+ + + +
+
+ Spring.UnitDetach +
+
+ + + +
+
+ Spring.UnitDetachFromAir +
+
+ + + +
+
+ Spring.SetUnitLoadingTransport +
+
+ Disables collisions between the two units to allow colvol intersection during the approach. +
+
+ Spring.SpawnProjectile +
+
+ + + +
+
+ Spring.DeleteProjectile +
+
+ Silently removes projectiles (no explosion). +
+
+ explosionParams +
+
+ Parameters for explosion

+ +

Please note the explosion defaults to 1 damage regardless of what it's defined in the weaponDef. +

+
+ Spring.SpawnExplosion +
+
+ + + +
+
+ Spring.SpawnCEG +
+
+ + + +
+
+ Spring.SpawnSFX +
+
+ Equal to the UnitScript versions of EmitSFX, but takes position and direction arguments (in either unit- or piece-space) instead of a piece index. +
+
+

Other

+
+
+ Spring.SetNoPause +
+
+ + + +
+
+ Spring.SetExperienceGrade +
+
+ Defines how often Callins.UnitExperience will be called. +
+
+ Spring.SetRadarErrorParams +
+
+ + + +
+
+

Command Descriptions

+
+
+ Spring.EditUnitCmdDesc +
+
+ + + +
+
+ Spring.InsertUnitCmdDesc +
+
+ + + +
+
+ Spring.RemoveUnitCmdDesc +
+
+ + + +
+
+ +

+ Teams +

+ +

+ +


+

+

+ Spring.SetAlly(firstAllyTeamID, secondAllyTeamID, ally) +

+

Changes the value of the (one-sided) alliance between: firstAllyTeamID -> secondAllyTeamID.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + firstAllyTeamID + number + + + +
  2. +
  3. + secondAllyTeamID + number + + + +
  4. +
  5. + ally + bool + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetAllyTeamStartBox(allyTeamID, xMin, zMin, xMax, zMax) +

+

Changes the start box position of an allyTeam.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + allyTeamID + number + + + +
  2. +
  3. + xMin + number + left start box boundary (elmos) +
  4. +
  5. + zMin + number + top start box boundary (elmos) +
  6. +
  7. + xMax + number + right start box boundary (elmos) +
  8. +
  9. + zMax + number + bottom start box boundary (elmos) +
  10. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.AssignPlayerToTeam(playerID, teamID) +

+

Assigns a player to a team.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + playerID + number + + + +
  2. +
  3. + teamID + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetGlobalLos(allyTeamID, globallos) +

+

Changes access to global line of sight for a team and its allies.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + allyTeamID + number + + + +
  2. +
  3. + globallos + bool + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Game End +

+ +

+ Spring.KillTeam(teamID) +

+

Will declare a team to be dead (no further orders can be assigned to such teams units).

+
+

+ + + Gaia team cannot be killed. + +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.GameOver([allyTeamID1[, allyTeamID2[, allyTeamIDn]]]) +

+

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. + +

+ + +

Parameters:

+
    +
  1. + allyTeamID1 + number + + + + (optional) +
  2. +
  3. + allyTeamID2 + number + + + + (optional) +
  4. +
  5. + allyTeamIDn + number + + + + (optional) +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Resources +

+ +

+ Spring.SetTidal(strength) +

+

Set tidal strength

+
+

+ +

+ + +

Parameters:

+
    +
  1. + strength + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetWind(minStrength, maxStrength) +

+

Set wind strength

+
+

+ +

+ + +

Parameters:

+
    +
  1. + minStrength + number + + + +
  2. +
  3. + maxStrength + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.AddTeamResource(teamID, type, amount) +

+

Adds metal or energy resources to the specified team.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
  3. + type + string + "metal" | "energy" +
  4. +
  5. + amount + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.UseTeamResource(teamID, type, amount) +

+

Consumes metal and/or energy resources of the specified team.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
  3. + type + string + "metal" | "energy" +
  4. +
  5. + amount + number or table + { metal = number amount, energy = number amount } +
  6. +
+ +

Returns:

+
    +
  1. + nil or bool + hadEnough
  2. +
+ + + +
+

+ Spring.SetTeamResource(teamID, res, amount) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
  3. + res + string + "m" = metal "e" = energy "ms" = metal storage "es" = energy storage +
  4. +
  5. + amount + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetTeamShareLevel(teamID, type, amount) +

+

Changes the resource amount for a team beyond which resources aren't stored but transferred to other allied teams if possible.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
  3. + type + string + "metal" | "energy" +
  4. +
  5. + amount + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.ShareTeamResource(teamID_src, teamID_recv, type, amount) +

+

Transfers resources between two teams.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID_src + number + + + +
  2. +
  3. + teamID_recv + number + + + +
  4. +
  5. + type + string + "metal" | "energy" +
  6. +
  7. + amount + number + + + +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Rules Params +

+ +

+ +


+

+

+ losAccess +

+

Parameters for los access

+
+

+ + If one condition is fulfilled all beneath it are too (e.g. if an unit is in LOS it can read params with `inradar=true` even if the param has `inlos=false`) + All GameRulesParam are public, TeamRulesParams can just be `private`,`allied` and/or `public` + You can read RulesParams from any Lua enviroments! With those losAccess policies you can limit their access. + +

+ + +

Fields:

+
    +
  1. + private + bool + only readable by the ally (default) + (optional) +
  2. +
  3. + allied + bool + readable by ally + ingame allied + (optional) +
  4. +
  5. + inlos + bool + readable if the unit is in LOS + (optional) +
  6. +
  7. + inradar + bool + readable if the unit is in AirLOS + (optional) +
  8. +
  9. + public + bool + readable by all + (optional) +
  10. +
+ + + + +
+

+ Spring.SetGameRulesParam(paramName, paramValue[, losAccess]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + paramName + string + + + +
  2. +
  3. + paramValue + number or string + numeric paramValues in quotes will be converted to number. +
  4. +
  5. + losAccess + losAccess + + + + (optional) +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetTeamRulesParam(teamID, paramName, paramValue[, losAccess]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
  3. + paramName + string + + + +
  4. +
  5. + paramValue + number or string + numeric paramValues in quotes will be converted to number. +
  6. +
  7. + losAccess + losAccess + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetPlayerRulesParam(playerID, paramName, paramValue[, losAccess]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + playerID + number + + + +
  2. +
  3. + paramName + string + + + +
  4. +
  5. + paramValue + number or string + numeric paramValues in quotes will be converted to number. +
  6. +
  7. + losAccess + losAccess + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitRulesParam(unitID, paramName, paramValue[, losAccess]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + paramName + string + + + +
  4. +
  5. + paramValue + number or string + numeric paramValues in quotes will be converted to number. +
  6. +
  7. + losAccess + losAccess + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetFeatureRulesParam(featureID, paramName, paramValue[, losAccess]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + paramName + string + + + +
  4. +
  5. + paramValue + number or string + numeric paramValues in quotes will be converted to number. +
  6. +
  7. + losAccess + losAccess + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Lua to COB +

+ +

+ +


+

+

+ Spring.CallCOBScript(unitID, funcName, retArgs[, COBArg1[, COBArg2[, COBArgn]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + funcName + number or string + + + +
  4. +
  5. + retArgs + number + + + +
  6. +
  7. + COBArg1 + + + + (optional) +
  8. +
  9. + COBArg2 + + + + (optional) +
  10. +
  11. + COBArgn + + + + (optional) +
  12. +
+ +

Returns:

+
    +
  1. + nil or number + returnValue
  2. +
  3. + nil or number + returnArg1
  4. +
  5. + nil or number + returnArg2
  6. +
  7. + nil or number + returnArgn
  8. +
+ + + +
+

+ Spring.GetCOBScriptID(unitID, funcName) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + funcName + string + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil or number + funcID
  2. +
+ + + +
+

+ Unit Handling +

+ +

+ +


+

+

+ Spring.CreateUnit(unitDefName, x, y, z, facing, teamID[, build=false[, flattenGround=true[, unitID[, builderID]]]]) +

+

+
+

+ + + Offmap positions are clamped! Use MoveCtrl to move to such positions. + +

+ + +

Parameters:

+
    +
  1. + unitDefName + string or number + or unitDefID +
  2. +
  3. + x + number + + + +
  4. +
  5. + y + number + + + +
  6. +
  7. + z + number + + + +
  8. +
  9. + facing + string or number + possible values for facing are: "south" | "s" | 0, "east" | "e" | 1, "north" | "n" | 2, "west" | "w" | 3 +
  10. +
  11. + teamID + number + + + +
  12. +
  13. + build + bool + the unit is created in "being built" state with buildProgress = 0 + (default false) +
  14. +
  15. + flattenGround + bool + the unit flattens ground, if it normally does so + (default true) +
  16. +
  17. + unitID + number + requests specific unitID + (optional) +
  18. +
  19. + builderID + number + + + + (optional) +
  20. +
+ +

Returns:

+
    +
  1. + number or nil + unitID meaning unit was created
  2. +
+ + +

See also:

+ + +
+

+ Spring.DestroyUnit(unitID[, selfd=false[, reclaimed=false[, attackerID[, cleanupImmediately=false]]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + selfd + bool + makes the unit act like it self-destructed. + (default false) +
  4. +
  5. + reclaimed + bool + don't show any DeathSequences, don't leave a wreckage. This does not give back the resources to the team! + (default false) +
  6. +
  7. + attackerID + number + + + + (optional) +
  8. +
  9. + cleanupImmediately + bool + stronger version of reclaimed, removes the unit unconditionally and makes its ID available for immediate reuse (otherwise it takes a few frames) + (default false) +
  10. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + +

See also:

+ + +
+

+ Spring.TransferUnit(unitID, newTeamID[, given=true]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + newTeamID + number + + + +
  4. +
  5. + given + bool + if false, the unit is captured. + (default true) +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Unit Control +

+ +

+ +


+

+

+ Spring.SetUnitCosts(unitID, where) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + where + {[number]=number,...} + keys and values are, respectively and in this order: buildTime=amount, metalCost=amount, energyCost=amount +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Unit Resourcing +

+ +

+ Spring.SetUnitResourcing(unitID, res, amount) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + res + string + + + +
  4. +
  5. + amount + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitResourcing(unitID, res) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + res + {[string]=number,...} + keys are: "[u|c][u|m][m|e]" unconditional | conditional, use | make, metal | energy. Values are amounts +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitTooltip(unitID, tooltip) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + tooltip + string + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitHealth(unitID, health) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + health + number or {[string]=number,...} + where keys can be one of health|capture|paralyze|build and values are amounts +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitMaxHealth(unitID, maxHealth) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + maxHealth + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitStockpile(unitID[, stockpile[, buildPercent]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + stockpile + number + + + + (optional) +
  4. +
  5. + buildPercent + number + + + + (optional) +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitUseWeapons(unitID[, forceUseWeapons[, allowUseWeapons]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + forceUseWeapons + number + + + + (optional) +
  4. +
  5. + allowUseWeapons + number + + + + (optional) +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ states +

+

Parameter for weapon states

+
+

+ +

+ + +

Fields:

+
    +
  1. + reloadState + number + + + +
  2. +
  3. + reloadFrame + number + synonym for reloadState! +
  4. +
  5. + reloadTime + number + + + +
  6. +
  7. + accuracy + number + + + +
  8. +
  9. + sprayAngle + number + + + +
  10. +
  11. + range + number + if you change the range of a weapon with dynamic damage make sure you use SetUnitWeaponDamages to change dynDamageRange as well. +
  12. +
  13. + projectileSpeed + number + + + +
  14. +
  15. + burst + number + + + +
  16. +
  17. + burstRate + number + + + +
  18. +
  19. + projectiles + number + + + +
  20. +
  21. + salvoLeft + number + + + +
  22. +
  23. + nextSalvo + number + + + +
  24. +
  25. + aimReady + number + (<>0.0f := true) +
  26. +
+ + + + +
+

+ Spring.SetUnitWeaponState(unitID, weaponNum, states) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + weaponNum + number + + + +
  4. +
  5. + states + states + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitWeaponState(unitID, weaponNum, key, value) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + weaponNum + number + + + +
  4. +
  5. + key + string + + + +
  6. +
  7. + value + number + + + +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ damages +

+

Parameters for damage

+
+

+ +

+ + +

Fields:

+
    +
  1. + paralyzeDamageTime + number + + + +
  2. +
  3. + impulseFactor + number + + + +
  4. +
  5. + impulseBoost + number + + + +
  6. +
  7. + craterMult + number + + + +
  8. +
  9. + craterBoost + number + + + +
  10. +
  11. + dynDamageExp + number + + + +
  12. +
  13. + dynDamageMin + number + + + +
  14. +
  15. + dynDamageRange + number + + + +
  16. +
  17. + dynDamageInverted + number + (<>0.0f := true) +
  18. +
  19. + craterAreaOfEffect + number + + + +
  20. +
  21. + damageAreaOfEffect + number + + + +
  22. +
  23. + edgeEffectiveness + number + + + +
  24. +
  25. + explosionSpeed + number + + + +
  26. +
  27. + armorType + number + + + +
  28. +
+ + + + +
+

+ Spring.SetUnitWeaponDamages(unitID, weaponNum, damages) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + weaponNum + number or string + "selfDestruct" | "explode" +
  4. +
  5. + damages + damages + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitWeaponDamages(unitID, weaponNum, key, value) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + weaponNum + number or string + "selfDestruct" | "explode" +
  4. +
  5. + key + string + + + +
  6. +
  7. + value + number + + + +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitMaxRange(unitID, maxRange) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + maxRange + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitExperience(unitID, experience) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + experience + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + +

See also:

+ + +
+

+ Spring.AddUnitExperience(unitID, deltaExperience) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + deltaExperience + number + Can be negative to subtract, but the unit will never have negative total afterwards +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + +

See also:

+ + +
+

+ Spring.SetUnitArmored(unitID[, armored[, armorMultiple]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + armored + bool + + + + (optional) +
  4. +
  5. + armorMultiple + number + + + + (optional) +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Unit LOS +

+ +

+ +


+

+

+ Spring.SetUnitLosMask(unitID, allyTeam, losTypes) +

+

+
+

+ + + 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] + } + +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + allyTeam + number + + + +
  4. +
  5. + losTypes + number or table + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitLosState(unitID, allyTeam, los) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + allyTeam + number + + + +
  4. +
  5. + los + number or table + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitCloak(unitID, cloak, cloakArg) +

+

+
+

+ + + If the 2nd argument is a number, the value works like this: + 1:=normal cloak + 2:=for free cloak (cost no E) + 3:=for free + no decloaking (except the unit is stunned) + 4:=ultimative cloak (no ecost, no decloaking, no stunned decloak) + + The decloak distance is only changed: + - if the 3th argument is a number or a boolean. + - if the boolean is false it takes the default decloak distance for that unitdef, + - if the boolean is true it takes the absolute value of it. + +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + cloak + bool or number + + + +
  4. +
  5. + cloakArg + bool or number + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitStealth(unitID, stealth) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + stealth + bool + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitSonarStealth(unitID, sonarStealth) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + sonarStealth + bool + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitSeismicSignature(unitID, seismicSignature) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + seismicSignature + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitAlwaysVisible(unitID, alwaysVisible) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + alwaysVisible + bool + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitUseAirLos(unitID, useAirLos) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + useAirLos + bool + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitMetalExtraction(unitID, depth[, range]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + depth + number + corresponds to metal extraction rate +
  4. +
  5. + range + number + similar to "extractsMetal" in unitDefs. + (optional) +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitHarvestStorage(unitID, metal) +

+

See also harvestStorage UnitDef tag.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + metal + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitBuildParams(unitID, paramName, bool) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + paramName + string + one of buildRange|buildDistance|buildRange3D +
  4. +
  5. + bool + number + value bool when paramName is buildRange3D, number otherwise +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitBuildSpeed(builderID, buildSpeed[, repairSpeed[, reclaimSpeed[, captureSpeed[, terraformSpeed]]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + builderID + number + + + +
  2. +
  3. + buildSpeed + number + + + +
  4. +
  5. + repairSpeed + number + + + + (optional) +
  6. +
  7. + reclaimSpeed + number + + + + (optional) +
  8. +
  9. + captureSpeed + number + + + + (optional) +
  10. +
  11. + terraformSpeed + number + + + + (optional) +
  12. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitNanoPieces(builderID, pieces) +

+

+
+

+ + + This saves a lot of engine calls, by replacing: function script.QueryNanoPiece() return currentpiece end + Use it! + +

+ + +

Parameters:

+
    +
  1. + builderID + number + + + +
  2. +
  3. + pieces + table + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitBlocking(unitID, isblocking, isSolidObjectCollidable, isProjectileCollidable, isRaySegmentCollidable, crushable, blockEnemyPushing, blockHeightChanges) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + isblocking + bool + + + +
  4. +
  5. + isSolidObjectCollidable + bool + + + +
  6. +
  7. + isProjectileCollidable + bool + + + +
  8. +
  9. + isRaySegmentCollidable + bool + + + +
  10. +
  11. + crushable + bool + + + +
  12. +
  13. + blockEnemyPushing + bool + + + +
  14. +
  15. + blockHeightChanges + bool + + + +
  16. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitCrashing(unitID, crashing) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + crashing + bool + + + +
  4. +
+ +

Returns:

+
    +
  1. + bool + success
  2. +
+ + + +
+

+ Spring.SetUnitShieldState(unitID[, weaponID=-1[, enabled[, power]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + weaponID + number + + + + (default -1) +
  4. +
  5. + enabled + bool + + + + (optional) +
  6. +
  7. + power + number + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitShieldRechargeDelay(unitID[, weaponID[, rechargeTime]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + weaponID + number + (optional if the unit only has one shield) + (optional) +
  4. +
  5. + rechargeTime + number + (in seconds; emulates a regular hit if nil) + (optional) +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitFlanking(unitID, type, arg1[, y[, z]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + type + string + "dir"|"minDamage"|"maxDamage"|"moveFactor"|"mode" +
  4. +
  5. + arg1 + number + x|minDamage|maxDamage|moveFactor|mode +
  6. +
  7. + y + number + only when type is "dir" + (optional) +
  8. +
  9. + z + number + only when type is "dir" + (optional) +
  10. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitNeutral(unitID, neutral) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + neutral + bool + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil or bool + setNeutral
  2. +
+ + + +
+

+ Spring.SetUnitTarget(unitID[, enemyUnitID[, dgun=false[, userTarget=false[, weaponNum=-1]]]]) +

+

Defines a unit's target.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + enemyUnitID + number + when nil drops the units current target. + (optional) +
  4. +
  5. + dgun + bool + + + + (default false) +
  6. +
  7. + userTarget + bool + + + + (default false) +
  8. +
  9. + weaponNum + number + + + + (default -1) +
  10. +
+ +

Returns:

+
    +
  1. + bool + success
  2. +
+ + + +
+

+ Spring.SetUnitTarget(unitID[, x[, y[, z[, dgun=false[, userTarget=false[, weaponNum=-1]]]]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + x + number + when nil or not passed it will drop target and ignore other parameters + (optional) +
  4. +
  5. + y + number + + + + (optional) +
  6. +
  7. + z + number + + + + (optional) +
  8. +
  9. + dgun + bool + + + + (default false) +
  10. +
  11. + userTarget + bool + + + + (default false) +
  12. +
  13. + weaponNum + number + + + + (default -1) +
  14. +
+ +

Returns:

+
    +
  1. + bool + success
  2. +
+ + + +
+

+ Spring.SetUnitMidAndAimPos(unitID, mpX, mpY, mpZ, apX, apY, apZ[, relative=false]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + mpX + number + new middle positionX of unit +
  4. +
  5. + mpY + number + new middle positionY of unit +
  6. +
  7. + mpZ + number + new middle positionZ of unit +
  8. +
  9. + apX + number + new positionX that enemies aim at on this unit +
  10. +
  11. + apY + number + new positionY that enemies aim at on this unit +
  12. +
  13. + apZ + number + new positionZ that enemies aim at on this unit +
  14. +
  15. + relative + bool + are the new coordinates relative to world (false) or unit (true) coordinates? Also, note that apy is inverted! + (default false) +
  16. +
+ +

Returns:

+
    +
  1. + bool + success
  2. +
+ + + +
+

+ Spring.SetUnitRadiusAndHeight(unitID, radius, height) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + radius + number + + + +
  4. +
  5. + height + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + bool + success
  2. +
+ + + +
+

+ Spring.SetUnitPieceParent(unitID, AlteredPiece, ParentPiece) +

+

Changes the pieces hierarchy of a unit by attaching a piece to a new parent.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + AlteredPiece + number + + + +
  4. +
  5. + ParentPiece + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitPieceMatrix(unitID, pieceNum, matrix) +

+

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. + +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + pieceNum + number + + + +
  4. +
  5. + matrix + {number,...} + an array of 16 floats +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitCollisionVolumeData(unitID, scaleX, scaleY, scaleZ, offsetX, offsetY, offsetZ, vType, tType, Axis) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + scaleX + number + + + +
  4. +
  5. + scaleY + number + + + +
  6. +
  7. + scaleZ + number + + + +
  8. +
  9. + offsetX + number + + + +
  10. +
  11. + offsetY + number + + + +
  12. +
  13. + offsetZ + number + + + +
  14. +
  15. + vType + number + + + +
  16. +
  17. + tType + number + + + +
  18. +
  19. + Axis + number + + + +
  20. +
+ +

Returns:

+
    +
  1. + 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
    +};
    +
    +
  2. +
+ + + +
+

+ Spring.SetUnitPieceCollisionVolumeData(unitID, pieceIndex, enable, scaleX, scaleY, scaleZ, offsetX, offsetY, offsetZ[, volumeType[, primaryAxis]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + pieceIndex + number + + + +
  4. +
  5. + enable + bool + + + +
  6. +
  7. + scaleX + number + + + +
  8. +
  9. + scaleY + number + + + +
  10. +
  11. + scaleZ + number + + + +
  12. +
  13. + offsetX + number + + + +
  14. +
  15. + offsetY + number + + + +
  16. +
  17. + offsetZ + number + + + +
  18. +
  19. + volumeType + number + + + + (optional) +
  20. +
  21. + primaryAxis + number + + + + (optional) +
  22. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitPieceVisible(unitID, pieceIndex, visible) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + pieceIndex + number + + + +
  4. +
  5. + visible + bool + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitSensorRadius(unitID, type) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + type + string + "los" | "airLos" | "radar" | "sonar" | "seismic" | "radarJammer" | "sonarJammer" +
  4. +
+ +

Returns:

+
    +
  1. + nil or number + newRadius
  2. +
+ + + +
+

+ Spring.SetUnitPosErrorParams(unitID, posErrorVectorX, posErrorVectorY, posErrorVectorZ, posErrorDeltaX, posErrorDeltaY, posErrorDeltaZ[, nextPosErrorUpdate]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + posErrorVectorX + number + + + +
  4. +
  5. + posErrorVectorY + number + + + +
  6. +
  7. + posErrorVectorZ + number + + + +
  8. +
  9. + posErrorDeltaX + number + + + +
  10. +
  11. + posErrorDeltaY + number + + + +
  12. +
  13. + posErrorDeltaZ + number + + + +
  14. +
  15. + nextPosErrorUpdate + number + + + + (optional) +
  16. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitMoveGoal(unitID, goalX, goalY, goalZ[, goalRadius[, moveSpeed[, moveRaw]]]) +

+

Used by default commands to get in build-, attackrange etc.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + goalX + number + + + +
  4. +
  5. + goalY + number + + + +
  6. +
  7. + goalZ + number + + + +
  8. +
  9. + goalRadius + number + + + + (optional) +
  10. +
  11. + moveSpeed + number + + + + (optional) +
  12. +
  13. + moveRaw + bool + + + + (optional) +
  14. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitLandGoal(unitID, goalX, goalY, goalZ[, goalRadius]) +

+

Used in conjunction with Spring.UnitAttach et al.

+
+

+ to re-implement old airbase & fuel system in Lua. + +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + goalX + number + + + +
  4. +
  5. + goalY + number + + + +
  6. +
  7. + goalZ + number + + + +
  8. +
  9. + goalRadius + number + + + + (optional) +
  10. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.ClearUnitGoal(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitPhysics(unitID, posX, posY, posZ, velX, velY, velZ, rotX, rotY, rotZ, dragX, dragY, dragZ) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + posX + number + + + +
  4. +
  5. + posY + number + + + +
  6. +
  7. + posZ + number + + + +
  8. +
  9. + velX + number + + + +
  10. +
  11. + velY + number + + + +
  12. +
  13. + velZ + number + + + +
  14. +
  15. + rotX + number + + + +
  16. +
  17. + rotY + number + + + +
  18. +
  19. + rotZ + number + + + +
  20. +
  21. + dragX + number + + + +
  22. +
  23. + dragY + number + + + +
  24. +
  25. + dragZ + number + + + +
  26. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitMass(unitID, mass) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + mass + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitPosition(unitID, x, z[, alwaysAboveSea]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + x + number + + + +
  4. +
  5. + z + number + + + +
  6. +
  7. + alwaysAboveSea + bool + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitRotation(unitID, yaw, pitch, roll) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + yaw + number + + + +
  4. +
  5. + pitch + number + + + +
  6. +
  7. + roll + number + + + +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitDirection(unitID, x, y, z) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + x + number + + + +
  4. +
  5. + y + number + + + +
  6. +
  7. + z + number + + + +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitHeadingAndUpDir(unitID, heading, upx, upy, upz) +

+

+
+

+ + 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. +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + heading + number + + + +
  4. +
  5. + upx + number + + + +
  6. +
  7. + upy + number + + + +
  8. +
  9. + upz + number + + + +
  10. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitVelocity(unitID, velX, velY, velZ) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + velX + number + + + +
  4. +
  5. + velY + number + + + +
  6. +
  7. + velZ + number + + + +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetFactoryBuggerOff(unitID[, buggerOff[, offset[, radius[, relHeading[, spherical[, forced]]]]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + buggerOff + bool + + + + (optional) +
  4. +
  5. + offset + number + + + + (optional) +
  6. +
  7. + radius + number + + + + (optional) +
  8. +
  9. + relHeading + number + + + + (optional) +
  10. +
  11. + spherical + bool + + + + (optional) +
  12. +
  13. + forced + bool + + + + (optional) +
  14. +
+ +

Returns:

+
    +
  1. + nil or number + buggerOff
  2. +
+ + + +
+

+ Spring.BuggerOff(x, y[, z], radius, teamID[, spherical=true[, forced=true[, excludeUnitID[, excludeUnitDefIDs]]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + y + number + + + +
  4. +
  5. + z + number + uses ground height when unspecified + (optional) +
  6. +
  7. + radius + number + + + +
  8. +
  9. + teamID + number + + + +
  10. +
  11. + spherical + bool + + + + (default true) +
  12. +
  13. + forced + bool + + + + (default true) +
  14. +
  15. + excludeUnitID + number + + + + (optional) +
  16. +
  17. + excludeUnitDefIDs + {[number],...} + + + + (optional) +
  18. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.AddUnitDamage(unitID, damage[, paralyze=0[, attackerID=-1[, weaponID=-1[, impulseX[, impulseY[, impulseZ]]]]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + damage + number + + + +
  4. +
  5. + paralyze + number + equals to the paralyzetime in the WeaponDef. + (default 0) +
  6. +
  7. + attackerID + number + + + + (default -1) +
  8. +
  9. + weaponID + number + + + + (default -1) +
  10. +
  11. + impulseX + number + + + + (optional) +
  12. +
  13. + impulseY + number + + + + (optional) +
  14. +
  15. + impulseZ + number + + + + (optional) +
  16. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.AddUnitImpulse(unitID, x, y, z[, decayRate]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + x + number + + + +
  4. +
  5. + y + number + + + +
  6. +
  7. + z + number + + + +
  8. +
  9. + decayRate + number + + + + (optional) +
  10. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.AddUnitSeismicPing(unitID, pindSize) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + pindSize + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.AddUnitResource(unitID, resource, amount) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + resource + string + "m" | "e" +
  4. +
  5. + amount + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.UseUnitResource(unitID, resource, amount) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + resource + string + "m" | "e" +
  4. +
  5. + amount + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil or bool + okay
  2. +
+ + + +
+

+ Spring.UseUnitResource(unitID, resources) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + resources + {[string]=number,...} + where keys are one of "m"|"metal"|"e"|"energy" and values are amounts +
  4. +
+ +

Returns:

+
    +
  1. + nil or bool + okay
  2. +
+ + + +
+

+ Decals +

+ +

+ +


+

+

+ Spring.AddObjectDecal(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.RemoveObjectDecal(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Grass +

+ +

+ +


+

+

+ Spring.AddGrass(x, z) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + z + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.RemoveGrass(x, z) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + z + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Feature Handling +

+ +

+ +


+

+

+ Spring.CreateFeature(featureDef, x, y, z[, heading[, AllyTeamID[, featureID]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureDef + string or number + name or id +
  2. +
  3. + x + number + + + +
  4. +
  5. + y + number + + + +
  6. +
  7. + z + number + + + +
  8. +
  9. + heading + number + + + + (optional) +
  10. +
  11. + AllyTeamID + number + + + + (optional) +
  12. +
  13. + featureID + number + + + + (optional) +
  14. +
+ +

Returns:

+
    +
  1. + number + featureID
  2. +
+ + + +
+

+ Spring.DestroyFeature(featureDefID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureDefID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.TransferFeature(featureDefID, teamID) +

+

Feature Control

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureDefID + number + + + +
  2. +
  3. + teamID + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetFeatureAlwaysVisible(featureID, enable) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + enable + bool + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetFeatureUseAirLos(featureID, useAirLos) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + useAirLos + bool + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetFeatureHealth(featureID, health) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + health + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetFeatureMaxHealth(featureID, maxHealth) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + maxHealth + number + minimum 0.1 +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetFeatureReclaim(featureID, reclaimLeft) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + reclaimLeft + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetFeatureResources(featureID, metal, energy[, reclaimTime[, reclaimLeft[, featureDefMetal[, featureDefEnergy]]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + metal + number + + + +
  4. +
  5. + energy + number + + + +
  6. +
  7. + reclaimTime + number + + + + (optional) +
  8. +
  9. + reclaimLeft + number + + + + (optional) +
  10. +
  11. + featureDefMetal + number + + + + (optional) +
  12. +
  13. + featureDefEnergy + number + + + + (optional) +
  14. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetFeatureResurrect(featureID, unitDef[, facing[, progress]]) +

+

+
+

+ + + Second param can now be a number id instead of a string name, this also allows cancelling ressurection by passing -1. + The level of progress can now be set via the additional 4th param. + Possible values for facing are: + "south" | "s" | 0 + "east" | "e" | 1 + "north" | "n" | 2 + "west" | "w" | 3 + +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + unitDef + string or number + id or name +
  4. +
  5. + facing + string or number + + + + (optional) +
  6. +
  7. + progress + number + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetFeatureMoveCtrl(featureID[, enable[, arg1[, arg2[, argn]]]]) +

+

+
+

+ + + 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. + +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + enable + bool + + + + (optional) +
  4. +
  5. + arg1 + number + + + + (optional) +
  6. +
  7. + arg2 + number + + + + (optional) +
  8. +
  9. + argn + number + + + + (optional) +
  10. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetFeaturePhysics(featureID, posX, posY, posZ, velX, velY, velZ, rotX, rotY, rotZ, dragX, dragY, dragZ) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + posX + number + + + +
  4. +
  5. + posY + number + + + +
  6. +
  7. + posZ + number + + + +
  8. +
  9. + velX + number + + + +
  10. +
  11. + velY + number + + + +
  12. +
  13. + velZ + number + + + +
  14. +
  15. + rotX + number + + + +
  16. +
  17. + rotY + number + + + +
  18. +
  19. + rotZ + number + + + +
  20. +
  21. + dragX + number + + + +
  22. +
  23. + dragY + number + + + +
  24. +
  25. + dragZ + number + + + +
  26. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetFeatureMass(featureID, mass) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + mass + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetFeaturePosition(featureID, x, y, z[, snapToGround]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + x + number + + + +
  4. +
  5. + y + number + + + +
  6. +
  7. + z + number + + + +
  8. +
  9. + snapToGround + bool + + + + (optional) +
  10. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetFeatureRotation(featureID, rotX, rotY, rotZ) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + rotX + number + + + +
  4. +
  5. + rotY + number + + + +
  6. +
  7. + rotZ + number + + + +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetFeatureDirection(featureID, dirX, dirY, dirZ) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + dirX + number + + + +
  4. +
  5. + dirY + number + + + +
  6. +
  7. + dirZ + number + + + +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetFeatureHeadingAndUpDir(featureID, heading, upx, upy, upz) +

+

+
+

+ + 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. +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + heading + number + + + +
  4. +
  5. + upx + number + + + +
  6. +
  7. + upy + number + + + +
  8. +
  9. + upz + number + + + +
  10. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetFeatureVelocity(featureID, velX, velY, velZ) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + velX + number + + + +
  4. +
  5. + velY + number + + + +
  6. +
  7. + velZ + number + + + +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetFeatureBlocking(featureID, isBlocking, isSolidObjectCollidable, isProjectileCollidable, isRaySegmentCollidable, crushable, blockEnemyPushing, blockHeightChanges) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + isBlocking + bool + + + +
  4. +
  5. + isSolidObjectCollidable + bool + + + +
  6. +
  7. + isProjectileCollidable + bool + + + +
  8. +
  9. + isRaySegmentCollidable + bool + + + +
  10. +
  11. + crushable + bool + + + +
  12. +
  13. + blockEnemyPushing + bool + + + +
  14. +
  15. + blockHeightChanges + bool + + + +
  16. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetFeatureNoSelect(featureID, noSelect) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + noSelect + bool + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetFeatureMidAndAimPos(featureID, mpX, mpY, mpZ, apX, apY, apZ[, relative]) +

+

+
+

+ + + Check `Spring.SetUnitMidAndAimPos` for further explanation of the arguments. + +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + mpX + number + + + +
  4. +
  5. + mpY + number + + + +
  6. +
  7. + mpZ + number + + + +
  8. +
  9. + apX + number + + + +
  10. +
  11. + apY + number + + + +
  12. +
  13. + apZ + number + + + +
  14. +
  15. + relative + bool + + + + (optional) +
  16. +
+ +

Returns:

+
    +
  1. + bool + success
  2. +
+ + + +
+

+ Spring.SetFeatureRadiusAndHeight(featureID, radius, height) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + radius + number + + + +
  4. +
  5. + height + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + bool + success
  2. +
+ + + +
+

+ Spring.SetFeatureCollisionVolumeData(featureID, scaleX, scaleY, scaleZ, offsetX, offsetY, offsetZ, vType, tType, Axis) +

+

+
+

+ + + Check `Spring.SetUnitCollisionVolumeData` for further explanation of the arguments. + +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + scaleX + number + + + +
  4. +
  5. + scaleY + number + + + +
  6. +
  7. + scaleZ + number + + + +
  8. +
  9. + offsetX + number + + + +
  10. +
  11. + offsetY + number + + + +
  12. +
  13. + offsetZ + number + + + +
  14. +
  15. + vType + number + + + +
  16. +
  17. + tType + number + + + +
  18. +
  19. + Axis + number + + + +
  20. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetFeaturePieceCollisionVolumeData(featureID, pieceIndex, enable, scaleX, scaleY, scaleZ, offsetX, offsetY, offsetZ, Axis, volumeType[, primaryAxis]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + pieceIndex + number + + + +
  4. +
  5. + enable + bool + + + +
  6. +
  7. + scaleX + number + + + +
  8. +
  9. + scaleY + number + + + +
  10. +
  11. + scaleZ + number + + + +
  12. +
  13. + offsetX + number + + + +
  14. +
  15. + offsetY + number + + + +
  16. +
  17. + offsetZ + number + + + +
  18. +
  19. + Axis + number + + + +
  20. +
  21. + volumeType + number + + + +
  22. +
  23. + primaryAxis + number + + + + (optional) +
  24. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetFeaturePieceVisible(featureID, pieceIndex, visible) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + pieceIndex + number + + + +
  4. +
  5. + visible + bool + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Projectiles +

+ +

+ +


+

+

+ projectileParams +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. pos + + +
      +
    • + x + number + + + +
    • +
    • + y + number + + + +
    • +
    • + z + number + + + +
    • +
    +
  2. end + + +
      +
    • + x + number + + + +
    • +
    • + y + number + + + +
    • +
    • + z + number + + + +
    • +
    +
  3. speed + + +
      +
    • + x + number + + + +
    • +
    • + y + number + + + +
    • +
    • + z + number + + + +
    • +
    +
  4. spread + + +
      +
    • + x + number + + + +
    • +
    • + y + number + + + +
    • +
    • + z + number + + + +
    • +
    +
  5. error + + +
      +
    • + x + number + + + +
    • +
    • + y + number + + + +
    • +
    • + z + number + + + +
    • +
    +
  6. + owner + number + + + +
  7. +
  8. + team + number + + + +
  9. +
  10. + ttl + number + + + +
  11. +
  12. + gravity + number + + + +
  13. +
  14. + tracking + number + + + +
  15. +
  16. + maxRange + number + + + +
  17. +
  18. + startAlpha + number + + + +
  19. +
  20. + endAlpha + number + + + +
  21. +
  22. + model + string + + + +
  23. +
  24. + cegTag + string + + + +
  25. +
+ + + + +
+

+ Spring.SetProjectileAlwaysVisible(projectileID, alwaysVisible) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
  3. + alwaysVisible + bool + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetProjectileUseAirLos(projectileID, useAirLos) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
  3. + useAirLos + bool + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetProjectileMoveControl(projectileID, enable) +

+

Disables engine movecontrol, so lua can fully control the physics.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
  3. + enable + bool + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetProjectilePosition(projectileID[, posX=0[, posY=0[, posZ=0]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
  3. + posX + number + + + + (default 0) +
  4. +
  5. + posY + number + + + + (default 0) +
  6. +
  7. + posZ + number + + + + (default 0) +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetProjectileVelocity(projectileID[, velX=0[, velY=0[, velZ=0]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
  3. + velX + number + + + + (default 0) +
  4. +
  5. + velY + number + + + + (default 0) +
  6. +
  7. + velZ + number + + + + (default 0) +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetProjectileCollision(projectileID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetProjectileTarget(projectileID[, arg1=0[, arg2=0[, posZ=0]]]) +

+

+
+

+ + + 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 + +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
  3. + arg1 + number + targetID or posX + (default 0) +
  4. +
  5. + arg2 + number + targetType or posY + (default 0) +
  6. +
  7. + posZ + number + + + + (default 0) +
  8. +
+ +

Returns:

+
    +
  1. + nil or bool + validTarget
  2. +
+ + + +
+

+ Spring.SetProjectileIsIntercepted(projectileID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetProjectileDamages(unitID, weaponNum, key, value) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + weaponNum + number + + + +
  4. +
  5. + key + string + + + +
  6. +
  7. + value + number + + + +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetProjectileIgnoreTrackingError(projectileID, ignore) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
  3. + ignore + bool + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetProjectileGravity(projectileID[, grav=0]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
  3. + grav + number + + + + (default 0) +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetPieceProjectileParams(projectileID[, explosionFlags[, spinAngle[, spinSpeed[, spinVectorX[, spinVectorY[, spinVectorZ]]]]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
  3. + explosionFlags + number + + + + (optional) +
  4. +
  5. + spinAngle + number + + + + (optional) +
  6. +
  7. + spinSpeed + number + + + + (optional) +
  8. +
  9. + spinVectorX + number + + + + (optional) +
  10. +
  11. + spinVectorY + number + + + + (optional) +
  12. +
  13. + spinVectorZ + number + + + + (optional) +
  14. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Give Order +

+ +

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.

+

+ cmdOpts +

+

Command Options params

+
+

+ +

+ + +

Fields:

+
    +
  1. + right + bool + Right mouse key pressed +
  2. +
  3. + alt + bool + Alt key pressed +
  4. +
  5. + ctrl + bool + Ctrl key pressed +
  6. +
  7. + shift + bool + Shift key pressed +
  8. +
+ + + + +
+

+ cmdSpec +

+

Command spec

+
+

+ + + Used when assigning multiple commands at once + +

+ + +

Fields:

+
    +
  1. + cmdID + number + + + +
  2. +
  3. + params + {number,...} + + + +
  4. +
  5. + options + cmdOpts + + + +
  6. +
+ + + + +
+

+ Spring.UnitFinishCommand(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.GiveOrderToUnit(unitID, cmdID, params, cmdOpts) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + cmdID + number + + + +
  4. +
  5. + params + {number,...} + + + +
  6. +
  7. + cmdOpts + cmdOpts + + + +
  8. +
+ +

Returns:

+
    +
  1. + bool + unitOrdered
  2. +
+ + + +
+

+ Spring.GiveOrderToUnitMap(unitMap, cmdID, params, cmdOpts) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitMap + {[number]=table,...} + table with unitIDs as keys +
  2. +
  3. + cmdID + number + + + +
  4. +
  5. + params + {number,...} + + + +
  6. +
  7. + cmdOpts + cmdOpts + + + +
  8. +
+ +

Returns:

+
    +
  1. + number + unitsOrdered
  2. +
+ + + +
+

+ Spring.GiveOrderToUnitArray(unitIDs, cmdID, params, cmdOpts) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitIDs + {number,...} + + + +
  2. +
  3. + cmdID + number + + + +
  4. +
  5. + params + {number,...} + + + +
  6. +
  7. + cmdOpts + cmdOpts + + + +
  8. +
+ +

Returns:

+
    +
  1. + number + unitsOrdered
  2. +
+ + + +
+

+ Spring.GiveOrderArrayToUnit(unitID, cmdArray) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + cmdArray + {cmdSpec,...} + + + +
  4. +
+ +

Returns:

+
    +
  1. + bool + ordersGiven
  2. +
+ + + +
+

+ Spring.GiveOrderArrayToUnitMap(unitMap, orderArray) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitMap + {[number]=table} + table with unitIDs as keys +
  2. +
  3. + orderArray + {cmdSpec,...} + + + +
  4. +
+ +

Returns:

+
    +
  1. + number + unitsOrdered
  2. +
+ + + +
+

+ Spring.GiveOrderArrayToUnitArray(unitArray, orderArray) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitArray + {number,...} + containing unitIDs +
  2. +
  3. + orderArray + {cmdSpec,...} + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Heightmap +

+ +

+ +

Note that x & z coords are in worldspace (Game.mapSizeX/Z), still the heightmap resolution is Game.squareSize.

+
+

+

+ Spring.LevelHeightMap(x1, z1, x2_height[, z2[, height]]) +

+

Set a certain height to a point or rectangle area on the world

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x1 + number + + + +
  2. +
  3. + z1 + number + + + +
  4. +
  5. + x2_height + number + if y2 and height are nil then this parameter is the height +
  6. +
  7. + z2 + number + + + + (optional) +
  8. +
  9. + height + number + + + + (optional) +
  10. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.AdjustHeightMap(x1, y1, x2_height[, y2[, height]]) +

+

Add a certain height to a point or rectangle area on the world

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x1 + number + + + +
  2. +
  3. + y1 + number + + + +
  4. +
  5. + x2_height + number + if y2 and height are nil then this parameter is the height +
  6. +
  7. + y2 + number + + + + (optional) +
  8. +
  9. + height + number + + + + (optional) +
  10. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.RevertHeightMap(x1, y1, x2_factor[, y2[, factor]]) +

+

Restore original map height to a point or rectangle area on the world

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x1 + number + + + +
  2. +
  3. + y1 + number + + + +
  4. +
  5. + x2_factor + number + if y2 and factor are nil then this parameter is the factor +
  6. +
  7. + y2 + number + + + + (optional) +
  8. +
  9. + factor + number + + + + (optional) +
  10. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.AddHeightMap(x, z, height) +

+

Can only be called in `Spring.SetHeightMapFunc`

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + z + number + + + +
  4. +
  5. + height + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil or number + newHeight
  2. +
+ + + +
+

+ Spring.SetHeightMap(x, z, height[, terraform=1]) +

+

+
+

+ + + Can only be called in `Spring.SetHeightMapFunc`. The terraform argument is + +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + z + number + + + +
  4. +
  5. + height + number + + + +
  6. +
  7. + terraform + number + a scaling factor. + (default 1) +
  8. +
+ +

Returns:

+
    +
  1. + nil or number + absHeightDiff =0 nothing will be changed (the terraform starts) and if =1 the terraform will be finished.
  2. +
+ + + +
+

+ Spring.SetHeightMapFunc(lua_function[, arg1[, arg2[, argn]]]) +

+

+
+

+ + + Example code: + + function Spring.SetHeightMapFunc(function() + for z=0,Game.mapSizeZ, Game.squareSize do + for x=0,Game.mapSizeX, Game.squareSize do + Spring.SetHeightMap( x, z, 200 + 20 * math.cos((x + z) / 90) ) + end + end + end) + +

+ + +

Parameters:

+
    +
  1. + lua_function + func + + + +
  2. +
  3. + arg1 + + + + (optional) +
  4. +
  5. + arg2 + + + + (optional) +
  6. +
  7. + argn + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + nil or number + absTotalHeightMapAmountChanged
  2. +
+ + + +
+

+ Height Map/Smooth Mesh +

+ +

+ +


+

+

+ Spring.LevelOriginalHeightMap(x1, y1, x2_height[, y2[, height]]) +

+

Set a height to a point or rectangle area to the original map height cache

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x1 + number + + + +
  2. +
  3. + y1 + number + + + +
  4. +
  5. + x2_height + number + if y2 and height are nil then this parameter is the height +
  6. +
  7. + y2 + number + + + + (optional) +
  8. +
  9. + height + number + + + + (optional) +
  10. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.AdjustOriginalHeightMap(x1, y1, x2_height[, y2[, height]]) +

+

Add height to a point or rectangle area to the original map height cache

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x1 + number + + + +
  2. +
  3. + y1 + number + + + +
  4. +
  5. + x2_height + number + if y2 and height are nil then this parameter is the height +
  6. +
  7. + y2 + number + + + + (optional) +
  8. +
  9. + height + number + + + + (optional) +
  10. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.RevertOriginalHeightMap(x1, y1, x2_factor[, y2[, factor]]) +

+

Restore original map height cache to a point or rectangle area on the world

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x1 + number + + + +
  2. +
  3. + y1 + number + + + +
  4. +
  5. + x2_factor + number + if y2 and factor are nil then this parameter is the factor +
  6. +
  7. + y2 + number + + + + (optional) +
  8. +
  9. + factor + number + + + + (optional) +
  10. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.AddOriginalHeightMap(x, y, height) +

+

+
+

+ + + Can only be called in `Spring.SetOriginalHeightMapFunc` + +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + y + number + + + +
  4. +
  5. + height + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetOriginalHeightMap(x, y, height[, factor]) +

+

+
+

+ + + Can only be called in `Spring.SetOriginalHeightMapFunc` + +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + y + number + + + +
  4. +
  5. + height + number + + + +
  6. +
  7. + factor + number + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetOriginalHeightMapFunc(heightMapFunc) +

+

+
+

+ + + Cannot recurse on itself + +

+ + +

Parameters:

+
    +
  1. + heightMapFunc + func + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.LevelSmoothMesh(x1, z1[, x2][, z2], height) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x1 + number + + + +
  2. +
  3. + z1 + number + + + +
  4. +
  5. + x2 + number + + + + (optional) +
  6. +
  7. + z2 + number + + + + (optional) +
  8. +
  9. + height + number + + + +
  10. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.AdjustSmoothMesh(x1, z1[, x2][, z2], height) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x1 + number + + + +
  2. +
  3. + z1 + number + + + +
  4. +
  5. + x2 + number + + + + (optional) +
  6. +
  7. + z2 + number + + + + (optional) +
  8. +
  9. + height + number + + + +
  10. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.RevertSmoothMesh(x1, z1[, x2][, z2], origFactor) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x1 + number + + + +
  2. +
  3. + z1 + number + + + +
  4. +
  5. + x2 + number + + + + (optional) +
  6. +
  7. + z2 + number + + + + (optional) +
  8. +
  9. + origFactor + number + + + +
  10. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.AddSmoothMesh(x, z, height) +

+

Can only be called in `Spring.SetSmoothMeshFunc`.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + z + number + + + +
  4. +
  5. + height + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil or number + newHeight
  2. +
+ + + +
+

+ Spring.SetSmoothMesh(x, z, height[, terraform=1]) +

+

Can only be called in `Spring.SetSmoothMeshFunc`.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + z + number + + + +
  4. +
  5. + height + number + + + +
  6. +
  7. + terraform + number + + + + (default 1) +
  8. +
+ +

Returns:

+
    +
  1. + nil or number + absHeightDiff
  2. +
+ + + +
+

+ Spring.SetSmoothMeshFunc(lua_function, arg1, arg2, argn) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + lua_function + func + + + +
  2. +
  3. + arg1 + [opt] +
  4. +
  5. + arg2 + [opt] +
  6. +
  7. + argn + [opt] +
  8. +
+ +

Returns:

+
    +
  1. + nil or number + absTotalHeightMapAmountChanged
  2. +
+ + + +
+

+ TerrainTypes +

+ +

+ +


+

+

+ Spring.SetMapSquareTerrainType(x, z, newType) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + z + number + + + +
  4. +
  5. + newType + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil or number + oldType
  2. +
+ + + +
+

+ Spring.SetTerrainTypeData(typeIndex[, speedTanks=nil[, speedKBOts=nil[, speedHovers=nil[, speedShips=nil]]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + typeIndex + number + + + +
  2. +
  3. + speedTanks + number + + + + (default nil) +
  4. +
  5. + speedKBOts + number + + + + (default nil) +
  6. +
  7. + speedHovers + number + + + + (default nil) +
  8. +
  9. + speedShips + number + + + + (default nil) +
  10. +
+ +

Returns:

+
    +
  1. + nil or bool + true
  2. +
+ + + +
+

+ Spring.SetSquareBuildingMask(x, z, mask) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + z + number + + + +
  4. +
  5. + mask + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil + See also buildingMask unitdef tag.
  2. +
+ + + +
+

+ Spring.UnitWeaponFire(unitID, weaponID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + weaponID + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.UnitAttach(transporterID, passengerID, pieceNum) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + transporterID + number + + + +
  2. +
  3. + passengerID + number + + + +
  4. +
  5. + pieceNum + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.UnitDetach(passengerID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + passengerID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.UnitDetachFromAir(passengerID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + passengerID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitLoadingTransport(passengerID, transportID) +

+

Disables collisions between the two units to allow colvol intersection during the approach.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + passengerID + number + + + +
  2. +
  3. + transportID + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SpawnProjectile(weaponDefID, projectileParams) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + weaponDefID + number + + + +
  2. +
  3. + projectileParams + projectileParams + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil or number + projectileID
  2. +
+ + + +
+

+ Spring.DeleteProjectile(projectileID) +

+

Silently removes projectiles (no explosion).

+
+

+ +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ explosionParams +

+

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. + +

+ + +

Fields:

+
    +
  1. + weaponDef + number + + + +
  2. +
  3. + owner + number + + + +
  4. +
  5. + hitUnit + number + + + +
  6. +
  7. + hitFeature + number + + + +
  8. +
  9. + craterAreaOfEffect + number + + + +
  10. +
  11. + damageAreaOfEffect + number + + + +
  12. +
  13. + edgeEffectiveness + number + + + +
  14. +
  15. + explosionSpeed + number + + + +
  16. +
  17. + gfxMod + number + + + +
  18. +
  19. + impactOnly + bool + + + +
  20. +
  21. + ignoreOwner + bool + + + +
  22. +
  23. + damageGround + bool + + + +
  24. +
+ + + + +
+

+ Spring.SpawnExplosion([posX=0][, posY=0][, posZ=0][, dirX=0][, dirY=0][, dirZ=0], explosionParams) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + posX + number + + + + (default 0) +
  2. +
  3. + posY + number + + + + (default 0) +
  4. +
  5. + posZ + number + + + + (default 0) +
  6. +
  7. + dirX + number + + + + (default 0) +
  8. +
  9. + dirY + number + + + + (default 0) +
  10. +
  11. + dirZ + number + + + + (default 0) +
  12. +
  13. + explosionParams + explosionParams + + + +
  14. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SpawnCEG(cegname[, posX=0[, posY=0[, posZ=0[, dirX=0[, dirY=0[, dirZ=0[, radius=0[, damage=0]]]]]]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + cegname + string + + + +
  2. +
  3. + posX + number + + + + (default 0) +
  4. +
  5. + posY + number + + + + (default 0) +
  6. +
  7. + posZ + number + + + + (default 0) +
  8. +
  9. + dirX + number + + + + (default 0) +
  10. +
  11. + dirY + number + + + + (default 0) +
  12. +
  13. + dirZ + number + + + + (default 0) +
  14. +
  15. + radius + number + + + + (default 0) +
  16. +
  17. + damage + number + + + + (default 0) +
  18. +
+ +

Returns:

+
    +
  1. + nil or bool + success
  2. +
  3. + number + cegID
  4. +
+ + + +
+

+ Spring.SpawnSFX([unitID=0[, sfxID=0[, posX=0[, posY=0[, posZ=0[, dirX=0[, dirY=0[, dirZ=0[, radius=0[, damage=0[, absolute]]]]]]]]]]]) +

+

Equal to the UnitScript versions of EmitSFX, but takes position and direction arguments (in either unit- or piece-space) instead of a piece index.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + + (default 0) +
  2. +
  3. + sfxID + number + + + + (default 0) +
  4. +
  5. + posX + number + + + + (default 0) +
  6. +
  7. + posY + number + + + + (default 0) +
  8. +
  9. + posZ + number + + + + (default 0) +
  10. +
  11. + dirX + number + + + + (default 0) +
  12. +
  13. + dirY + number + + + + (default 0) +
  14. +
  15. + dirZ + number + + + + (default 0) +
  16. +
  17. + radius + number + + + + (default 0) +
  18. +
  19. + damage + number + + + + (default 0) +
  20. +
  21. + absolute + bool + + + + (optional) +
  22. +
+ +

Returns:

+
    +
  1. + nil or bool + success
  2. +
+ + + +
+

+ Other +

+ +

+ +


+

+

+ Spring.SetNoPause(noPause) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + noPause + bool + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetExperienceGrade(expGrade[, ExpPowerScale[, ExpHealthScale[, ExpReloadScale]]]) +

+

Defines how often `Callins.UnitExperience` will be called.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + expGrade + number + + + +
  2. +
  3. + ExpPowerScale + number + + + + (optional) +
  4. +
  5. + ExpHealthScale + number + + + + (optional) +
  6. +
  7. + ExpReloadScale + number + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetRadarErrorParams(allyTeamID, allyteamErrorSize[, baseErrorSize[, baseErrorMult]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + allyTeamID + number + + + +
  2. +
  3. + allyteamErrorSize + number + + + +
  4. +
  5. + baseErrorSize + number + + + + (optional) +
  6. +
  7. + baseErrorMult + number + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Command Descriptions +

+ +

+ +

Doesn't work in unsynced code!

+
+

+

+ Spring.EditUnitCmdDesc(unitID, cmdDescID, cmdArray) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + cmdDescID + number + + + +
  4. +
  5. + cmdArray + table + +

    structure of cmdArray:

    +
     {
    +   [ id          = int ],
    +   [ type        = int ],
    +   [ name        = string ],
    +   [ action      = string ],
    +   [ tooltip     = string ],
    +   [ texture     = string ],
    +   [ cursor      = string ],
    +   [ queueing    = boolean ],
    +   [ hidden      = boolean ],
    +   [ disabled    = boolean ],
    +   [ showUnique  = boolean ],
    +   [ onlyTexture = boolean ],
    +   [ params      = { string = string, ... } ]
    + }
    +
    + +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.InsertUnitCmdDesc(unitID[, cmdDescID], cmdArray) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + cmdDescID + number + + + + (optional) +
  4. +
  5. + cmdArray + table + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.RemoveUnitCmdDesc(unitID[, cmdDescID]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + cmdDescID + number + + + + (optional) +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+ +{% endraw %} diff --git a/ldoc/modules/SyncedRead.html b/ldoc/modules/SyncedRead.html new file mode 100644 index 0000000000..915bba9bf2 --- /dev/null +++ b/ldoc/modules/SyncedRead.html @@ -0,0 +1,10576 @@ +--- +layout: default +title: SyncedRead +permalink: ldoc/modules/SyncedRead.html +description: Synced Read +parent: Lua API +table: 0x55a54e6a42b0 +--- + +{% raw %} +

Module SyncedRead

+

Synced Read

+

+ +


+

+

See also:

+ + +

Teams

+
+
+ Spring.GetGaiaTeamID +
+
+ + + +
+
+ Spring.GetAllyTeamStartBox +
+
+ + + +
+
+ Spring.GetTeamStartPosition +
+
+ + + +
+
+ xyz +
+
+ Cartesian triple (XYZ) +
+
+ Spring.GetMapStartPositions +
+
+ + + +
+
+ Spring.GetAllyTeamList +
+
+ + + +
+
+ Spring.GetTeamList +
+
+ + + +
+
+ Spring.GetPlayerList +
+
+ + + +
+
+ Spring.GetTeamInfo +
+
+ + + +
+
+ Spring.GetTeamAllyTeamID +
+
+ + + +
+
+ Spring.GetTeamResources +
+
+ + + +
+
+ Spring.GetTeamUnitStats +
+
+ + + +
+
+ Spring.GetTeamResourceStats +
+
+ + + +
+
+ teamStats +
+
+ + + +
+
+ Spring.GetTeamStatsHistory +
+
+ + + +
+
+ Spring.GetTeamLuaAI +
+
+ + + +
+
+ Spring.GetPlayerInfo +
+
+ + + +
+
+ Spring.GetPlayerControlledUnit +
+
+ Returns unit controlled by player on FPS mode +
+
+ Spring.GetAIInfo +
+
+ + + +
+
+ Spring.GetAllyTeamInfo +
+
+ + + +
+
+ Spring.AreTeamsAllied +
+
+ + + +
+
+ Spring.ArePlayersAllied +
+
+ + + +
+
+

Misc

+
+
+ Spring.GetUnitEstimatedPath +
+
+ + + +
+
+ Spring.GetUnitLastAttacker +
+
+ + + +
+
+ Spring.GetUnitLastAttackedPiece +
+
+ + + +
+
+ Spring.GetUnitCollisionVolumeData +
+
+ + + +
+
+ Spring.GetUnitSeparation +
+
+ + + +
+
+ Spring.GetUnitFeatureSeparation +
+
+ + + +
+
+ Spring.GetUnitDefDimensions +
+
+ + + +
+
+ Spring.GetCEGID +
+
+ + + +
+
+ Spring.GetUnitBlocking +
+
+ + + +
+
+ Spring.GetUnitMoveTypeData +
+
+ + + +
+
+ Spring.GetUnitCurrentCommand +
+
+ + + +
+
+ Spring.GetUnitCommands +
+
+ + + +
+
+ Spring.GetFactoryCommands +
+
+ + + +
+
+ Spring.GetFactoryBuggerOff +
+
+ + + +
+
+ Spring.GetFactoryCounts +
+
+ + + +
+
+ Spring.GetCommandQueue +
+
+ + + +
+
+ Spring.GetFullBuildQueue +
+
+ + + +
+
+ Spring.GetRealBuildQueue +
+
+ + + +
+
+ Spring.GetUnitCmdDescs +
+
+ + + +
+
+ Spring.FindUnitCmdDesc +
+
+ + + +
+
+ Spring.ValidFeatureID +
+
+ + + +
+
+ Spring.GetAllFeatures +
+
+ + + +
+
+ Spring.GetFeatureDefID +
+
+ + + +
+
+ Spring.GetFeatureTeam +
+
+ + + +
+
+ Spring.GetFeatureAllyTeam +
+
+ + + +
+
+ Spring.GetFeatureHealth +
+
+ + + +
+
+ Spring.GetFeatureHeight +
+
+ + + +
+
+ Spring.GetFeatureRadius +
+
+ + + +
+
+ Spring.GetFeatureMass +
+
+ + + +
+
+ Spring.GetFeaturePosition +
+
+ + + +
+
+ Spring.GetFeatureSeparation +
+
+ + + +
+
+ Spring.GetFeatureRotation +
+
+ + + +
+
+ Spring.GetFeatureDirection +
+
+ + + +
+
+ Spring.GetFeatureVelocity +
+
+ + + +
+
+ Spring.GetFeatureHeading +
+
+ + + +
+
+ Spring.GetFeatureResources +
+
+ + + +
+
+ Spring.GetFeatureBlocking +
+
+ + + +
+
+ Spring.GetFeatureNoSelect +
+
+ + + +
+
+ Spring.GetFeatureResurrect +
+
+ + + +
+
+ Spring.GetFeatureLastAttackedPiece +
+
+ + + +
+
+ Spring.GetFeatureCollisionVolumeData +
+
+ + + +
+
+ Spring.GetFeaturePieceCollisionVolumeData +
+
+ + + +
+
+ Spring.GetRadarErrorParams +
+
+ + + +
+
+

Game States

+
+
+ Spring.IsCheatingEnabled +
+
+ + + +
+
+ Spring.IsGodModeEnabled +
+
+ + + +
+
+ Spring.IsDevLuaEnabled +
+
+ + + +
+
+ Spring.IsEditDefsEnabled +
+
+ + + +
+
+ Spring.IsNoCostEnabled +
+
+ + + +
+
+ Spring.GetGlobalLos +
+
+ + + +
+
+ Spring.AreHelperAIsEnabled +
+
+ + + +
+
+ Spring.FixedAllies +
+
+ + + +
+
+ Spring.IsGameOver +
+
+ + + +
+
+

Speed/Time

+
+
+ Spring.GetGameFrame +
+
+ + + +
+
+ Spring.GetGameSeconds +
+
+ + + +
+
+

Environment

+
+
+ Spring.GetTidal +
+
+ + + +
+
+ Spring.GetWind +
+
+ + + +
+
+

Rules/Params

+
+
+ Spring.GetGameRulesParams +
+
+ + + +
+
+ Spring.GetTeamRulesParams +
+
+ + + +
+
+ Spring.GetPlayerRulesParams +
+
+ + + +
+
+ Spring.GetUnitRulesParams +
+
+ + + +
+
+ Spring.GetFeatureRulesParams +
+
+ + + +
+
+ Spring.GetGameRulesParam +
+
+ + + +
+
+ Spring.GetTeamRulesParam +
+
+ + + +
+
+ Spring.GetPlayerRulesParam +
+
+ + + +
+
+ Spring.GetUnitRulesParam +
+
+ + + +
+
+ Spring.GetFeatureRulesParam +
+
+ + + +
+
+

Mod and Map options

+
+
+ Spring.GetMapOptions +
+
+ + + +
+
+ Spring.GetModOptions +
+
+ + + +
+
+

Vectors

+
+
+ Spring.GetHeadingFromVector +
+
+ + + +
+
+ Spring.GetVectorFromHeading +
+
+ + + +
+
+ Spring.GetFacingFromHeading +
+
+ + + +
+
+ Spring.GetHeadingFromFacing +
+
+ + + +
+
+

Sides and Factions

+
+
+ sideSpec +
+
+ Side spec +
+
+ Spring.GetSideData +
+
+ + + +
+
+ Spring.GetSideData +
+
+ + + +
+
+ Spring.GetSideData +
+
+ + + +
+
+

Unit queries

+
+
+ Spring.GetAllUnits +
+
+ Get a list of all unitIDs +
+
+ Spring.GetTeamUnits +
+
+ + + +
+
+ Spring.GetTeamUnitsSorted +
+
+ + + +
+
+ Spring.GetTeamUnitsCounts +
+
+ + + +
+
+ Spring.GetTeamUnitsByDefs +
+
+ + + +
+
+ Spring.GetTeamUnitDefCount +
+
+ + + +
+
+ Spring.GetTeamUnitCount +
+
+ + + +
+
+

Spatial unit queries

+
+
+ Spring.GetUnitsInRectangle +
+
+ + + +
+
+ Spring.GetUnitsInBox +
+
+ + + +
+
+ Spring.GetUnitsInCylinder +
+
+ + + +
+
+ Spring.GetUnitsInSphere +
+
+ + + +
+
+ planeSpec +
+
+ + + +
+
+ Spring.GetUnitsInPlanes +
+
+ + + +
+
+ Spring.GetUnitNearestAlly +
+
+ + + +
+
+ Spring.GetUnitNearestEnemy +
+
+ + + +
+
+

Spatial feature queries

+
+
+ Spring.GetFeaturesInRectangle +
+
+ + + +
+
+ Spring.GetFeaturesInSphere +
+
+ + + +
+
+ Spring.GetFeaturesInCylinder +
+
+ + + +
+
+ Spring.GetProjectilesInRectangle +
+
+ + + +
+
+

Unit state

+
+
+ Spring.ValidUnitID +
+
+ + + +
+
+ unitState +
+
+ + + +
+
+ Spring.GetUnitStates +
+
+ + + +
+
+ Spring.GetUnitArmored +
+
+ + + +
+
+ Spring.GetUnitIsActive +
+
+ + + +
+
+ Spring.GetUnitIsCloaked +
+
+ + + +
+
+ Spring.GetUnitSeismicSignature +
+
+ + + +
+
+ Spring.GetUnitSelfDTime +
+
+ + + +
+
+ Spring.GetUnitStockpile +
+
+ + + +
+
+ Spring.GetUnitSensorRadius +
+
+ + + +
+
+ Spring.GetUnitPosErrorParams +
+
+ + + +
+
+ Spring.GetUnitTooltip +
+
+ + + +
+
+ Spring.GetUnitDefID +
+
+ + + +
+
+ Spring.GetUnitTeam +
+
+ + + +
+
+ Spring.GetUnitAllyTeam +
+
+ + + +
+
+ Spring.GetUnitNeutral +
+
+ Checks if a unit is neutral (NOT Gaia!) +
+
+ Spring.GetUnitHealth +
+
+ + + +
+
+ Spring.GetUnitIsDead +
+
+ + + +
+
+ Spring.GetUnitIsStunned +
+
+ + + +
+
+ Spring.GetUnitIsBeingBuilt +
+
+ + + +
+
+ Spring.GetUnitResources +
+
+ + + +
+
+ Spring.GetUnitMetalExtraction +
+
+ + + +
+
+ Spring.GetUnitExperience +
+
+ + + +
+
+ Spring.GetUnitHeight +
+
+ + + +
+
+ Spring.GetUnitRadius +
+
+ + + +
+
+ Spring.GetUnitMass +
+
+ + + +
+
+ Spring.GetUnitPosition +
+
+ + + +
+
+ Spring.GetUnitBasePosition +
+
+ + + +
+
+ Spring.GetUnitVectors +
+
+ + + +
+
+ Spring.GetUnitRotation +
+
+ + + +
+
+ Spring.GetUnitDirection +
+
+ + + +
+
+ Spring.GetUnitHeading +
+
+ + + +
+
+ Spring.GetUnitVelocity +
+
+ + + +
+
+ Spring.GetUnitBuildFacing +
+
+ + + +
+
+ Spring.GetUnitIsBuilding +
+
+ Checks whether a unit is currently building another (NOT for checking if it's a structure) +
+
+ Spring.GetUnitWorkerTask +
+
+ Checks a builder's current task +
+
+ Spring.GetUnitEffectiveBuildRange +
+
+ + + +
+
+ Spring.GetUnitCurrentBuildPower +
+
+ + + +
+
+ Spring.GetUnitHarvestStorage +
+
+ + + +
+
+ Spring.GetUnitBuildParams +
+
+ + + +
+
+ Spring.GetUnitInBuildStance +
+
+ + + +
+
+ Spring.GetUnitNanoPieces +
+
+ + + +
+
+ Spring.GetUnitTransporter +
+
+ + + +
+
+ Spring.GetUnitIsTransporting +
+
+ + + +
+
+ Spring.GetUnitShieldState +
+
+ + + +
+
+ Spring.GetUnitFlanking +
+
+ + + +
+
+ Spring.GetUnitMaxRange +
+
+ + + +
+
+

Unit weapon state

+
+
+ Spring.GetUnitWeaponState +
+
+ + + +
+
+ Spring.GetUnitWeaponDamages +
+
+ + + +
+
+ Spring.GetUnitWeaponVectors +
+
+ + + +
+
+ Spring.GetUnitWeaponTryTarget +
+
+ + + +
+
+ Spring.GetUnitWeaponTestTarget +
+
+ + + +
+
+ Spring.GetUnitWeaponTestRange +
+
+ + + +
+
+ Spring.GetUnitWeaponHaveFreeLineOfFire +
+
+ + + +
+
+ Spring.GetUnitWeaponCanFire +
+
+ + + +
+
+ Spring.GetUnitWeaponTarget +
+
+ + + +
+
+

Projectile state

+
+
+ Spring.GetProjectilePosition +
+
+ + + +
+
+ Spring.GetProjectileDirection +
+
+ + + +
+
+ Spring.GetProjectileVelocity +
+
+ + + +
+
+ Spring.GetProjectileGravity +
+
+ + + +
+
+ Spring.GetPieceProjectileParams +
+
+ + + +
+
+ Spring.GetProjectileTarget +
+
+ + + +
+
+ Spring.GetProjectileIsIntercepted +
+
+ + + +
+
+ Spring.GetProjectileTimeToLive +
+
+ + + +
+
+ Spring.GetProjectileOwnerID +
+
+ + + +
+
+ Spring.GetProjectileTeamID +
+
+ + + +
+
+ Spring.GetProjectileAllyTeamID +
+
+ + + +
+
+ Spring.GetProjectileType +
+
+ + + +
+
+ Spring.GetProjectileDefID +
+
+ + + +
+
+ Spring.GetProjectileDamages +
+
+ + + +
+
+ Spring.GetProjectileName +
+
+ + + +
+
+

Ground

+
+
+ Spring.IsPosInMap +
+
+ + + +
+
+ Spring.GetGroundHeight +
+
+ + + +
+
+ Spring.GetGroundOrigHeight +
+
+ + + +
+
+ Spring.GetGroundNormal +
+
+ + + +
+
+ Spring.GetGroundInfo +
+
+ + + +
+
+ Spring.GetGroundBlocked +
+
+ + + +
+
+ Spring.GetGroundExtremes +
+
+ + + +
+
+ Spring.GetTerrainTypeData +
+
+ + + +
+
+ Spring.GetGrass +
+
+ + + +
+
+ Spring.GetSmoothMeshHeight +
+
+ + + +
+
+

Tests

+
+
+ Spring.TestMoveOrder +
+
+ + + +
+
+ Spring.TestBuildOrder +
+
+ + + +
+
+ Spring.Pos2BuildPos +
+
+ Snaps a position to the building grid +
+
+ Spring.ClosestBuildPos +
+
+ + + +
+
+

Visibility

+
+
+ Spring.GetPositionLosState +
+
+ + + +
+
+ Spring.IsPosInLos +
+
+ + + +
+
+ Spring.IsPosInRadar +
+
+ + + +
+
+ Spring.IsPosInAirLos +
+
+ + + +
+
+ Spring.GetUnitLosState +
+
+ + + +
+
+ Spring.IsUnitInLos +
+
+ + + +
+
+ Spring.IsUnitInAirLos +
+
+ + + +
+
+ Spring.IsUnitInRadar +
+
+ + + +
+
+ Spring.IsUnitInJammer +
+
+ + + +
+
+

Piece/Script

+
+
+ pieceSpec +
+
+ Piece spec +
+
+ Spring.GetModelRootPiece +
+
+ + + +
+
+ Spring.GetModelPieceMap +
+
+ + + +
+
+ Spring.GetModelPieceList +
+
+ + + +
+
+ Spring.GetUnitRootPiece +
+
+ + + +
+
+ Spring.GetUnitPieceMap +
+
+ + + +
+
+ Spring.GetUnitPieceList +
+
+ + + +
+
+ Spring.GetUnitPieceInfo +
+
+ + + +
+
+ Spring.GetUnitPiecePosDir +
+
+ + + +
+
+ Spring.GetUnitPiecePosition +
+
+ + + +
+
+ Spring.GetUnitPieceDirection +
+
+ + + +
+
+ Spring.GetUnitPieceMatrix +
+
+ + + +
+
+ Spring.GetFeatureRootPiece +
+
+ + + +
+
+ Spring.GetFeaturePieceMap +
+
+ + + +
+
+ Spring.GetFeaturePieceList +
+
+ + + +
+
+ Spring.GetFeaturePieceInfo +
+
+ + + +
+
+ Spring.GetFeaturePiecePosDir +
+
+ + + +
+
+ Spring.GetFeaturePiecePosition +
+
+ + + +
+
+ Spring.GetFeaturePieceDirection +
+
+ + + +
+
+ Spring.GetFeaturePieceMatrix +
+
+ + + +
+
+ Spring.GetUnitScriptPiece +
+
+ + + +
+
+ Spring.GetUnitScriptNames +
+
+ + + +
+
+ +

+ Teams +

+ +

+ +


+

+

+ Spring.GetGaiaTeamID() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + teamID
  2. +
+ + + +
+

+ Spring.GetAllyTeamStartBox(allyID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + allyID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + number + xMin
  2. +
  3. + number + zMin
  4. +
  5. + number + xMax
  6. +
  7. + number + zMax
  8. +
+ + + +
+

+ Spring.GetTeamStartPosition(teamID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + number + x
  2. +
  3. + number + y
  4. +
  5. + number + x
  6. +
+ + + +
+

+ xyz +

+

Cartesian triple (XYZ)

+
+

+ +

+ + +

Fields:

+
    +
  1. + x + number + + + +
  2. +
  3. + y + number + + + +
  4. +
  5. + z + number + + + +
  6. +
+ + + + +
+

+ Spring.GetMapStartPositions() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + {xyz,...} + array of positions indexed by teamID
  2. +
+ + + +
+

+ Spring.GetAllyTeamList() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + {number,...} + list of allyTeamIDs
  2. +
+ + + +
+

+ Spring.GetTeamList([allyTeamID=-1]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + allyTeamID + number + to filter teams belonging to when >= 0 + (default -1) +
  2. +
+ +

Returns:

+
    +
  1. + nil or {number,...} + list of teamIDs
  2. +
+ + + +
+

+ Spring.GetPlayerList([teamID=-1[, active=false]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + to filter by when >= 0 + (default -1) +
  2. +
  3. + active + bool + whether to filter only active teams + (default false) +
  4. +
+ +

Returns:

+
    +
  1. + nil or {number,...} + list of playerIDs
  2. +
+ + + +
+

+ Spring.GetTeamInfo(teamID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + teamID
  2. +
  3. + number + leader
  4. +
  5. + number + isDead
  6. +
  7. + string + side
  8. +
  9. + number + allyTeam
  10. +
  11. + number + incomeMultiplier
  12. +
  13. + {[string]=string,...} + customTeamKeys
  14. +
+ + + +
+

+ Spring.GetTeamAllyTeamID(teamID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or allyTeamID + + +
  2. +
+ + + +
+

+ Spring.GetTeamResources(teamID, resource) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
  3. + resource + string + one of "m(etal)?|e(nergy)?" +
  4. +
+ +

Returns:

+
    +
  1. + nil or number + currentLevel
  2. +
  3. + number + storage
  4. +
  5. + number + pull
  6. +
  7. + number + income
  8. +
  9. + number + expense
  10. +
  11. + number + share
  12. +
  13. + number + sent
  14. +
  15. + number + received
  16. +
+ + + +
+

+ Spring.GetTeamUnitStats(teamID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + killed
  2. +
  3. + number + died
  4. +
  5. + number + capturedBy
  6. +
  7. + number + capturedFrom
  8. +
  9. + number + received
  10. +
  11. + number + sent
  12. +
+ + + +
+

+ Spring.GetTeamResourceStats(teamID, resource) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
  3. + resource + string + one of "m(etal)?|e(nergy)?" +
  4. +
+ +

Returns:

+
    +
  1. + nil or number + used
  2. +
  3. + number + produced
  4. +
  5. + number + excessed
  6. +
  7. + number + received
  8. +
  9. + number + sent
  10. +
+ + + +
+

+ teamStats +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + time + number + + + +
  2. +
  3. + frame + number + + + +
  4. +
  5. + metalUsed + number + + + +
  6. +
  7. + metalProduced + number + + + +
  8. +
  9. + metalExcess + number + + + +
  10. +
  11. + metalReceived + number + + + +
  12. +
  13. + metalSent + number + + + +
  14. +
  15. + energyUsed + number + + + +
  16. +
  17. + energyProduced + number + + + +
  18. +
  19. + energyExcess + number + + + +
  20. +
  21. + energyReceived + number + + + +
  22. +
  23. + energySent + number + + + +
  24. +
  25. + damageDealt + number + + + +
  26. +
  27. + damageReceived + number + + + +
  28. +
  29. + unitsProduced + number + + + +
  30. +
  31. + unitsDied + number + + + +
  32. +
  33. + unitsReceived + number + + + +
  34. +
  35. + unitsSent + number + + + +
  36. +
  37. + unitsCaptured + number + + + +
  38. +
  39. + unitsOutCaptured + number + + + +
  40. +
+ + + + +
+

+ Spring.GetTeamStatsHistory(teamID[, startIndex[, endIndex=startIndex]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
  3. + startIndex + number + when not specified return the number of history entries + (optional) +
  4. +
  5. + endIndex + number + + + + (default startIndex) +
  6. +
+ +

Returns:

+
    +
  1. + nil, number or {teamStats,...} + + +
  2. +
+ + + +
+

+ Spring.GetTeamLuaAI(teamID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + string + + +
  2. +
+ + + +
+

+ Spring.GetPlayerInfo(playerID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + playerID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or string + name
  2. +
  3. + bool + active
  4. +
  5. + bool + spectator
  6. +
  7. + number + teamID
  8. +
  9. + number + allyTeamID
  10. +
  11. + number + pingTime
  12. +
  13. + number + cpuUsage
  14. +
  15. + string + country
  16. +
  17. + number + rank
  18. +
  19. + {[string]=string} + customPlayerKeys
  20. +
+ + + +
+

+ Spring.GetPlayerControlledUnit(playerID) +

+

Returns unit controlled by player on FPS mode

+
+

+ +

+ + +

Parameters:

+
    +
  1. + playerID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + + +
  2. +
+ + + +
+

+ Spring.GetAIInfo(teamID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + number + skirmishAIID
  2. +
  3. + string + name
  4. +
  5. + number + hostingPlayerID
  6. +
  7. + string + shortName when synced "SYNCED_NOSHORTNAME", otherwise the AI shortname or "UNKNOWN"
  8. +
  9. + string + version when synced "SYNCED_NOVERSION", otherwise the AI version or "UNKNOWN"
  10. +
  11. + {[string]=string,...} + options
  12. +
+ + + +
+

+ Spring.GetAllyTeamInfo(allyTeamID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + allyTeamID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or {[string]=string,...} + + +
  2. +
+ + + +
+

+ Spring.AreTeamsAllied(teamID1, teamID2) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID1 + number + + + +
  2. +
  3. + teamID2 + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil or bool + + +
  2. +
+ + + +
+

+ Spring.ArePlayersAllied(playerID1, playerID2) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + playerID1 + number + + + +
  2. +
  3. + playerID2 + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil or bool + + +
  2. +
+ + + +
+

+ Misc +

+ +

+ +


+

+

+ Spring.GetUnitEstimatedPath(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitLastAttacker(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitLastAttackedPiece(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitCollisionVolumeData(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitSeparation(unitID1, unitID2[, direction=false[, subtractRadii=false]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID1 + number + + + +
  2. +
  3. + unitID2 + number + + + +
  4. +
  5. + direction + bool + to subtract from, default unitID1 - unitID2 + (default false) +
  6. +
  7. + subtractRadii + bool + whether units radii should be subtracted from the total + (default false) +
  8. +
+ +

Returns:

+
    +
  1. + nil or number + + +
  2. +
+ + + +
+

+ Spring.GetUnitFeatureSeparation(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitDefDimensions(unitDefID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitDefID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetCEGID() +

+

+
+

+ +

+ + + + + + +
+

+ Spring.GetUnitBlocking(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + isBlocking
  2. +
  3. + bool + isSolidObjectCollidable
  4. +
  5. + bool + isProjectileCollidable
  6. +
  7. + bool + isRaySegmentCollidable
  8. +
  9. + bool + crushable
  10. +
  11. + bool + blockEnemyPushing
  12. +
  13. + bool + blockHeightChanges
  14. +
+ + + +
+

+ Spring.GetUnitMoveTypeData(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitCurrentCommand() +

+

+
+

+ +

+ + + + + + +
+

+ Spring.GetUnitCommands(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetFactoryCommands(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetFactoryBuggerOff(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetFactoryCounts(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetCommandQueue(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetFullBuildQueue(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetRealBuildQueue(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitCmdDescs(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.FindUnitCmdDesc(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.ValidFeatureID(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + bool + + +
  2. +
+ + + +
+

+ Spring.GetAllFeatures() +

+

+
+

+ +

+ + + + + + +
+

+ Spring.GetFeatureDefID(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + + +
  2. +
+ + + +
+

+ Spring.GetFeatureTeam(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + + +
  2. +
+ + + +
+

+ Spring.GetFeatureAllyTeam(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + + +
  2. +
+ + + +
+

+ Spring.GetFeatureHealth(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + health
  2. +
  3. + number + defHealth
  4. +
  5. + number + resurrectProgress
  6. +
+ + + +
+

+ Spring.GetFeatureHeight(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + + +
  2. +
+ + + +
+

+ Spring.GetFeatureRadius(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + + +
  2. +
+ + + +
+

+ Spring.GetFeatureMass(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + + +
  2. +
+ + + +
+

+ Spring.GetFeaturePosition(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetFeatureSeparation(featureID1, featureID2[, direction=false]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID1 + number + + + +
  2. +
  3. + featureID2 + number + + + +
  4. +
  5. + direction + bool + to subtract from, default featureID1 - featureID2 + (default false) +
  6. +
+ +

Returns:

+
    +
  1. + nil or number + + +
  2. +
+ + + +
+

+ Spring.GetFeatureRotation(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + pitch, rotation in X axis
  2. +
  3. + number + yaw, rotation in Y axis
  4. +
  5. + number + roll, rotation in Z axis
  6. +
+ + + +
+

+ Spring.GetFeatureDirection(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or dirX + + +
  2. +
  3. + dirY + + +
  4. +
  5. + dirZ + + +
  6. +
+ + + +
+

+ Spring.GetFeatureVelocity(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetFeatureHeading(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetFeatureResources(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + metal
  2. +
  3. + number + defMetal
  4. +
  5. + number + energy
  6. +
  7. + number + defEnergy
  8. +
  9. + number + reclaimLeft
  10. +
  11. + number + reclaimTime
  12. +
+ + + +
+

+ Spring.GetFeatureBlocking(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + isBlocking
  2. +
  3. + bool + isSolidObjectCollidable
  4. +
  5. + bool + isProjectileCollidable
  6. +
  7. + bool + isRaySegmentCollidable
  8. +
  9. + bool + crushable
  10. +
  11. + bool + blockEnemyPushing
  12. +
  13. + bool + blockHeightChanges
  14. +
+ + + +
+

+ Spring.GetFeatureNoSelect(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + + +
  2. +
+ + + +
+

+ Spring.GetFeatureResurrect(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetFeatureLastAttackedPiece(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetFeatureCollisionVolumeData(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetFeaturePieceCollisionVolumeData(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetRadarErrorParams(allyTeamID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + allyTeamID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + radarErrorSize actual radar error size (when allyTeamID is allied to current team) or base radar error size
  2. +
  3. + number + baseRadarErrorSize
  4. +
  5. + number + baseRadarErrorMult
  6. +
+ + + +
+

+ Game States +

+ +

+ +


+

+

+ Spring.IsCheatingEnabled() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + bool + enabled
  2. +
+ + + +
+

+ Spring.IsGodModeEnabled() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + bool + enabled
  2. +
+ + + +
+

+ Spring.IsDevLuaEnabled() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + bool + enabled
  2. +
+ + + +
+

+ Spring.IsEditDefsEnabled() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + bool + enabled
  2. +
+ + + +
+

+ Spring.IsNoCostEnabled() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + bool + enabled
  2. +
+ + + +
+

+ Spring.GetGlobalLos([teamID]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + + (optional) +
  2. +
+ +

Returns:

+
    +
  1. + bool + enabled
  2. +
+ + + +
+

+ Spring.AreHelperAIsEnabled() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + bool + enabled
  2. +
+ + + +
+

+ Spring.FixedAllies() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + bool or nil + enabled
  2. +
+ + + +
+

+ Spring.IsGameOver() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + bool + isGameOver
  2. +
+ + + +
+

+ Speed/Time +

+ +

+ +


+

+

+ Spring.GetGameFrame() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + t1 frameNum % dayFrames
  2. +
  3. + number + t2 frameNum / dayFrames
  4. +
+ + + +
+

+ Spring.GetGameSeconds() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + seconds
  2. +
+ + + +
+

+ Environment +

+ +

+ +


+

+

+ Spring.GetTidal() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + tidalStrength
  2. +
+ + + +
+

+ Spring.GetWind() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + windStrength
  2. +
+ + + +
+

+ Rules/Params +

+ +

+ + +

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!)

+
+

+

+ Spring.GetGameRulesParams() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + {[string] + = number,...} rulesParams map with rules names as key and values as values
  2. +
+ + + +
+

+ Spring.GetTeamRulesParams(teamID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + {[string] + = number,...} rulesParams map with rules names as key and values as values
  2. +
+ + + +
+

+ Spring.GetPlayerRulesParams(playerID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + playerID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + {[string] + = number,...} rulesParams map with rules names as key and values as values
  2. +
+ + + +
+

+ Spring.GetUnitRulesParams(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + {[string] + = number,...} rulesParams map with rules names as key and values as values
  2. +
+ + + +
+

+ Spring.GetFeatureRulesParams(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + {[string] + = number,...} rulesParams map with rules names as key and values as values
  2. +
+ + + +
+

+ Spring.GetGameRulesParam(ruleRef) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + ruleRef + number or string + the rule index or name +
  2. +
+ +

Returns:

+
    +
  1. + nil, number or string + value
  2. +
+ + + +
+

+ Spring.GetTeamRulesParam(teamID, ruleRef) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
  3. + ruleRef + number or string + the rule index or name +
  4. +
+ +

Returns:

+
    +
  1. + nil, number or string + value
  2. +
+ + + +
+

+ Spring.GetPlayerRulesParam(playerID, ruleRef) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + playerID + number + + + +
  2. +
  3. + ruleRef + number or string + the rule index or name +
  4. +
+ +

Returns:

+
    +
  1. + nil, number or string + value
  2. +
+ + + +
+

+ Spring.GetUnitRulesParam(unitID, ruleRef) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + ruleRef + number or string + the rule index or name +
  4. +
+ +

Returns:

+
    +
  1. + nil, number or string + value
  2. +
+ + + +
+

+ Spring.GetFeatureRulesParam(featureID, ruleRef) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + ruleRef + number or string + the rule index or name +
  4. +
+ +

Returns:

+
    +
  1. + nil, number or string + value
  2. +
+ + + +
+

+ Mod and Map options +

+ +

+ + +

Warning: boolean values are not transfered from C to Lua correctly. + For this reason the respective option has to be converted to a number + and checked accordingly via an IF statement as shown below:

+ +
 if (tonumber(Spring.GetModOptions.exampleOption) == 1) then...end
+
+ +

The following check therefore is insufficient!

+ +
 if (Spring.GetModOptions.exampleOption) then...end
+
+
+

+

+ Spring.GetMapOptions() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + {[string] + = string,...} options map with options names as keys and values as values
  2. +
+ + + +
+

+ Spring.GetModOptions() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + {[string] + = string,...} options map with options names as keys and values as values
  2. +
+ + + +
+

+ Vectors +

+ +

+ +


+

+

+ Spring.GetHeadingFromVector(x, z) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + z + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + number + heading
  2. +
+ + + +
+

+ Spring.GetVectorFromHeading(heading) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + heading + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + number + x
  2. +
  3. + number + z
  4. +
+ + + +
+

+ Spring.GetFacingFromHeading(heading) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + heading + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + number + facing
  2. +
+ + + +
+

+ Spring.GetHeadingFromFacing(facing) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + facing + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + number + heading
  2. +
+ + + +
+

+ Sides and Factions +

+ +

+ +


+

+

+ sideSpec +

+

Side spec

+
+

+ + + Used when returning arrays of side specifications, is itself an array with + positional values as below: + +

+ + +

Fields:

+
    +
  1. + sideName + string + + + +
  2. +
  3. + caseName + string + + + +
  4. +
  5. + startUnit + string + + + +
  6. +
+ + + + +
+

+ Spring.GetSideData(sideName) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + sideName + string + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or string + startUnit
  2. +
  3. + string + caseSensitiveSideName
  4. +
+ + + +
+

+ Spring.GetSideData(sideID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + sideID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or string + sideName
  2. +
  3. + string + startUnit
  4. +
  5. + string + caseSensitiveSideName
  6. +
+ + + +
+

+ Spring.GetSideData() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + {[sideSpec],...} + sideArray
  2. +
+ + + +
+

+ Unit queries +

+ +

+ +


+

+

+ Spring.GetAllUnits() +

+

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. + +

+ + + +

Returns:

+
    +
  1. + {number,...} + unitIDs
  2. +
+ + +

See also:

+ + +
+

+ Spring.GetTeamUnits(teamID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or {number,...} + unitIDs
  2. +
+ + + +
+

+ Spring.GetTeamUnitsSorted(teamID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or {[number]={number,...}} + where keys are unitDefIDs and values are unitIDs
  2. +
+ + + +
+

+ Spring.GetTeamUnitsCounts(teamID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or {[number]=number} + where keys are unitDefIDs and values are counts
  2. +
+ + + +
+

+ Spring.GetTeamUnitsByDefs(teamID, unitDefIDs) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
  3. + unitDefIDs + number or {number,...} + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil or {number,...} + unitIDs
  2. +
+ + + +
+

+ Spring.GetTeamUnitDefCount(teamID, unitDefID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil or number + count
  2. +
+ + + +
+

+ Spring.GetTeamUnitCount(teamID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + count
  2. +
+ + + +
+

+ Spatial unit queries +

+ +

+ + +

For the allegiance parameters: AllUnits = -1, MyUnits = -2, AllyUnits = -3, EnemyUnits = -4

+
+

+

+ Spring.GetUnitsInRectangle(xmin, zmin, xmax, zmax[, allegiance]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + xmin + number + + + +
  2. +
  3. + zmin + number + + + +
  4. +
  5. + xmax + number + + + +
  6. +
  7. + zmax + number + + + +
  8. +
  9. + allegiance + number + + + + (optional) +
  10. +
+ +

Returns:

+
    +
  1. + {number,...} + unitIDs
  2. +
+ + + +
+

+ Spring.GetUnitsInBox(xmin, ymin, zmin, xmax, ymax, zmax[, allegiance]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + xmin + number + + + +
  2. +
  3. + ymin + number + + + +
  4. +
  5. + zmin + number + + + +
  6. +
  7. + xmax + number + + + +
  8. +
  9. + ymax + number + + + +
  10. +
  11. + zmax + number + + + +
  12. +
  13. + allegiance + number + + + + (optional) +
  14. +
+ +

Returns:

+
    +
  1. + {number,...} + unitIDs
  2. +
+ + + +
+

+ Spring.GetUnitsInCylinder(x, z, radius) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + z + number + + + +
  4. +
  5. + radius + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + {number,...} + unitIDs
  2. +
+ + + +
+

+ Spring.GetUnitsInSphere(x, y, z, radius) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + y + number + + + +
  4. +
  5. + z + number + + + +
  6. +
  7. + radius + number + + + +
  8. +
+ +

Returns:

+
    +
  1. + {number,...} + unitIDs
  2. +
+ + + +
+

+ planeSpec +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + normalVecX + number + + + +
  2. +
  3. + normalVecY + number + + + +
  4. +
  5. + normalVecZ + number + + + +
  6. +
  7. + d + number + + + +
  8. +
+ + + + +
+

+ Spring.GetUnitsInPlanes(planes[, allegiance]) +

+

+
+

+ + + 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 + +

+ + +

Parameters:

+
    +
  1. + planes + {planeSpec,...} + + + +
  2. +
  3. + allegiance + number + + + + (optional) +
  4. +
+ +

Returns:

+
    +
  1. + nil or {number,...} + unitIDs
  2. +
+ + + +
+

+ Spring.GetUnitNearestAlly(unitID[, range=1.0e9f]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + range + number + + + + (default 1.0e9f) +
  4. +
+ +

Returns:

+
    +
  1. + nil or number + unitID
  2. +
+ + + +
+

+ Spring.GetUnitNearestEnemy(unitID[, range=1.0e9f[, useLOS=true]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + range + number + + + + (default 1.0e9f) +
  4. +
  5. + useLOS + bool + + + + (default true) +
  6. +
+ +

Returns:

+
    +
  1. + nil or number + unitID
  2. +
+ + + +
+

+ Spatial feature queries +

+ +

+ +


+

+

+ Spring.GetFeaturesInRectangle(xmin, zmin, xmax, zmax) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + xmin + number + + + +
  2. +
  3. + zmin + number + + + +
  4. +
  5. + xmax + number + + + +
  6. +
  7. + zmax + number + + + +
  8. +
+ +

Returns:

+
    +
  1. + {number,...} + featureIDs
  2. +
+ + + +
+

+ Spring.GetFeaturesInSphere(x, y, z, radius) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + y + number + + + +
  4. +
  5. + z + number + + + +
  6. +
  7. + radius + number + + + +
  8. +
+ +

Returns:

+
    +
  1. + {number,...} + featureIDs
  2. +
+ + + +
+

+ Spring.GetFeaturesInCylinder(x, z, radius[, allegiance]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + z + number + + + +
  4. +
  5. + radius + number + + + +
  6. +
  7. + allegiance + number + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + {number,...} + featureIDs
  2. +
+ + + +
+

+ Spring.GetProjectilesInRectangle(xmin, zmin, xmax, zmax[, excludeWeaponProjectiles=false[, excludePieceProjectiles=false]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + xmin + number + + + +
  2. +
  3. + zmin + number + + + +
  4. +
  5. + xmax + number + + + +
  6. +
  7. + zmax + number + + + +
  8. +
  9. + excludeWeaponProjectiles + bool + + + + (default false) +
  10. +
  11. + excludePieceProjectiles + bool + + + + (default false) +
  12. +
+ +

Returns:

+
    +
  1. + {number,...} + projectileIDs
  2. +
+ + + +
+

+ Unit state +

+ +

+ +


+

+

+ Spring.ValidUnitID(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + bool + + +
  2. +
+ + + +
+

+ unitState +

+

+
+

+ +

+ + +

Fields:

+
    +
  1. + firestate + number + + + +
  2. +
  3. + movestate + number + + + +
  4. +
  5. + repeat + bool + + + +
  6. +
  7. + cloak + bool + + + +
  8. +
  9. + active + bool + + + +
  10. +
  11. + trajectory + bool + + + +
  12. +
  13. + autoland + bool + optional +
  14. +
  15. + autorepairlevel + number + optional +
  16. +
  17. + loopbackattack + bool + optional +
  18. +
+ + + + +
+

+ Spring.GetUnitStates(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + {unitState,...} + + +
  2. +
+ + + +
+

+ Spring.GetUnitArmored(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + armored
  2. +
  3. + number + armorMultiple
  4. +
+ + + +
+

+ Spring.GetUnitIsActive(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + + +
  2. +
+ + + +
+

+ Spring.GetUnitIsCloaked(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + + +
  2. +
+ + + +
+

+ Spring.GetUnitSeismicSignature(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + + +
  2. +
+ + + +
+

+ Spring.GetUnitSelfDTime(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + + +
  2. +
+ + + +
+

+ Spring.GetUnitStockpile(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + numStockpiled
  2. +
  3. + number + numStockpileQued
  4. +
  5. + number + buildPercent
  6. +
+ + + +
+

+ Spring.GetUnitSensorRadius(unitID, type) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + type + string + one of los, airLos, radar, sonar, seismic, radarJammer, sonarJammer +
  4. +
+ +

Returns:

+
    +
  1. + nil or number + radius
  2. +
+ + + +
+

+ Spring.GetUnitPosErrorParams(unitID[, allyTeamID]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + allyTeamID + number + + + + (optional) +
  4. +
+ +

Returns:

+
    +
  1. + nil or number + posErrorVectorX
  2. +
  3. + number + posErrorVectorY
  4. +
  5. + number + posErrorVectorZ
  6. +
  7. + number + posErrorDeltaX
  8. +
  9. + number + posErrorDeltaY
  10. +
  11. + number + posErrorDeltaZ
  12. +
  13. + number + nextPosErrorUpdatebaseErrorMult
  14. +
  15. + bool + posErrorBit
  16. +
+ + + +
+

+ Spring.GetUnitTooltip(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or string + + +
  2. +
+ + + +
+

+ Spring.GetUnitDefID(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + + +
  2. +
+ + + +
+

+ Spring.GetUnitTeam(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + + +
  2. +
+ + + +
+

+ Spring.GetUnitAllyTeam(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + + +
  2. +
+ + + +
+

+ Spring.GetUnitNeutral(unitID) +

+

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. + +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + + +
  2. +
+ + + +
+

+ Spring.GetUnitHealth(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + health
  2. +
  3. + number + maxHealth
  4. +
  5. + number + paralyzeDamage
  6. +
  7. + number + captureProgress
  8. +
  9. + number + buildProgress between 0.0-1.0
  10. +
+ + + +
+

+ Spring.GetUnitIsDead(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + + +
  2. +
+ + + +
+

+ Spring.GetUnitIsStunned(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + stunnedOrBuilt unit is stunned either via EMP or being under construction
  2. +
  3. + bool + stunned unit is stunned via EMP
  4. +
  5. + bool + beingBuilt unit is stunned via being under construction
  6. +
+ + + +
+

+ Spring.GetUnitIsBeingBuilt(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + bool + beingBuilt
  2. +
  3. + number + buildProgress
  4. +
+ + + +
+

+ Spring.GetUnitResources(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + metalMake
  2. +
  3. + number + metalUse
  4. +
  5. + number + energyMake
  6. +
  7. + number + energyUse
  8. +
+ + + +
+

+ Spring.GetUnitMetalExtraction(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + + +
  2. +
+ + + +
+

+ Spring.GetUnitExperience(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + number + XP [0.0; +∞)
  2. +
  3. + number + limXP [0.0; 1.0) as experience approaches infinity
  4. +
+ + + +
+

+ Spring.GetUnitHeight(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + + +
  2. +
+ + + +
+

+ Spring.GetUnitRadius(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + + +
  2. +
+ + + +
+

+ Spring.GetUnitMass(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + + +
  2. +
+ + + +
+

+ Spring.GetUnitPosition(unitID[, midPos=false[, aimPos=false]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + midPos + bool + return midpoint as well + (default false) +
  4. +
  5. + aimPos + bool + return aimpoint as well + (default false) +
  6. +
+ +

Returns:

+
    +
  1. + nil or number + basePointX
  2. +
  3. + number + basePointY
  4. +
  5. + number + basePointZ
  6. +
  7. + nil or number + midPointX
  8. +
  9. + number + midPointY
  10. +
  11. + number + midPointZ
  12. +
  13. + nil or number + aimPointX
  14. +
  15. + number + aimPointY
  16. +
  17. + number + aimPointZ
  18. +
+ + + +
+

+ Spring.GetUnitBasePosition(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + posX
  2. +
  3. + number + posY
  4. +
  5. + number + posZ
  6. +
+ + + +
+

+ Spring.GetUnitVectors(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or xyz + front
  2. +
  3. + xyz + up
  4. +
  5. + xyz + right
  6. +
+ + + +
+

+ Spring.GetUnitRotation(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + pitch, rotation in X axis
  2. +
  3. + number + yaw, rotation in Y axis
  4. +
  5. + number + roll, rotation in Z axis
  6. +
+ + + +
+

+ Spring.GetUnitDirection(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or dirX + + +
  2. +
  3. + dirY + + +
  4. +
  5. + dirZ + + +
  6. +
+ + + +
+

+ Spring.GetUnitHeading(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitVelocity(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitBuildFacing(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitIsBuilding(unitID) +

+

Checks whether a unit is currently building another (NOT for checking if it's a structure)

+
+

+ + + Works for both mobile builders and factories. + +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + number + buildeeUnitID or nil
  2. +
+ + + +
+

+ Spring.GetUnitWorkerTask(unitID) +

+

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). + +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + number + cmdID of the relevant command
  2. +
  3. + number + targetID if applicable (all except RESTORE)
  4. +
+ + + +
+

+ Spring.GetUnitEffectiveBuildRange(unitID, buildeeDefID) +

+

+
+

+ + Useful for setting move goals manually. +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + buildeeDefID + number + or nil +
  4. +
+ +

Returns:

+
    +
  1. + number + effectiveBuildRange counted to the center of prospective buildee; buildRange if buildee nil
  2. +
+ + + +
+

+ Spring.GetUnitCurrentBuildPower(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitHarvestStorage(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitBuildParams(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitInBuildStance(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitNanoPieces(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitTransporter(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitIsTransporting(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitShieldState(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitFlanking(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitMaxRange(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Unit weapon state +

+ +

+ +


+

+

+ Spring.GetUnitWeaponState(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitWeaponDamages(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitWeaponVectors(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitWeaponTryTarget(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitWeaponTestTarget(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitWeaponTestRange(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitWeaponHaveFreeLineOfFire(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitWeaponCanFire(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Spring.GetUnitWeaponTarget(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ + + + +
+

+ Projectile state +

+ +

+ +


+

+

+ Spring.GetProjectilePosition(projectileID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + posX
  2. +
  3. + number + posY
  4. +
  5. + number + posZ
  6. +
+ + + +
+

+ Spring.GetProjectileDirection(projectileID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + dirX
  2. +
  3. + number + dirY
  4. +
  5. + number + dirZ
  6. +
+ + + +
+

+ Spring.GetProjectileVelocity(projectileID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + velX
  2. +
  3. + number + velY
  4. +
  5. + number + velZ
  6. +
  7. + number + velW
  8. +
+ + + +
+

+ Spring.GetProjectileGravity(projectileID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + + +
  2. +
+ + + +
+

+ Spring.GetPieceProjectileParams(projectileID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + explosionFlags encoded bitwise with SHATTER = 1, EXPLODE = 2, EXPLODEONHIT = 2, FALL = 4, SMOKE = 8, FIRE = 16, NONE = 32, NOCEGTRAIL = 64, NO_HEATCLOUD = 128
  2. +
  3. + number + spinAngle
  4. +
  5. + number + spinSpeed
  6. +
  7. + number + spinVectorX
  8. +
  9. + number + spinVectorY
  10. +
  11. + number + spinVectorZ
  12. +
+ + + +
+

+ Spring.GetProjectileTarget(projectileID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + targetTypeInt where + string.byte('g') := GROUND + string.byte('u') := UNIT + string.byte('f') := FEATURE + string.byte('p') := PROJECTILE
  2. +
  3. + number or xyz + target targetID or targetPos when targetTypeInt == string.byte('g')
  4. +
+ + + +
+

+ Spring.GetProjectileIsIntercepted(projectileID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + + +
  2. +
+ + + +
+

+ Spring.GetProjectileTimeToLive(projectileID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + + +
  2. +
+ + + +
+

+ Spring.GetProjectileOwnerID(projectileID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + + +
  2. +
+ + + +
+

+ Spring.GetProjectileTeamID(projectileID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + + +
  2. +
+ + + +
+

+ Spring.GetProjectileAllyTeamID(projectileID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + + +
  2. +
+ + + +
+

+ Spring.GetProjectileType(projectileID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + weapon
  2. +
  3. + bool + piece
  4. +
+ + + +
+

+ Spring.GetProjectileDefID(projectileID) +

+

+
+

+ + + Using this to get a weaponDefID is HIGHLY preferred to indexing WeaponDefNames via GetProjectileName + +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + + +
  2. +
+ + + +
+

+ Spring.GetProjectileDamages(projectileID, tag) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
  3. + 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.
    +
    + +
  4. +
+ +

Returns:

+
    +
  1. + nil or number + + +
  2. +
+ + + +
+

+ Spring.GetProjectileName(projectileID) +

+

+
+

+ + + It is recommended to rather use GetProjectileDefID for indexing purposes. + +

+ + +

Parameters:

+
    +
  1. + projectileID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or string + + +
  2. +
+ + +

See also:

+ + +
+

+ Ground +

+ +

+ +


+

+

+ Spring.IsPosInMap(x, z) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + z + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + boolean + inPlayArea whether the position is in the active play area
  2. +
  3. + boolean + inMap whether the position is in the full map area (currently this is the same as above)
  4. +
+ + + +
+

+ Spring.GetGroundHeight(x, z) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + z + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + number + + +
  2. +
+ + + +
+

+ Spring.GetGroundOrigHeight(x, z) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + z + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + number + + +
  2. +
+ + + +
+

+ Spring.GetGroundNormal(x, z[, smoothed=false]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + z + number + + + +
  4. +
  5. + smoothed + bool + raw or smoothed center normal + (default false) +
  6. +
+ +

Returns:

+
    +
  1. + number + normalX
  2. +
  3. + number + normalY
  4. +
  5. + number + normalZ
  6. +
  7. + number + slope
  8. +
+ + + +
+

+ Spring.GetGroundInfo(x, z) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + z + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + number + ix
  2. +
  3. + number + iz
  4. +
  5. + number + terrainTypeIndex
  6. +
  7. + string + name
  8. +
  9. + number + metalExtraction
  10. +
  11. + number + hardness
  12. +
  13. + number + tankSpeed
  14. +
  15. + number + kbotSpeed
  16. +
  17. + number + hoverSpeed
  18. +
  19. + number + shipSpeed
  20. +
  21. + bool + receiveTracks
  22. +
+ + + +
+

+ Spring.GetGroundBlocked() +

+

+
+

+ +

+ + + + + + +
+

+ Spring.GetGroundExtremes() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + initMinHeight
  2. +
  3. + number + initMaxHeight
  4. +
  5. + number + currMinHeight
  6. +
  7. + number + currMaxHeight
  8. +
+ + + +
+

+ Spring.GetTerrainTypeData(terrainTypeInfo) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + terrainTypeInfo + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + number + index
  2. +
  3. + string + name
  4. +
  5. + number + hardness
  6. +
  7. + number + tankSpeed
  8. +
  9. + number + kbotSpeed
  10. +
  11. + number + hoverSpeed
  12. +
  13. + number + shipSpeed
  14. +
  15. + bool + receiveTracks
  16. +
+ + + +
+

+ Spring.GetGrass(x, z) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + z + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + number + + +
  2. +
+ + + +
+

+ Spring.GetSmoothMeshHeight(x, z) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + z + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + number + height
  2. +
+ + + +
+

+ Tests +

+ +

+ +


+

+

+ Spring.TestMoveOrder(unitDefID, testTerrain, testObjects, centerOnly) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitDefID + number + + + +
  2. +
  3. + testTerrain + bool + + + + (default true) +
  4. +
  5. + testObjects + bool + + + + (default true) +
  6. +
  7. + centerOnly + bool + + + + (default false) +
  8. +
+ +

Returns:

+
    +
  1. + bool + + +
  2. +
+ + + +
+

+ Spring.TestBuildOrder(unitDefID, x, y, z, facing) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitDefID + number + + + +
  2. +
  3. + x + number + + + +
  4. +
  5. + y + number + + + +
  6. +
  7. + z + number + + + +
  8. +
  9. + facing + number or string + one of: 0-s,1-e,2-n,3-w +
  10. +
+ +

Returns:

+
    +
  1. + number + blocking one of: 0 = blocked, 1 = mobile unit on the way, 2 = reclaimable, 3 = open
  2. +
  3. + nil or featureID + when there's a reclaimable feature on the way
  4. +
+ + + +
+

+ Spring.Pos2BuildPos(unitDefID, posX, posY, posZ[, buildFacing=0]) +

+

Snaps a position to the building grid

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitDefID + number + + + +
  2. +
  3. + posX + number + + + +
  4. +
  5. + posY + number + + + +
  6. +
  7. + posZ + number + + + +
  8. +
  9. + buildFacing + number + one of SOUTH = 0, EAST = 1, NORTH = 2, WEST = 3 + (default 0) +
  10. +
+ +

Returns:

+
    +
  1. + number + buildPosX
  2. +
  3. + number + buildPosY
  4. +
  5. + number + buildPosZ
  6. +
+ + + +
+

+ Spring.ClosestBuildPos(teamID, unitDefID, posX, posY, posZ, searchRadius, minDistance, buildFacing) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
  3. + unitDefID + number + + + +
  4. +
  5. + posX + number + + + +
  6. +
  7. + posY + number + + + +
  8. +
  9. + posZ + number + + + +
  10. +
  11. + searchRadius + number + + + +
  12. +
  13. + minDistance + number + + + +
  14. +
  15. + buildFacing + number + one of SOUTH = 0, EAST = 1, NORTH = 2, WEST = 3 +
  16. +
+ +

Returns:

+
    +
  1. + number + buildPosX
  2. +
  3. + number + buildPosY
  4. +
  5. + number + buildPosZ
  6. +
+ + + +
+

+ Visibility +

+ +

+ +


+

+

+ Spring.GetPositionLosState(posX, posY, posZ[, allyTeamID]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + posX + number + + + +
  2. +
  3. + posY + number + + + +
  4. +
  5. + posZ + number + + + +
  6. +
  7. + allyTeamID + number + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + bool + inLosOrRadar
  2. +
  3. + inLos + + +
  4. +
  5. + inRadar + + +
  6. +
  7. + inJammer + + +
  8. +
+ + + +
+

+ Spring.IsPosInLos(posX, posY, posZ[, allyTeamID]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + posX + number + + + +
  2. +
  3. + posY + number + + + +
  4. +
  5. + posZ + number + + + +
  6. +
  7. + allyTeamID + number + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + bool + + +
  2. +
+ + + +
+

+ Spring.IsPosInRadar(posX, posY, posZ[, allyTeamID]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + posX + number + + + +
  2. +
  3. + posY + number + + + +
  4. +
  5. + posZ + number + + + +
  6. +
  7. + allyTeamID + number + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + bool + + +
  2. +
+ + + +
+

+ Spring.IsPosInAirLos(posX, posY, posZ[, allyTeamID]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + posX + number + + + +
  2. +
  3. + posY + number + + + +
  4. +
  5. + posZ + number + + + +
  6. +
  7. + allyTeamID + number + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + bool + + +
  2. +
+ + + +
+

+ Spring.GetUnitLosState(unitID[, allyTeamID[, raw=false]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + allyTeamID + number + + + + (optional) +
  4. +
  5. + raw + bool + + + + (default false) +
  6. +
+ +

Returns:

+
    +
  1. + nil, number or {los=bool,radar=bool,typed=bool} + los

    + +

    Raw is only available in gadgets and when raw parameter is true.

    + +

    RAW returns an bitmask integer, where the bits are: + 1: LOSINLOS, the unit is currently in the los of the allyteam, + 2: LOSINRADAR the unit is currently in radar from the allyteam, + 4: LOSPREVLOS the unit has previously been in los from the allyteam, + 8: LOSCONTRADAR the unit has continuously been in radar since it was last inlos by the allyteam

  2. +
+ + + +
+

+ Spring.IsUnitInLos(unitID, allyTeamID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + allyTeamID + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + bool + inLos
  2. +
+ + + +
+

+ Spring.IsUnitInAirLos(unitID, allyTeamID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + allyTeamID + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + bool + inAirLos
  2. +
+ + + +
+

+ Spring.IsUnitInRadar(unitID, allyTeamID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + allyTeamID + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + bool + inRadar
  2. +
+ + + +
+

+ Spring.IsUnitInJammer(unitID, allyTeamID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + allyTeamID + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + bool + inJammer
  2. +
+ + + +
+

+ Piece/Script +

+ +

+ +


+

+

+ pieceSpec +

+

Piece spec

+
+

+ +

+ + +

Fields:

+
    +
  1. + name + string + + + +
  2. +
  3. + parent + string + + + +
  4. +
  5. + children + {[string],...} + names +
  6. +
  7. + empty + bool + + + +
  8. +
  9. + min + {number,number,number} + (x,y,z) +
  10. +
  11. + max + {number,number,number} + (x,y,z) +
  12. +
  13. + offset + {number,number,number} + (x,y,z) +
  14. +
+ + + + +
+

+ Spring.GetModelRootPiece(modelName) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + modelName + string + + + +
  2. +
+ +

Returns:

+
    +
  1. + number + index of the root piece
  2. +
+ + + +
+

+ Spring.GetModelPieceMap(modelName) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + modelName + string + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or {[string]=number,...} + pieceInfos where keys are piece names and values are indices
  2. +
+ + + +
+

+ Spring.GetModelPieceList(modelName) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + modelName + string + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or {[string],...} + pieceNames
  2. +
+ + + +
+

+ Spring.GetUnitRootPiece(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + number + index of the root piece
  2. +
+ + + +
+

+ Spring.GetUnitPieceMap(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or {[string]=number,...} + pieceInfos where keys are piece names and values are indices
  2. +
+ + + +
+

+ Spring.GetUnitPieceList(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + {[string],...} + pieceNames
  2. +
+ + + +
+

+ Spring.GetUnitPieceInfo(unitID, pieceIndex) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + pieceIndex + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil or pieceSpec + pieceInfo
  2. +
+ + + +
+

+ Spring.GetUnitPiecePosDir(unitID, pieceIndex) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + pieceIndex + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + number or nil + posX
  2. +
  3. + number + posY
  4. +
  5. + number + posZ
  6. +
  7. + number + dirX
  8. +
  9. + number + dirY
  10. +
  11. + number + dirZ
  12. +
+ + + +
+

+ Spring.GetUnitPiecePosition(unitID, pieceIndex) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + pieceIndex + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + number or nil + posX
  2. +
  3. + number + posY
  4. +
  5. + number + posZ
  6. +
+ + + +
+

+ Spring.GetUnitPieceDirection(unitID, pieceIndex) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + pieceIndex + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + number or nil + dirX
  2. +
  3. + number + dirY
  4. +
  5. + number + dirZ
  6. +
+ + + +
+

+ Spring.GetUnitPieceMatrix(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + number or nil + m11
  2. +
  3. + number + m12
  4. +
  5. + number + m13
  6. +
  7. + number + m14
  8. +
  9. + number + m21
  10. +
  11. + number + m22
  12. +
  13. + number + m23
  14. +
  15. + number + m24
  16. +
  17. + number + m31
  18. +
  19. + number + m32
  20. +
  21. + number + m33
  22. +
  23. + number + m34
  24. +
  25. + number + m41
  26. +
  27. + number + m42
  28. +
  29. + number + m43
  30. +
  31. + number + m44
  32. +
+ + + +
+

+ Spring.GetFeatureRootPiece(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + number + index of the root piece
  2. +
+ + + +
+

+ Spring.GetFeaturePieceMap(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + {[string]=number,...} + pieceInfos where keys are piece names and values are indices
  2. +
+ + + +
+

+ Spring.GetFeaturePieceList(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + {[string],...} + pieceNames
  2. +
+ + + +
+

+ Spring.GetFeaturePieceInfo(featureID, pieceIndex) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + pieceIndex + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil or pieceSpec + pieceInfo
  2. +
+ + + +
+

+ Spring.GetFeaturePiecePosDir(featureID, pieceIndex) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + pieceIndex + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + number or nil + posX
  2. +
  3. + number + posY
  4. +
  5. + number + posZ
  6. +
  7. + number + dirX
  8. +
  9. + number + dirY
  10. +
  11. + number + dirZ
  12. +
+ + + +
+

+ Spring.GetFeaturePiecePosition(featureID, pieceIndex) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + pieceIndex + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + number or nil + posX
  2. +
  3. + number + posY
  4. +
  5. + number + posZ
  6. +
+ + + +
+

+ Spring.GetFeaturePieceDirection(featureID, pieceIndex) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + pieceIndex + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + number or nil + dirX
  2. +
  3. + number + dirY
  4. +
  5. + number + dirZ
  6. +
+ + + +
+

+ Spring.GetFeaturePieceMatrix(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + number or nil + m11
  2. +
  3. + number + m12
  4. +
  5. + number + m13
  6. +
  7. + number + m14
  8. +
  9. + number + m21
  10. +
  11. + number + m22
  12. +
  13. + number + m23
  14. +
  15. + number + m24
  16. +
  17. + number + m31
  18. +
  19. + number + m32
  20. +
  21. + number + m33
  22. +
  23. + number + m34
  24. +
  25. + number + m41
  26. +
  27. + number + m42
  28. +
  29. + number + m43
  30. +
  31. + number + m44
  32. +
+ + + +
+

+ Spring.GetUnitScriptPiece(unitID[, scriptPiece]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + scriptPiece + number + + + + (optional) +
  4. +
+ +

Returns:

+
    +
  1. + {number,...} or number + pieceIndices when scriptPiece is not specified, pieceIndex otherwise
  2. +
+ + + +
+

+ Spring.GetUnitScriptNames(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + {[string]=number,...} + where keys are piece names and values are piece indices
  2. +
+ + + +
+ +{% endraw %} diff --git a/ldoc/modules/UnsyncedCtrl.html b/ldoc/modules/UnsyncedCtrl.html new file mode 100644 index 0000000000..cfd0e04bfb --- /dev/null +++ b/ldoc/modules/UnsyncedCtrl.html @@ -0,0 +1,8280 @@ +--- +layout: default +title: UnsyncedCtrl +permalink: ldoc/modules/UnsyncedCtrl.html +description: Callouts to set state +parent: Lua API +table: 0x55a54e565ad0 +--- + +{% raw %} +

Module UnsyncedCtrl

+

Callouts to set state

+

+ +


+

+

See also:

+ + +

Tables

+
+
+ rgb +
+
+ Color triple (RGB) +
+
+ rgba +
+
+ Color quadruple (RGBA) +
+
+

Decals

+
+
+ Spring.CreateDecal +
+
+ + + +
+
+ Spring.DestroyDecal +
+
+ + + +
+
+ Spring.SetDecalPos +
+
+ + + +
+
+ Spring.SetDecalSize +
+
+ + + +
+
+ Spring.SetDecalRotation +
+
+ + + +
+
+ Spring.SetDecalTexture +
+
+ + + +
+
+ Spring.SetDecalAlpha +
+
+ + + +
+
+

Give Order

+
+
+ cmdOpts +
+
+ Command Options params +
+
+ Spring.GiveOrder +
+
+ + + +
+
+ Spring.GiveOrderToUnit +
+
+ + + +
+
+ Spring.GiveOrderToUnitMap +
+
+ + + +
+
+ Spring.GiveOrderToUnitArray +
+
+ + + +
+
+ cmdSpec +
+
+ Command spec +
+
+ Spring.GiveOrderArrayToUnit +
+
+ + + +
+
+ Spring.GiveOrderArrayToUnitMap +
+
+ + + +
+
+ Spring.GiveOrderArrayToUnitArray +
+
+ + + +
+
+ Spring.SetBuildSpacing +
+
+ + + +
+
+ Spring.SetBuildFacing +
+
+ + + +
+
+

Ingame Console

+
+
+ Spring.Ping +
+
+ Send a ping request to the server +
+
+ Spring.Echo +
+
+ Useful for debugging. +
+
+ Spring.Log +
+
+ + + +
+
+ Spring.SendCommands +
+
+ + + +
+
+ Spring.SetMapShader +
+
+ + + +
+
+ Spring.SetMapSquareTexture +
+
+ + + +
+
+ Spring.SetMapShadingTexture +
+
+ + + +
+
+ Spring.SetSkyBoxTexture +
+
+ + + +
+
+

Messages

+
+
+ Spring.SendMessage +
+
+ + + +
+
+ Spring.SendMessageToSpectators +
+
+ + + +
+
+ Spring.SendMessageToPlayer +
+
+ + + +
+
+ Spring.SendMessageToTeam +
+
+ + + +
+
+ Spring.SendMessageToAllyTeam +
+
+ + + +
+
+

Sounds

+
+
+ Spring.LoadSoundDef +
+
+ Loads a SoundDefs file, the format is the same as in gamedata/sounds.lua. +
+
+ Spring.PlaySoundFile +
+
+ + + +
+
+ Spring.PlaySoundStream +
+
+ Allows to play an Ogg Vorbis (.OGG) and mp3 compressed sound file. +
+
+ Spring.StopSoundStream +
+
+ Terminates any SoundStream currently running. +
+
+ Spring.PauseSoundStream +
+
+ Pause any SoundStream currently running. +
+
+ Spring.SetSoundStreamVolume +
+
+ Set volume for SoundStream +
+
+ Spring.SetSoundEffectParams +
+
+ + + +
+
+ Spring.AddWorldIcon +
+
+ + + +
+
+ Spring.AddWorldText +
+
+ + + +
+
+ Spring.AddWorldUnit +
+
+ + + +
+
+ Spring.DrawUnitCommands +
+
+ + + +
+
+ Spring.DrawUnitCommands +
+
+ + + +
+
+

Camera

+
+
+ camState +
+
+ Parameters for camera state +
+
+ Spring.SetCameraTarget +
+
+ For Spring Engine XZ represents horizontal, from north west corner of map and Y vertical, from water level and rising. +
+
+ Spring.SetCameraTarget +
+
+ + + +
+
+ Spring.SetCameraState +
+
+ Sets camera state +
+
+

Unit Selection

+
+
+ Spring.SelectUnit +
+
+ Selects a single unit +
+
+ Spring.DeselectUnit +
+
+ + + +
+
+ Spring.DeselectUnitArray +
+
+ Deselects multiple units. +
+
+ Spring.DeselectUnitMap +
+
+ Deselects multiple units. +
+
+ Spring.SelectUnitArray +
+
+ Selects multiple units, or appends to selection. +
+
+ Spring.SelectUnitMap +
+
+ Selects multiple units, or appends to selection. +
+
+

Lighting

+
+
+ lightParams +
+
+ Parameters for lighting +
+
+ Spring.AddMapLight +
+
+ + + +
+
+ Spring.AddModelLight +
+
+ + + +
+
+ Spring.UpdateMapLight +
+
+ + + +
+
+ Spring.UpdateModelLight +
+
+ + + +
+
+ Spring.AddLightTrackingTarget +
+
+ + + +
+
+ Spring.SetMapLightTrackingState +
+
+ Set a map-illuminating light to start/stop tracking the position of a moving object (unit or projectile) +
+
+ Spring.SetModelLightTrackingState +
+
+ Set a model-illuminating light to start/stop tracking the position of a moving object (unit or projectile) +
+
+

Unit custom rendering

+
+
+ Spring.SetUnitNoDraw +
+
+ + + +
+
+ Spring.SetUnitEngineDrawMask +
+
+ + + +
+
+ Spring.SetUnitAlwaysUpdateMatrix +
+
+ + + +
+
+ Spring.SetUnitNoMinimap +
+
+ + + +
+
+ Spring.SetUnitNoSelect +
+
+ + + +
+
+ Spring.SetUnitLeaveTracks +
+
+ + + +
+
+ Spring.SetUnitSelectionVolumeData +
+
+ + + +
+
+

Features

+
+
+ Spring.SetFeatureNoDraw +
+
+ + + +
+
+ Spring.SetFeatureEngineDrawMask +
+
+ + + +
+
+ Spring.SetFeatureAlwaysUpdateMatrix +
+
+ + + +
+
+ Spring.SetFeatureFade +
+
+ Control whether a feature will fade or not when zoomed out. +
+
+ Spring.SetFeatureSelectionVolumeData +
+
+ + + +
+
+

Unit Icons

+
+
+ Spring.AddUnitIcon +
+
+ + + +
+
+ Spring.FreeUnitIcon +
+
+ + + +
+
+ Spring.UnitIconSetDraw +
+
+ + + +
+
+ Spring.SetUnitDefIcon +
+
+ + + +
+
+ Spring.SetUnitDefImage +
+
+ + + +
+
+

Virtual File System

+
+
+ Spring.ExtractModArchiveFile +
+
+ + + +
+
+ Spring.CreateDir +
+
+ + + +
+
+

GUI

+
+
+ Spring.SetActiveCommand +
+
+ + + +
+
+ Spring.SetActiveCommand +
+
+ + + +
+
+ Spring.LoadCmdColorsConfig +
+
+ + + +
+
+ Spring.LoadCtrlPanelConfig +
+
+ + + +
+
+ Spring.ForceLayoutUpdate +
+
+ + + +
+
+ Spring.SetDrawSelectionInfo +
+
+ Disables the "Selected Units x" box in the GUI. +
+
+ Spring.SetBoxSelectionByEngine +
+
+ + + +
+
+ Spring.SetTeamColor +
+
+ + + +
+
+ Spring.AssignMouseCursor +
+
+ Changes/creates the cursor of a single CursorCmd. +
+
+ Spring.ReplaceMouseCursor +
+
+ Mass replace all occurrences of the cursor in all CursorCmds. +
+
+ Spring.SetCustomCommandDrawData +
+
+ Register your custom cmd so it gets visible in the unit's cmd queue +
+
+

Mouse

+
+
+ Spring.WarpMouse +
+
+ + + +
+
+ Spring.SetMouseCursor +
+
+ + + +
+
+

LOS Colors

+
+
+ Spring.SetLosViewColors +
+
+ + + +
+
+ Spring.SetNanoProjectileParams +
+
+ + + +
+
+

Engine Config

+
+
+ Spring.SetConfigInt +
+
+ + + +
+
+ Spring.SetConfigFloat +
+
+ + + +
+
+ Spring.SetConfigString +
+
+ + + +
+
+ Spring.Quit +
+
+ Closes the application +
+
+

Unit Group

+
+
+ Spring.SetUnitGroup +
+
+ + + +
+
+

UI

+
+
+ Spring.SendLuaUIMsg +
+
+ + + +
+
+ Spring.SendLuaGaiaMsg +
+
+ + + +
+
+ Spring.SendLuaRulesMsg +
+
+ + + +
+
+ Spring.SendLuaMenuMsg +
+
+ + + +
+
+ Spring.SetLastMessagePosition +
+
+ + + +
+
+

Sharing

+
+
+ Spring.SetShareLevel +
+
+ + + +
+
+ Spring.ShareResources +
+
+ + + +
+
+ Spring.ShareResources +
+
+ + + +
+
+

Markers

+
+
+ Spring.MarkerAddPoint +
+
+ + + +
+
+ Spring.MarkerAddLine +
+
+ + + +
+
+ Spring.MarkerErasePosition +
+
+ + + +
+
+

Sun

+
+
+ Spring.SetAtmosphere +
+
+ It can be used to modify the following atmosphere parameters +
+
+ Spring.SetSunDirection +
+
+ + + +
+
+ Spring.SetSunLighting +
+
+ It can be used to modify the following sun lighting parameters +
+
+ mapRenderingParams +
+
+ Map rendering params +
+
+ Spring.SetMapRenderingParams +
+
+ Allows to change map rendering params at runtime. +
+
+ Spring.ForceTesselationUpdate +
+
+ + + +
+
+

AI

+
+
+ Spring.SendSkirmishAIMessage +
+
+ + + +
+
+

Developers

+
+
+ Spring.SetLogSectionFilterLevel +
+
+ + + +
+
+ Spring.GarbageCollectCtrl +
+
+ + + +
+
+ Spring.SetDrawSky +
+
+ + + +
+
+ Spring.SetDrawWater +
+
+ + + +
+
+ Spring.SetDrawGround +
+
+ + + +
+
+ Spring.SetDrawGroundDeferred +
+
+ + + +
+
+ Spring.SetDrawModelsDeferred +
+
+ + + +
+
+ Spring.SetVideoCapturingMode +
+
+ This doesn't actually record the game in any way, it just regulates the framerate and interpolations. +
+
+ Spring.SetVideoCapturingTimeOffset +
+
+ + + +
+
+ waterParams +
+
+ Water params +
+
+ Spring.SetWaterParams +
+
+ + + +
+
+

Preload

+
+
+ Spring.PreloadUnitDefModel +
+
+ + + +
+
+ Spring.PreloadFeatureDefModel +
+
+ + + +
+
+ Spring.PreloadSoundItem +
+
+ + + +
+
+ Spring.LoadModelTextures +
+
+ + + +
+
+

SDL Text

+
+
+ Spring.SDLSetTextInputRect +
+
+ + + +
+
+ Spring.SDLStartTextInput +
+
+ + + +
+
+ Spring.SDLStopTextInput +
+
+ + + +
+
+

Window Management

+
+
+ Spring.SetWindowGeometry +
+
+ + + +
+
+ Spring.SetWindowMinimized +
+
+ + + +
+
+ Spring.SetWindowMaximized +
+
+ + + +
+
+

Misc

+
+
+ Spring.Reload +
+
+ + + +
+
+ Spring.Restart +
+
+ + + +
+
+ Spring.Start +
+
+ Launches a new Spring instance without terminating the existing one. +
+
+ Spring.SetWMIcon +
+
+ Sets the icon for the process which is seen in the OS task-bar and other places (default: spring-logo). +
+
+ SetWMCaption +
+
+ Sets the window title for the process (default: "Spring "). +
+
+ Spring.ClearWatchDogTimer +
+
+ + + +
+
+ Spring.SetClipboard +
+
+ + + +
+
+ Spring.Yield +
+
+ Relinquish control of the game loading thread and OpenGL context back to the UI (LuaIntro). +
+
+ +

+ Tables +

+ +

+ rgb +

+

Color triple (RGB)

+
+

+ +

+ + +

Fields:

+
    +
  1. + r + number + + + +
  2. +
  3. + g + number + + + +
  4. +
  5. + b + number + + + +
  6. +
+ + + + +
+

+ rgba +

+

Color quadruple (RGBA)

+
+

+ +

+ + +

Fields:

+
    +
  1. + r + number + + + +
  2. +
  3. + g + number + + + +
  4. +
  5. + b + number + + + +
  6. +
  7. + a + number + + + +
  8. +
+ + + + +
+

+ Decals +

+ +

+ +


+

+

+ Spring.CreateDecal() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + nil or number + decalIndex
  2. +
+ + + +
+

+ Spring.DestroyDecal(decalIndex) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + decalIndex + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetDecalPos(decalIndex, posX, posY, posZ) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + decalIndex + number + + + +
  2. +
  3. + posX + number + + + +
  4. +
  5. + posY + number + + + +
  6. +
  7. + posZ + number + + + +
  8. +
+ +

Returns:

+
    +
  1. + bool + decalSet
  2. +
+ + + +
+

+ Spring.SetDecalSize(decalIndex, sizeX, sizeY) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + decalIndex + number + + + +
  2. +
  3. + sizeX + number + + + +
  4. +
  5. + sizeY + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + bool + decalSet
  2. +
+ + + +
+

+ Spring.SetDecalRotation(decalIndex, rot) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + decalIndex + number + + + +
  2. +
  3. + rot + number + in radians +
  4. +
+ +

Returns:

+
    +
  1. + nil or bool + decalSet
  2. +
+ + + +
+

+ Spring.SetDecalTexture(decalIndex, textureName) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + decalIndex + number + + + +
  2. +
  3. + textureName + string + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil or bool + decalSet
  2. +
+ + + +
+

+ Spring.SetDecalAlpha(decalIndex, alpha) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + decalIndex + number + + + +
  2. +
  3. + alpha + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil or bool + decalSet
  2. +
+ + + +
+

+ Give Order +

+ +

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.

+

+ cmdOpts +

+

Command Options params

+
+

+ + + Can be specified as a table, or as an array containing any of the keys + below. + +

+ + +

Fields:

+
    +
  1. + right + bool + Right mouse key pressed +
  2. +
  3. + alt + bool + Alt key pressed +
  4. +
  5. + ctrl + bool + Ctrl key pressed +
  6. +
  7. + shift + bool + Shift key pressed +
  8. +
  9. + meta + bool + Meta (windows/mac/mod4) key pressed +
  10. +
+ + + + +
+

+ Spring.GiveOrder(cmdID, params, options) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + cmdID + number + + + +
  2. +
  3. + params + table + + + +
  4. +
  5. + options + cmdOpts + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil or true + + +
  2. +
+ + + +
+

+ Spring.GiveOrderToUnit(unitID, cmdID, params, options) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + cmdID + number + + + +
  4. +
  5. + params + table + + + +
  6. +
  7. + options + cmdOpts + + + +
  8. +
+ +

Returns:

+
    +
  1. + nil or true + + +
  2. +
+ + + +
+

+ Spring.GiveOrderToUnitMap(unitMap, cmdID, params, options) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitMap + table + { [unitID] = arg1, ... } +
  2. +
  3. + cmdID + number + + + +
  4. +
  5. + params + table + + + +
  6. +
  7. + options + cmdOpts + + + +
  8. +
+ +

Returns:

+
    +
  1. + nil or true + + +
  2. +
+ + + +
+

+ Spring.GiveOrderToUnitArray(unitArray, cmdID, params, options) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitArray + {number,...} + array of unit ids +
  2. +
  3. + cmdID + number + + + +
  4. +
  5. + params + table + + + +
  6. +
  7. + options + cmdOpts + + + +
  8. +
+ +

Returns:

+
    +
  1. + nil or true + + +
  2. +
+ + + +
+

+ cmdSpec +

+

Command spec

+
+

+ + + Used when assigning multiple commands at once + +

+ + +

Fields:

+
    +
  1. + cmdID + number + + + +
  2. +
  3. + params + table + + + +
  4. +
  5. + options + cmdOpts + + + +
  6. +
+ + + + +
+

+ Spring.GiveOrderArrayToUnit(unitID, cmdArray) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + cmdArray + {cmdSpec,...} + + + +
  4. +
+ +

Returns:

+
    +
  1. + bool + ordersGiven
  2. +
+ + + +
+

+ Spring.GiveOrderArrayToUnitMap(unitMap, cmdArray) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitMap + table + { [unitID] = arg1, ... } +
  2. +
  3. + cmdArray + {cmdSpec,...} + + + +
  4. +
+ +

Returns:

+
    +
  1. + bool + ordersGiven
  2. +
+ + + +
+

+ Spring.GiveOrderArrayToUnitArray(unitArray, cmdArray[, pairwise=false]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitArray + {number,...} + array of unit ids +
  2. +
  3. + cmdArray + {cmdSpec,...} + + + +
  4. +
  5. + pairwise + bool + 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. + (default false) +

  6. +
+ +

Returns:

+
    +
  1. + nil or bool + + +
  2. +
+ + + +
+

+ Spring.SetBuildSpacing(spacing) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + spacing + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetBuildFacing(facing) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + facing + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Ingame Console +

+ +

+ +


+

+

+ Spring.Ping(pingTag) +

+

Send a ping request to the server

+
+

+ +

+ + +

Parameters:

+
    +
  1. + pingTag + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.Echo(arg1[, arg2[, argn]]) +

+

Useful for debugging.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + arg1 + + + +
  2. +
  3. + arg2 + + + + (optional) +
  4. +
  5. + argn + Prints values in the spring chat console. + Hint: the default print() writes to STDOUT. + (optional) +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.Log(section, logLevel, logMessage1[, logMessage2[, logMessagen]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + section + string + + + +
  2. +
  3. + logLevel + number or string + + +

    Possible values for logLevel are:

    +
    "debug"   | LOG.DEBUG
    +"info"    | LOG.INFO
    +"notice"  | LOG.NOTICE (engine default) (new in Version 97)
    +"warning" | LOG.WARNING
    +"error"   | LOG.ERROR
    +"fatal"   | LOG.FATAL
    +
    + +
  4. +
  5. + logMessage1 + string + + + +
  6. +
  7. + logMessage2 + string + + + + (optional) +
  8. +
  9. + logMessagen + string + + + + (optional) +
  10. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SendCommands(command1, command2) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + command1 + string or table + | { command1, command 2, ...} +
  2. +
  3. + command2 + string + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetMapShader(standardShaderID, deferredShaderID) +

+

+
+

+ + + 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. + +

+ + +

Parameters:

+
    +
  1. + standardShaderID + number + + + +
  2. +
  3. + deferredShaderID + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetMapSquareTexture(texSqrX, texSqrY, luaTexName) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + texSqrX + number + + + +
  2. +
  3. + texSqrY + number + + + +
  4. +
  5. + luaTexName + string + + + +
  6. +
+ +

Returns:

+
    +
  1. + bool + success
  2. +
+ + + +
+

+ Spring.SetMapShadingTexture(texType, texName) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + texType + string + + + +
  2. +
  3. + texName + string + + + +
  4. +
+ +

Returns:

+
    +
  1. + bool + success
  2. +
+ + + +

Usage:

+ +
+

+ Spring.SetSkyBoxTexture(texName) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + texName + string + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Messages +

+ +

+ +


+

+

+ Spring.SendMessage(message) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + message + string + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SendMessageToSpectators(message) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + message + string + <PLAYER#> (with # being a playerid) inside the string will be replaced with the players name - i.e. : Spring.SendMessage ("<PLAYER1> did something") might display as "ProRusher did something" +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SendMessageToPlayer(playerID, message) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + playerID + number + + + +
  2. +
  3. + message + string + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SendMessageToTeam(teamID, message) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
  3. + message + string + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SendMessageToAllyTeam(allyID, message) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + allyID + number + + + +
  2. +
  3. + message + string + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Sounds +

+ +

+ +


+

+

+ Spring.LoadSoundDef(soundfile) +

+

Loads a SoundDefs file, the format is the same as in `gamedata/sounds.lua`.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + soundfile + string + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + success
  2. +
+ + + +
+

+ Spring.PlaySoundFile(soundfile[, volume=1.0[, posx[, posy[, posz[, speedx[, speedy[, speedz[, channel]]]]]]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + soundfile + string + + + +
  2. +
  3. + volume + number + + + + (default 1.0) +
  4. +
  5. + posx + number + + + + (optional) +
  6. +
  7. + posy + number + + + + (optional) +
  8. +
  9. + posz + number + + + + (optional) +
  10. +
  11. + speedx + number + + + + (optional) +
  12. +
  13. + speedy + number + + + + (optional) +
  14. +
  15. + speedz + number + + + + (optional) +
  16. +
  17. + channel + number or string + + +
    Possible arguments for channel argument:
    +"general" || 0 || nil (default)
    +"battle" || "sfx" | 1
    +"unitreply" || "voice" || 2
    +"userinterface" || "ui" || 3
    +
    + + + (optional) +
  18. +
+ +

Returns:

+
    +
  1. + nil or bool + playSound
  2. +
+ + + +
+

+ Spring.PlaySoundStream(oggfile[, volume=1.0[, enqueue]]) +

+

Allows to play an Ogg Vorbis (.OGG) and mp3 compressed sound file.

+
+

+ + + Multiple sound streams may be played at once. + +

+ + +

Parameters:

+
    +
  1. + oggfile + string + + + +
  2. +
  3. + volume + number + + + + (default 1.0) +
  4. +
  5. + enqueue + bool + + + + (optional) +
  6. +
+ +

Returns:

+
    +
  1. + nil or bool + success
  2. +
+ + + +
+

+ Spring.StopSoundStream() +

+

Terminates any SoundStream currently running.

+
+

+ +

+ + + +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.PauseSoundStream() +

+

Pause any SoundStream currently running.

+
+

+ +

+ + + +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetSoundStreamVolume(volume) +

+

Set volume for SoundStream

+
+

+ +

+ + +

Parameters:

+
    +
  1. + volume + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetSoundEffectParams() +

+

+
+

+ +

+ + + + + + +
+

+ Spring.AddWorldIcon(cmdID, posX, posY, posZ) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + cmdID + number + + + +
  2. +
  3. + posX + number + + + +
  4. +
  5. + posY + number + + + +
  6. +
  7. + posZ + number + + + +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.AddWorldText(text, posX, posY, posZ) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + text + string + + + +
  2. +
  3. + posX + number + + + +
  4. +
  5. + posY + number + + + +
  6. +
  7. + posZ + number + + + +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.AddWorldUnit(unitDefID, posX, posY, posZ, teamID, facing) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitDefID + number + + + +
  2. +
  3. + posX + number + + + +
  4. +
  5. + posY + number + + + +
  6. +
  7. + posZ + number + + + +
  8. +
  9. + teamID + number + + + +
  10. +
  11. + facing + number + + + +
  12. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.DrawUnitCommands(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.DrawUnitCommands(units, tableOrArray) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + units + table + array of unit ids +
  2. +
  3. + tableOrArray + bool + [opt=false] when true units is interpreted as a table in the format { [unitID] = arg1, ... } +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Camera +

+ +

+ +


+

+

+ camState +

+

Parameters for camera state

+
+

+ + + Highly dependent on the type of the current camera controller + +

+ + +

Fields:

+
    +
  1. + name + string + "ta"|"spring"|"rot"|"ov"|"free"|"fps"|"dummy" +
  2. +
  3. + mode + number + the camera mode: 0 (fps), 1 (ta), 2 (spring), 3 (rot), 4 (free), 5 (ov), 6 (dummy) +
  4. +
  5. + fov + number + + + +
  6. +
  7. + px + number + Position X of the ground point in screen center +
  8. +
  9. + py + number + Position Y of the ground point in screen center +
  10. +
  11. + pz + number + Position Z of the ground point in screen center +
  12. +
  13. + dx + number + Camera direction vector X +
  14. +
  15. + dy + number + Camera direction vector Y +
  16. +
  17. + dz + number + Camera direction vector Z +
  18. +
  19. + rx + number + Camera rotation angle on X axis (spring) +
  20. +
  21. + ry + number + Camera rotation angle on Y axis (spring) +
  22. +
  23. + rz + number + Camera rotation angle on Z axis (spring) +
  24. +
  25. + angle + number + Camera rotation angle on X axis (aka tilt/pitch) (ta) +
  26. +
  27. + flipped + number + -1 for when south is down, 1 for when north is down (ta) +
  28. +
  29. + dist + number + Camera distance from the ground (spring) +
  30. +
  31. + height + number + Camera distance from the ground (ta) +
  32. +
  33. + oldHeight + number + Camera distance from the ground, cannot be changed (rot) +
  34. +
+ + + + +
+

+ Spring.SetCameraTarget(x, y, z[, transTime]) +

+

For Spring Engine XZ represents horizontal, from north west corner of map and Y vertical, from water level and rising.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + y + number + + + +
  4. +
  5. + z + number + + + +
  6. +
  7. + transTime + number + + + + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetCameraTarget(px, py, pz, tx, ty, tz) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + px + number + [opt=0] +
  2. +
  3. + py + number + [opt=0] +
  4. +
  5. + pz + number + [opt=0] +
  6. +
  7. + tx + number + [opt=0] +
  8. +
  9. + ty + number + [opt=0] +
  10. +
  11. + tz + number + [opt=0] +
  12. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetCameraState(camState[, transitionTime=0[, transitionTimeFactor[, transitionTimeExponent]]]) +

+

Sets camera state

+
+

+ + + The fields in `camState` must be consistent with the name/mode and current/new camera mode + +

+ + +

Parameters:

+
    +
  1. + camState + camState + + + +
  2. +
  3. + transitionTime + number + in nanoseconds + (default 0) +
  4. +
  5. + transitionTimeFactor + number + multiplicative factor applied to this and all subsequent transition times for + this camera mode.

    + +

    Defaults to "CamTimeFactor" springsetting unless set previously. + (optional) +

  6. +
  7. + transitionTimeExponent + number + tween factor applied to this and all subsequent transitions for this camera + mode.

    + +

    Defaults to "CamTimeExponent" springsetting unless set previously. + (optional) +

  8. +
+ +

Returns:

+
    +
  1. + bool + set
  2. +
+ + + +
+

+ Unit Selection +

+ +

+ +


+

+

+ Spring.SelectUnit(unitID[, append=false]) +

+

Selects a single unit

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + or nil +
  2. +
  3. + append + bool + append to current selection + (default false) +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.DeselectUnit(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.DeselectUnitArray(unitID) +

+

Deselects multiple units.

+
+

+ Accepts a table with unitIDs as values + +

+ + +

Parameters:

+
    +
  1. + unitID + {[any] + , ...} unitIDs +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.DeselectUnitMap(any) +

+

Deselects multiple units.

+
+

+ Accepts a table with unitIDs as keys + +

+ + +

Parameters:

+
    +
  1. + any + {[unitID] + , ...} unitMap where keys are unitIDs +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SelectUnitArray(unitID[, append=false]) +

+

Selects multiple units, or appends to selection.

+
+

+ Accepts a table with unitIDs as values + +

+ + +

Parameters:

+
    +
  1. + unitID + {[any] + , ...} unitIDs +
  2. +
  3. + append + bool + append to current selection + (default false) +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SelectUnitMap(any[, append=false]) +

+

Selects multiple units, or appends to selection.

+
+

+ Accepts a table with unitIDs as keys + +

+ + +

Parameters:

+
    +
  1. + any + {[unitID] + , ...} unitMap where keys are unitIDs +
  2. +
  3. + append + bool + append to current selection + (default false) +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Lighting +

+ +

+ +


+

+

+ lightParams +

+

Parameters for lighting

+
+

+ +

+ + +

Fields:

+
    +
  1. position + + +
      +
    • + px + number + + + +
    • +
    • + py + number + + + +
    • +
    • + pz + number + + + +
    • +
    +
  2. direction + + +
      +
    • + dx + number + + + +
    • +
    • + dy + number + + + +
    • +
    • + dz + number + + + +
    • +
    +
  3. ambientColor + + +
      +
    • + red + number + + + +
    • +
    • + green + number + + + +
    • +
    • + blue + number + + + +
    • +
    +
  4. diffuseColor + + +
      +
    • + red + number + + + +
    • +
    • + green + number + + + +
    • +
    • + blue + number + + + +
    • +
    +
  5. specularColor + + +
      +
    • + red + number + + + +
    • +
    • + green + number + + + +
    • +
    • + blue + number + + + +
    • +
    +
  6. intensityWeight + + +
      +
    • + ambientWeight + number + + + +
    • +
    • + diffuseWeight + number + + + +
    • +
    • + specularWeight + number + + + +
    • +
    +
  7. ambientDecayRate per-frame decay of ambientColor (spread over TTL frames) +
      +
    • + ambientRedDecay + number + + + +
    • +
    • + ambientGreenDecay + number + + + +
    • +
    • + ambientBlueDecay + number + + + +
    • +
    +
  8. diffuseDecayRate per-frame decay of diffuseColor (spread over TTL frames) +
      +
    • + diffuseRedDecay + number + + + +
    • +
    • + diffuseGreenDecay + number + + + +
    • +
    • + diffuseBlueDecay + number + + + +
    • +
    +
  9. specularDecayRate per-frame decay of specularColor (spread over TTL frames) +
      +
    • + specularRedDecay + number + + + +
    • +
    • + specularGreenDecay + number + + + +
    • +
    • + specularBlueDecay + number + + + +
    • +
    +
  10. decayFunctionType *DecayType = 0.0 -> interpret *DecayRate values as linear, else as exponential +
      +
    • + ambientDecayType + number + + + +
    • +
    • + diffuseDecayType + number + + + +
    • +
    • + specularDecayType + number + + + +
    • +
    +
  11. + radius + number + + + +
  12. +
  13. + fov + number + + + +
  14. +
  15. + ttl + number + + + +
  16. +
  17. + priority + number + + + +
  18. +
  19. + ignoreLOS + bool + + + +
  20. +
+ + + + +
+

+ Spring.AddMapLight(lightParams) +

+

+
+

+ + + requires MaxDynamicMapLights > 0 + +

+ + +

Parameters:

+
    +
  1. + lightParams + lightParams + + + +
  2. +
+ +

Returns:

+
    +
  1. + number + lightHandle
  2. +
+ + + +
+

+ Spring.AddModelLight(lightParams) +

+

+
+

+ + + requires MaxDynamicMapLights > 0 + +

+ + +

Parameters:

+
    +
  1. + lightParams + lightParams + + + +
  2. +
+ +

Returns:

+
    +
  1. + number + lightHandle
  2. +
+ + + +
+

+ Spring.UpdateMapLight(lightHandle, lightParams) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + lightHandle + number + + + +
  2. +
  3. + lightParams + lightParams + + + +
  4. +
+ +

Returns:

+
    +
  1. + bool + success
  2. +
+ + + +
+

+ Spring.UpdateModelLight(lightHandle, lightParams) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + lightHandle + number + + + +
  2. +
  3. + lightParams + lightParams + + + +
  4. +
+ +

Returns:

+
    +
  1. + bool + success
  2. +
+ + + +
+

+ Spring.AddLightTrackingTarget() +

+

+
+

+ +

+ + + + + + +
+

+ Spring.SetMapLightTrackingState(lightHandle, unitOrProjectileID, enableTracking, unitOrProjectile) +

+

Set a map-illuminating light to start/stop tracking the position of a moving object (unit or projectile)

+
+

+ +

+ + +

Parameters:

+
    +
  1. + lightHandle + number + + + +
  2. +
  3. + unitOrProjectileID + number + + + +
  4. +
  5. + enableTracking + bool + + + +
  6. +
  7. + unitOrProjectile + bool + + + +
  8. +
+ +

Returns:

+
    +
  1. + bool + success
  2. +
+ + + +
+

+ Spring.SetModelLightTrackingState(lightHandle, unitOrProjectileID, enableTracking, unitOrProjectile) +

+

Set a model-illuminating light to start/stop tracking the position of a moving object (unit or projectile)

+
+

+ +

+ + +

Parameters:

+
    +
  1. + lightHandle + number + + + +
  2. +
  3. + unitOrProjectileID + number + + + +
  4. +
  5. + enableTracking + bool + + + +
  6. +
  7. + unitOrProjectile + bool + + + +
  8. +
+ +

Returns:

+
    +
  1. + bool + success
  2. +
+ + + +
+

+ Unit custom rendering +

+ +

+ +


+

+

+ Spring.SetUnitNoDraw(unitID, noDraw) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + noDraw + bool + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitEngineDrawMask(unitID, drawMask) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + drawMask + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitAlwaysUpdateMatrix(unitID, alwaysUpdateMatrix) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + alwaysUpdateMatrix + bool + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitNoMinimap(unitID, unitNoMinimap) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitNoMinimap + bool + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitNoSelect(unitID, unitNoSelect) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitNoSelect + bool + whether unit can be selected or not +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitLeaveTracks(unitID, unitLeaveTracks) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + unitLeaveTracks + bool + whether unit leaves tracks on movement +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitSelectionVolumeData(unitID, featureID, scaleX, scaleY, scaleZ, offsetX, offsetY, offsetZ, vType, tType, Axis) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + featureID + number + + + +
  4. +
  5. + scaleX + number + + + +
  6. +
  7. + scaleY + number + + + +
  8. +
  9. + scaleZ + number + + + +
  10. +
  11. + offsetX + number + + + +
  12. +
  13. + offsetY + number + + + +
  14. +
  15. + offsetZ + number + + + +
  16. +
  17. + vType + number + + + +
  18. +
  19. + tType + number + + + +
  20. +
  21. + Axis + number + + + +
  22. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Features +

+ +

+ +


+

+

+ Spring.SetFeatureNoDraw(featureID, noDraw) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + noDraw + bool + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetFeatureEngineDrawMask(featureID, engineDrawMask) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + engineDrawMask + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetFeatureAlwaysUpdateMatrix(featureID, alwaysUpdateMat) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + alwaysUpdateMat + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetFeatureFade(featureID, allow) +

+

Control whether a feature will fade or not when zoomed out.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + allow + bool + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetFeatureSelectionVolumeData(featureID, scaleX, scaleY, scaleZ, offsetX, offsetY, offsetZ, vType, tType, Axis) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
  3. + scaleX + number + + + +
  4. +
  5. + scaleY + number + + + +
  6. +
  7. + scaleZ + number + + + +
  8. +
  9. + offsetX + number + + + +
  10. +
  11. + offsetY + number + + + +
  12. +
  13. + offsetZ + number + + + +
  14. +
  15. + vType + number + + + +
  16. +
  17. + tType + number + + + +
  18. +
  19. + Axis + number + + + +
  20. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Unit Icons +

+ +

+ +


+

+

+ Spring.AddUnitIcon(iconName, texFile[, size[, dist[, radAdjust]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + iconName + string + + + +
  2. +
  3. + texFile + string + + + +
  4. +
  5. + size + number + + + + (optional) +
  6. +
  7. + dist + number + + + + (optional) +
  8. +
  9. + radAdjust + number + + + + (optional) +
  10. +
+ +

Returns:

+
    +
  1. + nil or bool + added
  2. +
+ + + +
+

+ Spring.FreeUnitIcon(iconName) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + iconName + string + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + freed
  2. +
+ + + +
+

+ Spring.UnitIconSetDraw(unitID, drawIcon) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + drawIcon + bool + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitDefIcon(unitDefID, iconName) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitDefID + number + + + +
  2. +
  3. + iconName + string + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetUnitDefImage(unitDefID, image) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitDefID + number + + + +
  2. +
  3. + image + string + luaTexture|texFile +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Virtual File System +

+ +

+ + +

Prefer using VFS whenever possible

+
+

+

+ Spring.ExtractModArchiveFile(modfile) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + modfile + string + + + +
  2. +
+ +

Returns:

+
    +
  1. + bool + extracted
  2. +
+ + + +
+

+ Spring.CreateDir(path) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + path + string + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + dirCreated
  2. +
+ + + +
+

+ GUI +

+ +

+ +


+

+

+ Spring.SetActiveCommand(action[, actionExtra]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + action + string + + + +
  2. +
  3. + actionExtra + string + + + + (optional) +
  4. +
+ +

Returns:

+
    +
  1. + nil or bool + commandSet
  2. +
+ + + +
+

+ Spring.SetActiveCommand(cmdIndex[, button=1][, leftClick], rightClick, alt, ctrl, meta, shift) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + cmdIndex + number + + + +
  2. +
  3. + button + number + + + + (default 1) +
  4. +
  5. + leftClick + bool + + + + (optional) +
  6. +
  7. + rightClick + optional bool + + + +
  8. +
  9. + alt + optional bool + + + +
  10. +
  11. + ctrl + optional bool + + + +
  12. +
  13. + meta + optional bool + + + +
  14. +
  15. + shift + optional bool + + + +
  16. +
+ +

Returns:

+
    +
  1. + nil or bool + commandSet
  2. +
+ + + +
+

+ Spring.LoadCmdColorsConfig(config) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + config + string + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.LoadCtrlPanelConfig(config) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + config + string + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.ForceLayoutUpdate() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetDrawSelectionInfo(enable) +

+

Disables the "Selected Units x" box in the GUI.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + enable + bool + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetBoxSelectionByEngine(state) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + state + bool + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetTeamColor(teamID, r, g, b) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
  3. + r + number + + + +
  4. +
  5. + g + number + + + +
  6. +
  7. + b + number + + + +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.AssignMouseCursor(cmdName, iconFileName[, overwrite=true[, hotSpotTopLeft=false]]) +

+

Changes/creates the cursor of a single CursorCmd.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + cmdName + string + + + +
  2. +
  3. + iconFileName + string + +

    not the full filename, instead it is like this:

    +
     Wanted filename: Anims/cursorattack_0.bmp
    + => iconFileName: cursorattack
    +
    + +
  4. +
  5. + overwrite + bool + + + + (default true) +
  6. +
  7. + hotSpotTopLeft + bool + + + + (default false) +
  8. +
+ +

Returns:

+
    +
  1. + nil or bool + assigned
  2. +
+ + + +
+

+ Spring.ReplaceMouseCursor(oldFileName, newFileName[, hotSpotTopLeft=false]) +

+

Mass replace all occurrences of the cursor in all CursorCmds.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + oldFileName + string + + + +
  2. +
  3. + newFileName + string + + + +
  4. +
  5. + hotSpotTopLeft + bool + + + + (default false) +
  6. +
+ +

Returns:

+
    +
  1. + nil or bool + assigned
  2. +
+ + + +
+

+ Spring.SetCustomCommandDrawData(cmdID[, cmdReference]) +

+

Register your custom cmd so it gets visible in the unit's cmd queue

+
+

+ +

+ + +

Parameters:

+
    +
  1. + cmdID + number + + + +
  2. +
  3. + cmdReference + string or number + iconname | cmdID_cloneIcon + (optional) +
  4. +
+ +

Returns:

+
    +
  1. + nil or bool + assigned
  2. +
+ + + +
+

+ Mouse +

+ +

+ +


+

+

+ Spring.WarpMouse(x, y) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + y + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetMouseCursor(cursorName[, cursorScale=1.0]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + cursorName + string + + + +
  2. +
  3. + cursorScale + number + + + + (default 1.0) +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ LOS Colors +

+ +

+ +


+

+

+ Spring.SetLosViewColors(always, LOS, radar, jam, radar2) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + always + table + {r,g,b} +
  2. +
  3. + LOS + table + = {r,g,b} +
  4. +
  5. + radar + table + = {r,g,b} +
  6. +
  7. + jam + table + = {r,g,b} +
  8. +
  9. + radar2 + table + = {r,g,b} +
  10. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetNanoProjectileParams([rotVal=0[, rotVel=0[, rotAcc=0[, rotValRng=0[, rotVelRng=0[, rotAccRng=0]]]]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + rotVal + number + in degrees + (default 0) +
  2. +
  3. + rotVel + number + in degrees + (default 0) +
  4. +
  5. + rotAcc + number + in degrees + (default 0) +
  6. +
  7. + rotValRng + number + in degrees + (default 0) +
  8. +
  9. + rotVelRng + number + in degrees + (default 0) +
  10. +
  11. + rotAccRng + number + in degrees + (default 0) +
  12. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Engine Config +

+ +

+ + +

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.

+
+

+

+ Spring.SetConfigInt(name, value[, useOverlay=false]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + name + string + + + +
  2. +
  3. + value + number + + + +
  4. +
  5. + useOverlay + bool + the value will only be set in memory, and not be restored for the next game. + (default false) +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetConfigFloat(name, value[, useOverla=false]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + name + string + + + +
  2. +
  3. + value + number + + + +
  4. +
  5. + useOverla + bool + the value will only be set in memory, and not be restored for the next game.y + (default false) +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetConfigString(name, value[, useOverlay=false]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + name + string + + + +
  2. +
  3. + value + number + + + +
  4. +
  5. + useOverlay + bool + the value will only be set in memory, and not be restored for the next game. + (default false) +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.Quit() +

+

Closes the application

+
+

+ +

+ + + +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Unit Group +

+ +

+ +


+

+

+ Spring.SetUnitGroup(unitID, groupID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + groupID + number + the group number to be assigned, or -1 for deassignment +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ UI +

+ +

+ +

Very important! (allows synced inter-lua-enviroment communications)

+
+

+

+ Spring.SendLuaUIMsg(message, mode) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + message + string + + + +
  2. +
  3. + mode + string + "s"/"specs" | "a"/"allies" +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SendLuaGaiaMsg(message) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + message + string + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SendLuaRulesMsg(message) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + message + string + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SendLuaMenuMsg(msg) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + msg + string + + + +
  2. +
+ + + + +
+

+ Spring.SetLastMessagePosition(x, y, z) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + y + number + + + +
  4. +
  5. + z + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Sharing +

+ +

+ +


+

+

+ Spring.SetShareLevel(resource, shareLevel) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + resource + string + metal | energy +
  2. +
  3. + shareLevel + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.ShareResources(teamID, units) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
  3. + units + string + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.ShareResources(teamID, resource, amount) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
  3. + resource + string + metal | energy +
  4. +
  5. + amount + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Markers +

+ +

+ +


+

+

+ Spring.MarkerAddPoint(x, y, z[, text=""[, localOnly]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + y + number + + + +
  4. +
  5. + z + number + + + +
  6. +
  7. + text + string + + + + (default "") +
  8. +
  9. + localOnly + bool + + + + (optional) +
  10. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.MarkerAddLine(x1, y1, z1, x2, y2, z2[, localOnly=false[, playerId]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x1 + number + + + +
  2. +
  3. + y1 + number + + + +
  4. +
  5. + z1 + number + + + +
  6. +
  7. + x2 + number + + + +
  8. +
  9. + y2 + number + + + +
  10. +
  11. + z2 + number + + + +
  12. +
  13. + localOnly + bool + + + + (default false) +
  14. +
  15. + playerId + number + + + + (optional) +
  16. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.MarkerErasePosition(x, y, z, noop[, localOnly=false[, playerId[, alwaysErase=false]]]) +

+

+
+

+ + + Issue an erase command for markers on the map. + +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + y + number + + + +
  4. +
  5. + z + number + + + +
  6. +
  7. + noop + + + +
  8. +
  9. + localOnly + bool + do not issue a network message, erase only for the current player + (default false) +
  10. +
  11. + playerId + number + when not specified it uses the issuer playerId + (optional) +
  12. +
  13. + alwaysErase + bool + erase any marker when localOnly and current player is spectating. Allows spectators to erase players markers locally + (default false) +
  14. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Sun +

+ +

+ +


+

+

+ Spring.SetAtmosphere(params) +

+

It can be used to modify the following atmosphere parameters

+
+

+ +

+ + +

Parameters:

+
    +
  1. params + + +
      +
    • + fogStart + number + + + +
    • +
    • + fogEnd + number + + + +
    • +
    • + sunColor + rgb + + + +
    • +
    • + skyColor + rgb + + + +
    • +
    • + cloudColor + rgb + + + +
    • +
    +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +

Usage:

+ +
+

+ Spring.SetSunDirection(dirX, dirY, dirZ[, intensity=true]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + dirX + number + + + +
  2. +
  3. + dirY + number + + + +
  4. +
  5. + dirZ + number + + + +
  6. +
  7. + intensity + number + + + + (default true) +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetSunLighting(params) +

+

It can be used to modify the following sun lighting parameters

+
+

+ +

+ + +

Parameters:

+
    +
  1. params + + +
      +
    • + groundAmbientColor + rgb + + + +
    • +
    • + groundDiffuseColor + rgb + + + +
    • +
    +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +

Usage:

+ +
+

+ mapRenderingParams +

+

Map rendering params

+
+

+ +

+ + +

Fields:

+
    +
  1. + splatTexMults + rgba + + + +
  2. +
  3. + splatTexScales + rgba + + + +
  4. +
  5. + voidWater + bool + + + +
  6. +
  7. + voidGround + bool + + + +
  8. +
  9. + splatDetailNormalDiffuseAlpha + bool + + + +
  10. +
+ + + + +
+

+ Spring.SetMapRenderingParams(params) +

+

Allows to change map rendering params at runtime.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + params + mapRenderingParams + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.ForceTesselationUpdate([normal=true[, shadow=false]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + normal + bool + + + + (default true) +
  2. +
  3. + shadow + bool + + + + (default false) +
  4. +
+ +

Returns:

+
    +
  1. + bool + updated
  2. +
+ + + +
+

+ AI +

+ +

+ +


+

+

+ Spring.SendSkirmishAIMessage(aiTeam, message) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + aiTeam + number + + + +
  2. +
  3. + message + string + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil or bool + ai_processed
  2. +
+ + + +
+

+ Developers +

+ +

+ +


+

+

+ Spring.SetLogSectionFilterLevel(sectionName, logLevel) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + sectionName + string + + + +
  2. +
  3. + logLevel + string or number + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.GarbageCollectCtrl([itersPerBatch[, numStepsPerIter[, minStepsPerIter[, maxStepsPerIter[, minLoopRunTime[, maxLoopRunTime[, baseRunTimeMult[, baseMemLoadMult]]]]]]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + itersPerBatch + int + + + + (optional) +
  2. +
  3. + numStepsPerIter + int + + + + (optional) +
  4. +
  5. + minStepsPerIter + int + + + + (optional) +
  6. +
  7. + maxStepsPerIter + int + + + + (optional) +
  8. +
  9. + minLoopRunTime + number + + + + (optional) +
  10. +
  11. + maxLoopRunTime + number + + + + (optional) +
  12. +
  13. + baseRunTimeMult + number + + + + (optional) +
  14. +
  15. + baseMemLoadMult + number + + + + (optional) +
  16. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetDrawSky(drawSky) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + drawSky + bool + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetDrawWater(drawWater) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + drawWater + bool + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetDrawGround(drawGround) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + drawGround + bool + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetDrawGroundDeferred(drawGroundDeferred[, drawGroundForward]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + drawGroundDeferred + bool + + + +
  2. +
  3. + drawGroundForward + bool + allows disabling of the forward pass + treturn nil + (optional) +
  4. +
+ + + + +
+

+ Spring.SetDrawModelsDeferred(drawUnitsDeferred, drawFeaturesDeferred[, drawUnitsForward[, drawFeaturesForward]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + drawUnitsDeferred + bool + + + +
  2. +
  3. + drawFeaturesDeferred + bool + + + +
  4. +
  5. + drawUnitsForward + bool + allows disabling of the respective forward passes + (optional) +
  6. +
  7. + drawFeaturesForward + bool + allows disabling of the respective forward passes + (optional) +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetVideoCapturingMode(allowCaptureMode) +

+

This doesn't actually record the game in any way, it just regulates the framerate and interpolations.

+
+

+ +

+ + +

Parameters:

+
    +
  1. + allowCaptureMode + bool + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetVideoCapturingTimeOffset(timeOffset) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + timeOffset + bool + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ waterParams +

+

Water params

+
+

+ +

+ + +

Fields:

+
    +
  1. + absorb + rgb + + + +
  2. +
  3. + baseColor + rgb + + + +
  4. +
  5. + minColor + rgb + + + +
  6. +
  7. + surfaceColor + rgb + + + +
  8. +
  9. + diffuseColor + rgb + + + +
  10. +
  11. + specularColor + rgb + + + +
  12. +
  13. + planeColor + rgb + + + +
  14. +
  15. + texture + string + file +
  16. +
  17. + foamTexture + string + file +
  18. +
  19. + normalTexture + string + file +
  20. +
  21. + damage + number + + + +
  22. +
  23. + repeatX + number + + + +
  24. +
  25. + repeatY + number + + + +
  26. +
  27. + surfaceAlpha + number + + + +
  28. +
  29. + ambientFactor + number + + + +
  30. +
  31. + diffuseFactor + number + + + +
  32. +
  33. + specularFactor + number + + + +
  34. +
  35. + specularPower + number + + + +
  36. +
  37. + fresnelMin + number + + + +
  38. +
  39. + fresnelMax + number + + + +
  40. +
  41. + fresnelPower + number + + + +
  42. +
  43. + reflectionDistortion + number + + + +
  44. +
  45. + blurBase + number + + + +
  46. +
  47. + blurExponent + number + + + +
  48. +
  49. + perlinStartFreq + number + + + +
  50. +
  51. + perlinLacunarity + number + + + +
  52. +
  53. + perlinAmplitude + number + + + +
  54. +
  55. + numTiles + number + + + +
  56. +
  57. + shoreWaves + bool + + + +
  58. +
  59. + forceRendering + bool + + + +
  60. +
  61. + hasWaterPlane + bool + + + +
  62. +
+ + + + +
+

+ Spring.SetWaterParams(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`. + +

+ + +

Parameters:

+
    +
  1. + waterParams + waterParams + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Preload +

+ +

+ +


+

+

+ Spring.PreloadUnitDefModel(unitDefID) +

+

+
+

+ + + Allow the engine to load the unit's model (and texture) in a background thread. + Wreckages and buildOptions of a unit are automatically preloaded. + +

+ + +

Parameters:

+
    +
  1. + unitDefID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.PreloadFeatureDefModel(featureDefID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureDefID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.PreloadSoundItem(name) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + name + string + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.LoadModelTextures(modelName) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + modelName + string + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + success
  2. +
+ + + +
+

+ SDL Text +

+ +

+ +


+

+

+ Spring.SDLSetTextInputRect(x, y, width, height) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + y + number + + + +
  4. +
  5. + width + number + + + +
  6. +
  7. + height + number + + + +
  8. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SDLStartTextInput() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SDLStopTextInput() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Window Management +

+ +

+ +


+

+

+ Spring.SetWindowGeometry(displayIndex, winPosX, winPosY, winSizeX, winSizeY, fullScreen, borderless) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + displayIndex + number + + + +
  2. +
  3. + winPosX + number + + + +
  4. +
  5. + winPosY + number + + + +
  6. +
  7. + winSizeX + number + + + +
  8. +
  9. + winSizeY + number + + + +
  10. +
  11. + fullScreen + bool + + + +
  12. +
  13. + borderless + bool + + + +
  14. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetWindowMinimized() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + bool + minimized
  2. +
+ + + +
+

+ Spring.SetWindowMaximized() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + bool + maximized
  2. +
+ + + +
+

+ Misc +

+ +

+ +


+

+

+ Spring.Reload(startScript) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + startScript + string + the CONTENT of the script.txt spring should use to start. +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.Restart(commandline_args, startScript) +

+

+
+

+ + + If this call returns, something went wrong + +

+ + +

Parameters:

+
    +
  1. + commandline_args + string + commandline arguments passed to spring executable. +
  2. +
  3. + startScript + string + + + +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.Start(commandline_args, startScript) +

+

Launches a new Spring instance without terminating the existing one.

+
+

+ + + If this call returns, something went wrong + +

+ + +

Parameters:

+
    +
  1. + commandline_args + string + commandline arguments passed to spring executable. +
  2. +
  3. + 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. +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetWMIcon(iconFileName) +

+

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. + +

+ + +

Parameters:

+
    +
  1. + iconFileName + string + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ SetWMCaption(title[, titleShort=title]) +

+

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. + +

+ + +

Parameters:

+
    +
  1. + title + string + + + +
  2. +
  3. + titleShort + string + + + + (default title) +
  4. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.ClearWatchDogTimer([threadName=main]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + threadName + string + + + + (default main) +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.SetClipboard(text) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + text + string + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.Yield(sleep) +

+

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. + +

+ + +

Parameters:

+
    +
  1. + sleep + number + time in milliseconds. +
  2. +
+ +

Returns:

+
    +
  1. + bool + when true caller should continue calling Spring.Yield during the widgets/gadgets load, when false it shouldn't call it any longer.
  2. +
+ + + +

Usage:

+ +
+ +{% endraw %} diff --git a/ldoc/modules/UnsyncedRead.html b/ldoc/modules/UnsyncedRead.html new file mode 100644 index 0000000000..637d63796e --- /dev/null +++ b/ldoc/modules/UnsyncedRead.html @@ -0,0 +1,6869 @@ +--- +layout: default +title: UnsyncedRead +permalink: ldoc/modules/UnsyncedRead.html +description: Callouts to get state +parent: Lua API +table: 0x55a54e528bd0 +--- + +{% raw %} +

Module UnsyncedRead

+

Callouts to get state

+

+ +


+

+

See also:

+ + +

Decals

+
+
+ Spring.GetAllDecals +
+
+ + + +
+
+ Spring.GetDecalPos +
+
+ + + +
+
+ Spring.GetDecalSize +
+
+ + + +
+
+ Spring.GetDecalRotation +
+
+ + + +
+
+ Spring.GetDecalTexture +
+
+ + + +
+
+ Spring.GetDecalAlpha +
+
+ + + +
+
+ Spring.GetDecalOwner +
+
+ + + +
+
+ Spring.GetDecalType +
+
+ + + +
+
+

Misc

+
+
+ Spring.GetUnitTransformMatrix +
+
+ + + +
+
+ Spring.GetFeatureTransformMatrix +
+
+ + + +
+
+ Spring.MakeGLDBQuery +
+
+ + + +
+
+ Spring.GetGLDBQuery +
+
+ + + +
+
+ Spring.GetSyncedGCInfo +
+
+ + + +
+
+

Replay

+
+
+ Spring.IsReplay +
+
+ + + +
+
+ Spring.GetReplayLength +
+
+ + + +
+
+

Game/Menu Name

+
+
+ Spring.GetGameName +
+
+ + + +
+
+ Spring.GetMenuName +
+
+ + + +
+
+

Profiling

+
+
+ Spring.GetProfilerTimeRecord +
+
+ + + +
+
+ Spring.GetProfilerRecordNames +
+
+ + + +
+
+ Spring.GetLuaMemUsage +
+
+ + + +
+
+ Spring.GetVidMemUsage +
+
+ + + +
+
+

Class Timer

+
+
+ Spring.GetTimer +
+
+ Get a timer with millisecond resolution +
+
+ Spring.GetTimerMicros +
+
+ Get a timer with microsecond resolution +
+
+ Spring.GetFrameTimer +
+
+ Get a timer for the start of the frame +
+
+ Spring.DiffTimers +
+
+ + + +
+
+

Screen/Rendering Info

+
+
+ Spring.GetNumDisplays +
+
+ + + +
+
+ Spring.GetViewGeometry +
+
+ Get main view geometry (map and game rendering) +
+
+ Spring.GetDualViewGeometry +
+
+ Get dual view geometry (minimap when enabled) +
+
+ Spring.GetWindowGeometry +
+
+ Get main window geometry +
+
+ Spring.GetWindowDisplayMode +
+
+ Get main window display mode +
+
+ Spring.GetScreenGeometry +
+
+ Get screen geometry +
+
+ Spring.GetMiniMapGeometry +
+
+ Get minimap geometry +
+
+ Spring.GetMiniMapRotation +
+
+ Get minimap rotation +
+
+ Spring.GetMiniMapDualScreen +
+
+ + + +
+
+ Spring.GetSelectionBox +
+
+ Get vertices from currently active selection box +
+
+ Spring.GetDrawSelectionInfo +
+
+ + + +
+
+ Spring.IsAboveMiniMap +
+
+ + + +
+
+ Spring.GetDrawFrame +
+
+ + + +
+
+ Spring.GetFrameTimeOffset +
+
+ + + +
+
+ Spring.GetLastUpdateSeconds +
+
+ + + +
+
+ Spring.GetVideoCapturingMode +
+
+ + + +
+
+

Unit attributes

+
+
+ Spring.IsUnitAllied +
+
+ + + +
+
+ Spring.IsUnitSelected +
+
+ + + +
+
+ Spring.GetUnitLuaDraw +
+
+ + + +
+
+ Spring.GetUnitNoDraw +
+
+ + + +
+
+ Spring.GetUnitEngineDrawMask +
+
+ + + +
+
+ Spring.GetUnitAlwaysUpdateMatrix +
+
+ + + +
+
+ Spring.GetUnitDrawFlag +
+
+ + + +
+
+ Spring.GetUnitNoMinimap +
+
+ + + +
+
+ Spring.GetUnitNoSelect +
+
+ + + +
+
+ Spring.UnitIconGetDraw +
+
+ + + +
+
+ Spring.GetUnitSelectionVolumeData +
+
+ + + +
+
+

Feature attributes

+
+
+ Spring.GetFeatureLuaDraw +
+
+ + + +
+
+ Spring.GetFeatureNoDraw +
+
+ + + +
+
+ Spring.GetFeatureEngineDrawMask +
+
+ + + +
+
+ Spring.GetFeatureAlwaysUpdateMatrix +
+
+ + + +
+
+ Spring.GetFeatureDrawFlag +
+
+ + + +
+
+ Spring.GetFeatureSelectionVolumeData +
+
+ + + +
+
+

Inview

+
+
+ Spring.IsUnitInView +
+
+ + + +
+
+ Spring.IsUnitVisible +
+
+ + + +
+
+ Spring.IsUnitIcon +
+
+ + + +
+
+ Spring.IsAABBInView +
+
+ + + +
+
+ Spring.IsSphereInView +
+
+ + + +
+
+ Spring.GetUnitViewPosition +
+
+ + + +
+
+ Spring.GetVisibleUnits +
+
+ + + +
+
+ Spring.GetVisibleFeatures +
+
+ + + +
+
+ Spring.GetVisibleProjectiles +
+
+ + + +
+
+ Spring.GetRenderUnits +
+
+ + + +
+
+ Spring.GetRenderUnitsDrawFlagChanged +
+
+ + + +
+
+ Spring.GetRenderFeatures +
+
+ + + +
+
+ Spring.GetRenderFeaturesDrawFlagChanged +
+
+ + + +
+
+ Spring.ClearUnitsPreviousDrawFlag +
+
+ + + +
+
+ Spring.ClearFeaturesPreviousDrawFlag +
+
+ + + +
+
+ Spring.GetUnitsInScreenRectangle +
+
+ Get units inside a rectangle area on the map +
+
+ Spring.GetFeaturesInScreenRectangle +
+
+ Get features inside a rectangle area on the map +
+
+ Spring.GetLocalPlayerID +
+
+ + + +
+
+ Spring.GetLocalTeamID +
+
+ + + +
+
+ Spring.GetLocalAllyTeamID +
+
+ + + +
+
+ Spring.GetSpectatingState +
+
+ + + +
+
+ Spring.GetSelectedUnits +
+
+ + + +
+
+ Spring.GetSelectedUnitsSorted +
+
+ Get selected units aggregated by unitDefID +
+
+ Spring.GetSelectedUnitsCounts +
+
+ Get an aggregate count of selected units per unitDefID +
+
+ Spring.GetSelectedUnitsCount +
+
+ Returns the amount of selected units +
+
+ Spring.GetBoxSelectionByEngine +
+
+ Get if selection box is handled by engine +
+
+ Spring.IsGUIHidden +
+
+ + + +
+
+ Spring.HaveShadows +
+
+ + + +
+
+ Spring.HaveAdvShading +
+
+ + + +
+
+ Spring.GetWaterMode +
+
+ + + +
+
+ Spring.GetMapDrawMode +
+
+ + + +
+
+ Spring.GetMapSquareTexture +
+
+ + + +
+
+ rgb +
+
+ Color triple (RGB) +
+
+ Spring.GetLosViewColors +
+
+ + + +
+
+ Spring.GetNanoProjectileParams +
+
+ + + +
+
+ Spring.GetCameraNames +
+
+ Get available cameras +
+
+ camState +
+
+ Parameters for camera state +
+
+ Spring.GetCameraState +
+
+ + + +
+
+ Spring.GetCameraPosition +
+
+ + + +
+
+ Spring.GetCameraDirection +
+
+ + + +
+
+ Spring.GetCameraRotation +
+
+ + + +
+
+ Spring.GetCameraFOV +
+
+ + + +
+
+ xyz +
+
+ Cartesian triple (XYZ) +
+
+ Spring.GetCameraVectors +
+
+ + + +
+
+ Spring.WorldToScreenCoords +
+
+ + + +
+
+ Spring.TraceScreenRay +
+
+ Get information about a ray traced from screen to world position +
+
+ Spring.GetPixelDir +
+
+ + + +
+
+ Spring.GetTeamColor +
+
+ + + +
+
+ Spring.GetTeamOrigColor +
+
+ + + +
+
+ Spring.GetDrawSeconds +
+
+ + + +
+
+

Sound

+
+
+ Spring.GetSoundStreamTime +
+
+ + + +
+
+ Spring.GetSoundEffectParams +
+
+ + + +
+
+

Game Speed

+
+
+ Spring.GetFPS +
+
+ + + +
+
+ Spring.GetGameSpeed +
+
+ + + +
+
+ Spring.GetGameState +
+
+ + + +
+
+

Commands

+
+
+ Spring.GetActiveCommand +
+
+ + + +
+
+ Spring.GetDefaultCommand +
+
+ + + +
+
+ cmdDesc +
+
+ Command Description +
+
+ Spring.GetActiveCmdDescs +
+
+ + + +
+
+ Spring.GetActiveCmdDesc +
+
+ + + +
+
+ Spring.GetCmdDescIndex +
+
+ + + +
+
+ Spring.GetBuildFacing +
+
+ + + +
+
+ Spring.GetBuildSpacing +
+
+ + + +
+
+ Spring.GetGatherMode +
+
+ + + +
+
+ Spring.GetActivePage +
+
+ + + +
+
+

Mouse State

+
+
+ Spring.GetMouseState +
+
+ + + +
+
+ Spring.GetMouseCursor +
+
+ + + +
+
+ Spring.GetMouseStartPosition +
+
+ + + +
+
+

Text

+
+
+ Spring.GetClipboard +
+
+ + + +
+
+ Spring.IsUserWriting +
+
+ + + +
+
+

Console

+
+
+ Spring.GetLastMessagePositions +
+
+ + + +
+
+ Spring.GetConsoleBuffer +
+
+ + + +
+
+ Spring.GetCurrentTooltip +
+
+ + + +
+
+

Key Input

+
+
+ Spring.GetKeyFromScanSymbol +
+
+ + + +
+
+ Spring.GetKeyState +
+
+ + + +
+
+ Spring.GetModKeyState +
+
+ + + +
+
+ Spring.GetPressedKeys +
+
+ + + +
+
+ Spring.GetPressedScans +
+
+ + + +
+
+ Spring.GetInvertQueueKey +
+
+ + + +
+
+ Spring.GetKeyCode +
+
+ + + +
+
+ Spring.GetKeySymbol +
+
+ + + +
+
+ Spring.GetScanSymbol +
+
+ + + +
+
+ keybindingSpec +
+
+ Keybinding spec +
+
+ Spring.GetKeyBindings +
+
+ + + +
+
+ Spring.GetActionHotKeys +
+
+ + + +
+
+

Unit Groups

+
+
+ Spring.GetGroupList +
+
+ + + +
+
+ Spring.GetSelectedGroup +
+
+ + + +
+
+ Spring.GetUnitGroup +
+
+ + + +
+
+ Spring.GetGroupUnits +
+
+ + + +
+
+ Spring.GetGroupUnitsSorted +
+
+ + + +
+
+ Spring.GetGroupUnitsCounts +
+
+ + + +
+
+ Spring.GetGroupUnitsCount +
+
+ + + +
+
+

Team/Player Info

+
+
+ rosterSpec +
+
+ Roster spec +
+
+ Spring.GetPlayerRoster +
+
+ + + +
+
+ Spring.GetPlayerTraffic +
+
+ + + +
+
+ Spring.GetPlayerStatistics +
+
+ + + +
+
+

Configuration

+
+
+ configSpec +
+
+ Configuration spec +
+
+ Spring.GetConfigParams +
+
+ + + +
+
+ Spring.GetConfigInt +
+
+ + + +
+
+ Spring.GetConfigFloat +
+
+ + + +
+
+ Spring.GetConfigString +
+
+ + + +
+
+ Spring.GetLogSections +
+
+ + + +
+
+ +

+ Decals +

+ +

+ +


+

+

+ Spring.GetAllDecals() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + nil or {[number],...} + decalIndices
  2. +
+ + + +
+

+ Spring.GetDecalPos(decalIndex) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + decalIndex + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + posX
  2. +
  3. + number + posY
  4. +
  5. + number + posZ
  6. +
+ + + +
+

+ Spring.GetDecalSize(decalIndex) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + decalIndex + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + sizeX
  2. +
  3. + number + sizeY
  4. +
+ + + +
+

+ Spring.GetDecalRotation(decalIndex) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + decalIndex + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + rotation in radians
  2. +
+ + + +
+

+ Spring.GetDecalTexture(decalIndex) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + decalIndex + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or string + texture
  2. +
+ + + +
+

+ Spring.GetDecalAlpha(decalIndex) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + decalIndex + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + alpha
  2. +
+ + + +
+

+ Spring.GetDecalOwner(decalIndex) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + decalIndex + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + unitID
  2. +
+ + + +
+

+ Spring.GetDecalType(decalIndex) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + decalIndex + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or string + type "explosion"|"building"|"lua"|"unknown"
  2. +
+ + + +
+

+ Misc +

+ +

+ +


+

+

+ Spring.GetUnitTransformMatrix(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + number or nil + m11 nil when unitID cannot be parsed
  2. +
  3. + number + m12
  4. +
  5. + number + m13
  6. +
  7. + number + m14
  8. +
  9. + number + m21
  10. +
  11. + number + m22
  12. +
  13. + number + m23
  14. +
  15. + number + m24
  16. +
  17. + number + m31
  18. +
  19. + number + m32
  20. +
  21. + number + m33
  22. +
  23. + number + m34
  24. +
  25. + number + m41
  26. +
  27. + number + m42
  28. +
  29. + number + m43
  30. +
  31. + number + m44
  32. +
+ + + +
+

+ Spring.GetFeatureTransformMatrix(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + number or nil + m11 nil when featureID cannot be parsed
  2. +
  3. + number + m12
  4. +
  5. + number + m13
  6. +
  7. + number + m14
  8. +
  9. + number + m21
  10. +
  11. + number + m22
  12. +
  13. + number + m23
  14. +
  15. + number + m24
  16. +
  17. + number + m31
  18. +
  19. + number + m32
  20. +
  21. + number + m33
  22. +
  23. + number + m34
  24. +
  25. + number + m41
  26. +
  27. + number + m42
  28. +
  29. + number + m43
  30. +
  31. + number + m44
  32. +
+ + + +
+

+ Spring.MakeGLDBQuery([forced=false]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + forced + bool + + + + (default false) +
  2. +
+ +

Returns:

+
    +
  1. + bool + + +
  2. +
+ + + +
+

+ Spring.GetGLDBQuery([blockingCall=true]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + blockingCall + bool + + + + (default true) +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + ready
  2. +
  3. + bool + drivers not ok when true
  4. +
  5. + number + maxCtxX
  6. +
  7. + number + maxCtxY
  8. +
  9. + string + url
  10. +
  11. + string + driver
  12. +
+ + + +
+

+ Spring.GetSyncedGCInfo([collectGC=false]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + collectGC + bool + collect before returning metric + (default false) +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + GC values are expressed in Kbytes: #bytes/2^10
  2. +
+ + + +
+

+ Replay +

+ +

+ +


+

+

+ Spring.IsReplay() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + nil or bool + isReplay
  2. +
+ + + +
+

+ Spring.GetReplayLength() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + nil or number + timeInSeconds
  2. +
+ + + +
+

+ Game/Menu Name +

+ +

+ +


+

+

+ Spring.GetGameName() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + string + name
  2. +
+ + + +
+

+ Spring.GetMenuName() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + string + name name .. version from Modinfo.lua. E.g. "Spring: 1944 test-5640-ac2d15b".
  2. +
+ + + +
+

+ Profiling +

+ +

+ +


+

+

+ Spring.GetProfilerTimeRecord(profilerName[, frameData=false]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + profilerName + string + + + +
  2. +
  3. + frameData + bool + + + + (default false) +
  4. +
+ +

Returns:

+
    +
  1. + number + total in ms
  2. +
  3. + number + current in ms
  4. +
  5. + number + max_dt
  6. +
  7. + number + time_pct
  8. +
  9. + number + peak_pct
  10. +
  11. + nil or {[number]=number,...} + frameData where key is the frame index and value is duration
  12. +
+ + + +
+

+ Spring.GetProfilerRecordNames() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + {string,...} + profilerNames
  2. +
+ + + +
+

+ Spring.GetLuaMemUsage() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + luaHandleAllocedMem in kilobytes
  2. +
  3. + number + luaHandleNumAllocs divided by 1000
  4. +
  5. + number + luaGlobalAllocedMem in kilobytes
  6. +
  7. + number + luaGlobalNumAllocs divided by 1000
  8. +
  9. + number + luaUnsyncedGlobalAllocedMem in kilobytes
  10. +
  11. + number + luaUnsyncedGlobalNumAllocs divided by 1000
  12. +
  13. + number + luaSyncedGlobalAllocedMem in kilobytes
  14. +
  15. + number + luaSyncedGlobalNumAllocs divided by 1000
  16. +
+ + + +
+

+ Spring.GetVidMemUsage() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + usedMem in MB
  2. +
  3. + number + availableMem in MB
  4. +
+ + + +
+

+ Class Timer +

+ +

+ Spring.GetTimer() +

+

Get a timer with millisecond resolution

+
+

+ +

+ + + +

Returns:

+
    +
  1. + Timer + + +
  2. +
+ + + +
+

+ Spring.GetTimerMicros() +

+

Get a timer with microsecond resolution

+
+

+ +

+ + + +

Returns:

+
    +
  1. + Timer + + +
  2. +
+ + + +
+

+ Spring.GetFrameTimer([lastFrameTime=false]) +

+

Get a timer for the start of the frame

+
+

+ + + This should give better results for camera interpolations + +

+ + +

Parameters:

+
    +
  1. + lastFrameTime + bool + whether to use last frame time instead of last frame start + (default false) +
  2. +
+ +

Returns:

+
    +
  1. + Timer + + +
  2. +
+ + + +
+

+ Spring.DiffTimers(endTimer, startTimer[, returnMs=false[, fromMicroSecs=false]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + endTimer + Timer + + + +
  2. +
  3. + startTimer + Timer + + + +
  4. +
  5. + returnMs + bool + whether to return timeAmount in milliseconds as opposed to seconds + (default false) +
  6. +
  7. + fromMicroSecs + bool + whether timers are in microseconds instead of milliseconds + (default false) +
  8. +
+ +

Returns:

+
    +
  1. + number + timeAmount
  2. +
+ + + +
+

+ Screen/Rendering Info +

+ +

+ +


+

+

+ Spring.GetNumDisplays() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + numDisplays as returned by SDL_GetNumVideoDisplays
  2. +
+ + + +
+

+ Spring.GetViewGeometry() +

+

Get main view geometry (map and game rendering)

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + viewSizeX in px
  2. +
  3. + number + viewSizeY in px
  4. +
  5. + number + viewPosX offset from leftmost screen left border in px
  6. +
  7. + number + viewPosY offset from bottommost screen bottom border in px
  8. +
+ + + +
+

+ Spring.GetDualViewGeometry() +

+

Get dual view geometry (minimap when enabled)

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + dualViewSizeX in px
  2. +
  3. + number + dualViewSizeY in px
  4. +
  5. + number + dualViewPosX offset from leftmost screen left border in px
  6. +
  7. + number + dualViewPosY offset from bottommost screen bottom border in px
  8. +
+ + + +
+

+ Spring.GetWindowGeometry() +

+

Get main window geometry

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + winSizeX in px
  2. +
  3. + number + winSizeY in px
  4. +
  5. + number + winPosX in px
  6. +
  7. + number + winPosY in px
  8. +
  9. + number + windowBorderTop in px
  10. +
  11. + number + windowBorderLeft in px
  12. +
  13. + number + windowBorderBottom in px
  14. +
  15. + number + windowBorderRight in px
  16. +
+ + + +
+

+ Spring.GetWindowDisplayMode() +

+

Get main window display mode

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + width in px
  2. +
  3. + number + height in px
  4. +
  5. + number + bits per pixel
  6. +
  7. + number + refresh rate in Hz
  8. +
+ + + +
+

+ Spring.GetScreenGeometry([displayIndex=-1[, queryUsable=false]]) +

+

Get screen geometry

+
+

+ +

+ + +

Parameters:

+
    +
  1. + displayIndex + number + + + + (default -1) +
  2. +
  3. + queryUsable + bool + + + + (default false) +
  4. +
+ +

Returns:

+
    +
  1. + number + screenSizeX in px
  2. +
  3. + number + screenSizeY in px
  4. +
  5. + number + screenPosX in px
  6. +
  7. + number + screenPosY in px
  8. +
  9. + number + windowBorderTop in px
  10. +
  11. + number + windowBorderLeft in px
  12. +
  13. + number + windowBorderBottom in px
  14. +
  15. + number + windowBorderRight in px
  16. +
  17. + nil or number + screenUsableSizeX in px
  18. +
  19. + nil or number + screenUsableSizeY in px
  20. +
  21. + nil or number + screenUsablePosX in px
  22. +
  23. + nil or number + screenUsablePosY in px
  24. +
+ + + +
+

+ Spring.GetMiniMapGeometry() +

+

Get minimap geometry

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + minimapPosX in px
  2. +
  3. + number + minimapPosY in px
  4. +
  5. + number + minimapSizeX in px
  6. +
  7. + number + minimapSizeY in px
  8. +
  9. + bool + minimized
  10. +
  11. + bool + maximized
  12. +
+ + + +
+

+ Spring.GetMiniMapRotation() +

+

Get minimap rotation

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + amount in radians
  2. +
+ + + +
+

+ Spring.GetMiniMapDualScreen() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + string or false + position "left"|"right" when dual screen is enabled, false when not
  2. +
+ + + +
+

+ Spring.GetSelectionBox() +

+

Get vertices from currently active selection box

+
+

+ + + Returns nil when selection box is inactive + +

+ + + +

Returns:

+
    +
  1. + nil or number + bottomLeftX
  2. +
  3. + nil or number + topRightX
  4. +
  5. + nil or number + topRightY
  6. +
  7. + nil or number + bottomLeftY
  8. +
+ + + +
+

+ Spring.GetDrawSelectionInfo() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + bool + + +
  2. +
+ + + +
+

+ Spring.IsAboveMiniMap(x, y) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + y + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + bool + isAbove
  2. +
+ + + +
+

+ Spring.GetDrawFrame() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + low_16bit
  2. +
  3. + number + high_16bit
  4. +
+ + + +
+

+ Spring.GetFrameTimeOffset() +

+

+
+

+ + + 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. + +

+ + + +

Returns:

+
    +
  1. + nil or number + offset of the current draw frame from the last sim frame, expressed in fractions of a frame
  2. +
+ + + +
+

+ Spring.GetLastUpdateSeconds() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + nil or number + lastUpdateSeconds
  2. +
+ + + +
+

+ Spring.GetVideoCapturingMode() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + bool + allowRecord
  2. +
+ + + +
+

+ Unit attributes +

+ +

+ +


+

+

+ Spring.IsUnitAllied(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + isAllied nil with unitID cannot be parsed
  2. +
+ + + +
+

+ Spring.IsUnitSelected(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + isSelected nil when unitID cannot be parsed
  2. +
+ + + +
+

+ Spring.GetUnitLuaDraw(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + draw nil when unitID cannot be parsed
  2. +
+ + + +
+

+ Spring.GetUnitNoDraw(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + nil when unitID cannot be parsed
  2. +
+ + + +
+

+ Spring.GetUnitEngineDrawMask(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + nil when unitID cannot be parsed
  2. +
+ + + +
+

+ Spring.GetUnitAlwaysUpdateMatrix(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + nil when unitID cannot be parsed
  2. +
+ + + +
+

+ Spring.GetUnitDrawFlag(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + nil when unitID cannot be parsed
  2. +
+ + + +
+

+ Spring.GetUnitNoMinimap(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + nil when unitID cannot be parsed
  2. +
+ + + +
+

+ Spring.GetUnitNoSelect(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + nil when unitID cannot be parsed
  2. +
+ + + +
+

+ Spring.UnitIconGetDraw(unitID, nil) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + nil + nil or bool + when unitID is invalid +
  4. +
+ + + + +
+

+ Spring.GetUnitSelectionVolumeData(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + number or nil + scaleX nil when unitID cannot be parsed
  2. +
  3. + number + scaleY
  4. +
  5. + number + scaleZ
  6. +
  7. + number + offsetX
  8. +
  9. + number + offsetY
  10. +
  11. + number + offsetZ
  12. +
  13. + number + volumeType
  14. +
  15. + number + useContHitTest
  16. +
  17. + number + getPrimaryAxis
  18. +
  19. + bool + ignoreHits
  20. +
+ + + +
+

+ Feature attributes +

+ +

+ +


+

+

+ Spring.GetFeatureLuaDraw(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + nil when featureID cannot be parsed
  2. +
+ + + +
+

+ Spring.GetFeatureNoDraw(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + nil when featureID cannot be parsed
  2. +
+ + + +
+

+ Spring.GetFeatureEngineDrawMask(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + nil when featureID cannot be parsed
  2. +
+ + + +
+

+ Spring.GetFeatureAlwaysUpdateMatrix(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + nil when featureID cannot be parsed
  2. +
+ + + +
+

+ Spring.GetFeatureDrawFlag(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + nil when featureID cannot be parsed
  2. +
+ + + +
+

+ Spring.GetFeatureSelectionVolumeData(featureID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + featureID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + number or nil + scaleX nil when unitID cannot be parsed
  2. +
  3. + number + scaleY
  4. +
  5. + number + scaleZ
  6. +
  7. + number + offsetX
  8. +
  9. + number + offsetY
  10. +
  11. + number + offsetZ
  12. +
  13. + number + volumeType
  14. +
  15. + number + useContHitTest
  16. +
  17. + number + getPrimaryAxis
  18. +
  19. + bool + ignoreHits
  20. +
+ + + +
+

+ Inview +

+ +

+ +


+

+

+ Spring.IsUnitInView(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + inView nil when unitID cannot be parsed
  2. +
+ + + +
+

+ Spring.IsUnitVisible(unitID[, radius], checkIcon) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + radius + number + unitRadius when not specified + (optional) +
  4. +
  5. + checkIcon + bool + + + +
  6. +
+ +

Returns:

+
    +
  1. + nil or bool + isVisible nil when unitID cannot be parsed
  2. +
+ + + +
+

+ Spring.IsUnitIcon(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or bool + isUnitIcon nil when unitID cannot be parsed
  2. +
+ + + +
+

+ Spring.IsAABBInView(minX, minY, minZ, maxX, maxY, maxZ) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + minX + number + + + +
  2. +
  3. + minY + number + + + +
  4. +
  5. + minZ + number + + + +
  6. +
  7. + maxX + number + + + +
  8. +
  9. + maxY + number + + + +
  10. +
  11. + maxZ + number + + + +
  12. +
+ +

Returns:

+
    +
  1. + bool + inView
  2. +
+ + + +
+

+ Spring.IsSphereInView(posX, posY, posZ[, radius=0]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + posX + number + + + +
  2. +
  3. + posY + number + + + +
  4. +
  5. + posZ + number + + + +
  6. +
  7. + radius + number + + + + (default 0) +
  8. +
+ +

Returns:

+
    +
  1. + bool + inView
  2. +
+ + + +
+

+ Spring.GetUnitViewPosition(unitID[, midPos=false]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
  3. + midPos + bool + + + + (default false) +
  4. +
+ +

Returns:

+
    +
  1. + number or nil + x nil when unitID cannot be parsed
  2. +
  3. + number + y
  4. +
  5. + number + z
  6. +
+ + + +
+

+ Spring.GetVisibleUnits([teamID=-1[, radius=30[, icons=true]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + + (default -1) +
  2. +
  3. + radius + number + + + + (default 30) +
  4. +
  5. + icons + bool + + + + (default true) +
  6. +
+ +

Returns:

+
    +
  1. + nil or {[number],...} + unitIDs
  2. +
+ + + +
+

+ Spring.GetVisibleFeatures([teamID=-1[, radius=30[, icons=true[, geos=true]]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + + (default -1) +
  2. +
  3. + radius + number + + + + (default 30) +
  4. +
  5. + icons + bool + + + + (default true) +
  6. +
  7. + geos + bool + + + + (default true) +
  8. +
+ +

Returns:

+
    +
  1. + nil or {[number],...} + featureIDs
  2. +
+ + + +
+

+ Spring.GetVisibleProjectiles([allyTeamID=-1[, addSyncedProjectiles=true[, addWeaponProjectiles=true[, addPieceProjectiles=true]]]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + allyTeamID + number + + + + (default -1) +
  2. +
  3. + addSyncedProjectiles + bool + + + + (default true) +
  4. +
  5. + addWeaponProjectiles + bool + + + + (default true) +
  6. +
  7. + addPieceProjectiles + bool + + + + (default true) +
  8. +
+ +

Returns:

+
    +
  1. + nil or {[number],...} + projectileIDs
  2. +
+ + + +
+

+ Spring.GetRenderUnits() +

+

+
+

+ +

+ + + + + + +
+

+ Spring.GetRenderUnitsDrawFlagChanged() +

+

+
+

+ +

+ + + + + + +
+

+ Spring.GetRenderFeatures() +

+

+
+

+ +

+ + + + + + +
+

+ Spring.GetRenderFeaturesDrawFlagChanged() +

+

+
+

+ +

+ + + + + + +
+

+ Spring.ClearUnitsPreviousDrawFlag() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.ClearFeaturesPreviousDrawFlag() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + nil + + +
  2. +
+ + + +
+

+ Spring.GetUnitsInScreenRectangle(left, top, right, bottom[, allegiance=-1]) +

+

Get units inside a rectangle area on the map

+
+

+ +

+ + +

Parameters:

+
    +
  1. + left + number + + + +
  2. +
  3. + top + number + + + +
  4. +
  5. + right + number + + + +
  6. +
  7. + bottom + number + + + +
  8. +
  9. + allegiance + number + teamID when > 0, when < 0 one of AllUnits = -1, MyUnits = -2, AllyUnits = -3, EnemyUnits = -4 + (default -1) +
  10. +
+ +

Returns:

+
    +
  1. + nil or {[number],...} + unitIDs
  2. +
+ + + +
+

+ Spring.GetFeaturesInScreenRectangle(left, top, right, bottom) +

+

Get features inside a rectangle area on the map

+
+

+ +

+ + +

Parameters:

+
    +
  1. + left + number + + + +
  2. +
  3. + top + number + + + +
  4. +
  5. + right + number + + + +
  6. +
  7. + bottom + number + + + +
  8. +
+ +

Returns:

+
    +
  1. + nil or {[number],...} + featureIDs
  2. +
+ + + +
+

+ Spring.GetLocalPlayerID() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + playerID
  2. +
+ + + +
+

+ Spring.GetLocalTeamID() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + teamID
  2. +
+ + + +
+

+ Spring.GetLocalAllyTeamID() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + allyTeamID
  2. +
+ + + +
+

+ Spring.GetSpectatingState() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + bool + spectating
  2. +
  3. + bool + spectatingFullView
  4. +
  5. + bool + spectatingFullSelect
  6. +
+ + + +
+

+ Spring.GetSelectedUnits() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + {[number],...} + unitIDs
  2. +
+ + + +
+

+ Spring.GetSelectedUnitsSorted() +

+

Get selected units aggregated by unitDefID

+
+

+ +

+ + + +

Returns:

+
    +
  1. + {[number]={number,...},...} + where keys are unitDefIDs and values are unitIDs
  2. +
  3. + n + the number of unitDefIDs
  4. +
+ + + +
+

+ Spring.GetSelectedUnitsCounts() +

+

Get an aggregate count of selected units per unitDefID

+
+

+ +

+ + + +

Returns:

+
    +
  1. + {[number]=number,...} + unitsCounts where keys are unitDefIDs and values are counts
  2. +
  3. + n + the number of unitDefIDs
  4. +
+ + + +
+

+ Spring.GetSelectedUnitsCount() +

+

Returns the amount of selected units

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + selectedUnitsCount
  2. +
+ + + +
+

+ Spring.GetBoxSelectionByEngine() +

+

Get if selection box is handled by engine

+
+

+ +

+ + + +

Returns:

+
    +
  1. + bool + when true engine won't select units inside selection box when released
  2. +
+ + +

See also:

+ + +
+

+ Spring.IsGUIHidden() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + bool + + +
  2. +
+ + + +
+

+ Spring.HaveShadows() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + shadowsLoaded + + +
  2. +
+ + + +
+

+ Spring.HaveAdvShading() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + bool + useAdvShading
  2. +
  3. + bool + groundUseAdvShading
  4. +
+ + + +
+

+ Spring.GetWaterMode() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + waterRendererID
  2. +
  3. + string + waterRendererName
  4. +
+ + +

See also:

+ + +
+

+ Spring.GetMapDrawMode() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + nil or string + "normal"|"height"|"metal"|"pathTraversability"|"los"
  2. +
+ + + +
+

+ Spring.GetMapSquareTexture(texSquareX, texSquareY, lodMin, luaTexName[, lodMax=lodMin]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + texSquareX + number + + + +
  2. +
  3. + texSquareY + number + + + +
  4. +
  5. + lodMin + number + + + +
  6. +
  7. + luaTexName + string + + + +
  8. +
  9. + lodMax + number + + + + (default lodMin) +
  10. +
+ +

Returns:

+
    +
  1. + nil or bool + success
  2. +
+ + + +
+

+ rgb +

+

Color triple (RGB)

+
+

+ +

+ + +

Fields:

+
    +
  1. + r + number + + + +
  2. +
  3. + g + number + + + +
  4. +
  5. + b + number + + + +
  6. +
+ + + + +
+

+ Spring.GetLosViewColors() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + { + always=rgb, LOS=rgb, radar=rgb, jam=rgb, radar2=rgb }
  2. +
+ + + +
+

+ Spring.GetNanoProjectileParams() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + rotVal in degrees
  2. +
  3. + number + rotVel in degrees
  4. +
  5. + number + rotAcc in degrees
  6. +
  7. + number + rotValRng in degrees
  8. +
  9. + number + rotVelRng in degrees
  10. +
  11. + number + rotAccRng in degrees
  12. +
+ + + +
+

+ Spring.GetCameraNames() +

+

Get available cameras

+
+

+ +

+ + + +

Returns:

+
    +
  1. + {[string] + = number} where keys are names and values are indices
  2. +
+ + + +
+

+ camState +

+

Parameters for camera state

+
+

+ + + Highly dependent on the type of the current camera controller + +

+ + +

Fields:

+
    +
  1. + name + string + "ta"|"spring"|"rot"|"ov"|"free"|"fps"|"dummy" +
  2. +
  3. + mode + number + the camera mode: 0 (fps), 1 (ta), 2 (spring), 3 (rot), 4 (free), 5 (ov), 6 (dummy) +
  4. +
  5. + fov + number + + + +
  6. +
  7. + px + number + Position X of the ground point in screen center +
  8. +
  9. + py + number + Position Y of the ground point in screen center +
  10. +
  11. + pz + number + Position Z of the ground point in screen center +
  12. +
  13. + dx + number + Camera direction vector X +
  14. +
  15. + dy + number + Camera direction vector Y +
  16. +
  17. + dz + number + Camera direction vector Z +
  18. +
  19. + rx + number + Camera rotation angle on X axis (spring) +
  20. +
  21. + ry + number + Camera rotation angle on Y axis (spring) +
  22. +
  23. + rz + number + Camera rotation angle on Z axis (spring) +
  24. +
  25. + angle + number + Camera rotation angle on X axis (aka tilt/pitch) (ta) +
  26. +
  27. + flipped + number + -1 for when south is down, 1 for when north is down (ta) +
  28. +
  29. + dist + number + Camera distance from the ground (spring) +
  30. +
  31. + height + number + Camera distance from the ground (ta) +
  32. +
  33. + oldHeight + number + Camera distance from the ground, cannot be changed (rot) +
  34. +
+ + + + +
+

+ Spring.GetCameraState([useReturns=true]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + useReturns + bool + when true return multiple values instead of table + (default true) +
  2. +
+ +

Returns:

+
    +
  1. + any or camState + ret1
  2. +
  3. + any or nil + ret2
  4. +
  5. + any or nil + retn
  6. +
+ + + +
+

+ Spring.GetCameraPosition() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + posX + + +
  2. +
  3. + posY + + +
  4. +
  5. + posZ + + +
  6. +
+ + + +
+

+ Spring.GetCameraDirection() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + dirX + + +
  2. +
  3. + dirY + + +
  4. +
  5. + dirZ + + +
  6. +
+ + + +
+

+ Spring.GetCameraRotation() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + rotX + in radians
  2. +
  3. + rotY + in radians
  4. +
  5. + rotZ + in radians
  6. +
+ + + +
+

+ Spring.GetCameraFOV() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + vFOV
  2. +
  3. + number + hFOV
  4. +
+ + + +
+

+ xyz +

+

Cartesian triple (XYZ)

+
+

+ +

+ + +

Fields:

+
    +
  1. + x + number + + + +
  2. +
  3. + y + number + + + +
  4. +
  5. + z + number + + + +
  6. +
+ + + + +
+

+ Spring.GetCameraVectors() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + { + forward = xyz, up = xyz, right = xyz, topFrustumPlane = xyz, botFrustumPlane = xyz, lftFrustumPlane = xyz, rgtFrustumPlane = xyz }
  2. +
+ + + +
+

+ Spring.WorldToScreenCoords(x, y, z) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + y + number + + + +
  4. +
  5. + z + number + + + +
  6. +
+ +

Returns:

+
    +
  1. + viewPortX + + +
  2. +
  3. + viewPortY + + +
  4. +
  5. + viewPortZ + + +
  6. +
+ + + +
+

+ Spring.TraceScreenRay(screenX, screenY[, onlyCoords=false[, useMinimap=false[, includeSky=false[, ignoreWater=false[, heightOffset=0]]]]]) +

+

Get information about a ray traced from screen to world position

+
+

+ + + Extended to allow a custom plane, parameters are (0, 1, 0, D=0) where D is the offset D can be specified in the third argument (if all the bools are false) or in the seventh (as shown). + + Intersection coordinates are returned in t[4],t[5],t[6] when the ray goes offmap and includeSky is true), or when no unit or feature is hit (or onlyCoords is true). + + This will only work for units & objects with the default collission sphere. Per Piece collission and custom collission objects are not supported. + + The unit must be selectable, to appear to a screen trace ray. + +

+ + +

Parameters:

+
    +
  1. + screenX + number + position on x axis in mouse coordinates (origin on left border of view) +
  2. +
  3. + screenY + number + position on y axis in mouse coordinates (origin on top border of view) +
  4. +
  5. + onlyCoords + bool + return only description (1st return value) and coordinates (2nd return value) + (default false) +
  6. +
  7. + useMinimap + bool + if position arguments are contained by minimap, use the minimap corresponding world position + (default false) +
  8. +
  9. + includeSky + bool + + + + (default false) +
  10. +
  11. + ignoreWater + bool + + + + (default false) +
  12. +
  13. + heightOffset + number + + + + (default 0) +
  14. +
+ +

Returns:

+
    +
  1. + nil or string + description of traced position
  2. +
  3. + nil, number, string or xyz + unitID or feature, position triple when onlyCoords=true
  4. +
  5. + nil, number or string + featureID or ground
  6. +
  7. + nil or xyz + coords
  8. +
+ + + +
+

+ Spring.GetPixelDir(x, y) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + x + number + + + +
  2. +
  3. + y + number + + + +
  4. +
+ +

Returns:

+
    +
  1. + dirX + + +
  2. +
  3. + dirY + + +
  4. +
  5. + dirZ + + +
  6. +
+ + + +
+

+ Spring.GetTeamColor(teamID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + r factor from 0 to 1
  2. +
  3. + nil or number + g factor from 0 to 1
  4. +
  5. + nil or number + b factor from 0 to 1
  6. +
  7. + nil or number + a factor from 0 to 1
  8. +
+ + + +
+

+ Spring.GetTeamOrigColor(teamID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + teamID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + r factor from 0 to 1
  2. +
  3. + nil or number + g factor from 0 to 1
  4. +
  5. + nil or number + b factor from 0 to 1
  6. +
  7. + nil or number + a factor from 0 to 1
  8. +
+ + + +
+

+ Spring.GetDrawSeconds() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + time + in seconds
  2. +
+ + + +
+

+ Sound +

+ +

+ +


+

+

+ Spring.GetSoundStreamTime() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + playTime
  2. +
  3. + number + time
  4. +
+ + + +
+

+ Spring.GetSoundEffectParams() +

+

+
+

+ +

+ + + + + + +
+

+ Game Speed +

+ +

+ +


+

+

+ Spring.GetFPS() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + fps
  2. +
+ + + +
+

+ Spring.GetGameSpeed() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + wantedSpeedFactor
  2. +
  3. + number + speedFactor
  4. +
  5. + bool + paused
  6. +
+ + + +
+

+ Spring.GetGameState([maxLatency=500]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + maxLatency + number + used for isSimLagging return parameter + (default 500) +
  2. +
+ +

Returns:

+
    +
  1. + bool + doneLoading
  2. +
  3. + bool + isSavedGame
  4. +
  5. + bool + isClientPaused
  6. +
  7. + bool + isSimLagging
  8. +
+ + + +
+

+ Commands +

+ +

+ +


+

+

+ Spring.GetActiveCommand() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + nil or number + cmdIndex
  2. +
  3. + nil or number + cmdID
  4. +
  5. + nil or number + cmdType
  6. +
  7. + nil or string + cmdName
  8. +
+ + + +
+

+ Spring.GetDefaultCommand() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + nil or number + cmdIndex
  2. +
  3. + nil or number + cmdID
  4. +
  5. + nil or number + cmdType
  6. +
  7. + nil or string + cmdName
  8. +
+ + + +
+

+ cmdDesc +

+

Command Description

+
+

+ + + Contains data about a command + +

+ + +

Fields:

+
    +
  1. + id + number + + + +
  2. +
  3. + type + number + + + +
  4. +
  5. + name + string + + + +
  6. +
  7. + action + string + + + +
  8. +
  9. + tooltip + string + + + +
  10. +
  11. + texture + string + + + +
  12. +
  13. + cursor + string + + + +
  14. +
  15. + queueing + bool + + + +
  16. +
  17. + hidden + bool + + + +
  18. +
  19. + disabled + bool + + + +
  20. +
  21. + showUnique + bool + + + +
  22. +
  23. + onlyTexture + bool + + + +
  24. +
  25. + params + {[string],...} + + + +
  26. +
+ + + + +
+

+ Spring.GetActiveCmdDescs() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + {[cmdDesc],...} + cmdDescs
  2. +
+ + + +
+

+ Spring.GetActiveCmdDesc(cmdIndex) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + cmdIndex + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or cmdDesc + + +
  2. +
+ + + +
+

+ Spring.GetCmdDescIndex(cmdID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + cmdID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + cmdDescIndex
  2. +
+ + + +
+

+ Spring.GetBuildFacing() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + buildFacing
  2. +
+ + + +
+

+ Spring.GetBuildSpacing() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + buildSpacing
  2. +
+ + + +
+

+ Spring.GetGatherMode() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + gatherMode
  2. +
+ + + +
+

+ Spring.GetActivePage() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + activePage
  2. +
  3. + number + maxPage
  4. +
+ + + +
+

+ Mouse State +

+ +

+ +


+

+

+ Spring.GetMouseState() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + x
  2. +
  3. + number + y
  4. +
  5. + number + lmbPressed left mouse button pressed
  6. +
  7. + number + mmbPressed middle mouse button pressed
  8. +
  9. + number + rmbPressed right mouse button pressed
  10. +
  11. + bool + offscreen
  12. +
  13. + bool + mmbScroll
  14. +
+ + + +
+

+ Spring.GetMouseCursor() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + string + cursorName
  2. +
  3. + number + cursorScale
  4. +
+ + + +
+

+ Spring.GetMouseStartPosition(button) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + button + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + number + x
  2. +
  3. + number + y
  4. +
  5. + number + camPosX
  6. +
  7. + number + camPosY
  8. +
  9. + number + camPosZ
  10. +
  11. + number + dirX
  12. +
  13. + number + dirY
  14. +
  15. + number + dirZ
  16. +
+ + + +
+

+ Text +

+ +

+ +


+

+

+ Spring.GetClipboard() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + string + text
  2. +
+ + + +
+

+ Spring.IsUserWriting() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + bool + + +
  2. +
+ + + +
+

+ Console +

+ +

+ +


+

+

+ Spring.GetLastMessagePositions() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + {xyz,...} + message positions
  2. +
+ + + +
+

+ Spring.GetConsoleBuffer(maxLines) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + maxLines + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or {{text=string,priority=number},...} + pair array of (text, priority)
  2. +
+ + + +
+

+ Spring.GetCurrentTooltip() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + string + tooltip
  2. +
+ + + +
+

+ Key Input +

+ +

+ +


+

+

+ Spring.GetKeyFromScanSymbol(scanSymbol) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + scanSymbol + string + + + +
  2. +
+ +

Returns:

+
    +
  1. + string + keyName
  2. +
+ + + +
+

+ Spring.GetKeyState(keyCode) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + keyCode + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + bool + pressed
  2. +
+ + + +
+

+ Spring.GetModKeyState() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + bool + alt
  2. +
  3. + bool + ctrl
  4. +
  5. + bool + meta
  6. +
  7. + bool + shift
  8. +
+ + + +
+

+ Spring.GetPressedKeys() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + {[number or string]=true,...} + where keys are keyCodes or key names
  2. +
+ + + +
+

+ Spring.GetPressedScans() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + {[number or string]=true,...} + where keys are scanCodes or scan names
  2. +
+ + + +
+

+ Spring.GetInvertQueueKey() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + nil or number + queueKey
  2. +
+ + + +
+

+ Spring.GetKeyCode(keySym) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + keySym + string + + + +
  2. +
+ +

Returns:

+
    +
  1. + number + keyCode
  2. +
+ + + +
+

+ Spring.GetKeySymbol(keyCode) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + keyCode + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + string + keyCodeName
  2. +
  3. + string + keyCodeDefaultName name when there are not aliases
  4. +
+ + + +
+

+ Spring.GetScanSymbol(scanCode) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + scanCode + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + string + scanCodeName
  2. +
  3. + string + scanCodeDefaultName name when there are not aliases
  4. +
+ + + +
+

+ keybindingSpec +

+

Keybinding spec

+
+

+ + + Contains data about a keybinding + +

+ + +

Fields:

+
    +
  1. + command + string + + + +
  2. +
  3. + extra + string + + + +
  4. +
  5. + boundWith + string + + + +
  6. +
+ + + + +
+

+ Spring.GetKeyBindings([keySet1[, keySet2]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + keySet1 + string + filters keybindings bound to this keyset + (optional) +
  2. +
  3. + keySet2 + string + OR bound to this keyset + (optional) +
  4. +
+ +

Returns:

+
    +
  1. + {[keybindingSpec],...} + + +
  2. +
+ + + +
+

+ Spring.GetActionHotKeys(actionName) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + actionName + string + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or {[string],...} + hotkeys
  2. +
+ + + +
+

+ Unit Groups +

+ +

+ +


+

+

+ Spring.GetGroupList() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + nil or {[number]=number,...} + where keys are groupIDs and values are counts
  2. +
+ + + +
+

+ Spring.GetSelectedGroup() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + number + groupID -1 when no group selected
  2. +
+ + + +
+

+ Spring.GetUnitGroup(unitID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + unitID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + groupID
  2. +
+ + + +
+

+ Spring.GetGroupUnits(groupID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + groupID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or {[number],...} + unitIDs
  2. +
+ + + +
+

+ Spring.GetGroupUnitsSorted(groupID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + groupID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or {[number]={[number],...},...} + where keys are unitDefIDs and values are unitIDs
  2. +
+ + + +
+

+ Spring.GetGroupUnitsCounts(groupID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + groupID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or {[number]=number,...} + where keys are unitDefIDs and values are counts
  2. +
+ + + +
+

+ Spring.GetGroupUnitsCount(groupID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + groupID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + groupSize
  2. +
+ + + +
+

+ Team/Player Info +

+ +

+ +


+

+

+ rosterSpec +

+

Roster spec

+
+

+ + + Contains data about a player + +

+ + +

Fields:

+
    +
  1. + name + string + + + +
  2. +
  3. + playerID + number + + + +
  4. +
  5. + teamID + number + + + +
  6. +
  7. + allyTeamID + number + + + +
  8. +
  9. + spectator + bool + + + +
  10. +
  11. + 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 +
  12. +
  13. + pingTime + number + if -1, the player is pathfinding +
  14. +
+ + + + +
+

+ Spring.GetPlayerRoster([sortType[, showPathingPlayers=false]]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + sortType + number + return unsorted if unspecified. Disabled = 0, Allies = 1, TeamID = 2, PlayerName = 3, PlayerCPU = 4, PlayerPing = 5 + (optional) +
  2. +
  3. + showPathingPlayers + bool + + + + (default false) +
  4. +
+ +

Returns:

+
    +
  1. + nil or {[rosterSpec],...} + playerTable
  2. +
+ + + +
+

+ Spring.GetPlayerTraffic(playerID, packetID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + playerID + number + + + +
  2. +
  3. + packetID + number + [opt] +
  4. +
+ +

Returns:

+
    +
  1. + number + traffic
  2. +
+ + + +
+

+ Spring.GetPlayerStatistics(playerID) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + playerID + number + + + +
  2. +
+ +

Returns:

+
    +
  1. + nil or number + mousePixels nil when invalid playerID
  2. +
  3. + number + mouseClicks
  4. +
  5. + number + keyPresses
  6. +
  7. + number + numCommands
  8. +
  9. + number + unitCommands
  10. +
+ + + +
+

+ Configuration +

+ +

+ +


+

+

+ configSpec +

+

Configuration spec

+
+

+ + + Contains data about a configuration, only name and type are guaranteed + +

+ + +

Fields:

+
    +
  1. + name + string + + + +
  2. +
  3. + type + string + + + +
  4. +
  5. + description + string + + + +
  6. +
  7. + defaultValue + string + + + +
  8. +
  9. + minimumValue + string + + + +
  10. +
  11. + maximumValue + string + + + +
  12. +
  13. + safemodeValue + string + + + +
  14. +
  15. + declarationFile + string + + + +
  16. +
  17. + declarationLine + string + + + +
  18. +
  19. + readOnly + bool + + + +
  20. +
+ + + + +
+

+ Spring.GetConfigParams() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + {[configSpec],...} + + +
  2. +
+ + + +
+

+ Spring.GetConfigInt(name[, default=0]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + name + string + + + +
  2. +
  3. + default + number or nil + + + + (default 0) +
  4. +
+ +

Returns:

+
    +
  1. + nil or number + configInt
  2. +
+ + + +
+

+ Spring.GetConfigFloat(name[, default=0]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + name + string + + + +
  2. +
  3. + default + number or nil + + + + (default 0) +
  4. +
+ +

Returns:

+
    +
  1. + nil or number + configFloat
  2. +
+ + + +
+

+ Spring.GetConfigString(name[, default=""]) +

+

+
+

+ +

+ + +

Parameters:

+
    +
  1. + name + string + + + +
  2. +
  3. + default + string or nil + + + + (default "") +
  4. +
+ +

Returns:

+
    +
  1. + nil or number + configString
  2. +
+ + + +
+

+ Spring.GetLogSections() +

+

+
+

+ +

+ + + +

Returns:

+
    +
  1. + {[string]=number,...} + sections where keys are names and loglevel are values. E.g. { "KeyBindings" = LOG.INFO, "Font" = LOG.INFO, "Sound" = LOG.WARNING, ... }
  2. +
+ + + +
+ +{% endraw %} diff --git a/ldoc/modules/VFS.html b/ldoc/modules/VFS.html new file mode 100644 index 0000000000..1b17c27377 --- /dev/null +++ b/ldoc/modules/VFS.html @@ -0,0 +1,24 @@ +--- +layout: default +title: VFS +permalink: ldoc/modules/VFS.html +description: Virtual File System +parent: Lua API +table: 0x55a54ebc1bd0 +--- + +{% raw %} +

Module VFS

+

Virtual File System

+

+ +


+

+

See also:

+ + + + +{% endraw %}