mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-26 06:22:17 -08:00
Fixed preview render crash
This commit is contained in:
parent
9b33ab3c0a
commit
debf940973
3 changed files with 10 additions and 4 deletions
|
|
@ -4666,6 +4666,7 @@ public class Blocks{
|
|||
|
||||
privileged = true;
|
||||
memoryCapacity = 128;
|
||||
forceDark = true;
|
||||
}};
|
||||
|
||||
//endregion
|
||||
|
|
|
|||
|
|
@ -223,22 +223,27 @@ public class Drawf{
|
|||
}
|
||||
|
||||
public static void light(float x, float y, float radius, Color color, float opacity){
|
||||
if(renderer == null) return;
|
||||
renderer.lights.add(x, y, radius, color, opacity);
|
||||
}
|
||||
|
||||
public static void light(Position pos, float radius, Color color, float opacity){
|
||||
if(renderer == null) return;
|
||||
light(pos.getX(), pos.getY(), radius, color, opacity);
|
||||
}
|
||||
|
||||
public static void light(float x, float y, TextureRegion region, Color color, float opacity){
|
||||
if(renderer == null) return;
|
||||
renderer.lights.add(x, y, region, color, opacity);
|
||||
}
|
||||
|
||||
public static void light(float x, float y, float x2, float y2){
|
||||
if(renderer == null) return;
|
||||
renderer.lights.line(x, y, x2, y2, 30, Color.orange, 0.3f);
|
||||
}
|
||||
|
||||
public static void light(float x, float y, float x2, float y2, float stroke, Color tint, float alpha){
|
||||
if(renderer == null) return;
|
||||
renderer.lights.line(x, y, x2, y2, stroke, tint, alpha);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ public class PowerNode extends PowerBlock{
|
|||
|
||||
getPotentialLinks(tile, player.team(), other -> {
|
||||
Draw.color(laserColor1, Renderer.laserOpacity * 0.5f);
|
||||
drawLaser(tile.team(), x * tilesize + offset, y * tilesize + offset, other.x, other.y, size, other.block.size);
|
||||
drawLaser(x * tilesize + offset, y * tilesize + offset, other.x, other.y, size, other.block.size);
|
||||
|
||||
Drawf.square(other.x, other.y, other.block.size * tilesize / 2f + 2f, Pal.place);
|
||||
});
|
||||
|
|
@ -177,7 +177,7 @@ public class PowerNode extends PowerBlock{
|
|||
Draw.alpha(Renderer.laserOpacity);
|
||||
}
|
||||
|
||||
public void drawLaser(Team team, float x1, float y1, float x2, float y2, int size1, int size2){
|
||||
public void drawLaser(float x1, float y1, float x2, float y2, int size1, int size2){
|
||||
float angle1 = Angles.angle(x1, y1, x2, y2),
|
||||
vx = Mathf.cosDeg(angle1), vy = Mathf.sinDeg(angle1),
|
||||
len1 = size1 * tilesize / 2f - 1.5f, len2 = size2 * tilesize / 2f - 1.5f;
|
||||
|
|
@ -325,7 +325,7 @@ public class PowerNode extends PowerBlock{
|
|||
|
||||
if(otherReq == null || otherReq.block == null) continue;
|
||||
|
||||
drawLaser(player == null ? Team.sharded : player.team(), plan.drawx(), plan.drawy(), otherReq.drawx(), otherReq.drawy(), size, otherReq.block.size);
|
||||
drawLaser(plan.drawx(), plan.drawy(), otherReq.drawx(), otherReq.drawy(), size, otherReq.block.size);
|
||||
}
|
||||
Draw.color();
|
||||
}
|
||||
|
|
@ -472,7 +472,7 @@ public class PowerNode extends PowerBlock{
|
|||
|
||||
if(link.block instanceof PowerNode && link.id >= id) continue;
|
||||
|
||||
drawLaser(team, x, y, link.x, link.y, size, link.block.size);
|
||||
drawLaser(x, y, link.x, link.y, size, link.block.size);
|
||||
}
|
||||
|
||||
Draw.reset();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue