Fog building hiding

This commit is contained in:
Anuken
2022-02-19 20:34:55 -05:00
parent 66a806c304
commit 99b01f3a3c
11 changed files with 90 additions and 17 deletions

View File

@@ -70,6 +70,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
transient float enabledControlTime;
transient String lastAccessed;
transient boolean wasDamaged; //used only by the indexer
transient boolean wasVisible; //used only by the block renderer when fog is on
transient float visualLiquid;
@Nullable PowerModule power;
@@ -1775,6 +1776,24 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
}
}
@Replace
@Override
public boolean inFogTo(Team viewer){
if(team == viewer || !state.rules.fog) return false;
int size = block.size, of = block.sizeOffset, tx = tile.x, ty = tile.y;
for(int x = 0; x < size; x++){
for(int y = 0; y < size; y++){
if(fogControl.isVisibleTile(viewer, tx + x + of, ty + y + of)){
return false;
}
}
}
return true;
}
@Override
public void remove(){
if(sound != null){