From 4d2c36e2d42ccb40fed5ec38157163152a3755ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=8D=9A=7ENex?= <87421482+NexIsDumb@users.noreply.github.com> Date: Fri, 31 May 2024 20:38:00 +0200 Subject: [PATCH] making certain scripts break less --- source/funkin/game/Character.hx | 18 +++++++++--------- source/funkin/game/PlayState.hx | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/source/funkin/game/Character.hx b/source/funkin/game/Character.hx index f902d39a..69afc69e 100644 --- a/source/funkin/game/Character.hx +++ b/source/funkin/game/Character.hx @@ -73,20 +73,20 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset } /** - * Like `playSingAnim` but checks if the character has the animation with the suffix part, otherwhise tries to play the animation without the suffix part. + * Like `playSingAnimUnsafe` but checks if the character has the animation with the suffix part, otherwhise tries to play the animation without the suffix part. */ - public function playSafeSingAnim(direction:Int, suffix:String = "", Context:PlayAnimContext = SING, Force:Bool = true, Reversed:Bool = false, Frame:Int = 0) - { - var event = EventManager.get(DirectionAnimEvent).recycle(getSingAnim(direction, suffix), direction, suffix, Context, Reversed, Frame, Force); - script.call("onPlaySafeSingAnim", [event]); - if (!event.cancelled) - playSingAnim(event.direction, hasAnimation(event.animName) ? event.suffix : "", event.context, event.force, event.reversed, event.frame); - } - public function playSingAnim(direction:Int, suffix:String = "", Context:PlayAnimContext = SING, Force:Bool = true, Reversed:Bool = false, Frame:Int = 0) { var event = EventManager.get(DirectionAnimEvent).recycle(getSingAnim(direction, suffix), direction, suffix, Context, Reversed, Frame, Force); script.call("onPlaySingAnim", [event]); + if (!event.cancelled) + playSingAnimUnsafe(event.direction, hasAnimation(event.animName) ? event.suffix : "", event.context, event.force, event.reversed, event.frame); + } + + public function playSingAnimUnsafe(direction:Int, suffix:String = "", Context:PlayAnimContext = SING, Force:Bool = true, Reversed:Bool = false, Frame:Int = 0) + { + var event = EventManager.get(DirectionAnimEvent).recycle(getSingAnim(direction, suffix), direction, suffix, Context, Reversed, Frame, Force); + script.call("onPlaySingAnimUnsafe", [event]); if (!event.cancelled) playAnim(event.animName, event.force, event.context, event.reversed, event.frame); } diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index fdbe0444..f585e89f 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1572,7 +1572,7 @@ class PlayState extends MusicBeatState if (char == null) continue; if(event.stunned) char.stunned = true; - char.playSafeSingAnim(directionID, event.animSuffix, MISS, event.forceAnim); + char.playSingAnim(directionID, event.animSuffix, MISS, event.forceAnim); } } @@ -1653,7 +1653,7 @@ class PlayState extends MusicBeatState if (!event.animCancelled) for(char in event.characters) if (char != null) - char.playSafeSingAnim(event.direction, event.animSuffix, SING, event.forceAnim); + char.playSingAnim(event.direction, event.animSuffix, SING, event.forceAnim); if (event.note.__strum != null) { if (!event.strumGlowCancelled) event.note.__strum.press(event.note.strumTime);