isaacscript-common 2.0.13 → 2.0.14
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/subscriptions/postBombInitLate.d.ts +1 -1
- package/dist/callbacks/subscriptions/postCollectibleInitFirst.d.ts +1 -1
- package/dist/callbacks/subscriptions/postEffectInitLate.d.ts +1 -1
- package/dist/callbacks/subscriptions/postFamiliarInitLate.d.ts +1 -1
- package/dist/callbacks/subscriptions/postHolyMantleRemoved.d.ts +2 -2
- package/dist/callbacks/subscriptions/postItemDischarged.d.ts +2 -2
- package/dist/callbacks/subscriptions/postItemPickup.d.ts +1 -1
- package/dist/callbacks/subscriptions/postKnifeInitLate.d.ts +1 -1
- package/dist/callbacks/subscriptions/postLaserInitLate.d.ts +1 -1
- package/dist/callbacks/subscriptions/postNPCInitLate.d.ts +1 -1
- package/dist/callbacks/subscriptions/postNPCStateChanged.d.ts +1 -1
- package/dist/callbacks/subscriptions/postPEffectUpdateReordered.d.ts +2 -2
- package/dist/callbacks/subscriptions/postPickupCollect.d.ts +1 -1
- package/dist/callbacks/subscriptions/postPickupInitLate.d.ts +1 -1
- package/dist/callbacks/subscriptions/postPlayerChangeType.d.ts +1 -1
- package/dist/callbacks/subscriptions/postProjectileInitLate.d.ts +1 -1
- package/dist/callbacks/subscriptions/postPurchase.d.ts +1 -1
- package/dist/callbacks/subscriptions/postTearInitLate.d.ts +1 -1
- package/dist/callbacks/subscriptions/postTearInitVeryLate.d.ts +1 -1
- package/dist/callbacks/subscriptions/postTrinketBreak.d.ts +2 -2
- package/dist/callbacks/subscriptions/preItemPickup.d.ts +1 -1
- package/dist/constants.d.ts +16 -7
- package/dist/constants.lua +2 -2
- package/dist/features/characterHealthConversion.d.ts +1 -1
- package/dist/features/characterStats.d.ts +1 -1
- package/dist/features/deployJSONRoom.lua +2 -2
- package/dist/features/extraConsoleCommands/commands.d.ts +2 -0
- package/dist/features/extraConsoleCommands/commands.lua +14 -0
- package/dist/features/extraConsoleCommands/init.lua +1 -0
- package/dist/features/preventCollectibleRotate.d.ts +1 -1
- package/dist/features/sirenHelpers.d.ts +1 -1
- package/dist/functions/boss.d.ts +3 -3
- package/dist/functions/cards.d.ts +3 -3
- package/dist/functions/character.d.ts +10 -10
- package/dist/functions/collectibleCacheFlag.d.ts +2 -2
- package/dist/functions/collectibleSet.d.ts +1 -1
- package/dist/functions/collectibleTag.d.ts +3 -3
- package/dist/functions/collectibles.d.ts +15 -15
- package/dist/functions/collectibles.lua +2 -1
- package/dist/functions/entity.d.ts +7 -7
- package/dist/functions/entitySpecific.d.ts +38 -38
- package/dist/functions/familiars.lua +1 -1
- package/dist/functions/flying.d.ts +3 -3
- package/dist/functions/gridEntity.d.ts +2 -2
- package/dist/functions/gridEntity.lua +0 -4
- package/dist/functions/level.d.ts +1 -0
- package/dist/functions/level.lua +29 -0
- package/dist/functions/log.d.ts +2 -2
- package/dist/functions/npc.d.ts +1 -1
- package/dist/functions/pickups.d.ts +24 -24
- package/dist/functions/pills.d.ts +3 -3
- package/dist/functions/player.d.ts +17 -17
- package/dist/functions/rooms.d.ts +24 -1
- package/dist/functions/rooms.lua +56 -21
- package/dist/functions/run.d.ts +1 -1
- package/dist/functions/spawnCollectible.d.ts +1 -1
- package/dist/functions/transformations.d.ts +2 -2
- package/dist/functions/trinketCacheFlag.d.ts +2 -2
- package/dist/functions/trinketGive.d.ts +2 -2
- package/dist/functions/trinketSet.d.ts +1 -1
- package/dist/functions/trinkets.d.ts +5 -5
- package/dist/functions/trinkets.lua +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.lua +8 -0
- package/dist/objects/roomShapeToDoorSlots.d.ts +1 -1
- package/dist/objects/roomShapeToDoorSlotsToGridIndexDelta.lua +3 -3
- package/dist/sets/mineShaftRoomSubTypesSet.d.ts +2 -0
- package/dist/sets/mineShaftRoomSubTypesSet.lua +14 -0
- package/dist/types/PickingUpItem.d.ts +1 -1
- package/dist/types/TrinketSituation.d.ts +3 -3
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ActiveSlot, CacheFlag, CollectibleType, PlayerType, TrinketType } from "isaac-typescript-definitions";
|
|
2
2
|
import { HealthType } from "../enums/HealthType";
|
|
3
|
-
export declare function addCollectibleCostume(player: EntityPlayer, collectibleType: CollectibleType
|
|
3
|
+
export declare function addCollectibleCostume(player: EntityPlayer, collectibleType: CollectibleType): void;
|
|
4
4
|
/**
|
|
5
5
|
* Helper function to add a stat to a player based on the `CacheFlag` provided. Call this function
|
|
6
6
|
* from the EvaluateCache callback.
|
|
@@ -17,16 +17,16 @@ export declare function addCollectibleCostume(player: EntityPlayer, collectibleT
|
|
|
17
17
|
* - CacheFlag.LUCK (1 << 10)
|
|
18
18
|
*/
|
|
19
19
|
export declare function addStat(player: EntityPlayer, cacheFlag: CacheFlag, amount: number): void;
|
|
20
|
-
export declare function addTrinketCostume(player: EntityPlayer, trinketType: TrinketType
|
|
21
|
-
export declare function anyPlayerHasCollectible(collectibleType: CollectibleType
|
|
22
|
-
export declare function anyPlayerHasTrinket(trinketType: TrinketType
|
|
20
|
+
export declare function addTrinketCostume(player: EntityPlayer, trinketType: TrinketType): void;
|
|
21
|
+
export declare function anyPlayerHasCollectible(collectibleType: CollectibleType): boolean;
|
|
22
|
+
export declare function anyPlayerHasTrinket(trinketType: TrinketType): boolean;
|
|
23
23
|
/**
|
|
24
24
|
* Helper function to determine if the given character is present.
|
|
25
25
|
*
|
|
26
26
|
* This function is variadic, meaning that you can supply as many characters as you want to check
|
|
27
27
|
* for. Returns true if any of the characters supplied are present.
|
|
28
28
|
*/
|
|
29
|
-
export declare function anyPlayerIs(...matchingCharacters:
|
|
29
|
+
export declare function anyPlayerIs(...matchingCharacters: PlayerType[]): boolean;
|
|
30
30
|
/**
|
|
31
31
|
* Helper function to determine if a player will destroy a rock/pot/skull if they walk over it.
|
|
32
32
|
*
|
|
@@ -41,7 +41,7 @@ export declare function canPlayerCrushRocks(player: EntityPlayer): boolean;
|
|
|
41
41
|
* Helper function to find the active slot that the player has the corresponding collectible type
|
|
42
42
|
* in. Returns undefined if the player does not have the collectible in any active slot.
|
|
43
43
|
*/
|
|
44
|
-
export declare function getActiveItemSlot(player: EntityPlayer, collectibleType: CollectibleType
|
|
44
|
+
export declare function getActiveItemSlot(player: EntityPlayer, collectibleType: CollectibleType): ActiveSlot | undefined;
|
|
45
45
|
/**
|
|
46
46
|
* Helper function to get how long Azazel's Brimstone laser should be. You can pass either an
|
|
47
47
|
* `EntityPlayer` object or a tear height stat.
|
|
@@ -94,12 +94,12 @@ export declare function getPlayerCloserThan(position: Vector, distance: float):
|
|
|
94
94
|
*
|
|
95
95
|
* This function is variadic, meaning that you can specify N collectible types.
|
|
96
96
|
*/
|
|
97
|
-
export declare function getPlayerCollectibleCount(player: EntityPlayer, ...collectibleTypes:
|
|
97
|
+
export declare function getPlayerCollectibleCount(player: EntityPlayer, ...collectibleTypes: CollectibleType[]): int;
|
|
98
98
|
/**
|
|
99
99
|
* Iterates over every item in the game and returns a map containing the number of each item that
|
|
100
100
|
* the player has.
|
|
101
101
|
*/
|
|
102
|
-
export declare function getPlayerCollectibleMap(player: EntityPlayer): Map<CollectibleType
|
|
102
|
+
export declare function getPlayerCollectibleMap(player: EntityPlayer): Map<CollectibleType, int>;
|
|
103
103
|
/**
|
|
104
104
|
* Returns the number of red hearts that the player has, excluding any rotten hearts. For example,
|
|
105
105
|
* if the player has one full black heart, one full soul heart, and one half black heart, this
|
|
@@ -152,14 +152,14 @@ export declare function getPlayerSoulHearts(player: EntityPlayer): int;
|
|
|
152
152
|
* This function is variadic, meaning that you can supply as many characters as you want to check
|
|
153
153
|
* for. Returns true if any of the characters supplied are present.
|
|
154
154
|
*/
|
|
155
|
-
export declare function getPlayersOfType(...characters:
|
|
155
|
+
export declare function getPlayersOfType(...characters: PlayerType[]): EntityPlayer[];
|
|
156
156
|
/**
|
|
157
157
|
* Helper function to get only the players that have a certain collectible.
|
|
158
158
|
*
|
|
159
159
|
* This function is variadic, meaning that you can supply as many collectible types as you want to
|
|
160
160
|
* check for. It only returns the players that have all of the collectibles.
|
|
161
161
|
*/
|
|
162
|
-
export declare function getPlayersWithCollectible(...collectibleTypes:
|
|
162
|
+
export declare function getPlayersWithCollectible(...collectibleTypes: CollectibleType[]): EntityPlayer[];
|
|
163
163
|
/**
|
|
164
164
|
* Helper function to determine how many heart containers that Tainted Magdalene has that will not
|
|
165
165
|
* be automatically depleted over time. By default, this is 2, but this function will return 4 so
|
|
@@ -175,7 +175,7 @@ export declare function getTaintedMagdaleneNonTemporaryMaxHearts(player: EntityP
|
|
|
175
175
|
* Returns the total number of collectibles amongst all players. For example, if player 1 has 1 Sad
|
|
176
176
|
* Onion and player 2 has 2 Sad Onions, then this function would return 3.
|
|
177
177
|
*/
|
|
178
|
-
export declare function getTotalPlayerCollectibles(collectibleType: CollectibleType
|
|
178
|
+
export declare function getTotalPlayerCollectibles(collectibleType: CollectibleType): int;
|
|
179
179
|
/** After touching a white fire, a player will turn into The Lost until they clear a room. */
|
|
180
180
|
export declare function hasLostCurse(player: EntityPlayer): boolean;
|
|
181
181
|
/**
|
|
@@ -199,7 +199,7 @@ export declare function isBethany(player: EntityPlayer): boolean;
|
|
|
199
199
|
* This function is variadic, meaning that you can supply as many characters as you want to check
|
|
200
200
|
* for. Returns true if the player is any of the supplied characters.
|
|
201
201
|
*/
|
|
202
|
-
export declare function isCharacter(player: EntityPlayer, ...characters:
|
|
202
|
+
export declare function isCharacter(player: EntityPlayer, ...characters: PlayerType[]): boolean;
|
|
203
203
|
/**
|
|
204
204
|
* Helper function for detecting when a player is Eden or Tainted Eden. Useful for situations where
|
|
205
205
|
* you want to know if the starting stats were randomized, for example.
|
|
@@ -230,19 +230,19 @@ export declare function isVanillaPlayer(player: EntityPlayer): boolean;
|
|
|
230
230
|
* This function is variadic, meaning that you can supply as many collectible types as you want to
|
|
231
231
|
* add.
|
|
232
232
|
*/
|
|
233
|
-
export declare function playerAddCollectible(player: EntityPlayer, ...collectibleTypes:
|
|
233
|
+
export declare function playerAddCollectible(player: EntityPlayer, ...collectibleTypes: CollectibleType[]): void;
|
|
234
234
|
/**
|
|
235
235
|
* Helper function to check to see if a player has one or more collectibles.
|
|
236
236
|
*
|
|
237
237
|
* This function is variadic, meaning that you can supply as many collectible types as you want to
|
|
238
238
|
* check for. Returns true if the player has any of the supplied collectible types.
|
|
239
239
|
*/
|
|
240
|
-
export declare function playerHasCollectible(player: EntityPlayer, ...collectibleTypes:
|
|
240
|
+
export declare function playerHasCollectible(player: EntityPlayer, ...collectibleTypes: CollectibleType[]): boolean;
|
|
241
241
|
/**
|
|
242
242
|
* Helper function to remove a collectible costume from a player. Use this helper function to avoid
|
|
243
243
|
* having to request the collectible from the item config.
|
|
244
244
|
*/
|
|
245
|
-
export declare function removeCollectibleCostume(player: EntityPlayer, collectibleType: CollectibleType
|
|
245
|
+
export declare function removeCollectibleCostume(player: EntityPlayer, collectibleType: CollectibleType): void;
|
|
246
246
|
/**
|
|
247
247
|
* Helper function to remove the Dead Eye multiplier from a player.
|
|
248
248
|
*
|
|
@@ -254,7 +254,7 @@ export declare function removeDeadEyeMultiplier(player: EntityPlayer): void;
|
|
|
254
254
|
* Helper function to remove a trinket costume from a player. Use this helper function to avoid
|
|
255
255
|
* having to request the trinket from the item config.
|
|
256
256
|
*/
|
|
257
|
-
export declare function removeTrinketCostume(player: EntityPlayer, trinketType: TrinketType
|
|
257
|
+
export declare function removeTrinketCostume(player: EntityPlayer, trinketType: TrinketType): void;
|
|
258
258
|
/**
|
|
259
259
|
* Helper function to set an active collectible to a particular slot. This has different behavior
|
|
260
260
|
* than calling the `player.AddCollectible` method with the `activeSlot` argument, because this
|
|
@@ -286,4 +286,4 @@ export declare function setBlindfold(player: EntityPlayer, enabled: boolean, mod
|
|
|
286
286
|
* Helper function to use an active item without showing an animation, keeping the item, or adding
|
|
287
287
|
* any costumes.
|
|
288
288
|
*/
|
|
289
|
-
export declare function useActiveItemTemp(player: EntityPlayer, collectibleType: CollectibleType
|
|
289
|
+
export declare function useActiveItemTemp(player: EntityPlayer, collectibleType: CollectibleType): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BossID, Dimension, Direction, DoorSlot, ItemPoolType, MinibossID, RoomTransitionAnim, RoomType } from "isaac-typescript-definitions";
|
|
1
|
+
import { BossID, Dimension, Direction, DoorSlot, ItemPoolType, MinibossID, RoomShape, RoomTransitionAnim, RoomType } from "isaac-typescript-definitions";
|
|
2
2
|
/**
|
|
3
3
|
* Helper function for quickly switching to a new room without playing a particular animation. Use
|
|
4
4
|
* this helper function over invoking the `Game.ChangeRoom` method directly to ensure that you do
|
|
@@ -14,6 +14,11 @@ export declare function getAllRoomGridIndexes(): int[];
|
|
|
14
14
|
* tricky to properly detect.
|
|
15
15
|
*/
|
|
16
16
|
export declare function getCurrentDimension(): Dimension;
|
|
17
|
+
/**
|
|
18
|
+
* Helper function to get the number of rooms that are currently on the floor layout. This does not
|
|
19
|
+
* include off-grid rooms, like the Devil Room.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getNumRooms(): int;
|
|
17
22
|
/**
|
|
18
23
|
* Helper function to get an array of all of the safe grid indexes for rooms that match the
|
|
19
24
|
* specified room type.
|
|
@@ -29,6 +34,13 @@ export declare function getRoomGridIndexesForType(...roomTypes: RoomType[]): int
|
|
|
29
34
|
* `ItemPoolType.ItemPoolType.POOL_ANGEL` if you are in an Angel Room.
|
|
30
35
|
*/
|
|
31
36
|
export declare function getRoomItemPoolType(): ItemPoolType;
|
|
37
|
+
/**
|
|
38
|
+
* Helper function to get the grid indexes of all the rooms connected to the given room index.
|
|
39
|
+
*
|
|
40
|
+
* @param roomGridIndex Optional. Default is the current room index.
|
|
41
|
+
*/
|
|
42
|
+
export declare function getRoomNeighbors(roomGridIndex?: int): int[];
|
|
43
|
+
export declare function getRoomShapeNeighborGridIndexDeltas(roomShape: RoomShape): int[];
|
|
32
44
|
/**
|
|
33
45
|
* Helper function to get the proper name of a room type.
|
|
34
46
|
*
|
|
@@ -89,6 +101,11 @@ export declare function inGenesisRoom(): boolean;
|
|
|
89
101
|
/** Helper function to determine if the current room shape is one of the four L room shapes. */
|
|
90
102
|
export declare function inLRoom(): boolean;
|
|
91
103
|
export declare function inMegaSatanRoom(): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Helper function to determine if the current room is part of the Repentance "escape sequence" in
|
|
106
|
+
* the Mines/Ashpit.
|
|
107
|
+
*/
|
|
108
|
+
export declare function inMineShaft(): boolean;
|
|
92
109
|
/**
|
|
93
110
|
* Helper function to check if the current room is a miniboss room for a particular miniboss. This
|
|
94
111
|
* will only work for mini-bosses that have dedicated boss rooms in the "00.special rooms.stb" file.
|
|
@@ -136,6 +153,12 @@ export declare function isRedKeyRoom(roomGridIndex?: int): boolean;
|
|
|
136
153
|
export declare function isRoomInsideMap(roomGridIndex?: int): boolean;
|
|
137
154
|
/** Helper function to check if a room exists at the given room grid index. */
|
|
138
155
|
export declare function roomExists(roomGridIndex: int): boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Helper function to get the coordinates of a given grid index. The floor is represented by a 13x13
|
|
158
|
+
* grid. For example, since the starting room is in the center, the starting room grid index of 84
|
|
159
|
+
* be equal to coordinates of (?, ?).
|
|
160
|
+
*/
|
|
161
|
+
export declare function roomGridIndexToXY(roomGridIndex: int): [x: int, y: int];
|
|
139
162
|
/**
|
|
140
163
|
* If the `Room.Update` method is called in a PostNewRoom callback, then some entities will slide
|
|
141
164
|
* around (such as the player). Since those entity velocities are already at zero, setting them to
|
package/dist/functions/rooms.lua
CHANGED
|
@@ -3,8 +3,8 @@ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
|
3
3
|
local Set = ____lualib.Set
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
6
|
-
local Map = ____lualib.Map
|
|
7
6
|
local __TS__Spread = ____lualib.__TS__Spread
|
|
7
|
+
local Map = ____lualib.Map
|
|
8
8
|
local __TS__StringIncludes = ____lualib.__TS__StringIncludes
|
|
9
9
|
local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
|
|
10
10
|
local ____exports = {}
|
|
@@ -25,11 +25,16 @@ local ____cachedClasses = require("cachedClasses")
|
|
|
25
25
|
local game = ____cachedClasses.game
|
|
26
26
|
local sfxManager = ____cachedClasses.sfxManager
|
|
27
27
|
local ____constants = require("constants")
|
|
28
|
-
local
|
|
28
|
+
local LEVEL_GRID_ROW_WIDTH = ____constants.LEVEL_GRID_ROW_WIDTH
|
|
29
|
+
local MAX_LEVEL_GRID_INDEX = ____constants.MAX_LEVEL_GRID_INDEX
|
|
29
30
|
local NUM_DIMENSIONS = ____constants.NUM_DIMENSIONS
|
|
31
|
+
local ____roomShapeToDoorSlotsToGridIndexDelta = require("objects.roomShapeToDoorSlotsToGridIndexDelta")
|
|
32
|
+
local ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA = ____roomShapeToDoorSlotsToGridIndexDelta.ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA
|
|
30
33
|
local ____roomTypeNames = require("objects.roomTypeNames")
|
|
31
34
|
local DEFAULT_ROOM_TYPE_NAME = ____roomTypeNames.DEFAULT_ROOM_TYPE_NAME
|
|
32
35
|
local ROOM_TYPE_NAMES = ____roomTypeNames.ROOM_TYPE_NAMES
|
|
36
|
+
local ____mineShaftRoomSubTypesSet = require("sets.mineShaftRoomSubTypesSet")
|
|
37
|
+
local MINE_SHAFT_ROOM_SUB_TYPE_SET = ____mineShaftRoomSubTypesSet.MINE_SHAFT_ROOM_SUB_TYPE_SET
|
|
33
38
|
local ____doors = require("functions.doors")
|
|
34
39
|
local closeAllDoors = ____doors.closeAllDoors
|
|
35
40
|
local getDoors = ____doors.getDoors
|
|
@@ -58,6 +63,10 @@ local ____roomShape = require("functions.roomShape")
|
|
|
58
63
|
local getGridIndexDelta = ____roomShape.getGridIndexDelta
|
|
59
64
|
local ____utils = require("functions.utils")
|
|
60
65
|
local erange = ____utils.erange
|
|
66
|
+
local irange = ____utils.irange
|
|
67
|
+
function ____exports.getRoomShapeNeighborGridIndexDeltas(self, roomShape)
|
|
68
|
+
return {__TS__Spread(ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA[roomShape]:values())}
|
|
69
|
+
end
|
|
61
70
|
function ____exports.getRooms(self, includeExtraDimensionalRooms)
|
|
62
71
|
if includeExtraDimensionalRooms == nil then
|
|
63
72
|
includeExtraDimensionalRooms = false
|
|
@@ -77,14 +86,10 @@ function ____exports.getRooms(self, includeExtraDimensionalRooms)
|
|
|
77
86
|
end
|
|
78
87
|
end
|
|
79
88
|
else
|
|
80
|
-
do
|
|
81
|
-
local
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if roomDescriptor.Data ~= nil then
|
|
85
|
-
roomsMap:set(roomDescriptor.ListIndex, roomDescriptor)
|
|
86
|
-
end
|
|
87
|
-
i = i + 1
|
|
89
|
+
for ____, roomGridIndex in ipairs(irange(nil, MAX_LEVEL_GRID_INDEX)) do
|
|
90
|
+
local roomDescriptor = level:GetRoomByIdx(roomGridIndex)
|
|
91
|
+
if roomDescriptor.Data ~= nil then
|
|
92
|
+
roomsMap:set(roomDescriptor.ListIndex, roomDescriptor)
|
|
88
93
|
end
|
|
89
94
|
end
|
|
90
95
|
end
|
|
@@ -132,6 +137,10 @@ function ____exports.getCurrentDimension(self)
|
|
|
132
137
|
end
|
|
133
138
|
return error("Failed to get the current dimension using the starting room index of: " .. tostring(startingRoomGridIndex))
|
|
134
139
|
end
|
|
140
|
+
function ____exports.getNumRooms(self)
|
|
141
|
+
local rooms = ____exports.getRooms(nil)
|
|
142
|
+
return #rooms
|
|
143
|
+
end
|
|
135
144
|
function ____exports.getRoomGridIndexesForType(self, ...)
|
|
136
145
|
local roomTypesSet = __TS__New(Set, {...})
|
|
137
146
|
local rooms = ____exports.getRooms(nil)
|
|
@@ -151,6 +160,26 @@ function ____exports.getRoomItemPoolType(self)
|
|
|
151
160
|
local roomSeed = room:GetSpawnSeed()
|
|
152
161
|
return itemPool:GetPoolForRoom(roomType, roomSeed)
|
|
153
162
|
end
|
|
163
|
+
function ____exports.getRoomNeighbors(self, roomGridIndex)
|
|
164
|
+
local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
|
|
165
|
+
if roomDescriptor.SafeGridIndex < 0 or roomDescriptor.SafeGridIndex > MAX_LEVEL_GRID_INDEX then
|
|
166
|
+
return {}
|
|
167
|
+
end
|
|
168
|
+
local roomData = roomDescriptor.Data
|
|
169
|
+
if roomData == nil then
|
|
170
|
+
return {}
|
|
171
|
+
end
|
|
172
|
+
local roomShape = roomData.Shape
|
|
173
|
+
local gridIndexDeltas = ____exports.getRoomShapeNeighborGridIndexDeltas(nil, roomShape)
|
|
174
|
+
local gridIndexes = __TS__ArrayMap(
|
|
175
|
+
gridIndexDeltas,
|
|
176
|
+
function(____, gridIndexDelta) return roomDescriptor.SafeGridIndex + gridIndexDelta end
|
|
177
|
+
)
|
|
178
|
+
return __TS__ArrayFilter(
|
|
179
|
+
gridIndexes,
|
|
180
|
+
function(____, gridIndex) return ____exports.roomExists(nil, gridIndex) end
|
|
181
|
+
)
|
|
182
|
+
end
|
|
154
183
|
function ____exports.getRoomTypeName(self, roomType)
|
|
155
184
|
local roomTypeName = ROOM_TYPE_NAMES[roomType]
|
|
156
185
|
return roomTypeName == nil and DEFAULT_ROOM_TYPE_NAME or roomTypeName
|
|
@@ -158,14 +187,10 @@ end
|
|
|
158
187
|
function ____exports.getRoomsOfDimension(self, dimension)
|
|
159
188
|
local level = game:GetLevel()
|
|
160
189
|
local roomsMap = __TS__New(Map)
|
|
161
|
-
do
|
|
162
|
-
local
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
if roomDescriptor.Data ~= nil then
|
|
166
|
-
roomsMap:set(roomDescriptor.ListIndex, roomDescriptor)
|
|
167
|
-
end
|
|
168
|
-
i = i + 1
|
|
190
|
+
for ____, roomGridIndex in ipairs(irange(nil, MAX_LEVEL_GRID_INDEX)) do
|
|
191
|
+
local roomDescriptor = level:GetRoomByIdx(roomGridIndex, dimension)
|
|
192
|
+
if roomDescriptor.Data ~= nil then
|
|
193
|
+
roomsMap:set(roomDescriptor.ListIndex, roomDescriptor)
|
|
169
194
|
end
|
|
170
195
|
end
|
|
171
196
|
return {__TS__Spread(roomsMap:values())}
|
|
@@ -226,6 +251,11 @@ function ____exports.inMegaSatanRoom(self)
|
|
|
226
251
|
local roomGridIndex = getRoomGridIndex(nil)
|
|
227
252
|
return roomGridIndex == GridRoom.MEGA_SATAN
|
|
228
253
|
end
|
|
254
|
+
function ____exports.inMineShaft(self)
|
|
255
|
+
local roomStageID = getRoomStageID(nil)
|
|
256
|
+
local roomSubType = getRoomSubType(nil)
|
|
257
|
+
return (roomStageID == StageID.MINES or roomStageID == StageID.ASHPIT) and MINE_SHAFT_ROOM_SUB_TYPE_SET:has(roomSubType)
|
|
258
|
+
end
|
|
229
259
|
function ____exports.inMinibossRoomOf(self, minibossID)
|
|
230
260
|
local room = game:GetRoom()
|
|
231
261
|
local roomType = room:GetType()
|
|
@@ -279,7 +309,7 @@ function ____exports.isDoorSlotValidAtGridIndexForRedRoom(self, doorSlot, roomGr
|
|
|
279
309
|
return false
|
|
280
310
|
end
|
|
281
311
|
local redRoomGridIndex = roomGridIndex + delta
|
|
282
|
-
return not ____exports.roomExists(nil, redRoomGridIndex)
|
|
312
|
+
return not ____exports.roomExists(nil, redRoomGridIndex) and redRoomGridIndex >= 0 and redRoomGridIndex <= MAX_LEVEL_GRID_INDEX
|
|
283
313
|
end
|
|
284
314
|
function ____exports.isRedKeyRoom(self, roomGridIndex)
|
|
285
315
|
local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
|
|
@@ -291,6 +321,11 @@ function ____exports.isRoomInsideMap(self, roomGridIndex)
|
|
|
291
321
|
end
|
|
292
322
|
return roomGridIndex >= 0
|
|
293
323
|
end
|
|
324
|
+
function ____exports.roomGridIndexToXY(self, roomGridIndex)
|
|
325
|
+
local x = roomGridIndex % LEVEL_GRID_ROW_WIDTH
|
|
326
|
+
local y = math.floor(roomGridIndex / LEVEL_GRID_ROW_WIDTH)
|
|
327
|
+
return {x, y}
|
|
328
|
+
end
|
|
294
329
|
function ____exports.roomUpdateSafe(self)
|
|
295
330
|
local room = game:GetRoom()
|
|
296
331
|
local entities = getEntities(nil)
|
|
@@ -310,12 +345,12 @@ function ____exports.setRoomCleared(self)
|
|
|
310
345
|
for ____, door in ipairs(getDoors(nil)) do
|
|
311
346
|
do
|
|
312
347
|
if isHiddenSecretRoomDoor(nil, door) then
|
|
313
|
-
goto
|
|
348
|
+
goto __continue67
|
|
314
349
|
end
|
|
315
350
|
openDoorFast(nil, door)
|
|
316
351
|
door.ExtraVisible = false
|
|
317
352
|
end
|
|
318
|
-
::
|
|
353
|
+
::__continue67::
|
|
319
354
|
end
|
|
320
355
|
sfxManager:Stop(SoundEffect.DOOR_HEAVY_OPEN)
|
|
321
356
|
game:ShakeScreen(0)
|
package/dist/functions/run.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ export declare function onSetSeed(): boolean;
|
|
|
9
9
|
* Helper function to restart the game using the console command of "restart". You can optionally
|
|
10
10
|
* specify a `PlayerType` to restart the game as that character.
|
|
11
11
|
*/
|
|
12
|
-
export declare function restart(character?: PlayerType
|
|
12
|
+
export declare function restart(character?: PlayerType): void;
|
|
@@ -14,7 +14,7 @@ import { CollectibleType } from "isaac-typescript-definitions";
|
|
|
14
14
|
* @param forceFreeItem Optional. Set to true to disable the logic that gives the item a price for
|
|
15
15
|
* Tainted Keeper. Default is false.
|
|
16
16
|
*/
|
|
17
|
-
export declare function spawnCollectible(collectibleType: CollectibleType
|
|
17
|
+
export declare function spawnCollectible(collectibleType: CollectibleType, position: Vector, seedOrRNG?: Seed | RNG, options?: boolean, forceFreeItem?: boolean): EntityPickup;
|
|
18
18
|
/**
|
|
19
19
|
* Helper function to spawn an empty collectible. Doing this is tricky since spawning a collectible
|
|
20
20
|
* with `CollectibleType.NULL` will result in spawning a collectible with a random type from the
|
|
@@ -9,7 +9,7 @@ import { CollectibleType, PlayerForm } from "isaac-typescript-definitions";
|
|
|
9
9
|
* const guppyCollectibleTypes = getCollectibleTypesForTransformation(PlayerForm.GUPPY);
|
|
10
10
|
* ```
|
|
11
11
|
*/
|
|
12
|
-
export declare function getCollectibleTypesForTransformation(playerForm: PlayerForm): Set<CollectibleType
|
|
12
|
+
export declare function getCollectibleTypesForTransformation(playerForm: PlayerForm): Set<CollectibleType>;
|
|
13
13
|
/** Returns the number of items that a player has towards a particular transformation. */
|
|
14
14
|
export declare function getPlayerNumCollectiblesForTransformation(player: EntityPlayer, playerForm: PlayerForm): int;
|
|
15
15
|
/** Returns a set of the player's current transformations. */
|
|
@@ -25,6 +25,6 @@ export declare function getPlayerTransformations(player: EntityPlayer): Set<Play
|
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
27
|
export declare function getTransformationName(playerForm: PlayerForm): string;
|
|
28
|
-
export declare function getTransformationsForCollectibleType(collectibleType: CollectibleType
|
|
28
|
+
export declare function getTransformationsForCollectibleType(collectibleType: CollectibleType): Set<PlayerForm>;
|
|
29
29
|
export declare function hasFlyingTransformation(player: EntityPlayer): boolean;
|
|
30
30
|
export declare function isTransformationFlying(playerForm: PlayerForm): boolean;
|
|
@@ -3,8 +3,8 @@ import { CacheFlag, TrinketType } from "isaac-typescript-definitions";
|
|
|
3
3
|
* Returns a map containing every trinket type that the player has that matches the provided
|
|
4
4
|
* CacheFlag. The values of the map correspond to the multiplier for that trinket.
|
|
5
5
|
*/
|
|
6
|
-
export declare function getPlayerTrinketsForCacheFlag(player: EntityPlayer, cacheFlag: CacheFlag): Map<TrinketType
|
|
6
|
+
export declare function getPlayerTrinketsForCacheFlag(player: EntityPlayer, cacheFlag: CacheFlag): Map<TrinketType, int>;
|
|
7
7
|
/**
|
|
8
8
|
* Returns a set containing every trinket type with the given cache flag, including modded trinkets.
|
|
9
9
|
*/
|
|
10
|
-
export declare function getTrinketsForCacheFlag(cacheFlag: CacheFlag): Set<TrinketType
|
|
10
|
+
export declare function getTrinketsForCacheFlag(cacheFlag: CacheFlag): Set<TrinketType>;
|
|
@@ -16,7 +16,7 @@ export declare function giveTrinketsBack(player: EntityPlayer, trinketSituation:
|
|
|
16
16
|
* @param numTrinkets Optional. If specified, will smelt the given number of trinkets. Use this to
|
|
17
17
|
* avoid calling this function multiple times. Default is 1.
|
|
18
18
|
*/
|
|
19
|
-
export declare function smeltTrinket(player: EntityPlayer, trinketType: TrinketType
|
|
19
|
+
export declare function smeltTrinket(player: EntityPlayer, trinketType: TrinketType, numTrinkets?: number): void;
|
|
20
20
|
/**
|
|
21
21
|
* Helper function to temporarily remove a specific kind of trinket from the player. Use this in
|
|
22
22
|
* combination with the `giveTrinketsBack` function to take away and give back a trinket on the same
|
|
@@ -27,7 +27,7 @@ export declare function smeltTrinket(player: EntityPlayer, trinketType: TrinketT
|
|
|
27
27
|
*
|
|
28
28
|
* @returns Undefined if the player does not have the trinket, or TrinketSituation if they do.
|
|
29
29
|
*/
|
|
30
|
-
export declare function temporarilyRemoveTrinket(player: EntityPlayer, trinketType: TrinketType
|
|
30
|
+
export declare function temporarilyRemoveTrinket(player: EntityPlayer, trinketType: TrinketType): TrinketSituation | undefined;
|
|
31
31
|
/**
|
|
32
32
|
* Helper function to temporarily removes a player's held trinkets, if any. This will not remove any
|
|
33
33
|
* smelted trinkets. Use this in combination with the `giveTrinketsBack` function to take away and
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { TrinketType } from "isaac-typescript-definitions";
|
|
2
2
|
/** Returns a set containing every valid trinket type in the game, including modded items. */
|
|
3
|
-
export declare function getTrinketSet(): Set<TrinketType
|
|
3
|
+
export declare function getTrinketSet(): Set<TrinketType>;
|
|
@@ -5,7 +5,7 @@ import { CacheFlag, TrinketType } from "isaac-typescript-definitions";
|
|
|
5
5
|
* For example, passing `TrinketType.SWALLOWED_PENNY` would result in 32769, which is the value that
|
|
6
6
|
* corresponds to the golden trinket sub-type for Swallowed Penny.
|
|
7
7
|
*/
|
|
8
|
-
export declare function getGoldenTrinketType(trinketType: TrinketType
|
|
8
|
+
export declare function getGoldenTrinketType(trinketType: TrinketType): TrinketType;
|
|
9
9
|
/**
|
|
10
10
|
* Returns the slot number corresponding to where a trinket can be safely inserted.
|
|
11
11
|
*
|
|
@@ -25,7 +25,7 @@ export declare function getOpenTrinketSlot(player: EntityPlayer): int | undefine
|
|
|
25
25
|
* Helper function to get the in-game description for a trinket. Returns "Unknown" if the provided
|
|
26
26
|
* trinket type was not valid.
|
|
27
27
|
*/
|
|
28
|
-
export declare function getTrinketDescription(trinketType: TrinketType
|
|
28
|
+
export declare function getTrinketDescription(trinketType: TrinketType): string;
|
|
29
29
|
/**
|
|
30
30
|
* Helper function to get the name of a trinket. Returns "Unknown" if the provided trinket type is
|
|
31
31
|
* not valid.
|
|
@@ -37,7 +37,7 @@ export declare function getTrinketDescription(trinketType: TrinketType | int): s
|
|
|
37
37
|
* const trinketName = getTrinketName(trinketType); // trinketName is "Swallowed Penny"
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
|
-
export declare function getTrinketName(trinketType: TrinketType
|
|
40
|
+
export declare function getTrinketName(trinketType: TrinketType): string;
|
|
41
41
|
/**
|
|
42
42
|
* Returns whether or not the player can hold an additional trinket, beyond what they are currently
|
|
43
43
|
* carrying. This takes into account items that modify the max number of trinkets, like Mom's Purse.
|
|
@@ -46,7 +46,7 @@ export declare function getTrinketName(trinketType: TrinketType | int): string;
|
|
|
46
46
|
* items. (Only Tainted Forgotten can pick up items.)
|
|
47
47
|
*/
|
|
48
48
|
export declare function hasOpenTrinketSlot(player: EntityPlayer): boolean;
|
|
49
|
-
export declare function isGoldenTrinket(trinketType: TrinketType
|
|
49
|
+
export declare function isGoldenTrinket(trinketType: TrinketType): boolean;
|
|
50
50
|
/**
|
|
51
51
|
* Helper function to change the sprite of a trinket entity.
|
|
52
52
|
*
|
|
@@ -60,4 +60,4 @@ export declare function isGoldenTrinket(trinketType: TrinketType | int): boolean
|
|
|
60
60
|
* already been taken by the player.
|
|
61
61
|
*/
|
|
62
62
|
export declare function setTrinketSprite(trinket: EntityPickup, pngPath: string | undefined): void;
|
|
63
|
-
export declare function trinketHasCacheFlag(trinketType: TrinketType
|
|
63
|
+
export declare function trinketHasCacheFlag(trinketType: TrinketType, cacheFlag: CacheFlag): boolean;
|
|
@@ -44,7 +44,7 @@ function ____exports.getTrinketDescription(self, trinketType)
|
|
|
44
44
|
if trinketDescription ~= nil then
|
|
45
45
|
return trinketDescription
|
|
46
46
|
end
|
|
47
|
-
local itemConfigItem = itemConfig:
|
|
47
|
+
local itemConfigItem = itemConfig:GetTrinket(trinketType)
|
|
48
48
|
if itemConfigItem ~= nil then
|
|
49
49
|
return itemConfigItem.Description
|
|
50
50
|
end
|
|
@@ -55,7 +55,7 @@ function ____exports.getTrinketName(self, trinketType)
|
|
|
55
55
|
if trinketName ~= nil then
|
|
56
56
|
return trinketName
|
|
57
57
|
end
|
|
58
|
-
local itemConfigItem = itemConfig:
|
|
58
|
+
local itemConfigItem = itemConfig:GetTrinket(trinketType)
|
|
59
59
|
if itemConfigItem ~= nil then
|
|
60
60
|
return itemConfigItem.Name
|
|
61
61
|
end
|
package/dist/index.d.ts
CHANGED
|
@@ -62,6 +62,7 @@ export * from "./functions/jsonHelpers";
|
|
|
62
62
|
export * from "./functions/jsonRoom";
|
|
63
63
|
export * from "./functions/kColor";
|
|
64
64
|
export * from "./functions/language";
|
|
65
|
+
export * from "./functions/level";
|
|
65
66
|
export * from "./functions/log";
|
|
66
67
|
export * from "./functions/map";
|
|
67
68
|
export * from "./functions/math";
|
package/dist/index.lua
CHANGED
|
@@ -509,6 +509,14 @@ do
|
|
|
509
509
|
end
|
|
510
510
|
end
|
|
511
511
|
end
|
|
512
|
+
do
|
|
513
|
+
local ____export = require("functions.level")
|
|
514
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
515
|
+
if ____exportKey ~= "default" then
|
|
516
|
+
____exports[____exportKey] = ____exportValue
|
|
517
|
+
end
|
|
518
|
+
end
|
|
519
|
+
end
|
|
512
520
|
do
|
|
513
521
|
local ____export = require("functions.log")
|
|
514
522
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -6,11 +6,11 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
|
|
|
6
6
|
local DoorSlot = ____isaac_2Dtypescript_2Ddefinitions.DoorSlot
|
|
7
7
|
local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
|
|
8
8
|
local ____constants = require("constants")
|
|
9
|
-
local
|
|
9
|
+
local LEVEL_GRID_ROW_WIDTH = ____constants.LEVEL_GRID_ROW_WIDTH
|
|
10
10
|
local LEFT = -1
|
|
11
|
-
local UP = -
|
|
11
|
+
local UP = -LEVEL_GRID_ROW_WIDTH
|
|
12
12
|
local RIGHT = 1
|
|
13
|
-
local DOWN =
|
|
13
|
+
local DOWN = LEVEL_GRID_ROW_WIDTH
|
|
14
14
|
____exports.ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA = {
|
|
15
15
|
[RoomShape.SHAPE_1x1] = __TS__New(Map, {{DoorSlot.LEFT_0, LEFT}, {DoorSlot.UP_0, UP}, {DoorSlot.RIGHT_0, RIGHT}, {DoorSlot.DOWN_0, DOWN}}),
|
|
16
16
|
[RoomShape.IH] = __TS__New(Map, {{DoorSlot.LEFT_0, LEFT}, {DoorSlot.RIGHT_0, RIGHT}}),
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local Set = ____lualib.Set
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
4
|
+
local ____exports = {}
|
|
5
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
6
|
+
local MinesRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.MinesRoomSubType
|
|
7
|
+
____exports.MINE_SHAFT_ROOM_SUB_TYPE_SET = __TS__New(Set, {
|
|
8
|
+
MinesRoomSubType.MINESHAFT_ENTRANCE,
|
|
9
|
+
MinesRoomSubType.MINESHAFT_LOBBY,
|
|
10
|
+
MinesRoomSubType.MINESHAFT_KNIFE_PIECE,
|
|
11
|
+
MinesRoomSubType.MINESHAFT_ROOM_PRE_CHASE,
|
|
12
|
+
MinesRoomSubType.MINESHAFT_ROOM_POST_CHASE
|
|
13
|
+
})
|
|
14
|
+
return ____exports
|
|
@@ -3,7 +3,7 @@ export interface PickingUpItem {
|
|
|
3
3
|
/** Needed so that we can distinguish between picking up a collectible and a trinket. */
|
|
4
4
|
itemType: ItemType;
|
|
5
5
|
/** Equal to either the collectible type or the trinket type. */
|
|
6
|
-
subType: CollectibleType | TrinketType
|
|
6
|
+
subType: CollectibleType | TrinketType;
|
|
7
7
|
}
|
|
8
8
|
export declare function newPickingUpItem(): PickingUpItem;
|
|
9
9
|
export declare function resetPickingUpItem(pickingUpItem: PickingUpItem): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TrinketType } from "isaac-typescript-definitions";
|
|
2
2
|
export interface TrinketSituation {
|
|
3
|
-
trinketTypeRemoved: TrinketType
|
|
4
|
-
trinketType1: TrinketType
|
|
5
|
-
trinketType2: TrinketType
|
|
3
|
+
trinketTypeRemoved: TrinketType;
|
|
4
|
+
trinketType1: TrinketType;
|
|
5
|
+
trinketType2: TrinketType;
|
|
6
6
|
numSmeltedTrinkets: int;
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.14",
|
|
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
|
"dependencies": {
|
|
28
|
-
"isaac-typescript-definitions": "^2.0.
|
|
28
|
+
"isaac-typescript-definitions": "^2.0.19"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"isaacscript-lint": "^1.0.150",
|