mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-10 03:59:26 +02:00
block hp bar
This commit is contained in:
@@ -33,6 +33,9 @@ setting.baropacity.description = Sets the opacity of the unit health bar.
|
|||||||
|
|
||||||
setting.blockStatus.name = enable Block Status
|
setting.blockStatus.name = enable Block Status
|
||||||
setting.blockStatus.description = display enemy block status too
|
setting.blockStatus.description = display enemy block status too
|
||||||
|
setting.blockBar.name = enable Block Bar
|
||||||
|
setting.blockBar.description = display block health bar
|
||||||
|
|
||||||
setting.powerNode.name = enable Power Node
|
setting.powerNode.name = enable Power Node
|
||||||
setting.powerNode.description = display power node link lines
|
setting.powerNode.description = display power node link lines
|
||||||
setting.massDriver.name = enable Mass Driver
|
setting.massDriver.name = enable Mass Driver
|
||||||
|
|||||||
@@ -32,7 +32,10 @@ setting.baropacity.name = 유닛 바 투명도
|
|||||||
setting.baropacity.description = 유닛 바의 투명도를 조절합니다.
|
setting.baropacity.description = 유닛 바의 투명도를 조절합니다.
|
||||||
|
|
||||||
setting.blockStatus.name = 블록 상태 표시
|
setting.blockStatus.name = 블록 상태 표시
|
||||||
setting.blockStatus.description = 블록 왼쪽아래에 상태를 표시합니다.
|
setting.blockStatus.description = 적 블록 상태를 표시합니다.
|
||||||
|
setting.blockBar.name = 블록 바 표시
|
||||||
|
setting.blockBar.description = 블록 체력바를 표시합니다.
|
||||||
|
|
||||||
setting.powerNode.name = 노드 연결선 표시
|
setting.powerNode.name = 노드 연결선 표시
|
||||||
setting.powerNode.description = 선택한 블록과 전기적으로 연결된 블록들을 선으로 이어서 표시합니다.
|
setting.powerNode.description = 선택한 블록과 전기적으로 연결된 블록들을 선으로 이어서 표시합니다.
|
||||||
setting.massDriver.name = 매스 드라이버 연결선 표시
|
setting.massDriver.name = 매스 드라이버 연결선 표시
|
||||||
|
|||||||
@@ -3,8 +3,14 @@ package informatis.ui.draws;
|
|||||||
import arc.graphics.g2d.Draw;
|
import arc.graphics.g2d.Draw;
|
||||||
import arc.graphics.g2d.Fill;
|
import arc.graphics.g2d.Fill;
|
||||||
import arc.scene.style.TextureRegionDrawable;
|
import arc.scene.style.TextureRegionDrawable;
|
||||||
|
import mindustry.Vars;
|
||||||
|
import mindustry.gen.Building;
|
||||||
import mindustry.gen.Groups;
|
import mindustry.gen.Groups;
|
||||||
import mindustry.graphics.Pal;
|
import mindustry.graphics.Pal;
|
||||||
|
import mindustry.world.Build;
|
||||||
|
import mindustry.world.Tile;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
import static informatis.SUtils.*;
|
import static informatis.SUtils.*;
|
||||||
import static arc.Core.settings;
|
import static arc.Core.settings;
|
||||||
@@ -13,25 +19,51 @@ public class BlockDraw extends OverDraw {
|
|||||||
BlockDraw(String name, TextureRegionDrawable icon) {
|
BlockDraw(String name, TextureRegionDrawable icon) {
|
||||||
super(name, icon);
|
super(name, icon);
|
||||||
registerOption("blockStatus");
|
registerOption("blockStatus");
|
||||||
|
registerOption("blockBar");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw() {
|
public void draw() {
|
||||||
super.draw();
|
super.draw();
|
||||||
Groups.build.each(b->{
|
|
||||||
if(isInCamera(b.x, b.y, b.block.size/2f) && settings.getBool("blockStatus") && enabled) {
|
if(!enabled) return;
|
||||||
if(b.block.consumers.length > 0) {
|
Groups.build.each(b -> {
|
||||||
float multiplier = b.block.size > 1 ? 1.0F : 0.64F;
|
if(!isInCamera(b.x, b.y, b.block.size/2f)) return;
|
||||||
float brcx = b.x + (float)(b.block.size * 8) / 2.0F - 8.0F * multiplier / 2.0F;
|
if(settings.getBool("blockStatus") && b.block.consumers.length > 0) {
|
||||||
float brcy = b.y - (float)(b.block.size * 8) / 2.0F + 8.0F * multiplier / 2.0F;
|
float multiplier = b.block.size > 1 ? 1.0F : 0.64F;
|
||||||
Draw.z(71.0F);
|
float brcx = b.x + (float)(b.block.size * 8) / 2.0F - 8.0F * multiplier / 2.0F;
|
||||||
Draw.color(Pal.gray);
|
float brcy = b.y - (float)(b.block.size * 8) / 2.0F + 8.0F * multiplier / 2.0F;
|
||||||
Fill.square(brcx, brcy, 2.5F * multiplier, 45.0F);
|
Draw.z(71.0F);
|
||||||
Draw.color(b.status().color);
|
Draw.color(Pal.gray);
|
||||||
Fill.square(brcx, brcy, 1.5F * multiplier, 45.0F);
|
Fill.square(brcx, brcy, 2.5F * multiplier, 45.0F);
|
||||||
Draw.color();
|
Draw.color(b.status().color);
|
||||||
}
|
Fill.square(brcx, brcy, 1.5F * multiplier, 45.0F);
|
||||||
};
|
Draw.color();
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
for (Tile tile : Vars.world.tiles) {
|
||||||
|
if(!isInCamera(tile.worldx(), tile.worldy(), 8) || tile.build == null) continue;
|
||||||
|
|
||||||
|
Building b = tile.build;
|
||||||
|
|
||||||
|
if(settings.getBool("blockBar")) {
|
||||||
|
float bx = b.x, by = b.y - b.block.size * 4 - 2;
|
||||||
|
float width = b.block.size * 7.5f, height = 2;
|
||||||
|
Draw.color(Pal.gray);
|
||||||
|
Fill.quad(
|
||||||
|
bx - width/2, by + height/2,
|
||||||
|
bx - width/2, by - height/2,
|
||||||
|
bx + width/2, by - height/2,
|
||||||
|
bx + width/2, by + height/2);
|
||||||
|
Draw.color(Pal.health);
|
||||||
|
width = b.block.size * 7.5f - 0.5f; height = 2 - 0.5f;
|
||||||
|
Fill.quad(
|
||||||
|
bx - width/2, by + height/2,
|
||||||
|
bx - width/2, by - height/2,
|
||||||
|
bx - width/2 + width * b.healthf(), by - height/2,
|
||||||
|
bx - width/2 + width * b.healthf(), by + height/2);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class UnitDraw extends OverDraw {
|
|||||||
|
|
||||||
pathTiles.clear();
|
pathTiles.clear();
|
||||||
otherCores = Groups.build.copy(new Seq<>()).filter(b -> b instanceof CoreBlock.CoreBuild && b.team != u.team);
|
otherCores = Groups.build.copy(new Seq<>()).filter(b -> b instanceof CoreBlock.CoreBuild && b.team != u.team);
|
||||||
getNextTile(u.tileOn(), SVars.pathfinder.getField(u.team, u.controller() instanceof SuicideAI ? 0 : u.pathType(), u.pathType()));
|
getNextTile(u.tileOn(), SVars.pathfinder.getField(u.team, u.controller() instanceof SuicideAI ? 0 : u.pathType(), Pathfinder.fieldCore));
|
||||||
for(int i = 0; i < pathTiles.size - 1; i++) {
|
for(int i = 0; i < pathTiles.size - 1; i++) {
|
||||||
Tile from = pathTiles.get(i), to = pathTiles.get(i + 1);
|
Tile from = pathTiles.get(i), to = pathTiles.get(i + 1);
|
||||||
if(from == null || to == null) continue;
|
if(from == null || to == null) continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user