Environmental lights / Bugfixes

This commit is contained in:
Anuken
2020-07-08 12:40:17 -04:00
parent a9333baa78
commit c15aec641a
7 changed files with 49 additions and 9 deletions

View File

@@ -146,6 +146,14 @@ public class Block extends UnlockableContent{
public Sound breakSound = Sounds.boom;
/** How reflective this block is. */
public float albedo = 0f;
/** Environmental passive light color. */
public Color lightColor = Color.white.cpy();
/**
* Whether this environmental block passively emits light.
* Not valid for non-environmental blocks. */
public boolean emitLight = false;
/** Radius of the light emitted by this block. */
public float lightRadius = 60f;
/** The sound that this block makes while active. One sound loop. Do not overuse.*/
public Sound activeSound = Sounds.none;
@@ -212,6 +220,10 @@ public class Block extends UnlockableContent{
.sumf(other -> !other.floor().isLiquid ? 1f : 0f) / size / size;
}
public void drawEnvironmentLight(Tile tile){
Drawf.light(tile.worldx(), tile.worldy(), lightRadius, lightColor, lightColor.a);
}
/** Drawn when you are placing a block. */
public void drawPlace(int x, int y, int rotation, boolean valid){
}