From 07598e3f2f6b485a11d21eb0c293b2054579f601 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 7 Dec 2019 14:26:14 -0500 Subject: [PATCH] Minor tweaks --- core/src/io/anuke/mindustry/mod/Scripts.java | 6 ++---- .../ui/fragments/ScriptConsoleFragment.java | 15 ++++----------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/core/src/io/anuke/mindustry/mod/Scripts.java b/core/src/io/anuke/mindustry/mod/Scripts.java index e1edbfa078..84fdc4e5d3 100644 --- a/core/src/io/anuke/mindustry/mod/Scripts.java +++ b/core/src/io/anuke/mindustry/mod/Scripts.java @@ -45,9 +45,7 @@ public class Scripts implements Disposable{ } private String getError(Throwable t){ - if(t instanceof EcmaError && t.getCause() != null){ - t = t.getCause(); - } + t = Strings.getFinalCause(t); return t.getClass().getSimpleName() + (t.getMessage() == null ? "" : ": " + t.getMessage()); } @@ -74,7 +72,7 @@ public class Scripts implements Disposable{ try{ context.evaluateString(scope, script, file, 1, null); }catch(Throwable t){ - log(file, getError(t)); + log(file, "[scarlet]" + getError(t)); } } diff --git a/core/src/io/anuke/mindustry/ui/fragments/ScriptConsoleFragment.java b/core/src/io/anuke/mindustry/ui/fragments/ScriptConsoleFragment.java index 700c5beb7c..458bae6c2c 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/ScriptConsoleFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/ScriptConsoleFragment.java @@ -21,7 +21,6 @@ import static io.anuke.mindustry.Vars.*; public class ScriptConsoleFragment extends Table{ private final static int messagesShown = 14; private Array messages = new Array<>(); - private float fadetime; private boolean open = false, shown; private TextField chatfield; private Label fieldlabel = new Label(">"); @@ -133,7 +132,7 @@ public class ScriptConsoleFragment extends Table{ Draw.alpha(shadowColor.a * opacity); float theight = offsety + spacing + getMarginBottom(); - for(int i = scrollPos; i < messages.size && i < messagesShown + scrollPos && (i < fadetime || open); i++){ + for(int i = scrollPos; i < messages.size && i < messagesShown + scrollPos; i++){ layout.setText(font, messages.get(i), Color.white, textWidth, Align.bottomLeft, true); theight += layout.height + textspacing; @@ -142,9 +141,9 @@ public class ScriptConsoleFragment extends Table{ font.getCache().clear(); font.getCache().addText(messages.get(i), fontoffsetx + offsetx, offsety + theight, textWidth, Align.bottomLeft, true); - if(!open && fadetime - i < 1f && fadetime - i >= 0f){ - font.getCache().setAlphas((fadetime - i) * opacity); - Draw.color(0, 0, 0, shadowColor.a * (fadetime - i) * opacity); + if(!open){ + font.getCache().setAlphas(opacity); + Draw.color(0, 0, 0, shadowColor.a * opacity); }else{ font.getCache().setAlphas(opacity); } @@ -157,9 +156,6 @@ public class ScriptConsoleFragment extends Table{ } Draw.color(); - - if(fadetime > 0 && !open) - fadetime -= Time.delta() / 180f; } private void sendMessage(){ @@ -224,8 +220,5 @@ public class ScriptConsoleFragment extends Table{ public void addMessage(String message){ messages.insert(0, message); - - fadetime += 1f; - fadetime = Math.min(fadetime, messagesShown) + 1f; } }