Fixed #1436 / Fixed crawlers not exploding

This commit is contained in:
Anuken
2020-01-24 23:21:23 -05:00
parent 081edde1f2
commit 923d576a5f
4 changed files with 15 additions and 7 deletions

View File

@@ -103,9 +103,10 @@ public class UnitTypes implements ContentList{
shootSound = Sounds.explosion; shootSound = Sounds.explosion;
bullet = new BombBulletType(2f, 3f, "clear"){{ bullet = new BombBulletType(2f, 3f, "clear"){{
hitEffect = Fx.pulverize; hitEffect = Fx.pulverize;
lifetime = 2f; lifetime = 30f;
speed = 1.1f; speed = 1.1f;
splashDamageRadius = 55f; splashDamageRadius = 55f;
instantDisappear = true;
splashDamage = 30f; splashDamage = 30f;
killShooter = true; killShooter = true;
}}; }};
@@ -126,7 +127,6 @@ public class UnitTypes implements ContentList{
shootSound = Sounds.flame; shootSound = Sounds.flame;
length = 1f; length = 1f;
reload = 14f; reload = 14f;
range = 30f;
alternate = true; alternate = true;
recoil = 1f; recoil = 1f;
ejectEffect = Fx.none; ejectEffect = Fx.none;

View File

@@ -3,8 +3,7 @@ package mindustry.entities.bullet;
import arc.audio.*; import arc.audio.*;
import arc.math.*; import arc.math.*;
import mindustry.content.*; import mindustry.content.*;
import mindustry.ctype.Content; import mindustry.ctype.*;
import mindustry.ctype.ContentType;
import mindustry.entities.*; import mindustry.entities.*;
import mindustry.entities.Effects.*; import mindustry.entities.Effects.*;
import mindustry.entities.effect.*; import mindustry.entities.effect.*;
@@ -41,7 +40,9 @@ public abstract class BulletType extends Content{
public float recoil; public float recoil;
/** Whether to kill the shooter when this is shot. For suicide bombers. */ /** Whether to kill the shooter when this is shot. For suicide bombers. */
public boolean killShooter; public boolean killShooter;
/** Whether to instantly make the bullet disappear. */
public boolean instantDisappear;
/** Damage dealt in splash. 0 to disable.*/
public float splashDamage = 0f; public float splashDamage = 0f;
/** Knockback in velocity. */ /** Knockback in velocity. */
public float knockback; public float knockback;
@@ -151,6 +152,10 @@ public abstract class BulletType extends Content{
if(killShooter && b.getOwner() instanceof HealthTrait){ if(killShooter && b.getOwner() instanceof HealthTrait){
((HealthTrait)b.getOwner()).kill(); ((HealthTrait)b.getOwner()).kill();
} }
if(instantDisappear){
b.time(lifetime);
}
} }
public void update(Bullet b){ public void update(Bullet b){

View File

@@ -42,7 +42,6 @@ public class GroundUnit extends BaseUnit{
moveToCore(PathTarget.enemyCores); moveToCore(PathTarget.enemyCores);
} }
}else{ }else{
float dst = dst(core); float dst = dst(core);
if(dst < getWeapon().bullet.range() / 1.1f){ if(dst < getWeapon().bullet.range() / 1.1f){
@@ -170,6 +169,7 @@ public class GroundUnit extends BaseUnit{
if(!Units.invalidateTarget(target, this)){ if(!Units.invalidateTarget(target, this)){
if(dst(target) < getWeapon().bullet.range()){ if(dst(target) < getWeapon().bullet.range()){
rotate(angleTo(target)); rotate(angleTo(target));
if(Angles.near(angleTo(target), rotation, 13f)){ if(Angles.near(angleTo(target), rotation, 13f)){

View File

@@ -182,8 +182,11 @@ public class PowerNode extends PowerBlock{
if(tile == other){ if(tile == other){
if(other.entity.power.links.size == 0){ if(other.entity.power.links.size == 0){
int[] total = {0};
getPotentialLinks(tile, link -> { getPotentialLinks(tile, link -> {
if(!insulated(tile, link)) tile.configure(link.pos()); if(!insulated(tile, link) && total[0]++ < maxNodes){
tile.configure(link.pos());
}
}); });
}else{ }else{
while(entity.power.links.size > 0){ while(entity.power.links.size > 0){