-
Notifications
You must be signed in to change notification settings - Fork 1
Pawn
This page describes functions of Pawn
that have been added or changed as part of memedit.
- For a page about the
Pawn
class as defined in vanilla version of the game, see Vanilla Pawn - For a page about the
Pawn
class functions added by the mod loader, see Pawn.
-
Pawn
-
AddWeapon
- Orig func moved -> AddWeaponVanilla
-
GetArmedWeaponType
- Orig func moved -> GetArmedWeaponVanilla
- Alias
GetArmedWeapon
-
GetBaseWeaponTypes
- Orig func moved -> GetEquippedWeaponsVanilla
- Alias
GetEquippedWeapons
- GetClass
- GetCustomAnim
- GetDefaultFaction
- GetImageOffset
- GetImpactMaterial
- GetLeader
- GetMaxBaseHealth
- GetMaxHealth
- GetMutation
- GetOwner
-
GetPoweredWeaponTypes
- Orig func moved -> GetPoweredWeaponsVanilla
- Alias
GetPoweredWeapons
- GetQueuedTarget
- GetUndoLoc
- GetWeaponBaseType
- GetWeaponClass
- GetWeaponCount
- GetWeaponLimitedRemaining
- GetWeaponLimitedUses
- GetWeaponType
-
IsBaseWeaponTypeEquipped
- Orig func moved -> IsWeaponEquippedVanilla
- Alias
IsWeaponEquipped
- IsInvisible
- IsJumper
- IsMassive
- IsMinor
- IsMissionCritical
- IsMovementSpent
- IsMutation
- IsNeutral
- IsPushable
- IsSpaceColor
- IsTeleporter
-
IsWeaponTypePowered
- Orig func moved -> IsWeaponPoweredVanilla
- Alias
IsWeaponPowered
- RemoveWeapon
- SetAcid
- SetBoosted
- SetClass
- SetCorpse
- SetDefaultFaction
- SetFlying
- SetFrozen
- SetImageOffset
- SetImpactMaterial
- SetJumper
- SetLeader
- SetMassive
- SetMaxBaseHealth
- SetMaxHealth
- SetMech
- SetMinor
- SetMovementSpent
- SetMoveSpeed
- SetOwner
- SetPushable
- SetQueuedTarget
- SetShield
- SetSpaceColor
- SetTeleporter
- SetUndoLoc
- SetWeaponClass
- SetWeaponLimitedRemaining
- SetWeaponLimitedUses
-
AddWeapon
-
void
Pawn:AddWeapon(weaponId, forceEnable)
-
Original function moved to
AddWeaponVanilla
When using the original function, the added weapon will be hidden unless it costs 0 cores, and is of the same class as the unit.
If the additional optional parameter forceEnable
is true
the weapon will be enabled by setting its core cost to zero and matching the class of the unit.
Example:
local pawn = Board:GetPawn(0)
pawn:AddWeapon("Brute_Tankmech", true)
-
string
Pawn:GetArmedWeaponType()
- Alias
GetArmedWeapon
-
Original function moved to
GetArmedWeaponVanilla
Looks up the armed weapon using memedit to get current values, instead of relying on save data which can be out of date.
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn %s is currently arming %s",
pawn:GetMechName(),
tostring(pawn:GetArmedWeaponType())
)
-
table
Pawn:GetBaseWeaponTypes()
-
Original function moved to
GetEquippedWeaponsVanilla
- Alias
GetEquippedWeapons
Looks up the unit's weapons using memedit to get current values, instead of relying on save data which can be out of date.
Example:
local pawn = Board:GetPawn(0)
local weapons = pawn:GetBaseWeaponTypes()
local primary = weapons[1]
local secondary = weapons[2]
LOGF("Pawn %s's equipped base weapons are %s and %s",
pawn:GetMechName(),
tostring(primary),
tostring(secondary)
)
-
string
Pawn:GetClass()
Returns the unit's current class. This could be different from the class of the unit's type, if it has been changed with SetClass.
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn %s's class is %s",
pawn:GetMechName(),
tostring(pawn:GetClass())
)
-
string
Pawn:GetCustomAnim()
Returns the unit's current custom animation. By default this should be ""
, if it has not been changed with SetCustomAnim
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn %s's custom animation is %s",
pawn:GetMechName(),
tostring(pawn:GetCustomAnim())
)
-
number
Pawn:GetDefaultFaction()
Returns the unit's default faction.
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn %s's default faction is %s",
pawn:GetMechName(),
tostring(pawn:GetDefaultFaction())
)
-
number
Pawn:GetImageOffset()
Returns the pawn's image offset, defining which row of the unit's sprite-sheet it should use.
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn %s has image offset %s",
pawn:GetMechName(),
pawn:GetImageOffset()
)
-
number
Pawn:GetImpactMaterial()
Returns the pawn's impact material.
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn %s has impact material %s",
pawn:GetMechName(),
pawn:GetImpactMaterial()
)
-
number
Pawn:GetLeader()
Returns the pawn's psion ability integer. By default all units have the constant LEADER_NONE
.
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn %s has psion ability integer %s",
pawn:GetMechName(),
pawn:GetLeader()
)
-
number
Pawn:GetMaxBaseHealth()
Returns the unit's maximum base health.
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn %s has %s max base health",
pawn:GetMechName(),
pawn:GetMaxBaseHealth()
)
-
number
Pawn:GetMaxHealth()
Returns the pawn's maximum health.
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn %s has %s max health",
pawn:GetMechName(),
pawn:GetMaxHealth()
)
Overrides the modloader's Pawn:GetMutation
function (see wiki) using memedit to check the mutation value, rather than checking the board for present psions.
-
number
Pawn:GetOwner()
Returns the id of the pawn's owner.
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn %s has owner with id %s",
pawn:GetMechName(),
tostring(pawn:GetOwner())
)
-
table
Pawn:GetPoweredWeaponTypes()
-
Original function moved to
GetPoweredWeapons
- Alias
GetPoweredWeapons
Looks up the unit's weapons using memedit to get current values, instead of relying on save data which can be out of date.
Example:
local pawn = Board:GetPawn(0)
local weapons = pawn:GetPoweredWeaponTypes()
local weapon1 = weapons[1]
local weapon2 = weapons[2]
LOGF("Pawn %s's powered weapons are %s and %s",
pawn:GetMechName(),
tostring(weapon1),
tostring(weapon2)
)
-
Point
Pawn:GetQueuedTarget()
Missing description - please fill this in if you know the answer.
Example:
-- Missing example
-
Point
Pawn:GetUndoLoc()
Returns the location the unit will end up in if the pawn's Undo Move is used.
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn %s's undo location is %s",
pawn:GetMechName(),
pawn:GetUndoLoc():GetString(),
)
-
string
Pawn:GetWeaponBaseType(weaponIndex)
Returns the base type of the weapon at the specified index.
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn %s's weapon at index %s has base type %s",
pawn:GetMechName(),
weaponIndex,
pawn:GetWeaponBaseType(weaponIndex),
)
-
string
Pawn:GetWeaponClass(weaponIndex)
Returns the class of the weapon at the specified index.
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn %s's weapon at index %s has class %s",
pawn:GetMechName(),
weaponIndex,
pawn:GetWeaponClass(weaponIndex),
)
-
number
Pawn:GetWeaponCount()
Returns the pawn's number of weapons.
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn %s has %s weapons",
pawn:GetMechName(),
pawn:GetWeaponCount(),
)
-
number
Pawn:GetWeaponLimitedRemaining(weapon_index)
Argument name | Type | Description |
---|---|---|
weapon_index |
number | The index of the weapon we want to check. Usually 1 or 2 |
Returns the remaining limited uses of the pawn's wepaon in the specified index. Only applicable for limited use weapons.
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn's weapon index 1 has %s uses remaining", pawn:GetWeaponLimitedRemaining(1))
-
number
Pawn:GetWeaponLimitedUses(weapon_index)
Argument name | Type | Description |
---|---|---|
weapon_index |
number | The index of the weapon we want to check. Usually 1 or 2 |
Returns the max limited uses of the pawn's wepaon in the specified index. Only applicable for limited use weapons.
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn's weapon index 1 has %s uses in total", pawn:GetWeaponLimitedUses(1))
-
string
Pawn:GetWeaponType(weaponIndex)
Returns the current type of the weapon at the specified index. (includes upgrades)
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn %s's weapon at index %s has type %s",
pawn:GetMechName(),
weaponIndex,
pawn:GetWeaponType(weaponIndex),
)
-
boolean
Pawn:IsBaseWeaponTypeEquipped()
-
Original function moved to
IsWeaponEquippedVanilla
- Alias
IsWeaponEquipped
Looks up the unit's weapons using memedit to get current values, instead of relying on save data which can be out of date.
Example:
local pawn = Board:GetPawn(0)
local skill = "Prime_Punchmech"
LOGF("Pawn %s is equipped with %s is %s",
pawn:GetMechName(),
skill,
tostring(pawn:IsBaseWeaponTypeEquipped(skill)),
)
-
boolean
Pawn:IsInvisible()
Returns true
if the pawn is invisible. false
otherwise.
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn %s is invisible is %s",
pawn:GetMechName(),
tostring(pawn:IsInvisible()),
)
-
boolean
Pawn:IsJumper()
-
Original function moved to
IsJumperVanilla
Returns true
if the pawn is a Jumper. false
otherwise.
Note: Uses memdit to check the unit object instance instead of the unit type.
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn %s is a Jumper is %s",
pawn:GetMechName(),
tostring(pawn:IsJumper()),
)
-
boolean
Pawn:IsMassive()
Returns true
if the pawn is Massive. false
otherwise.
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn %s is Massive is %s",
pawn:GetMechName(),
tostring(pawn:IsMassive()),
)
-
boolean
Pawn:IsMinor()
Returns true
if the pawn is Minor. false
otherwise.
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn %s is Minor is %s",
pawn:GetMechName(),
tostring(pawn:IsMinor()),
)
-
boolean
Pawn:IsMissionCritical()
Returns true
if the pawn has MissionCritical toggled on. false
otherwise.
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn %s is MissionCritical is %s",
pawn:GetMechName(),
tostring(pawn:IsMissionCritical()),
)
-
boolean
Pawn:IsMovementSpent()
Returns true
if the pawn has spent its movement. false
otherwise.
Note: a pawn must have both not spent its movement as well as be active to be able to move.
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn %s has spent its movement is %s",
pawn:GetMechName(),
tostring(pawn:IsMovementSpent()),
)
Overrides the modloader's Pawn:IsMutation
function (see wiki) using memedit to check the mutation value being compared, rather than checking the board for present psions.
-
boolean
Pawn:IsNeutral()
Returns true
if the pawn is neutral. false
otherwise.
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn %s is neutral is %s",
pawn:GetMechName(),
tostring(pawn:IsNeutral()),
)
-
boolean
Pawn:IsPushable()
Returns true
if the pawn is pushable. false
otherwise.
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn %s is pushable is %s",
pawn:GetMechName(),
tostring(pawn:IsPushable()),
)
-
boolean
Pawn:IsSpaceColor()
Returns true
if the pawn colors its occupying tile. false
otherwise.
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn %s colors its occupying tile is %s",
pawn:GetMechName(),
tostring(pawn:IsSpaceColor()),
)
-
boolean
Pawn:IsTeleporter()
-
Original function moved to
IsTeleporterVanilla
Returns true
if the pawn is a Teleporter. false
otherwise.
Note: Uses memdit to check the unit object instance instead of the unit type.
Example:
local pawn = Board:GetPawn(0)
LOGF("Pawn %s is a Teleporter is %s",
pawn:GetMechName(),
tostring(pawn:IsTeleporter()),
)
-
boolean
Pawn:IsWeaponTypePowered()
-
Original function moved to
IsWeaponPoweredVanilla
- Alias
IsWeaponPowered
Looks up the unit's weapons using memedit to get current values, instead of relying on save data which can be out of date.
Example:
local pawn = Board:GetPawn(0)
local skill = "Prime_Punchmech_A"
LOGF("Pawn %s is equipped with powered %s is %s",
pawn:GetMechName(),
skill,
tostring(pawn:IsWeaponTypePowered(skill)),
)
-
void
Pawn:RemoveWeapon(weaponIndex)
Removes the unit's weapon at the specified weaponIndex, and moves all weapons at indexes above this one index up to fill in the gap.
Example:
local pawn = Board:GetPawn(0)
pawn:RemoveWeapon(1)
-
void
Pawn:SetAcid(acid, no_animation)
-
void
Pawn:SetAcid(acid)
-
Original function moved to
SetAcidVanilla
Argument name | Type | Description |
---|---|---|
acid |
boolean | Whether to apply or remove acid |
no_animation |
boolean | Whether to skip animation and sound |
Same as the original function, but with an additional option argument no_animation
; which if set to true
skips all sound and animation and applies the effect immediately.
Example:
local pawn = Board:GetPawn(0)
pawn:SetAcid(true, true)
-
void
Pawn:SetBoosted(boosted)
Argument name | Type | Description |
---|---|---|
boosted |
boolean | Whether to apply or remove boosted |
Sets/unsets whether the unit is boosted; making its weapon deal more damage.
Example:
local pawn = Board:GetPawn(0)
pawn:SetBoosted(true)
-
void
Pawn:SetClass(class)
Argument name | Type | Description |
---|---|---|
class |
string | The class to set |
Sets the unit's class.
Example:
local pawn = Board:GetPawn(0)
pawn:SetClass("Brute")
-
void
Pawn:SetCorpse(corpse)
Argument name | Type | Description |
---|---|---|
corpse |
boolean | Whether to apply or remove corpse |
Sets/unsets whether a unit will leave a corpse when killed.
Example:
local pawn = Board:GetPawn(0)
pawn:SetCorpse(false)
-
void
Pawn:SetDefaultFaction(faction)
Argument name | Type | Description |
---|---|---|
faction |
number | Which faction to set |
Sets the unit's default faction.
Example:
local pawn = Board:GetPawn(0)
pawn:SetFaction(FACTION_BOTS)
-
void
Pawn:SetFlying()
Argument name | Type | Description |
---|---|---|
flying |
boolean | Whether to add or remove flying |
Sets or removes the pawn's flying state, as by the specified value.
Example:
local pawn = Game:GetPawn(0)
pawn:SetFlying(true)
-
void
Pawn:SetFrozen(frozen, no_animation)
-
void
Pawn:SetFrozen(frozen)
-
Original function moved to
SetFrozenVanilla
Argument name | Type | Description |
---|---|---|
frozen |
boolean | Whether to apply or remove frozen |
no_animation |
boolean | Whether to skip animation and sound |
Same as the original function, but with an additional option argument no_animation
; which if set to true
skips all sound and animation and applies the effect immediately.
Example:
local pawn = Board:GetPawn(0)
pawn:SetFrozen(true, true)
-
void
Pawn:SetImageOffset(imageOffset)
Argument name | Type | Description |
---|---|---|
imageOffset |
number | Which image offset to set |
Sets the unit's image offset, defining which row of the unit's sprite-sheet it should use.
Example:
local pawn = Board:GetPawn(0)
pawn:SetImageOffset(1)
-
void
Pawn:SetImpactMaterial(impactMaterial)
Argument name | Type | Description |
---|---|---|
impactMaterial |
number | Which impactmaterial to set |
Sets the unit's impact material, defining which impact sounds will play when the unit is hit.
Example:
local pawn = Board:GetPawn(0)
pawn:SetImpactMaterial(IMPACT_INSECT)
-
void
Pawn:SetJumper(jumper)
Argument name | Type | Description |
---|---|---|
jumper |
boolean | Whether to make the pawn a Jumper, or to remove that ability |
Changes the unit's movement type to that of a Jumper if jumper
is true
, or removes that ability if false
.
Example:
local pawn = Game:GetPawn(0)
pawn:SetJumper(true)
-
void
Pawn:SetMassive(massive)
Argument name | Type | Description |
---|---|---|
massive |
boolean | Whether to make the pawn Massive, or to remove that status |
Changes the unit to Massive if massive
is true
, or removes Massive from the unit if false
.
Massive units can stand in water without getting killed
Example:
local pawn = Game:GetPawn(0)
pawn:SetMassive(false)
-
void
Pawn:SetMaxBaseHealth(maxBaseHealth)
Argument name | Type | Description |
---|---|---|
maxBaseHealth |
number | The maximum base health to set |
Sets the pawn's base maximum health to the specified amount.
When in a mission, the base max health does not affect the mech on the board.
When out of mission, the base max health will modify the pawn's maximum health, so the pawn will spawn with increased health when starting a new mission.
Example:
local pawn = Game:GetPawn(0)
pawn:SetMaxBaseHealth(2)
-
void
Pawn:SetMaxHealth(maxHealth)
Argument name | Type | Description |
---|---|---|
maxHealth |
number | The maximum health to set |
Sets the pawn's maximum health to the specified amount.
When out of mission, the maximum health does not affect the mech.
When in a mission, the max health will modify the pawn's maximum health.
Example:
local pawn = Board:GetPawn(0)
pawn:SetMaxHealth(2)
-
void
Pawn:SetMech(mech)
-
void
Pawn:SetMech()
-
Original function moved to
SetMechVanilla
Argument name | Type | Description |
---|---|---|
mech |
boolean | Whether to change the pawn to a mech, or remove that status |
Changes the pawn to be considered a mech if mech
is true
, or removes that classification if false
, or calls the original function if the argument is left blank.
Due to how the game will very quickly crash with more or less mechs than exactly 3
, this function will not allow setting more than 3
pawns to mechs.
There may be times when forcing a unit to be either a mech or a non-mech can be helpful, which is why this functionality is exposed.
Example:
local pawn = Board:GetPawn(0)
pawn:SetMech(true)
-
void
Pawn:SetMinor(minor)
Argument name | Type | Description |
---|---|---|
minor |
boolean | Whether to make the pawn Minor, or to remove that status |
Sets or removes the unit's Minor state, as by the specified value.
Minor units don't give experience when killed; don't burrow underground when escaping; and don't count as a unit for spawning purposes.
Example:
local pawn = Game:GetPawn(0)
pawn:SetMinor(false)
-
void
Pawn:SetMovementSpent(movementSpent)
Argument name | Type | Description |
---|---|---|
movementSpent |
boolean | Whether to disable or enable movement |
Spends the unit's movement if true
, or unspends it if false
.
Note: a pawn must have both not spent its movement as well as be active to be able to move.
Example:
local pawn = Board:GetPawn(0)
pawn:SetMovementSpent(true)
-
void
Pawn:SetOwner(pawnId)
Argument name | Type | Description |
---|---|---|
pawnId |
number | The id of the unit to set as owner |
Sets the owner of the unit to the unit with the specified id.
A unit owned by a mech will be displayed next on the left hand side of the screen.
Example:
local pawn = Board:GetPawn(0)
pawn:SetOwner(1)
-
void
Pawn:SetPushable(pawnId)
Argument name | Type | Description |
---|---|---|
pushable |
boolean | Whether to make the unit pushable or unpushable |
Makes the unit pushable if pushable
is true
, or unpushable if false
. In-game, a unit that is unpushable is refered to as being Stable
.
Example:
local pawn = Board:GetPawn(0)
pawn:SetPushable(false)
-
void
Pawn:SetQueuedTarget(loc)
Argument name | Type | Description |
---|---|---|
loc |
Point | The point to queue the attack |
Changes the queued target of a unit to the specified location.
Example:
local pawn = Board:GetPawn(0)
pawn:SetQueuedTarget(Point(0,0))
-
void
Pawn:SetShield(shield, no_animation)
-
void
Pawn:SetShield(shield)
-
Original function moved to
SetShieldVanilla
Argument name | Type | Description |
---|---|---|
shield |
boolean | Whether to apply or remove shield |
no_animation |
boolean | Whether to skip animation and sound |
Same as the original function, but with an additional option argument no_animation
; which if set to true
skips all sound and animation and applies the effect immediately.
Example:
local pawn = Board:GetPawn(0)
pawn:SetShield(true, true)
-
void
Pawn:SetSpaceColor(spaceColor)
Argument name | Type | Description |
---|---|---|
spaceColor |
boolean | Whether the unit's occupying tile is colored or not |
Sets/unsets whether the unit's occupying tile will be colored or not.
Example:
local pawn = Board:GetPawn(0)
pawn:SetSpaceColor(false)
-
void
Pawn:SetTeleporter(teleporter)
Argument name | Type | Description |
---|---|---|
teleporter |
boolean | Whether to make the pawn a Teleporter, or to remove that ability |
Changes the pawn's movement type to that of a Teleporter if teleporter
is true
, or removes that ability if false
.
Example:
local pawn = Board:GetPawn(0)
pawn:SetTeleporter(true)
-
void
Pawn:SetUndoLoc(loc)
Argument name | Type | Description |
---|---|---|
loc |
Point | The location to move the unit when using Undo Move |
Changes the unit's undo location to the specified location.
Example:
local pawn = Board:GetPawn(0)
pawn:SetUndoLoc(Point(0,0))
-
void
Pawn:SetWeaponClass(weaponIndex, class)
Argument name | Type | Description |
---|---|---|
weaponIndex |
number | The weapon to change |
class |
string | The class to set |
Changes the weapon at the specified index's class.
Note: The class referred to by this function is the class in the weapon object. This is by default set to be the same as the class of the owning unit. This weapon class is then compared to the class of the weapon type table in lua to see if the weapon should have an increased cost for being off-class.
Example:
local pawn = Board:GetPawn(0)
pawn:SetWeaponClass(1, "Brute")
-
void
Pawn:SetWeaponLimitedRemaining(weapon_index, remaining)
Argument name | Type | Description |
---|---|---|
weapon_index |
number | The index of the weapon we want to set. Usually 1 or 2 |
remaining |
number | The number of remaining uses we want to set for the weapon |
Changes the remaining limited uses for a weapon to the specified amount.
Example:
local pawn = Board:GetPawn(0)
pawn:SetWeaponLimitedRemaining(1, 1)
-
void
Pawn:SetWeaponLimitedUses(weapon_index, uses)
Argument name | Type | Description |
---|---|---|
weapon_index |
number | The index of the weapon we want to set. Usually 1 or 2 |
uses |
number | The number of total uses we want to set for the weapon |
Changes the total limited uses for a weapon to the specified amount.
Example:
local pawn = Board:GetPawn(0)
pawn:SetWeaponLimitedUses(1, 1)