diff --git a/core/assets/planets/TODO.dat b/core/assets/planets/TODO.dat index d2d0e1b30a..e8220fa481 100644 Binary files a/core/assets/planets/TODO.dat and b/core/assets/planets/TODO.dat differ diff --git a/core/src/mindustry/content/Weathers.java b/core/src/mindustry/content/Weathers.java index 5cb687d0e8..f6a07a846f 100644 --- a/core/src/mindustry/content/Weathers.java +++ b/core/src/mindustry/content/Weathers.java @@ -4,6 +4,7 @@ import arc.*; import arc.graphics.*; import arc.graphics.g2d.*; import arc.math.*; +import arc.math.geom.*; import arc.util.*; import mindustry.ctype.*; import mindustry.gen.*; @@ -15,7 +16,8 @@ import static mindustry.Vars.*; public class Weathers implements ContentList{ public static Weather rain, - snow; + snow, + sandstorm; @Override public void load(){ @@ -152,5 +154,58 @@ public class Weathers implements ContentList{ } } }; + + sandstorm = new Weather("sandstorm"){ + TextureRegion region; + float yspeed = 0.3f, xspeed = 6f, padding = 110f, size = 110f, invDensity = 800f; + Vec2 force = new Vec2(0.35f, 0.01f); + Color color = Color.valueOf("f7cba4"); + + @Override + public void load(){ + super.load(); + + region = Core.atlas.find("circle-shadow"); + } + + @Override + public void drawOver(Weatherc state){ + rand.setSeed(0); + Tmp.r1.setCentered(Core.camera.position.x, Core.camera.position.y, Core.graphics.getWidth() / renderer.minScale(), Core.graphics.getHeight() / renderer.minScale()); + Tmp.r1.grow(padding); + Core.camera.bounds(Tmp.r2); + int total = (int)(Tmp.r1.area() / invDensity * state.intensity()); + Draw.tint(color); + float baseAlpha = Draw.getColor().a; + + for(Unitc unit : Groups.unit){ + unit.impulse(force.x * state.intensity(), force.y * state.intensity()); + } + + for(int i = 0; i < total; i++){ + float scl = rand.random(0.5f, 1f); + float scl2 = rand.random(0.5f, 1f); + float sscl = rand.random(0.5f, 1f); + float x = (rand.random(0f, world.unitWidth()) + Time.time() * xspeed * scl2); + float y = (rand.random(0f, world.unitHeight()) - Time.time() * yspeed * scl); + float alpha = rand.random(0.2f); + + x += Mathf.sin(y, rand.random(30f, 80f), rand.random(1f, 7f)); + + x -= Tmp.r1.x; + y -= Tmp.r1.y; + x = Mathf.mod(x, Tmp.r1.width); + y = Mathf.mod(y, Tmp.r1.height); + x += Tmp.r1.x; + y += Tmp.r1.y; + + if(Tmp.r3.setCentered(x, y, size * sscl).overlaps(Tmp.r2)){ + Draw.alpha(alpha * baseAlpha); + //Fill.circle(x, y, size * sscl / 2f); + Draw.rect(region, x, y, size * sscl, size * sscl); + } + } + } + }; } } diff --git a/core/src/mindustry/core/World.java b/core/src/mindustry/core/World.java index d1b52e3391..415619bf94 100644 --- a/core/src/mindustry/core/World.java +++ b/core/src/mindustry/core/World.java @@ -257,13 +257,10 @@ public class World{ state.rules.weather.clear(); - if(sector.is(SectorAttribute.rainy)){ - state.rules.weather.add(new WeatherEntry(Weathers.rain)); - } + if(sector.is(SectorAttribute.rainy)) state.rules.weather.add(new WeatherEntry(Weathers.rain)); + if(sector.is(SectorAttribute.snowy)) state.rules.weather.add(new WeatherEntry(Weathers.snow)); + if(sector.is(SectorAttribute.desert)) state.rules.weather.add(new WeatherEntry(Weathers.sandstorm)); - if(sector.is(SectorAttribute.snowy)){ - state.rules.weather.add(new WeatherEntry(Weathers.snow)); - } } public Context filterContext(Map map){ diff --git a/core/src/mindustry/maps/generators/BaseGenerator.java b/core/src/mindustry/maps/generators/BaseGenerator.java index 80e87f0108..db507d2239 100644 --- a/core/src/mindustry/maps/generators/BaseGenerator.java +++ b/core/src/mindustry/maps/generators/BaseGenerator.java @@ -32,6 +32,10 @@ public class BaseGenerator{ this.tiles = tiles; this.team = team; this.cores = cores; + + //don't generate bases when there are no loaded schematics + if(bases.cores.isEmpty()) return; + Mathf.random.setSeed(sector.id); for(Block block : content.blocks()){ diff --git a/core/src/mindustry/type/Sector.java b/core/src/mindustry/type/Sector.java index 7847333d29..db1389fe6a 100644 --- a/core/src/mindustry/type/Sector.java +++ b/core/src/mindustry/type/Sector.java @@ -241,6 +241,8 @@ public class Sector{ /** Has rain. */ rainy, /** Has snow. */ - snowy + snowy, + /** Has sandstorms. */ + desert } } diff --git a/tools/src/mindustry/tools/SectorDataGenerator.java b/tools/src/mindustry/tools/SectorDataGenerator.java index 84c2e56263..e0c4828280 100644 --- a/tools/src/mindustry/tools/SectorDataGenerator.java +++ b/tools/src/mindustry/tools/SectorDataGenerator.java @@ -1,6 +1,7 @@ package mindustry.tools; import arc.*; +import arc.backend.headless.mock.*; import arc.files.*; import arc.mock.*; import arc.struct.*; @@ -27,6 +28,7 @@ public class SectorDataGenerator{ Core.files = new MockFiles(); Core.app = new MockApplication(); Core.settings = new MockSettings(); + Core.graphics = new MockGraphics(); headless = true; net = new Net(null); @@ -121,6 +123,7 @@ public class SectorDataGenerator{ //TODO bad code boolean hasSnow = data.floors[0].name.contains("ice") || data.floors[0].name.contains("snow"); boolean hasRain = !hasSnow && data.floors[0].name.contains("water"); + boolean hasDesert = !hasSnow && !hasRain && data.floors[0].name.contains("sand"); if(hasSnow){ data.attributes |= (1 << SectorAttribute.snowy.ordinal()); @@ -130,6 +133,10 @@ public class SectorDataGenerator{ data.attributes |= (1 << SectorAttribute.rainy.ordinal()); } + if(hasDesert){ + data.attributes |= (1 << SectorAttribute.desert.ordinal()); + } + data.resources = content.asArray().sort(Structs.comps(Structs.comparing(Content::getContentType), Structs.comparingInt(c -> c.id))).toArray(UnlockableContent.class); //50% water -> naval attribute