Dedicated memory cells

This commit is contained in:
Anuken
2020-08-11 10:50:12 -04:00
parent 7e8326a3af
commit bb3c80c055
29 changed files with 3535 additions and 3467 deletions
@@ -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;
}
}