User Tools

Site Tools


ixe:irpl:unit:getunitdirection

GetUnitDirection

:!: Available in version 48 and later.

GetUnitDirection(<-UID) ->direction

Description

Returns the facing direction of unit UID. Behaves differently depending on the unit's rotate mode:

  • For units in rotate mode 0 (constant, such as emitters and reactors), direction is always 0.
  • For units in rotate mode 1 (left/right, such as most player-built ships), direction is 0 if facing right or 1 if facing left.
  • For units in rotate mode 2 (four-way, only possible in custom units), direction is 0 if facing right, 1 if facing up, 2 if facing left or 3 if facing down.
  • If unit UID does not exist, 0 is returned.

Examples

# need worked example
ixe/irpl/unit/getunitdirection.txt · Last modified: 2025/01/24 14:20 by Argonwolf