diff --git a/source/funkin/play/character/BaseCharacter.hx b/source/funkin/play/character/BaseCharacter.hx index 1da456938..d5f774641 100644 --- a/source/funkin/play/character/BaseCharacter.hx +++ b/source/funkin/play/character/BaseCharacter.hx @@ -49,6 +49,11 @@ class BaseCharacter extends Bopper */ public var debug:Bool = false; + /** + * The current note kind. + */ + public var curNoteKind:NoteKind; + /** * This character plays a given animation when hitting these specific combo numbers. */ @@ -513,21 +518,41 @@ class BaseCharacter extends Bopper public override function onNoteHit(event:HitNoteScriptEvent) { super.onNoteHit(event); - // If another script cancelled the event, don't do anything. if (event.eventCanceled) return; + curNoteKind = NoteKindManager.getNoteKind(event.note.noteData.kind); if (event.note.noteData.getMustHitNote() && characterType == BF) { - // If the note is from the same strumline, play the sing animation. - this.playSingAnimation(event.note.noteData.getDirection(), false); - holdTimer = 0; + if (curNoteKind != null) + { + if (!curNoteKind.noanim) + { + this.playSingAnimation(event.note.noteData.getDirection(), false, curNoteKind?.suffix); + holdTimer = 0; + } + } + else + { + this.playSingAnimation(event.note.noteData.getDirection(), false); + holdTimer = 0; + } } else if (!event.note.noteData.getMustHitNote() && characterType == DAD) { - // If the note is from the same strumline, play the sing animation. - this.playSingAnimation(event.note.noteData.getDirection(), false); - holdTimer = 0; + if (curNoteKind != null) + { + if (!curNoteKind.noanim) + { + this.playSingAnimation(event.note.noteData.getDirection(), false, curNoteKind?.suffix); + holdTimer = 0; + } + } + else + { + this.playSingAnimation(event.note.noteData.getDirection(), false); + holdTimer = 0; + } } else if (characterType == GF && event.note.noteData.getMustHitNote()) { @@ -661,6 +686,7 @@ class BaseCharacter extends Bopper // restart even if already playing, because the character might sing the same note twice. // trace('Playing ${anim}...'); + playAnimation(anim, true); } diff --git a/source/funkin/play/notes/notekind/NoteKind.hx b/source/funkin/play/notes/notekind/NoteKind.hx index 700d2f9b3..f472def3b 100644 --- a/source/funkin/play/notes/notekind/NoteKind.hx +++ b/source/funkin/play/notes/notekind/NoteKind.hx @@ -23,6 +23,16 @@ class NoteKind implements INoteScriptedClass */ public var noteStyleId:Null; + /** + * Whether or not the sing animation should play. + */ + public var noanim:Bool; + + /** + * The animation suffix to use. + */ + public var suffix:String; + /** * Custom parameters for the chart editor */ @@ -35,12 +45,14 @@ class NoteKind implements INoteScriptedClass */ public var scoreable:Bool = true; - public function new(noteKind:String, description:String = "", ?noteStyleId:String, ?params:Array) + public function new(noteKind:String, description:String = "", ?noteStyleId:String, ?params:Array, ?anim:Bool, ?suffix:String) { this.noteKind = noteKind; this.description = description; this.noteStyleId = noteStyleId; this.params = params ?? []; + this.noanim = anim ?? false; + this.suffix = suffix ?? ''; } public function toString():String diff --git a/source/funkin/play/notes/notekind/NoteKindManager.hx b/source/funkin/play/notes/notekind/NoteKindManager.hx index 3ae55133e..829615933 100644 --- a/source/funkin/play/notes/notekind/NoteKindManager.hx +++ b/source/funkin/play/notes/notekind/NoteKindManager.hx @@ -129,6 +129,23 @@ class NoteKindManager return noteStyleId; } + /** + * Retrieve custom params of the given note kind + * @param noteKind Name of the note kind + * @return Array + */ + public static function getNoteKind(noteKind:Null):Null + { + if (noteKind == null) + { + return null; + } + else + { + return noteKinds.get(noteKind); + } + } + /** * Retrive custom params of the given note kind * @param noteKind Name of the note kind