More tutorial

This commit is contained in:
Anuken
2019-08-08 17:26:20 -04:00
parent 4811578c95
commit b587b6bb4d
4 changed files with 49 additions and 18 deletions

View File

@@ -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.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 = 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.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 = [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.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.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.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 your core for 2 waves. Build more turrets. 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.lead = More ores are available. Explore and mine[accent] lead[].\n\nDrag from your unit to the core to transfer resources. 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.
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.
item.copper.description = The most basic structural material. Used extensively in all types of blocks. 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. item.lead.description = A basic starter material. Used extensively in electronics and liquid transportation blocks.

View File

@@ -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 static class GameOverEvent{
public final Team winner; public final Team winner;

View File

@@ -32,14 +32,19 @@ public class Tutorial{
}); });
Events.on(LineConfirmEvent.class, event -> events.add("lineconfirm")); 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(){ public void update(){
if(stage.done.get()){ if(stage.done.get()){
next(); next();
}else{
stage.update();
} }
} }
/** draw UI overlay */
public void draw(){ public void draw(){
stage.draw(); stage.draw();
} }
@@ -82,6 +87,23 @@ public class Tutorial{
outline("category-turrets"); outline("category-turrets");
outline("block-duo"); 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(); 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; this.done = done;
} }
/** displayed tutorial stage text.*/
public String text(){ public String text(){
return text.get(line); 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(){ void draw(){
} }

View File

@@ -1,11 +1,12 @@
package io.anuke.mindustry.world.blocks.defense.turrets; package io.anuke.mindustry.world.blocks.defense.turrets;
import io.anuke.arc.*;
import io.anuke.arc.collection.*; import io.anuke.arc.collection.*;
import io.anuke.arc.scene.ui.layout.*; import io.anuke.arc.scene.ui.layout.*;
import io.anuke.mindustry.*; import io.anuke.mindustry.*;
import io.anuke.mindustry.entities.bullet.*; import io.anuke.mindustry.entities.bullet.*;
import io.anuke.mindustry.entities.type.Unit;
import io.anuke.mindustry.entities.type.*; import io.anuke.mindustry.entities.type.*;
import io.anuke.mindustry.game.EventType.*;
import io.anuke.mindustry.graphics.*; import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.type.*; import io.anuke.mindustry.type.*;
import io.anuke.mindustry.ui.*; import io.anuke.mindustry.ui.*;
@@ -127,6 +128,11 @@ public class ItemTurret extends CooledTurret{
//must not be found //must not be found
entity.ammo.add(new ItemEntry(item, (int)type.ammoMultiplier)); entity.ammo.add(new ItemEntry(item, (int)type.ammoMultiplier));
//fire events for the tutorial
if(state.rules.tutorial){
Events.fire(new AmmoDeliverEvent());
}
} }
@Override @Override