File tree Expand file tree Collapse file tree
src/main/kotlin/ru/octol1ttle/flightassistant
impl/computer/autoflight/base Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22org.gradle.jvmargs =-Xmx4G
33org.gradle.parallel =true
44org.gradle.caching =true
5- org.gradle.configuration-cache =true
5+ org.gradle.configuration-cache =false
66
77# Mod Properties
88mod.id =flightassistant
Original file line number Diff line number Diff line change 1+ package ru.octol1ttle.flightassistant.api.util.extensions
2+
3+ import kotlin.math.abs
4+ import kotlin.math.ceil
5+ import kotlin.math.pow
6+ import kotlin.math.sign
7+
8+ fun Float.asPercentage (decimals : Int = 1): String {
9+ val percentage = this * 100
10+ val factor = 10.0 .pow(decimals)
11+
12+ val furtherFromZero = sign(percentage) * ceil(abs(percentage) * factor) / factor
13+
14+ return " %.${decimals} f%%" .formatRoot(furtherFromZero)
15+ }
Original file line number Diff line number Diff line change @@ -14,8 +14,8 @@ import ru.octol1ttle.flightassistant.api.computer.Computer
1414import ru.octol1ttle.flightassistant.api.computer.ComputerBus
1515import ru.octol1ttle.flightassistant.api.computer.ComputerQuery
1616import ru.octol1ttle.flightassistant.api.util.FATickCounter
17+ import ru.octol1ttle.flightassistant.api.util.extensions.asPercentage
1718import ru.octol1ttle.flightassistant.api.util.extensions.filterWorking
18- import ru.octol1ttle.flightassistant.api.util.extensions.formatRoot
1919import ru.octol1ttle.flightassistant.api.util.extensions.getActiveHighestPriority
2020import ru.octol1ttle.flightassistant.api.util.throwIfNotInRange
2121import ru.octol1ttle.flightassistant.impl.display.StatusDisplay
@@ -102,7 +102,7 @@ class ThrustComputer(computers: ComputerBus) : Computer(computers) {
102102 if (query is StatusDisplay .StatusMessageQuery ) {
103103 // TODO: show actual thrust output and requested thrust (both by user and autoflight)
104104 if (getThrustSource() != null || current != 0.0f ) {
105- query.respond(Component .translatable(" status.flightassistant.thrust" , " %.1f " .formatRoot(current * 100 ) + " % " ))
105+ query.respond(Component .translatable(" status.flightassistant.thrust" , current.asPercentage() ))
106106 }
107107 }
108108 }
You can’t perform that action at this time.
0 commit comments