Display locked sectors / Core incinerate hint
This commit is contained in:
@@ -6,6 +6,8 @@ import arc.graphics.g2d.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.util.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.content.TechTree.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.type.*;
|
||||
@@ -42,6 +44,11 @@ public abstract class UnlockableContent extends MappableContent{
|
||||
this.unlocked = Core.settings != null && Core.settings.getBool(this.name + "-unlocked", false);
|
||||
}
|
||||
|
||||
/** @return the tech node for this content. may be null. */
|
||||
public @Nullable TechNode node(){
|
||||
return TechTree.get(this);
|
||||
}
|
||||
|
||||
public String displayDescription(){
|
||||
return minfo.mod == null ? description : description + "\n" + Core.bundle.format("mod.display", minfo.mod.meta.displayName());
|
||||
}
|
||||
|
||||
@@ -15,8 +15,10 @@ import arc.scene.ui.layout.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.content.TechTree.*;
|
||||
import mindustry.core.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.game.Objectives.*;
|
||||
import mindustry.game.SectorInfo.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.gen.*;
|
||||
@@ -253,7 +255,10 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
boolean canSelect(Sector sector){
|
||||
if(mode == select) return sector.hasBase();
|
||||
//preset sectors can only be selected once unlocked
|
||||
if(sector.preset != null) return sector.preset.unlocked() || sector.hasBase();
|
||||
if(sector.preset != null){
|
||||
TechNode node = sector.preset.node();
|
||||
return node == null || node.parent == null || node.parent.content.unlocked();
|
||||
}
|
||||
|
||||
return sector.hasBase() || sector.near().contains(Sector::hasBase); //near an occupied sector
|
||||
}
|
||||
@@ -291,7 +296,9 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
|
||||
Color color =
|
||||
sec.hasBase() ? Tmp.c2.set(Team.sharded.color).lerp(Team.crux.color, sec.hasEnemyBase() ? 0.5f : 0f) :
|
||||
sec.preset != null ? Tmp.c2.set(Team.derelict.color).lerp(Color.white, Mathf.absin(Time.time, 10f, 1f)) :
|
||||
sec.preset != null ?
|
||||
sec.preset.unlocked() ? Tmp.c2.set(Team.derelict.color).lerp(Color.white, Mathf.absin(Time.time, 10f, 1f)) :
|
||||
Color.gray :
|
||||
sec.hasEnemyBase() ? Team.crux.color :
|
||||
null;
|
||||
|
||||
@@ -352,7 +359,12 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
for(Sector sec : planet.sectors){
|
||||
if(sec != hovered){
|
||||
var preficon = sec.icon();
|
||||
var icon = (sec.isAttacked() ? Fonts.getLargeIcon("warning") : !sec.hasBase() && sec.preset != null && sec.preset.unlocked() && preficon == null ? Fonts.getLargeIcon("terrain") : preficon);
|
||||
var icon =
|
||||
sec.isAttacked() ? Fonts.getLargeIcon("warning") :
|
||||
!sec.hasBase() && sec.preset != null && sec.preset.unlocked() && preficon == null ?
|
||||
Fonts.getLargeIcon("terrain") :
|
||||
sec.preset != null && sec.preset.locked() && sec.preset.node() != null && !sec.preset.node().parent.content.locked() ? Fonts.getLargeIcon("lock") :
|
||||
preficon;
|
||||
var color = sec.preset != null && !sec.hasBase() ? Team.derelict.color : Team.sharded.color;
|
||||
|
||||
if(icon != null){
|
||||
@@ -690,7 +702,21 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
|
||||
stable.image().color(Pal.accent).fillX().height(3f).pad(3f).row();
|
||||
|
||||
if(!sector.hasBase()){
|
||||
boolean locked = sector.preset != null && sector.preset.locked() && sector.preset.node() != null;
|
||||
|
||||
if(locked){
|
||||
stable.table(r -> {
|
||||
r.add("@complete").colspan(2).left();
|
||||
r.row();
|
||||
for(Objective o : sector.preset.node().objectives){
|
||||
if(o.complete()) continue;
|
||||
|
||||
r.add("> " + o.display()).color(Color.lightGray).left();
|
||||
r.image(o.complete() ? Icon.ok : Icon.cancel, o.complete() ? Color.lightGray : Color.scarlet).padLeft(3);
|
||||
r.row();
|
||||
}
|
||||
}).row();
|
||||
}else if(!sector.hasBase()){
|
||||
stable.add(Core.bundle.get("sectors.threat") + " [accent]" + sector.displayThreat()).row();
|
||||
}
|
||||
|
||||
@@ -730,13 +756,23 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
}
|
||||
|
||||
if((sector.hasBase() && mode == look) || canSelect(sector) || (sector.preset != null && sector.preset.alwaysUnlocked) || debugSelect){
|
||||
stable.button(mode == select ? "@sectors.select" : sector.isBeingPlayed() ? "@sectors.resume" : sector.hasBase() ? "@sectors.go" : "@sectors.launch", Icon.play, () -> {
|
||||
stable.button(
|
||||
mode == select ? "@sectors.select" :
|
||||
sector.isBeingPlayed() ? "@sectors.resume" :
|
||||
sector.hasBase() ? "@sectors.go" :
|
||||
locked ? "@locked" : "@sectors.launch",
|
||||
locked ? Icon.lock :Icon.play, () -> {
|
||||
|
||||
if(sector.isBeingPlayed()){
|
||||
//already at this sector
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
|
||||
if(sector.preset != null && sector.preset.locked()){
|
||||
return;
|
||||
}
|
||||
|
||||
boolean shouldHide = true;
|
||||
|
||||
//save before launch.
|
||||
@@ -778,7 +814,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
}
|
||||
|
||||
if(shouldHide) hide();
|
||||
}).growX().height(54f).minWidth(170f).padTop(4);
|
||||
}).growX().height(54f).minWidth(170f).padTop(4).disabled(locked);
|
||||
}
|
||||
|
||||
stable.pack();
|
||||
|
||||
@@ -172,6 +172,7 @@ public class HintsFragment extends Fragment{
|
||||
&& SectorPresets.frozenForest.unlocked()
|
||||
&& SectorPresets.frozenForest.sector.save == null,
|
||||
() -> state.isCampaign() && state.getSector().preset == SectorPresets.frozenForest),
|
||||
coreIncinerate(() -> state.isCampaign() && state.rules.defaultTeam.core() != null && state.rules.defaultTeam.core().items.get(Items.copper) >= state.rules.defaultTeam.core().storageCapacity - 10, () -> false),
|
||||
;
|
||||
|
||||
@Nullable
|
||||
|
||||
Reference in New Issue
Block a user