custom states
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
1325
|
||||
1326
|
||||
@@ -0,0 +1,7 @@
|
||||
package funkin.scripting;
|
||||
|
||||
class ModState extends MusicBeatState {
|
||||
public function new(stateName:String) {
|
||||
super(true, stateName);
|
||||
}
|
||||
}
|
||||
@@ -32,10 +32,11 @@ class Script extends FlxBasic implements IFlxDestroyable {
|
||||
// Flixel related stuff
|
||||
"FlxG" => flixel.FlxG,
|
||||
"FlxSprite" => flixel.FlxSprite,
|
||||
"FlxEase" => flixel.tweens.FlxEase,
|
||||
"FlxTween" => flixel.tweens.FlxTween,
|
||||
"FlxBasic" => flixel.FlxBasic,
|
||||
"FlxCamera" => flixel.FlxCamera,
|
||||
"state" => flixel.FlxG.state,
|
||||
"FlxEase" => flixel.tweens.FlxEase,
|
||||
"FlxTween" => flixel.tweens.FlxTween,
|
||||
"FlxSound" => flixel.system.FlxSound,
|
||||
"FlxAssets" => flixel.system.FlxAssets,
|
||||
"FlxMath" => flixel.math.FlxMath,
|
||||
@@ -53,6 +54,7 @@ class Script extends FlxBasic implements IFlxDestroyable {
|
||||
build: funkin.macros.BuildCounterMacro.getBuildNumber(),
|
||||
name: "Codename Engine"
|
||||
},
|
||||
"ModState" => funkin.scripting.ModState,
|
||||
"PlayState" => funkin.game.PlayState,
|
||||
"GameOverSubstate" => funkin.game.GameOverSubstate,
|
||||
"Note" => funkin.game.Note,
|
||||
@@ -68,8 +70,11 @@ class Script extends FlxBasic implements IFlxDestroyable {
|
||||
"Paths" => funkin.system.Paths,
|
||||
"Conductor" => funkin.system.Conductor,
|
||||
"CoolUtil" => funkin.system.CoolUtil,
|
||||
"XMLUtil" => funkin.system.XMLUtil,
|
||||
"FunkinShader" => funkin.shaders.FunkinShader,
|
||||
"CustomShader" => funkin.shaders.CustomShader,
|
||||
"FunkinText" => funkin.ui.FunkinText,
|
||||
"Alphabet" => funkin.ui.Alphabet,
|
||||
];
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -70,12 +70,15 @@ class MusicBeatState extends FlxUIState implements IBeatReceiver
|
||||
|
||||
public var scriptsAllowed:Bool = true;
|
||||
|
||||
public var scriptName:String = null;
|
||||
|
||||
inline function get_controls():Controls
|
||||
return PlayerSettings.player1.controls;
|
||||
|
||||
public function new(scriptsAllowed:Bool = true) {
|
||||
public function new(scriptsAllowed:Bool = true, ?scriptName:String) {
|
||||
super();
|
||||
this.scriptsAllowed = scriptsAllowed;
|
||||
this.scriptName = scriptName;
|
||||
loadScript();
|
||||
}
|
||||
|
||||
@@ -83,7 +86,7 @@ class MusicBeatState extends FlxUIState implements IBeatReceiver
|
||||
if (scriptsAllowed) {
|
||||
if (stateScript == null || stateScript is DummyScript) {
|
||||
var className = Type.getClassName(Type.getClass(this));
|
||||
var scriptName = className.substr(className.lastIndexOf(".")+1);
|
||||
var scriptName = this.scriptName != null ? this.scriptName : className.substr(className.lastIndexOf(".")+1);
|
||||
|
||||
stateScript = Script.create(Paths.script('data/states/${scriptName}'));
|
||||
stateScript.setParent(this);
|
||||
|
||||
Reference in New Issue
Block a user