Added some more documentation

This commit is contained in:
Ne_Eo
2024-12-16 04:37:18 +01:00
parent a6c99754fd
commit aec73ab2b6
25 changed files with 298 additions and 12 deletions
+19
View File
@@ -8,6 +8,7 @@ import lime.app.Application;
@:allow(funkin.backend.scripting.ScriptPack)
/**
* Class used for scripting.
* Use `Script.create` to create a script.
*/
class Script extends FlxBasic implements IFlxDestroyable {
/**
@@ -16,6 +17,9 @@ class Script extends FlxBasic implements IFlxDestroyable {
*/
public static var staticVariables:Map<String, Dynamic> = [];
/**
* Gets the default variables for a script.
*/
public static function getDefaultVariables(?script:Script):Map<String, Dynamic> {
return [
// Haxe related stuff
@@ -141,6 +145,10 @@ class Script extends FlxBasic implements IFlxDestroyable {
return redirects;
}
/**
* Gets the default defines for a script.
* Includes all of the defines that the build was compiled with.
*/
public static function getDefaultPreprocessors():Map<String, Dynamic> {
var defines = funkin.backend.system.macros.DefinesMacro.defines;
defines.set("CODENAME_ENGINE", true);
@@ -182,6 +190,10 @@ class Script extends FlxBasic implements IFlxDestroyable {
private var didLoad:Bool = false;
/**
* Remapped filenames.
* Used for trace messages, to show what mod the script is from.
*/
public var remappedNames:Map<String, String> = [];
/**
@@ -366,7 +378,14 @@ class Script extends FlxBasic implements IFlxDestroyable {
private function onCall(func:String, parameters:Array<Dynamic>):Dynamic {
return null;
}
/**
* Called when the script is created.
* @param path Path to the script
*/
public function onCreate(path:String) {}
/**
* Called when the script is loaded.
*/
public function onLoad() {}
}