This commit is contained in:
Anuken
2025-02-08 19:33:23 -05:00
parent ebaf88e80d
commit b96191f6d6
6 changed files with 18 additions and 4 deletions

View File

@@ -2412,7 +2412,7 @@ public class Blocks{
}};
solarPanel = new SolarGenerator("solar-panel"){{
requirements(Category.power, with(Items.lead, 10, Items.silicon, 10));
requirements(Category.power, with(Items.lead, 10, Items.silicon, 8));
powerProduction = 0.12f;
}};

View File

@@ -13,6 +13,7 @@ import mindustry.game.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.type.*;
import mindustry.world.blocks.*;
import mindustry.world.blocks.environment.*;
import static mindustry.Vars.*;
@@ -194,6 +195,11 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
if(type.legSplashDamage > 0 && !disarmed){
Damage.damage(team, l.base.x, l.base.y, type.legSplashRange, type.legSplashDamage * state.rules.unitDamage(team), false, true);
var tile = Vars.world.tileWorld(l.base.x, l.base.y);
if(tile != null && tile.block().unitMoveBreakable){
ConstructBlock.deconstructFinish(tile, tile.block(), self());
}
}
}

View File

@@ -11,6 +11,7 @@ import mindustry.game.*;
import mindustry.gen.*;
import mindustry.type.*;
import mindustry.world.*;
import mindustry.world.blocks.*;
import mindustry.world.blocks.environment.*;
import static mindustry.Vars.*;
@@ -57,16 +58,20 @@ abstract class TankComp implements Posc, Flyingc, Hitboxc, Unitc, ElevationMovec
for(int dx = -r; dx <= r; dx++){
for(int dy = -r; dy <= r; dy++){
Tile t = Vars.world.tileWorld(x + dx*tilesize, y + dy*tilesize);
if(t == null || t.solid()){
if(t == null || t.solid()){
solids ++;
}
//TODO should this apply to the player team(s)? currently PvE due to balancing
if(type.crushDamage > 0 && !disarmed && (walked || deltaLen() >= 0.01f) && t != null && t.build != null && t.build.team != team
if(type.crushDamage > 0 && !disarmed && (walked || deltaLen() >= 0.01f) && t != null
//damage radius is 1 tile smaller to prevent it from just touching walls as it passes
&& Math.max(Math.abs(dx), Math.abs(dy)) <= r - 1){
t.build.damage(team, type.crushDamage * Time.delta * t.block().crushDamageMultiplier * state.rules.unitDamage(team));
if(t.build != null && t.build.team != team){
t.build.damage(team, type.crushDamage * Time.delta * t.block().crushDamageMultiplier * state.rules.unitDamage(team));
}else if(t.block().unitMoveBreakable){
ConstructBlock.deconstructFinish(t, t.block(), self());
}
}
}
}

View File

@@ -124,6 +124,8 @@ public class Block extends UnlockableContent implements Senseable{
public boolean saveData;
/** whether you can break this with rightclick */
public boolean breakable;
/** if true, this block will be broken by certain units stepping/moving over it */
public boolean unitMoveBreakable;
/** whether to add this block to brokenblocks */
public boolean rebuildable = true;
/** if true, this logic-related block can only be used with privileged processors (or is one itself) */

View File

@@ -16,6 +16,7 @@ public class Prop extends Block{
breakable = true;
alwaysReplace = true;
instantDeconstruct = true;
unitMoveBreakable = true;
breakEffect = Fx.breakProp;
breakSound = Sounds.rockBreak;
}