Fixed script release
breaking followers when called mid-movement.
This commit is contained in:
parent
c78736c94f
commit
570b5927c2
1 changed files with 9 additions and 1 deletions
10
src/scrcmd.c
10
src/scrcmd.c
|
@ -1032,7 +1032,15 @@ bool8 ScrCmd_applymovement_at(struct ScriptContext *ctx)
|
|||
|
||||
static bool8 WaitForMovementFinish(void)
|
||||
{
|
||||
return ScriptMovement_IsObjectMovementFinished(sMovingNpcId, sMovingNpcMapNum, sMovingNpcMapGroup);
|
||||
if (ScriptMovement_IsObjectMovementFinished(sMovingNpcId, sMovingNpcMapNum, sMovingNpcMapGroup)) {
|
||||
struct ObjectEvent *objEvent = GetFollowerObject();
|
||||
// If the follower is still entering the pokeball, wait for it to finish too
|
||||
// This prevents a `release` after this script command from getting the follower stuck in an intermediate state
|
||||
if (sMovingNpcId != OBJ_EVENT_ID_FOLLOWER && objEvent && ObjectEventGetHeldMovementActionId(objEvent) == MOVEMENT_ACTION_ENTER_POKEBALL)
|
||||
return ScriptMovement_IsObjectMovementFinished(objEvent->localId, objEvent->mapNum, objEvent->mapGroup);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 ScrCmd_waitmovement(struct ScriptContext *ctx)
|
||||
|
|
Loading…
Reference in a new issue