Skip to content

Changes to Mindustry Logic

Cardillan edited this page Feb 28, 2026 · 38 revisions

This wiki page documents changes to Mindustry Logic here, as they appear in the main branch. Listed are changes that affect compilers (new instructions, new properties, new built-in variables and so on). Minor bug fixes, especially when the bug hasn't been part of a release, aren't included.

I (cardillan) will update this page on a best-effort basis when new commits appear on Mindustry's main branch. Feel free to update the page to correct inaccuracies, omissions and errors, or use the discussion page for discussions.

Listed chronologically in descending order on a best-effort basis, starting from the last release of Mindustry 7 (v146). Dates link to the relevant commit.

Latest BE

  • 2026-02-28 LogicBlock.accumulator is stored in map save and restored on a map load.
  • 2026-02-27 The time already waited for a running wait instruction is stored in map save and restored on a map load.

No changes.

  • 2026-02-08 New sensable LAccess properties @buildX, @buildY, @building, @breaking, @selectedBlock and @selectedRotation.
  • 2026-02-07 Added the ability to run code on a map objective completion (note this means the code runs without a logic block attached).
  • 2026-02-04 The drawflush instruction always clears the graphic buffer, even if the argument doesn't represent a valid display.
  • 2026-01-16 The instruction accumulator is not decreased when an instruction yields. Guarantees that a wait instruction with a non-zero argument accumulates the number of instructions corresponding to the length of the wait to be run on the next frame update, regardless of the frame rate.
  • 2026-01-15 New sensable LAccess property @maxUnits. Returns the maximum number of units that a team can have. Can only be sensed from cores.
  • 2026-01-14 A wait instruction with a zero argument yields (ends the execution of the current tick), but is not executed again. Before this change, wait 0 didn't yield and was equivalent to a noop.
  • 2025-12-28 Allows displays to be used with draw image (draws the contents of another display on the current one).
  • 2025-12-28 Allows textures/quad markers to use content or logic displays as their texture.
  • 2025-12-19 New ucontrol deconstruct x y instruction for deconstructing blocks. Requires the logicUnitDeconstruct game rule to be set (either use the GUI settings, or open the console and run Vars.state.rules.logicUnitDeconstruct = true;).

No changes.

  • 2025-08-01 Extension of the schematic file format (support for content ID mapping). The change is backwards compatible (older versions of Mindustry ignore the content map when present.)
  • 2025-07-27 Ability to sense building requirement on block types (e.g., @air-factory.@copper returns the amount of copper needed to build the air factory). Returned values respect the game settings (infinite resources and build cost multiplier).

No changes.

  • 2025-07-18 Assigning a non-numeric value to @counter is now effectively ignored.
  • 2025-07-10 the @bufferUsage LAccess property has been renamed to @bufferSize.
  • 2025-07-10 the read and write instruction now recognize the LReadable and LWritable interface, making is possible for mods to integrate their objects with read/write logic.
  • 2025-07-06 the control instruction can control any block in the processor's range, not just blocks directly linked to it.
  • 2025-07-03 read can access individual characters within a message block. A UTF-16 value of the character is returned. When the index is out of range, returns null. The size of the text in the message box can be sensed using @bufferUsage.
  • 2025-07-02
    • The text alignment in draw print is no longer an instruction keyword, but a variable. Supported alignments are mlog variables, such as @bottomLeft or @center.
    • New marker properties textAlign and lineAlign.
  • 2025-07-02
    • New select instruction (a ternary operator).
    • Assigning a non-numeric value to @counter now sets the @counter to the numeric part of the value assigned, leading to generally undefined behavior.
  • 2025-06-22 Small fixes to the read/write canvas access: reading from invalid pixel index now returns null and the value to write is converted to an integer properly if it is an object. Note that the write will silently fail if the pixel value is out of range (0 to 7).
  • 2025-06-17 read and write can access individual canvas pixels.
  • 2025-06-15 New marker property outline.
  • 2025-06-14 New sensable property @operations. Returns the number of drawflush operations on a display since map reload (allows detecting the display needs to be redrawn).
  • 2025-06-02 Two new operations: op emod result a b computes a modulo b, always returning a positive number; op ushr result a b computes an unsigned right-shift.
  • 2025-05-25 New operation op logn result a b. Computes the logarithm of a in base b.
  • 2025-05-14 New operation op round. Rounds the value to the nearest integer.
  • 2025-05-12 New operation op sign. Returns 0 only when the operand is strictly equal to 0, -1 for negative and 1 for positive numbers.
  • 2025-05-11 New unpackcolor instruction.
  • 2025-05-08 The @counter is set back to numeric value at the start of the execution of each instruction. It is now impossible to assign null or an object value to @counter in any way - all such assignments (regardless of the actual assignment mechanism) are effectively ignored.
  • 2025-04-28 Mlog parser now recognizes the 0xFFFFFFFF80000000 literal and the corresponding value in binary representation (i.e. Integer.MIN_VALUE). The only unparseable numbers left are -9223372036854775808 (i.e. Long.MIN_VALUE) in any representation, values from 0x8000000000000001 to 0x800000000000000F in hexadecimal representation and the value 0b1000000000000000000000000000000000000000000000000000000000000001 in binary representation.
  • 2025-04-19 Color literals for named colors (e.g. %[red]).
  • 2025-04-18 New sensable property @bufferUsage. The property returns the number of commands in the graphics buffer of a display.
  • 2025-04-17 New sensable properties @displayHeight and @displayWidth, returning display size in pixels. Added to support tileable displays.
  • 2025-04-08 sensor @size returns the length of a string value.
  • 2025-04-04 read can access characters within string values. A UTF-16 value of the character is returned. When the index is out of range, returns null.
  • 2025-04-04 New sensable property @memoryCapacity.
  • 2025-04-04 fixes a bug which prevented parsing of numeric literal giving the value of -(2^31) in any form (decimal, float, hex, binary). This value still can't be parsed when expressed as an unsigned 64bit integer (i.e. 0xFFFFFFFF80000000 or the corresponding value in binary).
  • 2025-03-04 instruction scheduling change: all the accumulator capacity is used in each tick.
  • 2025-02-09 read and write can access existing variables by name (including @counter) from other processors.
  • 2025-02-06 New sensable properties @totalPayload and @payloadCapacity, objects and units can be sensed to see whether they hold a payload contents (similarly to sensing whether they hold items/liquids).
  • 2025-02-06 New LogicRule canGameOver
  • 2025-02-05 Support for team in the lookup instruction
  • 2025-02-05 New printchar instruction. Takes either a number, which is converted to an UTF-16 character and printed, or a Mindustry content, in which case the corresponding icon is printed.
  • 2025-02-04 New LogicRule unitMineSpeed
  • 2024-11-29 Change in displaying numbers (affects emulators and compile-time evaluation of print instructions)
  • 2024-09-15 New ulocate building type shield.
  • 2024-08-06 New argument to the playsound instruction
  • 2024-08-03 New parameter to the message instruction
  • 2024-07-07 New sensable properties @currentAmmoType, @velocityX, @velocityY. New LogicRule dragMultiplier.
  • 2024-06-16 New clientdata instruction
  • 2024-06-16 Removed @solid variable, new sensable property @solid.
  • 2024-04-12 New instruction playsound
  • 2024-03-30 New instructions weathersense, weatherset
  • 2024-03-03 @shield is a settable property (world processor)
  • 2024-02-06 New draw subcommands translate, rotate, scale, reset.
  • 2024-02-02 Mods can add effects
  • 2024-01-31 Added new markers (quad) and marker properties (posi, uvi, colori)
  • 2024-01-20 Fixes wait instruction inconsistency
  • 2023-12-15 Various updates to markers (branch merge)
  • 2023-12-12 Allow fetching unitCount by type, and buildCount without type
  • 2023-12-02 New format and localeprint instructions, various networking logic updates
  • 2023-11-23 New draw print variant for graphical output of the text buffer
  • 2023-10-31 New property @armor, properties @speed, @armor, @health made settable
  • 2023-10-06 wait instruction yields execution, new parameter for message to return status
  • 2023-09-28 New camera position properties (@cameraX, @cameraY, @cameraWidth, @cameraHeight)
  • 2023-09-27 New marker instruction (later supplanted by makemarker and setmarker)
  • 2023-09-21 New explosion parameter effect
  • 2023-09-20 Prevent objects from being set to @counter
  • 2023-09-12 New LogicRule ban, unban