Added more hints
This commit is contained in:
@@ -1508,6 +1508,7 @@ public class Blocks implements ContentList{
|
||||
shootEffect = Fx.shootLiquid;
|
||||
range = 110f;
|
||||
health = 250 * size * size;
|
||||
flags = EnumSet.of(BlockFlag.turret, BlockFlag.extinguisher);
|
||||
}};
|
||||
|
||||
lancer = new ChargeTurret("lancer"){{
|
||||
|
||||
@@ -29,9 +29,14 @@ abstract class CommanderComp implements Entityc, Posc{
|
||||
transient float minFormationSpeed;
|
||||
|
||||
public void update(){
|
||||
if(controlling.isEmpty()){
|
||||
formation = null;
|
||||
}
|
||||
|
||||
if(formation != null){
|
||||
formation.anchor.set(x, y, 0);
|
||||
formation.updateSlots();
|
||||
controlling.removeAll(u -> u.dead || !(u.controller() instanceof FormationAI ai && ai.leader == self()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +69,8 @@ abstract class CommanderComp implements Entityc, Posc{
|
||||
}
|
||||
});
|
||||
|
||||
if(units.isEmpty()) return;
|
||||
|
||||
//sort by hitbox size, then by distance
|
||||
units.sort(Structs.comps(Structs.comparingFloat(u -> -u.hitSize), Structs.comparingFloat(u -> u.dst2(this))));
|
||||
units.truncate(type.commandLimit);
|
||||
|
||||
@@ -45,7 +45,7 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc{
|
||||
}
|
||||
|
||||
public boolean canMine(){
|
||||
return type.mineSpeed > 0;
|
||||
return type.mineSpeed > 0 && type.mineTier >= 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -58,6 +58,7 @@ public enum Binding implements KeyBind{
|
||||
fullscreen(KeyCode.f11),
|
||||
pause(KeyCode.space),
|
||||
minimap(KeyCode.m),
|
||||
planet_map(KeyCode.n),
|
||||
toggle_menus(KeyCode.c),
|
||||
screenshot(KeyCode.p),
|
||||
toggle_power_lines(KeyCode.f5),
|
||||
|
||||
@@ -237,8 +237,9 @@ public class DesktopInput extends InputHandler{
|
||||
player.shooting = false;
|
||||
}
|
||||
|
||||
if(state.isGame() && Core.input.keyTap(Binding.minimap) && !scene.hasDialog() && !(scene.getKeyboardFocus() instanceof TextField)){
|
||||
ui.minimapfrag.toggle();
|
||||
if(state.isGame() && !scene.hasDialog() && !(scene.getKeyboardFocus() instanceof TextField)){
|
||||
if(Core.input.keyTap(Binding.minimap)) ui.minimapfrag.toggle();
|
||||
if(Core.input.keyTap(Binding.planet_map) && state.isCampaign()) ui.planet.toggle();
|
||||
}
|
||||
|
||||
if(state.isMenu() || Core.scene.hasDialog()) return;
|
||||
|
||||
@@ -677,23 +677,22 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
stable.add(Core.bundle.get("sectors.threat") + " [accent]" + sector.displayThreat()).row();
|
||||
}
|
||||
|
||||
if(sector.isAttacked()){ //TODO localize
|
||||
//these mechanics are likely to change and as such are not added to the bundle
|
||||
stable.add("[scarlet]Under attack! [accent]" + (int)(sector.info.damage * 100) + "% damaged");
|
||||
if(sector.isAttacked()){
|
||||
stable.add(Core.bundle.format("sectors.underattack", (int)(sector.info.damage * 100)));
|
||||
stable.row();
|
||||
|
||||
if(sector.info.wavesSurvived >= 0 && sector.info.wavesSurvived - sector.info.wavesPassed >= 0 && !sector.isBeingPlayed()){
|
||||
int toCapture = sector.info.attack || sector.info.winWave <= 1 ? -1 : sector.info.winWave - (sector.info.wave + sector.info.wavesPassed);
|
||||
boolean plus = (sector.info.wavesSurvived - sector.info.wavesPassed) >= SectorDamage.maxRetWave - 1;
|
||||
stable.add("[accent]Survives " + Math.min(sector.info.wavesSurvived - sector.info.wavesPassed, toCapture <= 0 ? 200 : 0) +
|
||||
(plus ? "+" : "") + (toCapture < 0 ? "" : "/" + toCapture) + " waves");
|
||||
stable.add(Core.bundle.format("sectors.survives", Math.min(sector.info.wavesSurvived - sector.info.wavesPassed, toCapture <= 0 ? 200 : 0) +
|
||||
(plus ? "+" : "") + (toCapture < 0 ? "" : "/" + toCapture)));
|
||||
stable.row();
|
||||
}
|
||||
}else if(sector.hasBase() && sector.near().contains(Sector::hasEnemyBase)){ //TODO localize
|
||||
stable.add("[scarlet]Vulnerable");
|
||||
}else if(sector.hasBase() && sector.near().contains(Sector::hasEnemyBase)){
|
||||
stable.add("@sectors.vulnerable");
|
||||
stable.row();
|
||||
}else if(!sector.hasBase() && sector.hasEnemyBase()){ //TODO localize
|
||||
stable.add("[scarlet]Enemy Base");
|
||||
}else if(!sector.hasBase() && sector.hasEnemyBase()){
|
||||
stable.add("@sectors.enemybase");
|
||||
stable.row();
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,11 @@ import arc.util.*;
|
||||
import mindustry.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.input.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
@@ -24,10 +26,9 @@ public class HintsFragment extends Fragment{
|
||||
private static final float foutTime = 0.6f;
|
||||
|
||||
/** All hints to be displayed in the game. */
|
||||
public Seq<Hint> incomplete = Seq.with(DefaultHint.values());
|
||||
@Nullable
|
||||
public Hint current;
|
||||
public Seq<Hint> hints = Seq.with(DefaultHint.values());
|
||||
|
||||
@Nullable Hint current;
|
||||
Group group = new WidgetGroup();
|
||||
ObjectSet<String> events = new ObjectSet<>();
|
||||
ObjectSet<Block> placedBlocks = new ObjectSet<>();
|
||||
@@ -47,10 +48,10 @@ public class HintsFragment extends Fragment{
|
||||
}else if(!current.show()){ //current became hidden
|
||||
hide();
|
||||
}
|
||||
}else if(incomplete.size > 0){
|
||||
}else if(hints.size > 0){
|
||||
//check one hint each frame to see if it should be shown.
|
||||
checkIdx = (checkIdx + 1) % incomplete.size;
|
||||
Hint hint = incomplete.get(checkIdx);
|
||||
checkIdx = (checkIdx + 1) % hints.size;
|
||||
Hint hint = hints.get(checkIdx);
|
||||
if(hint.show() && !hint.finished() & !hint.complete()){
|
||||
display(hint);
|
||||
}
|
||||
@@ -61,7 +62,7 @@ public class HintsFragment extends Fragment{
|
||||
checkNext();
|
||||
|
||||
Events.on(BlockBuildEndEvent.class, event -> {
|
||||
if(!event.breaking && event.tile.team() == Vars.state.rules.defaultTeam){
|
||||
if(!event.breaking && event.unit == player.unit()){
|
||||
placedBlocks.add(event.tile.block());
|
||||
}
|
||||
|
||||
@@ -70,26 +71,22 @@ public class HintsFragment extends Fragment{
|
||||
}
|
||||
});
|
||||
|
||||
Events.on(UnitControlEvent.class, e -> {
|
||||
if(e.player == player){
|
||||
events.add("unitcontrol");
|
||||
}
|
||||
Events.on(ResetEvent.class, e -> {
|
||||
placedBlocks.clear();
|
||||
events.clear();
|
||||
});
|
||||
|
||||
Events.on(WorldLoadEvent.class, e -> Core.app.post(() -> {
|
||||
checkNext();
|
||||
}));
|
||||
}
|
||||
|
||||
void checkNext(){
|
||||
if(current != null) return;
|
||||
|
||||
incomplete.removeAll(h -> h == current || !h.valid() || h.finished() || (h.show() && h.complete()));
|
||||
incomplete.sort(Hint::order);
|
||||
hints.removeAll(h -> h == current || !h.valid() || h.finished() || (h.show() && h.complete()));
|
||||
hints.sort(Hint::order);
|
||||
|
||||
Hint first = incomplete.find(Hint::show);
|
||||
Hint first = hints.find(Hint::show);
|
||||
if(first != null){
|
||||
incomplete.remove(first);
|
||||
hints.remove(first);
|
||||
display(first);
|
||||
}
|
||||
}
|
||||
@@ -120,7 +117,7 @@ public class HintsFragment extends Fragment{
|
||||
if(current == null) return;
|
||||
|
||||
current.finish();
|
||||
incomplete.remove(current);
|
||||
hints.remove(current);
|
||||
|
||||
hide();
|
||||
}
|
||||
@@ -144,7 +141,7 @@ public class HintsFragment extends Fragment{
|
||||
public enum DefaultHint implements Hint{
|
||||
desktopMove(visibleDesktop, () -> Core.input.axis(Binding.move_x) != 0 || Core.input.axis(Binding.move_y) != 0),
|
||||
zoom(visibleDesktop, () -> Core.input.axis(KeyCode.scroll) != 0),
|
||||
mine(isTutorial, () -> player.unit().mining()),
|
||||
mine(() -> player.unit().canMine() && isTutorial.get(), () -> player.unit().mining()),
|
||||
placeDrill(isTutorial, () -> ui.hints.placedBlocks.contains(Blocks.mechanicalDrill)),
|
||||
placeConveyor(isTutorial, () -> ui.hints.placedBlocks.contains(Blocks.conveyor)),
|
||||
placeTurret(isTutorial, () -> ui.hints.placedBlocks.contains(Blocks.duo)),
|
||||
@@ -156,6 +153,13 @@ public class HintsFragment extends Fragment{
|
||||
unitControl(() -> state.rules.defaultTeam.data().units.size > 1 && !net.active(), () -> !player.dead() && !player.unit().spawnedByCore),
|
||||
respawn(visibleMobile, () -> !player.dead() && !player.unit().spawnedByCore, () -> !player.dead() && player.unit().spawnedByCore),
|
||||
launch(() -> isTutorial.get() && state.rules.sector.isCaptured(), () -> ui.planet.isShown()),
|
||||
schematicSelect(visibleDesktop, () -> ui.hints.placedBlocks.contains(Blocks.router), () -> Core.input.keyRelease(Binding.schematic_select) || Core.input.keyTap(Binding.pick)),
|
||||
conveyorPathfind(() -> control.input.block == Blocks.titaniumConveyor, () -> Core.input.keyTap(Binding.diagonal_placement) || (mobile && Core.settings.getBool("swapdiagonal"))),
|
||||
boost(visibleDesktop, () -> !player.dead() && player.unit().type.canBoost, () -> Core.input.keyDown(Binding.boost)),
|
||||
command(() -> state.rules.defaultTeam.data().units.size > 3 && !net.active(), () -> player.unit().isCommanding()),
|
||||
payloadPickup(() -> !player.unit().dead && player.unit() instanceof Payloadc p && p.payloads().isEmpty(), () -> player.unit() instanceof Payloadc p && p.payloads().any()),
|
||||
payloadDrop(() -> !player.unit().dead && player.unit() instanceof Payloadc p && p.payloads().any(), () -> player.unit() instanceof Payloadc p && p.payloads().isEmpty()),
|
||||
waveFire(() -> Groups.fire.size() > 0 && Blocks.wave.unlockedNow(), () -> indexer.getAllied(state.rules.defaultTeam, BlockFlag.extinguisher).size() > 0),
|
||||
;
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -23,7 +23,9 @@ public enum BlockFlag{
|
||||
/** Any reactor block. */
|
||||
reactor,
|
||||
/** Any block that boosts unit capacity. */
|
||||
unitModifier;
|
||||
unitModifier,
|
||||
/** Blocks that extinguishes fires. */
|
||||
extinguisher;
|
||||
|
||||
public final static BlockFlag[] all = values();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user