From 06e94b18000841b6d3ef92bb0571bd7c3c1ee044 Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 11 Mar 2020 10:08:27 -0400 Subject: [PATCH] Cleaned up weather class --- .../mindustry/annotations/Annotations.java | 1 + .../src/main/resources/classids.properties | 1 + .../resources/revisions/WeatherEntity/0.json | 1 + .../resources/revisions/WeatherEntity/1.json | 1 + core/assets-raw/sprites/effects/particle.png | Bin 0 -> 1598 bytes core/assets/shaders/snow.frag | 9 ++-- core/src/mindustry/content/Weathers.java | 6 +++ core/src/mindustry/core/Logic.java | 5 +++ core/src/mindustry/core/Renderer.java | 4 +- core/src/mindustry/type/Weather.java | 41 +++++++++++++++--- gradle.properties | 2 +- 11 files changed, 58 insertions(+), 13 deletions(-) create mode 100644 annotations/src/main/resources/revisions/WeatherEntity/0.json create mode 100644 annotations/src/main/resources/revisions/WeatherEntity/1.json create mode 100644 core/assets-raw/sprites/effects/particle.png 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 0000000000000000000000000000000000000000..dabcbab9a97b1b38f62667e3b428dd3567b96f92 GIT binary patch literal 1598 zcmeAS@N?(olHy`uVBq!ia0y~yV9)?z4mJh`hMs>rav2yHTQZ%U13aCb6$*;-(=u~X z85lGs)=sqbI2<6->L0vxktn-$hXu<@KQR|qnXO!|D+IDy!(@HpezE&XO%f4zKe+Y5 zgY!vO4<3ySXAgH2_`_IOR1#D&QRuxlmu^zchYI=Udy99xk8@ZteP&u|5A&?N*(+UQ z&ZLANy`bIng7HFo;>^fnb5v9x?%wxK@WJ!gp7fvle;0pUW!cThII&`yU8`pEMm$!ek=e@>JheQbV?bvo-jNyE!4D<5%ejL1k{+8cTCO2_h!#jBPD z@0;*3;_05Fk=o&roBjSBF7S(wd}j4lQDsAis)xYB1zkd?HV7^bRzK?0_3p9VKga9( z6TKC~IeTQdS2#4k`E@Y;!|v^2bw!7~xsErU6F>e_g3)QW!{TQa_mB5owqR^Je_-mp zPvNf)oKb(db()y%qJw$N;@5S3Z!+tZH#Dj{o27&-@*CfouFpSP zJ;#nA^Hu04HVX?DH|{BW-+g|+?%TeEZzkx!g~fkn*I#W5t}@Y)$K^B!9Wv_uO%)t=Xx z{_U@PVdLE1WKFB*{^lQ+I$51kT;O%yshEMKGLnt;J1O% z!Tn6EJ+pz+OqrP12g>U9AGh6`{b=dM#=SrO99;YDzFJG2@d2)d+yT|b*1t~tmbF>I zklygRrl-2f#%X^Z2Rsi#zat;9+zt{KBy9xXjvbmWQY2Gpzcqw1n}UJbT5* z_i{1`(HtLNF!)zYblXwH^i@Y9o-yT}Dud0g>3V73Zof@R>*x3=xF_OtGyD1dVy=OQ zoek4lOf{yNrXKQ+vRtU3w5C7LeqyurO0OWFKj-dy*xFhYEx$8EWe=x9|A~Y0e6N@a z(kt|BPWTxm?v47C$8vyg>bY|!(qd;Xo@NY{XWA2;2M(=HU;idue?dju zhtvrbQ(bsWf{wat&JeEXUwMJ4gR$pX%7-lV?DtDAFrA;{BCv$%#9W43+&j#a#a{Jn zl1y1Ev!iAD+91dKfxlH-3_GtX?Jinda_-Oise5!^p3xHB5-%irIcS zlKpDevb{5AORtI!JrbkyZgTxPE)(ZUd$G8xiRpfS^iJMB_o;2J#zTcmv2I3BtvoXh zF`il`o_g1_%nQqHy#E%E7|&Hc8YpLdmo5__?9dC^N_8#iuO+q|1QR;&L$^RD|& z*@3W4C7T?Y-m5&1n^1lF+T#AuzN1w)cejP}3EjGM^9+YV^Bw-3hi!|!$+KoidfpS6Qo8QJv+sT8 z`X_i+3ZSaE*dr`xg&VGKW>zSig6*VGaC?DQ)J1_lOC LS3j3^P6 { + //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