Tree-like objective node structure (#7152)

* overall structure

* overall layout

* field interpreter

* less bloated UI

* scroll pan't

* strip off the 'Marker' suffix

* e

* all (hopefully all...) interpreters finished.

* onset

* two, four

* i don't understand how icon mappings work.

* separate remover and indexer

* some cleanups

* untested mobile support

* contrib

* ok anuke

* fix conflicts 2

* hidden
This commit is contained in:
GlennFolker
2022-07-15 21:41:18 +07:00
committed by GitHub
parent 3b1c8baca9
commit 695c19d0b0
26 changed files with 1733 additions and 810 deletions

View File

@@ -1,8 +1,8 @@
package mindustry.content;
import arc.math.geom.*;
import mindustry.game.MapObjectives.*;
import mindustry.game.*;
import mindustry.game.MapObjectives.*;
import mindustry.graphics.*;
import mindustry.type.*;
@@ -115,102 +115,18 @@ public class SectorPresets{
addStartingItems = true;
alwaysUnlocked = true;
difficulty = 1;
rules = r -> {
r.objectives.addAll(
new ItemObjective(Items.beryllium, 15).withMarkers(
new ShapeTextMarker("Click to mine [accent]resources[] from walls.", 290f * 8f, 106f * 8f)
),
new BuildCountObjective(Blocks.turbineCondenser, 1).withMarkers(
new ShapeTextMarker("Open the tech tree.\nResearch, then place a [accent]turbine condenser[] on the vent.\nThis will generate [accent]power[].", 289f * 8f, 116f * 8f, 8f * 2.6f, 0f, 9f)
),
new BuildCountObjective(Blocks.plasmaBore, 1).withMarkers(
new ShapeTextMarker("Research and place a [accent]plasma bore[]. \nThis automatically mines resources from walls.", 293.5f * 8f, 113.5f * 8f, 4f * 2.6f, 45f, 60f)
),
new BuildCountObjective(Blocks.beamNode, 1).withMarkers(
new ShapeTextMarker("To [accent]power[] the plasma bore, research and place a [accent]beam node[].\nConnect the turbine condenser to the plasma bore.", 294f * 8f, 116f * 8f)
),
new CoreItemObjective(Items.beryllium, 5).withMarkers(
new TextMarker("Research and place [accent]ducts[] to move the mined resources\nfrom the plasma bore to the core.", 285f * 8f, 108f * 8f)
),
new CoreItemObjective(Items.beryllium, 200).withMarkers(
new TextMarker("Expand the mining operation.\nPlace more Plasma Bores and use beam nodes and ducts to support them.\nMine 200 beryllium.", 280f * 8f, 118f * 8f)
),
new CoreItemObjective(Items.graphite, 100).withMarkers(
new TextMarker("More complex blocks require [accent]graphite[].\nSet up plasma bores to mine graphite.", 261f * 8f, 108f * 8f)
),
new ResearchObjective(Blocks.siliconArcFurnace).withMarkers(
new TextMarker("Begin researching [accent]factories[].\nResearch the [accent]cliff crusher[] and [accent]silicon arc furnace[].", 268f * 8f, 101f * 8f)
),
new CoreItemObjective(Items.silicon, 50).withMarkers(
new TextMarker("The arc furnace needs [accent]sand[] and [accent]graphite[] to create [accent]silicon[].\n[accent]Power[] is also required.", 268f * 8f, 101f * 8f),
new TextMarker("Use [accent]cliff crushers[] to mine sand.", 262f * 8f, 88f * 8f)
),
new BuildCountObjective(Blocks.tankFabricator, 1).withMarkers(
new TextMarker("Use [accent]units[] to explore the map, defend buildings, and go on the offensive.\n Research and place a [accent]tank fabricator[].", 258f * 8f, 116f * 8f)
),
new UnitCountObjective(UnitTypes.stell, 1).withMarkers(
new TextMarker("Produce a unit.\nUse the \"?\" button to see selected factory requirements.", 258f * 8f, 116f * 8f)
),
new CommandModeObjective().withMarkers(
new TextMarker("Hold [accent]shift[] to enter [accent]command mode[].\n[accent]Left-click and drag[] to select units.\n[accent]Right-click[] to order selected units to move or attack.", 258f * 8f, 116f * 8f)
),
new BuildCountObjective(Blocks.breach, 1).withMarkers(
new TextMarker("Units are effective, but [accent]turrets[] provide better defensive capabilities if used effectively.\n Place a [accent]Breach[] turret.\nTurrets require [accent]ammo[].", 258f * 8f, 114f * 8f)
),
new BuildCountObjective(Blocks.berylliumWall, 6).withMarkers(
new TextMarker("[accent]Walls[] can prevent oncoming damage from reaching buildings.\nPlace some [accent]beryllium walls[] around the turret.", 276f * 8f, 133f * 8f)
),
new TimerObjective("@objective.enemiesapproaching",30 * 60).withMarkers(
new TextMarker("Enemy incoming, prepare to defend.", 276f * 8f, 133f * 8f)
).withFlags("defStart"),
new DestroyUnitsObjective(2).withFlags("defDone"),
new DestroyBlockObjective(Blocks.coreBastion , 288, 198, Team.malis).withMarkers(
new TextMarker("The enemy is vulnerable. Counter-attack.", 276f * 8f, 133f * 8f)
),
new BuildCountObjective(Blocks.coreBastion, 1).withMarkers(
new ShapeTextMarker("New cores can be placed on [accent]core tiles[].\nNew cores function as forward bases and share a resource inventory with other cores.\nPlace a core.", 287.5f * 8f, 197.5f * 8f, 9f * 2.6f, 0f, 12f)
),
new TimerObjective("[accent]Set up defenses:[lightgray] {0}", 120 * 60).withMarkers(
new TextMarker("The enemy will be able to detect you in 2 minutes.\nSet up defenses, mining, and production.", 288f * 8f, 202f * 8f)
).withFlags("openMap")
);
};
}};
two = new SectorPreset("two", erekir, 88){{
difficulty = 3;
rules = r -> {
r.objectives.addAll(
new TimerObjective("[lightgray]Enemy detection:[] [accent]{0}", 7 * 60 * 60).withMarkers(
new TextMarker("The enemy will begin constructing units in 7 minutes.", 276f * 8f, 164f * 8f)
).withFlags("beginBuilding"),
new ProduceObjective(Items.tungsten).withMarkers(
new ShapeTextMarker("Tungsten can be mined using an [accent]impact drill[].\nThis structure requires [accent]water[] and [accent]power[].", 220f * 8f, 181f * 8f)
),
new DestroyBlockObjective(Blocks.largeShieldProjector, 210, 278, Team.malis).withMarkers(
new TextMarker("The enemy is protected by shields.\nAn experimental shield breaker module has been detected in this sector.\nFind and activate it using tungsten.", 276f * 8f, 164f * 8f),
new MinimapMarker(23, 137, Pal.accent)
)
);
};
}};
lake = new SectorPreset("lake", erekir, 41){{
difficulty = 4;
rules = r -> {
r.objectives.addAll(
new BuildCountObjective(Blocks.shipFabricator, 1),
new UnitCountObjective(UnitTypes.elude, 1)
);
};
}};
three = new SectorPreset("three", erekir, 36){{
difficulty = 5;
captureWave = 9;
}};
@@ -220,47 +136,10 @@ public class SectorPresets{
split = new SectorPreset("split", erekir, 19){{ //TODO random sector, pick a better one
difficulty = 5;
rules = r -> {
r.objectives.addAll(
new CoreItemObjective(Items.tungsten, 100).withMarkers(
new TextMarker("Some blocks can be picked up by the core unit.\nPick up this [accent]container[] and place it onto the [accent]payload loader[].\n(Default keys are [ and ] to pick up and drop)", 347 * 8f, 445f * 8f),
new TextMarker("You must acquire some tungsten to build units.", 293 * 8f, 417 * 8f)
),
new BuildCountObjective(Blocks.payloadMassDriver, 2).withMarkers(
new TextMarker("Units must be transported to the other side of the wall.\nPlace two [accent]Payload Mass Drivers[], one on each side of the wall.\nSet up the link by pressing one of them, then selecting the other.", 293 * 8f, 417 * 8f)
),
new DestroyCoreObjective().withMarkers(
new TextMarker("Similar to the container, units can also be transported using a [accent]Payload Mass Driver[].\nPlace a unit fabricator adjacent to a mass driver to load them, then send them across the wall to attack the enemy base.", 293 * 8f, 417 * 8f)
)
);
};
}};
four = new SectorPreset("four", erekir, 29){{
difficulty = 6;
rules = r -> {
float rad = 52f;
r.objectives.addAll(
new DestroyBlocksObjective(Blocks.coreBastion, Team.malis, Point2.pack(290,501), Point2.pack(158,496))
.withFlags("nukeannounce"),
new TimerObjective("@objective.nuclearlaunch", 8 * 60 * 60).withMarkers(
new MinimapMarker(338, 377, rad, 14f, Pal.remove),
new ShapeMarker(338 * 8, 377 * 8f){{
radius = rad * 8f;
fill = true;
color = Pal.remove.cpy().mul(0.8f).a(0.3f);
sides = 90;
}},
new ShapeMarker(338 * 8, 377 * 8f){{
radius = rad * 8f;
color = Pal.remove;
sides = 90;
}}
).withFlags("nuke1")
);
};
}};
//endregion