Core launch capacity tweaks
This commit is contained in:
@@ -574,6 +574,7 @@ bannedblocks = Banned Blocks
|
|||||||
bannedunits = Banned Units
|
bannedunits = Banned Units
|
||||||
addall = Add All
|
addall = Add All
|
||||||
launch.from = Launching From: [accent]{0}
|
launch.from = Launching From: [accent]{0}
|
||||||
|
launch.capacity = Launching Item Capacity: [accent]{0}
|
||||||
launch.destination = Destination: {0}
|
launch.destination = Destination: {0}
|
||||||
configure.invalid = Amount must be a number between 0 and {0}.
|
configure.invalid = Amount must be a number between 0 and {0}.
|
||||||
add = Add...
|
add = Add...
|
||||||
@@ -832,6 +833,7 @@ bar.heatamount = Heat: {0}
|
|||||||
bar.heatpercent = Heat: {0} ({1}%)
|
bar.heatpercent = Heat: {0} ({1}%)
|
||||||
bar.power = Power
|
bar.power = Power
|
||||||
bar.progress = Build Progress
|
bar.progress = Build Progress
|
||||||
|
bar.launchcooldown = Launch Cooldown
|
||||||
bar.input = Input
|
bar.input = Input
|
||||||
bar.output = Output
|
bar.output = Output
|
||||||
bar.strength = [stat]{0}[lightgray]x strength
|
bar.strength = [stat]{0}[lightgray]x strength
|
||||||
|
|||||||
@@ -94,6 +94,8 @@ public class Vars implements Loadable{
|
|||||||
public static final float buildingRange = 220f;
|
public static final float buildingRange = 220f;
|
||||||
/** range for moving items */
|
/** range for moving items */
|
||||||
public static final float itemTransferRange = 220f;
|
public static final float itemTransferRange = 220f;
|
||||||
|
/** multiplier for core item capacity when launching */
|
||||||
|
public static final float launchCapacityMultiplier = 0.25f;
|
||||||
/** range for moving items for logic units */
|
/** range for moving items for logic units */
|
||||||
public static final float logicItemTransferRange = 45f;
|
public static final float logicItemTransferRange = 45f;
|
||||||
/** duration of time between turns in ticks */
|
/** duration of time between turns in ticks */
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ public class Planets{
|
|||||||
atmosphereRadOut = 0.3f;
|
atmosphereRadOut = 0.3f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
//TODO hide beryllium and others on load in rules
|
||||||
serpulo = new Planet("serpulo", sun, 1f, 3){{
|
serpulo = new Planet("serpulo", sun, 1f, 3){{
|
||||||
generator = new SerpuloPlanetGenerator();
|
generator = new SerpuloPlanetGenerator();
|
||||||
meshLoader = () -> new HexMesh(this, 6);
|
meshLoader = () -> new HexMesh(this, 6);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import arc.scene.ui.*;
|
|||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
|
import mindustry.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
import mindustry.ctype.*;
|
import mindustry.ctype.*;
|
||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
@@ -26,6 +27,8 @@ public class LaunchLoadoutDialog extends BaseDialog{
|
|||||||
Schematic selected;
|
Schematic selected;
|
||||||
//validity of loadout items
|
//validity of loadout items
|
||||||
boolean valid;
|
boolean valid;
|
||||||
|
//last calculated capacity
|
||||||
|
int lastCapacity;
|
||||||
|
|
||||||
public LaunchLoadoutDialog(){
|
public LaunchLoadoutDialog(){
|
||||||
super("@configure");
|
super("@configure");
|
||||||
@@ -44,7 +47,7 @@ public class LaunchLoadoutDialog extends BaseDialog{
|
|||||||
|
|
||||||
//updates sum requirements
|
//updates sum requirements
|
||||||
Runnable update = () -> {
|
Runnable update = () -> {
|
||||||
int cap = selected.findCore().itemCapacity;
|
int cap = lastCapacity = (int)(Vars.launchCapacityMultiplier * selected.findCore().itemCapacity);
|
||||||
|
|
||||||
//cap resources based on core type
|
//cap resources based on core type
|
||||||
ItemSeq resources = universe.getLaunchResources();
|
ItemSeq resources = universe.getLaunchResources();
|
||||||
@@ -91,7 +94,7 @@ public class LaunchLoadoutDialog extends BaseDialog{
|
|||||||
ItemSeq realItems = sitems.copy();
|
ItemSeq realItems = sitems.copy();
|
||||||
selected.requirements().each(realItems::remove);
|
selected.requirements().each(realItems::remove);
|
||||||
|
|
||||||
loadout.show(selected.findCore().itemCapacity, realItems, out, UnlockableContent::unlocked, out::clear, () -> {}, () -> {
|
loadout.show(lastCapacity, realItems, out, UnlockableContent::unlocked, out::clear, () -> {}, () -> {
|
||||||
universe.updateLaunchResources(new ItemSeq(out));
|
universe.updateLaunchResources(new ItemSeq(out));
|
||||||
update.run();
|
update.run();
|
||||||
rebuildItems.run();
|
rebuildItems.run();
|
||||||
@@ -139,6 +142,8 @@ public class LaunchLoadoutDialog extends BaseDialog{
|
|||||||
|
|
||||||
}).growX().scrollX(false);
|
}).growX().scrollX(false);
|
||||||
|
|
||||||
|
cont.row();
|
||||||
|
cont.label(() -> Core.bundle.format("launch.capacity", lastCapacity)).row();
|
||||||
cont.row();
|
cont.row();
|
||||||
cont.pane(items);
|
cont.pane(items);
|
||||||
cont.row();
|
cont.row();
|
||||||
|
|||||||
@@ -880,7 +880,7 @@ public class Block extends UnlockableContent{
|
|||||||
public ItemStack[] researchRequirements(){
|
public ItemStack[] researchRequirements(){
|
||||||
ItemStack[] out = new ItemStack[requirements.length];
|
ItemStack[] out = new ItemStack[requirements.length];
|
||||||
for(int i = 0; i < out.length; i++){
|
for(int i = 0; i < out.length; i++){
|
||||||
int quantity = 60 + Mathf.round(Mathf.pow(requirements[i].amount, 1.1f) * 20 * researchCostMultiplier, 10);
|
int quantity = 60 + Mathf.round(Mathf.pow(requirements[i].amount, 1.11f) * 20 * researchCostMultiplier, 10);
|
||||||
|
|
||||||
out[i] = new ItemStack(requirements[i].item, UI.roundAmount(quantity));
|
out[i] = new ItemStack(requirements[i].item, UI.roundAmount(quantity));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,9 @@ public class LaunchPad extends Block{
|
|||||||
super.setBars();
|
super.setBars();
|
||||||
|
|
||||||
bars.add("items", entity -> new Bar(() -> Core.bundle.format("bar.items", entity.items.total()), () -> Pal.items, () -> (float)entity.items.total() / itemCapacity));
|
bars.add("items", entity -> new Bar(() -> Core.bundle.format("bar.items", entity.items.total()), () -> Pal.items, () -> (float)entity.items.total() / itemCapacity));
|
||||||
|
|
||||||
|
//TODO is "bar.launchcooldown" the right terminology?
|
||||||
|
bars.add("progress", (LaunchPadBuild build) -> new Bar(() -> Core.bundle.get("bar.launchcooldown"), () -> Pal.ammo, () -> Mathf.clamp(build.launchCounter / launchTime)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -73,8 +76,8 @@ public class LaunchPad extends Block{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldConsume(){
|
public boolean shouldConsume(){
|
||||||
//TODO do not consume after reload / disable?
|
//TODO add launch costs, maybe legacy version
|
||||||
return true;
|
return launchCounter < launchTime && enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user