Floogen / FashionSense

Stardew Valley framework which allows for bigger accessories, hairstyles and other appearances. Includes animation support and more.
GNU General Public License v3.0
20 stars 16 forks source link

Farmer Hands Animation crashing #33

Open Neosinf opened 7 months ago

Neosinf commented 7 months ago

Hello

My mod crashes when attempting this single animation, so I have added a compat to avoid it, but it might be worth looking into. I assume that I'm using the animateOnce method correctly. All the parameters sent to it are expected/normal.

Full code below.

Regards

Neosinf

<C#>if (Mod.instance.Helper.ModRegistry.IsLoaded("PeacefulEnd.FashionSense")) {

    return;

}

player.Halt();

FarmerSprite.AnimationFrame carryAnimation;

int frameIndex;

bool frameFlip = false;

switch (direction)
{

    case 0: // Up

        frameIndex = 12;

        break;

    case 1: // Right

        frameIndex = 6;

        break;

    case 2: // Down

        frameIndex = 0;

        break;

    default: // Left

        frameIndex = 6;

        frameFlip = true; // same as right but flipped

        break;

}

carryAnimation = new(frameIndex, timeFrame, true, frameFlip);

player.FarmerSprite.animateOnce(new FarmerSprite.AnimationFrame[1] { carryAnimation });</C#>