This commit is contained in:
Anuken
2022-03-01 17:59:11 -05:00
parent 0805fffa18
commit f47f96663a
10 changed files with 26 additions and 12 deletions

View File

@@ -86,6 +86,13 @@ public final class FogControl implements CustomChunk{
}
});
//unit dead -> fog updates
Events.on(UnitDestroyEvent.class, e -> {
if(state.rules.fog && fog[e.unit.team.id] != null){
fog[e.unit.team.id].dynamicUpdated = true;
}
});
SaveVersion.addCustomChunk("static-fog-data", this);
}

View File

@@ -175,7 +175,7 @@ public class OverlayRenderer{
Draw.color();
}else{
state.teams.eachEnemyCore(player.team(), core -> {
if(Core.camera.bounds(Tmp.r1).overlaps(Tmp.r2.setCentered(core.x, core.y, state.rules.enemyCoreBuildRadius * 2f))){
if(core.wasVisible && Core.camera.bounds(Tmp.r1).overlaps(Tmp.r2.setCentered(core.x, core.y, state.rules.enemyCoreBuildRadius * 2f))){
Draw.color(Color.darkGray);
Lines.circle(core.x, core.y - 2, state.rules.enemyCoreBuildRadius);
Draw.color(Pal.accent, core.team.color, 0.5f + Mathf.absin(Time.time, 10f, 0.5f));

View File

@@ -703,7 +703,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
public void drawOverlapCheck(Block block, int cursorX, int cursorY, boolean valid){
if(!valid && state.rules.placeRangeCheck){
var blocker = Build.getEnemyOverlap(block, player.team(), cursorX, cursorY);
if(blocker != null){
if(blocker != null && blocker.wasVisible){
Drawf.selected(blocker, Pal.remove);
Tmp.v1.set(cursorX, cursorY).scl(tilesize).add(block.offset, block.offset).sub(blocker).scl(-1f).nor();
Drawf.dashLineDst(Pal.remove,

View File

@@ -79,9 +79,12 @@ public class BurstDrill extends Drill{
}
invertTime = 1f;
Effect.shake(shake, shake, this);
progress %= drillTime;
drillEffect.at(x + Mathf.range(drillEffectRnd), y + Mathf.range(drillEffectRnd), dominantItem.color);
if(wasVisible){
Effect.shake(shake, shake, this);
drillEffect.at(x + Mathf.range(drillEffectRnd), y + Mathf.range(drillEffectRnd), dominantItem.color);
}
}
}

View File

@@ -295,7 +295,7 @@ public class Drill extends Block{
progress %= delay;
drillEffect.at(x + Mathf.range(drillEffectRnd), y + Mathf.range(drillEffectRnd), dominantItem.color);
if(wasVisible) drillEffect.at(x + Mathf.range(drillEffectRnd), y + Mathf.range(drillEffectRnd), dominantItem.color);
}
}

View File

@@ -200,7 +200,7 @@ public class GenericCrafter extends Block{
}
}
if(Mathf.chanceDelta(updateEffectChance)){
if(wasVisible && Mathf.chanceDelta(updateEffectChance)){
updateEffect.at(x + Mathf.range(size * 4f), y + Mathf.range(size * 4));
}
}else{
@@ -242,7 +242,9 @@ public class GenericCrafter extends Block{
}
}
craftEffect.at(x, y);
if(wasVisible){
craftEffect.at(x, y);
}
progress %= 1f;
}

View File

@@ -154,7 +154,7 @@ public class WallCrafter extends Block{
float eff = getEfficiency(tile.x, tile.y, rotation, dest -> {
//TODO make not chance based?
if(cons && Mathf.chanceDelta(updateEffectChance * warmup)){
if(wasVisible && cons && Mathf.chanceDelta(updateEffectChance * warmup)){
updateEffect.at(
dest.worldx() + Mathf.range(3f) - dx * tilesize,
dest.worldy() + Mathf.range(3f) - dy * tilesize,

View File

@@ -63,7 +63,9 @@ public class CoreBlock extends StorageBlock{
if(player == null || tile == null || !(tile.build instanceof CoreBuild entity)) return;
CoreBlock block = (CoreBlock)tile.block();
Fx.spawn.at(entity);
if(entity.wasVisible){
Fx.spawn.at(entity);
}
player.set(entity);
@@ -392,7 +394,7 @@ public class CoreBlock extends StorageBlock{
if(team == state.rules.defaultTeam && state.isCampaign()){
state.rules.sector.info.handleCoreItem(item, amount);
if(realAmount == 0){
if(realAmount == 0 && wasVisible){
Fx.coreBurn.at(x, y);
}
}

View File

@@ -38,7 +38,7 @@ public class StorageBlock extends Block{
if(Mathf.chance(0.3)){
Tile edge = Edges.getFacingEdge(source, self);
Tile edge2 = Edges.getFacingEdge(self, source);
if(edge != null && edge2 != null){
if(edge != null && edge2 != null && self.wasVisible){
Fx.coreBurn.at((edge.worldx() + edge2.worldx())/2f, (edge.worldy() + edge2.worldy())/2f);
}
}