This commit is contained in:
EggleEgg 2026-03-07 21:24:30 +01:00 committed by GitHub
commit ddb163f0eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 35 additions and 0 deletions

View file

@ -2651,6 +2651,7 @@ public class Blocks{
ambientSound = Sounds.loopPulse;
ambientSoundVolume = 0.08f;
liquidCapacity = 80f;
constructHealthMultiplier = 0.5f;
consumePower(25f);
consumeItem(Items.blastCompound);
@ -2812,6 +2813,7 @@ public class Blocks{
requirements(Category.power, with(Items.tungsten, 750, Items.carbide, 300, Items.oxide, 150, Items.silicon, 500, Items.phaseFabric, 150, Items.surgeAlloy, 200));
size = 5;
constructHealthMultiplier = 0.5f;
liquidCapacity = 80f;
outputLiquid = new LiquidStack(Liquids.neoplasm, 20f / 60f);
explodeOnFull = true;
@ -3143,6 +3145,7 @@ public class Blocks{
isFirstTier = true;
unitType = UnitTypes.alpha;
health = 1100;
constructHealthMultiplier = 0.65f;
itemCapacity = 4000;
size = 3;
buildCostMultiplier = 2f;
@ -3155,6 +3158,7 @@ public class Blocks{
unitType = UnitTypes.beta;
health = 3500;
constructHealthMultiplier = 0.65f;
itemCapacity = 9000;
size = 4;
thrusterLength = 34/4f;
@ -3168,6 +3172,7 @@ public class Blocks{
unitType = UnitTypes.gamma;
health = 6000;
constructHealthMultiplier = 0.65f;
itemCapacity = 13000;
size = 5;
thrusterLength = 40/4f;
@ -3183,6 +3188,7 @@ public class Blocks{
isFirstTier = true;
unitType = UnitTypes.evoke;
health = 4500;
constructHealthMultiplier = 0.65f;
itemCapacity = 2000;
size = 4;
thrusterLength = 34/4f;
@ -3203,6 +3209,7 @@ public class Blocks{
unitType = UnitTypes.incite;
health = 16000;
constructHealthMultiplier = 0.65f;
itemCapacity = 3000;
size = 5;
thrusterLength = 40/4f;
@ -3221,6 +3228,7 @@ public class Blocks{
unitType = UnitTypes.emanate;
health = 30000;
constructHealthMultiplier = 0.65f;
itemCapacity = 4000;
size = 6;
thrusterLength = 48/4f;
@ -4250,6 +4258,7 @@ public class Blocks{
coolantMultiplier = 0.4f;
liquidCapacity = 60f;
scaledHealth = 150;
constructHealthMultiplier = 0.5f;
coolant = consumeCoolant(1f);
depositCooldown = 2.0f;
@ -4317,6 +4326,7 @@ public class Blocks{
shootSound = Sounds.shootSpectre;
scaledHealth = 160;
constructHealthMultiplier = 0.5f;
coolant = consumeCoolant(1f);
depositCooldown = 2.0f;
@ -4354,6 +4364,7 @@ public class Blocks{
}};
scaledHealth = 200;
constructHealthMultiplier = 0.5f;
liquidCapacity = 60f;
coolant = consumeCoolant(0.5f);
consumePower(17f);
@ -5617,6 +5628,7 @@ public class Blocks{
range = 1350;
shootCone = 1f;
scaledHealth = 220;
constructHealthMultiplier = 0.5f;
rotateSpeed = 0.9f;
coolant = consume(new ConsumeLiquid(Liquids.water, 15f / 60f));
@ -5884,6 +5896,7 @@ public class Blocks{
trackingRange = range * 1.4f;
shootCone = 30f;
scaledHealth = 350;
constructHealthMultiplier = 0.5f;
rotateSpeed = 1.5f;
coolant = consume(new ConsumeLiquid(Liquids.water, 15f / 60f));
@ -6227,6 +6240,7 @@ public class Blocks{
trackingRange = range * 1.4f;
shootCone = 100f;
scaledHealth = 370;
constructHealthMultiplier = 0.5f;
rotateSpeed = 2.6f;
recoil = 0.5f;
recoilTime = 30f;
@ -6314,6 +6328,7 @@ public class Blocks{
requirements(Category.units, with(Items.lead, 2000, Items.silicon, 1000, Items.titanium, 2000, Items.thorium, 750, Items.plastanium, 450, Items.phaseFabric, 600));
size = 7;
constructHealthMultiplier = 0.5f;
consumePower(13f);
consumeItems(with(Items.silicon, 850, Items.titanium, 750, Items.plastanium, 650));
consumeLiquid(Liquids.cryofluid, 1f);
@ -6336,6 +6351,7 @@ public class Blocks{
requirements(Category.units, with(Items.lead, 4000, Items.silicon, 3000, Items.thorium, 1000, Items.plastanium, 600, Items.phaseFabric, 600, Items.surgeAlloy, 800));
size = 9;
constructHealthMultiplier = 0.5f;
consumePower(25f);
consumeItems(with(Items.silicon, 1000, Items.plastanium, 600, Items.surgeAlloy, 500, Items.phaseFabric, 350));
consumeLiquid(Liquids.cryofluid, 3f);

View file

@ -187,6 +187,8 @@ public class Block extends UnlockableContent implements Senseable{
public float scaledHealth = -1;
/** building health; -1 to use scaledHealth */
public int health = -1;
/** Buildplan health multiplier as a fraction of its health. If this value is <0, it defaults to 10 hp */
public float constructHealthMultiplier = -1f;
/** damage absorption, similar to unit armor */
public float armor = 0f;
/** base block explosiveness */
@ -588,6 +590,10 @@ public class Block extends UnlockableContent implements Senseable{
return true;
}
public float constructHealthMultiplier(){
return constructHealthMultiplier > 0f ? health * constructHealthMultiplier : 10f;
}
public boolean rotatedOutput(int x, int y){
return rotate;
}

View file

@ -170,6 +170,8 @@ public class ConstructBlock extends Block{
public float progress = 0;
public float buildCost;
public float previousHealth;
public float damaged;
public @Nullable Object lastConfig;
public @Nullable Unit lastBuilder;
public boolean wasConstructing, activeDeconstruct;
@ -304,9 +306,11 @@ public class ConstructBlock extends Block{
maxProgress = core == null || team.rules().infiniteResources ? maxProgress : checkRequired(core.items, maxProgress, true);
progress = Mathf.clamp(progress + maxProgress);
scaleHealth(progress);
if(progress >= 1f || state.rules.infiniteResources){
boolean canFinish = true;
scaleHealth(1f);
//look at leftover resources to consume, get them from the core if necessary, delay building if not
if(!infinite){
@ -378,6 +382,7 @@ public class ConstructBlock extends Block{
}
progress = Mathf.clamp(progress - amount);
scaleHealth(progress);
if(progress <= current.deconstructThreshold || state.rules.infiniteResources){
//add any leftover items that weren't obtained due to rounding errors
@ -441,6 +446,14 @@ public class ConstructBlock extends Block{
return progress;
}
public void scaleHealth(float progress){
float maxHealth = tile.build.maxHealth = current.constructHealthMultiplier() > 0f ? current.constructHealthMultiplier() : tile.block() instanceof ConstructBlock b ? b.health : 10f;
if(previousHealth > tile.build.health + 0.001f) damaged += previousHealth - tile.build.health;
previousHealth = tile.build.health = progress * maxHealth - damaged;
tile.build.health = Mathf.clamp(tile.build.health, 0f, maxHealth);
}
public void setConstruct(Block previous, Block block){
if(block == null) return;