From 8672dcf9f9462e8db0f34aa18d8312544049abc8 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 28 Nov 2024 16:55:55 -0500 Subject: [PATCH] Don't draw power beams for derelict blocks --- core/src/mindustry/net/ArcNetProvider.java | 4 +++- core/src/mindustry/world/blocks/power/BeamNode.java | 2 +- core/src/mindustry/world/blocks/power/PowerNode.java | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/mindustry/net/ArcNetProvider.java b/core/src/mindustry/net/ArcNetProvider.java index 4d984265fc..66d2d5278c 100644 --- a/core/src/mindustry/net/ArcNetProvider.java +++ b/core/src/mindustry/net/ArcNetProvider.java @@ -144,7 +144,7 @@ public class ArcNetProvider implements NetProvider{ @Override public void received(Connection connection, Object object){ - if(!(connection.getArbitraryData() instanceof ArcConnection k) || !(object instanceof Packet pack)) return; + if(!(connection.getArbitraryData() instanceof ArcConnection k)) return; if(packetSpamLimit > 0 && !k.packetRate.allow(3000, packetSpamLimit)){ Log.warn("Blacklisting IP '@' as potential DOS attack - packet spam.", k.address); @@ -153,6 +153,8 @@ public class ArcNetProvider implements NetProvider{ return; } + if(!(object instanceof Packet pack)) return; + Core.app.post(() -> { try{ net.handleServerReceived(k, pack); diff --git a/core/src/mindustry/world/blocks/power/BeamNode.java b/core/src/mindustry/world/blocks/power/BeamNode.java index d5477e182c..f62bd162cd 100644 --- a/core/src/mindustry/world/blocks/power/BeamNode.java +++ b/core/src/mindustry/world/blocks/power/BeamNode.java @@ -207,7 +207,7 @@ public class BeamNode extends PowerBlock{ public void draw(){ super.draw(); - if(Mathf.zero(Renderer.laserOpacity)) return; + if(Mathf.zero(Renderer.laserOpacity) || team == Team.derelict) return; Draw.z(Layer.power); Draw.color(laserColor1, laserColor2, (1f - power.graph.getSatisfaction()) * 0.86f + Mathf.absin(3f, 0.1f)); diff --git a/core/src/mindustry/world/blocks/power/PowerNode.java b/core/src/mindustry/world/blocks/power/PowerNode.java index 421684f43b..89ddae8cbc 100644 --- a/core/src/mindustry/world/blocks/power/PowerNode.java +++ b/core/src/mindustry/world/blocks/power/PowerNode.java @@ -472,7 +472,7 @@ public class PowerNode extends PowerBlock{ public void draw(){ super.draw(); - if(Mathf.zero(Renderer.laserOpacity) || isPayload()) return; + if(Mathf.zero(Renderer.laserOpacity) || isPayload() || team == Team.derelict) return; Draw.z(Layer.power); setupColor(power.graph.getSatisfaction());