Skip to content

Commit

Permalink
Stop item movement on out-of-bounds error
Browse files Browse the repository at this point in the history
* Instead of throwing an error, just stop the movement of the item and run the callback when it tries to go out-of-bounds with the ARRIVED_NEAR error code. This prevents location loading issues when the GS resumes item movement in `Item.gsOnLoad` (specifically Yoga frogs).
  • Loading branch information
Whizy committed Jul 15, 2018
1 parent 91b2579 commit 322edad
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/model/ItemMovement.js
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,8 @@ ItemMovement.prototype.moveStep = function moveStep() {
var nextStep = this.transport(this.path[0]);
if (nextStep && !nextStep.forceStop) {
if (nextStep.dx < this.getGeo().l || nextStep.dx > this.getGeo().r) {
throw new NpcMovementError(this, 'step destination out of bounds');
log.warn('movement: step destination out of bounds for %s', this.item);
return this.stopMove(MOVE_CB_STATUS.ARRIVED_NEAR);
}
// actually move and announce the resulting changes
this.item.setXY(nextStep.dx, nextStep.dy);
Expand Down

0 comments on commit 322edad

Please sign in to comment.