diff --git a/core/src/mindustry/entities/comp/UnitComp.java b/core/src/mindustry/entities/comp/UnitComp.java index 950226b0c1..84ebbedc4e 100644 --- a/core/src/mindustry/entities/comp/UnitComp.java +++ b/core/src/mindustry/entities/comp/UnitComp.java @@ -35,7 +35,7 @@ import static mindustry.logic.GlobalVars.*; @Component(base = true) abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, Itemsc, Rotc, Unitc, Weaponsc, Drawc, Syncc, Shieldc, Displayable, Ranged, Minerc, Builderc, Senseable, Settable{ private static final Vec2 tmp1 = new Vec2(), tmp2 = new Vec2(); - static final float warpDst = 20f; + static final float warpDst = 16f; @Import boolean dead, disarmed; @Import float x, y, rotation, maxHealth, drag, armor, hitSize, health, shield, ammo, dragMultiplier, armorOverride, speedMultiplier; @@ -647,7 +647,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I if(y > top) dy -= (y - top)/warpDst; velAddNet(dx * Time.delta, dy * Time.delta); - float margin = tilesize * 2f; + float margin = tilesize * 1f; x = Mathf.clamp(x, left - margin, right - tilesize + margin); y = Mathf.clamp(y, bot - margin, top - tilesize + margin); } diff --git a/core/src/mindustry/game/FogControl.java b/core/src/mindustry/game/FogControl.java index 8d67a35d7f..4ef68bf44d 100644 --- a/core/src/mindustry/game/FogControl.java +++ b/core/src/mindustry/game/FogControl.java @@ -119,8 +119,7 @@ public final class FogControl implements CustomChunk{ var data = data(team); if(data == null) return false; - if(x < 0 || y < 0 || x >= ww || y >= wh) return false; - return data.read.get(x + y * ww); + return data.read.get(Mathf.clamp(x, 0, ww - 1) + Mathf.clamp(y, 0, wh - 1) * ww); } public void resetFog(){