Minor ConstructBlock logic tweak

This commit is contained in:
Anuken 2021-03-22 16:35:04 -04:00
parent 975043d439
commit d72db58b3f
2 changed files with 9 additions and 1 deletions

View File

@ -25,7 +25,8 @@ public class Scripts implements Disposable{
private static final Seq<String> 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<String> whitelist = Seq.with("mindustry.net", "netserver", "netclient", "com.sun.proxy.$proxy", "mindustry.gen.", "mindustry.logic.", "mindustry.async.", "saveio", "systemcursor", "filetreeinitevent");
private static final Seq<String> 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;

View File

@ -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;