Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions source/funkin/game/Character.hx
Original file line number Diff line number Diff line change
Expand Up @@ -581,11 +581,11 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset

var lastIndex = scripts.scripts.indexOf(this.script);
if(lastIndex >= 0) {
if(script == null) // last != null && new == null
if(script == null || script is DummyScript) // last != null && new is unusable
scripts.scripts.splice(lastIndex, 1);
else // last != null && new != null
scripts.scripts[lastIndex] = script;
} else if(script != null) // last == null
} else if(script != null && !(script is DummyScript)) // last == null, DummyScripts are never dispatched
scripts.insert(0, script);

return this.script = script;
Expand Down
7 changes: 5 additions & 2 deletions source/funkin/game/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2386,8 +2386,11 @@ class PlayState extends MusicBeatState

public function addScript(file:String) {
var ext = Path.extension(file).toLowerCase();
if (Script.scriptExtensions.contains(ext))
scripts.add(Script.create(file));
if (Script.scriptExtensions.contains(ext)) {
var script = Script.create(file);
if (script is DummyScript) return;
scripts.add(script);
}
}

// GETTERS & SETTERS
Expand Down
3 changes: 2 additions & 1 deletion source/funkin/game/Stage.hx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ class Stage extends FlxBasic implements IBeatReceiver {
public function loadXml(xml:Access, forceLoadAll:Bool = false) {
if (PlayState.instance == state) {
stageScript = Script.create(Paths.script('data/stages/$stageFile'));
PlayState.instance.scripts.add(stageScript);
if (!(stageScript is DummyScript))
PlayState.instance.scripts.add(stageScript);
stageScript.load();
}

Expand Down