Overall difficulty decrease / Crash fix / Server fillitems command

This commit is contained in:
Anuken
2018-08-08 15:02:51 -04:00
parent 91552a3a2b
commit f8def04653
4 changed files with 38 additions and 21 deletions

View File

@@ -1,7 +1,6 @@
package io.anuke.mindustry.ai;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Bits;
import io.anuke.mindustry.entities.units.BaseUnit;
import io.anuke.mindustry.entities.units.Squad;
import io.anuke.mindustry.game.EventType.WorldLoadEvent;
@@ -10,6 +9,7 @@ import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.game.Waves;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Events;
import io.anuke.ucore.util.GridBits;
import io.anuke.ucore.util.Mathf;
import java.io.DataInput;
@@ -21,7 +21,7 @@ import static io.anuke.mindustry.Vars.*;
public class WaveSpawner{
private static final int quadsize = 4;
private Bits quadrants;
private GridBits quadrants;
private Array<SpawnGroup> groups;
@@ -166,7 +166,7 @@ public class WaveSpawner{
private void reset(){
flySpawns.clear();
groundSpawns.clear();
quadrants = new Bits(quadWidth() * quadHeight());
quadrants = new GridBits(quadWidth(), quadHeight());
if(world.getSector() == null){
groups = Waves.getSpawns();
@@ -176,15 +176,13 @@ public class WaveSpawner{
}
private boolean getQuad(int quadx, int quady){
return quadrants.get(quadx + quady * quadWidth());
return quadrants.get(quadx, quady);
}
private void setQuad(int quadx, int quady, boolean valid){
if(valid){
quadrants.set(quadx + quady * quadWidth());
}else{
quadrants.clear(quadx + quady * quadWidth());
}
if(quadrants == null) quadrants = new GridBits(quadWidth(), quadHeight());
quadrants.set(quadx, quady, valid);
}
//TODO instead of randomly scattering locations around the map, find spawns close to each other

View File

@@ -41,7 +41,8 @@ public class SectorsDialog extends FloatingDialog{
+ (selected.saveID == -1 ? " " + Bundles.get("text.sector.unexplored") :
(selected.hasSave() ? " [accent]/[white] " + Bundles.format("text.sector.time", selected.getSave().getPlayTime()) : ""))));
content().row();
content().label(() -> Bundles.format("text.mission", selected == null || selected.completedMissions >= selected.missions.size ? Bundles.get("text.none") : selected.missions.get(selected.completedMissions).displayString())
content().label(() -> Bundles.format("text.mission", selected == null || selected.completedMissions >= selected.missions.size
? Bundles.get("text.none") : selected.missions.get(selected.completedMissions).displayString())
+ " [WHITE]" + (selected == null ? "" : Bundles.format("text.save.difficulty", "[LIGHT_GRAY]" + selected.getDifficulty().toString())));
content().row();
content().add(new SectorView()).grow();

View File

@@ -38,8 +38,8 @@ import java.io.DataOutputStream;
import java.io.IOException;
public class UnitPad extends Block{
protected float gracePeriodMultiplier = 19f;
protected float speedupTime = 60f * 60f * 19;
protected float gracePeriodMultiplier = 22f;
protected float speedupTime = 60f * 60f * 20;
protected float maxSpeedup = 7f;
protected UnitType type;

View File

@@ -16,6 +16,8 @@ import io.anuke.mindustry.game.Version;
import io.anuke.mindustry.net.*;
import io.anuke.mindustry.net.Administration.PlayerInfo;
import io.anuke.mindustry.net.Packets.KickReason;
import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.ItemType;
import io.anuke.mindustry.ui.fragments.DebugFragment;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.*;
@@ -261,6 +263,20 @@ public class ServerControl extends Module{
}
});
handler.register("fillitems", "Fill the core with 2000 items.", arg -> {
if(!state.is(State.playing)){
err("Not playing. Host first.");
return;
}
for(Item item : Item.all()){
if(item.type == ItemType.material){
state.teams.get(Team.blue).cores.first().entity.items.add(item, 2000);
}
}
info("Core filled.");
});
handler.register("friendlyfire", "<on/off>", "Enable or disable friendly fire.", arg -> {
String s = arg[0];
if(s.equalsIgnoreCase("on")){
@@ -544,10 +560,12 @@ public class ServerControl extends Module{
return;
}
SaveIO.loadFromSlot(slot);
info("Save loaded.");
host();
state.set(State.playing);
threads.run(() -> {
SaveIO.loadFromSlot(slot);
info("Save loaded.");
host();
state.set(State.playing);
});
});
handler.register("save", "<slot>", "Save game state to a slot.", arg -> {
@@ -559,11 +577,11 @@ public class ServerControl extends Module{
return;
}
int slot = Strings.parseInt(arg[0]);
SaveIO.saveToSlot(slot);
info("Saved to slot {0}.", slot);
threads.run(() -> {
int slot = Strings.parseInt(arg[0]);
SaveIO.saveToSlot(slot);
info("Saved to slot {0}.", slot);
});
});
handler.register("griefers", "[min-break:place-ratio] [min-breakage]", "Find possible griefers currently online.", arg -> {