sm64coopdx/mods/char-select-extra-chars-plus/!misc-functions.lua
Yuyake 1cb8cb8e5e
Some checks failed
Build coop / build-linux (push) Has been cancelled
Build coop / build-steamos (push) Has been cancelled
Build coop / build-windows-opengl (push) Has been cancelled
Build coop / build-windows-directx (push) Has been cancelled
Build coop / build-macos-arm (push) Has been cancelled
Build coop / build-macos-intel (push) Has been cancelled
Extra Characters PLUS v1.0 (#1076)
* Replaces Extra Characters

* Folder inside another folder fix
2026-01-11 02:20:45 +01:00

31 lines
No EOL
837 B
Lua

--- Misc Functions ---
--- @param m MarioState
--- @param name string
--- @param accel? number
--- Plays a custom animation for MarioState `m`
function play_custom_anim(m, name, accel)
accel = accel or 0x10000
m.marioObj.header.gfx.animInfo.animAccel = accel
if (smlua_anim_util_get_current_animation_name(m.marioObj) ~= name or m.marioObj.header.gfx.animInfo.animID ~= -1) then
m.marioObj.header.gfx.animInfo.animID = -1
set_anim_to_frame(m, 0)
end
smlua_anim_util_set_animation(m.marioObj, name)
end
--- @param str string
--- @param splitAt? string
function string.split(str, splitAt)
if splitAt == nil then
splitAt = " "
end
local result = {}
for match in str:gmatch(string.format("[^%s]+", splitAt)) do
table.insert(result, match)
end
return result
end