2022-03-11 01:30:01 -05:00
|
|
|
package funkin.modding;
|
|
|
|
|
|
|
|
import funkin.modding.events.ScriptEvent;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines a set of callbacks available to all scripted classes.
|
2023-06-08 16:30:45 -04:00
|
|
|
*
|
2022-03-11 01:30:01 -05:00
|
|
|
* Includes events handling basic life cycle relevant to all scripted classes.
|
|
|
|
*/
|
|
|
|
interface IScriptedClass
|
|
|
|
{
|
2023-01-22 22:25:45 -05:00
|
|
|
public function onScriptEvent(event:ScriptEvent):Void;
|
2022-03-11 01:30:01 -05:00
|
|
|
|
2023-01-22 22:25:45 -05:00
|
|
|
public function onCreate(event:ScriptEvent):Void;
|
|
|
|
public function onDestroy(event:ScriptEvent):Void;
|
|
|
|
public function onUpdate(event:UpdateScriptEvent):Void;
|
2022-03-11 01:30:01 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-03-14 20:48:45 -04:00
|
|
|
* Defines a set of callbacks available to scripted classes which can follow the game between states.
|
2022-03-11 01:30:01 -05:00
|
|
|
*/
|
2022-03-14 20:48:45 -04:00
|
|
|
interface IStateChangingScriptedClass extends IScriptedClass
|
2022-03-11 01:30:01 -05:00
|
|
|
{
|
2023-01-22 22:25:45 -05:00
|
|
|
public function onStateChangeBegin(event:StateChangeScriptEvent):Void;
|
|
|
|
public function onStateChangeEnd(event:StateChangeScriptEvent):Void;
|
2022-03-21 00:19:05 -04:00
|
|
|
|
2023-06-02 14:34:47 -04:00
|
|
|
public function onSubStateOpenBegin(event:SubStateScriptEvent):Void;
|
|
|
|
public function onSubStateOpenEnd(event:SubStateScriptEvent):Void;
|
|
|
|
public function onSubStateCloseBegin(event:SubStateScriptEvent):Void;
|
|
|
|
public function onSubStateCloseEnd(event:SubStateScriptEvent):Void;
|
2022-03-21 00:19:05 -04:00
|
|
|
}
|
|
|
|
|
2023-05-26 17:10:08 -04:00
|
|
|
/**
|
|
|
|
* Defines a set of callbacks available to scripted classes which can be added to the current state.
|
|
|
|
* Generally requires the class to be an instance of FlxBasic.
|
|
|
|
*/
|
|
|
|
interface IStateStageProp extends IScriptedClass
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Called when the relevant element is added to the game state.
|
|
|
|
*/
|
|
|
|
public function onAdd(event:ScriptEvent):Void;
|
|
|
|
}
|
|
|
|
|
2022-03-21 00:19:05 -04:00
|
|
|
/**
|
|
|
|
* Defines a set of callbacks available to scripted classes which represent notes.
|
|
|
|
*/
|
|
|
|
interface INoteScriptedClass extends IScriptedClass
|
|
|
|
{
|
2023-01-22 22:25:45 -05:00
|
|
|
public function onNoteHit(event:NoteScriptEvent):Void;
|
|
|
|
public function onNoteMiss(event:NoteScriptEvent):Void;
|
2022-03-11 01:30:01 -05:00
|
|
|
}
|
|
|
|
|
2022-03-14 20:48:45 -04:00
|
|
|
/**
|
|
|
|
* Developer note:
|
2023-06-08 16:30:45 -04:00
|
|
|
*
|
2022-03-14 20:48:45 -04:00
|
|
|
* I previously considered adding events for onKeyDown, onKeyUp, mouse events, etc.
|
|
|
|
* However, I realized that you can simply call something like the following within a module:
|
2022-07-06 21:49:42 -04:00
|
|
|
* `FlxG.state.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);`
|
2022-03-14 20:48:45 -04:00
|
|
|
* This is more efficient than adding an entire event handler for every key press.
|
|
|
|
*
|
|
|
|
* -Eric
|
|
|
|
*/
|
2022-03-11 01:30:01 -05:00
|
|
|
/**
|
|
|
|
* Defines a set of callbacks available to scripted classes that involve the lifecycle of the Play State.
|
|
|
|
*/
|
|
|
|
interface IPlayStateScriptedClass extends IScriptedClass
|
|
|
|
{
|
2023-01-22 22:25:45 -05:00
|
|
|
/**
|
|
|
|
* Called when the game is paused.
|
|
|
|
* Has properties to set whether the pause easter egg will happen,
|
|
|
|
* and can be cancelled by scripts.
|
|
|
|
*/
|
|
|
|
public function onPause(event:PauseScriptEvent):Void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when the game is unpaused.
|
|
|
|
*/
|
|
|
|
public function onResume(event:ScriptEvent):Void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when the song has been parsed, before notes have been placed.
|
|
|
|
* Use this to mutate the chart.
|
|
|
|
*/
|
|
|
|
public function onSongLoaded(event:SongLoadScriptEvent):Void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when the song starts (conductor time is 0 seconds).
|
|
|
|
*/
|
|
|
|
public function onSongStart(event:ScriptEvent):Void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when the song ends and the song is about to be unloaded.
|
|
|
|
*/
|
|
|
|
public function onSongEnd(event:ScriptEvent):Void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called as the player runs out of health just before the game over substate is entered.
|
|
|
|
*/
|
|
|
|
public function onGameOver(event:ScriptEvent):Void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when the player restarts the song, either via pause menu or restarting after a game over.
|
|
|
|
*/
|
|
|
|
public function onSongRetry(event:ScriptEvent):Void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when EITHER player hits a note.
|
|
|
|
* Query the note attached to the event to determine if it was hit by the player or CPU.
|
|
|
|
*/
|
|
|
|
public function onNoteHit(event:NoteScriptEvent):Void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when EITHER player (usually the player) misses a note.
|
|
|
|
*/
|
|
|
|
public function onNoteMiss(event:NoteScriptEvent):Void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when the player presses a key when no note is on the strumline.
|
|
|
|
*/
|
|
|
|
public function onNoteGhostMiss(event:GhostMissNoteScriptEvent):Void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when the song reaches an event.
|
|
|
|
*/
|
|
|
|
public function onSongEvent(event:SongEventScriptEvent):Void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called once every step of the song.
|
|
|
|
*/
|
|
|
|
public function onStepHit(event:SongTimeScriptEvent):Void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called once every beat of the song.
|
|
|
|
*/
|
|
|
|
public function onBeatHit(event:SongTimeScriptEvent):Void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when the countdown of the song starts.
|
|
|
|
*/
|
|
|
|
public function onCountdownStart(event:CountdownScriptEvent):Void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when the a part of the countdown happens.
|
|
|
|
*/
|
|
|
|
public function onCountdownStep(event:CountdownScriptEvent):Void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when the countdown of the song ends.
|
|
|
|
*/
|
|
|
|
public function onCountdownEnd(event:CountdownScriptEvent):Void;
|
2022-03-11 01:30:01 -05:00
|
|
|
}
|