Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Mod = RegisterMod("YourFolderName", 1)
- local game = Game()
- local donorcard = {
- SPAWN_CHANCE = 50, -- chance to spawn a blood donation machine.
- MaggieStart = true -- should Maggie start with the Trinket?
- }
- TrinketType.TRINKET_DONOR_CARD = Isaac.GetTrinketIdByName("Donor Card")
- -- console commands
- function Mod:costumizeMaggie(consol,para)
- if consol == "betterMaggie" then
- if donorcard.MaggieStart == false then
- donorcard.MaggieStart = true
- Isaac.ConsoleOutput("Maggie will start with the Donor Card")
- else
- donorcard.MaggieStart = false
- Isaac.ConsoleOutput("Maggie won't start with the Donor Card")
- end
- end
- end
- SuperBum:AddCallback(ModCallbacks.MC_EXECUTE_CMD, Mod.costumizeMaggie)
- -- on post peffect update
- function Mod:onInit(player)
- -- stuff, which happens on frame 1
- if game:GetFrameCount() == 1 then
- -- let Maggie start with the trinket
- if player:GetPlayerType() == PlayerType.PLAYER_MAGDALENA
- and donorcard.MaggieStart == true then
- -- player gets the donor card trinket
- player:GetTrinket(TrinketType.TRINKET_DONOR_CARD)
- end
- end
- end
- Mod:AddCallback(ModCallbacks.MC_POST_PEFFECT_UPDATE, Mod.onInit)
- -- on new room
- function Mod:onNewRoom(_)
- local player = Isaac.GetPlayer(0)
- local roomType = game:GetRoom():GetType()
- -- check if the player has the trinket
- if player:HasTrinket(TrinketType.TRINKET_DONOR_CARD)
- or player:GetEffects():HasTrinketEffect(TrinketType.TRINKET_DONOR_CARD) then
- -- check if the player already visited room and if the room is a shop
- if game:GetRoom():IsFirstVisit() == true
- and roomType == RoomType.ROOM_SHOP then
- -- get RNG if needed
- local rng = player:GetTrinketRNG(TrinketType.TRINKET_DONOR_CARD)
- local roll = rng:RandomInt(100)
- if roll < donorcard.SPAWN_CHANCE then
- -- spawn the blood donation machine
- Isaac.Spawn(EntityType.ENTITY_SLOT, 8, 0, Vector(250, 250), Vector(0, 0), player) -- position needs adjustment
- end
- end
- end
- end
- Mod:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, Mod.onNewRoom)
Advertisement
Add Comment
Please, Sign In to add comment