From b7ec90e7c028c860f34c72a95a9040c8c2a142d4 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 27 Aug 2020 11:35:58 -0400 Subject: [PATCH] Launch/map buttons for mobile campaign / Bugfixes --- core/assets/bundles/bundle.properties | 4 +++- core/src/mindustry/ai/types/GroundAI.java | 5 ++++- core/src/mindustry/content/UnitTypes.java | 8 +++----- core/src/mindustry/core/NetServer.java | 4 ++++ core/src/mindustry/input/DesktopInput.java | 10 ++++++---- core/src/mindustry/ui/dialogs/DatabaseDialog.java | 2 +- core/src/mindustry/ui/dialogs/PausedDialog.java | 12 ++++++++++++ core/src/mindustry/ui/fragments/HudFragment.java | 4 +++- 8 files changed, 36 insertions(+), 13 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 56f21ac68e..6b9f8d5e82 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -136,6 +136,8 @@ mod.scripts.disable = Your device does not support mods with scripts. You must d about.button = About name = Name: noname = Pick a[accent] player name[] first. +planetmap = Planet Map +launchcore = Launch Core filename = File Name: unlocked = New content unlocked! completed = [accent]Completed @@ -170,7 +172,7 @@ host.info = The [accent]host[] button hosts a server on port [scarlet]6567[]. \n join.info = Here, you can enter a [accent]server IP[] to connect to, or discover [accent]local network[] or [accent]global[] servers to connect to.\nBoth LAN and WAN multiplayer is supported.\n\n[lightgray]If you want to connect to someone by IP, you would need to ask the host for their IP, which can be found by googling "my ip" from their device. hostserver = Host Multiplayer Game invitefriends = Invite Friends -hostserver.mobile = Host\nGame +hostserver.mobile = Host Game host = Host hosting = [accent]Opening server... hosts.refresh = Refresh diff --git a/core/src/mindustry/ai/types/GroundAI.java b/core/src/mindustry/ai/types/GroundAI.java index d7b112554e..888d8a3418 100644 --- a/core/src/mindustry/ai/types/GroundAI.java +++ b/core/src/mindustry/ai/types/GroundAI.java @@ -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){ diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index fb1ffcaea3..e5de1d7de3 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -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; diff --git a/core/src/mindustry/core/NetServer.java b/core/src/mindustry/core/NetServer.java index a71c0cd6b3..ba03907038 100644 --- a/core/src/mindustry/core/NetServer.java +++ b/core/src/mindustry/core/NetServer.java @@ -779,6 +779,10 @@ public class NetServer implements ApplicationListener{ } if(state.isGame() && net.server()){ + if(state.rules.pvp){ + state.serverPaused = isWaitingForPlayers(); + } + sync(); } } diff --git a/core/src/mindustry/input/DesktopInput.java b/core/src/mindustry/input/DesktopInput.java index 1903d21c40..7fb02a8606 100644 --- a/core/src/mindustry/input/DesktopInput.java +++ b/core/src/mindustry/input/DesktopInput.java @@ -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(){ diff --git a/core/src/mindustry/ui/dialogs/DatabaseDialog.java b/core/src/mindustry/ui/dialogs/DatabaseDialog.java index eebfe47898..2506da87d9 100644 --- a/core/src/mindustry/ui/dialogs/DatabaseDialog.java +++ b/core/src/mindustry/ui/dialogs/DatabaseDialog.java @@ -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); diff --git a/core/src/mindustry/ui/dialogs/PausedDialog.java b/core/src/mindustry/ui/dialogs/PausedDialog.java index ae91f18f10..13479fa151 100644 --- a/core/src/mindustry/ui/dialogs/PausedDialog.java +++ b/core/src/mindustry/ui/dialogs/PausedDialog.java @@ -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(); } diff --git a/core/src/mindustry/ui/fragments/HudFragment.java b/core/src/mindustry/ui/fragments/HudFragment.java index d1eae438a2..5102b2ebf4 100644 --- a/core/src/mindustry/ui/fragments/HudFragment.java +++ b/core/src/mindustry/ui/fragments/HudFragment.java @@ -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; }