From 47ead3c4758572e9b7e5c45a69a9d96ce2650d67 Mon Sep 17 00:00:00 2001 From: RushieWashie <57391931+JiroCab@users.noreply.github.com> Date: Sun, 17 Aug 2025 15:08:12 +0800 Subject: [PATCH] Maw - Added wip boss bar - Fixed a new cut scene fragment every time a map is loaded (will cause more memory usage) - changed cut scene to be trigger by wave instead of the unit iexisting - added toxopid to gradle --- build.gradle.kts | 10 ++++ src/biotech/BioEventHandler.java | 10 +++- src/biotech/BioTech.java | 1 + src/biotech/BioVars.java | 13 +++-- src/biotech/type/unit/ShomeretUnitType.java | 6 --- src/biotech/ui/BioBossBarFragment.java | 56 +++++++++++++++++++++ 6 files changed, 85 insertions(+), 11 deletions(-) create mode 100644 src/biotech/ui/BioBossBarFragment.java diff --git a/build.gradle.kts b/build.gradle.kts index 234e338..f3baca4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -21,6 +21,7 @@ buildscript{ plugins{ java id("com.github.GglLfr.EntityAnno") apply false + id("com.xpdustry.toxopid") version "4.1.0" } val arcVersion: String by project @@ -52,6 +53,15 @@ fun entity(module: String): String{ return "com.github.GglLfr.EntityAnno$module:$entVersion" } +fun toxopid(module: String): String{ + return "com.xpdustry.toxopid.spec.ModPlatform" +} + +toxopid { + compileVersion = mindustryVersion + runtimeVersion = mindustryVersion +} + allprojects{ apply(plugin = "java") sourceSets["main"].java.setSrcDirs(listOf(layout.projectDirectory.dir("src"))) diff --git a/src/biotech/BioEventHandler.java b/src/biotech/BioEventHandler.java index d66f670..1e962c7 100644 --- a/src/biotech/BioEventHandler.java +++ b/src/biotech/BioEventHandler.java @@ -4,10 +4,11 @@ import arc.util.Log; import arc.util.Reflect; import biotech.content.BioFx; -import biotech.ui.BioResearchDialog; +import biotech.type.unit.*; +import biotech.ui.*; import biotech.world.blocks.enviroment.BiologicalStaticSpawner; import mindustry.Vars; -import mindustry.game.EventType; +import mindustry.game.*; import mindustry.gen.Building; import mindustry.gen.Groups; import mindustry.ui.fragments.MenuFragment; @@ -29,6 +30,11 @@ public static void init() { } }); + Events.on(EventType.WaveEvent.class, event -> { + if(Vars.state.rules.spawns.contains( w -> w.type instanceof ShomeretUnitType)) BioVars.shomeretUI.begin(); + }); + Events.on(EventType.WorldLoadEvent.class, you -> BioVars.postInit()); + Events.on(EventType.ClientLoadEvent.class, world -> BioVars.load()); } } diff --git a/src/biotech/BioTech.java b/src/biotech/BioTech.java index f5e469d..166a344 100644 --- a/src/biotech/BioTech.java +++ b/src/biotech/BioTech.java @@ -66,6 +66,7 @@ public static void loadMusic() { void loadSettings() { ui.settings.addCategory(bundle.get("setting.biotech-category"), Icon.settings, t -> { + t.checkPref("biotech-bossbar-hides-menu", true); t.pref(new ButtonPref(bundle.get("setting.biotech-clear-tech-tree"), Icon.trash,() -> { ui.showConfirm("@confirm", bundle.get("setting.biotech-clear-tech-tree.confirm"), () -> { diff --git a/src/biotech/BioVars.java b/src/biotech/BioVars.java index 4a26ee9..2fbdc1f 100644 --- a/src/biotech/BioVars.java +++ b/src/biotech/BioVars.java @@ -1,12 +1,19 @@ package biotech; -import biotech.ui.ShomeretUI; +import biotech.type.unit.*; +import biotech.ui.*; import mindustry.Vars; public class BioVars { - public static ShomeretUI shomeretUI = new ShomeretUI(); + public static ShomeretUI shomeretUI = new ShomeretUI(); + public static BioBossBarFragment bossBar = new BioBossBarFragment(); - public static void postInit() { + public static void load(){ + bossBar.load(Vars.ui.hudGroup); shomeretUI.build(Vars.ui.hudGroup); } + + public static void postInit() { + bossBar.build(); + } } diff --git a/src/biotech/type/unit/ShomeretUnitType.java b/src/biotech/type/unit/ShomeretUnitType.java index 4fb267b..b987e20 100644 --- a/src/biotech/type/unit/ShomeretUnitType.java +++ b/src/biotech/type/unit/ShomeretUnitType.java @@ -19,7 +19,6 @@ public class ShomeretUnitType extends BiologicalUnitType { public static int state; public static UnitType ima; - boolean cutsceneFinished = false; int spawnCooldown = 10 * 60; public ShomeretUnitType(String name) { @@ -112,11 +111,6 @@ public void init() { public void update(Unit unit) { super.update(unit); - if (!cutsceneFinished) { - BioVars.shomeretUI.begin(); - cutsceneFinished = true; - } - if (unit.health < unit.maxHealth / 2 && state == 0) state = 1; //ima shitter diff --git a/src/biotech/ui/BioBossBarFragment.java b/src/biotech/ui/BioBossBarFragment.java new file mode 100644 index 0000000..5d8e9f8 --- /dev/null +++ b/src/biotech/ui/BioBossBarFragment.java @@ -0,0 +1,56 @@ +package biotech.ui; + +import arc.*; +import arc.func.*; +import arc.graphics.g2d.*; +import arc.scene.*; +import arc.scene.ui.layout.*; +import arc.util.*; +import mindustry.*; +import mindustry.graphics.*; +import mindustry.ui.*; + + +public class BioBossBarFragment { + public Table bossBar = new Table(); + + public boolean hide(){ + return !Core.settings.getBool("biotech-bossbar-hides-menu", true); + } + + public void load(Group parent){ + Boolp prevHud = Vars.ui.hudGroup.find("waves").visibility, prevMap = Vars.ui.hudGroup.find("minimap/position").visibility; + if(!Vars.mobile){ //dont softlock mobile players + if(prevHud == null) prevHud = () -> false; + Boolp finalprevHud = prevHud; + parent.find("waves").visible( () -> hide() && finalprevHud.get()); + } + + if(prevMap == null) prevMap = () -> false; + Boolp finalprevMap = prevMap; + parent.find("minimap/position").visible( () -> hide() && finalprevMap.get()); + + parent.fill( p -> { + p.name = "biotech-bossbar"; + p.align(Align.top).setFillParent(true); + p.add(bossBar).visible(true); //<- replace with the unit detection + }); + } + + public void build(){ + bossBar.clear();; + Bar bar = new Bar( + () -> ">m< ow", + () -> Pal.heal, + () -> Vars.player.unit() != null ? Vars.player.unit().healthf() : 0f //<- replace this with the actually unit(s) + ){ + @Override + public void draw(){ + //replace this with ur gorry image -rushie + super.draw(); + } + }; + bossBar.add(bar).minWidth(Core.graphics.getWidth() * 0.85f).minHeight(50f).pad(5f); + + } +}