From 0debdee40bfedd07d38a9af09a05832739207f01 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 30 Jul 2022 21:59:36 -0400 Subject: [PATCH] Fixed more wide water / Unit command JSON support --- core/src/mindustry/mod/ContentParser.java | 13 +++++++++++++ core/src/mindustry/world/Tile.java | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/mod/ContentParser.java b/core/src/mindustry/mod/ContentParser.java index fa5f916bd2..448510ace2 100644 --- a/core/src/mindustry/mod/ContentParser.java +++ b/core/src/mindustry/mod/ContentParser.java @@ -16,6 +16,7 @@ import arc.util.serialization.*; import arc.util.serialization.Json.*; import arc.util.serialization.Jval.*; import mindustry.*; +import mindustry.ai.*; import mindustry.ai.types.*; import mindustry.content.*; import mindustry.content.TechTree.*; @@ -104,6 +105,18 @@ public class ContentParser{ readFields(effect, data); return effect; }); + put(UnitCommand.class, (type, data) -> { + if(data.isString()){ + var cmd = UnitCommand.all.find(u -> u.name.equals(data.asString())); + if(cmd != null){ + return cmd; + }else{ + throw new IllegalArgumentException("Unknown unit command name: " + data.asString()); + } + }else{ + throw new IllegalArgumentException("Unit commands must be strings."); + } + }); put(BulletType.class, (type, data) -> { if(data.isString()){ return field(Bullets.class, data); diff --git a/core/src/mindustry/world/Tile.java b/core/src/mindustry/world/Tile.java index f30a8be9d7..85f20acf1b 100644 --- a/core/src/mindustry/world/Tile.java +++ b/core/src/mindustry/world/Tile.java @@ -658,7 +658,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{ table.table(t -> { t.left(); - t.add(new Image(toDisplay.getDisplayIcon(this))).size(8 * 4); + t.add(new Image(toDisplay.getDisplayIcon(this))).scaling(Scaling.fit).size(8 * 4); t.labelWrap(toDisplay.getDisplayName(this)).left().width(190f).padLeft(5); }).growX().left(); }