Space 'puddles'
This commit is contained in:
@@ -26,7 +26,7 @@ public class Bullets implements ContentList{
|
||||
standardDenseBig, standardThoriumBig, standardIncendiaryBig,
|
||||
|
||||
//liquid
|
||||
waterShot, cryoShot, slagShot, oilShot, heavyWaterShot, heavyCryoShot, heavySlagShot, heavyOilShot,
|
||||
waterShot, cryoShot, slagShot, oilShot, heavyWaterShot, heavyCryoShot, heavySlagShot, heavyOilShot, spaceLiquid,
|
||||
|
||||
//environment, misc.
|
||||
damageLightning, damageLightningGround, fireball, basicFlame, pyraFlame;
|
||||
@@ -476,5 +476,10 @@ public class Bullets implements ContentList{
|
||||
statusDuration = 60f * 4f;
|
||||
damage = 0.2f;
|
||||
}};
|
||||
|
||||
spaceLiquid = new SpaceLiquidBulletType(){{
|
||||
knockback = 0.7f;
|
||||
drag = 0.01f;
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ public class Liquids implements ContentList{
|
||||
heatCapacity = 0.7f;
|
||||
barColor = Color.valueOf("6b675f");
|
||||
effect = StatusEffects.tarred;
|
||||
boilPoint = 0.65f;
|
||||
gasColor = Color.grays(0.4f);
|
||||
}};
|
||||
|
||||
cryofluid = new Liquid("cryofluid", Color.valueOf("6ecdec")){{
|
||||
|
||||
@@ -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{
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package mindustry.entities.bullet;
|
||||
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
|
||||
//this should probably be an effect?
|
||||
public class SpaceLiquidBulletType extends BulletType{
|
||||
public float orbSize = 5.5f;
|
||||
|
||||
public SpaceLiquidBulletType(){
|
||||
super(3.5f, 0);
|
||||
|
||||
collides = false;
|
||||
lifetime = 90f;
|
||||
despawnEffect = Fx.none;
|
||||
hitEffect = Fx.none;
|
||||
smokeEffect = Fx.none;
|
||||
shootEffect = Fx.none;
|
||||
drag = 0.001f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float range(){
|
||||
return speed * lifetime / 2f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Bullet b){
|
||||
super.update(b);
|
||||
|
||||
if(!(b.data instanceof Liquid liquid)) return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Bullet b){
|
||||
super.draw(b);
|
||||
|
||||
if(!(b.data instanceof Liquid liquid)) return;
|
||||
|
||||
Draw.color(liquid.color);
|
||||
Fill.circle(b.x, b.y, Interp.pow3Out.apply(b.fslope()) * orbSize);
|
||||
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void despawned(Bullet b){
|
||||
super.despawned(b);
|
||||
|
||||
if(!(b.data instanceof Liquid liquid)) return;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user