Enable full customization of core launching/landing animations. (#9693)

* Extract all updates and draws of core launch/land animations to CoreBlock/CoreBuild

* Re-add removed methods as deprecated

* Fixed tests failing

* anuke said no

* Extract launch effect
This commit is contained in:
GlFolker
2024-04-01 21:46:44 +07:00
committed by GitHub
parent 1f5d8b1f04
commit bfd8dbd769
6 changed files with 221 additions and 138 deletions

View File

@@ -35,6 +35,7 @@ import mindustry.maps.*;
import mindustry.type.*;
import mindustry.ui.*;
import mindustry.world.blocks.storage.*;
import mindustry.world.blocks.storage.CoreBlock.*;
import static arc.Core.*;
import static mindustry.Vars.*;
@@ -1244,7 +1245,8 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
Events.fire(new SectorLaunchLoadoutEvent(sector, from, loadout));
if(settings.getBool("skipcoreanimation")){
CoreBuild core = player.team().core();
if(core == null || settings.getBool("skipcoreanimation")){
//just... go there
control.playSector(from, sector);
//hide only after load screen is shown
@@ -1256,9 +1258,9 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
//allow planet dialog to finish hiding before actually launching
Time.runTask(5f, () -> {
Runnable doLaunch = () -> {
renderer.showLaunch(schemCore);
renderer.showLaunch(core, schemCore);
//run with less delay, as the loading animation is delayed by several frames
Time.runTask(coreLandDuration - 8f, () -> control.playSector(from, sector));
Time.runTask(core.landDuration() - 8f, () -> control.playSector(from, sector));
};
//load launchFrom sector right before launching so animation is correct
@@ -1276,7 +1278,6 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
}else if(mode == select){
listener.get(sector);
}else if(mode == planetLaunch){ //TODO make sure it doesn't have a base already.
//TODO animation
//schematic selection and cost handled by listener
listener.get(sector);