An experiment
This commit is contained in:
@@ -31,6 +31,7 @@ public class BaseTurret extends Block{
|
||||
priority = TargetPriority.turret;
|
||||
group = BlockGroup.turrets;
|
||||
flags = EnumSet.of(BlockFlag.turret);
|
||||
updateInUnits = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -127,7 +127,7 @@ public class PayloadConveyor extends Block{
|
||||
if(!enabled) return;
|
||||
|
||||
if(item != null){
|
||||
item.update();
|
||||
item.update(false);
|
||||
}
|
||||
|
||||
lastInterp = curInterp;
|
||||
|
||||
@@ -37,7 +37,9 @@ public class BuildPayload implements Payload{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
public void update(boolean inUnit){
|
||||
if(inUnit && !build.block.updateInUnits) return;
|
||||
|
||||
if(build.tile == null) build.tile = emptyTile;
|
||||
build.update();
|
||||
}
|
||||
|
||||
@@ -36,8 +36,9 @@ public interface Payload extends Position{
|
||||
/** @return the time taken to build this payload. */
|
||||
float buildTime();
|
||||
|
||||
/** update this payload if it is a block */
|
||||
default void update(){}
|
||||
/** update this payload if it is a block
|
||||
* @param inUnit whether this payload is in a unit */
|
||||
default void update(boolean inUnit){}
|
||||
|
||||
/** @return whether this payload was dumped. */
|
||||
default boolean dump(){
|
||||
|
||||
@@ -138,7 +138,7 @@ public class PayloadBlock extends Block{
|
||||
@Override
|
||||
public void updateTile(){
|
||||
if(payload != null){
|
||||
payload.update();
|
||||
payload.update(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ public class NuclearReactor extends PowerGenerator{
|
||||
|
||||
public NuclearReactor(String name){
|
||||
super(name);
|
||||
updateInUnits = false;
|
||||
itemCapacity = 30;
|
||||
liquidCapacity = 30;
|
||||
hasItems = true;
|
||||
@@ -138,7 +139,7 @@ public class NuclearReactor extends PowerGenerator{
|
||||
if((fuel < 5 && heat < 0.5f) || !state.rules.reactorExplosions) return;
|
||||
|
||||
Effect.shake(6f, 16f, x, y);
|
||||
Damage.damage(x, y, explosionRadius * tilesize, explosionDamage * 4);
|
||||
Damage.damage(x, y, explosionRadius * tilesize * (float)(fuel / itemCapacity), explosionDamage * 4);
|
||||
|
||||
explodeEffect.at(x, y);
|
||||
}
|
||||
|
||||
@@ -280,6 +280,13 @@ public class PowerGraph{
|
||||
}
|
||||
}
|
||||
|
||||
public void clear(){
|
||||
all.clear();
|
||||
producers.clear();
|
||||
consumers.clear();
|
||||
batteries.clear();
|
||||
}
|
||||
|
||||
public void reflow(Building tile){
|
||||
queue.clear();
|
||||
queue.addLast(tile);
|
||||
|
||||
Reference in New Issue
Block a user