isaacscript-common 1.0.592 → 1.0.593
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/functions/ui.lua +21 -14
- package/package.json +1 -1
package/dist/functions/ui.lua
CHANGED
|
@@ -1,29 +1,33 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____exports = {}
|
|
3
|
+
local getHeartRowLength
|
|
3
4
|
local ____constants = require("constants")
|
|
4
5
|
local UI_HEART_WIDTH = ____constants.UI_HEART_WIDTH
|
|
5
|
-
function
|
|
6
|
-
local screenWidth = Isaac.GetScreenWidth()
|
|
7
|
-
local screenHeight = Isaac.GetScreenHeight()
|
|
8
|
-
return Vector(screenWidth, screenHeight)
|
|
9
|
-
end
|
|
10
|
-
function ____exports.getHeartsUIWidth(self)
|
|
6
|
+
function getHeartRowLength(self, player)
|
|
11
7
|
local game = Game()
|
|
12
8
|
local level = game:GetLevel()
|
|
13
9
|
local curses = level:GetCurses()
|
|
14
|
-
local player = Isaac.GetPlayer()
|
|
15
10
|
local maxHearts = player:GetMaxHearts()
|
|
16
11
|
local soulHearts = player:GetSoulHearts()
|
|
17
12
|
local boneHearts = player:GetBoneHearts()
|
|
18
|
-
local extraLives = player:GetExtraLives()
|
|
19
|
-
local combinedHearts = maxHearts + soulHearts + boneHearts * 2
|
|
20
|
-
if combinedHearts > 12 then
|
|
21
|
-
combinedHearts = 12
|
|
22
|
-
end
|
|
23
13
|
if curses == LevelCurse.CURSE_OF_THE_UNKNOWN then
|
|
24
|
-
|
|
14
|
+
return 1
|
|
25
15
|
end
|
|
26
|
-
local
|
|
16
|
+
local combinedHearts = maxHearts + soulHearts + boneHearts * 2
|
|
17
|
+
return math.max(combinedHearts / 2, 6)
|
|
18
|
+
end
|
|
19
|
+
function ____exports.getScreenBottomRightPos(self)
|
|
20
|
+
local screenWidth = Isaac.GetScreenWidth()
|
|
21
|
+
local screenHeight = Isaac.GetScreenHeight()
|
|
22
|
+
return Vector(screenWidth, screenHeight)
|
|
23
|
+
end
|
|
24
|
+
function ____exports.getHeartsUIWidth(self)
|
|
25
|
+
local player = Isaac.GetPlayer()
|
|
26
|
+
local extraLives = player:GetExtraLives()
|
|
27
|
+
local effects = player:GetEffects()
|
|
28
|
+
local hasHolyMantleEffect = effects:HasCollectibleEffect(CollectibleType.COLLECTIBLE_HOLY_MANTLE)
|
|
29
|
+
local heartRowLength = getHeartRowLength(nil, player)
|
|
30
|
+
local width = heartRowLength * UI_HEART_WIDTH
|
|
27
31
|
if extraLives > 9 then
|
|
28
32
|
width = width + 20
|
|
29
33
|
if player:HasCollectible(CollectibleType.COLLECTIBLE_GUPPYS_COLLAR) then
|
|
@@ -35,6 +39,9 @@ function ____exports.getHeartsUIWidth(self)
|
|
|
35
39
|
width = width + 4
|
|
36
40
|
end
|
|
37
41
|
end
|
|
42
|
+
if hasHolyMantleEffect then
|
|
43
|
+
width = width + UI_HEART_WIDTH
|
|
44
|
+
end
|
|
38
45
|
return width
|
|
39
46
|
end
|
|
40
47
|
function ____exports.getHUDOffsetVector(self)
|