Better sector loadout selection
This commit is contained in:
Binary file not shown.
@@ -1699,12 +1699,12 @@ public class Blocks{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
radar = new Radar("radar"){{
|
radar = new Radar("radar"){{
|
||||||
requirements(Category.effect, BuildVisibility.fogOnly, with(Items.silicon, 30, Items.graphite, 30));
|
requirements(Category.effect, BuildVisibility.fogOnly, with(Items.silicon, 40, Items.graphite, 40));
|
||||||
outlineColor = Color.valueOf("4a4b53");
|
outlineColor = Color.valueOf("4a4b53");
|
||||||
fogRadius = 30;
|
fogRadius = 28;
|
||||||
researchCost = with(Items.silicon, 50, Items.graphite, 50);
|
researchCost = with(Items.silicon, 70, Items.graphite, 70);
|
||||||
|
|
||||||
consumePower(0.1f);
|
consumePower(0.15f);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
buildTower = new BuildTurret("build-tower"){{
|
buildTower = new BuildTurret("build-tower"){{
|
||||||
@@ -1719,12 +1719,11 @@ public class Blocks{
|
|||||||
regenProjector = new RegenProjector("regen-projector"){{
|
regenProjector = new RegenProjector("regen-projector"){{
|
||||||
requirements(Category.effect, with(Items.silicon, 80, Items.tungsten, 60, Items.oxide, 40, Items.beryllium, 80));
|
requirements(Category.effect, with(Items.silicon, 80, Items.tungsten, 60, Items.oxide, 40, Items.beryllium, 80));
|
||||||
size = 3;
|
size = 3;
|
||||||
consumePower(1f);
|
|
||||||
range = 28;
|
range = 28;
|
||||||
baseColor = Pal.regen;
|
baseColor = Pal.regen;
|
||||||
|
|
||||||
|
consumePower(1f);
|
||||||
consumeLiquid(Liquids.hydrogen, 1f / 60f);
|
consumeLiquid(Liquids.hydrogen, 1f / 60f);
|
||||||
|
|
||||||
consumeItem(Items.phaseFabric).boost();
|
consumeItem(Items.phaseFabric).boost();
|
||||||
|
|
||||||
healPercent = 4f / 60f;
|
healPercent = 4f / 60f;
|
||||||
@@ -2536,7 +2535,7 @@ public class Blocks{
|
|||||||
drillTime = 160f;
|
drillTime = 160f;
|
||||||
tier = 3;
|
tier = 3;
|
||||||
size = 2;
|
size = 2;
|
||||||
range = 4;
|
range = 5;
|
||||||
fogRadius = 3;
|
fogRadius = 3;
|
||||||
researchCost = with(Items.beryllium, 10);
|
researchCost = with(Items.beryllium, 10);
|
||||||
|
|
||||||
@@ -2666,7 +2665,7 @@ public class Blocks{
|
|||||||
//TODO should this be higher?
|
//TODO should this be higher?
|
||||||
buildCostMultiplier = 0.75f;
|
buildCostMultiplier = 0.75f;
|
||||||
|
|
||||||
unitCapModifier = 20;
|
unitCapModifier = 15;
|
||||||
researchCostMultiplier = 0.07f;
|
researchCostMultiplier = 0.07f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
@@ -2681,7 +2680,7 @@ public class Blocks{
|
|||||||
armor = 10f;
|
armor = 10f;
|
||||||
incinerateNonBuildable = true;
|
incinerateNonBuildable = true;
|
||||||
|
|
||||||
unitCapModifier = 20;
|
unitCapModifier = 15;
|
||||||
researchCostMultipliers.put(Items.silicon, 0.4f);
|
researchCostMultipliers.put(Items.silicon, 0.4f);
|
||||||
researchCostMultiplier = 0.14f;
|
researchCostMultiplier = 0.14f;
|
||||||
}};
|
}};
|
||||||
@@ -2698,7 +2697,7 @@ public class Blocks{
|
|||||||
armor = 15f;
|
armor = 15f;
|
||||||
incinerateNonBuildable = true;
|
incinerateNonBuildable = true;
|
||||||
|
|
||||||
unitCapModifier = 20;
|
unitCapModifier = 15;
|
||||||
researchCostMultipliers.put(Items.silicon, 0.3f);
|
researchCostMultipliers.put(Items.silicon, 0.3f);
|
||||||
researchCostMultiplier = 0.2f;
|
researchCostMultiplier = 0.2f;
|
||||||
}};
|
}};
|
||||||
@@ -4089,7 +4088,7 @@ public class Blocks{
|
|||||||
requirements(Category.units, with(Items.silicon, 200, Items.beryllium, 250));
|
requirements(Category.units, with(Items.silicon, 200, Items.beryllium, 250));
|
||||||
size = 3;
|
size = 3;
|
||||||
configurable = false;
|
configurable = false;
|
||||||
plans.add(new UnitPlan(UnitTypes.stell, 60f * 60f * 1.5f, with(Items.beryllium, 100f, Items.silicon, 60f)));
|
plans.add(new UnitPlan(UnitTypes.stell, 60f * 60f * 1f, with(Items.beryllium, 50f, Items.silicon, 70f)));
|
||||||
researchCost = with(Items.beryllium, 200, Items.graphite, 80, Items.silicon, 80);
|
researchCost = with(Items.beryllium, 200, Items.graphite, 80, Items.silicon, 80);
|
||||||
regionSuffix = "-dark";
|
regionSuffix = "-dark";
|
||||||
fogRadius = 3;
|
fogRadius = 3;
|
||||||
@@ -4480,7 +4479,7 @@ public class Blocks{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
canvas = new CanvasBlock("canvas"){{
|
canvas = new CanvasBlock("canvas"){{
|
||||||
requirements(Category.logic, with(Items.silicon, 40));
|
requirements(Category.logic, BuildVisibility.debugOnly, with(Items.silicon, 50));
|
||||||
|
|
||||||
canvasSize = 12;
|
canvasSize = 12;
|
||||||
padding = 7f / 4f * 2f;
|
padding = 7f / 4f * 2f;
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ public class Planets{
|
|||||||
allowWaveSimulation = true;
|
allowWaveSimulation = true;
|
||||||
allowSectorInvasion = true;
|
allowSectorInvasion = true;
|
||||||
allowLaunchSchematics = true;
|
allowLaunchSchematics = true;
|
||||||
|
allowLaunchLoadout = true;
|
||||||
ruleSetter = r -> {
|
ruleSetter = r -> {
|
||||||
//TODO this planet is crux, need to update all maps.
|
//TODO this planet is crux, need to update all maps.
|
||||||
//r.waveTeam = Team.crux;
|
//r.waveTeam = Team.crux;
|
||||||
|
|||||||
@@ -87,6 +87,8 @@ public class Planet extends UnlockableContent{
|
|||||||
public boolean hasAtmosphere = true;
|
public boolean hasAtmosphere = true;
|
||||||
/** Whether to allow users to specify a custom launch schematic for this map. */
|
/** Whether to allow users to specify a custom launch schematic for this map. */
|
||||||
public boolean allowLaunchSchematics = false;
|
public boolean allowLaunchSchematics = false;
|
||||||
|
/** Whether to allow users to specify the resources they take to this map. */
|
||||||
|
public boolean allowLaunchLoadout = false;
|
||||||
/** Whether to allow sectors to simulate waves in the background. */
|
/** Whether to allow sectors to simulate waves in the background. */
|
||||||
public boolean allowWaveSimulation = false;
|
public boolean allowWaveSimulation = false;
|
||||||
/** Whether to simulate sector invasions from enemy bases. */
|
/** Whether to simulate sector invasions from enemy bases. */
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class LaunchLoadoutDialog extends BaseDialog{
|
|||||||
super("@configure");
|
super("@configure");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void show(CoreBlock core, Sector sector, Runnable confirm){
|
public void show(CoreBlock core, Sector sector, Sector destination, Runnable confirm){
|
||||||
cont.clear();
|
cont.clear();
|
||||||
buttons.clear();
|
buttons.clear();
|
||||||
|
|
||||||
@@ -69,7 +69,20 @@ public class LaunchLoadoutDialog extends BaseDialog{
|
|||||||
ItemSeq launches = universe.getLaunchResources();
|
ItemSeq launches = universe.getLaunchResources();
|
||||||
int capacity = lastCapacity;
|
int capacity = lastCapacity;
|
||||||
|
|
||||||
if(getMax()){
|
if(!sector.planet.allowLaunchLoadout){
|
||||||
|
launches.clear();
|
||||||
|
//TODO this should be set to a proper loadout based on sector.
|
||||||
|
if(destination.preset != null){
|
||||||
|
var rules = destination.preset.generator.map.rules();
|
||||||
|
for(var stack : rules.loadout){
|
||||||
|
if(!sector.planet.hiddenItems.contains(stack.item)){
|
||||||
|
launches.add(stack.item, stack.amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
universe.updateLaunchResources(launches);
|
||||||
|
}else if(getMax()){
|
||||||
for(Item item : content.items()){
|
for(Item item : content.items()){
|
||||||
launches.set(item, Mathf.clamp(sitems.get(item) - launches.get(item), 0, capacity));
|
launches.set(item, Mathf.clamp(sitems.get(item) - launches.get(item), 0, capacity));
|
||||||
}
|
}
|
||||||
@@ -78,10 +91,13 @@ public class LaunchLoadoutDialog extends BaseDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(ItemStack s : total){
|
for(ItemStack s : total){
|
||||||
table.image(s.item.uiIcon).left().size(iconSmall);
|
|
||||||
int as = schems.get(s.item), al = launches.get(s.item);
|
int as = schems.get(s.item), al = launches.get(s.item);
|
||||||
|
|
||||||
String amountStr = (al + as) + "[gray] (" + (al + " + " + as + ")");
|
if(as + al == 0) continue;
|
||||||
|
|
||||||
|
table.image(s.item.uiIcon).left().size(iconSmall);
|
||||||
|
|
||||||
|
String amountStr = (al + as) + (sector.planet.allowLaunchLoadout ? "[gray] (" + (al + " + " + as + ")") : "");
|
||||||
|
|
||||||
table.add(
|
table.add(
|
||||||
sitems.has(s.item, s.amount) ? amountStr :
|
sitems.has(s.item, s.amount) ? amountStr :
|
||||||
@@ -97,25 +113,27 @@ public class LaunchLoadoutDialog extends BaseDialog{
|
|||||||
|
|
||||||
Runnable rebuildItems = () -> rebuild.get(items);
|
Runnable rebuildItems = () -> rebuild.get(items);
|
||||||
|
|
||||||
buttons.button("@resources.max", Icon.add, Styles.togglet, () -> {
|
if(sector.planet.allowLaunchLoadout){
|
||||||
setMax(!getMax());
|
buttons.button("@resources.max", Icon.add, Styles.togglet, () -> {
|
||||||
update.run();
|
setMax(!getMax());
|
||||||
rebuildItems.run();
|
|
||||||
}).checked(b -> getMax());
|
|
||||||
|
|
||||||
buttons.button("@resources", Icon.edit, () -> {
|
|
||||||
ItemSeq stacks = universe.getLaunchResources();
|
|
||||||
Seq<ItemStack> out = stacks.toSeq();
|
|
||||||
|
|
||||||
ItemSeq realItems = sitems.copy();
|
|
||||||
selected.requirements().each(realItems::remove);
|
|
||||||
|
|
||||||
loadout.show(lastCapacity, realItems, out, UnlockableContent::unlocked, out::clear, () -> {}, () -> {
|
|
||||||
universe.updateLaunchResources(new ItemSeq(out));
|
|
||||||
update.run();
|
update.run();
|
||||||
rebuildItems.run();
|
rebuildItems.run();
|
||||||
});
|
}).checked(b -> getMax());
|
||||||
}).disabled(b -> getMax());
|
|
||||||
|
buttons.button("@resources", Icon.edit, () -> {
|
||||||
|
ItemSeq stacks = universe.getLaunchResources();
|
||||||
|
Seq<ItemStack> out = stacks.toSeq();
|
||||||
|
|
||||||
|
ItemSeq realItems = sitems.copy();
|
||||||
|
selected.requirements().each(realItems::remove);
|
||||||
|
|
||||||
|
loadout.show(lastCapacity, realItems, out, UnlockableContent::unlocked, out::clear, () -> {}, () -> {
|
||||||
|
universe.updateLaunchResources(new ItemSeq(out));
|
||||||
|
update.run();
|
||||||
|
rebuildItems.run();
|
||||||
|
});
|
||||||
|
}).disabled(b -> getMax());
|
||||||
|
}
|
||||||
|
|
||||||
boolean rows = Core.graphics.isPortrait() && mobile;
|
boolean rows = Core.graphics.isPortrait() && mobile;
|
||||||
|
|
||||||
@@ -138,44 +156,48 @@ public class LaunchLoadoutDialog extends BaseDialog{
|
|||||||
|
|
||||||
cont.add(Core.bundle.format("launch.from", sector.name())).row();
|
cont.add(Core.bundle.format("launch.from", sector.name())).row();
|
||||||
|
|
||||||
cont.pane(t -> {
|
if(sector.planet.allowLaunchSchematics){
|
||||||
int[] i = {0};
|
cont.pane(t -> {
|
||||||
|
int[] i = {0};
|
||||||
|
|
||||||
Cons<Schematic> handler = s -> {
|
Cons<Schematic> handler = s -> {
|
||||||
if(s.tiles.contains(tile -> !tile.block.supportsEnv(sector.planet.defaultEnv) ||
|
if(s.tiles.contains(tile -> !tile.block.supportsEnv(sector.planet.defaultEnv) ||
|
||||||
//make sure block can be built here.
|
//make sure block can be built here.
|
||||||
(!state.rules.hiddenBuildItems.isEmpty() && Structs.contains(tile.block.requirements, stack -> state.rules.hiddenBuildItems.contains(stack.item))))){
|
(!sector.planet.hiddenItems.isEmpty() && Structs.contains(tile.block.requirements, stack -> sector.planet.hiddenItems.contains(stack.item))))){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
t.button(b -> b.add(new SchematicImage(s)), Styles.togglet, () -> {
|
t.button(b -> b.add(new SchematicImage(s)), Styles.togglet, () -> {
|
||||||
selected = s;
|
selected = s;
|
||||||
update.run();
|
update.run();
|
||||||
rebuildItems.run();
|
rebuildItems.run();
|
||||||
}).group(group).pad(4).checked(s == selected).size(200f);
|
}).group(group).pad(4).checked(s == selected).size(200f);
|
||||||
|
|
||||||
if(++i[0] % cols == 0){
|
if(++i[0] % cols == 0){
|
||||||
t.row();
|
t.row();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if(sector.planet.allowLaunchSchematics || schematics.getDefaultLoadout(core) == null){
|
if(sector.planet.allowLaunchSchematics || schematics.getDefaultLoadout(core) == null){
|
||||||
for(var entry : schematics.getLoadouts()){
|
for(var entry : schematics.getLoadouts()){
|
||||||
if(entry.key.size <= core.size){
|
if(entry.key.size <= core.size){
|
||||||
for(Schematic s : entry.value){
|
for(Schematic s : entry.value){
|
||||||
handler.get(s);
|
handler.get(s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
//only allow launching with the standard loadout schematic
|
||||||
|
handler.get(schematics.getDefaultLoadout(core));
|
||||||
}
|
}
|
||||||
}else{
|
}).growX().scrollX(false);
|
||||||
//only allow launching with the standard loadout schematic
|
|
||||||
handler.get(schematics.getDefaultLoadout(core));
|
cont.row();
|
||||||
}
|
|
||||||
}).growX().scrollX(false);
|
cont.label(() -> Core.bundle.format("launch.capacity", lastCapacity)).row();
|
||||||
|
cont.row();
|
||||||
|
}
|
||||||
|
|
||||||
cont.row();
|
|
||||||
cont.label(() -> Core.bundle.format("launch.capacity", lastCapacity)).row();
|
|
||||||
cont.row();
|
|
||||||
cont.pane(items);
|
cont.pane(items);
|
||||||
cont.row();
|
cont.row();
|
||||||
cont.add("@sector.missingresources").visible(() -> !valid);
|
cont.add("@sector.missingresources").visible(() -> !valid);
|
||||||
|
|||||||
@@ -1159,7 +1159,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
}else{
|
}else{
|
||||||
CoreBlock block = from.info.bestCoreType instanceof CoreBlock b ? b : (CoreBlock)Blocks.coreShard;
|
CoreBlock block = from.info.bestCoreType instanceof CoreBlock b ? b : (CoreBlock)Blocks.coreShard;
|
||||||
|
|
||||||
loadouts.show(block, from, () -> {
|
loadouts.show(block, from, sector, () -> {
|
||||||
var schemCore = universe.getLastLoadout().findCore();
|
var schemCore = universe.getLastLoadout().findCore();
|
||||||
from.removeItems(universe.getLastLoadout().requirements());
|
from.removeItems(universe.getLastLoadout().requirements());
|
||||||
from.removeItems(universe.getLaunchResources());
|
from.removeItems(universe.getLaunchResources());
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import static mindustry.Vars.*;
|
|||||||
public class CanvasBlock extends Block{
|
public class CanvasBlock extends Block{
|
||||||
public float padding = 0f;
|
public float padding = 0f;
|
||||||
public int canvasSize = 8;
|
public int canvasSize = 8;
|
||||||
public int[] palette = {0x000000ff, 0x55415f_ff, 0x646964_ff, 0xd77355_ff, 0x508cd7_ff, 0x64b964_ff, 0xe6c86e_ff, 0xdcf5ff_ff};
|
public int[] palette = {0x634b7dff, 0xc45d9f_ff, 0xe39aac_ff, 0xf0dab1_ff, 0x6461c2_ff, 0x2ba9b4_ff, 0x93d4b5_ff, 0xf0f6e8_ff};
|
||||||
public int bitsPerPixel;
|
public int bitsPerPixel;
|
||||||
public IntIntMap colorToIndex = new IntIntMap();
|
public IntIntMap colorToIndex = new IntIntMap();
|
||||||
|
|
||||||
|
|||||||
@@ -114,6 +114,8 @@ public class MessageBlock extends Block{
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
a.setMaxLength(maxTextLength);
|
a.setMaxLength(maxTextLength);
|
||||||
|
dialog.cont.row();
|
||||||
|
dialog.cont.label(() -> a.getText().length() + " / " + maxTextLength).color(Color.lightGray);
|
||||||
dialog.buttons.button("@ok", () -> {
|
dialog.buttons.button("@ok", () -> {
|
||||||
if(!a.getText().equals(message.toString())) configure(a.getText());
|
if(!a.getText().equals(message.toString())) configure(a.getText());
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
@@ -123,12 +125,23 @@ public class MessageBlock extends Block{
|
|||||||
dialog.hide();
|
dialog.hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
dialog.closeOnBack();
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
deselect();
|
deselect();
|
||||||
}).size(40f);
|
}).size(40f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onConfigureBuildTapped(Building other){
|
||||||
|
if(this == other){
|
||||||
|
deselect();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleString(Object value){
|
public void handleString(Object value){
|
||||||
message.setLength(0);
|
message.setLength(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user