Skip to content

[CPLUS plus ex] Utils

DasKeifer edited this page Sep 30, 2026 · 2 revisions

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.

Table of Contents

getPilotDisplayName

  • string cplus_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"))

getPilotPortraitSurface

  • surface|nil cplus_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:

  1. If _G[pilotId].Portrait is set -> img/portraits/<Portrait>.png
  2. Else advanced pilots (Pilot_Arrogant, Pilot_Caretaker, Pilot_Chemical, Pilot_Delusional) -> img/advanced/portraits/pilots/<pilotId>.png
  3. Else -> img/portraits/pilots/<pilotId>.png

Example:

local surface = cplus_plus_ex:getPilotPortraitSurface("Pilot_Original", 2)
if surface then
    -- use with DecoSurface / UI
end

getTechnoVekPawn

  • table|nil cplus_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

isCyborg

  • bool cplus_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

isFlyingCyborg

  • bool cplus_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

isBurrowerCyborg

  • bool cplus_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

isJumperCyborg

  • bool cplus_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

isTeleporterCyborg

  • bool cplus_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

Clone this wiki locally