mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-14 09:47:24 +07:00
Merui swap / Bomber command support
This commit is contained in:
@ -78,11 +78,15 @@ public class CommandAI extends AIController{
|
|||||||
float engageRange = unit.type.range - 10f;
|
float engageRange = unit.type.range - 10f;
|
||||||
|
|
||||||
if(move){
|
if(move){
|
||||||
moveTo(vecOut,
|
if(unit.type.circleTarget && attackTarget != null){
|
||||||
attackTarget != null && unit.within(attackTarget, engageRange) ? engageRange :
|
circleAttack(80f);
|
||||||
unit.isGrounded() ? 0f :
|
}else{
|
||||||
attackTarget != null ? engageRange :
|
moveTo(vecOut,
|
||||||
0f, unit.isFlying() ? 40f : 100f, false, null);
|
attackTarget != null && unit.within(attackTarget, engageRange) ? engageRange :
|
||||||
|
unit.isGrounded() ? 0f :
|
||||||
|
attackTarget != null ? engageRange :
|
||||||
|
0f, unit.isFlying() ? 40f : 100f, false, null);
|
||||||
|
}
|
||||||
|
|
||||||
//calculateFlock().limit(unit.speed() * flockMult)
|
//calculateFlock().limit(unit.speed() * flockMult)
|
||||||
}
|
}
|
||||||
|
@ -15,11 +15,11 @@ public class FlyingAI extends AIController{
|
|||||||
unloadPayloads();
|
unloadPayloads();
|
||||||
|
|
||||||
if(target != null && unit.hasWeapons()){
|
if(target != null && unit.hasWeapons()){
|
||||||
if(!unit.type.circleTarget){
|
if(unit.type.circleTarget){
|
||||||
|
circleAttack(120f);
|
||||||
|
}else{
|
||||||
moveTo(target, unit.type.range * 0.8f);
|
moveTo(target, unit.type.range * 0.8f);
|
||||||
unit.lookAt(target);
|
unit.lookAt(target);
|
||||||
}else{
|
|
||||||
attack(120f);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,21 +56,4 @@ public class FlyingAI extends AIController{
|
|||||||
|
|
||||||
return core;
|
return core;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void attack(float circleLength){
|
|
||||||
vec.set(target).sub(unit);
|
|
||||||
|
|
||||||
float ang = unit.angleTo(target);
|
|
||||||
float diff = Angles.angleDist(ang, unit.rotation());
|
|
||||||
|
|
||||||
if(diff > 70f && vec.len() < circleLength){
|
|
||||||
vec.setAngle(unit.vel().angle());
|
|
||||||
}else{
|
|
||||||
vec.setAngle(Angles.moveToward(unit.vel().angle(), vec.angle(), 6f));
|
|
||||||
}
|
|
||||||
|
|
||||||
vec.setLength(unit.speed());
|
|
||||||
|
|
||||||
unit.moveAt(vec);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -4190,22 +4190,23 @@ public class Blocks{
|
|||||||
consumePower(2f);
|
consumePower(2f);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
mechFabricator = new UnitFactory("mech-fabricator"){{
|
shipFabricator = new UnitFactory("ship-fabricator"){{
|
||||||
requirements(Category.units, with(Items.silicon, 250, Items.beryllium, 200));
|
requirements(Category.units, with(Items.silicon, 250, Items.beryllium, 200));
|
||||||
|
|
||||||
size = 3;
|
size = 3;
|
||||||
configurable = false;
|
configurable = false;
|
||||||
plans.add(new UnitPlan(UnitTypes.merui, 60f * 45f, with(Items.beryllium, 50f, Items.silicon, 70f)));
|
plans.add(new UnitPlan(UnitTypes.elude, 60f * 45f, with(Items.beryllium, 50f, Items.silicon, 70f)));
|
||||||
regionSuffix = "-dark";
|
regionSuffix = "-dark";
|
||||||
fogRadius = 3;
|
fogRadius = 3;
|
||||||
researchCostMultiplier = 0.5f;
|
researchCostMultiplier = 0.5f;
|
||||||
consumePower(2f);
|
consumePower(2f);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
shipFabricator = new UnitFactory("ship-fabricator"){{
|
mechFabricator = new UnitFactory("mech-fabricator"){{
|
||||||
requirements(Category.units, with(Items.silicon, 200, Items.graphite, 300, Items.tungsten, 60));
|
requirements(Category.units, with(Items.silicon, 200, Items.graphite, 300, Items.tungsten, 60));
|
||||||
size = 3;
|
size = 3;
|
||||||
configurable = false;
|
configurable = false;
|
||||||
plans.add(new UnitPlan(UnitTypes.elude, 60f * 40f, with(Items.graphite, 40f, Items.silicon, 70f)));
|
plans.add(new UnitPlan(UnitTypes.merui, 60f * 40f, with(Items.graphite, 40f, Items.silicon, 70f)));
|
||||||
regionSuffix = "-dark";
|
regionSuffix = "-dark";
|
||||||
fogRadius = 3;
|
fogRadius = 3;
|
||||||
researchCostMultiplier = 0.65f;
|
researchCostMultiplier = 0.65f;
|
||||||
|
@ -283,13 +283,13 @@ public class ErekirTechTree{
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
node(mechFabricator, Seq.with(new OnSector(two)), () -> {
|
node(shipFabricator, Seq.with(new OnSector(two)), () -> {
|
||||||
node(UnitTypes.merui, () -> {
|
node(UnitTypes.elude, () -> {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
node(shipFabricator, Seq.with(new OnSector(three)), () -> {
|
node(mechFabricator, Seq.with(new OnSector(three)), () -> {
|
||||||
node(UnitTypes.elude, () -> {
|
node(UnitTypes.merui, () -> {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -234,6 +234,23 @@ public class AIController implements UnitController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void circleAttack(float circleLength){
|
||||||
|
vec.set(target).sub(unit);
|
||||||
|
|
||||||
|
float ang = unit.angleTo(target);
|
||||||
|
float diff = Angles.angleDist(ang, unit.rotation());
|
||||||
|
|
||||||
|
if(diff > 70f && vec.len() < circleLength){
|
||||||
|
vec.setAngle(unit.vel().angle());
|
||||||
|
}else{
|
||||||
|
vec.setAngle(Angles.moveToward(unit.vel().angle(), vec.angle(), 6f));
|
||||||
|
}
|
||||||
|
|
||||||
|
vec.setLength(unit.speed());
|
||||||
|
|
||||||
|
unit.moveAt(vec);
|
||||||
|
}
|
||||||
|
|
||||||
public void circle(Position target, float circleLength){
|
public void circle(Position target, float circleLength){
|
||||||
circle(target, circleLength, unit.speed());
|
circle(target, circleLength, unit.speed());
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ public class Weather extends UnlockableContent{
|
|||||||
|
|
||||||
public WeatherState create(float intensity, float duration){
|
public WeatherState create(float intensity, float duration){
|
||||||
WeatherState entity = type.get();
|
WeatherState entity = type.get();
|
||||||
entity.intensity(intensity);
|
entity.intensity(Mathf.clamp(intensity));
|
||||||
entity.init(this);
|
entity.init(this);
|
||||||
entity.life(duration);
|
entity.life(duration);
|
||||||
entity.add();
|
entity.add();
|
||||||
|
Reference in New Issue
Block a user