diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 7c906733be..972451c6d6 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -207,6 +207,7 @@ text.saving=[accent]Saving... text.wave=[orange]Wave {0} text.wave.waiting=[LIGHT_GRAY]Wave in {0} text.waiting=[LIGHT_GRAY]Waiting... +text.waiting.players=Waiting for 2 players... text.wave.enemies=[LIGHT_GRAY]{0} Enemies Remaining text.wave.enemy=[LIGHT_GRAY]{0} Enemy Remaining text.loadimage=Load Image diff --git a/core/src/io/anuke/mindustry/core/NetServer.java b/core/src/io/anuke/mindustry/core/NetServer.java index b864ab79f6..98c8c7d902 100644 --- a/core/src/io/anuke/mindustry/core/NetServer.java +++ b/core/src/io/anuke/mindustry/core/NetServer.java @@ -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; diff --git a/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java b/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java index fb6d2443d5..fee77eda43 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java @@ -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; diff --git a/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java b/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java index 3e760677fc..9364b25b5c 100644 --- a/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java +++ b/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java @@ -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());