diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index f59a38ad30..59560dc016 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -1358,6 +1358,7 @@ keybind.shoot.name = Shoot keybind.zoom.name = Zoom keybind.menu.name = Menu keybind.pause.name = Pause +keybind.skip_wave.name = Skip Wave keybind.pause_building.name = Pause/Resume Building keybind.minimap.name = Minimap keybind.planet_map.name = Planet Map diff --git a/core/src/mindustry/input/Binding.java b/core/src/mindustry/input/Binding.java index d5c52930d3..35318003d6 100644 --- a/core/src/mindustry/input/Binding.java +++ b/core/src/mindustry/input/Binding.java @@ -85,6 +85,7 @@ public enum Binding implements KeyBind{ menu(Vars.android ? KeyCode.back : KeyCode.escape), fullscreen(KeyCode.f11), pause(KeyCode.space), + skip_wave(KeyCode.unset), minimap(KeyCode.m), research(KeyCode.j), planet_map(KeyCode.n), diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index 3742774645..c299caeb81 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -758,11 +758,7 @@ public class UnitType extends UnlockableContent implements Senseable{ } } - @CallSuper - @Override - public void init(){ - super.init(); - + protected void checkEntityMapping(){ if(constructor == null) throw new IllegalArgumentException(Strings.format(""" No constructor set up for unit '@': Assign `constructor = [your unit constructor]`. Vanilla defaults are: "flying": UnitEntity::create @@ -777,7 +773,7 @@ public class UnitType extends UnlockableContent implements Senseable{ "crawl": CrawlUnit::create """, name)); - // Often modders improperly only sets `constructor = ...` without mapping. Try to mitigate for that. + // Often modders improperly only sets `constructor = ...` without mapping. Try to mitigate that. // In most cases, if the constructor is a Vanilla class, things should work just fine. if(EntityMapping.map(name) == null) EntityMapping.nameMap.put(name, constructor); @@ -787,17 +783,25 @@ public class UnitType extends UnlockableContent implements Senseable{ int classId = example.classId(); if( // Check if `classId()` even points to a valid constructor... - EntityMapping.map(classId) == null || - // ...or if the class doesn't register itself and uses the ID of its base class. - classId != ((Entityc)EntityMapping.map(classId).get()).classId() + EntityMapping.map(classId) == null || + // ...or if the class doesn't register itself and uses the ID of its base class. + classId != ((Entityc)EntityMapping.map(classId).get()).classId() ){ String type = example.getClass().getSimpleName(); throw new IllegalArgumentException(Strings.format(""" - Invalid class ID for `@` detected (found: @). Fix it by: + Invalid class ID for `@` detected (found: @). Potential fixes: - Register with `EntityMapping.register("some-unique-name", @::new)` to get an ID, and store it somewhere. - Override `@#classId()` to return that ID. """, type, classId, type, type)); } + } + + @CallSuper + @Override + public void init(){ + super.init(); + + checkEntityMapping(); allowLegStep = example instanceof Legsc || example instanceof Crawlc; diff --git a/core/src/mindustry/ui/fragments/HudFragment.java b/core/src/mindustry/ui/fragments/HudFragment.java index 397814ae4a..b0f638ede9 100644 --- a/core/src/mindustry/ui/fragments/HudFragment.java +++ b/core/src/mindustry/ui/fragments/HudFragment.java @@ -30,8 +30,6 @@ import mindustry.type.*; import mindustry.ui.*; import mindustry.world.*; import mindustry.world.blocks.environment.*; -import mindustry.world.blocks.storage.*; -import mindustry.world.blocks.storage.CoreBlock.*; import mindustry.world.meta.*; import static mindustry.Vars.*; @@ -286,6 +284,14 @@ public class HudFragment{ }); toggleMenus(); } + + if(Core.input.keyTap(Binding.skip_wave) && canSkipWave()){ + if(net.client() && player.admin){ + Call.adminRequest(player, AdminAction.wave, null); + }else{ + logic.skipWave(); + } + } }); Table wavesMain, editorMain;