Laser pierce & crash fixes

This commit is contained in:
Anuken
2026-01-09 22:02:24 -05:00
parent 06589cd77f
commit 4969e382f6
2 changed files with 2 additions and 4 deletions

View File

@@ -178,8 +178,6 @@ public class Damage{
}
public static float findPierceLength(Bullet b, int pierceCap, boolean laser, float length){
if(pierceCap <= 0) return length;
vec.trnsExact(b.rotation(), length);
rect.setPosition(b.x, b.y).setSize(vec.x, vec.y).normalize().grow(3f);
@@ -217,7 +215,7 @@ public class Damage{
//return either the length when not enough things were pierced,
//or the last pierced object if there were enough blockages
return Math.min(distances.size < pierceCap ? length : Math.max(6f, distances.get(pierceCap - 1)), maxDst);
return Math.min(distances.size < pierceCap || pierceCap <= 0 ? length : Math.max(6f, distances.get(pierceCap - 1)), maxDst);
}
/** Collides a bullet with blocks in a laser, taking into account absorption blocks. Resulting length is stored in the bullet's fdata. */

View File

@@ -141,7 +141,7 @@ public class StackConveyor extends Block implements Autotiler{
}
}else if(state == stateUnload){ //front unload
//TOOD hacky front check
if((blendprox & (1)) != 0 && !front().block.squareSprite){
if((blendprox & (1)) != 0 && front() != null && !front().block.squareSprite){
Draw.rect(sliced(regions[0], SliceMode.top), x + Geometry.d4x(rotation) * tilesize*0.75f, y + Geometry.d4y(rotation) * tilesize*0.75f, rotation * 90f);
}
}