mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-15 11:22:55 +00:00
Add one more conditional in atlas + add ignoreExclusions in Bopper/BaseCharacter
This commit is contained in:
parent
6349ba3a5a
commit
68d87a0837
|
@ -95,7 +95,7 @@ class FlxAtlasSprite extends FlxAnimate
|
|||
*/
|
||||
public function hasAnimation(id:String):Bool
|
||||
{
|
||||
return getLabelIndex(id) != -1 || anim.symbolDictionary.exists(id);
|
||||
return getLabelIndex(id) != -1 || anim.symbolDictionary.exists(id) || anim.getByName(id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -151,6 +151,8 @@ class BaseCharacter extends Bopper
|
|||
super(CharacterDataParser.DEFAULT_DANCEEVERY);
|
||||
this.characterId = id;
|
||||
|
||||
ignoreExclusionPref = ["sing"];
|
||||
|
||||
_data = CharacterDataParser.fetchCharacterData(this.characterId);
|
||||
if (_data == null)
|
||||
{
|
||||
|
|
|
@ -260,6 +260,8 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
|
|||
|
||||
public var canPlayOtherAnims:Bool = true;
|
||||
|
||||
public var ignoreExclusionPref:Array<String> = [];
|
||||
|
||||
/**
|
||||
* @param name The name of the animation to play.
|
||||
* @param restart Whether to restart the animation if it is already playing.
|
||||
|
@ -268,7 +270,26 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
|
|||
*/
|
||||
public function playAnimation(name:String, restart:Bool = false, ignoreOther:Bool = false, reversed:Bool = false):Void
|
||||
{
|
||||
if (!canPlayOtherAnims && !ignoreOther) return;
|
||||
if ((!canPlayOtherAnims))
|
||||
{
|
||||
var id = name;
|
||||
if (getCurrentAnimation() == id && restart) {}
|
||||
else if (ignoreExclusionPref != null && ignoreExclusionPref.length > 0)
|
||||
{
|
||||
var detected:Bool = false;
|
||||
for (entry in ignoreExclusionPref)
|
||||
{
|
||||
if (StringTools.startsWith(id, entry))
|
||||
{
|
||||
detected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!detected) return;
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
var correctName = correctAnimationName(name);
|
||||
if (correctName == null) return;
|
||||
|
|
Loading…
Reference in a new issue