mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-11 11:17:11 +07:00
Fixed unit pads, rule selection, gameover state
This commit is contained in:
parent
3b2b79d539
commit
3464f40da3
@ -86,7 +86,7 @@ public class Logic implements ApplicationListener{
|
||||
}
|
||||
|
||||
private void checkGameOver(){
|
||||
if(state.rules.waves && state.teams.get(defaultTeam).cores.size == 0 && !state.gameOver){
|
||||
if(!state.rules.attackMode && state.teams.get(defaultTeam).cores.size == 0 && !state.gameOver){
|
||||
state.gameOver = true;
|
||||
Events.fire(new GameOverEvent(waveTeam));
|
||||
}else if(state.rules.attackMode){
|
||||
|
@ -819,6 +819,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
|
||||
this.lastSpawner = spawner;
|
||||
this.dead = true;
|
||||
setNet(spawner.getX(), spawner.getY());
|
||||
spawner.updateSpawning(this);
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
@ -195,6 +195,13 @@ public abstract class InputHandler implements InputProcessor{
|
||||
}
|
||||
}
|
||||
|
||||
//clear when the player taps on something else
|
||||
if(!consumed && !mobile && player.isBuilding() && block == null){
|
||||
player.clearBuilding();
|
||||
block = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!showedInventory){
|
||||
frag.inv.hide();
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public class MapPlayDialog extends FloatingDialog{
|
||||
|
||||
modes.addButton(mode.toString(), "toggle", () -> {
|
||||
selectedGamemode = selectedGamemode == mode ? null : mode;
|
||||
rules = mode.apply(map.rules());
|
||||
rules = selectedGamemode == null ? map.rules() : mode.apply(map.rules());
|
||||
}).update(b -> b.setChecked(selectedGamemode == mode)).size(140f, 54f);
|
||||
if(i++ % 2 == 1) modes.row();
|
||||
}
|
||||
|
@ -59,6 +59,7 @@ public class MechPad extends Block{
|
||||
|
||||
if(!entity.cons.valid()) return;
|
||||
player.beginRespawning(entity);
|
||||
entity.sameMech = false;
|
||||
}
|
||||
|
||||
@Remote(called = Loc.server)
|
||||
@ -71,7 +72,7 @@ public class MechPad extends Block{
|
||||
|
||||
if(entity.player == null) return;
|
||||
Mech mech = ((MechPad)tile.block()).mech;
|
||||
entity.player.mech = entity.player.mech == mech ? Mechs.starter : mech;
|
||||
entity.player.mech = !entity.sameMech && entity.player.mech == mech ? Mechs.starter : mech;
|
||||
|
||||
entity.progress = 0;
|
||||
entity.player.onRespawn(tile);
|
||||
@ -113,7 +114,7 @@ public class MechPad extends Block{
|
||||
Draw.rect(Core.atlas.find(name), tile.drawx(), tile.drawy());
|
||||
|
||||
if(entity.player != null){
|
||||
TextureRegion region = (entity.player.mech == mech ? Mechs.starter.iconRegion : mech.iconRegion);
|
||||
TextureRegion region = (!entity.sameMech && entity.player.mech == mech ? Mechs.starter.iconRegion : mech.iconRegion);
|
||||
|
||||
Shaders.build.region = region;
|
||||
Shaders.build.progress = entity.progress;
|
||||
@ -162,6 +163,7 @@ public class MechPad extends Block{
|
||||
|
||||
public class MechFactoryEntity extends TileEntity implements SpawnerTrait{
|
||||
Player player;
|
||||
boolean sameMech;
|
||||
float progress;
|
||||
float time;
|
||||
float heat;
|
||||
@ -171,6 +173,7 @@ public class MechPad extends Block{
|
||||
if(player == null){
|
||||
progress = 0f;
|
||||
player = unit;
|
||||
sameMech = true;
|
||||
|
||||
player.beginRespawning(this);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user