This commit is contained in:
Yoshman29
2023-03-25 01:54:09 +01:00
parent 0ad31331a1
commit f22c5e754f
2 changed files with 14 additions and 1 deletions
+11 -1
View File
@@ -11,6 +11,7 @@ import funkin.scripting.events.*;
using StringTools;
@:allow(funkin.game.PlayState)
class Note extends FlxSprite
{
public var strumTime:Float = 0;
@@ -88,8 +89,16 @@ class Note extends FlxSprite
public static var swagWidth:Float = 160 * 0.7;
private static var __customNoteTypeExists:Map<String, Bool> = [];
public var animSuffix:String = "";
private static function customTypePathExists(path:String) {
if (__customNoteTypeExists.exists(path))
return __customNoteTypeExists[path];
return __customNoteTypeExists[path] = Assets.exists(path);
}
public function new(strumLine:StrumLine, noteData:ChartNote, sustain:Bool = false, sustainLength:Float = 0, sustainOffset:Float = 0)
{
super();
@@ -110,7 +119,8 @@ class Note extends FlxSprite
this.noteData = noteData.id.getDefault(0);
var customType = Paths.image('game/notes/${this.noteType}');
var event = EventManager.get(NoteCreationEvent).recycle(this, strumID, this.noteType, noteTypeID, PlayState.instance.strumLines.indexOf(strumLine), mustPress, Assets.exists(customType) ? 'game/notes/${this.noteType}' : 'game/notes/default', 0.7, animSuffix);
var event = EventManager.get(NoteCreationEvent).recycle(this, strumID, this.noteType, noteTypeID, PlayState.instance.strumLines.indexOf(strumLine), mustPress,
(this.noteType != null && customTypePathExists(customType)) ? 'game/notes/${this.noteType}' : 'game/notes/default', 0.7, animSuffix);
if (PlayState.instance != null)
event = PlayState.instance.scripts.event("onNoteCreation", event);
+3
View File
@@ -475,6 +475,7 @@ class PlayState extends MusicBeatState
@:dox(hide) override public function create()
{
Note.__customNoteTypeExists = [];
// SCRIPTING & DATA INITIALISATION
#if REGION
instance = this;
@@ -845,6 +846,8 @@ class PlayState extends MusicBeatState
FlxG.sound.destroySound(vocals);
}
instance = null;
Note.__customNoteTypeExists = [];
}
@:dox(hide) private function generateSong(?songData:ChartData):Void