Implemented JPS badly

This commit is contained in:
Anuken
2018-04-20 19:55:41 -04:00
parent 68bfd3017b
commit 4261e6242c
23 changed files with 338 additions and 284 deletions

View File

@@ -0,0 +1,4 @@
package io.anuke.mindustry.entities.effect;
public interface BelowLiquidEffect {
}

View File

@@ -37,6 +37,7 @@ public class Puddle extends Entity implements SerializableEntity, Poolable{
private static final int maxGeneration = 2;
private static final Color tmp = new Color();
private static final Rectangle rect = new Rectangle();
private static int seeds;
private int loadedPosition = -1;
private Tile tile;
@@ -84,7 +85,7 @@ public class Puddle extends Entity implements SerializableEntity, Poolable{
}else if(p.liquid == liquid){
p.accepting = Math.max(amount, p.accepting);
if(generation == 0 && Timers.get(p, "ripple", 50) && p.amount >= maxLiquid/2f){
if(generation == 0 && Timers.get(p, "ripple2", 50) && p.amount >= maxLiquid/2f){
Effects.effect(BlockFx.ripple, p.liquid.color, (tile.worldx() + source.worldx())/2f, (tile.worldy() + source.worldy())/2f);
}
}else{
@@ -172,12 +173,18 @@ public class Puddle extends Entity implements SerializableEntity, Poolable{
@Override
public void draw() {
seeds = id;
boolean onLiquid = tile.floor().liquid;
float f = Mathf.clamp(amount/(maxLiquid/1.5f));
float smag = onLiquid ? 0.8f : 0f;
float sscl = 20f;
Draw.color(Hue.shift(tmp.set(liquid.color), 2, -0.05f));
Fill.circle(x, y, f * 8f);
Fill.circle(x + Mathf.sin(Timers.time() + seeds*532, sscl, smag), y + Mathf.sin(Timers.time() + seeds*53, sscl, smag), f * 8f);
Angles.randLenVectors(id, 3, f * 6f, (ex, ey) -> {
Fill.circle(x + ex, y + ey, f * 5f);
Fill.circle(x + ex + Mathf.sin(Timers.time() + seeds*532, sscl, smag),
y + ey + Mathf.sin(Timers.time() + seeds*53, sscl, smag), f * 5f);
seeds ++;
});
Draw.color();
}

View File

@@ -7,7 +7,7 @@ import io.anuke.ucore.util.Mathf;
import static io.anuke.mindustry.Vars.groundEffectGroup;
public class Rubble extends TimedEntity{
public class Rubble extends TimedEntity implements BelowLiquidEffect{
private static final Color color = Color.valueOf("52504e");
private int size;