From a0569a63bce60137f86b0754602214fb7139ae10 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 25 May 2024 21:50:12 -0400 Subject: [PATCH] Possible entity collision variable overwrite fix --- .../src/mindustry/entities/EntityCollisions.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/core/src/mindustry/entities/EntityCollisions.java b/core/src/mindustry/entities/EntityCollisions.java index 1dfc9ef86f..ca1be49af4 100644 --- a/core/src/mindustry/entities/EntityCollisions.java +++ b/core/src/mindustry/entities/EntityCollisions.java @@ -16,7 +16,7 @@ public class EntityCollisions{ //tile collisions private Vec2 vector = new Vec2(), l1 = new Vec2(); - private Rect r1 = new Rect(), r2 = new Rect(), tmp = new Rect(); + private Rect r1 = new Rect(), r2 = new Rect(), r3 = new Rect(), r4 = new Rect(), tmp = new Rect(); //entity collisions private Seq arrOut = new Seq<>(Hitboxc.class); @@ -218,12 +218,12 @@ public class EntityCollisions{ } private void updateCollision(Hitboxc solid){ - solid.hitbox(r1); - r1.x += (solid.lastX() - solid.getX()); - r1.y += (solid.lastY() - solid.getY()); + solid.hitbox(r3); + r3.x += (solid.lastX() - solid.getX()); + r3.y += (solid.lastY() - solid.getY()); - solid.hitbox(r2); - r2.merge(r1); + solid.hitbox(r4); + r4.merge(r3); arrOut.clear(); @@ -235,8 +235,8 @@ public class EntityCollisions{ for(int i = 0; i < size; i++){ Hitboxc sc = items[i]; - sc.hitbox(r1); - if(r2.overlaps(r1)){ + sc.hitbox(r3); + if(r4.overlaps(r3)){ checkCollide(solid, sc); //break out of loop when this object hits something if(!solid.isAdded()) return;