mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-11 11:17:11 +07:00
Added sector complete event / Patched up server sector completion
This commit is contained in:
parent
f2ac9ed385
commit
54488564f3
@ -4,10 +4,7 @@ import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.game.EventType.GameOverEvent;
|
||||
import io.anuke.mindustry.game.EventType.PlayEvent;
|
||||
import io.anuke.mindustry.game.EventType.ResetEvent;
|
||||
import io.anuke.mindustry.game.EventType.WaveEvent;
|
||||
import io.anuke.mindustry.game.EventType.*;
|
||||
import io.anuke.mindustry.game.GameMode;
|
||||
import io.anuke.mindustry.game.Teams;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
@ -112,6 +109,8 @@ public class Logic extends Module{
|
||||
if(!headless){
|
||||
ui.missions.show(world.getSector());
|
||||
}
|
||||
|
||||
Events.fire(new SectorCompleteEvent());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,10 @@ import io.anuke.ucore.function.Event;
|
||||
|
||||
public class EventType{
|
||||
|
||||
public static class SectorCompleteEvent implements Event{
|
||||
|
||||
}
|
||||
|
||||
public static class GameLoadEvent implements Event{
|
||||
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.game.Difficulty;
|
||||
import io.anuke.mindustry.game.EventType.GameOverEvent;
|
||||
import io.anuke.mindustry.game.EventType.SectorCompleteEvent;
|
||||
import io.anuke.mindustry.game.GameMode;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.game.Version;
|
||||
@ -91,6 +92,20 @@ public class ServerControl extends Module{
|
||||
"&lrWARNING: &lyIt is highly advised to specify which version you're using by building with gradle args &lc-Pbuildversion=&lm<build>&ly so that clients know which version you are using.");
|
||||
}
|
||||
|
||||
Events.on(SectorCompleteEvent.class, event -> {
|
||||
Log.info("Sector complete.");
|
||||
world.sectors.completeSector(world.getSector().x, world.getSector().y);
|
||||
world.sectors.save();
|
||||
gameOvers = 0;
|
||||
inExtraRound = true;
|
||||
Settings.putInt("sector_x", world.getSector().x + world.getSector().width);
|
||||
Settings.save();
|
||||
|
||||
Call.onInfoMessage("[accent]Sector conquered![]\n" + roundExtraTime + " seconds until deployment in next sector.");
|
||||
|
||||
playSectorMap();
|
||||
});
|
||||
|
||||
Events.on(GameOverEvent.class, event -> {
|
||||
if(inExtraRound) return;
|
||||
info("Game over!");
|
||||
@ -891,28 +906,5 @@ public class ServerControl extends Module{
|
||||
if(!inExtraRound && state.mode.isPvp){
|
||||
checkPvPGameOver();
|
||||
}
|
||||
|
||||
//TODO re implement sector shuffle
|
||||
/*
|
||||
if(state.is(State.playing) && world.getSector() != null && !inExtraRound && netServer.admins.getStrict()){
|
||||
//all assigned missions are complete
|
||||
if(world.getSector().completedMissions >= world.getSector().missions.size){
|
||||
Log.info("Mission complete.");
|
||||
world.sectors.completeSector(world.getSector().x, world.getSector().y);
|
||||
world.sectors.save();
|
||||
gameOvers = 0;
|
||||
inExtraRound = true;
|
||||
Settings.putInt("sector_x", world.getSector().x + world.getSector().size);
|
||||
Settings.save();
|
||||
|
||||
Call.onInfoMessage("[accent]Sector conquered![]\n" + roundExtraTime + " seconds until deployment in next sector.");
|
||||
|
||||
playSectorMap();
|
||||
}else if(world.getSector().currentMission().isComplete()){
|
||||
world.getSector().currentMission().onComplete();
|
||||
//increment completed missions, check next index next frame
|
||||
world.getSector().completedMissions ++;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user