Skip to content

Changes to Mindustry Logic

Cardillan edited this page Jul 18, 2025 · 23 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).

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

  • 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-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
Clone this wiki locally