Lua:Callins: Difference between revisions
m →Unsynced Only: details for save |
|||
| Line 382: | Line 382: | ||
=== Units === | === Units === | ||
{{LuaCallin | |||
|name = UnitCreated | |||
|params = unitID, unitDefID, unitTeam, builderID | |||
|return = none | |||
|description = Called at the moment the unit is created. | |||
}} | |||
{{LuaCallin | |||
|name = UnitFinished | |||
|params = unitID, unitDefID, unitTeam | |||
|return = none | |||
|description = Called at the moment the unit is completed. | |||
}} | |||
{{LuaCallin | |||
|name = UnitFromFactory | |||
|params = unitID, unitDefID, unitTeam, factID, factDefID, userOrders | |||
|return = none | |||
|description = Called when a factory finishes construction of a unit. | |||
}} | |||
{{LuaCallin | |||
|name = UnitGiven | |||
|params = unitID, unitDefID, newTeam, oldTeam | |||
|return = none | |||
|description = Called when a unit is transferred between teams. | |||
}} | |||
{{LuaCallin | |||
|name = UnitTaken | |||
|params = unitID, unitDefID, oldTeam, newTeam | |||
|return = none | |||
|description = Called when a unit is transferred between teams. | |||
}} | |||
{{LuaCallin | |||
|name = UnitDamaged | |||
|params = unitID, unitDefID, unitTeam, damage, paralyzer, weaponDefID, projectileID, attackerID, attackerDefID, attackerTeam | |||
|return = none | |||
|description = Called when a unit is damaged (after <code>UnitPreDamaged</code>). | |||
}} | |||
{{LuaCallin | |||
|name = UnitDestroyed | |||
|params = unitID, unitDefID, unitTeam, attackerID, attackerDefID, attackerTeam | |||
|return = none | |||
|description = Called when a unit is destroyed. | |||
}} | |||
{{LuaCallin | |||
|name = UnitUnitCollision | |||
|params = colliderID, collideeID | |||
|return = none | |||
|description = Called when two units collide. Both units must be registered with [[Lua_System#Synced|Script.SetWatchUnit]]. | |||
}} | |||
{{LuaCallin | |||
|name = UnitFeatureCollision | |||
|params = colliderID, collideeID | |||
|return = none | |||
|description = Called when a unit collides with a feature. The unit must be registered with [[Lua_System#Synced|Script.SetWatchUnit]] and the feature regsitered with [[Lua_System#Synced|Script.SetWatchFeature]]. | |||
}} | |||
{{LuaCallin | |||
|name = UnitCommand | |||
|params = unitID, unitDefID, teamID, cmdID, cmdParams, cmdOptions | |||
|return = none | |||
|description = Called after when a unit accepts a command, after<code>AllowCommand</code> returns <code>true</code>. | |||
}} | |||
{{LuaCallin | |||
|name = UnitCmdDone | |||
|params = unitID, unitDefID, unitTeam, cmdID, cmdTag, cmdParams, cmdOpts | |||
|return = none | |||
|description = Called when a unit completes a command. | |||
}} | |||
{{LuaCallin | |||
|name = UnitLoaded | |||
|params = unitID, unitDefID, unitTeam, transportID, transportTeam | |||
|return = none | |||
|description = Called when a unit is loaded by a transport. | |||
}} | |||
{{LuaCallin | |||
|name = UnitUnloaded | |||
|params = unitID, unitDefID, unitTeam, transportID, transportTeam | |||
|return = none | |||
|description = Called when a unit is unloaded by a transport. | |||
}} | |||
{{LuaCallin | |||
|name = UnitExperience | |||
|params = unitID, unitDefID, unitTeam, experience, oldExperience | |||
|return = none | |||
|description = Called when a unit gains experience greater or equal to the minimum limit set by calling [[Lua_SyncedCtrl#Other|Spring.SetExperienceGrade]]. | |||
}} | |||
{{LuaCallin | |||
|name = UnitIdle | |||
|params = unitID, unitDefID, unitTeam | |||
|return = none | |||
|description = Called when a unit is idle (empty command queue). | |||
}} | |||
{{LuaCallin | |||
|name = UnitCloaked | |||
|params = unitID, unitDefID, unitTeam | |||
|return = none | |||
|description = Called when a unit cloaks. | |||
}} | |||
{{LuaCallin | |||
|name = UnitDecloaked | |||
|params = unitID, unitDefID, unitTeam | |||
|return = none | |||
|description = Called when a unit decloaks. | |||
}} | |||
{{LuaCallin | |||
|name = UnitMoved | |||
|params = ??? | |||
|return = none | |||
|description = ??? Not implemented in base handler | |||
}} | |||
{{LuaCallin | |||
|name = UnitMoveFailed | |||
|params = ??? | |||
|return = none | |||
|description = ??? Not implemented in base handler | |||
}} | |||
{{LuaCallin | |||
|name = StockpileChanged | |||
|params = unitID, unitDefID, unitTeam, weaponNum, oldCount, newCount | |||
|return = none | |||
|description = Called when a units stockpile of weapons increases or decreases. See {{xtaglink|Gamedev:WeaponDefs|stockpile}}. | |||
}} | |||
{{LuaCallin | |||
|name = UnitEnteredLos | |||
|params = unitID, unitTeam, allyTeam, unitDefID | |||
|return = none | |||
|description = Called when a unit enters LOS of an allyteam. | |||
}} | |||
{{LuaCallin | |||
|name = UnitLeftLos | |||
|params = unitID, unitTeam, allyTeam, unitDefID | |||
|return = none | |||
|description = Called when a unit leaves LOS of an allyteam. | |||
}} | |||
{{LuaCallin | |||
|name = UnitEnteredRadar | |||
|params = unitID, unitTeam, allyTeam, unitDefID | |||
|return = none | |||
|description = Called when a unit enters radar of an allyteam. | |||
}} | |||
{{LuaCallin | |||
|name = UnitLeftRadar | |||
|params = unitID, unitTeam, allyTeam, unitDefID | |||
|return = none | |||
|description = Called when a unit leaves radar of an allyteam. | |||
}} | |||
{{LuaCallin | |||
|name = UnitEnteredAir | |||
|params = ??? | |||
|return = none | |||
|description = ??? Not implemented by base handler | |||
}} | |||
{{LuaCallin | |||
|name = UnitLeftAir | |||
|params = ??? | |||
|return = none | |||
|description = ??? Not implemented by base handler | |||
}} | |||
{{LuaCallin | |||
|name = UnitEnteredWater | |||
|params = ??? | |||
|return = none | |||
|description = ??? Not implemented by base handler | |||
}} | |||
{{LuaCallin | |||
|name = UnitLeftWater | |||
|params = ??? | |||
|return = none | |||
|description = ??? Not implemented by base handler | |||
}} | |||
{{LuaCallin | |||
|name = UnitSeismicPing | |||
|params = x, y, z, strength, allyTeam, unitID, unitDefID | |||
|return = none | |||
|description = Called when a unit emits a seismic ping. See {{xtaglink|Gamedev:UnitDefs|seismicSignature}}. | |||
}} | |||
=== Features === | === Features === | ||
Revision as of 21:42, 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: none
- {{{info}}}
addon.LoadProgress()
return: none
- {{{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 becomeMouseOwner
- {{{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
addon.TeamChanged()
return: none
- {{{info}}}
addon.TeamDied()
return: none
- {{{info}}}
Units
addon.UnitCreated()
return: none
- {{{info}}}
addon.UnitFinished()
return: none
- {{{info}}}
addon.UnitFromFactory()
return: none
- {{{info}}}
addon.UnitGiven()
return: none
- {{{info}}}
addon.UnitTaken()
return: none
- {{{info}}}
addon.UnitDamaged()
return: none
- {{{info}}}
addon.UnitDestroyed()
return: none
- {{{info}}}
addon.UnitUnitCollision()
return: none
- {{{info}}}
addon.UnitFeatureCollision()
return: none
- {{{info}}}
addon.UnitCommand()
return: none
- {{{info}}}
addon.UnitCmdDone()
return: none
- {{{info}}}
addon.UnitLoaded()
return: none
- {{{info}}}
addon.UnitUnloaded()
return: none
- {{{info}}}
addon.UnitExperience()
return: none
- {{{info}}}
addon.UnitIdle()
return: none
- {{{info}}}
addon.UnitCloaked()
return: none
- {{{info}}}
addon.UnitDecloaked()
return: none
- {{{info}}}
addon.UnitMoved()
return: none
- {{{info}}}
addon.UnitMoveFailed()
return: none
- {{{info}}}
addon.StockpileChanged()
return: none
- {{{info}}}
addon.UnitEnteredLos()
return: none
- {{{info}}}
addon.UnitLeftLos()
return: none
- {{{info}}}
addon.UnitEnteredRadar()
return: none
- {{{info}}}
addon.UnitLeftRadar()
return: none
- {{{info}}}
addon.UnitEnteredAir()
return: none
- {{{info}}}
addon.UnitLeftAir()
return: none
- {{{info}}}
addon.UnitEnteredWater()
return: none
- {{{info}}}
addon.UnitLeftWater()
return: none
- {{{info}}}
addon.UnitSeismicPing()
return: none
- {{{info}}}
Features
addon.FeatureCreated()
return: none
- {{{info}}}
addon.FeatureDamaged()
return: none
- {{{info}}}
addon.FeatureDestroyed()
return: none
- {{{info}}}
addon.FeatureMoved()
return: none
- {{{info}}}
Projectiles
The following Callins are only called for weaponDefIDs registered via Script.SetWatchWeapon.
addon.ProjectileCreated()
return: none
- {{{info}}}
addon.ProjectileDestroyed()
return: none
- {{{info}}}
addon.Explosion()
return: bool noGfx
- {{{info}}}
Synced Only
addon.CommandFallback()
return: bool used, bool finished
- {{{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}}}
addon.RecvLuaMsg()
return: none
- {{{info}}}
addon.Load()
return: none
- {{{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}}}