Josh64

Has Stompy

Oct 6th, 2018
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.67 KB | None | 0 0
  1. local Mod = RegisterMod("yourMod", 1)
  2. local game = Game()
  3.  
  4. local stompyItems = 0 -- countes the itmes needed for the transformation
  5. local stompyPills = 0 -- countes the pilles needed for the transformation
  6. local Has = {
  7. Stompy = false -- will be set to true if the player has the transformation
  8. }
  9.  
  10. function Mod:detectStompy(player)
  11.  
  12. local entities = Isaac.GetRoomEntities()
  13.  
  14. -- look for items which contributes to the stompy transformation
  15. for e = 1, #entities do -- go though all the entities in the room
  16. local entity = entities[e]
  17. if entity.Type == EntityType.ENTITY_PICKUP
  18. and entity.Variant == PickupVariant.PICKUP_COLLECTIBLE then -- look for items
  19.  
  20. -- check if the item is Magic Mush
  21. if entity.SubType == CollectibleType.COLLECTIBLE_MAGIC_MUSHROOM then
  22. if (player.Position - entity.Position):Length() < player.Size + entity.Size -- pick up detection code
  23. and not player:HasCollectible(CollectibleType.COLLECTIBLE_MAGIC_MUSHROOM) -- make sure that the player hasn't picked up the item already
  24. then
  25. stompyItems = stompyItems + 1
  26. Mod:SaveData(stompyItems)
  27. end
  28. end
  29.  
  30. -- check if the item is Leo. We do the same stuff as for Magic Mush
  31. if entity.SubType == CollectibleType.COLLECTIBLE_LEO then
  32. if (player.Position - entity.Position):Length() < player.Size + entity.Size -
  33. and not player:HasCollectible(CollectibleType.COLLECTIBLE_STOMPY) then
  34. stompyItems = stompyItems + 1
  35. Mod:SaveData(stompyItems)
  36. end
  37. end
  38. end
  39. end
  40.  
  41. -- check if the player has the Stompy transformation
  42. if (stompyItems + stompyPills) >= 3 then -- taking three 'One makes your larger'-pills or take one pill and have two size increasing items will transform Isaac into Stompy
  43. Has.Stompy = true -- confirm that the player has the Stompy transformation
  44. end
  45.  
  46. if Has.Stompy == true then -- if the player has the transformation
  47. -- then we do stuff
  48. end
  49. end
  50. Mod:AddCallback(ModCallbacks.MC_POST_PEFFECT_UPDATE, Mod.detectStompy)
  51.  
  52. -- check if the player takes a 'One makes you larger'-pill
  53. function Mod:countPills(_PillEffect)
  54. if stompyPills < 3 then -- only 3 three pills are needed for the transformation
  55. stompyPills = stompyPills + 1 -- counts your 'One makes you larger'-pills
  56. Mod:SaveData(stompyPills)
  57. end
  58. end
  59. Mod:AddCallback(ModCallbacks.MC_USE_PILL, Mod.countPills, PillEffect.PILLEFFECT_LARGER)
Advertisement
Add Comment
Please, Sign In to add comment