How would I make followitems (specifically MT_TAILSOVERLAY) work with custom states?

Gemini0

That Icy Guy
I'm currently trying to modify Continue State Switcher to be an entire emote system, starting with sitting, but I've run into a problem...

Tails, when sitting, doesn't have his tails.

Is there a way I can finangle MT_TAILSOVERLAY or a similar object to make this work, or do I just have to bake the tails into the sprites?
Tails sitting on a tall block in Greenflower Zone Act 1. He doesn't have his tails.

EDIT: Nevermind, I got it working, thanks to Inferno:
Lua:
-- Holy shit Inferno. Thank you so much for letting me use this and helping me fix it.
-- This code's mostly from mctails, but it's based on the SRB2 source code anyway.
-- I asked if I could share this code, and he said:
-- Inferno, today @ 2:07 PM EST: "That's all good."
addHook("FollowMobj", function(player, tails)
    if not (player.mo.skin == "mctails" or player.mo.skin == "tails") return end
    if player.mo.state == S_PLAYSIT
        tails.angle = player.drawangle
        tails.scale = player.mo.scale
        tails.state = S_TAILSOVERLAY_PLUS60DEGREES
        tails.skin = player.mo.skin
    -- horizontal offsets
        local zoffs = FixedMul(-16*FRACUNIT, tails.scale)
        local backwards = 16
        backwards = ($ - (8*FRACUNIT)) / 2
        if (player.mo.eflags & MFE_VERTICALFLIP)
            P_MoveOrigin(tails,
            player.mo.x + P_ReturnThrustX(tails, tails.angle, FixedMul(backwards, tails.scale)),
            player.mo.y + P_ReturnThrustY(tails, tails.angle, FixedMul(backwards, tails.scale)),
            player.mo.z - zoffs)
        else
            P_MoveOrigin(tails,
            player.mo.x + P_ReturnThrustX(tails, tails.angle, FixedMul(backwards, tails.scale)),
            player.mo.y + P_ReturnThrustY(tails, tails.angle, FixedMul(backwards, tails.scale)),
            player.mo.z + zoffs)
        end
        return true
    end
end, MT_TAILSOVERLAY)
 
Last edited:

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top