Space 'puddles'
This commit is contained in:
@@ -3,11 +3,13 @@ package mindustry.entities;
|
||||
import arc.math.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
public class Puddles{
|
||||
private static final IntMap<Puddle> map = new IntMap<>();
|
||||
@@ -32,21 +34,30 @@ public class Puddles{
|
||||
public static void deposit(Tile tile, Tile source, Liquid liquid, float amount, boolean initial){
|
||||
if(tile == null) return;
|
||||
|
||||
float ax = (tile.worldx() + source.worldx()) / 2f, ay = (tile.worldy() + source.worldy()) / 2f;
|
||||
|
||||
if(liquid.willBoil()){
|
||||
if(Mathf.chanceDelta(0.16f)){
|
||||
liquid.vaporEffect.at((tile.worldx() + source.worldx()) / 2f, (tile.worldy() + source.worldy()) / 2f, liquid.gasColor);
|
||||
liquid.vaporEffect.at(ax, ay, liquid.gasColor);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if(Vars.state.rules.hasEnv(Env.space)){
|
||||
if(Mathf.chanceDelta(0.11f) && tile != source){
|
||||
Bullets.spaceLiquid.create(null, source.team(), ax, ay, source.angleTo(tile) + Mathf.range(50f), -1f, Mathf.random(0f, 0.2f), Mathf.random(0.6f, 1f), liquid);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if(tile.floor().isLiquid && !canStayOn(liquid, tile.floor().liquidDrop)){
|
||||
reactPuddle(tile.floor().liquidDrop, liquid, amount, tile,
|
||||
(tile.worldx() + source.worldx()) / 2f, (tile.worldy() + source.worldy()) / 2f);
|
||||
ax, ay);
|
||||
|
||||
Puddle p = map.get(tile.pos());
|
||||
|
||||
if(initial && p != null && p.lastRipple <= Time.time - 40f){
|
||||
Fx.ripple.at((tile.worldx() + source.worldx()) / 2f, (tile.worldy() + source.worldy()) / 2f, 1f, tile.floor().liquidDrop.color);
|
||||
Fx.ripple.at(ax, ay, 1f, tile.floor().liquidDrop.color);
|
||||
p.lastRipple = Time.time;
|
||||
}
|
||||
return;
|
||||
@@ -60,14 +71,14 @@ public class Puddles{
|
||||
puddle.tile = tile;
|
||||
puddle.liquid = liquid;
|
||||
puddle.amount = amount;
|
||||
puddle.set((tile.worldx() + source.worldx()) / 2f, (tile.worldy() + source.worldy()) / 2f);
|
||||
puddle.set(ax, ay);
|
||||
map.put(tile.pos(), puddle);
|
||||
puddle.add();
|
||||
}else if(p.liquid == liquid){
|
||||
p.accepting = Math.max(amount, p.accepting);
|
||||
|
||||
if(initial && p.lastRipple <= Time.time - 40f && p.amount >= maxLiquid / 2f){
|
||||
Fx.ripple.at((tile.worldx() + source.worldx()) / 2f, (tile.worldy() + source.worldy()) / 2f, 1f, p.liquid.color);
|
||||
Fx.ripple.at(ax, ay, 1f, p.liquid.color);
|
||||
p.lastRipple = Time.time;
|
||||
}
|
||||
}else{
|
||||
|
||||
Reference in New Issue
Block a user