-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.lua
33 lines (25 loc) · 879 Bytes
/
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
local suppository_mod = RegisterMod("suppository", 1)
local suppositoryTrinket = Isaac.GetTrinketIdByName("Suppository")
local shouldUseSuppository = false
function suppository_mod:curseEval(Curses)
local player = Isaac.GetPlayer(0)
if player:HasTrinket(suppositoryTrinket) then
local level = Game():GetLevel()
local curses = level:GetCurses()
if (curses > 0) then
shouldUseSuppository = true
end
end
end
function suppository_mod:useSuppository()
if(shouldUseSuppository) then
local player = Isaac.GetPlayer(0)
local level = Game():GetLevel()
level:RemoveCurses()
player:TryRemoveTrinket(suppositoryTrinket)
player:AnimateHappy()
shouldUseSuppository = false
end
end
suppository_mod:AddCallback(ModCallbacks.MC_POST_CURSE_EVAL, suppository_mod.curseEval)
suppository_mod:AddCallback(ModCallbacks.MC_POST_UPDATE, suppository_mod.useSuppository)