-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.lua
48 lines (38 loc) · 1.22 KB
/
main.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
local dd = RegisterMod("Dime Dance", 1)
local musicManager = MusicManager()
function dd:StopSound()
if musicManager:GetCurrentMusicID() == Isaac.GetMusicIdByName("CoinD") then
if Epic then
Epic:DoCostume(false)
end
musicManager:Fadeout()
end
end
function dd:PlaySound()
if musicManager:GetCurrentMusicID() ~= Isaac.GetMusicIdByName("CoinD") then
local currentSongID = musicManager:GetCurrentMusicID()
if Epic then
Epic:DoCostume(true)
end
musicManager:Play(Isaac.GetMusicIdByName("CoinD"), 1)
musicManager:UpdateVolume()
musicManager:Queue(currentSongID)
end
end
function dd:NewRoom()
dd:StopSound()
end
function dd:CheckCoin()
local dimeExists = false
for i, entity in ipairs(Isaac.GetRoomEntities()) do
if entity.Type == 5 and entity.Variant == 20 and entity.SubType == 3 then -- 5.20.3: dime coin
dd:PlaySound()
dimeExists = true
end
end
if not dimeExists then
dd:StopSound()
end
end
dd:AddCallback(ModCallbacks.MC_POST_UPDATE, dd.CheckCoin)
dd:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, dd.NewRoom)