From 6fb7f4fe2688782b9c37b156e2e3ec0d8d31b021 Mon Sep 17 00:00:00 2001 From: buthed010203 Date: Mon, 27 Sep 2021 11:55:34 -0400 Subject: [PATCH 1/3] At least add a fastAA property (#6058) Since my other pr will never get merged, i will at least add this so i can use it myself --- tools/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/build.gradle b/tools/build.gradle index c9985b1612..781c80e821 100644 --- a/tools/build.gradle +++ b/tools/build.gradle @@ -17,7 +17,7 @@ def doAntialias = !project.hasProperty("disableAntialias") def colorMap = new IntMap>(), colorIndexMap = new IntIntMap() //on my machine, I have a native Nim AA implementation that is ~10x faster //it's not compiled for other platforms so they don't get it -def useFastAA = System.getProperty("user.name") == "anuke" +def useFastAA = project.hasProperty("fastAA") || System.getProperty("user.name") == "anuke" def transformColors = { List> list -> list.each{ colors -> @@ -281,4 +281,4 @@ task updateScripts(dependsOn: classes, type: JavaExec){ classpath = sourceSets.main.runtimeClasspath standardInput = System.in workingDir = "../" -} \ No newline at end of file +} From 083c21ea3f18f5b1b7bd4b792e43701b0e69a1aa Mon Sep 17 00:00:00 2001 From: Matthew Peng <54301439+MEEPofFaith@users.noreply.github.com> Date: Mon, 27 Sep 2021 08:55:56 -0700 Subject: [PATCH 2/3] Effect Rotate With Parent (#5999) * Effect Rotate With Parent * Use Rotc * Wording * Base Rotation * Rotate effect rotation with parent. --- .../revisions/EffectStateComp/6.json | 1 + core/src/mindustry/content/Fx.java | 8 +++---- core/src/mindustry/entities/Effect.java | 21 ++++++++++++++++-- .../mindustry/entities/comp/ChildComp.java | 22 ++++++++++++++----- 4 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 annotations/src/main/resources/revisions/EffectStateComp/6.json diff --git a/annotations/src/main/resources/revisions/EffectStateComp/6.json b/annotations/src/main/resources/revisions/EffectStateComp/6.json new file mode 100644 index 0000000000..f8a361e105 --- /dev/null +++ b/annotations/src/main/resources/revisions/EffectStateComp/6.json @@ -0,0 +1 @@ +{version:6,fields:[{name:color,type:arc.graphics.Color},{name:data,type:java.lang.Object},{name:effect,type:mindustry.entities.Effect},{name:lifetime,type:float},{name:offsetPos,type:float},{name:offsetRot,type:float},{name:offsetX,type:float},{name:offsetY,type:float},{name:parent,type:mindustry.gen.Posc},{name:rotDirWithParent,type:boolean},{name:rotPosWithParent,type:boolean},{name:rotation,type:float},{name:time,type:float},{name:x,type:float},{name:y,type:float}]} \ No newline at end of file diff --git a/core/src/mindustry/content/Fx.java b/core/src/mindustry/content/Fx.java index dca9904588..9339df49ab 100644 --- a/core/src/mindustry/content/Fx.java +++ b/core/src/mindustry/content/Fx.java @@ -362,13 +362,13 @@ public class Fx{ Fill.circle(e.x, e.y, e.fin() * 10); Drawf.light(e.x, e.y, e.fin() * 20f, Pal.heal, 0.7f); - }).followParent(true), + }).followParent(true).rotWithParent(true), greenLaserChargeSmall = new Effect(40f, 100f, e -> { color(Pal.heal); stroke(e.fin() * 2f); Lines.circle(e.x, e.y, e.fout() * 50f); - }).followParent(true), + }).followParent(true).rotWithParent(true), greenCloud = new Effect(80f, e -> { color(Pal.heal); @@ -1943,7 +1943,7 @@ public class Fx{ } Lines.endLine(); - }).followParent(false), + }).followParent(false).rotWithParent(false), chainEmp = new Effect(30f, 300f, e -> { if(!(e.data instanceof Position p)) return; @@ -1980,5 +1980,5 @@ public class Fx{ } Lines.endLine(); - }).followParent(false); + }).followParent(false).rotWithParent(false); } diff --git a/core/src/mindustry/entities/Effect.java b/core/src/mindustry/entities/Effect.java index ba5def3822..4d298eb40f 100644 --- a/core/src/mindustry/entities/Effect.java +++ b/core/src/mindustry/entities/Effect.java @@ -30,8 +30,12 @@ public class Effect{ public float lifetime = 50f; /** Clip size. */ public float clip; + /** Amount added to rotation */ + public float baseRotation; /** If true, parent unit is data are followed. */ public boolean followParent; + /** If this and followParent are true, the effect will offset and rotate with the parent's rotation. */ + public boolean rotWithParent; public float layer = Layer.effect; public float layerDuration; @@ -61,11 +65,21 @@ public class Effect{ return this; } + public Effect rotWithParent(boolean follow){ + rotWithParent = follow; + return this; + } + public Effect layer(float l){ layer = l; return this; } + public Effect baseRotation(float d){ + baseRotation = d; + return this; + } + public Effect layer(float l, float duration){ layer = l; this.layerDuration = duration; @@ -156,12 +170,15 @@ public class Effect{ EffectState entity = EffectState.create(); entity.effect = effect; - entity.rotation = rotation; + entity.rotation = effect.baseRotation + rotation; entity.data = data; entity.lifetime = effect.lifetime; entity.set(x, y); entity.color.set(color); - if(effect.followParent && data instanceof Posc p) entity.parent = p; + if(effect.followParent && data instanceof Posc p){ + entity.parent = p; + entity.rotWithParent = effect.rotWithParent; + } entity.add(); } } diff --git a/core/src/mindustry/entities/comp/ChildComp.java b/core/src/mindustry/entities/comp/ChildComp.java index dae0c98814..f34a9198c9 100644 --- a/core/src/mindustry/entities/comp/ChildComp.java +++ b/core/src/mindustry/entities/comp/ChildComp.java @@ -1,29 +1,41 @@ package mindustry.entities.comp; +import arc.math.*; import arc.util.*; import mindustry.annotations.Annotations.*; import mindustry.gen.*; @Component -abstract class ChildComp implements Posc{ - @Import float x, y; +abstract class ChildComp implements Posc, Rotc{ + @Import float x, y, rotation; @Nullable Posc parent; - float offsetX, offsetY; + boolean rotWithParent; + float offsetX, offsetY, offsetPos, offsetRot; @Override public void add(){ if(parent != null){ offsetX = x - parent.getX(); offsetY = y - parent.getY(); + if(rotWithParent && parent instanceof Rotc r){ + offsetPos = -r.rotation(); + offsetRot = rotation - r.rotation(); + } } } @Override public void update(){ if(parent != null){ - x = parent.getX() + offsetX; - y = parent.getY() + offsetY; + if(rotWithParent && parent instanceof Rotc r){ + x = parent.getX() + Angles.trnsx(r.rotation() + offsetPos, offsetX, offsetY); + y = parent.getY() + Angles.trnsy(r.rotation() + offsetPos, offsetX, offsetY); + rotation = r.rotation() + offsetRot; + }else{ + x = parent.getX() + offsetX; + y = parent.getY() + offsetY; + } } } } From dbd31b9031ba2c989283808d131e2268dbca2174 Mon Sep 17 00:00:00 2001 From: TranquillyUnpleasant <62061444+TranquillyUnpleasant@users.noreply.github.com> Date: Mon, 27 Sep 2021 23:46:28 +0500 Subject: [PATCH 3/3] Cryo tiles (#6054) * Cryo tile * tile name * Shader * Icon and property --- .../blocks/environment/pooled-cryofluid.png | Bin 0 -> 1335 bytes core/assets/bundles/bundle.properties | 1 + core/assets/icons/icons.properties | 1 + core/assets/shaders/cryofluid.frag | 35 ++++++++++++++++++ core/src/mindustry/content/Blocks.java | 18 ++++++++- core/src/mindustry/graphics/CacheLayer.java | 3 +- core/src/mindustry/graphics/Shaders.java | 3 +- 7 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 core/assets-raw/sprites/blocks/environment/pooled-cryofluid.png create mode 100644 core/assets/shaders/cryofluid.frag diff --git a/core/assets-raw/sprites/blocks/environment/pooled-cryofluid.png b/core/assets-raw/sprites/blocks/environment/pooled-cryofluid.png new file mode 100644 index 0000000000000000000000000000000000000000..9d50189fd901faa4516b6d23738f91ce5e1797d0 GIT binary patch literal 1335 zcmeAS@N?(olHy`uVBq!ia0y~yU{C;I4mJh`hT^KKFANM!KdM3^N`ey06$*;-(=u~X z6-p`#QWa7wGSe6sDsH`<9zE@e8c*B(NY`l%DlJEf45k-vYSyv0H(R&v)jQ9$Nj6Uw zo-s^N^xkCWSla&a_;{^J=4W zZuCc<)cZ--#qYUYE3Obzah|rz$$Liogd>~3YcoZfdmfFrusP+$M3pnH8VMdjWhx#g zPCvh!+;g6@%JY*g_x#QOXViMxUDuuNzw?Z>`;4014!>$YofomUoaXNGXIDbi>|e8< zSnfV=xo-VxP36Uv;UPTbW!J0&Y$g<0#-Gk;i#FW8S=6N8)a<~^jYpZ+1}d^mmDC7a z?lt+CrCAn-;m3r-C+;w0os8+>Hs5Kn@L~${UOm3LUU!CFDt|g!{q{foa{a`^ox&kA z6M8E*Ir@I>qeK5>M1ATHP+zaN*9KFFqgcn*I9`Vy_V@aK-p+ zAOD(X@VYk&$W1 zDOtxNp*PbK-t4J)EW0>(`cz|m!*gm40Vk6Zn*Xv!XllMXK522=sxGzAvstekyRYe3 zrk=Hoj%$xG-I$Vf^UR&DP;vit^X}f+TcI1nlD=SC%$f?#rD1%ceOfu8FTy?e?4EeE z%l+JNxWDL1+o#NxnWxXr+I}hPxt{ECm-BabeZTa2fk8n~k4eds#KZ2ArHigDJ7ZG% zEc0^u%&(5Q!GAB+HA>}X)l7=2`nG^A(_pvn1uMT2LuNximPgw-7A&YV?Do_AsI+~? z(L*;xPH_Z@&%Tf;$b878qx4eqUG|;xABkP5?~?v6yK}>Zzv54rF4R8##=CW2-Sbf|(bwG4@$ul(+Bx6PJ>2)3 zp?>k9kj>dL0j8%t)PI(wk4s&$+h$wJ}agx%BynVA8@H z2aDJ@Pg*GCFL+!eba74nwba(nV(D9hlGob(fCwZ%dOZLccuW)L8^5fwD2j6qf9(vL;Tf~duuKu>ahDeMoy@?% zVBqQE7!q;#?KwwA1_u@f1HBE)X1yp#`jNvq?ds>p7rK*~PyzR473Q?dpOSb%mU+7R KxvX 0.55 && noise < 0.56) { + color.rgb = S2; + } else if (noise > 0.50 && noise < 0.60){ + color.rgb = S1; + } + + gl_FragColor = color; +} diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index d944f433f0..acd40284f6 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -35,7 +35,7 @@ public class Blocks implements ContentList{ public static Block //environment - air, spawn, cliff, deepwater, water, taintedWater, deepTaintedWater, tar, slag, stone, craters, charr, sand, darksand, dirt, mud, ice, snow, darksandTaintedWater, space, + air, spawn, cliff, deepwater, water, taintedWater, deepTaintedWater, tar, slag, cryofluid, stone, craters, charr, sand, darksand, dirt, mud, ice, snow, darksandTaintedWater, space, dacite, stoneWall, dirtWall, sporeWall, iceWall, daciteWall, sporePine, snowPine, pine, shrubs, whiteTree, whiteTreeDead, sporeCluster, iceSnow, sandWater, darksandWater, duneWall, sandWall, moss, sporeMoss, shale, shaleWall, shaleBoulder, sandBoulder, daciteBoulder, boulder, snowBoulder, basaltBoulder, grass, salt, @@ -196,6 +196,22 @@ public class Blocks implements ContentList{ cacheLayer = CacheLayer.tar; }}; + cryofluid = new Floor("pooled-cryofluid"){{ + drownTime = 150f; + status = StatusEffects.freezing; + statusDuration = 240f; + speedMultiplier = 0.5f; + variants = 0; + liquidDrop = Liquids.cryofluid; + liquidMultiplier = 0.5f; + isLiquid = true; + cacheLayer = CacheLayer.cryofluid; + + emitLight = true; + lightRadius = 20f; + lightColor = Color.cyan.cpy().a(0.19f); + }}; + slag = new Floor("molten-slag"){{ drownTime = 150f; status = StatusEffects.melting; diff --git a/core/src/mindustry/graphics/CacheLayer.java b/core/src/mindustry/graphics/CacheLayer.java index a68b7f6e06..3921612853 100644 --- a/core/src/mindustry/graphics/CacheLayer.java +++ b/core/src/mindustry/graphics/CacheLayer.java @@ -10,7 +10,7 @@ import static mindustry.Vars.*; public class CacheLayer{ public static CacheLayer - water, mud, tar, slag, space, normal, walls; + water, mud, cryofluid, tar, slag, space, normal, walls; public static CacheLayer[] all = {}; @@ -37,6 +37,7 @@ public class CacheLayer{ mud = new ShaderLayer(Shaders.mud), tar = new ShaderLayer(Shaders.tar), slag = new ShaderLayer(Shaders.slag), + cryofluid = new ShaderLayer(Shaders.cryofluid), space = new ShaderLayer(Shaders.space), normal = new CacheLayer(), walls = new CacheLayer() diff --git a/core/src/mindustry/graphics/Shaders.java b/core/src/mindustry/graphics/Shaders.java index 7ea78a2549..33026d6fe1 100644 --- a/core/src/mindustry/graphics/Shaders.java +++ b/core/src/mindustry/graphics/Shaders.java @@ -21,7 +21,7 @@ public class Shaders{ public static UnitBuildShader build; public static DarknessShader darkness; public static LightShader light; - public static SurfaceShader water, mud, tar, slag, space, caustics; + public static SurfaceShader water, mud, tar, slag, cryofluid, space, caustics; public static PlanetShader planet; public static PlanetGridShader planetGrid; public static AtmosphereShader atmosphere; @@ -47,6 +47,7 @@ public class Shaders{ mud = new SurfaceShader("mud"); tar = new SurfaceShader("tar"); slag = new SurfaceShader("slag"); + cryofluid = new SurfaceShader("cryofluid"); space = new SpaceShader("space"); //caustics = new SurfaceShader("caustics"){ // @Override