Fixed #3133 (probably) / Logic icon draw command

This commit is contained in:
Anuken
2020-10-26 13:31:32 -04:00
parent a2181fec48
commit 8770bb2422
19 changed files with 6314 additions and 4076 deletions

View File

@@ -15,6 +15,7 @@ import mindustry.game.Teams.*;
import mindustry.gen.*;
import mindustry.type.*;
import mindustry.world.*;
import mindustry.world.blocks.logic.*;
import mindustry.world.blocks.logic.LogicDisplay.*;
import mindustry.world.blocks.logic.MemoryBlock.*;
import mindustry.world.blocks.logic.MessageBlock.*;
@@ -823,9 +824,15 @@ public class LExecutor{
//graphics on headless servers are useless.
if(Vars.headless) return;
int num1 = exec.numi(p1);
if(type == LogicDisplay.commandImage){
num1 = exec.obj(p1) instanceof UnlockableContent u ? u.iconId : 0;
}
//add graphics calls, cap graphics buffer size
if(exec.graphicsBuffer.size < maxGraphicsBuffer){
exec.graphicsBuffer.add(DisplayCmd.get(type, exec.numi(x), exec.numi(y), exec.numi(p1), exec.numi(p2), exec.numi(p3), exec.numi(p4)));
exec.graphicsBuffer.add(DisplayCmd.get(type, exec.numi(x), exec.numi(y), num1, exec.numi(p2), exec.numi(p3), exec.numi(p4)));
}
}
}

View File

@@ -143,6 +143,12 @@ public class LStatements{
if(type == GraphicsType.color){
p2 = "255";
}
if(type == GraphicsType.image){
p1 = "@copper";
p2 = "32";
p3 = "0";
}
rebuild(table);
}, 2, cell -> cell.size(100, 50)));
}, Styles.logict, () -> {}).size(90, 40).color(table.color).left().padLeft(2);
@@ -205,6 +211,15 @@ public class LStatements{
fields(s, "x3", p3, v -> p3 = v);
fields(s, "y3", p4, v -> p4 = v);
}
case image -> {
fields(s, "x", x, v -> x = v);
fields(s, "y", y, v -> y = v);
row(s);
fields(s, "image", p1, v -> p1 = v);
fields(s, "size", p2, v -> p2 = v);
row(s);
fields(s, "rotation", p3, v -> p3 = v);
}
}
}).expand().left();
}