Skip to content

Commit

Permalink
Interplanetary Accelerator re-added with functionality (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
Anuken committed Jan 24, 2025
1 parent 8f5ecca commit 2253884
Show file tree
Hide file tree
Showing 13 changed files with 603 additions and 199 deletions.
3 changes: 3 additions & 0 deletions core/assets/bundles/bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,7 @@ sectors.stored = Stored:
sectors.resume = Resume
sectors.launch = Launch
sectors.select = Select
sectors.launchselect = Select Launch Destination
sectors.nonelaunch = [lightgray]none (sun)
sectors.rename = Rename Sector
sectors.enemybase = [scarlet]Enemy Base
Expand Down Expand Up @@ -1090,6 +1091,7 @@ ability.stat.buildtime = [stat]{0} sec[lightgray] build time

bar.onlycoredeposit = Only Core Depositing Allowed
bar.drilltierreq = Better Drill Required
bar.nobatterypower = Insufficieny Battery Power
bar.noresources = Missing Resources
bar.corereq = Core Base Required
bar.corefloor = Core Zone Tile Required
Expand All @@ -1098,6 +1100,7 @@ bar.drillspeed = Drill Speed: {0}/s
bar.pumpspeed = Pump Speed: {0}/s
bar.efficiency = Efficiency: {0}%
bar.boost = Boost: +{0}%
bar.powerbuffer = Battery Power: {0}/{1}
bar.powerbalance = Power: {0}/s
bar.powerstored = Stored: {0}/{1}
bar.poweramount = Power: {0}
Expand Down
3 changes: 2 additions & 1 deletion core/src/mindustry/content/Blocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -6362,8 +6362,9 @@ Items.surgeAlloy, new BasicBulletType(7f, 250){{
}};

interplanetaryAccelerator = new Accelerator("interplanetary-accelerator"){{
requirements(Category.effect, BuildVisibility.hidden, with(Items.copper, 16000, Items.silicon, 11000, Items.thorium, 13000, Items.titanium, 12000, Items.surgeAlloy, 6000, Items.phaseFabric, 5000));
requirements(Category.effect, BuildVisibility.campaignOnly, with(Items.copper, 16000, Items.silicon, 11000, Items.thorium, 13000, Items.titanium, 12000, Items.surgeAlloy, 6000, Items.phaseFabric, 5000));
researchCostMultiplier = 0.1f;
powerBufferRequirement = 1_000_000f;
size = 7;
hasPower = true;
consumePower(10f);
Expand Down
1 change: 1 addition & 0 deletions core/src/mindustry/content/Planets.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ public static void load(){
atmosphereRadOut = 0.3f;
startSector = 15;
alwaysUnlocked = true;
allowSelfSectorLaunch = true;
landCloudColor = Pal.spore.cpy().a(0.5f);
}};

Expand Down
5 changes: 2 additions & 3 deletions core/src/mindustry/content/SerpuloTechTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ public static void load(){
node(junction, () -> {
node(router, () -> {
node(launchPad, Seq.with(new SectorComplete(extractionOutpost)), () -> {
//no longer necessary to beat the campaign
//node(interplanetaryAccelerator, Seq.with(new SectorComplete(planetaryTerminal)), () -> {
node(interplanetaryAccelerator, Seq.with(new SectorComplete(planetaryTerminal)), () -> {

//});
});
});

node(distributor);
Expand Down
33 changes: 7 additions & 26 deletions core/src/mindustry/core/Renderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
import mindustry.graphics.g3d.*;
import mindustry.maps.*;
import mindustry.type.*;
import mindustry.world.blocks.storage.*;
import mindustry.world.blocks.storage.CoreBlock.*;
import mindustry.world.blocks.*;

import static arc.Core.*;
import static mindustry.Vars.*;
Expand Down Expand Up @@ -51,8 +50,7 @@ public class Renderer implements ApplicationListener{
public TextureRegion[][] fluidFrames;

//currently landing core, null if there are no cores or it has finished landing.
private @Nullable CoreBuild landCore;
private @Nullable CoreBlock launchCoreType;
private @Nullable LaunchAnimator landCore;
private Color clearColor = new Color(0f, 0f, 0f, 1f);
private float
//target camera scale that is lerp-ed to
Expand Down Expand Up @@ -379,7 +377,7 @@ public void draw(){
if(state.rules.fog) Draw.draw(Layer.fogOfWar, fog::drawFog);
Draw.draw(Layer.space, () -> {
if(landCore == null || landTime <= 0f) return;
landCore.drawLanding(launching && launchCoreType != null ? launchCoreType : (CoreBlock)landCore.block);
landCore.drawLanding();
});

Events.fire(Trigger.drawOver);
Expand Down Expand Up @@ -504,10 +502,6 @@ public boolean isLaunching(){
return launching;
}

public CoreBlock getLaunchCoreType(){
return launchCoreType;
}

public float getLandTime(){
return landTime;
}
Expand All @@ -527,43 +521,30 @@ public void setLandPTimer(float landPTimer){
this.landPTimer = landPTimer;
}

@Deprecated
public void showLanding(){
var core = player.bestCore();
if(core != null) showLanding(core);
}

public void showLanding(CoreBuild landCore){
public void showLanding(LaunchAnimator landCore){
this.landCore = landCore;
launching = false;
landTime = landCore.landDuration();

landCore.beginLaunch(null);
landCore.beginLaunch(false);
camerascale = landCore.zoomLaunching();
}

@Deprecated
public void showLaunch(CoreBlock coreType){
var core = player.team().core();
if(core != null) showLaunch(core, coreType);
}

public void showLaunch(CoreBuild landCore, CoreBlock coreType){
public void showLaunch(LaunchAnimator landCore){
control.input.config.hideConfig();
control.input.planConfig.hide();
control.input.inv.hide();

this.landCore = landCore;
launching = true;
landTime = landCore.landDuration();
launchCoreType = coreType;

Music music = landCore.launchMusic();
music.stop();
music.play();
music.setVolume(settings.getInt("musicvol") / 100f);

landCore.beginLaunch(coreType);
landCore.beginLaunch(true);
}

public void takeMapScreenshot(){
Expand Down
6 changes: 6 additions & 0 deletions core/src/mindustry/game/Universe.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import arc.util.*;
import mindustry.content.*;
import mindustry.game.EventType.*;
import mindustry.game.Schematic.*;
import mindustry.game.SectorInfo.*;
import mindustry.gen.*;
import mindustry.maps.*;
Expand Down Expand Up @@ -115,6 +116,11 @@ public void updateLaunchResources(ItemSeq stacks){
Core.settings.putJson("launch-resources-seq", lastLaunchResources);
}

/** Updates selected loadout for future deployment. Creates an empty schematic with a single core block. */
public void updateLoadout(CoreBlock block){
updateLoadout(block, new Schematic(Seq.with(new Stile(block, 0, 0, null, (byte)0)), new StringMap(), block.size, block.size));
}

/** Updates selected loadout for future deployment. */
public void updateLoadout(CoreBlock block, Schematic schem){
Core.settings.put("lastloadout-" + block.name, schem.file == null ? "" : schem.file.nameWithoutExtension());
Expand Down
7 changes: 6 additions & 1 deletion core/src/mindustry/maps/generators/PlanetGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void generateSector(Sector sector){
if(sector.planet.getSector(other).id == sector.planet.startSector){
return;
}

if(sector.planet.getSector(other).generateEnemyBase){
any = false;
break;
Expand All @@ -57,6 +57,11 @@ public boolean allowLanding(Sector sector){
return sector.planet.allowLaunchToNumbered && (sector.hasBase() || sector.near().contains(Sector::hasBase));
}

/** @return whether to allow landing on the specified procedural sector */
public boolean allowAcceleratorLanding(Sector sector){
return sector.planet.allowLaunchToNumbered;
}

public void addWeather(Sector sector, Rules rules){

//apply weather based on terrain
Expand Down
16 changes: 3 additions & 13 deletions core/src/mindustry/type/Planet.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,10 @@ public class Planet extends UnlockableContent{
public Seq<Planet> children = new Seq<>();
/** Default root node shown when the tech tree is opened here. */
public @Nullable TechNode techTree;
/** TODO remove? Planets that can be launched to from this one. Made mutual in init(). */
/** Planets that can be launched to from this one. */
public Seq<Planet> launchCandidates = new Seq<>();
/** Whether interplanetary accelerators can launch to 'any' procedural sector on this planet's surface. */
public boolean allowSelfSectorLaunch;
/** If true, all content in this planet's tech tree will be assigned this planet in their shownPlanets. */
public boolean autoAssignPlanet = true;
/** Content (usually planet-specific) that is unlocked upon landing here. */
Expand Down Expand Up @@ -383,18 +385,6 @@ public void init(){
updateBaseCoverage();
}

//make planet launch candidates mutual.
var candidates = launchCandidates.copy();

for(Planet planet : content.planets()){
if(planet.launchCandidates.contains(this)){
candidates.addUnique(planet);
}
}

//TODO currently, mutual launch candidates are simply a nuisance.
//launchCandidates = candidates;

clipRadius = Math.max(clipRadius, radius + atmosphereRadOut + 0.5f);
}

Expand Down
Loading

0 comments on commit 2253884

Please sign in to comment.