Skip to content

Commit

Permalink
Bugfixes / Added tool to re-format bundles with missing text
Browse files Browse the repository at this point in the history
  • Loading branch information
Anuken committed Jul 9, 2018
1 parent 1e82067 commit b7e28a7
Show file tree
Hide file tree
Showing 19 changed files with 5,563 additions and 5,522 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

/core/assets/mindustry-saves/
/core/assets/mindustry-maps/
/core/assets/bundles/output/
/deploy/
/desktop/packr-out/
/desktop/packr-export/
Expand Down
2 changes: 1 addition & 1 deletion annotations/src/io/anuke/annotations/Annotations.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class Annotations {
Variant variants() default Variant.all;
/**The local locations where this method is called locally, when invoked.*/
Loc called() default Loc.none;
/**Whether to forward this packet to all other clients upon recieval. Server only.*/
/**Whether to forward this packet to all other clients upon recieval. Client only.*/
boolean forward() default false;
/**Whether the packet for this method is sent with UDP instead of TCP.
* UDP is faster, but is prone to packet loss and duplication.*/
Expand Down
994 changes: 515 additions & 479 deletions core/assets/bundles/bundle_de.properties

Large diffs are not rendered by default.

1,067 changes: 515 additions & 552 deletions core/assets/bundles/bundle_es.properties

Large diffs are not rendered by default.

1,043 changes: 515 additions & 528 deletions core/assets/bundles/bundle_fr.properties

Large diffs are not rendered by default.

1,006 changes: 515 additions & 491 deletions core/assets/bundles/bundle_in_ID.properties

Large diffs are not rendered by default.

1,066 changes: 515 additions & 551 deletions core/assets/bundles/bundle_ita.properties

Large diffs are not rendered by default.

1,034 changes: 515 additions & 519 deletions core/assets/bundles/bundle_ko.properties

Large diffs are not rendered by default.

1,003 changes: 515 additions & 488 deletions core/assets/bundles/bundle_pl.properties

Large diffs are not rendered by default.

664 changes: 354 additions & 310 deletions core/assets/bundles/bundle_pt_BR.properties

Large diffs are not rendered by default.

1,050 changes: 505 additions & 545 deletions core/assets/bundles/bundle_ru.properties

Large diffs are not rendered by default.

1,066 changes: 515 additions & 551 deletions core/assets/bundles/bundle_tk.properties

Large diffs are not rendered by default.

1,013 changes: 514 additions & 499 deletions core/assets/bundles/bundle_uk_UA.properties

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions core/src/io/anuke/mindustry/entities/effect/Fire.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public void update() {
if(time >= lifetime() || tile == null){
CallEntity.onFireRemoved(getID());
remove();
return;
}

TileEntity entity = tile.target().entity;
Expand Down
5 changes: 5 additions & 0 deletions core/src/io/anuke/mindustry/type/Recipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ public Recipe setDebug(){
return this;
}

@Override
public boolean isHidden() {
return debugOnly;
}

@Override
public void displayInfo(Table table) {
ContentDisplay.displayRecipe(table, this);
Expand Down
2 changes: 1 addition & 1 deletion core/src/io/anuke/mindustry/world/consumers/Consume.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

public abstract class Consume {
private boolean optional;
private boolean update;
private boolean update = true;

public Consume optional(boolean optional) {
this.optional = optional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ public ItemStack[] getItems() {

@Override
public void update(Block block, TileEntity entity) {
for(ItemStack stack : items){
entity.items.remove(stack);
}

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public boolean hasOne(ItemStack[] stacks){
return true;
}

//TODO optimize!
public int total(){
return total;
}
Expand Down
63 changes: 60 additions & 3 deletions packer/src/io/anuke/mindustry/BundleLauncher.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,73 @@
package io.anuke.mindustry;

import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.ObjectMap;
import com.badlogic.gdx.utils.OrderedMap;
import com.badlogic.gdx.utils.PropertiesUtils;
import io.anuke.ucore.util.Log;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class BundleLauncher {

public static void main(String[] args){
public static void main(String[] args) throws Exception{
File file = new File("bundle.properties");
Paths.get("").forEach(child -> {
Log.info("Directory: {0}", child);
OrderedMap<String, String> base = new OrderedMap<>();
PropertiesUtils.load(base, new InputStreamReader(new FileInputStream(file)));
Array<String> removals = new Array<>();

Files.walk(Paths.get("")).forEach(child -> {
try {
if (child.getFileName().toString().equals("bundle.properties") || Files.isDirectory(child) || child.toString().contains("output")) return;

Log.info("Parsing bundle: {0}", child);

OrderedMap<String, String> other = new OrderedMap<>();
PropertiesUtils.load(other, Files.newBufferedReader(child));
removals.clear();

for(String key : other.orderedKeys()){
if(!base.containsKey(key)){
removals.add(key);
Log.info("&lr- Removing unused key '{0}'...", key);
}
}
Log.info("&lr{0} keys removed.", removals.size);
for(String s : removals){
other.remove(s);
}

int added = 0;

for(String key : base.orderedKeys()){
if(!other.containsKey(key)){
other.put(key, base.get(key));
added ++;
Log.info("&lc- Adding missing key '{0}'...", key);
}
}

Path output = child.resolveSibling("output/" + child.getFileName());

Log.info("&lc{0} keys added.", added);
Log.info("Writing bundle to {0}", output);
StringBuilder result = new StringBuilder();
for(ObjectMap.Entry<String, String> e : other.entries()){
result.append(e.toString().replace("\\", "\\\\").replace("\n", "\\n"));
result.append("\n");
}
Files.write(output, result.toString().getBytes());
//PropertiesUtils.store(other, Files.newBufferedWriter(output), null);

}catch (IOException e){
throw new RuntimeException(e);
}
});
}

Expand Down

0 comments on commit b7e28a7

Please sign in to comment.