<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.fightorder.net/wiki/index.php?action=history&amp;feed=atom&amp;title=Lua%3ACallins</id>
	<title>Lua:Callins - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.fightorder.net/wiki/index.php?action=history&amp;feed=atom&amp;title=Lua%3ACallins"/>
	<link rel="alternate" type="text/html" href="https://www.fightorder.net/wiki/index.php?title=Lua:Callins&amp;action=history"/>
	<updated>2026-04-21T02:44:57Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://www.fightorder.net/wiki/index.php?title=Lua:Callins&amp;diff=491&amp;oldid=prev</id>
		<title>Qrow: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://www.fightorder.net/wiki/index.php?title=Lua:Callins&amp;diff=491&amp;oldid=prev"/>
		<updated>2025-11-13T01:51:00Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 18:51, 12 November 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Qrow</name></author>
	</entry>
	<entry>
		<id>https://www.fightorder.net/wiki/index.php?title=Lua:Callins&amp;diff=490&amp;oldid=prev</id>
		<title>interwiki3&gt;Beherith: /* Drawing */ newline</title>
		<link rel="alternate" type="text/html" href="https://www.fightorder.net/wiki/index.php?title=Lua:Callins&amp;diff=490&amp;oldid=prev"/>
		<updated>2022-10-12T14:10:04Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Drawing: &lt;/span&gt; newline&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Lua Callins =&lt;br /&gt;
This page is future looking to unified widget/gadget (aka &amp;quot;addon&amp;quot;) handler, which may yet be some way off, c.f. the [https://github.com/spring/spring/blob/ebb704e008f6ea645947d07be1cfcc272af0428f/doc/changelog.txt#L71 changelog].&lt;br /&gt;
&lt;br /&gt;
Related Sourcecode :&lt;br /&gt;
[https://github.com/spring/spring/blob/d9b3927a528a876b9ab4042771e82b050267572a/rts/Lua/LuaHandle.cpp https://github.com/spring/spring/rts/Lua/LuaHandle.cpp]&lt;br /&gt;
&lt;br /&gt;
For now, to use these addons in a widget, replace addon with widget and, for a gadget, replace addon with gadget. For example,&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
    function widget:UnitCreated(unitID, unitDefID, unitTeam, builderID)&lt;br /&gt;
        ...  &lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: maroon;&amp;quot;&amp;gt;&amp;#039;&amp;#039;&amp;#039;Attention:&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
== Common ==&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = Initialize&lt;br /&gt;
|info = Called when the addon is (re)loaded.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = Shutdown&lt;br /&gt;
|info = Called when the addon or the game is shutdown.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Unsynced Only ==&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DefaultCommand&lt;br /&gt;
|args = type, id&lt;br /&gt;
|return = {{type|number}} cmdID&lt;br /&gt;
|info = Used to set the default command when a unit is selected. First parameter is the type of the object pointed at (either &amp;quot;unit or &amp;quot;feature&amp;quot;) and the second is its {{var|unitID}} or {{var|featureID}} respectively. &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = CommandNotify&lt;br /&gt;
|args = cmdID, cmdParams, cmdOptions&lt;br /&gt;
|return = {{type|bool}} removeCmd&lt;br /&gt;
|info = Called when a command is issued. Returning {{value|true}} deletes the command and does not send it through the network.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = CommandsChanged&lt;br /&gt;
|args = None&lt;br /&gt;
|return = ?&lt;br /&gt;
|info = Called when the command descriptions changed, e.g. when selecting or deselecting a unit.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = WorldTooltip&lt;br /&gt;
|args = ttType, data1, data2, data3&lt;br /&gt;
|return = {{type|string}} newTooltip&lt;br /&gt;
|info = The parameters can be {{value|&amp;quot;unit&amp;quot;}}, {{var|unitID}}; {{value|&amp;quot;feature&amp;quot;}}, {{var|featureID}}; {{value|&amp;quot;ground&amp;quot;}}, {{var|posX}}, {{var|posY}}, {{var|posZ}} or {{value|&amp;quot;selection&amp;quot;}}.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnsyncedHeightMapUpdate&lt;br /&gt;
|args = ???&lt;br /&gt;
|info = Called when the unsynced copy of the height-map is altered.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = GameProgress&lt;br /&gt;
|args = serverFrameNum&lt;br /&gt;
|info = Called every 60 frames, calculating delta between GameFrame and GameProgress. Can give an ETA about catching up with simulation for mid-game join players.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = GameSetup&lt;br /&gt;
|args =  state, ready, playerStates&lt;br /&gt;
|return = {{type|bool}} success, {{type|bool}} newReady&lt;br /&gt;
|info = ???&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = SunChanged&lt;br /&gt;
|args = ???&lt;br /&gt;
|info = ???&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = AddConsoleLine&lt;br /&gt;
|args = msg, priority&lt;br /&gt;
|info = Called when text is entered into the console (e.g. Spring.Echo).&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = RecvSkirmishAIMessage&lt;br /&gt;
|args = aiTeam, dataStr&lt;br /&gt;
|return = ???&lt;br /&gt;
|info = ???&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = RecvFromSynced&lt;br /&gt;
|args = ...&lt;br /&gt;
|info = Receives data sent via [[Lua_System#Synced|SendToUnsynced]] callout.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = Save&lt;br /&gt;
|args = zip&lt;br /&gt;
|info = Called when a chat command &amp;#039;/save&amp;#039; or &amp;#039;/savegame&amp;#039; is received. The single argument is a userdatum representing the savegame zip file. See [[Lua_SaveLoad#Save_.28_zip_.29_-.3E_nil|Lua_SaveLoad]].&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = LoadProgress&lt;br /&gt;
|args = message, replaceLastLine&lt;br /&gt;
|info = Only available to LuaIntro.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = GroupChanged&lt;br /&gt;
|args = groupID&lt;br /&gt;
|info = Called when a unit is added to or removed from a control group. Currently implemented for widgets only.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = ConfigureLayout&lt;br /&gt;
|args = ???&lt;br /&gt;
|return = ???&lt;br /&gt;
|info = ???&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Input ===&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = IsAbove&lt;br /&gt;
|args = x, y&lt;br /&gt;
|return = {{type|bool}} isAbove&lt;br /&gt;
|info = Called every Update. Must return {{value|true}} for {{name|Mouse*}} events and {{name|GetToolTip}} to be called.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = GetTooltip&lt;br /&gt;
|args = x, y&lt;br /&gt;
|return = {{type|string}} tooltip&lt;br /&gt;
|info = Called when {{name|IsAbove}} returns {{value|true}}.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = KeyPress&lt;br /&gt;
|args = key, mods, isRepeat&lt;br /&gt;
|return = {{type|bool}} becomeOwner&lt;br /&gt;
|info = Called repeatedly when a key is pressed down. If you want an action to occur only once check for {{var|1=isRepeat == {{value|false}}}}. The {{var|mods}} parameter is a {{type|table}}, with keys {{value|&amp;quot;alt&amp;quot;}}, {{value|&amp;quot;ctrl&amp;quot;}}, {{value|&amp;quot;meta&amp;quot;}} and {{value|&amp;quot;shift&amp;quot;}} each having a boolean value. Return {{value|true}} if you don&amp;#039;t want other callins or the engine to also receive this keypress. A list of key codes can be seen at the [https://wiki.libsdl.org/SDLKeycodeLookup SDL wiki].&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = KeyRelease&lt;br /&gt;
|args = key&lt;br /&gt;
|return = {{type|bool}}&lt;br /&gt;
|info = Called when the key is released.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = TextInput&lt;br /&gt;
|args = utf8char&lt;br /&gt;
|info = Called whenever a key press results in text input. Introduced in 97.0.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = JoystickEvent&lt;br /&gt;
|args = ???&lt;br /&gt;
|info = ???&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = MousePress&lt;br /&gt;
|args = x, y, button&lt;br /&gt;
|return = {{type|bool}} becomeMouseOwner&lt;br /&gt;
|info = Called when a mouse button is pressed. The {{var|button}} parameter supports up to 7 buttons. Must return {{value|true}} for {{name|MouseRelease}} and other functions to be called.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = MouseRelease&lt;br /&gt;
|args = x, y, button&lt;br /&gt;
|return = bool becomeMouseOwner&lt;br /&gt;
|info = Called when a mouse button is released. Please note that in order to have Spring call {{name|MouseRelease}}, you need to have a {{name|MousePress}} call-in in the same addon that returns {{value|true}}.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = MouseWheel&lt;br /&gt;
|args = up, value&lt;br /&gt;
|info = Called when the mouse wheel is moved. The parameters indicate the direction and amount of travel.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = MouseMove&lt;br /&gt;
|args = x, y, dx, dy, button&lt;br /&gt;
|info = Called when the mouse is moved. The {{var|dx}} and {{var|dy}} parameters indicate the distance travelled, whereas the first two indicate the final position.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Players ===&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = PlayerChanged&lt;br /&gt;
|args = playerID&lt;br /&gt;
|info = Called whenever a player&amp;#039;s status changes e.g. becoming a spectator.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = PlayerAdded&lt;br /&gt;
|args = playerID&lt;br /&gt;
|info = Called whenever a new player joins the game.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = PlayerRemoved&lt;br /&gt;
|args = playerID, reason&lt;br /&gt;
|info = Called whenever a player is removed from the game.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Downloads ===&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DownloadStarted&lt;br /&gt;
|args = id&lt;br /&gt;
|info = Called when a [[Pr-downloader]] download is started via [[Lua_VFS#Archives|VFS.DownloadArchive]].&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DownloadFinished&lt;br /&gt;
|args = id&lt;br /&gt;
|info = Called when a [[Pr-downloader]] download finishes successfully.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DownloadFailed&lt;br /&gt;
|args = id, errorID&lt;br /&gt;
|info = Called when a [[Pr-downloader]] download fails to complete.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DownloadProgress&lt;br /&gt;
|args = id, downloaded, total&lt;br /&gt;
|info = Called incrementally during a [[Pr-downloader]] download.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Drawing ===&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = ViewResize&lt;br /&gt;
|args = viewSizeX, viewSizeY&lt;br /&gt;
|info = Called whenever the window is resized.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = Update&lt;br /&gt;
|args = dt&lt;br /&gt;
|info = Called for every draw frame (including when the game is paused) and at least once per sim frame except when catching up. The parameter is the time since the last update. &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Draw* Functions ===&lt;br /&gt;
Inside the Draw* functions, you can use the [[Lua_OpenGL_Api | Lua OpenGL Api]] to draw graphics.&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Avoid doing heavy calculations inside these callins; ideally, do the calculations elsewhere and use Draw callins only for drawing.&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DrawGenesis&lt;br /&gt;
|info = Doesn&amp;#039;t render to screen! Use this callin to update textures, shaders, etc. Also available to LuaMenu.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DrawWorldPreParticles&lt;br /&gt;
|info = ??? {{new|104.0}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DrawWorldPreUnit&lt;br /&gt;
|info = Spring draws units, features, some water types, cloaked units, and the sun.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DrawWorld&lt;br /&gt;
|info = Spring draws command queues, &amp;#039;map stuff&amp;#039;, and map marks.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DrawWorldShadow&lt;br /&gt;
|info = ???&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DrawWorldReflection&lt;br /&gt;
|info = ???&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DrawWorldRefraction&lt;br /&gt;
|info = ???&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DrawGroundPreForward&lt;br /&gt;
|info = Runs at the start of the forward pass when a custom map shader has been assigned via [[Lua_UnsyncedCtrl#Map|{{name|Spring.SetMapShader}}]] (convenient for setting uniforms).&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DrawGroundPreDeferred&lt;br /&gt;
|info = Runs at the start of the deferred pass when a custom map shader has been assigned via [[Lua_UnsyncedCtrl#Map|{{name|Spring.SetMapShader}}]] (convenient for setting uniforms).&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DrawGroundPostDeferred&lt;br /&gt;
|info = This runs at the end of its respective deferred pass and allows proper frame compositing (with ground flashes/decals/foliage/etc, which are drawn between it and [[#API:DrawWorldPreUnit|{{name|DrawWorldPreUnit}}]]) via [[Lua_OpenGL_Api#Textures|{{name|gl.CopyToTexture}}]].&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DrawUnitsPostDeferred&lt;br /&gt;
|info = Runs at the end of the unit deferred pass to inform Lua code it should make use of the {{value|$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 [[#API:DrawWorld|{{name|DrawWorld}}]] via [[Lua_OpenGL_Api#Textures|{{name|gl.CopyToTexture}}]]). N.B. The *PostDeferred events are only sent (and only have a real purpose) if forward drawing is disabled.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DrawFeaturesPostDeferred&lt;br /&gt;
|info = Runs at the end of the feature deferred pass to inform Lua code it should make use of the {{value|$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 [[#API:DrawWorld|{{name|DrawWorld}}]] via [[Lua_OpenGL_Api#Textures|{{name|gl.CopyToTexture}}]]). N.B. The *PostDeferred events are only sent (and only have a real purpose) if forward drawing is disabled.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DrawScreen&lt;br /&gt;
|args = vsx, vsy&lt;br /&gt;
|info = ??? Also available to LuaMenu.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DrawScreenEffects&lt;br /&gt;
|args = vsx, vsy&lt;br /&gt;
|info = Where {{var|vsx}}, {{var|vsy}} are screen coordinates.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DrawScreenPost&lt;br /&gt;
|args = vsx, vsy&lt;br /&gt;
|info = {{new|104.0}} Similar to {{name|DrawScreenEffects}}, this can be used to alter the contents of a frame after it has been completely rendered (i.e. World, MiniMap, Menu, UI).&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DrawLoadScreen&lt;br /&gt;
|info = {{new|95.0}} Only available to LuaIntro, draws custom load screens.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DrawInMinimap&lt;br /&gt;
|args = sx, sy&lt;br /&gt;
|info = Where {{var|sx}}, {{var|sy}} are values relative to the minimap&amp;#039;s position and scale.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DrawInMinimapBackground&lt;br /&gt;
|args = sx, sy&lt;br /&gt;
|info = Where {{var|sx}}, {{var|sy}} are values relative to the minimap&amp;#039;s position and scale.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Custom Object Rendering ===&lt;br /&gt;
For the following calls {{var|drawMode}} can be one of the following, {{var|1=notDrawing = {{value|0}}}}, {{var|1=normalDraw = {{value|1}}}}, {{var|1=shadowDraw = {{value|2}}}}, {{var|1=reflectionDraw = {{value|3}}}}, {{var|1=refractionDraw = {{value|4}}}}, and finally {{var|1=gameDeferredDraw = {{value|5}}}} which was added in 102.0.&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DrawUnit&lt;br /&gt;
|args = unitID, drawMode&lt;br /&gt;
|return = {{type|bool}} suppressEngineDraw&lt;br /&gt;
|info = For custom rendering of units, [[Lua_UnitRendering#Lua.27s_DrawXYZ-Callin|enabled here]].	&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DrawFeature&lt;br /&gt;
|args = unitID, drawMode&lt;br /&gt;
|return = {{type|bool}} suppressEngineDraw&lt;br /&gt;
|info = For custom rendering of features, [[Lua_UnitRendering#Lua.27s_DrawXYZ-Callin|enabled here]].	&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DrawShield&lt;br /&gt;
|args = unitID, weaponID, drawMode&lt;br /&gt;
|return = {{type|bool}} suppressEngineDraw&lt;br /&gt;
|info = For custom rendering of [[Gamedev:WeaponDefs#Shield_(WeaponType)|shields]].&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = DrawProjectile&lt;br /&gt;
|args = projectileID, drawMode&lt;br /&gt;
|return = {{type|bool}} suppressEngineDraw&lt;br /&gt;
|info = For custom rendering of weapon (&amp;amp; other) projectiles, [[Lua_UnitRendering#Lua.27s_DrawXYZ-Callin|enabled here]].&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Unsynced Menu Only ==&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = AllowDraw&lt;br /&gt;
|return = {{type|bool}} allowDraw&lt;br /&gt;
|info = Enables Draw{Genesis,Screen,ScreenPost} callins if {{value|true}} is returned, otherwise they are called once every 30 seconds. Only active when a game isn&amp;#039;t running.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = ActivateMenu&lt;br /&gt;
|info = Called whenever LuaMenu is on with no game loaded.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = ActivateGame&lt;br /&gt;
|info = Called whenever LuaMenu is on with a game loaded.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Synced - Unsynced Shared ==&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = GotChatMsg&lt;br /&gt;
|args = msg, player&lt;br /&gt;
|info = Called when a player issues a UI command e.g. types {{var|/foo}} or {{var|/luarules foo}}.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Game ===&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = GameID&lt;br /&gt;
|args = gameID&lt;br /&gt;
|info = Called once to deliver the {{var|gameID}}. As of 101.0+ the string is encoded in hex.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = GamePaused&lt;br /&gt;
|info = Called when the game is paused.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = GameOver&lt;br /&gt;
|args = winningAllyTeams&lt;br /&gt;
|info = The parameter is a {{type|table}} list of winning allyTeams, if empty the game result was undecided (like when dropping from an host).&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = GameFrame&lt;br /&gt;
|args = frame&lt;br /&gt;
|info = Called for every game simulation frame (30 per second). Starts at frame {{value|0}} in 101.0+ and {{value|1}} in previous versions.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = GamePreload&lt;br /&gt;
|info = Called before the 0 gameframe. From 104.0 onwards, will not be called when a saved game is loaded.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = GameStart&lt;br /&gt;
|info = Called upon the start of the game. From 104.0 onwards, will not be called when a saved game is loaded.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Teams ===&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = TeamChanged&lt;br /&gt;
|args = teamID&lt;br /&gt;
|info = ???&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = TeamDied&lt;br /&gt;
|args = teamID&lt;br /&gt;
|info = Called when a team dies (see [[Lua_SyncedCtrl#Game_End|Spring.KillTeam]]).&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Units ===&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitCreated&lt;br /&gt;
|args = unitID, unitDefID, unitTeam, builderID&lt;br /&gt;
|info = Called at the moment the unit is created.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitFinished&lt;br /&gt;
|args = unitID, unitDefID, unitTeam&lt;br /&gt;
|info = Called at the moment the unit is completed.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitFromFactory&lt;br /&gt;
|args = unitID, unitDefID, unitTeam, factID, factDefID, userOrders&lt;br /&gt;
|info = Called when a factory finishes construction of a unit.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitReverseBuilt&lt;br /&gt;
|args = unitID, unitDefID, unitTeam&lt;br /&gt;
|info = Called when a living unit becomes a nanoframe again.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitGiven&lt;br /&gt;
|args = unitID, unitDefID, newTeam, oldTeam&lt;br /&gt;
|info = Called when a unit is transferred between teams. This is called after {{name|UnitTaken}} and in that moment unit is assigned to the &amp;#039;&amp;#039;&amp;#039;newTeam&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitTaken&lt;br /&gt;
|args = unitID, unitDefID, oldTeam, newTeam&lt;br /&gt;
|info = Called when a unit is transferred between teams. This is called before {{name|UnitGiven}} and in that moment unit is still assigned to the &amp;#039;&amp;#039;&amp;#039;oldTeam&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitDamaged&lt;br /&gt;
|args =  unitID, unitDefID, unitTeam, damage, paralyzer, weaponDefID, projectileID, attackerID, attackerDefID, attackerTeam&lt;br /&gt;
|info = Called when a unit is damaged (after {{name|UnitPreDamaged}}).&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitDestroyed&lt;br /&gt;
|args = unitID, unitDefID, unitTeam, attackerID, attackerDefID, attackerTeam&lt;br /&gt;
|info = Called when a unit is destroyed.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = RenderUnitDestroyed&lt;br /&gt;
|args = unitID, unitDefID, unitTeam&lt;br /&gt;
|info = Called just before a unit is invalid, after it finishes its death animation. {{new|101.0}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitStunned&lt;br /&gt;
|args =  unitID, unitDefID, unitTeam, stunned&lt;br /&gt;
|info = Called when a unit changes its stun status. {{new|99.0}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitUnitCollision&lt;br /&gt;
|args = colliderID, collideeID&lt;br /&gt;
|info = Called when two units collide. Both units must be registered with [[Lua_System#Synced|Script.SetWatchUnit]].&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitFeatureCollision&lt;br /&gt;
|args = colliderID, collideeID&lt;br /&gt;
|info = Called when a unit collides with a feature. The unit must be registered with [[Lua_System#Synced|Script.SetWatchUnit]] and the feature registered with [[Lua_System#Synced|Script.SetWatchFeature]].&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitHarvestStorageFull&lt;br /&gt;
|args = unitID, unitDefID, unitTeam&lt;br /&gt;
|info = Called when a unit&amp;#039;s harvestStorage is full (according to its unitDef&amp;#039;s entry).&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitCommand&lt;br /&gt;
|args = unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOpts, cmdTag&lt;br /&gt;
|info = Called after when a unit accepts a command, after {{name|AllowCommand}} returns {{value|true}}.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitCmdDone&lt;br /&gt;
|args = unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOpts, cmdTag&lt;br /&gt;
|info = Called when a unit completes a command.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitLoaded&lt;br /&gt;
|args = unitID, unitDefID, unitTeam, transportID, transportTeam&lt;br /&gt;
|info = Called when a unit is loaded by a transport.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitUnloaded&lt;br /&gt;
|args = unitID, unitDefID, unitTeam, transportID, transportTeam&lt;br /&gt;
|info = Called when a unit is unloaded by a transport.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitExperience&lt;br /&gt;
|args = unitID, unitDefID, unitTeam, experience, oldExperience&lt;br /&gt;
|info = Called when a unit gains experience greater or equal to the minimum limit set by calling [[Lua_SyncedCtrl#Other|Spring.SetExperienceGrade]]. Should be called more reliably with small values of experience grade in 104.0+.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitIdle&lt;br /&gt;
|args = unitID, unitDefID, unitTeam&lt;br /&gt;
|info = Called when a unit is idle (empty command queue).&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitCloaked&lt;br /&gt;
|args = unitID, unitDefID, unitTeam&lt;br /&gt;
|info = Called when a unit cloaks.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitDecloaked&lt;br /&gt;
|args = unitID, unitDefID, unitTeam&lt;br /&gt;
|info = Called when a unit decloaks.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitMoved&lt;br /&gt;
|args = ???&lt;br /&gt;
|info = ??? Not implemented in base handler&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitMoveFailed&lt;br /&gt;
|args = ???&lt;br /&gt;
|info = ??? Not implemented in base handler&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = StockpileChanged&lt;br /&gt;
|args = unitID, unitDefID, unitTeam, weaponNum, oldCount, newCount&lt;br /&gt;
|info = Called when a units stockpile of weapons increases or decreases. See {{xtaglink|Gamedev:WeaponDefs|stockpile}}.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitEnteredLos&lt;br /&gt;
|args = unitID, unitTeam, allyTeam, unitDefID&lt;br /&gt;
|info = Called when a unit enters LOS of an allyteam. Its called after the unit is in LOS, so you can query that unit. The allyTeam is who&amp;#039;s LOS the unit entered.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitLeftLos&lt;br /&gt;
|args = unitID, unitTeam, allyTeam, unitDefID&lt;br /&gt;
|info = 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. &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitEnteredRadar&lt;br /&gt;
|args = unitID, unitTeam, allyTeam, unitDefID&lt;br /&gt;
|info = Called when a unit enters radar of an allyteam. Also called when a unit enters LOS without any radar coverage. &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitLeftRadar&lt;br /&gt;
|args = unitID, unitTeam, allyTeam, unitDefID&lt;br /&gt;
|info = 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. &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitEnteredAir&lt;br /&gt;
|args = ???&lt;br /&gt;
|info = ??? Not implemented by base handler&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitLeftAir&lt;br /&gt;
|args = ???&lt;br /&gt;
|info = ??? Not implemented by base handler&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitEnteredWater&lt;br /&gt;
|args = ???&lt;br /&gt;
|info = ??? Not implemented by base handler&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitLeftWater&lt;br /&gt;
|args = ???&lt;br /&gt;
|info = ??? Not implemented by base handler&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitSeismicPing&lt;br /&gt;
|args = x, y, z, strength, allyTeam, unitID, unitDefID&lt;br /&gt;
|info = Called when a unit emits a seismic ping. See {{xtaglink|Gamedev:UnitDefs|seismicSignature}}.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Features ===&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = FeatureCreated&lt;br /&gt;
|args = featureID, allyTeamID&lt;br /&gt;
|info = Called when a feature is created.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = FeatureDamaged&lt;br /&gt;
|args =  featureID, featureDefID, featureTeam, damage, weaponDefID, projectileID, attackerID, attackerDefID, attackerTeam&lt;br /&gt;
|info = Called when a feature is damaged.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = FeatureDestroyed&lt;br /&gt;
|args = featureID, allyTeamID&lt;br /&gt;
|info = Called when a feature is destroyed.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = FeatureMoved&lt;br /&gt;
|args = ???&lt;br /&gt;
|info = ???&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Projectiles ===&lt;br /&gt;
The following Callins are only called for weaponDefIDs registered via [[Lua_System#Synced|Script.SetWatchWeapon]].&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = ProjectileCreated&lt;br /&gt;
|args = proID, proOwnerID, weaponDefID&lt;br /&gt;
|info = Called when the projectile is created. Note that {{var|weaponDefID}} is missing if the projectile is spawned as part of a burst, but [[Lua_SyncedRead#Projectiles|Spring.GetProjectileDefID]] and [[Lua_SyncedRead#Projectiles|Spring.GetProjectileName]] still work in callin scope using {{var|proID}}.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = ProjectileDestroyed&lt;br /&gt;
|args = proID&lt;br /&gt;
|info = Called when the projectile is destroyed.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Synced Only ==&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = CommandFallback&lt;br /&gt;
|args = unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOptions, cmdTag&lt;br /&gt;
|return = {{type|bool}} used, {{type|bool}} finished&lt;br /&gt;
|info = Called when the unit reaches an unknown command in its queue (i.e. one not handled by the engine). If no addon returns {{var|used}} as {{value|true}} the command is dropped, if an addon returns {{value|true}}, {{value|true}} the command is removed because it&amp;#039;s done, with {{value|true}}, {{value|false}} it&amp;#039;s kept in the queue and {{name|CommandFallback}} gets called again on the next slowupdate.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = AllowCommand&lt;br /&gt;
|args = unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOptions, cmdTag, synced&lt;br /&gt;
|return = {{type|bool}} allow&lt;br /&gt;
|info = Called when the command is given, before the unit&amp;#039;s queue is altered. The return value is whether it should be let into the queue. The queue remains untouched when a command is blocked, whether it would be queued or replace the queue.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = AllowUnitCreation&lt;br /&gt;
|args = unitDefID, builderID, builderTeam, x, y, z, facing&lt;br /&gt;
|return = {{type|bool}} allow&lt;br /&gt;
|info = Called just before unit is created, the boolean return value determines whether or not the creation is permitted.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = AllowUnitTransfer&lt;br /&gt;
|args = unitID, unitDefID, oldTeam, newTeam, capture&lt;br /&gt;
|return = {{type|bool}} allow&lt;br /&gt;
|info = Called just before a unit is transferred to a different team, the boolean return value determines whether or not the transfer is permitted.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = AllowUnitBuildStep&lt;br /&gt;
|args = builderID, builderTeam, unitID, unitDefID, part&lt;br /&gt;
|return = {{type|bool}} allow&lt;br /&gt;
|info = Called just before a unit progresses its build percentage, the boolean return value determines whether or not the build makes progress.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = AllowFeatureCreation&lt;br /&gt;
|args = featureDefID, teamID, x, y, z&lt;br /&gt;
|return = {{type|bool}} allow&lt;br /&gt;
|info = Called just before feature is created, the boolean return value determines whether or not the creation is permitted.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = AllowFeatureBuildStep&lt;br /&gt;
|args = builderID, builderTeam, featureID, featureDefID, part&lt;br /&gt;
|return = {{type|bool}} allow&lt;br /&gt;
|info = Called just before a feature changes its build percentage, the boolean return value determines whether or not the change is permitted. 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&amp;#039;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.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = AllowResourceLevel&lt;br /&gt;
|args = teamID, res, level&lt;br /&gt;
|return = {{type|bool}} allow&lt;br /&gt;
|info = Called when a team sets the sharing level of a resource, the boolean return value determines whether or not the sharing level is permitted.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = AllowResourceTransfer&lt;br /&gt;
|args = oldTeamID, newTeamID, res, amount&lt;br /&gt;
|return = {{type|bool}} allow&lt;br /&gt;
|info = Called just before resources are transferred between players, the boolean return value determines whether or not the transfer is permitted.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = AllowStartPosition&lt;br /&gt;
|args = playerID, teamID, readyState, clampedX, clampedY, clampedZ, rawX, rawY, rawZ&lt;br /&gt;
|return = {{type|bool}} allow&lt;br /&gt;
|info = {{var|clamped{X,Y,Z}}} are the coordinates clamped into start-boxes, {{var|raw}} is where player tried to place their marker. The {{var|readyState}} can be any one of &lt;br /&gt;
* {{value|0}} - player picked a position, &lt;br /&gt;
* {{value|1}} - player clicked ready, &lt;br /&gt;
* {{value|2}} - player pressed ready OR  the game was force-started (player did not click ready, but is now forcibly readied) or &lt;br /&gt;
* {{value|3}} - the player failed to load. &lt;br /&gt;
* {{new|95.0}} the default &amp;#039;failed to choose&amp;#039; start-position is the north-west point of their startbox, or (0,0,0) if they do not have a startbox. &lt;br /&gt;
NB: The order of the parameters changed with the addition of {{var|teamID}} in 104.0. Previouly it was:&lt;br /&gt;
{{var|clampedX, clampedY, clampedZ, playerID, readyState, rawX, rawY, rawZ}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = AllowDirectUnitControl&lt;br /&gt;
|args = unitID, unitDefID, unitTeam, playerID&lt;br /&gt;
|return = {{type|bool}} allow&lt;br /&gt;
|info = Determines if this unit can be controlled directly in FPS view.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = AllowWeaponTargetCheck&lt;br /&gt;
|args = attackerID, attackerWeaponNum, attackerWeaponDefID&lt;br /&gt;
|return = {{type|bool}} allowCheck, {{type|bool}} ignoreCheck&lt;br /&gt;
|info = Determines if this weapon can automatically generate targets itself. See also {{xtaglink|Gamedev:WeaponDefs|commandFire}} weaponDef tag. The {{var|ignoreCheck}} return value was added in 99.0 to allow ignoring the callin i.e. running normal engine check for this weapon.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = AllowWeaponTarget&lt;br /&gt;
|args = attackerID, targetID, attackerWeaponNum, attackerWeaponDefID, defPriority&lt;br /&gt;
|return = {{type|bool}} allowed, {{type|number}} newPriority&lt;br /&gt;
|info = Controls blocking of a specific target from being considered during a weapon&amp;#039;s periodic auto-targeting sweep. The second return value is the new priority for this target (if you don&amp;#039;t want to change it, return {{var|defPriority}}). Lower priority targets are targeted first.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = AllowWeaponInterceptTarget&lt;br /&gt;
|args = interceptorUnitID, interceptorWeaponID, targetProjectileID&lt;br /&gt;
|return = {{type|bool}} allowed&lt;br /&gt;
|info = Controls blocking of a specific intercept target from being considered during an {{xtaglink|Gamedev:WeaponDefs|interceptor}} weapon&amp;#039;s periodic auto-targeting sweep. Only called for {{var|weaponDefIDs}} registered via [[Lua_System#Synced|Script.SetWatchWeapon]].&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = AllowBuilderHoldFire&lt;br /&gt;
|args = unitID, unitDefID, action&lt;br /&gt;
|return = {{type|bool}} actionAllowed&lt;br /&gt;
|info = {{new|98.0}} {{Sourcelinkhash|5a82d750b89e72024bb0bb62cf05ea257737e0ac}}   Called when a construction unit wants to &amp;quot;use his nano beams&amp;quot;.&amp;lt;br&amp;gt;{{var|action}} is one of following:&lt;br /&gt;
* {{value|-1}} Build&lt;br /&gt;
* {{value|CMD.REPAIR}} Repair&lt;br /&gt;
* {{value|CMD.RECLAIM}} Reclaim&lt;br /&gt;
* {{value|CMD.RESTORE}} Restore&lt;br /&gt;
* {{value|CMD.RESURRECT}} Resurrect&lt;br /&gt;
* {{value|CMD.CAPTURE}} Capture&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = Explosion&lt;br /&gt;
|args = weaponDefID, px, py, pz, AttackerID, ProjectileID&lt;br /&gt;
|return = {{type|bool}} noGfx&lt;br /&gt;
|info = Called when an explosion occurs. If it returns {{value|true}} then no graphical effects are drawn by the engine for this explosion.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = TerraformComplete&lt;br /&gt;
|args = unitID, unitDefID, unitTeam, buildUnitID, buildUnitDefID, buildUnitTeam&lt;br /&gt;
|return = {{type|bool}} stop&lt;br /&gt;
|info = Called when pre-building terrain levelling terraforms are completed (c.f. {{xtaglink|Gamedev:UnitDefs|levelGround}}). If the return value is {{value|true}} the current build order is terminated.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = MoveCtrlNotify&lt;br /&gt;
|args = unitID, unitDefID, unitTeam, data&lt;br /&gt;
|return = {{type|bool}} moveCtrlComplete&lt;br /&gt;
|info = Enable both [[Lua_MoveCtrl#Options|Spring.MoveCtrl.SetCollideStop]] and [[Lua_MoveCtrl#Options|Spring.MoveCtrl.SetTrackGround]] to enable this call-in, data was supposed to indicate the type of notification but currently never has a value other than {{value|1}} (&amp;quot;unit hit the ground&amp;quot;). The return value determines whether or not the unit should remain script-controlled ({{value|false}}) or return to engine controlled movement ({{value|true}}).&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = RecvLuaMsg&lt;br /&gt;
|args = msg, playerID&lt;br /&gt;
|info = Receives messages from unsynced sent via [[Lua_UnsyncedCtrl#SendLuaMessage|Spring.SendLuaRulesMsg]] or [[Lua_UnsyncedCtrl#SendLuaMessage|Spring.SendLuaUIMsg]].&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = Load&lt;br /&gt;
|args = zip&lt;br /&gt;
|info = Called after {{name|GamePreload}} and before {{name|GameStart}}. See [[Lua_SaveLoad#Load_.28_zip_.29_-.3E_nil|Lua_SaveLoad]].&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Damage Controllers ===&lt;br /&gt;
For the following callins, in addition to being a regular weapon, {{var|weaponDefID}} may be one of the following:&lt;br /&gt;
* {{value|-1}} - debris collision, also default of [[Lua_SyncedCtrl#Unit_Control|Spring.AddUnitDamage]]&lt;br /&gt;
* {{value|-2}} - ground collision&lt;br /&gt;
* {{value|-3}} - object collision&lt;br /&gt;
* {{value|-4}} - fire damage&lt;br /&gt;
* {{value|-5}} - water damage&lt;br /&gt;
* {{value|-6}} - kill damage&lt;br /&gt;
* {{value|-7}} - crush damage&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = UnitPreDamaged&lt;br /&gt;
|args = unitID, unitDefID, unitTeam, damage, paralyzer, weaponDefID, projectileID, attackerID, attackerDefID, attackerTeam&lt;br /&gt;
|return = {{type|number}} newDamage, {{type|number}} impulseMult&lt;br /&gt;
|info = Called before damage is applied to the unit, allows fine control over how much damage and [http://en.wikipedia.org/wiki/Impulse_(physics) impulse] is applied.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = ShieldPreDamaged&lt;br /&gt;
|I recommend looking up the CallIns in Sourcecode, because the Lua-Documentation, generated from the lua handle of them is seriously flawed and not regenerated.&lt;br /&gt;
|Lua-Handler documented from version&lt;br /&gt;
|args = proID, proOwnerID, shieldEmitterWeaponNum, shieldCarrierUnitID, bounceProjectile, beamEmitterWeaponNum, beamEmitterUnitID, startX, startY, startZ, hitX, hitY, hitZ&lt;br /&gt;
|https://github.com/spring/spring/blob/d085e297416bd963ec25eaa3dbf0796ba22a3582/rts/Lua/LuaHandleSynced.h#L106&lt;br /&gt;
|Actual CallIn: &lt;br /&gt;
|args = proID, shieldCarrier, boolBounceProjectile, beamEmitterWeaponNum, beamEmitterUnitID, startX, startY, startZ, hitX, hitY, hitZ&lt;br /&gt;
|return = {{type|bool}} handleCollision&lt;br /&gt;
|info = Called before any engine shield-vs-projectile logic executes. If the return value is {{value|true}} the gadget handles the collision event and the engine does not remove the projectile. If the weapon is a hitscan type ([[Gamedev:WeaponDefs#Tag:weaponType|BeamLaser]] or [[Gamedev:WeaponDefs#Tag:weaponType|LightningCanon]]) then {{var|proID}} is {{value|nil}} and {{var|beamEmitterWeaponNum}} and {{var|beamEmitterUnitID}} are populated instead. The start and hit position arguments are provided from 104.0 onwards.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{LuaCallin&lt;br /&gt;
|name = FeaturePreDamaged&lt;br /&gt;
|args = featureID, featureDefID, featureTeam, damage, weaponDefID, projectileID, attackerID, attackerDefID, attackerTeam&lt;br /&gt;
|return = {{type|number}} newDamage, {{type|number}} impulseMult&lt;br /&gt;
|info = Called before damage is applied to the feature, allows fine control over how much damage and [http://en.wikipedia.org/wiki/Impulse_(physics) impulse] is applied.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category: Lua]]&lt;/div&gt;</summary>
		<author><name>interwiki3&gt;Beherith</name></author>
	</entry>
</feed>