From 2a8c4b51d49851cab27ec5bb897125f79da63aa6 Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 13 Apr 2022 15:09:49 -0400 Subject: [PATCH] Objectives --- core/assets/bundles/bundle.properties | 157 ++++++++++++++++++ core/src/mindustry/content/SectorPresets.java | 10 +- core/src/mindustry/game/MapObjectives.java | 76 ++++++++- core/src/mindustry/io/JsonIO.java | 6 + 4 files changed, 239 insertions(+), 10 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 9e03774bcc..7dcad61ea1 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -570,6 +570,7 @@ configure = Configure Loadout objective.research = [accent]Research:\n[]{0}[lightgray]{1} objective.item = [accent]Obtain: [][lightgray]{0}[]/{1}\n{2}[lightgray]{3} +objective.build = [accent]Build: [][lightgray]{0}[]x\n{1}[lightgray]{2} loadout = Loadout resources = Resources @@ -1843,3 +1844,159 @@ lenum.build = Build a structure. lenum.getblock = Fetch a building and type at coordinates.\nUnit must be in range of position.\nSolid non-buildings will have the type [accent]@solid[]. lenum.within = Check if unit is near a position. lenum.boost = Start/stop boosting. + +#TODO: temporary names! +block.empty.name = Empty +block.rhyolite-crater.name = Rhyolite Crater +block.rough-rhyolite.name = Rough Rhyolite +block.regolith.name = Regolith +block.yellow-stone.name = Yellow Stone +block.carbon-stone.name = Carbon Stone +block.ferric-stone.name = Ferric Stone +block.ferric-craters.name = Ferric Craters +block.beryllic-stone.name = Beryllic Stone +block.crystalline-stone.name = Crystalline Stone +block.crystal-floor.name = Crystal Floor +block.yellow-stone-plates.name = Yellow Stone Plates +block.red-stone.name = Red Stone +block.dense-red-stone.name = Dense Red Stone +block.red-ice.name = Red Ice +block.arkycite-floor.name = Arkycite Floor +block.arkyic-stone.name = Arkyic Stone +block.rhyolite-vent.name = Rhyolite Vent +block.carbon-vent.name = Carbon Vent +block.arkyic-vent.name = Arkyic Vent +block.yellow-stone-vent.name = Yellow Stone Vent +block.red-stone-vent.name = Red Stone Vent +block.redmat.name = Redmat +block.bluemat.name = Bluemat +block.core-zone.name = Core Zone +block.regolith-wall.name = Regolith Wall +block.yellow-stone-wall.name = Yellow Stone Wall +block.rhyolite-wall.name = Rhyolite Wall +block.carbon-wall.name = Carbon Wall +block.ferric-stone-wall.name = Ferric Stone Wall +block.beryllic-stone-wall.name = Beryllic Stone Wall +block.arkyic-wall.name = Arkyic Wall +block.crystalline-stone-wall.name = Crystalline Stone Wall +block.red-ice-wall.name = Red Ice Wall +block.red-stone-wall.name = Red Stone Wall +block.red-diamond-wall.name = Red Diamond Wall +block.redweed.name = Redweed +block.pur-bush.name = Pur Bush +block.yellowcoral.name = Yellowcoral +block.carbon-boulder.name = Carbon Boulder +block.ferric-boulder.name = Ferric Boulder +block.beryllic-boulder.name = Beryllic Boulder +block.yellow-stone-boulder.name = Yellow Stone Boulder +block.arkyic-boulder.name = Arkyic Boulder +block.crystal-cluster.name = Crystal Cluster +block.vibrant-crystal-cluster.name = Vibrant Crystal Cluster +block.crystal-blocks.name = Crystal Blocks +block.crystal-orbs.name = Crystal Orbs +block.crystalline-boulder.name = Crystalline Boulder +block.red-ice-boulder.name = Red Ice Boulder +block.rhyolite-boulder.name = Rhyolite Boulder +block.red-stone-boulder.name = Red Stone Boulder +block.graphitic-wall.name = Graphitic Wall +block.silicon-arc-furnace.name = Silicon Arc Furnace +block.electrolyzer.name = Electrolyzer +block.atmospheric-concentrator.name = Atmospheric Concentrator +block.oxidation-chamber.name = Oxidation Chamber +block.electric-heater.name = Electric Heater +block.phase-heater.name = Phase Heater +block.heat-redirector.name = Heat Redirector +block.slag-incinerator.name = Slag Incinerator +block.carbide-crucible.name = Carbide Crucible +block.slag-centrifuge.name = Slag Centrifuge +block.surge-crucible.name = Surge Crucible +block.cyanogen-synthesizer.name = Cyanogen Synthesizer +block.phase-synthesizer.name = Phase Synthesizer +block.heat-reactor.name = Heat Reactor +block.beryllium-wall.name = Beryllium Wall +block.beryllium-wall-large.name = Beryllium Wall Large +block.tungsten-wall.name = Tungsten Wall +block.tungsten-wall-large.name = Tungsten Wall Large +block.blast-door.name = Blast Door +block.carbide-wall.name = Carbide Wall +block.carbide-wall-large.name = Carbide Wall Large +block.radar.name = Radar +block.build-tower.name = Build Tower +block.regen-projector.name = Regen Projector +block.shield-projector.name = Shield Projector +block.large-shield-projector.name = Large Shield Projector +block.armored-duct.name = Armored Duct +block.overflow-duct.name = Overflow Duct +block.duct-unloader.name = Duct Unloader +block.surge-conveyor.name = Surge Conveyor +block.surge-router.name = Surge Router +block.unit-cargo-loader.name = Unit Cargo Loader +block.unit-cargo-unload-point.name = Unit Cargo Unload Point +block.reinforced-pump.name = Reinforced Pump +block.reinforced-conduit.name = Reinforced Conduit +block.reinforced-liquid-junction.name = Reinforced Liquid Junction +block.reinforced-bridge-conduit.name = Reinforced Bridge Conduit +block.reinforced-liquid-router.name = Reinforced Liquid Router +block.reinforced-liquid-container.name = Reinforced Liquid Container +block.reinforced-liquid-tank.name = Reinforced Liquid Tank +block.beam-node.name = Beam Node +block.beam-tower.name = Beam Tower +block.beam-link.name = Beam Link +block.turbine-condenser.name = Turbine Condenser +block.chemical-combustion-chamber.name = Chemical Combustion Chamber +block.pyrolysis-generator.name = Pyrolysis Generator +block.vent-condenser.name = Vent Condenser +block.cliff-crusher.name = Cliff Crusher +block.plasma-bore.name = Plasma Bore +block.large-plasma-bore.name = Large Plasma Bore +block.impact-drill.name = Impact Drill +block.eruption-drill.name = Eruption Drill +block.core-bastion.name = Core Bastion +block.core-citadel.name = Core Citadel +block.core-acropolis.name = Core Acropolis +block.reinforced-container.name = Reinforced Container +block.reinforced-vault.name = Reinforced Vault +block.breach.name = Breach +block.sublimate.name = Sublimate +block.titan.name = Titan +block.disperse.name = Disperse +block.fabricator.name = Fabricator +block.tank-reconstructor.name = Tank Reconstructor +block.mech-reconstructor.name = Mech Reconstructor +block.ship-reconstructor.name = Ship Reconstructor +block.tank-assembler.name = Tank Assembler +block.ship-assembler.name = Ship Assembler +block.mech-assembler.name = Mech Assembler +block.reinforced-payload-conveyor.name = Reinforced Payload Conveyor +block.reinforced-payload-router.name = Reinforced Payload Router +block.payload-mass-driver.name = Payload Mass Driver +block.small-deconstructor.name = Small Deconstructor +block.canvas.name = Canvas +block.world-processor.name = World Processor +block.world-cell.name = World Cell +status.slow.name = Slow +status.shielded.name = Shielded +status.corroded.name = Corroded +status.disarmed.name = Disarmed +unit.stell.name = Stell +unit.locus.name = Locus +unit.vanquish.name = Vanquish +unit.conquer.name = Conquer +unit.latum.name = Latum +unit.bulwark.name = Bulwark +unit.krepost.name = Krepost +unit.avert.name = Avert +unit.quell.name = Quell +unit.quell-missile.name = Quell Missile +unit.disrupt.name = Disrupt +unit.disrupt-missile.name = Disrupt Missile +unit.evoke.name = Evoke +unit.incite.name = Incite +unit.emanate.name = Emanate +unit.manifold.name = Manifold +unit.assembly-drone.name = Assembly Drone +unit.effect-drone.name = Effect Drone +sector.two.name = Two +sector.three.name = Three +sector.four.name = Four +sector.five.name = Five \ No newline at end of file diff --git a/core/src/mindustry/content/SectorPresets.java b/core/src/mindustry/content/SectorPresets.java index 3e0a9d8737..55e1a6ea9f 100644 --- a/core/src/mindustry/content/SectorPresets.java +++ b/core/src/mindustry/content/SectorPresets.java @@ -115,9 +115,13 @@ public class SectorPresets{ difficulty = 1; rules = r -> { - r.objectives.addAll(new ItemObjective(Items.beryllium, 20).withMarkers( - new TextMarker("Use the unit to mine [accent]resources[] from walls.", 1984f, 2240f + 16f), - new ShapeMarker(1984f, 2240f) + r.objectives.addAll( + new ItemObjective(Items.beryllium, 10).withMarkers( + new ShapeTextMarker("Use the unit to mine [accent]resources[] from walls.", 1984f, 2240f) + ), + new ResearchObjective(Blocks.turbineCondenser), + new BuildCountObjective(Blocks.turbineCondenser, 1).withMarkers( + new ShapeTextMarker("Place a [accent]turbine condenser[] on the vent.\nThis will generate [accent]power[].", 253f * 8f, 258f * 8f, 8f * 2.6f, 0f, 9f) )); }; }}; diff --git a/core/src/mindustry/game/MapObjectives.java b/core/src/mindustry/game/MapObjectives.java index ced562435c..85e77c1421 100644 --- a/core/src/mindustry/game/MapObjectives.java +++ b/core/src/mindustry/game/MapObjectives.java @@ -15,11 +15,11 @@ import mindustry.world.*; public class MapObjectives{ public static Prov[] allObjectiveTypes = new Prov[]{ - ResearchObjective::new, PlaceCountObjective::new, ItemObjective::new + ResearchObjective::new, BuildCountObjective::new, ItemObjective::new }; public static Prov[] allMarkerTypes = new Prov[]{ - TextMarker::new, ShapeMarker::new + TextMarker::new, ShapeMarker::new, ShapeTextMarker::new }; public static class ResearchObjective extends MapObjective{ @@ -71,21 +71,21 @@ public class MapObjectives{ } } - public static class PlaceCountObjective extends MapObjective{ + public static class BuildCountObjective extends MapObjective{ public Block block = Blocks.conveyor; public int placeCount = 1; - public PlaceCountObjective(Block block, int placeCount){ + public BuildCountObjective(Block block, int placeCount){ this.block = block; this.placeCount = placeCount; } - public PlaceCountObjective(){ + public BuildCountObjective(){ } @Override public String text(){ - return Core.bundle.format("objective.place", placeCount, block.emoji(), block.localizedName); + return Core.bundle.format("objective.build", placeCount, block.emoji(), block.localizedName); } @Override @@ -131,6 +131,61 @@ public class MapObjectives{ } } + public static class ShapeTextMarker extends ObjectiveMarker{ + public String text = "sample text"; + public float x, y, fontSize = 1f, textHeight = 7f; + public byte flags = WorldLabel.flagBackground | WorldLabel.flagOutline; + + public float radius = 6f, rotation = 0f; + public int sides = 4; + public Color color = Pal.accent; + + public ShapeTextMarker(String text, float x, float y){ + this.text = text; + this.x = x; + this.y = y; + } + + public ShapeTextMarker(String text, float x, float y, float radius){ + this.text = text; + this.x = x; + this.y = y; + this.radius = radius; + } + + public ShapeTextMarker(String text, float x, float y, float radius, float rotation){ + this.text = text; + this.x = x; + this.y = y; + this.radius = radius; + this.rotation = rotation; + } + + public ShapeTextMarker(String text, float x, float y, float radius, float rotation, float textHeight){ + this.text = text; + this.x = x; + this.y = y; + this.radius = radius; + this.rotation = rotation; + this.textHeight = textHeight; + } + + public ShapeTextMarker(){ + + } + + @Override + public void draw(){ + Lines.stroke(3f, Pal.gray); + Lines.poly(x, y, sides, radius + 1f, rotation); + Lines.stroke(1f, color); + Lines.poly(x, y, sides, radius + 1f, rotation); + Draw.reset(); + + WorldLabel.drawAt(text, x, y + radius + textHeight, Draw.z(), flags, fontSize); + } + } + public static class ShapeMarker extends ObjectiveMarker{ public float x, y, radius = 6f, rotation = 0f; public int sides = 4; @@ -141,6 +196,13 @@ public class MapObjectives{ this.y = y; } + public ShapeMarker(float x, float y, float radius, float rotation){ + this.x = x; + this.y = y; + this.radius = radius; + this.rotation = rotation; + } + public ShapeMarker(){ } @@ -155,7 +217,7 @@ public class MapObjectives{ } public static class TextMarker extends ObjectiveMarker{ - public String text = "sample text"; + public String text = "uwu"; public float x, y, fontSize = 1f; public byte flags = WorldLabel.flagBackground | WorldLabel.flagOutline; diff --git a/core/src/mindustry/io/JsonIO.java b/core/src/mindustry/io/JsonIO.java index a65d7d82ad..2a3bb0c219 100644 --- a/core/src/mindustry/io/JsonIO.java +++ b/core/src/mindustry/io/JsonIO.java @@ -248,6 +248,12 @@ public class JsonIO{ var i = obj.get(); json.addClassTag(Strings.camelize(i.getClass().getSimpleName().replace("Objective", "")), i.getClass()); } + + //use short names for all marker types + for(var obj : MapObjectives.allMarkerTypes){ + var i = obj.get(); + json.addClassTag(Strings.camelize(i.getClass().getSimpleName().replace("Marker", "")), i.getClass()); + } } static class CustomJson extends Json{