Josh64

Fail modded trinket support

Jan 10th, 2021
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. -- Modded trinket support /
  2. function ctc:UpdateTrinketCostume (trinketBool, trinketId, costumeId)
  3. -- first get the player
  4. for i = 0, (game:GetNumPlayers() - 1) do
  5. local player = Isaac.GetPlayer(i)
  6. local playerData = player:GetData()
  7.  
  8. -- check if the player has the trinket or not
  9. if player:HasTrinket(trinketId) -- has the trinket, but hasn't gotten the costume yet
  10. and trinketBool == false then
  11. -- check if the costume gets applied by smelting or by pickung up the trinket
  12. if onPickup == false then -- costume would get applied by smelting the trinket
  13.  
  14. if player:GetTrinket(0) ~= trinketId
  15. and player:GetTrinket(1) ~= trinketId -- check if the player doesn't hold the trinket in the moment of smelting
  16. and applyCostume == true then -- check if the pickup aniamtion ended (still follows the same rules as base game trinkets)
  17.  
  18.  
  19. -- apply costume
  20. player:AddNullCostume(costumeId)
  21. -- set trinketBool
  22. trinketBool = true
  23. end
  24. else
  25. if player:HasTrinket(trinketId) then
  26. -- costume would get applied by picking up the trinket
  27. player:AddNullCostume(costumeId)
  28.  
  29. trinketBool = true
  30. end
  31. end
  32.  
  33. elseif (not player:HasTrinket(trinketId)) -- doesn't have the trinket, but still has the costume
  34. and trinketBool == true then -- again the '1' is a stand in for 'true' since you can't return 'true or false'
  35. -- remove the costume.
  36. -- this gets triggert when a new run starts and/or 'onPickup' is set to 'true' and the player dropped the trinket
  37. player:TryRemoveNullCostume(costumeId)
  38.  
  39. trinketBool = false
  40. end
  41. end
  42. end
Advertisement
Add Comment
Please, Sign In to add comment