diff --git a/Emulator/src/main/java/com/eu/habbo/threading/runnables/RebugKickBallAction.java b/Emulator/src/main/java/com/eu/habbo/threading/runnables/RebugKickBallAction.java index 86af53eb..ae098e05 100644 --- a/Emulator/src/main/java/com/eu/habbo/threading/runnables/RebugKickBallAction.java +++ b/Emulator/src/main/java/com/eu/habbo/threading/runnables/RebugKickBallAction.java @@ -4,11 +4,16 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTileState; +import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer; import com.eu.habbo.util.pathfinding.Direction8; import gnu.trove.set.hash.THashSet; +/** + * Alternative football physics based on the Rebug plugin. + * Uses momentum decay (ball slows down over time) and simple 180-degree bounce. + */ public class RebugKickBallAction implements Runnable { private final HabboItem ball; @@ -18,6 +23,9 @@ public class RebugKickBallAction implements Runnable { private boolean isDribble; public boolean dead = false; + // Track tiles traveled since last wall bounce for user-bounce logic + private int tilesSinceBounce = -1; // -1 = no bounce has happened yet + public RebugKickBallAction(HabboItem ball, Room room, Direction8 direction, int momentum) { this.ball = ball; this.room = room; @@ -42,6 +50,7 @@ public class RebugKickBallAction implements Runnable { if (isTileBlocked(nextX, nextY)) { this.direction = this.direction.rotateDirection180Degrees(); + this.tilesSinceBounce = 0; nextX = this.ball.getX() + this.direction.getDiffX(); nextY = this.ball.getY() + this.direction.getDiffY(); } @@ -58,6 +67,20 @@ public class RebugKickBallAction implements Runnable { this.ball.setZ(nextTile.getStackHeight()); this.ball.needsUpdate(true); + // Count tiles since bounce + if (this.tilesSinceBounce >= 0) { + this.tilesSinceBounce++; + } + + // After bouncing, if ball has traveled more than 1 tile from the wall, bounce off users + if (this.tilesSinceBounce > 1 && !this.isDribble) { + THashSet habbos = this.room.getHabbosAt(nextTile.x, nextTile.y); + if (!habbos.isEmpty()) { + this.direction = this.direction.rotateDirection180Degrees(); + this.tilesSinceBounce = 0; + } + } + // Schedule next movement if (!this.isDribble) { long delay = getDelayForMomentum(this.momentum); diff --git a/Latest_Compiled_Version/Habbo-4.0.5-jar-with-dependencies.jar b/Latest_Compiled_Version/Habbo-4.0.5-jar-with-dependencies.jar index 34273136..9a0839d6 100644 Binary files a/Latest_Compiled_Version/Habbo-4.0.5-jar-with-dependencies.jar and b/Latest_Compiled_Version/Habbo-4.0.5-jar-with-dependencies.jar differ