Football fixes

This commit is contained in:
Beny 2020-10-15 13:40:01 +02:00
parent 67c1a3dea7
commit 62ffa14c40
4 changed files with 9 additions and 12 deletions

View File

@ -7,10 +7,7 @@ import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionPushable;
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameTeamItem;
import com.eu.habbo.habbohotel.items.interactions.games.football.goals.InteractionFootballGoal;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.rooms.RoomUserRotation;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.outgoing.rooms.items.ItemStateComposer;
import com.eu.habbo.util.pathfinding.Rotation;
@ -32,7 +29,7 @@ public class InteractionFootball extends InteractionPushable {
@Override
public int getWalkOnVelocity(RoomUnit roomUnit, Room room) {
if (roomUnit.getPath().isEmpty() && roomUnit.tilesWalked() == 2)
if (roomUnit.getPath().isEmpty() && roomUnit.tilesWalked() == 2 && this.getExtradata().equals("1"))
return 0;
if (roomUnit.getPath().size() == 0 && roomUnit.tilesWalked() == 1)
@ -43,7 +40,7 @@ public class InteractionFootball extends InteractionPushable {
@Override
public int getWalkOffVelocity(RoomUnit roomUnit, Room room) {
if (roomUnit.getPath().size() == 0)
if (roomUnit.getPath().size() == 0 && roomUnit.tilesWalked() == 0)
return 6;
return 1;
@ -152,9 +149,9 @@ public class InteractionFootball extends InteractionPushable {
@Override
public boolean validMove(Room room, RoomTile from, RoomTile to) {
if (to == null) return false;
if (to == null || to.state == RoomTileState.INVALID) return false;
HabboItem topItem = room.getTopItemAt(to.x, to.y, this);
return !(!room.getLayout().tileWalkable(to.x, to.y) || (topItem != null && (!topItem.getBaseItem().allowStack() || topItem.getBaseItem().allowSit() || topItem.getBaseItem().allowLay())));
return (topItem == null || topItem.getBaseItem().allowStack());
}
//Events

View File

@ -26,7 +26,7 @@ public class InteractionFootballGoal extends InteractionGameTeamItem {
@Override
public boolean isWalkable() {
return true;
return this.getBaseItem().allowWalk();
}
@Override

View File

@ -512,14 +512,14 @@ public class RoomUnit {
this.startLocation = this.currentLocation;
if (goalLocation != null && !noReset) {
boolean isWalking = this.hasStatus(RoomUnitStatus.MOVE);
this.goalLocation = goalLocation;
this.findPath(); ///< Quadral: this is where we start formulating a path
if (!this.path.isEmpty()) {
this.tilesWalked = 0;
this.tilesWalked = isWalking ? this.tilesWalked : 0;
this.cmdSit = false;
} else {
this.goalLocation = this.currentLocation;
}
}
}

View File

@ -58,7 +58,7 @@ public class FloorItemOnRollerComposer extends MessageComposer {
this.response.appendString(Double.toString(this.oldLocation != null ? this.newZ : (this.item.getZ() + this.heightOffset)));
this.response.appendInt(this.roller != null ? this.roller.getId() : -1);
if(this.oldLocation != null) {
if(this.oldLocation == null) {
this.item.onMove(this.room, this.room.getLayout().getTile(this.item.getX(), this.item.getY()), this.newLocation);
this.item.setX(this.newLocation.x);
this.item.setY(this.newLocation.y);