From 6ffc8ba3c56c38b66e3a833dd1064f2d854fe544 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 20 Jul 2021 10:45:15 -0400 Subject: [PATCH] #4874 --- .../world/blocks/power/LightBlock.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/core/src/mindustry/world/blocks/power/LightBlock.java b/core/src/mindustry/world/blocks/power/LightBlock.java index 8a88a8e017..16f109d626 100644 --- a/core/src/mindustry/world/blocks/power/LightBlock.java +++ b/core/src/mindustry/world/blocks/power/LightBlock.java @@ -3,12 +3,15 @@ package mindustry.world.blocks.power; import arc.graphics.*; import arc.graphics.g2d.*; import arc.math.*; +import arc.math.geom.*; import arc.scene.ui.layout.*; +import arc.struct.*; import arc.util.*; import arc.util.io.*; import mindustry.annotations.Annotations.*; import mindustry.gen.*; import mindustry.graphics.*; +import mindustry.input.*; import mindustry.logic.*; import mindustry.world.*; @@ -25,6 +28,7 @@ public class LightBlock extends Block{ update = true; configurable = true; saveConfig = true; + swapDiagonalPlacement = true; config(Integer.class, (LightBuild tile, Integer value) -> tile.color = value); } @@ -36,6 +40,19 @@ public class LightBlock extends Block{ super.init(); } + @Override + public void drawPlace(int x, int y, int rotation, boolean valid){ + super.drawPlace(x, y, rotation, valid); + + Drawf.dashCircle(x * tilesize + offset, y * tilesize + offset, radius * 0.75f, Pal.placing); + } + + @Override + public void changePlacementPath(Seq points, int rotation){ + var placeRadius2 = Mathf.pow(radius * 0.7f / tilesize, 2f) * 3; + Placement.calculateNodes(points, this, rotation, (point, other) -> point.dst2(other) <= placeRadius2); + } + public class LightBuild extends Building{ public int color = Pal.accent.rgba(); public float smoothTime = 1f;