Class GlobalVars

java.lang.Object
mindustry.logic.GlobalVars

public class GlobalVars extends Object
Stores global logic variables for logic processors.
  • Field Details

  • Constructor Details

    • GlobalVars

      public GlobalVars()
  • Method Details

    • init

      public void init()
    • update

      public void update()
      Updates global time and other state variables.
    • lookupContent

      @Nullable public Content lookupContent(ContentType type, int id)
      Returns:
      a piece of content based on its logic ID. This is not equivalent to content ID.
    • lookupLogicId

      public int lookupLogicId(UnlockableContent content)
      Returns:
      the integer logic ID of content, or -1 if invalid.
    • get

      public int get(String name)
      Returns:
      a constant ID > 0 if there is a constant with this name, otherwise -1.
    • get

      public LExecutor.Var get(int id)
      Returns:
      a constant variable by ID. ID is not bound checked and must be positive.
    • set

      public void set(int id, double value)
      Sets a global variable by an ID returned from put().
    • put

      public int put(String name, Object value)
      Adds a constant value by name.