diff --git a/annotations/src/main/java/mindustry/annotations/Annotations.java b/annotations/src/main/java/mindustry/annotations/Annotations.java index c4ba024d88..95bd2b2a4a 100644 --- a/annotations/src/main/java/mindustry/annotations/Annotations.java +++ b/annotations/src/main/java/mindustry/annotations/Annotations.java @@ -17,6 +17,7 @@ public class Annotations{ effects, overlays, names, + weather } /** Indicates that a method overrides other methods. */ diff --git a/annotations/src/main/resources/classids.properties b/annotations/src/main/resources/classids.properties index 94cf6c6685..87a75e0f14 100644 --- a/annotations/src/main/resources/classids.properties +++ b/annotations/src/main/resources/classids.properties @@ -10,6 +10,7 @@ mindustry.entities.def.PlayerComp=5 mindustry.entities.def.PuddleComp=6 mindustry.entities.def.StandardEffectComp=7 mindustry.entities.def.TileComp=8 +mindustry.type.Weather.WeatherComp=13 phantom=11 spirit=12 vanguard=9 \ No newline at end of file diff --git a/annotations/src/main/resources/revisions/WeatherEntity/0.json b/annotations/src/main/resources/revisions/WeatherEntity/0.json new file mode 100644 index 0000000000..eaaaeead96 --- /dev/null +++ b/annotations/src/main/resources/revisions/WeatherEntity/0.json @@ -0,0 +1 @@ +{fields:[]} \ No newline at end of file diff --git a/annotations/src/main/resources/revisions/WeatherEntity/1.json b/annotations/src/main/resources/revisions/WeatherEntity/1.json new file mode 100644 index 0000000000..254fbf608c --- /dev/null +++ b/annotations/src/main/resources/revisions/WeatherEntity/1.json @@ -0,0 +1 @@ +{version:1,fields:[{name:x,type:float,size:4},{name:y,type:float,size:4}]} \ No newline at end of file diff --git a/core/assets-raw/sprites/effects/particle.png b/core/assets-raw/sprites/effects/particle.png new file mode 100644 index 0000000000..dabcbab9a9 Binary files /dev/null and b/core/assets-raw/sprites/effects/particle.png differ diff --git a/core/assets/shaders/snow.frag b/core/assets/shaders/snow.frag index 599fa905b9..b17cc756e0 100644 --- a/core/assets/shaders/snow.frag +++ b/core/assets/shaders/snow.frag @@ -35,13 +35,10 @@ void main(){ //TODO this is very slow for(float i=0.0; i { + //TODO remove later + Weathers.snow.create(); + }); + Events.on(WaveEvent.class, event -> { if(state.isCampaign()){ //TODO implement diff --git a/core/src/mindustry/core/Renderer.java b/core/src/mindustry/core/Renderer.java index 29911d307f..87d3235bf4 100644 --- a/core/src/mindustry/core/Renderer.java +++ b/core/src/mindustry/core/Renderer.java @@ -39,7 +39,7 @@ public class Renderer implements ApplicationListener{ camera = new Camera(); Shaders.init(); - fx.addEffect(new SnowFilter()); + //fx.addEffect(new SnowFilter()); } public void shake(float intensity, float duration){ @@ -253,6 +253,8 @@ public class Renderer implements ApplicationListener{ overlays.drawTop(); + Groups.drawWeather(); + endFx(); if(!pixelator.enabled()){ diff --git a/core/src/mindustry/type/Weather.java b/core/src/mindustry/type/Weather.java index 4a849ea601..4dc805e892 100644 --- a/core/src/mindustry/type/Weather.java +++ b/core/src/mindustry/type/Weather.java @@ -1,28 +1,59 @@ package mindustry.type; +import arc.func.*; import mindustry.annotations.Annotations.*; import mindustry.ctype.*; +import mindustry.gen.*; public abstract class Weather extends MappableContent{ protected float duration = 100f; + protected Prov type = WeatherEntity::create; + + public Weather(String name, Prov type){ + super(name); + this.type = type; + } public Weather(String name){ super(name); } - public abstract void update(); + public void create(){ + Weatherc entity = type.get(); + entity.init(this); + entity.add(); + } - public abstract void draw(); + public void update(){ + + } + + public void draw(){ + + } @Override public ContentType getContentType(){ return ContentType.weather; } - //TODO implement - + @EntityDef(value = {Weatherc.class}, pooled = true, isFinal = false) @Component - class WeatherComp{ + abstract class WeatherComp implements Posc, DrawLayerWeatherc{ Weather weather; + + void init(Weather weather){ + this.weather = weather; + } + + @Override + public void drawWeather(){ + weather.draw(); + } + + @Override + public float clipSize(){ + return Float.MAX_VALUE; + } } } diff --git a/gradle.properties b/gradle.properties index 3601eb66f0..1bbf7facaa 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xms256m -Xmx1024m -archash=d781ecb488d5431692ffa509fa1a1a21a8f8185d +archash=3c2fae9b66b6affc1ba6701cce19ca9625c5e1b1