Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Mod = RegisterMod("yourMod", 1)
- local game = Game()
- local stompyItems = 0 -- countes the itmes needed for the transformation
- local stompyPills = 0 -- countes the pilles needed for the transformation
- local Has = {
- Stompy = false -- will be set to true if the player has the transformation
- }
- function Mod:detectStompy(player)
- local entities = Isaac.GetRoomEntities()
- -- look for items which contributes to the stompy transformation
- for e = 1, #entities do -- go though all the entities in the room
- local entity = entities[e]
- if entity.Type == EntityType.ENTITY_PICKUP
- and entity.Variant == PickupVariant.PICKUP_COLLECTIBLE then -- look for items
- -- check if the item is Magic Mush
- if entity.SubType == CollectibleType.COLLECTIBLE_MAGIC_MUSHROOM then
- if (player.Position - entity.Position):Length() < player.Size + entity.Size -- pick up detection code
- and not player:HasCollectible(CollectibleType.COLLECTIBLE_MAGIC_MUSHROOM) -- make sure that the player hasn't picked up the item already
- then
- stompyItems = stompyItems + 1
- Mod:SaveData(stompyItems)
- end
- end
- -- check if the item is Leo. We do the same stuff as for Magic Mush
- if entity.SubType == CollectibleType.COLLECTIBLE_LEO then
- if (player.Position - entity.Position):Length() < player.Size + entity.Size -
- and not player:HasCollectible(CollectibleType.COLLECTIBLE_STOMPY) then
- stompyItems = stompyItems + 1
- Mod:SaveData(stompyItems)
- end
- end
- end
- end
- -- check if the player has the Stompy transformation
- 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
- Has.Stompy = true -- confirm that the player has the Stompy transformation
- end
- if Has.Stompy == true then -- if the player has the transformation
- -- then we do stuff
- end
- end
- Mod:AddCallback(ModCallbacks.MC_POST_PEFFECT_UPDATE, Mod.detectStompy)
- -- check if the player takes a 'One makes you larger'-pill
- function Mod:countPills(_PillEffect)
- if stompyPills < 3 then -- only 3 three pills are needed for the transformation
- stompyPills = stompyPills + 1 -- counts your 'One makes you larger'-pills
- Mod:SaveData(stompyPills)
- end
- end
- Mod:AddCallback(ModCallbacks.MC_USE_PILL, Mod.countPills, PillEffect.PILLEFFECT_LARGER)
Advertisement
Add Comment
Please, Sign In to add comment