<?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=LuaCallinReturn</id>
	<title>LuaCallinReturn - 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=LuaCallinReturn"/>
	<link rel="alternate" type="text/html" href="https://www.fightorder.net/wiki/index.php?title=LuaCallinReturn&amp;action=history"/>
	<updated>2026-04-24T09:53:06Z</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=LuaCallinReturn&amp;diff=489&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=LuaCallinReturn&amp;diff=489&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=LuaCallinReturn&amp;diff=488&amp;oldid=prev</id>
		<title>interwiki3&gt;Maddox: Added params and description to AllowFeatureBuildStep</title>
		<link rel="alternate" type="text/html" href="https://www.fightorder.net/wiki/index.php?title=LuaCallinReturn&amp;diff=488&amp;oldid=prev"/>
		<updated>2022-05-24T19:52:46Z</updated>

		<summary type="html">&lt;p&gt;Added params and description to AllowFeatureBuildStep&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Engine_Development|Development]] &amp;lt; [[Lua_Scripting|Lua Scripting]] &amp;lt; {{FULLPAGENAME}}&lt;br /&gt;
&lt;br /&gt;
==Engine Source==&lt;br /&gt;
If you can understand Lua code well and wish to get the most up to date info, you can refer to:&lt;br /&gt;
{{sourcelink|file=cont/base/springcontent/LuaGadgets/actions.lua}}, &lt;br /&gt;
{{sourcelink|file=cont/LuaUI/widgets.lua}} and &amp;lt;br&amp;gt;&lt;br /&gt;
{{sourcelink|file=cont/base/springcontent/LuaGadgets/gadgets.lua}} &amp;lt;br&amp;gt;&lt;br /&gt;
to see how widget/gadget call-ins are distributed, find call-in and widgetHandler function definitions, see how they are processed and what values should be returned from some call ins&lt;br /&gt;
(are these the only files?)&lt;br /&gt;
&lt;br /&gt;
==What is a callin anyway?==&lt;br /&gt;
Call-ins are calls from the engine, into the gadget or widget script. In other words, these functions are called when a particular &amp;#039;&amp;#039;event&amp;#039;&amp;#039; happens.&lt;br /&gt;
Some call-in functions can return values to the engine.&lt;br /&gt;
===Blocking events with return values===&lt;br /&gt;
The call-in functions named &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Allow&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;XXX can block their event by returning &amp;#039;&amp;#039;false&amp;#039;&amp;#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
For example &amp;#039;&amp;#039;AllowUnitTransfer()&amp;#039;&amp;#039;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;return true&amp;lt;/code&amp;gt; = allow transfer &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;return false&amp;lt;/code&amp;gt; = deny transfer&lt;br /&gt;
&lt;br /&gt;
==Commands, general-purpose:==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;Initialize()&amp;lt;/font&amp;gt; --&amp;gt; none.&amp;lt;br&amp;gt;&lt;br /&gt;
called when widget/gadget gets (re-)loaded.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;Shutdown()&amp;lt;/font&amp;gt; --&amp;gt; none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;PlayerChanged&amp;lt;/font&amp;gt; --&amp;gt; (playerID).&lt;br /&gt;
gadget/widget: Use this to check whether a player has become spectator for instance.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;LayoutButtons()&amp;lt;/font&amp;gt; --&amp;gt; unknown, please document.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;ConfigureLayout()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;command&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;CommandNotify()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;id, params, options&amp;quot;, where id = the CommandID&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;KeyPress()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;key, mods, isRepeat&amp;quot;, where key = keymap, mods = SHIFT, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;KeyRelease()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;key&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;MouseMove()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;x, y, dx, dy, button&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;MousePress()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;x, y, button&amp;quot;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;font color=#dd9944&amp;gt;button parameter values: left - 1, middle - 2, right - 3&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{new|&amp;gt;96.0}} buttom param removed  {{Sourcelinkhash|4c104344e92256e33d79820e9012c5e1178e212b}} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;MouseRelease()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;x, y, button&amp;quot;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;font color=#dd9944&amp;gt;Please note that in order to have Spring call MouseRelease, you need to have a MousePress call-in in the same widget that returns true.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;MouseWheel()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;up, value&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;IsAbove()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;x, y&amp;quot; where x,y = screen coordinates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;GetTooltip()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;x, y&amp;quot; where x,y = screen coordinates.  Returns WorldTooltip.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;AddConsoleLine()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;msg, priority&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;MapDrawCmd()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;playerID, cmdType, px, py, pz, labeltext&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;AllowCommand()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOptions, cmdTag, synced&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;font color=#dd9944&amp;gt;Synced only.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;CommandFallback()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOptions, cmdTag&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;CommandsChanged()&amp;lt;/font&amp;gt; --&amp;gt; unknown (none?)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;AllowUnitCreation()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitDefID, builderID, builderTeam, x, y, z, facing&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;AllowUnitTransfer()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, oldTeam, newTeam, capture&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;AllowUnitBuildStep()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;builderID, builderTeam, unitID, unitDefID, part&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;AllowFeatureCreation()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;featureDefID, teamID, x, y, z&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;AllowFeatureBuildStep()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;builderID, builderTeam, featureID, featureDefID, part&amp;quot;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;font color=#dd9944&amp;gt;Called just before a feature updates its build percentage. Returns a bool to allow the change.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;AllowResourceLevel()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;teamID, res, level&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;AllowResourceTransfer()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;teamID, res, level&amp;quot;&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;Update()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;dt&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;font color=#dd9944&amp;gt;called every screenframe. dt is the time since the last screenframe&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;DefaultCommand()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;type,id&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;font color=#dd9944&amp;gt;can return an [[Lua_CMDs|CMD]] to change cursor and command. {{forumlink|topic=26438|title=example usage}}&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;AllowDirectUnitControl(unitID, unitDefID, unitTeam, playerID)   &amp;lt;/font&amp;gt; -&amp;gt; allowFpsControl&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;return true&amp;#039;&amp;#039; allows fps mode, &amp;#039;&amp;#039;return false&amp;#039;&amp;#039; blocks it.&lt;br /&gt;
&lt;br /&gt;
==Unit-Specific:==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitPreDamaged()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, unitTeam, damage, paralyzer, weaponDefID, attackerID, attackerDefID, attackerTeam&amp;quot; &amp;lt;span class=&amp;quot;warning&amp;quot;&amp;gt;(prior to 94.0)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitPreDamaged()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, unitTeam, damage, paralyzer, weaponDefID, projectileID, attackerID, attackerDefID, attackerTeam&amp;quot; &amp;lt;span class=&amp;quot;warning&amp;quot;&amp;gt;(as of 94.0)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitDamaged()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, unitTeam, damage, paralyzer, weaponDefID, projectileID, attackerID, attackerDefID, attackerTeam&amp;quot; &amp;lt;span class=&amp;quot;warning&amp;quot;&amp;gt;(as of 95.0)&amp;lt;/span&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;font color=#dd9944&amp;gt;Can overwrite the taken damage by returning a new number value.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
As of 88.0 for both UnitDamaged and UnitPreDamaged:&lt;br /&gt;
     weaponDefID -1 --&amp;gt; debris collision&lt;br /&gt;
     weaponDefID -2 --&amp;gt; ground collision&lt;br /&gt;
     weaponDefID -3 --&amp;gt; object collision&lt;br /&gt;
     weaponDefID -4 --&amp;gt; fire damage&lt;br /&gt;
     weaponDefID -5 --&amp;gt; water damage&lt;br /&gt;
     weaponDefID -6 --&amp;gt; kill damage&lt;br /&gt;
     weaponDefID -7 --&amp;gt; crush damage&lt;br /&gt;
&lt;br /&gt;
As of 96.0 {Unit,Feature}{Pre}Damaged events receive the &amp;#039;attacker&amp;#039; ID when object is crushed&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitExperience()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, unitTeam, experience, oldExperience&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;font color=#dd9944&amp;gt;Spring.SetExperienceGrade must be called first to determine how often it is called&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitCreated()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, teamID, builderID&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;font color=#dd9944&amp;gt;Unit started being built (it&amp;#039;s in wireframe mode)&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitFinished()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, teamID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitFromFactory()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, unitTeam, factID, factDefID, userOrders&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitDestroyed()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, teamID, attackerID, attackerDefID, attackerTeamID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitTaken()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, unitTeam, newTeam&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;font color=#dd9944&amp;gt;Unit still belongs to old team&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitGiven()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, unitTeam, oldTeam&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;font color=#dd9944&amp;gt;Unit now belongs to new team&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitIdle()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, teamID&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;font color=#dd9944&amp;gt;No commands in this unit&amp;#039;s queue. Beware, might be fired while &amp;#039;guarding&amp;#039;.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitCommand()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, unitTeam, cmdID, cmdOpts, cmdParams, cmdTag&amp;quot; &amp;lt;span class=&amp;quot;warning&amp;quot;&amp;gt;(cmdTag only available from version 95.0)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitSeismicPing()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;x, y, z, strength&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitEnteredRadar()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitTeam&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitEnteredLos()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, teamID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitLeftRadar()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitTeam&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitLeftLos()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, teamID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitLoaded()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, unitTeam, transportID, transportTeam&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitUnloaded()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, teamID, transportID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitCloaked()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, teamID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitDecloaked)&amp;lt;/font&amp;gt;--&amp;gt; &amp;quot;unitID, unitDefID, teamID&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitMoveFailed()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, unitTeam&amp;quot;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;font color=#dd9944&amp;gt;Only called for unitDefIDs registered via [[Lua_System#Synced|Script.SetWatchUnit]] since 85.0&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;StockpileChanged()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, unitTeam, weaponNum, oldCount, newCount&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitEnteredWater()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, teamID&amp;quot;&lt;br /&gt;
&amp;lt;span class=&amp;quot;warning&amp;quot;&amp;gt;(as of 95.0)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitEnteredAir()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, teamID&amp;quot;&lt;br /&gt;
&amp;lt;span class=&amp;quot;warning&amp;quot;&amp;gt;(as of 95.0)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitLeftWater()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, teamID&amp;quot;&lt;br /&gt;
&amp;lt;span class=&amp;quot;warning&amp;quot;&amp;gt;(as of 95.0)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitLeftAir()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, teamID&amp;quot;&lt;br /&gt;
&amp;lt;span class=&amp;quot;warning&amp;quot;&amp;gt;(as of 95.0)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;ShieldPreDamaged()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;proID, shieldEmitterWeaponNum, shieldCarrierUnitID, boolBounceProjectile, beamEmitterWaponNumber, beamCarrierUnitID, startx, starty, startz, hitx, hity, hitz&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitUnitCollision(colliderID, collideeID)&amp;lt;/font&amp;gt; -- needs SetWatchUnit enabled for both parties&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;AllowWeaponTargetCheck(attackerID, attackerWeaponNum, attackerWeaponDefID)&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;font color=#dd9944&amp;gt;Only called for weaponDefIDs registered via [[Lua_System#Synced|Script.SetWatchWeapon]] since 92.0&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;AllowWeaponTarget(attackerID, targetID, attackerWeaponNum, attackerWeaponDefID, defaultPriority)&amp;lt;/font&amp;gt; &lt;br /&gt;
 --&amp;gt; &amp;lt;code&amp;gt;return &amp;quot;targetAllowed, targetPriority&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;span class=&amp;quot;warning&amp;quot;&amp;gt;defaultPriority new in 89.0&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#dd9944&amp;gt;Only called for weaponDefIDs registered via [[Lua_System#Synced|Script.SetWatchWeapon]] since 92.0&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;DrawShield(number unitID, number weaponID)&amp;lt;/font&amp;gt; --&amp;gt; boolean&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;true&amp;#039;&amp;#039; (&amp;lt;-?) skips Spring&amp;#039;s own drawing of shield &amp;lt;weaponID&amp;gt; owned by unit &amp;lt;unitID&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://github.com/spring/spring/commit/7bbfd9464d4f74c12163ea0740c8c60d1ba978f1 maybe new in 86.0+]&lt;br /&gt;
&lt;br /&gt;
==Feature-Specific:==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;FeatureCreated()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;featureID, allyTeam&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;FeatureDestroyed()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;featureID, allyTeam&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;TerraformComplete()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, unitTeam, buildUnitID, buildUnitDefID, buildUnitTeam&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitCmdDone()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;unitID, unitDefID, unitTeam, cmdID, cmdTag, cmdParams, cmdOptions&amp;quot; &amp;lt;span class=&amp;quot;warning&amp;quot;&amp;gt;cmdParams and cmdOptions are only available from version 95.0&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;UnitFeatureCollision(colliderID, collideeID, crushKilled)&amp;lt;/font&amp;gt; -- needs SetWatchUnit for first and SetWatchFeature for second party&lt;br /&gt;
&lt;br /&gt;
{{new|95.0}} &amp;lt;font color=#55ee99&amp;gt;FeatureDamaged()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;featureID, featureDefID, featureTeam, damage, weaponDefID, projectileID, attackerID, attackerDefID, attackerTeam&amp;quot;&lt;br /&gt;
&lt;br /&gt;
{{new|95.0}} &amp;lt;font color=#55ee99&amp;gt;FeaturePreDamaged()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;featureID, featureDefID, featureTeam, damage, weaponDefID, projectileID, attackerID, attackerDefID, attackerTeam&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;--&amp;gt; return newDamage, impulseMult (=0)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Drawing:==&lt;br /&gt;
Inside these functions, you can use the [[Lua_OpenGL_Api | Lua OpenGL Api]] to draw graphics.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;font color=#55ee99&amp;gt;DrawGenesis()&amp;lt;/font&amp;gt; --&amp;gt; none.  Don&amp;#039;t render here.&lt;br /&gt;
&lt;br /&gt;
 Spring draws the sky, the map, some water types, and unit selection.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;font color=#55ee99&amp;gt;DrawWorldPreUnit()&amp;lt;/font&amp;gt; --&amp;gt; none.&lt;br /&gt;
&lt;br /&gt;
 Spring draws units, features, some water types, cloaked units, and the sun.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;font color=#55ee99&amp;gt;DrawWorld()&amp;lt;/font&amp;gt; --&amp;gt; none.&lt;br /&gt;
&lt;br /&gt;
 Spring draws command queues, &amp;#039;map stuff&amp;#039;, and map marks.&lt;br /&gt;
&lt;br /&gt;
Each unit might also have a DrawUnit call, [[Lua_UnitRendering|enabled here.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;DrawUnit(unitID,DrawMode)&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
With enum DrawMode {&amp;lt;br&amp;gt;&lt;br /&gt;
	notDrawing     = 0,&amp;lt;br&amp;gt;&lt;br /&gt;
	normalDraw     = 1,&amp;lt;br&amp;gt;&lt;br /&gt;
	shadowDraw     = 2,&amp;lt;br&amp;gt;&lt;br /&gt;
	reflectionDraw = 3,&amp;lt;br&amp;gt;&lt;br /&gt;
	refractionDraw = 4&amp;lt;br&amp;gt;&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;DrawFeature(featureID, DrawMode)&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;DrawShield(unitID, weaponID, DrawMode)&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;DrawProjectile(projectileID, DrawMode)&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;DrawScreenEffects()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;vsx, vsy&amp;quot; where vsx, vsy are screen coords.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;DrawScreen()&amp;lt;/font&amp;gt; --&amp;gt; none.&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;DrawInMiniMap()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;sx, sy&amp;quot; where sx,sy are values relative to the minimap&amp;#039;s position and scale.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;DrawWorldShadow()&amp;lt;/font&amp;gt; --&amp;gt; none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;DrawWorldReflection()&amp;lt;/font&amp;gt; --&amp;gt; none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;DrawWorldRefraction()&amp;lt;/font&amp;gt; --&amp;gt; none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;DrawLoadScreen()&amp;lt;/font&amp;gt; --&amp;gt; none. {{new|95.0}}&lt;br /&gt;
&lt;br /&gt;
Only available to LuaIntro, draws custom load screens.&lt;br /&gt;
&lt;br /&gt;
==Game Events:==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;GameID()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;gameID&amp;quot; {{new|89.0}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;Explosion()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;weaponID, px, py, pz, ownerID&amp;quot;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;font color=#dd9944&amp;gt;Only called for weaponDefIDs registered via Script.SetWatchWeapon&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;return true to hide the weapon&amp;#039;s CEG&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;ShockFront()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;power, dx, dy, dz&amp;quot; &amp;lt;span class=&amp;quot;warning&amp;quot;&amp;gt;Not yet implemented!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;GameFrame()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;frameNum&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;CobCallback()&amp;lt;/font&amp;gt; --&amp;gt; unknown, marked FIXME.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;GroupChanged()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;groupID&amp;quot; where groupID is the value of Group whose table value changed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;WorldTooltip()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;ttType, data1, data2, data3&amp;quot; special, should be documented in detail. &amp;lt;span class=&amp;quot;warning&amp;quot;&amp;gt;Not yet implemented!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;GamePreload()&amp;lt;/font&amp;gt;  --&amp;gt; none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;GameStart()&amp;lt;/font&amp;gt; --&amp;gt; none.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;GameProgress()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;serverFrameNum&amp;quot; ( called every 60 frames, calculating delta between GameFrame and GameProgress can give an ETA about catching up with simulation )&amp;lt;span class=&amp;quot;warning&amp;quot;&amp;gt; Not yet implemented!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;GameOver()&amp;lt;/font&amp;gt; --&amp;gt;  &amp;quot;[ [1] = allyTeamID1, [2] = allyTeamID2, ... ]&amp;quot;,  a list of winning allyteams, if empty the game result was undecided ( like when dropping from an host )&amp;lt;span class=&amp;quot;warning&amp;quot;&amp;gt;   Will return nil in pre 0.83.x&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;TeamDied()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;TeamID&amp;quot; where TeamID = the team that has been eliminated.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;AllowStartPosition()&amp;lt;/font&amp;gt; --&amp;gt; &lt;br /&gt;
   number clampedPos.x, number clampedPos.y, number clampedPos.z,&lt;br /&gt;
   number playerID,&lt;br /&gt;
   number readyState,&lt;br /&gt;
   number rawPickPos.x, number rawPickPos.y, number rawPickPos.z&lt;br /&gt;
&lt;br /&gt;
FIXME: apparently the above is incorrect and parameters are AllowStartPosition(playerID, teamID, readyState, cx, cy, cz, rx, ry, rz)&lt;br /&gt;
&lt;br /&gt;
clampedPos = coordinates clamped into startbox, rawPickPos = where player tried to start&lt;br /&gt;
&lt;br /&gt;
{{New|95.0}} the default &amp;#039;failed to choose&amp;#039; start-position is now just (0,0,0), not (0,-500,0) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
readyState can be any one of:&lt;br /&gt;
    PLAYER_RDYSTATE_UPDATED = 0 -- player picked a position&lt;br /&gt;
    PLAYER_RDYSTATE_READIED = 1 -- player clicked ready&lt;br /&gt;
    PLAYER_RDYSTATE_FORCED = 2 -- game was force-started (player did not click ready)&lt;br /&gt;
    PLAYER_RDYSTATE_FAILED = 3&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;GameSetup()&amp;lt;/font&amp;gt; --&amp;gt; string &amp;quot;state&amp;quot;, boolean &amp;quot;ready&amp;quot;, table &amp;quot;playerStates&amp;quot; &lt;br /&gt;
&amp;lt;br&amp;gt;return success, newReady&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;GamePaused()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;playerID, paused&amp;quot; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;PlayerAdded()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;playerID&amp;quot; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;PlayerRemoved()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;playerID, reason&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Projectiles:==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;ProjectileCreated()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;proID, proOwnerID, weaponDefID&amp;quot;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;font color=#dd9944&amp;gt;Only called for weaponDefIDs registered via Script.SetWatchWeapon&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;ProjectileDestroyed()&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;proID&amp;quot;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;font color=#dd9944&amp;gt;Only called for weaponDefIDs registered via Script.SetWatchWeapon&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=#55ee99&amp;gt;AllowWeaponInterceptTarget&amp;lt;/font&amp;gt; --&amp;gt; &amp;quot;number interceptorUnitID, number interceptorWeaponID, number targetProjectileID&amp;quot;&lt;br /&gt;
returns boolean&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;font color=#dd9944&amp;gt;Only called for weaponDefIDs registered via Script.SetWatchWeapon&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Deprecated]]&lt;/div&gt;</summary>
		<author><name>interwiki3&gt;Maddox</name></author>
	</entry>
</feed>