Block position starting missions
This commit is contained in:
@@ -15,6 +15,7 @@ import io.anuke.mindustry.maps.*;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.maps.generation.WorldGenerator;
|
||||
import io.anuke.mindustry.world.blocks.OreBlock;
|
||||
import io.anuke.ucore.core.Events;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.entities.EntityPhysics;
|
||||
@@ -208,10 +209,15 @@ public class World extends Module{
|
||||
public void endMapLoad(){
|
||||
for(int x = 0; x < tiles.length; x++){
|
||||
for(int y = 0; y < tiles[0].length; y++){
|
||||
tiles[x][y].updateOcclusion();
|
||||
Tile tile = tiles[x][y];
|
||||
tile.updateOcclusion();
|
||||
|
||||
if(tiles[x][y].entity != null){
|
||||
tiles[x][y].entity.updateProximity();
|
||||
if(tile.floor() instanceof OreBlock && tile.hasCliffs()){
|
||||
tile.setFloor(((OreBlock) tile.floor()).base);
|
||||
}
|
||||
|
||||
if(tile.entity != null){
|
||||
tile.entity.updateProximity();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,10 @@ public class OverlayRenderer{
|
||||
for(Player player : players){
|
||||
InputHandler input = control.input(player.playerIndex);
|
||||
|
||||
if(world.getSector() != null){
|
||||
world.getSector().currentMission().drawOverlay();
|
||||
}
|
||||
|
||||
if(!input.isDrawing() || player.isDead()) continue;
|
||||
|
||||
Shaders.outline.color.set(Palette.accent);
|
||||
|
||||
@@ -13,23 +13,36 @@ import static io.anuke.mindustry.Vars.*;
|
||||
public class TutorialSector{
|
||||
|
||||
public static Array<Mission> getMissions(){
|
||||
int x = sectorSize/2, y = sectorSize/2;
|
||||
|
||||
return Array.with(
|
||||
new ItemMission(Items.copper, 30).setMessage("$tutorial.begin"),
|
||||
new BlockMission(ProductionBlocks.mechanicalDrill).setMessage("$tutorial.drill"),
|
||||
new BlockMission(DistributionBlocks.conveyor).setMessage("$tutorial.conveyor"),
|
||||
|
||||
new BlockLocMission(ProductionBlocks.mechanicalDrill, 55, 62).setMessage("$tutorial.drill"),
|
||||
|
||||
new BlockLocMission(DistributionBlocks.conveyor, 57, 62, 0).setShowComplete(false).setMessage("$tutorial.conveyor"),
|
||||
new BlockLocMission(DistributionBlocks.conveyor, 58, 62, 0).setShowComplete(false),
|
||||
new BlockLocMission(DistributionBlocks.conveyor, 59, 62, 0).setShowComplete(false),
|
||||
new BlockLocMission(DistributionBlocks.conveyor, 60, 62, 3).setShowComplete(false),
|
||||
|
||||
new ItemMission(Items.copper, 50).setMessage("$tutorial.morecopper"),
|
||||
new BlockMission(TurretBlocks.duo).setMessage("$tutorial.turret"),
|
||||
new BlockMission(ProductionBlocks.mechanicalDrill).setMessage("$tutorial.drillturret"),
|
||||
|
||||
new BlockLocMission(TurretBlocks.duo, 56, 59).setMessage("$tutorial.turret"),
|
||||
new BlockLocMission(ProductionBlocks.mechanicalDrill, 55, 60).setMessage("$tutorial.drillturret"),
|
||||
|
||||
new WaveMission(5).setMessage("$tutorial.waves"),
|
||||
new ExpandMission(1, 0),
|
||||
new ItemMission(Items.lead, 30).setMessage("$tutorial.lead"),
|
||||
new ItemMission(Items.copper, 150).setMessage("$tutorial.morecopper"),
|
||||
|
||||
new BlockMission(CraftingBlocks.smelter).setMessage("$tutorial.smelter"),
|
||||
new ItemMission(Items.densealloy, 30).setMessage("$tutorial.densealloy"),
|
||||
new BlockMission(CraftingBlocks.siliconsmelter).setMessage("$tutorial.siliconsmelter"),
|
||||
new BlockMission(PowerBlocks.combustionGenerator).setMessage("$tutorial.generator"),
|
||||
new BlockMission(PowerBlocks.powerNode).setMessage("$tutorial.node"),
|
||||
|
||||
new ItemMission(Items.silicon, 30).setMessage("$tutorial.silicon"),
|
||||
|
||||
new BlockMission(UnitBlocks.daggerFactory).setMessage("$tutorial.daggerfactory"),
|
||||
new UnitMission(UnitTypes.dagger).setMessage("$tutorial.dagger"),
|
||||
new ExpandMission(-1, 0),
|
||||
@@ -56,11 +69,15 @@ public class TutorialSector{
|
||||
private static void generateBase(){
|
||||
int x = sectorSize/2, y = sectorSize/2;
|
||||
world.setBlock(world.tile(x, y), StorageBlocks.core, waveTeam);
|
||||
world.setBlock(world.tile(x + 1, y + 2), TurretBlocks.duo, waveTeam);
|
||||
world.setBlock(world.tile(x + 1, y - 2), TurretBlocks.duo, waveTeam);
|
||||
// world.setBlock(world.tile(x + 1, y + 2), TurretBlocks.duo, waveTeam);
|
||||
//world.setBlock(world.tile(x + 1, y - 2), TurretBlocks.duo, waveTeam);
|
||||
world.setBlock(world.tile(x - 1, y + 2), UnitBlocks.daggerFactory, waveTeam);
|
||||
world.setBlock(world.tile(x - 1, y - 3), UnitBlocks.daggerFactory, waveTeam);
|
||||
|
||||
//fill turret ammo
|
||||
//world.tile(x + 1, y + 2).block().handleStack(Items.copper, 1, world.tile(x + 1, y + 2), null);
|
||||
//world.tile(x + 1, y - 2).block().handleStack(Items.copper, 1, world.tile(x + 1, y - 2), null);
|
||||
|
||||
//since placed() is not called here, add core manually
|
||||
state.teams.get(waveTeam).cores.add(world.tile(x, y));
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ public class WorldGenerator{
|
||||
}
|
||||
|
||||
if(ores != null && ((Floor) floor).hasOres){
|
||||
int offsetX = x + 1, offsetY = y + 15;
|
||||
int offsetX = x - 4, offsetY = y + 23;
|
||||
for(int i = ores.size - 1; i >= 0; i--){
|
||||
Item entry = ores.get(i);
|
||||
if(
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
package io.anuke.mindustry.maps.missions;
|
||||
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Lines;
|
||||
import io.anuke.ucore.util.Angles;
|
||||
import io.anuke.ucore.util.Bundles;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
import static io.anuke.mindustry.Vars.players;
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
|
||||
public class BlockLocMission extends Mission{
|
||||
@@ -23,6 +31,35 @@ public class BlockLocMission extends Mission{
|
||||
this.rotation = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawOverlay(){
|
||||
Lines.stroke(2f);
|
||||
|
||||
Draw.color(Palette.accent.r * 0.8f,Palette.accent.g * 0.8f,Palette.accent.b * 0.8f);
|
||||
Lines.square(x * tilesize + block.offset(), y * tilesize + block.offset() - 1f, block.size * tilesize/2f + 1f+ Mathf.absin(Timers.time(), 6f, 2f));
|
||||
|
||||
Draw.color(Palette.accent);
|
||||
Lines.square(x * tilesize + block.offset(), y * tilesize + block.offset(), block.size * tilesize/2f + 1f+ Mathf.absin(Timers.time(), 6f, 2f));
|
||||
|
||||
|
||||
if(block.rotate){
|
||||
Draw.colorl(0.4f);
|
||||
Draw.rect("icon-arrow", x * tilesize + block.offset(), y * tilesize + block.offset() - 1f, rotation*90);
|
||||
Draw.colorl(0.6f);
|
||||
Draw.rect("icon-arrow", x * tilesize + block.offset(), y * tilesize + block.offset(), rotation*90);
|
||||
}
|
||||
|
||||
float rot = players[0].angleTo(x * tilesize + block.offset(), y * tilesize + block.offset());
|
||||
float len = 12f;
|
||||
|
||||
Draw.color(Palette.accent.r * 0.8f,Palette.accent.g * 0.8f,Palette.accent.b * 0.8f);
|
||||
Draw.rect("icon-arrow", players[0].x + Angles.trnsx(rot, len), players[0].y + Angles.trnsy(rot, len), rot);
|
||||
Draw.color(Palette.accent);
|
||||
Draw.rect("icon-arrow", players[0].x + Angles.trnsx(rot, len), players[0].y + Angles.trnsy(rot, len) + 1f, rot);
|
||||
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isComplete(){
|
||||
return world.tile(x, y).block() == block && (!block.rotate || world.tile(x,y).getRotation() == rotation);
|
||||
|
||||
@@ -8,6 +8,7 @@ import io.anuke.mindustry.game.SpawnGroup;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.maps.Sector;
|
||||
import io.anuke.mindustry.maps.generation.Generation;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
import io.anuke.ucore.util.Bundles;
|
||||
|
||||
@@ -16,6 +17,7 @@ import static io.anuke.mindustry.Vars.ui;
|
||||
|
||||
public abstract class Mission{
|
||||
private String extraMessage;
|
||||
private boolean showComplete =true;
|
||||
|
||||
public abstract boolean isComplete();
|
||||
|
||||
@@ -37,6 +39,16 @@ public abstract class Mission{
|
||||
return this;
|
||||
}
|
||||
|
||||
public Mission setShowComplete(boolean complete){
|
||||
this.showComplete = complete;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**Draw mission overlay.*/
|
||||
public void drawOverlay(){
|
||||
|
||||
}
|
||||
|
||||
/**Shows the unique sector message.*/
|
||||
public void showMessage(){
|
||||
if(!headless && extraMessage != null){
|
||||
@@ -49,11 +61,11 @@ public abstract class Mission{
|
||||
}
|
||||
|
||||
public void onBegin(){
|
||||
showMessage();
|
||||
Timers.runTask(60f, this::showMessage);
|
||||
}
|
||||
|
||||
public void onComplete(){
|
||||
if(!headless){
|
||||
if(showComplete && !headless){
|
||||
ui.hudfrag.showText("[LIGHT_GRAY]"+menuDisplayString() + ":\n" + Bundles.get("text.mission.complete"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user