From d1b51844e416e4d1031ad808dcc819bd6f0a6530 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 13 Mar 2018 00:16:40 -0400 Subject: [PATCH] Changed laser transitions and effects --- .../production/nuclearreactor-center.png | Bin 538 -> 529 bytes core/assets/version.properties | 2 +- .../blocks/types/generation/Generator.java | 60 +++++++++--------- .../blocks/types/production/Centrifuge.java | 15 +++++ 4 files changed, 46 insertions(+), 31 deletions(-) create mode 100644 core/src/io/anuke/mindustry/world/blocks/types/production/Centrifuge.java diff --git a/core/assets-raw/sprites/blocks/production/nuclearreactor-center.png b/core/assets-raw/sprites/blocks/production/nuclearreactor-center.png index 5b5a2688cc7a80c8bfac3ed31b2ece0a0d1ea273..b6894c4638f1c7d9d6ae325f28d55c955763b05c 100644 GIT binary patch delta 467 zcmbQmGLdD1iYjM;M`SSr1Gg{;GcwGYBf-GHz+U3%>&pI!nU|T3|C!;otclSY_1&H> zjv*e$kA|-8JLDkn&&%xK)lDyx*Qh&w@tn1w%k7GIV66KCPXXT#za=IgeH1X~Mefc2 zlTH_!uR8mu{{9)iYuj`!p3e|oI_2yCK7IzBjuXZId=nWQTs)P}Rc?3`l6Y(0(OYJ7 zrv@n~<$POQ_d=v=(E;my+%*vqK7viTFG51<<(22Q8k9a{XxR5&_xRmBc80dOUlP2_ z7Nl-|z9YWIU6JL}q&mKf7c{khJS_O2urr?PiE8A9O3oI6iyJQ={5)yGZ=HvAn)`Ae zdG84DioB8i>DNB@(9p0;UyFXn=x_JmykONTwK|`A+37ngc3)0ni(eb|_41o4>ZHw`&AZmA zclf+PrdlNLY2|~68iD1<2~$hOg4;Q>oENAt?goelaQbl=IpzIwTD zLE7`pca5!2{;X*eV9HKNd;DKkp24H@MBzXG6b1*Ei_T6Q`A0V%y7E(}B=_#jnT{?i zZY{5UCFvUYK=!_fyqlQOkBr$>^?bLS7p2?z+1o!? zcgDOY1r`$DUVq(nXHAytgnOYAm(LUDD)G=HTS5M7xm#EFl-<#2NBTmez;`W!hvGb&AyQHT6VSnv=zf0ZY_!0&N1_n=8 KKbLh*2~7aIILtr* diff --git a/core/assets/version.properties b/core/assets/version.properties index d71e0f2b48..dad06a7adc 100644 --- a/core/assets/version.properties +++ b/core/assets/version.properties @@ -1,5 +1,5 @@ #Autogenerated file. Do not modify. -#Mon Mar 12 22:01:24 EDT 2018 +#Tue Mar 13 00:12:47 EDT 2018 version=release androidBuildCode=474 name=Mindustry diff --git a/core/src/io/anuke/mindustry/world/blocks/types/generation/Generator.java b/core/src/io/anuke/mindustry/world/blocks/types/generation/Generator.java index a6bd3a927e..dba4df2876 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/generation/Generator.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/generation/Generator.java @@ -25,8 +25,10 @@ import static io.anuke.mindustry.Vars.world; public class Generator extends PowerBlock{ public static boolean drawRangeOverlay = false; - public static final float thicknessScl = 0.85f; - public static final float laserMinValue = 0.7f; + public static final float thicknessScl = 0.85f * 0.7f; + public static final float laserMinValue = 0f; + public static final Color laserFrom = Color.valueOf("d0bdd2"); + public static final Color laserTo = Color.valueOf("ffe7a8"); protected Translator t1 = new Translator(); protected Translator t2 = new Translator(); @@ -140,22 +142,23 @@ public class Generator extends PowerBlock{ GeneratorEntity entity = tile.entity(); + if(entity.power.amount > powerSpeed){ + entity.laserThickness = Mathf.lerpDelta(entity.laserThickness, 1f, 0.05f); + }else{ + entity.laserThickness = Mathf.lerpDelta(entity.laserThickness, laserMinValue, 0.05f); + } + for(int i = 0; i < laserDirections; i++){ - if(entity.power.amount > powerSpeed){ - entity.laserThickness = Mathf.lerpDelta(entity.laserThickness, 1f, 0.05f); - }else{ - entity.laserThickness = Mathf.lerpDelta(entity.laserThickness, laserMinValue, 0.05f); - } drawLaserTo(tile, (tile.getRotation() + i) - laserDirections / 2); } Draw.color(); } - @Override - public boolean acceptPower(Tile tile, Tile source, float amount){ - return false; - } + //@Override + //public boolean acceptPower(Tile tile, Tile source, float amount){ + // return false; + //} @Override public TileEntity getEntity() { @@ -173,9 +176,15 @@ public class Generator extends PowerBlock{ int rot = (tile.getRotation() + i) - laserDirections / 2; Tile target = laserTarget(tile, rot); - if(target == null || isInterfering(target, rot)) + if(target == null) continue; + if(isInterfering(target, rot)){ + float fract = tile.entity.power.amount / powerCapacity; + float ofract = target.entity.power.amount / target.block().powerCapacity; + if(ofract > fract) continue; + } + float transmit = Math.min(powerSpeed * Timers.delta(), entity.power.amount); if(target.block().acceptPower(target, tile, transmit)){ float accepted = target.block().addPower(target, transmit); @@ -191,39 +200,30 @@ public class Generator extends PowerBlock{ GeneratorEntity entity = tile.entity(); - float scale = thicknessScl * entity.laserThickness; + float scale = thicknessScl; if(target != null){ boolean interfering = isInterfering(target, rotation); - t1.trns(rotation * 90, 1 * tilesize / 2 + 2f + + t1.trns(rotation * 90, tilesize / 2 + 2f + (interfering ? Vector2.dst(tile.worldx(), tile.worldy(), target.worldx(), target.worldy()) / 2f - tilesize / 2f * 1 : 0)); t2.trns(rotation * 90, size * tilesize / 2 + 2f); - if(!interfering){ - Draw.tint(Hue.mix(Color.GRAY, Color.WHITE, 0.904f + Mathf.sin(Timers.time(), 1.7f, 0.06f))); - }else{ - Draw.tint(Hue.mix(Color.SCARLET, Color.WHITE, 0.902f + Mathf.sin(Timers.time(), 1.7f, 0.08f))); - - //if(state.is(State.playing) && Mathf.chance(Timers.delta() * 0.033)){ - // Effects.effect(Fx.laserspark, target.worldx() - t1.x, target.worldy() - t1.y); - //} - } - - float r = interfering ? 0f : 0f; + Draw.tint(Hue.mix(laserFrom, laserTo, entity.laserThickness * 0.93f + Mathf.sin(Timers.time(), 1.7f, 0.07f))); int relative = tile.sizedRelativeTo(target.x, target.y); if(relative == -1){ Shapes.laser("laser", "laserend", tile.worldx() + t2.x, tile.worldy() + t2.y, - target.worldx() - t1.x + Mathf.range(r), - target.worldy() - t1.y + Mathf.range(r), scale); + target.worldx() - t1.x, + target.worldy() - t1.y, scale); }else{ - float s = 18f; - float sclx = (relative == 1 || relative == 3) ? entity.laserThickness : 1f; - float scly = (relative == 1 || relative == 3) ? 1f : entity.laserThickness; + float lf = 1f; + float s = interfering ? 12f : 18f; + float sclx = (relative == 1 || relative == 3) ? lf : 1f; + float scly = (relative == 1 || relative == 3) ? 1f : lf; Draw.rect("laserfull", tile.worldx() + Geometry.d4[relative].x * size * tilesize / 2f, tile.worldy() + Geometry.d4[relative].y * size * tilesize / 2f , s * sclx, s * scly); diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/Centrifuge.java b/core/src/io/anuke/mindustry/world/blocks/types/production/Centrifuge.java new file mode 100644 index 0000000000..79afb99b3a --- /dev/null +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/Centrifuge.java @@ -0,0 +1,15 @@ +package io.anuke.mindustry.world.blocks.types.production; + +import io.anuke.mindustry.world.Tile; + +public class Centrifuge extends LiquidCrafter { + + public Centrifuge(String name) { + super(name); + } + + @Override + public void update(Tile tile){ + + } +}