Interface RubbleClearer

All Known Implementing Classes:
BipedMek, GunEmplacement, LandAirMek, LargeSupportTank, Mek, MekWithArms, QuadMek, QuadVee, SuperHeavyTank, SupportTank, SupportVTOL, Tank, TripodMek, VTOL

public interface RubbleClearer
Shared multi-turn rubble-clearing state for units that can clear a rubble hex with a bulldozer or backhoe (TacOps). The unit must remain in the target hex for the required number of turns; the work is banked one turn at a time and the hex opens up once it is done.

An implementor supplies the small amount of per-unit state - the target hex and the completed/required turn counts - and inherits the state transitions as default methods. Both Tank and Mek implement this (a Mek clears only with a backhoe, since the bulldozer is vehicle-only equipment), so the machine lives in one place rather than being duplicated.

  • Method Details

    • getRubbleClearTarget

      @Nullable Coords getRubbleClearTarget()
      Returns:
      the rubble hex this unit is clearing, or null if it is not clearing rubble
    • setRubbleClearTarget

      void setRubbleClearTarget(@Nullable Coords target)
      Parameters:
      target - the rubble hex being cleared, or null to stop clearing
    • getRubbleClearTurnsCompleted

      int getRubbleClearTurnsCompleted()
      Returns:
      the number of turns of clearing banked so far
    • setRubbleClearTurnsCompleted

      void setRubbleClearTurnsCompleted(int turns)
      Parameters:
      turns - the number of turns of clearing banked so far
    • getRubbleClearTurnsRequired

      int getRubbleClearTurnsRequired()
      Returns:
      the total number of turns this rubble hex needs to be cleared
    • setRubbleClearTurnsRequired

      void setRubbleClearTurnsRequired(int turns)
      Parameters:
      turns - the total number of turns the clearing takes
    • beginClearingRubble

      default void beginClearingRubble(Coords target, int requiredTurns)
      Begins clearing a rubble hex (TacOps). The unit must remain in target for requiredTurns turns; this replaces any in-progress effort on a different hex.
      Parameters:
      target - the rubble hex being cleared (the unit's own hex)
      requiredTurns - the number of full turns the clearing takes (2/4/8/16 by structure type, capped at 16, plus any backhoe penalty)
    • isClearingRubble

      default boolean isClearingRubble()
      Returns:
      true if this unit is partway through clearing a rubble hex
    • bankRubbleClearTurn

      default int bankRubbleClearTurn()
      Banks one full turn of clearing.
      Returns:
      the number of turns of clearing completed so far (including this one)
    • cancelClearingRubble

      default void cancelClearingRubble()
      Clears the in-progress rubble-clearing state; call when the unit stops or finishes clearing.