diff --git a/android/build.gradle b/android/build.gradle index 5486155564..5d438dc30c 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -28,6 +28,7 @@ dependencies{ implementation project(":core") implementation arcModule("backends:backend-android") + implementation 'com.faendir.rhino:rhino-android:1.5.2' natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a" diff --git a/android/src/io/anuke/mindustry/AndroidLauncher.java b/android/src/io/anuke/mindustry/AndroidLauncher.java index 627a782dd3..e8e3223a19 100644 --- a/android/src/io/anuke/mindustry/AndroidLauncher.java +++ b/android/src/io/anuke/mindustry/AndroidLauncher.java @@ -9,10 +9,11 @@ import android.os.Build.*; import android.os.*; import android.provider.Settings.*; import android.telephony.*; +import com.faendir.rhino_android.*; import io.anuke.arc.*; import io.anuke.arc.backends.android.surfaceview.*; import io.anuke.arc.files.*; -import io.anuke.arc.func.Cons; +import io.anuke.arc.func.*; import io.anuke.arc.scene.ui.layout.*; import io.anuke.arc.util.*; import io.anuke.arc.util.serialization.*; @@ -65,6 +66,11 @@ public class AndroidLauncher extends AndroidApplication{ } } + @Override + public org.mozilla.javascript.Context getScriptContext(){ + return new RhinoAndroidHelper(Core.files.local("script-output").file()).enterContext(); + } + @Override public void shareFile(FileHandle file){ } diff --git a/build.gradle b/build.gradle index 4e1252df97..7bb0e486b0 100644 --- a/build.gradle +++ b/build.gradle @@ -257,6 +257,7 @@ project(":core"){ compile arcModule("arc-core") compile arcModule("extensions:freetype") compile arcModule("extensions:arcnet") + compile "org.mozilla:rhino:1.7.11" if(localArc() && debugged()) compile arcModule("extensions:recorder") compileOnly project(":annotations") @@ -298,6 +299,7 @@ project(":tools"){ compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop" + compile "org.reflections:reflections:0.9.11" compile arcModule("backends:backend-sdl") } diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 7ab18ba121..2a32d86f22 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -26,6 +26,7 @@ load.image = Images load.content = Content load.system = System load.mod = Mods +load.scripts = Scripts schematic = Schematic schematic.add = Save Schematic... diff --git a/core/assets/scripts/base.js b/core/assets/scripts/base.js new file mode 100755 index 0000000000..492e7392e5 --- /dev/null +++ b/core/assets/scripts/base.js @@ -0,0 +1,13 @@ +const log = function(context, obj){ + Vars.mods.getScripts().log(context, obj ? String(obj) : "null") +} + +const extendContent = function(classType, name, params){ + return new JavaAdapter(classType, params, name) +} + +const extend = function(classType, params){ + return new JavaAdapter(classType, params) +} + +const base = {} \ No newline at end of file diff --git a/core/assets/scripts/global.js b/core/assets/scripts/global.js new file mode 100755 index 0000000000..43d0b5826c --- /dev/null +++ b/core/assets/scripts/global.js @@ -0,0 +1,70 @@ +//Generated class. Do not modify. + +const log = function(context, obj){ + Vars.mods.getScripts().log(context, obj ? String(obj) : "null") +} + +const extendContent = function(classType, name, params){ + return new JavaAdapter(classType, params, name) +} + +const extend = function(classType, params){ + return new JavaAdapter(classType, params) +} + +const base = {} +importPackage(Packages.io.anuke.arc) +importPackage(Packages.io.anuke.arc.collection) +importPackage(Packages.io.anuke.arc.graphics) +importPackage(Packages.io.anuke.arc.graphics.g2d) +importPackage(Packages.io.anuke.arc.math) +importPackage(Packages.io.anuke.arc.scene) +importPackage(Packages.io.anuke.arc.scene.actions) +importPackage(Packages.io.anuke.arc.scene.event) +importPackage(Packages.io.anuke.arc.scene.style) +importPackage(Packages.io.anuke.arc.scene.ui) +importPackage(Packages.io.anuke.arc.scene.ui.layout) +importPackage(Packages.io.anuke.arc.scene.utils) +importPackage(Packages.io.anuke.arc.util) +importPackage(Packages.io.anuke.mindustry) +importPackage(Packages.io.anuke.mindustry.ai) +importPackage(Packages.io.anuke.mindustry.content) +importPackage(Packages.io.anuke.mindustry.core) +importPackage(Packages.io.anuke.mindustry.ctype) +importPackage(Packages.io.anuke.mindustry.editor) +importPackage(Packages.io.anuke.mindustry.entities) +importPackage(Packages.io.anuke.mindustry.entities.bullet) +importPackage(Packages.io.anuke.mindustry.entities.effect) +importPackage(Packages.io.anuke.mindustry.entities.traits) +importPackage(Packages.io.anuke.mindustry.entities.type) +importPackage(Packages.io.anuke.mindustry.entities.type.base) +importPackage(Packages.io.anuke.mindustry.entities.units) +importPackage(Packages.io.anuke.mindustry.game) +importPackage(Packages.io.anuke.mindustry.graphics) +importPackage(Packages.io.anuke.mindustry.input) +importPackage(Packages.io.anuke.mindustry.maps) +importPackage(Packages.io.anuke.mindustry.maps.filters) +importPackage(Packages.io.anuke.mindustry.maps.generators) +importPackage(Packages.io.anuke.mindustry.maps.zonegen) +importPackage(Packages.io.anuke.mindustry.type) +importPackage(Packages.io.anuke.mindustry.ui) +importPackage(Packages.io.anuke.mindustry.ui.dialogs) +importPackage(Packages.io.anuke.mindustry.ui.fragments) +importPackage(Packages.io.anuke.mindustry.ui.layout) +importPackage(Packages.io.anuke.mindustry.world) +importPackage(Packages.io.anuke.mindustry.world.blocks) +importPackage(Packages.io.anuke.mindustry.world.blocks.defense) +importPackage(Packages.io.anuke.mindustry.world.blocks.defense.turrets) +importPackage(Packages.io.anuke.mindustry.world.blocks.distribution) +importPackage(Packages.io.anuke.mindustry.world.blocks.liquid) +importPackage(Packages.io.anuke.mindustry.world.blocks.logic) +importPackage(Packages.io.anuke.mindustry.world.blocks.power) +importPackage(Packages.io.anuke.mindustry.world.blocks.production) +importPackage(Packages.io.anuke.mindustry.world.blocks.sandbox) +importPackage(Packages.io.anuke.mindustry.world.blocks.storage) +importPackage(Packages.io.anuke.mindustry.world.blocks.units) +importPackage(Packages.io.anuke.mindustry.world.consumers) +importPackage(Packages.io.anuke.mindustry.world.meta) +importPackage(Packages.io.anuke.mindustry.world.meta.values) +importPackage(Packages.io.anuke.mindustry.world.modules) +importPackage(Packages.io.anuke.mindustry.world.producers) diff --git a/core/assets/scripts/wrapper.js b/core/assets/scripts/wrapper.js new file mode 100755 index 0000000000..0c7a8aba4d --- /dev/null +++ b/core/assets/scripts/wrapper.js @@ -0,0 +1,10 @@ +modName = "$MOD_NAME$" + +!function(){ + +const scriptName = "$SCRIPT_NAME$" +const print = text => log(scriptName, text); +$CODE$ + +}(); + diff --git a/core/src/io/anuke/mindustry/ClientLauncher.java b/core/src/io/anuke/mindustry/ClientLauncher.java index 6abff04782..1c8fd4048f 100644 --- a/core/src/io/anuke/mindustry/ClientLauncher.java +++ b/core/src/io/anuke/mindustry/ClientLauncher.java @@ -70,8 +70,11 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform Sounds.load(); assets.loadRun("contentcreate", Content.class, () -> { - content.createContent(); + content.createBaseContent(); content.loadColors(); + }, () -> { + mods.loadScripts(); + content.createModContent(); }); add(logic = new Logic()); @@ -193,7 +196,8 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform if(assets.getCurrentLoading() != null){ String name = assets.getCurrentLoading().fileName.toLowerCase(); - String key = name.contains("content") ? "content" : name.contains("mod") ? "mods" : name.contains("msav") || name.contains("maps") ? "map" : name.contains("ogg") || name.contains("mp3") ? "sound" : name.contains("png") ? "image" : "system"; + String key = name.contains("script") ? "scripts" : name.contains("content") ? "content" : name.contains("mod") ? "mods" : name.contains("msav") || + name.contains("maps") ? "map" : name.contains("ogg") || name.contains("mp3") ? "sound" : name.contains("png") ? "image" : "system"; font.draw(bundle.get("load." + key, ""), graphics.getWidth() / 2f, graphics.getHeight() / 2f - height / 2f - Scl.scl(10f), Align.center); } } diff --git a/core/src/io/anuke/mindustry/content/Blocks.java b/core/src/io/anuke/mindustry/content/Blocks.java index de1cae226f..b68c24587a 100644 --- a/core/src/io/anuke/mindustry/content/Blocks.java +++ b/core/src/io/anuke/mindustry/content/Blocks.java @@ -7,7 +7,7 @@ import io.anuke.arc.graphics.g2d.*; import io.anuke.arc.math.*; import io.anuke.arc.util.*; import io.anuke.mindustry.*; -import io.anuke.mindustry.ctype.ContentList; +import io.anuke.mindustry.ctype.*; import io.anuke.mindustry.entities.*; import io.anuke.mindustry.entities.bullet.*; import io.anuke.mindustry.entities.type.*; @@ -19,8 +19,7 @@ import io.anuke.mindustry.world.blocks.*; import io.anuke.mindustry.world.blocks.defense.*; import io.anuke.mindustry.world.blocks.defense.turrets.*; import io.anuke.mindustry.world.blocks.distribution.*; -import io.anuke.mindustry.world.blocks.liquid.Conduit; -import io.anuke.mindustry.world.blocks.liquid.LiquidTank; +import io.anuke.mindustry.world.blocks.liquid.*; import io.anuke.mindustry.world.blocks.logic.*; import io.anuke.mindustry.world.blocks.power.*; import io.anuke.mindustry.world.blocks.production.*; @@ -915,6 +914,7 @@ public class Blocks implements ContentList{ phaseConveyor = new ItemBridge("phase-conveyor"){{ requirements(Category.distribution, ItemStack.with(Items.phasefabric, 5, Items.silicon, 7, Items.lead, 10, Items.graphite, 10)); range = 12; + canOverdrive = false; hasPower = true; consumes.power(0.30f); }}; @@ -977,7 +977,7 @@ public class Blocks implements ContentList{ size = 3; }}; - conduit = new io.anuke.mindustry.world.blocks.liquid.Conduit("conduit"){{ + conduit = new Conduit("conduit"){{ requirements(Category.liquid, ItemStack.with(Items.metaglass, 1)); health = 45; }}; @@ -989,14 +989,14 @@ public class Blocks implements ContentList{ health = 90; }}; - platedConduit = new io.anuke.mindustry.world.blocks.liquid.ArmoredConduit("plated-conduit"){{ + platedConduit = new ArmoredConduit("plated-conduit"){{ requirements(Category.liquid, ItemStack.with(Items.thorium, 2, Items.metaglass, 1, Items.plastanium, 1)); liquidCapacity = 16f; liquidPressure = 1.025f; health = 220; }}; - liquidRouter = new io.anuke.mindustry.world.blocks.liquid.LiquidRouter("liquid-router"){{ + liquidRouter = new LiquidRouter("liquid-router"){{ requirements(Category.liquid, ItemStack.with(Items.graphite, 4, Items.metaglass, 2)); liquidCapacity = 20f; }}; @@ -1008,20 +1008,21 @@ public class Blocks implements ContentList{ health = 500; }}; - liquidJunction = new io.anuke.mindustry.world.blocks.liquid.LiquidJunction("liquid-junction"){{ + liquidJunction = new LiquidJunction("liquid-junction"){{ requirements(Category.liquid, ItemStack.with(Items.graphite, 2, Items.metaglass, 2)); }}; - bridgeConduit = new io.anuke.mindustry.world.blocks.liquid.LiquidExtendingBridge("bridge-conduit"){{ + bridgeConduit = new LiquidExtendingBridge("bridge-conduit"){{ requirements(Category.liquid, ItemStack.with(Items.graphite, 4, Items.metaglass, 8)); range = 4; hasPower = false; }}; - phaseConduit = new io.anuke.mindustry.world.blocks.liquid.LiquidBridge("phase-conduit"){{ + phaseConduit = new LiquidBridge("phase-conduit"){{ requirements(Category.liquid, ItemStack.with(Items.phasefabric, 5, Items.silicon, 7, Items.metaglass, 20, Items.titanium, 10)); range = 12; hasPower = true; + canOverdrive = false; consumes.power(0.30f); }}; diff --git a/core/src/io/anuke/mindustry/core/ContentLoader.java b/core/src/io/anuke/mindustry/core/ContentLoader.java index bc4d0dac81..ab6c44b5b4 100644 --- a/core/src/io/anuke/mindustry/core/ContentLoader.java +++ b/core/src/io/anuke/mindustry/core/ContentLoader.java @@ -3,6 +3,7 @@ package io.anuke.mindustry.core; import io.anuke.arc.collection.*; import io.anuke.arc.func.*; import io.anuke.arc.graphics.*; +import io.anuke.arc.util.ArcAnnotate.*; import io.anuke.arc.util.*; import io.anuke.mindustry.content.*; import io.anuke.mindustry.ctype.*; @@ -20,10 +21,10 @@ import static io.anuke.mindustry.Vars.mods; */ @SuppressWarnings("unchecked") public class ContentLoader{ - private boolean loaded = false; private ObjectMap[] contentNameMap = new ObjectMap[ContentType.values().length]; private Array[] contentMap = new Array[ContentType.values().length]; private MappableContent[][] temporaryMapper; + private @Nullable LoadedMod currentMod; private ObjectSet> initialization = new ObjectSet<>(); private ContentList[] content = { new Fx(), @@ -43,35 +44,40 @@ public class ContentLoader{ new LegacyColorMapper(), }; + public ContentLoader(){ + clear(); + } + /** Clears all initialized content.*/ public void clear(){ contentNameMap = new ObjectMap[ContentType.values().length]; contentMap = new Array[ContentType.values().length]; initialization = new ObjectSet<>(); - loaded = false; - } - - /** Creates all content types. */ - public void createContent(){ - if(loaded){ - Log.info("Content already loaded, skipping."); - return; - } for(ContentType type : ContentType.values()){ contentMap[type.ordinal()] = new Array<>(); contentNameMap[type.ordinal()] = new ObjectMap<>(); } + } + + /** Creates all base types. */ + public void createBaseContent(){ for(ContentList list : content){ list.load(); } + } + /** Creates mod content, if applicable. */ + public void createModContent(){ if(mods != null){ mods.loadContent(); } + } - //check up ID mapping, make sure it's linear + /** Logs content statistics.*/ + public void logContent(){ + //check up ID mapping, make sure it's linear (debug only) for(Array arr : contentMap){ for(int i = 0; i < arr.size; i++){ int id = arr.get(i).id; @@ -81,11 +87,6 @@ public class ContentLoader{ } } - loaded = true; - } - - /** Logs content statistics.*/ - public void logContent(){ Log.info("--- CONTENT INFO ---"); for(int k = 0; k < contentMap.length; k++){ Log.info("[{0}]: loaded {1}", ContentType.values()[k].name(), contentMap[k].size); @@ -147,13 +148,23 @@ public class ContentLoader{ public void handleContent(Content content){ contentMap[content.getContentType().ordinal()].add(content); + } + public void setCurrentMod(LoadedMod mod){ + this.currentMod = mod; + } + + public String transformName(String name){ + return currentMod == null ? name : currentMod.name + "-" + name; } public void handleMappableContent(MappableContent content){ if(contentNameMap[content.getContentType().ordinal()].containsKey(content.name)){ throw new IllegalArgumentException("Two content objects cannot have the same name! (issue: '" + content.name + "')"); } + if(currentMod != null){ + content.mod = currentMod; + } contentNameMap[content.getContentType().ordinal()].put(content.name, content); } diff --git a/core/src/io/anuke/mindustry/core/Control.java b/core/src/io/anuke/mindustry/core/Control.java index b38cc63297..c7a04955ca 100644 --- a/core/src/io/anuke/mindustry/core/Control.java +++ b/core/src/io/anuke/mindustry/core/Control.java @@ -451,12 +451,12 @@ public class Control implements ApplicationListener, Loadable{ platform.updateRPC(); } - if(Core.input.keyTap(Binding.pause) && !scene.hasDialog() && !ui.restart.isShown() && (state.is(State.paused) || state.is(State.playing))){ + if(Core.input.keyTap(Binding.pause) && !scene.hasDialog() && !scene.hasKeyboard() && !ui.restart.isShown() && (state.is(State.paused) || state.is(State.playing))){ state.set(state.is(State.playing) ? State.paused : State.playing); } if(Core.input.keyTap(Binding.menu) && !ui.restart.isShown()){ - if(ui.chatfrag.chatOpen()){ + if(ui.chatfrag.shown()){ ui.chatfrag.hide(); }else if(!ui.paused.isShown() && !scene.hasDialog()){ ui.paused.show(); @@ -464,7 +464,7 @@ public class Control implements ApplicationListener, Loadable{ } } - if(!mobile && Core.input.keyTap(Binding.screenshot) && !(scene.getKeyboardFocus() instanceof TextField) && !ui.chatfrag.chatOpen()){ + if(!mobile && Core.input.keyTap(Binding.screenshot) && !(scene.getKeyboardFocus() instanceof TextField) && !scene.hasKeyboard()){ renderer.takeMapScreenshot(); } diff --git a/core/src/io/anuke/mindustry/core/NetClient.java b/core/src/io/anuke/mindustry/core/NetClient.java index 2b2e1d4b76..f4cc17693b 100644 --- a/core/src/io/anuke/mindustry/core/NetClient.java +++ b/core/src/io/anuke/mindustry/core/NetClient.java @@ -491,7 +491,7 @@ public class NetClient implements ApplicationListener{ player.pointerX, player.pointerY, player.rotation, player.baseRotation, player.velocity().x, player.velocity().y, player.getMineTile(), - player.isBoosting, player.isShooting, ui.chatfrag.chatOpen(), player.isBuilding, + player.isBoosting, player.isShooting, ui.chatfrag.shown(), player.isBuilding, requests, Core.camera.position.x, Core.camera.position.y, Core.camera.width * viewScale, Core.camera.height * viewScale); diff --git a/core/src/io/anuke/mindustry/core/Platform.java b/core/src/io/anuke/mindustry/core/Platform.java index 50875d426d..b4798fa704 100644 --- a/core/src/io/anuke/mindustry/core/Platform.java +++ b/core/src/io/anuke/mindustry/core/Platform.java @@ -8,10 +8,12 @@ import io.anuke.arc.func.*; import io.anuke.arc.math.*; import io.anuke.arc.scene.ui.*; import io.anuke.arc.util.serialization.*; +import io.anuke.mindustry.mod.*; import io.anuke.mindustry.net.*; import io.anuke.mindustry.net.Net.*; import io.anuke.mindustry.type.*; import io.anuke.mindustry.ui.dialogs.*; +import org.mozilla.javascript.*; import static io.anuke.mindustry.Vars.mobile; @@ -45,6 +47,17 @@ public interface Platform{ return new ArcNetImpl(); } + /** Gets the scripting implementation. */ + default Scripts createScripts(){ + return new Scripts(); + } + + default Context getScriptContext(){ + Context c = Context.enter(); + c.setOptimizationLevel(9); + return c; + } + /** Add a text input dialog that should show up after the field is tapped. */ default void addDialog(TextField field){ addDialog(field, 16); diff --git a/core/src/io/anuke/mindustry/core/UI.java b/core/src/io/anuke/mindustry/core/UI.java index 142481b96d..3eb530ac7f 100644 --- a/core/src/io/anuke/mindustry/core/UI.java +++ b/core/src/io/anuke/mindustry/core/UI.java @@ -42,6 +42,7 @@ public class UI implements ApplicationListener, Loadable{ public MenuFragment menufrag; public HudFragment hudfrag; public ChatFragment chatfrag; + public ScriptConsoleFragment scriptfrag; public PlayerListFragment listfrag; public LoadingFragment loadfrag; @@ -211,6 +212,7 @@ public class UI implements ApplicationListener, Loadable{ chatfrag = new ChatFragment(); listfrag = new PlayerListFragment(); loadfrag = new LoadingFragment(); + scriptfrag = new ScriptConsoleFragment(); picker = new ColorPicker(); editor = new MapEditorDialog(); @@ -253,6 +255,7 @@ public class UI implements ApplicationListener, Loadable{ menufrag.build(menuGroup); chatfrag.container().build(hudGroup); listfrag.build(hudGroup); + scriptfrag.container().build(hudGroup); loadfrag.build(group); new FadeInFragment().build(group); } diff --git a/core/src/io/anuke/mindustry/ctype/MappableContent.java b/core/src/io/anuke/mindustry/ctype/MappableContent.java index 3063157c13..709e7652d4 100644 --- a/core/src/io/anuke/mindustry/ctype/MappableContent.java +++ b/core/src/io/anuke/mindustry/ctype/MappableContent.java @@ -6,7 +6,7 @@ public abstract class MappableContent extends Content{ public final String name; public MappableContent(String name){ - this.name = name; + this.name = Vars.content.transformName(name); Vars.content.handleMappableContent(this); } diff --git a/core/src/io/anuke/mindustry/ctype/UnlockableContent.java b/core/src/io/anuke/mindustry/ctype/UnlockableContent.java index bb50e115cb..7082b4a431 100644 --- a/core/src/io/anuke/mindustry/ctype/UnlockableContent.java +++ b/core/src/io/anuke/mindustry/ctype/UnlockableContent.java @@ -20,8 +20,8 @@ public abstract class UnlockableContent extends MappableContent{ public UnlockableContent(String name){ super(name); - this.localizedName = Core.bundle.get(getContentType() + "." + name + ".name", name); - this.description = Core.bundle.getOrNull(getContentType() + "." + name + ".description"); + this.localizedName = Core.bundle.get(getContentType() + "." + this.name + ".name", this.name); + this.description = Core.bundle.getOrNull(getContentType() + "." + this.name + ".description"); } /** Generate any special icons for this content. Called asynchronously.*/ diff --git a/core/src/io/anuke/mindustry/entities/type/Player.java b/core/src/io/anuke/mindustry/entities/type/Player.java index 4e83cd1091..73c0fc4dc0 100644 --- a/core/src/io/anuke/mindustry/entities/type/Player.java +++ b/core/src/io/anuke/mindustry/entities/type/Player.java @@ -556,7 +556,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{ updateKeyboard(); } - isTyping = ui.chatfrag.chatOpen(); + isTyping = ui.chatfrag.shown(); updateMechanics(); @@ -604,7 +604,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{ movement.limit(speed).scl(Time.delta()); - if(!ui.chatfrag.chatOpen()){ + if(!Core.scene.hasKeyboard()){ velocity.add(movement.x, movement.y); }else{ isShooting = false; @@ -613,7 +613,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{ updateVelocityStatus(); moved = dst(prex, prey) > 0.001f; - if(!ui.chatfrag.chatOpen()){ + if(!Core.scene.hasKeyboard()){ float baseLerp = mech.getRotationAlpha(this); if(!isShooting() || !mech.turnCursor){ if(!movement.isZero()){ diff --git a/core/src/io/anuke/mindustry/input/Binding.java b/core/src/io/anuke/mindustry/input/Binding.java index 45383cb6ef..25d41289e3 100644 --- a/core/src/io/anuke/mindustry/input/Binding.java +++ b/core/src/io/anuke/mindustry/input/Binding.java @@ -54,6 +54,7 @@ public enum Binding implements KeyBind{ chat_history_prev(KeyCode.UP), chat_history_next(KeyCode.DOWN), chat_scroll(new Axis(KeyCode.SCROLL)), + console(KeyCode.BACKTICK), ; private final KeybindValue defaultValue; diff --git a/core/src/io/anuke/mindustry/input/DesktopInput.java b/core/src/io/anuke/mindustry/input/DesktopInput.java index 7b015600ce..e8cc6793d8 100644 --- a/core/src/io/anuke/mindustry/input/DesktopInput.java +++ b/core/src/io/anuke/mindustry/input/DesktopInput.java @@ -122,7 +122,7 @@ public class DesktopInput extends InputHandler{ drawSelected(sreq.x, sreq.y, sreq.block, getRequest(sreq.x, sreq.y, sreq.block.size, sreq) != null ? Pal.remove : Pal.accent); } - if(Core.input.keyDown(Binding.schematic_select) && !ui.chatfrag.chatOpen()){ + if(Core.input.keyDown(Binding.schematic_select) && !Core.scene.hasKeyboard()){ drawSelection(schemX, schemY, cursorX, cursorY, Vars.maxSchematicSize); } @@ -139,7 +139,7 @@ public class DesktopInput extends InputHandler{ player.isShooting = false; } - if(!state.is(State.menu) && Core.input.keyTap(Binding.minimap) && (scene.getKeyboardFocus() == ui.minimap || !scene.hasDialog()) && !ui.chatfrag.chatOpen() && !(scene.getKeyboardFocus() instanceof TextField)){ + if(!state.is(State.menu) && Core.input.keyTap(Binding.minimap) && (scene.getKeyboardFocus() == ui.minimap || !scene.hasDialog()) && !Core.scene.hasKeyboard() && !(scene.getKeyboardFocus() instanceof TextField)){ if(!ui.minimap.isShown()){ ui.minimap.show(); }else{ @@ -293,12 +293,12 @@ public class DesktopInput extends InputHandler{ player.clearBuilding(); } - if(Core.input.keyTap(Binding.schematic_select) && !ui.chatfrag.chatOpen()){ + if(Core.input.keyTap(Binding.schematic_select) && !Core.scene.hasKeyboard()){ schemX = rawCursorX; schemY = rawCursorY; } - if(Core.input.keyTap(Binding.schematic_menu) && !ui.chatfrag.chatOpen()){ + if(Core.input.keyTap(Binding.schematic_menu) && !Core.scene.hasKeyboard()){ if(ui.schematics.isShown()){ ui.schematics.hide(); }else{ @@ -311,7 +311,7 @@ public class DesktopInput extends InputHandler{ selectRequests.clear(); } - if(Core.input.keyRelease(Binding.schematic_select) && !ui.chatfrag.chatOpen()){ + if(Core.input.keyRelease(Binding.schematic_select) && !Core.scene.hasKeyboard()){ lastSchematic = schematics.create(schemX, schemY, rawCursorX, rawCursorY); useSchematic(lastSchematic); if(selectRequests.isEmpty()){ @@ -371,10 +371,10 @@ public class DesktopInput extends InputHandler{ }else if(selected != null){ //only begin shooting if there's no cursor event if(!tileTapped(selected) && !tryTapPlayer(Core.input.mouseWorld().x, Core.input.mouseWorld().y) && (player.buildQueue().size == 0 || !player.isBuilding) && !droppingItem && - !tryBeginMine(selected) && player.getMineTile() == null && !ui.chatfrag.chatOpen()){ + !tryBeginMine(selected) && player.getMineTile() == null && !Core.scene.hasKeyboard()){ player.isShooting = true; } - }else if(!ui.chatfrag.chatOpen()){ //if it's out of bounds, shooting is just fine + }else if(!Core.scene.hasKeyboard()){ //if it's out of bounds, shooting is just fine player.isShooting = true; } }else if(Core.input.keyTap(Binding.deselect) && block != null){ diff --git a/core/src/io/anuke/mindustry/input/PlaceMode.java b/core/src/io/anuke/mindustry/input/PlaceMode.java index 5ac66c5220..cb287caed6 100644 --- a/core/src/io/anuke/mindustry/input/PlaceMode.java +++ b/core/src/io/anuke/mindustry/input/PlaceMode.java @@ -1,5 +1,5 @@ package io.anuke.mindustry.input; -enum PlaceMode{ +public enum PlaceMode{ none, breaking, placing, schematicSelect } diff --git a/core/src/io/anuke/mindustry/mod/ClassAccess.java b/core/src/io/anuke/mindustry/mod/ClassAccess.java new file mode 100644 index 0000000000..48c67d839f --- /dev/null +++ b/core/src/io/anuke/mindustry/mod/ClassAccess.java @@ -0,0 +1,7 @@ +package io.anuke.mindustry.mod; + +import io.anuke.arc.collection.*; +//obviously autogenerated, do not touch +public class ClassAccess{ + public static final ObjectSet allowedClassNames = ObjectSet.with("io.anuke.arc.Core", "io.anuke.arc.collection.Array", "io.anuke.arc.collection.Array$ArrayIterable", "io.anuke.arc.collection.ArrayMap", "io.anuke.arc.collection.ArrayMap$Entries", "io.anuke.arc.collection.ArrayMap$Keys", "io.anuke.arc.collection.ArrayMap$Values", "io.anuke.arc.collection.AtomicQueue", "io.anuke.arc.collection.BinaryHeap", "io.anuke.arc.collection.BinaryHeap$Node", "io.anuke.arc.collection.Bits", "io.anuke.arc.collection.BooleanArray", "io.anuke.arc.collection.ByteArray", "io.anuke.arc.collection.CharArray", "io.anuke.arc.collection.ComparableTimSort", "io.anuke.arc.collection.DelayedRemovalArray", "io.anuke.arc.collection.EnumSet", "io.anuke.arc.collection.EnumSet$EnumSetIterator", "io.anuke.arc.collection.FloatArray", "io.anuke.arc.collection.GridBits", "io.anuke.arc.collection.GridMap", "io.anuke.arc.collection.IdentityMap", "io.anuke.arc.collection.IdentityMap$Entries", "io.anuke.arc.collection.IdentityMap$Entry", "io.anuke.arc.collection.IdentityMap$Keys", "io.anuke.arc.collection.IdentityMap$Values", "io.anuke.arc.collection.IntArray", "io.anuke.arc.collection.IntFloatMap", "io.anuke.arc.collection.IntFloatMap$Entries", "io.anuke.arc.collection.IntFloatMap$Entry", "io.anuke.arc.collection.IntFloatMap$Keys", "io.anuke.arc.collection.IntFloatMap$Values", "io.anuke.arc.collection.IntIntMap", "io.anuke.arc.collection.IntIntMap$Entries", "io.anuke.arc.collection.IntIntMap$Entry", "io.anuke.arc.collection.IntIntMap$Keys", "io.anuke.arc.collection.IntIntMap$Values", "io.anuke.arc.collection.IntMap", "io.anuke.arc.collection.IntMap$Entries", "io.anuke.arc.collection.IntMap$Entry", "io.anuke.arc.collection.IntMap$Keys", "io.anuke.arc.collection.IntMap$Values", "io.anuke.arc.collection.IntQueue", "io.anuke.arc.collection.IntSet", "io.anuke.arc.collection.IntSet$IntSetIterator", "io.anuke.arc.collection.LongArray", "io.anuke.arc.collection.LongMap", "io.anuke.arc.collection.LongMap$Entries", "io.anuke.arc.collection.LongMap$Entry", "io.anuke.arc.collection.LongMap$Keys", "io.anuke.arc.collection.LongMap$Values", "io.anuke.arc.collection.LongQueue", "io.anuke.arc.collection.ObjectFloatMap", "io.anuke.arc.collection.ObjectFloatMap$Entries", "io.anuke.arc.collection.ObjectFloatMap$Entry", "io.anuke.arc.collection.ObjectFloatMap$Keys", "io.anuke.arc.collection.ObjectFloatMap$Values", "io.anuke.arc.collection.ObjectIntMap", "io.anuke.arc.collection.ObjectIntMap$Entries", "io.anuke.arc.collection.ObjectIntMap$Entry", "io.anuke.arc.collection.ObjectIntMap$Keys", "io.anuke.arc.collection.ObjectIntMap$Values", "io.anuke.arc.collection.ObjectMap", "io.anuke.arc.collection.ObjectMap$Entries", "io.anuke.arc.collection.ObjectMap$Entry", "io.anuke.arc.collection.ObjectMap$Keys", "io.anuke.arc.collection.ObjectMap$Values", "io.anuke.arc.collection.ObjectSet", "io.anuke.arc.collection.ObjectSet$ObjectSetIterator", "io.anuke.arc.collection.OrderedMap", "io.anuke.arc.collection.OrderedMap$OrderedMapEntries", "io.anuke.arc.collection.OrderedMap$OrderedMapKeys", "io.anuke.arc.collection.OrderedMap$OrderedMapValues", "io.anuke.arc.collection.OrderedSet", "io.anuke.arc.collection.OrderedSet$OrderedSetIterator", "io.anuke.arc.collection.PooledLinkedList", "io.anuke.arc.collection.PooledLinkedList$Item", "io.anuke.arc.collection.Queue", "io.anuke.arc.collection.Queue$QueueIterable", "io.anuke.arc.collection.ShortArray", "io.anuke.arc.collection.SnapshotArray", "io.anuke.arc.collection.Sort", "io.anuke.arc.collection.SortedIntList", "io.anuke.arc.collection.SortedIntList$Iterator", "io.anuke.arc.collection.SortedIntList$Node", "io.anuke.arc.collection.StringMap", "io.anuke.arc.collection.TimSort", "io.anuke.arc.func.Boolc", "io.anuke.arc.func.Boolf", "io.anuke.arc.func.Boolf2", "io.anuke.arc.func.Boolp", "io.anuke.arc.func.Cons", "io.anuke.arc.func.Cons2", "io.anuke.arc.func.Floatc", "io.anuke.arc.func.Floatc2", "io.anuke.arc.func.Floatc4", "io.anuke.arc.func.Floatf", "io.anuke.arc.func.Floatp", "io.anuke.arc.func.Func", "io.anuke.arc.func.Func2", "io.anuke.arc.func.Func3", "io.anuke.arc.func.Intc", "io.anuke.arc.func.Intc2", "io.anuke.arc.func.Intc4", "io.anuke.arc.func.Intf", "io.anuke.arc.func.Intp", "io.anuke.arc.func.Prov", "io.anuke.arc.graphics.Color", "io.anuke.arc.graphics.g2d.Draw", "io.anuke.arc.graphics.g2d.Fill", "io.anuke.arc.graphics.g2d.Lines", "io.anuke.arc.graphics.g2d.TextureAtlas", "io.anuke.arc.graphics.g2d.TextureAtlas$AtlasRegion", "io.anuke.arc.graphics.g2d.TextureRegion", "io.anuke.arc.math.Angles", "io.anuke.arc.math.Mathf", "io.anuke.arc.scene.Action", "io.anuke.arc.scene.Element", "io.anuke.arc.scene.Group", "io.anuke.arc.scene.Scene", "io.anuke.arc.scene.Scene$TouchFocus", "io.anuke.arc.scene.actions.Actions", "io.anuke.arc.scene.actions.AddAction", "io.anuke.arc.scene.actions.AddListenerAction", "io.anuke.arc.scene.actions.AfterAction", "io.anuke.arc.scene.actions.AlphaAction", "io.anuke.arc.scene.actions.ColorAction", "io.anuke.arc.scene.actions.DelayAction", "io.anuke.arc.scene.actions.DelegateAction", "io.anuke.arc.scene.actions.FloatAction", "io.anuke.arc.scene.actions.IntAction", "io.anuke.arc.scene.actions.LayoutAction", "io.anuke.arc.scene.actions.MoveByAction", "io.anuke.arc.scene.actions.MoveToAction", "io.anuke.arc.scene.actions.OriginAction", "io.anuke.arc.scene.actions.ParallelAction", "io.anuke.arc.scene.actions.RelativeTemporalAction", "io.anuke.arc.scene.actions.RemoveAction", "io.anuke.arc.scene.actions.RemoveActorAction", "io.anuke.arc.scene.actions.RemoveListenerAction", "io.anuke.arc.scene.actions.RepeatAction", "io.anuke.arc.scene.actions.RotateByAction", "io.anuke.arc.scene.actions.RotateToAction", "io.anuke.arc.scene.actions.RunnableAction", "io.anuke.arc.scene.actions.ScaleByAction", "io.anuke.arc.scene.actions.ScaleToAction", "io.anuke.arc.scene.actions.SequenceAction", "io.anuke.arc.scene.actions.SizeByAction", "io.anuke.arc.scene.actions.SizeToAction", "io.anuke.arc.scene.actions.TemporalAction", "io.anuke.arc.scene.actions.TimeScaleAction", "io.anuke.arc.scene.actions.TouchableAction", "io.anuke.arc.scene.actions.TranslateByAction", "io.anuke.arc.scene.actions.VisibleAction", "io.anuke.arc.scene.event.ChangeListener", "io.anuke.arc.scene.event.ChangeListener$ChangeEvent", "io.anuke.arc.scene.event.ClickListener", "io.anuke.arc.scene.event.DragListener", "io.anuke.arc.scene.event.DragScrollListener", "io.anuke.arc.scene.event.ElementGestureListener", "io.anuke.arc.scene.event.EventListener", "io.anuke.arc.scene.event.FocusListener", "io.anuke.arc.scene.event.FocusListener$FocusEvent", "io.anuke.arc.scene.event.FocusListener$FocusEvent$Type", "io.anuke.arc.scene.event.HandCursorListener", "io.anuke.arc.scene.event.IbeamCursorListener", "io.anuke.arc.scene.event.InputEvent", "io.anuke.arc.scene.event.InputEvent$Type", "io.anuke.arc.scene.event.InputListener", "io.anuke.arc.scene.event.SceneEvent", "io.anuke.arc.scene.event.Touchable", "io.anuke.arc.scene.event.VisibilityEvent", "io.anuke.arc.scene.event.VisibilityListener", "io.anuke.arc.scene.style.BaseDrawable", "io.anuke.arc.scene.style.Drawable", "io.anuke.arc.scene.style.NinePatchDrawable", "io.anuke.arc.scene.style.ScaledNinePatchDrawable", "io.anuke.arc.scene.style.Style", "io.anuke.arc.scene.style.TextureRegionDrawable", "io.anuke.arc.scene.style.TiledDrawable", "io.anuke.arc.scene.style.TransformDrawable", "io.anuke.arc.scene.ui.Button", "io.anuke.arc.scene.ui.Button$ButtonStyle", "io.anuke.arc.scene.ui.ButtonGroup", "io.anuke.arc.scene.ui.CheckBox", "io.anuke.arc.scene.ui.CheckBox$CheckBoxStyle", "io.anuke.arc.scene.ui.ColorImage", "io.anuke.arc.scene.ui.Dialog", "io.anuke.arc.scene.ui.Dialog$DialogStyle", "io.anuke.arc.scene.ui.Image", "io.anuke.arc.scene.ui.ImageButton", "io.anuke.arc.scene.ui.ImageButton$ImageButtonStyle", "io.anuke.arc.scene.ui.KeybindDialog", "io.anuke.arc.scene.ui.KeybindDialog$KeybindDialogStyle", "io.anuke.arc.scene.ui.Label", "io.anuke.arc.scene.ui.Label$LabelStyle", "io.anuke.arc.scene.ui.ProgressBar", "io.anuke.arc.scene.ui.ProgressBar$ProgressBarStyle", "io.anuke.arc.scene.ui.ScrollPane", "io.anuke.arc.scene.ui.ScrollPane$ScrollPaneStyle", "io.anuke.arc.scene.ui.SettingsDialog", "io.anuke.arc.scene.ui.SettingsDialog$SettingsTable", "io.anuke.arc.scene.ui.SettingsDialog$SettingsTable$CheckSetting", "io.anuke.arc.scene.ui.SettingsDialog$SettingsTable$Setting", "io.anuke.arc.scene.ui.SettingsDialog$SettingsTable$SliderSetting", "io.anuke.arc.scene.ui.SettingsDialog$StringProcessor", "io.anuke.arc.scene.ui.Slider", "io.anuke.arc.scene.ui.Slider$SliderStyle", "io.anuke.arc.scene.ui.TextArea", "io.anuke.arc.scene.ui.TextArea$TextAreaListener", "io.anuke.arc.scene.ui.TextButton", "io.anuke.arc.scene.ui.TextButton$TextButtonStyle", "io.anuke.arc.scene.ui.TextField", "io.anuke.arc.scene.ui.TextField$DefaultOnscreenKeyboard", "io.anuke.arc.scene.ui.TextField$OnscreenKeyboard", "io.anuke.arc.scene.ui.TextField$TextFieldClickListener", "io.anuke.arc.scene.ui.TextField$TextFieldFilter", "io.anuke.arc.scene.ui.TextField$TextFieldListener", "io.anuke.arc.scene.ui.TextField$TextFieldStyle", "io.anuke.arc.scene.ui.TextField$TextFieldValidator", "io.anuke.arc.scene.ui.Tooltip", "io.anuke.arc.scene.ui.Tooltip$Tooltips", "io.anuke.arc.scene.ui.Touchpad", "io.anuke.arc.scene.ui.Touchpad$TouchpadStyle", "io.anuke.arc.scene.ui.TreeElement", "io.anuke.arc.scene.ui.TreeElement$Node", "io.anuke.arc.scene.ui.TreeElement$TreeStyle", "io.anuke.arc.scene.ui.layout.Cell", "io.anuke.arc.scene.ui.layout.Collapser", "io.anuke.arc.scene.ui.layout.HorizontalGroup", "io.anuke.arc.scene.ui.layout.Scl", "io.anuke.arc.scene.ui.layout.Stack", "io.anuke.arc.scene.ui.layout.Table", "io.anuke.arc.scene.ui.layout.Table$DrawRect", "io.anuke.arc.scene.ui.layout.VerticalGroup", "io.anuke.arc.scene.ui.layout.WidgetGroup", "io.anuke.arc.scene.utils.ArraySelection", "io.anuke.arc.scene.utils.Cullable", "io.anuke.arc.scene.utils.Disableable", "io.anuke.arc.scene.utils.DragAndDrop", "io.anuke.arc.scene.utils.DragAndDrop$Payload", "io.anuke.arc.scene.utils.DragAndDrop$Source", "io.anuke.arc.scene.utils.DragAndDrop$Target", "io.anuke.arc.scene.utils.Elements", "io.anuke.arc.scene.utils.Layout", "io.anuke.arc.scene.utils.Selection", "io.anuke.arc.util.Time", "io.anuke.mindustry.Vars", "io.anuke.mindustry.ai.BlockIndexer", "io.anuke.mindustry.ai.Pathfinder", "io.anuke.mindustry.ai.Pathfinder$PathData", "io.anuke.mindustry.ai.Pathfinder$PathTarget", "io.anuke.mindustry.ai.Pathfinder$PathTileStruct", "io.anuke.mindustry.ai.WaveSpawner", "io.anuke.mindustry.content.Blocks", "io.anuke.mindustry.content.Bullets", "io.anuke.mindustry.content.Fx", "io.anuke.mindustry.content.Items", "io.anuke.mindustry.content.Liquids", "io.anuke.mindustry.content.Loadouts", "io.anuke.mindustry.content.Mechs", "io.anuke.mindustry.content.StatusEffects", "io.anuke.mindustry.content.TechTree", "io.anuke.mindustry.content.TechTree$TechNode", "io.anuke.mindustry.content.TypeIDs", "io.anuke.mindustry.content.UnitTypes", "io.anuke.mindustry.content.Zones", "io.anuke.mindustry.core.ContentLoader", "io.anuke.mindustry.core.Control", "io.anuke.mindustry.core.FileTree", "io.anuke.mindustry.core.GameState", "io.anuke.mindustry.core.GameState$State", "io.anuke.mindustry.core.Logic", "io.anuke.mindustry.core.Platform", "io.anuke.mindustry.core.Renderer", "io.anuke.mindustry.core.UI", "io.anuke.mindustry.core.Version", "io.anuke.mindustry.core.World", "io.anuke.mindustry.core.World$Raycaster", "io.anuke.mindustry.ctype.Content", "io.anuke.mindustry.ctype.ContentList", "io.anuke.mindustry.ctype.MappableContent", "io.anuke.mindustry.ctype.UnlockableContent", "io.anuke.mindustry.editor.DrawOperation", "io.anuke.mindustry.editor.DrawOperation$OpType", "io.anuke.mindustry.editor.DrawOperation$TileOpStruct", "io.anuke.mindustry.editor.EditorTile", "io.anuke.mindustry.editor.EditorTool", "io.anuke.mindustry.editor.MapEditor", "io.anuke.mindustry.editor.MapEditor$Context", "io.anuke.mindustry.editor.MapEditorDialog", "io.anuke.mindustry.editor.MapGenerateDialog", "io.anuke.mindustry.editor.MapInfoDialog", "io.anuke.mindustry.editor.MapLoadDialog", "io.anuke.mindustry.editor.MapRenderer", "io.anuke.mindustry.editor.MapResizeDialog", "io.anuke.mindustry.editor.MapSaveDialog", "io.anuke.mindustry.editor.MapView", "io.anuke.mindustry.editor.OperationStack", "io.anuke.mindustry.editor.WaveInfoDialog", "io.anuke.mindustry.entities.Damage", "io.anuke.mindustry.entities.Damage$PropCellStruct", "io.anuke.mindustry.entities.Effects", "io.anuke.mindustry.entities.Effects$Effect", "io.anuke.mindustry.entities.Effects$EffectContainer", "io.anuke.mindustry.entities.Effects$EffectProvider", "io.anuke.mindustry.entities.Effects$EffectRenderer", "io.anuke.mindustry.entities.Effects$ScreenshakeProvider", "io.anuke.mindustry.entities.Entities", "io.anuke.mindustry.entities.EntityCollisions", "io.anuke.mindustry.entities.EntityGroup", "io.anuke.mindustry.entities.Predict", "io.anuke.mindustry.entities.TargetPriority", "io.anuke.mindustry.entities.Units", "io.anuke.mindustry.entities.bullet.ArtilleryBulletType", "io.anuke.mindustry.entities.bullet.BasicBulletType", "io.anuke.mindustry.entities.bullet.BombBulletType", "io.anuke.mindustry.entities.bullet.BulletType", "io.anuke.mindustry.entities.bullet.FlakBulletType", "io.anuke.mindustry.entities.bullet.HealBulletType", "io.anuke.mindustry.entities.bullet.LiquidBulletType", "io.anuke.mindustry.entities.bullet.MassDriverBolt", "io.anuke.mindustry.entities.bullet.MissileBulletType", "io.anuke.mindustry.entities.effect.Decal", "io.anuke.mindustry.entities.effect.Fire", "io.anuke.mindustry.entities.effect.GroundEffectEntity", "io.anuke.mindustry.entities.effect.GroundEffectEntity$GroundEffect", "io.anuke.mindustry.entities.effect.ItemTransfer", "io.anuke.mindustry.entities.effect.Lightning", "io.anuke.mindustry.entities.effect.Puddle", "io.anuke.mindustry.entities.effect.RubbleDecal", "io.anuke.mindustry.entities.effect.ScorchDecal", "io.anuke.mindustry.entities.traits.AbsorbTrait", "io.anuke.mindustry.entities.traits.BelowLiquidTrait", "io.anuke.mindustry.entities.traits.BuilderMinerTrait", "io.anuke.mindustry.entities.traits.BuilderTrait", "io.anuke.mindustry.entities.traits.BuilderTrait$BuildDataStatic", "io.anuke.mindustry.entities.traits.BuilderTrait$BuildRequest", "io.anuke.mindustry.entities.traits.DamageTrait", "io.anuke.mindustry.entities.traits.DrawTrait", "io.anuke.mindustry.entities.traits.Entity", "io.anuke.mindustry.entities.traits.HealthTrait", "io.anuke.mindustry.entities.traits.KillerTrait", "io.anuke.mindustry.entities.traits.MinerTrait", "io.anuke.mindustry.entities.traits.MoveTrait", "io.anuke.mindustry.entities.traits.SaveTrait", "io.anuke.mindustry.entities.traits.Saveable", "io.anuke.mindustry.entities.traits.ScaleTrait", "io.anuke.mindustry.entities.traits.ShooterTrait", "io.anuke.mindustry.entities.traits.SolidTrait", "io.anuke.mindustry.entities.traits.SpawnerTrait", "io.anuke.mindustry.entities.traits.SyncTrait", "io.anuke.mindustry.entities.traits.TargetTrait", "io.anuke.mindustry.entities.traits.TeamTrait", "io.anuke.mindustry.entities.traits.TimeTrait", "io.anuke.mindustry.entities.traits.TypeTrait", "io.anuke.mindustry.entities.traits.VelocityTrait", "io.anuke.mindustry.entities.type.BaseEntity", "io.anuke.mindustry.entities.type.BaseUnit", "io.anuke.mindustry.entities.type.Bullet", "io.anuke.mindustry.entities.type.DestructibleEntity", "io.anuke.mindustry.entities.type.EffectEntity", "io.anuke.mindustry.entities.type.Player", "io.anuke.mindustry.entities.type.SolidEntity", "io.anuke.mindustry.entities.type.TileEntity", "io.anuke.mindustry.entities.type.TimedEntity", "io.anuke.mindustry.entities.type.Unit", "io.anuke.mindustry.entities.type.base.BaseDrone", "io.anuke.mindustry.entities.type.base.BuilderDrone", "io.anuke.mindustry.entities.type.base.Crawler", "io.anuke.mindustry.entities.type.base.Dagger", "io.anuke.mindustry.entities.type.base.Draug", "io.anuke.mindustry.entities.type.base.Eruptor", "io.anuke.mindustry.entities.type.base.FlyingUnit", "io.anuke.mindustry.entities.type.base.Fortress", "io.anuke.mindustry.entities.type.base.Ghoul", "io.anuke.mindustry.entities.type.base.GroundUnit", "io.anuke.mindustry.entities.type.base.MinerDrone", "io.anuke.mindustry.entities.type.base.Phantom", "io.anuke.mindustry.entities.type.base.RepairDrone", "io.anuke.mindustry.entities.type.base.Revenant", "io.anuke.mindustry.entities.type.base.Spirit", "io.anuke.mindustry.entities.type.base.Titan", "io.anuke.mindustry.entities.type.base.Wraith", "io.anuke.mindustry.entities.units.StateMachine", "io.anuke.mindustry.entities.units.Statuses", "io.anuke.mindustry.entities.units.Statuses$StatusEntry", "io.anuke.mindustry.entities.units.UnitCommand", "io.anuke.mindustry.entities.units.UnitDrops", "io.anuke.mindustry.entities.units.UnitState", "io.anuke.mindustry.game.DefaultWaves", "io.anuke.mindustry.game.Difficulty", "io.anuke.mindustry.game.EventType", "io.anuke.mindustry.game.EventType$BlockBuildBeginEvent", "io.anuke.mindustry.game.EventType$BlockBuildEndEvent", "io.anuke.mindustry.game.EventType$BlockDestroyEvent", "io.anuke.mindustry.game.EventType$BlockInfoEvent", "io.anuke.mindustry.game.EventType$BuildSelectEvent", "io.anuke.mindustry.game.EventType$ClientLoadEvent", "io.anuke.mindustry.game.EventType$CommandIssueEvent", "io.anuke.mindustry.game.EventType$ContentReloadEvent", "io.anuke.mindustry.game.EventType$CoreItemDeliverEvent", "io.anuke.mindustry.game.EventType$DepositEvent", "io.anuke.mindustry.game.EventType$DisposeEvent", "io.anuke.mindustry.game.EventType$GameOverEvent", "io.anuke.mindustry.game.EventType$LaunchEvent", "io.anuke.mindustry.game.EventType$LaunchItemEvent", "io.anuke.mindustry.game.EventType$LineConfirmEvent", "io.anuke.mindustry.game.EventType$LoseEvent", "io.anuke.mindustry.game.EventType$MapMakeEvent", "io.anuke.mindustry.game.EventType$MapPublishEvent", "io.anuke.mindustry.game.EventType$MechChangeEvent", "io.anuke.mindustry.game.EventType$PlayEvent", "io.anuke.mindustry.game.EventType$PlayerBanEvent", "io.anuke.mindustry.game.EventType$PlayerChatEvent", "io.anuke.mindustry.game.EventType$PlayerConnect", "io.anuke.mindustry.game.EventType$PlayerIpBanEvent", "io.anuke.mindustry.game.EventType$PlayerIpUnbanEvent", "io.anuke.mindustry.game.EventType$PlayerJoin", "io.anuke.mindustry.game.EventType$PlayerLeave", "io.anuke.mindustry.game.EventType$PlayerUnbanEvent", "io.anuke.mindustry.game.EventType$ResearchEvent", "io.anuke.mindustry.game.EventType$ResetEvent", "io.anuke.mindustry.game.EventType$ResizeEvent", "io.anuke.mindustry.game.EventType$StateChangeEvent", "io.anuke.mindustry.game.EventType$TapConfigEvent", "io.anuke.mindustry.game.EventType$TapEvent", "io.anuke.mindustry.game.EventType$TileChangeEvent", "io.anuke.mindustry.game.EventType$Trigger", "io.anuke.mindustry.game.EventType$TurretAmmoDeliverEvent", "io.anuke.mindustry.game.EventType$UnitCreateEvent", "io.anuke.mindustry.game.EventType$UnitDestroyEvent", "io.anuke.mindustry.game.EventType$UnlockEvent", "io.anuke.mindustry.game.EventType$WaveEvent", "io.anuke.mindustry.game.EventType$WinEvent", "io.anuke.mindustry.game.EventType$WithdrawEvent", "io.anuke.mindustry.game.EventType$WorldLoadEvent", "io.anuke.mindustry.game.EventType$ZoneConfigureCompleteEvent", "io.anuke.mindustry.game.EventType$ZoneRequireCompleteEvent", "io.anuke.mindustry.game.Gamemode", "io.anuke.mindustry.game.GlobalData", "io.anuke.mindustry.game.LoopControl", "io.anuke.mindustry.game.MusicControl", "io.anuke.mindustry.game.Objective", "io.anuke.mindustry.game.Objectives", "io.anuke.mindustry.game.Objectives$Launched", "io.anuke.mindustry.game.Objectives$Unlock", "io.anuke.mindustry.game.Objectives$Wave", "io.anuke.mindustry.game.Objectives$ZoneObjective", "io.anuke.mindustry.game.Objectives$ZoneWave", "io.anuke.mindustry.game.Rules", "io.anuke.mindustry.game.Saves", "io.anuke.mindustry.game.Saves$SaveSlot", "io.anuke.mindustry.game.Schematic", "io.anuke.mindustry.game.Schematic$Stile", "io.anuke.mindustry.game.Schematics", "io.anuke.mindustry.game.SoundLoop", "io.anuke.mindustry.game.SpawnGroup", "io.anuke.mindustry.game.Stats", "io.anuke.mindustry.game.Stats$Rank", "io.anuke.mindustry.game.Stats$RankResult", "io.anuke.mindustry.game.Team", "io.anuke.mindustry.game.Teams", "io.anuke.mindustry.game.Teams$BrokenBlock", "io.anuke.mindustry.game.Teams$TeamData", "io.anuke.mindustry.game.Tutorial", "io.anuke.mindustry.game.Tutorial$TutorialStage", "io.anuke.mindustry.graphics.BlockRenderer", "io.anuke.mindustry.graphics.Bloom", "io.anuke.mindustry.graphics.CacheLayer", "io.anuke.mindustry.graphics.Drawf", "io.anuke.mindustry.graphics.FloorRenderer", "io.anuke.mindustry.graphics.IndexedRenderer", "io.anuke.mindustry.graphics.Layer", "io.anuke.mindustry.graphics.LightRenderer", "io.anuke.mindustry.graphics.MenuRenderer", "io.anuke.mindustry.graphics.MinimapRenderer", "io.anuke.mindustry.graphics.MultiPacker", "io.anuke.mindustry.graphics.MultiPacker$PageType", "io.anuke.mindustry.graphics.OverlayRenderer", "io.anuke.mindustry.graphics.Pal", "io.anuke.mindustry.graphics.Pixelator", "io.anuke.mindustry.graphics.Shaders", "io.anuke.mindustry.input.Binding", "io.anuke.mindustry.input.DesktopInput", "io.anuke.mindustry.input.InputHandler", "io.anuke.mindustry.input.InputHandler$PlaceLine", "io.anuke.mindustry.input.MobileInput", "io.anuke.mindustry.input.PlaceMode", "io.anuke.mindustry.input.Placement", "io.anuke.mindustry.input.Placement$DistanceHeuristic", "io.anuke.mindustry.input.Placement$NormalizeDrawResult", "io.anuke.mindustry.input.Placement$NormalizeResult", "io.anuke.mindustry.input.Placement$TileHueristic", "io.anuke.mindustry.maps.Map", "io.anuke.mindustry.maps.Maps", "io.anuke.mindustry.maps.Maps$MapProvider", "io.anuke.mindustry.maps.Maps$ShuffleMode", "io.anuke.mindustry.maps.Maps$ShuffleMode", "io.anuke.mindustry.maps.filters.BlendFilter", "io.anuke.mindustry.maps.filters.ClearFilter", "io.anuke.mindustry.maps.filters.DistortFilter", "io.anuke.mindustry.maps.filters.FilterOption", "io.anuke.mindustry.maps.filters.FilterOption$BlockOption", "io.anuke.mindustry.maps.filters.FilterOption$SliderOption", "io.anuke.mindustry.maps.filters.GenerateFilter", "io.anuke.mindustry.maps.filters.GenerateFilter$GenerateInput", "io.anuke.mindustry.maps.filters.GenerateFilter$GenerateInput$TileProvider", "io.anuke.mindustry.maps.filters.MedianFilter", "io.anuke.mindustry.maps.filters.MirrorFilter", "io.anuke.mindustry.maps.filters.NoiseFilter", "io.anuke.mindustry.maps.filters.OreFilter", "io.anuke.mindustry.maps.filters.OreMedianFilter", "io.anuke.mindustry.maps.filters.RiverNoiseFilter", "io.anuke.mindustry.maps.filters.ScatterFilter", "io.anuke.mindustry.maps.filters.TerrainFilter", "io.anuke.mindustry.maps.generators.BasicGenerator", "io.anuke.mindustry.maps.generators.BasicGenerator$DistanceHeuristic", "io.anuke.mindustry.maps.generators.BasicGenerator$TileHueristic", "io.anuke.mindustry.maps.generators.Generator", "io.anuke.mindustry.maps.generators.MapGenerator", "io.anuke.mindustry.maps.generators.MapGenerator$Decoration", "io.anuke.mindustry.maps.generators.RandomGenerator", "io.anuke.mindustry.maps.zonegen.DesertWastesGenerator", "io.anuke.mindustry.maps.zonegen.OvergrowthGenerator", "io.anuke.mindustry.type.Category", "io.anuke.mindustry.type.ContentType", "io.anuke.mindustry.type.Item", "io.anuke.mindustry.type.ItemStack", "io.anuke.mindustry.type.ItemType", "io.anuke.mindustry.type.Liquid", "io.anuke.mindustry.type.LiquidStack", "io.anuke.mindustry.type.Mech", "io.anuke.mindustry.type.Publishable", "io.anuke.mindustry.type.StatusEffect", "io.anuke.mindustry.type.StatusEffect$TransitionHandler", "io.anuke.mindustry.type.TypeID", "io.anuke.mindustry.type.UnitType", "io.anuke.mindustry.type.Weapon", "io.anuke.mindustry.type.WeatherEvent", "io.anuke.mindustry.type.Zone", "io.anuke.mindustry.ui.Bar", "io.anuke.mindustry.ui.BorderImage", "io.anuke.mindustry.ui.Cicon", "io.anuke.mindustry.ui.ContentDisplay", "io.anuke.mindustry.ui.Fonts", "io.anuke.mindustry.ui.GridImage", "io.anuke.mindustry.ui.IconSize", "io.anuke.mindustry.ui.IntFormat", "io.anuke.mindustry.ui.ItemDisplay", "io.anuke.mindustry.ui.ItemImage", "io.anuke.mindustry.ui.ItemsDisplay", "io.anuke.mindustry.ui.Links", "io.anuke.mindustry.ui.Links$LinkEntry", "io.anuke.mindustry.ui.LiquidDisplay", "io.anuke.mindustry.ui.Minimap", "io.anuke.mindustry.ui.MobileButton", "io.anuke.mindustry.ui.MultiReqImage", "io.anuke.mindustry.ui.ReqImage", "io.anuke.mindustry.ui.Styles", "io.anuke.mindustry.ui.dialogs.AboutDialog", "io.anuke.mindustry.ui.dialogs.AdminsDialog", "io.anuke.mindustry.ui.dialogs.BansDialog", "io.anuke.mindustry.ui.dialogs.ColorPicker", "io.anuke.mindustry.ui.dialogs.ContentInfoDialog", "io.anuke.mindustry.ui.dialogs.ControlsDialog", "io.anuke.mindustry.ui.dialogs.CustomGameDialog", "io.anuke.mindustry.ui.dialogs.CustomRulesDialog", "io.anuke.mindustry.ui.dialogs.DatabaseDialog", "io.anuke.mindustry.ui.dialogs.DeployDialog", "io.anuke.mindustry.ui.dialogs.DeployDialog$View", "io.anuke.mindustry.ui.dialogs.DeployDialog$ZoneNode", "io.anuke.mindustry.ui.dialogs.DiscordDialog", "io.anuke.mindustry.ui.dialogs.FileChooser", "io.anuke.mindustry.ui.dialogs.FileChooser$FileHistory", "io.anuke.mindustry.ui.dialogs.FloatingDialog", "io.anuke.mindustry.ui.dialogs.GameOverDialog", "io.anuke.mindustry.ui.dialogs.HostDialog", "io.anuke.mindustry.ui.dialogs.JoinDialog", "io.anuke.mindustry.ui.dialogs.JoinDialog$Server", "io.anuke.mindustry.ui.dialogs.LanguageDialog", "io.anuke.mindustry.ui.dialogs.LoadDialog", "io.anuke.mindustry.ui.dialogs.LoadoutDialog", "io.anuke.mindustry.ui.dialogs.MapPlayDialog", "io.anuke.mindustry.ui.dialogs.MapsDialog", "io.anuke.mindustry.ui.dialogs.MinimapDialog", "io.anuke.mindustry.ui.dialogs.ModsDialog", "io.anuke.mindustry.ui.dialogs.PaletteDialog", "io.anuke.mindustry.ui.dialogs.PausedDialog", "io.anuke.mindustry.ui.dialogs.SaveDialog", "io.anuke.mindustry.ui.dialogs.SchematicsDialog", "io.anuke.mindustry.ui.dialogs.SchematicsDialog$SchematicImage", "io.anuke.mindustry.ui.dialogs.SchematicsDialog$SchematicInfoDialog", "io.anuke.mindustry.ui.dialogs.SettingsMenuDialog", "io.anuke.mindustry.ui.dialogs.TechTreeDialog", "io.anuke.mindustry.ui.dialogs.TechTreeDialog$LayoutNode", "io.anuke.mindustry.ui.dialogs.TechTreeDialog$TechTreeNode", "io.anuke.mindustry.ui.dialogs.TechTreeDialog$View", "io.anuke.mindustry.ui.dialogs.TraceDialog", "io.anuke.mindustry.ui.dialogs.ZoneInfoDialog", "io.anuke.mindustry.ui.fragments.BlockConfigFragment", "io.anuke.mindustry.ui.fragments.BlockInventoryFragment", "io.anuke.mindustry.ui.fragments.ChatFragment", "io.anuke.mindustry.ui.fragments.FadeInFragment", "io.anuke.mindustry.ui.fragments.Fragment", "io.anuke.mindustry.ui.fragments.HudFragment", "io.anuke.mindustry.ui.fragments.LoadingFragment", "io.anuke.mindustry.ui.fragments.MenuFragment", "io.anuke.mindustry.ui.fragments.OverlayFragment", "io.anuke.mindustry.ui.fragments.PlacementFragment", "io.anuke.mindustry.ui.fragments.PlayerListFragment", "io.anuke.mindustry.ui.fragments.ScriptConsoleFragment", "io.anuke.mindustry.ui.layout.BranchTreeLayout", "io.anuke.mindustry.ui.layout.BranchTreeLayout$TreeAlignment", "io.anuke.mindustry.ui.layout.BranchTreeLayout$TreeLocation", "io.anuke.mindustry.ui.layout.RadialTreeLayout", "io.anuke.mindustry.ui.layout.TreeLayout", "io.anuke.mindustry.ui.layout.TreeLayout$TreeNode", "io.anuke.mindustry.world.Block", "io.anuke.mindustry.world.BlockStorage", "io.anuke.mindustry.world.Build", "io.anuke.mindustry.world.CachedTile", "io.anuke.mindustry.world.DirectionalItemBuffer", "io.anuke.mindustry.world.DirectionalItemBuffer$BufferItemStruct", "io.anuke.mindustry.world.Edges", "io.anuke.mindustry.world.ItemBuffer", "io.anuke.mindustry.world.LegacyColorMapper", "io.anuke.mindustry.world.LegacyColorMapper$LegacyBlock", "io.anuke.mindustry.world.Pos", "io.anuke.mindustry.world.StaticTree", "io.anuke.mindustry.world.Tile", "io.anuke.mindustry.world.WorldContext", "io.anuke.mindustry.world.blocks.Attributes", "io.anuke.mindustry.world.blocks.Autotiler", "io.anuke.mindustry.world.blocks.Autotiler$AutotilerHolder", "io.anuke.mindustry.world.blocks.BlockPart", "io.anuke.mindustry.world.blocks.BuildBlock", "io.anuke.mindustry.world.blocks.BuildBlock$BuildEntity", "io.anuke.mindustry.world.blocks.DoubleOverlayFloor", "io.anuke.mindustry.world.blocks.Floor", "io.anuke.mindustry.world.blocks.ItemSelection", "io.anuke.mindustry.world.blocks.LiquidBlock", "io.anuke.mindustry.world.blocks.OreBlock", "io.anuke.mindustry.world.blocks.OverlayFloor", "io.anuke.mindustry.world.blocks.PowerBlock", "io.anuke.mindustry.world.blocks.RespawnBlock", "io.anuke.mindustry.world.blocks.Rock", "io.anuke.mindustry.world.blocks.StaticWall", "io.anuke.mindustry.world.blocks.TreeBlock", "io.anuke.mindustry.world.blocks.defense.DeflectorWall", "io.anuke.mindustry.world.blocks.defense.DeflectorWall$DeflectorEntity", "io.anuke.mindustry.world.blocks.defense.Door", "io.anuke.mindustry.world.blocks.defense.Door$DoorEntity", "io.anuke.mindustry.world.blocks.defense.ForceProjector", "io.anuke.mindustry.world.blocks.defense.ForceProjector$ForceEntity", "io.anuke.mindustry.world.blocks.defense.ForceProjector$ShieldEntity", "io.anuke.mindustry.world.blocks.defense.MendProjector", "io.anuke.mindustry.world.blocks.defense.MendProjector$MendEntity", "io.anuke.mindustry.world.blocks.defense.OverdriveProjector", "io.anuke.mindustry.world.blocks.defense.OverdriveProjector$OverdriveEntity", "io.anuke.mindustry.world.blocks.defense.ShockMine", "io.anuke.mindustry.world.blocks.defense.SurgeWall", "io.anuke.mindustry.world.blocks.defense.Wall", "io.anuke.mindustry.world.blocks.defense.turrets.ArtilleryTurret", "io.anuke.mindustry.world.blocks.defense.turrets.BurstTurret", "io.anuke.mindustry.world.blocks.defense.turrets.ChargeTurret", "io.anuke.mindustry.world.blocks.defense.turrets.ChargeTurret$LaserTurretEntity", "io.anuke.mindustry.world.blocks.defense.turrets.CooledTurret", "io.anuke.mindustry.world.blocks.defense.turrets.DoubleTurret", "io.anuke.mindustry.world.blocks.defense.turrets.ItemTurret", "io.anuke.mindustry.world.blocks.defense.turrets.ItemTurret$ItemEntry", "io.anuke.mindustry.world.blocks.defense.turrets.ItemTurret$ItemTurretEntity", "io.anuke.mindustry.world.blocks.defense.turrets.LaserTurret", "io.anuke.mindustry.world.blocks.defense.turrets.LaserTurret$LaserTurretEntity", "io.anuke.mindustry.world.blocks.defense.turrets.LiquidTurret", "io.anuke.mindustry.world.blocks.defense.turrets.PowerTurret", "io.anuke.mindustry.world.blocks.defense.turrets.Turret", "io.anuke.mindustry.world.blocks.defense.turrets.Turret$AmmoEntry", "io.anuke.mindustry.world.blocks.defense.turrets.Turret$TurretEntity", "io.anuke.mindustry.world.blocks.distribution.ArmoredConveyor", "io.anuke.mindustry.world.blocks.distribution.BufferedItemBridge", "io.anuke.mindustry.world.blocks.distribution.BufferedItemBridge$BufferedItemBridgeEntity", "io.anuke.mindustry.world.blocks.distribution.Conveyor", "io.anuke.mindustry.world.blocks.distribution.Conveyor$ConveyorEntity", "io.anuke.mindustry.world.blocks.distribution.Conveyor$ItemPos", "io.anuke.mindustry.world.blocks.distribution.ExtendingItemBridge", "io.anuke.mindustry.world.blocks.distribution.ItemBridge", "io.anuke.mindustry.world.blocks.distribution.ItemBridge$ItemBridgeEntity", "io.anuke.mindustry.world.blocks.distribution.Junction", "io.anuke.mindustry.world.blocks.distribution.Junction$JunctionEntity", "io.anuke.mindustry.world.blocks.distribution.MassDriver", "io.anuke.mindustry.world.blocks.distribution.MassDriver$DriverBulletData", "io.anuke.mindustry.world.blocks.distribution.MassDriver$DriverState", "io.anuke.mindustry.world.blocks.distribution.MassDriver$MassDriverEntity", "io.anuke.mindustry.world.blocks.distribution.OverflowGate", "io.anuke.mindustry.world.blocks.distribution.OverflowGate$OverflowGateEntity", "io.anuke.mindustry.world.blocks.distribution.Router", "io.anuke.mindustry.world.blocks.distribution.Router$RouterEntity", "io.anuke.mindustry.world.blocks.distribution.Sorter", "io.anuke.mindustry.world.blocks.distribution.Sorter$SorterEntity", "io.anuke.mindustry.world.blocks.liquid.ArmoredConduit", "io.anuke.mindustry.world.blocks.liquid.Conduit", "io.anuke.mindustry.world.blocks.liquid.Conduit$ConduitEntity", "io.anuke.mindustry.world.blocks.liquid.LiquidBridge", "io.anuke.mindustry.world.blocks.liquid.LiquidExtendingBridge", "io.anuke.mindustry.world.blocks.liquid.LiquidJunction", "io.anuke.mindustry.world.blocks.liquid.LiquidOverflowGate", "io.anuke.mindustry.world.blocks.liquid.LiquidRouter", "io.anuke.mindustry.world.blocks.liquid.LiquidTank", "io.anuke.mindustry.world.blocks.logic.LogicBlock", "io.anuke.mindustry.world.blocks.logic.MessageBlock", "io.anuke.mindustry.world.blocks.logic.MessageBlock$MessageBlockEntity", "io.anuke.mindustry.world.blocks.power.Battery", "io.anuke.mindustry.world.blocks.power.BurnerGenerator", "io.anuke.mindustry.world.blocks.power.ConditionalConsumePower", "io.anuke.mindustry.world.blocks.power.DecayGenerator", "io.anuke.mindustry.world.blocks.power.ImpactReactor", "io.anuke.mindustry.world.blocks.power.ImpactReactor$FusionReactorEntity", "io.anuke.mindustry.world.blocks.power.ItemLiquidGenerator", "io.anuke.mindustry.world.blocks.power.ItemLiquidGenerator$ItemLiquidGeneratorEntity", "io.anuke.mindustry.world.blocks.power.LightBlock", "io.anuke.mindustry.world.blocks.power.LightBlock$LightEntity", "io.anuke.mindustry.world.blocks.power.NuclearReactor", "io.anuke.mindustry.world.blocks.power.NuclearReactor$NuclearReactorEntity", "io.anuke.mindustry.world.blocks.power.PowerDiode", "io.anuke.mindustry.world.blocks.power.PowerDistributor", "io.anuke.mindustry.world.blocks.power.PowerGenerator", "io.anuke.mindustry.world.blocks.power.PowerGenerator$GeneratorEntity", "io.anuke.mindustry.world.blocks.power.PowerGraph", "io.anuke.mindustry.world.blocks.power.PowerNode", "io.anuke.mindustry.world.blocks.power.SingleTypeGenerator", "io.anuke.mindustry.world.blocks.power.SolarGenerator", "io.anuke.mindustry.world.blocks.power.ThermalGenerator", "io.anuke.mindustry.world.blocks.production.Cultivator", "io.anuke.mindustry.world.blocks.production.Cultivator$CultivatorEntity", "io.anuke.mindustry.world.blocks.production.Drill", "io.anuke.mindustry.world.blocks.production.Drill$DrillEntity", "io.anuke.mindustry.world.blocks.production.Fracker", "io.anuke.mindustry.world.blocks.production.Fracker$FrackerEntity", "io.anuke.mindustry.world.blocks.production.GenericCrafter", "io.anuke.mindustry.world.blocks.production.GenericCrafter$GenericCrafterEntity", "io.anuke.mindustry.world.blocks.production.GenericSmelter", "io.anuke.mindustry.world.blocks.production.Incinerator", "io.anuke.mindustry.world.blocks.production.Incinerator$IncineratorEntity", "io.anuke.mindustry.world.blocks.production.LiquidConverter", "io.anuke.mindustry.world.blocks.production.Pump", "io.anuke.mindustry.world.blocks.production.Separator", "io.anuke.mindustry.world.blocks.production.SolidPump", "io.anuke.mindustry.world.blocks.production.SolidPump$SolidPumpEntity", "io.anuke.mindustry.world.blocks.sandbox.ItemSource", "io.anuke.mindustry.world.blocks.sandbox.ItemSource$ItemSourceEntity", "io.anuke.mindustry.world.blocks.sandbox.ItemVoid", "io.anuke.mindustry.world.blocks.sandbox.LiquidSource", "io.anuke.mindustry.world.blocks.sandbox.LiquidSource$LiquidSourceEntity", "io.anuke.mindustry.world.blocks.sandbox.PowerSource", "io.anuke.mindustry.world.blocks.sandbox.PowerVoid", "io.anuke.mindustry.world.blocks.storage.CoreBlock", "io.anuke.mindustry.world.blocks.storage.CoreBlock$CoreEntity", "io.anuke.mindustry.world.blocks.storage.LaunchPad", "io.anuke.mindustry.world.blocks.storage.StorageBlock", "io.anuke.mindustry.world.blocks.storage.StorageBlock$StorageBlockEntity", "io.anuke.mindustry.world.blocks.storage.Unloader", "io.anuke.mindustry.world.blocks.storage.Unloader$UnloaderEntity", "io.anuke.mindustry.world.blocks.storage.Vault", "io.anuke.mindustry.world.blocks.units.CommandCenter", "io.anuke.mindustry.world.blocks.units.CommandCenter$CommandCenterEntity", "io.anuke.mindustry.world.blocks.units.MechPad", "io.anuke.mindustry.world.blocks.units.MechPad$MechFactoryEntity", "io.anuke.mindustry.world.blocks.units.RallyPoint", "io.anuke.mindustry.world.blocks.units.RepairPoint", "io.anuke.mindustry.world.blocks.units.RepairPoint$RepairPointEntity", "io.anuke.mindustry.world.blocks.units.UnitFactory", "io.anuke.mindustry.world.blocks.units.UnitFactory$UnitFactoryEntity", "io.anuke.mindustry.world.consumers.Consume", "io.anuke.mindustry.world.consumers.ConsumeItemFilter", "io.anuke.mindustry.world.consumers.ConsumeItems", "io.anuke.mindustry.world.consumers.ConsumeLiquid", "io.anuke.mindustry.world.consumers.ConsumeLiquidBase", "io.anuke.mindustry.world.consumers.ConsumeLiquidFilter", "io.anuke.mindustry.world.consumers.ConsumePower", "io.anuke.mindustry.world.consumers.ConsumeType", "io.anuke.mindustry.world.consumers.Consumers", "io.anuke.mindustry.world.meta.Attribute", "io.anuke.mindustry.world.meta.BlockBars", "io.anuke.mindustry.world.meta.BlockFlag", "io.anuke.mindustry.world.meta.BlockGroup", "io.anuke.mindustry.world.meta.BlockStat", "io.anuke.mindustry.world.meta.BlockStats", "io.anuke.mindustry.world.meta.BuildVisibility", "io.anuke.mindustry.world.meta.PowerType", "io.anuke.mindustry.world.meta.Producers", "io.anuke.mindustry.world.meta.StatCategory", "io.anuke.mindustry.world.meta.StatUnit", "io.anuke.mindustry.world.meta.StatValue", "io.anuke.mindustry.world.meta.values.AmmoListValue", "io.anuke.mindustry.world.meta.values.BooleanValue", "io.anuke.mindustry.world.meta.values.BoosterListValue", "io.anuke.mindustry.world.meta.values.ItemFilterValue", "io.anuke.mindustry.world.meta.values.ItemListValue", "io.anuke.mindustry.world.meta.values.LiquidFilterValue", "io.anuke.mindustry.world.meta.values.LiquidValue", "io.anuke.mindustry.world.meta.values.NumberValue", "io.anuke.mindustry.world.meta.values.StringValue", "io.anuke.mindustry.world.modules.BlockModule", "io.anuke.mindustry.world.modules.ConsumeModule", "io.anuke.mindustry.world.modules.ItemModule", "io.anuke.mindustry.world.modules.ItemModule$ItemCalculator", "io.anuke.mindustry.world.modules.ItemModule$ItemConsumer", "io.anuke.mindustry.world.modules.LiquidModule", "io.anuke.mindustry.world.modules.LiquidModule$LiquidCalculator", "io.anuke.mindustry.world.modules.LiquidModule$LiquidConsumer", "io.anuke.mindustry.world.modules.PowerModule", "io.anuke.mindustry.world.producers.Produce", "io.anuke.mindustry.world.producers.ProduceItem", "java.io.PrintStream", "java.lang.String", "java.lang.System"); +} \ No newline at end of file diff --git a/core/src/io/anuke/mindustry/mod/ContentParser.java b/core/src/io/anuke/mindustry/mod/ContentParser.java index afe1f2f74f..3ca887279d 100644 --- a/core/src/io/anuke/mindustry/mod/ContentParser.java +++ b/core/src/io/anuke/mindustry/mod/ContentParser.java @@ -52,6 +52,11 @@ public class ContentParser{ } } }); + put(StatusEffect.class, (type, data) -> { + StatusEffect effect = new StatusEffect(); + readFields(effect, data); + return effect; + }); put(Color.class, (type, data) -> Color.valueOf(data.asString())); put(BulletType.class, (type, data) -> { if(data.isString()){ diff --git a/core/src/io/anuke/mindustry/mod/Mod.java b/core/src/io/anuke/mindustry/mod/Mod.java index 5ee0f699c4..aa4d8198f5 100644 --- a/core/src/io/anuke/mindustry/mod/Mod.java +++ b/core/src/io/anuke/mindustry/mod/Mod.java @@ -15,11 +15,6 @@ public class Mod{ } - /** Create any content needed here. */ - public void loadContent(){ - - } - /** Register any commands to be used on the server side, e.g. from the console. */ public void registerServerCommands(CommandHandler handler){ diff --git a/core/src/io/anuke/mindustry/mod/Mods.java b/core/src/io/anuke/mindustry/mod/Mods.java index 2d1a731272..974be2f634 100644 --- a/core/src/io/anuke/mindustry/mod/Mods.java +++ b/core/src/io/anuke/mindustry/mod/Mods.java @@ -30,6 +30,7 @@ import static io.anuke.mindustry.Vars.*; public class Mods implements Loadable{ private Json json = new Json(); + private @Nullable Scripts scripts; private ContentParser parser = new ContentParser(); private ObjectMap> bundles = new ObjectMap<>(); private ObjectSet specialFolders = ObjectSet.with("bundles", "sprites"); @@ -202,6 +203,16 @@ public class Mods implements Loadable{ requiresReload = true; } + public Scripts getScripts(){ + if(scripts == null) scripts = platform.createScripts(); + return scripts; + } + + /** @return whether the scripting engine has been initialized. */ + public boolean hasScripts(){ + return scripts != null; + } + public boolean requiresReload(){ return requiresReload; } @@ -352,8 +363,15 @@ public class Mods implements Loadable{ Sounds.dispose(); Sounds.load(); Core.assets.finishLoading(); + if(scripts != null){ + scripts.dispose(); + scripts = null; + } content.clear(); - content.createContent(); + content.createBaseContent(); + content.loadColors(); + loadScripts(); + content.createModContent(); loadAsync(); loadSync(); content.init(); @@ -365,8 +383,44 @@ public class Mods implements Loadable{ Events.fire(new ContentReloadEvent()); } + /** This must be run on the main thread! */ + public void loadScripts(){ + Time.mark(); + + try{ + for(LoadedMod mod : loaded){ + if(mod.root.child("scripts").exists()){ + content.setCurrentMod(mod); + mod.scripts = mod.root.child("scripts").findAll(f -> f.extension().equals("js")); + Log.info("[{0}] Found {1} scripts.", mod.meta.name, mod.scripts.size); + + for(FileHandle file : mod.scripts){ + try{ + if(scripts == null){ + scripts = platform.createScripts(); + } + scripts.run(mod, file); + }catch(Throwable e){ + Core.app.post(() -> { + Log.err("Error loading script {0} for mod {1}.", file.name(), mod.meta.name); + e.printStackTrace(); + //if(!headless) ui.showException(e); + }); + break; + } + } + } + } + }finally{ + content.setCurrentMod(null); + } + + Log.info("Time to initialize modded scripts: {0}", Time.elapsed()); + } + /** Creates all the content found in mod files. */ public void loadContent(){ + class LoadRun implements Comparable{ final ContentType type; final FileHandle file; @@ -419,9 +473,6 @@ public class Mods implements Loadable{ //this finishes parsing content fields parser.finishParsing(); - - //load content for code mods - each(Mod::loadContent); } /** @return all loaded mods. */ @@ -587,6 +638,8 @@ public class Mods implements Loadable{ public Array dependencies = new Array<>(); /** All missing dependencies of this mod as strings. */ public Array missingDependencies = new Array<>(); + /** Script files to run. */ + public Array scripts = new Array<>(); public LoadedMod(FileHandle file, FileHandle root, Mod mod, ModMeta meta){ this.root = root; diff --git a/core/src/io/anuke/mindustry/mod/Scripts.java b/core/src/io/anuke/mindustry/mod/Scripts.java new file mode 100644 index 0000000000..84fdc4e5d3 --- /dev/null +++ b/core/src/io/anuke/mindustry/mod/Scripts.java @@ -0,0 +1,83 @@ +package io.anuke.mindustry.mod; + +import io.anuke.arc.*; +import io.anuke.arc.collection.*; +import io.anuke.arc.files.*; +import io.anuke.arc.util.*; +import io.anuke.mindustry.*; +import io.anuke.mindustry.mod.Mods.*; +import org.mozilla.javascript.*; + +import static io.anuke.mindustry.Vars.*; + +public class Scripts implements Disposable{ + private final Context context; + private final String wrapper; + private Scriptable scope; + private Array logBuffer = new Array<>(); + + public Scripts(){ + Time.mark(); + + context = Vars.platform.getScriptContext(); + context.setClassShutter(type -> (ClassAccess.allowedClassNames.contains(type) || type.startsWith("adapter") || type.contains("PrintStream") || type.startsWith("io.anuke.mindustry")) && !type.equals("io.anuke.mindustry.mod.ClassAccess")); + + scope = new ImporterTopLevel(context); + wrapper = Core.files.internal("scripts/wrapper.js").readString(); + + run(Core.files.internal("scripts/global.js").readString(), "global.js"); + Log.info("Time to load script engine: {0}", Time.elapsed()); + } + + public String runConsole(String text){ + try{ + Object o = context.evaluateString(scope, text, "console.js", 1, null); + if(o instanceof NativeJavaObject){ + o = ((NativeJavaObject)o).unwrap(); + } + if(o instanceof Undefined){ + o = "undefined"; + } + return String.valueOf(o); + }catch(Throwable t){ + return getError(t); + } + } + + private String getError(Throwable t){ + t = Strings.getFinalCause(t); + return t.getClass().getSimpleName() + (t.getMessage() == null ? "" : ": " + t.getMessage()); + } + + public void log(String source, String message){ + Log.info("[{0}]: {1}", source, message); + logBuffer.add("[accent][" + source + "]:[] " + message); + if(!headless & ui.scriptfrag != null){ + onLoad(); + } + } + + public void onLoad(){ + if(!headless){ + logBuffer.each(ui.scriptfrag::addMessage); + } + logBuffer.clear(); + } + + public void run(LoadedMod mod, FileHandle file){ + run(wrapper.replace("$SCRIPT_NAME$", mod.name + "/" + file.nameWithoutExtension()).replace("$CODE$", file.readString()).replace("$MOD_NAME$", mod.name), file.name()); + } + + private void run(String script, String file){ + try{ + context.evaluateString(scope, script, file, 1, null); + }catch(Throwable t){ + log(file, "[scarlet]" + getError(t)); + } + } + + @Override + public void dispose(){ + Context.exit(); + } +} diff --git a/core/src/io/anuke/mindustry/type/Item.java b/core/src/io/anuke/mindustry/type/Item.java index 6ec12ae475..86951ab093 100644 --- a/core/src/io/anuke/mindustry/type/Item.java +++ b/core/src/io/anuke/mindustry/type/Item.java @@ -34,7 +34,6 @@ public class Item extends UnlockableContent{ public Item(String name, Color color){ super(name); this.color = color; - this.description = Core.bundle.getOrNull("item." + this.name + ".description"); } public Item(String name){ diff --git a/core/src/io/anuke/mindustry/type/Liquid.java b/core/src/io/anuke/mindustry/type/Liquid.java index bc97a18990..63839c479c 100644 --- a/core/src/io/anuke/mindustry/type/Liquid.java +++ b/core/src/io/anuke/mindustry/type/Liquid.java @@ -31,7 +31,6 @@ public class Liquid extends UnlockableContent{ public Liquid(String name, Color color){ super(name); this.color = new Color(color); - this.description = Core.bundle.getOrNull("liquid." + name + ".description"); } /** For modding only.*/ diff --git a/core/src/io/anuke/mindustry/type/Mech.java b/core/src/io/anuke/mindustry/type/Mech.java index 8eb9681548..a9419a116b 100644 --- a/core/src/io/anuke/mindustry/type/Mech.java +++ b/core/src/io/anuke/mindustry/type/Mech.java @@ -39,7 +39,6 @@ public class Mech extends UnlockableContent{ public Mech(String name, boolean flying){ super(name); this.flying = flying; - this.description = Core.bundle.get("mech." + name + ".description"); } public Mech(String name){ diff --git a/core/src/io/anuke/mindustry/type/UnitType.java b/core/src/io/anuke/mindustry/type/UnitType.java index b2602a16ad..ddcaa4f36f 100644 --- a/core/src/io/anuke/mindustry/type/UnitType.java +++ b/core/src/io/anuke/mindustry/type/UnitType.java @@ -51,7 +51,6 @@ public class UnitType extends UnlockableContent{ public UnitType(String name){ super(name); - this.description = Core.bundle.getOrNull("unit." + name + ".description"); } public void create(Prov mainConstructor){ diff --git a/core/src/io/anuke/mindustry/ui/fragments/ChatFragment.java b/core/src/io/anuke/mindustry/ui/fragments/ChatFragment.java index 2801d10149..c7c168bc84 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/ChatFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/ChatFragment.java @@ -24,7 +24,7 @@ public class ChatFragment extends Table{ private final static int messagesShown = 10; private Array messages = new Array<>(); private float fadetime; - private boolean chatOpen = false; + private boolean shown = false; private TextField chatfield; private Label fieldlabel = new Label(">"); private BitmapFont font; @@ -52,7 +52,7 @@ public class ChatFragment extends Table{ if(!net.active() && messages.size > 0){ clearMessages(); - if(chatOpen){ + if(shown){ hide(); } } @@ -66,7 +66,7 @@ public class ChatFragment extends Table{ toggle(); } - if(chatOpen){ + if(shown){ if(input.keyTap(Binding.chat_history_prev) && historyPos < history.size - 1){ if(historyPos == 0) history.set(0, chatfield.getText()); historyPos++; @@ -123,7 +123,7 @@ public class ChatFragment extends Table{ Draw.color(shadowColor); - if(chatOpen){ + if(shown){ Fill.crect(offsetx, chatfield.getY(), chatfield.getWidth() + 15f, chatfield.getHeight() - 1); } @@ -131,14 +131,14 @@ public class ChatFragment extends Table{ float spacing = chatspace; - chatfield.visible(chatOpen); - fieldlabel.visible(chatOpen); + chatfield.visible(shown); + fieldlabel.visible(shown); Draw.color(shadowColor); Draw.alpha(shadowColor.a * opacity); float theight = offsety + spacing + getMarginBottom(); - for(int i = scrollPos; i < messages.size && i < messagesShown + scrollPos && (i < fadetime || chatOpen); i++){ + for(int i = scrollPos; i < messages.size && i < messagesShown + scrollPos && (i < fadetime || shown); i++){ layout.setText(font, messages.get(i).formattedMessage, Color.white, textWidth, Align.bottomLeft, true); theight += layout.height + textspacing; @@ -147,7 +147,7 @@ public class ChatFragment extends Table{ font.getCache().clear(); font.getCache().addText(messages.get(i).formattedMessage, fontoffsetx + offsetx, offsety + theight, textWidth, Align.bottomLeft, true); - if(!chatOpen && fadetime - i < 1f && fadetime - i >= 0f){ + if(!shown && fadetime - i < 1f && fadetime - i >= 0f){ font.getCache().setAlphas((fadetime - i) * opacity); Draw.color(0, 0, 0, shadowColor.a * (fadetime - i) * opacity); }else{ @@ -163,7 +163,7 @@ public class ChatFragment extends Table{ Draw.color(); - if(fadetime > 0 && !chatOpen) + if(fadetime > 0 && !shown) fadetime -= Time.delta() / 180f; } @@ -180,9 +180,9 @@ public class ChatFragment extends Table{ public void toggle(){ - if(!chatOpen){ + if(!shown){ scene.setKeyboardFocus(chatfield); - chatOpen = !chatOpen; + shown = !shown; if(mobile){ TextInput input = new TextInput(); input.maxLength = maxTextLength; @@ -199,7 +199,7 @@ public class ChatFragment extends Table{ } }else{ scene.setKeyboardFocus(null); - chatOpen = !chatOpen; + shown = !shown; scrollPos = 0; sendMessage(); } @@ -207,7 +207,7 @@ public class ChatFragment extends Table{ public void hide(){ scene.setKeyboardFocus(null); - chatOpen = false; + shown = false; clearChatInput(); } @@ -222,12 +222,8 @@ public class ChatFragment extends Table{ chatfield.setText(""); } - public boolean chatOpen(){ - return chatOpen; - } - - public int getMessagesSize(){ - return messages.size; + public boolean shown(){ + return shown; } public void addMessage(String message, String sender){ diff --git a/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java b/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java index 3bbce3b1ec..b2c60deca9 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java @@ -83,7 +83,7 @@ public class HudFragment extends Fragment{ select.addImageButton(Icon.chatSmall, style,() -> { if(net.active() && mobile){ - if(ui.chatfrag.chatOpen()){ + if(ui.chatfrag.shown()){ ui.chatfrag.hide(); }else{ ui.chatfrag.toggle(); @@ -131,7 +131,7 @@ public class HudFragment extends Fragment{ } cont.update(() -> { - if(Core.input.keyTap(Binding.toggle_menus) && !ui.chatfrag.chatOpen() && !Core.scene.hasDialog() && !(Core.scene.getKeyboardFocus() instanceof TextField)){ + if(Core.input.keyTap(Binding.toggle_menus) && !ui.chatfrag.shown() && !Core.scene.hasDialog() && !(Core.scene.getKeyboardFocus() instanceof TextField)){ toggleMenus(); } }); diff --git a/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java b/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java index 95bdd5affa..5d8e5ff0e5 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java @@ -103,7 +103,8 @@ public class PlacementFragment extends Fragment{ } } - if(ui.chatfrag.chatOpen()) return false; + if(ui.chatfrag.shown() || Core.scene.hasKeyboard()) return false; + for(int i = 0; i < blockSelect.length; i++){ if(Core.input.keyTap(blockSelect[i])){ if(i > 9) { //select block directionally diff --git a/core/src/io/anuke/mindustry/ui/fragments/ScriptConsoleFragment.java b/core/src/io/anuke/mindustry/ui/fragments/ScriptConsoleFragment.java new file mode 100644 index 0000000000..458bae6c2c --- /dev/null +++ b/core/src/io/anuke/mindustry/ui/fragments/ScriptConsoleFragment.java @@ -0,0 +1,224 @@ +package io.anuke.mindustry.ui.fragments; + +import io.anuke.arc.*; +import io.anuke.arc.Input.*; +import io.anuke.arc.collection.*; +import io.anuke.arc.graphics.*; +import io.anuke.arc.graphics.g2d.*; +import io.anuke.arc.math.*; +import io.anuke.arc.scene.*; +import io.anuke.arc.scene.ui.*; +import io.anuke.arc.scene.ui.Label.*; +import io.anuke.arc.scene.ui.layout.*; +import io.anuke.arc.util.*; +import io.anuke.mindustry.*; +import io.anuke.mindustry.input.*; +import io.anuke.mindustry.ui.*; + +import static io.anuke.arc.Core.*; +import static io.anuke.mindustry.Vars.*; + +public class ScriptConsoleFragment extends Table{ + private final static int messagesShown = 14; + private Array messages = new Array<>(); + private boolean open = false, shown; + private TextField chatfield; + private Label fieldlabel = new Label(">"); + private BitmapFont font; + private GlyphLayout layout = new GlyphLayout(); + private float offsetx = Scl.scl(4), offsety = Scl.scl(4), fontoffsetx = Scl.scl(2), chatspace = Scl.scl(50); + private Color shadowColor = new Color(0, 0, 0, 0.4f); + private float textspacing = Scl.scl(10); + private Array history = new Array<>(); + private int historyPos = 0; + private int scrollPos = 0; + private Fragment container = new Fragment(){ + @Override + public void build(Group parent){ + scene.add(ScriptConsoleFragment.this); + } + }; + + public ScriptConsoleFragment(){ + + setFillParent(true); + font = Fonts.def; + + visible(() -> { + if(input.keyTap(Binding.console) && !Vars.net.client() && (scene.getKeyboardFocus() == chatfield || scene.getKeyboardFocus() == null)){ + shown = !shown; + if(shown && !open){ + toggle(); + } + clearChatInput(); + } + + return shown && !Vars.net.client(); + }); + + update(() -> { + if(input.keyTap(Binding.chat) && (scene.getKeyboardFocus() == chatfield || scene.getKeyboardFocus() == null)){ + toggle(); + } + + if(open){ + if(input.keyTap(Binding.chat_history_prev) && historyPos < history.size - 1){ + if(historyPos == 0) history.set(0, chatfield.getText()); + historyPos++; + updateChat(); + } + if(input.keyTap(Binding.chat_history_next) && historyPos > 0){ + historyPos--; + updateChat(); + } + scrollPos = (int)Mathf.clamp(scrollPos + input.axis(Binding.chat_scroll), 0, Math.max(0, messages.size - messagesShown)); + } + }); + + history.insert(0, ""); + setup(); + + if(mods.hasScripts()){ + app.post(() -> mods.getScripts().onLoad()); + } + } + + public Fragment container(){ + return container; + } + + public void clearMessages(){ + messages.clear(); + history.clear(); + history.insert(0, ""); + } + + private void setup(){ + fieldlabel.setStyle(new LabelStyle(fieldlabel.getStyle())); + fieldlabel.getStyle().font = font; + fieldlabel.setStyle(fieldlabel.getStyle()); + + chatfield = new TextField("", new TextField.TextFieldStyle(scene.getStyle(TextField.TextFieldStyle.class))); + chatfield.setMaxLength(Vars.maxTextLength); + chatfield.getStyle().background = null; + chatfield.getStyle().font = Fonts.chat; + chatfield.getStyle().fontColor = Color.white; + chatfield.setStyle(chatfield.getStyle()); + + bottom().left().marginBottom(offsety).marginLeft(offsetx * 2).add(fieldlabel).padBottom(6f); + + add(chatfield).padBottom(offsety).padLeft(offsetx).growX().padRight(offsetx).height(28); + } + + @Override + public void draw(){ + float opacity = 1f; + float textWidth = graphics.getWidth() - offsetx*2f; + + Draw.color(shadowColor); + + if(open){ + Fill.crect(offsetx, chatfield.getY(), chatfield.getWidth() + 15f, chatfield.getHeight() - 1); + } + + super.draw(); + + float spacing = chatspace; + + chatfield.visible(open); + fieldlabel.visible(open); + + Draw.color(shadowColor); + Draw.alpha(shadowColor.a * opacity); + + float theight = offsety + spacing + getMarginBottom(); + 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; + if(i - scrollPos == 0) theight -= textspacing + 1; + + font.getCache().clear(); + font.getCache().addText(messages.get(i), fontoffsetx + offsetx, offsety + theight, textWidth, Align.bottomLeft, true); + + if(!open){ + font.getCache().setAlphas(opacity); + Draw.color(0, 0, 0, shadowColor.a * opacity); + }else{ + font.getCache().setAlphas(opacity); + } + + Fill.crect(offsetx, theight - layout.height - 2, textWidth + Scl.scl(4f), layout.height + textspacing); + Draw.color(shadowColor); + Draw.alpha(opacity * shadowColor.a); + + font.getCache().draw(); + } + + Draw.color(); + } + + private void sendMessage(){ + String message = chatfield.getText(); + clearChatInput(); + + if(message.replaceAll(" ", "").isEmpty()) return; + + history.insert(1, message); + + addMessage("[lightgray]> " + message); + addMessage(mods.getScripts().runConsole(message)); + } + + public void toggle(){ + + if(!open){ + scene.setKeyboardFocus(chatfield); + open = !open; + if(mobile){ + TextInput input = new TextInput(); + input.maxLength = maxTextLength; + input.accepted = text -> { + chatfield.setText(text); + sendMessage(); + hide(); + Core.input.setOnscreenKeyboardVisible(false); + }; + input.canceled = this::hide; + Core.input.getTextInput(input); + }else{ + chatfield.fireClick(); + } + }else{ + scene.setKeyboardFocus(null); + open = !open; + scrollPos = 0; + sendMessage(); + } + } + + public void hide(){ + scene.setKeyboardFocus(null); + open = false; + clearChatInput(); + } + + public void updateChat(){ + chatfield.setText(history.get(historyPos)); + chatfield.setCursorPosition(chatfield.getText().length()); + } + + public void clearChatInput(){ + historyPos = 0; + history.set(0, ""); + chatfield.setText(""); + } + + public boolean open(){ + return open; + } + + public void addMessage(String message){ + messages.insert(0, message); + } +} diff --git a/core/src/io/anuke/mindustry/world/Block.java b/core/src/io/anuke/mindustry/world/Block.java index 75f4fff536..f9dcd9c779 100644 --- a/core/src/io/anuke/mindustry/world/Block.java +++ b/core/src/io/anuke/mindustry/world/Block.java @@ -158,7 +158,6 @@ public class Block extends BlockStorage{ public Block(String name){ super(name); - this.description = Core.bundle.getOrNull("block." + name + ".description"); this.solid = false; } diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/Door.java b/core/src/io/anuke/mindustry/world/blocks/defense/Door.java index b0c83fba9d..dc05d1ee58 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/Door.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/Door.java @@ -18,11 +18,11 @@ import java.io.*; import static io.anuke.mindustry.Vars.*; public class Door extends Wall{ - protected final Rectangle rect = new Rectangle(); + protected final static Rectangle rect = new Rectangle(); - protected int timerToggle = timers++; - protected Effect openfx = Fx.dooropen; - protected Effect closefx = Fx.doorclose; + public final int timerToggle = timers++; + public Effect openfx = Fx.dooropen; + public Effect closefx = Fx.doorclose; protected TextureRegion openRegion; diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/ForceProjector.java b/core/src/io/anuke/mindustry/world/blocks/defense/ForceProjector.java index 4dce2d9db9..5b385578d1 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/ForceProjector.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/ForceProjector.java @@ -21,17 +21,17 @@ import java.io.*; import static io.anuke.mindustry.Vars.*; public class ForceProjector extends Block{ - protected int timerUse = timers++; - protected float phaseUseTime = 350f; + public final int timerUse = timers++; + public float phaseUseTime = 350f; - protected float phaseRadiusBoost = 80f; - protected float radius = 101.7f; - protected float breakage = 550f; - protected float cooldownNormal = 1.75f; - protected float cooldownLiquid = 1.5f; - protected float cooldownBrokenBase = 0.35f; - protected float basePowerDraw = 0.2f; - protected TextureRegion topRegion; + public float phaseRadiusBoost = 80f; + public float radius = 101.7f; + public float breakage = 550f; + public float cooldownNormal = 1.75f; + public float cooldownLiquid = 1.5f; + public float cooldownBrokenBase = 0.35f; + public float basePowerDraw = 0.2f; + public TextureRegion topRegion; private static Tile paramTile; private static ForceProjector paramBlock; diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/MendProjector.java b/core/src/io/anuke/mindustry/world/blocks/defense/MendProjector.java index 5ba2461265..1d737a4900 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/MendProjector.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/MendProjector.java @@ -18,19 +18,18 @@ import java.io.*; import static io.anuke.mindustry.Vars.*; public class MendProjector extends Block{ - private static Color color = Color.valueOf("84f491"); - private static Color phase = Color.valueOf("ffd59e"); - private static IntSet healed = new IntSet(); + private static final IntSet healed = new IntSet(); - protected int timerUse = timers++; - - protected TextureRegion topRegion; - protected float reload = 250f; - protected float range = 60f; - protected float healPercent = 12f; - protected float phaseBoost = 12f; - protected float phaseRangeBoost = 50f; - protected float useTime = 400f; + public final int timerUse = timers++; + public Color baseColor = Color.valueOf("84f491"); + public Color phaseColor = Color.valueOf("ffd59e"); + public TextureRegion topRegion; + public float reload = 250f; + public float range = 60f; + public float healPercent = 12f; + public float phaseBoost = 12f; + public float phaseRangeBoost = 50f; + public float useTime = 400f; public MendProjector(String name){ super(name); @@ -92,7 +91,7 @@ public class MendProjector extends Block{ if(other.getTeamID() == tile.getTeamID() && !healed.contains(other.pos()) && other.entity != null && other.entity.health < other.entity.maxHealth()){ other.entity.healBy(other.entity.maxHealth() * (healPercent + entity.phaseHeat * phaseBoost) / 100f * entity.efficiency()); - Effects.effect(Fx.healBlockFull, Tmp.c1.set(color).lerp(phase, entity.phaseHeat), other.drawx(), other.drawy(), other.block().size); + Effects.effect(Fx.healBlockFull, Tmp.c1.set(baseColor).lerp(phaseColor, entity.phaseHeat), other.drawx(), other.drawy(), other.block().size); healed.add(other.pos()); } } @@ -110,7 +109,7 @@ public class MendProjector extends Block{ MendEntity entity = tile.entity(); float realRange = range + entity.phaseHeat * phaseRangeBoost; - Drawf.dashCircle(tile.drawx(), tile.drawy(), realRange, color); + Drawf.dashCircle(tile.drawx(), tile.drawy(), realRange, baseColor); } @Override @@ -120,7 +119,7 @@ public class MendProjector extends Block{ MendEntity entity = tile.entity(); float f = 1f - (Time.time() / 100f) % 1f; - Draw.color(color, phase, entity.phaseHeat); + Draw.color(baseColor, phaseColor, entity.phaseHeat); Draw.alpha(entity.heat * Mathf.absin(Time.time(), 10f, 1f) * 0.5f); //Draw.blend(Blending.additive); Draw.rect(topRegion, tile.drawx(), tile.drawy()); @@ -135,7 +134,7 @@ public class MendProjector extends Block{ @Override public void drawLight(Tile tile){ - renderer.lights.add(tile.drawx(), tile.drawy(), 50f * tile.entity.efficiency(), color, 0.7f * tile.entity.efficiency()); + renderer.lights.add(tile.drawx(), tile.drawy(), 50f * tile.entity.efficiency(), baseColor, 0.7f * tile.entity.efficiency()); } class MendEntity extends TileEntity{ diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/OverdriveProjector.java b/core/src/io/anuke/mindustry/world/blocks/defense/OverdriveProjector.java index cc8c99a54e..f1708354b5 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/OverdriveProjector.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/OverdriveProjector.java @@ -16,19 +16,19 @@ import java.io.*; import static io.anuke.mindustry.Vars.*; public class OverdriveProjector extends Block{ - private static Color color = Color.valueOf("feb380"); - private static Color phase = Color.valueOf("ffd59e"); - private static IntSet healed = new IntSet(); + private static final IntSet healed = new IntSet(); - protected int timerUse = timers++; + public final int timerUse = timers++; - protected TextureRegion topRegion; - protected float reload = 60f; - protected float range = 80f; - protected float speedBoost = 1.5f; - protected float speedBoostPhase = 0.75f; - protected float useTime = 400f; - protected float phaseRangeBoost = 20f; + public TextureRegion topRegion; + public float reload = 60f; + public float range = 80f; + public float speedBoost = 1.5f; + public float speedBoostPhase = 0.75f; + public float useTime = 400f; + public float phaseRangeBoost = 20f; + public Color baseColor = Color.valueOf("feb380"); + public Color phaseColor = Color.valueOf("ffd59e"); public OverdriveProjector(String name){ super(name); @@ -69,7 +69,7 @@ public class OverdriveProjector extends Block{ @Override public void drawLight(Tile tile){ - renderer.lights.add(tile.drawx(), tile.drawy(), 50f * tile.entity.efficiency(), color, 0.7f * tile.entity.efficiency()); + renderer.lights.add(tile.drawx(), tile.drawy(), 50f * tile.entity.efficiency(), baseColor, 0.7f * tile.entity.efficiency()); } @Override @@ -118,7 +118,7 @@ public class OverdriveProjector extends Block{ OverdriveEntity entity = tile.entity(); float realRange = range + entity.phaseHeat * phaseRangeBoost; - Drawf.dashCircle(tile.drawx(), tile.drawy(), realRange, color); + Drawf.dashCircle(tile.drawx(), tile.drawy(), realRange, baseColor); } @Override @@ -128,7 +128,7 @@ public class OverdriveProjector extends Block{ OverdriveEntity entity = tile.entity(); float f = 1f - (Time.time() / 100f) % 1f; - Draw.color(color, phase, entity.phaseHeat); + Draw.color(baseColor, phaseColor, entity.phaseHeat); Draw.alpha(entity.heat * Mathf.absin(Time.time(), 10f, 1f) * 0.5f); Draw.rect(topRegion, tile.drawx(), tile.drawy()); Draw.alpha(1f); diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/ShockMine.java b/core/src/io/anuke/mindustry/world/blocks/defense/ShockMine.java index e834812f5a..de72043c7d 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/ShockMine.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/ShockMine.java @@ -11,13 +11,13 @@ import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; public class ShockMine extends Block{ - protected int timerDamage = timers++; + public final int timerDamage = timers++; - protected float cooldown = 80f; - protected float tileDamage = 5f; - protected float damage = 13; - protected int length = 10; - protected int tendrils = 6; + public float cooldown = 80f; + public float tileDamage = 5f; + public float damage = 13; + public int length = 10; + public int tendrils = 6; public ShockMine(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/SurgeWall.java b/core/src/io/anuke/mindustry/world/blocks/defense/SurgeWall.java index 0f51c74b40..a1c52ac823 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/SurgeWall.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/SurgeWall.java @@ -7,9 +7,9 @@ import io.anuke.mindustry.entities.type.TileEntity; import io.anuke.mindustry.graphics.Pal; public class SurgeWall extends Wall{ - protected float lightningChance = 0.05f; - protected float lightningDamage = 15f; - protected int lightningLength = 17; + public float lightningChance = 0.05f; + public float lightningDamage = 15f; + public int lightningLength = 17; public SurgeWall(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/Wall.java b/core/src/io/anuke/mindustry/world/blocks/defense/Wall.java index 70d6b6f91f..8b60ffd0f2 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/Wall.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/Wall.java @@ -9,7 +9,7 @@ import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.meta.BlockGroup; public class Wall extends Block{ - protected int variants = 0; + public int variants = 0; public Wall(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/ArtilleryTurret.java b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/ArtilleryTurret.java index 53ba8cbad4..f7095474c8 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/ArtilleryTurret.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/ArtilleryTurret.java @@ -13,7 +13,7 @@ import static io.anuke.mindustry.Vars.tilesize; * Artillery turrets have special shooting calculations done to hit targets. */ public class ArtilleryTurret extends ItemTurret{ - protected float velocityInaccuracy = 0f; + public float velocityInaccuracy = 0f; public ArtilleryTurret(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/BurstTurret.java b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/BurstTurret.java index d746227559..66775fb14e 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/BurstTurret.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/BurstTurret.java @@ -8,7 +8,7 @@ import io.anuke.mindustry.world.Tile; import static io.anuke.mindustry.Vars.tilesize; public class BurstTurret extends ItemTurret{ - protected float burstSpacing = 5; + public float burstSpacing = 5; public BurstTurret(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/ChargeTurret.java b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/ChargeTurret.java index 3f02328eed..e6aac80ea9 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/ChargeTurret.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/ChargeTurret.java @@ -12,11 +12,11 @@ import static io.anuke.mindustry.Vars.tilesize; public class ChargeTurret extends PowerTurret{ - protected float chargeTime = 30f; - protected int chargeEffects = 5; - protected float chargeMaxDelay = 10f; - protected Effect chargeEffect = Fx.none; - protected Effect chargeBeginEffect = Fx.none; + public float chargeTime = 30f; + public int chargeEffects = 5; + public float chargeMaxDelay = 10f; + public Effect chargeEffect = Fx.none; + public Effect chargeBeginEffect = Fx.none; public ChargeTurret(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/CooledTurret.java b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/CooledTurret.java index 58038d857e..03c35de0d0 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/CooledTurret.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/CooledTurret.java @@ -17,8 +17,8 @@ import static io.anuke.mindustry.Vars.tilesize; public class CooledTurret extends Turret{ /** How much reload is lowered by for each unit of liquid of heat capacity. */ - protected float coolantMultiplier = 5f; - protected Effect coolEffect = Fx.fuelburn; + public float coolantMultiplier = 5f; + public Effect coolEffect = Fx.fuelburn; public CooledTurret(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/DoubleTurret.java b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/DoubleTurret.java index 2067bd285a..813280bb2f 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/DoubleTurret.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/DoubleTurret.java @@ -9,7 +9,7 @@ import io.anuke.mindustry.world.meta.StatUnit; import static io.anuke.mindustry.Vars.tilesize; public class DoubleTurret extends ItemTurret{ - protected float shotWidth = 2f; + public float shotWidth = 2f; public DoubleTurret(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/ItemTurret.java b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/ItemTurret.java index dca1324e66..ea670a37e5 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/ItemTurret.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/ItemTurret.java @@ -22,8 +22,8 @@ import java.io.*; import static io.anuke.mindustry.Vars.*; public class ItemTurret extends CooledTurret{ - protected int maxAmmo = 30; - protected ObjectMap ammo = new ObjectMap<>(); + public int maxAmmo = 30; + public ObjectMap ammo = new ObjectMap<>(); public ItemTurret(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/LaserTurret.java b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/LaserTurret.java index 2766e79724..74e8490928 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/LaserTurret.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/LaserTurret.java @@ -14,8 +14,8 @@ import io.anuke.mindustry.world.meta.values.*; import static io.anuke.mindustry.Vars.tilesize; public class LaserTurret extends PowerTurret{ - protected float firingMoveFract = 0.25f; - protected float shootDuration = 100f; + public float firingMoveFract = 0.25f; + public float shootDuration = 100f; public LaserTurret(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/LiquidTurret.java b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/LiquidTurret.java index 28a33aa82a..83b9a75d8b 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/LiquidTurret.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/LiquidTurret.java @@ -15,7 +15,7 @@ import io.anuke.mindustry.world.meta.values.*; import static io.anuke.mindustry.Vars.*; public class LiquidTurret extends Turret{ - protected ObjectMap ammo = new ObjectMap<>(); + public ObjectMap ammo = new ObjectMap<>(); public LiquidTurret(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/PowerTurret.java b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/PowerTurret.java index 7e4c54ace4..1eab2079a8 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/PowerTurret.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/PowerTurret.java @@ -7,8 +7,8 @@ import io.anuke.mindustry.world.meta.BlockStat; import io.anuke.mindustry.world.meta.StatUnit; public class PowerTurret extends CooledTurret{ - protected @NonNull BulletType shootType; - protected float powerUse = 1f; + public @NonNull BulletType shootType; + public float powerUse = 1f; public PowerTurret(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/Turret.java b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/Turret.java index 05edbe5091..9f2cfa9ed6 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/Turret.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/Turret.java @@ -28,40 +28,39 @@ import io.anuke.mindustry.world.meta.*; import static io.anuke.mindustry.Vars.tilesize; public abstract class Turret extends Block{ - protected static final int targetInterval = 20; + public final int timerTarget = timers++; + public int targetInterval = 20; - protected final int timerTarget = timers++; + public Color heatColor = Pal.turretHeat; + public Effect shootEffect = Fx.none; + public Effect smokeEffect = Fx.none; + public Effect ammoUseEffect = Fx.none; + public Sound shootSound = Sounds.shoot; - protected Color heatColor = Pal.turretHeat; - protected Effect shootEffect = Fx.none; - protected Effect smokeEffect = Fx.none; - protected Effect ammoUseEffect = Fx.none; - protected Sound shootSound = Sounds.shoot; - - protected int ammoPerShot = 1; - protected float ammoEjectBack = 1f; - protected float range = 50f; - protected float reload = 10f; - protected float inaccuracy = 0f; - protected int shots = 1; - protected float spread = 4f; - protected float recoil = 1f; - protected float restitution = 0.02f; - protected float cooldown = 0.02f; - protected float rotatespeed = 5f; //in degrees per tick - protected float shootCone = 8f; - protected float shootShake = 0f; - protected float xRand = 0f; - protected boolean targetAir = true; - protected boolean targetGround = true; + public int ammoPerShot = 1; + public float ammoEjectBack = 1f; + public float range = 50f; + public float reload = 10f; + public float inaccuracy = 0f; + public int shots = 1; + public float spread = 4f; + public float recoil = 1f; + public float restitution = 0.02f; + public float cooldown = 0.02f; + public float rotatespeed = 5f; //in degrees per tick + public float shootCone = 8f; + public float shootShake = 0f; + public float xRand = 0f; + public boolean targetAir = true; + public boolean targetGround = true; protected Vector2 tr = new Vector2(); protected Vector2 tr2 = new Vector2(); - protected TextureRegion baseRegion, heatRegion; + public TextureRegion baseRegion, heatRegion; - protected Cons2 drawer = (tile, entity) -> Draw.rect(region, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90); - protected Cons2 heatDrawer = (tile, entity) -> { + public Cons2 drawer = (tile, entity) -> Draw.rect(region, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90); + public Cons2 heatDrawer = (tile, entity) -> { if(entity.heat <= 0.00001f) return; Draw.color(heatColor, entity.heat); Draw.blend(Blending.additive); diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/BufferedItemBridge.java b/core/src/io/anuke/mindustry/world/blocks/distribution/BufferedItemBridge.java index 4fc815676d..cb684c90f3 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/BufferedItemBridge.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/BufferedItemBridge.java @@ -7,10 +7,10 @@ import io.anuke.mindustry.world.*; import java.io.*; public class BufferedItemBridge extends ExtendingItemBridge{ - protected int timerAccept = timers++; + public final int timerAccept = timers++; - protected float speed = 40f; - protected int bufferCapacity = 50; + public float speed = 40f; + public int bufferCapacity = 50; public BufferedItemBridge(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/Conveyor.java b/core/src/io/anuke/mindustry/world/blocks/distribution/Conveyor.java index e05812d523..f046a63850 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/Conveyor.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/Conveyor.java @@ -32,7 +32,7 @@ public class Conveyor extends Block implements Autotiler{ private final Vector2 tr2 = new Vector2(); private TextureRegion[][] regions = new TextureRegion[7][4]; - protected float speed = 0f; + public float speed = 0f; protected Conveyor(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/ItemBridge.java b/core/src/io/anuke/mindustry/world/blocks/distribution/ItemBridge.java index 0d692a504d..8965a1be97 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/ItemBridge.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/ItemBridge.java @@ -20,12 +20,12 @@ import java.io.*; import static io.anuke.mindustry.Vars.*; public class ItemBridge extends Block{ - protected int timerTransport = timers++; - protected int range; - protected float transportTime = 2f; - protected TextureRegion endRegion, bridgeRegion, arrowRegion; - protected BuildRequest otherReq; + public final int timerTransport = timers++; + public int range; + public float transportTime = 2f; + public TextureRegion endRegion, bridgeRegion, arrowRegion; + private static BuildRequest otherReq; private static int lastPlaced = Pos.invalid; public ItemBridge(String name){ diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/Junction.java b/core/src/io/anuke/mindustry/world/blocks/distribution/Junction.java index 7877317185..8fe62c1a05 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/Junction.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/Junction.java @@ -17,8 +17,8 @@ import java.io.IOException; import static io.anuke.mindustry.Vars.content; public class Junction extends Block{ - protected float speed = 26; //frames taken to go through this junction - protected int capacity = 6; + public float speed = 26; //frames taken to go through this junction + public int capacity = 6; public Junction(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/MassDriver.java b/core/src/io/anuke/mindustry/world/blocks/distribution/MassDriver.java index c4a1aba990..f6799d7dc7 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/MassDriver.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/MassDriver.java @@ -20,17 +20,17 @@ import java.io.*; import static io.anuke.mindustry.Vars.*; public class MassDriver extends Block{ - protected float range; - protected float rotateSpeed = 0.04f; - protected float translation = 7f; - protected int minDistribute = 10; - protected float knockback = 4f; - protected float reloadTime = 100f; - protected Effect shootEffect = Fx.shootBig2; - protected Effect smokeEffect = Fx.shootBigSmoke2; - protected Effect recieveEffect = Fx.mineBig; - protected float shake = 3f; - protected TextureRegion baseRegion; + public float range; + public float rotateSpeed = 0.04f; + public float translation = 7f; + public int minDistribute = 10; + public float knockback = 4f; + public float reloadTime = 100f; + public Effect shootEffect = Fx.shootBig2; + public Effect smokeEffect = Fx.shootBigSmoke2; + public Effect recieveEffect = Fx.mineBig; + public float shake = 3f; + public TextureRegion baseRegion; public MassDriver(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/OverflowGate.java b/core/src/io/anuke/mindustry/world/blocks/distribution/OverflowGate.java index b25635e005..a510bae97c 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/OverflowGate.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/OverflowGate.java @@ -10,7 +10,7 @@ import io.anuke.mindustry.world.meta.BlockGroup; import java.io.*; public class OverflowGate extends Block{ - protected float speed = 1f; + public float speed = 1f; public OverflowGate(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/Router.java b/core/src/io/anuke/mindustry/world/blocks/distribution/Router.java index fdff392743..c8e9fb441d 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/Router.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/Router.java @@ -9,7 +9,7 @@ import io.anuke.mindustry.world.*; import io.anuke.mindustry.world.meta.BlockGroup; public class Router extends Block{ - protected float speed = 8f; + public float speed = 8f; public Router(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/Sorter.java b/core/src/io/anuke/mindustry/world/blocks/distribution/Sorter.java index 13eb1224e8..60c88e77b1 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/Sorter.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/Sorter.java @@ -18,7 +18,7 @@ import static io.anuke.mindustry.Vars.content; public class Sorter extends Block{ private static Item lastItem; - protected boolean invert; + public boolean invert; public Sorter(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/liquid/ArmoredConduit.java b/core/src/io/anuke/mindustry/world/blocks/liquid/ArmoredConduit.java index 7a50ef5f0a..d74087123c 100644 --- a/core/src/io/anuke/mindustry/world/blocks/liquid/ArmoredConduit.java +++ b/core/src/io/anuke/mindustry/world/blocks/liquid/ArmoredConduit.java @@ -9,7 +9,7 @@ import io.anuke.mindustry.world.Edges; import io.anuke.mindustry.world.Tile; public class ArmoredConduit extends Conduit{ - protected TextureRegion capRegion; + public TextureRegion capRegion; public ArmoredConduit(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/liquid/Conduit.java b/core/src/io/anuke/mindustry/world/blocks/liquid/Conduit.java index 80c2ab5baf..e68b58e48d 100644 --- a/core/src/io/anuke/mindustry/world/blocks/liquid/Conduit.java +++ b/core/src/io/anuke/mindustry/world/blocks/liquid/Conduit.java @@ -16,12 +16,12 @@ import io.anuke.mindustry.world.blocks.*; import io.anuke.mindustry.world.modules.*; public class Conduit extends LiquidBlock implements Autotiler{ - protected final int timerFlow = timers++; + public final int timerFlow = timers++; - protected TextureRegion[] topRegions = new TextureRegion[7]; - protected TextureRegion[] botRegions = new TextureRegion[7]; + public TextureRegion[] topRegions = new TextureRegion[7]; + public TextureRegion[] botRegions = new TextureRegion[7]; - protected float leakResistance = 1.5f; + public float leakResistance = 1.5f; public Conduit(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/liquid/LiquidOverflowGate.java b/core/src/io/anuke/mindustry/world/blocks/liquid/LiquidOverflowGate.java index dafcef1508..3004835249 100644 --- a/core/src/io/anuke/mindustry/world/blocks/liquid/LiquidOverflowGate.java +++ b/core/src/io/anuke/mindustry/world/blocks/liquid/LiquidOverflowGate.java @@ -9,7 +9,7 @@ import io.anuke.mindustry.world.meta.*; //TODO implement later public class LiquidOverflowGate extends LiquidBlock{ - int topRegion; + public int topRegion; public LiquidOverflowGate(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/power/ImpactReactor.java b/core/src/io/anuke/mindustry/world/blocks/power/ImpactReactor.java index e1945f1609..77e2cf2ad2 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/ImpactReactor.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/ImpactReactor.java @@ -19,17 +19,17 @@ import java.io.*; import static io.anuke.mindustry.Vars.*; public class ImpactReactor extends PowerGenerator{ - protected int timerUse = timers++; + public final int timerUse = timers++; - protected int plasmas = 4; - protected float warmupSpeed = 0.001f; - protected float itemDuration = 60f; - protected int explosionRadius = 50; - protected int explosionDamage = 2000; + public int plasmas = 4; + public float warmupSpeed = 0.001f; + public float itemDuration = 60f; + public int explosionRadius = 50; + public int explosionDamage = 2000; - protected Color plasma1 = Color.valueOf("ffd06b"), plasma2 = Color.valueOf("ff361b"); - protected int bottomRegion; - protected int[] plasmaRegions; + public Color plasma1 = Color.valueOf("ffd06b"), plasma2 = Color.valueOf("ff361b"); + public int bottomRegion; + public int[] plasmaRegions; public ImpactReactor(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/power/ItemLiquidGenerator.java b/core/src/io/anuke/mindustry/world/blocks/power/ItemLiquidGenerator.java index 07effa5b30..7d4b378b2a 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/ItemLiquidGenerator.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/ItemLiquidGenerator.java @@ -20,20 +20,20 @@ import static io.anuke.mindustry.Vars.*; * Liquids will take priority over items. */ public class ItemLiquidGenerator extends PowerGenerator{ - protected float minItemEfficiency = 0.2f; + public float minItemEfficiency = 0.2f; /** The time in number of ticks during which a single item will produce power. */ - protected float itemDuration = 70f; + public float itemDuration = 70f; - protected float minLiquidEfficiency = 0.2f; + public float minLiquidEfficiency = 0.2f; /** Maximum liquid used per frame. */ - protected float maxLiquidGenerate = 0.4f; + public float maxLiquidGenerate = 0.4f; - protected Effect generateEffect = Fx.generatespark; - protected Effect explodeEffect = Fx.generatespark; - protected Color heatColor = Color.valueOf("ff9b59"); - protected TextureRegion topRegion, liquidRegion; - protected boolean randomlyExplode = true; - protected boolean defaults = false; + public Effect generateEffect = Fx.generatespark; + public Effect explodeEffect = Fx.generatespark; + public Color heatColor = Color.valueOf("ff9b59"); + public TextureRegion topRegion, liquidRegion; + public boolean randomlyExplode = true; + public boolean defaults = false; public ItemLiquidGenerator(boolean hasItems, boolean hasLiquids, String name){ this(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/power/LightBlock.java b/core/src/io/anuke/mindustry/world/blocks/power/LightBlock.java index 0fc61676f2..06e1b257cb 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/LightBlock.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/LightBlock.java @@ -16,9 +16,9 @@ import static io.anuke.mindustry.Vars.*; public class LightBlock extends Block{ private static int lastColor = 0; - protected float brightness = 0.9f; - protected float radius = 200f; - protected int topRegion; + public float brightness = 0.9f; + public float radius = 200f; + public int topRegion; public LightBlock(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/power/NuclearReactor.java b/core/src/io/anuke/mindustry/world/blocks/power/NuclearReactor.java index 2aa478a3bf..7ae1e4ca70 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/NuclearReactor.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/NuclearReactor.java @@ -22,22 +22,22 @@ import java.io.*; import static io.anuke.mindustry.Vars.*; public class NuclearReactor extends PowerGenerator{ - protected final int timerFuel = timers++; + public final int timerFuel = timers++; - protected final Vector2 tr = new Vector2(); + public final Vector2 tr = new Vector2(); - protected Color lightColor = Color.valueOf("7f19ea"); - protected Color coolColor = new Color(1, 1, 1, 0f); - protected Color hotColor = Color.valueOf("ff9575a3"); - protected float itemDuration = 120; //time to consume 1 fuel - protected float heating = 0.01f; //heating per frame * fullness - protected float smokeThreshold = 0.3f; //threshold at which block starts smoking - protected int explosionRadius = 40; - protected int explosionDamage = 1350; - protected float flashThreshold = 0.46f; //heat threshold at which the lights start flashing - protected float coolantPower = 0.5f; + public Color lightColor = Color.valueOf("7f19ea"); + public Color coolColor = new Color(1, 1, 1, 0f); + public Color hotColor = Color.valueOf("ff9575a3"); + public float itemDuration = 120; //time to consume 1 fuel + public float heating = 0.01f; //heating per frame * fullness + public float smokeThreshold = 0.3f; //threshold at which block starts smoking + public int explosionRadius = 40; + public int explosionDamage = 1350; + public float flashThreshold = 0.46f; //heat threshold at which the lights start flashing + public float coolantPower = 0.5f; - protected TextureRegion topRegion, lightsRegion; + public TextureRegion topRegion, lightsRegion; public NuclearReactor(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/power/PowerDiode.java b/core/src/io/anuke/mindustry/world/blocks/power/PowerDiode.java index 08d621a09c..1dee0636a5 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/PowerDiode.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/PowerDiode.java @@ -13,7 +13,7 @@ import io.anuke.arc.graphics.g2d.TextureRegion; import io.anuke.mindustry.entities.traits.BuilderTrait; public class PowerDiode extends Block{ - protected TextureRegion arrow; + public TextureRegion arrow; public PowerDiode(String name){ super(name); @@ -50,7 +50,7 @@ public class PowerDiode extends Block{ } // battery % of the graph on either side, defaults to zero - protected float bar(Tile tile){ + public float bar(Tile tile){ return (tile != null && tile.block().hasPower) ? tile.entity.power.graph.getBatteryStored() / tile.entity.power.graph.getTotalBatteryCapacity() : 0f; } diff --git a/core/src/io/anuke/mindustry/world/blocks/power/PowerGenerator.java b/core/src/io/anuke/mindustry/world/blocks/power/PowerGenerator.java index a7bfe3da97..d5e4c2ccfd 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/PowerGenerator.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/PowerGenerator.java @@ -13,7 +13,7 @@ import java.io.*; public class PowerGenerator extends PowerDistributor{ /** The amount of power produced per tick in case of an efficiency of 1.0, which represents 100%. */ - protected float powerProduction; + public float powerProduction; public BlockStat generationType = BlockStat.basePowerGeneration; public PowerGenerator(String name){ diff --git a/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java b/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java index 3c9356076b..b2d914ce3f 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java @@ -21,12 +21,12 @@ import static io.anuke.mindustry.Vars.*; public class PowerNode extends PowerBlock{ protected static boolean returnValue = false; - protected ObjectSet graphs = new ObjectSet<>(); - protected Vector2 t1 = new Vector2(), t2 = new Vector2(); - protected TextureRegion laser, laserEnd; + protected final ObjectSet graphs = new ObjectSet<>(); + protected final Vector2 t1 = new Vector2(), t2 = new Vector2(); - protected float laserRange = 6; - protected int maxNodes = 3; + public TextureRegion laser, laserEnd; + public float laserRange = 6; + public int maxNodes = 3; public PowerNode(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/power/ThermalGenerator.java b/core/src/io/anuke/mindustry/world/blocks/power/ThermalGenerator.java index b2d9576718..5bb3cce8d7 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/ThermalGenerator.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/ThermalGenerator.java @@ -12,7 +12,7 @@ import io.anuke.mindustry.world.meta.*; import static io.anuke.mindustry.Vars.renderer; public class ThermalGenerator extends PowerGenerator{ - protected Effect generateEffect = Fx.none; + public Effect generateEffect = Fx.none; public ThermalGenerator(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/production/Cultivator.java b/core/src/io/anuke/mindustry/world/blocks/production/Cultivator.java index c3901d435c..4cf0a6b2f1 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/Cultivator.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/Cultivator.java @@ -16,14 +16,14 @@ import io.anuke.mindustry.world.meta.Attribute; import java.io.*; public class Cultivator extends GenericCrafter{ - protected static final Color plantColor = Color.valueOf("5541b1"); - protected static final Color plantColorLight = Color.valueOf("7457ce"); - protected static final Color bottomColor = Color.valueOf("474747"); + public Color plantColor = Color.valueOf("5541b1"); + public Color plantColorLight = Color.valueOf("7457ce"); + public Color bottomColor = Color.valueOf("474747"); - protected TextureRegion middleRegion, topRegion; - protected RandomXS128 random = new RandomXS128(0); - protected float recurrence = 6f; - protected Attribute attribute = Attribute.spores; + public TextureRegion middleRegion, topRegion; + public RandomXS128 random = new RandomXS128(0); + public float recurrence = 6f; + public Attribute attribute = Attribute.spores; public Cultivator(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/production/Drill.java b/core/src/io/anuke/mindustry/world/blocks/production/Drill.java index 309761830b..c4ee18715a 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/Drill.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/Drill.java @@ -21,41 +21,40 @@ import io.anuke.mindustry.world.meta.*; import static io.anuke.mindustry.Vars.*; public class Drill extends Block{ - protected final static float hardnessDrillMultiplier = 50f; + public float hardnessDrillMultiplier = 50f; protected final ObjectIntMap oreCount = new ObjectIntMap<>(); protected final Array itemArray = new Array<>(); /** Maximum tier of blocks this drill can mine. */ - protected int tier; + public int tier; /** Base time to drill one ore, in frames. */ - protected float drillTime = 300; + public float drillTime = 300; /** How many times faster the drill will progress when boosted by liquid. */ - protected float liquidBoostIntensity = 1.6f; + public float liquidBoostIntensity = 1.6f; /** Speed at which the drill speeds up. */ - protected float warmupSpeed = 0.02f; + public float warmupSpeed = 0.02f; //return variables for countOre protected Item returnItem; protected int returnCount; /** Whether to draw the item this drill is mining. */ - protected boolean drawMineItem = false; + public boolean drawMineItem = false; /** Effect played when an item is produced. This is colored. */ - protected Effect drillEffect = Fx.mine; + public Effect drillEffect = Fx.mine; /** Speed the drill bit rotates at. */ - protected float rotateSpeed = 2f; + public float rotateSpeed = 2f; /** Effect randomly played while drilling. */ - protected Effect updateEffect = Fx.pulverizeSmall; + public Effect updateEffect = Fx.pulverizeSmall; /** Chance the update effect will appear. */ - protected float updateEffectChance = 0.02f; + public float updateEffectChance = 0.02f; - protected boolean drawRim = false; - - protected Color heatColor = Color.valueOf("ff5512"); - protected TextureRegion rimRegion; - protected TextureRegion rotatorRegion; - protected TextureRegion topRegion; + public boolean drawRim = false; + public Color heatColor = Color.valueOf("ff5512"); + public TextureRegion rimRegion; + public TextureRegion rotatorRegion; + public TextureRegion topRegion; public Drill(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/production/Fracker.java b/core/src/io/anuke/mindustry/world/blocks/production/Fracker.java index deb606eedd..4f79a420b5 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/Fracker.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/Fracker.java @@ -6,11 +6,11 @@ import io.anuke.mindustry.world.*; import io.anuke.mindustry.world.meta.*; public class Fracker extends SolidPump{ - protected final float itemUseTime = 100f; + public float itemUseTime = 100f; - protected TextureRegion liquidRegion; - protected TextureRegion rotatorRegion; - protected TextureRegion topRegion; + public TextureRegion liquidRegion; + public TextureRegion rotatorRegion; + public TextureRegion topRegion; public Fracker(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/production/GenericCrafter.java b/core/src/io/anuke/mindustry/world/blocks/production/GenericCrafter.java index 9f4c8c693d..512be4ddd6 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/GenericCrafter.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/GenericCrafter.java @@ -17,16 +17,16 @@ import io.anuke.mindustry.world.meta.*; import java.io.*; public class GenericCrafter extends Block{ - protected ItemStack outputItem; - protected LiquidStack outputLiquid; + public ItemStack outputItem; + public LiquidStack outputLiquid; - protected float craftTime = 80; - protected Effect craftEffect = Fx.none; - protected Effect updateEffect = Fx.none; - protected float updateEffectChance = 0.04f; + public float craftTime = 80; + public Effect craftEffect = Fx.none; + public Effect updateEffect = Fx.none; + public float updateEffectChance = 0.04f; - protected Cons drawer = null; - protected Prov drawIcons = null; + public Cons drawer = null; + public Prov drawIcons = null; public GenericCrafter(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/production/GenericSmelter.java b/core/src/io/anuke/mindustry/world/blocks/production/GenericSmelter.java index 828decc1e0..ba0c20bb75 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/GenericSmelter.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/GenericSmelter.java @@ -11,8 +11,8 @@ import static io.anuke.mindustry.Vars.renderer; /** A GenericCrafter with a new glowing region drawn on top. */ public class GenericSmelter extends GenericCrafter{ - protected Color flameColor = Color.valueOf("ffc999"); - protected TextureRegion topRegion; + public Color flameColor = Color.valueOf("ffc999"); + public TextureRegion topRegion; public GenericSmelter(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/production/Incinerator.java b/core/src/io/anuke/mindustry/world/blocks/production/Incinerator.java index fce368f246..57c00e5a2c 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/Incinerator.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/Incinerator.java @@ -15,8 +15,8 @@ import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; public class Incinerator extends Block{ - protected Effect effect = Fx.fuelburn; - protected Color flameColor = Color.valueOf("ffad9d"); + public Effect effect = Fx.fuelburn; + public Color flameColor = Color.valueOf("ffad9d"); public Incinerator(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/production/Pump.java b/core/src/io/anuke/mindustry/world/blocks/production/Pump.java index 9b91d8b98f..9142cc49af 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/Pump.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/Pump.java @@ -19,7 +19,7 @@ public class Pump extends LiquidBlock{ protected final Array drawTiles = new Array<>(); protected final Array updateTiles = new Array<>(); - protected final int timerContentCheck = timers++; + public final int timerContentCheck = timers++; /** Pump amount, total. */ protected float pumpAmount = 1f; diff --git a/core/src/io/anuke/mindustry/world/blocks/production/SolidPump.java b/core/src/io/anuke/mindustry/world/blocks/production/SolidPump.java index bb6cb397cf..6a3e5d806c 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/SolidPump.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/SolidPump.java @@ -20,12 +20,12 @@ import io.anuke.mindustry.world.meta.BlockStat; * Pump that makes liquid from solids and takes in power. Only works on solid floor blocks. */ public class SolidPump extends Pump{ - protected Liquid result = Liquids.water; - protected Effect updateEffect = Fx.none; - protected float updateEffectChance = 0.02f; - protected float rotateSpeed = 1f; + public Liquid result = Liquids.water; + public Effect updateEffect = Fx.none; + public float updateEffectChance = 0.02f; + public float rotateSpeed = 1f; /** Attribute that is checked when calculating output. */ - protected Attribute attribute; + public Attribute attribute; public SolidPump(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/sandbox/LiquidSource.java b/core/src/io/anuke/mindustry/world/blocks/sandbox/LiquidSource.java index 5513f462ec..ec3f325db2 100644 --- a/core/src/io/anuke/mindustry/world/blocks/sandbox/LiquidSource.java +++ b/core/src/io/anuke/mindustry/world/blocks/sandbox/LiquidSource.java @@ -21,7 +21,7 @@ import java.io.*; import static io.anuke.mindustry.Vars.*; public class LiquidSource extends Block{ - private static Liquid lastLiquid; + public static Liquid lastLiquid; public LiquidSource(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java b/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java index c164e7011e..3ee36c332b 100644 --- a/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java +++ b/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java @@ -24,7 +24,7 @@ import io.anuke.mindustry.world.modules.*; import static io.anuke.mindustry.Vars.*; public class CoreBlock extends StorageBlock{ - protected Mech mech = Mechs.starter; + public Mech mech = Mechs.starter; public CoreBlock(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/storage/LaunchPad.java b/core/src/io/anuke/mindustry/world/blocks/storage/LaunchPad.java index 47973a9a8b..92aa7ae75c 100644 --- a/core/src/io/anuke/mindustry/world/blocks/storage/LaunchPad.java +++ b/core/src/io/anuke/mindustry/world/blocks/storage/LaunchPad.java @@ -21,9 +21,9 @@ import static io.anuke.mindustry.Vars.data; import static io.anuke.mindustry.Vars.world; public class LaunchPad extends StorageBlock{ - protected final int timerLaunch = timers++; + public final int timerLaunch = timers++; /** Time inbetween launches. */ - protected float launchTime; + public float launchTime; public LaunchPad(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/storage/Unloader.java b/core/src/io/anuke/mindustry/world/blocks/storage/Unloader.java index f67701d4d5..b809fc351c 100644 --- a/core/src/io/anuke/mindustry/world/blocks/storage/Unloader.java +++ b/core/src/io/anuke/mindustry/world/blocks/storage/Unloader.java @@ -15,8 +15,8 @@ import java.io.*; import static io.anuke.mindustry.Vars.content; public class Unloader extends Block{ - protected float speed = 1f; - protected final int timerUnload = timers++; + public float speed = 1f; + public final int timerUnload = timers++; private static Item lastItem; diff --git a/core/src/io/anuke/mindustry/world/blocks/units/MechPad.java b/core/src/io/anuke/mindustry/world/blocks/units/MechPad.java index ef7314e00b..c5a07cdead 100644 --- a/core/src/io/anuke/mindustry/world/blocks/units/MechPad.java +++ b/core/src/io/anuke/mindustry/world/blocks/units/MechPad.java @@ -26,7 +26,7 @@ import static io.anuke.mindustry.Vars.*; public class MechPad extends Block{ public @NonNull Mech mech; - protected float buildTime = 60 * 5; + public float buildTime = 60 * 5; public MechPad(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/units/RepairPoint.java b/core/src/io/anuke/mindustry/world/blocks/units/RepairPoint.java index 6c5e8698b2..e02381d73d 100644 --- a/core/src/io/anuke/mindustry/world/blocks/units/RepairPoint.java +++ b/core/src/io/anuke/mindustry/world/blocks/units/RepairPoint.java @@ -19,13 +19,13 @@ import io.anuke.mindustry.world.meta.BlockFlag; public class RepairPoint extends Block{ private static Rectangle rect = new Rectangle(); - protected int timerTarget = timers++; + public int timerTarget = timers++; - protected float repairRadius = 50f; - protected float repairSpeed = 0.3f; - protected float powerUse; - protected TextureRegion baseRegion; - protected TextureRegion laser, laserEnd; + public float repairRadius = 50f; + public float repairSpeed = 0.3f; + public float powerUse; + public TextureRegion baseRegion; + public TextureRegion laser, laserEnd; public RepairPoint(String name){ super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/units/UnitFactory.java b/core/src/io/anuke/mindustry/world/blocks/units/UnitFactory.java index 678d43c10f..93e19b7266 100644 --- a/core/src/io/anuke/mindustry/world/blocks/units/UnitFactory.java +++ b/core/src/io/anuke/mindustry/world/blocks/units/UnitFactory.java @@ -27,12 +27,12 @@ import java.io.*; import static io.anuke.mindustry.Vars.*; public class UnitFactory extends Block{ - protected UnitType unitType; - protected float produceTime = 1000f; - protected float launchVelocity = 0f; - protected TextureRegion topRegion; - protected int maxSpawn = 4; - protected int[] capacities; + public UnitType unitType; + public float produceTime = 1000f; + public float launchVelocity = 0f; + public TextureRegion topRegion; + public int maxSpawn = 4; + public int[] capacities; public UnitFactory(String name){ super(name); diff --git a/desktop/src/io/anuke/mindustry/desktop/DesktopLauncher.java b/desktop/src/io/anuke/mindustry/desktop/DesktopLauncher.java index 1bea20db40..eb216b724e 100644 --- a/desktop/src/io/anuke/mindustry/desktop/DesktopLauncher.java +++ b/desktop/src/io/anuke/mindustry/desktop/DesktopLauncher.java @@ -19,7 +19,7 @@ import io.anuke.arc.util.io.*; import io.anuke.arc.util.serialization.*; import io.anuke.mindustry.*; import io.anuke.mindustry.core.GameState.*; -import io.anuke.mindustry.core.Version; +import io.anuke.mindustry.core.*; import io.anuke.mindustry.desktop.steam.*; import io.anuke.mindustry.game.EventType.*; import io.anuke.mindustry.mod.Mods.*; diff --git a/gradle.properties b/gradle.properties index 0e54b8fa9e..5157fccbe2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xms256m -Xmx1024m -archash=2caecb328322b840a760dbb8877952867abd54d1 +archash=6d310772fec1f69efeae2e487cab3bd64728ae05 diff --git a/server/src/io/anuke/mindustry/server/MindustryServer.java b/server/src/io/anuke/mindustry/server/MindustryServer.java index ad83a69eb7..ca6077fd9e 100644 --- a/server/src/io/anuke/mindustry/server/MindustryServer.java +++ b/server/src/io/anuke/mindustry/server/MindustryServer.java @@ -33,7 +33,9 @@ public class MindustryServer implements ApplicationListener{ Vars.loadSettings(); Vars.init(); - content.createContent(); + content.createBaseContent(); + mods.loadScripts(); + content.createModContent(); content.init(); Core.app.addListener(logic = new Logic()); diff --git a/tests/src/test/java/ApplicationTests.java b/tests/src/test/java/ApplicationTests.java index a9ed831fbc..58f51ad473 100644 --- a/tests/src/test/java/ApplicationTests.java +++ b/tests/src/test/java/ApplicationTests.java @@ -47,7 +47,7 @@ public class ApplicationTests{ net = new Net(null); tree = new FileTree(); Vars.init(); - content.createContent(); + content.createBaseContent(); add(logic = new Logic()); add(netServer = new NetServer()); diff --git a/tests/src/test/java/power/PowerTestFixture.java b/tests/src/test/java/power/PowerTestFixture.java index 75f4a56854..e3a2fea469 100644 --- a/tests/src/test/java/power/PowerTestFixture.java +++ b/tests/src/test/java/power/PowerTestFixture.java @@ -33,7 +33,7 @@ public class PowerTestFixture{ } }; - content.createContent(); + content.createBaseContent(); Log.setUseColors(false); Time.setDeltaProvider(() -> 0.5f); } diff --git a/tools/build.gradle b/tools/build.gradle index dff7745f5d..6a2825747a 100644 --- a/tools/build.gradle +++ b/tools/build.gradle @@ -297,7 +297,7 @@ task pack(dependsOn: classes){ //run generation task; generate all needed sprites file(genFolder).mkdirs() javaexec{ - main = "io.anuke.mindustry.ImagePacker" + main = "io.anuke.mindustry.tools.ImagePacker" classpath = sourceSets.main.runtimeClasspath standardInput = System.in workingDir = genFolder @@ -310,7 +310,7 @@ task pack(dependsOn: classes){ } jvmArgs("-Djava.awt.headless=true") - main = "io.anuke.mindustry.Upscaler" + main = "io.anuke.mindustry.tools.Upscaler" classpath = sourceSets.main.runtimeClasspath standardInput = System.in workingDir = "../core/assets-raw/sprites_out/ui/icons" @@ -351,7 +351,7 @@ task pack(dependsOn: classes){ task genSprites(dependsOn: classes, type: JavaExec){ finalizedBy 'antialiasGen' - main = "io.anuke.mindustry.ImagePacker" + main = "io.anuke.mindustry.tools.ImagePacker" classpath = sourceSets.main.runtimeClasspath jvmArgs("-Djava.awt.headless=true") standardInput = System.in @@ -361,7 +361,7 @@ task genSprites(dependsOn: classes, type: JavaExec){ task updateBundles(dependsOn: classes, type: JavaExec){ file(genFolder).mkdirs() - main = "io.anuke.mindustry.BundleLauncher" + main = "io.anuke.mindustry.tools.BundleLauncher" classpath = sourceSets.main.runtimeClasspath standardInput = System.in workingDir = "../core/assets/bundles/" diff --git a/tools/src/io/anuke/mindustry/BundleLauncher.java b/tools/src/io/anuke/mindustry/tools/BundleLauncher.java similarity index 98% rename from tools/src/io/anuke/mindustry/BundleLauncher.java rename to tools/src/io/anuke/mindustry/tools/BundleLauncher.java index 3888f641da..7d99eadac2 100644 --- a/tools/src/io/anuke/mindustry/BundleLauncher.java +++ b/tools/src/io/anuke/mindustry/tools/BundleLauncher.java @@ -1,4 +1,4 @@ -package io.anuke.mindustry; +package io.anuke.mindustry.tools; import io.anuke.arc.collection.Array; import io.anuke.arc.collection.OrderedMap; diff --git a/tools/src/io/anuke/mindustry/Generators.java b/tools/src/io/anuke/mindustry/tools/Generators.java similarity index 99% rename from tools/src/io/anuke/mindustry/Generators.java rename to tools/src/io/anuke/mindustry/tools/Generators.java index 718f994376..91887f0383 100644 --- a/tools/src/io/anuke/mindustry/Generators.java +++ b/tools/src/io/anuke/mindustry/tools/Generators.java @@ -1,4 +1,4 @@ -package io.anuke.mindustry; +package io.anuke.mindustry.tools; import io.anuke.arc.collection.*; import io.anuke.arc.graphics.*; @@ -6,7 +6,7 @@ import io.anuke.arc.graphics.g2d.*; import io.anuke.arc.math.*; import io.anuke.arc.util.*; import io.anuke.arc.util.noise.*; -import io.anuke.mindustry.ImagePacker.*; +import io.anuke.mindustry.tools.ImagePacker.*; import io.anuke.mindustry.ctype.*; import io.anuke.mindustry.type.*; import io.anuke.mindustry.ui.*; diff --git a/tools/src/io/anuke/mindustry/Image.java b/tools/src/io/anuke/mindustry/tools/Image.java similarity index 97% rename from tools/src/io/anuke/mindustry/Image.java rename to tools/src/io/anuke/mindustry/tools/Image.java index 30e06b8170..f7c987762b 100644 --- a/tools/src/io/anuke/mindustry/Image.java +++ b/tools/src/io/anuke/mindustry/tools/Image.java @@ -1,9 +1,9 @@ -package io.anuke.mindustry; +package io.anuke.mindustry.tools; import io.anuke.arc.graphics.Color; import io.anuke.arc.graphics.g2d.TextureRegion; import io.anuke.arc.util.Structs; -import io.anuke.mindustry.ImagePacker.GenRegion; +import io.anuke.mindustry.tools.ImagePacker.GenRegion; import javax.imageio.ImageIO; import java.awt.*; diff --git a/tools/src/io/anuke/mindustry/ImagePacker.java b/tools/src/io/anuke/mindustry/tools/ImagePacker.java similarity index 97% rename from tools/src/io/anuke/mindustry/ImagePacker.java rename to tools/src/io/anuke/mindustry/tools/ImagePacker.java index 200da5c602..76346817ab 100644 --- a/tools/src/io/anuke/mindustry/ImagePacker.java +++ b/tools/src/io/anuke/mindustry/tools/ImagePacker.java @@ -1,4 +1,4 @@ -package io.anuke.mindustry; +package io.anuke.mindustry.tools; import io.anuke.arc.Core; import io.anuke.arc.collection.ObjectMap; @@ -7,6 +7,7 @@ import io.anuke.arc.graphics.g2d.TextureAtlas.AtlasRegion; import io.anuke.arc.util.*; import io.anuke.arc.util.Log.LogHandler; import io.anuke.arc.util.Log.NoopLogHandler; +import io.anuke.mindustry.*; import io.anuke.mindustry.core.ContentLoader; import javax.imageio.ImageIO; @@ -23,7 +24,7 @@ public class ImagePacker{ Log.setLogger(new NoopLogHandler()); Vars.content = new ContentLoader(); - Vars.content.createContent(); + Vars.content.createBaseContent(); Log.setLogger(new LogHandler()); Files.walk(Paths.get("../../../assets-raw/sprites_out")).forEach(path -> { diff --git a/tools/src/io/anuke/mindustry/tools/ScriptStubGenerator.java b/tools/src/io/anuke/mindustry/tools/ScriptStubGenerator.java new file mode 100644 index 0000000000..17cd3fb5df --- /dev/null +++ b/tools/src/io/anuke/mindustry/tools/ScriptStubGenerator.java @@ -0,0 +1,78 @@ +package io.anuke.mindustry.tools; + +import io.anuke.arc.*; +import io.anuke.arc.collection.Array; +import io.anuke.arc.collection.*; +import io.anuke.arc.files.*; +import io.anuke.arc.graphics.*; +import io.anuke.arc.graphics.g2d.*; +import io.anuke.arc.graphics.g2d.TextureAtlas.*; +import io.anuke.arc.math.*; +import io.anuke.arc.util.*; +import org.reflections.*; +import org.reflections.scanners.*; +import org.reflections.util.*; + +import java.io.*; +import java.lang.reflect.*; +import java.util.*; + +public class ScriptStubGenerator{ + + public static void main(String[] args){ + String base = "io.anuke.mindustry"; + Array blacklist = Array.with("plugin", "mod", "net", "io", "tools", "gen"); + Array nameBlacklist = Array.with("ClientLauncher", "NetClient", "NetServer", "ClassAccess"); + Array> whitelist = Array.with(Draw.class, Fill.class, Lines.class, Core.class, TextureAtlas.class, TextureRegion.class, Time.class, System.class, PrintStream.class, AtlasRegion.class, String.class, Mathf.class, Angles.class, Color.class); + Array nopackage = Array.with("io.anuke.arc.func", "java.lang", "java"); + Array imported = Array.with("io.anuke.mindustry.type", "io.anuke.mindustry.world"); + + String fileTemplate = "package io.anuke.mindustry.mod;\n" + + "\n" + + "import io.anuke.arc.collection.*;\n" + + "//obviously autogenerated, do not touch\n" + + "public class ClassAccess{\n" + + //"\tstatic final Array> allowedClasses = Array.with($ALLOWED_CLASSES$);\n" + + "\tpublic static final ObjectSet allowedClassNames = ObjectSet.with($ALLOWED_CLASS_NAMES$);\n" + + "}"; + + List classLoadersList = new LinkedList<>(); + classLoadersList.add(ClasspathHelper.contextClassLoader()); + classLoadersList.add(ClasspathHelper.staticClassLoader()); + + Reflections reflections = new Reflections(new ConfigurationBuilder() + .setScanners(new SubTypesScanner(false), new ResourcesScanner()) + .setUrls(ClasspathHelper.forClassLoader(classLoadersList.toArray(new ClassLoader[0]))) + .filterInputsBy(new FilterBuilder() + .include(FilterBuilder.prefix("io.anuke.mindustry")) + .include(FilterBuilder.prefix("io.anuke.arc.func")) + .include(FilterBuilder.prefix("io.anuke.arc.collection")) + .include(FilterBuilder.prefix("io.anuke.arc.scene")) + )); + + Array> classes = Array.with(reflections.getSubTypesOf(Object.class)); + classes.addAll(reflections.getSubTypesOf(Enum.class)); + classes.addAll(whitelist); + classes.sort(Structs.comparing(Class::getName)); + + classes.removeAll(type -> type.isSynthetic() || type.isAnonymousClass() || type.getCanonicalName() == null || Modifier.isPrivate(type.getModifiers()) + || blacklist.contains(s -> type.getName().startsWith(base + "." + s + ".")) || nameBlacklist.contains(type.getSimpleName())); + classes.distinct(); + ObjectSet used = ObjectSet.with(); + + StringBuilder result = new StringBuilder("//Generated class. Do not modify.\n"); + result.append("\n").append(new FileHandle("core/assets/scripts/base.js").readString()).append("\n"); + for(Class type : classes){ + if(used.contains(type.getPackage().getName()) || nopackage.contains(s -> type.getName().startsWith(s))) continue; + result.append("importPackage(Packages.").append(type.getPackage().getName()).append(")\n"); + used.add(type.getPackage().getName()); + } + + //Log.info(result); + + new FileHandle("core/assets/scripts/global.js").writeString(result.toString()); + new FileHandle("core/src/io/anuke/mindustry/mod/ClassAccess.java").writeString(fileTemplate + .replace("$ALLOWED_CLASSES$", classes.toString(", ", type -> type.getName() + ".class")) + .replace("$ALLOWED_CLASS_NAMES$", classes.toString(", ", type -> "\"" + type.getName() + "\""))); + } +} diff --git a/tools/src/io/anuke/mindustry/SquareMarcher.java b/tools/src/io/anuke/mindustry/tools/SquareMarcher.java similarity index 99% rename from tools/src/io/anuke/mindustry/SquareMarcher.java rename to tools/src/io/anuke/mindustry/tools/SquareMarcher.java index 278f9543aa..c795637e25 100644 --- a/tools/src/io/anuke/mindustry/SquareMarcher.java +++ b/tools/src/io/anuke/mindustry/tools/SquareMarcher.java @@ -1,4 +1,4 @@ -package io.anuke.mindustry; +package io.anuke.mindustry.tools; import io.anuke.arc.Core; import io.anuke.arc.files.FileHandle; diff --git a/tools/src/io/anuke/mindustry/Upscaler.java b/tools/src/io/anuke/mindustry/tools/Upscaler.java similarity index 97% rename from tools/src/io/anuke/mindustry/Upscaler.java rename to tools/src/io/anuke/mindustry/tools/Upscaler.java index 12cc32ee3b..5101552ddb 100644 --- a/tools/src/io/anuke/mindustry/Upscaler.java +++ b/tools/src/io/anuke/mindustry/tools/Upscaler.java @@ -1,4 +1,4 @@ -package io.anuke.mindustry; +package io.anuke.mindustry.tools; import io.anuke.arc.*; import io.anuke.arc.backends.sdl.*;