Lua:Callins: Difference between revisions
→Features: Feature* callins |
some more jK info |
||
| Line 27: | Line 27: | ||
{{LuaCallin | {{LuaCallin | ||
|name = CommandNotify | |name = CommandNotify | ||
|params = | |params = cmdID, cmdParams, cmdOptions | ||
|description = | |return = bool removeCmd | ||
|description = Called when a command is issued. Returning <code>true</code> deletes the command and does not send it through the network. | |||
}} | }} | ||
{{LuaCallin | {{LuaCallin | ||
|name = WorldTooltip | |name = WorldTooltip | ||
|params = | |params = ttType, data1, data2, data3 | ||
|return = nones | |return = nones | ||
|description = | |description = The parameters can be <code>"unit"</code>, <code>unitID</code>; <code>"feature"</code>, <code>featureID</code>; <code>"ground"</code>, <code>posX</code>, <code>posY</code>, <code>posZ</code> or <code>"selection"</code>. | ||
}} | }} | ||
| Line 116: | Line 117: | ||
=== Input === | === Input === | ||
{{LuaCallin | |||
|name = IsAbove | |||
|params = x, y | |||
|return = bool isAbove | |||
|description = Called every Update. Must return <code>true</code> for <code>Mouse*</code> events and <code>GetToolTip</code> to be called. | |||
}} | |||
{{LuaCallin | |||
|name = GetTooltip | |||
|params = x, y | |||
|return = string tooltip | |||
|description = Called when <code>IsAbove</code> returns true. | |||
}} | |||
{{LuaCallin | {{LuaCallin | ||
|name = KeyPress | |name = KeyPress | ||
| Line 140: | Line 155: | ||
|name = MousePress | |name = MousePress | ||
|params = x, y, button | |params = x, y, button | ||
|return = | |return = bool checkMouseRelease | ||
|description = Called when a mouse button is pressed. The <code>button</code> parameter | |description = Called when a mouse button is pressed. The <code>button</code> parameter supports up to 7 buttons. Must return <code>true</code> for <code>MouseRelease</code> to be called. | ||
}} | }} | ||
| Line 148: | Line 163: | ||
|params = x, y, button | |params = x, y, button | ||
|return = none | |return = none | ||
|description = Called when a mouse button is released. Please note that in order to have Spring call MouseRelease, you need to have a MousePress call-in in the same addon that returns <code>true</code>. | |description = Called when a mouse button is released. Please note that in order to have Spring call <code>MouseRelease</code>, you need to have a <code>MousePress</code> call-in in the same addon that returns <code>true</code>. | ||
}} | }} | ||
| Line 163: | Line 178: | ||
|return = none | |return = none | ||
|description = Called when the mouse is moved. The <code>dx</code> and <code>dy</code> parameters indicate the distance travelled, whereas the first two indicate the final position. | |description = Called when the mouse is moved. The <code>dx</code> and <code>dy</code> parameters indicate the distance travelled, whereas the first two indicate the final position. | ||
}} | }} | ||
Revision as of 16:03, 15 February 2014
Lua Callins
Common
addon.Initialize()
return: none
- {{{info}}}
addon.Shutdown()
return: none
- {{{info}}}
Unsynced Only
addon.DefaultCommand()
return: number cmdID
- {{{info}}}
addon.CommandNotify()
return: bool removeCmd
- {{{info}}}
addon.WorldTooltip()
return: nones
- {{{info}}}
addon.UnsyncedHeightMapUpdate()
return: none
- {{{info}}}
addon.GameProgress()
return: none
- {{{info}}}
addon.GameSetup()
return: bool success, ??? newReady
- {{{info}}}
addon.SunChanged()
return: none
- {{{info}}}
addon.AddConsoleLine()
return: none
- {{{info}}}
addon.RecvSkirmishAIMessage()
return: ???
- {{{info}}}
addon.RecvFromSynced()
return: none
- {{{info}}}
addon.Save()
return: ???
- {{{info}}}
addon.LoadProgress()
return: ???
- {{{info}}}
addon.GroupChanged()
return: ???
- {{{info}}}
addon.ConfigureLayout()
return: ???
- {{{info}}}
Input
addon.IsAbove()
return: bool isAbove
- {{{info}}}
addon.GetTooltip()
return: string tooltip
- {{{info}}}
addon.KeyPress()
return: none
- {{{info}}}
addon.KeyRelease()
return: none
- {{{info}}}
addon.JoystickEvent()
return: none
- {{{info}}}
addon.MousePress()
return: bool checkMouseRelease
- {{{info}}}
addon.MouseRelease()
return: none
- {{{info}}}
addon.MouseWheel()
return: none
- {{{info}}}
addon.MouseMove()
return: none
- {{{info}}}
Players
addon.PlayerChanged()
return: none
- {{{info}}}
addon.PlayerAdded()
return: none
- {{{info}}}
addon.PlayerRemoved()
return: none
- {{{info}}}
Drawing
addon.ViewResize()
return: none
- {{{info}}}
addon.Update()
return: none
- {{{info}}}
Inside the Draw* functions, you can use the Lua OpenGL Api to draw graphics.
addon.DrawGenesis()
return: none
- {{{info}}}
addon.DrawWorldPreUnit()
return: none
- {{{info}}}
addon.DrawWorld()
return: none
- {{{info}}}
addon.DrawWorldShadow()
return: none
- {{{info}}}
addon.DrawWorldReflection()
return: none
- {{{info}}}
addon.DrawWorldRefraction()
return: none
- {{{info}}}
addon.DrawScreen()
return: none
- {{{info}}}
addon.DrawScreenEffects()
return: none
- {{{info}}}
addon.DrawLoadScreen()
return: none
- {{{info}}}
addon.DrawInMinimap()
return: none
- {{{info}}}
Custom Object Rendering
For the following calls drawMode can be one of the following, notDrawing = 0, normalDraw = 1, shadowDraw = 2, reflectionDraw = 3, refractionDraw = 4.
addon.DrawUnit()
return: none
- {{{info}}}
addon.DrawFeature()
return: none
- {{{info}}}
addon.DrawShield()
return: none
- {{{info}}}
addon.DrawProjectile()
return: none
- {{{info}}}
Game
addon.GameID()
return: none
- {{{info}}}
addon.GamePaused()
return: none
- {{{info}}}
addon.GameOver()
return: none
- {{{info}}}
addon.GameFrame()
return: none
- {{{info}}}
addon.GamePreload()
return: none
- {{{info}}}
addon.GameStart()
return: none
- {{{info}}}
Teams
Units
Features
addon.FeatureCreated()
return: none
- {{{info}}}
addon.FeatureDamaged()
return: none
- {{{info}}}
addon.FeatureDestroyed()
return: none
- {{{info}}}
addon.FeatureMoved()
return: none
- {{{info}}}
Projectiles
Synced Only
addon.CommandFallback()
return: bool used, bool removed
- {{{info}}}
addon.AllowCommand()
return: bool allow
- {{{info}}}
addon.AllowUnitCreation()
return: bool allow
- {{{info}}}
addon.AllowUnitTransfer()
return: bool allow
- {{{info}}}
addon.AllowUnitBuildStep()
return: bool allow
- {{{info}}}
addon.AllowFeatureCreation()
return: bool allow
- {{{info}}}
addon.AllowFeatureBuildStep()
return: bool allow
- {{{info}}}
addon.AllowResourceLevel()
return: bool allow
- {{{info}}}
addon.AllowResourceTransfer()
return: bool allow
- {{{info}}}
addon.AllowStartPosition()
return: bool allow
- {{{info}}}
addon.AllowDirectUnitControl()
return: bool allow
- {{{info}}}
addon.AllowWeaponTargetCheck()
return: bool allow
- {{{info}}}
addon.AllowWeaponTarget()
return: bool allowed, number priority
- {{{info}}}
addon.AllowWeaponInterceptTarget()
return: bool allowed
- {{{info}}}
addon.TerraformComplete()
return: bool stop
- {{{info}}}
addon.MoveCtrlNotify()
return: bool moveCtrlComplete
- {{{info}}}
Damage Controllers
addon.UnitPreDamaged()
return: number newDamage, number impulseMult
- {{{info}}}
addon.ShieldPreDamaged()
return: bool handleCollision
- {{{info}}}
addon.FeaturePreDamaged()
return: number newDamage, number impulseMult
- {{{info}}}