Made wave extinguish fires / Buffed fire
This commit is contained in:
@@ -7,6 +7,7 @@ import io.anuke.mindustry.content.fx.Fx;
|
||||
import io.anuke.mindustry.entities.effect.Fire;
|
||||
import io.anuke.mindustry.entities.effect.Puddle;
|
||||
import io.anuke.mindustry.type.Liquid;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Fill;
|
||||
@@ -30,6 +31,20 @@ public class LiquidBulletType extends BulletType{
|
||||
knockback = 0.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Bullet b) {
|
||||
super.update(b);
|
||||
|
||||
if(liquid.canExtinguish()){
|
||||
Tile tile = world.tileWorld(b.x, b.y);
|
||||
if(Fire.has(tile.x, tile.y) && tile != null){
|
||||
Fire.extinguish(tile, 100f);
|
||||
b.remove();
|
||||
hit(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Bullet b){
|
||||
Draw.color(liquid.color, Color.WHITE, b.fout() / 100f + Mathf.randomSeedRange(b.id, 0.1f));
|
||||
|
||||
@@ -33,6 +33,7 @@ import static io.anuke.mindustry.Vars.*;
|
||||
public class Fire extends TimedEntity implements SaveTrait, SyncTrait, Poolable{
|
||||
private static final IntMap<Fire> map = new IntMap<>();
|
||||
private static final float baseLifetime = 1000f;
|
||||
private static final float spreadChance = 0.05f, fireballChance = 0.07f;
|
||||
|
||||
private int loadedPosition = -1;
|
||||
private Tile tile;
|
||||
@@ -67,6 +68,10 @@ public class Fire extends TimedEntity implements SaveTrait, SyncTrait, Poolable{
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean has(int x, int y){
|
||||
return Mathf.inBounds(x, y, world.width(), world.height()) && map.containsKey(x + y * world.width());
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to extinguish a fire by shortening its life. If there is no fire here, does nothing.
|
||||
*/
|
||||
@@ -126,12 +131,12 @@ public class Fire extends TimedEntity implements SaveTrait, SyncTrait, Poolable{
|
||||
lifetime += Mathf.clamp(flammability / 8f, 0f, 0.6f) * Timers.delta();
|
||||
}
|
||||
|
||||
if(flammability > 1f && Mathf.chance(0.03 * Timers.delta() * Mathf.clamp(flammability / 5f, 0.3f, 2f))){
|
||||
if(flammability > 1f && Mathf.chance(spreadChance * Timers.delta() * Mathf.clamp(flammability / 5f, 0.3f, 2f))){
|
||||
GridPoint2 p = Mathf.select(Geometry.d4);
|
||||
Tile other = world.tile(tile.x + p.x, tile.y + p.y);
|
||||
create(other);
|
||||
|
||||
if(Mathf.chance(0.05 * Timers.delta() * Mathf.clamp(flammability / 10.0))){
|
||||
if(Mathf.chance(fireballChance * Timers.delta() * Mathf.clamp(flammability / 10.0))){
|
||||
Call.createBullet(TurretBullets.fireball, x, y, Mathf.random(360f));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user