Options for SectorPreset overriding plant launch fields. (#7478)
* Preset overriding loadouts * a * You know I should really learn what this actually does
This commit is contained in:
@@ -80,6 +80,14 @@ public class Sector{
|
||||
return hasBase() || (preset != null && preset.alwaysUnlocked);
|
||||
}
|
||||
|
||||
public boolean allowLaunchSchematics(){
|
||||
return (preset != null && preset.overrideLaunchDefaults) ? preset.allowLaunchSchematics : planet.allowLaunchSchematics;
|
||||
}
|
||||
|
||||
public boolean allowLaunchLoadout(){
|
||||
return (preset != null && preset.overrideLaunchDefaults) ? preset.allowLaunchLoadout : planet.allowLaunchLoadout;
|
||||
}
|
||||
|
||||
public void saveInfo(){
|
||||
Core.settings.putJson(planet.name + "-s-" + id + "-info", info);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,12 @@ public class SectorPreset extends UnlockableContent{
|
||||
public float startWaveTimeMultiplier = 2f;
|
||||
public boolean addStartingItems = false;
|
||||
public boolean showSectorLandInfo = true;
|
||||
/** If true, uses this sector's launch fields instead */
|
||||
public boolean overrideLaunchDefaults = false;
|
||||
/** Whether to allow users to specify a custom launch schematic for this map. */
|
||||
public boolean allowLaunchSchematics = false;
|
||||
/** Whether to allow users to specify the resources they take to this map. */
|
||||
public boolean allowLaunchLoadout = false;
|
||||
/** If true, switches to attack mode after waves end. */
|
||||
public boolean attackAfterWaves = false;
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public class LaunchLoadoutDialog extends BaseDialog{
|
||||
|
||||
int capacity = lastCapacity;
|
||||
|
||||
if(!sector.planet.allowLaunchLoadout){
|
||||
if(!destination.allowLaunchLoadout()){
|
||||
resources.clear();
|
||||
//TODO this should be set to a proper loadout based on sector.
|
||||
if(destination.preset != null){
|
||||
@@ -95,7 +95,7 @@ public class LaunchLoadoutDialog extends BaseDialog{
|
||||
|
||||
table.image(s.item.uiIcon).left().size(iconSmall);
|
||||
|
||||
String amountStr = (al + as) + (sector.planet.allowLaunchLoadout ? "[gray] (" + (al + " + " + as + ")") : "");
|
||||
String amountStr = (al + as) + (destination.allowLaunchLoadout() ? "[gray] (" + (al + " + " + as + ")") : "");
|
||||
|
||||
table.add(
|
||||
sitems.has(s.item, s.amount) ? amountStr :
|
||||
@@ -111,7 +111,7 @@ public class LaunchLoadoutDialog extends BaseDialog{
|
||||
|
||||
Runnable rebuildItems = () -> rebuild.get(items);
|
||||
|
||||
if(sector.planet.allowLaunchLoadout){
|
||||
if(destination.allowLaunchLoadout()){
|
||||
buttons.button("@resources.max", Icon.add, Styles.togglet, () -> {
|
||||
setMax(!getMax());
|
||||
update.run();
|
||||
@@ -154,7 +154,7 @@ public class LaunchLoadoutDialog extends BaseDialog{
|
||||
|
||||
cont.add(Core.bundle.format("launch.from", sector.name())).row();
|
||||
|
||||
if(sector.planet.allowLaunchSchematics){
|
||||
if(destination.allowLaunchSchematics()){
|
||||
cont.pane(t -> {
|
||||
int[] i = {0};
|
||||
|
||||
@@ -176,7 +176,7 @@ public class LaunchLoadoutDialog extends BaseDialog{
|
||||
}
|
||||
};
|
||||
|
||||
if(sector.planet.allowLaunchSchematics || schematics.getDefaultLoadout(core) == null){
|
||||
if(destination.allowLaunchSchematics() || schematics.getDefaultLoadout(core) == null){
|
||||
for(var entry : schematics.getLoadouts()){
|
||||
if(entry.key.size <= core.size){
|
||||
for(Schematic s : entry.value){
|
||||
|
||||
@@ -1160,7 +1160,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
//free launch.
|
||||
control.playSector(sector);
|
||||
}else{
|
||||
CoreBlock block = from.planet.allowLaunchSchematics ? (from.info.bestCoreType instanceof CoreBlock b ? b : (CoreBlock)from.planet.defaultCore) : (CoreBlock)from.planet.defaultCore;
|
||||
CoreBlock block = sector.allowLaunchSchematics() ? (from.info.bestCoreType instanceof CoreBlock b ? b : (CoreBlock)from.planet.defaultCore) : (CoreBlock)from.planet.defaultCore;
|
||||
|
||||
loadouts.show(block, from, sector, () -> {
|
||||
var schemCore = universe.getLastLoadout().findCore();
|
||||
|
||||
Reference in New Issue
Block a user