Josh64

New_BombBugsHelp

Apr 19th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. local BombBugs = RegisterMod("BombBugs", 1)
  2. local game = Game()
  3.  
  4. -- reference item and the Tick
  5.  
  6. CollectibleType.COLLECTIBLE_BOMB_BUGS = Isaac.GetItemIdByName("Bomb Bugs")
  7. local HasTick = false
  8.  
  9. -- getting a bug on a bomb explosion
  10.  
  11. function BombBugs:onExplosion()
  12.  
  13. local bomb = entity:ToBomb()
  14.  
  15. -- refernce player
  16.  
  17. local player = Isaac.GetPlayer(0)
  18.  
  19. -- check, if a bomb explodes
  20.  
  21. if player:HasCollectible(CollectibleType.COLLECTIBLE_BOMB_BUGS) and Isaac.Explode(bomb.Position, bomb) then
  22. local rng = player:GetCollectibleRNG(CollectibleType.COLLECTIBLE_BOMB_BUGS)
  23. local roll = rng:RandomInt(100)
  24. if roll < 90 then
  25. player:AddBlueSpider(player.Position)
  26.  
  27. else
  28. if HasTick == false then
  29. player:ToPlayer():AddTrinket(TrinketType.TRINKET_TICK)
  30. HasTick = true
  31. end
  32. end
  33. end
  34. end
  35.  
  36. BombBugs:AddCallback(ModCallbacks.MC_POST_UPDATE, BombBugs.onExplosion)
Advertisement
Add Comment
Please, Sign In to add comment