isaacscript-common 1.2.174 → 1.2.177
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/itemPickup.lua +0 -1
- package/dist/callbacks/postBombInitLate.lua +0 -1
- package/dist/callbacks/postBoneSwing.lua +0 -1
- package/dist/callbacks/postCursedTeleport.lua +0 -1
- package/dist/callbacks/postCustomDoorEnter.lua +0 -1
- package/dist/callbacks/postEffectInitLate.lua +0 -1
- package/dist/callbacks/postEsauJr.lua +0 -1
- package/dist/callbacks/postFamiliarInitLate.lua +0 -1
- package/dist/callbacks/postFlip.lua +0 -1
- package/dist/callbacks/postGridEntity.lua +0 -1
- package/dist/callbacks/postGridEntityCollision.lua +0 -1
- package/dist/callbacks/postKnifeInitLate.lua +0 -1
- package/dist/callbacks/postLaserInitLate.lua +0 -1
- package/dist/callbacks/postNPCInitLate.lua +0 -1
- package/dist/callbacks/postPickupCollect.lua +0 -1
- package/dist/callbacks/postPickupInitLate.lua +0 -1
- package/dist/callbacks/postPlayerChangeHealth.lua +0 -1
- package/dist/callbacks/postPlayerChangeType.lua +0 -1
- package/dist/callbacks/postPlayerFatalDamage.lua +0 -1
- package/dist/callbacks/postPlayerInitLate.lua +0 -1
- package/dist/callbacks/postPlayerReordered.lua +0 -1
- package/dist/callbacks/postProjectileInitLate.lua +0 -1
- package/dist/callbacks/postPurchase.lua +0 -1
- package/dist/callbacks/postSlotInitUpdate.lua +0 -1
- package/dist/callbacks/postSlotRender.lua +0 -1
- package/dist/callbacks/postTearInitLate.lua +0 -1
- package/dist/callbacks/postTearInitVeryLate.lua +0 -1
- package/dist/callbacks/postTransformation.lua +0 -1
- package/dist/callbacks/postTrinketBreak.lua +0 -1
- package/dist/callbacks/preNewLevel.lua +0 -1
- package/dist/callbacks/subscriptions/postBombInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postBoneSwing.lua +0 -1
- package/dist/callbacks/subscriptions/postCursedTeleport.lua +0 -1
- package/dist/callbacks/subscriptions/postCustomDoorEnter.lua +0 -1
- package/dist/callbacks/subscriptions/postCustomRevive.lua +0 -1
- package/dist/callbacks/subscriptions/postEffectInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postEsauJr.lua +0 -1
- package/dist/callbacks/subscriptions/postFamiliarInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postFirstEsauJr.lua +0 -1
- package/dist/callbacks/subscriptions/postFirstFlip.lua +0 -1
- package/dist/callbacks/subscriptions/postFlip.lua +0 -1
- package/dist/callbacks/subscriptions/postGameStartedReordered.lua +0 -1
- package/dist/callbacks/subscriptions/postGridEntityBroken.lua +0 -1
- package/dist/callbacks/subscriptions/postGridEntityCollision.lua +0 -1
- package/dist/callbacks/subscriptions/postGridEntityInit.lua +0 -1
- package/dist/callbacks/subscriptions/postGridEntityRemove.lua +0 -1
- package/dist/callbacks/subscriptions/postGridEntityStateChange.lua +0 -1
- package/dist/callbacks/subscriptions/postGridEntityUpdate.lua +0 -1
- package/dist/callbacks/subscriptions/postItemPickup.lua +0 -1
- package/dist/callbacks/subscriptions/postKnifeInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postLaserInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postNPCInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postNewLevelReordered.lua +0 -1
- package/dist/callbacks/subscriptions/postNewRoomEarly.lua +0 -1
- package/dist/callbacks/subscriptions/postNewRoomReordered.lua +0 -1
- package/dist/callbacks/subscriptions/postPEffectUpdateReordered.lua +0 -1
- package/dist/callbacks/subscriptions/postPickupCollect.lua +0 -1
- package/dist/callbacks/subscriptions/postPickupInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postPlayerChangeHealth.lua +0 -1
- package/dist/callbacks/subscriptions/postPlayerChangeType.lua +0 -1
- package/dist/callbacks/subscriptions/postPlayerFatalDamage.lua +0 -1
- package/dist/callbacks/subscriptions/postPlayerInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postPlayerInitReordered.lua +0 -1
- package/dist/callbacks/subscriptions/postPlayerRenderReordered.lua +0 -1
- package/dist/callbacks/subscriptions/postPlayerUpdateReordered.lua +0 -1
- package/dist/callbacks/subscriptions/postProjectileInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postPurchase.lua +0 -1
- package/dist/callbacks/subscriptions/postSacrifice.lua +0 -1
- package/dist/callbacks/subscriptions/postSlotAnimationChanged.lua +0 -1
- package/dist/callbacks/subscriptions/postSlotDestroyed.lua +0 -1
- package/dist/callbacks/subscriptions/postSlotInit.lua +0 -1
- package/dist/callbacks/subscriptions/postSlotRender.lua +0 -1
- package/dist/callbacks/subscriptions/postSlotUpdate.lua +0 -1
- package/dist/callbacks/subscriptions/postTearInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postTearInitVeryLate.lua +0 -1
- package/dist/callbacks/subscriptions/postTransformation.lua +0 -1
- package/dist/callbacks/subscriptions/postTrinketBreak.lua +0 -1
- package/dist/callbacks/subscriptions/preBerserkDeath.lua +0 -1
- package/dist/callbacks/subscriptions/preCustomRevive.lua +0 -1
- package/dist/callbacks/subscriptions/preItemPickup.lua +0 -1
- package/dist/callbacks/subscriptions/preNewLevel.lua +0 -1
- package/dist/callbacks/subscriptions/roomClearChange.lua +0 -1
- package/dist/classes/DefaultMap.lua +0 -1
- package/dist/classes/ModUpgraded.lua +0 -1
- package/dist/classes/null.d.ts +6 -7
- package/dist/classes/null.lua +5 -6
- package/dist/constants.d.ts +10 -10
- package/dist/constants.lua +3 -4
- package/dist/enums/private/SerializationBrand.lua +0 -1
- package/dist/features/collectiblesSeen.d.ts +6 -0
- package/dist/features/collectiblesSeen.lua +42 -0
- package/dist/features/deployJSONRoom.lua +2 -2
- package/dist/features/disableInputs.lua +0 -1
- package/dist/features/disableSound.lua +0 -1
- package/dist/features/extraConsoleCommands/commands.d.ts +11 -11
- package/dist/features/extraConsoleCommands/commands.lua +23 -23
- package/dist/features/extraConsoleCommands/init.lua +6 -7
- package/dist/features/getCollectibleItemPoolType.lua +0 -1
- package/dist/features/isPonyActive.lua +0 -1
- package/dist/features/playerInventory.d.ts +10 -2
- package/dist/features/playerInventory.lua +51 -16
- package/dist/features/preventCollectibleRotate.lua +0 -1
- package/dist/features/runInNFrames.lua +0 -1
- 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 -5
- package/dist/features/saveDataManager/load.lua +0 -1
- package/dist/features/saveDataManager/main.lua +0 -1
- package/dist/features/saveDataManager/maps.lua +0 -1
- package/dist/features/saveDataManager/merge.lua +5 -4
- package/dist/features/saveDataManager/save.lua +0 -1
- package/dist/features/sirenHelpers.lua +0 -1
- package/dist/features/taintedLazarusPlayers.lua +0 -1
- 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 -80
- package/dist/functions/cards.d.ts +3 -3
- package/dist/functions/cards.lua +7 -8
- package/dist/functions/charge.d.ts +11 -11
- package/dist/functions/charge.lua +13 -13
- package/dist/functions/collectibleCacheFlag.lua +0 -1
- package/dist/functions/collectibleSet.lua +0 -1
- 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 -23
- package/dist/functions/deepCopyTests.lua +0 -1
- package/dist/functions/doors.d.ts +8 -8
- package/dist/functions/doors.lua +16 -17
- package/dist/functions/entity.d.ts +13 -14
- package/dist/functions/entity.lua +27 -35
- package/dist/functions/entitySpecific.lua +0 -1
- package/dist/functions/familiars.lua +0 -1
- package/dist/functions/flying.lua +1 -2
- package/dist/functions/globals.lua +0 -1
- package/dist/functions/gridEntity.d.ts +1 -1
- package/dist/functions/gridEntity.lua +5 -6
- package/dist/functions/input.lua +0 -1
- package/dist/functions/jsonHelpers.d.ts +7 -7
- package/dist/functions/jsonHelpers.lua +10 -11
- package/dist/functions/jsonRoom.lua +0 -1
- package/dist/functions/log.d.ts +21 -21
- package/dist/functions/log.lua +75 -75
- package/dist/functions/map.lua +0 -1
- package/dist/functions/math.d.ts +1 -1
- package/dist/functions/math.lua +3 -4
- package/dist/functions/npc.lua +0 -1
- package/dist/functions/pickups.lua +0 -1
- package/dist/functions/player.d.ts +6 -8
- package/dist/functions/player.lua +22 -30
- package/dist/functions/playerDataStructures.lua +0 -1
- package/dist/functions/playerHealth.d.ts +1 -1
- package/dist/functions/playerHealth.lua +20 -21
- package/dist/functions/pocketItems.lua +0 -1
- package/dist/functions/positionVelocity.d.ts +3 -0
- package/dist/functions/positionVelocity.lua +19 -6
- 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 -76
- package/dist/functions/set.d.ts +2 -2
- package/dist/functions/set.lua +7 -8
- package/dist/functions/string.lua +0 -1
- package/dist/functions/transformations.lua +0 -1
- package/dist/functions/trinketCacheFlag.d.ts +4 -4
- package/dist/functions/trinketCacheFlag.lua +3 -3
- package/dist/functions/trinketGive.d.ts +7 -7
- package/dist/functions/trinketGive.lua +27 -27
- package/dist/functions/trinketSet.lua +0 -1
- 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 -1
- package/dist/functions/vector.d.ts +2 -0
- package/dist/functions/vector.lua +13 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.lua +13 -0
- package/dist/lualib_bundle.lua +83 -49
- package/dist/maps/cardMap.lua +0 -1
- package/dist/maps/characterMap.lua +0 -1
- package/dist/maps/collectibleDescriptionMap.lua +0 -1
- package/dist/maps/collectibleNameMap.lua +0 -1
- package/dist/maps/gridEntityTypeToBrokenStateMap.lua +0 -1
- package/dist/maps/gridEntityXMLMap.lua +0 -1
- package/dist/maps/pillEffectMap.lua +0 -1
- package/dist/maps/roomShapeToTopLeftWallGridIndexMap.d.ts +1 -1
- package/dist/maps/roomShapeToTopLeftWallGridIndexMap.lua +1 -2
- package/dist/maps/roomTypeMap.lua +0 -1
- package/dist/maps/trinketDescriptionMap.lua +0 -1
- package/dist/maps/trinketNameMap.lua +0 -1
- package/dist/patchErrorFunctions.lua +0 -1
- package/dist/types/CollectibleIndex.d.ts +15 -0
- package/dist/types/CollectibleIndex.lua +3 -0
- package/dist/upgradeMod.lua +3 -1
- package/package.json +3 -3
package/dist/functions/rooms.lua
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
1
|
local ____lualib = require("lualib_bundle")
|
|
3
2
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
4
3
|
local Set = ____lualib.Set
|
|
@@ -30,38 +29,13 @@ local getEntityPositions = ____positionVelocity.getEntityPositions
|
|
|
30
29
|
local getEntityVelocities = ____positionVelocity.getEntityVelocities
|
|
31
30
|
local setEntityPositions = ____positionVelocity.setEntityPositions
|
|
32
31
|
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
|
|
32
|
+
local ____roomData = require("functions.roomData")
|
|
33
|
+
local getCurrentRoomDescriptorReadOnly = ____roomData.getCurrentRoomDescriptorReadOnly
|
|
34
|
+
local getRoomData = ____roomData.getRoomData
|
|
35
|
+
local getRoomDescriptor = ____roomData.getRoomDescriptor
|
|
36
|
+
local getRoomGridIndex = ____roomData.getRoomGridIndex
|
|
37
|
+
local getRoomStageID = ____roomData.getRoomStageID
|
|
38
|
+
local getRoomSubType = ____roomData.getRoomSubType
|
|
65
39
|
function ____exports.getRooms(self, includeExtraDimensionalRooms)
|
|
66
40
|
if includeExtraDimensionalRooms == nil then
|
|
67
41
|
includeExtraDimensionalRooms = false
|
|
@@ -95,13 +69,13 @@ function ____exports.getRooms(self, includeExtraDimensionalRooms)
|
|
|
95
69
|
return rooms
|
|
96
70
|
end
|
|
97
71
|
function ____exports.inDeathCertificateArea(self)
|
|
98
|
-
local roomStageID =
|
|
99
|
-
local roomSubType =
|
|
72
|
+
local roomStageID = getRoomStageID(nil)
|
|
73
|
+
local roomSubType = getRoomSubType(nil)
|
|
100
74
|
return roomStageID == 35 and (roomSubType == 33 or roomSubType == 34)
|
|
101
75
|
end
|
|
102
76
|
function ____exports.changeRoom(self, roomGridIndex)
|
|
103
77
|
local level = game:GetLevel()
|
|
104
|
-
local roomData =
|
|
78
|
+
local roomData = getRoomData(nil, roomGridIndex)
|
|
105
79
|
if roomData == nil then
|
|
106
80
|
error(("Failed to change the room to grid index " .. tostring(roomGridIndex)) .. " because that room does not exist.")
|
|
107
81
|
end
|
|
@@ -132,10 +106,6 @@ function ____exports.getCurrentDimension(self)
|
|
|
132
106
|
end
|
|
133
107
|
return error("Failed to get the current dimension using the starting room index of: " .. tostring(startingRoomGridIndex))
|
|
134
108
|
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
109
|
function ____exports.getRoomGridIndexesForType(self, ...)
|
|
140
110
|
local roomTypesSet = __TS__New(Set, {...})
|
|
141
111
|
local rooms = ____exports.getRooms(nil)
|
|
@@ -155,22 +125,6 @@ function ____exports.getRoomItemPoolType(self)
|
|
|
155
125
|
local roomSeed = room:GetSpawnSeed()
|
|
156
126
|
return itemPool:GetPoolForRoom(roomType, roomSeed)
|
|
157
127
|
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
128
|
function ____exports.gridToPos(self, x, y)
|
|
175
129
|
local room = game:GetRoom()
|
|
176
130
|
x = x + 1
|
|
@@ -186,63 +140,63 @@ end
|
|
|
186
140
|
function ____exports.inAngelShop(self)
|
|
187
141
|
local room = game:GetRoom()
|
|
188
142
|
local roomType = room:GetType()
|
|
189
|
-
local roomSubType =
|
|
143
|
+
local roomSubType = getRoomSubType(nil)
|
|
190
144
|
return roomType == RoomType.ROOM_ANGEL and roomSubType == 1
|
|
191
145
|
end
|
|
192
146
|
function ____exports.inBeastRoom(self)
|
|
193
147
|
local room = game:GetRoom()
|
|
194
148
|
local roomType = room:GetType()
|
|
195
|
-
local roomSubType =
|
|
149
|
+
local roomSubType = getRoomSubType(nil)
|
|
196
150
|
return roomType == RoomType.ROOM_DUNGEON and roomSubType == 4
|
|
197
151
|
end
|
|
198
152
|
function ____exports.inBossRoomOf(self, bossID)
|
|
199
153
|
local room = game:GetRoom()
|
|
200
154
|
local roomType = room:GetType()
|
|
201
|
-
local roomStageID =
|
|
202
|
-
local roomSubType =
|
|
155
|
+
local roomStageID = getRoomStageID(nil)
|
|
156
|
+
local roomSubType = getRoomSubType(nil)
|
|
203
157
|
return roomType == RoomType.ROOM_BOSS and roomStageID == 0 and roomSubType == bossID
|
|
204
158
|
end
|
|
205
159
|
function ____exports.inCrawlspace(self)
|
|
206
160
|
local room = game:GetRoom()
|
|
207
161
|
local roomType = room:GetType()
|
|
208
|
-
local roomSubType =
|
|
162
|
+
local roomSubType = getRoomSubType(nil)
|
|
209
163
|
return roomType == RoomType.ROOM_DUNGEON and roomSubType == 0
|
|
210
164
|
end
|
|
211
165
|
function ____exports.inDevilsCrownTreasureRoom(self)
|
|
212
|
-
local roomDescriptor =
|
|
166
|
+
local roomDescriptor = getCurrentRoomDescriptorReadOnly(nil)
|
|
213
167
|
return hasFlag(nil, roomDescriptor.Flags, 2048)
|
|
214
168
|
end
|
|
215
169
|
function ____exports.inDimension(self, dimension)
|
|
216
170
|
return dimension == ____exports.getCurrentDimension(nil)
|
|
217
171
|
end
|
|
172
|
+
function ____exports.inGenesisRoom(self)
|
|
173
|
+
local roomGridIndex = getRoomGridIndex(nil)
|
|
174
|
+
return roomGridIndex == GridRooms.ROOM_GENESIS_IDX
|
|
175
|
+
end
|
|
218
176
|
function ____exports.inLRoom(self)
|
|
219
177
|
local room = game:GetRoom()
|
|
220
178
|
local roomShape = room:GetRoomShape()
|
|
221
179
|
return roomShape == RoomShape.ROOMSHAPE_LTL or roomShape == RoomShape.ROOMSHAPE_LTR or roomShape == RoomShape.ROOMSHAPE_LBL or roomShape == RoomShape.ROOMSHAPE_LBR
|
|
222
180
|
end
|
|
223
|
-
function ____exports.inGenesisRoom(self)
|
|
224
|
-
local roomGridIndex = ____exports.getRoomGridIndex(nil)
|
|
225
|
-
return roomGridIndex == GridRooms.ROOM_GENESIS_IDX
|
|
226
|
-
end
|
|
227
181
|
function ____exports.inMegaSatanRoom(self)
|
|
228
|
-
local roomGridIndex =
|
|
182
|
+
local roomGridIndex = getRoomGridIndex(nil)
|
|
229
183
|
return roomGridIndex == GridRooms.ROOM_MEGA_SATAN_IDX
|
|
230
184
|
end
|
|
231
185
|
function ____exports.inMinibossRoomOf(self, minibossID)
|
|
232
186
|
local room = game:GetRoom()
|
|
233
187
|
local roomType = room:GetType()
|
|
234
|
-
local roomStageID =
|
|
235
|
-
local roomSubType =
|
|
188
|
+
local roomStageID = getRoomStageID(nil)
|
|
189
|
+
local roomSubType = getRoomSubType(nil)
|
|
236
190
|
return roomType == RoomType.ROOM_MINIBOSS and roomStageID == 0 and roomSubType == minibossID
|
|
237
191
|
end
|
|
238
192
|
function ____exports.inSecretShop(self)
|
|
239
|
-
local roomGridIndex =
|
|
193
|
+
local roomGridIndex = getRoomGridIndex(nil)
|
|
240
194
|
return roomGridIndex == GridRooms.ROOM_SECRET_SHOP_IDX
|
|
241
195
|
end
|
|
242
196
|
function ____exports.inStartingRoom(self)
|
|
243
197
|
local level = game:GetLevel()
|
|
244
198
|
local startingRoomGridIndex = level:GetStartingRoomIndex()
|
|
245
|
-
local roomGridIndex =
|
|
199
|
+
local roomGridIndex = getRoomGridIndex(nil)
|
|
246
200
|
return roomGridIndex == startingRoomGridIndex and ____exports.inDimension(nil, 0)
|
|
247
201
|
end
|
|
248
202
|
function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes)
|
|
@@ -264,12 +218,12 @@ function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes)
|
|
|
264
218
|
)
|
|
265
219
|
end
|
|
266
220
|
function ____exports.isRedKeyRoom(self, roomGridIndex)
|
|
267
|
-
local roomDescriptor =
|
|
221
|
+
local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
|
|
268
222
|
return hasFlag(nil, roomDescriptor.Flags, 1024)
|
|
269
223
|
end
|
|
270
224
|
function ____exports.isRoomInsideMap(self, roomGridIndex)
|
|
271
225
|
if roomGridIndex == nil then
|
|
272
|
-
roomGridIndex =
|
|
226
|
+
roomGridIndex = getRoomGridIndex(nil)
|
|
273
227
|
end
|
|
274
228
|
return roomGridIndex >= 0
|
|
275
229
|
end
|
|
@@ -292,12 +246,12 @@ function ____exports.setRoomCleared(self)
|
|
|
292
246
|
for ____, door in ipairs(getDoors(nil)) do
|
|
293
247
|
do
|
|
294
248
|
if isHiddenSecretRoomDoor(nil, door) then
|
|
295
|
-
goto
|
|
249
|
+
goto __continue46
|
|
296
250
|
end
|
|
297
251
|
openDoorFast(nil, door)
|
|
298
252
|
door.ExtraVisible = false
|
|
299
253
|
end
|
|
300
|
-
::
|
|
254
|
+
::__continue46::
|
|
301
255
|
end
|
|
302
256
|
sfxManager:Stop(SoundEffect.SOUND_DOOR_HEAVY_OPEN)
|
|
303
257
|
game:ShakeScreen(0)
|
|
@@ -315,7 +269,7 @@ function ____exports.teleport(self, roomGridIndex, direction, roomTransitionAnim
|
|
|
315
269
|
roomTransitionAnim = RoomTransitionAnim.TELEPORT
|
|
316
270
|
end
|
|
317
271
|
local level = game:GetLevel()
|
|
318
|
-
local roomData =
|
|
272
|
+
local roomData = getRoomData(nil, roomGridIndex)
|
|
319
273
|
if roomData == nil then
|
|
320
274
|
error(("Failed to change the room to grid index " .. tostring(roomGridIndex)) .. " because that room does not exist.")
|
|
321
275
|
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
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
1
|
local ____lualib = require("lualib_bundle")
|
|
3
2
|
local Set = ____lualib.Set
|
|
4
3
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
@@ -22,13 +21,6 @@ function ____exports.addSetsToSet(self, mainSet, ...)
|
|
|
22
21
|
end
|
|
23
22
|
end
|
|
24
23
|
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
24
|
function ____exports.combineSets(self, ...)
|
|
33
25
|
local sets = {...}
|
|
34
26
|
local newSet = __TS__New(Set)
|
|
@@ -39,6 +31,13 @@ function ____exports.combineSets(self, ...)
|
|
|
39
31
|
end
|
|
40
32
|
return newSet
|
|
41
33
|
end
|
|
34
|
+
function ____exports.copySet(self, oldSet)
|
|
35
|
+
local newSet = __TS__New(Set)
|
|
36
|
+
for ____, value in __TS__Iterator(oldSet:values()) do
|
|
37
|
+
newSet:add(value)
|
|
38
|
+
end
|
|
39
|
+
return newSet
|
|
40
|
+
end
|
|
42
41
|
function ____exports.deleteSetsFromSet(self, mainSet, ...)
|
|
43
42
|
local setsToRemove = {...}
|
|
44
43
|
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>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
1
|
local ____lualib = require("lualib_bundle")
|
|
3
2
|
local Map = ____lualib.Map
|
|
4
3
|
local __TS__New = ____lualib.__TS__New
|
|
5
4
|
local Set = ____lualib.Set
|
|
6
5
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
7
6
|
local ____exports = {}
|
|
7
|
+
local initCacheFlagMap, CACHE_FLAG_TO_TRINKETS_MAP
|
|
8
8
|
local ____math = require("functions.math")
|
|
9
9
|
local range = ____math.range
|
|
10
10
|
local ____set = require("functions.set")
|
|
@@ -14,8 +14,7 @@ local getMaxTrinketType = ____trinkets.getMaxTrinketType
|
|
|
14
14
|
local trinketHasCacheFlag = ____trinkets.trinketHasCacheFlag
|
|
15
15
|
local ____utils = require("functions.utils")
|
|
16
16
|
local getEnumValues = ____utils.getEnumValues
|
|
17
|
-
|
|
18
|
-
local function initCacheFlagMap(self)
|
|
17
|
+
function initCacheFlagMap(self)
|
|
19
18
|
local maxTrinketID = getMaxTrinketType(nil)
|
|
20
19
|
for ____, cacheFlag in ipairs(getEnumValues(nil, CacheFlag)) do
|
|
21
20
|
local trinketsSet = __TS__New(Set)
|
|
@@ -37,6 +36,7 @@ function ____exports.getTrinketsForCacheFlag(self, cacheFlag)
|
|
|
37
36
|
end
|
|
38
37
|
return copySet(nil, trinketsSet)
|
|
39
38
|
end
|
|
39
|
+
CACHE_FLAG_TO_TRINKETS_MAP = __TS__New(Map)
|
|
40
40
|
function ____exports.getPlayerTrinketsForCacheFlag(self, player, cacheFlag)
|
|
41
41
|
local trinketsForCacheFlag = ____exports.getTrinketsForCacheFlag(nil, cacheFlag)
|
|
42
42
|
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
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
1
|
local ____lualib = require("lualib_bundle")
|
|
3
2
|
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
4
3
|
local __TS__ArraySort = ____lualib.__TS__ArraySort
|
|
@@ -17,6 +16,13 @@ function ____exports.getEnumValues(self, transpiledEnum)
|
|
|
17
16
|
__TS__ArraySort(enumValues)
|
|
18
17
|
return enumValues
|
|
19
18
|
end
|
|
19
|
+
function ____exports.getTraversalDescription(self, key, traversalDescription)
|
|
20
|
+
if traversalDescription ~= "" then
|
|
21
|
+
traversalDescription = traversalDescription .. " --> "
|
|
22
|
+
end
|
|
23
|
+
traversalDescription = traversalDescription .. tostring(key)
|
|
24
|
+
return traversalDescription
|
|
25
|
+
end
|
|
20
26
|
function ____exports.hexToKColor(self, hexString, alpha)
|
|
21
27
|
hexString = __TS__StringReplace(hexString, "#", "")
|
|
22
28
|
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
|