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