isaacscript-common 1.2.172 → 1.2.175
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/postNewRoomEarly.lua +2 -2
- package/dist/classes/null.d.ts +6 -7
- package/dist/classes/null.lua +5 -5
- package/dist/constants.d.ts +10 -10
- package/dist/constants.lua +3 -3
- package/dist/features/collectiblesSeen.d.ts +6 -0
- package/dist/features/collectiblesSeen.lua +43 -0
- package/dist/features/deployJSONRoom.lua +2 -1
- package/dist/features/extraConsoleCommands/commands.d.ts +11 -11
- package/dist/features/extraConsoleCommands/commands.lua +23 -22
- package/dist/features/extraConsoleCommands/init.lua +6 -6
- package/dist/features/playerInventory.d.ts +10 -2
- package/dist/features/playerInventory.lua +60 -21
- package/dist/features/saveDataManager/constants.d.ts +1 -1
- package/dist/features/saveDataManager/constants.lua +1 -1
- package/dist/features/saveDataManager/exports.d.ts +6 -6
- package/dist/features/saveDataManager/exports.lua +4 -4
- package/dist/features/saveDataManager/merge.lua +9 -8
- package/dist/featuresInitialized.d.ts +1 -1
- package/dist/featuresInitialized.lua +3 -3
- package/dist/functions/array.d.ts +39 -39
- package/dist/functions/array.lua +79 -79
- package/dist/functions/cards.d.ts +3 -3
- package/dist/functions/cards.lua +7 -7
- package/dist/functions/charge.d.ts +11 -11
- package/dist/functions/charge.lua +13 -13
- package/dist/functions/collectibles.d.ts +53 -15
- package/dist/functions/collectibles.lua +44 -21
- package/dist/functions/color.d.ts +2 -2
- package/dist/functions/color.lua +6 -6
- package/dist/functions/deepCopy.d.ts +0 -3
- package/dist/functions/deepCopy.lua +5 -22
- package/dist/functions/doors.d.ts +8 -8
- package/dist/functions/doors.lua +16 -16
- package/dist/functions/entity.d.ts +13 -14
- package/dist/functions/entity.lua +27 -34
- package/dist/functions/gridEntity.d.ts +8 -1
- package/dist/functions/gridEntity.lua +7 -11
- package/dist/functions/jsonHelpers.d.ts +7 -7
- package/dist/functions/jsonHelpers.lua +10 -11
- package/dist/functions/log.d.ts +21 -21
- package/dist/functions/log.lua +75 -74
- package/dist/functions/math.d.ts +1 -1
- package/dist/functions/math.lua +3 -3
- package/dist/functions/mergeTests.lua +56 -1
- package/dist/functions/player.d.ts +8 -10
- package/dist/functions/player.lua +22 -29
- package/dist/functions/playerHealth.d.ts +1 -1
- package/dist/functions/playerHealth.lua +20 -20
- package/dist/functions/positionVelocity.d.ts +3 -0
- package/dist/functions/positionVelocity.lua +19 -5
- package/dist/functions/random.d.ts +7 -7
- package/dist/functions/revive.d.ts +5 -5
- package/dist/functions/revive.lua +8 -8
- package/dist/functions/roomData.d.ts +96 -0
- package/dist/functions/roomData.lua +57 -0
- package/dist/functions/rooms.d.ts +1 -96
- package/dist/functions/rooms.lua +30 -75
- package/dist/functions/set.d.ts +2 -2
- package/dist/functions/set.lua +7 -7
- package/dist/functions/trinketCacheFlag.d.ts +4 -4
- package/dist/functions/trinketCacheFlag.lua +3 -2
- package/dist/functions/trinketGive.d.ts +7 -7
- package/dist/functions/trinketGive.lua +27 -27
- package/dist/functions/trinkets.d.ts +2 -2
- package/dist/functions/trinkets.lua +6 -6
- package/dist/functions/ui.d.ts +13 -13
- package/dist/functions/ui.lua +28 -28
- package/dist/functions/utils.d.ts +6 -0
- package/dist/functions/utils.lua +7 -0
- package/dist/functions/vector.d.ts +2 -0
- package/dist/functions/vector.lua +13 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.lua +8 -0
- package/dist/maps/roomShapeToTopLeftWallGridIndexMap.d.ts +1 -1
- package/dist/maps/roomShapeToTopLeftWallGridIndexMap.lua +1 -1
- package/dist/types/CollectibleIndex.d.ts +15 -0
- package/dist/types/CollectibleIndex.lua +3 -0
- package/dist/upgradeMod.lua +3 -0
- package/package.json +2 -2
|
@@ -96,15 +96,15 @@ end
|
|
|
96
96
|
function getPlayerIndexCollectibleType(self, player, differentiateForgottenAndSoul)
|
|
97
97
|
local character = player:GetPlayerType()
|
|
98
98
|
repeat
|
|
99
|
-
local
|
|
100
|
-
local
|
|
101
|
-
if
|
|
99
|
+
local ____switch71 = character
|
|
100
|
+
local ____cond71 = ____switch71 == PlayerType.PLAYER_THESOUL
|
|
101
|
+
if ____cond71 then
|
|
102
102
|
do
|
|
103
103
|
return differentiateForgottenAndSoul and CollectibleType.COLLECTIBLE_SPOON_BENDER or DEFAULT_COLLECTIBLE_TYPE
|
|
104
104
|
end
|
|
105
105
|
end
|
|
106
|
-
|
|
107
|
-
if
|
|
106
|
+
____cond71 = ____cond71 or ____switch71 == PlayerType.PLAYER_LAZARUS2_B
|
|
107
|
+
if ____cond71 then
|
|
108
108
|
do
|
|
109
109
|
return CollectibleType.COLLECTIBLE_INNER_EYE
|
|
110
110
|
end
|
|
@@ -172,16 +172,16 @@ function ____exports.isKeeper(self, player)
|
|
|
172
172
|
local character = player:GetPlayerType()
|
|
173
173
|
return character == PlayerType.PLAYER_KEEPER or character == PlayerType.PLAYER_KEEPER_B
|
|
174
174
|
end
|
|
175
|
+
function ____exports.isModdedCharacter(self, player)
|
|
176
|
+
local character = player:GetPlayerType()
|
|
177
|
+
return character > MAX_VANILLA_CHARACTER
|
|
178
|
+
end
|
|
175
179
|
function isTaintedModded(self, player)
|
|
176
180
|
local character = player:GetPlayerType()
|
|
177
181
|
local name = player:GetName()
|
|
178
182
|
local taintedCharacter = Isaac.GetPlayerTypeByName(name, true)
|
|
179
183
|
return character == taintedCharacter
|
|
180
184
|
end
|
|
181
|
-
function ____exports.isModdedCharacter(self, player)
|
|
182
|
-
local character = player:GetPlayerType()
|
|
183
|
-
return character > MAX_VANILLA_CHARACTER
|
|
184
|
-
end
|
|
185
185
|
function ____exports.isVanillaCharacter(self, player)
|
|
186
186
|
return not ____exports.isModdedCharacter(nil, player)
|
|
187
187
|
end
|
|
@@ -201,13 +201,6 @@ function ____exports.addTrinketCostume(self, player, trinketType)
|
|
|
201
201
|
end
|
|
202
202
|
player:AddCostume(itemConfigTrinket, false)
|
|
203
203
|
end
|
|
204
|
-
function ____exports.anyPlayerCloserThan(self, position, distance)
|
|
205
|
-
local players = ____exports.getPlayers(nil)
|
|
206
|
-
return __TS__ArraySome(
|
|
207
|
-
players,
|
|
208
|
-
function(____, player) return player.Position:Distance(position) <= distance end
|
|
209
|
-
)
|
|
210
|
-
end
|
|
211
204
|
function ____exports.anyPlayerHasCollectible(self, collectibleType)
|
|
212
205
|
local players = ____exports.getPlayers(nil)
|
|
213
206
|
return __TS__ArraySome(
|
|
@@ -235,6 +228,10 @@ function ____exports.canPlayerCrushRocks(self, player)
|
|
|
235
228
|
local effects = player:GetEffects()
|
|
236
229
|
return player:HasCollectible(CollectibleType.COLLECTIBLE_LEO) or player:HasCollectible(CollectibleType.COLLECTIBLE_THUNDER_THIGHS) or effects:HasCollectibleEffect(CollectibleType.COLLECTIBLE_MEGA_MUSH) or player:HasPlayerForm(PlayerForm.PLAYERFORM_STOMPY)
|
|
237
230
|
end
|
|
231
|
+
function ____exports.canTakeFreeDevilDeals(self, player)
|
|
232
|
+
local character = player:GetPlayerType()
|
|
233
|
+
return CHARACTERS_WITH_FREE_DEVIL_DEALS:has(character)
|
|
234
|
+
end
|
|
238
235
|
function ____exports.characterCanHaveRedHearts(self, character)
|
|
239
236
|
return not CHARACTERS_WITH_NO_RED_HEARTS:has(character)
|
|
240
237
|
end
|
|
@@ -515,10 +512,6 @@ function ____exports.isLost(self, player)
|
|
|
515
512
|
local character = player:GetPlayerType()
|
|
516
513
|
return character == PlayerType.PLAYER_THELOST or character == PlayerType.PLAYER_THELOST_B
|
|
517
514
|
end
|
|
518
|
-
function ____exports.canTakeFreeDevilDeals(self, player)
|
|
519
|
-
local character = player:GetPlayerType()
|
|
520
|
-
return CHARACTERS_WITH_FREE_DEVIL_DEALS:has(character)
|
|
521
|
-
end
|
|
522
515
|
function ____exports.isTainted(self, player)
|
|
523
516
|
local character = player:GetPlayerType()
|
|
524
517
|
local ____isVanillaCharacter_result_0
|
|
@@ -571,9 +564,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
571
564
|
itemPool:RemoveCollectible(collectibleType)
|
|
572
565
|
end
|
|
573
566
|
repeat
|
|
574
|
-
local
|
|
575
|
-
local
|
|
576
|
-
if
|
|
567
|
+
local ____switch124 = activeSlot
|
|
568
|
+
local ____cond124 = ____switch124 == ActiveSlot.SLOT_PRIMARY
|
|
569
|
+
if ____cond124 then
|
|
577
570
|
do
|
|
578
571
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
579
572
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -582,8 +575,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
582
575
|
break
|
|
583
576
|
end
|
|
584
577
|
end
|
|
585
|
-
|
|
586
|
-
if
|
|
578
|
+
____cond124 = ____cond124 or ____switch124 == ActiveSlot.SLOT_SECONDARY
|
|
579
|
+
if ____cond124 then
|
|
587
580
|
do
|
|
588
581
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
589
582
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -598,16 +591,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
598
591
|
break
|
|
599
592
|
end
|
|
600
593
|
end
|
|
601
|
-
|
|
602
|
-
if
|
|
594
|
+
____cond124 = ____cond124 or ____switch124 == ActiveSlot.SLOT_POCKET
|
|
595
|
+
if ____cond124 then
|
|
603
596
|
do
|
|
604
597
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
605
598
|
player:SetActiveCharge(charge, activeSlot)
|
|
606
599
|
break
|
|
607
600
|
end
|
|
608
601
|
end
|
|
609
|
-
|
|
610
|
-
if
|
|
602
|
+
____cond124 = ____cond124 or ____switch124 == ActiveSlot.SLOT_POCKET2
|
|
603
|
+
if ____cond124 then
|
|
611
604
|
do
|
|
612
605
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
613
606
|
break
|
|
@@ -11,6 +11,7 @@ export declare function addPlayerHealthType(player: EntityPlayer, healthType: He
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function getPlayerHealth(player: EntityPlayer): PlayerHealth;
|
|
13
13
|
export declare function getPlayerHealthType(player: EntityPlayer, healthType: HealthType): int;
|
|
14
|
+
export declare function removeAllPlayerHealth(player: EntityPlayer): void;
|
|
14
15
|
/**
|
|
15
16
|
* Helper function to set a player's health to a specific state. You can use this in combination
|
|
16
17
|
* with the `getPlayerHealth` function to restore the player's health back to a certain
|
|
@@ -19,4 +20,3 @@ export declare function getPlayerHealthType(player: EntityPlayer, healthType: He
|
|
|
19
20
|
* Based on the `REVEL.LoadHealth` function in the Revelations mod.
|
|
20
21
|
*/
|
|
21
22
|
export declare function setPlayerHealth(player: EntityPlayer, playerHealth: PlayerHealth): void;
|
|
22
|
-
export declare function removeAllPlayerHealth(player: EntityPlayer): void;
|
|
@@ -14,26 +14,6 @@ local getSoulHearts = ____player.getSoulHearts
|
|
|
14
14
|
local ____utils = require("functions.utils")
|
|
15
15
|
local ensureAllCases = ____utils.ensureAllCases
|
|
16
16
|
local ____repeat = ____utils["repeat"]
|
|
17
|
-
function ____exports.removeAllPlayerHealth(self, player)
|
|
18
|
-
local character = player:GetPlayerType()
|
|
19
|
-
local goldenHearts = player:GetGoldenHearts()
|
|
20
|
-
local eternalHearts = player:GetEternalHearts()
|
|
21
|
-
local boneHearts = player:GetBoneHearts()
|
|
22
|
-
local brokenHearts = player:GetBrokenHearts()
|
|
23
|
-
player:AddGoldenHearts(goldenHearts * -1)
|
|
24
|
-
player:AddEternalHearts(eternalHearts * -1)
|
|
25
|
-
player:AddBoneHearts(boneHearts * -1)
|
|
26
|
-
player:AddBrokenHearts(brokenHearts * -1)
|
|
27
|
-
player:AddMaxHearts(MAX_PLAYER_HEART_CONTAINERS * -2, true)
|
|
28
|
-
player:AddSoulHearts(MAX_PLAYER_HEART_CONTAINERS * -2)
|
|
29
|
-
if character == PlayerType.PLAYER_THESOUL then
|
|
30
|
-
local forgotten = player:GetSubPlayer()
|
|
31
|
-
if forgotten ~= nil then
|
|
32
|
-
local forgottenBoneHearts = forgotten:GetBoneHearts()
|
|
33
|
-
forgotten:AddBoneHearts(forgottenBoneHearts * -1)
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
17
|
function ____exports.addPlayerHealthType(self, player, healthType, numHearts)
|
|
38
18
|
repeat
|
|
39
19
|
local ____switch3 = healthType
|
|
@@ -233,6 +213,26 @@ function ____exports.getPlayerHealthType(self, player, healthType)
|
|
|
233
213
|
end
|
|
234
214
|
until true
|
|
235
215
|
end
|
|
216
|
+
function ____exports.removeAllPlayerHealth(self, player)
|
|
217
|
+
local character = player:GetPlayerType()
|
|
218
|
+
local goldenHearts = player:GetGoldenHearts()
|
|
219
|
+
local eternalHearts = player:GetEternalHearts()
|
|
220
|
+
local boneHearts = player:GetBoneHearts()
|
|
221
|
+
local brokenHearts = player:GetBrokenHearts()
|
|
222
|
+
player:AddGoldenHearts(goldenHearts * -1)
|
|
223
|
+
player:AddEternalHearts(eternalHearts * -1)
|
|
224
|
+
player:AddBoneHearts(boneHearts * -1)
|
|
225
|
+
player:AddBrokenHearts(brokenHearts * -1)
|
|
226
|
+
player:AddMaxHearts(MAX_PLAYER_HEART_CONTAINERS * -2, true)
|
|
227
|
+
player:AddSoulHearts(MAX_PLAYER_HEART_CONTAINERS * -2)
|
|
228
|
+
if character == PlayerType.PLAYER_THESOUL then
|
|
229
|
+
local forgotten = player:GetSubPlayer()
|
|
230
|
+
if forgotten ~= nil then
|
|
231
|
+
local forgottenBoneHearts = forgotten:GetBoneHearts()
|
|
232
|
+
forgotten:AddBoneHearts(forgottenBoneHearts * -1)
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
end
|
|
236
236
|
function ____exports.setPlayerHealth(self, player, playerHealth)
|
|
237
237
|
local character = player:GetPlayerType()
|
|
238
238
|
local subPlayer = player:GetSubPlayer()
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
export declare function anyEntityCloserThan(entities: Entity[], position: Vector, distance: int): boolean;
|
|
3
|
+
/** Iterates over all players and checks if any player is close enough to the specified position. */
|
|
4
|
+
export declare function anyPlayerCloserThan(position: Vector, distance: float): boolean;
|
|
2
5
|
/**
|
|
3
6
|
* Helper function to get a room position that is not overlapping with a grid entity, a heaven door,
|
|
4
7
|
* or a player. The `Room.FindFreePickupSpawnPosition` method will return locations that overlap
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____lualib = require("lualib_bundle")
|
|
3
|
+
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
3
4
|
local Map = ____lualib.Map
|
|
4
5
|
local __TS__New = ____lualib.__TS__New
|
|
5
6
|
local ____exports = {}
|
|
@@ -8,13 +9,26 @@ local game = ____cachedClasses.game
|
|
|
8
9
|
local ____constants = require("constants")
|
|
9
10
|
local DISTANCE_OF_GRID_TILE = ____constants.DISTANCE_OF_GRID_TILE
|
|
10
11
|
local ____entity = require("functions.entity")
|
|
11
|
-
local anyEntityCloserThan = ____entity.anyEntityCloserThan
|
|
12
12
|
local getEntities = ____entity.getEntities
|
|
13
13
|
local ____entitySpecific = require("functions.entitySpecific")
|
|
14
14
|
local getEffects = ____entitySpecific.getEffects
|
|
15
15
|
local ____player = require("functions.player")
|
|
16
16
|
local getPlayerCloserThan = ____player.getPlayerCloserThan
|
|
17
|
+
local getPlayers = ____player.getPlayers
|
|
17
18
|
local MAX_FIND_FREE_POSITION_ATTEMPTS = 100
|
|
19
|
+
function ____exports.anyEntityCloserThan(self, entities, position, distance)
|
|
20
|
+
return __TS__ArraySome(
|
|
21
|
+
entities,
|
|
22
|
+
function(____, entity) return position:Distance(entity.Position) <= distance end
|
|
23
|
+
)
|
|
24
|
+
end
|
|
25
|
+
function ____exports.anyPlayerCloserThan(self, position, distance)
|
|
26
|
+
local players = getPlayers(nil)
|
|
27
|
+
return __TS__ArraySome(
|
|
28
|
+
players,
|
|
29
|
+
function(____, player) return player.Position:Distance(position) <= distance end
|
|
30
|
+
)
|
|
31
|
+
end
|
|
18
32
|
function ____exports.findFreePosition(self, startingPosition, avoidActiveEntities)
|
|
19
33
|
if avoidActiveEntities == nil then
|
|
20
34
|
avoidActiveEntities = false
|
|
@@ -28,15 +42,15 @@ function ____exports.findFreePosition(self, startingPosition, avoidActiveEntitie
|
|
|
28
42
|
local position = room:FindFreePickupSpawnPosition(startingPosition, i, avoidActiveEntities)
|
|
29
43
|
local closePlayer = getPlayerCloserThan(nil, position, DISTANCE_OF_GRID_TILE)
|
|
30
44
|
if closePlayer ~= nil then
|
|
31
|
-
goto
|
|
45
|
+
goto __continue7
|
|
32
46
|
end
|
|
33
|
-
local isCloseHeavenDoor = anyEntityCloserThan(nil, heavenDoors, position, DISTANCE_OF_GRID_TILE)
|
|
47
|
+
local isCloseHeavenDoor = ____exports.anyEntityCloserThan(nil, heavenDoors, position, DISTANCE_OF_GRID_TILE)
|
|
34
48
|
if isCloseHeavenDoor then
|
|
35
|
-
goto
|
|
49
|
+
goto __continue7
|
|
36
50
|
end
|
|
37
51
|
return position
|
|
38
52
|
end
|
|
39
|
-
::
|
|
53
|
+
::__continue7::
|
|
40
54
|
i = i + 1
|
|
41
55
|
end
|
|
42
56
|
end
|
|
@@ -25,13 +25,6 @@ export declare function getRandomFloat(min: int, max: int, seed?: Seed): float;
|
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
27
|
export declare function getRandomInt(min: int, max: int, seed?: Seed): int;
|
|
28
|
-
/**
|
|
29
|
-
* Helper function to get the next seed value.
|
|
30
|
-
*
|
|
31
|
-
* This function is useful because it is standard practice to work with seed values directly over
|
|
32
|
-
* RNG objects, since the latter are not serializable.
|
|
33
|
-
*/
|
|
34
|
-
export declare function nextSeed(seed: Seed): Seed;
|
|
35
28
|
/**
|
|
36
29
|
* Helper function to initialize an RNG object.
|
|
37
30
|
*
|
|
@@ -48,3 +41,10 @@ export declare function nextSeed(seed: Seed): Seed;
|
|
|
48
41
|
* @param seed The seed to initialize it with. Default is `Random()`.
|
|
49
42
|
*/
|
|
50
43
|
export declare function initRNG(seed?: Seed): RNG;
|
|
44
|
+
/**
|
|
45
|
+
* Helper function to get the next seed value.
|
|
46
|
+
*
|
|
47
|
+
* This function is useful because it is standard practice to work with seed values directly over
|
|
48
|
+
* RNG objects, since the latter are not serializable.
|
|
49
|
+
*/
|
|
50
|
+
export declare function nextSeed(seed: Seed): Seed;
|
|
@@ -4,11 +4,6 @@
|
|
|
4
4
|
* will be fatal.
|
|
5
5
|
*/
|
|
6
6
|
export declare function isDamageToPlayerFatal(player: EntityPlayer, damageAmount: int, damageSource: EntityRef, lastDamageGameFrame: int | undefined): boolean;
|
|
7
|
-
/**
|
|
8
|
-
* The `EntityPlayer.WillPlayerRevive` method does not properly account for Mysterious Paper, so use
|
|
9
|
-
* this helper function instead for more robust revival detection.
|
|
10
|
-
*/
|
|
11
|
-
export declare function willPlayerRevive(player: EntityPlayer): boolean;
|
|
12
7
|
/**
|
|
13
8
|
* Assuming that we are on the frame of fatal damage, this function returns whether or not
|
|
14
9
|
* Mysterious Paper would rotate to Missing Poster on the frame that the "Game Over" screen would
|
|
@@ -18,6 +13,11 @@ export declare function willPlayerRevive(player: EntityPlayer): boolean;
|
|
|
18
13
|
* Mysterious Paper be Missing Power is: `gameFrameCount % 4 === 3`
|
|
19
14
|
*/
|
|
20
15
|
export declare function willMysteriousPaperRevive(player: EntityPlayer): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The `EntityPlayer.WillPlayerRevive` method does not properly account for Mysterious Paper, so use
|
|
18
|
+
* this helper function instead for more robust revival detection.
|
|
19
|
+
*/
|
|
20
|
+
export declare function willPlayerRevive(player: EntityPlayer): boolean;
|
|
21
21
|
/**
|
|
22
22
|
* Helper function to determine if the player will be revived by the Heartbreak collectible if they
|
|
23
23
|
* take fatal damage. This is contingent on the character that they are playing as and the amount of
|
|
@@ -13,14 +13,6 @@ local getFinalFrameOfAnimation = ____sprite.getFinalFrameOfAnimation
|
|
|
13
13
|
local ____trinketGive = require("functions.trinketGive")
|
|
14
14
|
local giveTrinketsBack = ____trinketGive.giveTrinketsBack
|
|
15
15
|
local temporarilyRemoveTrinket = ____trinketGive.temporarilyRemoveTrinket
|
|
16
|
-
function ____exports.willMysteriousPaperRevive(self, player)
|
|
17
|
-
local gameFrameCount = game:GetFrameCount()
|
|
18
|
-
local sprite = player:GetSprite()
|
|
19
|
-
local animation = getDeathAnimationName(nil, player)
|
|
20
|
-
local deathAnimationFrames = getFinalFrameOfAnimation(nil, sprite, animation)
|
|
21
|
-
local frameOfDeath = gameFrameCount + deathAnimationFrames + 1
|
|
22
|
-
return frameOfDeath % 4 == 3
|
|
23
|
-
end
|
|
24
16
|
function ____exports.willReviveFromHeartbreak(self, player)
|
|
25
17
|
if not player:HasCollectible(CollectibleType.COLLECTIBLE_HEARTBREAK) then
|
|
26
18
|
return false
|
|
@@ -79,6 +71,14 @@ function ____exports.isDamageToPlayerFatal(self, player, damageAmount, damageSou
|
|
|
79
71
|
end
|
|
80
72
|
return true
|
|
81
73
|
end
|
|
74
|
+
function ____exports.willMysteriousPaperRevive(self, player)
|
|
75
|
+
local gameFrameCount = game:GetFrameCount()
|
|
76
|
+
local sprite = player:GetSprite()
|
|
77
|
+
local animation = getDeathAnimationName(nil, player)
|
|
78
|
+
local deathAnimationFrames = getFinalFrameOfAnimation(nil, sprite, animation)
|
|
79
|
+
local frameOfDeath = gameFrameCount + deathAnimationFrames + 1
|
|
80
|
+
return frameOfDeath % 4 == 3
|
|
81
|
+
end
|
|
82
82
|
function ____exports.willPlayerRevive(self, player)
|
|
83
83
|
local trinketSituation = temporarilyRemoveTrinket(nil, player, TrinketType.TRINKET_MYSTERIOUS_PAPER)
|
|
84
84
|
local willRevive = player:WillPlayerRevive() or trinketSituation ~= nil and ____exports.willMysteriousPaperRevive(nil, player)
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/**
|
|
3
|
+
* Alias for the `Level.GetCurrentRoomDesc` method. Use this to make it more clear what type of
|
|
4
|
+
* `RoomDescriptor` object that you are retrieving.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getCurrentRoomDescriptorReadOnly(): RoomDescriptorReadOnly;
|
|
7
|
+
/**
|
|
8
|
+
* Helper function to get the room data for the provided room.
|
|
9
|
+
*
|
|
10
|
+
* @param roomGridIndex Optional. Default is the current room index.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getRoomData(roomGridIndex?: int): RoomConfig | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Helper function to get the descriptor for a room.
|
|
15
|
+
*
|
|
16
|
+
* @param roomGridIndex Optional. Default is the current room index.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getRoomDescriptor(roomGridIndex?: int): RoomDescriptor;
|
|
19
|
+
/**
|
|
20
|
+
* Helper function to get the grid index of the current room.
|
|
21
|
+
*
|
|
22
|
+
* - If the current room is inside of the grid, this function will return the `SafeGridIndex` from
|
|
23
|
+
* the room descriptor. (The safe grid index is defined as the top-left 1x1 section that the room
|
|
24
|
+
* overlaps with, or the top-right 1x1 section of a `RoomType.ROOMSHAPE_LTL` room.)
|
|
25
|
+
* - If the current room is outside of the grid, it will return the index from the
|
|
26
|
+
* `Level.GetCurrentRoomIndex` method (since `SafeGridIndex` is bugged for these cases).
|
|
27
|
+
*
|
|
28
|
+
* Use this function instead of the `Level.GetCurrentRoomIndex` method directly because the latter
|
|
29
|
+
* will return the specific 1x1 quadrant that the player entered the room at. For most situations,
|
|
30
|
+
* using the safe grid index is more reliable than this.
|
|
31
|
+
*
|
|
32
|
+
* Data structures that store data per room should use the room's `ListIndex` instead of
|
|
33
|
+
* `SafeGridIndex`, since the former is unique across different dimensions.
|
|
34
|
+
*/
|
|
35
|
+
export declare function getRoomGridIndex(): int;
|
|
36
|
+
/**
|
|
37
|
+
* Helper function to get the list grid index of the provided room, which is equal to the index in
|
|
38
|
+
* the `RoomList.Get` method. In other words, this is equal to the order that the room was created
|
|
39
|
+
* by the floor generation algorithm.
|
|
40
|
+
*
|
|
41
|
+
* Use this as an index for data structures that store data per room, since it is unique across
|
|
42
|
+
* different dimensions.
|
|
43
|
+
*
|
|
44
|
+
* @param roomGridIndex Optional. Default is the current room index.
|
|
45
|
+
*/
|
|
46
|
+
export declare function getRoomListIndex(roomGridIndex?: int): int;
|
|
47
|
+
/**
|
|
48
|
+
* Helper function to get the name of the room as it appears in the STB/XML data.
|
|
49
|
+
*
|
|
50
|
+
* @param roomGridIndex Optional. Default is the current room index.
|
|
51
|
+
* @returns The room name. Returns "Unknown" if the type was not found.
|
|
52
|
+
*/
|
|
53
|
+
export declare function getRoomName(roomGridIndex?: int): string;
|
|
54
|
+
/**
|
|
55
|
+
* Helper function to get the stage ID for a room from the XML/STB data. The room stage ID will
|
|
56
|
+
* correspond to the first number in the filename of the XML/STB file. For example, a Depths room
|
|
57
|
+
* would have a stage ID of 7.
|
|
58
|
+
*
|
|
59
|
+
* @param roomGridIndex Optional. Default is the current room index.
|
|
60
|
+
* @returns The room stage ID. Returns -1 if the stage ID was not found.
|
|
61
|
+
*/
|
|
62
|
+
export declare function getRoomStageID(roomGridIndex?: int): StageID;
|
|
63
|
+
/**
|
|
64
|
+
* Helper function to get the sub-type for a room from the XML/STB data. The room sub-type will
|
|
65
|
+
* correspond to different things depending on what XML/STB file it draws from. For example, in the
|
|
66
|
+
* "00.special rooms.stb" file, an Angel Room with a sub-type of 0 will correspond to a normal Angel
|
|
67
|
+
* Room and a sub-type of 1 will correspond to an Angel Room shop for The Stairway.
|
|
68
|
+
*
|
|
69
|
+
* @param roomGridIndex Optional. Default is the current room index.
|
|
70
|
+
* @returns The room sub-type. Returns -1 if the sub-type was not found.
|
|
71
|
+
*/
|
|
72
|
+
export declare function getRoomSubType(roomGridIndex?: int): int;
|
|
73
|
+
/**
|
|
74
|
+
* Helper function for getting the type of the room with the given grid index.
|
|
75
|
+
*
|
|
76
|
+
* @param roomGridIndex Optional. Default is the current room index.
|
|
77
|
+
* @returns The room data type. Returns -1 if the type was not found.
|
|
78
|
+
*/
|
|
79
|
+
export declare function getRoomType(roomGridIndex?: int): RoomType;
|
|
80
|
+
/**
|
|
81
|
+
* Helper function to get the variant for a room from the XML/STB data. You can think of a room
|
|
82
|
+
* variant as its identifier. For example, to go to Basement room #123, you would use a console
|
|
83
|
+
* command of `goto d.123` while on the Basement.
|
|
84
|
+
*
|
|
85
|
+
* @param roomGridIndex Optional. Default is the current room index.
|
|
86
|
+
* @returns The room variant. Returns -1 if the variant was not found.
|
|
87
|
+
*/
|
|
88
|
+
export declare function getRoomVariant(roomGridIndex?: int): int;
|
|
89
|
+
/**
|
|
90
|
+
* Note that the room visited count will be inaccurate during the period before the PostNewRoom
|
|
91
|
+
* callback has fired (i.e. when entities are initializing and performing their first update). This
|
|
92
|
+
* is because the variable is only incremented immediately before the PostNewRoom callback fires.
|
|
93
|
+
*
|
|
94
|
+
* @param roomGridIndex Optional. Default is the current room index.
|
|
95
|
+
*/
|
|
96
|
+
export declare function getRoomVisitedCount(roomGridIndex?: int): int;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
local ____cachedClasses = require("cachedClasses")
|
|
4
|
+
local game = ____cachedClasses.game
|
|
5
|
+
function ____exports.getCurrentRoomDescriptorReadOnly(self)
|
|
6
|
+
local level = game:GetLevel()
|
|
7
|
+
return level:GetCurrentRoomDesc()
|
|
8
|
+
end
|
|
9
|
+
function ____exports.getRoomDescriptor(self, roomGridIndex)
|
|
10
|
+
local level = game:GetLevel()
|
|
11
|
+
if roomGridIndex == nil then
|
|
12
|
+
roomGridIndex = ____exports.getRoomGridIndex(nil)
|
|
13
|
+
end
|
|
14
|
+
return level:GetRoomByIdx(roomGridIndex)
|
|
15
|
+
end
|
|
16
|
+
function ____exports.getRoomGridIndex(self)
|
|
17
|
+
local level = game:GetLevel()
|
|
18
|
+
local currentRoomIndex = level:GetCurrentRoomIndex()
|
|
19
|
+
if currentRoomIndex < 0 then
|
|
20
|
+
return currentRoomIndex
|
|
21
|
+
end
|
|
22
|
+
local roomDescriptor = ____exports.getCurrentRoomDescriptorReadOnly(nil)
|
|
23
|
+
return roomDescriptor.SafeGridIndex
|
|
24
|
+
end
|
|
25
|
+
function ____exports.getRoomData(self, roomGridIndex)
|
|
26
|
+
local roomDescriptor = ____exports.getRoomDescriptor(nil, roomGridIndex)
|
|
27
|
+
return roomDescriptor.Data
|
|
28
|
+
end
|
|
29
|
+
function ____exports.getRoomListIndex(self, roomGridIndex)
|
|
30
|
+
local roomDescriptor = ____exports.getRoomDescriptor(nil, roomGridIndex)
|
|
31
|
+
return roomDescriptor.ListIndex
|
|
32
|
+
end
|
|
33
|
+
function ____exports.getRoomName(self, roomGridIndex)
|
|
34
|
+
local roomData = ____exports.getRoomData(nil, roomGridIndex)
|
|
35
|
+
return roomData == nil and "Unknown" or roomData.Name
|
|
36
|
+
end
|
|
37
|
+
function ____exports.getRoomStageID(self, roomGridIndex)
|
|
38
|
+
local roomData = ____exports.getRoomData(nil, roomGridIndex)
|
|
39
|
+
return roomData == nil and -1 or roomData.StageID
|
|
40
|
+
end
|
|
41
|
+
function ____exports.getRoomSubType(self, roomGridIndex)
|
|
42
|
+
local roomData = ____exports.getRoomData(nil, roomGridIndex)
|
|
43
|
+
return roomData == nil and -1 or roomData.Subtype
|
|
44
|
+
end
|
|
45
|
+
function ____exports.getRoomType(self, roomGridIndex)
|
|
46
|
+
local roomData = ____exports.getRoomData(nil, roomGridIndex)
|
|
47
|
+
return roomData == nil and -1 or roomData.Type
|
|
48
|
+
end
|
|
49
|
+
function ____exports.getRoomVariant(self, roomGridIndex)
|
|
50
|
+
local roomData = ____exports.getRoomData(nil, roomGridIndex)
|
|
51
|
+
return roomData == nil and -1 or roomData.Variant
|
|
52
|
+
end
|
|
53
|
+
function ____exports.getRoomVisitedCount(self, roomGridIndex)
|
|
54
|
+
local roomDescriptor = ____exports.getRoomDescriptor(nil, roomGridIndex)
|
|
55
|
+
return roomDescriptor.VisitedCount
|
|
56
|
+
end
|
|
57
|
+
return ____exports
|
|
@@ -15,47 +15,6 @@ export declare function getAllRoomGridIndexes(): int[];
|
|
|
15
15
|
* tricky to properly detect.
|
|
16
16
|
*/
|
|
17
17
|
export declare function getCurrentDimension(): Dimension;
|
|
18
|
-
/**
|
|
19
|
-
* Alias for the `Level.GetCurrentRoomDesc` method. Use this to make it more clear what type of
|
|
20
|
-
* `RoomDescriptor` object that you are retrieving.
|
|
21
|
-
*/
|
|
22
|
-
export declare function getCurrentRoomDescriptorReadOnly(): RoomDescriptorReadOnly;
|
|
23
|
-
/**
|
|
24
|
-
* Helper function to get the room data for the provided room.
|
|
25
|
-
*
|
|
26
|
-
* @param roomGridIndex Optional. Default is the current room index.
|
|
27
|
-
*/
|
|
28
|
-
export declare function getRoomData(roomGridIndex?: int): RoomConfig | undefined;
|
|
29
|
-
/**
|
|
30
|
-
* Helper function for getting the type of the room with the given grid index.
|
|
31
|
-
*
|
|
32
|
-
* @param roomGridIndex Optional. Default is the current room index.
|
|
33
|
-
* @returns The room data type. Returns -1 if the type was not found.
|
|
34
|
-
*/
|
|
35
|
-
export declare function getRoomType(roomGridIndex?: int): RoomType;
|
|
36
|
-
/**
|
|
37
|
-
* Helper function to get the descriptor for a room.
|
|
38
|
-
*
|
|
39
|
-
* @param roomGridIndex Optional. Default is the current room index.
|
|
40
|
-
*/
|
|
41
|
-
export declare function getRoomDescriptor(roomGridIndex?: int): RoomDescriptor;
|
|
42
|
-
/**
|
|
43
|
-
* Helper function to get the grid index of the current room.
|
|
44
|
-
*
|
|
45
|
-
* - If the current room is inside of the grid, this function will return the `SafeGridIndex` from
|
|
46
|
-
* the room descriptor. (The safe grid index is defined as the top-left 1x1 section that the room
|
|
47
|
-
* overlaps with, or the top-right 1x1 section of a `RoomType.ROOMSHAPE_LTL` room.)
|
|
48
|
-
* - If the current room is outside of the grid, it will return the index from the
|
|
49
|
-
* `Level.GetCurrentRoomIndex` method (since `SafeGridIndex` is bugged for these cases).
|
|
50
|
-
*
|
|
51
|
-
* Use this function instead of the `Level.GetCurrentRoomIndex` method directly because the latter
|
|
52
|
-
* will return the specific 1x1 quadrant that the player entered the room at. For most situations,
|
|
53
|
-
* using the safe grid index is more reliable than this.
|
|
54
|
-
*
|
|
55
|
-
* Data structures that store data per room should use the room's `ListIndex` instead of
|
|
56
|
-
* `SafeGridIndex`, since the former is unique across different dimensions.
|
|
57
|
-
*/
|
|
58
|
-
export declare function getRoomGridIndex(): int;
|
|
59
18
|
/**
|
|
60
19
|
* Helper function to get an array of all of the safe grid indexes for rooms that match the
|
|
61
20
|
* specified room type.
|
|
@@ -71,60 +30,6 @@ export declare function getRoomGridIndexesForType(...roomTypes: RoomType[]): int
|
|
|
71
30
|
* `ItemPoolType.ItemPoolType.POOL_ANGEL` if you are in an Angel Room.
|
|
72
31
|
*/
|
|
73
32
|
export declare function getRoomItemPoolType(): ItemPoolType;
|
|
74
|
-
/**
|
|
75
|
-
* Helper function to get the list grid index of the provided room, which is equal to the index in
|
|
76
|
-
* the `RoomList.Get` method. In other words, this is equal to the order that the room was created
|
|
77
|
-
* by the floor generation algorithm.
|
|
78
|
-
*
|
|
79
|
-
* Use this as an index for data structures that store data per room, since it is unique across
|
|
80
|
-
* different dimensions.
|
|
81
|
-
*
|
|
82
|
-
* @param roomGridIndex Optional. Default is the current room index.
|
|
83
|
-
*/
|
|
84
|
-
export declare function getRoomListIndex(roomGridIndex?: int): int;
|
|
85
|
-
/**
|
|
86
|
-
* Helper function to get the name of the room as it appears in the STB/XML data.
|
|
87
|
-
*
|
|
88
|
-
* @param roomGridIndex Optional. Default is the current room index.
|
|
89
|
-
* @returns The room name. Returns "Unknown" if the type was not found.
|
|
90
|
-
*/
|
|
91
|
-
export declare function getRoomName(roomGridIndex?: int): string;
|
|
92
|
-
/**
|
|
93
|
-
* Helper function to get the stage ID for a room from the XML/STB data. The room stage ID will
|
|
94
|
-
* correspond to the first number in the filename of the XML/STB file. For example, a Depths room
|
|
95
|
-
* would have a stage ID of 7.
|
|
96
|
-
*
|
|
97
|
-
* @param roomGridIndex Optional. Default is the current room index.
|
|
98
|
-
* @returns The room stage ID. Returns -1 if the stage ID was not found.
|
|
99
|
-
*/
|
|
100
|
-
export declare function getRoomStageID(roomGridIndex?: int): StageID;
|
|
101
|
-
/**
|
|
102
|
-
* Helper function to get the sub-type for a room from the XML/STB data. The room sub-type will
|
|
103
|
-
* correspond to different things depending on what XML/STB file it draws from. For example, in the
|
|
104
|
-
* "00.special rooms.stb" file, an Angel Room with a sub-type of 0 will correspond to a normal Angel
|
|
105
|
-
* Room and a sub-type of 1 will correspond to an Angel Room shop for The Stairway.
|
|
106
|
-
*
|
|
107
|
-
* @param roomGridIndex Optional. Default is the current room index.
|
|
108
|
-
* @returns The room sub-type. Returns -1 if the sub-type was not found.
|
|
109
|
-
*/
|
|
110
|
-
export declare function getRoomSubType(roomGridIndex?: int): int;
|
|
111
|
-
/**
|
|
112
|
-
* Helper function to get the variant for a room from the XML/STB data. You can think of a room
|
|
113
|
-
* variant as its identifier. For example, to go to Basement room #123, you would use a console
|
|
114
|
-
* command of `goto d.123` while on the Basement.
|
|
115
|
-
*
|
|
116
|
-
* @param roomGridIndex Optional. Default is the current room index.
|
|
117
|
-
* @returns The room variant. Returns -1 if the variant was not found.
|
|
118
|
-
*/
|
|
119
|
-
export declare function getRoomVariant(roomGridIndex?: int): int;
|
|
120
|
-
/**
|
|
121
|
-
* Note that the room visited count will be inaccurate during the period before the PostNewRoom
|
|
122
|
-
* callback has fired (i.e. when entities are initializing and performing their first update). This
|
|
123
|
-
* is because the variable is only incremented immediately before the PostNewRoom callback fires.
|
|
124
|
-
*
|
|
125
|
-
* @param roomGridIndex Optional. Default is the current room index.
|
|
126
|
-
*/
|
|
127
|
-
export declare function getRoomVisitedCount(roomGridIndex?: int): int;
|
|
128
33
|
/**
|
|
129
34
|
* Helper function to get the room descriptor for every room on the level. Uses the `Level.GetRooms`
|
|
130
35
|
* method to accomplish this.
|
|
@@ -169,9 +74,9 @@ export declare function inDeathCertificateArea(): boolean;
|
|
|
169
74
|
*/
|
|
170
75
|
export declare function inDevilsCrownTreasureRoom(): boolean;
|
|
171
76
|
export declare function inDimension(dimension: Dimension): boolean;
|
|
77
|
+
export declare function inGenesisRoom(): boolean;
|
|
172
78
|
/** Helper function to determine if the current room shape is one of the four L room shapes. */
|
|
173
79
|
export declare function inLRoom(): boolean;
|
|
174
|
-
export declare function inGenesisRoom(): boolean;
|
|
175
80
|
export declare function inMegaSatanRoom(): boolean;
|
|
176
81
|
/**
|
|
177
82
|
* Helper function to check if the current room is a miniboss room for a particular miniboss. This
|