Made units self-destruct after spawner removal

This commit is contained in:
Anuken
2018-08-03 20:22:33 -04:00
parent 1dd6e66167
commit f30ea80b42
3 changed files with 10 additions and 4 deletions
@@ -329,6 +329,10 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
if(!Net.client()){
avoidOthers(8f);
if(spawner != -1 && (world.tile(spawner) == null || world.tile(spawner).entity == null)){
damage(health);
}
}
if(squad != null){
@@ -17,7 +17,7 @@ public class FortressGenerator{
private final Block[] turretBlocks = {TurretBlocks.duo, TurretBlocks.hail, TurretBlocks.wave};
private final Block[] drillBlocks = {ProductionBlocks.tungstenDrill, ProductionBlocks.carbideDrill};
private final Block[] armorBlocks = {DefenseBlocks.tungstenWall, DefenseBlocks.carbideWall, DefenseBlocks.thoriumWall};
private final int minCoreDst = 30;
private final int minCoreDst = 50;
private int enemyX, enemyY, coreX, coreY;
private Team team;
@@ -42,7 +42,7 @@ public class FortressGenerator{
for(int x = 2; x < gen.width - 2; x++){
for(int y = 2; y < gen.height - 2; y++){
if(Vector2.dst(x, y, coreX, coreY) > minCoreDst &&
gen.tiles[x][y].floor().dropsItem(ore) && gen.random.chance(0.03)){
gen.tiles[x][y].floor().dropsItem(ore) && gen.random.chance(0.02)){
int elevation = gen.tiles[x][y].getElevation();
gen.tiles[x][y].setBlock(drill, team);
@@ -31,7 +31,9 @@ public interface Mission{
float dst = Vector2.dst(wx, wy, coreX, coreY);
float elevation = gen.tiles[wx][wy].getElevation();
if(dst < lerpDst){
if(dst < 4){
elevation = targetElevation;
}else if(dst < lerpDst){
elevation = Mathf.lerp(elevation, targetElevation, Mathf.clamp(2*(1f-(dst / lerpDst))) + Noise.nnoise(wx, wy, 8f, 1f));
}