Josh64

rest

Jan 16th, 2021
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1.  
  2. function ctc:SwitchCostumeRequirementold(hasTrinket, trinketId, costumeId) -- outdated, but left in just in case with problems with the playerData version
  3. for i = 0, (game:GetNumPlayers() - 1) do
  4. local player = Isaac.GetPlayer(i)
  5. if hasTrinket == true then
  6. if player:GetTrinket(0) ~= nil then -- the player holds at least something
  7. if player:GetTrinket(0) == trinketId
  8. or player:GetTrinket(1) == trinketId then
  9. player:TryRemoveNullCostume(costumeId) -- remove costume
  10.  
  11. -- allow the moddedCos. boolean to be switched in the callback
  12. hasTrinket = false -- switches the moddedCos. variable of the currrent trinket to 'false'..
  13. -- in the MC_EXECUTE_CMD callback of the Mod which calls the function
  14. end
  15. end
  16. end
  17. end
  18. end
  19.  
  20. -- functions used in the MC_POST_UPDATE callback of mods which want the compatibility
  21.  
  22. function ctc:AddTrinketCostume(player, trinketId, costumeId)
  23. if onPickup == false then -- costume would get applied by smelting the trinket
  24. if player:GetTrinket(0) ~= trinketId
  25. and player:GetTrinket(1) ~= trinketId
  26. and applyCostume == true then -- still follows the same rules as base game trinkets
  27.  
  28. -- costume would get applied by smelting the trinket
  29. player:AddNullCostume(costumeId)
  30.  
  31. -- allow the moddedCos. boolean to be switched in the callback
  32. hasTrinketCostume = true -- switches the moddedCos. variable of the curreent trinket to 'true'..
  33. -- in the MC_POST_UPDATE callback of the Mod whihc calls the function
  34. end
  35. else
  36. if player:HasTrinket(trinketId) then
  37. -- costume would get applied by picking up the trinket
  38. player:AddNullCostume(costumeId)
  39.  
  40. -- allow the moddedCos. boolean to be switched in the callback
  41. hasTrinketCostume = true -- switches the moddedCos. variable of the curreent trinket to 'true'..
  42. -- in the MC_POST_UPDATE callback of the Mod whihc calls the function
  43. end
  44. end
  45. end
  46.  
  47.  
  48. -- ex. ctc:RemoveTrinketCostume(player, costumeId)
  49. function ctc:RemoveTrinketCostume (player, trinketId, costumeId)
  50. if not player:HasTrinket(trinketId) then
  51. -- costume would get applied by picking up the trinket
  52. player:TryRemoveNullCostume(costumeId)
  53. end
  54. end
Advertisement
Add Comment
Please, Sign In to add comment