isaacscript-common 1.0.598 → 1.0.602
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/preBerserkDeath.lua +3 -1
- 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/constants.d.ts +1 -0
- package/dist/constants.lua +1 -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/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 +8 -1
- package/dist/functions/player.lua +49 -42
- 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/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
|
@@ -2,57 +2,66 @@
|
|
|
2
2
|
require("lualib_bundle");
|
|
3
3
|
local ____exports = {}
|
|
4
4
|
local getTotalWeightOfJSONRooms, getJSONRoomWithChosenWeight
|
|
5
|
+
local ____array = require("functions.array")
|
|
6
|
+
local arraySum = ____array.arraySum
|
|
5
7
|
local ____log = require("functions.log")
|
|
6
8
|
local log = ____log.log
|
|
7
9
|
local ____random = require("functions.random")
|
|
8
10
|
local getRandomFloat = ____random.getRandomFloat
|
|
9
11
|
function getTotalWeightOfJSONRooms(self, jsonRooms)
|
|
10
|
-
local
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
local weights = __TS__ArrayMap(
|
|
13
|
+
jsonRooms,
|
|
14
|
+
function(____, jsonRoom)
|
|
15
|
+
local roomWeightString = jsonRoom["$"].weight
|
|
16
|
+
local roomWeight = tonumber(roomWeightString)
|
|
17
|
+
if roomWeight == nil then
|
|
18
|
+
error(("Failed to parse the weight of a JSON room: " .. roomWeightString) .. ".")
|
|
19
|
+
end
|
|
20
|
+
return roomWeight
|
|
16
21
|
end
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return totalWeight
|
|
22
|
+
)
|
|
23
|
+
return arraySum(nil, weights)
|
|
20
24
|
end
|
|
21
25
|
function getJSONRoomWithChosenWeight(self, jsonRooms, chosenWeight)
|
|
22
26
|
for ____, jsonRoom in ipairs(jsonRooms) do
|
|
23
27
|
local roomWeightString = jsonRoom["$"].weight
|
|
24
28
|
local roomWeight = tonumber(roomWeightString)
|
|
25
29
|
if roomWeight == nil then
|
|
26
|
-
error("Failed to parse the weight of a room: " .. roomWeightString)
|
|
30
|
+
error("Failed to parse the weight of a JSON room: " .. roomWeightString)
|
|
27
31
|
end
|
|
28
32
|
if chosenWeight < roomWeight then
|
|
29
33
|
return jsonRoom
|
|
30
34
|
end
|
|
31
35
|
chosenWeight = chosenWeight - roomWeight
|
|
32
36
|
end
|
|
33
|
-
error("Failed to get a room with chosen weight: " .. tostring(chosenWeight))
|
|
34
|
-
return jsonRooms[1]
|
|
37
|
+
return error("Failed to get a JSON room with chosen weight: " .. tostring(chosenWeight))
|
|
35
38
|
end
|
|
36
39
|
function ____exports.getJSONRoomOfVariant(self, jsonRooms, variant)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
local jsonRoomsOfVariant = __TS__ArrayFilter(
|
|
41
|
+
jsonRooms,
|
|
42
|
+
function(____, jsonRoom)
|
|
43
|
+
local roomVariantString = jsonRoom["$"].variant
|
|
44
|
+
local roomVariant = tonumber(roomVariantString)
|
|
45
|
+
return roomVariant == variant
|
|
42
46
|
end
|
|
47
|
+
)
|
|
48
|
+
if #jsonRoomsOfVariant == 0 then
|
|
49
|
+
return nil
|
|
50
|
+
end
|
|
51
|
+
if #jsonRoomsOfVariant == 1 then
|
|
52
|
+
return jsonRoomsOfVariant[1]
|
|
43
53
|
end
|
|
44
|
-
return
|
|
54
|
+
return error(((("Found " .. tostring(#jsonRoomsOfVariant)) .. " JSON rooms with a variant of ") .. tostring(variant)) .. ", when there should only be 1.")
|
|
45
55
|
end
|
|
46
56
|
function ____exports.getJSONRoomsOfSubType(self, jsonRooms, subType)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
57
|
+
return __TS__ArrayFilter(
|
|
58
|
+
jsonRooms,
|
|
59
|
+
function(____, jsonRoom)
|
|
60
|
+
local roomSubTypeString = jsonRoom["$"].subtype
|
|
61
|
+
local roomSubType = tonumber(roomSubTypeString)
|
|
62
|
+
return roomSubType == subType
|
|
53
63
|
end
|
|
54
|
-
|
|
55
|
-
return jsonRoomsOfSubType
|
|
64
|
+
)
|
|
56
65
|
end
|
|
57
66
|
function ____exports.getRandomJSONRoom(self, jsonRooms, seed, verbose)
|
|
58
67
|
if seed == nil then
|
|
@@ -67,7 +76,7 @@ function ____exports.getRandomJSONRoom(self, jsonRooms, seed, verbose)
|
|
|
67
76
|
end
|
|
68
77
|
local chosenWeight = getRandomFloat(nil, 0, totalWeight, seed)
|
|
69
78
|
if verbose then
|
|
70
|
-
log("Randomly chose weight: " .. tostring(chosenWeight))
|
|
79
|
+
log("Randomly chose weight for JSON room: " .. tostring(chosenWeight))
|
|
71
80
|
end
|
|
72
81
|
return getJSONRoomWithChosenWeight(nil, jsonRooms, chosenWeight)
|
|
73
82
|
end
|
package/dist/functions/log.d.ts
CHANGED
|
@@ -24,15 +24,15 @@ export declare function logAllGameStateFlags(this: void): void;
|
|
|
24
24
|
* Helper function for printing out every projectile flag that is turned on. Helpful when debugging.
|
|
25
25
|
*/
|
|
26
26
|
export declare function logAllProjectileFlags(this: void, flags: int): void;
|
|
27
|
-
/** Helper function for printing out every use flag that is turned on. Helpful when debugging. */
|
|
28
|
-
export declare function logAllTearFlags(this: void, flags: int): void;
|
|
29
|
-
/** Helper function for printing out every use flag that is turned on. Helpful when debugging. */
|
|
30
|
-
export declare function logAllUseFlags(this: void, flags: int): void;
|
|
31
27
|
/**
|
|
32
28
|
* Helper function for printing out every seed effect (i.e. Easter Egg) that is turned on for the
|
|
33
29
|
* particular run.
|
|
34
30
|
*/
|
|
35
31
|
export declare function logAllSeedEffects(this: void): void;
|
|
32
|
+
/** Helper function for printing out every use flag that is turned on. Helpful when debugging. */
|
|
33
|
+
export declare function logAllTearFlags(this: void, flags: int): void;
|
|
34
|
+
/** Helper function for printing out every use flag that is turned on. Helpful when debugging. */
|
|
35
|
+
export declare function logAllUseFlags(this: void, flags: int): void;
|
|
36
36
|
export declare function logArray<T>(this: void, array: T[]): void;
|
|
37
37
|
export declare function logColor(this: void, color: Color): void;
|
|
38
38
|
export declare function logEntity(this: void, entity: Entity): void;
|
package/dist/functions/log.lua
CHANGED
|
@@ -38,11 +38,9 @@ function ____exports.logAllFlags(flags, flagEnum, description)
|
|
|
38
38
|
____exports.log(("Logging all " .. description) .. "flags:")
|
|
39
39
|
local hasNoFlags = true
|
|
40
40
|
local i = 1
|
|
41
|
-
for
|
|
42
|
-
local key = ____value[1]
|
|
43
|
-
local value = ____value[2]
|
|
41
|
+
for key, value in pairs(flagEnum) do
|
|
44
42
|
if hasFlag(nil, flags, value) then
|
|
45
|
-
____exports.log((((((" " .. tostring(i)) .. ") Has flag: ") .. key) .. " (") .. tostring(value)) .. ")")
|
|
43
|
+
____exports.log((((((" " .. tostring(i)) .. ") Has flag: ") .. tostring(key)) .. " (") .. tostring(value)) .. ")")
|
|
46
44
|
hasNoFlags = false
|
|
47
45
|
end
|
|
48
46
|
i = i + 1
|
|
@@ -62,9 +60,7 @@ function ____exports.logAllGameStateFlags()
|
|
|
62
60
|
____exports.log("Logging all game state flags:")
|
|
63
61
|
local hasNoFlags = true
|
|
64
62
|
local i = 1
|
|
65
|
-
for
|
|
66
|
-
local key = ____value[1]
|
|
67
|
-
local value = ____value[2]
|
|
63
|
+
for key, value in pairs(GameStateFlag) do
|
|
68
64
|
local gameStateFlag = value
|
|
69
65
|
local flagValue = game:GetStateFlag(gameStateFlag)
|
|
70
66
|
if flagValue then
|
|
@@ -80,21 +76,13 @@ end
|
|
|
80
76
|
function ____exports.logAllProjectileFlags(flags)
|
|
81
77
|
____exports.logAllFlags(flags, ProjectileFlags, "projectile")
|
|
82
78
|
end
|
|
83
|
-
function ____exports.logAllTearFlags(flags)
|
|
84
|
-
____exports.logAllFlags(flags, TearFlags, "tear")
|
|
85
|
-
end
|
|
86
|
-
function ____exports.logAllUseFlags(flags)
|
|
87
|
-
____exports.logAllFlags(flags, UseFlag, "use")
|
|
88
|
-
end
|
|
89
79
|
function ____exports.logAllSeedEffects()
|
|
90
80
|
local game = Game()
|
|
91
81
|
local seeds = game:GetSeeds()
|
|
92
82
|
____exports.log("Logging all seed effects:")
|
|
93
83
|
local hasNoSeedEffects = true
|
|
94
84
|
local i = 1
|
|
95
|
-
for
|
|
96
|
-
local key = ____value[1]
|
|
97
|
-
local value = ____value[2]
|
|
85
|
+
for key, value in pairs(SeedEffect) do
|
|
98
86
|
local seedEffect = value
|
|
99
87
|
if seeds:HasSeedEffect(seedEffect) then
|
|
100
88
|
____exports.log((((((" " .. tostring(i)) .. ") ") .. key) .. " (") .. tostring(value)) .. ")")
|
|
@@ -106,6 +94,12 @@ function ____exports.logAllSeedEffects()
|
|
|
106
94
|
____exports.log(" n/a (no seed effects)")
|
|
107
95
|
end
|
|
108
96
|
end
|
|
97
|
+
function ____exports.logAllTearFlags(flags)
|
|
98
|
+
____exports.logAllFlags(flags, TearFlags, "tear")
|
|
99
|
+
end
|
|
100
|
+
function ____exports.logAllUseFlags(flags)
|
|
101
|
+
____exports.logAllFlags(flags, UseFlag, "use")
|
|
102
|
+
end
|
|
109
103
|
function ____exports.logArray(array)
|
|
110
104
|
local arrayString = arrayToString(nil, array)
|
|
111
105
|
____exports.log("Array: " .. arrayString)
|
|
@@ -148,7 +142,7 @@ function ____exports.logTemporaryEffects(player)
|
|
|
148
142
|
do
|
|
149
143
|
local effect = effectsList:Get(i)
|
|
150
144
|
if effect == nil then
|
|
151
|
-
goto
|
|
145
|
+
goto __continue36
|
|
152
146
|
end
|
|
153
147
|
if effect.Item:IsCollectible() then
|
|
154
148
|
local collectibleName = getCollectibleName(nil, effect.Item.ID)
|
|
@@ -162,7 +156,7 @@ function ____exports.logTemporaryEffects(player)
|
|
|
162
156
|
____exports.log(((" " .. tostring(i + 1)) .. ") Unknown type of temporary effect: ") .. tostring(effect.Item.ID))
|
|
163
157
|
end
|
|
164
158
|
end
|
|
165
|
-
::
|
|
159
|
+
::__continue36::
|
|
166
160
|
i = i + 1
|
|
167
161
|
end
|
|
168
162
|
end
|
|
@@ -185,6 +179,8 @@ function ____exports.setLogFunctionsGlobal(self)
|
|
|
185
179
|
globals.logAllFlags = ____exports.logAllFlags
|
|
186
180
|
globals.logAllGameStateFlags = ____exports.logAllGameStateFlags
|
|
187
181
|
globals.logAllProjectileFlags = ____exports.logAllProjectileFlags
|
|
182
|
+
globals.logAllSeedEffects = ____exports.logAllSeedEffects
|
|
183
|
+
globals.logAllTearFlags = ____exports.logAllTearFlags
|
|
188
184
|
globals.logAllUseFlags = ____exports.logAllUseFlags
|
|
189
185
|
globals.logArray = ____exports.logArray
|
|
190
186
|
globals.logColor = ____exports.logColor
|
|
@@ -192,6 +188,7 @@ function ____exports.setLogFunctionsGlobal(self)
|
|
|
192
188
|
globals.logKColor = ____exports.logKColor
|
|
193
189
|
globals.logMap = ____exports.logMap
|
|
194
190
|
globals.logTable = ____exports.logTable
|
|
191
|
+
globals.logTemporaryEffects = ____exports.logTemporaryEffects
|
|
195
192
|
globals.logSet = ____exports.logSet
|
|
196
193
|
globals.logVector = ____exports.logVector
|
|
197
194
|
end
|
package/dist/functions/npc.lua
CHANGED
|
@@ -9,14 +9,12 @@ local getEntities = ____entity.getEntities
|
|
|
9
9
|
local getFilteredNewEntities = ____entity.getFilteredNewEntities
|
|
10
10
|
local getProjectiles = ____entity.getProjectiles
|
|
11
11
|
local removeEntities = ____entity.removeEntities
|
|
12
|
-
function ____exports.
|
|
13
|
-
local
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
end
|
|
19
|
-
return bosses
|
|
12
|
+
function ____exports.getAliveNPCs(self)
|
|
13
|
+
local npcs = ____exports.getNPCs(nil)
|
|
14
|
+
return __TS__ArrayFilter(
|
|
15
|
+
npcs,
|
|
16
|
+
function(____, npc) return not npc:IsDead() and not ____exports.isAliveExceptionNPC(nil, npc) end
|
|
17
|
+
)
|
|
20
18
|
end
|
|
21
19
|
function ____exports.getNPCs(self, matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
|
|
22
20
|
if ignoreFriendly == nil then
|
|
@@ -92,22 +90,18 @@ function ____exports.fireProjectiles(self, npc, position, velocity, projectilesM
|
|
|
92
90
|
return getFilteredNewEntities(nil, oldProjectiles, newProjectiles)
|
|
93
91
|
end
|
|
94
92
|
function ____exports.getAliveBosses(self)
|
|
95
|
-
local
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
end
|
|
101
|
-
return aliveBosses
|
|
93
|
+
local aliveNPCs = ____exports.getAliveNPCs(nil)
|
|
94
|
+
return __TS__ArrayFilter(
|
|
95
|
+
aliveNPCs,
|
|
96
|
+
function(____, aliveNPC) return aliveNPC:IsBoss() end
|
|
97
|
+
)
|
|
102
98
|
end
|
|
103
|
-
function ____exports.
|
|
104
|
-
local
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
end
|
|
110
|
-
return aliveNPCs
|
|
99
|
+
function ____exports.getBosses(self)
|
|
100
|
+
local npcs = ____exports.getNPCs(nil)
|
|
101
|
+
return __TS__ArrayFilter(
|
|
102
|
+
npcs,
|
|
103
|
+
function(____, npc) return npc:IsBoss() end
|
|
104
|
+
)
|
|
111
105
|
end
|
|
112
106
|
function ____exports.removeAllNPCs(self, cap)
|
|
113
107
|
local npcs = ____exports.getNPCs(nil)
|
|
@@ -25,7 +25,7 @@ export declare function anyPlayerHasTrinket(trinketType: TrinketType | int): boo
|
|
|
25
25
|
* This function is variadic, meaning that you can supply as many characters as you want to check
|
|
26
26
|
* for. Returns true if any of the characters supplied are present.
|
|
27
27
|
*/
|
|
28
|
-
export declare function anyPlayerIs(...
|
|
28
|
+
export declare function anyPlayerIs(...matchingCharacters: PlayerType[]): boolean;
|
|
29
29
|
/**
|
|
30
30
|
* Helper function to determine if the provided character can have red heart containers. Returns
|
|
31
31
|
* true for characters like Isaac, Magdalene, or Cain. Returns true for Keeper and Tainted Keeper,
|
|
@@ -83,6 +83,8 @@ export declare function getPlayerAvailableHeartSlots(player: EntityPlayer): int;
|
|
|
83
83
|
* Kiss; use the `getPlayerMaxHeartContainers()` function for that.
|
|
84
84
|
*/
|
|
85
85
|
export declare function getCharacterMaxHeartContainers(character: PlayerType): int;
|
|
86
|
+
/** Helper function to get an array containing the characters of all of the current players. */
|
|
87
|
+
export declare function getCharacters(): number[];
|
|
86
88
|
/**
|
|
87
89
|
* Iterates over all players and checks if any are close enough to the specified position.
|
|
88
90
|
*
|
|
@@ -195,6 +197,11 @@ export declare function isJacobOrEsau(player: EntityPlayer): boolean;
|
|
|
195
197
|
export declare function isKeeper(player: EntityPlayer): boolean;
|
|
196
198
|
/** Helper function for detecting when a player is The Lost or Tainted Lost. */
|
|
197
199
|
export declare function isLost(player: EntityPlayer): boolean;
|
|
200
|
+
/**
|
|
201
|
+
* Helper function for detecting when a player is one of the characters that can take free Devil
|
|
202
|
+
* Deals. (e.g. The Lost, Tainted Lost, etc.)
|
|
203
|
+
*/
|
|
204
|
+
export declare function canTakeFreeDevilDeals(player: EntityPlayer): boolean;
|
|
198
205
|
/** Helper function for detecting when a player is Tainted Lazarus or Dead Tainted Lazarus. */
|
|
199
206
|
export declare function isTaintedLazarus(player: EntityPlayer): boolean;
|
|
200
207
|
export declare function removeCollectibleCostume(player: EntityPlayer, collectibleType: CollectibleType | int): void;
|
|
@@ -4,6 +4,7 @@ local ____exports = {}
|
|
|
4
4
|
local EXCLUDED_CHARACTERS
|
|
5
5
|
local ____constants = require("constants")
|
|
6
6
|
local CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART = ____constants.CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART
|
|
7
|
+
local CHARACTERS_WITH_FREE_DEVIL_DEALS = ____constants.CHARACTERS_WITH_FREE_DEVIL_DEALS
|
|
7
8
|
local CHARACTERS_WITH_NO_RED_HEARTS = ____constants.CHARACTERS_WITH_NO_RED_HEARTS
|
|
8
9
|
local CHARACTERS_WITH_NO_SOUL_HEARTS = ____constants.CHARACTERS_WITH_NO_SOUL_HEARTS
|
|
9
10
|
local LOST_STYLE_PLAYER_TYPES = ____constants.LOST_STYLE_PLAYER_TYPES
|
|
@@ -28,6 +29,13 @@ function ____exports.getCharacterMaxHeartContainers(self, character)
|
|
|
28
29
|
end
|
|
29
30
|
return 12
|
|
30
31
|
end
|
|
32
|
+
function ____exports.getCharacters(self)
|
|
33
|
+
local players = ____exports.getPlayers(nil)
|
|
34
|
+
return __TS__ArrayMap(
|
|
35
|
+
players,
|
|
36
|
+
function(____, player) return player:GetPlayerType() end
|
|
37
|
+
)
|
|
38
|
+
end
|
|
31
39
|
function ____exports.getPlayerIndex(self, player)
|
|
32
40
|
local character = player:GetPlayerType()
|
|
33
41
|
local collectibleToUse = character == PlayerType.PLAYER_LAZARUS2_B and CollectibleType.COLLECTIBLE_INNER_EYE or CollectibleType.COLLECTIBLE_SAD_ONION
|
|
@@ -60,18 +68,18 @@ function ____exports.getPlayers(self, performExclusions)
|
|
|
60
68
|
do
|
|
61
69
|
local player = Isaac.GetPlayer(i)
|
|
62
70
|
if player == nil then
|
|
63
|
-
goto
|
|
71
|
+
goto __continue70
|
|
64
72
|
end
|
|
65
73
|
if ____exports.isChildPlayer(nil, player) then
|
|
66
|
-
goto
|
|
74
|
+
goto __continue70
|
|
67
75
|
end
|
|
68
76
|
local character = player:GetPlayerType()
|
|
69
77
|
if performExclusions and EXCLUDED_CHARACTERS:has(character) then
|
|
70
|
-
goto
|
|
78
|
+
goto __continue70
|
|
71
79
|
end
|
|
72
80
|
__TS__ArrayPush(players, player)
|
|
73
81
|
end
|
|
74
|
-
::
|
|
82
|
+
::__continue70::
|
|
75
83
|
i = i + 1
|
|
76
84
|
end
|
|
77
85
|
end
|
|
@@ -98,39 +106,34 @@ function ____exports.addTrinketCostume(self, player, trinketType)
|
|
|
98
106
|
player:AddCostume(itemConfigTrinket, false)
|
|
99
107
|
end
|
|
100
108
|
function ____exports.anyPlayerCloserThan(self, position, distance)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
return false
|
|
109
|
+
local players = ____exports.getPlayers(nil)
|
|
110
|
+
return __TS__ArraySome(
|
|
111
|
+
players,
|
|
112
|
+
function(____, player) return player.Position:Distance(position) <= distance end
|
|
113
|
+
)
|
|
107
114
|
end
|
|
108
115
|
function ____exports.anyPlayerHasCollectible(self, collectibleType)
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
return false
|
|
116
|
+
local players = ____exports.getPlayers(nil)
|
|
117
|
+
return __TS__ArraySome(
|
|
118
|
+
players,
|
|
119
|
+
function(____, player) return player:HasCollectible(collectibleType) end
|
|
120
|
+
)
|
|
115
121
|
end
|
|
116
122
|
function ____exports.anyPlayerHasTrinket(self, trinketType)
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
return false
|
|
123
|
+
local players = ____exports.getPlayers(nil)
|
|
124
|
+
return __TS__ArraySome(
|
|
125
|
+
players,
|
|
126
|
+
function(____, player) return player:HasTrinket(trinketType) end
|
|
127
|
+
)
|
|
123
128
|
end
|
|
124
129
|
function ____exports.anyPlayerIs(self, ...)
|
|
125
|
-
local
|
|
126
|
-
local
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
end
|
|
133
|
-
return false
|
|
130
|
+
local matchingCharacters = {...}
|
|
131
|
+
local matchingCharacterSet = __TS__New(Set, matchingCharacters)
|
|
132
|
+
local characters = ____exports.getCharacters(nil)
|
|
133
|
+
return __TS__ArraySome(
|
|
134
|
+
characters,
|
|
135
|
+
function(____, character) return matchingCharacterSet:has(character) end
|
|
136
|
+
)
|
|
134
137
|
end
|
|
135
138
|
function ____exports.characterCanHaveRedHearts(self, character)
|
|
136
139
|
return not CHARACTERS_WITH_NO_RED_HEARTS:has(character)
|
|
@@ -281,14 +284,14 @@ function ____exports.getPlayerIndexVanilla(self, playerToFind)
|
|
|
281
284
|
do
|
|
282
285
|
local player = Isaac.GetPlayer(i)
|
|
283
286
|
if player == nil then
|
|
284
|
-
goto
|
|
287
|
+
goto __continue62
|
|
285
288
|
end
|
|
286
289
|
local playerHash = GetPtrHash(player)
|
|
287
290
|
if playerHash == playerToFindHash then
|
|
288
291
|
return i
|
|
289
292
|
end
|
|
290
293
|
end
|
|
291
|
-
::
|
|
294
|
+
::__continue62::
|
|
292
295
|
i = i + 1
|
|
293
296
|
end
|
|
294
297
|
end
|
|
@@ -400,6 +403,10 @@ function ____exports.isLost(self, player)
|
|
|
400
403
|
local character = player:GetPlayerType()
|
|
401
404
|
return character == PlayerType.PLAYER_THELOST or character == PlayerType.PLAYER_THELOST_B
|
|
402
405
|
end
|
|
406
|
+
function ____exports.canTakeFreeDevilDeals(self, player)
|
|
407
|
+
local character = player:GetPlayerType()
|
|
408
|
+
return CHARACTERS_WITH_FREE_DEVIL_DEALS:has(character)
|
|
409
|
+
end
|
|
403
410
|
function ____exports.isTaintedLazarus(self, player)
|
|
404
411
|
local character = player:GetPlayerType()
|
|
405
412
|
return character == PlayerType.PLAYER_LAZARUS_B or character == PlayerType.PLAYER_LAZARUS2_B
|
|
@@ -445,9 +452,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
445
452
|
itemPool:RemoveCollectible(collectibleType)
|
|
446
453
|
end
|
|
447
454
|
repeat
|
|
448
|
-
local
|
|
449
|
-
local
|
|
450
|
-
if
|
|
455
|
+
local ____switch112 = activeSlot
|
|
456
|
+
local ____cond112 = ____switch112 == ActiveSlot.SLOT_PRIMARY
|
|
457
|
+
if ____cond112 then
|
|
451
458
|
do
|
|
452
459
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
453
460
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -456,8 +463,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
456
463
|
break
|
|
457
464
|
end
|
|
458
465
|
end
|
|
459
|
-
|
|
460
|
-
if
|
|
466
|
+
____cond112 = ____cond112 or ____switch112 == ActiveSlot.SLOT_SECONDARY
|
|
467
|
+
if ____cond112 then
|
|
461
468
|
do
|
|
462
469
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
463
470
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -472,16 +479,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
472
479
|
break
|
|
473
480
|
end
|
|
474
481
|
end
|
|
475
|
-
|
|
476
|
-
if
|
|
482
|
+
____cond112 = ____cond112 or ____switch112 == ActiveSlot.SLOT_POCKET
|
|
483
|
+
if ____cond112 then
|
|
477
484
|
do
|
|
478
485
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
479
486
|
player:SetActiveCharge(charge, activeSlot)
|
|
480
487
|
break
|
|
481
488
|
end
|
|
482
489
|
end
|
|
483
|
-
|
|
484
|
-
if
|
|
490
|
+
____cond112 = ____cond112 or ____switch112 == ActiveSlot.SLOT_POCKET2
|
|
491
|
+
if ____cond112 then
|
|
485
492
|
do
|
|
486
493
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
487
494
|
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()
|