Fixed logic IDs not loading / Accelerator animation tweaks

This commit is contained in:
Anuken
2025-02-08 16:04:04 -05:00
parent f8b6600fe7
commit ebaf88e80d
3 changed files with 21 additions and 6 deletions

View File

@@ -23,6 +23,7 @@ import static mindustry.Vars.*;
public class GlobalVars{
public static final int ctrlProcessor = 1, ctrlPlayer = 2, ctrlCommand = 3;
public static final ContentType[] lookableContent = {ContentType.block, ContentType.unit, ContentType.item, ContentType.liquid, ContentType.team};
public static final ContentType[] writableLookableContent = {ContentType.block, ContentType.unit, ContentType.item, ContentType.liquid};
/** Global random state. */
public static final Rand rand = new Rand();
@@ -155,7 +156,7 @@ public class GlobalVars{
if(ids.exists()){
//read logic ID mapping data (generated in ImagePacker)
try(DataInputStream in = new DataInputStream(ids.readByteStream())){
for(ContentType ctype : lookableContent){
for(ContentType ctype : writableLookableContent){
short amount = in.readShort();
logicIdToContent[ctype.ordinal()] = new UnlockableContent[amount];
contentIdToLogicId[ctype.ordinal()] = new int[Vars.content.getBy(ctype).size];

View File

@@ -111,6 +111,7 @@ public class Accelerator extends Block{
public float progress;
public float time, launchHeat;
public boolean launching;
public float launchTime;
protected float cloudSeed;
@@ -156,7 +157,18 @@ public class Accelerator extends Block{
{
if(launching){
Draw.reset();
Draw.blend(Blending.additive);
Fill.light(x, y, 15, launchBlock.size * tilesize * 1f, Tmp.c2.set(Pal.accent).a(launchTime / chargeDuration), Tmp.c1.set(Pal.accent).a(0f));
Draw.blend();
Draw.rect(launchBlock.fullIcon, x, y);
Draw.z(Layer.bullet);
Draw.mixcol(Pal.accent, Mathf.clamp(launchTime / chargeDuration));
Draw.color(1f, 1f, 1f, Interp.pow2In.apply(Mathf.clamp(launchTime / chargeDuration * 0.7f)));
Draw.rect(launchBlock.fullIcon, x, y);
Draw.reset();
}else{
Drawf.shadow(x, y, launchBlock.size * tilesize * 2f, progress);
Draw.draw(Layer.blockBuilding, () -> {
@@ -175,7 +187,6 @@ public class Accelerator extends Block{
});
}
Draw.reset();
}
@@ -366,13 +377,15 @@ public class Accelerator extends Block{
@Override
public void endLaunch(){
launching = false;
launchTime = 0f;
}
@Override
public float zoomLaunch(){
float rawTime = launchDuration() - renderer.getLandTime();
float shake = rawTime < chargeDuration ? Interp.pow10In.apply(Mathf.clamp(rawTime/chargeDuration)) : 0f;
Core.camera.position.set(this);
Core.camera.position.set(x, y).add(Tmp.v1.setToRandomDirection().scl(shake * 2f));
if(rawTime < chargeDuration){
float fin = rawTime / chargeDuration;
@@ -389,6 +402,7 @@ public class Accelerator extends Block{
@Override
public void updateLaunch(){
float in = renderer.getLandTimeIn() * launchDuration();
launchTime = launchDuration() - in;
float tsize = Mathf.sample(CoreBlock.thrusterSizes, (in + 35f) / launchDuration());
float rawFin = renderer.getLandTimeIn();