Class GameState

java.lang.Object
mindustry.core.GameState

public class GameState extends Object
  • Field Details

    • wave

      public int wave
      Current wave number, can be anything in non-wave modes.
    • wavetime

      public float wavetime
      Wave countdown in ticks.
    • tick

      public double tick
      Logic tick.
    • updateId

      public long updateId
      Continuously ticks up every non-paused update.
    • gameOver

      public boolean gameOver
      Whether the game is in game over state.
    • won

      public boolean won
      Whether the player's team won the match.
    • serverTps

      public int serverTps
      Server ticks/second. Only valid in multiplayer.
    • map

      public Map map
      Map that is currently being played on.
    • rules

      public Rules rules
      The current game rules.
    • stats

      public GameStats stats
      Statistics for this save/game. Displayed after game over.
    • envAttrs

      public Attributes envAttrs
      Global attributes of the environment, calculated by weather.
    • teams

      public Teams teams
      Team data. Gets reset every new game.
    • enemies

      public int enemies
      Number of enemies in the game; only used clientside in servers.
    • playtestingMap

      @Nullable public Map playtestingMap
      Map being playtested (not edited!)
  • Constructor Details

    • GameState

      public GameState()
  • Method Details

    • boss

      @Nullable public mindustry.gen.Unit boss()
    • set

      public void set(GameState.State astate)
    • hasSpawns

      public boolean hasSpawns()
    • isCampaign

      public boolean isCampaign()
      Note that being in a campaign does not necessarily mean having a sector.
    • hasSector

      public boolean hasSector()
    • getSector

      @Nullable public Sector getSector()
    • getPlanet

      @Nullable public Planet getPlanet()
    • isEditor

      public boolean isEditor()
    • isPaused

      public boolean isPaused()
    • isPlaying

      public boolean isPlaying()
    • isGame

      public boolean isGame()
      Returns:
      whether the current state is *not* the menu.
    • isMenu

      public boolean isMenu()
    • is

      public boolean is(GameState.State astate)
    • getState

      public GameState.State getState()