-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
If you write a lua cs like
function onBegin()
disablePause()
...
end
and then use a lua cs trigger (but with unskippable = false) to trigger it, then you will actually have 2 frames to skip the cutscene, even if the lua cs seems to prevent pausing
yeah i know we should set unskippable = true in this case, but i just want to write everything here, in case you think this should be improved, or someone else curious about what actually happens
order-or-operation analysis:
Frame 1.
LuaCutsceneTrigger.OnEntercalled (whenPlayer.Update)LuaCutsceneEntityis createdLuaCutsceneEntityis to be added to sceneLuaCutsceneEntity.OnEnterinvokedLevel.Updatedone
Frame 2.
EntityList.UpdateList,LuaCutsceneEntityis actually added into the sceneLuaCutsceneEntityis aCutsceneEntity, soLevel.StartCutsceneis called, andLuaCutsceneEntity.OnBeginis calledLevel.StartCutscenemakes it possible to skip cutscene this frameLuaCutsceneEntity.OnBeginadds anew Coroutine(onBeginWrapper(level))as a component of itself
private IEnumerator onBeginWrapper(Level level)
{
yield return onBeginRoutine;
EndCutscene(level);
}
Level.Updatebegin- Check if pause button is pressed
- If not pause,
Scene.Update LuaCutsceneEntity.Update, which leads to itsCoroutinecomponent update- Coroutine's enumerators consist of one enumerator
onBeginWrapper(level), soonBeginWrapper(level).MoveNextis called, which makesenumerator.Current = onBeginRoutine onBeginRoutineis pushed onto Coroutine's enumerators stack
Frame 3.
- You can still pause and skip cutscene this frame
LuaCutsceneEntity.Update, so theCoroutineupdateonBeginRoutine.MoveNextis called, which finally callsdisablePause, that makeslevel.PauseLock = true, so you can't pause from now on- But pause check is before this
Frame 4.
- You can't pause this frame
Metadata
Metadata
Assignees
Labels
No labels