This commit is contained in:
@@ -182,6 +182,10 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
||||
public void setBlock(@NonNull Block type, Team team, int rotation, Prov<Building> entityprov){
|
||||
changing = true;
|
||||
|
||||
if(type.isStatic() || this.block.isStatic()){
|
||||
recache();
|
||||
}
|
||||
|
||||
this.block = type;
|
||||
preChanged();
|
||||
changeEntity(team, entityprov, (byte)Mathf.mod(rotation, 4));
|
||||
@@ -288,6 +292,11 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
||||
Call.removeTile(this);
|
||||
}
|
||||
|
||||
/** set()-s this tile, except it's synced across the network */
|
||||
public void setNet(Block block){
|
||||
Call.setTile(this, block, Team.derelict, 0);
|
||||
}
|
||||
|
||||
/** set()-s this tile, except it's synced across the network */
|
||||
public void setNet(Block block, Team team, int rotation){
|
||||
Call.setTile(this, block, team, rotation);
|
||||
|
||||
@@ -43,7 +43,7 @@ public class ShockMine extends Block{
|
||||
|
||||
@Override
|
||||
public void unitOn(Unit unit){
|
||||
if(unit.team() != team && timer(timerDamage, cooldown)){
|
||||
if(enabled && unit.team != team && timer(timerDamage, cooldown)){
|
||||
for(int i = 0; i < tendrils; i++){
|
||||
Lightning.create(team, Pal.lancerLaser, damage, x, y, Mathf.random(360f), length);
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ public class ItemBridge extends Block{
|
||||
unloadable = false;
|
||||
group = BlockGroup.transportation;
|
||||
canOverdrive = false;
|
||||
noUpdateDisabled = true;
|
||||
|
||||
//point2 config is relative
|
||||
config(Point2.class, (ItemBridgeBuild tile, Point2 i) -> tile.link = Point2.pack(i.x + tile.tileX(), i.y + tile.tileY()));
|
||||
|
||||
@@ -19,6 +19,7 @@ public class Junction extends Block{
|
||||
solid = true;
|
||||
group = BlockGroup.transportation;
|
||||
unloadable = false;
|
||||
noUpdateDisabled = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -92,15 +92,16 @@ public class OverflowGate extends Block{
|
||||
if(from == -1) return null;
|
||||
Building to = nearby((from + 2) % 4);
|
||||
boolean canForward = to != null && to.acceptItem(this, item) && to.team == team && !(to.block() instanceof OverflowGate);
|
||||
boolean inv = invert == enabled;
|
||||
|
||||
if(!canForward || invert){
|
||||
if(!canForward || inv){
|
||||
Building a = nearby(Mathf.mod(from - 1, 4));
|
||||
Building b = nearby(Mathf.mod(from + 1, 4));
|
||||
boolean ac = a != null && a.acceptItem(this, item) && !(a.block() instanceof OverflowGate) && a.team == team;
|
||||
boolean bc = b != null && b.acceptItem(this, item) && !(b.block() instanceof OverflowGate) && b.team == team;
|
||||
|
||||
if(!ac && !bc){
|
||||
return invert && canForward ? to : null;
|
||||
return inv && canForward ? to : null;
|
||||
}
|
||||
|
||||
if(ac && !bc){
|
||||
|
||||
@@ -96,6 +96,8 @@ public class PayloadConveyor extends Block{
|
||||
|
||||
@Override
|
||||
public void updateTile(){
|
||||
if(!enabled) return;
|
||||
|
||||
progress = Time.time() % moveTime;
|
||||
|
||||
updatePayload();
|
||||
|
||||
@@ -35,6 +35,7 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
||||
solid = false;
|
||||
floating = true;
|
||||
conveyorPlacement = true;
|
||||
noUpdateDisabled = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -36,6 +36,8 @@ public class LiquidJunction extends LiquidBlock{
|
||||
|
||||
@Override
|
||||
public Building getLiquidDestination(Building source, Liquid liquid){
|
||||
if(!enabled) return this;
|
||||
|
||||
int dir = source.relativeTo(tile.x, tile.y);
|
||||
dir = (dir + 4) % 4;
|
||||
Building next = nearby(dir);
|
||||
|
||||
@@ -7,6 +7,8 @@ public class LiquidRouter extends LiquidBlock{
|
||||
|
||||
public LiquidRouter(String name){
|
||||
super(name);
|
||||
|
||||
noUpdateDisabled = true;
|
||||
}
|
||||
|
||||
public class LiquidRouterEntity extends LiquidBuild{
|
||||
|
||||
@@ -361,15 +361,17 @@ public class LogicBlock extends Block{
|
||||
updateCode();
|
||||
}
|
||||
|
||||
accumulator += edelta() * instructionsPerTick * (consValid() ? 1 : 0);
|
||||
if(enabled){
|
||||
accumulator += edelta() * instructionsPerTick * (consValid() ? 1 : 0);
|
||||
|
||||
if(accumulator > maxInstructionScale * instructionsPerTick) accumulator = maxInstructionScale * instructionsPerTick;
|
||||
if(accumulator > maxInstructionScale * instructionsPerTick) accumulator = maxInstructionScale * instructionsPerTick;
|
||||
|
||||
for(int i = 0; i < (int)accumulator; i++){
|
||||
if(executor.initialized()){
|
||||
executor.runOnce();
|
||||
for(int i = 0; i < (int)accumulator; i++){
|
||||
if(executor.initialized()){
|
||||
executor.runOnce();
|
||||
}
|
||||
accumulator --;
|
||||
}
|
||||
accumulator --;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ public class PowerDiode extends Block{
|
||||
solid = true;
|
||||
insulated = true;
|
||||
group = BlockGroup.power;
|
||||
noUpdateDisabled = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,12 +24,12 @@ public class SolarGenerator extends PowerGenerator{
|
||||
public class SolarGeneratorBuild extends GeneratorBuild{
|
||||
@Override
|
||||
public void updateTile(){
|
||||
productionEfficiency =
|
||||
productionEfficiency = enabled ?
|
||||
Mathf.maxZero(Attribute.light.env() +
|
||||
(state.rules.solarPowerMultiplier < 0 ?
|
||||
(state.rules.lighting ? 1f - state.rules.ambientLight.a : 1f) :
|
||||
state.rules.solarPowerMultiplier
|
||||
));
|
||||
)) : 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public class ItemVoid extends Block{
|
||||
|
||||
@Override
|
||||
public boolean acceptItem(Building source, Item item){
|
||||
return true;
|
||||
return enabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class LiquidVoid extends Block{
|
||||
public class LiquidVoidBuild extends Building{
|
||||
@Override
|
||||
public boolean acceptLiquid(Building source, Liquid liquid, float amount){
|
||||
return true;
|
||||
return enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,7 +14,7 @@ public class PowerSource extends PowerNode{
|
||||
public class PowerSourceBuild extends PowerNodeBuild{
|
||||
@Override
|
||||
public float getPowerProduction(){
|
||||
return 10000f;
|
||||
return enabled ? 10000f : 0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user