Class UnitType

All Implemented Interfaces:
Comparable<Content>, Senseable
Direct Known Subclasses:
ErekirUnitType, MissileUnitType, NeoplasmUnitType

public class UnitType extends UnlockableContent implements Senseable
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     

    Nested classes/interfaces inherited from class mindustry.ctype.Content

    Content.ModContentInfo
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    arc.struct.Seq<Ability>
    list of "abilities", which are various behaviors that update each frame
    float
    movement speed (world units/t)
    arc.func.Prov<? extends UnitController>
    The default AI controller to assign on creation.
    float
    movement speed (world units/t)
    boolean
    A value of false is used to hide command changing UI in unit factories.
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    int
    amount of ammo this unit can hold (if the rule is enabled); <0 to determine based on weapon fire rate.
    ammo this unit uses, if that system is enabled.
    float
    movement speed (world units/t)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    arc.graphics.g2d.TextureRegion
     
    float
    total length of a leg (both segments)
    arc.graphics.g2d.TextureRegion
     
    float
    movement speed (world units/t)
    float
    movement speed (world units/t)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    float
    movement speed (world units/t)
    float
    movement speed (world units/t)
    float
    movement speed (world units/t)
    protected float
     
    protected ItemStack[]
     
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    arc.graphics.g2d.TextureRegion
     
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    float
    movement speed (world units/t)
    arc.struct.Seq<UnitCommand>
    Commands available to this unit through RTS controls.
    arc.func.Prov<? extends mindustry.gen.Unit>
    Creates a new instance of this unit class.
    arc.func.Func<mindustry.gen.Unit,? extends UnitController>
    Function that chooses AI controller based on unit entity.
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    float
    movement speed (world units/t)
    float
    magnitude of sine offset between segments
    float
    magnitude of sine offset between segments
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    float
    magnitude of sine offset between segments
    effect created when this unit dies
    float
    movement speed (world units/t)
    arc.audio.Sound
    sound played when this unit explodes (*not* when it is shot down)
    Command to assign to this unit upon creation.
    float
    movement speed (world units/t)
    float
    movement speed (world units/t)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    float
    movement speed (world units/t)
    boolean
    Whether to emit a splashing effect in water (fasle implies emitWalkSound false).
    boolean
    Whether to emit a splashing noise in water.
    arc.graphics.Color
    override for all engine colors
    arc.graphics.Color
    color for inner portions of engines
    float
    movement speed (world units/t)
    float
    movement speed (world units/t)
    arc.struct.Seq<UnitType.UnitEngine>
    list of engines, or "thrusters"
    float
    movement speed (world units/t)
    int
    The environment flags that this unit *cannot* function in.
    int
    The environment flags that this unit can function in.
    int
    Environmental flags that are *all* required for this unit to function.
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    effect that this unit emits when falling
    effect created at engine when unit falls.
    float
    movement speed (world units/t)
    protected ItemStack[]
     
    boolean
    TODO neither of these appear to do much
    boolean
    TODO neither of these appear to do much
    int
    Cost type ID for flow field/enemy AI pathfinding.
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    float
    movement speed (world units/t)
    float
    movement speed (world units/t)
    arc.graphics.g2d.TextureRegion
     
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    float
    movement speed (world units/t)
    arc.graphics.Color
    color that this unit flashes when getting healed (if healFlash is true)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    float
    movement speed (world units/t)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    float
    movement speed (world units/t)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    float
    ticks that must pass before this missile starts homing.
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    arc.struct.ObjectSet<StatusEffect>
    None of the status effects in this set can be applied to this unit.
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    int
    amount of items this unit can carry; <0 to determine based on hitSize.
    arc.graphics.g2d.TextureRegion
     
    float
    movement speed (world units/t)
    arc.graphics.g2d.TextureRegion
     
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    float
    total length of a leg (both segments)
    arc.graphics.g2d.TextureRegion
     
    boolean
    If true, the base (further away) leg region is drawn under instead of over.
    boolean
    If true, legs always try to move around even when the unit is not moving (leads to more natural behavior)
    int
    number of legs this unit has (must have the correct type to function!)
    float
    total length of a leg (both segments)
    float
    total length of a leg (both segments)
    int
    size of groups in which legs move.
    float
    total length of a leg (both segments)
    float
    total length of a leg (both segments)
    float
    total length of a leg (both segments)
    float
    total length of a leg (both segments)
    float
    total length of a leg (both segments)
    float
    total length of a leg (both segments)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    arc.graphics.g2d.TextureRegion
     
    float
    total length of a leg (both segments)
    float
    total length of a leg (both segments)
    float
    total length of a leg (both segments)
    float
    total length of a leg (both segments)
    float
    total length of a leg (both segments)
    float
    lifetime of this missile.
    arc.graphics.Color
    Color of light that this unit produces when lighting is enabled in the map.
    float
    movement speed (world units/t)
    float
    movement speed (world units/t)
    boolean
    If true, legs are locked to the base of the unit instead of being on an implicit rotating "mount".
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    arc.audio.Sound
    sound played on loop when this unit is around.
    float
    volume of loop sound
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    float
    movement speed (world units/t)
    float
    parameters for mech swaying animation
    float
    screen shake amount for when this mech lands after boosting
    arc.graphics.Color
    color that legs change to when moving, to simulate depth
    float
    parameters for mech swaying animation
    boolean
    whether particles are created when this mech takes a step
    float
    parameters for mech swaying animation
    float
    movement speed (world units/t)
    boolean
    whether this unit can mine ores from floors/walls, respectively
    boolean
    if true, harder materials will take longer to mine
    arc.struct.Seq<Item>
    Target items to mine.
    arc.graphics.g2d.TextureRegion
     
    arc.graphics.g2d.TextureRegion
     
    float
    movement speed (world units/t)
    arc.audio.Sound
    continuous sound emitted when mining.
    float
    volume of mining sound.
    float
    mining speed in weird arbitrary units
    int
    max hardness of ore that this unit can mine (<0 to disable)
    boolean
    whether this unit can mine ores from floors/walls, respectively
    float
    movement speed (world units/t)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    arc.graphics.Color
    color for outline generated around sprites
    int
    thickness for sprite outline
    arc.graphics.g2d.TextureRegion
     
    boolean
    if false, no sprite outlines are generated
    arc.struct.Seq<DrawPart>
    extra (usually animated) visual parts
    Function used for calculating cost of moving with ControlPathfinder.
    int
    ID for path cost, to be used in the control path finder.
    float
    movement speed (world units/t)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    arc.graphics.g2d.TextureRegion
     
    float
    movement speed (world units/t)
    arc.graphics.g2d.TextureRegion
     
    float
    movement speed (world units/t)
    float
    movement speed (world units/t)
    float
    movement speed (world units/t)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    float
    movement speed (world units/t)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    mindustry.gen.Unit
    A sample of the unit that this type creates.
    arc.graphics.g2d.TextureRegion[]
     
    unit spawned at the end; if null, the segment unit is used
    boolean
    true - parent segments are on higher layers; false - parent segments are on lower layers than head
    float
    magnitude of sine offset between segments
    float
    magnitude of sine offset between segments
    arc.graphics.g2d.TextureRegion[]
     
    float
    magnitude of sine offset between segments
    arc.graphics.g2d.TextureRegion[]
     
    float
    magnitude of sine offset between segments
    float
    magnitude of sine offset between segments
    int
    number of independent segments
    float
    magnitude of sine offset between segments
    float
    magnitude of sine offset between segments
    unit spawned in segments; if null, the same unit is used
    int
    TODO wave support - for multi-unit segmented units, this is the number of independent units that are spawned
    float
    movement speed (world units/t)
    float
    movement speed (world units/t)
    arc.graphics.g2d.TextureRegion
     
    static final float
     
    static final float
     
    arc.graphics.Color
    override for unit shield colour.
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    arc.graphics.g2d.TextureRegion
     
    float
    movement speed (world units/t)
    float
    movement speed (world units/t)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    arc.struct.Seq<UnitStance>
    Stances this unit can have.
    float
    movement speed (world units/t)
    float
    movement speed (world units/t)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    Flags to target based on priority.
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    float
    movement speed (world units/t)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    protected ItemStack[]
     
    arc.graphics.Color
    override for engine trail color
    int
    length of engine trail (if flying) or wave trail (if naval)
    float
    movement speed (world units/t)
    optional effect created when this tank moves
    int
    number of frames of movement in a tread
    int
    how much of a top part of a tread sprite is "cut off" relative to the pattern; this is corrected for
    arc.math.geom.Rect[]
    list of treads as rectangles in IMAGE COORDINATES, relative to the center.
    arc.graphics.g2d.TextureRegion
     
    arc.graphics.g2d.TextureRegion[][]
     
    boolean
    if false, the thruster is always displayed at its normal size regardless of elevation
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    float
    movement speed (world units/t)
    float
    movement speed (world units/t)
    arc.struct.Seq<Weapon>
    All weapons that this unit will shoot with.
    boolean
    if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    arc.graphics.g2d.TextureRegion[]
     

    Fields inherited from class mindustry.ctype.MappableContent

    name

    Fields inherited from class mindustry.ctype.Content

    id, minfo

    Fields inherited from interface mindustry.logic.Senseable

    noSensed
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    applyColor(mindustry.gen.Unit unit)
     
    void
    applyOutlineColor(mindustry.gen.Unit unit)
     
    arc.graphics.Color
    cellColor(mindustry.gen.Unit unit)
     
    protected void
    checkEntityMapping(mindustry.gen.Unit example)
     
    mindustry.gen.Unit
    create(Team team)
     
    createController(mindustry.gen.Unit unit)
     
    void
    Generate any special icons for this content.
    void
    display(mindustry.gen.Unit unit, arc.scene.ui.layout.Table table)
     
    void
    draw(mindustry.gen.Unit unit)
     
    void
    drawBody(mindustry.gen.Unit unit)
     
    void
    drawCell(mindustry.gen.Unit unit)
     
    void
    drawCrawl(mindustry.gen.Crawlc crawl)
     
    void
    drawEngines(mindustry.gen.Unit unit)
     
    void
    drawItems(mindustry.gen.Unit unit)
     
    <T extends mindustry.gen.Unit & mindustry.gen.Legsc>
    void
    drawLegs(T unit)
     
    void
    drawLight(mindustry.gen.Unit unit)
     
    void
    drawMech(mindustry.gen.Mechc mech)
     
    void
    drawMining(mindustry.gen.Unit unit)
     
    void
    drawMiningBeam(mindustry.gen.Unit unit, float px, float py)
     
    void
    drawOutline(mindustry.gen.Unit unit)
     
    <T extends mindustry.gen.Unit & mindustry.gen.Payloadc>
    void
    drawPayload(T unit)
     
    void
    drawShadow(mindustry.gen.Unit unit)
     
    void
    drawShield(mindustry.gen.Unit unit)
     
    void
    drawSoftShadow(float x, float y, float rotation, float alpha)
     
    void
    drawSoftShadow(mindustry.gen.Unit unit)
     
    void
    drawSoftShadow(mindustry.gen.Unit unit, float alpha)
     
    <T extends mindustry.gen.Unit & mindustry.gen.Tankc>
    void
    drawTank(T unit)
     
    void
    drawTrail(mindustry.gen.Unit unit)
     
    void
    drawWeaponOutlines(mindustry.gen.Unit unit)
     
    void
    drawWeapons(mindustry.gen.Unit unit)
     
    float
     
    float
     
    Returns the type name of this piece of content.
    void
    getDependencies(arc.func.Cons<UnlockableContent> cons)
    Iterates through any implicit dependencies of this content.
     
    void
    getRegionsToOutline(arc.struct.Seq<arc.graphics.g2d.TextureRegion> out)
     
    getRequirements(UnitType[] prevReturn, float[] timeReturn)
     
     
    boolean
     
    boolean
    hittable(mindustry.gen.Unit unit)
     
    void
    Called after all content and modules are created.
    boolean
     
    boolean
    Whether this content is always hidden in the content database dialog.
    void
    killed(mindustry.gen.Unit unit)
     
    void
    landed(mindustry.gen.Unit unit)
     
    void
    Called after all content is created, only on non-headless versions.
    boolean
     
     
    double
    sense(LAccess sensor)
     
     
    void
    Sets up engines, mirroring the contents of the specified array.
    void
    Initializes stats on demand.
    arc.graphics.Color
    shieldColor(mindustry.gen.Unit unit)
     
    mindustry.gen.Unit
    spawn(float x, float y)
     
    mindustry.gen.Unit
    spawn(arc.math.geom.Position pos)
     
    mindustry.gen.Unit
    spawn(arc.math.geom.Position pos, Team team)
     
    mindustry.gen.Unit
    spawn(Team team, float x, float y)
     
    mindustry.gen.Unit
    spawn(Team team, float x, float y, float rotation)
     
    mindustry.gen.Unit
    spawn(Team team, float x, float y, float rotation, arc.func.Cons<mindustry.gen.Unit> cons)
     
    mindustry.gen.Unit
    spawn(Team team, arc.math.geom.Position pos)
     
    boolean
    supportsEnv(int env)
     
    boolean
    targetable(mindustry.gen.Unit unit, Team targeter)
     
    void
    update(mindustry.gen.Unit unit)
     
    void
    updatePayload(mindustry.gen.Unit unit, mindustry.gen.Unit unitHolder, mindustry.gen.Building buildingHolder)
     
    protected void
     

    Methods inherited from class mindustry.ctype.MappableContent

    toString

    Methods inherited from class mindustry.ctype.Content

    compareTo, hasErrored, isModded, isVanilla

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface mindustry.logic.Senseable

    sense
  • Field Details

    • shadowTX

      public static final float shadowTX
      See Also:
    • shadowTY

      public static final float shadowTY
      See Also:
    • envRequired

      public int envRequired
      Environmental flags that are *all* required for this unit to function. 0 = any environment
    • envEnabled

      public int envEnabled
      The environment flags that this unit can function in. If the env matches any of these, it will be enabled.
    • envDisabled

      public int envDisabled
      The environment flags that this unit *cannot* function in. If the env matches any of these, it will explode or be disabled.
    • speed

      public float speed
      movement speed (world units/t)
    • boostMultiplier

      public float boostMultiplier
      movement speed (world units/t)
    • rotateSpeed

      public float rotateSpeed
      movement speed (world units/t)
    • baseRotateSpeed

      public float baseRotateSpeed
      movement speed (world units/t)
    • drag

      public float drag
      movement speed (world units/t)
    • accel

      public float accel
      movement speed (world units/t)
    • hitSize

      public float hitSize
      movement speed (world units/t)
    • deathShake

      public float deathShake
      movement speed (world units/t)
    • stepShake

      public float stepShake
      movement speed (world units/t)
    • rippleScale

      public float rippleScale
      movement speed (world units/t)
    • riseSpeed

      public float riseSpeed
      movement speed (world units/t)
    • fallSpeed

      public float fallSpeed
      movement speed (world units/t)
    • missileAccelTime

      public float missileAccelTime
      movement speed (world units/t)
    • health

      public float health
      movement speed (world units/t)
    • armor

      public float armor
      movement speed (world units/t)
    • range

      public float range
      movement speed (world units/t)
    • maxRange

      public float maxRange
      movement speed (world units/t)
    • mineRange

      public float mineRange
      movement speed (world units/t)
    • buildRange

      public float buildRange
      movement speed (world units/t)
    • crashDamageMultiplier

      public float crashDamageMultiplier
      movement speed (world units/t)
    • dpsEstimate

      public float dpsEstimate
      movement speed (world units/t)
    • clipSize

      public float clipSize
      movement speed (world units/t)
    • drownTimeMultiplier

      public float drownTimeMultiplier
      movement speed (world units/t)
    • strafePenalty

      public float strafePenalty
      movement speed (world units/t)
    • researchCostMultiplier

      public float researchCostMultiplier
      movement speed (world units/t)
    • groundLayer

      public float groundLayer
      movement speed (world units/t)
    • flyingLayer

      public float flyingLayer
      movement speed (world units/t)
    • payloadCapacity

      public float payloadCapacity
      movement speed (world units/t)
    • buildSpeed

      public float buildSpeed
      movement speed (world units/t)
    • aimDst

      public float aimDst
      movement speed (world units/t)
    • buildBeamOffset

      public float buildBeamOffset
      movement speed (world units/t)
    • mineBeamOffset

      public float mineBeamOffset
      movement speed (world units/t)
    • targetPriority

      public float targetPriority
      movement speed (world units/t)
    • shadowElevation

      public float shadowElevation
      movement speed (world units/t)
    • shadowElevationScl

      public float shadowElevationScl
      movement speed (world units/t)
    • engineOffset

      public float engineOffset
      movement speed (world units/t)
    • engineSize

      public float engineSize
      movement speed (world units/t)
    • engineLayer

      public float engineLayer
      movement speed (world units/t)
    • itemOffsetY

      public float itemOffsetY
      movement speed (world units/t)
    • lightRadius

      public float lightRadius
      movement speed (world units/t)
    • lightOpacity

      public float lightOpacity
      movement speed (world units/t)
    • softShadowScl

      public float softShadowScl
      movement speed (world units/t)
    • fogRadius

      public float fogRadius
      movement speed (world units/t)
    • waveTrailX

      public float waveTrailX
      movement speed (world units/t)
    • waveTrailY

      public float waveTrailY
      movement speed (world units/t)
    • trailScl

      public float trailScl
      movement speed (world units/t)
    • isEnemy

      public boolean isEnemy
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • flying

      public boolean flying
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • wobble

      public boolean wobble
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • targetAir

      public boolean targetAir
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • targetGround

      public boolean targetGround
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • faceTarget

      public boolean faceTarget
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • circleTarget

      public boolean circleTarget
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • autoDropBombs

      public boolean autoDropBombs
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • targetBuildingsMobile

      public boolean targetBuildingsMobile
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • canBoost

      public boolean canBoost
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • boostWhenBuilding

      public boolean boostWhenBuilding
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • logicControllable

      public boolean logicControllable
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • playerControllable

      public boolean playerControllable
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • allowedInPayloads

      public boolean allowedInPayloads
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • hittable

      public boolean hittable
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • killable

      public boolean killable
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • targetable

      public boolean targetable
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • vulnerableWithPayloads

      public boolean vulnerableWithPayloads
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • pickupUnits

      public boolean pickupUnits
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • physics

      public boolean physics
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • canDrown

      public boolean canDrown
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • useUnitCap

      public boolean useUnitCap
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • coreUnitDock

      public boolean coreUnitDock
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • createWreck

      public boolean createWreck
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • createScorch

      public boolean createScorch
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • lowAltitude

      public boolean lowAltitude
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • rotateToBuilding

      public boolean rotateToBuilding
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • allowLegStep

      public boolean allowLegStep
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • legPhysicsLayer

      public boolean legPhysicsLayer
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • hovering

      public boolean hovering
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • omniMovement

      public boolean omniMovement
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • rotateMoveFirst

      public boolean rotateMoveFirst
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • healFlash

      public boolean healFlash
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • canHeal

      public boolean canHeal
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • singleTarget

      public boolean singleTarget
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • forceMultiTarget

      public boolean forceMultiTarget
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • canAttack

      public boolean canAttack
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • hidden

      public boolean hidden
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • internal

      public boolean internal
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • internalGenerateSprites

      public boolean internalGenerateSprites
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • bounded

      public boolean bounded
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • autoFindTarget

      public boolean autoFindTarget
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • targetUnderBlocks

      public boolean targetUnderBlocks
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • alwaysShootWhenMoving

      public boolean alwaysShootWhenMoving
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • hoverable

      public boolean hoverable
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • alwaysCreateOutline

      public boolean alwaysCreateOutline
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • generateFullIcon

      public boolean generateFullIcon
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • squareShape

      public boolean squareShape
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • drawBuildBeam

      public boolean drawBuildBeam
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • drawMineBeam

      public boolean drawMineBeam
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • drawCell

      public boolean drawCell
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • drawItems

      public boolean drawItems
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • drawShields

      public boolean drawShields
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • drawBody

      public boolean drawBody
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • drawSoftShadow

      public boolean drawSoftShadow
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • drawMinimap

      public boolean drawMinimap
      if true, this unit counts as an enemy in the wave counter (usually false for support-only units)
    • aiController

      public arc.func.Prov<? extends UnitController> aiController
      The default AI controller to assign on creation.
    • controller

      public arc.func.Func<mindustry.gen.Unit,? extends UnitController> controller
      Function that chooses AI controller based on unit entity.
    • constructor

      public arc.func.Prov<? extends mindustry.gen.Unit> constructor
      Creates a new instance of this unit class.
    • abilities

      public arc.struct.Seq<Ability> abilities
      list of "abilities", which are various behaviors that update each frame
    • weapons

      public arc.struct.Seq<Weapon> weapons
      All weapons that this unit will shoot with.
    • immunities

      public arc.struct.ObjectSet<StatusEffect> immunities
      None of the status effects in this set can be applied to this unit.
    • healColor

      public arc.graphics.Color healColor
      color that this unit flashes when getting healed (if healFlash is true)
    • lightColor

      public arc.graphics.Color lightColor
      Color of light that this unit produces when lighting is enabled in the map.
    • shieldColor

      @Nullable public arc.graphics.Color shieldColor
      override for unit shield colour.
    • deathSound

      public arc.audio.Sound deathSound
      sound played when this unit explodes (*not* when it is shot down)
    • loopSound

      public arc.audio.Sound loopSound
      sound played on loop when this unit is around.
    • loopSoundVolume

      public float loopSoundVolume
      volume of loop sound
    • fallEffect

      public Effect fallEffect
      effect that this unit emits when falling
    • fallEngineEffect

      public Effect fallEngineEffect
      effect created at engine when unit falls.
    • deathExplosionEffect

      public Effect deathExplosionEffect
      effect created when this unit dies
    • treadEffect

      @Nullable public Effect treadEffect
      optional effect created when this tank moves
    • parts

      public arc.struct.Seq<DrawPart> parts
      extra (usually animated) visual parts
    • engines

      public arc.struct.Seq<UnitType.UnitEngine> engines
      list of engines, or "thrusters"
    • useEngineElevation

      public boolean useEngineElevation
      if false, the thruster is always displayed at its normal size regardless of elevation
    • engineColor

      @Nullable public arc.graphics.Color engineColor
      override for all engine colors
    • engineColorInner

      public arc.graphics.Color engineColorInner
      color for inner portions of engines
    • trailLength

      public int trailLength
      length of engine trail (if flying) or wave trail (if naval)
    • trailColor

      @Nullable public arc.graphics.Color trailColor
      override for engine trail color
    • flowfieldPathType

      public int flowfieldPathType
      Cost type ID for flow field/enemy AI pathfinding.
    • pathCost

      @Nullable public Pathfinder.PathCost pathCost
      Function used for calculating cost of moving with ControlPathfinder. Does not affect "normal" flow field pathfinding.
    • pathCostId

      public int pathCostId
      ID for path cost, to be used in the control path finder. This is the value that actually matters; do not assign manually. Set in init().
    • sample

      @Nullable public mindustry.gen.Unit sample
      A sample of the unit that this type creates. Do not modify!
    • targetFlags

      public BlockFlag[] targetFlags
      Flags to target based on priority. Null indicates that the closest target should be found. The closest enemy core is used as a fallback.
    • allowChangeCommands

      public boolean allowChangeCommands
      A value of false is used to hide command changing UI in unit factories.
    • commands

      public arc.struct.Seq<UnitCommand> commands
      Commands available to this unit through RTS controls. An empty array means commands will be assigned based on unit capabilities in init().
    • defaultCommand

      @Nullable public UnitCommand defaultCommand
      Command to assign to this unit upon creation. Null indicates the first command in the array.
    • stances

      public arc.struct.Seq<UnitStance> stances
      Stances this unit can have. An empty array means stances will be assigned based on unit capabilities in init().
    • outlineColor

      public arc.graphics.Color outlineColor
      color for outline generated around sprites
    • outlineRadius

      public int outlineRadius
      thickness for sprite outline
    • outlines

      public boolean outlines
      if false, no sprite outlines are generated
    • itemCapacity

      public int itemCapacity
      amount of items this unit can carry; <0 to determine based on hitSize.
    • ammoCapacity

      public int ammoCapacity
      amount of ammo this unit can hold (if the rule is enabled); <0 to determine based on weapon fire rate.
    • ammoType

      public AmmoType ammoType
      ammo this unit uses, if that system is enabled.
    • mineTier

      public int mineTier
      max hardness of ore that this unit can mine (<0 to disable)
    • mineSpeed

      public float mineSpeed
      mining speed in weird arbitrary units
    • mineWalls

      public boolean mineWalls
      whether this unit can mine ores from floors/walls, respectively
    • mineFloor

      public boolean mineFloor
      whether this unit can mine ores from floors/walls, respectively
    • mineHardnessScaling

      public boolean mineHardnessScaling
      if true, harder materials will take longer to mine
    • mineSound

      public arc.audio.Sound mineSound
      continuous sound emitted when mining.
    • mineSoundVolume

      public float mineSoundVolume
      volume of mining sound.
    • mineItems

      public arc.struct.Seq<Item> mineItems
      Target items to mine. Used in MinerAI
    • legCount

      public int legCount
      number of legs this unit has (must have the correct type to function!)
    • legGroupSize

      public int legGroupSize
      size of groups in which legs move. for example, insects (6 legs) usually move legs in groups of 3.
    • legLength

      public float legLength
      total length of a leg (both segments)
    • legSpeed

      public float legSpeed
      total length of a leg (both segments)
    • legForwardScl

      public float legForwardScl
      total length of a leg (both segments)
    • legBaseOffset

      public float legBaseOffset
      total length of a leg (both segments)
    • legMoveSpace

      public float legMoveSpace
      total length of a leg (both segments)
    • legExtension

      public float legExtension
      total length of a leg (both segments)
    • legPairOffset

      public float legPairOffset
      total length of a leg (both segments)
    • legLengthScl

      public float legLengthScl
      total length of a leg (both segments)
    • legStraightLength

      public float legStraightLength
      total length of a leg (both segments)
    • legMaxLength

      public float legMaxLength
      total length of a leg (both segments)
    • legMinLength

      public float legMinLength
      total length of a leg (both segments)
    • legSplashDamage

      public float legSplashDamage
      total length of a leg (both segments)
    • legSplashRange

      public float legSplashRange
      total length of a leg (both segments)
    • baseLegStraightness

      public float baseLegStraightness
      total length of a leg (both segments)
    • legStraightness

      public float legStraightness
      total length of a leg (both segments)
    • legBaseUnder

      public boolean legBaseUnder
      If true, the base (further away) leg region is drawn under instead of over.
    • lockLegBase

      public boolean lockLegBase
      If true, legs are locked to the base of the unit instead of being on an implicit rotating "mount".
    • legContinuousMove

      public boolean legContinuousMove
      If true, legs always try to move around even when the unit is not moving (leads to more natural behavior)
    • flipBackLegs

      public boolean flipBackLegs
      TODO neither of these appear to do much
    • flipLegSide

      public boolean flipLegSide
      TODO neither of these appear to do much
    • emitWalkSound

      public boolean emitWalkSound
      Whether to emit a splashing noise in water.
    • emitWalkEffect

      public boolean emitWalkEffect
      Whether to emit a splashing effect in water (fasle implies emitWalkSound false).
    • mechLandShake

      public float mechLandShake
      screen shake amount for when this mech lands after boosting
    • mechSideSway

      public float mechSideSway
      parameters for mech swaying animation
    • mechFrontSway

      public float mechFrontSway
      parameters for mech swaying animation
    • mechStride

      public float mechStride
      parameters for mech swaying animation
    • mechStepParticles

      public boolean mechStepParticles
      whether particles are created when this mech takes a step
    • mechLegColor

      public arc.graphics.Color mechLegColor
      color that legs change to when moving, to simulate depth
    • treadRects

      public arc.math.geom.Rect[] treadRects
      list of treads as rectangles in IMAGE COORDINATES, relative to the center. these are mirrored.
    • treadFrames

      public int treadFrames
      number of frames of movement in a tread
    • treadPullOffset

      public int treadPullOffset
      how much of a top part of a tread sprite is "cut off" relative to the pattern; this is corrected for
    • segments

      public int segments
      number of independent segments
    • segmentUnits

      public int segmentUnits
      TODO wave support - for multi-unit segmented units, this is the number of independent units that are spawned
    • segmentUnit

      @Nullable public UnitType segmentUnit
      unit spawned in segments; if null, the same unit is used
    • segmentEndUnit

      @Nullable public UnitType segmentEndUnit
      unit spawned at the end; if null, the segment unit is used
    • segmentLayerOrder

      public boolean segmentLayerOrder
      true - parent segments are on higher layers; false - parent segments are on lower layers than head
    • segmentMag

      public float segmentMag
      magnitude of sine offset between segments
    • segmentScl

      public float segmentScl
      magnitude of sine offset between segments
    • segmentPhase

      public float segmentPhase
      magnitude of sine offset between segments
    • segmentRotSpeed

      public float segmentRotSpeed
      magnitude of sine offset between segments
    • segmentMaxRot

      public float segmentMaxRot
      magnitude of sine offset between segments
    • segmentSpacing

      public float segmentSpacing
      magnitude of sine offset between segments
    • segmentRotationRange

      public float segmentRotationRange
      magnitude of sine offset between segments
    • crawlSlowdown

      public float crawlSlowdown
      magnitude of sine offset between segments
    • crushDamage

      public float crushDamage
      magnitude of sine offset between segments
    • crawlSlowdownFrac

      public float crawlSlowdownFrac
      magnitude of sine offset between segments
    • lifetime

      public float lifetime
      lifetime of this missile.
    • homingDelay

      public float homingDelay
      ticks that must pass before this missile starts homing.
    • baseRegion

      public arc.graphics.g2d.TextureRegion baseRegion
    • legRegion

      public arc.graphics.g2d.TextureRegion legRegion
    • region

      public arc.graphics.g2d.TextureRegion region
    • previewRegion

      public arc.graphics.g2d.TextureRegion previewRegion
    • shadowRegion

      public arc.graphics.g2d.TextureRegion shadowRegion
    • cellRegion

      public arc.graphics.g2d.TextureRegion cellRegion
    • itemCircleRegion

      public arc.graphics.g2d.TextureRegion itemCircleRegion
    • softShadowRegion

      public arc.graphics.g2d.TextureRegion softShadowRegion
    • jointRegion

      public arc.graphics.g2d.TextureRegion jointRegion
    • footRegion

      public arc.graphics.g2d.TextureRegion footRegion
    • legBaseRegion

      public arc.graphics.g2d.TextureRegion legBaseRegion
    • baseJointRegion

      public arc.graphics.g2d.TextureRegion baseJointRegion
    • outlineRegion

      public arc.graphics.g2d.TextureRegion outlineRegion
    • treadRegion

      public arc.graphics.g2d.TextureRegion treadRegion
    • mineLaserRegion

      public arc.graphics.g2d.TextureRegion mineLaserRegion
    • mineLaserEndRegion

      public arc.graphics.g2d.TextureRegion mineLaserEndRegion
    • wreckRegions

      public arc.graphics.g2d.TextureRegion[] wreckRegions
    • segmentRegions

      public arc.graphics.g2d.TextureRegion[] segmentRegions
    • segmentCellRegions

      public arc.graphics.g2d.TextureRegion[] segmentCellRegions
    • segmentOutlineRegions

      public arc.graphics.g2d.TextureRegion[] segmentOutlineRegions
    • treadRegions

      public arc.graphics.g2d.TextureRegion[][] treadRegions
    • buildTime

      protected float buildTime
    • totalRequirements

      @Nullable protected ItemStack[] totalRequirements
    • cachedRequirements

      @Nullable protected ItemStack[] cachedRequirements
    • firstRequirements

      @Nullable protected ItemStack[] firstRequirements
  • Constructor Details

    • UnitType

      public UnitType(String name)
  • Method Details

    • createController

      public UnitController createController(mindustry.gen.Unit unit)
    • create

      public mindustry.gen.Unit create(Team team)
    • spawn

      public mindustry.gen.Unit spawn(Team team, float x, float y, float rotation, @Nullable arc.func.Cons<mindustry.gen.Unit> cons)
      Parameters:
      cons - Callback that gets called with every unit that is spawned. This is used for multi-unit segmented units.
    • spawn

      public mindustry.gen.Unit spawn(Team team, float x, float y, float rotation)
    • spawn

      public mindustry.gen.Unit spawn(Team team, float x, float y)
    • spawn

      public mindustry.gen.Unit spawn(float x, float y)
    • spawn

      public mindustry.gen.Unit spawn(Team team, arc.math.geom.Position pos)
    • spawn

      public mindustry.gen.Unit spawn(arc.math.geom.Position pos)
    • spawn

      public mindustry.gen.Unit spawn(arc.math.geom.Position pos, Team team)
    • hasWeapons

      public boolean hasWeapons()
    • targetable

      public boolean targetable(mindustry.gen.Unit unit, Team targeter)
    • hittable

      public boolean hittable(mindustry.gen.Unit unit)
    • update

      public void update(mindustry.gen.Unit unit)
    • updatePayload

      public void updatePayload(mindustry.gen.Unit unit, @Nullable mindustry.gen.Unit unitHolder, @Nullable mindustry.gen.Building buildingHolder)
    • killed

      public void killed(mindustry.gen.Unit unit)
    • landed

      public void landed(mindustry.gen.Unit unit)
    • display

      public void display(mindustry.gen.Unit unit, arc.scene.ui.layout.Table table)
    • supportsEnv

      public boolean supportsEnv(int env)
      Returns:
      whether this block supports a specific environment.
    • isBanned

      public boolean isBanned()
    • getDependencies

      public void getDependencies(arc.func.Cons<UnlockableContent> cons)
      Description copied from class: UnlockableContent
      Iterates through any implicit dependencies of this content. For blocks, this would be the items required to build it.
      Overrides:
      getDependencies in class UnlockableContent
    • isHidden

      public boolean isHidden()
      Description copied from class: UnlockableContent
      Whether this content is always hidden in the content database dialog.
      Overrides:
      isHidden in class UnlockableContent
    • setStats

      public void setStats()
      Description copied from class: UnlockableContent
      Initializes stats on demand. Should only be called once. Only called before something is displayed.
      Overrides:
      setStats in class UnlockableContent
    • validateWeapons

      protected void validateWeapons()
    • checkEntityMapping

      protected void checkEntityMapping(mindustry.gen.Unit example)
    • init

      public void init()
      Description copied from class: Content
      Called after all content and modules are created. Do not use to load regions or texture data!
      Overrides:
      init in class Content
    • estimateDps

      public float estimateDps()
    • load

      public void load()
      Description copied from class: Content
      Called after all content is created, only on non-headless versions. Use for loading regions or other image data.
      Overrides:
      load in class Content
    • getRegionsToOutline

      public void getRegionsToOutline(arc.struct.Seq<arc.graphics.g2d.TextureRegion> out)
    • needsBodyOutline

      public boolean needsBodyOutline()
    • createIcons

      public void createIcons(MultiPacker packer)
      Description copied from class: UnlockableContent
      Generate any special icons for this content. Called synchronously. No regions are loaded at this point; grab pixmaps from the packer.
      Overrides:
      createIcons in class UnlockableContent
    • getBuildTime

      public float getBuildTime()
      Returns:
      the time required to build this unit, as a value that takes into account reconstructors
    • getTotalRequirements

      public ItemStack[] getTotalRequirements()
      Returns:
      all items needed to build this unit, including reconstructor steps.
    • getRequirements

      @Nullable public ItemStack[] getRequirements(@Nullable UnitType[] prevReturn, @Nullable float[] timeReturn)
      Returns:
      item requirements based on reconstructors or factories found; returns previous unit in array if provided
    • getFirstRequirements

      @Nullable public ItemStack[] getFirstRequirements()
    • researchRequirements

      public ItemStack[] researchRequirements()
      Overrides:
      researchRequirements in class UnlockableContent
      Returns:
      items needed to research this content
    • sense

      public double sense(LAccess sensor)
      Specified by:
      sense in interface Senseable
    • senseObject

      public Object senseObject(LAccess sensor)
      Specified by:
      senseObject in interface Senseable
    • getContentType

      public ContentType getContentType()
      Description copied from class: Content
      Returns the type name of this piece of content. This should return the same value for all instances of this content type.
      Specified by:
      getContentType in class Content
    • setEnginesMirror

      public void setEnginesMirror(UnitType.UnitEngine... array)
      Sets up engines, mirroring the contents of the specified array.
    • draw

      public void draw(mindustry.gen.Unit unit)
    • shieldColor

      public arc.graphics.Color shieldColor(mindustry.gen.Unit unit)
    • drawMining

      public void drawMining(mindustry.gen.Unit unit)
    • drawMiningBeam

      public void drawMiningBeam(mindustry.gen.Unit unit, float px, float py)
    • drawPayload

      public <T extends mindustry.gen.Unit & mindustry.gen.Payloadc> void drawPayload(T unit)
    • drawShield

      public void drawShield(mindustry.gen.Unit unit)
    • drawShadow

      public void drawShadow(mindustry.gen.Unit unit)
    • drawSoftShadow

      public void drawSoftShadow(mindustry.gen.Unit unit)
    • drawSoftShadow

      public void drawSoftShadow(mindustry.gen.Unit unit, float alpha)
    • drawSoftShadow

      public void drawSoftShadow(float x, float y, float rotation, float alpha)
    • drawItems

      public void drawItems(mindustry.gen.Unit unit)
    • drawTrail

      public void drawTrail(mindustry.gen.Unit unit)
    • drawEngines

      public void drawEngines(mindustry.gen.Unit unit)
    • drawWeapons

      public void drawWeapons(mindustry.gen.Unit unit)
    • drawWeaponOutlines

      public void drawWeaponOutlines(mindustry.gen.Unit unit)
    • drawOutline

      public void drawOutline(mindustry.gen.Unit unit)
    • drawBody

      public void drawBody(mindustry.gen.Unit unit)
    • drawCell

      public void drawCell(mindustry.gen.Unit unit)
    • cellColor

      public arc.graphics.Color cellColor(mindustry.gen.Unit unit)
    • drawLight

      public void drawLight(mindustry.gen.Unit unit)
    • drawTank

      public <T extends mindustry.gen.Unit & mindustry.gen.Tankc> void drawTank(T unit)
    • drawLegs

      public <T extends mindustry.gen.Unit & mindustry.gen.Legsc> void drawLegs(T unit)
    • drawCrawl

      public void drawCrawl(mindustry.gen.Crawlc crawl)
    • drawMech

      public void drawMech(mindustry.gen.Mechc mech)
    • applyOutlineColor

      public void applyOutlineColor(mindustry.gen.Unit unit)
    • applyColor

      public void applyColor(mindustry.gen.Unit unit)