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
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;
|
|
@@ -6,6 +6,33 @@ local ____player = require("functions.player")
|
|
|
6
6
|
local useActiveItemTemp = ____player.useActiveItemTemp
|
|
7
7
|
local ____utils = require("functions.utils")
|
|
8
8
|
local ____repeat = ____utils["repeat"]
|
|
9
|
+
function ____exports.giveTrinketsBack(self, player, trinketSituation)
|
|
10
|
+
if trinketSituation == nil then
|
|
11
|
+
return
|
|
12
|
+
end
|
|
13
|
+
local trinket1 = player:GetTrinket(0)
|
|
14
|
+
local trinket2 = player:GetTrinket(1)
|
|
15
|
+
if trinket1 ~= TrinketType.TRINKET_NULL then
|
|
16
|
+
player:TryRemoveTrinket(trinket1)
|
|
17
|
+
end
|
|
18
|
+
if trinket2 ~= TrinketType.TRINKET_NULL then
|
|
19
|
+
player:TryRemoveTrinket(trinket2)
|
|
20
|
+
end
|
|
21
|
+
____repeat(
|
|
22
|
+
nil,
|
|
23
|
+
trinketSituation.numSmeltedTrinkets,
|
|
24
|
+
function()
|
|
25
|
+
player:AddTrinket(trinketSituation.trinketTypeRemoved, false)
|
|
26
|
+
useActiveItemTemp(nil, player, CollectibleType.COLLECTIBLE_SMELTER)
|
|
27
|
+
end
|
|
28
|
+
)
|
|
29
|
+
if trinketSituation.trinket1 ~= TrinketType.TRINKET_NULL then
|
|
30
|
+
player:AddTrinket(trinketSituation.trinket1, false)
|
|
31
|
+
end
|
|
32
|
+
if trinketSituation.trinket2 ~= TrinketType.TRINKET_NULL then
|
|
33
|
+
player:AddTrinket(trinketSituation.trinket2, false)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
9
36
|
function ____exports.temporarilyRemoveTrinket(self, player, trinketType)
|
|
10
37
|
if not player:HasTrinket(trinketType) then
|
|
11
38
|
return nil
|
|
@@ -42,31 +69,4 @@ function ____exports.temporarilyRemoveTrinkets(self, player)
|
|
|
42
69
|
end
|
|
43
70
|
return {trinketTypeRemoved = TrinketType.TRINKET_NULL, trinket1 = trinket1, trinket2 = trinket2, numSmeltedTrinkets = 0}
|
|
44
71
|
end
|
|
45
|
-
function ____exports.giveTrinketsBack(self, player, trinketSituation)
|
|
46
|
-
if trinketSituation == nil then
|
|
47
|
-
return
|
|
48
|
-
end
|
|
49
|
-
local trinket1 = player:GetTrinket(0)
|
|
50
|
-
local trinket2 = player:GetTrinket(1)
|
|
51
|
-
if trinket1 ~= TrinketType.TRINKET_NULL then
|
|
52
|
-
player:TryRemoveTrinket(trinket1)
|
|
53
|
-
end
|
|
54
|
-
if trinket2 ~= TrinketType.TRINKET_NULL then
|
|
55
|
-
player:TryRemoveTrinket(trinket2)
|
|
56
|
-
end
|
|
57
|
-
____repeat(
|
|
58
|
-
nil,
|
|
59
|
-
trinketSituation.numSmeltedTrinkets,
|
|
60
|
-
function()
|
|
61
|
-
player:AddTrinket(trinketSituation.trinketTypeRemoved, false)
|
|
62
|
-
useActiveItemTemp(nil, player, CollectibleType.COLLECTIBLE_SMELTER)
|
|
63
|
-
end
|
|
64
|
-
)
|
|
65
|
-
if trinketSituation.trinket1 ~= TrinketType.TRINKET_NULL then
|
|
66
|
-
player:AddTrinket(trinketSituation.trinket1, false)
|
|
67
|
-
end
|
|
68
|
-
if trinketSituation.trinket2 ~= TrinketType.TRINKET_NULL then
|
|
69
|
-
player:AddTrinket(trinketSituation.trinket2, false)
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
72
|
return ____exports
|
|
@@ -18,8 +18,6 @@ export declare function getMaxTrinketType(): int;
|
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
20
|
export declare function getOpenTrinketSlot(player: EntityPlayer): int | undefined;
|
|
21
|
-
/** Helper function to get all of the trinket entities in the room. */
|
|
22
|
-
export declare function getTrinkets(matchingSubType?: number): EntityPickup[];
|
|
23
21
|
/**
|
|
24
22
|
* Helper function to get the in-game description for a trinket. Returns "Unknown" if the provided
|
|
25
23
|
* trinket type was not valid.
|
|
@@ -36,6 +34,8 @@ export declare function getTrinketDescription(trinketType: TrinketType | int): s
|
|
|
36
34
|
* ```
|
|
37
35
|
*/
|
|
38
36
|
export declare function getTrinketName(trinketType: TrinketType | int): string;
|
|
37
|
+
/** Helper function to get all of the trinket entities in the room. */
|
|
38
|
+
export declare function getTrinkets(matchingSubType?: number): EntityPickup[];
|
|
39
39
|
/**
|
|
40
40
|
* Returns whether or not the player can hold an additional trinket, beyond what they are currently
|
|
41
41
|
* carrying. This takes into account items that modify the max number of trinkets, like Mom's Purse.
|
|
@@ -42,12 +42,6 @@ function ____exports.getOpenTrinketSlot(self, player)
|
|
|
42
42
|
end
|
|
43
43
|
return error("The player has an unknown number of trinket slots: " .. tostring(maxTrinkets))
|
|
44
44
|
end
|
|
45
|
-
function ____exports.getTrinkets(self, matchingSubType)
|
|
46
|
-
if matchingSubType == nil then
|
|
47
|
-
matchingSubType = -1
|
|
48
|
-
end
|
|
49
|
-
return getPickups(nil, PickupVariant.PICKUP_TRINKET, matchingSubType)
|
|
50
|
-
end
|
|
51
45
|
function ____exports.getTrinketDescription(self, trinketType)
|
|
52
46
|
local trinketDescription = TRINKET_DESCRIPTION_MAP:get(trinketType)
|
|
53
47
|
if trinketDescription ~= nil then
|
|
@@ -70,6 +64,12 @@ function ____exports.getTrinketName(self, trinketType)
|
|
|
70
64
|
end
|
|
71
65
|
return DEFAULT_TRINKET_NAME
|
|
72
66
|
end
|
|
67
|
+
function ____exports.getTrinkets(self, matchingSubType)
|
|
68
|
+
if matchingSubType == nil then
|
|
69
|
+
matchingSubType = -1
|
|
70
|
+
end
|
|
71
|
+
return getPickups(nil, PickupVariant.PICKUP_TRINKET, matchingSubType)
|
|
72
|
+
end
|
|
73
73
|
function ____exports.hasOpenTrinketSlot(self, player)
|
|
74
74
|
local character = player:GetPlayerType()
|
|
75
75
|
if character == PlayerType.PLAYER_THESOUL_B then
|
package/dist/functions/ui.d.ts
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
-
/**
|
|
3
|
-
* Helper function to get the width of the first player's hearts on the UI. This is useful for
|
|
4
|
-
* drawing UI elements to the right of where the player's hearts are. Make sure to use this in
|
|
5
|
-
* combination with the the `getHUDOffsetVector` helper function.
|
|
6
|
-
*/
|
|
7
|
-
export declare function getHeartsUIWidth(): int;
|
|
8
|
-
/**
|
|
9
|
-
* Returns how many hearts are in the heart UI row. If the player has more than 6 hearts, this
|
|
10
|
-
* function will return 6.
|
|
11
|
-
*/
|
|
12
|
-
export declare function getHeartRowLength(player: EntityPlayer): int;
|
|
13
2
|
/**
|
|
14
3
|
* In the options menu, players have the ability to set a HUD offset. However, mods do not have
|
|
15
4
|
* access to this value. To get around this, Mod Config Menu provides a separate HUD offset setting
|
|
@@ -21,11 +10,22 @@ export declare function getHeartRowLength(player: EntityPlayer): int;
|
|
|
21
10
|
* a HUD offset that should be added to the position of a UI element.
|
|
22
11
|
*/
|
|
23
12
|
export declare function getHUDOffsetVector(): Vector;
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Returns how many hearts are in the heart UI row. If the player has more than 6 hearts, this
|
|
15
|
+
* function will return 6.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getHeartRowLength(player: EntityPlayer): int;
|
|
18
|
+
/**
|
|
19
|
+
* Helper function to get the width of the first player's hearts on the UI. This is useful for
|
|
20
|
+
* drawing UI elements to the right of where the player's hearts are. Make sure to use this in
|
|
21
|
+
* combination with the the `getHUDOffsetVector` helper function.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getHeartsUIWidth(): int;
|
|
26
24
|
export declare function getScreenBottomLeftPos(): Vector;
|
|
27
25
|
export declare function getScreenBottomRightPos(): Vector;
|
|
28
26
|
export declare function getScreenCenterPos(): Vector;
|
|
27
|
+
export declare function getScreenTopLeftPos(): Vector;
|
|
28
|
+
export declare function getScreenTopRightPos(): Vector;
|
|
29
29
|
/**
|
|
30
30
|
* Get how many hearts are currently being shown on the hearts UI.
|
|
31
31
|
*
|
package/dist/functions/ui.lua
CHANGED
|
@@ -4,6 +4,27 @@ local ____cachedClasses = require("cachedClasses")
|
|
|
4
4
|
local game = ____cachedClasses.game
|
|
5
5
|
local ____constants = require("constants")
|
|
6
6
|
local UI_HEART_WIDTH = ____constants.UI_HEART_WIDTH
|
|
7
|
+
function ____exports.getScreenBottomRightPos(self)
|
|
8
|
+
local screenWidth = Isaac.GetScreenWidth()
|
|
9
|
+
local screenHeight = Isaac.GetScreenHeight()
|
|
10
|
+
return Vector(screenWidth, screenHeight)
|
|
11
|
+
end
|
|
12
|
+
function ____exports.getHUDOffsetVector(self)
|
|
13
|
+
local defaultVector = Vector.Zero
|
|
14
|
+
local hudOffset = math.floor(Options.HUDOffset * 10)
|
|
15
|
+
if hudOffset < 1 or hudOffset > 10 then
|
|
16
|
+
return defaultVector
|
|
17
|
+
end
|
|
18
|
+
local x = hudOffset * 2
|
|
19
|
+
local y = hudOffset
|
|
20
|
+
if y >= 4 then
|
|
21
|
+
y = y + 1
|
|
22
|
+
end
|
|
23
|
+
if y >= 9 then
|
|
24
|
+
y = y + 1
|
|
25
|
+
end
|
|
26
|
+
return Vector(x, y)
|
|
27
|
+
end
|
|
7
28
|
function ____exports.getHeartRowLength(self, player)
|
|
8
29
|
local maxHearts = player:GetMaxHearts()
|
|
9
30
|
local soulHearts = player:GetSoulHearts()
|
|
@@ -12,11 +33,6 @@ function ____exports.getHeartRowLength(self, player)
|
|
|
12
33
|
local heartRowLength = combinedHearts / 2
|
|
13
34
|
return math.min(heartRowLength, 6)
|
|
14
35
|
end
|
|
15
|
-
function ____exports.getScreenBottomRightPos(self)
|
|
16
|
-
local screenWidth = Isaac.GetScreenWidth()
|
|
17
|
-
local screenHeight = Isaac.GetScreenHeight()
|
|
18
|
-
return Vector(screenWidth, screenHeight)
|
|
19
|
-
end
|
|
20
36
|
function ____exports.getHeartsUIWidth(self)
|
|
21
37
|
local level = game:GetLevel()
|
|
22
38
|
local curses = level:GetCurses()
|
|
@@ -45,29 +61,6 @@ function ____exports.getHeartsUIWidth(self)
|
|
|
45
61
|
end
|
|
46
62
|
return width
|
|
47
63
|
end
|
|
48
|
-
function ____exports.getHUDOffsetVector(self)
|
|
49
|
-
local defaultVector = Vector.Zero
|
|
50
|
-
local hudOffset = math.floor(Options.HUDOffset * 10)
|
|
51
|
-
if hudOffset < 1 or hudOffset > 10 then
|
|
52
|
-
return defaultVector
|
|
53
|
-
end
|
|
54
|
-
local x = hudOffset * 2
|
|
55
|
-
local y = hudOffset
|
|
56
|
-
if y >= 4 then
|
|
57
|
-
y = y + 1
|
|
58
|
-
end
|
|
59
|
-
if y >= 9 then
|
|
60
|
-
y = y + 1
|
|
61
|
-
end
|
|
62
|
-
return Vector(x, y)
|
|
63
|
-
end
|
|
64
|
-
function ____exports.getScreenTopLeftPos(self)
|
|
65
|
-
return Vector.Zero
|
|
66
|
-
end
|
|
67
|
-
function ____exports.getScreenTopRightPos(self)
|
|
68
|
-
local bottomRight = ____exports.getScreenBottomRightPos(nil)
|
|
69
|
-
return Vector(bottomRight.X, 0)
|
|
70
|
-
end
|
|
71
64
|
function ____exports.getScreenBottomLeftPos(self)
|
|
72
65
|
local bottomRight = ____exports.getScreenBottomRightPos(nil)
|
|
73
66
|
return Vector(0, bottomRight.Y)
|
|
@@ -76,6 +69,13 @@ function ____exports.getScreenCenterPos(self)
|
|
|
76
69
|
local bottomRight = ____exports.getScreenBottomRightPos(nil)
|
|
77
70
|
return bottomRight / 2
|
|
78
71
|
end
|
|
72
|
+
function ____exports.getScreenTopLeftPos(self)
|
|
73
|
+
return Vector.Zero
|
|
74
|
+
end
|
|
75
|
+
function ____exports.getScreenTopRightPos(self)
|
|
76
|
+
local bottomRight = ____exports.getScreenBottomRightPos(nil)
|
|
77
|
+
return Vector(bottomRight.X, 0)
|
|
78
|
+
end
|
|
79
79
|
function ____exports.getVisibleHearts(self, player)
|
|
80
80
|
local effectiveMaxHearts = player:GetEffectiveMaxHearts()
|
|
81
81
|
local soulHearts = player:GetSoulHearts()
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="typescript-to-lua/language-extensions" />
|
|
1
2
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
3
|
/**
|
|
3
4
|
* Helper function to get type safety on a switch statement.
|
|
@@ -53,6 +54,11 @@ export declare const ensureAllCases: (obj: never) => never;
|
|
|
53
54
|
* `pairs` or `Object.values`.
|
|
54
55
|
*/
|
|
55
56
|
export declare function getEnumValues<T>(transpiledEnum: T): Array<T[keyof T]>;
|
|
57
|
+
/**
|
|
58
|
+
* Helper function to log what is happening in functions that recursively move through nested data
|
|
59
|
+
* structures.
|
|
60
|
+
*/
|
|
61
|
+
export declare function getTraversalDescription(key: AnyNotNil, traversalDescription: string): string;
|
|
56
62
|
/**
|
|
57
63
|
* Converts a hex string like "#33aa33" to a KColor object.
|
|
58
64
|
*
|
package/dist/functions/utils.lua
CHANGED
|
@@ -17,6 +17,13 @@ function ____exports.getEnumValues(self, transpiledEnum)
|
|
|
17
17
|
__TS__ArraySort(enumValues)
|
|
18
18
|
return enumValues
|
|
19
19
|
end
|
|
20
|
+
function ____exports.getTraversalDescription(self, key, traversalDescription)
|
|
21
|
+
if traversalDescription ~= "" then
|
|
22
|
+
traversalDescription = traversalDescription .. " --> "
|
|
23
|
+
end
|
|
24
|
+
traversalDescription = traversalDescription .. tostring(key)
|
|
25
|
+
return traversalDescription
|
|
26
|
+
end
|
|
20
27
|
function ____exports.hexToKColor(self, hexString, alpha)
|
|
21
28
|
hexString = __TS__StringReplace(hexString, "#", "")
|
|
22
29
|
if #hexString ~= HEX_STRING_LENGTH then
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/// <reference types="typescript-to-lua/language-extensions" />
|
|
2
3
|
export declare function copyVector(vector: Vector): Vector;
|
|
4
|
+
export declare function deserializeVector(vectorTable: LuaTable): Vector;
|
|
3
5
|
export declare function directionToVector(direction: Direction): Vector;
|
|
4
6
|
/**
|
|
5
7
|
* Helper function to get a new vector of length 1. Using this is safer than using the `Vector.One`
|
|
@@ -5,6 +5,19 @@ local DIRECTION_TO_VECTOR = ____directionToVector.DIRECTION_TO_VECTOR
|
|
|
5
5
|
function ____exports.copyVector(self, vector)
|
|
6
6
|
return Vector(vector.X, vector.Y)
|
|
7
7
|
end
|
|
8
|
+
function ____exports.deserializeVector(self, vectorTable)
|
|
9
|
+
local xString = vectorTable.X
|
|
10
|
+
local x = tonumber(xString)
|
|
11
|
+
if x == nil then
|
|
12
|
+
error("Failed to read the X value of a serialized vector.")
|
|
13
|
+
end
|
|
14
|
+
local yString = vectorTable.Y
|
|
15
|
+
local y = tonumber(yString)
|
|
16
|
+
if y == nil then
|
|
17
|
+
error("Failed to read the Y value of a serialized vector.")
|
|
18
|
+
end
|
|
19
|
+
return Vector(x, y)
|
|
20
|
+
end
|
|
8
21
|
function ____exports.directionToVector(self, direction)
|
|
9
22
|
return DIRECTION_TO_VECTOR[direction]
|
|
10
23
|
end
|
package/dist/index.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ export * from "./functions/pocketItems";
|
|
|
64
64
|
export * from "./functions/positionVelocity";
|
|
65
65
|
export * from "./functions/random";
|
|
66
66
|
export * from "./functions/revive";
|
|
67
|
+
export * from "./functions/roomData";
|
|
67
68
|
export * from "./functions/rooms";
|
|
68
69
|
export * from "./functions/run";
|
|
69
70
|
export * from "./functions/seeds";
|
|
@@ -90,6 +91,7 @@ export * from "./maps/roomTypeMap";
|
|
|
90
91
|
export * from "./objects/directionNames";
|
|
91
92
|
export * from "./types/AddCallbackParametersCustom";
|
|
92
93
|
export * from "./types/AnyEntity";
|
|
94
|
+
export * from "./types/CollectibleIndex";
|
|
93
95
|
export * from "./types/JSONDoor";
|
|
94
96
|
export * from "./types/JSONEntity";
|
|
95
97
|
export * from "./types/JSONRoom";
|
package/dist/index.lua
CHANGED
|
@@ -514,6 +514,14 @@ do
|
|
|
514
514
|
end
|
|
515
515
|
end
|
|
516
516
|
end
|
|
517
|
+
do
|
|
518
|
+
local ____export = require("functions.roomData")
|
|
519
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
520
|
+
if ____exportKey ~= "default" then
|
|
521
|
+
____exports[____exportKey] = ____exportValue
|
|
522
|
+
end
|
|
523
|
+
end
|
|
524
|
+
end
|
|
517
525
|
do
|
|
518
526
|
local ____export = require("functions.rooms")
|
|
519
527
|
for ____exportKey, ____exportValue in pairs(____export) do
|