Package mindustry.game
Class Rules
java.lang.Object
mindustry.game.Rules
Defines current rules on how the game should function.
Does not store game state, just configuration.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA team-specific ruleset.static classA simple map for storing TeamRules in an efficient way without hashing. -
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanWhether air units spawn at spawns instead of the edge of the mapbooleanAllows editing the rules in-game.booleanIf true, world processors can be edited and placed on this map.booleanIf true, most blocks (including environmental walls) can be deconstructed.booleanIf the `data` instruction is allowed for world processorsarc.graphics.ColorAmbient light color, used when lighting is enabled.booleanDetermines if gamemode is attack mode.Attributes of the environment.floatbackground UV offsetsfloatbackground UV offsetsfloatbackground texture scaling factorfloatbackground texture move speed scaling - bigger numbers mean slower movement.path to background texture with extension (e.g.arc.struct.ObjectSet<Block>Blocks that cannot be placed.arc.struct.ObjectSet<UnitType>Units that cannot be built.floatHow much damage blocks (turrets) deal.floatHow much health blocks start with.booleanIf true, bannedBlocks becomes a whitelist.booleanIf false, borders fade out into darkness.floatMultiplier for buildings resource cost.floatMultiplier for building speed.booleanWhether a gameover can happen at all.booleanIf true, dead teams in PvP automatically have their blocks & units converted to derelict upon death.arc.graphics.Colorcolor of clouds that is displayed when the player is landingbooleanWhether cores change teams when they are destroyed.booleanIf true, every enemy block in the radius of the (enemy) core is destroyed upon death.booleanWhether cores incinerate items when full, just like in the campaign.Name of callback to call for background rendering in mods; see Renderer#addCustomBackground.booleanWhether friendly explosions can occur and set fire/damage other blocks.floatMultiplier for percentage of materials refunded when deconstructing.team of the player by default.booleanWhether blocks can be repaired by clicking them.booleanIf true, blocks outside the map area are disabled.booleanIf true, the unit cap is disabled.booleanIf true, world processors no longer update.floatEnvironment drag multiplier.floatRadius around enemy wave drop zones.arc.graphics.ColorColor for discovered but un-monitored fog of war areas.booleanWhether this is the editor gamemode.floatNo-build zone around enemy core radius.intEnvironmental flags that dictate visuals & how blocks function.booleanWhether fire (and neoplasm spread) is enabled.booleanIf true, fog of war is enabled.booleanIf true, ghost blocks will appear upon destruction, letting builder blocks/units rebuild them.booleanIf true, banned blocks are hidden from the build menu.booleanSandbox mode: Enables infinite resources, build range and build speed.floatStarting wave spacing; if <=0, uses waveSpacing * 2.booleanIf true, buildings will be constructed instantly, with no limit on blocks placed per second.floatCooldown, in seconds, of item depositing for players.booleanWhether ambient lighting is enabled.intMap area limit rectangle.booleanIf true, the map play area is cropped based on the rectangle below.intMap area limit rectangle.intMap area limit rectangle.intMap area limit rectangle.arc.struct.Seq<ItemStack>Starting items put in cores.booleanWhether to allow units to build with logic.Mission string displayed instead of wave/core counter.name of the custom mode that this ruleset describes, or null.arc.struct.ObjectSet<String>Flags set by objectives.In-map objective executor.floatMultiplier for time in timer objectives.booleanIf true, items can only be deposited in the core.booleanIf true, blocks cannot be placed near blocks that are near the enemy team.Rules from this planet are applied.Parameters for planet rendered in the background.booleanIf true, no-build zones are calculated based on the closest core.booleanWhether to allow manual unit control.booleanWhether the game objective is PvP.booleanWhether is waiting for players enabled in PvP.booleanEXPERIMENTAL! If true, air and ground units target random things each wave instead of only the core/generators.booleanWhether reactors can explode and damage other blocks.arc.struct.ObjectSet<UnlockableContent>Unlocked content names.arc.struct.ObjectSet<Block>Reveals blocks normally hidden by build visibility.booleanWhether schematics are allowed.Sector for saves that have them.booleanIf true, unit spawn points are shown.floatMultiplies power output of solar panels.arc.struct.Seq<SpawnGroup>Spawn layout.arc.graphics.ColorColor for static, undiscovered fog of war areas.booleanIf fog = true, this is whether static (black) fog is enabled.arc.struct.StringMapspecial tags for additional info.Team-specific rules.booleanWhether units use and require ammo.floatHow fast unit factories build units.intBase unit cap.booleanWhether cores add to unit limitfloatMultiplier of resources that units take to build.floatHow much damage unit crash damage deals.floatHow much damage units deal.floatHow much health units start with.floatHow fast units can mine.booleanIf true, units' payloads are destroy()ed when the unit is destroyed.booleanEXPERIMENTAL! If true, blocks will update in units and share power.booleanIf true, bannedUnits becomes a whitelist.booleanWhether to pause the wave timer until all enemies are destroyed.booleanWhether waves are spawnable at all.booleanWhether the waves can be manually summoned with the play button.floatTime between waves in ticks.booleanIf true, units spawn at enemy cores in attack maps with waves enabled.team of the enemy in waves/sectors.booleanWhether the waves come automatically on a timer.arc.struct.Seq<Weather.WeatherEntry>Weather events that occur here.intWave after which the player 'wins'. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloatblockDamage(Team team) floatblockHealth(Team team) floatbuildRadius(Team team) floatbuildSpeed(Team team) copy()Copies this ruleset exactly.booleanhasEnv(int env) booleanbooleanmode()Returns the gamemode that best fits these rules.floatunitBuildSpeed(Team team) floatfloatunitCrashDamage(Team team) floatunitDamage(Team team) floatunitHealth(Team team) floatunitMineSpeed(Team team)
-
Field Details
-
allowEditRules
public boolean allowEditRulesAllows editing the rules in-game. Essentially a cheat mode toggle. -
infiniteResources
public boolean infiniteResourcesSandbox mode: Enables infinite resources, build range and build speed. -
teams
Team-specific rules. -
waveTimer
public boolean waveTimerWhether the waves come automatically on a timer. If not, waves come when the play button is pressed. -
waveSending
public boolean waveSendingWhether the waves can be manually summoned with the play button. -
waves
public boolean wavesWhether waves are spawnable at all. -
airUseSpawns
public boolean airUseSpawnsWhether air units spawn at spawns instead of the edge of the map -
wavesSpawnAtCores
public boolean wavesSpawnAtCoresIf true, units spawn at enemy cores in attack maps with waves enabled. -
pvp
public boolean pvpWhether the game objective is PvP. Note that this enables automatic hosting. -
pvpAutoPause
public boolean pvpAutoPauseWhether is waiting for players enabled in PvP. -
waitEnemies
public boolean waitEnemiesWhether to pause the wave timer until all enemies are destroyed. -
attackMode
public boolean attackModeDetermines if gamemode is attack mode. -
editor
public boolean editorWhether this is the editor gamemode. -
derelictRepair
public boolean derelictRepairWhether blocks can be repaired by clicking them. -
canGameOver
public boolean canGameOverWhether a gameover can happen at all. Set this to false to implement custom gameover conditions. -
coreCapture
public boolean coreCaptureWhether cores change teams when they are destroyed. -
reactorExplosions
public boolean reactorExplosionsWhether reactors can explode and damage other blocks. -
possessionAllowed
public boolean possessionAllowedWhether to allow manual unit control. -
schematicsAllowed
public boolean schematicsAllowedWhether schematics are allowed. -
damageExplosions
public boolean damageExplosionsWhether friendly explosions can occur and set fire/damage other blocks. -
fire
public boolean fireWhether fire (and neoplasm spread) is enabled. -
unitAmmo
public boolean unitAmmoWhether units use and require ammo. -
randomWaveAI
public boolean randomWaveAIEXPERIMENTAL! If true, air and ground units target random things each wave instead of only the core/generators. -
unitPayloadUpdate
public boolean unitPayloadUpdateEXPERIMENTAL! If true, blocks will update in units and share power. -
unitPayloadsExplode
public boolean unitPayloadsExplodeIf true, units' payloads are destroy()ed when the unit is destroyed. -
unitCapVariable
public boolean unitCapVariableWhether cores add to unit limit -
showSpawns
public boolean showSpawnsIf true, unit spawn points are shown. -
solarMultiplier
public float solarMultiplierMultiplies power output of solar panels. -
unitBuildSpeedMultiplier
public float unitBuildSpeedMultiplierHow fast unit factories build units. -
unitCostMultiplier
public float unitCostMultiplierMultiplier of resources that units take to build. -
unitDamageMultiplier
public float unitDamageMultiplierHow much damage units deal. -
unitHealthMultiplier
public float unitHealthMultiplierHow much health units start with. -
unitCrashDamageMultiplier
public float unitCrashDamageMultiplierHow much damage unit crash damage deals. (Compounds with unitDamageMultiplier) -
unitMineSpeedMultiplier
public float unitMineSpeedMultiplierHow fast units can mine. -
ghostBlocks
public boolean ghostBlocksIf true, ghost blocks will appear upon destruction, letting builder blocks/units rebuild them. -
logicUnitBuild
public boolean logicUnitBuildWhether to allow units to build with logic. -
allowEditWorldProcessors
public boolean allowEditWorldProcessorsIf true, world processors can be edited and placed on this map. -
disableWorldProcessors
public boolean disableWorldProcessorsIf true, world processors no longer update. Used for testing. -
blockHealthMultiplier
public float blockHealthMultiplierHow much health blocks start with. -
blockDamageMultiplier
public float blockDamageMultiplierHow much damage blocks (turrets) deal. -
buildCostMultiplier
public float buildCostMultiplierMultiplier for buildings resource cost. -
buildSpeedMultiplier
public float buildSpeedMultiplierMultiplier for building speed. -
deconstructRefundMultiplier
public float deconstructRefundMultiplierMultiplier for percentage of materials refunded when deconstructing. -
objectiveTimerMultiplier
public float objectiveTimerMultiplierMultiplier for time in timer objectives. -
enemyCoreBuildRadius
public float enemyCoreBuildRadiusNo-build zone around enemy core radius. -
polygonCoreProtection
public boolean polygonCoreProtectionIf true, no-build zones are calculated based on the closest core. -
placeRangeCheck
public boolean placeRangeCheckIf true, blocks cannot be placed near blocks that are near the enemy team. -
cleanupDeadTeams
public boolean cleanupDeadTeamsIf true, dead teams in PvP automatically have their blocks & units converted to derelict upon death. -
onlyDepositCore
public boolean onlyDepositCoreIf true, items can only be deposited in the core. -
itemDepositCooldown
public float itemDepositCooldownCooldown, in seconds, of item depositing for players. -
coreDestroyClear
public boolean coreDestroyClearIf true, every enemy block in the radius of the (enemy) core is destroyed upon death. Used for campaign maps. -
hideBannedBlocks
public boolean hideBannedBlocksIf true, banned blocks are hidden from the build menu. -
allowEnvironmentDeconstruct
public boolean allowEnvironmentDeconstructIf true, most blocks (including environmental walls) can be deconstructed. This is only meant to be used internally in sandbox/test maps. -
instantBuild
public boolean instantBuildIf true, buildings will be constructed instantly, with no limit on blocks placed per second. This is highly experimental and may cause lag! -
blockWhitelist
public boolean blockWhitelistIf true, bannedBlocks becomes a whitelist. -
unitWhitelist
public boolean unitWhitelistIf true, bannedUnits becomes a whitelist. -
dropZoneRadius
public float dropZoneRadiusRadius around enemy wave drop zones. -
waveSpacing
public float waveSpacingTime between waves in ticks. -
initialWaveSpacing
public float initialWaveSpacingStarting wave spacing; if <=0, uses waveSpacing * 2. -
winWave
public int winWaveWave after which the player 'wins'. Use a value <= 0 to disable. -
unitCap
public int unitCapBase unit cap. Can still be increased by blocks. -
disableUnitCap
public boolean disableUnitCapIf true, the unit cap is disabled. -
dragMultiplier
public float dragMultiplierEnvironment drag multiplier. -
env
public int envEnvironmental flags that dictate visuals & how blocks function. -
attributes
Attributes of the environment. -
sector
Sector for saves that have them. -
spawns
Spawn layout. -
loadout
Starting items put in cores. -
weather
Weather events that occur here. -
bannedBlocks
Blocks that cannot be placed. -
bannedUnits
Units that cannot be built. -
revealedBlocks
Reveals blocks normally hidden by build visibility. -
researched
Unlocked content names. Only used in multiplayer when the campaign is enabled. -
objectives
In-map objective executor. -
objectiveFlags
Flags set by objectives. Used in world processors. -
fog
public boolean fogIf true, fog of war is enabled. Enemy units and buildings are hidden unless in radar view. -
staticFog
public boolean staticFogIf fog = true, this is whether static (black) fog is enabled. -
staticColor
public arc.graphics.Color staticColorColor for static, undiscovered fog of war areas. -
dynamicColor
public arc.graphics.Color dynamicColorColor for discovered but un-monitored fog of war areas. -
lighting
public boolean lightingWhether ambient lighting is enabled. -
ambientLight
public arc.graphics.Color ambientLightAmbient light color, used when lighting is enabled. -
defaultTeam
team of the player by default. -
waveTeam
team of the enemy in waves/sectors. -
cloudColor
public arc.graphics.Color cloudColorcolor of clouds that is displayed when the player is landing -
modeName
name of the custom mode that this ruleset describes, or null. -
mission
Mission string displayed instead of wave/core counter. Null to disable. -
coreIncinerates
public boolean coreIncineratesWhether cores incinerate items when full, just like in the campaign. -
borderDarkness
public boolean borderDarknessIf false, borders fade out into darkness. Only use with custom backgrounds! -
limitMapArea
public boolean limitMapAreaIf true, the map play area is cropped based on the rectangle below. -
limitX
public int limitXMap area limit rectangle. -
limitY
public int limitYMap area limit rectangle. -
limitWidth
public int limitWidthMap area limit rectangle. -
limitHeight
public int limitHeightMap area limit rectangle. -
disableOutsideArea
public boolean disableOutsideAreaIf true, blocks outside the map area are disabled. -
tags
public arc.struct.StringMap tagsspecial tags for additional info. -
customBackgroundCallback
Name of callback to call for background rendering in mods; see Renderer#addCustomBackground. Runs last. -
backgroundTexture
path to background texture with extension (e.g. "sprites/space.png") -
backgroundSpeed
public float backgroundSpeedbackground texture move speed scaling - bigger numbers mean slower movement. 0 to disable. -
backgroundScl
public float backgroundSclbackground texture scaling factor -
backgroundOffsetX
public float backgroundOffsetXbackground UV offsets -
backgroundOffsetY
public float backgroundOffsetYbackground UV offsets -
planetBackground
Parameters for planet rendered in the background. Cannot be changed once a map is loaded. -
planet
Rules from this planet are applied. If it'ssun, mixed tech is enabled. -
allowLogicData
public boolean allowLogicDataIf the `data` instruction is allowed for world processors
-
-
Constructor Details
-
Rules
public Rules()
-
-
Method Details
-
copy
Copies this ruleset exactly. Not efficient at all, do not use often. -
mode
Returns the gamemode that best fits these rules. -
hasEnv
public boolean hasEnv(int env) -
buildRadius
-
unitBuildSpeed
-
unitCost
-
unitDamage
-
unitHealth
-
unitCrashDamage
-
unitMineSpeed
-
blockHealth
-
blockDamage
-
buildSpeed
-
isBanned
-
isBanned
-