Constructor
Methods
Cutscene:after(func: function, replace: boolean?)
Adds a new callback for the end of this cutscene.
@param func
— The callback function to set or append to this cutscene.
@param replace
— Whether or not to overwrite all previously defined callbacks on this function.
Arguments:
func: function | The callback function to set or append to this cutscene. |
replace: boolean? | Whether or not to overwrite all previously defined callbacks on this function. |
Returns:
self: Cutscene? |
Cutscene:canEnd()
(Called internally) (Override) Checks whether the cutscene is currently in a state suitable to be ended.
@return can_end
— Whether the cutscene is able to be ended.
Returns:
can_end: boolean | Whether the cutscene is able to be ended. |
Cutscene:canResume()
(Called internally) Checks whether the cutscene is ready to resume.
@return ready
— Whether the cutscene is ready to resume.
@return a
@return b
@return c
@return d
@return e
@return f
Returns:
ready: boolean | Whether the cutscene is ready to resume. |
a: any | |
b: any | |
c: any | |
d: any | |
e: any | |
f: any |
Cutscene:during(func: fun()boolean?, replace: boolean?)
Adds a new during callback to this cutscene.
During callbacks run once every frame during cutscenes, and they can remove themselves from the cutscene by returning false
.
@param func
— The function to be run.
@param replace
— Whether the new callback should replace all currently active during callbacks.
Arguments:
func: fun()boolean? | The function to be run. |
replace: boolean? | Whether the new callback should replace all currently active during callbacks. |
Cutscene:endCutscene()
Ends the cutscene.
Cutscene:gotoCutscene(func: string|function, : unknown)
Starts executing a new cutscene script specified by func
.
@param func
— The new cutscene script.
@param ...
— Additional arguments to pass to the new cutscene.
Arguments:
func: string|function | The new cutscene script. |
: unknown | Additional arguments to pass to the new cutscene. |
Returns:
1: unknown |
Cutscene:onEnd()
(Called internally) Internal callback for when cutscenes end.
Also responsible for calling user defined callbacks from Cutscene:after()
Cutscene:parseFromGetter(getter: fun(...any)fun(...any)|nil, cutscene: string|fun(...any), id: string?, : unknown)
Arguments:
getter: fun(...any)fun(...any)|nil | |
cutscene: string|fun(...any) | |
id: string? | |
: unknown |
Returns:
cutscene: fun(...any) | |
args: table |
Cutscene:playSound(sound: string, volume: number?, pitch: number?)
Plays a sound.
@return finished
— A function that returns true
once the sound has stopped playing.
Arguments:
sound: string | |
volume: number? | |
pitch: number? |
Returns:
finished: function | A function that returns |
Cutscene:resume(: unknown)
Resumes the cutscene if it had been previously paused.
@param ...
— Additional arguments that will be returned by the adjacent Cutscene:wait()
call.
Arguments:
: unknown | Additional arguments that will be returned by the adjacent |
Cutscene:tryResume()
(Called internally) Checks whether the cutscene is ready to be resumed, and resumes it if the check succeeds.
Any additional return values from Cutscene:canResume()
are passed through into Cutscene:resume(...)
.
@return success
— Whether the cutscene successfully resumed.
Returns:
success: boolean | Whether the cutscene successfully resumed. |
Cutscene:update()
(Override) Runs once every frame that the cutscene instance exists (including when suspended).
New cutscene types should always call super.update(self)
if they override this function!
See: Cutscene.during if you are looking to run code every frame in a cutscene script.
Cutscene:wait(seconds: (number|function)?)
Temporarily suspends execution of the cutscene script.
@param seconds
— When a number
, waits this number of seconds before continuing. When a function
, waits until this function returns true
. (Defaults to 0
)
@return ...
— Any values passed into the adjacent Cutscene:resume(...) call.
Arguments:
seconds: (number|function)? | When a |
Returns:
...: any | Any values passed into the adjacent Cutscene:resume(...) call. |