isaacscript-common 1.2.174 → 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/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 +51 -15
- 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 +5 -3
- 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 +1 -1
- package/dist/functions/gridEntity.lua +5 -5
- 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/player.d.ts +6 -8
- 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
|
@@ -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
|
package/dist/functions/rooms.lua
CHANGED
|
@@ -30,38 +30,13 @@ local getEntityPositions = ____positionVelocity.getEntityPositions
|
|
|
30
30
|
local getEntityVelocities = ____positionVelocity.getEntityVelocities
|
|
31
31
|
local setEntityPositions = ____positionVelocity.setEntityPositions
|
|
32
32
|
local setEntityVelocities = ____positionVelocity.setEntityVelocities
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
end
|
|
41
|
-
function ____exports.getRoomDescriptor(self, roomGridIndex)
|
|
42
|
-
local level = game:GetLevel()
|
|
43
|
-
if roomGridIndex == nil then
|
|
44
|
-
roomGridIndex = ____exports.getRoomGridIndex(nil)
|
|
45
|
-
end
|
|
46
|
-
return level:GetRoomByIdx(roomGridIndex)
|
|
47
|
-
end
|
|
48
|
-
function ____exports.getRoomGridIndex(self)
|
|
49
|
-
local level = game:GetLevel()
|
|
50
|
-
local currentRoomIndex = level:GetCurrentRoomIndex()
|
|
51
|
-
if currentRoomIndex < 0 then
|
|
52
|
-
return currentRoomIndex
|
|
53
|
-
end
|
|
54
|
-
local roomDescriptor = ____exports.getCurrentRoomDescriptorReadOnly(nil)
|
|
55
|
-
return roomDescriptor.SafeGridIndex
|
|
56
|
-
end
|
|
57
|
-
function ____exports.getRoomStageID(self, roomGridIndex)
|
|
58
|
-
local roomData = ____exports.getRoomData(nil, roomGridIndex)
|
|
59
|
-
return roomData == nil and -1 or roomData.StageID
|
|
60
|
-
end
|
|
61
|
-
function ____exports.getRoomSubType(self, roomGridIndex)
|
|
62
|
-
local roomData = ____exports.getRoomData(nil, roomGridIndex)
|
|
63
|
-
return roomData == nil and -1 or roomData.Subtype
|
|
64
|
-
end
|
|
33
|
+
local ____roomData = require("functions.roomData")
|
|
34
|
+
local getCurrentRoomDescriptorReadOnly = ____roomData.getCurrentRoomDescriptorReadOnly
|
|
35
|
+
local getRoomData = ____roomData.getRoomData
|
|
36
|
+
local getRoomDescriptor = ____roomData.getRoomDescriptor
|
|
37
|
+
local getRoomGridIndex = ____roomData.getRoomGridIndex
|
|
38
|
+
local getRoomStageID = ____roomData.getRoomStageID
|
|
39
|
+
local getRoomSubType = ____roomData.getRoomSubType
|
|
65
40
|
function ____exports.getRooms(self, includeExtraDimensionalRooms)
|
|
66
41
|
if includeExtraDimensionalRooms == nil then
|
|
67
42
|
includeExtraDimensionalRooms = false
|
|
@@ -95,13 +70,13 @@ function ____exports.getRooms(self, includeExtraDimensionalRooms)
|
|
|
95
70
|
return rooms
|
|
96
71
|
end
|
|
97
72
|
function ____exports.inDeathCertificateArea(self)
|
|
98
|
-
local roomStageID =
|
|
99
|
-
local roomSubType =
|
|
73
|
+
local roomStageID = getRoomStageID(nil)
|
|
74
|
+
local roomSubType = getRoomSubType(nil)
|
|
100
75
|
return roomStageID == 35 and (roomSubType == 33 or roomSubType == 34)
|
|
101
76
|
end
|
|
102
77
|
function ____exports.changeRoom(self, roomGridIndex)
|
|
103
78
|
local level = game:GetLevel()
|
|
104
|
-
local roomData =
|
|
79
|
+
local roomData = getRoomData(nil, roomGridIndex)
|
|
105
80
|
if roomData == nil then
|
|
106
81
|
error(("Failed to change the room to grid index " .. tostring(roomGridIndex)) .. " because that room does not exist.")
|
|
107
82
|
end
|
|
@@ -132,10 +107,6 @@ function ____exports.getCurrentDimension(self)
|
|
|
132
107
|
end
|
|
133
108
|
return error("Failed to get the current dimension using the starting room index of: " .. tostring(startingRoomGridIndex))
|
|
134
109
|
end
|
|
135
|
-
function ____exports.getRoomType(self, roomGridIndex)
|
|
136
|
-
local roomData = ____exports.getRoomData(nil, roomGridIndex)
|
|
137
|
-
return roomData == nil and -1 or roomData.Type
|
|
138
|
-
end
|
|
139
110
|
function ____exports.getRoomGridIndexesForType(self, ...)
|
|
140
111
|
local roomTypesSet = __TS__New(Set, {...})
|
|
141
112
|
local rooms = ____exports.getRooms(nil)
|
|
@@ -155,22 +126,6 @@ function ____exports.getRoomItemPoolType(self)
|
|
|
155
126
|
local roomSeed = room:GetSpawnSeed()
|
|
156
127
|
return itemPool:GetPoolForRoom(roomType, roomSeed)
|
|
157
128
|
end
|
|
158
|
-
function ____exports.getRoomListIndex(self, roomGridIndex)
|
|
159
|
-
local roomDescriptor = ____exports.getRoomDescriptor(nil, roomGridIndex)
|
|
160
|
-
return roomDescriptor.ListIndex
|
|
161
|
-
end
|
|
162
|
-
function ____exports.getRoomName(self, roomGridIndex)
|
|
163
|
-
local roomData = ____exports.getRoomData(nil, roomGridIndex)
|
|
164
|
-
return roomData == nil and "Unknown" or roomData.Name
|
|
165
|
-
end
|
|
166
|
-
function ____exports.getRoomVariant(self, roomGridIndex)
|
|
167
|
-
local roomData = ____exports.getRoomData(nil, roomGridIndex)
|
|
168
|
-
return roomData == nil and -1 or roomData.Variant
|
|
169
|
-
end
|
|
170
|
-
function ____exports.getRoomVisitedCount(self, roomGridIndex)
|
|
171
|
-
local roomDescriptor = ____exports.getRoomDescriptor(nil, roomGridIndex)
|
|
172
|
-
return roomDescriptor.VisitedCount
|
|
173
|
-
end
|
|
174
129
|
function ____exports.gridToPos(self, x, y)
|
|
175
130
|
local room = game:GetRoom()
|
|
176
131
|
x = x + 1
|
|
@@ -186,63 +141,63 @@ end
|
|
|
186
141
|
function ____exports.inAngelShop(self)
|
|
187
142
|
local room = game:GetRoom()
|
|
188
143
|
local roomType = room:GetType()
|
|
189
|
-
local roomSubType =
|
|
144
|
+
local roomSubType = getRoomSubType(nil)
|
|
190
145
|
return roomType == RoomType.ROOM_ANGEL and roomSubType == 1
|
|
191
146
|
end
|
|
192
147
|
function ____exports.inBeastRoom(self)
|
|
193
148
|
local room = game:GetRoom()
|
|
194
149
|
local roomType = room:GetType()
|
|
195
|
-
local roomSubType =
|
|
150
|
+
local roomSubType = getRoomSubType(nil)
|
|
196
151
|
return roomType == RoomType.ROOM_DUNGEON and roomSubType == 4
|
|
197
152
|
end
|
|
198
153
|
function ____exports.inBossRoomOf(self, bossID)
|
|
199
154
|
local room = game:GetRoom()
|
|
200
155
|
local roomType = room:GetType()
|
|
201
|
-
local roomStageID =
|
|
202
|
-
local roomSubType =
|
|
156
|
+
local roomStageID = getRoomStageID(nil)
|
|
157
|
+
local roomSubType = getRoomSubType(nil)
|
|
203
158
|
return roomType == RoomType.ROOM_BOSS and roomStageID == 0 and roomSubType == bossID
|
|
204
159
|
end
|
|
205
160
|
function ____exports.inCrawlspace(self)
|
|
206
161
|
local room = game:GetRoom()
|
|
207
162
|
local roomType = room:GetType()
|
|
208
|
-
local roomSubType =
|
|
163
|
+
local roomSubType = getRoomSubType(nil)
|
|
209
164
|
return roomType == RoomType.ROOM_DUNGEON and roomSubType == 0
|
|
210
165
|
end
|
|
211
166
|
function ____exports.inDevilsCrownTreasureRoom(self)
|
|
212
|
-
local roomDescriptor =
|
|
167
|
+
local roomDescriptor = getCurrentRoomDescriptorReadOnly(nil)
|
|
213
168
|
return hasFlag(nil, roomDescriptor.Flags, 2048)
|
|
214
169
|
end
|
|
215
170
|
function ____exports.inDimension(self, dimension)
|
|
216
171
|
return dimension == ____exports.getCurrentDimension(nil)
|
|
217
172
|
end
|
|
173
|
+
function ____exports.inGenesisRoom(self)
|
|
174
|
+
local roomGridIndex = getRoomGridIndex(nil)
|
|
175
|
+
return roomGridIndex == GridRooms.ROOM_GENESIS_IDX
|
|
176
|
+
end
|
|
218
177
|
function ____exports.inLRoom(self)
|
|
219
178
|
local room = game:GetRoom()
|
|
220
179
|
local roomShape = room:GetRoomShape()
|
|
221
180
|
return roomShape == RoomShape.ROOMSHAPE_LTL or roomShape == RoomShape.ROOMSHAPE_LTR or roomShape == RoomShape.ROOMSHAPE_LBL or roomShape == RoomShape.ROOMSHAPE_LBR
|
|
222
181
|
end
|
|
223
|
-
function ____exports.inGenesisRoom(self)
|
|
224
|
-
local roomGridIndex = ____exports.getRoomGridIndex(nil)
|
|
225
|
-
return roomGridIndex == GridRooms.ROOM_GENESIS_IDX
|
|
226
|
-
end
|
|
227
182
|
function ____exports.inMegaSatanRoom(self)
|
|
228
|
-
local roomGridIndex =
|
|
183
|
+
local roomGridIndex = getRoomGridIndex(nil)
|
|
229
184
|
return roomGridIndex == GridRooms.ROOM_MEGA_SATAN_IDX
|
|
230
185
|
end
|
|
231
186
|
function ____exports.inMinibossRoomOf(self, minibossID)
|
|
232
187
|
local room = game:GetRoom()
|
|
233
188
|
local roomType = room:GetType()
|
|
234
|
-
local roomStageID =
|
|
235
|
-
local roomSubType =
|
|
189
|
+
local roomStageID = getRoomStageID(nil)
|
|
190
|
+
local roomSubType = getRoomSubType(nil)
|
|
236
191
|
return roomType == RoomType.ROOM_MINIBOSS and roomStageID == 0 and roomSubType == minibossID
|
|
237
192
|
end
|
|
238
193
|
function ____exports.inSecretShop(self)
|
|
239
|
-
local roomGridIndex =
|
|
194
|
+
local roomGridIndex = getRoomGridIndex(nil)
|
|
240
195
|
return roomGridIndex == GridRooms.ROOM_SECRET_SHOP_IDX
|
|
241
196
|
end
|
|
242
197
|
function ____exports.inStartingRoom(self)
|
|
243
198
|
local level = game:GetLevel()
|
|
244
199
|
local startingRoomGridIndex = level:GetStartingRoomIndex()
|
|
245
|
-
local roomGridIndex =
|
|
200
|
+
local roomGridIndex = getRoomGridIndex(nil)
|
|
246
201
|
return roomGridIndex == startingRoomGridIndex and ____exports.inDimension(nil, 0)
|
|
247
202
|
end
|
|
248
203
|
function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes)
|
|
@@ -264,12 +219,12 @@ function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes)
|
|
|
264
219
|
)
|
|
265
220
|
end
|
|
266
221
|
function ____exports.isRedKeyRoom(self, roomGridIndex)
|
|
267
|
-
local roomDescriptor =
|
|
222
|
+
local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
|
|
268
223
|
return hasFlag(nil, roomDescriptor.Flags, 1024)
|
|
269
224
|
end
|
|
270
225
|
function ____exports.isRoomInsideMap(self, roomGridIndex)
|
|
271
226
|
if roomGridIndex == nil then
|
|
272
|
-
roomGridIndex =
|
|
227
|
+
roomGridIndex = getRoomGridIndex(nil)
|
|
273
228
|
end
|
|
274
229
|
return roomGridIndex >= 0
|
|
275
230
|
end
|
|
@@ -292,12 +247,12 @@ function ____exports.setRoomCleared(self)
|
|
|
292
247
|
for ____, door in ipairs(getDoors(nil)) do
|
|
293
248
|
do
|
|
294
249
|
if isHiddenSecretRoomDoor(nil, door) then
|
|
295
|
-
goto
|
|
250
|
+
goto __continue46
|
|
296
251
|
end
|
|
297
252
|
openDoorFast(nil, door)
|
|
298
253
|
door.ExtraVisible = false
|
|
299
254
|
end
|
|
300
|
-
::
|
|
255
|
+
::__continue46::
|
|
301
256
|
end
|
|
302
257
|
sfxManager:Stop(SoundEffect.SOUND_DOOR_HEAVY_OPEN)
|
|
303
258
|
game:ShakeScreen(0)
|
|
@@ -315,7 +270,7 @@ function ____exports.teleport(self, roomGridIndex, direction, roomTransitionAnim
|
|
|
315
270
|
roomTransitionAnim = RoomTransitionAnim.TELEPORT
|
|
316
271
|
end
|
|
317
272
|
local level = game:GetLevel()
|
|
318
|
-
local roomData =
|
|
273
|
+
local roomData = getRoomData(nil, roomGridIndex)
|
|
319
274
|
if roomData == nil then
|
|
320
275
|
error(("Failed to change the room to grid index " .. tostring(roomGridIndex)) .. " because that room does not exist.")
|
|
321
276
|
end
|
package/dist/functions/set.d.ts
CHANGED
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
* This function is variadic, meaning that you can specify N sets to add to the first set.
|
|
7
7
|
*/
|
|
8
8
|
export declare function addSetsToSet<T>(mainSet: Set<T>, ...setsToAdd: Array<Set<T> | ReadonlySet<T>>): void;
|
|
9
|
-
/** Helper function to copy a set. (You can also use a Set constructor to accomplish this task.) */
|
|
10
|
-
export declare function copySet<T>(oldSet: Set<T> | ReadonlySet<T>): Set<T>;
|
|
11
9
|
/**
|
|
12
10
|
* Helper function to create a new set that is the composition of two or more sets.
|
|
13
11
|
*
|
|
14
12
|
* This function is variadic, meaning that you can specify N sets.
|
|
15
13
|
*/
|
|
16
14
|
export declare function combineSets<T>(...sets: Array<Set<T> | ReadonlySet<T>>): Set<T>;
|
|
15
|
+
/** Helper function to copy a set. (You can also use a Set constructor to accomplish this task.) */
|
|
16
|
+
export declare function copySet<T>(oldSet: Set<T> | ReadonlySet<T>): Set<T>;
|
|
17
17
|
/**
|
|
18
18
|
* Helper function to delete all of the values in one set from another set. The first set passed
|
|
19
19
|
* will be modified in place.
|
package/dist/functions/set.lua
CHANGED
|
@@ -22,13 +22,6 @@ function ____exports.addSetsToSet(self, mainSet, ...)
|
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
|
-
function ____exports.copySet(self, oldSet)
|
|
26
|
-
local newSet = __TS__New(Set)
|
|
27
|
-
for ____, value in __TS__Iterator(oldSet:values()) do
|
|
28
|
-
newSet:add(value)
|
|
29
|
-
end
|
|
30
|
-
return newSet
|
|
31
|
-
end
|
|
32
25
|
function ____exports.combineSets(self, ...)
|
|
33
26
|
local sets = {...}
|
|
34
27
|
local newSet = __TS__New(Set)
|
|
@@ -39,6 +32,13 @@ function ____exports.combineSets(self, ...)
|
|
|
39
32
|
end
|
|
40
33
|
return newSet
|
|
41
34
|
end
|
|
35
|
+
function ____exports.copySet(self, oldSet)
|
|
36
|
+
local newSet = __TS__New(Set)
|
|
37
|
+
for ____, value in __TS__Iterator(oldSet:values()) do
|
|
38
|
+
newSet:add(value)
|
|
39
|
+
end
|
|
40
|
+
return newSet
|
|
41
|
+
end
|
|
42
42
|
function ____exports.deleteSetsFromSet(self, mainSet, ...)
|
|
43
43
|
local setsToRemove = {...}
|
|
44
44
|
for ____, set in ipairs(setsToRemove) do
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
-
/**
|
|
3
|
-
* Returns a set containing every trinket type with the given cache flag, including modded trinkets.
|
|
4
|
-
*/
|
|
5
|
-
export declare function getTrinketsForCacheFlag(cacheFlag: CacheFlag): Set<TrinketType | int>;
|
|
6
2
|
/**
|
|
7
3
|
* Returns a map containing every trinket type that the player has that matches the provided
|
|
8
4
|
* CacheFlag. The values of the map correspond to the multiplier for that trinket.
|
|
9
5
|
*/
|
|
10
6
|
export declare function getPlayerTrinketsForCacheFlag(player: EntityPlayer, cacheFlag: CacheFlag): Map<TrinketType | int, int>;
|
|
7
|
+
/**
|
|
8
|
+
* Returns a set containing every trinket type with the given cache flag, including modded trinkets.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getTrinketsForCacheFlag(cacheFlag: CacheFlag): Set<TrinketType | int>;
|
|
@@ -5,6 +5,7 @@ local __TS__New = ____lualib.__TS__New
|
|
|
5
5
|
local Set = ____lualib.Set
|
|
6
6
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
7
7
|
local ____exports = {}
|
|
8
|
+
local initCacheFlagMap, CACHE_FLAG_TO_TRINKETS_MAP
|
|
8
9
|
local ____math = require("functions.math")
|
|
9
10
|
local range = ____math.range
|
|
10
11
|
local ____set = require("functions.set")
|
|
@@ -14,8 +15,7 @@ local getMaxTrinketType = ____trinkets.getMaxTrinketType
|
|
|
14
15
|
local trinketHasCacheFlag = ____trinkets.trinketHasCacheFlag
|
|
15
16
|
local ____utils = require("functions.utils")
|
|
16
17
|
local getEnumValues = ____utils.getEnumValues
|
|
17
|
-
|
|
18
|
-
local function initCacheFlagMap(self)
|
|
18
|
+
function initCacheFlagMap(self)
|
|
19
19
|
local maxTrinketID = getMaxTrinketType(nil)
|
|
20
20
|
for ____, cacheFlag in ipairs(getEnumValues(nil, CacheFlag)) do
|
|
21
21
|
local trinketsSet = __TS__New(Set)
|
|
@@ -37,6 +37,7 @@ function ____exports.getTrinketsForCacheFlag(self, cacheFlag)
|
|
|
37
37
|
end
|
|
38
38
|
return copySet(nil, trinketsSet)
|
|
39
39
|
end
|
|
40
|
+
CACHE_FLAG_TO_TRINKETS_MAP = __TS__New(Map)
|
|
40
41
|
function ____exports.getPlayerTrinketsForCacheFlag(self, player, cacheFlag)
|
|
41
42
|
local trinketsForCacheFlag = ____exports.getTrinketsForCacheFlag(nil, cacheFlag)
|
|
42
43
|
local playerTrinkets = __TS__New(Map)
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
import { TrinketSituation } from "../types/TrinketSituation";
|
|
3
|
+
/**
|
|
4
|
+
* Helper function to restore the player's trinkets back to the way they were before the
|
|
5
|
+
* `temporarilyRemoveTrinket` function was used. It will re-smelt any smelted trinkets that were
|
|
6
|
+
* removed.
|
|
7
|
+
*/
|
|
8
|
+
export declare function giveTrinketsBack(player: EntityPlayer, trinketSituation: TrinketSituation | undefined): void;
|
|
3
9
|
/**
|
|
4
10
|
* Helper function to temporarily remove a specific kind of trinket from the player. Use this in
|
|
5
11
|
* combination with the `giveTrinketBack` function to take away and give back a trinket on the same
|
|
6
12
|
* frame. This function correctly handles multiple trinket slots and ensures that all copies of the
|
|
7
13
|
* trinket are removed, including smelted trinkets.
|
|
8
14
|
*
|
|
9
|
-
* Note that
|
|
15
|
+
* Note that one smelted golden trinket is the same as two smelted normal trinkets.
|
|
10
16
|
*
|
|
11
17
|
* @returns Undefined if the player does not have the trinket, or TrinketSituation if they do.
|
|
12
18
|
*/
|
|
@@ -19,9 +25,3 @@ export declare function temporarilyRemoveTrinket(player: EntityPlayer, trinketTy
|
|
|
19
25
|
* @returns Undefined if the player does not have any trinkets, or TrinketSituation if they do.
|
|
20
26
|
*/
|
|
21
27
|
export declare function temporarilyRemoveTrinkets(player: EntityPlayer): TrinketSituation | undefined;
|
|
22
|
-
/**
|
|
23
|
-
* Helper function to restore the player's trinkets back to the way they were before the
|
|
24
|
-
* `temporarilyRemoveTrinket` function was used. It will re-smelt any smelted trinkets that were
|
|
25
|
-
* removed.
|
|
26
|
-
*/
|
|
27
|
-
export declare function giveTrinketsBack(player: EntityPlayer, trinketSituation: TrinketSituation | undefined): void;
|