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

@@ -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());
}
}
}
}