Removed launch mechanic remnants
This commit is contained in:
@@ -4,7 +4,6 @@ import arc.*;
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.core.GameState.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.game.*;
|
||||
@@ -178,7 +177,7 @@ public class Logic implements ApplicationListener{
|
||||
public void runWave(){
|
||||
spawner.spawnEnemies();
|
||||
state.wave++;
|
||||
state.wavetime = state.hasSector() && state.getSector().isLaunchWave(state.wave) ? state.rules.waveSpacing * state.rules.launchWaveMultiplier : state.rules.waveSpacing;
|
||||
state.wavetime = state.rules.waveSpacing;
|
||||
|
||||
Events.fire(new WaveEvent());
|
||||
}
|
||||
@@ -251,58 +250,6 @@ public class Logic implements ApplicationListener{
|
||||
}
|
||||
}
|
||||
|
||||
@Remote(called = Loc.both)
|
||||
public static void launchZone(){
|
||||
if(!state.isCampaign()) return;
|
||||
|
||||
if(!headless){
|
||||
ui.hudfrag.showLaunch();
|
||||
}
|
||||
|
||||
//TODO better core launch effect
|
||||
for(Building tile : state.teams.playerCores()){
|
||||
Fx.launch.at(tile);
|
||||
}
|
||||
|
||||
Sector sector = state.rules.sector;
|
||||
|
||||
//TODO containers must be launched too
|
||||
Time.runTask(30f, () -> {
|
||||
Sector origin = sector.save.meta.secinfo.origin;
|
||||
if(origin != null){
|
||||
ItemSeq stacks = origin.getExtraItems();
|
||||
|
||||
//add up all items into list
|
||||
for(Building entity : state.teams.playerCores()){
|
||||
entity.items.each(stacks::add);
|
||||
}
|
||||
|
||||
//save received items
|
||||
origin.setExtraItems(stacks);
|
||||
}
|
||||
|
||||
//remove all the cores
|
||||
state.teams.playerCores().each(b -> b.tile.remove());
|
||||
|
||||
state.launched = true;
|
||||
state.gameOver = true;
|
||||
|
||||
//save over the data w/o the cores
|
||||
sector.save.save();
|
||||
|
||||
//run a turn, since launching takes up a turn
|
||||
universe.runTurn();
|
||||
|
||||
//TODO apply extra damage to sector
|
||||
//sector.setTurnsPassed(sector.getTurnsPassed() + 3);
|
||||
|
||||
//TODO load the sector that was launched from
|
||||
Events.fire(new LaunchEvent());
|
||||
//manually fire game over event now
|
||||
Events.fire(new GameOverEvent(state.rules.defaultTeam));
|
||||
});
|
||||
}
|
||||
|
||||
@Remote(called = Loc.both)
|
||||
public static void updateGameOver(Team winner){
|
||||
state.gameOver = true;
|
||||
|
||||
@@ -40,7 +40,6 @@ public class EventType{
|
||||
|
||||
public static class WinEvent{}
|
||||
public static class LoseEvent{}
|
||||
public static class LaunchEvent{}
|
||||
public static class ResizeEvent{}
|
||||
public static class MapMakeEvent{}
|
||||
public static class MapPublishEvent{}
|
||||
|
||||
@@ -68,8 +68,6 @@ public class Rules{
|
||||
public float dropZoneRadius = 300f;
|
||||
/** Time between waves in ticks. */
|
||||
public float waveSpacing = 60 * 60 * 2;
|
||||
/** How many times longer a launch wave takes. */
|
||||
public float launchWaveMultiplier = 2f;
|
||||
/** Wave after which the player 'wins'. Used in sectors. Use a value <= 0 to disable. */
|
||||
public int winWave = 0;
|
||||
/** Base unit cap. Can still be increased by blocks. */
|
||||
|
||||
@@ -31,9 +31,6 @@ public class Sector{
|
||||
public float baseCoverage;
|
||||
public boolean generateEnemyBase;
|
||||
|
||||
//TODO implement a dynamic launch period
|
||||
public int launchPeriod = 10;
|
||||
|
||||
public Sector(Planet planet, Ptile tile){
|
||||
this.planet = planet;
|
||||
this.tile = tile;
|
||||
@@ -134,16 +131,6 @@ public class Sector{
|
||||
return res % 2 == 0 ? res : res + 1;
|
||||
}
|
||||
|
||||
//TODO implement
|
||||
public boolean isLaunchWave(int wave){
|
||||
return metCondition() && wave % launchPeriod == 0;
|
||||
}
|
||||
|
||||
public boolean metCondition(){
|
||||
//TODO implement
|
||||
return false;
|
||||
}
|
||||
|
||||
//TODO this should be stored in a more efficient structure, and be updated each turn
|
||||
public ItemSeq getExtraItems(){
|
||||
return Core.settings.getJson(key("extra-items"), ItemSeq.class, ItemSeq::new);
|
||||
|
||||
@@ -4,7 +4,6 @@ import arc.*;
|
||||
import arc.func.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.input.*;
|
||||
import arc.math.*;
|
||||
import arc.scene.*;
|
||||
import arc.scene.actions.*;
|
||||
@@ -26,7 +25,6 @@ import mindustry.input.*;
|
||||
import mindustry.net.Packets.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.ui.dialogs.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
@@ -173,8 +171,6 @@ public class HudFragment extends Fragment{
|
||||
s.button(Icon.play, Styles.righti, 30f, () -> {
|
||||
if(net.client() && player.admin){
|
||||
Call.adminRequest(player, AdminAction.wave);
|
||||
}else if(inLaunchWave()){
|
||||
ui.showConfirm("@confirm", "@launch.skip.confirm", () -> !canSkipWave(), () -> logic.skipWave());
|
||||
}else{
|
||||
logic.skipWave();
|
||||
}
|
||||
@@ -576,40 +572,6 @@ public class HudFragment extends Fragment{
|
||||
Core.scene.add(image);
|
||||
}
|
||||
|
||||
private void showLaunchConfirm(){
|
||||
BaseDialog dialog = new BaseDialog("@launch");
|
||||
dialog.update(() -> {
|
||||
if(!inLaunchWave()){
|
||||
dialog.hide();
|
||||
}
|
||||
});
|
||||
dialog.cont.add("@launch.confirm").width(500f).wrap().pad(4f).get().setAlignment(Align.center, Align.center);
|
||||
dialog.buttons.defaults().size(200f, 54f).pad(2f);
|
||||
dialog.setFillParent(false);
|
||||
dialog.buttons.button("@cancel", dialog::hide);
|
||||
dialog.buttons.button("@ok", () -> {
|
||||
dialog.hide();
|
||||
Call.launchZone();
|
||||
});
|
||||
dialog.keyDown(KeyCode.escape, dialog::hide);
|
||||
dialog.keyDown(KeyCode.back, dialog::hide);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
//TODO launching is disabled, possibly forever
|
||||
private boolean inLaunchWave(){
|
||||
return false;
|
||||
/*
|
||||
return state.hasSector() &&
|
||||
state.getSector().metCondition() &&
|
||||
!net.client() &&
|
||||
state.wave % state.getSector().launchPeriod == 0 && !spawner.isSpawning();*/
|
||||
}
|
||||
|
||||
private boolean canLaunch(){
|
||||
return inLaunchWave() && state.enemies <= 0;
|
||||
}
|
||||
|
||||
private void toggleMenus(){
|
||||
if(flip != null){
|
||||
flip.getStyle().imageUp = shown ? Icon.downOpen : Icon.upOpen;
|
||||
@@ -752,22 +714,6 @@ public class HudFragment extends Fragment{
|
||||
builder.append(wavef.get(state.wave));
|
||||
builder.append("\n");
|
||||
|
||||
if(inLaunchWave()){
|
||||
builder.append("[#");
|
||||
Tmp.c1.set(Color.white).lerp(state.enemies > 0 ? Color.white : Color.scarlet, Mathf.absin(Time.time(), 2f, 1f)).toString(builder);
|
||||
builder.append("]");
|
||||
|
||||
if(!canLaunch()){
|
||||
builder.append(Core.bundle.get("launch.unable2"));
|
||||
}else{
|
||||
builder.append(Core.bundle.get("launch"));
|
||||
builder.append("\n");
|
||||
builder.append(Core.bundle.format("launch.next", state.wave + state.getSector().launchPeriod));
|
||||
builder.append("\n");
|
||||
}
|
||||
builder.append("[]\n");
|
||||
}
|
||||
|
||||
if(state.enemies > 0){
|
||||
if(state.enemies == 1){
|
||||
builder.append(enemyf.get(state.enemies));
|
||||
@@ -786,13 +732,8 @@ public class HudFragment extends Fragment{
|
||||
return builder;
|
||||
}).growX().pad(8f);
|
||||
|
||||
table.setDisabled(() -> !canLaunch());
|
||||
table.setDisabled(true);
|
||||
table.visible(() -> state.rules.waves);
|
||||
table.clicked(() -> {
|
||||
if(canLaunch()){
|
||||
showLaunchConfirm();
|
||||
}
|
||||
});
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user