diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 2e926f6b58..357d531014 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -864,26 +864,12 @@ unit.reaper.name = Reaper tutorial.intro = Begin by[accent] mining copper[]. Tap a copper ore vein near your core to do this.\n\n[accent]{0}/{1} copper tutorial.drill = Mining manually is inefficient.\n[accent]Drills []can mine automatically.\n\nClick the drill tab in the bottom right, then select the[accent] mechanical drill[]. Place it on a copper vein by clicking. tutorial.drill.mobile = Mining manually is inefficient.\n[accent]Drills []can mine automatically.\n\nTap the drill tab in the bottom right, then select the[accent] mechanical drill[]. Place it on a copper vein by tapping, then press the[accent] checkmark[] below to confirm your selection.\nPress the[accent] X button[] to cancel placement. - tutorial.conveyor = [accent]Conveyors[] are used to transport items to the core.\nMake a line of conveyors from the drill to the core.[yellow] Hold down the mouse to place in a line.[]\nHold[accent] CTRL[] while selecting a line to place diagonally.\n\n[accent]{0}/{1} conveyors tutorial.conveyor.mobile = [accent]Conveyors[] are used to transport items to the core.\nMake a line of conveyors from the drill to the core.[yellow] Place in a line by holding down your finger for a few seconds[] and dragging in a direction.\n\n[accent]{0}/{1} conveyors tutorial.turret = Defensive structures must be built to repel the[lightgray] enemy[].\nBuild a duo turret near your base. -tutorial.drillturret = Duo turrets require[accent] copper ammo []to shoot.\nPlace a drill next to the turret to supply it with mined copper. -tutorial.waves = The[lightgray] enemy[] approaches.\n\nDefend your core for 2 waves. Build more turrets. -tutorial.lead = More ores are available. Explore and mine[accent] lead[].\n\nDrag from your unit to the core to transfer resources. -tutorial.smelter = Copper and lead are weak metals.\nSuperior[accent] Dense Alloy[] can be created in a smelter.\n\nBuild one. -tutorial.densealloy = The smelter will now produce alloy.\nGet some.\nImprove the production if necessary. -tutorial.siliconsmelter = The core will now create a[accent] spirit drone[] for mining and repairing blocks.\n\nFactories for other units can be created with [accent] silicon.\nMake a silicon smelter. -tutorial.silicondrill = Silicon requires[accent] coal[] and[accent] sand[].\nStart by making drills. -tutorial.generator = This technology requires power.\nCreate a[accent] combustion generator[] for it. -tutorial.generatordrill = Combustion generators need fuel.\nFuel it with coal from a drill. -tutorial.node = Power requires transport.\nCreate a[accent] power node[] next to your combustion generator to transfer its power. -tutorial.nodelink = Power can be transferred through contacting power blocks and generators, or by linked power nodes.\n\nLink power by tapping the node and selecting the generator and silicon smelter. -tutorial.silicon = Silicon is being produced. Get some.\n\nImproving the production system is advised. -tutorial.daggerfactory = Construct a[accent] dagger mech factory.[]\n\nThis will be used to create attack mechs. -tutorial.router = Factories need resources to function.\nCreate a router to split conveyor resources. -tutorial.dagger = Link power nodes to the factory.\nOnce requirements are met, a mech will be created.\n\nCreate more drills, generators and conveyors as necessary. -tutorial.battle = The[lightgray] enemy[] has revealed their core.\nDestroy it with your unit and dagger mechs. +tutorial.drillturret = Duo turrets require[accent] copper ammo []to shoot.\nPlace a drill near to the turret. Lead conveyors into the turret to supply it with copper.\n\n[accent]Ammo delivered: 0/1 +tutorial.waves = The[lightgray] enemy[] approaches.\n\nDefend the core for 2 waves.[accent] Click[] to shoot.\nBuild more turrets and drills. Mine more copper. +tutorial.waves.mobile = The[lightgray] enemy[] approaches.\n\nDefend the core for 2 waves. Your ship will automatically fire at enemies.\nBuild more turrets and drills. Mine more copper. item.copper.description = The most basic structural material. Used extensively in all types of blocks. item.lead.description = A basic starter material. Used extensively in electronics and liquid transportation blocks. diff --git a/core/src/io/anuke/mindustry/game/EventType.java b/core/src/io/anuke/mindustry/game/EventType.java index ebafef861c..e3dd86a0e7 100644 --- a/core/src/io/anuke/mindustry/game/EventType.java +++ b/core/src/io/anuke/mindustry/game/EventType.java @@ -53,6 +53,11 @@ public class EventType{ } + /** Called when a turret recieves ammo, but only when the tutorial is active! */ + public static class AmmoDeliverEvent{ + + } + public static class GameOverEvent{ public final Team winner; diff --git a/core/src/io/anuke/mindustry/game/Tutorial.java b/core/src/io/anuke/mindustry/game/Tutorial.java index d287a62a85..c6d48bea1b 100644 --- a/core/src/io/anuke/mindustry/game/Tutorial.java +++ b/core/src/io/anuke/mindustry/game/Tutorial.java @@ -32,14 +32,19 @@ public class Tutorial{ }); Events.on(LineConfirmEvent.class, event -> events.add("lineconfirm")); + Events.on(AmmoDeliverEvent.class, event -> events.add("ammo")); } + /** update tutorial state, transition if needed */ public void update(){ if(stage.done.get()){ next(); + }else{ + stage.update(); } } + /** draw UI overlay */ public void draw(){ stage.draw(); } @@ -82,6 +87,23 @@ public class Tutorial{ outline("category-turrets"); outline("block-duo"); } + }, + drillturret(() -> event("ammo")){ + void draw(){ + outline("category-production"); + outline("block-mechanical-drill"); + } + }, + waves(() -> Vars.state.wave > 2 && Vars.state.enemies() <= 0){ + void begin(){ + Vars.state.rules.waveTimer = true; + } + + void update(){ + if(Vars.state.wave > 2){ + Vars.state.rules.waveTimer = false; + } + } }; protected final String line = Core.bundle.has("tutorial." + name() + ".mobile") && Vars.mobile ? "tutorial." + name() + ".mobile" : "tutorial." + name(); @@ -98,10 +120,22 @@ public class Tutorial{ this.done = done; } + /** displayed tutorial stage text.*/ public String text(){ return text.get(line); } + /** called every frame when this stage is active.*/ + void update(){ + + } + + /** called when a stage begins.*/ + void begin(){ + + } + + /** called when a stage needs to draw itself, usually over highlighted UI elements. */ void draw(){ } 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 4eacb2bbdd..5804c945a7 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 @@ -1,11 +1,12 @@ package io.anuke.mindustry.world.blocks.defense.turrets; +import io.anuke.arc.*; import io.anuke.arc.collection.*; import io.anuke.arc.scene.ui.layout.*; import io.anuke.mindustry.*; import io.anuke.mindustry.entities.bullet.*; -import io.anuke.mindustry.entities.type.Unit; import io.anuke.mindustry.entities.type.*; +import io.anuke.mindustry.game.EventType.*; import io.anuke.mindustry.graphics.*; import io.anuke.mindustry.type.*; import io.anuke.mindustry.ui.*; @@ -127,6 +128,11 @@ public class ItemTurret extends CooledTurret{ //must not be found entity.ammo.add(new ItemEntry(item, (int)type.ammoMultiplier)); + + //fire events for the tutorial + if(state.rules.tutorial){ + Events.fire(new AmmoDeliverEvent()); + } } @Override