Cutscene

┗> Class


The underlying class for cutscene types in Kristal. \


Constructor






Methods


Cutscene:after(func: function, replace: boolean?)

Adds a new callback for the end of this cutscene.

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.

Returns:

can_end: boolean

Whether the cutscene is able to be ended.



Cutscene:canResume()

(Called internally) Checks whether the cutscene is ready to resume.

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.

Arguments:

func: fun()boolean?

The function to be run.

replace: boolean?

Whether the new callback should replace all currently active during callbacks.



Cutscene:endCutscene()

(Called internally) Ends the cutscene.

NOTE: If you want to end a cutscene, use return. DO NOT CALL THIS!





Cutscene:gotoCutscene(func: string|function, : any)

Starts executing a new cutscene script specified by func.

Arguments:

func: string|function

The new cutscene script.

: any

Additional arguments to pass to the new cutscene.

Returns:

1: any


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:pause()

Indefinitely pausees the cutscene.

Returns:

1: any


Cutscene:playSound(sound: string, volume: number?, pitch: number?)

Plays a sound.

Arguments:

sound: string
volume: number?
pitch: number?

Returns:

finished: function

A function that returns true once the sound has stopped playing.



Cutscene:resume(: unknown)

Resumes the cutscene if it had been previously paused.

Arguments:

: unknown

Additional arguments that will be returned by the adjacent Cutscene:wait() call.



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(...).

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.

Arguments:

seconds: (number|function)?

When a number, waits this number of seconds before continuing. When a function, waits until this function returns true. (Defaults to 0)

Returns:

...: any

Any values passed into the adjacent Cutscene:resume(...) call.




Undocumented