From c7cbe508766e6f646a3b4cb1de788d118c9280c6 Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 17 Mar 2021 17:39:50 -0400 Subject: [PATCH] More misc cleanup --- core/src/mindustry/core/NetServer.java | 2 +- core/src/mindustry/entities/Damage.java | 13 ++++++++----- core/src/mindustry/entities/EntityGroup.java | 4 +++- .../world/blocks/distribution/StackConveyor.java | 4 ++-- .../mindustry/world/blocks/logic/LogicBlock.java | 5 ++--- gradle.properties | 2 +- 6 files changed, 17 insertions(+), 13 deletions(-) diff --git a/core/src/mindustry/core/NetServer.java b/core/src/mindustry/core/NetServer.java index 5204fbd53d..1d97c9c63d 100644 --- a/core/src/mindustry/core/NetServer.java +++ b/core/src/mindustry/core/NetServer.java @@ -41,7 +41,7 @@ public class NetServer implements ApplicationListener{ private static final Vec2 vector = new Vec2(); private static final Rect viewport = new Rect(); /** If a player goes away of their server-side coordinates by this distance, they get teleported back. */ - private static final float correctDist = tilesize * 12f; + private static final float correctDist = tilesize * 14f; public final Administration admins = new Administration(); public final CommandHandler clientCommands = new CommandHandler("/"); diff --git a/core/src/mindustry/entities/Damage.java b/core/src/mindustry/entities/Damage.java index e3f9be816b..5e55849407 100644 --- a/core/src/mindustry/entities/Damage.java +++ b/core/src/mindustry/entities/Damage.java @@ -248,7 +248,7 @@ public class Damage{ tmpUnit = null; - Cons cons = e -> { + Units.nearbyEnemies(hitter.team, rect, e -> { if((tmpUnit != null && e.dst2(x, y) > tmpUnit.dst2(x, y)) || !e.checkTarget(hitter.type.collidesAir, hitter.type.collidesGround)) return; e.hitbox(hitrect); @@ -263,9 +263,7 @@ public class Damage{ if(vec != null){ tmpUnit = e; } - }; - - Units.nearbyEnemies(hitter.team, rect, cons); + }); if(tmpBuilding != null && tmpUnit != null){ if(Mathf.dst2(x, y, tmpUnit.getX(), tmpUnit.getY()) <= Mathf.dst2(x, y, tmpBuilding.getX(), tmpBuilding.getY())){ @@ -339,7 +337,12 @@ public class Damage{ /** Damages all entities and blocks in a radius that are enemies of the team. */ public static void damage(Team team, float x, float y, float radius, float damage, boolean complete, boolean air, boolean ground){ - Cons cons = entity -> { + Cons cons + + + + + = entity -> { if(entity.team == team || !entity.within(x, y, radius) || (entity.isFlying() && !air) || (entity.isGrounded() && !ground)){ return; } diff --git a/core/src/mindustry/entities/EntityGroup.java b/core/src/mindustry/entities/EntityGroup.java index 6553e72d44..39ff8ee901 100644 --- a/core/src/mindustry/entities/EntityGroup.java +++ b/core/src/mindustry/entities/EntityGroup.java @@ -55,7 +55,9 @@ public class EntityGroup implements Iterable{ } public void update(){ - each(Entityc::update); + for(index = 0; index < array.size; index++){ + array.items[index].update(); + } } public Seq copy(Seq arr){ diff --git a/core/src/mindustry/world/blocks/distribution/StackConveyor.java b/core/src/mindustry/world/blocks/distribution/StackConveyor.java index e44218feb4..bdd5c50ef7 100644 --- a/core/src/mindustry/world/blocks/distribution/StackConveyor.java +++ b/core/src/mindustry/world/blocks/distribution/StackConveyor.java @@ -283,7 +283,7 @@ public class StackConveyor extends Block implements Autotiler{ @Override public void handleItem(Building source, Item item){ - if(items.empty()) poofIn(); + if(items.empty() && tile != null) poofIn(); super.handleItem(source, item); lastItem = item; } @@ -291,7 +291,7 @@ public class StackConveyor extends Block implements Autotiler{ @Override public void handleStack(Item item, int amount, Teamc source){ if(amount <= 0) return; - if(items.empty()) poofIn(); + if(items.empty() && tile != null) poofIn(); super.handleStack(item, amount, source); lastItem = item; } diff --git a/core/src/mindustry/world/blocks/logic/LogicBlock.java b/core/src/mindustry/world/blocks/logic/LogicBlock.java index d1cb1e0f10..8890c36faf 100644 --- a/core/src/mindustry/world/blocks/logic/LogicBlock.java +++ b/core/src/mindustry/world/blocks/logic/LogicBlock.java @@ -47,7 +47,7 @@ public class LogicBlock extends Block{ config(Integer.class, (LogicBuild entity, Integer pos) -> { //if there is no valid link in the first place, nobody cares if(!entity.validLink(world.build(pos))) return; - Building lbuild = world.build(pos); + var lbuild = world.build(pos); int x = lbuild.tileX(), y = lbuild.tileY(); LogicLink link = entity.links.find(l -> l.x == x && l.y == y); @@ -62,8 +62,7 @@ public class LogicBlock extends Block{ } }else{ entity.links.remove(l -> world.build(l.x, l.y) == lbuild); - LogicLink out = new LogicLink(x, y, entity.findLinkName(lbuild.block), true); - entity.links.add(out); + entity.links.add(new LogicLink(x, y, entity.findLinkName(lbuild.block), true)); } entity.updateCode(entity.code, true, null); diff --git a/gradle.properties b/gradle.properties index ba35000785..6762639015 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xms256m -Xmx1024m -archash=dc282cd5ac5e6017992767f1c3827945c3be40fa +archash=20f1b39b3238d56cff9956db35e808e72d6797b6