Launch/map buttons for mobile campaign / Bugfixes

This commit is contained in:
Anuken
2020-08-27 11:35:58 -04:00
parent 89c007fcdb
commit b7ec90e7c0
8 changed files with 36 additions and 13 deletions

View File

@@ -9,6 +9,8 @@ import mindustry.gen.*;
import mindustry.world.*;
import mindustry.world.meta.*;
import java.util.*;
import static mindustry.Vars.*;
public class GroundAI extends AIController{
@@ -20,8 +22,9 @@ public class GroundAI extends AIController{
Building core = unit.closestEnemyCore();
if(core != null && unit.within(core, unit.range() / 1.1f)){
if(core != null && unit.within(core, unit.range() / 1.1f + core.block.size * tilesize / 2f)){
target = core;
Arrays.fill(targets, core);
}
if((core == null || !unit.within(core, unit.range() * 0.5f)) && command() == UnitCommand.attack){

View File

@@ -72,7 +72,6 @@ public class UnitTypes implements ContentList{
mace = new UnitType("mace"){{
speed = 0.4f;
hitsize = 9f;
range = 10f;
health = 500;
armor = 4f;
@@ -84,12 +83,11 @@ public class UnitTypes implements ContentList{
reload = 14f;
recoil = 1f;
ejectEffect = Fx.none;
bullet = new BulletType(3f, 30f){{
bullet = new BulletType(3.9f, 30f){{
ammoMultiplier = 3f;
hitSize = 7f;
lifetime = 42f;
lifetime = 12f;
pierce = true;
drag = 0.05f;
statusDuration = 60f * 4;
shootEffect = Fx.shootSmallFlame;
hitEffect = Fx.hitFlameSmall;
@@ -380,7 +378,7 @@ public class UnitTypes implements ContentList{
drag = 0.1f;
speed = 0.5f;
hitsize = 21f;
health = 7600;
health = 8000;
armor = 6f;
legCount = 6;

View File

@@ -779,6 +779,10 @@ public class NetServer implements ApplicationListener{
}
if(state.isGame() && net.server()){
if(state.rules.pvp){
state.serverPaused = isWaitingForPlayers();
}
sync();
}
}

View File

@@ -338,22 +338,24 @@ public class DesktopInput extends InputHandler{
table.row();
table.left().margin(0f).defaults().size(48f).left();
//TODO localize these
table.button(Icon.paste, Styles.clearPartiali, () -> {
ui.schematics.show();
}).tooltip("Schematics");
}).tooltip("@schematics");
table.button(Icon.tree, Styles.clearPartiali, () -> {
ui.research.show();
}).visible(() -> state.isCampaign()).tooltip("Research");
}).visible(() -> state.isCampaign()).tooltip("@research");
table.button(Icon.map, Styles.clearPartiali, () -> {
ui.planet.show();
}).visible(() -> state.isCampaign()).tooltip("Planet Map");
}).visible(() -> state.isCampaign()).tooltip("@planetmap");
table.button(Icon.up, Styles.clearPartiali, () -> {
ui.planet.show(state.getSector(), player.team().core());
}).visible(() -> state.isCampaign())
.disabled(b -> player.team().core() == null || !player.team().core().items.has(player.team().core().block.requirements)).tooltip("Launch Core");
.disabled(b -> player.team().core() == null || !player.team().core().items.has(player.team().core().block.requirements)).tooltip("@launchcore");
}
void pollInput(){

View File

@@ -56,7 +56,7 @@ public class DatabaseDialog extends BaseDialog{
for(int i = 0; i < array.size; i++){
UnlockableContent unlock = (UnlockableContent)array.get(i);
Image image = unlocked(unlock) ? new Image(unlock.icon(Cicon.medium)) : new Image(Icon.lockOpen, Pal.gray);
Image image = unlocked(unlock) ? new Image(unlock.icon(Cicon.medium)) : new Image(Icon.lock, Pal.gray);
list.add(image).size(8*4).pad(3);
ClickListener listener = new ClickListener();
image.addListener(listener);

View File

@@ -93,6 +93,18 @@ public class PausedDialog extends BaseDialog{
cont.row();
cont.buttonRow("@load", Icon.download, load::show).disabled(b -> net.active());
}else if(state.isCampaign()){
cont.buttonRow("@launchcore", Icon.up, () -> {
hide();
ui.planet.show(state.getSector(), player.team().core());
}).disabled(b -> player.team().core() == null || !player.team().core().items.has(player.team().core().block.requirements));
cont.row();
cont.buttonRow("@planetmap", Icon.map, () -> {
hide();
ui.planet.show();
});
}else{
cont.row();
}

View File

@@ -29,7 +29,7 @@ import mindustry.ui.dialogs.*;
import static mindustry.Vars.*;
public class HudFragment extends Fragment{
private static final float dsize = 47.2f;
private static final float dsize = 47f;
public final PlacementFragment blockfrag = new PlacementFragment();
@@ -122,6 +122,8 @@ public class HudFragment extends Fragment{
}).update(i -> {
if(net.active() && mobile){
i.getStyle().imageUp = Icon.chat;
}else if(state.isCampaign()){
i.getStyle().imageUp = Icon.tree;
}else{
i.getStyle().imageUp = Icon.book;
}