Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Modded trinket support /
- function ctc:UpdateTrinketCostume (trinketBool, trinketId, costumeId)
- -- first get the player
- for i = 0, (game:GetNumPlayers() - 1) do
- local player = Isaac.GetPlayer(i)
- local playerData = player:GetData()
- -- check if the player has the trinket or not
- if player:HasTrinket(trinketId) -- has the trinket, but hasn't gotten the costume yet
- and trinketBool == false then
- -- check if the costume gets applied by smelting or by pickung up the trinket
- if onPickup == false then -- costume would get applied by smelting the trinket
- if player:GetTrinket(0) ~= trinketId
- and player:GetTrinket(1) ~= trinketId -- check if the player doesn't hold the trinket in the moment of smelting
- and applyCostume == true then -- check if the pickup aniamtion ended (still follows the same rules as base game trinkets)
- -- apply costume
- player:AddNullCostume(costumeId)
- -- set trinketBool
- trinketBool = true
- end
- else
- if player:HasTrinket(trinketId) then
- -- costume would get applied by picking up the trinket
- player:AddNullCostume(costumeId)
- trinketBool = true
- end
- end
- elseif (not player:HasTrinket(trinketId)) -- doesn't have the trinket, but still has the costume
- and trinketBool == true then -- again the '1' is a stand in for 'true' since you can't return 'true or false'
- -- remove the costume.
- -- this gets triggert when a new run starts and/or 'onPickup' is set to 'true' and the player dropped the trinket
- player:TryRemoveNullCostume(costumeId)
- trinketBool = false
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment