making certain scripts break less

This commit is contained in:
⍚~Nex
2024-05-31 20:38:00 +02:00
parent f259d626cf
commit 4d2c36e2d4
2 changed files with 11 additions and 11 deletions
+9 -9
View File
@@ -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);
}
+2 -2
View File
@@ -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);