Properly implement everything in PAC

Signed-off-by: Ayane Satomi <ayane@vignetteapp.org>
This commit is contained in:
Ayane Satomi 2022-04-19 01:08:34 +08:00
parent ff6c079fd4
commit 57b3f69d27

View file

@ -36,13 +36,15 @@ function playMusic(music)
-- FIXME: This doesn't know how to clean out music
local audio = pac.CreatePart("mmd_audio_" .. tostring(music))
audio:SetURL(tostring(music))
audio:SetVolume(1)
audio:SetPitch(1)
audio:SetStopOnHide(true)
audio:SetPauseOnHide(true)
audio:SetPath(tostring(music))
audio:SetParent(self)
end
for _, part in pairs(pac.GetLocalParts()) do
if part.ClassName == "group" then
part:SetParent(part)
break
end
end
function cleanupAudio(music)
local name = "mmd_audio_" .. tostring(music)
@ -63,5 +65,12 @@ function custom_taunts:OnDanceChanged(sid64, newdata)
--FIXME: find a way to clean this out!
playMusic(music)
end
if newdata.type == INFO_TYPES.Stop then
for _, part in pairs(pac.GetLocalParts()) do
if string.find(part:Name(), "/mmd_music_([A-zA0-9])+/") == true pac.RemovePart(part) end
end
end
end