Class Rules

java.lang.Object
mindustry.game.Rules

public class Rules extends Object
Defines current rules on how the game should function. Does not store game state, just configuration.
  • Field Details

    • infiniteResources

      public boolean infiniteResources
      Sandbox mode: Enables infinite resources, build range and build speed.
    • teams

      public Rules.TeamRules teams
      Team-specific rules.
    • waveTimer

      public boolean waveTimer
      Whether the waves come automatically on a timer. If not, waves come when the play button is pressed.
    • waveSending

      public boolean waveSending
      Whether the waves can be manually summoned with the play button.
    • waves

      public boolean waves
      Whether waves are spawnable at all.
    • pvp

      public boolean pvp
      Whether the game objective is PvP. Note that this enables automatic hosting.
    • pvpAutoPause

      public boolean pvpAutoPause
      Whether is waiting for players enabled in PvP.
    • waitEnemies

      public boolean waitEnemies
      Whether to pause the wave timer until all enemies are destroyed.
    • attackMode

      public boolean attackMode
      Determines if gamemode is attack mode.
    • editor

      public boolean editor
      Whether this is the editor gamemode.
    • canGameOver

      public boolean canGameOver
      Whether a gameover can happen at all. Set this to false to implement custom gameover conditions.
    • coreCapture

      public boolean coreCapture
      Whether cores change teams when they are destroyed.
    • reactorExplosions

      public boolean reactorExplosions
      Whether reactors can explode and damage other blocks.
    • possessionAllowed

      public boolean possessionAllowed
      Whether to allow manual unit control.
    • schematicsAllowed

      public boolean schematicsAllowed
      Whether schematics are allowed.
    • damageExplosions

      public boolean damageExplosions
      Whether friendly explosions can occur and set fire/damage other blocks.
    • fire

      public boolean fire
      Whether fire (and neoplasm spread) is enabled.
    • unitAmmo

      public boolean unitAmmo
      Whether units use and require ammo.
    • unitPayloadUpdate

      public boolean unitPayloadUpdate
      EXPERIMENTAL! If true, blocks will update in units and share power.
    • unitCapVariable

      public boolean unitCapVariable
      Whether cores add to unit limit
    • showSpawns

      public boolean showSpawns
      If true, unit spawn points are shown.
    • solarMultiplier

      public float solarMultiplier
      Multiplies power output of solar panels.
    • unitBuildSpeedMultiplier

      public float unitBuildSpeedMultiplier
      How fast unit factories build units.
    • unitCostMultiplier

      public float unitCostMultiplier
      Multiplier of resources that units take to build.
    • unitDamageMultiplier

      public float unitDamageMultiplier
      How much damage units deal.
    • unitHealthMultiplier

      public float unitHealthMultiplier
      How much health units start with.
    • unitCrashDamageMultiplier

      public float unitCrashDamageMultiplier
      How much damage unit crash damage deals. (Compounds with unitDamageMultiplier)
    • ghostBlocks

      public boolean ghostBlocks
      If true, ghost blocks will appear upon destruction, letting builder blocks/units rebuild them.
    • logicUnitBuild

      public boolean logicUnitBuild
      Whether to allow units to build with logic.
    • disableWorldProcessors

      public boolean disableWorldProcessors
      If true, world processors no longer update. Used for testing.
    • blockHealthMultiplier

      public float blockHealthMultiplier
      How much health blocks start with.
    • blockDamageMultiplier

      public float blockDamageMultiplier
      How much damage blocks (turrets) deal.
    • buildCostMultiplier

      public float buildCostMultiplier
      Multiplier for buildings resource cost.
    • buildSpeedMultiplier

      public float buildSpeedMultiplier
      Multiplier for building speed.
    • deconstructRefundMultiplier

      public float deconstructRefundMultiplier
      Multiplier for percentage of materials refunded when deconstructing.
    • enemyCoreBuildRadius

      public float enemyCoreBuildRadius
      No-build zone around enemy core radius.
    • polygonCoreProtection

      public boolean polygonCoreProtection
      If true, no-build zones are calculated based on the closest core.
    • placeRangeCheck

      public boolean placeRangeCheck
      If true, blocks cannot be placed near blocks that are near the enemy team.
    • cleanupDeadTeams

      public boolean cleanupDeadTeams
      If true, dead teams in PvP automatically have their blocks & units converted to derelict upon death.
    • onlyDepositCore

      public boolean onlyDepositCore
      If true, items can only be deposited in the core.
    • coreDestroyClear

      public boolean coreDestroyClear
      If true, every enemy block in the radius of the (enemy) core is destroyed upon death. Used for campaign maps.
    • hideBannedBlocks

      public boolean hideBannedBlocks
      If true, banned blocks are hidden from the build menu.
    • blockWhitelist

      public boolean blockWhitelist
      If true, bannedBlocks becomes a whitelist.
    • unitWhitelist

      public boolean unitWhitelist
      If true, bannedUnits becomes a whitelist.
    • dropZoneRadius

      public float dropZoneRadius
      Radius around enemy wave drop zones.
    • waveSpacing

      public float waveSpacing
      Time between waves in ticks.
    • initialWaveSpacing

      public float initialWaveSpacing
      Starting wave spacing; if <=0, uses waveSpacing * 2.
    • winWave

      public int winWave
      Wave after which the player 'wins'. Use a value <= 0 to disable.
    • unitCap

      public int unitCap
      Base unit cap. Can still be increased by blocks.
    • dragMultiplier

      public float dragMultiplier
      Environment drag multiplier.
    • env

      public int env
      Environmental flags that dictate visuals & how blocks function.
    • attributes

      public Attributes attributes
      Attributes of the environment.
    • sector

      @Nullable public Sector sector
      Sector for saves that have them.
    • spawns

      public Seq<SpawnGroup> spawns
      Spawn layout.
    • loadout

      public Seq<ItemStack> loadout
      Starting items put in cores.
    • weather

      public Seq<Weather.WeatherEntry> weather
      Weather events that occur here.
    • bannedBlocks

      public ObjectSet<Block> bannedBlocks
      Blocks that cannot be placed.
    • bannedUnits

      public ObjectSet<UnitType> bannedUnits
      Units that cannot be built.
    • revealedBlocks

      public ObjectSet<Block> revealedBlocks
      Reveals blocks normally hidden by build visibility.
    • researched

      public ObjectSet<String> researched
      Unlocked content names. Only used in multiplayer when the campaign is enabled.
    • hiddenBuildItems

      public ObjectSet<Item> hiddenBuildItems
      Block containing these items as requirements are hidden.
    • objectives

      public MapObjectives objectives
      In-map objective executor.
    • objectiveFlags

      public ObjectSet<String> objectiveFlags
      Flags set by objectives. Used in world processors.
    • fog

      public boolean fog
      If true, fog of war is enabled. Enemy units and buildings are hidden unless in radar view.
    • staticFog

      public boolean staticFog
      If fog = true, this is whether static (black) fog is enabled.
    • staticColor

      public Color staticColor
      Color for static, undiscovered fog of war areas.
    • dynamicColor

      public Color dynamicColor
      Color for discovered but un-monitored fog of war areas.
    • lighting

      public boolean lighting
      Whether ambient lighting is enabled.
    • ambientLight

      public Color ambientLight
      Ambient light color, used when lighting is enabled.
    • defaultTeam

      public Team defaultTeam
      team of the player by default.
    • waveTeam

      public Team waveTeam
      team of the enemy in waves/sectors.
    • cloudColor

      public Color cloudColor
      color of clouds that is displayed when the player is landing
    • modeName

      @Nullable public String modeName
      name of the custom mode that this ruleset describes, or null.
    • mission

      @Nullable public String mission
      Mission string displayed instead of wave/core counter. Null to disable.
    • coreIncinerates

      public boolean coreIncinerates
      Whether cores incinerate items when full, just like in the campaign.
    • borderDarkness

      public boolean borderDarkness
      If false, borders fade out into darkness. Only use with custom backgrounds!
    • limitMapArea

      public boolean limitMapArea
      If true, the map play area is cropped based on the rectangle below.
    • limitX

      public int limitX
      Map area limit rectangle.
    • limitY

      public int limitY
      Map area limit rectangle.
    • limitWidth

      public int limitWidth
      Map area limit rectangle.
    • limitHeight

      public int limitHeight
      Map area limit rectangle.
    • disableOutsideArea

      public boolean disableOutsideArea
      If true, blocks outside the map area are disabled.
    • tags

      public StringMap tags
      special tags for additional info.
    • customBackgroundCallback

      @Nullable public String customBackgroundCallback
      Name of callback to call for background rendering in mods; see Renderer#addCustomBackground. Runs last.
    • backgroundTexture

      @Nullable public String backgroundTexture
      path to background texture with extension (e.g. "sprites/space.png")
    • backgroundSpeed

      public float backgroundSpeed
      background texture move speed scaling - bigger numbers mean slower movement. 0 to disable.
    • backgroundScl

      public float backgroundScl
      background texture scaling factor
    • backgroundOffsetX

      public float backgroundOffsetX
      background UV offsets
    • backgroundOffsetY

      public float backgroundOffsetY
      background UV offsets
    • planetBackground

      @Nullable public PlanetParams planetBackground
      Parameters for planet rendered in the background. Cannot be changed once a map is loaded.
    • planet

      public Planet planet
      Rules from this planet are applied. If it's sun, mixed tech is enabled.
  • Constructor Details

    • Rules

      public Rules()
  • Method Details

    • copy

      public Rules copy()
      Copies this ruleset exactly. Not efficient at all, do not use often.
    • mode

      public Gamemode mode()
      Returns the gamemode that best fits these rules.
    • hasEnv

      public boolean hasEnv(int env)
    • unitBuildSpeed

      public float unitBuildSpeed(Team team)
    • unitCost

      public float unitCost(Team team)
    • unitDamage

      public float unitDamage(Team team)
    • unitHealth

      public float unitHealth(Team team)
    • unitCrashDamage

      public float unitCrashDamage(Team team)
    • blockHealth

      public float blockHealth(Team team)
    • blockDamage

      public float blockDamage(Team team)
    • buildSpeed

      public float buildSpeed(Team team)
    • isBanned

      public boolean isBanned(Block block)
    • isBanned

      public boolean isBanned(UnitType unit)