mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-22 21:57:58 +07:00
Made units self-destruct after spawner removal
This commit is contained in:
@ -329,6 +329,10 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
|||||||
|
|
||||||
if(!Net.client()){
|
if(!Net.client()){
|
||||||
avoidOthers(8f);
|
avoidOthers(8f);
|
||||||
|
|
||||||
|
if(spawner != -1 && (world.tile(spawner) == null || world.tile(spawner).entity == null)){
|
||||||
|
damage(health);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(squad != null){
|
if(squad != null){
|
||||||
|
@ -17,7 +17,7 @@ public class FortressGenerator{
|
|||||||
private final Block[] turretBlocks = {TurretBlocks.duo, TurretBlocks.hail, TurretBlocks.wave};
|
private final Block[] turretBlocks = {TurretBlocks.duo, TurretBlocks.hail, TurretBlocks.wave};
|
||||||
private final Block[] drillBlocks = {ProductionBlocks.tungstenDrill, ProductionBlocks.carbideDrill};
|
private final Block[] drillBlocks = {ProductionBlocks.tungstenDrill, ProductionBlocks.carbideDrill};
|
||||||
private final Block[] armorBlocks = {DefenseBlocks.tungstenWall, DefenseBlocks.carbideWall, DefenseBlocks.thoriumWall};
|
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 int enemyX, enemyY, coreX, coreY;
|
||||||
private Team team;
|
private Team team;
|
||||||
@ -42,7 +42,7 @@ public class FortressGenerator{
|
|||||||
for(int x = 2; x < gen.width - 2; x++){
|
for(int x = 2; x < gen.width - 2; x++){
|
||||||
for(int y = 2; y < gen.height - 2; y++){
|
for(int y = 2; y < gen.height - 2; y++){
|
||||||
if(Vector2.dst(x, y, coreX, coreY) > minCoreDst &&
|
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();
|
int elevation = gen.tiles[x][y].getElevation();
|
||||||
gen.tiles[x][y].setBlock(drill, team);
|
gen.tiles[x][y].setBlock(drill, team);
|
||||||
|
@ -26,12 +26,14 @@ public interface Mission{
|
|||||||
int lerpDst = 20;
|
int lerpDst = 20;
|
||||||
for(int x = -lerpDst; x <= lerpDst; x++){
|
for(int x = -lerpDst; x <= lerpDst; x++){
|
||||||
for(int y = -lerpDst; y <= lerpDst; y++){
|
for(int y = -lerpDst; y <= lerpDst; y++){
|
||||||
int wx = gen.width/2 + x, wy = gen.height/2 + y;
|
int wx = gen.width / 2 + x, wy = gen.height / 2 + y;
|
||||||
|
|
||||||
float dst = Vector2.dst(wx, wy, coreX, coreY);
|
float dst = Vector2.dst(wx, wy, coreX, coreY);
|
||||||
float elevation = gen.tiles[wx][wy].getElevation();
|
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));
|
elevation = Mathf.lerp(elevation, targetElevation, Mathf.clamp(2*(1f-(dst / lerpDst))) + Noise.nnoise(wx, wy, 8f, 1f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user