OciXCrom

IsaacGuru Show Healthbars Command

May 30th, 2021
1,500
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.80 KB | None | 0 0
  1. local mod = RegisterMod("Show Healthbars", 1)
  2.  
  3. local show_healthbars = false
  4.  
  5. function mod:OnExecuteCmd(cmd, params)
  6.     if cmd == "hps" then
  7.         if show_healthbars then
  8.             show_healthbars = false
  9.             print("Disabled!")
  10.         else
  11.             print("Enabled!")
  12.         end
  13.     end
  14. end
  15.  
  16. mod:AddCallback(ModCallbacks.MC_EXECUTE_CMD, mod.OnExecuteCmd)
  17.  
  18. function mod:OnRender()
  19.     if show_healthbars then
  20.         for _,entity in pairs(Isaac.GetRoomEntities()) do
  21.             if entity:IsVulnerableEnemy() then
  22.                 position = Isaac.WorldToRenderPosition(entity.Position) + Game():GetRoom():GetRenderScrollOffset()
  23.                 Isaac.RenderText(string.format("%.2f/%.2f", entity.HitPoints, entity.MaxHitPoints), position.X, position.Y, 1, 1, 1, 1)
  24.             end
  25.         end
  26.     end
  27. end
  28.  
  29. mod:AddCallback(ModCallbacks.MC_POST_RENDER, mod.OnRender)
Advertisement
Add Comment
Please, Sign In to add comment