From d72db58b3f06c4fd6a1f624729c9c16437f07703 Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 22 Mar 2021 16:35:04 -0400 Subject: [PATCH] Minor ConstructBlock logic tweak --- core/src/mindustry/mod/Scripts.java | 3 ++- core/src/mindustry/world/blocks/ConstructBlock.java | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/mod/Scripts.java b/core/src/mindustry/mod/Scripts.java index 80ab1633e7..1634a0bde3 100644 --- a/core/src/mindustry/mod/Scripts.java +++ b/core/src/mindustry/mod/Scripts.java @@ -25,7 +25,8 @@ public class Scripts implements Disposable{ private static final Seq blacklist = Seq.with(".net.", "java.net", "files", "reflect", "javax", "rhino", "file", "channels", "jdk", "runtime", "util.os", "rmi", "security", "org.", "sun.", "beans", "sql", "http", "exec", "compiler", "process", "system", ".awt", "socket", "classloader", "oracle", "invoke", "java.util.function", "java.util.stream", "org.", "mod.classmap"); - private static final Seq whitelist = Seq.with("mindustry.net", "netserver", "netclient", "com.sun.proxy.$proxy", "mindustry.gen.", "mindustry.logic.", "mindustry.async.", "saveio", "systemcursor", "filetreeinitevent"); + private static final Seq whitelist = Seq.with("mindustry.net", "netserver", "netclient", "com.sun.proxy.$proxy", "jdk.proxy1", "mindustry.gen.", + "mindustry.logic.", "mindustry.async.", "saveio", "systemcursor", "filetreeinitevent"); private final Context context; private final Scriptable scope; diff --git a/core/src/mindustry/world/blocks/ConstructBlock.java b/core/src/mindustry/world/blocks/ConstructBlock.java index b9621fe736..112569dd71 100644 --- a/core/src/mindustry/world/blocks/ConstructBlock.java +++ b/core/src/mindustry/world/blocks/ConstructBlock.java @@ -22,6 +22,8 @@ import mindustry.world.*; import mindustry.world.blocks.storage.CoreBlock.*; import mindustry.world.modules.*; +import java.util.*; + import static mindustry.Vars.*; /** A block in the process of construction. */ @@ -263,6 +265,11 @@ public class ConstructBlock extends Block{ } public void deconstruct(Unit builder, @Nullable Building core, float amount){ + //reset accumulated resources when switching modes + if(wasConstructing){ + Arrays.fill(accumulator, 0); + Arrays.fill(totalAccumulator, 0); + } wasConstructing = false; activeDeconstruct = true; float deconstructMultiplier = state.rules.deconstructRefundMultiplier;