Proper interplanetary launch

This commit is contained in:
Anuken 2022-01-23 14:37:08 -05:00
parent 3574e40a08
commit 4497f7ab3a
11 changed files with 66 additions and 9 deletions

View File

@ -672,7 +672,7 @@ sector.extractionOutpost.description = A remote outpost, constructed by the enem
sector.impact0078.description = Here lie remnants of the interstellar transport vessel that first entered this system.\n\nSalvage as much as possible from the wreckage. Research any intact technology.
sector.planetaryTerminal.description = The final target.\n\nThis coastal base contains a structure capable of launching Cores to local planets. It is extremely well guarded.\n\nProduce naval units. Eliminate the enemy as quickly as possible. Research the launch structure.
sector.onset.name = Onset
sector.onset.name = The Onset
status.burning.name = Burning
status.freezing.name = Freezing

View File

@ -34,6 +34,11 @@ public class GroundAI extends AIController{
if(spawner == null && core == null) move = false;
}
//no reason to move if there's nothing there
if(core == null && (!state.rules.waves || getClosestSpawner() == null)){
move = false;
}
if(move) pathfind(Pathfinder.fieldCore);
}

View File

@ -16,6 +16,7 @@ public class ErekirTechTree{
var costMultipliers = new ObjectFloatMap<Item>();
costMultipliers.put(Items.silicon, 7);
costMultipliers.put(Items.surgeAlloy, 4);
costMultipliers.put(Items.phaseFabric, 4);
costMultipliers.put(Items.thorium, 8);
costMultipliers.put(Items.graphite, 6);

View File

@ -1,6 +1,7 @@
package mindustry.content;
import arc.graphics.*;
import arc.struct.*;
import mindustry.type.*;
public class Items{
@ -9,6 +10,9 @@ public class Items{
phaseFabric, surgeAlloy, sporePod, sand, blastCompound, pyratite, metaglass,
beryllium, tungsten, oxide, carbide, fissileMatter, dormantCyst;
//TODO remove, these are for debugging only
public static final Seq<Item> serpuloItems = new Seq<>(), erekirItems = new Seq<>();
public static void load(){
copper = new Item("copper", Color.valueOf("d99d73")){{
hardness = 1;
@ -124,5 +128,15 @@ public class Items{
dormantCyst = new Item("dormant-cyst", Color.valueOf("df824d")){{
flammability = 0.1f;
}};
serpuloItems.addAll(
scrap, copper, lead, graphite, coal, titanium, thorium, silicon, plastanium,
phaseFabric, surgeAlloy, sporePod, sand, blastCompound, pyratite, metaglass
);
erekirItems.addAll(
scrap, graphite, thorium, silicon, phaseFabric, surgeAlloy, sand,
beryllium, tungsten, oxide, carbide, fissileMatter, dormantCyst
);
}
}

View File

@ -1,6 +1,7 @@
package mindustry.content;
import arc.*;
import arc.func.*;
import arc.scene.style.*;
import arc.struct.*;
import arc.util.*;
@ -140,6 +141,14 @@ public class TechTree{
all.add(this);
}
/** Recursively iterates through everything that is a child of this node. Includes itself. */
public void each(Cons<TechNode> consumer){
consumer.get(this);
for(var child : children){
child.each(consumer);
}
}
public Drawable icon(){
return icon == null ? new TextureRegionDrawable(content.uiIcon) : icon;
}

View File

@ -76,6 +76,14 @@ public class MobileInput extends InputHandler implements GestureListener{
/** Control building last tapped. */
public @Nullable Building buildingTapped;
{
Events.on(UnitDestroyEvent.class, e -> {
if(e.unit != null && e.unit.isPlayer() && e.unit.getPlayer().isLocal() && e.unit.type.weapons.contains(w -> w.bullet.killShooter)){
manualShooting = false;
}
});
}
//region utility methods
/** Check and assign targets for a specific position. */

View File

@ -247,7 +247,7 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
}
//TODO test, different placement
//TODO this biome should have more blocks in gneeral
//TODO this biome should have more blocks in general
if(block == Blocks.regolithWall && rand.chance(0.2) && nearAir(x, y) && !near(x, y, 3, Blocks.crystalBlocks)){
block = Blocks.crystalBlocks;
}
@ -294,7 +294,7 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
//it is very hot
state.rules.attributes.set(Attribute.heat, 0.8f);
state.rules.environment = Env.scorching | Env.terrestrial | Env.groundWater;
state.rules.environment = Env.scorching | Env.terrestrial;
Schematics.placeLaunchLoadout(spawnX, spawnY);
state.rules.showSpawns = true;

View File

@ -82,13 +82,13 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
any = true;
}
if(Structs.contains(tile.tiles, s -> sector.planet.getSector(s).id == sector.planet.startSector)) return;
if(noise < 0.16){
for(Ptile other : tile.tiles){
var osec = sector.planet.getSector(other);
//no sectors near start sector!
if(
osec.id == sector.planet.startSector || //near starting sector
osec.generateEnemyBase && poles < 0.85 || //near other base
(sector.preset != null && noise < 0.11) //near preset
){

View File

@ -176,6 +176,10 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
settings.put("lastplanet", state.planet.name);
}
if(!selectable(state.planet)){
state.planet = Planets.serpulo;
}
rebuildButtons();
mode = look;
state.otherCamPos = null;
@ -255,7 +259,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
dialog.add("@sectors.captured");
}
//TODO unimplemented, cutscene needed
//TODO not fully implemented, cutscene needed
public void showPlanetLaunch(Sector sector, Cons<Sector> listener){
selected = null;
hovered = null;
@ -263,11 +267,20 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
this.listener = listener;
launchSector = sector;
//automatically select next planets; TODO pan!
//automatically select next planets;
if(sector.planet.launchCandidates.size == 1){
state.planet = sector.planet.launchCandidates.first();
state.otherCamPos = sector.planet.position;
state.otherCamAlpha = 0f;
//unlock and highlight sector
var destSec = state.planet.sectors.get(state.planet.startSector);
var preset = destSec.preset;
if(preset != null){
preset.unlock();
}
selected = destSec;
updateSelected();
}
//TODO pan over to correct planet
@ -471,7 +484,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
//TODO what if any sector is selectable?
//TODO launch criteria - which planets can be launched to? Where should this be defined? Should planets even be selectable?
if(mode == planetLaunch) return launchSector != null && planet != launchSector.planet && launchSector.planet.launchCandidates.contains(planet);
return planet == state.planet || (planet.alwaysUnlocked && planet.isLandable()) || planet.sectors.contains(Sector::hasBase);
return (planet.alwaysUnlocked && planet.isLandable()) || planet.sectors.contains(Sector::hasBase);
}
void setup(){
@ -690,6 +703,9 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
state.camPos.set(Tmp.v31.set(state.otherCamPos).lerp(state.planet.position, state.otherCamAlpha).add(state.camPos).sub(state.planet.position));
state.otherCamPos = null;
//announce new sector
newPresets.add(state.planet.sectors.get(state.planet.startSector));
}
}

View File

@ -116,6 +116,7 @@ public class SettingsMenuDialog extends BaseDialog{
t.button("@settings.clearresearch", Icon.trash, style, () -> {
ui.showConfirm("@confirm", "@settings.clearresearch.confirm", () -> {
Core.settings.put("lastplanet", "serpulo");
universe.clearLoadoutInfo();
for(TechNode node : TechTree.all){
node.reset();

View File

@ -81,7 +81,10 @@ public class ItemSource extends Block{
while(counter >= limit){
items.set(outputItem, 1);
dump(outputItem);
if(dump(outputItem)){
//for debugging only
produced(outputItem);
}
items.set(outputItem, 0);
counter -= limit;
}