bugfixes
This commit is contained in:
@@ -119,7 +119,7 @@ public class BlockIndexer{
|
|||||||
|
|
||||||
ObjectSet<Tile> set = damagedTiles[team.ordinal()];
|
ObjectSet<Tile> set = damagedTiles[team.ordinal()];
|
||||||
for(Tile tile : set){
|
for(Tile tile : set){
|
||||||
if((tile.entity == null || tile.entity.getTeam() != team || !tile.entity.damaged()) && !(tile.block() instanceof BuildBlock)){
|
if((tile.entity == null || tile.entity.getTeam() != team || !tile.entity.damaged()) || tile.block() instanceof BuildBlock){
|
||||||
returnArray.add(tile);
|
returnArray.add(tile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ public class Control implements ApplicationListener{
|
|||||||
});
|
});
|
||||||
|
|
||||||
Events.on(PlayEvent.class, event -> {
|
Events.on(PlayEvent.class, event -> {
|
||||||
player.setTeam(defaultTeam);
|
player.setTeam(state.rules.pvp ? netServer.assignTeam(playerGroup.all()) : defaultTeam);
|
||||||
player.setDead(true);
|
player.setDead(true);
|
||||||
player.add();
|
player.add();
|
||||||
|
|
||||||
@@ -237,7 +237,7 @@ public class Control implements ApplicationListener{
|
|||||||
public void playMap(Map map, Rules rules){
|
public void playMap(Map map, Rules rules){
|
||||||
ui.loadAnd(() -> {
|
ui.loadAnd(() -> {
|
||||||
logic.reset();
|
logic.reset();
|
||||||
world.loadMap(map);
|
world.loadMap(map, rules);
|
||||||
state.rules = rules;
|
state.rules = rules;
|
||||||
logic.play();
|
logic.play();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -220,6 +220,10 @@ public class World implements ApplicationListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void loadMap(Map map){
|
public void loadMap(Map map){
|
||||||
|
loadMap(map, new Rules());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadMap(Map map, Rules checkRules){
|
||||||
try{
|
try{
|
||||||
SaveIO.load(map.file, new FilterContext(map));
|
SaveIO.load(map.file, new FilterContext(map));
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
@@ -238,20 +242,21 @@ public class World implements ApplicationListener{
|
|||||||
invalidMap = false;
|
invalidMap = false;
|
||||||
|
|
||||||
if(!headless){
|
if(!headless){
|
||||||
if(state.teams.get(defaultTeam).cores.size == 0){
|
if(state.teams.get(defaultTeam).cores.size == 0 && !checkRules.pvp){
|
||||||
ui.showError("$map.nospawn");
|
ui.showError("$map.nospawn");
|
||||||
invalidMap = true;
|
invalidMap = true;
|
||||||
}else if(state.rules.pvp){ //pvp maps need two cores to be valid
|
}else if(checkRules.pvp){ //pvp maps need two cores to be valid
|
||||||
invalidMap = true;
|
int teams = 0;
|
||||||
for(Team team : Team.all){
|
for(Team team : Team.all){
|
||||||
if(state.teams.get(team).cores.size != 0 && team != defaultTeam){
|
if(state.teams.get(team).cores.size != 0){
|
||||||
invalidMap = false;
|
teams ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(invalidMap){
|
if(teams < 2){
|
||||||
|
invalidMap = true;
|
||||||
ui.showError("$map.nospawn.pvp");
|
ui.showError("$map.nospawn.pvp");
|
||||||
}
|
}
|
||||||
}else if(state.rules.attackMode){ //pvp maps need two cores to be valid
|
}else if(checkRules.attackMode){ //attack maps need two cores to be valid
|
||||||
invalidMap = state.teams.get(waveTeam).cores.isEmpty();
|
invalidMap = state.teams.get(waveTeam).cores.isEmpty();
|
||||||
if(invalidMap){
|
if(invalidMap){
|
||||||
ui.showError("$map.nospawn.attack");
|
ui.showError("$map.nospawn.attack");
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import io.anuke.mindustry.entities.type.TileEntity;
|
|||||||
import io.anuke.mindustry.entities.units.UnitState;
|
import io.anuke.mindustry.entities.units.UnitState;
|
||||||
import io.anuke.mindustry.world.Pos;
|
import io.anuke.mindustry.world.Pos;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
import io.anuke.mindustry.world.blocks.*;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
@@ -23,6 +24,10 @@ public class RepairDrone extends BaseDrone{
|
|||||||
target = Units.findDamagedTile(team, x, y);
|
target = Units.findDamagedTile(team, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(target instanceof TileEntity && ((TileEntity)target).block instanceof BuildBlock){
|
||||||
|
target = null;
|
||||||
|
}
|
||||||
|
|
||||||
if(target != null){
|
if(target != null){
|
||||||
if(target.dst(RepairDrone.this) > type.range){
|
if(target.dst(RepairDrone.this) > type.range){
|
||||||
circle(type.range * 0.9f);
|
circle(type.range * 0.9f);
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
|
|
||||||
info("Selected next map to be {0}.", map.name());
|
info("Selected next map to be {0}.", map.name());
|
||||||
|
|
||||||
play(true, () -> world.loadMap(map));
|
play(true, () -> world.loadMap(map, map.applyRules(lastMode)));
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
netServer.kickAll(KickReason.gameover);
|
netServer.kickAll(KickReason.gameover);
|
||||||
@@ -231,7 +231,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
logic.reset();
|
logic.reset();
|
||||||
lastMode = preset;
|
lastMode = preset;
|
||||||
try{
|
try{
|
||||||
world.loadMap(result);
|
world.loadMap(result, result.applyRules(lastMode));
|
||||||
state.rules = result.applyRules(preset);
|
state.rules = result.applyRules(preset);
|
||||||
logic.play();
|
logic.play();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user