From f59441005ebc044fee9e5af1982aada086145c29 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 3 Nov 2018 09:17:03 -0400 Subject: [PATCH] New sorted update script --- core/assets/bundles/bundle.properties | 13 ++++--------- .../src/io/anuke/mindustry/BundleLauncher.java | 18 +++++++++++++++--- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 3e8fe5a1db..7f4a153beb 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -73,6 +73,7 @@ text.nextmission = Next Mission text.maps.none = [LIGHT_GRAY]No maps found\! text.about.button = About text.name = Name\: +text.filename = File Name\: text.unlocked = New Block Unlocked\! text.unlocked.plural = New Blocks Unlocked\! text.players = {0} players online @@ -766,16 +767,10 @@ block.bridge-conduit.description = Advanced liquid transport block. Allows trans block.mechanical-pump.description = A cheap pump with slow output, but no power consumption. block.rotary-pump.description = An advanced pump which doubles up speed by using power. block.thermal-pump.description = The ultimate pump. Three times as fast as a mechanical pump and the only pump which is able to retrieve lava. +block.router.description = Accepts items from one direction and outputs them to up to 3 other directions equally. Useful for splitting the materials from one source to multiple targets. +block.distributor.description = An advanced router which splits items to up to 7 other directions equally. +block.bridge-conveyor.description = Advanced item transport block. Allows transporting items over up to 3 tiles of any terrain or building. liquid.water.description = Commonly used for cooling machines and waste processing. liquid.lava.description = Can be transformed into[LIGHT_GRAY] stone[], used for generating power or used as ammo for certain turrets. liquid.oil.description = Can be burnt, exploded or used as a coolant. liquid.cryofluid.description = The most efficient liquid for cooling things down. - -# TODO: These descriptions have been changed. Let translators find them easily. -block.router.description = Accepts items from one direction and outputs them to up to 3 other directions equally. Useful for splitting the materials from one source to multiple targets. -block.distributor.description = An advanced router which splits items to up to 7 other directions equally. -block.bridge-conveyor.description = Advanced item transport block. Allows transporting items over up to 3 tiles of any terrain or building. - -# TODO: To be deleted in all translations: block.bridgeconveyor.name, block.bridgeconveyor.description -# (There are additional elements for bridge-conveyor already) -text.filename = File Name\: diff --git a/tools/src/io/anuke/mindustry/BundleLauncher.java b/tools/src/io/anuke/mindustry/BundleLauncher.java index a423370b33..c6975093e5 100644 --- a/tools/src/io/anuke/mindustry/BundleLauncher.java +++ b/tools/src/io/anuke/mindustry/BundleLauncher.java @@ -4,6 +4,7 @@ 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.function.BiFunction; import io.anuke.ucore.util.Log; import java.io.File; @@ -54,15 +55,26 @@ public class BundleLauncher { } } + BiFunction processor = (key, value) -> (key + " = " + value).replace("\\", "\\\\").replace("\n", "\\n") + "\n"; + 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 e : other.entries()){ - result.append((e.key + " = " + e.value).replace("\\", "\\\\").replace("\n", "\\n")); - result.append("\n"); + + //add everything ordered + for(String key : base.orderedKeys()){ + result.append(processor.get(key, other.get(key))); + other.remove(key); } + + result.append("\n#Additional Entries\n\n"); + + for(ObjectMap.Entry e : other.entries()){ + result.append(processor.get(e.key, e.value)); + } + Files.write(child, result.toString().getBytes(StandardCharsets.UTF_8)); }catch (IOException e){