Skip to content

Commit 7aee34b

Browse files
committed
Finalized launch pad mechanics
1 parent c6d82be commit 7aee34b

19 files changed

+310
-52
lines changed
Loading
Loading
Loading
Loading

core/assets/bundles/bundle.properties

+10-2
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,8 @@ addall = Add All
737737
launch.from = Launching From: [accent]{0}
738738
launch.capacity = Launching Item Capacity: [accent]{0}
739739
launch.destination = Destination: {0}
740+
landing.sources = Source Sectors: [accent]{0}[]
741+
landing.import = Max Total Import: {0}[accent]{1}[lightgray]/min
740742
configure.invalid = Amount must be a number between 0 and {0}.
741743
add = Add...
742744
guardian = Guardian
@@ -778,6 +780,7 @@ sectors.launch = Launch
778780
sectors.select = Select
779781
sectors.launchselect = Select Launch Destination
780782
sectors.nonelaunch = [lightgray]none (sun)
783+
sectors.redirect = Redirect Launch Pads
781784
sectors.rename = Rename Sector
782785
sectors.enemybase = [scarlet]Enemy Base
783786
sectors.vulnerable = [scarlet]Vulnerable
@@ -1748,7 +1751,10 @@ block.spectre.name = Spectre
17481751
block.meltdown.name = Meltdown
17491752
block.foreshadow.name = Foreshadow
17501753
block.container.name = Container
1751-
block.launch-pad.name = Launch Pad (Legacy)
1754+
block.launch-pad.name = Launch Pad [lightgray](Legacy)
1755+
block.advanced-launch-pad.name = Launch Pad
1756+
block.landing-pad.name = Landing Pad
1757+
17521758
block.segment.name = Segment
17531759
block.ground-factory.name = Ground Factory
17541760
block.air-factory.name = Air Factory
@@ -2198,7 +2204,9 @@ block.vault.description = Stores a large amount of items of each type. Expands s
21982204
block.container.description = Stores a small amount of items of each type. Expands storage when placed next to a core. Contents can be retrieved with an unloader.
21992205
block.unloader.description = Unloads the selected item from nearby blocks.
22002206
block.launch-pad.description = Launches batches of items to selected sectors.
2201-
block.launch-pad.details = Sub-orbital system for point-to-point transportation of resources. Payload pods are fragile and incapable of surviving re-entry.
2207+
block.advanced-launch-pad.description = Launches batches of items to selected sectors. Only accepts one item type at a time.
2208+
block.advanced-launch-pad.details = Sub-orbital system for point-to-point transportation of resources.
2209+
block.landing-pad.description = Receives items from launch pads in other sectors. Requires large amounts of water to protect against impacts of landings.
22022210
block.duo.description = Fires alternating bullets at enemies.
22032211
block.scatter.description = Fires clumps of lead, scrap or metaglass flak at enemy aircraft.
22042212
block.scorch.description = Burns any ground enemies close to it. Highly effective at close range.

core/assets/icons/icons.properties

+2
Original file line numberDiff line numberDiff line change
@@ -595,3 +595,5 @@
595595
63087=scathe-missile-phase|unit-scathe-missile-phase-ui
596596
63086=scathe-missile-surge|unit-scathe-missile-surge-ui
597597
63085=scathe-missile-surge-split|unit-scathe-missile-surge-split-ui
598+
63084=advanced-launch-pad|block-advanced-launch-pad-ui
599+
63083=landing-pad|block-landing-pad-ui

core/assets/logicids.dat

34 Bytes
Binary file not shown.

core/src/mindustry/content/Blocks.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -6364,23 +6364,26 @@ Items.surgeAlloy, new BasicBulletType(7f, 250){{
63646364
}};
63656365

63666366
advancedLaunchPad = new LaunchPad("advanced-launch-pad"){{
6367-
requirements(Category.effect, BuildVisibility.campaignOnly, with(Items.copper, 350, Items.silicon, 140, Items.lead, 200, Items.titanium, 150));
6367+
requirements(Category.effect, BuildVisibility.campaignOnly, with(Items.copper, 350, Items.silicon, 250, Items.lead, 300, Items.titanium, 200));
63686368
size = 4;
63696369
itemCapacity = 100;
63706370
launchTime = 60f * 30;
6371+
liquidCapacity = 40f;
63716372
hasPower = true;
6373+
drawLiquid = Liquids.oil;
63726374
consumeLiquid(Liquids.oil, 9f/60f);
63736375
consumePower(8f);
63746376
}};
63756377

63766378
landingPad = new LandingPad("landing-pad"){{
6377-
requirements(Category.effect, BuildVisibility.campaignOnly, with(Items.copper, 350, Items.silicon, 140, Items.lead, 200, Items.titanium, 150));
6379+
requirements(Category.effect, BuildVisibility.campaignOnly, with(Items.copper, 300, Items.graphite, 200, Items.titanium, 150));
63786380
size = 4;
63796381

63806382
itemCapacity = 100;
63816383

6382-
liquidCapacity = 4000f;
6383-
consumeLiquidAmount = 2000f;
6384+
coolingEffect = new RadialEffect(Fx.steamCoolSmoke, 4, 90f, 9.5f, 180f);
6385+
liquidCapacity = 5000f;
6386+
consumeLiquidAmount = 2500f;
63846387
}};
63856388

63866389
interplanetaryAccelerator = new Accelerator("interplanetary-accelerator"){{

core/src/mindustry/content/Fx.java

+22
Original file line numberDiff line numberDiff line change
@@ -1474,6 +1474,12 @@ public class Fx{
14741474
Lines.circle(e.x, e.y, e.fin() * (e.rotation + 50f));
14751475
}),
14761476

1477+
podLandShockwave = new Effect(12f, 80f, e -> {
1478+
color(Pal.accent);
1479+
stroke(e.fout() * 2f + 0.2f);
1480+
Lines.circle(e.x, e.y, e.fin() * 26f);
1481+
}),
1482+
14771483
explosion = new Effect(30, e -> {
14781484
e.scaled(7, i -> {
14791485
stroke(3f * i.fout());
@@ -1624,6 +1630,15 @@ public class Fx{
16241630
});
16251631
}),
16261632

1633+
steamCoolSmoke = new Effect(35f, e -> {
1634+
color(Pal.water, Color.lightGray, e.fin(Interp.pow2Out));
1635+
alpha(e.fout(Interp.pow3Out));
1636+
1637+
randLenVectors(e.id, 4, e.finpow() * 7f, e.rotation, 30f, (x, y) -> {
1638+
Fill.circle(e.x + x, e.y + y, Math.max(e.fout(), Math.min(1f, e.fin() * 8f)) * 2.8f);
1639+
});
1640+
}),
1641+
16271642
smokePuff = new Effect(30, e -> {
16281643
color(e.color);
16291644

@@ -2574,6 +2589,13 @@ public class Fx{
25742589
Fill.circle(e.x + Tmp.v1.x, e.y + Tmp.v1.y, 8f * rand.random(0.6f, 1f) * e.fout(0.2f));
25752590
}).layer(Layer.groundUnit + 1f),
25762591

2592+
podLandDust = new Effect(70f, e -> {
2593+
color(e.color, e.fout(0.1f));
2594+
rand.setSeed(e.id);
2595+
Tmp.v1.trns(e.rotation, e.finpow() * 35f * rand.random(0.2f, 1f));
2596+
Fill.circle(e.x + Tmp.v1.x, e.y + Tmp.v1.y, 5f * rand.random(0.6f, 1f) * e.fout(0.2f));
2597+
}).layer(Layer.groundUnit + 1f),
2598+
25772599
unitShieldBreak = new Effect(35, e -> {
25782600
if(!(e.data instanceof Unit unit)) return;
25792601

core/src/mindustry/content/SerpuloTechTree.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ public static void load(){
2020
node(junction, () -> {
2121
node(router, () -> {
2222
node(advancedLaunchPad, Seq.with(new SectorComplete(extractionOutpost)), () -> {
23-
node(interplanetaryAccelerator, Seq.with(new SectorComplete(planetaryTerminal)), () -> {
23+
node(landingPad, () -> {
24+
node(interplanetaryAccelerator, Seq.with(new SectorComplete(planetaryTerminal)), () -> {
2425

26+
});
2527
});
2628
});
2729

core/src/mindustry/entities/effect/RadialEffect.java

+8-3
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,35 @@
88
/** Renders one particle effect repeatedly at specified angle intervals. */
99
public class RadialEffect extends Effect{
1010
public Effect effect = Fx.none;
11-
public float rotationSpacing = 90f, rotationOffset = 0f;
11+
public float rotationSpacing = 90f, rotationOffset = 0f, effectRotationOffset = 0f;
1212
public float lengthOffset = 0f;
1313
public int amount = 4;
1414

1515
public RadialEffect(){
1616
clip = 100f;
1717
}
1818

19-
public RadialEffect(Effect effect, int amount, float spacing, float lengthOffset){
19+
public RadialEffect(Effect effect, int amount, float spacing, float lengthOffset, float effectRotationOffset){
2020
this();
2121
this.amount = amount;
2222
this.effect = effect;
23+
this.effectRotationOffset = effectRotationOffset;
2324
this.rotationSpacing = spacing;
2425
this.lengthOffset = lengthOffset;
2526
}
2627

28+
public RadialEffect(Effect effect, int amount, float spacing, float lengthOffset){
29+
this(effect, amount, spacing, lengthOffset, 0f);
30+
}
31+
2732
@Override
2833
public void create(float x, float y, float rotation, Color color, Object data){
2934
if(!shouldCreate()) return;
3035

3136
rotation += rotationOffset;
3237

3338
for(int i = 0; i < amount; i++){
34-
effect.create(x + Angles.trnsx(rotation, lengthOffset), y + Angles.trnsy(rotation, lengthOffset), rotation, color, data);
39+
effect.create(x + Angles.trnsx(rotation, lengthOffset), y + Angles.trnsy(rotation, lengthOffset), rotation + effectRotationOffset, color, data);
3540
rotation += rotationSpacing;
3641
}
3742
}

core/src/mindustry/game/SectorInfo.java

+35-14
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ public class SectorInfo{
3030
public ObjectMap<Item, ExportStat> rawProduction = new ObjectMap<>();
3131
/** Export statistics. */
3232
public ObjectMap<Item, ExportStat> export = new ObjectMap<>();
33+
//TODO: there is an obvious exploit with launch pad redirection here; pads can be redirected after leaving a sector, which doesn't update calculations.
34+
/** Import statistics, based on what launch pads are actually receiving. TODO: this is not actually used or displayed anywhere (yet) */
35+
public ObjectMap<Item, ExportStat> imports = new ObjectMap<>();
3336
/** Items stored in all cores. */
3437
public ItemSeq items = new ItemSeq();
3538
/** The best available core type. */
@@ -118,10 +121,20 @@ public void handleItemExport(Item item, int amount){
118121
export.get(item, ExportStat::new).counter += amount;
119122
}
120123

124+
/** Updates import statistics. */
125+
public void handleItemImport(Item item, int amount){
126+
imports.get(item, ExportStat::new).counter += amount;
127+
}
128+
121129
public float getExport(Item item){
122130
return export.get(item, ExportStat::new).mean;
123131
}
124132

133+
public boolean hasExport(Item item){
134+
var exp = export.get(item);
135+
return exp != null && exp.mean > 0f;
136+
}
137+
125138
public void refreshImportRates(Planet planet){
126139
if(importRateCache == null || importRateCache.length != content.items().size){
127140
importRateCache = new float[content.items().size];
@@ -140,7 +153,7 @@ public float[] getImportRates(Planet planet){
140153
return importRateCache;
141154
}
142155

143-
/** @return the import rate of an item as item/second. */
156+
/** @return the import rate of an item as item/second. This is the *raw* max import rate, not what landing pads are actually using. */
144157
public float getImportRate(Planet planet, Item item){
145158
return getImportRates(planet)[item.id];
146159
}
@@ -239,19 +252,8 @@ public void update(){
239252
//refresh throughput
240253
if(time.get(refreshPeriod)){
241254

242-
//refresh export
243-
export.each((item, stat) -> {
244-
//initialize stat after loading
245-
if(!stat.loaded){
246-
stat.means.fill(stat.mean);
247-
stat.loaded = true;
248-
}
249-
250-
//add counter, subtract how many items were taken from the core during this time
251-
stat.means.add(Math.max(stat.counter, 0));
252-
stat.counter = 0;
253-
stat.mean = stat.means.rawMean();
254-
});
255+
updateStats(export);
256+
updateStats(imports);
255257

256258
if(coreDeltas == null) coreDeltas = new int[content.items().size];
257259
if(productionDeltas == null) productionDeltas = new int[content.items().size];
@@ -268,13 +270,32 @@ public void update(){
268270
//export can, at most, be the raw items being produced from factories + the items being taken from the core
269271
export.get(item).mean = Math.min(export.get(item).mean, rawProduction.get(item).mean + Math.max(-production.get(item).mean, 0));
270272
}
273+
274+
if(imports.containsKey(item)){
275+
//import can't exceed max import rate
276+
imports.get(item).mean = Math.min(imports.get(item).mean, getImportRate(state.getPlanet(), item));
277+
}
271278
}
272279

273280
Arrays.fill(coreDeltas, 0);
274281
Arrays.fill(productionDeltas, 0);
275282
}
276283
}
277284

285+
void updateStats(ObjectMap<Item, ExportStat> map){
286+
map.each((item, stat) -> {
287+
//initialize stat after loading
288+
if(!stat.loaded){
289+
stat.means.fill(stat.mean);
290+
stat.loaded = true;
291+
}
292+
293+
stat.means.add(Math.max(stat.counter, 0));
294+
stat.counter = 0;
295+
stat.mean = stat.means.rawMean();
296+
});
297+
}
298+
278299
void updateDelta(Item item, ObjectMap<Item, ExportStat> map, int[] deltas){
279300
ExportStat stat = map.get(item, ExportStat::new);
280301
if(!stat.loaded){

core/src/mindustry/graphics/Pal.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
public class Pal{
66
public static Color
77

8+
water = Color.valueOf("596ab8"),
89
darkOutline = Color.valueOf("2d2f39"),
910
thoriumPink = Color.valueOf("f9a3c7"),
1011
coalBlack = Color.valueOf("272727"),
@@ -107,7 +108,7 @@ public class Pal{
107108
redderDust = Color.valueOf("ff7b69"),
108109

109110
plasticSmoke = Color.valueOf("f1e479"),
110-
111+
111112
adminChat = Color.valueOf("ff4000"),
112113

113114
neoplasmOutline = Color.valueOf("2e191d"),

core/src/mindustry/ui/dialogs/PlanetDialog.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@ void showStats(Sector sector){
962962

963963
//import
964964
if(sector.hasBase()){
965-
displayItems(c, 1f, sector.info.importStats(sector.planet), "@sectors.import", t -> {
965+
displayItems(c, 1f, sector.info.imports, "@sectors.import", t -> {
966966
sector.info.eachImport(sector.planet, other -> {
967967
String ic = other.iconChar();
968968
t.add(Iconc.rightOpen + " " + (ic == null || ic.isEmpty() ? "" : ic + " ") + other.name()).padLeft(10f).row();

0 commit comments

Comments
 (0)