Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local morebumsmod3 = RegisterMod("Even more bums",1.0);
- local bumPoopVar = Isaac.GetEntityVariantByName("Poop Bum")
- local bumBatteryVar = Isaac.GetEntityVariantByName("Battery Bum")
- local bumSpiderVar = Isaac.GetEntityVariantByName("Spider Bum")
- local hyperbumVar = Isaac.GetEntityVariantByName("Hyper Bum")
- local bumDeadVar = Isaac.GetEntityVariantByName("Dead Bum")
- local bumRoboVar = Isaac.GetEntityVariantByName("Robo Bum")
- local bumHolyVar = Isaac.GetEntityVariantByName("Holy Bum")
- local ultrabumVar = Isaac.GetEntityVariantByName("Ultra Bum")
- local bombbumVar = Isaac.GetEntityVariantByName("Bomb Bum")
- local pillbumVar = Isaac.GetEntityVariantByName("Pill Bum")
- local runebumVar = Isaac.GetEntityVariantByName("Rune Bum")
- local megabumVar = Isaac.GetEntityVariantByName("Mega Bum")
- local bumPoopItem = Isaac.GetItemIdByName("Poop Bum")
- local bumBatteryItem = Isaac.GetItemIdByName("Battery Bum")
- local bumSpiderItem = Isaac.GetItemIdByName("Spider Bum")
- local bumPoop = nil
- local bumBattery = nil
- local bumSpider = nil
- local hyperbum = nil
- local hyperbumplaymovie = -1
- local entities = {}
- local pennypickupcount = 0
- local bummovespeed = 50
- local chasingspeed = 70
- local itemframecount = 150
- local playerdistance = 90
- local pickupdistance = 200
- local collisiondistance = 30
- local bumlist = {bumPoopVar,bumBatteryVar,bumSpiderVar,hyperbumVar,ultrabumVar,bumDeadVar,bumRoboVar,bumHolyVar,24,64,88,90,102,bombbumVar,pillbumVar,runebumVar,megabumVar}
- local modrunning = false
- local poops = {}
- debug_text = ""
- if not __eidItemDescriptions then
- __eidItemDescriptions = {};
- end
- __eidItemDescriptions[bumPoopItem] = "Breaks poop#Spawns blue flies";
- __eidItemDescriptions[bumBatteryItem] = "Takes pennies#Recharges your active item";
- __eidItemDescriptions[bumSpiderItem] = "Eats flies#Spawns blue spiders";
- function morebumsmod3:update()
- local player = Isaac.GetPlayer(0)
- if player:HasCollectible(bumPoopItem) then
- entities = Isaac.GetRoomEntities()
- --add familiar
- if bumPoop == nil and hyperbum == nil then
- for ent = 1, #entities do
- local entity = entities[ent]
- if entity.Type == 3 and entity.Variant == bumPoopVar then
- bumPoop = entity
- end
- end
- end
- if bumPoop == nil and hyperbum == nil then
- bumPoop = Isaac.Spawn(3, bumPoopVar, 0, player.Position, player.Velocity, player)
- end
- else --remove familiar
- if bumPoop then
- bumPoop:Remove()
- bumPoop = nil
- end
- end
- if player:HasCollectible(bumBatteryItem) then
- entities = Isaac.GetRoomEntities()
- --add familiar
- if bumBattery == nil and hyperbum == nil then
- for ent = 1, #entities do
- local entity = entities[ent]
- if entity.Type == 3 and entity.Variant == bumBatteryVar then
- bumBattery = entity
- end
- end
- end
- if bumBattery == nil and hyperbum == nil then
- bumBattery = Isaac.Spawn(3, bumBatteryVar, 0, player.Position, player.Velocity, player)
- end
- else --remove familiar
- if bumBattery then
- bumBattery:Remove()
- bumBattery = nil
- end
- end
- if player:HasCollectible(bumSpiderItem) then
- entities = Isaac.GetRoomEntities()
- --add familiar
- if bumSpider == nil and hyperbum == nil then
- for ent = 1, #entities do
- local entity = entities[ent]
- if entity.Type == 3 and entity.Variant == bumSpiderVar then
- bumSpider = entity
- end
- end
- end
- if bumSpider == nil and hyperbum == nil then
- bumSpider = Isaac.Spawn(3, bumSpiderVar, 0, player.Position, player.Velocity, player)
- end
- else --remove familiar
- if bumSpider then
- bumSpider:Remove()
- bumSpider = nil
- end
- end
- --hyperbum
- if player:HasCollectible(bumPoopItem) and player:HasCollectible(bumBatteryItem) and player:HasCollectible(bumSpiderItem) then
- if hyperbum == nil then
- hyperbumplaymovie = 0
- if bumPoop then
- bumPoop:Remove()
- bumPoop = nil
- end
- if bumBattery then
- bumBattery:Remove()
- bumBattery = nil
- end
- if bumSpider then
- bumSpider:Remove()
- bumSpider = nil
- end
- for ent = 1, #entities do
- local entity = entities[ent]
- if entity.Type == 3 and entity.Variant == hyperbumVar then
- hyperbum = entity
- end
- end
- end
- if hyperbum == nil then
- hyperbum = Isaac.Spawn(3, hyperbumVar, 0, player.Position, player.Velocity, player)
- end
- if modrunning == false then
- hyperbumplaymovie = 2
- end
- else
- hyperbumplaymovie = -1
- if hyperbum then
- hyperbum:Remove()
- hyperbum = nil
- end
- end
- --check for poops in room
- if Game():GetFrameCount() % 90 == 0 then
- poops = {}
- local currentRoomDesc = Game():GetLevel():GetCurrentRoomDesc()
- if currentRoomDesc.PoopCount > 0 then
- local currentRoom = Game():GetLevel():GetCurrentRoom()
- local tilenum = 1
- while #poops < currentRoomDesc.PoopCount do
- local tile = currentRoom:GetGridEntity(tilenum)
- if tile and tile.Desc.Type == GridEntityType.GRID_POOP then
- table.insert(poops, tile)
- end
- tilenum = tilenum + 1
- end
- end
- end
- modrunning = true
- end
- function morebumsmod3:poopbumUpdate(bum)
- local player = Isaac.GetPlayer(0)
- chasing = false
- --set animations
- local Sprite = bum:GetSprite()
- local playanim = "FloatDown"
- --follow player
- local targetpos = bum.Position
- if targetpos:Distance(player.Position) > playerdistance then
- targetpos = player.Position
- end
- --if a poop in the room go for that instead
- if #poops > 0 then
- for p = 1, #poops do
- if poops[p].Desc.State < 4 then
- if bum.Position:Distance(poops[p].Position) <= pickupdistance then
- targetpos = poops[p].Position
- chasing = true
- if bum.Position:Distance(poops[p].Position) < 17 then
- bum:GetSprite():Play("Dive", false)
- end
- if bum.Position:Distance(poops[p].Position) < 3 then
- if poops[p]:GetVariant() == 1 then
- poops[p]:SetVariant(0)
- end
- poops[p]:Destroy()
- Isaac.Spawn(3, 43, 0, bum.Position, bum.Velocity, nil)
- end
- break
- end
- end
- end
- end
- for ent = 1, #entities do
- local entity = entities[ent]
- if entity.Type == 245 and entity:HasFullHealth() then
- if bum.Position:Distance(entity.Position) <= pickupdistance then
- targetpos = entity.Position
- chasing = true
- if bum.Position:Distance(entity.Position) < 17 then
- bum:GetSprite():Play("Dive", false)
- end
- if bum.Position:Distance(entity.Position) < 3 then
- entity:Kill()
- Isaac.Spawn(3, 43, 0, bum.Position, bum.Velocity, nil)
- end
- break
- end
- end
- --dont overlap with other bums
- for j = 1, #bumlist do
- if entity.Variant == bumlist[j] and entity.Variant ~= bum.Variant then
- local distance = targetpos:Distance(entity.Position)
- if distance <= collisiondistance then
- local nudgeVector = entity.Position - targetpos
- nudgeVector = nudgeVector:Normalized()
- targetpos = targetpos - nudgeVector*0.005
- entity.Position = entity.Position + nudgeVector*3
- end
- if distance < 0.01 then
- entity.Position = Vector(entity.Position.X+1,entity.Position.Y+1)
- end
- distance = bum.Position:Distance(entity.Position)
- if distance <= collisiondistance then
- local nudgeVector = entity.Position - bum.Position
- nudgeVector = nudgeVector:Normalized()
- bum.Position = bum.Position - nudgeVector*0.005
- entity.Position = entity.Position + nudgeVector*3
- end
- if distance < 0.01 then
- entity.Position = Vector(entity.Position.X+1,entity.Position.Y+1)
- end
- end
- end
- end
- targetpos = normalizedirection(bum.Position, targetpos, chasing)
- bum:ToFamiliar():FollowPosition(targetpos)
- if Sprite:IsPlaying(playanim) == false and Sprite:IsPlaying("Spawn") == false and Sprite:IsPlaying("Dive") == false then
- Sprite:Play(playanim, true)
- end
- end
- function morebumsmod3:batterybumUpdate(bum)
- local player = Isaac.GetPlayer(0)
- local givestuff = true
- if pennypickupcount < 1 then
- givestuff = false
- end
- chasing = false
- --set animations
- local Sprite = bum:GetSprite()
- local playanim = "FloatDown"
- --follow player
- local targetpos = bum.Position
- if targetpos:Distance(player.Position) > playerdistance then
- targetpos = player.Position
- end
- --if a penny in the room go for that instead
- for ent = 1, #entities do
- local entity = entities[ent]
- --only activate if the player has an active item that isnt fully charged
- if player:NeedsCharge() and pennypickupcount < 6 and player:GetActiveCharge() < 13 then
- if entity.Type == 5 and entity.Variant == 20 and entity.SubType == 1 and entity.FrameCount > itemframecount then
- if entity:ToPickup():IsShopItem() == false then
- if bum.Position:Distance(entity.Position) <= pickupdistance then
- targetpos = entity.Position
- chasing = true
- givestuff = false
- if bum.Position:Distance(entity.Position) < 17 then
- entity:GetSprite():Play("Collect", false)
- end
- if bum.Position:Distance(entity.Position) < 3 then
- SFXManager():Play(234, 1.25, 0, false, 1.0)
- entity:Remove()
- pennypickupcount = pennypickupcount + 1
- end
- break
- end
- end
- end
- end
- --dont overlap with other bums
- for j = 1, #bumlist do
- if entity.Variant == bumlist[j] and entity.Variant ~= bum.Variant then
- local distance = targetpos:Distance(entity.Position)
- if distance <= collisiondistance then
- local nudgeVector = entity.Position - targetpos
- nudgeVector = nudgeVector:Normalized()
- entity.Position = entity.Position + nudgeVector
- end
- if distance < 0.01 then
- entity.Position = Vector(entity.Position.X+1,entity.Position.Y+1)
- end
- distance = bum.Position:Distance(entity.Position)
- if distance <= collisiondistance then
- local nudgeVector = entity.Position - bum.Position
- nudgeVector = nudgeVector:Normalized()
- entity.Position = entity.Position + nudgeVector
- end
- if distance < 0.01 then
- entity.Position = Vector(entity.Position.X+1,entity.Position.Y+1)
- end
- end
- end
- end
- if bum.Position:Distance(player.Position) <= playerdistance and player:NeedsCharge() and pennypickupcount > 0 and player:GetActiveCharge() < 13 then
- chasing = false
- givestuff = true
- targetpos = bum.Position
- end
- targetpos = normalizedirection(bum.Position, targetpos, chasing)
- bum:ToFamiliar():FollowPosition(targetpos)
- --play animations
- if givestuff and player:NeedsCharge() and bum.Position:Distance(player.Position) <= playerdistance+5 then
- playanim = "PreSpawn"
- if Sprite:IsFinished("PreSpawn") then
- playanim = "Spawn"
- --recharge active
- pennypickupcount = pennypickupcount - 1
- player:SetActiveCharge(player:GetActiveCharge()+1)
- end
- end
- if Sprite:IsPlaying(playanim) == false and Sprite:IsPlaying("Spawn") == false then
- Sprite:Play(playanim, true)
- end
- end
- function morebumsmod3:spiderbumUpdate(bum)
- local player = Isaac.GetPlayer(0)
- chasing = false
- --set animations
- local Sprite = bum:GetSprite()
- local playanim = "FloatDown"
- --follow player
- local targetpos = bum.Position
- if targetpos:Distance(player.Position) > playerdistance then
- targetpos = player.Position
- end
- --if a fly in the room go for that instead
- for ent = 1, #entities do
- local entity = entities[ent]
- if entity.Type == 13 or entity.Type == 18 or entity.Type == 96 or entity.Type == 222 or entity.Type == 256 or entity.Type == 281 or entity.Type == 296 or (entity.Type == 3 and entity.Variant == 43 and entity.SubType == 0) then
- if bum.Position:Distance(entity.Position) <= pickupdistance then
- targetpos = entity.Position
- chasing = true
- if bum.Position:Distance(entity.Position) < 30 then
- playanim = "Eat"
- end
- if bum.Position:Distance(entity.Position) < 8 then
- SFXManager():Play(317, 0.75, 0, false, 1.0)
- SFXManager():Play(30, 1, 0, false, 1.0)
- entity:Remove()
- Isaac.Spawn(3, 73, 0, bum.Position, bum.Velocity, nil)
- end
- break
- end
- end
- --dont overlap with other bums
- for j = 1, #bumlist do
- if entity.Variant == bumlist[j] and entity.Variant ~= bum.Variant then
- local distance = targetpos:Distance(entity.Position)
- if distance <= collisiondistance then
- local nudgeVector = entity.Position - targetpos
- nudgeVector = nudgeVector:Normalized()
- entity.Position = entity.Position + nudgeVector
- end
- if distance < 0.01 then
- entity.Position = Vector(entity.Position.X+1,entity.Position.Y+1)
- end
- distance = bum.Position:Distance(entity.Position)
- if distance <= collisiondistance then
- local nudgeVector = entity.Position - bum.Position
- nudgeVector = nudgeVector:Normalized()
- entity.Position = entity.Position + nudgeVector
- end
- if distance < 0.01 then
- entity.Position = Vector(entity.Position.X+1,entity.Position.Y+1)
- end
- end
- end
- end
- targetpos = normalizedirection(bum.Position, targetpos, chasing)
- bum:ToFamiliar():FollowPosition(targetpos)
- --play animations
- if Sprite:IsPlaying(playanim) == false and Sprite:IsPlaying("Spawn") == false and Sprite:IsPlaying("Eat") == false then
- Sprite:Play(playanim, true)
- end
- end
- function normalizedirection(currentpos, targetpos, chasing)
- local moveVector = targetpos - currentpos
- if chasing then
- moveVector = moveVector:Normalized() * chasingspeed
- else
- moveVector = moveVector:Normalized() * bummovespeed
- end
- moveVector = currentpos + moveVector
- return moveVector
- end
- function morebumsmod3:PostPlayerInit()
- pennypickupcount = 0
- bumPoopVar = Isaac.GetEntityVariantByName("Poop Bum")
- bumBatteryVar = Isaac.GetEntityVariantByName("Battery Bum")
- bumSpiderVar = Isaac.GetEntityVariantByName("Spider Bum")
- hyperbumVar = Isaac.GetEntityVariantByName("Hyper Bum")
- bumDeadVar = Isaac.GetEntityVariantByName("Dead Bum")
- bumRoboVar = Isaac.GetEntityVariantByName("Robo Bum")
- bumHolyVar = Isaac.GetEntityVariantByName("Holy Bum")
- ultrabumVar = Isaac.GetEntityVariantByName("Ultra Bum")
- bombbumVar = Isaac.GetEntityVariantByName("Bomb Bum")
- pillbumVar = Isaac.GetEntityVariantByName("Pill Bum")
- runebumVar = Isaac.GetEntityVariantByName("Rune Bum")
- megabumVar = Isaac.GetEntityVariantByName("Mega Bum")
- bumlist = {bumPoopVar,bumBatteryVar,bumSpiderVar,hyperbumVar,ultrabumVar,bumDeadVar,bumRoboVar,bumHolyVar,24,64,88,90,102,bombbumVar,pillbumVar,runebumVar,megabumVar}
- end
- local movie = Sprite()
- movie:Load("gfx/giantbook_hyperbum.anm2", true)
- function morebumsmod3:displaymovie()
- if modrunning then
- if hyperbumplaymovie == 0 then
- hyperbumplaymovie = 1
- movie:Play("Main", true)
- movie:SetFrame("Main", 0)
- movie:SetOverlayRenderPriority(true)
- movie:Render(Vector(240,135), Vector(0,0), Vector(0,0))
- elseif hyperbumplaymovie == 1 then
- if movie:GetFrame() < 80 and Game():GetFrameCount() % 2 == 0 then
- movie:SetFrame("Main", movie:GetFrame()+1)
- end
- movie:SetOverlayRenderPriority(true)
- movie:Render(Vector(240,135), Vector(0,0), Vector(0,0))
- if movie:GetFrame() == 80 then
- hyperbumplaymovie = 2
- end
- end
- end
- end
- --hyperbum run
- function morebumsmod3:hyperbumUpdate(bum)
- local player = Isaac.GetPlayer(0)
- local givestuff = true
- if pennypickupcount < 1 then
- givestuff = false
- end
- chasing = false
- --set animations
- local Sprite = bum:GetSprite()
- local playanim = "FloatDown"
- --follow player
- local targetpos = bum.Position
- if targetpos:Distance(player.Position) > playerdistance then
- targetpos = player.Position
- end
- --go for items in room
- --find poops
- if #poops > 0 then
- for p = 1, #poops do
- if poops[p].Desc.State < 4 then
- if bum.Position:Distance(poops[p].Position) <= pickupdistance then
- targetpos = poops[p].Position
- chasing = true
- if bum.Position:Distance(poops[p].Position) < 17 then
- bum:GetSprite():Play("Dive", false)
- end
- if bum.Position:Distance(poops[p].Position) < 3 then
- if poops[p]:GetVariant() == 1 then
- poops[p]:SetVariant(0)
- end
- poops[p]:Destroy()
- Isaac.Spawn(3, 73, 0, bum.Position, bum.Velocity, nil)
- Isaac.Spawn(3, 73, 0, bum.Position, bum.Velocity, nil)
- end
- break
- end
- end
- end
- end
- for ent = 1, #entities do
- local entity = entities[ent]
- --find poops
- if entity.Type == 245 and entity:HasFullHealth() then
- if bum.Position:Distance(entity.Position) <= pickupdistance then
- targetpos = entity.Position
- chasing = true
- if bum.Position:Distance(entity.Position) < 17 then
- bum:GetSprite():Play("Spawn", false)
- end
- if bum.Position:Distance(entity.Position) < 3 then
- entity:Kill()
- Isaac.Spawn(3, 73, 0, bum.Position, bum.Velocity, nil)
- Isaac.Spawn(3, 73, 0, bum.Position, bum.Velocity, nil)
- end
- break
- end
- end
- --find pennies
- if player:NeedsCharge() and pennypickupcount < 7 and player:GetActiveCharge() < 13 then
- if entity.Type == 5 and entity.Variant == 20 and entity.SubType == 1 and entity.FrameCount > itemframecount then
- if entity:ToPickup():IsShopItem() == false then
- if bum.Position:Distance(entity.Position) <= pickupdistance then
- targetpos = entity.Position
- chasing = true
- givestuff = false
- if bum.Position:Distance(entity.Position) < 17 then
- entity:GetSprite():Play("Collect", false)
- end
- if bum.Position:Distance(entity.Position) < 3 then
- SFXManager():Play(234, 1.25, 0, false, 1.0)
- entity:Remove()
- pennypickupcount = pennypickupcount + 2
- end
- break
- end
- end
- end
- end
- --find flies
- if entity.Type == 13 or entity.Type == 18 or entity.Type == 96 or entity.Type == 222 or entity.Type == 256 or entity.Type == 281 or entity.Type == 296 or (entity.Type == 3 and entity.Variant == 43) then
- if bum.Position:Distance(entity.Position) <= pickupdistance then
- targetpos = entity.Position
- chasing = true
- if bum.Position:Distance(entity.Position) < 30 then
- playanim = "Eat"
- end
- if bum.Position:Distance(entity.Position) < 8 then
- SFXManager():Play(317, 0.75, 0, false, 1.0)
- SFXManager():Play(30, 1, 0, false, 1.0)
- entity:Remove()
- Isaac.Spawn(3, 73, 0, bum.Position, bum.Velocity, nil)
- Isaac.Spawn(3, 73, 0, bum.Position, bum.Velocity, nil)
- end
- break
- end
- end
- --dont overlap with other bums
- for j = 1, #bumlist do
- if entity.Variant == bumlist[j] and entity.Variant ~= bum.Variant then
- local distance = targetpos:Distance(entity.Position)
- if distance <= collisiondistance then
- local nudgeVector = entity.Position - targetpos
- nudgeVector = nudgeVector:Normalized()
- entity.Position = entity.Position + nudgeVector
- end
- if distance < 0.01 then
- entity.Position = Vector(entity.Position.X+1,entity.Position.Y+1)
- end
- distance = bum.Position:Distance(entity.Position)
- if distance <= collisiondistance then
- local nudgeVector = entity.Position - bum.Position
- nudgeVector = nudgeVector:Normalized()
- entity.Position = entity.Position + nudgeVector
- end
- if distance < 0.01 then
- entity.Position = Vector(entity.Position.X+1,entity.Position.Y+1)
- end
- end
- end
- end
- if bum.Position:Distance(player.Position) <= playerdistance and player:NeedsCharge() and pennypickupcount > 0 and player:GetActiveCharge() < 13 then
- chasing = false
- givestuff = true
- targetpos = bum.Position
- end
- targetpos = normalizedirection(bum.Position, targetpos, chasing)
- bum:ToFamiliar():FollowPosition(targetpos)
- --play animations
- if givestuff and bum.Position:Distance(player.Position) <= playerdistance+5 then
- if player:NeedsCharge() and player:GetActiveCharge() < 13 then
- playanim = "PreSpawn"
- if Sprite:IsFinished("PreSpawn") then
- playanim = "Spawn"
- --recharge active
- pennypickupcount = pennypickupcount - 1
- player:SetActiveCharge(player:GetActiveCharge()+1)
- end
- end
- end
- if Sprite:IsPlaying(playanim) == false and Sprite:IsPlaying("Spawn") == false and Sprite:IsPlaying("Eat") == false then
- Sprite:Play(playanim, true)
- end
- end
- function morebumsmod3:getpoops()
- poops = {}
- local currentRoomDesc = Game():GetLevel():GetCurrentRoomDesc()
- if currentRoomDesc.PoopCount > 0 then
- local currentRoom = Game():GetLevel():GetCurrentRoom()
- local tilenum = 1
- while #poops < currentRoomDesc.PoopCount do
- local tile = currentRoom:GetGridEntity(tilenum)
- if tile and tile.Desc.Type == GridEntityType.GRID_POOP then
- table.insert(poops, tile)
- end
- tilenum = tilenum + 1
- end
- end
- end
- morebumsmod3:AddCallback(ModCallbacks.MC_POST_UPDATE , morebumsmod3.update);
- morebumsmod3:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, morebumsmod3.poopbumUpdate, bumPoopVar);
- morebumsmod3:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, morebumsmod3.batterybumUpdate, bumBatteryVar);
- morebumsmod3:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, morebumsmod3.spiderbumUpdate, bumSpiderVar);
- morebumsmod3:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, morebumsmod3.hyperbumUpdate, hyperbumVar);
- morebumsmod3:AddCallback(ModCallbacks.MC_POST_PLAYER_INIT, morebumsmod3.PostPlayerInit);
- morebumsmod3:AddCallback(ModCallbacks.MC_POST_RENDER, morebumsmod3.displaymovie);
- morebumsmod3:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, morebumsmod3.getpoops)
Advertisement
Add Comment
Please, Sign In to add comment