Josh64

not my code

Oct 31st, 2018
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.18 KB | None | 0 0
  1. local morebumsmod3 = RegisterMod("Even more bums",1.0);
  2.  
  3. local bumPoopVar = Isaac.GetEntityVariantByName("Poop Bum")
  4. local bumBatteryVar = Isaac.GetEntityVariantByName("Battery Bum")
  5. local bumSpiderVar = Isaac.GetEntityVariantByName("Spider Bum")
  6. local hyperbumVar = Isaac.GetEntityVariantByName("Hyper Bum")
  7.  
  8. local bumDeadVar = Isaac.GetEntityVariantByName("Dead Bum")
  9. local bumRoboVar = Isaac.GetEntityVariantByName("Robo Bum")
  10. local bumHolyVar = Isaac.GetEntityVariantByName("Holy Bum")
  11. local ultrabumVar = Isaac.GetEntityVariantByName("Ultra Bum")
  12.  
  13. local bombbumVar = Isaac.GetEntityVariantByName("Bomb Bum")
  14. local pillbumVar = Isaac.GetEntityVariantByName("Pill Bum")
  15. local runebumVar = Isaac.GetEntityVariantByName("Rune Bum")
  16. local megabumVar = Isaac.GetEntityVariantByName("Mega Bum")
  17.  
  18. local bumPoopItem = Isaac.GetItemIdByName("Poop Bum")
  19. local bumBatteryItem = Isaac.GetItemIdByName("Battery Bum")
  20. local bumSpiderItem = Isaac.GetItemIdByName("Spider Bum")
  21.  
  22. local bumPoop = nil
  23. local bumBattery = nil
  24. local bumSpider = nil
  25. local hyperbum = nil
  26.  
  27. local hyperbumplaymovie = -1
  28. local entities = {}
  29.  
  30. local pennypickupcount = 0
  31.  
  32. local bummovespeed = 50
  33. local chasingspeed = 70
  34. local itemframecount = 150
  35.  
  36. local playerdistance = 90
  37. local pickupdistance = 200
  38. local collisiondistance = 30
  39.  
  40. local bumlist = {bumPoopVar,bumBatteryVar,bumSpiderVar,hyperbumVar,ultrabumVar,bumDeadVar,bumRoboVar,bumHolyVar,24,64,88,90,102,bombbumVar,pillbumVar,runebumVar,megabumVar}
  41.  
  42. local modrunning = false
  43.  
  44. local poops = {}
  45.  
  46. debug_text = ""
  47.  
  48.  
  49. if not __eidItemDescriptions then
  50. __eidItemDescriptions = {};
  51. end
  52. __eidItemDescriptions[bumPoopItem] = "Breaks poop#Spawns blue flies";
  53. __eidItemDescriptions[bumBatteryItem] = "Takes pennies#Recharges your active item";
  54. __eidItemDescriptions[bumSpiderItem] = "Eats flies#Spawns blue spiders";
  55.  
  56.  
  57. function morebumsmod3:update()
  58. local player = Isaac.GetPlayer(0)
  59. if player:HasCollectible(bumPoopItem) then
  60. entities = Isaac.GetRoomEntities()
  61. --add familiar
  62. if bumPoop == nil and hyperbum == nil then
  63. for ent = 1, #entities do
  64. local entity = entities[ent]
  65. if entity.Type == 3 and entity.Variant == bumPoopVar then
  66. bumPoop = entity
  67. end
  68. end
  69. end
  70. if bumPoop == nil and hyperbum == nil then
  71. bumPoop = Isaac.Spawn(3, bumPoopVar, 0, player.Position, player.Velocity, player)
  72. end
  73. else --remove familiar
  74. if bumPoop then
  75. bumPoop:Remove()
  76. bumPoop = nil
  77. end
  78. end
  79. if player:HasCollectible(bumBatteryItem) then
  80. entities = Isaac.GetRoomEntities()
  81. --add familiar
  82. if bumBattery == nil and hyperbum == nil then
  83. for ent = 1, #entities do
  84. local entity = entities[ent]
  85. if entity.Type == 3 and entity.Variant == bumBatteryVar then
  86. bumBattery = entity
  87. end
  88. end
  89. end
  90. if bumBattery == nil and hyperbum == nil then
  91. bumBattery = Isaac.Spawn(3, bumBatteryVar, 0, player.Position, player.Velocity, player)
  92. end
  93. else --remove familiar
  94. if bumBattery then
  95. bumBattery:Remove()
  96. bumBattery = nil
  97. end
  98. end
  99. if player:HasCollectible(bumSpiderItem) then
  100. entities = Isaac.GetRoomEntities()
  101. --add familiar
  102. if bumSpider == nil and hyperbum == nil then
  103. for ent = 1, #entities do
  104. local entity = entities[ent]
  105. if entity.Type == 3 and entity.Variant == bumSpiderVar then
  106. bumSpider = entity
  107. end
  108. end
  109. end
  110. if bumSpider == nil and hyperbum == nil then
  111. bumSpider = Isaac.Spawn(3, bumSpiderVar, 0, player.Position, player.Velocity, player)
  112. end
  113. else --remove familiar
  114. if bumSpider then
  115. bumSpider:Remove()
  116. bumSpider = nil
  117. end
  118. end
  119.  
  120. --hyperbum
  121. if player:HasCollectible(bumPoopItem) and player:HasCollectible(bumBatteryItem) and player:HasCollectible(bumSpiderItem) then
  122. if hyperbum == nil then
  123. hyperbumplaymovie = 0
  124. if bumPoop then
  125. bumPoop:Remove()
  126. bumPoop = nil
  127. end
  128. if bumBattery then
  129. bumBattery:Remove()
  130. bumBattery = nil
  131. end
  132. if bumSpider then
  133. bumSpider:Remove()
  134. bumSpider = nil
  135. end
  136. for ent = 1, #entities do
  137. local entity = entities[ent]
  138. if entity.Type == 3 and entity.Variant == hyperbumVar then
  139. hyperbum = entity
  140. end
  141. end
  142. end
  143. if hyperbum == nil then
  144. hyperbum = Isaac.Spawn(3, hyperbumVar, 0, player.Position, player.Velocity, player)
  145. end
  146. if modrunning == false then
  147. hyperbumplaymovie = 2
  148. end
  149. else
  150. hyperbumplaymovie = -1
  151. if hyperbum then
  152. hyperbum:Remove()
  153. hyperbum = nil
  154. end
  155. end
  156.  
  157. --check for poops in room
  158. if Game():GetFrameCount() % 90 == 0 then
  159. poops = {}
  160. local currentRoomDesc = Game():GetLevel():GetCurrentRoomDesc()
  161. if currentRoomDesc.PoopCount > 0 then
  162. local currentRoom = Game():GetLevel():GetCurrentRoom()
  163. local tilenum = 1
  164. while #poops < currentRoomDesc.PoopCount do
  165. local tile = currentRoom:GetGridEntity(tilenum)
  166. if tile and tile.Desc.Type == GridEntityType.GRID_POOP then
  167. table.insert(poops, tile)
  168. end
  169. tilenum = tilenum + 1
  170. end
  171. end
  172. end
  173. modrunning = true
  174. end
  175.  
  176.  
  177. function morebumsmod3:poopbumUpdate(bum)
  178. local player = Isaac.GetPlayer(0)
  179.  
  180. chasing = false
  181.  
  182. --set animations
  183. local Sprite = bum:GetSprite()
  184. local playanim = "FloatDown"
  185.  
  186. --follow player
  187. local targetpos = bum.Position
  188. if targetpos:Distance(player.Position) > playerdistance then
  189. targetpos = player.Position
  190. end
  191. --if a poop in the room go for that instead
  192. if #poops > 0 then
  193. for p = 1, #poops do
  194. if poops[p].Desc.State < 4 then
  195. if bum.Position:Distance(poops[p].Position) <= pickupdistance then
  196. targetpos = poops[p].Position
  197. chasing = true
  198. if bum.Position:Distance(poops[p].Position) < 17 then
  199. bum:GetSprite():Play("Dive", false)
  200. end
  201. if bum.Position:Distance(poops[p].Position) < 3 then
  202. if poops[p]:GetVariant() == 1 then
  203. poops[p]:SetVariant(0)
  204. end
  205. poops[p]:Destroy()
  206. Isaac.Spawn(3, 43, 0, bum.Position, bum.Velocity, nil)
  207. end
  208. break
  209. end
  210. end
  211. end
  212. end
  213. for ent = 1, #entities do
  214. local entity = entities[ent]
  215. if entity.Type == 245 and entity:HasFullHealth() then
  216. if bum.Position:Distance(entity.Position) <= pickupdistance then
  217. targetpos = entity.Position
  218. chasing = true
  219. if bum.Position:Distance(entity.Position) < 17 then
  220. bum:GetSprite():Play("Dive", false)
  221. end
  222. if bum.Position:Distance(entity.Position) < 3 then
  223. entity:Kill()
  224. Isaac.Spawn(3, 43, 0, bum.Position, bum.Velocity, nil)
  225. end
  226. break
  227. end
  228. end
  229. --dont overlap with other bums
  230. for j = 1, #bumlist do
  231. if entity.Variant == bumlist[j] and entity.Variant ~= bum.Variant then
  232. local distance = targetpos:Distance(entity.Position)
  233. if distance <= collisiondistance then
  234. local nudgeVector = entity.Position - targetpos
  235. nudgeVector = nudgeVector:Normalized()
  236. targetpos = targetpos - nudgeVector*0.005
  237. entity.Position = entity.Position + nudgeVector*3
  238. end
  239. if distance < 0.01 then
  240. entity.Position = Vector(entity.Position.X+1,entity.Position.Y+1)
  241. end
  242. distance = bum.Position:Distance(entity.Position)
  243. if distance <= collisiondistance then
  244. local nudgeVector = entity.Position - bum.Position
  245. nudgeVector = nudgeVector:Normalized()
  246. bum.Position = bum.Position - nudgeVector*0.005
  247. entity.Position = entity.Position + nudgeVector*3
  248. end
  249. if distance < 0.01 then
  250. entity.Position = Vector(entity.Position.X+1,entity.Position.Y+1)
  251. end
  252. end
  253. end
  254. end
  255. targetpos = normalizedirection(bum.Position, targetpos, chasing)
  256. bum:ToFamiliar():FollowPosition(targetpos)
  257.  
  258. if Sprite:IsPlaying(playanim) == false and Sprite:IsPlaying("Spawn") == false and Sprite:IsPlaying("Dive") == false then
  259. Sprite:Play(playanim, true)
  260. end
  261. end
  262.  
  263. function morebumsmod3:batterybumUpdate(bum)
  264. local player = Isaac.GetPlayer(0)
  265.  
  266. local givestuff = true
  267. if pennypickupcount < 1 then
  268. givestuff = false
  269. end
  270. chasing = false
  271.  
  272. --set animations
  273. local Sprite = bum:GetSprite()
  274. local playanim = "FloatDown"
  275.  
  276. --follow player
  277. local targetpos = bum.Position
  278. if targetpos:Distance(player.Position) > playerdistance then
  279. targetpos = player.Position
  280. end
  281.  
  282. --if a penny in the room go for that instead
  283. for ent = 1, #entities do
  284. local entity = entities[ent]
  285. --only activate if the player has an active item that isnt fully charged
  286. if player:NeedsCharge() and pennypickupcount < 6 and player:GetActiveCharge() < 13 then
  287. if entity.Type == 5 and entity.Variant == 20 and entity.SubType == 1 and entity.FrameCount > itemframecount then
  288. if entity:ToPickup():IsShopItem() == false then
  289. if bum.Position:Distance(entity.Position) <= pickupdistance then
  290. targetpos = entity.Position
  291. chasing = true
  292. givestuff = false
  293. if bum.Position:Distance(entity.Position) < 17 then
  294. entity:GetSprite():Play("Collect", false)
  295. end
  296. if bum.Position:Distance(entity.Position) < 3 then
  297. SFXManager():Play(234, 1.25, 0, false, 1.0)
  298. entity:Remove()
  299. pennypickupcount = pennypickupcount + 1
  300. end
  301. break
  302. end
  303. end
  304. end
  305. end
  306. --dont overlap with other bums
  307. for j = 1, #bumlist do
  308. if entity.Variant == bumlist[j] and entity.Variant ~= bum.Variant then
  309. local distance = targetpos:Distance(entity.Position)
  310. if distance <= collisiondistance then
  311. local nudgeVector = entity.Position - targetpos
  312. nudgeVector = nudgeVector:Normalized()
  313. entity.Position = entity.Position + nudgeVector
  314. end
  315. if distance < 0.01 then
  316. entity.Position = Vector(entity.Position.X+1,entity.Position.Y+1)
  317. end
  318. distance = bum.Position:Distance(entity.Position)
  319. if distance <= collisiondistance then
  320. local nudgeVector = entity.Position - bum.Position
  321. nudgeVector = nudgeVector:Normalized()
  322. entity.Position = entity.Position + nudgeVector
  323. end
  324. if distance < 0.01 then
  325. entity.Position = Vector(entity.Position.X+1,entity.Position.Y+1)
  326. end
  327. end
  328. end
  329. end
  330. if bum.Position:Distance(player.Position) <= playerdistance and player:NeedsCharge() and pennypickupcount > 0 and player:GetActiveCharge() < 13 then
  331. chasing = false
  332. givestuff = true
  333. targetpos = bum.Position
  334. end
  335. targetpos = normalizedirection(bum.Position, targetpos, chasing)
  336. bum:ToFamiliar():FollowPosition(targetpos)
  337.  
  338. --play animations
  339. if givestuff and player:NeedsCharge() and bum.Position:Distance(player.Position) <= playerdistance+5 then
  340. playanim = "PreSpawn"
  341. if Sprite:IsFinished("PreSpawn") then
  342. playanim = "Spawn"
  343. --recharge active
  344. pennypickupcount = pennypickupcount - 1
  345. player:SetActiveCharge(player:GetActiveCharge()+1)
  346. end
  347. end
  348. if Sprite:IsPlaying(playanim) == false and Sprite:IsPlaying("Spawn") == false then
  349. Sprite:Play(playanim, true)
  350. end
  351. end
  352.  
  353. function morebumsmod3:spiderbumUpdate(bum)
  354. local player = Isaac.GetPlayer(0)
  355.  
  356. chasing = false
  357.  
  358. --set animations
  359. local Sprite = bum:GetSprite()
  360. local playanim = "FloatDown"
  361.  
  362. --follow player
  363. local targetpos = bum.Position
  364. if targetpos:Distance(player.Position) > playerdistance then
  365. targetpos = player.Position
  366. end
  367. --if a fly in the room go for that instead
  368. for ent = 1, #entities do
  369. local entity = entities[ent]
  370. 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
  371. if bum.Position:Distance(entity.Position) <= pickupdistance then
  372. targetpos = entity.Position
  373. chasing = true
  374. if bum.Position:Distance(entity.Position) < 30 then
  375. playanim = "Eat"
  376. end
  377. if bum.Position:Distance(entity.Position) < 8 then
  378. SFXManager():Play(317, 0.75, 0, false, 1.0)
  379. SFXManager():Play(30, 1, 0, false, 1.0)
  380. entity:Remove()
  381. Isaac.Spawn(3, 73, 0, bum.Position, bum.Velocity, nil)
  382. end
  383. break
  384. end
  385. end
  386. --dont overlap with other bums
  387. for j = 1, #bumlist do
  388. if entity.Variant == bumlist[j] and entity.Variant ~= bum.Variant then
  389. local distance = targetpos:Distance(entity.Position)
  390. if distance <= collisiondistance then
  391. local nudgeVector = entity.Position - targetpos
  392. nudgeVector = nudgeVector:Normalized()
  393. entity.Position = entity.Position + nudgeVector
  394. end
  395. if distance < 0.01 then
  396. entity.Position = Vector(entity.Position.X+1,entity.Position.Y+1)
  397. end
  398. distance = bum.Position:Distance(entity.Position)
  399. if distance <= collisiondistance then
  400. local nudgeVector = entity.Position - bum.Position
  401. nudgeVector = nudgeVector:Normalized()
  402. entity.Position = entity.Position + nudgeVector
  403. end
  404. if distance < 0.01 then
  405. entity.Position = Vector(entity.Position.X+1,entity.Position.Y+1)
  406. end
  407. end
  408. end
  409. end
  410. targetpos = normalizedirection(bum.Position, targetpos, chasing)
  411. bum:ToFamiliar():FollowPosition(targetpos)
  412.  
  413. --play animations
  414. if Sprite:IsPlaying(playanim) == false and Sprite:IsPlaying("Spawn") == false and Sprite:IsPlaying("Eat") == false then
  415. Sprite:Play(playanim, true)
  416. end
  417. end
  418.  
  419. function normalizedirection(currentpos, targetpos, chasing)
  420. local moveVector = targetpos - currentpos
  421. if chasing then
  422. moveVector = moveVector:Normalized() * chasingspeed
  423. else
  424. moveVector = moveVector:Normalized() * bummovespeed
  425. end
  426. moveVector = currentpos + moveVector
  427. return moveVector
  428. end
  429.  
  430.  
  431.  
  432.  
  433.  
  434. function morebumsmod3:PostPlayerInit()
  435. pennypickupcount = 0
  436. bumPoopVar = Isaac.GetEntityVariantByName("Poop Bum")
  437. bumBatteryVar = Isaac.GetEntityVariantByName("Battery Bum")
  438. bumSpiderVar = Isaac.GetEntityVariantByName("Spider Bum")
  439. hyperbumVar = Isaac.GetEntityVariantByName("Hyper Bum")
  440. bumDeadVar = Isaac.GetEntityVariantByName("Dead Bum")
  441. bumRoboVar = Isaac.GetEntityVariantByName("Robo Bum")
  442. bumHolyVar = Isaac.GetEntityVariantByName("Holy Bum")
  443. ultrabumVar = Isaac.GetEntityVariantByName("Ultra Bum")
  444. bombbumVar = Isaac.GetEntityVariantByName("Bomb Bum")
  445. pillbumVar = Isaac.GetEntityVariantByName("Pill Bum")
  446. runebumVar = Isaac.GetEntityVariantByName("Rune Bum")
  447. megabumVar = Isaac.GetEntityVariantByName("Mega Bum")
  448. bumlist = {bumPoopVar,bumBatteryVar,bumSpiderVar,hyperbumVar,ultrabumVar,bumDeadVar,bumRoboVar,bumHolyVar,24,64,88,90,102,bombbumVar,pillbumVar,runebumVar,megabumVar}
  449. end
  450.  
  451. local movie = Sprite()
  452. movie:Load("gfx/giantbook_hyperbum.anm2", true)
  453. function morebumsmod3:displaymovie()
  454. if modrunning then
  455. if hyperbumplaymovie == 0 then
  456. hyperbumplaymovie = 1
  457. movie:Play("Main", true)
  458. movie:SetFrame("Main", 0)
  459. movie:SetOverlayRenderPriority(true)
  460. movie:Render(Vector(240,135), Vector(0,0), Vector(0,0))
  461. elseif hyperbumplaymovie == 1 then
  462. if movie:GetFrame() < 80 and Game():GetFrameCount() % 2 == 0 then
  463. movie:SetFrame("Main", movie:GetFrame()+1)
  464. end
  465. movie:SetOverlayRenderPriority(true)
  466. movie:Render(Vector(240,135), Vector(0,0), Vector(0,0))
  467. if movie:GetFrame() == 80 then
  468. hyperbumplaymovie = 2
  469. end
  470. end
  471. end
  472. end
  473.  
  474. --hyperbum run
  475. function morebumsmod3:hyperbumUpdate(bum)
  476. local player = Isaac.GetPlayer(0)
  477.  
  478. local givestuff = true
  479. if pennypickupcount < 1 then
  480. givestuff = false
  481. end
  482. chasing = false
  483.  
  484. --set animations
  485. local Sprite = bum:GetSprite()
  486. local playanim = "FloatDown"
  487.  
  488. --follow player
  489. local targetpos = bum.Position
  490. if targetpos:Distance(player.Position) > playerdistance then
  491. targetpos = player.Position
  492. end
  493. --go for items in room
  494. --find poops
  495. if #poops > 0 then
  496. for p = 1, #poops do
  497. if poops[p].Desc.State < 4 then
  498. if bum.Position:Distance(poops[p].Position) <= pickupdistance then
  499. targetpos = poops[p].Position
  500. chasing = true
  501. if bum.Position:Distance(poops[p].Position) < 17 then
  502. bum:GetSprite():Play("Dive", false)
  503. end
  504. if bum.Position:Distance(poops[p].Position) < 3 then
  505. if poops[p]:GetVariant() == 1 then
  506. poops[p]:SetVariant(0)
  507. end
  508. poops[p]:Destroy()
  509. Isaac.Spawn(3, 73, 0, bum.Position, bum.Velocity, nil)
  510. Isaac.Spawn(3, 73, 0, bum.Position, bum.Velocity, nil)
  511. end
  512. break
  513. end
  514. end
  515. end
  516. end
  517. for ent = 1, #entities do
  518. local entity = entities[ent]
  519. --find poops
  520. if entity.Type == 245 and entity:HasFullHealth() then
  521. if bum.Position:Distance(entity.Position) <= pickupdistance then
  522. targetpos = entity.Position
  523. chasing = true
  524. if bum.Position:Distance(entity.Position) < 17 then
  525. bum:GetSprite():Play("Spawn", false)
  526. end
  527. if bum.Position:Distance(entity.Position) < 3 then
  528. entity:Kill()
  529. Isaac.Spawn(3, 73, 0, bum.Position, bum.Velocity, nil)
  530. Isaac.Spawn(3, 73, 0, bum.Position, bum.Velocity, nil)
  531. end
  532. break
  533. end
  534. end
  535. --find pennies
  536. if player:NeedsCharge() and pennypickupcount < 7 and player:GetActiveCharge() < 13 then
  537. if entity.Type == 5 and entity.Variant == 20 and entity.SubType == 1 and entity.FrameCount > itemframecount then
  538. if entity:ToPickup():IsShopItem() == false then
  539. if bum.Position:Distance(entity.Position) <= pickupdistance then
  540. targetpos = entity.Position
  541. chasing = true
  542. givestuff = false
  543. if bum.Position:Distance(entity.Position) < 17 then
  544. entity:GetSprite():Play("Collect", false)
  545. end
  546. if bum.Position:Distance(entity.Position) < 3 then
  547. SFXManager():Play(234, 1.25, 0, false, 1.0)
  548. entity:Remove()
  549. pennypickupcount = pennypickupcount + 2
  550. end
  551. break
  552. end
  553. end
  554. end
  555. end
  556. --find flies
  557. 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
  558. if bum.Position:Distance(entity.Position) <= pickupdistance then
  559. targetpos = entity.Position
  560. chasing = true
  561. if bum.Position:Distance(entity.Position) < 30 then
  562. playanim = "Eat"
  563. end
  564. if bum.Position:Distance(entity.Position) < 8 then
  565. SFXManager():Play(317, 0.75, 0, false, 1.0)
  566. SFXManager():Play(30, 1, 0, false, 1.0)
  567. entity:Remove()
  568. Isaac.Spawn(3, 73, 0, bum.Position, bum.Velocity, nil)
  569. Isaac.Spawn(3, 73, 0, bum.Position, bum.Velocity, nil)
  570. end
  571. break
  572. end
  573. end
  574. --dont overlap with other bums
  575. for j = 1, #bumlist do
  576. if entity.Variant == bumlist[j] and entity.Variant ~= bum.Variant then
  577. local distance = targetpos:Distance(entity.Position)
  578. if distance <= collisiondistance then
  579. local nudgeVector = entity.Position - targetpos
  580. nudgeVector = nudgeVector:Normalized()
  581. entity.Position = entity.Position + nudgeVector
  582. end
  583. if distance < 0.01 then
  584. entity.Position = Vector(entity.Position.X+1,entity.Position.Y+1)
  585. end
  586. distance = bum.Position:Distance(entity.Position)
  587. if distance <= collisiondistance then
  588. local nudgeVector = entity.Position - bum.Position
  589. nudgeVector = nudgeVector:Normalized()
  590. entity.Position = entity.Position + nudgeVector
  591. end
  592. if distance < 0.01 then
  593. entity.Position = Vector(entity.Position.X+1,entity.Position.Y+1)
  594. end
  595. end
  596. end
  597. end
  598. if bum.Position:Distance(player.Position) <= playerdistance and player:NeedsCharge() and pennypickupcount > 0 and player:GetActiveCharge() < 13 then
  599. chasing = false
  600. givestuff = true
  601. targetpos = bum.Position
  602. end
  603. targetpos = normalizedirection(bum.Position, targetpos, chasing)
  604. bum:ToFamiliar():FollowPosition(targetpos)
  605.  
  606. --play animations
  607. if givestuff and bum.Position:Distance(player.Position) <= playerdistance+5 then
  608. if player:NeedsCharge() and player:GetActiveCharge() < 13 then
  609. playanim = "PreSpawn"
  610. if Sprite:IsFinished("PreSpawn") then
  611. playanim = "Spawn"
  612. --recharge active
  613. pennypickupcount = pennypickupcount - 1
  614. player:SetActiveCharge(player:GetActiveCharge()+1)
  615. end
  616. end
  617. end
  618. if Sprite:IsPlaying(playanim) == false and Sprite:IsPlaying("Spawn") == false and Sprite:IsPlaying("Eat") == false then
  619. Sprite:Play(playanim, true)
  620. end
  621. end
  622.  
  623. function morebumsmod3:getpoops()
  624. poops = {}
  625. local currentRoomDesc = Game():GetLevel():GetCurrentRoomDesc()
  626. if currentRoomDesc.PoopCount > 0 then
  627. local currentRoom = Game():GetLevel():GetCurrentRoom()
  628. local tilenum = 1
  629. while #poops < currentRoomDesc.PoopCount do
  630. local tile = currentRoom:GetGridEntity(tilenum)
  631. if tile and tile.Desc.Type == GridEntityType.GRID_POOP then
  632. table.insert(poops, tile)
  633. end
  634. tilenum = tilenum + 1
  635. end
  636. end
  637. end
  638.  
  639. morebumsmod3:AddCallback(ModCallbacks.MC_POST_UPDATE , morebumsmod3.update);
  640. morebumsmod3:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, morebumsmod3.poopbumUpdate, bumPoopVar);
  641. morebumsmod3:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, morebumsmod3.batterybumUpdate, bumBatteryVar);
  642. morebumsmod3:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, morebumsmod3.spiderbumUpdate, bumSpiderVar);
  643. morebumsmod3:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, morebumsmod3.hyperbumUpdate, hyperbumVar);
  644. morebumsmod3:AddCallback(ModCallbacks.MC_POST_PLAYER_INIT, morebumsmod3.PostPlayerInit);
  645. morebumsmod3:AddCallback(ModCallbacks.MC_POST_RENDER, morebumsmod3.displaymovie);
  646. morebumsmod3:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, morebumsmod3.getpoops)
Advertisement
Add Comment
Please, Sign In to add comment