slurp
This commit is contained in:
@@ -901,6 +901,15 @@ public class Fx{
|
|||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
//TODO needs a lot of work
|
||||||
|
neoplasmHeal = new Effect(120f, e -> {
|
||||||
|
color(Pal.neoplasm1, Pal.neoplasm2, e.fin());
|
||||||
|
|
||||||
|
randLenVectors(e.id, 1, e.fin() * 3f, (x, y) -> {
|
||||||
|
Fill.circle(e.x + x, e.y + y, 0.2f + e.fslope() * 2f);
|
||||||
|
});
|
||||||
|
}).followParent(true).rotWithParent(true).layer(Layer.bullet - 2),
|
||||||
|
|
||||||
steam = new Effect(35f, e -> {
|
steam = new Effect(35f, e -> {
|
||||||
color(Color.lightGray);
|
color(Color.lightGray);
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,10 @@ public class Puddles{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void deposit(Tile tile, Tile source, Liquid liquid, float amount, boolean initial){
|
public static void deposit(Tile tile, Tile source, Liquid liquid, float amount, boolean initial){
|
||||||
|
deposit(tile, source, liquid, amount, initial, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void deposit(Tile tile, Tile source, Liquid liquid, float amount, boolean initial, boolean cap){
|
||||||
if(tile == null) return;
|
if(tile == null) return;
|
||||||
|
|
||||||
float ax = (tile.worldx() + source.worldx()) / 2f, ay = (tile.worldy() + source.worldy()) / 2f;
|
float ax = (tile.worldx() + source.worldx()) / 2f, ay = (tile.worldy() + source.worldy()) / 2f;
|
||||||
@@ -51,8 +55,7 @@ public class Puddles{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(tile.floor().isLiquid && !canStayOn(liquid, tile.floor().liquidDrop)){
|
if(tile.floor().isLiquid && !canStayOn(liquid, tile.floor().liquidDrop)){
|
||||||
reactPuddle(tile.floor().liquidDrop, liquid, amount, tile,
|
reactPuddle(tile.floor().liquidDrop, liquid, amount, tile, ax, ay);
|
||||||
ax, ay);
|
|
||||||
|
|
||||||
Puddle p = map.get(tile.pos());
|
Puddle p = map.get(tile.pos());
|
||||||
|
|
||||||
@@ -82,7 +85,13 @@ public class Puddles{
|
|||||||
p.lastRipple = Time.time;
|
p.lastRipple = Time.time;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
p.amount += reactPuddle(p.liquid, liquid, amount, p.tile, (p.x + source.worldx())/2f, (p.y + source.worldy())/2f);
|
float added = reactPuddle(p.liquid, liquid, amount, p.tile, (p.x + source.worldx())/2f, (p.y + source.worldy())/2f);
|
||||||
|
|
||||||
|
if(cap){
|
||||||
|
added = Mathf.clamp(maxLiquid - p.amount, 0f, added);
|
||||||
|
}
|
||||||
|
|
||||||
|
p.amount += added;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class LiquidExplodeAbility extends Ability{
|
|||||||
public void death(Unit unit){
|
public void death(Unit unit){
|
||||||
//TODO what if noise is radial, so it looks like a splat?
|
//TODO what if noise is radial, so it looks like a splat?
|
||||||
int tx = unit.tileX(), ty = unit.tileY();
|
int tx = unit.tileX(), ty = unit.tileY();
|
||||||
int rad = (int)(unit.hitSize / tilesize * radScale);
|
int rad = Math.max((int)(unit.hitSize / tilesize * radScale), 1);
|
||||||
float realNoise = unit.hitSize / noiseMag;
|
float realNoise = unit.hitSize / noiseMag;
|
||||||
for(int x = -rad; x <= rad; x++){
|
for(int x = -rad; x <= rad; x++){
|
||||||
for(int y = -rad; y <= rad; y++){
|
for(int y = -rad; y <= rad; y++){
|
||||||
|
|||||||
@@ -1,11 +1,53 @@
|
|||||||
package mindustry.entities.abilities;
|
package mindustry.entities.abilities;
|
||||||
|
|
||||||
|
import arc.math.*;
|
||||||
|
import arc.util.*;
|
||||||
|
import mindustry.content.*;
|
||||||
|
import mindustry.entities.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
|
import mindustry.type.*;
|
||||||
|
import mindustry.world.*;
|
||||||
|
|
||||||
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class LiquidRegenAbility extends Ability{
|
public class LiquidRegenAbility extends Ability{
|
||||||
|
public Liquid liquid;
|
||||||
|
public float slurpSpeed = 9f;
|
||||||
|
public float regenPerSlurp = 2.9f;
|
||||||
|
public float slurpEffectChance = 0.4f;
|
||||||
|
public Effect slurpEffect = Fx.heal;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Unit unit){
|
public void update(Unit unit){
|
||||||
|
//TODO timer?
|
||||||
|
|
||||||
|
//TODO effects?
|
||||||
|
if(unit.damaged()){
|
||||||
|
boolean healed = false;
|
||||||
|
int tx = unit.tileX(), ty = unit.tileY();
|
||||||
|
int rad = Math.max((int)(unit.hitSize / tilesize * 0.6f), 1);
|
||||||
|
for(int x = -rad; x <= rad; x++){
|
||||||
|
for(int y = -rad; y <= rad; y++){
|
||||||
|
if(x*x + y*y <= rad*rad){
|
||||||
|
|
||||||
|
Tile tile = world.tile(tx + x, ty + y);
|
||||||
|
if(tile != null){
|
||||||
|
Puddle puddle = Puddles.get(tile);
|
||||||
|
if(puddle != null && puddle.liquid == liquid){
|
||||||
|
float fractionTaken = Math.min(puddle.amount, (slurpSpeed * Time.delta));
|
||||||
|
puddle.amount -= Math.min(puddle.amount, slurpSpeed * Time.delta);
|
||||||
|
unit.heal(fractionTaken * regenPerSlurp);
|
||||||
|
healed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(healed && Mathf.chanceDelta(slurpEffectChance)){
|
||||||
|
Tmp.v1.rnd(Mathf.random(unit.hitSize/2f));
|
||||||
|
slurpEffect.at(unit.x + Tmp.v1.x, unit.y + Tmp.v1.y, unit.rotation, unit);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -606,7 +606,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
return moveLiquid(next.build, liquid);
|
return moveLiquid(next.build, liquid);
|
||||||
}else if(leaks && !next.block().solid && !next.block().hasLiquids){
|
}else if(leaks && !next.block().solid && !next.block().hasLiquids){
|
||||||
float leakAmount = liquids.get(liquid) / 1.5f;
|
float leakAmount = liquids.get(liquid) / 1.5f;
|
||||||
Puddles.deposit(next, tile, liquid, leakAmount);
|
Puddles.deposit(next, tile, liquid, leakAmount, true, true);
|
||||||
liquids.remove(liquid, leakAmount);
|
liquids.remove(liquid, leakAmount);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -105,6 +105,9 @@ public class Pal{
|
|||||||
|
|
||||||
neoplasmOutline = Color.valueOf("2e191d"),
|
neoplasmOutline = Color.valueOf("2e191d"),
|
||||||
|
|
||||||
|
neoplasm1 = Color.valueOf("f98f4a"),
|
||||||
|
neoplasm2 = Color.valueOf("9e172c"),
|
||||||
|
|
||||||
logicBlocks = Color.valueOf("d4816b"),
|
logicBlocks = Color.valueOf("d4816b"),
|
||||||
logicControl = Color.valueOf("6bb2b2"),
|
logicControl = Color.valueOf("6bb2b2"),
|
||||||
logicOperations = Color.valueOf("877bad"),
|
logicOperations = Color.valueOf("877bad"),
|
||||||
|
|||||||
@@ -22,6 +22,11 @@ public class NeoplasmUnitType extends UnitType{
|
|||||||
liquid = Liquids.neoplasm;
|
liquid = Liquids.neoplasm;
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
abilities.add(new LiquidRegenAbility(){{
|
||||||
|
liquid = Liquids.neoplasm;
|
||||||
|
slurpEffect = Fx.neoplasmHeal;
|
||||||
|
}});
|
||||||
|
|
||||||
//green flashing is unnecessary since they always regen
|
//green flashing is unnecessary since they always regen
|
||||||
showHeal = false;
|
showHeal = false;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user