From f296d23cfabffa6524afe6c043efa91f2d714895 Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 16 Nov 2020 19:43:56 -0500 Subject: [PATCH] Bugfixes --- .../src/mindustry/android/AndroidLauncher.java | 2 +- core/assets/bundles/bundle.properties | 1 + core/assets/shaders/planet.vert | 4 ++-- core/src/mindustry/content/Planets.java | 2 ++ core/src/mindustry/content/SectorPresets.java | 2 +- core/src/mindustry/content/Weathers.java | 4 ++-- .../mindustry/entities/comp/BuildingComp.java | 2 ++ core/src/mindustry/graphics/Shaders.java | 4 ++-- .../src/mindustry/graphics/g3d/MeshBuilder.java | 2 -- .../mindustry/graphics/g3d/PlanetRenderer.java | 17 ++++++++++++++++- .../maps/generators/PlanetGenerator.java | 7 +++++++ .../maps/planet/SerpuloPlanetGenerator.java | 1 - core/src/mindustry/type/Planet.java | 4 +++- core/src/mindustry/type/Sector.java | 2 +- core/src/mindustry/ui/dialogs/PlanetDialog.java | 4 +++- .../src/mindustry/ui/fragments/HudFragment.java | 11 ++++++++--- gradle.properties | 2 +- 17 files changed, 52 insertions(+), 19 deletions(-) diff --git a/android/src/mindustry/android/AndroidLauncher.java b/android/src/mindustry/android/AndroidLauncher.java index d558e2542b..5084cbc67d 100644 --- a/android/src/mindustry/android/AndroidLauncher.java +++ b/android/src/mindustry/android/AndroidLauncher.java @@ -138,7 +138,7 @@ public class AndroidLauncher extends AndroidApplication{ if(open){ new FileChooser(title, file -> Structs.contains(extensions, file.extension().toLowerCase()), true, cons).show(); }else{ - super.showFileChooser(open, extension, cons); + super.showFileChooser(open, "@open", extension, cons); } } } diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index aee2e8e6fe..c63f22c407 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -544,6 +544,7 @@ sectors.select = Select sectors.nonelaunch = [lightgray]none (sun) sectors.rename = Rename Sector +sector.curcapture = Sector Captured sector.missingresources = [scarlet]Insufficient Core Resources sector.attacked = Sector [accent]{0}[white] under attack! sector.lost = Sector [accent]{0}[white] lost! diff --git a/core/assets/shaders/planet.vert b/core/assets/shaders/planet.vert index 4723e2bfff..182fe68972 100755 --- a/core/assets/shaders/planet.vert +++ b/core/assets/shaders/planet.vert @@ -17,9 +17,9 @@ const float shinelen = 0.2; void main(){ vec3 norc = u_ambientColor * (diffuse + vec3(clamp((dot(a_normal, u_lightdir) + 1.0) / 2.0, 0.0, 1.0))); float shinedot = max((-dot(u_camdir, a_normal) - (1.0 - shinelen)) / shinelen, 0.0); - float shinyness = (1.0 - a_color.a) * pow(shinedot, shinefalloff); + float albedo = (1.0 - a_color.a) * pow(shinedot, shinefalloff); vec4 baseCol = vec4(a_color.rgb, 1.0); - v_col = mix(baseCol * vec4(norc, 1.0), vec4(1.0), shinyness * norc.r); + v_col = mix(baseCol * vec4(norc, 1.0), vec4(1.0), albedo * norc.r); gl_Position = u_proj * u_trans * a_position; } diff --git a/core/src/mindustry/content/Planets.java b/core/src/mindustry/content/Planets.java index e07203313c..da7e05b7f5 100644 --- a/core/src/mindustry/content/Planets.java +++ b/core/src/mindustry/content/Planets.java @@ -36,6 +36,8 @@ public class Planets implements ContentList{ generator = new SerpuloPlanetGenerator(); meshLoader = () -> new HexMesh(this, 6); atmosphereColor = Color.valueOf("3c1b8f"); + atmosphereRadIn = 0.02f; + atmosphereRadOut = 0.3f; startSector = 15; }}; } diff --git a/core/src/mindustry/content/SectorPresets.java b/core/src/mindustry/content/SectorPresets.java index 52b96e66bf..c6add59963 100644 --- a/core/src/mindustry/content/SectorPresets.java +++ b/core/src/mindustry/content/SectorPresets.java @@ -41,7 +41,7 @@ public class SectorPresets implements ContentList{ difficulty = 2; }}; - ruinousShores = new SectorPreset("ruinousShores", serpulo, 19){{ + ruinousShores = new SectorPreset("ruinousShores", serpulo, 213){{ captureWave = 30; difficulty = 3; }}; diff --git a/core/src/mindustry/content/Weathers.java b/core/src/mindustry/content/Weathers.java index f719aa0cea..86dac06f7b 100644 --- a/core/src/mindustry/content/Weathers.java +++ b/core/src/mindustry/content/Weathers.java @@ -53,7 +53,7 @@ public class Weathers implements ContentList{ baseSpeed = 5.4f; attrs.set(Attribute.light, -0.1f); attrs.set(Attribute.water, -0.1f); - opacityMultiplier = 0.8f; + opacityMultiplier = 0.5f; force = 0.1f; sound = Sounds.wind; soundVol = 0.3f; @@ -74,7 +74,7 @@ public class Weathers implements ContentList{ attrs.set(Attribute.spores, 1f); attrs.set(Attribute.light, -0.15f); status = StatusEffects.sporeSlowed; - opacityMultiplier = 0.85f; + opacityMultiplier = 0.75f; force = 0.1f; sound = Sounds.wind; soundVol = 0.3f; diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index 087216cad2..9cfc87f5e9 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -1358,6 +1358,8 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, @Final @Override public void update(){ + if(state.isEditor()) return; + timeScaleDuration -= Time.delta; if(timeScaleDuration <= 0f || !block.canOverdrive){ timeScale = 1f; diff --git a/core/src/mindustry/graphics/Shaders.java b/core/src/mindustry/graphics/Shaders.java index cefb7b1bab..fbe0404b9f 100644 --- a/core/src/mindustry/graphics/Shaders.java +++ b/core/src/mindustry/graphics/Shaders.java @@ -71,8 +71,8 @@ public class Shaders{ setUniformf("u_rcampos", Tmp.v31.set(camera.position).sub(planet.position)); setUniformf("u_light", planet.getLightNormal()); setUniformf("u_color", planet.atmosphereColor.r, planet.atmosphereColor.g, planet.atmosphereColor.b); - setUniformf("u_innerRadius", planet.radius + 0.02f); - setUniformf("u_outerRadius", planet.radius * 1.3f); + setUniformf("u_innerRadius", planet.radius + planet.atmosphereRadIn); + setUniformf("u_outerRadius", planet.radius + planet.atmosphereRadOut); setUniformMatrix4("u_model", planet.getTransform(mat).val); setUniformMatrix4("u_projection", camera.combined.val); diff --git a/core/src/mindustry/graphics/g3d/MeshBuilder.java b/core/src/mindustry/graphics/g3d/MeshBuilder.java index c5550c7d70..89668e2858 100644 --- a/core/src/mindustry/graphics/g3d/MeshBuilder.java +++ b/core/src/mindustry/graphics/g3d/MeshBuilder.java @@ -77,8 +77,6 @@ public class MeshBuilder{ if(c.length > 5){ verts(c[0].v, c[4].v, c[5].v, nor, color); - }else{ - verts(c[0].v, c[3].v, c[4].v, nor, color); } } diff --git a/core/src/mindustry/graphics/g3d/PlanetRenderer.java b/core/src/mindustry/graphics/g3d/PlanetRenderer.java index 4294730f8b..708ae4cb22 100644 --- a/core/src/mindustry/graphics/g3d/PlanetRenderer.java +++ b/core/src/mindustry/graphics/g3d/PlanetRenderer.java @@ -57,6 +57,7 @@ public class PlanetRenderer implements Disposable{ camPos.set(0, 0f, camLength); projector.setScaling(1f / 150f); cam.fov = 60f; + cam.far = 150f; } /** Render the entire planet scene to the screen. */ @@ -93,6 +94,8 @@ public class PlanetRenderer implements Disposable{ renderPlanet(solarSystem); + renderTransparent(solarSystem); + endBloom(); Events.fire(Trigger.universeDrawEnd); @@ -125,11 +128,21 @@ public class PlanetRenderer implements Disposable{ renderOrbit(planet); + for(Planet child : planet.children){ + renderPlanet(child); + } + } + + public void renderTransparent(Planet planet){ + if(!planet.visible()) return; + if(planet.isLandable() && planet == this.planet){ renderSectors(planet); } if(planet.parent != null && planet.hasAtmosphere && Core.settings.getBool("atmosphere")){ + Gl.depthMask(false); + Blending.additive.apply(); Shaders.atmosphere.camera = cam; @@ -140,10 +153,12 @@ public class PlanetRenderer implements Disposable{ atmosphere.render(Shaders.atmosphere, Gl.triangles); Blending.normal.apply(); + + Gl.depthMask(true); } for(Planet child : planet.children){ - renderPlanet(child); + renderTransparent(child); } } diff --git a/core/src/mindustry/maps/generators/PlanetGenerator.java b/core/src/mindustry/maps/generators/PlanetGenerator.java index d6a37e2767..d1cfe30bf5 100644 --- a/core/src/mindustry/maps/generators/PlanetGenerator.java +++ b/core/src/mindustry/maps/generators/PlanetGenerator.java @@ -11,6 +11,7 @@ import mindustry.world.*; public abstract class PlanetGenerator extends BasicGenerator implements HexMesher{ protected IntSeq ints = new IntSeq(); protected Sector sector; + protected Simplex noise = new Simplex(); /** Should generate sector bases for a planet. */ public void generateSector(Sector sector){ @@ -46,6 +47,12 @@ public abstract class PlanetGenerator extends BasicGenerator implements HexMeshe } + @Override + protected float noise(float x, float y, double octaves, double falloff, double scl, double mag){ + Vec3 v = sector.rect.project(x, y); + return (float)noise.octaveNoise3D(octaves, falloff, 1f / scl, v.x, v.y, v.z) * (float)mag; + } + public void generate(Tiles tiles, Sector sec){ this.tiles = tiles; this.sector = sec; diff --git a/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java b/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java index 2239464a7b..0a49e1869d 100644 --- a/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java +++ b/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java @@ -16,7 +16,6 @@ import mindustry.world.*; import static mindustry.Vars.*; public class SerpuloPlanetGenerator extends PlanetGenerator{ - Simplex noise = new Simplex(); RidgedPerlin rid = new RidgedPerlin(1, 2); BaseGenerator basegen = new BaseGenerator(); float scl = 5f; diff --git a/core/src/mindustry/type/Planet.java b/core/src/mindustry/type/Planet.java index f61572f928..eb345baa38 100644 --- a/core/src/mindustry/type/Planet.java +++ b/core/src/mindustry/type/Planet.java @@ -18,7 +18,7 @@ import static mindustry.Vars.*; public class Planet extends UnlockableContent{ /** Default spacing between planet orbits in world units. */ - private static final float orbitSpacing = 10f; + private static final float orbitSpacing = 9f; /** intersect() temp var. */ private static final Vec3 intersectResult = new Vec3(); /** Mesh used for rendering. Created on load() - will be null on the server! */ @@ -33,6 +33,8 @@ public class Planet extends UnlockableContent{ public Seq sectors; /** Radius of this planet's sphere. Does not take into account sattelites. */ public float radius; + /** Atmosphere radius adjustment parameters. */ + public float atmosphereRadIn = 0, atmosphereRadOut = 0.3f; /** Orbital radius around the sun. Do not change unless you know exactly what you are doing.*/ public float orbitRadius; /** Total radius of this planet and all its children. */ diff --git a/core/src/mindustry/type/Sector.java b/core/src/mindustry/type/Sector.java index d2d1ee6dba..89b650dd83 100644 --- a/core/src/mindustry/type/Sector.java +++ b/core/src/mindustry/type/Sector.java @@ -103,7 +103,7 @@ public class Sector{ /** @return whether the enemy has a generated base here. */ public boolean hasEnemyBase(){ - return generateEnemyBase && (save == null || info.attack); + return ((generateEnemyBase && preset == null) || (preset != null && preset.captureWave == 0)) && (save == null || info.attack); } public boolean isBeingPlayed(){ diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index 217dfd4dc3..59b4de7be7 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -283,7 +283,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ } } - Sector current = state.getSector() != null && state.getSector().isBeingPlayed() ? state.getSector() : null; + Sector current = state.getSector() != null && state.getSector().isBeingPlayed() && state.getSector().planet == planets.planet ? state.getSector() : null; if(current != null){ planets.fill(current, hoverColor, -0.001f); @@ -418,6 +418,8 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ Planet planet = content.planets().get(i); if(planet.accessible){ pt.button(planet.localizedName, Styles.clearTogglet, () -> { + selected = null; + launchSector = null; renderer.planets.planet = planet; }).width(200).height(40).growX().update(bb -> bb.setChecked(renderer.planets.planet == planet)); pt.row(); diff --git a/core/src/mindustry/ui/fragments/HudFragment.java b/core/src/mindustry/ui/fragments/HudFragment.java index e3b0561c31..eb1fc2591f 100644 --- a/core/src/mindustry/ui/fragments/HudFragment.java +++ b/core/src/mindustry/ui/fragments/HudFragment.java @@ -749,6 +749,14 @@ public class HudFragment extends Fragment{ return builder; } + if(!state.rules.waves && state.isCampaign()){ + builder.append("[lightgray]").append(Core.bundle.get("sector.curcapture")); + } + + if(!state.rules.waves){ + return builder; + } + if(state.rules.winWave > 1 && state.rules.winWave >= state.wave && state.isCampaign()){ builder.append(wavefc.get(state.wave, state.rules.winWave)); }else{ @@ -774,9 +782,6 @@ public class HudFragment extends Fragment{ return builder; }).growX().pad(8f); - table.update(() -> { - //table.background(state.rules.waves ? Tex.wavepane : null); - }); table.touchable(() -> state.rules.waves ? Touchable.enabled : Touchable.disabled); return table; diff --git a/gradle.properties b/gradle.properties index 9d273aeadd..d9f1dd3bb8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xms256m -Xmx1024m -archash=079640f8ea3e46c1aff497f5f8a5e5f9c5197282 +archash=f1feed86eb643c2e5dbcee013b1b186644b5cf98