This commit is contained in:
Anuken
2019-01-27 09:19:23 -05:00
parent 6723157ca5
commit f31fd622dd
6 changed files with 39 additions and 83 deletions

View File

@@ -154,27 +154,6 @@ task scaleSprites4x(){
}
}
task processBlocks(){
def str = file("/home/anuke/Projects/Mindustry/core/src/io/anuke/mindustry/content/Blocks.java").text
def out = str
def mat = " consumes.power("
int i = 0
while(str.indexOf(mat, i) != -1){
i = str.indexOf(mat, i + 1)
if(i == -1) break
def line = str.substring(i, str.indexOf("\n", i))
def num = line.substring(line.indexOf("(") + 1, line.indexOf(")"))
float val = Float.parseFloat(num) * 10f;
boolean fmt = Math.abs((int)val - val) > 0.01f;
out = out.replace(line, (line.replace(num, (fmt ? String.format("%.2f", val) : (int)val) + "f")))
}
println(out)
}
task scaleSprites(){
finalizedBy 'genSprites'