Added 'waiting for players' message

This commit is contained in:
Anuken
2018-10-13 16:03:21 -04:00
parent f8d0682810
commit 81c7e63994
4 changed files with 13 additions and 3 deletions

View File

@@ -414,6 +414,10 @@ public class NetServer extends Module{
Log.info("&y{0} has connected.", player.name);
}
public boolean isWaitingForPlayers(){
return state.mode.isPvp && playerGroup.size() < 2;
}
public void update(){
if(threads.isEnabled() && !threads.isOnThread()) return;

View File

@@ -145,6 +145,11 @@ public class HudFragment extends Fragment{
t.table("clear", top -> top.add("[orange]< " + Bundles.get("text.paused") + " >").pad(6).get().setFontScale(fontScale * 1.5f));
});
parent.fill(t -> {
t.visible(() -> netServer.isWaitingForPlayers() && !state.is(State.menu));
t.table("clear", c -> c.margin(10).add("$text.waiting.players"));
});
//'core is under attack' table
parent.fill(t -> {
float notifDuration = 240f;

View File

@@ -35,6 +35,7 @@ import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import static io.anuke.mindustry.Vars.netServer;
import static io.anuke.mindustry.Vars.state;
import static io.anuke.mindustry.Vars.unitGroups;
@@ -204,7 +205,7 @@ public class CoreBlock extends StorageBlock{
if(entity.progress >= 1f){
Call.onUnitRespawn(tile, entity.currentUnit);
}
}else{
}else if(!netServer.isWaitingForPlayers()){
entity.warmup += Timers.delta();
if(entity.solid && entity.warmup > 60f && unitGroups[tile.getTeamID()].getByID(entity.droneID) == null && !Net.client()){
@@ -241,7 +242,6 @@ public class CoreBlock extends StorageBlock{
public class CoreEntity extends TileEntity implements SpawnerTrait{
public Unit currentUnit;
public float shieldHeat;
int droneID = -1;
boolean solid = true;
float warmup;
@@ -251,7 +251,7 @@ public class CoreBlock extends StorageBlock{
@Override
public void updateSpawning(Unit unit){
if(currentUnit == null){
if(!netServer.isWaitingForPlayers() && currentUnit == null){
currentUnit = unit;
progress = 0f;
unit.set(tile.drawx(), tile.drawy());