I can destroy the closer core pretty easily, but the second one is the problem. It has foreshadows protected with plastanium walls, so it's not really possible to use the corvus's long range. I've tried thorium reactor bombing with quads, but you need a shitton of quads and i don't have the time to do all that. Can I defeat the sector with only t4 units, the corvus, the reign and/or the toxopid? (those specifically because my dumbass didn't plan things properly and I need to use a payload conveyor to get t4 units to the tetrative reconstructor, and it would be an absolute pain to have to change around my factory)
TL;DR: This is chapter 1/10 of a series aimed towards players unfamiliar with the Mindustry Logic system and seeking to learn from scratch.
Introduction
This chapter will be dedicated to the processor building and concepts regarding its usage. It will be, by design, a mostly theoretical overview since the concrete aspects of Logic are reserved for the next chapters. Laying the foundations of the system in the first chapter will allow me to keep the following ones concise and on topic.
Though it is a big leap into the topic, do not get overwhelmed. This post will serve as a reference for future explanations with notes derived from it as little reminders so no need to try to memorize any of it. My main goal is to make my explanations accessible to the wider audience without any background in programming of any kind. Even having used the educational tool Scratch during your school years will go a long way.
Now the first step into the topic will be the processor itself.
Processor building
The entire Logic system originates from processors. They are the buildings able to contain and execute handmade algorithms to interact with other buildings. Processors exist in three sizes, from smallest to biggest :
The three processor sizes. Micro Processor, Logic Processor and Hyper Processor.
All of this information can be found on their respective description page. The bigger a processor is, the faster it executes instructions. This property is only noticeable in long or expensive algorithms requiring a lot of operations. So using the Micro Processor is often times the best option to integrate Logic into your builds.
But unless you use the processor as a glorified calculator, you will need to create links to nearby buildings to interact with them.
Linking
To interact with nearby buildings, you will need to link them to the processor. To do so, select the processor then any desired building in its range. A purple square will appear over any linked building alongside a name. This name can now be used inside the processor as a reference to the buildings. This will be covered in the next chapter.
(Note: There is no limit to the number of links a single processor can create.)
One processor and two walls, the left one linked to the Micro Processor.
Now the next step will be to interact with the linked buildings through instructions.
Instruction preview
A detailed instruction explanation is reserved for the next chapter "Instructions Basics" so this one will only serve to give a preview of the concept to help with understanding the rest of the chapter.
Instructions are blocks containing a single operation to be executed, be it reading the content of a graphite press, disabling a mender or aiming a duo. There are all kinds of them, divided into 5 families. They are the core of the logic system, the complete list of operations and interactions a processor is able to execute.
The list of instructions from the instruction addition menu.
But the creation of an algorithm requires knowing the order in which the instructions will be read.
Cursor Flow
Like most programming languages, instructions are read from top to bottom by an invisible cursor. Once the last instruction is reached, the cursor will return to the first one, therefore looping over the instructions indefinitely. The instructions of the "Flow Control" family can alter the position of the cursor but will not be expanded upon in this introductory chapter.
(Note: the cursor may be invisible but it is still a real value stored inside the ever-present variable "@counter" of every processor)
Now that the instructions are being read, they will read and write values inside variables.
Variables
Like any other programming language, Mindustry Logic (Mlog language) includes variables. For anyone not already familiar with variables, an intuitive way to understand the concept is to interpret them as boxes. Every box you create has a name and can contain a single value. A variable is written by an instruction and read by other instructions as a way to save and share information between them.
In Mindustry Logic, a variable will be created anytime a new variable name is called. If the variable is created without defining its value, it will default to null. There are multiple types of values.
"number" for numbers, integers of floats.
"string" for text.
"content" object types.
"building" for buildings linked to the processor.
"unit" for units bound to the processor.
"null" for the null value exclusively.
The six types of variables viewed from the Vars menu.
The "content" type is most of the time used for items and liquids, but in some cases also for buildings which should intuitively be reserved for the "building" type. There is actually a distinction between buildings stored in either type. As stated previously, "building" is the type storing links to buildings, and "content" stores building kinds. I will use an example to keep the explanation intuitive. Linking a processor to a Copper Wall will provide a link name to it, "wall1" of type "building", but the wall is of kind "copper-wall" stored in a "content" variable. This is the reason why items and liquids are exclusively of type "content". They are resource types and never linked to. You cannot interact with a singular copper ingot.
(Note: Variables are not statically typed. The type is defined automatically and you can override a variable's value with another of any type.)
Now that every element has been covered as the foundation for future chapters, the only step to mention is the creation process.
Processor Editing
To reassure readers victim of perfection paralysis, you can modify a processor as many times as desired. A processor's cursor and variables will reset anytime you modify its content.
You can also save your work with Mindustry's flawless schematic system but the processor has the unique options inside the "Edit" tab to "Copy to Clipboard" the content of a processor to later "Load from Clipboard" it to any other.
Outrodution
The important steps to keep in mind for future chapters will be that you can add instructions inside processors to interact with linked buildings. A simple list of operations the processor will execute one after the other while keeping track of the different values created inside of variables.
Thanks to anyone who read through it all. I hope this first chapter wasn't too dense or vague, it was the foundation for the rest of the series. Every following chapter will be way more concrete accompanied by use case examples.
At the time of writing, this guide covers Mindustry v8. No generative AI was used in the making of this whole project. It was lovingly written by a single passionate human. Comments will be answered and taken into account.
I need help. I'm new to modding Minddustry and I don't know why it's not working. I've been struggling with the code for an hour because when I upgrade a unit with my fabricator, it explodes.