diff --git a/core/src/mindustry/core/Control.java b/core/src/mindustry/core/Control.java index 8dd487034b..8109bbcd7c 100644 --- a/core/src/mindustry/core/Control.java +++ b/core/src/mindustry/core/Control.java @@ -74,7 +74,7 @@ public class Control implements ApplicationListener, Loadable{ Events.on(WorldLoadEvent.class, event -> { if(Mathf.zero(player.x) && Mathf.zero(player.y)){ - Building core = state.teams.closestCore(0, 0, player.team()); + Building core = player.bestCore(); if(core != null){ player.set(core); camera.position.set(core); diff --git a/core/src/mindustry/core/Renderer.java b/core/src/mindustry/core/Renderer.java index 8f5423cbc1..7b812f03f9 100644 --- a/core/src/mindustry/core/Renderer.java +++ b/core/src/mindustry/core/Renderer.java @@ -15,6 +15,7 @@ import mindustry.gen.*; import mindustry.graphics.*; import mindustry.graphics.g3d.*; import mindustry.ui.*; +import mindustry.world.blocks.storage.CoreBlock.*; import static arc.Core.*; import static mindustry.Vars.*; @@ -36,6 +37,7 @@ public class Renderer implements ApplicationListener{ /** minZoom = zooming out, maxZoom = zooming in */ public float minZoom = 1.5f, maxZoom = 6f; + private @Nullable CoreBuild landCore; //TODO unused private FxProcessor fx = new FxProcessor(); private Color clearColor = new Color(0f, 0f, 0f, 1f); @@ -62,6 +64,10 @@ public class Renderer implements ApplicationListener{ if(settings.getBool("bloom", !ios)){ setupBloom(); } + + Events.on(WorldLoadEvent.class, e -> { + landCore = player.bestCore(); + }); } @Override @@ -284,25 +290,25 @@ public class Renderer implements ApplicationListener{ } private void drawLanding(){ - if(landTime > 0 && player.closestCore() != null){ + CoreBuild entity = landCore == null ? player.bestCore() : landCore; + if(landTime > 0 && entity != null){ float fract = landTime / Fx.coreLand.lifetime; - Building entity = player.closestCore(); TextureRegion reg = entity.block.icon(Cicon.full); float scl = Scl.scl(4f) / camerascale; float s = reg.width * Draw.scl * scl * 4f * fract; Draw.color(Pal.lightTrail); - Draw.rect("circle-shadow", entity.getX(), entity.getY(), s, s); + Draw.rect("circle-shadow", entity.x, entity.y, s, s); Angles.randLenVectors(1, (1f- fract), 100, 1000f * scl * (1f-fract), (x, y, fin, fout) -> { Lines.stroke(scl * fin); - Lines.lineAngle(entity.getX() + x, entity.getY() + y, Mathf.angle(x, y), (fin * 20 + 1f) * scl); + Lines.lineAngle(entity.x + x, entity.y + y, Mathf.angle(x, y), (fin * 20 + 1f) * scl); }); Draw.color(); Draw.mixcol(Color.white, fract); - Draw.rect(reg, entity.getX(), entity.getY(), reg.width * Draw.scl * scl, reg.height * Draw.scl * scl, fract * 135f); + Draw.rect(reg, entity.x, entity.y, reg.width * Draw.scl * scl, reg.height * Draw.scl * scl, fract * 135f); Draw.reset(); } diff --git a/gradle.properties b/gradle.properties index 581d1f703c..3700022ccb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xms256m -Xmx1024m -archash=78fdeeda71a4bb2d46e81d936beccf8727d95388 +archash=f89e6a465fe9d139bd192960c2ebdff33c2af86a