Dedicated memory cells
Before Width: | Height: | Size: 739 B |
BIN
core/assets-raw/sprites/blocks/logic/memory-cell.png
Normal file
After Width: | Height: | Size: 385 B |
Before Width: | Height: | Size: 546 B After Width: | Height: | Size: 547 B |
Before Width: | Height: | Size: 711 B After Width: | Height: | Size: 779 B |
@ -284,3 +284,4 @@
|
||||
63460=micro-processor|block-micro-processor-medium
|
||||
63459=logic-display|block-logic-display-medium
|
||||
63458=switch|block-switch-medium
|
||||
63457=memory-cell|block-memory-cell-medium
|
||||
|
Before Width: | Height: | Size: 788 B After Width: | Height: | Size: 789 B |
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 187 KiB After Width: | Height: | Size: 186 KiB |
Before Width: | Height: | Size: 386 KiB After Width: | Height: | Size: 386 KiB |
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.2 MiB |
Before Width: | Height: | Size: 1.8 MiB After Width: | Height: | Size: 1.8 MiB |
Before Width: | Height: | Size: 188 KiB After Width: | Height: | Size: 187 KiB |
Before Width: | Height: | Size: 392 KiB After Width: | Height: | Size: 392 KiB |
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.3 MiB |
@ -83,7 +83,7 @@ public class Blocks implements ContentList{
|
||||
repairPoint, resupplyPoint,
|
||||
|
||||
//logic
|
||||
message, switchBlock, microProcessor, logicProcessor, logicDisplay,
|
||||
message, switchBlock, microProcessor, logicProcessor, logicDisplay, memoryCell,
|
||||
|
||||
//campaign
|
||||
launchPad, launchPadLarge,
|
||||
@ -1897,19 +1897,17 @@ public class Blocks implements ContentList{
|
||||
}};
|
||||
|
||||
microProcessor = new LogicBlock("micro-processor"){{
|
||||
requirements(Category.logic, with(Items.copper, 30, Items.lead, 50, Items.silicon, 30));
|
||||
requirements(Category.logic, with(Items.copper, 80, Items.lead, 50, Items.silicon, 60));
|
||||
|
||||
instructionsPerTick = 2;
|
||||
memory = 32;
|
||||
|
||||
size = 1;
|
||||
}};
|
||||
|
||||
logicProcessor = new LogicBlock("logic-processor"){{
|
||||
requirements(Category.logic, with(Items.copper, 200, Items.lead, 120, Items.silicon, 100, Items.metaglass, 50));
|
||||
requirements(Category.logic, with(Items.copper, 200, Items.lead, 120, Items.silicon, 110, Items.metaglass, 60));
|
||||
|
||||
instructionsPerTick = 5;
|
||||
memory = 128;
|
||||
|
||||
range = 16 * 10;
|
||||
|
||||
@ -1924,6 +1922,12 @@ public class Blocks implements ContentList{
|
||||
size = 3;
|
||||
}};
|
||||
|
||||
memoryCell = new MemoryBlock("memory-cell"){{
|
||||
requirements(Category.logic, with(Items.graphite, 40, Items.silicon, 40));
|
||||
|
||||
memoryCapacity = 64;
|
||||
}};
|
||||
|
||||
//endregion
|
||||
//region experimental
|
||||
|
||||
|
@ -67,7 +67,7 @@ public class ContinuousLaserBulletType extends BulletType{
|
||||
for(int i = 0; i < tscales.length; i++){
|
||||
Tmp.v1.trns(b.rotation() + 180f, (lenscales[i] - 1f) * 35f);
|
||||
Lines.stroke((9f + Mathf.absin(Time.time(), 0.8f, 1.5f)) * b.fout() * strokes[s] * tscales[i]);
|
||||
Lines.lineAngle(b.x + Tmp.v1.x, b.y + Tmp.v1.y, b.rotation(), baseLen * lenscales[i], CapStyle.none);
|
||||
Lines.lineAngle(b.x + Tmp.v1.x, b.y + Tmp.v1.y, b.rotation(), baseLen * lenscales[i], false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ public class LaserBulletType extends BulletType{
|
||||
for(Color color : colors){
|
||||
Draw.color(color);
|
||||
Lines.stroke((cwidth *= lengthFalloff) * b.fout());
|
||||
Lines.lineAngle(b.x, b.y, b.rotation(), baseLen, CapStyle.none);
|
||||
Lines.lineAngle(b.x, b.y, b.rotation(), baseLen, false);
|
||||
Tmp.v1.trns(b.rotation(), baseLen);
|
||||
Drawf.tri(b.x + Tmp.v1.x, b.y + Tmp.v1.y, Lines.getStroke() * 1.22f, cwidth * 2f + width / 2f, b.rotation());
|
||||
|
||||
|
@ -157,7 +157,7 @@ public class Drawf{
|
||||
|
||||
Lines.stroke(12f * scale);
|
||||
Lines.precise(true);
|
||||
Lines.line(line, x + Tmp.v1.x, y + Tmp.v1.y, x2 - Tmp.v1.x, y2 - Tmp.v1.y, CapStyle.none, 0f);
|
||||
Lines.line(line, x + Tmp.v1.x, y + Tmp.v1.y, x2 - Tmp.v1.x, y2 - Tmp.v1.y, false, 0f);
|
||||
Lines.precise(false);
|
||||
Lines.stroke(1f);
|
||||
|
||||
|
@ -9,6 +9,7 @@ import mindustry.entities.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.world.blocks.logic.LogicDisplay.*;
|
||||
import mindustry.world.blocks.logic.MemoryBlock.*;
|
||||
import mindustry.world.blocks.logic.MessageBlock.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
@ -23,7 +24,6 @@ public class LExecutor{
|
||||
maxGraphicsBuffer = 512,
|
||||
maxTextBuffer = 256;
|
||||
|
||||
public double[] memory = {};
|
||||
public LInstruction[] instructions = {};
|
||||
public Var[] vars = {};
|
||||
|
||||
@ -162,11 +162,12 @@ public class LExecutor{
|
||||
}
|
||||
|
||||
public static class ReadI implements LInstruction{
|
||||
public int from, to;
|
||||
public int target, position, output;
|
||||
|
||||
public ReadI(int from, int to){
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
public ReadI(int target, int position, int output){
|
||||
this.target = target;
|
||||
this.position = position;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
public ReadI(){
|
||||
@ -174,18 +175,24 @@ public class LExecutor{
|
||||
|
||||
@Override
|
||||
public void run(LExecutor exec){
|
||||
int address = exec.numi(from);
|
||||
int address = exec.numi(position);
|
||||
Building from = exec.building(target);
|
||||
|
||||
exec.setnum(to,address < 0 || address >= exec.memory.length ? 0 : exec.memory[address]);
|
||||
if(from instanceof MemoryEntity){
|
||||
MemoryEntity mem = (MemoryEntity)from;
|
||||
|
||||
exec.setnum(output, address < 0 || address >= mem.memory.length ? 0 : mem.memory[address]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class WriteI implements LInstruction{
|
||||
public int from, to;
|
||||
public int target, position, value;
|
||||
|
||||
public WriteI(int from, int to){
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
public WriteI(int target, int position, int value){
|
||||
this.target = target;
|
||||
this.position = position;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public WriteI(){
|
||||
@ -193,10 +200,16 @@ public class LExecutor{
|
||||
|
||||
@Override
|
||||
public void run(LExecutor exec){
|
||||
int address = exec.numi(to);
|
||||
int address = exec.numi(position);
|
||||
Building from = exec.building(target);
|
||||
|
||||
if(from instanceof MemoryEntity){
|
||||
MemoryEntity mem = (MemoryEntity)from;
|
||||
|
||||
if(address >= 0 && address < mem.memory.length){
|
||||
mem.memory[address] = exec.num(value);
|
||||
}
|
||||
|
||||
if(address >= 0 && address < exec.memory.length){
|
||||
exec.memory[address] = exec.num(from);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,16 +58,23 @@ public class LStatements{
|
||||
|
||||
@RegisterStatement("write")
|
||||
public static class WriteStatement extends LStatement{
|
||||
public String to = "0";
|
||||
public String from = "result";
|
||||
public String input = "result", target = "@0", address = "0";
|
||||
|
||||
@Override
|
||||
public void build(Table table){
|
||||
field(table, to, str -> to = str);
|
||||
table.add(" write ");
|
||||
|
||||
table.add(" = ");
|
||||
field(table, input, str -> input = str);
|
||||
|
||||
field(table, from, str -> from = str);
|
||||
table.add(" to ");
|
||||
|
||||
fields(table, target, str -> target = str);
|
||||
|
||||
table.row();
|
||||
|
||||
table.add(" at ");
|
||||
|
||||
field(table, address, str -> address = str);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -77,22 +84,29 @@ public class LStatements{
|
||||
|
||||
@Override
|
||||
public LInstruction build(LAssembler builder){
|
||||
return new WriteI(builder.var(from), builder.var(to));
|
||||
return new WriteI(builder.var(target), builder.var(address), builder.var(input));
|
||||
}
|
||||
}
|
||||
|
||||
@RegisterStatement("read")
|
||||
public static class ReadStatement extends LStatement{
|
||||
public String to = "result";
|
||||
public String from = "0";
|
||||
public String output = "result", target = "@0", address = "0";
|
||||
|
||||
@Override
|
||||
public void build(Table table){
|
||||
field(table, to, str -> to = str);
|
||||
table.add(" read ");
|
||||
|
||||
table.add(" = mem:: ");
|
||||
field(table, output, str -> output = str);
|
||||
|
||||
field(table, from, str -> from = str);
|
||||
table.add(" = ");
|
||||
|
||||
fields(table, target, str -> target = str);
|
||||
|
||||
table.row();
|
||||
|
||||
table.add(" at ");
|
||||
|
||||
field(table, address, str -> address = str);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -102,7 +116,7 @@ public class LStatements{
|
||||
|
||||
@Override
|
||||
public LInstruction build(LAssembler builder){
|
||||
return new ReadI(builder.var(from), builder.var(to));
|
||||
return new ReadI(builder.var(target), builder.var(address), builder.var(output));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -514,10 +514,10 @@ public class UnitType extends UnlockableContent{
|
||||
Draw.rect(footRegion, leg.base.x, leg.base.y, position.angleTo(leg.base));
|
||||
|
||||
Lines.stroke(legRegion.getHeight() * Draw.scl * flips);
|
||||
Lines.line(legRegion, position.x, position.y, leg.joint.x, leg.joint.y, CapStyle.none, 0);
|
||||
Lines.line(legRegion, position.x, position.y, leg.joint.x, leg.joint.y, false, 0);
|
||||
|
||||
Lines.stroke(legBaseRegion.getHeight() * Draw.scl * flips);
|
||||
Lines.line(legBaseRegion, leg.joint.x + Tmp.v1.x, leg.joint.y + Tmp.v1.y, leg.base.x, leg.base.y, CapStyle.none, 0);
|
||||
Lines.line(legBaseRegion, leg.joint.x + Tmp.v1.x, leg.joint.y + Tmp.v1.y, leg.base.x, leg.base.y, false, 0);
|
||||
|
||||
if(jointRegion.found()){
|
||||
Draw.rect(jointRegion, leg.joint.x, leg.joint.y);
|
||||
|
@ -45,7 +45,7 @@ public class ExtendingItemBridge extends ItemBridge{
|
||||
x + Geometry.d4[i].x * tilesize / 2f,
|
||||
y + Geometry.d4[i].y * tilesize / 2f,
|
||||
x + ex,
|
||||
y + ey, CapStyle.none, 0f);
|
||||
y + ey, false, 0f);
|
||||
|
||||
Draw.rect(endRegion, x, y, i * 90 + 90);
|
||||
Draw.rect(endRegion,
|
||||
|
@ -65,7 +65,7 @@ public class ItemBridge extends Block{
|
||||
req.drawx(),
|
||||
req.drawy(),
|
||||
otherReq.drawx(),
|
||||
otherReq.drawy(), CapStyle.none, -tilesize / 2f);
|
||||
otherReq.drawy(), false, -tilesize / 2f);
|
||||
Draw.rect(arrowRegion, (req.drawx() + otherReq.drawx()) / 2f, (req.drawy() + otherReq.drawy()) / 2f,
|
||||
Angles.angle(req.drawx(), req.drawy(), otherReq.drawx(), otherReq.drawy()));
|
||||
}
|
||||
@ -298,7 +298,7 @@ public class ItemBridge extends Block{
|
||||
x,
|
||||
y,
|
||||
other.worldx(),
|
||||
other.worldy(), CapStyle.none, -tilesize / 2f);
|
||||
other.worldy(), false, -tilesize / 2f);
|
||||
|
||||
int dist = Math.max(Math.abs(other.x - tile.x), Math.abs(other.y - tile.y));
|
||||
|
||||
|
@ -1,37 +0,0 @@
|
||||
package mindustry.world.blocks.experimental;
|
||||
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.struct.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
public class ProcessorBlock extends Block{
|
||||
|
||||
public ProcessorBlock(String name){
|
||||
super(name);
|
||||
configurable = true;
|
||||
}
|
||||
|
||||
public class ProcessorEntity extends Building{
|
||||
//all tiles in the block network - does not include itself
|
||||
Seq<Building> network = new Seq<>();
|
||||
|
||||
@Override
|
||||
public boolean onConfigureTileTapped(Building other){
|
||||
if(other == this) return true;
|
||||
|
||||
if(!network.contains(other)){
|
||||
network.add(other);
|
||||
}else{
|
||||
network.remove(other);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildConfiguration(Table table){
|
||||
super.buildConfiguration(table);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -24,7 +24,6 @@ public class LogicBlock extends Block{
|
||||
public int maxInstructionScale = 8;
|
||||
public int instructionsPerTick = 1;
|
||||
public float range = 8 * 10;
|
||||
public int memory = 16;
|
||||
|
||||
public LogicBlock(String name){
|
||||
super(name);
|
||||
@ -70,10 +69,6 @@ public class LogicBlock extends Block{
|
||||
public IntSeq invalidConnections = new IntSeq();
|
||||
public boolean loaded = false;
|
||||
|
||||
public LogicEntity(){
|
||||
executor.memory = new double[memory];
|
||||
}
|
||||
|
||||
public void updateCode(String str){
|
||||
updateCodeVars(str, null);
|
||||
}
|
||||
@ -279,10 +274,8 @@ public class LogicBlock extends Block{
|
||||
TypeIO.writeObject(write, value);
|
||||
}
|
||||
|
||||
write.i(executor.memory.length);
|
||||
for(int i = 0; i < executor.memory.length; i++){
|
||||
write.d(executor.memory[i]);
|
||||
}
|
||||
//no memory
|
||||
write.i(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -311,10 +304,8 @@ public class LogicBlock extends Block{
|
||||
}
|
||||
|
||||
int memory = read.i();
|
||||
double[] memorybank = executor.memory.length != memory ? new double[memory] : executor.memory;
|
||||
for(int i = 0; i < memory; i++){
|
||||
memorybank[i] = read.d();
|
||||
}
|
||||
//skip memory, it isn't used anymore
|
||||
read.skip(memory * 8);
|
||||
|
||||
updateCodeVars(code, asm -> {
|
||||
|
||||
@ -326,8 +317,6 @@ public class LogicBlock extends Block{
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
executor.memory = memorybank;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
org.gradle.daemon=true
|
||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||
archash=6ac4c28124eae46797498b5958a85b1375a60f1e
|
||||
archash=618135d9b6f36fbe0838e0a5128ac1283457be82
|
||||
|