Fixed many various map bugs
This commit is contained in:
@@ -5,8 +5,7 @@ import io.anuke.arc.collection.IntArray;
|
||||
import io.anuke.arc.collection.IntQueue;
|
||||
import io.anuke.arc.math.geom.Geometry;
|
||||
import io.anuke.arc.math.geom.Point2;
|
||||
import io.anuke.arc.util.Structs;
|
||||
import io.anuke.arc.util.Time;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.mindustry.game.EventType.TileChangeEvent;
|
||||
import io.anuke.mindustry.game.EventType.WorldLoadEvent;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
|
||||
@@ -4,8 +4,7 @@ import io.anuke.arc.Events;
|
||||
import io.anuke.arc.collection.Array;
|
||||
import io.anuke.arc.math.Angles;
|
||||
import io.anuke.arc.math.Mathf;
|
||||
import io.anuke.arc.util.Time;
|
||||
import io.anuke.arc.util.Tmp;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.mindustry.content.Blocks;
|
||||
import io.anuke.mindustry.content.Fx;
|
||||
import io.anuke.mindustry.entities.Damage;
|
||||
|
||||
@@ -114,6 +114,9 @@ public class Blocks implements ContentList{
|
||||
}
|
||||
|
||||
spawn = new OverlayFloor("spawn"){
|
||||
{
|
||||
variants = 0;
|
||||
}
|
||||
public void draw(Tile tile){}
|
||||
};
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ public class EditorTile extends Tile{
|
||||
}
|
||||
|
||||
if(overlayID() == overlay) return;
|
||||
op(OpType.overlay, overlay);
|
||||
op(OpType.overlay, this.overlay);
|
||||
super.setOverlayID(overlay);
|
||||
}
|
||||
|
||||
|
||||
@@ -145,8 +145,8 @@ public class MapRenderer implements Disposable{
|
||||
}
|
||||
|
||||
mesh.draw(idxDecal, region,
|
||||
wx * tilesize + offsetX, wy * tilesize + offsetY,
|
||||
region.getWidth() * Draw.scl, region.getHeight() * Draw.scl);
|
||||
wx * tilesize + offsetX, wy * tilesize + offsetY,
|
||||
region.getWidth() * Draw.scl, region.getHeight() * Draw.scl);
|
||||
mesh.setColor(Color.WHITE);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ public class Teams{
|
||||
/** Returns whether a team is active, e.g. whether it has any cores remaining. */
|
||||
public boolean isActive(Team team){
|
||||
//the enemy wave team is always active
|
||||
return (Vars.state.rules.waves && team == Vars.waveTeam) || get(team).cores.size > 0;
|
||||
return team == Vars.waveTeam || get(team).cores.size > 0;
|
||||
}
|
||||
|
||||
/** Returns a set of all teams that are enemies of this team. */
|
||||
|
||||
@@ -71,6 +71,7 @@ public abstract class SaveVersion extends SaveFileReader{
|
||||
state.wavetime = map.getFloat("wavetime", state.rules.waveSpacing);
|
||||
state.stats = JsonIO.read(Stats.class, map.get("stats", "{}"));
|
||||
state.rules = JsonIO.read(Rules.class, map.get("rules", "{}"));
|
||||
if(state.rules.spawns.isEmpty()) state.rules.spawns = DefaultWaves.get();
|
||||
Map worldmap = world.maps.byName(map.get("mapname", "\\\\\\"));
|
||||
world.setMap(worldmap == null ? new Map(StringMap.of(
|
||||
"name", map.get("mapname", "Unknown"),
|
||||
|
||||
@@ -5,6 +5,7 @@ import io.anuke.arc.collection.StringMap;
|
||||
import io.anuke.arc.files.FileHandle;
|
||||
import io.anuke.arc.graphics.Texture;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.game.DefaultWaves;
|
||||
import io.anuke.mindustry.game.Rules;
|
||||
import io.anuke.mindustry.io.JsonIO;
|
||||
|
||||
@@ -57,7 +58,9 @@ public class Map implements Comparable<Map>{
|
||||
|
||||
/** This creates a new instance.*/
|
||||
public Rules rules(){
|
||||
return JsonIO.read(Rules.class, tags.get("rules", "{}"));
|
||||
Rules result = JsonIO.read(Rules.class, tags.get("rules", "{}"));
|
||||
if(result.spawns.isEmpty()) result.spawns = DefaultWaves.get();
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Whether this map has a core of the enemy 'wave' team. Default: true.
|
||||
|
||||
@@ -6,6 +6,8 @@ import io.anuke.mindustry.type.ItemStack;
|
||||
|
||||
/** An item image with text. */
|
||||
public class ItemDisplay extends Table{
|
||||
public final Item item;
|
||||
public final int amount;
|
||||
|
||||
public ItemDisplay(Item item){
|
||||
this(item, 0);
|
||||
@@ -14,5 +16,8 @@ public class ItemDisplay extends Table{
|
||||
public ItemDisplay(Item item, int amount){
|
||||
add(new ItemImage(new ItemStack(item, amount))).size(8 * 4);
|
||||
add(item.localizedName()).padLeft(4);
|
||||
|
||||
this.item = item;
|
||||
this.amount = amount;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,15 @@ import io.anuke.mindustry.world.meta.StatUnit;
|
||||
|
||||
/** An ItemDisplay, but for liquids. */
|
||||
public class LiquidDisplay extends Table{
|
||||
public final Liquid liquid;
|
||||
public final float amount;
|
||||
public final boolean perSecond;
|
||||
|
||||
public LiquidDisplay(Liquid liquid, float amount, boolean perSecond){
|
||||
this.liquid = liquid;
|
||||
this.amount = amount;
|
||||
this.perSecond = perSecond;
|
||||
|
||||
add(new Stack(){{
|
||||
add(new Image(liquid.getContentIcon()));
|
||||
|
||||
|
||||
@@ -12,7 +12,8 @@ import io.anuke.mindustry.ui.BorderImage;
|
||||
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
|
||||
public class CustomGameDialog extends FloatingDialog{
|
||||
public class
|
||||
CustomGameDialog extends FloatingDialog{
|
||||
private MapPlayDialog dialog = new MapPlayDialog();
|
||||
|
||||
public CustomGameDialog(){
|
||||
|
||||
@@ -16,7 +16,7 @@ public class MapPlayDialog extends FloatingDialog{
|
||||
Difficulty difficulty = Difficulty.normal;
|
||||
CustomRulesDialog dialog = new CustomRulesDialog();
|
||||
Rules rules;
|
||||
Gamemode selectedGamemode;
|
||||
Gamemode selectedGamemode = Gamemode.survival;
|
||||
|
||||
public MapPlayDialog(){
|
||||
super("");
|
||||
@@ -28,6 +28,8 @@ public class MapPlayDialog extends FloatingDialog{
|
||||
cont.clearChildren();
|
||||
rules = map.rules();
|
||||
|
||||
rules = selectedGamemode.apply(map.rules());
|
||||
|
||||
Table selmode = new Table();
|
||||
selmode.add("$level.mode").colspan(4);
|
||||
selmode.row();
|
||||
@@ -43,8 +45,8 @@ public class MapPlayDialog extends FloatingDialog{
|
||||
}
|
||||
|
||||
modes.addButton(mode.toString(), "toggle", () -> {
|
||||
selectedGamemode = selectedGamemode == mode ? null : mode;
|
||||
rules = selectedGamemode == null ? map.rules() : mode.apply(map.rules());
|
||||
selectedGamemode = mode;
|
||||
rules = mode.apply(map.rules());
|
||||
}).update(b -> b.setChecked(selectedGamemode == mode)).size(140f, 54f);
|
||||
if(i++ % 2 == 1) modes.row();
|
||||
}
|
||||
|
||||
@@ -178,7 +178,6 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
graphics.sliderPref("fpscap", 125, 5, 125, 5, s -> (s > 120 ? Core.bundle.get("setting.fpscap.none") : Core.bundle.format("setting.fpscap.text", s)));
|
||||
graphics.sliderPref("chatopacity", 100, 0, 100, 5, s -> s + "%");
|
||||
|
||||
|
||||
if(!mobile){
|
||||
graphics.checkPref("vsync", true, b -> Core.graphics.setVSync(b));
|
||||
graphics.checkPref("fullscreen", false, b -> {
|
||||
@@ -221,6 +220,22 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
graphics.checkPref("animatedshields", !mobile);
|
||||
graphics.checkPref("lasers", true);
|
||||
graphics.checkPref("pixelate", false);
|
||||
|
||||
//TODO is this necessary?
|
||||
/*
|
||||
graphics.checkPref("linear", false, b -> {
|
||||
for(Texture tex : Core.atlas.getTextures()){
|
||||
TextureFilter filter = b ? TextureFilter.Linear : TextureFilter.Nearest;
|
||||
tex.setFilter(filter, filter);
|
||||
}
|
||||
});
|
||||
|
||||
if(Core.settings.getBool("linear")){
|
||||
for(Texture tex : Core.atlas.getTextures()){
|
||||
TextureFilter filter = TextureFilter.Linear;
|
||||
tex.setFilter(filter, filter);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
private void back(){
|
||||
|
||||
Reference in New Issue
Block a user