Class GlobalVars

java.lang.Object
mindustry.logic.GlobalVars

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

    • ctrlProcessor

      public static final int ctrlProcessor
      See Also:
    • ctrlPlayer

      public static final int ctrlPlayer
      See Also:
    • ctrlCommand

      public static final int ctrlCommand
      See Also:
    • lookableContent

      public static final ContentType[] lookableContent
    • writableLookableContent

      public static final ContentType[] writableLookableContent
    • rand

      public static final arc.math.Rand rand
      Global random state.
    • soundNames

      public static final arc.struct.Seq<String> soundNames
  • Constructor Details

    • GlobalVars

      public GlobalVars()
  • Method Details

    • init

      public void init()
    • update

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

      public LVar waitVar()
    • getEntries

      public arc.struct.Seq<GlobalVars.VarEntry> getEntries()
    • lookupContent

      @Nullable public Object lookupContent(ContentType type, int id)
      Returns:
      a piece of content based on its logic ID. This is not equivalent to content ID. In the case of teams, the return value may not be Content.
    • lookupLogicId

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

      public LVar get(String name)
      Returns:
      a constant variable if there is a constant with this name, otherwise null. Attempt to get privileged variable from non-privileged logic executor returns null constant.
    • get

      public LVar get(String name, boolean privileged)
      Returns:
      a constant variable by name Attempt to get privileged variable from non-privileged logic executor returns null constant.
    • set

      public void set(String name, double value)
      Sets a global variable by name.
    • put

      public LVar put(String name, Object value, boolean privileged)
      Adds a constant value by name.
    • put

      public LVar put(String name, Object value, boolean privileged, boolean hidden)
      Adds a constant value by name.
    • put

      public LVar put(String name, Object value)
    • putEntry

      public LVar putEntry(String name, Object value)
    • putEntry

      public LVar putEntry(String name, Object value, boolean privileged)
    • putEntryOnly

      public void putEntryOnly(String name)