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