isaacscript-common 1.0.341 → 1.0.345
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/callbacks/postPlayerChangeHealth.lua +12 -6
- package/dist/functions/entity.d.ts +2 -1
- package/dist/functions/entity.lua +2 -2
- package/dist/functions/math.d.ts +1 -0
- package/dist/functions/math.lua +15 -0
- package/dist/functions/player.d.ts +6 -0
- package/dist/functions/player.lua +55 -15
- package/dist/types/HealthType.d.ts +5 -4
- package/dist/types/HealthType.lua +8 -6
- package/package.json +4 -4
|
@@ -51,16 +51,16 @@ function getCurrentHealthValue(self, player, healthType)
|
|
|
51
51
|
return player:GetSoulHearts()
|
|
52
52
|
end
|
|
53
53
|
end
|
|
54
|
-
____cond10 = ____cond10 or (____switch10 == HealthType.
|
|
54
|
+
____cond10 = ____cond10 or (____switch10 == HealthType.ETERNAL)
|
|
55
55
|
if ____cond10 then
|
|
56
56
|
do
|
|
57
|
-
return player:
|
|
57
|
+
return player:GetEternalHearts()
|
|
58
58
|
end
|
|
59
59
|
end
|
|
60
|
-
____cond10 = ____cond10 or (____switch10 == HealthType.
|
|
60
|
+
____cond10 = ____cond10 or (____switch10 == HealthType.BLACK)
|
|
61
61
|
if ____cond10 then
|
|
62
62
|
do
|
|
63
|
-
return player:
|
|
63
|
+
return player:GetBlackHearts()
|
|
64
64
|
end
|
|
65
65
|
end
|
|
66
66
|
____cond10 = ____cond10 or (____switch10 == HealthType.GOLDEN)
|
|
@@ -69,10 +69,16 @@ function getCurrentHealthValue(self, player, healthType)
|
|
|
69
69
|
return player:GetGoldenHearts()
|
|
70
70
|
end
|
|
71
71
|
end
|
|
72
|
-
____cond10 = ____cond10 or (____switch10 == HealthType.
|
|
72
|
+
____cond10 = ____cond10 or (____switch10 == HealthType.BONE)
|
|
73
73
|
if ____cond10 then
|
|
74
74
|
do
|
|
75
|
-
return player:
|
|
75
|
+
return player:GetBoneHearts()
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
____cond10 = ____cond10 or (____switch10 == HealthType.ROTTEN)
|
|
79
|
+
if ____cond10 then
|
|
80
|
+
do
|
|
81
|
+
return player:GetRottenHearts()
|
|
76
82
|
end
|
|
77
83
|
end
|
|
78
84
|
____cond10 = ____cond10 or (____switch10 == HealthType.MAX_HEARTS)
|
|
@@ -27,5 +27,6 @@ export declare function getNPCs(): EntityNPC[];
|
|
|
27
27
|
* in secret rooms and I AM ERROR rooms if the "Corrupted Data" achievement is unlocked.
|
|
28
28
|
*/
|
|
29
29
|
export declare function isGlitchedCollectible(entity: Entity): boolean;
|
|
30
|
-
|
|
30
|
+
/** Removes all of the entities in the supplied array. */
|
|
31
|
+
export declare function removeEntities(entities: Entity[]): void;
|
|
31
32
|
export declare function removeAllMatchingEntities(entityType: int, entityVariant?: number, entitySubType?: number): void;
|
|
@@ -47,7 +47,7 @@ end
|
|
|
47
47
|
function ____exports.isGlitchedCollectible(self, entity)
|
|
48
48
|
return ((entity.Type == EntityType.ENTITY_PICKUP) and (entity.Variant == PickupVariant.PICKUP_COLLECTIBLE)) and (entity.SubType > GLITCHED_ITEM_THRESHOLD)
|
|
49
49
|
end
|
|
50
|
-
function ____exports.
|
|
50
|
+
function ____exports.removeEntities(self, entities)
|
|
51
51
|
for ____, entity in ipairs(entities) do
|
|
52
52
|
entity:Remove()
|
|
53
53
|
end
|
|
@@ -60,6 +60,6 @@ function ____exports.removeAllMatchingEntities(self, entityType, entityVariant,
|
|
|
60
60
|
entitySubType = -1
|
|
61
61
|
end
|
|
62
62
|
local entities = Isaac.FindByType(entityType, entityVariant, entitySubType)
|
|
63
|
-
____exports.
|
|
63
|
+
____exports.removeEntities(nil, entities)
|
|
64
64
|
end
|
|
65
65
|
return ____exports
|
package/dist/functions/math.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
export declare function getAngleDifference(angle1: float, angle2: float): float;
|
|
3
|
+
export declare function getCircleDiscretizedPoints(centerPos: Vector, distance: int, numPoints: int): Vector[];
|
|
3
4
|
export declare function isEven(num: int): boolean;
|
|
4
5
|
export declare function isOdd(num: int): boolean;
|
|
5
6
|
/**
|
package/dist/functions/math.lua
CHANGED
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
require("lualib_bundle");
|
|
2
3
|
local ____exports = {}
|
|
3
4
|
function ____exports.getAngleDifference(self, angle1, angle2)
|
|
4
5
|
local subtractedAngle = angle1 - angle2
|
|
5
6
|
return ((subtractedAngle + 180) % 360) - 180
|
|
6
7
|
end
|
|
8
|
+
function ____exports.getCircleDiscretizedPoints(self, centerPos, distance, numPoints)
|
|
9
|
+
local positions = {}
|
|
10
|
+
local leftOfCenter = Vector(-distance, 0)
|
|
11
|
+
do
|
|
12
|
+
local i = 0
|
|
13
|
+
while i < numPoints do
|
|
14
|
+
local rotatedPosition = leftOfCenter:Rotated((i * 360) / numPoints)
|
|
15
|
+
local positionFromCenter = centerPos + rotatedPosition
|
|
16
|
+
__TS__ArrayPush(positions, positionFromCenter)
|
|
17
|
+
i = i + 1
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
return positions
|
|
21
|
+
end
|
|
7
22
|
function ____exports.isEven(self, num)
|
|
8
23
|
return (num & 1) == 0
|
|
9
24
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
import HealthType from "../types/HealthType";
|
|
2
3
|
import PocketItemDescription from "../types/PocketItemDescription";
|
|
3
4
|
/**
|
|
4
5
|
* PlayerIndex is a specific type of string; see the documentation for the [[`getPlayerIndex`]]
|
|
@@ -24,6 +25,11 @@ export declare function getClosestPlayer(position: Vector): EntityPlayer;
|
|
|
24
25
|
* The Lost and Tainted Lost use a 38 frame death animation (i.e. the "LostDeath" animation).
|
|
25
26
|
*/
|
|
26
27
|
export declare function getDeathAnimationName(player: EntityPlayer): string;
|
|
28
|
+
/**
|
|
29
|
+
* Helper function that returns the type of the rightmost heart, not including golden hearts since
|
|
30
|
+
* they can't be damaged directly.
|
|
31
|
+
*/
|
|
32
|
+
export declare function getLastHeart(player: EntityPlayer): HealthType;
|
|
27
33
|
/**
|
|
28
34
|
* Helper function to get the first player with the lowest frame count of 0. Useful to find a
|
|
29
35
|
* freshly spawned player after using items like Esau Jr.
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
require("lualib_bundle");
|
|
3
3
|
local ____exports = {}
|
|
4
|
+
local ____HealthType = require("types.HealthType")
|
|
5
|
+
local HealthType = ____HealthType.default
|
|
4
6
|
local ____PocketItemType = require("types.PocketItemType")
|
|
5
7
|
local PocketItemType = ____PocketItemType.default
|
|
8
|
+
local ____bitwise = require("functions.bitwise")
|
|
9
|
+
local getKBitOfN = ____bitwise.getKBitOfN
|
|
10
|
+
local getNumBitsOfN = ____bitwise.getNumBitsOfN
|
|
6
11
|
local ____collectibles = require("functions.collectibles")
|
|
7
12
|
local getCollectibleSet = ____collectibles.getCollectibleSet
|
|
8
13
|
local EXCLUDED_CHARACTERS
|
|
@@ -18,18 +23,18 @@ function ____exports.getPlayers(self, performExclusions)
|
|
|
18
23
|
do
|
|
19
24
|
local player = Isaac.GetPlayer(i)
|
|
20
25
|
if player == nil then
|
|
21
|
-
goto
|
|
26
|
+
goto __continue46
|
|
22
27
|
end
|
|
23
28
|
if ____exports.isChildPlayer(nil, player) then
|
|
24
|
-
goto
|
|
29
|
+
goto __continue46
|
|
25
30
|
end
|
|
26
31
|
local character = player:GetPlayerType()
|
|
27
32
|
if performExclusions and EXCLUDED_CHARACTERS:has(character) then
|
|
28
|
-
goto
|
|
33
|
+
goto __continue46
|
|
29
34
|
end
|
|
30
35
|
__TS__ArrayPush(players, player)
|
|
31
36
|
end
|
|
32
|
-
::
|
|
37
|
+
::__continue46::
|
|
33
38
|
i = i + 1
|
|
34
39
|
end
|
|
35
40
|
end
|
|
@@ -109,6 +114,47 @@ function ____exports.getDeathAnimationName(self, player)
|
|
|
109
114
|
local isLostTypeCharacter = (((character == PlayerType.PLAYER_THELOST) or (character == PlayerType.PLAYER_THELOST_B)) or (character == PlayerType.PLAYER_THESOUL)) or (character == PlayerType.PLAYER_THESOUL_B)
|
|
110
115
|
return (isLostTypeCharacter and "LostDeath") or "Death"
|
|
111
116
|
end
|
|
117
|
+
function ____exports.getLastHeart(self, player)
|
|
118
|
+
local hearts = player:GetHearts()
|
|
119
|
+
local effectiveMaxHearts = player:GetEffectiveMaxHearts()
|
|
120
|
+
local soulHearts = player:GetSoulHearts()
|
|
121
|
+
local blackHearts = player:GetBlackHearts()
|
|
122
|
+
local eternalHearts = player:GetEternalHearts()
|
|
123
|
+
local boneHearts = player:GetBoneHearts()
|
|
124
|
+
local rottenHearts = player:GetRottenHearts()
|
|
125
|
+
local soulHeartSlots = soulHearts / 2
|
|
126
|
+
local lastHeartIndex = (boneHearts + soulHeartSlots) - 1
|
|
127
|
+
local isLastHeartBone = player:IsBoneHeart(lastHeartIndex)
|
|
128
|
+
if isLastHeartBone then
|
|
129
|
+
local isLastContainerEmpty = hearts <= (effectiveMaxHearts - 2)
|
|
130
|
+
if isLastContainerEmpty then
|
|
131
|
+
return HealthType.BONE
|
|
132
|
+
end
|
|
133
|
+
if rottenHearts > 0 then
|
|
134
|
+
return HealthType.ROTTEN
|
|
135
|
+
end
|
|
136
|
+
if eternalHearts > 0 then
|
|
137
|
+
return HealthType.ETERNAL
|
|
138
|
+
end
|
|
139
|
+
return HealthType.RED
|
|
140
|
+
end
|
|
141
|
+
if soulHearts > 0 then
|
|
142
|
+
local numBits = getNumBitsOfN(nil, blackHearts)
|
|
143
|
+
local finalBit = getKBitOfN(nil, numBits - 1, blackHearts)
|
|
144
|
+
local isBlack = finalBit == 1
|
|
145
|
+
if isBlack then
|
|
146
|
+
return HealthType.BLACK
|
|
147
|
+
end
|
|
148
|
+
return HealthType.SOUL
|
|
149
|
+
end
|
|
150
|
+
if eternalHearts > 0 then
|
|
151
|
+
return HealthType.ETERNAL
|
|
152
|
+
end
|
|
153
|
+
if rottenHearts > 0 then
|
|
154
|
+
return HealthType.ROTTEN
|
|
155
|
+
end
|
|
156
|
+
return HealthType.RED
|
|
157
|
+
end
|
|
112
158
|
function ____exports.getNewestPlayer(self)
|
|
113
159
|
local newestPlayer = nil
|
|
114
160
|
local lowestFrame = math.huge
|
|
@@ -159,16 +205,10 @@ function ____exports.getPlayerCollectibleMap(self, player)
|
|
|
159
205
|
for ____, collectibleType in __TS__Iterator(
|
|
160
206
|
collectibleSet:values()
|
|
161
207
|
) do
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
end
|
|
166
|
-
local collectibleNum = player:GetCollectibleNum(collectibleType)
|
|
167
|
-
if collectibleNum > 0 then
|
|
168
|
-
collectibleMap:set(collectibleType, collectibleNum)
|
|
169
|
-
end
|
|
208
|
+
local collectibleNum = player:GetCollectibleNum(collectibleType, true)
|
|
209
|
+
if collectibleNum > 0 then
|
|
210
|
+
collectibleMap:set(collectibleType, collectibleNum)
|
|
170
211
|
end
|
|
171
|
-
::__continue31::
|
|
172
212
|
end
|
|
173
213
|
return collectibleMap
|
|
174
214
|
end
|
|
@@ -204,14 +244,14 @@ function ____exports.getPlayerIndexVanilla(self, playerToFind)
|
|
|
204
244
|
do
|
|
205
245
|
local player = Isaac.GetPlayer(i)
|
|
206
246
|
if player == nil then
|
|
207
|
-
goto
|
|
247
|
+
goto __continue55
|
|
208
248
|
end
|
|
209
249
|
local playerHash = GetPtrHash(player)
|
|
210
250
|
if playerHash == playerToFindHash then
|
|
211
251
|
return i
|
|
212
252
|
end
|
|
213
253
|
end
|
|
214
|
-
::
|
|
254
|
+
::__continue55::
|
|
215
255
|
i = i + 1
|
|
216
256
|
end
|
|
217
257
|
end
|
|
@@ -5,15 +5,17 @@ HealthType.RED = 0
|
|
|
5
5
|
HealthType[HealthType.RED] = "RED"
|
|
6
6
|
HealthType.SOUL = 1
|
|
7
7
|
HealthType[HealthType.SOUL] = "SOUL"
|
|
8
|
-
HealthType.
|
|
8
|
+
HealthType.ETERNAL = 2
|
|
9
|
+
HealthType[HealthType.ETERNAL] = "ETERNAL"
|
|
10
|
+
HealthType.BLACK = 3
|
|
9
11
|
HealthType[HealthType.BLACK] = "BLACK"
|
|
10
|
-
HealthType.BONE = 3
|
|
11
|
-
HealthType[HealthType.BONE] = "BONE"
|
|
12
12
|
HealthType.GOLDEN = 4
|
|
13
13
|
HealthType[HealthType.GOLDEN] = "GOLDEN"
|
|
14
|
-
HealthType.
|
|
15
|
-
HealthType[HealthType.
|
|
16
|
-
HealthType.
|
|
14
|
+
HealthType.BONE = 5
|
|
15
|
+
HealthType[HealthType.BONE] = "BONE"
|
|
16
|
+
HealthType.ROTTEN = 6
|
|
17
|
+
HealthType[HealthType.ROTTEN] = "ROTTEN"
|
|
18
|
+
HealthType.MAX_HEARTS = 7
|
|
17
19
|
HealthType[HealthType.MAX_HEARTS] = "MAX_HEARTS"
|
|
18
20
|
____exports.default = HealthType
|
|
19
21
|
return ____exports
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.345",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"dist/**/*.d.ts"
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"isaac-typescript-definitions": "^1.0.
|
|
29
|
-
"isaacscript-lint": "^1.0.
|
|
28
|
+
"isaac-typescript-definitions": "^1.0.230",
|
|
29
|
+
"isaacscript-lint": "^1.0.63",
|
|
30
30
|
"typedoc": "^0.22.5",
|
|
31
|
-
"typescript": "4.4.
|
|
31
|
+
"typescript": "4.4.4",
|
|
32
32
|
"typescript-to-lua": "^1.0.1"
|
|
33
33
|
}
|
|
34
34
|
}
|