From f447aeff3e7eb256dc374052b4f84d91c7b9b3bb Mon Sep 17 00:00:00 2001 From: Sunny Kim <58885089+sk7725@users.noreply.github.com> Date: Sat, 5 Sep 2020 21:50:46 +0900 Subject: [PATCH] More wall fields for modding (#2486) * More wall fields for mods - `flashColor` (`flashWhite` is renamed to `flashHit` since it isn't white anymore) - `lightningColor` * Update Blocks.java --- core/src/mindustry/content/Blocks.java | 4 ++-- core/src/mindustry/world/blocks/defense/Wall.java | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 3f2fc9a70a..578125527e 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -767,14 +767,14 @@ public class Blocks implements ContentList{ phaseWall = new Wall("phase-wall"){{ requirements(Category.defense, with(Items.phasefabric, 6)); health = 150 * wallHealthMultiplier; - flashWhite = deflect = true; + flashHit = deflect = true; }}; phaseWallLarge = new Wall("phase-wall-large"){{ requirements(Category.defense, ItemStack.mult(phaseWall.requirements, 4)); health = 150 * 4 * wallHealthMultiplier; size = 2; - flashWhite = deflect = true; + flashHit = deflect = true; }}; surgeWall = new Wall("surge-wall"){{ diff --git a/core/src/mindustry/world/blocks/defense/Wall.java b/core/src/mindustry/world/blocks/defense/Wall.java index b08c2c500c..bad58eba9d 100644 --- a/core/src/mindustry/world/blocks/defense/Wall.java +++ b/core/src/mindustry/world/blocks/defense/Wall.java @@ -19,9 +19,11 @@ public class Wall extends Block{ public float lightningChance = -0.001f; public float lightningDamage = 20f; public int lightningLength = 17; + public Color lightningColor = Pal.surge; public float chanceDeflect = 10f; - public boolean flashWhite; + public boolean flashHit; + public Color flashColor = Color.white; public boolean deflect; public Wall(String name){ @@ -68,10 +70,10 @@ public class Wall extends Block{ } //draw flashing white overlay if enabled - if(flashWhite){ + if(flashHit){ if(hit < 0.0001f) return; - Draw.color(Color.white); + Draw.color(flashColor); Draw.alpha(hit * 0.5f); Draw.blend(Blending.additive); Fill.rect(x, y, tilesize * size, tilesize * size); @@ -91,7 +93,7 @@ public class Wall extends Block{ //create lightning if necessary if(lightningChance > 0){ if(Mathf.chance(lightningChance)){ - Lightning.create(team, Pal.surge, lightningDamage, x, y, bullet.rotation() + 180f, lightningLength); + Lightning.create(team, lightningColor, lightningDamage, x, y, bullet.rotation() + 180f, lightningLength); } }