From 6ea90ea82891097dec96953394ee2e4a80aaf05c Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 5 Feb 2019 22:11:02 -0500 Subject: [PATCH] Fixed lighting not rendering / Fixed engine colors --- .../io/anuke/mindustry/content/Blocks.java | 2 +- .../src/io/anuke/mindustry/content/Mechs.java | 16 ++++----- .../mindustry/entities/effect/Lightning.java | 35 ++++++++----------- .../anuke/mindustry/entities/type/Player.java | 2 +- core/src/io/anuke/mindustry/type/Mech.java | 3 +- 5 files changed, 25 insertions(+), 33 deletions(-) diff --git a/core/src/io/anuke/mindustry/content/Blocks.java b/core/src/io/anuke/mindustry/content/Blocks.java index b1676b21ab..911648d978 100644 --- a/core/src/io/anuke/mindustry/content/Blocks.java +++ b/core/src/io/anuke/mindustry/content/Blocks.java @@ -386,7 +386,7 @@ public class Blocks implements ContentList{ craftEffect = Fx.smeltsmoke; output = Items.surgealloy; craftTime = 75f; - size = 2; + size = 3; consumes.power(4f); consumes.items(new ItemStack(Items.titanium, 2), new ItemStack(Items.lead, 4), new ItemStack(Items.silicon, 3), new ItemStack(Items.copper, 3)); diff --git a/core/src/io/anuke/mindustry/content/Mechs.java b/core/src/io/anuke/mindustry/content/Mechs.java index 41092bb909..dd2a7fc643 100644 --- a/core/src/io/anuke/mindustry/content/Mechs.java +++ b/core/src/io/anuke/mindustry/content/Mechs.java @@ -35,7 +35,7 @@ public class Mechs implements ContentList{ mass = 1.2f; speed = 0.5f; boostSpeed = 0.85f; - trailColorTo = Color.valueOf("ffd37f"); + engineColor = Color.valueOf("ffd37f"); health = 250f; weapon = new Weapon("blaster"){{ @@ -65,7 +65,7 @@ public class Mechs implements ContentList{ health = 220f; weaponOffsetX = -1; weaponOffsetY = -1; - trailColorTo = Color.valueOf("d3ddff"); + engineColor = Color.valueOf("d3ddff"); weapon = new Weapon("shockgun"){{ length = 1f; @@ -110,7 +110,7 @@ public class Mechs implements ContentList{ boostSpeed = 0.8f; canHeal = true; health = 200f; - trailColorTo = Palette.heal; + engineColor = Palette.heal; weapon = new Weapon("heal-blaster"){{ length = 1.5f; @@ -159,7 +159,7 @@ public class Mechs implements ContentList{ shake = 4f; weaponOffsetX = 1; weaponOffsetY = 0; - trailColorTo = Color.valueOf("feb380"); + engineColor = Color.valueOf("feb380"); health = 300f; weapon = new Weapon("swarmer"){{ length = 1.5f; @@ -228,7 +228,7 @@ public class Mechs implements ContentList{ health = 180f; weaponOffsetX = -1; weaponOffsetY = -1; - trailColor = Palette.lightTrail; + engineColor = Palette.lightTrail; cellTrnsY = 1f; weapon = new Weapon("blaster"){{ length = 1.5f; @@ -255,7 +255,7 @@ public class Mechs implements ContentList{ drag = 0.01f; mass = 2f; health = 170f; - trailColor = Color.valueOf("d3ddff"); + engineColor = Color.valueOf("d3ddff"); cellTrnsY = 1f; weapon = new Weapon("missiles"){{ length = 1.5f; @@ -321,7 +321,7 @@ public class Mechs implements ContentList{ turnCursor = false; health = 220f; itemCapacity = 30; - trailColor = Color.valueOf("84f491"); + engineColor = Color.valueOf("84f491"); cellTrnsY = 1f; weapon = new Weapon("bomber"){{ length = 0f; @@ -352,7 +352,7 @@ public class Mechs implements ContentList{ mass = 3f; health = 240f; itemCapacity = 60; - trailColor = Color.valueOf("feb380"); + engineColor = Color.valueOf("feb380"); cellTrnsY = 1f; weapon = new Weapon("bomber"){{ diff --git a/core/src/io/anuke/mindustry/entities/effect/Lightning.java b/core/src/io/anuke/mindustry/entities/effect/Lightning.java index 56e3844461..ff0f654f9e 100644 --- a/core/src/io/anuke/mindustry/entities/effect/Lightning.java +++ b/core/src/io/anuke/mindustry/entities/effect/Lightning.java @@ -4,6 +4,8 @@ import io.anuke.annotations.Annotations.Loc; import io.anuke.annotations.Annotations.Remote; import io.anuke.arc.collection.Array; import io.anuke.arc.collection.IntSet; +import io.anuke.arc.graphics.g2d.Fill; +import io.anuke.arc.graphics.g2d.Lines; import io.anuke.mindustry.entities.EntityGroup; import io.anuke.mindustry.entities.impl.TimedEntity; import io.anuke.mindustry.entities.traits.DrawTrait; @@ -129,31 +131,22 @@ public class Lightning extends TimedEntity implements DrawTrait, SyncTrait, Time @Override public void draw(){ - float lx = x, ly = y; + Lines.stroke(2f * fout()); Draw.color(color, Color.WHITE, fin()); - //TODO this is really, really bad rendering - /* - for(int i = 0; i < lines.size; i++){ - Position v = lines.get(i); + Lines.beginLine(); - float f = (float) i / lines.size; + Lines.linePoint(x, y); + for(Position p : lines){ + Lines.linePoint(p.getX(), p.getY()); + } + Lines.endLine(); - Lines.stroke(fout() * 3f * (1.5f - f)); + int i = 0; - Lines.stroke(Lines.getStroke() * 4f); - Draw.alpha(0.3f); - Lines.line(lx, ly, v.getX(), v.getY()); - - Lines.stroke(Lines.getStroke()/4f); - Draw.alpha(1f); - Lines.line(lx, ly, v.getX(), v.getY()); - - Lines.stroke(3f * fout() * (1f - f)); - - lx = v.getX(); - ly = v.getY(); - }*/ - Draw.color(); + for(Position p : lines){ + Fill.square(p.getX(), p.getY(), (4f - (float)i++/lines.size*2f) * fout(), 45); + } + Draw.reset(); } @Override diff --git a/core/src/io/anuke/mindustry/entities/type/Player.java b/core/src/io/anuke/mindustry/entities/type/Player.java index df332cd260..a707ab6e88 100644 --- a/core/src/io/anuke/mindustry/entities/type/Player.java +++ b/core/src/io/anuke/mindustry/entities/type/Player.java @@ -371,7 +371,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{ public void drawUnder(){ float size = mech.engineSize * (mech.flying ? 1f : boostHeat); - Draw.color(mech.trailColorTo); + Draw.color(mech.engineColor); Fill.circle(x + Angles.trnsx(rotation + 180, mech.engineOffset), y + Angles.trnsy(rotation + 180, mech.engineOffset), size + Mathf.absin(Time.time(), 2f, size/4f)); diff --git a/core/src/io/anuke/mindustry/type/Mech.java b/core/src/io/anuke/mindustry/type/Mech.java index 7c28c72576..bdd94a2288 100644 --- a/core/src/io/anuke/mindustry/type/Mech.java +++ b/core/src/io/anuke/mindustry/type/Mech.java @@ -27,8 +27,7 @@ public class Mech extends UnlockableContent{ public float mineSpeed = 1f; public int drillPower = -1; public float buildPower = 1f; - public Color trailColor = Palette.boostFrom; - public Color trailColorTo = Palette.boostTo; + public Color engineColor = Palette.boostTo; public int itemCapacity = 30; public boolean turnCursor = true; public boolean canHeal = false;