mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 15:20:52 +01:00
Fixed some status issue when walking
This commit is contained in:
parent
13a05d1c07
commit
a56abbed35
@ -6,7 +6,7 @@ import lombok.Getter;
|
|||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum RoomUnitStatus {
|
public enum RoomUnitStatus {
|
||||||
MOVE("mv", true),
|
MOVE("mv"),
|
||||||
|
|
||||||
// SIT
|
// SIT
|
||||||
SIT_IN("sit-in"),
|
SIT_IN("sit-in"),
|
||||||
|
@ -108,13 +108,18 @@ public abstract class RoomUnit extends RoomEntity {
|
|||||||
//RoomHabbo
|
//RoomHabbo
|
||||||
this.isKicked = false;
|
this.isKicked = false;
|
||||||
this.overridableTiles = new THashSet<>();
|
this.overridableTiles = new THashSet<>();
|
||||||
|
this.statusUpdateNeeded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RoomItem getCurrentItem() {
|
public RoomItem getCurrentItem() {
|
||||||
return this.room.getRoomItemManager().getTopItemAt(this.currentPosition);
|
return this.room.getRoomItemManager().getTopItemAt(this.currentPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void cycle();
|
public void cycle() {
|
||||||
|
if(this.isWalking()) {
|
||||||
|
this.processWalking();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RoomUnit setCurrentPosition(RoomTile tile) {
|
public RoomUnit setCurrentPosition(RoomTile tile) {
|
||||||
@ -291,7 +296,7 @@ public abstract class RoomUnit extends RoomEntity {
|
|||||||
RoomItem item = this.room.getRoomItemManager().getTopItemAt(this.currentPosition.getX(), this.currentPosition.getY());
|
RoomItem item = this.room.getRoomItemManager().getTopItemAt(this.currentPosition.getX(), this.currentPosition.getY());
|
||||||
if (item == null || !item.getBaseItem().allowSit() || !item.getBaseItem().allowLay()) {
|
if (item == null || !item.getBaseItem().allowSit() || !item.getBaseItem().allowLay()) {
|
||||||
this.cmdStandEnabled = true;
|
this.cmdStandEnabled = true;
|
||||||
this.setBodyRotation(RoomRotation.values()[this.getBodyRotation().getValue() - this.getBodyRotation().getValue() % 2]);
|
this.bodyRotation = RoomRotation.values()[this.getBodyRotation().getValue() - this.getBodyRotation().getValue() % 2];
|
||||||
this.removeStatus(RoomUnitStatus.SIT);
|
this.removeStatus(RoomUnitStatus.SIT);
|
||||||
this.instantUpdate();
|
this.instantUpdate();
|
||||||
}
|
}
|
||||||
@ -303,7 +308,7 @@ public abstract class RoomUnit extends RoomEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.cmdSitEnabled = true;
|
this.cmdSitEnabled = true;
|
||||||
this.setBodyRotation(RoomRotation.values()[this.getBodyRotation().getValue() - this.getBodyRotation().getValue() % 2]);
|
this.bodyRotation = RoomRotation.values()[this.getBodyRotation().getValue() - this.getBodyRotation().getValue() % 2];
|
||||||
this.addStatus(RoomUnitStatus.SIT, "0.5");
|
this.addStatus(RoomUnitStatus.SIT, "0.5");
|
||||||
|
|
||||||
if(this instanceof RoomAvatar roomAvatar) {
|
if(this instanceof RoomAvatar roomAvatar) {
|
||||||
@ -474,42 +479,40 @@ public abstract class RoomUnit extends RoomEntity {
|
|||||||
* Note: This method is typically called in a loop to facilitate continuous character movement.
|
* Note: This method is typically called in a loop to facilitate continuous character movement.
|
||||||
*/
|
*/
|
||||||
public void processWalking() {
|
public void processWalking() {
|
||||||
if(this.isWalking()) {
|
this.statuses.entrySet().removeIf(entry -> entry.getKey().isRemoveWhenWalking());
|
||||||
this.statuses.entrySet().removeIf(entry -> entry.getKey().isRemoveWhenWalking());
|
|
||||||
|
|
||||||
if(this.getNextPosition() != null) {
|
if(this.getNextPosition() != null) {
|
||||||
this.currentPosition = this.getNextPosition();
|
this.currentPosition = this.getNextPosition();
|
||||||
this.currentZ = this.getNextZ();
|
this.currentZ = this.getNextZ();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!this.path.isEmpty()) {
|
||||||
|
RoomTile next = this.path.poll();
|
||||||
|
|
||||||
|
if(this.path.size() > 1 && this.cmdFastWalkEnabled) {
|
||||||
|
next = this.path.poll();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!this.path.isEmpty()) {
|
if(next == null || !this.isValidTile(next)) {
|
||||||
RoomTile next = this.path.poll();
|
this.path.clear();
|
||||||
|
this.findPath();
|
||||||
|
|
||||||
if(this.path.size() > 1 && this.cmdFastWalkEnabled) {
|
if(this.path.isEmpty()) {
|
||||||
next = this.path.poll();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(next == null || !this.isValidTile(next)) {
|
next = this.path.poll();
|
||||||
this.path.clear();
|
|
||||||
this.findPath();
|
|
||||||
|
|
||||||
if(this.path.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
next = this.path.poll();
|
|
||||||
}
|
|
||||||
|
|
||||||
RoomRotation nextRotation = this.handleNextRotation(next);
|
|
||||||
double nextHeight = this.handleNextHeight(next);
|
|
||||||
|
|
||||||
this.setRotation(nextRotation);
|
|
||||||
this.addStatus(RoomUnitStatus.MOVE, next.getX() + "," + next.getY() + "," + nextHeight);
|
|
||||||
this.nextPosition = next;
|
|
||||||
this.nextZ = nextHeight;
|
|
||||||
} else {
|
|
||||||
this.stopWalking();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RoomRotation nextRotation = this.handleNextRotation(next);
|
||||||
|
double nextHeight = this.handleNextHeight(next);
|
||||||
|
|
||||||
|
this.setRotation(nextRotation);
|
||||||
|
this.addStatus(RoomUnitStatus.MOVE, next.getX() + "," + next.getY() + "," + nextHeight);
|
||||||
|
this.nextPosition = next;
|
||||||
|
this.nextZ = nextHeight;
|
||||||
|
} else {
|
||||||
|
this.stopWalking();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ public class RoomAvatar extends RoomUnit {
|
|||||||
@Override
|
@Override
|
||||||
public void cycle() {
|
public void cycle() {
|
||||||
this.handleSignStatus();
|
this.handleSignStatus();
|
||||||
this.processWalking();
|
super.cycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user