From 197b67f8c1bb439b4b3ec4f3bf6288eca64f9495 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 12 Sep 2020 09:51:57 -0400 Subject: [PATCH] Fixed #2543 --- core/src/mindustry/entities/comp/BuildingComp.java | 7 +++++++ core/src/mindustry/world/blocks/defense/Wall.java | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index 9adc7897ce..54a7b8569f 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -76,6 +76,12 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, public Building init(Tile tile, Team team, boolean shouldAdd, int rotation){ if(!initialized){ create(tile.block(), team); + }else{ + if(block.hasPower){ + //reinit power graph + power.graph = new PowerGraph(); + power.graph.add(base()); + } } this.rotation = rotation; this.tile = tile; @@ -697,6 +703,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, other.build.power.links.removeValue(pos()); } } + power.links.clear(); } public Seq getPowerConnections(Seq out){ diff --git a/core/src/mindustry/world/blocks/defense/Wall.java b/core/src/mindustry/world/blocks/defense/Wall.java index bad58eba9d..c496b7e227 100644 --- a/core/src/mindustry/world/blocks/defense/Wall.java +++ b/core/src/mindustry/world/blocks/defense/Wall.java @@ -99,8 +99,11 @@ public class Wall extends Block{ //deflect bullets if necessary if(deflect){ + //slow bullets are not deflected + if(bullet.vel().len() <= 0.2f) return true; + //bullet reflection chance depends on bullet damage - if(!Mathf.chance(chanceDeflect/bullet.damage())) return true; + if(!Mathf.chance(chanceDeflect / bullet.damage())) return true; //translate bullet back to where it was upon collision bullet.trns(-bullet.vel.x, -bullet.vel.y);