Bugfixes
This commit is contained in:
@@ -6,6 +6,8 @@ import mindustry.entities.*;
|
|||||||
import mindustry.entities.units.*;
|
import mindustry.entities.units.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
|
import mindustry.world.blocks.distribution.*;
|
||||||
|
import mindustry.world.blocks.liquid.*;
|
||||||
import mindustry.world.meta.*;
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
public class SuicideAI extends GroundAI{
|
public class SuicideAI extends GroundAI{
|
||||||
@@ -14,7 +16,7 @@ public class SuicideAI extends GroundAI{
|
|||||||
@Override
|
@Override
|
||||||
public void updateUnit(){
|
public void updateUnit(){
|
||||||
|
|
||||||
if(Units.invalidateTarget(target, unit.team(), unit.x(), unit.y(), Float.MAX_VALUE)){
|
if(Units.invalidateTarget(target, unit.team, unit.x, unit.y, Float.MAX_VALUE)){
|
||||||
target = null;
|
target = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,29 +37,32 @@ public class SuicideAI extends GroundAI{
|
|||||||
unit.aimLook(Predict.intercept(unit, target, unit.type().weapons.first().bullet.speed));
|
unit.aimLook(Predict.intercept(unit, target, unit.type().weapons.first().bullet.speed));
|
||||||
}
|
}
|
||||||
|
|
||||||
blockedByBlock = false;
|
//do not move toward walls or transport blocks
|
||||||
|
if(!(target instanceof Building build && (build.block.group == BlockGroup.walls || build.block.group == BlockGroup.liquids || build.block.group == BlockGroup.transportation))){
|
||||||
|
blockedByBlock = false;
|
||||||
|
|
||||||
//raycast for target
|
//raycast for target
|
||||||
boolean blocked = Vars.world.raycast(unit.tileX(), unit.tileY(), target.tileX(), target.tileY(), (x, y) -> {
|
boolean blocked = Vars.world.raycast(unit.tileX(), unit.tileY(), target.tileX(), target.tileY(), (x, y) -> {
|
||||||
Tile tile = Vars.world.tile(x, y);
|
Tile tile = Vars.world.tile(x, y);
|
||||||
if(tile != null && tile.build == target) return false;
|
if(tile != null && tile.build == target) return false;
|
||||||
if(tile != null && tile.build != null && tile.build.team != unit.team()){
|
if(tile != null && tile.build != null && tile.build.team != unit.team()){
|
||||||
blockedByBlock = true;
|
blockedByBlock = true;
|
||||||
return true;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
return tile == null || tile.solid();
|
return tile == null || tile.solid();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//shoot when there's an enemy block in the way
|
||||||
|
if(blockedByBlock){
|
||||||
|
shoot = true;
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
//shoot when there's an enemy block in the way
|
if(!blocked){
|
||||||
if(blockedByBlock){
|
moveToTarget = true;
|
||||||
shoot = true;
|
//move towards target directly
|
||||||
}
|
unit.moveAt(vec.set(target).sub(unit).limit(unit.type().speed));
|
||||||
|
}
|
||||||
if(!blocked){
|
|
||||||
moveToTarget = true;
|
|
||||||
//move towards target directly
|
|
||||||
unit.moveAt(vec.set(target).sub(unit).limit(unit.type().speed));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -78,4 +83,10 @@ public class SuicideAI extends GroundAI{
|
|||||||
|
|
||||||
unit.controlWeapons(rotate, shoot);
|
unit.controlWeapons(rotate, shoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Teamc target(float x, float y, float range, boolean air, boolean ground){
|
||||||
|
return Units.closestTarget(unit.team, x, y, range, u -> u.checkTarget(air, ground), t -> ground &&
|
||||||
|
!(t.block instanceof Conveyor || t.block instanceof Conduit)); //do not target conveyors/conduits
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -514,7 +514,7 @@ public class UnitTypes implements ContentList{
|
|||||||
crawler = new UnitType("crawler"){{
|
crawler = new UnitType("crawler"){{
|
||||||
defaultController = SuicideAI::new;
|
defaultController = SuicideAI::new;
|
||||||
|
|
||||||
speed = 0.92f;
|
speed = 1f;
|
||||||
hitSize = 8f;
|
hitSize = 8f;
|
||||||
health = 180;
|
health = 180;
|
||||||
mechSideSway = 0.25f;
|
mechSideSway = 0.25f;
|
||||||
@@ -529,9 +529,9 @@ public class UnitTypes implements ContentList{
|
|||||||
hitEffect = Fx.pulverize;
|
hitEffect = Fx.pulverize;
|
||||||
lifetime = 10f;
|
lifetime = 10f;
|
||||||
speed = 1f;
|
speed = 1f;
|
||||||
splashDamageRadius = 55f;
|
splashDamageRadius = 70f;
|
||||||
instantDisappear = true;
|
instantDisappear = true;
|
||||||
splashDamage = 60f;
|
splashDamage = 80f;
|
||||||
killShooter = true;
|
killShooter = true;
|
||||||
hittable = false;
|
hittable = false;
|
||||||
collidesAir = true;
|
collidesAir = true;
|
||||||
@@ -1187,8 +1187,6 @@ public class UnitTypes implements ContentList{
|
|||||||
healPercent = 5.5f;
|
healPercent = 5.5f;
|
||||||
collidesTeam = true;
|
collidesTeam = true;
|
||||||
backColor = Pal.heal;
|
backColor = Pal.heal;
|
||||||
frontColor = Color.white;
|
|
||||||
backColor = Pal.heal;
|
|
||||||
trailColor = Pal.heal;
|
trailColor = Pal.heal;
|
||||||
}};
|
}};
|
||||||
}});
|
}});
|
||||||
@@ -1233,7 +1231,7 @@ public class UnitTypes implements ContentList{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
quad = new UnitType("quad"){{
|
quad = new UnitType("quad"){{
|
||||||
armor = 4f;
|
armor = 6f;
|
||||||
health = 6000;
|
health = 6000;
|
||||||
speed = 1.2f;
|
speed = 1.2f;
|
||||||
rotateSpeed = 2f;
|
rotateSpeed = 2f;
|
||||||
@@ -1256,7 +1254,7 @@ public class UnitTypes implements ContentList{
|
|||||||
new Weapon(){{
|
new Weapon(){{
|
||||||
x = y = 0f;
|
x = y = 0f;
|
||||||
mirror = false;
|
mirror = false;
|
||||||
reload = 60f;
|
reload = 55f;
|
||||||
minShootVelocity = 0.01f;
|
minShootVelocity = 0.01f;
|
||||||
|
|
||||||
bullet = new BasicBulletType(){{
|
bullet = new BasicBulletType(){{
|
||||||
@@ -1289,9 +1287,9 @@ public class UnitTypes implements ContentList{
|
|||||||
speed = 0.001f;
|
speed = 0.001f;
|
||||||
collides = false;
|
collides = false;
|
||||||
|
|
||||||
healPercent = 10f;
|
healPercent = 15f;
|
||||||
splashDamage = 240f;
|
splashDamage = 320f;
|
||||||
splashDamageRadius = 115f;
|
splashDamageRadius = 120f;
|
||||||
}};
|
}};
|
||||||
}});
|
}});
|
||||||
}};
|
}};
|
||||||
|
|||||||
@@ -603,7 +603,7 @@ public class ContentParser{
|
|||||||
customRequirements = null;
|
customRequirements = null;
|
||||||
}else{
|
}else{
|
||||||
researchName = research.getString("parent");
|
researchName = research.getString("parent");
|
||||||
customRequirements = research.hasChild("requirements") ? parser.readValue(ItemStack[].class, research.getChild("requirements")) : null;
|
customRequirements = research.has("requirements") ? parser.readValue(ItemStack[].class, research.get("requirements")) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//remove old node
|
//remove old node
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class Wall extends Block{
|
|||||||
solid = true;
|
solid = true;
|
||||||
destructible = true;
|
destructible = true;
|
||||||
group = BlockGroup.walls;
|
group = BlockGroup.walls;
|
||||||
buildCostMultiplier = 5f;
|
buildCostMultiplier = 6f;
|
||||||
canOverdrive = false;
|
canOverdrive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user