isaacscript-common 1.2.64 → 1.2.67
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/constants.d.ts +1 -0
- package/dist/constants.lua +1 -0
- package/dist/features/deployJSONRoom.lua +14 -16
- package/dist/functions/collectibleCacheFlag.lua +5 -7
- package/dist/functions/collectibleSet.lua +6 -8
- package/dist/functions/doors.d.ts +15 -0
- package/dist/functions/doors.lua +36 -3
- package/dist/functions/gridEntity.lua +13 -16
- package/dist/functions/pocketItems.lua +22 -24
- package/dist/functions/rooms.lua +10 -11
- package/dist/functions/transformations.lua +21 -23
- package/dist/functions/trinketCacheFlag.lua +5 -7
- package/dist/types/DefaultMap.d.ts +2 -3
- package/dist/types/PocketItemDescription.d.ts +2 -2
- package/package.json +1 -1
package/dist/constants.d.ts
CHANGED
|
@@ -102,6 +102,7 @@ export declare const MAX_PLAYER_TRINKET_SLOTS = 2;
|
|
|
102
102
|
export declare const MAX_ROOM_INDEX = 168;
|
|
103
103
|
export declare const MAX_VANILLA_CHARACTER = PlayerType.PLAYER_THESOUL_B;
|
|
104
104
|
export declare const MAX_VANILLA_COLLECTIBLE_TYPE = CollectibleType.COLLECTIBLE_MOMS_RING;
|
|
105
|
+
export declare const NUM_DIMENSIONS = 3;
|
|
105
106
|
export declare const SECOND_IN_MILLISECONDS = 1000;
|
|
106
107
|
export declare const MINUTE_IN_MILLISECONDS: number;
|
|
107
108
|
export declare const ONE_BY_ONE_ROOM_GRID_SIZE = 135;
|
package/dist/constants.lua
CHANGED
|
@@ -88,6 +88,7 @@ ____exports.MAX_PLAYER_TRINKET_SLOTS = 2
|
|
|
88
88
|
____exports.MAX_ROOM_INDEX = 168
|
|
89
89
|
____exports.MAX_VANILLA_CHARACTER = PlayerType.PLAYER_THESOUL_B
|
|
90
90
|
____exports.MAX_VANILLA_COLLECTIBLE_TYPE = CollectibleType.COLLECTIBLE_MOMS_RING
|
|
91
|
+
____exports.NUM_DIMENSIONS = 3
|
|
91
92
|
____exports.SECOND_IN_MILLISECONDS = 1000
|
|
92
93
|
____exports.MINUTE_IN_MILLISECONDS = 60 * ____exports.SECOND_IN_MILLISECONDS
|
|
93
94
|
____exports.ONE_BY_ONE_ROOM_GRID_SIZE = 135
|
|
@@ -23,6 +23,8 @@ local ____jsonRoom = require("functions.jsonRoom")
|
|
|
23
23
|
local getRandomJSONRoom = ____jsonRoom.getRandomJSONRoom
|
|
24
24
|
local ____log = require("functions.log")
|
|
25
25
|
local log = ____log.log
|
|
26
|
+
local ____math = require("functions.math")
|
|
27
|
+
local range = ____math.range
|
|
26
28
|
local ____npc = require("functions.npc")
|
|
27
29
|
local getNPCs = ____npc.getNPCs
|
|
28
30
|
local ____random = require("functions.random")
|
|
@@ -121,24 +123,20 @@ function fillRoomWithDecorations(self)
|
|
|
121
123
|
local gridSize = room:GetGridSize()
|
|
122
124
|
local roomListIndex = getRoomListIndex(nil)
|
|
123
125
|
local decorationGridIndexes = v.level.roomToDecorationGridIndexesMap:getAndSetDefault(roomListIndex)
|
|
124
|
-
do
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if decoration ~= nil then
|
|
135
|
-
setGridEntityInvisible(nil, decoration)
|
|
136
|
-
end
|
|
137
|
-
__TS__ArrayPush(decorationGridIndexes, gridIndex)
|
|
126
|
+
for ____, gridIndex in ipairs(range(nil, 0, gridSize - 1)) do
|
|
127
|
+
do
|
|
128
|
+
local existingGridEntity = room:GetGridEntity(gridIndex)
|
|
129
|
+
if existingGridEntity ~= nil then
|
|
130
|
+
goto __continue33
|
|
131
|
+
end
|
|
132
|
+
local position = room:GetGridPosition(gridIndex)
|
|
133
|
+
local decoration = Isaac.GridSpawn(GridEntityType.GRID_DECORATION, 0, position, true)
|
|
134
|
+
if decoration ~= nil then
|
|
135
|
+
setGridEntityInvisible(nil, decoration)
|
|
138
136
|
end
|
|
139
|
-
|
|
140
|
-
gridIndex = gridIndex + 1
|
|
137
|
+
__TS__ArrayPush(decorationGridIndexes, gridIndex)
|
|
141
138
|
end
|
|
139
|
+
::__continue33::
|
|
142
140
|
end
|
|
143
141
|
end
|
|
144
142
|
function spawnAllEntities(self, jsonRoom, seed, verbose)
|
|
@@ -9,6 +9,8 @@ local ____exports = {}
|
|
|
9
9
|
local ____collectibles = require("functions.collectibles")
|
|
10
10
|
local collectibleHasCacheFlag = ____collectibles.collectibleHasCacheFlag
|
|
11
11
|
local getMaxCollectibleID = ____collectibles.getMaxCollectibleID
|
|
12
|
+
local ____math = require("functions.math")
|
|
13
|
+
local range = ____math.range
|
|
12
14
|
local ____set = require("functions.set")
|
|
13
15
|
local copySet = ____set.copySet
|
|
14
16
|
local ____utils = require("functions.utils")
|
|
@@ -18,13 +20,9 @@ local function initCacheFlagMap(self)
|
|
|
18
20
|
local maxCollectibleID = getMaxCollectibleID(nil)
|
|
19
21
|
for ____, cacheFlag in ipairs(getEnumValues(nil, CacheFlag)) do
|
|
20
22
|
local collectiblesSet = __TS__New(Set)
|
|
21
|
-
do
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if collectibleHasCacheFlag(nil, collectibleType, cacheFlag) then
|
|
25
|
-
collectiblesSet:add(collectibleType)
|
|
26
|
-
end
|
|
27
|
-
collectibleType = collectibleType + 1
|
|
23
|
+
for ____, collectibleType in ipairs(range(nil, 1, maxCollectibleID)) do
|
|
24
|
+
if collectibleHasCacheFlag(nil, collectibleType, cacheFlag) then
|
|
25
|
+
collectiblesSet:add(collectibleType)
|
|
28
26
|
end
|
|
29
27
|
end
|
|
30
28
|
CACHE_FLAG_TO_COLLECTIBLES_MAP:set(cacheFlag, collectiblesSet)
|
|
@@ -5,20 +5,18 @@ local __TS__New = ____lualib.__TS__New
|
|
|
5
5
|
local ____exports = {}
|
|
6
6
|
local ____collectibles = require("functions.collectibles")
|
|
7
7
|
local getMaxCollectibleID = ____collectibles.getMaxCollectibleID
|
|
8
|
+
local ____math = require("functions.math")
|
|
9
|
+
local range = ____math.range
|
|
8
10
|
local ____set = require("functions.set")
|
|
9
11
|
local copySet = ____set.copySet
|
|
10
12
|
local COLLECTIBLE_SET = __TS__New(Set)
|
|
11
13
|
local function initCollectibleSet(self)
|
|
12
14
|
local itemConfig = Isaac.GetItemConfig()
|
|
13
15
|
local maxCollectibleID = getMaxCollectibleID(nil)
|
|
14
|
-
do
|
|
15
|
-
local
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if itemConfigItem ~= nil then
|
|
19
|
-
COLLECTIBLE_SET:add(collectibleType)
|
|
20
|
-
end
|
|
21
|
-
collectibleType = collectibleType + 1
|
|
16
|
+
for ____, collectibleType in ipairs(range(nil, 1, maxCollectibleID)) do
|
|
17
|
+
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
18
|
+
if itemConfigItem ~= nil then
|
|
19
|
+
COLLECTIBLE_SET:add(collectibleType)
|
|
22
20
|
end
|
|
23
21
|
end
|
|
24
22
|
end
|
|
@@ -11,6 +11,13 @@ export declare function closeDoorFast(door: GridEntityDoor): void;
|
|
|
11
11
|
* room types.
|
|
12
12
|
*/
|
|
13
13
|
export declare function getDoors(...roomTypes: RoomType[]): GridEntityDoor[];
|
|
14
|
+
/**
|
|
15
|
+
* Helper function to get all of the doors in the room that lead to the provided room index.
|
|
16
|
+
*
|
|
17
|
+
* This function is variadic, meaning that you can specify N arguments to return all of the doors
|
|
18
|
+
* that match any of the N room grid indexes.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getDoorsToRoomIndex(...roomGridIndex: int[]): GridEntityDoor[];
|
|
14
21
|
export declare function getAngelRoomDoor(): GridEntityDoor | undefined;
|
|
15
22
|
export declare function getDevilRoomDoor(): GridEntityDoor | undefined;
|
|
16
23
|
/**
|
|
@@ -73,3 +80,11 @@ export declare function openAllDoors(): void;
|
|
|
73
80
|
* an animation.
|
|
74
81
|
*/
|
|
75
82
|
export declare function openDoorFast(door: GridEntityDoor): void;
|
|
83
|
+
/**
|
|
84
|
+
* Helper function to remove all of the doors in the room. By default, it will remove every door.
|
|
85
|
+
* You can optionally specify one or more room types to remove only the doors that match the
|
|
86
|
+
* specified room types.
|
|
87
|
+
*
|
|
88
|
+
* @returns The number of doors removed.
|
|
89
|
+
*/
|
|
90
|
+
export declare function removeAllDoors(...roomTypes: RoomType[]): int;
|
package/dist/functions/doors.lua
CHANGED
|
@@ -3,6 +3,7 @@ local ____lualib = require("lualib_bundle")
|
|
|
3
3
|
local Set = ____lualib.Set
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
6
|
+
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
6
7
|
local __TS__ArrayFind = ____lualib.__TS__ArrayFind
|
|
7
8
|
local ____exports = {}
|
|
8
9
|
local ____constants = require("constants")
|
|
@@ -21,9 +22,7 @@ function ____exports.getDoors(self, ...)
|
|
|
21
22
|
if door == nil then
|
|
22
23
|
goto __continue7
|
|
23
24
|
end
|
|
24
|
-
if #roomTypes == 0 then
|
|
25
|
-
__TS__ArrayPush(doors, door)
|
|
26
|
-
elseif roomTypesSet:has(door.TargetRoomType) then
|
|
25
|
+
if #roomTypes == 0 or roomTypesSet:has(door.TargetRoomType) then
|
|
27
26
|
__TS__ArrayPush(doors, door)
|
|
28
27
|
end
|
|
29
28
|
end
|
|
@@ -51,6 +50,15 @@ function ____exports.closeDoorFast(self, door)
|
|
|
51
50
|
local sprite = door:GetSprite()
|
|
52
51
|
sprite:Play("Closed", true)
|
|
53
52
|
end
|
|
53
|
+
function ____exports.getDoorsToRoomIndex(self, ...)
|
|
54
|
+
local roomGridIndex = {...}
|
|
55
|
+
local roomGridIndexesSet = __TS__New(Set, roomGridIndex)
|
|
56
|
+
local doors = ____exports.getDoors(nil)
|
|
57
|
+
return __TS__ArrayFilter(
|
|
58
|
+
doors,
|
|
59
|
+
function(____, door) return roomGridIndexesSet:has(door.TargetRoomIndex) end
|
|
60
|
+
)
|
|
61
|
+
end
|
|
54
62
|
function ____exports.getAngelRoomDoor(self)
|
|
55
63
|
local angelRoomDoors = ____exports.getDoors(nil, RoomType.ROOM_ANGEL)
|
|
56
64
|
local ____temp_0
|
|
@@ -158,4 +166,29 @@ function ____exports.openDoorFast(self, door)
|
|
|
158
166
|
local sprite = door:GetSprite()
|
|
159
167
|
sprite:Play("Opened", true)
|
|
160
168
|
end
|
|
169
|
+
function ____exports.removeAllDoors(self, ...)
|
|
170
|
+
local roomTypes = {...}
|
|
171
|
+
local game = Game()
|
|
172
|
+
local room = game:GetRoom()
|
|
173
|
+
local roomTypesSet = __TS__New(Set, roomTypes)
|
|
174
|
+
local numDoorsRemoved = 0
|
|
175
|
+
do
|
|
176
|
+
local i = 0
|
|
177
|
+
while i < MAX_NUM_DOORS do
|
|
178
|
+
do
|
|
179
|
+
local door = room:GetDoor(i)
|
|
180
|
+
if door == nil then
|
|
181
|
+
goto __continue38
|
|
182
|
+
end
|
|
183
|
+
if #roomTypes == 0 or roomTypesSet:has(door.TargetRoomType) then
|
|
184
|
+
room:RemoveDoor(i)
|
|
185
|
+
numDoorsRemoved = numDoorsRemoved + 1
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
::__continue38::
|
|
189
|
+
i = i + 1
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
return numDoorsRemoved
|
|
193
|
+
end
|
|
161
194
|
return ____exports
|
|
@@ -15,6 +15,7 @@ local DEFAULT_TOP_LEFT_WALL_GRID_INDEX = ____roomShapeToTopLeftWallGridIndexMap.
|
|
|
15
15
|
local ROOM_SHAPE_TO_TOP_LEFT_WALL_GRID_INDEX_MAP = ____roomShapeToTopLeftWallGridIndexMap.ROOM_SHAPE_TO_TOP_LEFT_WALL_GRID_INDEX_MAP
|
|
16
16
|
local ____math = require("functions.math")
|
|
17
17
|
local isCircleIntersectingRectangle = ____math.isCircleIntersectingRectangle
|
|
18
|
+
local range = ____math.range
|
|
18
19
|
local ____rooms = require("functions.rooms")
|
|
19
20
|
local roomUpdateSafe = ____rooms.roomUpdateSafe
|
|
20
21
|
local ____sprite = require("functions.sprite")
|
|
@@ -101,26 +102,22 @@ function ____exports.getGridEntities(self, ...)
|
|
|
101
102
|
local gridSize = room:GetGridSize()
|
|
102
103
|
local gridEntityTypesSet = __TS__New(Set, gridEntityTypes)
|
|
103
104
|
local gridEntities = {}
|
|
104
|
-
do
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
105
|
+
for ____, gridIndex in ipairs(range(nil, 0, gridSize - 1)) do
|
|
106
|
+
do
|
|
107
|
+
local gridEntity = room:GetGridEntity(gridIndex)
|
|
108
|
+
if gridEntity == nil then
|
|
109
|
+
goto __continue10
|
|
110
|
+
end
|
|
111
|
+
if #gridEntityTypes == 0 then
|
|
112
|
+
__TS__ArrayPush(gridEntities, gridEntity)
|
|
113
|
+
else
|
|
114
|
+
local thisGridEntityType = gridEntity:GetType()
|
|
115
|
+
if gridEntityTypesSet:has(thisGridEntityType) then
|
|
113
116
|
__TS__ArrayPush(gridEntities, gridEntity)
|
|
114
|
-
else
|
|
115
|
-
local thisGridEntityType = gridEntity:GetType()
|
|
116
|
-
if gridEntityTypesSet:has(thisGridEntityType) then
|
|
117
|
-
__TS__ArrayPush(gridEntities, gridEntity)
|
|
118
|
-
end
|
|
119
117
|
end
|
|
120
118
|
end
|
|
121
|
-
::__continue10::
|
|
122
|
-
gridIndex = gridIndex + 1
|
|
123
119
|
end
|
|
120
|
+
::__continue10::
|
|
124
121
|
end
|
|
125
122
|
return gridEntities
|
|
126
123
|
end
|
|
@@ -8,6 +8,8 @@ local ____constants = require("constants")
|
|
|
8
8
|
local MAX_PLAYER_POCKET_ITEM_SLOTS = ____constants.MAX_PLAYER_POCKET_ITEM_SLOTS
|
|
9
9
|
local ____PocketItemType = require("types.PocketItemType")
|
|
10
10
|
local PocketItemType = ____PocketItemType.PocketItemType
|
|
11
|
+
local ____math = require("functions.math")
|
|
12
|
+
local range = ____math.range
|
|
11
13
|
function ____exports.getPocketItems(self, player)
|
|
12
14
|
local pocketItem = player:GetActiveItem(ActiveSlot.SLOT_POCKET)
|
|
13
15
|
local hasPocketItem = pocketItem ~= CollectibleType.COLLECTIBLE_NULL
|
|
@@ -17,30 +19,26 @@ function ____exports.getPocketItems(self, player)
|
|
|
17
19
|
local pocketItems = {}
|
|
18
20
|
local pocketItemIdentified = false
|
|
19
21
|
local pocketItem2Identified = false
|
|
20
|
-
do
|
|
21
|
-
local
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if slot + 1 == maxPocketItems then
|
|
41
|
-
break
|
|
42
|
-
end
|
|
43
|
-
slot = slot + 1
|
|
22
|
+
for ____, slot in ipairs(range(nil, 0, MAX_PLAYER_POCKET_ITEM_SLOTS - 1)) do
|
|
23
|
+
local card = player:GetCard(slot)
|
|
24
|
+
local pillColor = player:GetPill(slot)
|
|
25
|
+
if card ~= Card.CARD_NULL then
|
|
26
|
+
__TS__ArrayPush(pocketItems, {slot = slot, type = PocketItemType.CARD, subType = card})
|
|
27
|
+
elseif pillColor ~= PillColor.PILL_NULL then
|
|
28
|
+
__TS__ArrayPush(pocketItems, {slot = slot, type = PocketItemType.PILL, subType = pillColor})
|
|
29
|
+
elseif hasPocketItem and not hasPocketItem2 and not pocketItemIdentified then
|
|
30
|
+
pocketItemIdentified = true
|
|
31
|
+
__TS__ArrayPush(pocketItems, {slot = slot, type = PocketItemType.ACTIVE_ITEM, subType = pocketItem})
|
|
32
|
+
elseif not hasPocketItem and hasPocketItem2 and not pocketItem2Identified then
|
|
33
|
+
pocketItem2Identified = true
|
|
34
|
+
__TS__ArrayPush(pocketItems, {slot = slot, type = PocketItemType.DICE_BAG_DICE, subType = pocketItem2})
|
|
35
|
+
elseif hasPocketItem and hasPocketItem2 then
|
|
36
|
+
__TS__ArrayPush(pocketItems, {slot = slot, type = PocketItemType.UNDETERMINABLE, subType = 0})
|
|
37
|
+
else
|
|
38
|
+
__TS__ArrayPush(pocketItems, {slot = slot, type = PocketItemType.EMPTY, subType = 0})
|
|
39
|
+
end
|
|
40
|
+
if slot + 1 == maxPocketItems then
|
|
41
|
+
break
|
|
44
42
|
end
|
|
45
43
|
end
|
|
46
44
|
return pocketItems
|
package/dist/functions/rooms.lua
CHANGED
|
@@ -13,6 +13,7 @@ local ____constants = require("constants")
|
|
|
13
13
|
local GENESIS_ROOM_SUBTYPE = ____constants.GENESIS_ROOM_SUBTYPE
|
|
14
14
|
local GENESIS_ROOM_VARIANT = ____constants.GENESIS_ROOM_VARIANT
|
|
15
15
|
local MAX_ROOM_INDEX = ____constants.MAX_ROOM_INDEX
|
|
16
|
+
local NUM_DIMENSIONS = ____constants.NUM_DIMENSIONS
|
|
16
17
|
local ____doors = require("functions.doors")
|
|
17
18
|
local closeAllDoors = ____doors.closeAllDoors
|
|
18
19
|
local getDoors = ____doors.getDoors
|
|
@@ -26,6 +27,8 @@ local setEntityPositions = ____entity.setEntityPositions
|
|
|
26
27
|
local setEntityVelocities = ____entity.setEntityVelocities
|
|
27
28
|
local ____flag = require("functions.flag")
|
|
28
29
|
local hasFlag = ____flag.hasFlag
|
|
30
|
+
local ____math = require("functions.math")
|
|
31
|
+
local range = ____math.range
|
|
29
32
|
function ____exports.getCurrentRoomDescriptorReadOnly(self)
|
|
30
33
|
local game = Game()
|
|
31
34
|
local level = game:GetLevel()
|
|
@@ -116,15 +119,11 @@ function ____exports.getCurrentDimension(self)
|
|
|
116
119
|
local startingRoomGridIndex = level:GetStartingRoomIndex()
|
|
117
120
|
local startingRoomDesc = level:GetRoomByIdx(startingRoomGridIndex, -1)
|
|
118
121
|
local startingRoomHash = GetPtrHash(startingRoomDesc)
|
|
119
|
-
do
|
|
120
|
-
local
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if dimensionRoomHash == startingRoomHash then
|
|
125
|
-
return dimension
|
|
126
|
-
end
|
|
127
|
-
dimension = dimension + 1
|
|
122
|
+
for ____, dimension in ipairs(range(nil, 0, NUM_DIMENSIONS - 1)) do
|
|
123
|
+
local dimensionRoomDesc = level:GetRoomByIdx(startingRoomGridIndex, dimension)
|
|
124
|
+
local dimensionRoomHash = GetPtrHash(dimensionRoomDesc)
|
|
125
|
+
if dimensionRoomHash == startingRoomHash then
|
|
126
|
+
return dimension
|
|
128
127
|
end
|
|
129
128
|
end
|
|
130
129
|
return error("Failed to get the current dimension using the starting room index of: " .. tostring(startingRoomGridIndex))
|
|
@@ -298,12 +297,12 @@ function ____exports.setRoomCleared(self)
|
|
|
298
297
|
for ____, door in ipairs(getDoors(nil)) do
|
|
299
298
|
do
|
|
300
299
|
if isHiddenSecretRoomDoor(nil, door) then
|
|
301
|
-
goto
|
|
300
|
+
goto __continue56
|
|
302
301
|
end
|
|
303
302
|
openDoorFast(nil, door)
|
|
304
303
|
door.ExtraVisible = false
|
|
305
304
|
end
|
|
306
|
-
::
|
|
305
|
+
::__continue56::
|
|
307
306
|
end
|
|
308
307
|
sfx:Stop(SoundEffect.SOUND_DOOR_HEAVY_OPEN)
|
|
309
308
|
game:ShakeScreen(0)
|
|
@@ -10,6 +10,8 @@ local TRANSFORMATION_NAME_MAP = ____transformationNameMap.TRANSFORMATION_NAME_MA
|
|
|
10
10
|
local ____collectibles = require("functions.collectibles")
|
|
11
11
|
local collectibleHasTag = ____collectibles.collectibleHasTag
|
|
12
12
|
local getMaxCollectibleID = ____collectibles.getMaxCollectibleID
|
|
13
|
+
local ____math = require("functions.math")
|
|
14
|
+
local range = ____math.range
|
|
13
15
|
local ____set = require("functions.set")
|
|
14
16
|
local copySet = ____set.copySet
|
|
15
17
|
local TRANSFORMATION_TO_TAG_MAP = __TS__New(Map, {
|
|
@@ -38,31 +40,27 @@ local function initMaps(self)
|
|
|
38
40
|
__TS__New(Set)
|
|
39
41
|
)
|
|
40
42
|
end
|
|
41
|
-
do
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if not collectibleHasTag(nil, collectibleType, tag) then
|
|
49
|
-
goto __continue6
|
|
50
|
-
end
|
|
51
|
-
local collectibleTypesSet = TRANSFORMATION_TO_COLLECTIBLE_TYPES_MAP:get(playerForm)
|
|
52
|
-
if collectibleTypesSet == nil then
|
|
53
|
-
error("Failed to get the collectible types for transformation: " .. tostring(playerForm))
|
|
54
|
-
end
|
|
55
|
-
collectibleTypesSet:add(collectibleType)
|
|
56
|
-
local transformations = COLLECTIBLE_TYPE_TO_TRANSFORMATION_MAP:get(collectibleType)
|
|
57
|
-
if transformations == nil then
|
|
58
|
-
transformations = __TS__New(Set)
|
|
59
|
-
COLLECTIBLE_TYPE_TO_TRANSFORMATION_MAP:set(collectibleType, transformations)
|
|
60
|
-
end
|
|
61
|
-
transformations:add(playerForm)
|
|
43
|
+
for ____, collectibleType in ipairs(range(nil, 1, maxCollectibleID)) do
|
|
44
|
+
for ____, ____value in __TS__Iterator(TRANSFORMATION_TO_TAG_MAP:entries()) do
|
|
45
|
+
local playerForm = ____value[1]
|
|
46
|
+
local tag = ____value[2]
|
|
47
|
+
do
|
|
48
|
+
if not collectibleHasTag(nil, collectibleType, tag) then
|
|
49
|
+
goto __continue6
|
|
62
50
|
end
|
|
63
|
-
|
|
51
|
+
local collectibleTypesSet = TRANSFORMATION_TO_COLLECTIBLE_TYPES_MAP:get(playerForm)
|
|
52
|
+
if collectibleTypesSet == nil then
|
|
53
|
+
error("Failed to get the collectible types for transformation: " .. tostring(playerForm))
|
|
54
|
+
end
|
|
55
|
+
collectibleTypesSet:add(collectibleType)
|
|
56
|
+
local transformations = COLLECTIBLE_TYPE_TO_TRANSFORMATION_MAP:get(collectibleType)
|
|
57
|
+
if transformations == nil then
|
|
58
|
+
transformations = __TS__New(Set)
|
|
59
|
+
COLLECTIBLE_TYPE_TO_TRANSFORMATION_MAP:set(collectibleType, transformations)
|
|
60
|
+
end
|
|
61
|
+
transformations:add(playerForm)
|
|
64
62
|
end
|
|
65
|
-
|
|
63
|
+
::__continue6::
|
|
66
64
|
end
|
|
67
65
|
end
|
|
68
66
|
end
|
|
@@ -5,6 +5,8 @@ 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 ____math = require("functions.math")
|
|
9
|
+
local range = ____math.range
|
|
8
10
|
local ____set = require("functions.set")
|
|
9
11
|
local copySet = ____set.copySet
|
|
10
12
|
local ____trinkets = require("functions.trinkets")
|
|
@@ -17,13 +19,9 @@ local function initCacheFlagMap(self)
|
|
|
17
19
|
local maxTrinketID = getMaxTrinketID(nil)
|
|
18
20
|
for ____, cacheFlag in ipairs(getEnumValues(nil, CacheFlag)) do
|
|
19
21
|
local trinketsSet = __TS__New(Set)
|
|
20
|
-
do
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if trinketHasCacheFlag(nil, trinketType, cacheFlag) then
|
|
24
|
-
trinketsSet:add(trinketType)
|
|
25
|
-
end
|
|
26
|
-
trinketType = trinketType + 1
|
|
22
|
+
for ____, trinketType in ipairs(range(nil, 1, maxTrinketID)) do
|
|
23
|
+
if trinketHasCacheFlag(nil, trinketType, cacheFlag) then
|
|
24
|
+
trinketsSet:add(trinketType)
|
|
27
25
|
end
|
|
28
26
|
end
|
|
29
27
|
CACHE_FLAG_TO_TRINKETS_MAP:set(cacheFlag, trinketsSet)
|
|
@@ -43,9 +43,8 @@ declare type SecondArg<K, V, A extends unknown[]> = V | FactoryFunction<K, V, A>
|
|
|
43
43
|
* first:
|
|
44
44
|
*
|
|
45
45
|
* ```ts
|
|
46
|
-
* const
|
|
47
|
-
*
|
|
48
|
-
* })
|
|
46
|
+
* const factoryFunction = (_key: string, arg2: boolean) => arg2 ? 0 : 1;
|
|
47
|
+
* const defaultMapWithExtraArgs = new DefaultMap<string, string, [arg2: boolean]>(factoryFunction);
|
|
49
48
|
* ```
|
|
50
49
|
*/
|
|
51
50
|
export declare class DefaultMap<K, V, A extends unknown[] = []> extends Map<K, V> {
|