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
Modifier and TypeClassDescriptionstatic class
A team-specific ruleset.static class
A simple map for storing TeamRules in an efficient way without hashing. -
Field Summary
Modifier and TypeFieldDescriptionAmbient light color, used when lighting is enabled.boolean
Determines if gamemode is attack mode.Attributes of the environment.float
background UV offsetsfloat
background UV offsetsfloat
background texture scaling factorfloat
background texture move speed scaling - bigger numbers mean slower movement.path to background texture with extension (e.g.Blocks that cannot be placed.Units that cannot be built.float
How much damage blocks (turrets) deal.float
How much health blocks start with.boolean
If true, bannedBlocks becomes a whitelist.boolean
If false, borders fade out into darkness.float
Multiplier for buildings resource cost.float
Multiplier for building speed.boolean
Whether a gameover can happen at all.boolean
If true, dead teams in PvP automatically have their blocks & units converted to derelict upon death.color of clouds that is displayed when the player is landingboolean
Whether cores change teams when they are destroyed.boolean
If true, every enemy block in the radius of the (enemy) core is destroyed upon death.boolean
Whether cores incinerate items when full, just like in the campaign.Name of callback to call for background rendering in mods; see Renderer#addCustomBackground.boolean
Whether friendly explosions can occur and set fire/damage other blocks.float
Multiplier for percentage of materials refunded when deconstructing.team of the player by default.boolean
If true, blocks outside the map area are disabled.boolean
If true, world processors no longer update.float
Environment drag multiplier.float
Radius around enemy wave drop zones.Color for discovered but un-monitored fog of war areas.boolean
Whether this is the editor gamemode.float
No-build zone around enemy core radius.int
Environmental flags that dictate visuals & how blocks function.boolean
Whether fire (and neoplasm spread) is enabled.boolean
If true, fog of war is enabled.boolean
If true, ghost blocks will appear upon destruction, letting builder blocks/units rebuild them.Block containing these items as requirements are hidden.boolean
If true, banned blocks are hidden from the build menu.boolean
Sandbox mode: Enables infinite resources, build range and build speed.float
Starting wave spacing; if <=0, uses waveSpacing * 2.boolean
Whether ambient lighting is enabled.int
Map area limit rectangle.boolean
If true, the map play area is cropped based on the rectangle below.int
Map area limit rectangle.int
Map area limit rectangle.int
Map area limit rectangle.Starting items put in cores.boolean
Whether 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.Flags set by objectives.In-map objective executor.boolean
If true, items can only be deposited in the core.boolean
If 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.boolean
If true, no-build zones are calculated based on the closest core.boolean
Whether to allow manual unit control.boolean
Whether the game objective is PvP.boolean
Whether is waiting for players enabled in PvP.boolean
Whether reactors can explode and damage other blocks.Unlocked content names.Reveals blocks normally hidden by build visibility.boolean
Whether schematics are allowed.Sector for saves that have them.boolean
If true, unit spawn points are shown.float
Multiplies power output of solar panels.Spawn layout.Color for static, undiscovered fog of war areas.boolean
If fog = true, this is whether static (black) fog is enabled.special tags for additional info.Team-specific rules.boolean
Whether units use and require ammo.float
How fast unit factories build units.int
Base unit cap.boolean
Whether cores add to unit limitfloat
Multiplier of resources that units take to build.float
How much damage unit crash damage deals.float
How much damage units deal.float
How much health units start with.boolean
EXPERIMENTAL! If true, blocks will update in units and share power.boolean
If true, bannedUnits becomes a whitelist.boolean
Whether to pause the wave timer until all enemies are destroyed.boolean
Whether waves are spawnable at all.boolean
Whether the waves can be manually summoned with the play button.float
Time between waves in ticks.team of the enemy in waves/sectors.boolean
Whether the waves come automatically on a timer.Weather events that occur here.int
Wave after which the player 'wins'. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfloat
blockDamage
(Team team) float
blockHealth
(Team team) float
buildSpeed
(Team team) copy()
Copies this ruleset exactly.boolean
hasEnv
(int env) boolean
boolean
mode()
Returns the gamemode that best fits these rules.float
unitBuildSpeed
(Team team) float
float
unitCrashDamage
(Team team) float
unitDamage
(Team team) float
unitHealth
(Team team)
-
Field Details
-
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. -
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. -
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. -
unitPayloadUpdate
public boolean unitPayloadUpdateEXPERIMENTAL! If true, blocks will update in units and share power. -
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) -
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. -
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. -
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. -
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. -
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. -
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
Color for static, undiscovered fog of war areas. -
dynamicColor
Color for discovered but un-monitored fog of war areas. -
lighting
public boolean lightingWhether ambient lighting is enabled. -
ambientLight
Ambient light color, used when lighting is enabled. -
defaultTeam
team of the player by default. -
waveTeam
team of the enemy in waves/sectors. -
cloudColor
color 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
special 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.
-
-
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) -
unitBuildSpeed
-
unitCost
-
unitDamage
-
unitHealth
-
unitCrashDamage
-
blockHealth
-
blockDamage
-
buildSpeed
-
isBanned
-
isBanned
-