Time to begin adding the new units

This commit is contained in:
Anuken
2022-04-30 18:08:40 -04:00
parent fe62e1b6e3
commit 59be28b5eb
22 changed files with 151 additions and 58 deletions

View File

@@ -139,8 +139,11 @@ public class Blocks{
repairPoint, repairTurret,
//units - erekir
fabricator,
tankReconstructor, shipReconstructor, mechReconstructor,
tankFabricator, shipFabricator, mechFabricator,
basicReconstructor,
//tankReconstructor, shipReconstructor, mechReconstructor,
tankAssembler, shipAssembler, mechAssembler,
//TODO maybe making it 5x5 would be more appropriate, seems kinda cheap.
basicAssemblerModule,
@@ -4141,7 +4144,7 @@ public class Blocks{
//endregion
//region units - erekir
fabricator = new UnitFactory("fabricator"){{
tankFabricator = new UnitFactory("tank-fabricator"){{
requirements(Category.units, with(Items.silicon, 200, Items.beryllium, 150));
size = 3;
configurable = false;
@@ -4152,6 +4155,48 @@ public class Blocks{
consumePower(2f);
}};
mechFabricator = new UnitFactory("mech-fabricator"){{
requirements(Category.units, with(Items.silicon, 200, Items.beryllium, 150));
size = 3;
configurable = false;
plans.add(new UnitPlan(UnitTypes.merui, 60f * 35f, with(Items.beryllium, 40f, Items.silicon, 50f)));
researchCost = with(Items.beryllium, 200, Items.graphite, 80, Items.silicon, 80);
regionSuffix = "-dark";
fogRadius = 3;
consumePower(2f);
}};
shipFabricator = new UnitFactory("ship-fabricator"){{
requirements(Category.units, with(Items.silicon, 200, Items.beryllium, 150));
size = 3;
configurable = false;
plans.add(new UnitPlan(UnitTypes.osc, 60f * 35f, with(Items.beryllium, 40f, Items.silicon, 50f)));
researchCost = with(Items.beryllium, 200, Items.graphite, 80, Items.silicon, 80);
regionSuffix = "-dark";
fogRadius = 3;
consumePower(2f);
}};
basicReconstructor = new Reconstructor("basic-reconstructor"){{
requirements(Category.units, with(Items.beryllium, 250, Items.tungsten, 120, Items.silicon, 150));
regionSuffix = "-dark";
size = 3;
consumePower(2f);
consumeLiquid(Liquids.hydrogen, 3f / 60f);
consumeItems(with(Items.silicon, 50, Items.tungsten, 40));
constructTime = 60f * 40f;
researchCostMultiplier = 0.75f;
upgrades.addAll(
new UnitType[]{UnitTypes.stell, UnitTypes.locus},
new UnitType[]{UnitTypes.merui, UnitTypes.latum},
new UnitType[]{UnitTypes.osc, UnitTypes.avert}
);
}};
/*
mechReconstructor = new Reconstructor("mech-reconstructor"){{
requirements(Category.units, with(Items.beryllium, 250, Items.tungsten, 120, Items.silicon, 150));
regionSuffix = "-dark";
@@ -4199,7 +4244,7 @@ public class Blocks{
upgrades.addAll(
new UnitType[]{UnitTypes.stell, UnitTypes.locus}
);
}};
}};*/
tankAssembler = new UnitAssembler("tank-assembler"){{
requirements(Category.units, with(Items.graphite, 600, Items.beryllium, 600, Items.oxide, 250, Items.tungsten, 400, Items.silicon, 500));

View File

@@ -188,7 +188,7 @@ public class ErekirTechTree{
node(cliffCrusher, () -> {
node(siliconArcFurnace, () -> {
node(electrolyzer, Seq.with(new OnSector(three)), () -> {
node(oxidationChamber, Seq.with(new Research(mechReconstructor), new OnSector(four)), () -> {
node(oxidationChamber, Seq.with(new Research(basicReconstructor), new OnSector(four)), () -> {
node(electricHeater, Seq.with(new OnSector(four)), () -> {
node(heatRedirector, () -> {
@@ -228,7 +228,7 @@ public class ErekirTechTree{
});
node(breach, Seq.with(new Research(siliconArcFurnace), new Research(fabricator)), () -> {
node(breach, Seq.with(new Research(siliconArcFurnace), new Research(tankFabricator)), () -> {
node(berylliumWall, () -> {
node(berylliumWallLarge, () -> {
@@ -261,7 +261,7 @@ public class ErekirTechTree{
});
});
node(radar, Seq.with(new Research(beamNode), new Research(turbineCondenser), new Research(fabricator), new OnSector(SectorPresets.two)), () -> {
node(radar, Seq.with(new Research(beamNode), new Research(turbineCondenser), new Research(tankFabricator), new OnSector(SectorPresets.two)), () -> {
});
});
@@ -272,44 +272,39 @@ public class ErekirTechTree{
});
});
node(fabricator, Seq.with(new Research(siliconArcFurnace), new Research(plasmaBore), new Research(turbineCondenser)), () -> {
node(tankFabricator, Seq.with(new Research(siliconArcFurnace), new Research(plasmaBore), new Research(turbineCondenser)), () -> {
node(UnitTypes.stell, () -> {
});
node(mechReconstructor, Seq.with(new OnSector(three)), () -> {
node(basicReconstructor, Seq.with(new OnSector(three)), () -> {
node(UnitTypes.latum);
node(UnitTypes.avert);
node(UnitTypes.locus);
node(shipReconstructor, Seq.with(new OnSector(three)), () -> {
node(UnitTypes.avert);
node(tankAssembler, Seq.with(new OnSector(three), new Research(constructor), new Research(atmosphericConcentrator)), () -> {
node(UnitTypes.vanquish, () -> {
node(UnitTypes.conquer, Seq.with(tmpNever), () -> {
node(tankReconstructor, () -> {
node(UnitTypes.locus);
});
});
node(tankAssembler, Seq.with(new OnSector(three), new Research(constructor), new Research(atmosphericConcentrator)), () -> {
node(UnitTypes.vanquish, () -> {
node(UnitTypes.conquer, Seq.with(tmpNever), () -> {
node(shipAssembler, Seq.with(new OnSector(five)), () -> {
node(UnitTypes.quell, () -> {
node(UnitTypes.disrupt, Seq.with(tmpNever), () -> {
});
});
});
node(shipAssembler, Seq.with(new OnSector(five)), () -> {
node(UnitTypes.quell, () -> {
node(UnitTypes.disrupt, Seq.with(tmpNever), () -> {
node(mechAssembler, Seq.with(tmpNever), () -> {
node(UnitTypes.bulwark, () -> {
node(UnitTypes.krepost, Seq.with(tmpNever), () -> {
});
});
node(mechAssembler, Seq.with(tmpNever), () -> {
node(UnitTypes.bulwark, () -> {
node(UnitTypes.krepost, Seq.with(tmpNever), () -> {
});
});
});
});
});
});
});
});
});

View File

@@ -151,7 +151,7 @@ public class SectorPresets{
new TextMarker("The arc furnace needs [accent]sand[] and [accent]graphite[] to create [accent]silicon[].\n[accent]Power[] is also required.", 268f * 8f, 101f * 8f),
new TextMarker("Use [accent]cliff crushers[] to mine sand.", 262f * 8f, 88f * 8f)
),
new BuildCountObjective(Blocks.fabricator, 1).withMarkers(
new BuildCountObjective(Blocks.tankFabricator, 1).withMarkers(
new TextMarker("Use [accent]units[] to explore the map, defend buildings, and go on the offensive.\n Research and place a [accent]fabricator[]", 258f * 8f, 116f * 8f)
),
new UnitCountObjective(UnitTypes.stell, 1).withMarkers(

View File

@@ -38,7 +38,7 @@ public class UnitTypes{
//legs
public static @EntityDef({Unitc.class, Legsc.class}) UnitType corvus, atrax,
latum, anthicus,
merui, latum, anthicus,
bulwark, krepost;
//legs, legacy
@@ -46,7 +46,8 @@ public class UnitTypes{
//air
public static @EntityDef({Unitc.class}) UnitType flare, eclipse, horizon, zenith, antumbra,
evoke, avert, obviate;
evoke, avert, obviate,
osc;
//air, legacy
public static @EntityDef(value = {Unitc.class}, legacy = true) UnitType mono;
@@ -2829,6 +2830,35 @@ public class UnitTypes{
//endregion
//region erekir - mech
merui = new ErekirUnitType("merui"){{
speed = 0.75f;
drag = 0.1f;
hitSize = 9f;
rotateSpeed = 3.5f;
health = 700;
armor = 5f;
legCount = 6;
legLength = 8f;
lockLegBase = true;
legContinuousMove = true;
legExtension = -2f;
legBaseOffset = 3f;
maxStretch = 1.1f;
maxCompress = 0.2f;
legLengthScl = 0.96f;
legTrns = 1.1f;
legGroupSize = 3;
rippleScale = 0.2f;
legMoveSpace = 1f;
hovering = true;
visualElevation = 0.1f;
groundLayer = Layer.legUnit - 1f;
}};
latum = new ErekirUnitType("latum"){{
speed = 0.7f;
drag = 0.1f;
@@ -3300,6 +3330,25 @@ public class UnitTypes{
//endregion
//region erekir - flying
osc = new ErekirUnitType("osc"){{
//TODO needs hover passability like legs - move into UnitType?
hovering = true;
visualElevation = 0.1f;
drag = 0.08f;
speed = 2f;
rotateSpeed = 6f;
accel = 0.09f;
health = 600f;
armor = 3f;
hitSize = 7f;
engineOffset = 7f;
engineSize = 2f;
itemCapacity = 0;
useEngineElevation = false;
}};
avert = new ErekirUnitType("avert"){{
lowAltitude = false;
flying = true;

View File

@@ -150,6 +150,9 @@ public class BulletType extends Content implements Cloneable{
public int fragBullets = 9;
public float fragVelocityMin = 0.2f, fragVelocityMax = 1f, fragLifeMin = 1f, fragLifeMax = 1f;
public @Nullable BulletType fragBullet = null;
public float bulletInterval = 20f;
public int intervalBulletCount = 1;
public @Nullable BulletType intervalBullet;
public Color hitColor = Color.white;
public Color healColor = Pal.heal;
public Effect healEffect = Fx.healBlockFull;
@@ -423,6 +426,15 @@ public class BulletType extends Content implements Cloneable{
updateHoming(b);
updateWeaving(b);
updateTrailEffects(b);
updateBulletInterval(b);
}
public void updateBulletInterval(Bullet b){
if(intervalBullet != null && b.timer.get(2, bulletInterval)){
for(int i = 0; i < intervalBulletCount; i++){
intervalBullet.create(b, b.x, b.y, Mathf.random(360f));
}
}
}
public void updateHoming(Bullet b){

View File

@@ -62,7 +62,8 @@ public abstract class SaveFileReader{
"block-loader", "payload-loader",
"thermal-pump", "impulse-pump",
"alloy-smelter", "surge-smelter",
"steam-vent", "rhyolite-vent"
"steam-vent", "rhyolite-vent",
"fabricator", "tank-fabricator"
);
public static final ObjectMap<String, String> modContentNameMap = ObjectMap.of(

View File

@@ -165,6 +165,7 @@ public class UnitType extends UnlockableContent{
public boolean canDrown = true, naval = false;
public float drownTimeMultiplier = 1f;
public float engineOffset = 5f, engineSize = 2.5f;
public boolean useEngineElevation = true;
public @Nullable Color engineColor = null;
public @Nullable Color trailColor;
public Color engineColorInner = Color.white;
@@ -505,6 +506,10 @@ public class UnitType extends UnlockableContent{
mechStepParticles = hitSize > 15f;
}
if(engineSize > 0){
engines.add(new UnitEngine(0f, -engineOffset, engineSize, -90f));
}
if(treadEffect == null){
treadEffect = new Effect(50, e -> {
color(Tmp.c1.set(e.color).mul(1.5f));
@@ -871,7 +876,6 @@ public class UnitType extends UnlockableContent{
if(trailLength > 0 && !naval && unit.isFlying()){
drawTrail(unit);
}
if(engineSize > 0) drawEngine(unit);
if(engines.size > 0) drawEngines(unit);
Draw.z(z);
if(drawBody) drawBody(unit);
@@ -1010,27 +1014,6 @@ public class UnitType extends UnlockableContent{
}
}
public void drawEngine(Unit unit){
if(!unit.isFlying()) return;
float scale = unit.elevation;
float offset = engineOffset/2f + engineOffset/2f*scale;
Draw.color(engineColor == null ? unit.team.color : engineColor);
Fill.circle(
unit.x + Angles.trnsx(unit.rotation + 180, offset),
unit.y + Angles.trnsy(unit.rotation + 180, offset),
(engineSize + Mathf.absin(Time.time, 2f, engineSize / 4f)) * scale
);
Draw.color(engineColorInner);
Fill.circle(
unit.x + Angles.trnsx(unit.rotation + 180, offset - 1f),
unit.y + Angles.trnsy(unit.rotation + 180, offset - 1f),
(engineSize + Mathf.absin(Time.time, 2f, engineSize / 4f)) / 2f * scale
);
Draw.color();
}
public void drawTrail(Unit unit){
if(unit.trail == null){
unit.trail = new Trail(trailLength);
@@ -1040,16 +1023,18 @@ public class UnitType extends UnlockableContent{
}
public void drawEngines(Unit unit){
if(!unit.isFlying()) return;
float scale = useEngineElevation ? unit.elevation : 1f;
if(scale <= 0.0001f) return;
float scale = unit.elevation;
float rot = unit.rotation - 90;
Color color = engineColor == null ? unit.team.color : engineColor;
for(var engine : engines){
Tmp.v1.set(engine.x, engine.y).rotate(rot);
float ex = Tmp.v1.x, ey = Tmp.v1.y;
Draw.color(unit.team.color);
Draw.color(color);
Fill.circle(
unit.x + ex,
unit.y + ey,