mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-10 03:59:26 +02:00
yea better range display
This commit is contained in:
@@ -45,6 +45,10 @@ setting.rangeNearby.name = Display Near Range
|
||||
setting.rangeNearby.description = toggle to display range circle when you approached enemy ranges.
|
||||
setting.unitRange.name = Display Unit Range
|
||||
setting.unitRange.description = toggle to display unit range too.
|
||||
setting.softRangeDrawing.name = Soft Display Range
|
||||
setting.softRangeDrawing.description = toggle to change range display style.
|
||||
setting.softRangeOpacity.name = Soft Range Opacity
|
||||
setting.softRangeOpacity.description = use the slider to set opacity of soft range.
|
||||
setting.rangeRadius.name = Near Range Margin
|
||||
setting.rangeRadius.description = set additional distances to show range.
|
||||
setting.allTeamRange.name = Display Team Range
|
||||
|
||||
@@ -39,6 +39,10 @@ setting.rangeNearby.name = 주변 사거리 표시
|
||||
setting.rangeNearby.description = 적 사거리에 접근했을 경우 사거리를 표시합니다.
|
||||
setting.unitRange.name = 유닛 사거리 표시
|
||||
setting.unitRange.description = 유닛 사거리도 표시합니다.
|
||||
setting.softRangeDrawing.name = 부드러운 사거리 표시
|
||||
setting.softRangeDrawing.description = 사거리를 표시하는 원의 모양이 달라집니다.
|
||||
setting.softRangeOpacity.name = 부드러운 사거리 투명도
|
||||
setting.softRangeOpacity.description = 슬라이더로 부드러운 사거리 투명도를 조절합니다.
|
||||
setting.rangeRadius.name = 사거리 접근 거리
|
||||
setting.rangeRadius.description = 사거리를 표시할 추가 거리를 설정합니다.
|
||||
setting.allTeamRange.name = 팀 사거리 표시
|
||||
|
||||
@@ -104,11 +104,17 @@ public class Main extends Mod {
|
||||
boolean canHit = e.block instanceof Turret t ? unit.isFlying() ? t.targetAir : t.targetGround :
|
||||
e.block instanceof TractorBeamTurret tu && (unit.isFlying() ? tu.targetAir : tu.targetGround);
|
||||
float range = ((BaseTurret.BaseTurretBuild) e).range();
|
||||
float max = range + settings.getInt("rangeRadius") * tilesize + e.block.offset;
|
||||
|
||||
|
||||
if(Vars.player.dst(e) <= range + settings.getInt("rangeRadius") * tilesize + e.block.offset) {
|
||||
if(canHit || settings.getBool("allTargetRange"))
|
||||
Drawf.dashCircle(e.x, e.y, range, canHit ? e.team.color : Team.derelict.color);
|
||||
if(Vars.player.dst(e) <= max) {
|
||||
if(canHit || settings.getBool("allTargetRange")){
|
||||
if(settings.getBool("softRangeDrawing")){
|
||||
Lines.stroke(1, Tmp.c1.set(canHit ? e.team.color : Team.derelict.color).a(0.5f));
|
||||
Lines.poly(e.x, e.y, Lines.circleVertices(range), range);
|
||||
Fill.light(e.x, e.y, Lines.circleVertices(range), range, Color.clear, Tmp.c1.a(Mathf.clamp(1-(Vars.player.dst(e)/max), 0, settings.getInt("softRangeOpacity")/100f)));
|
||||
}
|
||||
else Drawf.dashCircle(e.x, e.y, range, canHit ? e.team.color : Team.derelict.color);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -117,10 +123,16 @@ public class Main extends Mod {
|
||||
Groups.unit.each(u -> u.team == team, u -> { // Don't draw own units
|
||||
boolean canHit = unit.isFlying() ? u.type.targetAir : u.type.targetGround;
|
||||
float range = u.range();
|
||||
float max = range + settings.getInt("rangeRadius") * tilesize;
|
||||
|
||||
if(Vars.player.dst(u) <= range + settings.getInt("rangeRadius") * tilesize) { // TODO: Store value of rangeRadius as an int, should increase performance
|
||||
if (canHit || settings.getBool("allTargetRange")) // Same as above
|
||||
Drawf.dashCircle(u.x, u.y, range, canHit ? u.team.color : Team.derelict.color);
|
||||
if(settings.getBool("softRangeDrawing")){
|
||||
Lines.stroke(1, Tmp.c1.set(canHit ? u.team.color : Team.derelict.color).a(0.5f));
|
||||
Lines.poly(u.x, u.y, Lines.circleVertices(range), range);
|
||||
Fill.light(u.x, u.y, Lines.circleVertices(range), range, Color.clear, Tmp.c1.a(Math.min(settings.getInt("softRangeOpacity")/100f, 1-Vars.player.dst(u)/max)));
|
||||
}
|
||||
else Drawf.dashCircle(u.x, u.y, range, canHit ? u.team.color : Team.derelict.color);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -275,6 +275,8 @@ public class Setting {
|
||||
addGraphicCheckSetting("allTeamRange", false, scanSeq);
|
||||
addGraphicCheckSetting("allTargetRange", false, scanSeq);
|
||||
addGraphicCheckSetting("unitRange", false, scanSeq);
|
||||
addGraphicCheckSetting("softRangeDrawing", false, scanSeq);
|
||||
addGraphicSlideSetting("softRangeOpacity", 10, 0, 25, 1, s -> s + "%", scanSeq);
|
||||
addGraphicSlideSetting("rangeRadius", 5, 0, 20, 1, s -> s + "tiles", scanSeq);
|
||||
addGraphicDialogSetting("wavesetting", scanSeq, scanTable);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user