From 2bfc23c216eed2f2294171d34304b63ed284bacb Mon Sep 17 00:00:00 2001 From: buthed010203 Date: Mon, 28 Mar 2022 14:32:36 -0400 Subject: [PATCH] Cease node dumbness (#6670) * Cease. * Mobile players are second rate citizens * Undo config on ratelimit, revert PowerNode for loop * Fix being unable to drop items into core vaults when there are over 1k of the item already --- core/src/mindustry/input/InputHandler.java | 9 ++++++++- core/src/mindustry/world/blocks/power/PowerNode.java | 8 ++++---- .../src/mindustry/world/blocks/storage/StorageBlock.java | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/core/src/mindustry/input/InputHandler.java b/core/src/mindustry/input/InputHandler.java index c283e516f3..2286a2999d 100644 --- a/core/src/mindustry/input/InputHandler.java +++ b/core/src/mindustry/input/InputHandler.java @@ -344,7 +344,14 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ public static void tileConfig(@Nullable Player player, Building build, @Nullable Object value){ if(build == null) return; if(net.server() && (!Units.canInteract(player, build) || - !netServer.admins.allowAction(player, ActionType.configure, build.tile, action -> action.config = value))) throw new ValidateException(player, "Player cannot configure a tile."); + !netServer.admins.allowAction(player, ActionType.configure, build.tile, action -> action.config = value))){ + var packet = new TileConfigCallPacket(); //undo the config on the client + packet.player = player; + packet.build = build; + packet.value = build.config(); + player.con.send(packet, true); + throw new ValidateException(player, "Player cannot configure a tile."); + } build.configured(player == null || player.dead() ? null : player.unit(), value); Core.app.post(() -> Events.fire(new ConfigEvent(build, player, value))); } diff --git a/core/src/mindustry/world/blocks/power/PowerNode.java b/core/src/mindustry/world/blocks/power/PowerNode.java index 2e89a47fca..10ffdfc425 100644 --- a/core/src/mindustry/world/blocks/power/PowerNode.java +++ b/core/src/mindustry/world/blocks/power/PowerNode.java @@ -355,7 +355,7 @@ public class PowerNode extends PowerBlock{ @Override public void placed(){ - if(net.client()) return; + if(net.client() || power.links.size > 0) return; getPotentialLinks(tile, team, other -> { if(!power.links.contains(other.pos())){ @@ -384,15 +384,15 @@ public class PowerNode extends PowerBlock{ return false; } - if(this == other){ - if(other.power.links.size == 0){ + if(this == other){ //double tapped + if(other.power.links.size == 0 || Core.input.shift()){ //find links int[] total = {0}; getPotentialLinks(tile, team, link -> { if(!insulated(this, link) && total[0]++ < maxNodes){ configure(link.pos()); } }); - }else{ + }else{ //clear links while(power.links.size > 0){ configure(power.links.get(0)); } diff --git a/core/src/mindustry/world/blocks/storage/StorageBlock.java b/core/src/mindustry/world/blocks/storage/StorageBlock.java index 9b0d482153..1fff319aee 100644 --- a/core/src/mindustry/world/blocks/storage/StorageBlock.java +++ b/core/src/mindustry/world/blocks/storage/StorageBlock.java @@ -84,7 +84,7 @@ public class StorageBlock extends Block{ @Override public int getMaximumAccepted(Item item){ - return itemCapacity; + return linkedCore != null ? linkedCore.getMaximumAccepted(item) : itemCapacity; } @Override