isaacscript-common 1.0.600 → 1.0.604
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/postFlip.lua +1 -2
- package/dist/callbacks/postPurchase.lua +7 -6
- package/dist/callbacks/preNewLevel.lua +7 -5
- package/dist/callbacks/subscriptions/{PreNewLevel.d.ts → preNewLevel.d.ts} +0 -0
- package/dist/callbacks/subscriptions/{PreNewLevel.lua → preNewLevel.lua} +0 -0
- package/dist/features/getCollectibleItemPoolType.d.ts +2 -2
- package/dist/features/saveDataManager/exports.lua +5 -0
- package/dist/features/sirenHelpers.lua +3 -1
- package/dist/functions/array.d.ts +5 -2
- package/dist/functions/array.lua +26 -31
- package/dist/functions/collectibles.d.ts +5 -0
- package/dist/functions/collectibles.lua +11 -11
- package/dist/functions/entity.d.ts +10 -10
- package/dist/functions/entity.lua +29 -31
- package/dist/functions/globals.d.ts +14 -0
- package/dist/functions/globals.lua +205 -0
- package/dist/functions/gridEntity.lua +7 -6
- package/dist/functions/input.d.ts +2 -2
- package/dist/functions/jsonRoom.lua +36 -27
- package/dist/functions/log.d.ts +4 -4
- package/dist/functions/log.lua +15 -18
- package/dist/functions/npc.lua +17 -23
- package/dist/functions/player.d.ts +3 -1
- package/dist/functions/player.lua +59 -54
- package/dist/functions/pocketItems.lua +4 -6
- package/dist/functions/rooms.lua +26 -33
- package/dist/functions/transformations.lua +3 -1
- package/dist/functions/trinkets.lua +4 -12
- package/dist/functions/util.d.ts +1 -0
- package/dist/functions/util.lua +10 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.lua +8 -0
- package/dist/types/CallbackParametersCustom.d.ts +1 -1
- package/dist/types/ModUpgraded.lua +3 -5
- package/package.json +2 -2
- package/dist/callbacks/postSlot.d.ts +0 -2
- package/dist/callbacks/postSlot.lua +0 -48
- package/dist/callbacks/postSlotRender.d.ts +0 -2
- package/dist/callbacks/postSlotRender.lua +0 -20
- package/dist/callbacks/subscriptions/postPlayerUpdateReordered - Copy.d.ts +0 -5
- package/dist/callbacks/subscriptions/postPlayerUpdateReordered - Copy.lua +0 -26
- package/dist/cardNameMap.d.ts +0 -2
- package/dist/cardNameMap.lua +0 -5
- package/dist/collectibleNameMap.d.ts +0 -2
- package/dist/collectibleNameMap.lua +0 -5
- package/dist/collectibleSet.d.ts +0 -1
- package/dist/collectibleSet.lua +0 -22
- package/dist/functions/card.d.ts +0 -25
- package/dist/functions/card.lua +0 -41
- package/dist/functions/items.d.ts +0 -9
- package/dist/functions/items.lua +0 -9
- package/dist/functions/localization.d.ts +0 -2
- package/dist/functions/localization.lua +0 -8
- package/dist/functions/sound.d.ts +0 -7
- package/dist/functions/sound.lua +0 -7
- package/dist/gridEntityMap.d.ts +0 -2
- package/dist/gridEntityMap.lua +0 -5
- package/dist/maps/roomTypeToItemPoolMap.d.ts +0 -2
- package/dist/maps/roomTypeToItemPoolMap.lua +0 -19
- package/dist/maps/transformationMap.d.ts +0 -5
- package/dist/maps/transformationMap.lua +0 -56
- package/dist/patchPrintFunction.d.ts +0 -1
- package/dist/patchPrintFunction.lua +0 -45
- package/dist/pillEffectNameMap.d.ts +0 -2
- package/dist/pillEffectNameMap.lua +0 -5
- package/dist/transformationMap.d.ts +0 -5
- package/dist/transformationMap.lua +0 -56
- package/dist/trinketNameMap.d.ts +0 -2
- package/dist/trinketNameMap.lua +0 -5
|
@@ -11,6 +11,8 @@ local LOST_STYLE_PLAYER_TYPES = ____constants.LOST_STYLE_PLAYER_TYPES
|
|
|
11
11
|
local MAX_PLAYER_HEART_CONTAINERS = ____constants.MAX_PLAYER_HEART_CONTAINERS
|
|
12
12
|
local ____HealthType = require("types.HealthType")
|
|
13
13
|
local HealthType = ____HealthType.HealthType
|
|
14
|
+
local ____array = require("functions.array")
|
|
15
|
+
local arraySum = ____array.arraySum
|
|
14
16
|
local ____bitwise = require("functions.bitwise")
|
|
15
17
|
local getKBitOfN = ____bitwise.getKBitOfN
|
|
16
18
|
local getNumBitsOfN = ____bitwise.getNumBitsOfN
|
|
@@ -29,6 +31,13 @@ function ____exports.getCharacterMaxHeartContainers(self, character)
|
|
|
29
31
|
end
|
|
30
32
|
return 12
|
|
31
33
|
end
|
|
34
|
+
function ____exports.getCharacters(self)
|
|
35
|
+
local players = ____exports.getPlayers(nil)
|
|
36
|
+
return __TS__ArrayMap(
|
|
37
|
+
players,
|
|
38
|
+
function(____, player) return player:GetPlayerType() end
|
|
39
|
+
)
|
|
40
|
+
end
|
|
32
41
|
function ____exports.getPlayerIndex(self, player)
|
|
33
42
|
local character = player:GetPlayerType()
|
|
34
43
|
local collectibleToUse = character == PlayerType.PLAYER_LAZARUS2_B and CollectibleType.COLLECTIBLE_INNER_EYE or CollectibleType.COLLECTIBLE_SAD_ONION
|
|
@@ -61,18 +70,18 @@ function ____exports.getPlayers(self, performExclusions)
|
|
|
61
70
|
do
|
|
62
71
|
local player = Isaac.GetPlayer(i)
|
|
63
72
|
if player == nil then
|
|
64
|
-
goto
|
|
73
|
+
goto __continue70
|
|
65
74
|
end
|
|
66
75
|
if ____exports.isChildPlayer(nil, player) then
|
|
67
|
-
goto
|
|
76
|
+
goto __continue70
|
|
68
77
|
end
|
|
69
78
|
local character = player:GetPlayerType()
|
|
70
79
|
if performExclusions and EXCLUDED_CHARACTERS:has(character) then
|
|
71
|
-
goto
|
|
80
|
+
goto __continue70
|
|
72
81
|
end
|
|
73
82
|
__TS__ArrayPush(players, player)
|
|
74
83
|
end
|
|
75
|
-
::
|
|
84
|
+
::__continue70::
|
|
76
85
|
i = i + 1
|
|
77
86
|
end
|
|
78
87
|
end
|
|
@@ -99,39 +108,34 @@ function ____exports.addTrinketCostume(self, player, trinketType)
|
|
|
99
108
|
player:AddCostume(itemConfigTrinket, false)
|
|
100
109
|
end
|
|
101
110
|
function ____exports.anyPlayerCloserThan(self, position, distance)
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
return false
|
|
111
|
+
local players = ____exports.getPlayers(nil)
|
|
112
|
+
return __TS__ArraySome(
|
|
113
|
+
players,
|
|
114
|
+
function(____, player) return player.Position:Distance(position) <= distance end
|
|
115
|
+
)
|
|
108
116
|
end
|
|
109
117
|
function ____exports.anyPlayerHasCollectible(self, collectibleType)
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
return false
|
|
118
|
+
local players = ____exports.getPlayers(nil)
|
|
119
|
+
return __TS__ArraySome(
|
|
120
|
+
players,
|
|
121
|
+
function(____, player) return player:HasCollectible(collectibleType) end
|
|
122
|
+
)
|
|
116
123
|
end
|
|
117
124
|
function ____exports.anyPlayerHasTrinket(self, trinketType)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
return false
|
|
125
|
+
local players = ____exports.getPlayers(nil)
|
|
126
|
+
return __TS__ArraySome(
|
|
127
|
+
players,
|
|
128
|
+
function(____, player) return player:HasTrinket(trinketType) end
|
|
129
|
+
)
|
|
124
130
|
end
|
|
125
131
|
function ____exports.anyPlayerIs(self, ...)
|
|
126
|
-
local
|
|
127
|
-
local
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
end
|
|
134
|
-
return false
|
|
132
|
+
local matchingCharacters = {...}
|
|
133
|
+
local matchingCharacterSet = __TS__New(Set, matchingCharacters)
|
|
134
|
+
local characters = ____exports.getCharacters(nil)
|
|
135
|
+
return __TS__ArraySome(
|
|
136
|
+
characters,
|
|
137
|
+
function(____, character) return matchingCharacterSet:has(character) end
|
|
138
|
+
)
|
|
135
139
|
end
|
|
136
140
|
function ____exports.characterCanHaveRedHearts(self, character)
|
|
137
141
|
return not CHARACTERS_WITH_NO_RED_HEARTS:has(character)
|
|
@@ -282,14 +286,14 @@ function ____exports.getPlayerIndexVanilla(self, playerToFind)
|
|
|
282
286
|
do
|
|
283
287
|
local player = Isaac.GetPlayer(i)
|
|
284
288
|
if player == nil then
|
|
285
|
-
goto
|
|
289
|
+
goto __continue62
|
|
286
290
|
end
|
|
287
291
|
local playerHash = GetPtrHash(player)
|
|
288
292
|
if playerHash == playerToFindHash then
|
|
289
293
|
return i
|
|
290
294
|
end
|
|
291
295
|
end
|
|
292
|
-
::
|
|
296
|
+
::__continue62::
|
|
293
297
|
i = i + 1
|
|
294
298
|
end
|
|
295
299
|
end
|
|
@@ -306,14 +310,14 @@ end
|
|
|
306
310
|
function ____exports.getPlayersOfType(self, ...)
|
|
307
311
|
local characters = {...}
|
|
308
312
|
local charactersSet = __TS__New(Set, characters)
|
|
309
|
-
local players =
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
313
|
+
local players = ____exports.getPlayers(nil)
|
|
314
|
+
return __TS__ArrayFilter(
|
|
315
|
+
players,
|
|
316
|
+
function(____, player)
|
|
317
|
+
local character = player:GetPlayerType()
|
|
318
|
+
return charactersSet:has(character)
|
|
314
319
|
end
|
|
315
|
-
|
|
316
|
-
return players
|
|
320
|
+
)
|
|
317
321
|
end
|
|
318
322
|
function ____exports.getTotalCharge(self, player, activeSlot)
|
|
319
323
|
local activeCharge = player:GetActiveCharge(activeSlot)
|
|
@@ -321,11 +325,12 @@ function ____exports.getTotalCharge(self, player, activeSlot)
|
|
|
321
325
|
return activeCharge + batteryCharge
|
|
322
326
|
end
|
|
323
327
|
function ____exports.getTotalPlayerCollectibles(self, collectibleType)
|
|
324
|
-
local
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
328
|
+
local players = ____exports.getPlayers(nil)
|
|
329
|
+
local numCollectiblesArray = __TS__ArrayMap(
|
|
330
|
+
players,
|
|
331
|
+
function(____, player) return player:GetCollectibleNum(collectibleType) end
|
|
332
|
+
)
|
|
333
|
+
return arraySum(nil, numCollectiblesArray)
|
|
329
334
|
end
|
|
330
335
|
function ____exports.hasLostCurse(self, player)
|
|
331
336
|
local effects = player:GetEffects()
|
|
@@ -450,9 +455,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
450
455
|
itemPool:RemoveCollectible(collectibleType)
|
|
451
456
|
end
|
|
452
457
|
repeat
|
|
453
|
-
local
|
|
454
|
-
local
|
|
455
|
-
if
|
|
458
|
+
local ____switch109 = activeSlot
|
|
459
|
+
local ____cond109 = ____switch109 == ActiveSlot.SLOT_PRIMARY
|
|
460
|
+
if ____cond109 then
|
|
456
461
|
do
|
|
457
462
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
458
463
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -461,8 +466,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
461
466
|
break
|
|
462
467
|
end
|
|
463
468
|
end
|
|
464
|
-
|
|
465
|
-
if
|
|
469
|
+
____cond109 = ____cond109 or ____switch109 == ActiveSlot.SLOT_SECONDARY
|
|
470
|
+
if ____cond109 then
|
|
466
471
|
do
|
|
467
472
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
468
473
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -477,16 +482,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
477
482
|
break
|
|
478
483
|
end
|
|
479
484
|
end
|
|
480
|
-
|
|
481
|
-
if
|
|
485
|
+
____cond109 = ____cond109 or ____switch109 == ActiveSlot.SLOT_POCKET
|
|
486
|
+
if ____cond109 then
|
|
482
487
|
do
|
|
483
488
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
484
489
|
player:SetActiveCharge(charge, activeSlot)
|
|
485
490
|
break
|
|
486
491
|
end
|
|
487
492
|
end
|
|
488
|
-
|
|
489
|
-
if
|
|
493
|
+
____cond109 = ____cond109 or ____switch109 == ActiveSlot.SLOT_POCKET2
|
|
494
|
+
if ____cond109 then
|
|
490
495
|
do
|
|
491
496
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
492
497
|
break
|
|
@@ -57,11 +57,9 @@ function ____exports.hasOpenPocketItemSlot(self, player)
|
|
|
57
57
|
return false
|
|
58
58
|
end
|
|
59
59
|
local pocketItems = ____exports.getPocketItems(nil, player)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
end
|
|
65
|
-
return false
|
|
60
|
+
return __TS__ArraySome(
|
|
61
|
+
pocketItems,
|
|
62
|
+
function(____, pocketItem) return pocketItem.type == PocketItemType.EMPTY end
|
|
63
|
+
)
|
|
66
64
|
end
|
|
67
65
|
return ____exports
|
package/dist/functions/rooms.lua
CHANGED
|
@@ -93,11 +93,11 @@ function ____exports.changeRoom(self, roomGridIndex)
|
|
|
93
93
|
game:ChangeRoom(roomGridIndex)
|
|
94
94
|
end
|
|
95
95
|
function ____exports.getAllRoomGridIndexes(self)
|
|
96
|
-
local
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
96
|
+
local rooms = ____exports.getRooms(nil)
|
|
97
|
+
return __TS__ArrayMap(
|
|
98
|
+
rooms,
|
|
99
|
+
function(____, roomDescriptor) return roomDescriptor.SafeGridIndex end
|
|
100
|
+
)
|
|
101
101
|
end
|
|
102
102
|
function ____exports.getCurrentDimension(self)
|
|
103
103
|
local game = Game()
|
|
@@ -119,21 +119,22 @@ function ____exports.getCurrentDimension(self)
|
|
|
119
119
|
dimension = dimension + 1
|
|
120
120
|
end
|
|
121
121
|
end
|
|
122
|
-
error("Failed to get the current dimension using the starting room index of: " .. tostring(startingRoomGridIndex))
|
|
123
|
-
return 0
|
|
122
|
+
return error("Failed to get the current dimension using the starting room index of: " .. tostring(startingRoomGridIndex))
|
|
124
123
|
end
|
|
125
124
|
function ____exports.getRoomDataType(self, roomGridIndex)
|
|
126
125
|
local roomData = ____exports.getRoomData(nil, roomGridIndex)
|
|
127
126
|
return roomData == nil and -1 or roomData.Type
|
|
128
127
|
end
|
|
129
128
|
function ____exports.getRoomGridIndexesForType(self, roomType)
|
|
130
|
-
local
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
129
|
+
local rooms = ____exports.getRooms(nil)
|
|
130
|
+
local matchingRooms = __TS__ArrayFilter(
|
|
131
|
+
rooms,
|
|
132
|
+
function(____, roomDescriptor) return roomDescriptor.Data ~= nil and roomDescriptor.Data.Type == roomType end
|
|
133
|
+
)
|
|
134
|
+
return __TS__ArrayMap(
|
|
135
|
+
matchingRooms,
|
|
136
|
+
function(____, roomDescriptor) return roomDescriptor.SafeGridIndex end
|
|
137
|
+
)
|
|
137
138
|
end
|
|
138
139
|
function ____exports.getRoomItemPoolType(self)
|
|
139
140
|
local game = Game()
|
|
@@ -246,23 +247,15 @@ function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes)
|
|
|
246
247
|
____temp_0 = __TS__New(Set, onlyCheckRoomTypes)
|
|
247
248
|
end
|
|
248
249
|
local roomTypeWhitelist = ____temp_0
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
end
|
|
259
|
-
if not roomDescriptor.Clear then
|
|
260
|
-
return false
|
|
261
|
-
end
|
|
262
|
-
end
|
|
263
|
-
::__continue49::
|
|
264
|
-
end
|
|
265
|
-
return true
|
|
250
|
+
local rooms = ____exports.getRooms(nil)
|
|
251
|
+
local matchingRooms = roomTypeWhitelist == nil and rooms or __TS__ArrayFilter(
|
|
252
|
+
rooms,
|
|
253
|
+
function(____, roomDescriptor) return roomDescriptor.Data ~= nil and roomTypeWhitelist:has(roomDescriptor.Data.Type) end
|
|
254
|
+
)
|
|
255
|
+
return __TS__ArrayEvery(
|
|
256
|
+
matchingRooms,
|
|
257
|
+
function(____, roomDescriptor) return roomDescriptor.Clear end
|
|
258
|
+
)
|
|
266
259
|
end
|
|
267
260
|
function ____exports.isRedKeyRoom(self, roomGridIndex)
|
|
268
261
|
local roomDescriptor = ____exports.getRoomDescriptor(nil, roomGridIndex)
|
|
@@ -296,12 +289,12 @@ function ____exports.setRoomCleared(self)
|
|
|
296
289
|
for ____, door in ipairs(getDoors(nil)) do
|
|
297
290
|
do
|
|
298
291
|
if isHiddenSecretRoomDoor(nil, door) then
|
|
299
|
-
goto
|
|
292
|
+
goto __continue55
|
|
300
293
|
end
|
|
301
294
|
openDoorFast(nil, door)
|
|
302
295
|
door.ExtraVisible = false
|
|
303
296
|
end
|
|
304
|
-
::
|
|
297
|
+
::__continue55::
|
|
305
298
|
end
|
|
306
299
|
sfx:Stop(SoundEffect.SOUND_DOOR_HEAVY_OPEN)
|
|
307
300
|
game:ShakeScreen(0)
|
|
@@ -6,6 +6,8 @@ local TRANSFORMATIONS_NOT_BASED_ON_ITEMS = ____transformationMaps.TRANSFORMATION
|
|
|
6
6
|
local TRANSFORMATION_TO_ITEMS_MAP = ____transformationMaps.TRANSFORMATION_TO_ITEMS_MAP
|
|
7
7
|
local ____transformationNameMap = require("maps.transformationNameMap")
|
|
8
8
|
local TRANSFORMATION_NAME_MAP = ____transformationNameMap.TRANSFORMATION_NAME_MAP
|
|
9
|
+
local ____array = require("functions.array")
|
|
10
|
+
local arrayCopy = ____array.arrayCopy
|
|
9
11
|
function ____exports.getPlayerNumTransformationCollectibles(self, player, playerForm)
|
|
10
12
|
if TRANSFORMATIONS_NOT_BASED_ON_ITEMS:has(playerForm) then
|
|
11
13
|
error(("The transformation of " .. tostring(playerForm)) .. " cannot be tracked by this function.")
|
|
@@ -22,7 +24,7 @@ function ____exports.getPlayerNumTransformationCollectibles(self, player, player
|
|
|
22
24
|
end
|
|
23
25
|
function ____exports.getTransformationsForItem(self, collectibleType)
|
|
24
26
|
local transformations = ITEM_TO_TRANSFORMATION_MAP:get(collectibleType)
|
|
25
|
-
return transformations == nil and ({}) or (
|
|
27
|
+
return transformations == nil and ({}) or arrayCopy(nil, transformations)
|
|
26
28
|
end
|
|
27
29
|
function ____exports.getTransformationName(self, transformation)
|
|
28
30
|
local defaultName = "Unknown"
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
-
require("lualib_bundle");
|
|
3
2
|
local ____exports = {}
|
|
4
3
|
local ____constants = require("constants")
|
|
5
4
|
local GOLDEN_TRINKET_SHIFT = ____constants.GOLDEN_TRINKET_SHIFT
|
|
@@ -7,6 +6,8 @@ local ____trinketDescriptionMap = require("maps.trinketDescriptionMap")
|
|
|
7
6
|
local TRINKET_DESCRIPTION_MAP = ____trinketDescriptionMap.TRINKET_DESCRIPTION_MAP
|
|
8
7
|
local ____trinketNameMap = require("maps.trinketNameMap")
|
|
9
8
|
local TRINKET_NAME_MAP = ____trinketNameMap.TRINKET_NAME_MAP
|
|
9
|
+
local ____entity = require("functions.entity")
|
|
10
|
+
local getPickups = ____entity.getPickups
|
|
10
11
|
local ____trinketGive = require("functions.trinketGive")
|
|
11
12
|
local giveTrinketsBack = ____trinketGive.giveTrinketsBack
|
|
12
13
|
local temporarilyRemoveTrinkets = ____trinketGive.temporarilyRemoveTrinkets
|
|
@@ -27,22 +28,13 @@ function ____exports.getOpenTrinketSlot(self, player)
|
|
|
27
28
|
end
|
|
28
29
|
return trinket1 == TrinketType.TRINKET_NULL and 1 or nil
|
|
29
30
|
end
|
|
30
|
-
error("The player has an unknown number of trinket slots: " .. tostring(maxTrinkets))
|
|
31
|
-
return nil
|
|
31
|
+
return error("The player has an unknown number of trinket slots: " .. tostring(maxTrinkets))
|
|
32
32
|
end
|
|
33
33
|
function ____exports.getTrinkets(self, matchingSubType)
|
|
34
34
|
if matchingSubType == nil then
|
|
35
35
|
matchingSubType = -1
|
|
36
36
|
end
|
|
37
|
-
|
|
38
|
-
local collectibles = {}
|
|
39
|
-
for ____, entity in ipairs(entities) do
|
|
40
|
-
local pickup = entity:ToPickup()
|
|
41
|
-
if pickup ~= nil then
|
|
42
|
-
__TS__ArrayPush(collectibles, pickup)
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
return collectibles
|
|
37
|
+
return getPickups(nil, PickupVariant.PICKUP_TRINKET, matchingSubType)
|
|
46
38
|
end
|
|
47
39
|
function ____exports.getTrinketDescription(self, trinketType)
|
|
48
40
|
local itemConfig = Isaac.GetItemConfig()
|
package/dist/functions/util.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare function copyMap<K, V>(oldMap: Map<K, V>): Map<K, V>;
|
|
|
10
10
|
* instead.
|
|
11
11
|
*/
|
|
12
12
|
export declare function copySet<T>(oldSet: Set<T>): Set<T>;
|
|
13
|
+
export declare function combineSets<T>(...sets: Array<Set<T>>): Set<T>;
|
|
13
14
|
/**
|
|
14
15
|
* Helper function to get type safety on a switch statement.
|
|
15
16
|
* Very useful to be future-safe against people adding values to a type or an enum.
|
package/dist/functions/util.lua
CHANGED
|
@@ -18,6 +18,16 @@ function ____exports.copySet(self, oldSet)
|
|
|
18
18
|
end
|
|
19
19
|
return newSet
|
|
20
20
|
end
|
|
21
|
+
function ____exports.combineSets(self, ...)
|
|
22
|
+
local sets = {...}
|
|
23
|
+
local newSet = __TS__New(Set)
|
|
24
|
+
for ____, set in ipairs(sets) do
|
|
25
|
+
for ____, value in __TS__Iterator(set:values()) do
|
|
26
|
+
newSet:add(value)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
return newSet
|
|
30
|
+
end
|
|
21
31
|
____exports.ensureAllCases = function(____, obj) return obj end
|
|
22
32
|
function ____exports.getEnumValues(self, transpiledEnum)
|
|
23
33
|
local enumValues = {}
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export * from "./functions/doors";
|
|
|
23
23
|
export * from "./functions/entity";
|
|
24
24
|
export * from "./functions/familiars";
|
|
25
25
|
export * from "./functions/flag";
|
|
26
|
+
export * from "./functions/globals";
|
|
26
27
|
export * from "./functions/gridEntity";
|
|
27
28
|
export * from "./functions/input";
|
|
28
29
|
export * from "./functions/json";
|
package/dist/index.lua
CHANGED
|
@@ -190,6 +190,14 @@ do
|
|
|
190
190
|
end
|
|
191
191
|
end
|
|
192
192
|
end
|
|
193
|
+
do
|
|
194
|
+
local ____export = require("functions.globals")
|
|
195
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
196
|
+
if ____exportKey ~= "default" then
|
|
197
|
+
____exports[____exportKey] = ____exportValue
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
end
|
|
193
201
|
do
|
|
194
202
|
local ____export = require("functions.gridEntity")
|
|
195
203
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -43,7 +43,7 @@ import { PostTrinketBreakCallbackType } from "../callbacks/subscriptions/postTri
|
|
|
43
43
|
import { PreBerserkDeathCallbackType } from "../callbacks/subscriptions/preBerserkDeath";
|
|
44
44
|
import { PreCustomReviveCallbackType } from "../callbacks/subscriptions/preCustomRevive";
|
|
45
45
|
import { PreItemPickupCallbackType } from "../callbacks/subscriptions/preItemPickup";
|
|
46
|
-
import { PreNewLevelCallbackType } from "../callbacks/subscriptions/
|
|
46
|
+
import { PreNewLevelCallbackType } from "../callbacks/subscriptions/preNewLevel";
|
|
47
47
|
import { ModCallbacksCustom } from "./ModCallbacksCustom";
|
|
48
48
|
export interface CallbackParametersCustom {
|
|
49
49
|
[ModCallbacksCustom.MC_POST_GAME_STARTED_REORDERED]: [
|
|
@@ -90,8 +90,8 @@ local ____preCustomRevive = require("callbacks.subscriptions.preCustomRevive")
|
|
|
90
90
|
local preCustomReviveRegister = ____preCustomRevive.preCustomReviveRegister
|
|
91
91
|
local ____preItemPickup = require("callbacks.subscriptions.preItemPickup")
|
|
92
92
|
local preItemPickupRegister = ____preItemPickup.preItemPickupRegister
|
|
93
|
-
local
|
|
94
|
-
local preNewLevelRegister =
|
|
93
|
+
local ____preNewLevel = require("callbacks.subscriptions.preNewLevel")
|
|
94
|
+
local preNewLevelRegister = ____preNewLevel.preNewLevelRegister
|
|
95
95
|
local ____log = require("functions.log")
|
|
96
96
|
local getDebugPrependString = ____log.getDebugPrependString
|
|
97
97
|
local ____util = require("functions.util")
|
|
@@ -384,9 +384,7 @@ function getCallbackRegisterFunction(self, callbackID)
|
|
|
384
384
|
do
|
|
385
385
|
do
|
|
386
386
|
ensureAllCases(nil, callbackID)
|
|
387
|
-
error(("The custom callback ID of \"" .. tostring(callbackID)) .. "\" is not valid.")
|
|
388
|
-
return function()
|
|
389
|
-
end
|
|
387
|
+
return error(("The custom callback ID of \"" .. tostring(callbackID)) .. "\" is not valid.")
|
|
390
388
|
end
|
|
391
389
|
end
|
|
392
390
|
until true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.604",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dist/**/*.d.ts"
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"isaac-typescript-definitions": "^1.0.
|
|
28
|
+
"isaac-typescript-definitions": "^1.0.333",
|
|
29
29
|
"isaacscript-lint": "^1.0.79",
|
|
30
30
|
"isaacscript-tsconfig": "^1.1.8",
|
|
31
31
|
"typedoc": "^0.22.11",
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
-
require("lualib_bundle");
|
|
3
|
-
local ____exports = {}
|
|
4
|
-
local hasSubscriptions, postUpdate, postNewRoom, checkNewEntity, v
|
|
5
|
-
local ____exports = require("features.saveDataManager.exports")
|
|
6
|
-
local saveDataManager = ____exports.saveDataManager
|
|
7
|
-
local postSlotInit = require("callbacks.subscriptions.postSlotInit")
|
|
8
|
-
local postSlotUpdate = require("callbacks.subscriptions.postSlotUpdate")
|
|
9
|
-
function hasSubscriptions(self)
|
|
10
|
-
return postSlotInit:hasSubscriptions() or postSlotUpdate:hasSubscriptions()
|
|
11
|
-
end
|
|
12
|
-
function postUpdate(self)
|
|
13
|
-
if not hasSubscriptions(nil) then
|
|
14
|
-
return
|
|
15
|
-
end
|
|
16
|
-
local slots = Isaac.FindByType(EntityType.ENTITY_SLOT)
|
|
17
|
-
for ____, slot in ipairs(slots) do
|
|
18
|
-
checkNewEntity(nil, slot)
|
|
19
|
-
postSlotUpdate:fire(slot)
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
function postNewRoom(self)
|
|
23
|
-
if not hasSubscriptions(nil) then
|
|
24
|
-
return
|
|
25
|
-
end
|
|
26
|
-
local slots = Isaac.FindByType(EntityType.ENTITY_SLOT)
|
|
27
|
-
for ____, slot in ipairs(slots) do
|
|
28
|
-
checkNewEntity(nil, slot)
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
function checkNewEntity(self, slot)
|
|
32
|
-
local ptrHash = GetPtrHash(slot)
|
|
33
|
-
if not v.room.initializedSlots:has(ptrHash) then
|
|
34
|
-
v.room.initializedSlots:add(ptrHash)
|
|
35
|
-
postSlotInit:fire(slot)
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
v = {
|
|
39
|
-
room = {
|
|
40
|
-
initializedSlots = __TS__New(Set)
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
function ____exports.postSlotCallbacksInit(self, mod)
|
|
44
|
-
saveDataManager(nil, "postSlot", v, hasSubscriptions)
|
|
45
|
-
mod:AddCallback(ModCallbacks.MC_POST_UPDATE, postUpdate)
|
|
46
|
-
mod:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, postNewRoom)
|
|
47
|
-
end
|
|
48
|
-
return ____exports
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
-
local ____exports = {}
|
|
3
|
-
local hasSubscriptions, postRender
|
|
4
|
-
local postSlotRender = require("callbacks.subscriptions.postSlotRender")
|
|
5
|
-
function hasSubscriptions(self)
|
|
6
|
-
return postSlotRender:hasSubscriptions()
|
|
7
|
-
end
|
|
8
|
-
function postRender(self)
|
|
9
|
-
if not hasSubscriptions(nil) then
|
|
10
|
-
return
|
|
11
|
-
end
|
|
12
|
-
local slots = Isaac.FindByType(EntityType.ENTITY_SLOT)
|
|
13
|
-
for ____, slot in ipairs(slots) do
|
|
14
|
-
postSlotRender:fire(slot)
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
function ____exports.postSlotRenderCallbackInit(self, mod)
|
|
18
|
-
mod:AddCallback(ModCallbacks.MC_POST_RENDER, postRender)
|
|
19
|
-
end
|
|
20
|
-
return ____exports
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
-
export declare type PostPlayerUpdateReorderedCallbackType = (player: EntityPlayer) => void;
|
|
3
|
-
export declare function hasSubscriptions(): boolean;
|
|
4
|
-
export declare function register(callback: PostPlayerUpdateReorderedCallbackType, playerVariant?: PlayerVariant): void;
|
|
5
|
-
export declare function fire(player: EntityPlayer): void;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
-
require("lualib_bundle");
|
|
3
|
-
local ____exports = {}
|
|
4
|
-
local subscriptions = {}
|
|
5
|
-
function ____exports.hasSubscriptions(self)
|
|
6
|
-
return #subscriptions > 0
|
|
7
|
-
end
|
|
8
|
-
function ____exports.register(self, callback, playerVariant)
|
|
9
|
-
__TS__ArrayPush(subscriptions, {callback, playerVariant})
|
|
10
|
-
end
|
|
11
|
-
function ____exports.fire(self, player)
|
|
12
|
-
for ____, ____value in ipairs(subscriptions) do
|
|
13
|
-
local callback
|
|
14
|
-
callback = ____value[1]
|
|
15
|
-
local playerVariant
|
|
16
|
-
playerVariant = ____value[2]
|
|
17
|
-
do
|
|
18
|
-
if (playerVariant ~= nil) and (playerVariant ~= player.Variant) then
|
|
19
|
-
goto __continue5
|
|
20
|
-
end
|
|
21
|
-
callback(nil, player)
|
|
22
|
-
end
|
|
23
|
-
::__continue5::
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
return ____exports
|
package/dist/cardNameMap.d.ts
DELETED
package/dist/cardNameMap.lua
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
-
require("lualib_bundle");
|
|
3
|
-
local ____exports = {}
|
|
4
|
-
____exports.CARD_NAME_MAP = __TS__New(Map, {{Card.CARD_FOOL, "0 - The Fool"}, {Card.CARD_MAGICIAN, "I - The Magician"}, {Card.CARD_HIGH_PRIESTESS, "II - The High Priestess"}, {Card.CARD_EMPRESS, "III - The Empress"}, {Card.CARD_EMPEROR, "IV - The Emperor"}, {Card.CARD_HIEROPHANT, "V - The Hierophant"}, {Card.CARD_LOVERS, "VI - The Lovers"}, {Card.CARD_CHARIOT, "VII - The Chariot"}, {Card.CARD_JUSTICE, "VIII - Justice"}, {Card.CARD_HERMIT, "IX - The Hermit"}, {Card.CARD_WHEEL_OF_FORTUNE, "X - Wheel of Fortune"}, {Card.CARD_STRENGTH, "XI - Strength"}, {Card.CARD_HANGED_MAN, "XII - The Hanged Man"}, {Card.CARD_DEATH, "XIII - Death"}, {Card.CARD_TEMPERANCE, "XIV - Temperance"}, {Card.CARD_DEVIL, "XV - The Devil"}, {Card.CARD_TOWER, "XVI - The Tower"}, {Card.CARD_STARS, "XVII - The Stars"}, {Card.CARD_MOON, "XVIII - The Moon"}, {Card.CARD_SUN, "XIX - The Sun"}, {Card.CARD_JUDGEMENT, "XX - Judgement"}, {Card.CARD_WORLD, "XXI - The World"}, {Card.CARD_CLUBS_2, "2 of Clubs"}, {Card.CARD_DIAMONDS_2, "2 of Diamonds"}, {Card.CARD_SPADES_2, "2 of Spades"}, {Card.CARD_HEARTS_2, "2 of Hearts"}, {Card.CARD_ACE_OF_CLUBS, "Ace of Clubs"}, {Card.CARD_ACE_OF_DIAMONDS, "Ace of Diamonds"}, {Card.CARD_ACE_OF_SPADES, "Ace of Spades"}, {Card.CARD_ACE_OF_HEARTS, "Ace of Hearts"}, {Card.CARD_JOKER, "Joker"}, {Card.RUNE_HAGALAZ, "Hagalaz"}, {Card.RUNE_JERA, "Jera"}, {Card.RUNE_EHWAZ, "Ehwaz"}, {Card.RUNE_DAGAZ, "Dagaz"}, {Card.RUNE_ANSUZ, "Ansuz"}, {Card.RUNE_PERTHRO, "Perthro"}, {Card.RUNE_BERKANO, "Berkano"}, {Card.RUNE_ALGIZ, "Algiz"}, {Card.RUNE_BLANK, "Blank Rune"}, {Card.RUNE_BLACK, "Black Rune"}, {Card.CARD_CHAOS, "Chaos Card"}, {Card.CARD_CREDIT, "Credit Card"}, {Card.CARD_RULES, "Rules Card"}, {Card.CARD_HUMANITY, "A Card Against Humanity"}, {Card.CARD_SUICIDE_KING, "Suicide King"}, {Card.CARD_GET_OUT_OF_JAIL, "Get Out Of Jail Free Card"}, {Card.CARD_QUESTIONMARK, "? Card"}, {Card.CARD_DICE_SHARD, "Dice Shard"}, {Card.CARD_EMERGENCY_CONTACT, "Emergency Contact"}, {Card.CARD_HOLY, "Holy Card"}, {Card.CARD_HUGE_GROWTH, "Huge Growth"}, {Card.CARD_ANCIENT_RECALL, "Ancient Recall"}, {Card.CARD_ERA_WALK, "Era Walk"}, {Card.RUNE_SHARD, "Rune Shard"}, {Card.CARD_REVERSE_FOOL, "0 - The Fool?"}, {Card.CARD_REVERSE_MAGICIAN, "I - The Magician?"}, {Card.CARD_REVERSE_HIGH_PRIESTESS, "II - The High Priestess?"}, {Card.CARD_REVERSE_EMPRESS, "III - The Empress?"}, {Card.CARD_REVERSE_EMPEROR, "IV - The Emperor?"}, {Card.CARD_REVERSE_HIEROPHANT, "V - The Hierophant?"}, {Card.CARD_REVERSE_LOVERS, "VI - The Lovers?"}, {Card.CARD_REVERSE_CHARIOT, "VII - The Chariot?"}, {Card.CARD_REVERSE_JUSTICE, "VIII - Justice?"}, {Card.CARD_REVERSE_HERMIT, "IX - The Hermit?"}, {Card.CARD_REVERSE_WHEEL_OF_FORTUNE, "X - Wheel of Fortune?"}, {Card.CARD_REVERSE_STRENGTH, "XI - Strength?"}, {Card.CARD_REVERSE_HANGED_MAN, "XII - The Hanged Man?"}, {Card.CARD_REVERSE_DEATH, "XIII - Death?"}, {Card.CARD_REVERSE_TEMPERANCE, "XIV - Temperance?"}, {Card.CARD_REVERSE_DEVIL, "XV - The Devil?"}, {Card.CARD_REVERSE_TOWER, "XVI - The Tower?"}, {Card.CARD_REVERSE_STARS, "XVII - The Stars?"}, {Card.CARD_REVERSE_MOON, "XVIII - The Moon?"}, {Card.CARD_REVERSE_SUN, "XIX - The Sun?"}, {Card.CARD_REVERSE_JUDGEMENT, "XX - Judgement?"}, {Card.CARD_REVERSE_WORLD, "XXI - The World?"}, {Card.CARD_CRACKED_KEY, "Cracked Key"}, {Card.CARD_QUEEN_OF_HEARTS, "Queen of Hearts"}, {Card.CARD_WILD, "Wild Card"}, {Card.CARD_SOUL_ISAAC, "Soul of Isaac"}, {Card.CARD_SOUL_MAGDALENE, "Soul of Magdalene"}, {Card.CARD_SOUL_CAIN, "Soul of Cain"}, {Card.CARD_SOUL_JUDAS, "Soul of Judas"}, {Card.CARD_SOUL_BLUEBABY, "Soul of ???"}, {Card.CARD_SOUL_EVE, "Soul of Eve"}, {Card.CARD_SOUL_SAMSON, "Soul of Samson"}, {Card.CARD_SOUL_AZAZEL, "Soul of Azazel"}, {Card.CARD_SOUL_LAZARUS, "Soul of Lazarus"}, {Card.CARD_SOUL_EDEN, "Soul of Eden"}, {Card.CARD_SOUL_LOST, "Soul of the Lost"}, {Card.CARD_SOUL_LILITH, "Soul of Lilith"}, {Card.CARD_SOUL_KEEPER, "Soul of the Keeper"}, {Card.CARD_SOUL_APOLLYON, "Soul of Apollyon"}, {Card.CARD_SOUL_FORGOTTEN, "Soul of the Forgotten"}, {Card.CARD_SOUL_BETHANY, "Soul of Bethany"}, {Card.CARD_SOUL_JACOB, "Soul of Jacob and Esau"}})
|
|
5
|
-
return ____exports
|