Crawl unit cells (#10298)

* Crawl unit cells

* Normal cells don't draw on crawl units
This commit is contained in:
Andromeda-Galaxy29
2025-02-06 23:39:23 +03:00
committed by GitHub
parent 52b1ef52d0
commit 556b2aa114

View File

@@ -443,7 +443,7 @@ public class UnitType extends UnlockableContent implements Senseable{
public TextureRegion baseRegion, legRegion, region, previewRegion, shadowRegion, cellRegion, itemCircleRegion,
softShadowRegion, jointRegion, footRegion, legBaseRegion, baseJointRegion, outlineRegion, treadRegion,
mineLaserRegion, mineLaserEndRegion;
public TextureRegion[] wreckRegions, segmentRegions, segmentOutlineRegions;
public TextureRegion[] wreckRegions, segmentRegions, segmentCellRegions, segmentOutlineRegions;
public TextureRegion[][] treadRegions;
//INTERNAL REQUIREMENTS
@@ -963,9 +963,11 @@ public class UnitType extends UnlockableContent implements Senseable{
segmentRegions = new TextureRegion[segments];
segmentOutlineRegions = new TextureRegion[segments];
segmentCellRegions = new TextureRegion[segments];
for(int i = 0; i < segments; i++){
segmentRegions[i] = Core.atlas.find(name + "-segment" + i);
segmentOutlineRegions[i] = Core.atlas.find(name + "-segment-outline" + i);
segmentCellRegions[i] = Core.atlas.find(name + "-segment-cell" + i);
}
clipSize = Math.max(region.width * 2f, clipSize);
@@ -1286,7 +1288,7 @@ public class UnitType extends UnlockableContent implements Senseable{
if(engines.size > 0) drawEngines(unit);
Draw.z(z);
if(drawBody) drawBody(unit);
if(drawCell) drawCell(unit);
if(drawCell && !(unit instanceof Crawlc)) drawCell(unit);
drawWeapons(unit);
if(drawItems) drawItems(unit);
if(!isPayload){
@@ -1652,6 +1654,13 @@ public class UnitType extends UnlockableContent implements Senseable{
//TODO merge outlines?
Draw.rect(regions[i], unit.x + tx, unit.y + ty, rot - 90);
// Draws the cells
if(drawCell && p != 0 && segmentCellRegions[i].found()){
Draw.color(cellColor(unit));
Draw.rect(segmentCellRegions[i], unit.x + tx, unit.y + ty, rot - 90);
Draw.reset();
}
}
}
}