Edge cleanup / Spawn warn / Bugfixes

This commit is contained in:
Anuken
2019-01-29 11:51:41 -05:00
parent 76af3e3077
commit d268d94f76
8 changed files with 48 additions and 8 deletions

View File

@@ -24,6 +24,7 @@ import java.io.IOException;
import static io.anuke.mindustry.Vars.*;
public class WaveSpawner{
private static final float shockwaveBase = 350f, shockwaveRand = 10f, maxShockwaveDst = shockwaveBase + shockwaveRand;
private Array<SpawnGroup> groups;
private Array<FlyerSpawn> flySpawns = new Array<>();
private Array<GroundSpawn> groundSpawns = new Array<>();
@@ -52,6 +53,11 @@ public class WaveSpawner{
}
}
/**@return true if the player is near a ground spawn point.*/
public boolean playerNear(){
return groundSpawns.count(g -> Mathf.dst(g.x * tilesize, g.y * tilesize, players[0].x, players[0].y) < maxShockwaveDst) > 0;
}
public void spawnEnemies(){
for(SpawnGroup group : groups){
@@ -98,7 +104,7 @@ public class WaveSpawner{
}
Time.run(20f, () -> Effects.effect(Fx.spawnShockwave, spawn.x * tilesize, spawn.y * tilesize));
//would be interesting to see player structures survive this without hacks
Time.run(40f, () -> Damage.damage(waveTeam, spawn.x * tilesize, spawn.y * tilesize, 350f + Mathf.random(80f), 99999999f));
Time.run(40f, () -> Damage.damage(waveTeam, spawn.x * tilesize, spawn.y * tilesize, shockwaveBase + Mathf.random(shockwaveRand), 99999999f));
}
}
}