Giter Site home page Giter Site logo

luacutscenes's People

Contributors

cruor avatar demojameson avatar jatheplayer avatar rhelmot avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

luacutscenes's Issues

Followers don't persist through teleports

Golden berries, regular berries, and (presumably) keys (though I have not tested those) don't persist through teleports like they should. Probably best to look at other teleport impls like in VivHelper or ContortHelper and just copypaste from there.

Teleport adds Player after Awake, breaking some entities

InstantTeleport and InstantTeleportTo readd the player to the level after it's reloaded, meaning the player isn't there during Awake, which some entities rely on. Just adding the player before then is sufficient to fix it. Here's a diff.txt of the code that fixes it, as well as a screenshot , and a mod with the fix. (Note this mod also contains code for limiting debris from spinner breakage - this is unrelated.)

Cutscene crashes on running a private coroutine

Not sure what magic makes it work for regular private methods, but it unfortunately doesn't work for coroutines. Here's a simple cutscene that can be used to replicate the crash:

function onBegin()
  getRoom():Options(0, false)
end

Options attempts to run CloseAndRun from Level and then crashes. You can also see this by attempting to run this one while over a watchtower:

function onBegin()
  celeste.Lookout.Interact(player)
end

...as Interact tries to run LookRoutine and also crashes.
In general any private coroutine will crash even if it's not wrapped in a method like the 2 examples above - see coroutine.yield(celeste.Lookout.LookRoutine), that also crashes.

A subtle order-of-operation issue

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.OnEnter called (when Player.Update)
  • LuaCutsceneEntity is created
  • LuaCutsceneEntity is to be added to scene
  • LuaCutsceneEntity.OnEnter invoked
  • Level.Update done

Frame 2.

  • EntityList.UpdateList, LuaCutsceneEntity is actually added into the scene
  • LuaCutsceneEntity is a CutsceneEntity, so Level.StartCutscene is called, and LuaCutsceneEntity.OnBegin is called
  • Level.StartCutscene makes it possible to skip cutscene this frame
  • LuaCutsceneEntity.OnBegin adds a new Coroutine(onBeginWrapper(level)) as a component of itself
	private IEnumerator onBeginWrapper(Level level)
	{
		yield return onBeginRoutine;
		EndCutscene(level);
	}
  • Level.Update begin
  • Check if pause button is pressed
  • If not pause, Scene.Update
  • LuaCutsceneEntity.Update, which leads to its Coroutine component update
  • Coroutine's enumerators consist of one enumerator onBeginWrapper(level), so onBeginWrapper(level).MoveNext is called, which makes enumerator.Current = onBeginRoutine
  • onBeginRoutine is pushed onto Coroutine's enumerators stack

Frame 3.

  • You can still pause and skip cutscene this frame
  • LuaCutsceneEntity.Update, so the Coroutine update
  • onBeginRoutine.MoveNext is called, which finally calls disablePause, that makes level.PauseLock = true, so you can't pause from now on
  • But pause check is before this

Frame 4.

  • You can't pause this frame

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.