isaacscript-common 1.0.571 → 1.0.575
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/doors.d.ts +10 -0
- package/dist/functions/doors.lua +15 -7
- package/dist/functions/rooms.d.ts +68 -42
- package/dist/functions/rooms.lua +68 -76
- package/package.json +1 -1
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
export declare function closeAllDoors(): void;
|
|
3
|
+
/**
|
|
4
|
+
* Use this instead of the `door.Close()` method if you want the door to immediately close without
|
|
5
|
+
* an animation.
|
|
6
|
+
*/
|
|
7
|
+
export declare function closeDoorFast(door: GridEntityDoor): void;
|
|
3
8
|
/**
|
|
4
9
|
* Helper function to get all of the doors in the room. By default, it will return every door. You
|
|
5
10
|
* can optionally specify one or more room types to return only the doors that match the specified
|
|
@@ -63,3 +68,8 @@ export declare function lockDoor(door: GridEntityDoor): void;
|
|
|
63
68
|
* discovered yet will not be opened.
|
|
64
69
|
*/
|
|
65
70
|
export declare function openAllDoors(): void;
|
|
71
|
+
/**
|
|
72
|
+
* Use this instead of the `door.Open()` method if you want the door to immediately open without
|
|
73
|
+
* an animation.
|
|
74
|
+
*/
|
|
75
|
+
export declare function openDoorFast(door: GridEntityDoor): void;
|
package/dist/functions/doors.lua
CHANGED
|
@@ -15,7 +15,7 @@ function ____exports.getDoors(self, ...)
|
|
|
15
15
|
do
|
|
16
16
|
local door = room:GetDoor(i)
|
|
17
17
|
if door == nil then
|
|
18
|
-
goto
|
|
18
|
+
goto __continue6
|
|
19
19
|
end
|
|
20
20
|
if #roomTypes == 0 then
|
|
21
21
|
__TS__ArrayPush(doors, door)
|
|
@@ -23,7 +23,7 @@ function ____exports.getDoors(self, ...)
|
|
|
23
23
|
__TS__ArrayPush(doors, door)
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
|
-
::
|
|
26
|
+
::__continue6::
|
|
27
27
|
i = i + 1
|
|
28
28
|
end
|
|
29
29
|
end
|
|
@@ -47,11 +47,14 @@ function ____exports.closeAllDoors(self)
|
|
|
47
47
|
for ____, door in ipairs(
|
|
48
48
|
____exports.getDoors(nil)
|
|
49
49
|
) do
|
|
50
|
-
door
|
|
51
|
-
local sprite = door:GetSprite()
|
|
52
|
-
sprite:Play("Close", true)
|
|
50
|
+
door:Close(true)
|
|
53
51
|
end
|
|
54
52
|
end
|
|
53
|
+
function ____exports.closeDoorFast(self, door)
|
|
54
|
+
door.State = DoorState.STATE_CLOSED
|
|
55
|
+
local sprite = door:GetSprite()
|
|
56
|
+
sprite:Play("Closed", true)
|
|
57
|
+
end
|
|
55
58
|
function ____exports.getAngelRoomDoor(self)
|
|
56
59
|
for ____, door in ipairs(
|
|
57
60
|
____exports.getDoors(nil)
|
|
@@ -140,8 +143,8 @@ end
|
|
|
140
143
|
function ____exports.lockDoor(self, door)
|
|
141
144
|
local game = Game()
|
|
142
145
|
local level = game:GetLevel()
|
|
143
|
-
local
|
|
144
|
-
|
|
146
|
+
local roomDescriptor = level:GetRoomByIdx(door.TargetRoomIndex)
|
|
147
|
+
roomDescriptor.VisitedCount = 0
|
|
145
148
|
door:SetVariant(DoorVariant.DOOR_LOCKED)
|
|
146
149
|
door:SetLocked(true)
|
|
147
150
|
door:Close(true)
|
|
@@ -153,4 +156,9 @@ function ____exports.openAllDoors(self)
|
|
|
153
156
|
door:Open()
|
|
154
157
|
end
|
|
155
158
|
end
|
|
159
|
+
function ____exports.openDoorFast(self, door)
|
|
160
|
+
door.State = DoorState.STATE_OPEN
|
|
161
|
+
local sprite = door:GetSprite()
|
|
162
|
+
sprite:Play("Opened", true)
|
|
163
|
+
end
|
|
156
164
|
return ____exports
|
|
@@ -10,45 +10,34 @@ export declare function getAllRoomGridIndexes(): int[];
|
|
|
10
10
|
* Helper function to get the current dimension. Most of the time, this will be `Dimension.MAIN`,
|
|
11
11
|
* but it can change if e.g. the player is in the mirror world of Downpour/Dross.
|
|
12
12
|
*
|
|
13
|
-
* Note that this function
|
|
13
|
+
* Note that this function correctly handles detecting the Death Certificate dimension, which is
|
|
14
14
|
* tricky to properly detect.
|
|
15
15
|
*/
|
|
16
16
|
export declare function getCurrentDimension(): Dimension;
|
|
17
|
-
/**
|
|
18
|
-
export declare function
|
|
19
|
-
export declare function getRoomData(): RoomConfig | undefined;
|
|
17
|
+
/** Alias for the `Level.GetCurrentRoomDesc()` method. */
|
|
18
|
+
export declare function getCurrentRoomDescriptorReadOnly(): RoomDescriptorReadOnly;
|
|
20
19
|
/**
|
|
21
|
-
* Helper function to get the
|
|
20
|
+
* Helper function to get the room data for the provided room.
|
|
21
|
+
*
|
|
22
|
+
* @param roomGridIndex Optional. Equal to the current room index by default.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getRoomData(roomGridIndex?: int): RoomConfig | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Helper function to get the type of a room from the XML/STB data. The room data type will
|
|
22
27
|
* correspond to different things depending on what XML/STB file it draws from. For example, in the
|
|
23
28
|
* "00.special rooms.stb" file, a room type of 2 corresponds to a shop, a room type of 3 corresponds
|
|
24
29
|
* to an I AM ERROR room, and so on.
|
|
25
30
|
*
|
|
31
|
+
* @param roomGridIndex Optional. Equal to the current room index by default.
|
|
26
32
|
* @returns The room data type. Returns -1 if the type was not found.
|
|
27
33
|
*/
|
|
28
|
-
export declare function getRoomDataType(): int;
|
|
34
|
+
export declare function getRoomDataType(roomGridIndex?: int): int;
|
|
29
35
|
/**
|
|
30
|
-
* Helper function to get the
|
|
31
|
-
* the `Level.GetRooms().Get()` method. In other words, this is equal to the order that the room was
|
|
32
|
-
* created by the floor generation algorithm.
|
|
33
|
-
*
|
|
34
|
-
* Use this as an index for data structures that store data per room, since it is unique across
|
|
35
|
-
* different dimensions.
|
|
36
|
-
*/
|
|
37
|
-
export declare function getRoomListIndex(): int;
|
|
38
|
-
/**
|
|
39
|
-
* Helper function to get the safe grid index of the current room. The safe grid index is defined as
|
|
40
|
-
* the top-left 1x1 section that the room overlaps with (or the top-right 1x1 section of a
|
|
41
|
-
* `RoomType.ROOMSHAPE_LTL` room).
|
|
42
|
-
*
|
|
43
|
-
* In most situations, using the safe grid index is more reliable than using the `GridIndex` or the
|
|
44
|
-
* `Level.GetCurrentRoomIndex()` method directly. `GridIndex` can return quadrants that are not on
|
|
45
|
-
* the map, and `Level.GetCurrentRoomIndex()` returns the specific 1x1 quadrant that the player
|
|
46
|
-
* entered the room at.
|
|
36
|
+
* Helper function to get the descriptor for a room.
|
|
47
37
|
*
|
|
48
|
-
*
|
|
49
|
-
* `SafeGridIndex`, since the former is unique across different dimensions.
|
|
38
|
+
* @param roomGridIndex Optional. Equal to the current room index by default.
|
|
50
39
|
*/
|
|
51
|
-
export declare function
|
|
40
|
+
export declare function getRoomDescriptor(roomGridIndex?: int): RoomDescriptor;
|
|
52
41
|
/**
|
|
53
42
|
* Helper function to get an array of all of the safe grid indexes for rooms that match the
|
|
54
43
|
* specified room type.
|
|
@@ -61,43 +50,76 @@ export declare function getRoomGridIndexesForType(roomType: RoomType): int[];
|
|
|
61
50
|
* `ItemPoolType.ItemPoolType.POOL_ANGEL` if you are in an Angel Room.
|
|
62
51
|
*/
|
|
63
52
|
export declare function getRoomItemPoolType(): ItemPoolType;
|
|
53
|
+
/**
|
|
54
|
+
* Helper function to get the list grid index of the provided room, which is equal to the index in
|
|
55
|
+
* the `Level.GetRooms().Get()` method. In other words, this is equal to the order that the room was
|
|
56
|
+
* created by the floor generation algorithm.
|
|
57
|
+
*
|
|
58
|
+
* Use this as an index for data structures that store data per room, since it is unique across
|
|
59
|
+
* different dimensions.
|
|
60
|
+
*
|
|
61
|
+
* @param roomGridIndex Optional. Equal to the current room index by default.
|
|
62
|
+
*/
|
|
63
|
+
export declare function getRoomListIndex(roomGridIndex?: int): int;
|
|
64
64
|
/**
|
|
65
65
|
* Helper function to get the name of the room as it appears in the STB/XML data.
|
|
66
66
|
*
|
|
67
|
+
* @param roomGridIndex Optional. Equal to the current room index by default.
|
|
67
68
|
* @returns The room name. Returns "Unknown" if the type was not found.
|
|
68
69
|
*/
|
|
69
|
-
export declare function getRoomName(): string;
|
|
70
|
+
export declare function getRoomName(roomGridIndex?: int): string;
|
|
70
71
|
/**
|
|
71
|
-
* Helper function to get the
|
|
72
|
+
* Helper function to get the safe grid index of the provided room. The safe grid index is defined as
|
|
73
|
+
* the top-left 1x1 section that the room overlaps with (or the top-right 1x1 section of a
|
|
74
|
+
* `RoomType.ROOMSHAPE_LTL` room).
|
|
75
|
+
*
|
|
76
|
+
* In most situations, using the safe grid index is more reliable than using the `GridIndex` or the
|
|
77
|
+
* `Level.GetCurrentRoomIndex()` method directly. `GridIndex` can return quadrants that are not on
|
|
78
|
+
* the map, and `Level.GetCurrentRoomIndex()` returns the specific 1x1 quadrant that the player
|
|
79
|
+
* entered the room at.
|
|
80
|
+
*
|
|
81
|
+
* Data structures that store data per room should use the room's `ListIndex` instead of
|
|
82
|
+
* `SafeGridIndex`, since the former is unique across different dimensions.
|
|
83
|
+
*
|
|
84
|
+
* @param roomGridIndex Optional. Equal to the current room index by default.
|
|
85
|
+
*/
|
|
86
|
+
export declare function getRoomSafeGridIndex(roomGridIndex?: int): int;
|
|
87
|
+
/**
|
|
88
|
+
* Helper function to get the stage ID for a room from the XML/STB data. The room stage ID will
|
|
72
89
|
* correspond to the first number in the filename of the XML/STB file. For example, a Depths room
|
|
73
90
|
* would have a stage ID of 7.
|
|
74
91
|
*
|
|
92
|
+
* @param roomGridIndex Optional. Equal to the current room index by default.
|
|
75
93
|
* @returns The room stage ID. Returns -1 if the stage ID was not found.
|
|
76
94
|
*/
|
|
77
|
-
export declare function getRoomStageID(): StageID;
|
|
95
|
+
export declare function getRoomStageID(roomGridIndex?: int): StageID;
|
|
78
96
|
/**
|
|
79
|
-
* Helper function to get the subtype for
|
|
97
|
+
* Helper function to get the subtype for a room from the XML/STB data. The room subtype will
|
|
80
98
|
* correspond to different things depending on what XML/STB file it draws from. For example, in the
|
|
81
99
|
* "00.special rooms.stb" file, an Angel Room with a subtype of 0 will correspond to a normal Angel
|
|
82
100
|
* Room and a subtype of 1 will correspond to an Angel Room shop for The Stairway.
|
|
83
101
|
*
|
|
102
|
+
* @param roomGridIndex Optional. Equal to the current room index by default.
|
|
84
103
|
* @returns The room subtype. Returns -1 if the subtype was not found.
|
|
85
104
|
*/
|
|
86
|
-
export declare function getRoomSubType(): int;
|
|
105
|
+
export declare function getRoomSubType(roomGridIndex?: int): int;
|
|
87
106
|
/**
|
|
88
|
-
* Helper function to get the variant for
|
|
89
|
-
*
|
|
107
|
+
* Helper function to get the variant for a room from the XML/STB data. You can think of a room
|
|
108
|
+
* variant as its identifier. For example, to go to Basement room #123, you would use a console
|
|
90
109
|
* command of `goto d.123` while on the Basement.
|
|
91
110
|
*
|
|
111
|
+
* @param roomGridIndex Optional. Equal to the current room index by default.
|
|
92
112
|
* @returns The room variant. Returns -1 if the variant was not found.
|
|
93
113
|
*/
|
|
94
|
-
export declare function getRoomVariant(): int;
|
|
114
|
+
export declare function getRoomVariant(roomGridIndex?: int): int;
|
|
95
115
|
/**
|
|
96
|
-
*
|
|
97
|
-
* fired (i.e. when entities are initializing and performing their first update). This
|
|
98
|
-
* the variable is only incremented immediately before the PostNewRoom callback fires.
|
|
116
|
+
* Note that the room visited count will be inaccurate during the period before the PostNewRoom
|
|
117
|
+
* callback has fired (i.e. when entities are initializing and performing their first update). This
|
|
118
|
+
* is because the variable is only incremented immediately before the PostNewRoom callback fires.
|
|
119
|
+
*
|
|
120
|
+
* @param roomGridIndex Optional. Equal to the current room index by default.
|
|
99
121
|
*/
|
|
100
|
-
export declare function getRoomVisitedCount(): int;
|
|
122
|
+
export declare function getRoomVisitedCount(roomGridIndex?: int): int;
|
|
101
123
|
/**
|
|
102
124
|
* Helper function to get the room descriptor for every room on the level. Uses the
|
|
103
125
|
* `Level.GetRooms()` method to accomplish this.
|
|
@@ -167,15 +189,19 @@ export declare function inStartingRoom(): boolean;
|
|
|
167
189
|
*/
|
|
168
190
|
export declare function isAllRoomsClear(onlyCheckRoomTypes?: RoomType[]): boolean;
|
|
169
191
|
/**
|
|
170
|
-
* Helper function to detect if the
|
|
192
|
+
* Helper function to detect if the provided room was created by the Red Key item. Under the hood,
|
|
171
193
|
* this checks for the `RoomDescriptorFlag.FLAG_RED_ROOM` flag.
|
|
194
|
+
*
|
|
195
|
+
* @param roomGridIndex Optional. Equal to the current room index by default.
|
|
172
196
|
*/
|
|
173
|
-
export declare function isRedKeyRoom(): boolean;
|
|
197
|
+
export declare function isRedKeyRoom(roomGridIndex?: int): boolean;
|
|
174
198
|
/**
|
|
175
|
-
* Helper function to determine
|
|
199
|
+
* Helper function to determine if the provided room is part of the floor layout. For
|
|
176
200
|
* example, Devil Rooms and the Mega Satan room are not considered to be inside the map.
|
|
201
|
+
*
|
|
202
|
+
* @param roomGridIndex Optional. Equal to the current room index by default.
|
|
177
203
|
*/
|
|
178
|
-
export declare function isRoomInsideMap(): boolean;
|
|
204
|
+
export declare function isRoomInsideMap(roomGridIndex?: int): boolean;
|
|
179
205
|
/**
|
|
180
206
|
* If `Room.Update()` is called in a PostNewRoom callback, then some entities will slide around
|
|
181
207
|
* (such as the player). Since those entity velocities are already at zero, setting them to zero
|
package/dist/functions/rooms.lua
CHANGED
|
@@ -9,6 +9,7 @@ local ____doors = require("functions.doors")
|
|
|
9
9
|
local closeAllDoors = ____doors.closeAllDoors
|
|
10
10
|
local getDoors = ____doors.getDoors
|
|
11
11
|
local isHiddenSecretRoomDoor = ____doors.isHiddenSecretRoomDoor
|
|
12
|
+
local openDoorFast = ____doors.openDoorFast
|
|
12
13
|
local ____entity = require("functions.entity")
|
|
13
14
|
local getEntities = ____entity.getEntities
|
|
14
15
|
local getEntityPositions = ____entity.getEntityPositions
|
|
@@ -17,35 +18,31 @@ local setEntityPositions = ____entity.setEntityPositions
|
|
|
17
18
|
local setEntityVelocities = ____entity.setEntityVelocities
|
|
18
19
|
local ____flag = require("functions.flag")
|
|
19
20
|
local hasFlag = ____flag.hasFlag
|
|
20
|
-
function ____exports.
|
|
21
|
+
function ____exports.getCurrentRoomDescriptorReadOnly(self)
|
|
21
22
|
local game = Game()
|
|
22
23
|
local level = game:GetLevel()
|
|
23
24
|
return level:GetCurrentRoomDesc()
|
|
24
25
|
end
|
|
25
|
-
function ____exports.getRoomData(self)
|
|
26
|
+
function ____exports.getRoomData(self, roomGridIndex)
|
|
27
|
+
local roomDescriptor = ____exports.getRoomDescriptor(nil, roomGridIndex)
|
|
28
|
+
return roomDescriptor.Data
|
|
29
|
+
end
|
|
30
|
+
function ____exports.getRoomDescriptor(self, roomGridIndex)
|
|
26
31
|
local game = Game()
|
|
27
32
|
local level = game:GetLevel()
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
end
|
|
32
|
-
function ____exports.getRoomSafeGridIndex(self)
|
|
33
|
-
local roomDesc = ____exports.getCurrentRoomDescReadOnly(nil)
|
|
34
|
-
return roomDesc.SafeGridIndex
|
|
35
|
-
end
|
|
36
|
-
function ____exports.getRoomStageID(self)
|
|
37
|
-
local roomData = ____exports.getRoomData(nil)
|
|
38
|
-
if roomData == nil then
|
|
39
|
-
return -1
|
|
33
|
+
if roomGridIndex == nil then
|
|
34
|
+
local currentRoomDescriptor = ____exports.getCurrentRoomDescriptorReadOnly(nil)
|
|
35
|
+
roomGridIndex = currentRoomDescriptor.SafeGridIndex
|
|
40
36
|
end
|
|
41
|
-
return
|
|
37
|
+
return level:GetRoomByIdx(roomGridIndex)
|
|
42
38
|
end
|
|
43
|
-
function ____exports.
|
|
44
|
-
local roomData = ____exports.getRoomData(nil)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
function ____exports.getRoomStageID(self, roomGridIndex)
|
|
40
|
+
local roomData = ____exports.getRoomData(nil, roomGridIndex)
|
|
41
|
+
return ((roomData == nil) and -1) or roomData.StageID
|
|
42
|
+
end
|
|
43
|
+
function ____exports.getRoomSubType(self, roomGridIndex)
|
|
44
|
+
local roomData = ____exports.getRoomData(nil, roomGridIndex)
|
|
45
|
+
return ((roomData == nil) and -1) or roomData.Subtype
|
|
49
46
|
end
|
|
50
47
|
function ____exports.getRooms(self, includeExtraDimensionalRooms)
|
|
51
48
|
if includeExtraDimensionalRooms == nil then
|
|
@@ -59,9 +56,9 @@ function ____exports.getRooms(self, includeExtraDimensionalRooms)
|
|
|
59
56
|
do
|
|
60
57
|
local i = 0
|
|
61
58
|
while i < roomList.Size do
|
|
62
|
-
local
|
|
63
|
-
if
|
|
64
|
-
__TS__ArrayPush(rooms,
|
|
59
|
+
local roomDescriptor = roomList:Get(i)
|
|
60
|
+
if roomDescriptor ~= nil then
|
|
61
|
+
__TS__ArrayPush(rooms, roomDescriptor)
|
|
65
62
|
end
|
|
66
63
|
i = i + 1
|
|
67
64
|
end
|
|
@@ -70,9 +67,9 @@ function ____exports.getRooms(self, includeExtraDimensionalRooms)
|
|
|
70
67
|
do
|
|
71
68
|
local i = 0
|
|
72
69
|
while i <= MAX_ROOM_INDEX do
|
|
73
|
-
local
|
|
74
|
-
if
|
|
75
|
-
__TS__ArrayPush(rooms,
|
|
70
|
+
local roomDescriptor = level:GetRoomByIdx(i)
|
|
71
|
+
if roomDescriptor ~= nil then
|
|
72
|
+
__TS__ArrayPush(rooms, roomDescriptor)
|
|
76
73
|
end
|
|
77
74
|
i = i + 1
|
|
78
75
|
end
|
|
@@ -93,10 +90,10 @@ function ____exports.changeRoom(self, roomGridIndex)
|
|
|
93
90
|
end
|
|
94
91
|
function ____exports.getAllRoomGridIndexes(self)
|
|
95
92
|
local allRoomGridIndexes = {}
|
|
96
|
-
for ____,
|
|
93
|
+
for ____, roomDescriptor in ipairs(
|
|
97
94
|
____exports.getRooms(nil)
|
|
98
95
|
) do
|
|
99
|
-
__TS__ArrayPush(allRoomGridIndexes,
|
|
96
|
+
__TS__ArrayPush(allRoomGridIndexes, roomDescriptor.SafeGridIndex)
|
|
100
97
|
end
|
|
101
98
|
return allRoomGridIndexes
|
|
102
99
|
end
|
|
@@ -125,24 +122,17 @@ function ____exports.getCurrentDimension(self)
|
|
|
125
122
|
)
|
|
126
123
|
return 0
|
|
127
124
|
end
|
|
128
|
-
function ____exports.getRoomDataType(self)
|
|
129
|
-
local roomData = ____exports.getRoomData(nil)
|
|
130
|
-
|
|
131
|
-
return -1
|
|
132
|
-
end
|
|
133
|
-
return roomData.Type
|
|
134
|
-
end
|
|
135
|
-
function ____exports.getRoomListIndex(self)
|
|
136
|
-
local roomDesc = ____exports.getCurrentRoomDescReadOnly(nil)
|
|
137
|
-
return roomDesc.ListIndex
|
|
125
|
+
function ____exports.getRoomDataType(self, roomGridIndex)
|
|
126
|
+
local roomData = ____exports.getRoomData(nil, roomGridIndex)
|
|
127
|
+
return ((roomData == nil) and -1) or roomData.Type
|
|
138
128
|
end
|
|
139
129
|
function ____exports.getRoomGridIndexesForType(self, roomType)
|
|
140
130
|
local roomGridIndexes = {}
|
|
141
|
-
for ____,
|
|
131
|
+
for ____, roomDescriptor in ipairs(
|
|
142
132
|
____exports.getRooms(nil)
|
|
143
133
|
) do
|
|
144
|
-
if (
|
|
145
|
-
__TS__ArrayPush(roomGridIndexes,
|
|
134
|
+
if (roomDescriptor.Data ~= nil) and (roomDescriptor.Data.Type == roomType) then
|
|
135
|
+
__TS__ArrayPush(roomGridIndexes, roomDescriptor.SafeGridIndex)
|
|
146
136
|
end
|
|
147
137
|
end
|
|
148
138
|
return roomGridIndexes
|
|
@@ -155,23 +145,25 @@ function ____exports.getRoomItemPoolType(self)
|
|
|
155
145
|
local roomSeed = room:GetSpawnSeed()
|
|
156
146
|
return itemPool:GetPoolForRoom(roomType, roomSeed)
|
|
157
147
|
end
|
|
158
|
-
function ____exports.
|
|
159
|
-
local
|
|
160
|
-
|
|
161
|
-
return "Unknown"
|
|
162
|
-
end
|
|
163
|
-
return roomData.Name
|
|
148
|
+
function ____exports.getRoomListIndex(self, roomGridIndex)
|
|
149
|
+
local roomDescriptor = ____exports.getRoomDescriptor(nil, roomGridIndex)
|
|
150
|
+
return roomDescriptor.ListIndex
|
|
164
151
|
end
|
|
165
|
-
function ____exports.
|
|
166
|
-
local roomData = ____exports.getRoomData(nil)
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
152
|
+
function ____exports.getRoomName(self, roomGridIndex)
|
|
153
|
+
local roomData = ____exports.getRoomData(nil, roomGridIndex)
|
|
154
|
+
return ((roomData == nil) and "Unknown") or roomData.Name
|
|
155
|
+
end
|
|
156
|
+
function ____exports.getRoomSafeGridIndex(self, roomGridIndex)
|
|
157
|
+
local roomDescriptor = ((roomGridIndex == nil) and ____exports.getCurrentRoomDescriptorReadOnly(nil)) or ____exports.getRoomDescriptor(nil, roomGridIndex)
|
|
158
|
+
return roomDescriptor.SafeGridIndex
|
|
171
159
|
end
|
|
172
|
-
function ____exports.
|
|
173
|
-
local
|
|
174
|
-
return
|
|
160
|
+
function ____exports.getRoomVariant(self, roomGridIndex)
|
|
161
|
+
local roomData = ____exports.getRoomData(nil, roomGridIndex)
|
|
162
|
+
return ((roomData == nil) and -1) or roomData.Variant
|
|
163
|
+
end
|
|
164
|
+
function ____exports.getRoomVisitedCount(self, roomGridIndex)
|
|
165
|
+
local roomDescriptor = ____exports.getRoomDescriptor(nil, roomGridIndex)
|
|
166
|
+
return roomDescriptor.VisitedCount
|
|
175
167
|
end
|
|
176
168
|
function ____exports.gridToPos(self, x, y)
|
|
177
169
|
local game = Game()
|
|
@@ -213,8 +205,8 @@ function ____exports.inCrawlspace(self)
|
|
|
213
205
|
return (roomSafeGridIndex == GridRooms.ROOM_DUNGEON_IDX) and (roomSubType ~= 4)
|
|
214
206
|
end
|
|
215
207
|
function ____exports.inDevilsCrownTreasureRoom(self)
|
|
216
|
-
local
|
|
217
|
-
return hasFlag(nil,
|
|
208
|
+
local roomDescriptor = ____exports.getCurrentRoomDescriptorReadOnly(nil)
|
|
209
|
+
return hasFlag(nil, roomDescriptor.Flags, 2048)
|
|
218
210
|
end
|
|
219
211
|
function ____exports.inDimension(self, dimension)
|
|
220
212
|
return dimension == ____exports.getCurrentDimension(nil)
|
|
@@ -250,33 +242,35 @@ function ____exports.inStartingRoom(self)
|
|
|
250
242
|
end
|
|
251
243
|
function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes)
|
|
252
244
|
local roomTypeWhitelist = (((onlyCheckRoomTypes == nil) and (function() return nil end)) or (function() return __TS__New(Set, onlyCheckRoomTypes) end))()
|
|
253
|
-
for ____,
|
|
245
|
+
for ____, roomDescriptor in ipairs(
|
|
254
246
|
____exports.getRooms(nil)
|
|
255
247
|
) do
|
|
256
248
|
do
|
|
257
|
-
local roomData =
|
|
249
|
+
local roomData = roomDescriptor.Data
|
|
258
250
|
if roomData == nil then
|
|
259
|
-
goto
|
|
251
|
+
goto __continue46
|
|
260
252
|
end
|
|
261
253
|
local roomType = roomData.Type
|
|
262
254
|
if (roomTypeWhitelist ~= nil) and (not roomTypeWhitelist:has(roomType)) then
|
|
263
|
-
goto
|
|
255
|
+
goto __continue46
|
|
264
256
|
end
|
|
265
|
-
if not
|
|
257
|
+
if not roomDescriptor.Clear then
|
|
266
258
|
return false
|
|
267
259
|
end
|
|
268
260
|
end
|
|
269
|
-
::
|
|
261
|
+
::__continue46::
|
|
270
262
|
end
|
|
271
263
|
return true
|
|
272
264
|
end
|
|
273
|
-
function ____exports.isRedKeyRoom(self)
|
|
274
|
-
local
|
|
275
|
-
return hasFlag(nil,
|
|
265
|
+
function ____exports.isRedKeyRoom(self, roomGridIndex)
|
|
266
|
+
local roomDescriptor = ____exports.getRoomDescriptor(nil, roomGridIndex)
|
|
267
|
+
return hasFlag(nil, roomDescriptor.Flags, 1024)
|
|
276
268
|
end
|
|
277
|
-
function ____exports.isRoomInsideMap(self)
|
|
278
|
-
|
|
279
|
-
|
|
269
|
+
function ____exports.isRoomInsideMap(self, roomGridIndex)
|
|
270
|
+
if roomGridIndex == nil then
|
|
271
|
+
roomGridIndex = ____exports.getRoomSafeGridIndex(nil)
|
|
272
|
+
end
|
|
273
|
+
return roomGridIndex >= 0
|
|
280
274
|
end
|
|
281
275
|
function ____exports.roomUpdateSafe(self)
|
|
282
276
|
local game = Game()
|
|
@@ -302,14 +296,12 @@ function ____exports.setRoomCleared(self)
|
|
|
302
296
|
) do
|
|
303
297
|
do
|
|
304
298
|
if isHiddenSecretRoomDoor(nil, door) then
|
|
305
|
-
goto
|
|
299
|
+
goto __continue56
|
|
306
300
|
end
|
|
307
|
-
door
|
|
308
|
-
local sprite = door:GetSprite()
|
|
309
|
-
sprite:Play("Opened", true)
|
|
301
|
+
openDoorFast(nil, door)
|
|
310
302
|
door.ExtraVisible = false
|
|
311
303
|
end
|
|
312
|
-
::
|
|
304
|
+
::__continue56::
|
|
313
305
|
end
|
|
314
306
|
sfx:Stop(SoundEffect.SOUND_DOOR_HEAVY_OPEN)
|
|
315
307
|
game:ShakeScreen(0)
|