package mindustry.logic; import arc.*; import arc.func.*; import arc.graphics.*; import arc.math.*; import arc.scene.*; import arc.scene.actions.*; import arc.scene.ui.*; import arc.scene.ui.layout.*; import arc.struct.*; import arc.util.*; import mindustry.gen.*; import mindustry.logic.LCanvas.*; import mindustry.logic.LExecutor.*; import mindustry.ui.*; import static mindustry.logic.LCanvas.*; /** * A statement is an intermediate representation of an instruction, to be used mostly in UI. * Contains all relevant variable information. */ public abstract class LStatement{ public transient @Nullable StatementElem elem; public abstract void build(Table table); public abstract LInstruction build(LAssembler builder); public LCategory category(){ return LCategory.unknown; } public LStatement copy(){ StringBuilder build = new StringBuilder(); write(build); //assume privileged when copying, because there's no way privileged instructions can appear here anyway, and the instructions get validated on load anyway Seq read = LAssembler.read(build.toString(), true); return read.size == 0 ? null : read.first(); } public boolean hidden(){ return false; } /** Privileged instructions are only allowed in world processors. */ public boolean privileged(){ return false; } /** If true, this statement is considered useless with privileged processors and is not allowed in them. */ public boolean nonPrivileged(){ return false; } //protected methods are only for internal UI layout utilities protected void param(Cell