Minor refactoring & tech tree fixes

This commit is contained in:
Anuken
2022-03-10 22:04:59 -05:00
parent 3847434c42
commit 96329b9b2e
6 changed files with 11 additions and 12 deletions

View File

@ -270,10 +270,10 @@ public class ErekirTechTree{
});
node(tankReconstructor, () -> {
node(tankReconstructor, Seq.with(new OnSector(three)), () -> {
node(UnitTypes.locus);
node(shipReconstructor, () -> {
node(shipReconstructor, Seq.with(new OnSector(four)), () -> {
node(UnitTypes.avert);
node(mechReconstructor, () -> {

View File

@ -146,6 +146,7 @@ public class Planets{
minZoom = 0.6f;
drawOrbit = false;
clipRadius = 2f;
defaultEnv = Env.space;
generator = new AsteroidGenerator();
cgen.get((AsteroidGenerator)generator);

View File

@ -1245,7 +1245,7 @@ public class UnitTypes{
//region air support
mono = new UnitType("mono"){{
defaultController = u -> new MinerAI();
controller = u -> new MinerAI();
flying = true;
drag = 0.06f;
@ -1264,7 +1264,7 @@ public class UnitTypes{
}};
poly = new UnitType("poly"){{
defaultController = u -> new BuilderAI();
controller = u -> new BuilderAI();
flying = true;
drag = 0.05f;
@ -3418,7 +3418,7 @@ public class UnitTypes{
//TODO bad name
evoke = new ErekirUnitType("evoke"){{
coreUnitDock = true;
defaultController = u -> new BuilderAI(true, coreFleeRange);
controller = u -> new BuilderAI(true, coreFleeRange);
isCounted = false;
envDisabled = 0;
@ -3478,7 +3478,7 @@ public class UnitTypes{
incite = new ErekirUnitType("incite"){{
coreUnitDock = true;
defaultController = u -> new BuilderAI(true, coreFleeRange);
controller = u -> new BuilderAI(true, coreFleeRange);
isCounted = false;
envDisabled = 0;
@ -3551,7 +3551,7 @@ public class UnitTypes{
emanate = new ErekirUnitType("emanate"){{
coreUnitDock = true;
defaultController = u -> new BuilderAI(true, coreFleeRange);
controller = u -> new BuilderAI(true, coreFleeRange);
isCounted = false;
envDisabled = 0;

View File

@ -10,7 +10,6 @@ import mindustry.graphics.g3d.*;
import mindustry.maps.generators.*;
import mindustry.type.*;
import mindustry.world.blocks.environment.*;
import mindustry.world.meta.*;
import static mindustry.Vars.*;
@ -142,7 +141,6 @@ public class AsteroidGenerator extends BlankPlanetGenerator{
state.rules.dragMultiplier = 0.7f; //yes, space actually has 0 drag but true 0% drag is very annoying
state.rules.borderDarkness = false;
state.rules.env = Env.space;
state.rules.waves = true;
//TODO ???

View File

@ -471,7 +471,7 @@ public class ContentParser{
}
if(value.has("defaultController")){
unit.defaultController = u -> supply(resolve(value.getString("defaultController"), FlyingAI.class)).get();
unit.controller = u -> supply(resolve(value.getString("defaultController"), FlyingAI.class)).get();
value.remove("defaultController");
}

View File

@ -114,7 +114,7 @@ public class UnitType extends UnlockableContent{
/** The default AI controller to assign on creation. */
public Prov<? extends UnitController> aiController = () -> !flying ? new GroundAI() : new FlyingAI();
/** Function that chooses AI controller based on unit entity. */
public Func<Unit, ? extends UnitController> defaultController = u -> !playerControllable || (u.team.isAI() && !u.team.rules().rtsAi) ? aiController.get() : new CommandAI();
public Func<Unit, ? extends UnitController> controller = u -> !playerControllable || (u.team.isAI() && !u.team.rules().rtsAi) ? aiController.get() : new CommandAI();
public Color outlineColor = Pal.darkerMetal;
public int outlineRadius = 3;
@ -219,7 +219,7 @@ public class UnitType extends UnlockableContent{
}
public UnitController createController(Unit unit){
return defaultController.get(unit);
return controller.get(unit);
}
public Unit create(Team team){