Added field for running logic code upon objective completion

This commit is contained in:
Anuken
2026-02-06 22:46:17 -05:00
parent 7d88eeee77
commit 67d3a9feb0
4 changed files with 39 additions and 20 deletions

View File

@@ -1,7 +1,6 @@
package mindustry.maps.filters;
import arc.scene.ui.layout.*;
import mindustry.*;
import mindustry.gen.*;
import mindustry.logic.*;
import mindustry.maps.filters.FilterOption.*;
@@ -38,26 +37,10 @@ public class LogicFilter extends GenerateFilter{
@Override
public void apply(Tiles tiles, GenerateInput in){
LExecutor executor = new LExecutor();
executor.privileged = true;
try{
//assembler has no variables, all the standard ones are null
executor.load(LAssembler.assemble(code, true));
}catch(Throwable ignored){
//if loading code
return;
}
//this updates map width/height global variables
logicVars.update();
//NOTE: all tile operations will call setNet for tiles, but that should have no overhead during world loading
//executions are limited to prevent infinite generation
for(int i = 1; i < maxInstructionsExecution; i++){
if(!loop && (executor.counter.numval >= executor.instructions.length || executor.counter.numval < 0)) break;
executor.runOnce();
}
LExecutor.runLogicScript(code, maxInstructionsExecution, loop);
}
@Override