Polar Aerodrome sector submission / Shields absorb unit wrecks

This commit is contained in:
Anuken
2024-09-15 11:36:09 -04:00
parent 0889da2bc7
commit aafdd35796
9 changed files with 55 additions and 9 deletions

View File

@@ -1889,21 +1889,21 @@ public class Blocks{
titaniumConveyor = new Conveyor("titanium-conveyor"){{
requirements(Category.distribution, with(Items.copper, 1, Items.lead, 1, Items.titanium, 1));
health = 65;
health = 70;
speed = 0.08f;
displayedSpeed = 11f;
}};
plastaniumConveyor = new StackConveyor("plastanium-conveyor"){{
requirements(Category.distribution, with(Items.plastanium, 1, Items.silicon, 1, Items.graphite, 1));
health = 75;
health = 90;
speed = 4f / 60f;
itemCapacity = 10;
}};
armoredConveyor = new ArmoredConveyor("armored-conveyor"){{
requirements(Category.distribution, with(Items.plastanium, 1, Items.thorium, 1, Items.metaglass, 1));
health = 180;
health = 280;
speed = 0.08f;
displayedSpeed = 11f;
}};

View File

@@ -8,7 +8,7 @@ public class SectorPresets{
public static SectorPreset
groundZero,
craters, biomassFacility, taintedWoods, frozenForest, ruinousShores, facility32m, windsweptIslands, stainedMountains, tarFields,
fungalPass, infestedCanyons, extractionOutpost, saltFlats, overgrowth,
fungalPass, infestedCanyons, extractionOutpost, polarAerodrome, saltFlats, overgrowth,
impact0078, desolateRift, nuclearComplex, planetaryTerminal,
coastline, navalFortress,
@@ -76,6 +76,10 @@ public class SectorPresets{
difficulty = 5;
}};
polarAerodrome = new SectorPreset("polarAerodrome", serpulo, 68){{
difficulty = 7;
}};
coastline = new SectorPreset("coastline", serpulo, 108){{
captureWave = 30;
difficulty = 5;

View File

@@ -378,7 +378,7 @@ public class SerpuloTechTree{
node(flare, () -> {
node(horizon, () -> {
node(zenith, () -> {
node(antumbra, () -> {
node(antumbra, Seq.with(new SectorComplete(polarAerodrome)), () -> {
node(eclipse, () -> {
});
@@ -514,7 +514,17 @@ public class SerpuloTechTree{
new Research(airFactory),
new Research(mono)
), () -> {
node(polarAerodrome, Seq.with(
new SectorComplete(fungalPass),
new SectorComplete(overgrowth),
new Research(multiplicativeReconstructor),
new Research(zenith),
new Research(swarmer),
new Research(cyclone),
new Research(blastDrill)
), () -> {
});
});
});

View File

@@ -25,8 +25,10 @@ import mindustry.logic.*;
import mindustry.type.*;
import mindustry.ui.*;
import mindustry.world.*;
import mindustry.world.blocks.*;
import mindustry.world.blocks.environment.*;
import mindustry.world.blocks.payloads.*;
import mindustry.world.meta.*;
import static mindustry.Vars.*;
import static mindustry.logic.GlobalVars.*;
@@ -713,7 +715,11 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
//if this unit crash landed (was flying), damage stuff in a radius
if(type.flying && !spawnedByCore && type.createWreck && state.rules.unitCrashDamage(team) > 0){
Damage.damage(team, x, y, Mathf.pow(hitSize, 0.94f) * 1.25f, Mathf.pow(hitSize, 0.75f) * type.crashDamageMultiplier * 5f * state.rules.unitCrashDamage(team), true, false, true);
var shields = indexer.getEnemy(team, BlockFlag.shield);
float crashDamage = Mathf.pow(hitSize, 0.75f) * type.crashDamageMultiplier * 5f * state.rules.unitCrashDamage(team);
if(shields.isEmpty() || !shields.contains(b -> b instanceof UnitWreckShield s && s.absorbWreck(self(), crashDamage))){
Damage.damage(team, x, y, Mathf.pow(hitSize, 0.94f) * 1.25f, crashDamage, true, false, true);
}
}
if(!headless && type.createScorch){

View File

@@ -0,0 +1,9 @@
package mindustry.world.blocks;
import mindustry.gen.*;
//TODO: horrible API design, but I'm not sure of a better way to do this right now. please don't use this class
public interface UnitWreckShield{
/** @return whether the shield was able to absorb the unit wreck; this should apply damage to the shield if true is returned. */
boolean absorbWreck(Unit unit, float damage);
}

View File

@@ -19,6 +19,7 @@ import mindustry.graphics.*;
import mindustry.logic.*;
import mindustry.ui.*;
import mindustry.world.*;
import mindustry.world.blocks.*;
import mindustry.world.consumers.*;
import mindustry.world.meta.*;
@@ -68,6 +69,7 @@ public class ForceProjector extends Block{
envEnabled |= Env.space;
ambientSound = Sounds.shield;
ambientSoundVolume = 0.08f;
flags = EnumSet.of(BlockFlag.shield);
if(consumeCoolant){
consume(coolantConsumer = new ConsumeCoolant(coolantConsumption)).boost().update(false);
@@ -120,7 +122,7 @@ public class ForceProjector extends Block{
Draw.color();
}
public class ForceBuild extends Building implements Ranged{
public class ForceBuild extends Building implements Ranged, UnitWreckShield{
public boolean broken = true;
public float buildup, radscl, hit, warmup, phaseHeat;
@@ -214,6 +216,17 @@ public class ForceProjector extends Block{
}
}
@Override
public boolean absorbWreck(Unit unit, float damage){
boolean absorb = !broken && Intersector.isInRegularPolygon(sides, x, y, realRadius(), shieldRotation, unit.x, unit.y);
if(absorb){
absorbEffect.at(unit);
hit = 1f;
buildup += damage;
}
return absorb;
}
public float realRadius(){
return (radius + phaseHeat * phaseRadiusBoost) * radscl;
}
@@ -238,7 +251,7 @@ public class ForceProjector extends Block{
Draw.z(Layer.block);
Draw.reset();
}
drawShield();
}

View File

@@ -22,6 +22,8 @@ public enum BlockFlag{
extinguisher,
/** Is a drill. */
drill,
/** Force projector block. */
shield,
//special, internal identifiers
launchPad,
@@ -32,5 +34,5 @@ public enum BlockFlag{
public final static BlockFlag[] all = values();
/** Values for logic only. Filters out some internal flags. */
public final static BlockFlag[] allLogic = {core, storage, generator, turret, factory, repair, battery, reactor, drill};
public final static BlockFlag[] allLogic = {core, storage, generator, turret, factory, repair, battery, reactor, drill, shield};
}