Skip to content

Commit

Permalink
making certain scripts break less
Browse files Browse the repository at this point in the history
  • Loading branch information
NexIsDumb committed May 31, 2024
1 parent f259d62 commit 4d2c36e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions source/funkin/game/Character.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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("onPlaySafeSingAnim", [event]);
script.call("onPlaySingAnim", [event]);
if (!event.cancelled)
playSingAnim(event.direction, hasAnimation(event.animName) ? event.suffix : "", event.context, event.force, event.reversed, event.frame);
playSingAnimUnsafe(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)
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("onPlaySingAnim", [event]);
script.call("onPlaySingAnimUnsafe", [event]);
if (!event.cancelled)
playAnim(event.animName, event.force, event.context, event.reversed, event.frame);
}
Expand Down
4 changes: 2 additions & 2 deletions source/funkin/game/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 4d2c36e

Please sign in to comment.