deployment - itb-community/ITB-ModLoader GitHub Wiki
Table of Contents
modApi.deployment
A table providing methods to get information about the deployment phase.
functions
The following list of functions can be accessed in the table modApi.deployment
.
getDeployed
table of number
modApi.deployment:getDeployed()
Returns a table of unit id's of the deployed units, not currently selected or in the remaining unit pool.
Example:
LOGF("List of deployed units: %s",
save_table(modApi.deployment:getDeployed())
)
getRemaining
table of number
modApi.deployment:getRemaining()
Returns a table of unit id's of the remaining units, not currently selected or deployed.
Example:
LOGF("List of remaining units: %s",
save_table(modApi.deployment:getRemaining())
)
getSelected
number
modApi.deployment:getSelected()
Returns the unit id of the unit in the cursor that currently ready to be deployed. If there is no unit to deploy, or if called anytime other than during the deployment phase, this method will return nil
.
Example:
LOGF("Unit with id %s is selected",
modApi.deployment:getSelected()
)
isDeploymentPhase
boolean
modApi.deployment:isDeploymentPhase()
Returns true
if called during the deployment phase, or false
if called anywhere else. The deployment phase is considered to last from the player is allowed to start placing mechs, until the last mech has landed.
Example:
LOG("isDeploymentPhase is",
modApi.deployment:isDeploymentPhase()
)
isLandingPhase
boolean
modApi.deployment:isLandingPhase()
Returns true
if called during the landing phase, or false
if called anywhere else. The landing phase is considered to last from the first mech begins descending, until the last mech has landed.
Example:
LOG("isLandingPhase is",
modApi.deployment:isLandingPhase()
)
events
The deployment module tracks state changes during the deployment phase. The following events are accessed in modApi.events
, and can be subscribed to by any mod. Every subscriber will be called when the individual events are dispatched.
onDeploymentPhaseEnd
Dispatched when the deployment phase ends.
Handler function signature:
void
handler()
Example:
local handler = function()
LOG("onDeploymentPhaseEnd")
end
modApi.events.onDeploymentPhaseEnd:subscribe(handler)
onDeploymentPhaseStart
Dispatched when the deployment phase starts.
Handler function signature:
void
handler()
Example:
local handler = function()
LOG("onDeploymentPhaseStart")
end
modApi.events.onDeploymentPhaseStart:subscribe(handler)
onLandingPhaseStart
Dispatched when the landing phase starts.
Handler function signature:
void
handler()
Example:
local handler = function()
LOG("onLandingPhaseStart")
end
modApi.events.onLandingPhaseStart:subscribe(handler)
onPawnDeployed
Dispatched when a unit is deployed.
Handler function signature:
void
handler(int pawnId)
Example:
local handler = function(pawnId)
LOGF("%s Deployed", Board:GetPawn(pawnId):GetType())
end
modApi.events.onPawnDeployed:subscribe(handler)
onPawnLanded
Dispatched when a unit lands.
Handler function signature:
void
handler(int pawnId)
Example:
local handler = function(pawnId)
LOGF("%s Landed", Board:GetPawn(pawnId):GetType())
end
modApi.events.onPawnLanded:subscribe(handler)
onPawnLanding
Dispatched when a unit begins landing.
Handler function signature:
void
handler(int pawnId)
Example:
local handler = function(pawnId)
LOGF("%s Landing", Board:GetPawn(pawnId):GetType())
end
modApi.events.onPawnLanding:subscribe(handler)
onPawnSelectedForDeployment
Dispatched when a unit is selected for deployment.
NOTE: Selected for deployment is different from a unit actually being selected.
Handler function signature:
void
handler(int pawnId)
Example:
local handler = function(pawnId)
LOGF("%s Selected", Board:GetPawn(pawnId):GetType())
end
modApi.events.onPawnSelectedForDeployment:subscribe(handler)
onPawnUndeployed
Dispatched when a unit is no longer deployed.
Handler function signature:
void
handler(int pawnId)
Example:
local handler = function(pawnId)
LOGF("%s Undeployed", Board:GetPawn(pawnId):GetType())
end
modApi.events.onPawnUndeployed:subscribe(handler)
onPawnUnselectedForDeployment
Dispatched when a unit is unselected for deployment.
NOTE: Selected for deployment is different from a unit actually being selected.
Handler function signature:
void
handler(int pawnId)
Example:
local handler = function(pawnId)
LOGF("%s Unselected", Board:GetPawn(pawnId):GetType())
end
modApi.events.onPawnUnselectedForDeployment:subscribe(handler)