Repository navigation
[CPLUS plus ex] Utils
Pilot display and cyborg helper APIs exposed by CPLUS+. Internal table helpers (deepcopy, etc.) live in scripts/utils.lua but are not part of the public root API documented here.
- getPilotDisplayName
- getPilotPortraitSurface
- getTechnoVekPawn
- isCyborg
- isFlyingCyborg
- isBurrowerCyborg
- isJumperCyborg
- isTeleporterCyborg
-
stringcplus_plus_ex:getPilotDisplayName(pilotOrId)
| Argument name | Type | Description |
|---|---|---|
pilotOrId |
Pilot or string | memhack Pilot struct, or pilot id string |
Resolves a human readable display name.
Pilot struct: Uses pilot:getName():get() via GetText when set. If empty and the pilot is a cyborg, falls back to the cyborg mech display name (TechnoVek pawn Name or pawn localization). Otherwise returns getIdStr().
Pilot id string: Uses _G[pilotId].Name via GetText when set. If empty and its a cyborg then it uses the mech display name from TechnoVek pawn Name or GetText of the pawn id suffix. If its empty and not a cyborg it uses the unnamed corp map (Pilot_Rust -> "Corp. Rust", etc.) or the raw id if not in the map.
Example:
local pilot = Board:GetPawn(0):GetPilot()
LOG(cplus_plus_ex:getPilotDisplayName(pilot))
LOG(cplus_plus_ex:getPilotDisplayName("Pilot_BeetleMech"))-
surface|nilcplus_plus_ex:getPilotPortraitSurface(pilotOrId, scale)
| Argument name | Type | Description |
|---|---|---|
pilotOrId |
Pilot or string | memhack Pilot or pilot id |
scale |
number | Optional; default 2
|
Returns a cached sdlext surface for the pilot portrait.
Path resolution:
- If
_G[pilotId].Portraitis set ->img/portraits/<Portrait>.png - Else advanced pilots (
Pilot_Arrogant,Pilot_Caretaker,Pilot_Chemical,Pilot_Delusional) ->img/advanced/portraits/pilots/<pilotId>.png - Else ->
img/portraits/pilots/<pilotId>.png
Example:
local surface = cplus_plus_ex:getPilotPortraitSurface("Pilot_Original", 2)
if surface then
-- use with DecoSurface / UI
end-
table|nilcplus_plus_ex.getTechnoVekPawn(pilotId)
| Argument name | Type | Description |
|---|---|---|
pilotId |
string | Pilot id (e.g. "Pilot_BeetleMech") |
Returns the global pawn table if the id matches Pilot_<...> and _G[pawnName].Class == "TechnoVek". Otherwise nil.
Example:
local pawn = cplus_plus_ex.getTechnoVekPawn("Pilot_BeetleMech")
if pawn then
LOG("Flying: " .. tostring(pawn.Flying))
end-
boolcplus_plus_ex.isCyborg(pilotId)
| Argument name | Type | Description |
|---|---|---|
pilotId |
string | Pilot id |
True if getTechnoVekPawn(pilotId) is non nil - i.e. it is a pilot for a TechnoVek
Example:
if cplus_plus_ex.isCyborg("Pilot_BeetleMech") then
LOG("TechnoVek cyborg")
end-
boolcplus_plus_ex.isFlyingCyborg(pilotId)
| Argument name | Type | Description |
|---|---|---|
pilotId |
string | Pilot id |
True if the pilot is a cyborg and the TechnoVek pawn has a truthy Flying flag.
Example:
if cplus_plus_ex.isFlyingCyborg(pilotId) then
LOG("Flying cyborg")
end-
boolcplus_plus_ex.isBurrowerCyborg(pilotId)
| Argument name | Type | Description |
|---|---|---|
pilotId |
string | Pilot id |
True if the pilot is a cyborg and the TechnoVek pawn has a truthy Burrows flag.
Example:
if cplus_plus_ex.isBurrowerCyborg(pilotId) then
LOG("Burrower cyborg")
end-
boolcplus_plus_ex.isJumperCyborg(pilotId)
| Argument name | Type | Description |
|---|---|---|
pilotId |
string | Pilot id |
True if the pilot is a cyborg and the TechnoVek pawn has a truthy Jumper flag.
Example:
if cplus_plus_ex.isJumperCyborg(pilotId) then
LOG("Jumper cyborg")
end-
boolcplus_plus_ex.isTeleporterCyborg(pilotId)
| Argument name | Type | Description |
|---|---|---|
pilotId |
string | Pilot id |
True if the pilot is a cyborg and the TechnoVek pawn has a truthy Teleporter flag.
Example:
if cplus_plus_ex.isTeleporterCyborg(pilotId) then
LOG("Teleporter cyborg")
end