isaacscript-common 6.2.1 → 6.5.0
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/cachedClasses.d.ts +15 -0
- package/cachedClasses.lua +20 -0
- package/callbacks/reorderedCallbacks.d.ts +9 -0
- package/callbacks/reorderedCallbacks.lua +9 -0
- package/constants.d.ts +26 -4
- package/constants.lua +20 -4
- package/enums/CornerType.d.ts +6 -0
- package/enums/CornerType.lua +11 -0
- package/enums/DecorationVariant.d.ts +9 -0
- package/enums/DecorationVariant.lua +7 -0
- package/enums/RockAltType.d.ts +7 -0
- package/enums/RockAltType.lua +13 -0
- package/features/customGridEntity.d.ts +2 -2
- package/features/customGridEntity.lua +7 -5
- package/features/customStage/backdrop.d.ts +2 -0
- package/features/customStage/backdrop.lua +211 -0
- package/features/customStage/customStageConstants.d.ts +1 -0
- package/features/customStage/customStageConstants.lua +3 -0
- package/features/customStage/exports.d.ts +28 -0
- package/features/customStage/exports.lua +58 -1
- package/features/customStage/gridEntities.d.ts +18 -0
- package/features/customStage/gridEntities.lua +215 -0
- package/features/customStage/init.d.ts +2 -1
- package/features/customStage/init.lua +71 -9
- package/features/customStage/streakText.d.ts +2 -0
- package/features/customStage/streakText.lua +22 -0
- package/features/customStage/v.d.ts +10 -0
- package/features/customStage/v.lua +4 -0
- package/features/customStage/versusScreen.d.ts +3 -0
- package/features/customStage/versusScreen.lua +201 -0
- package/features/debugDisplay/debugDisplay.lua +2 -0
- package/features/debugDisplay/exports.d.ts +108 -0
- package/features/debugDisplay/exports.lua +145 -0
- package/features/debugDisplay/v.d.ts +2 -0
- package/features/debugDisplay/v.lua +9 -0
- package/features/deployJSONRoom.lua +6 -2
- package/features/extraConsoleCommands/init.lua +10 -1
- package/features/extraConsoleCommands/listCommands.d.ts +21 -6
- package/features/extraConsoleCommands/listCommands.lua +50 -19
- package/features/extraConsoleCommands/v.d.ts +1 -0
- package/features/extraConsoleCommands/v.lua +2 -1
- package/features/pause.d.ts +11 -0
- package/features/pause.lua +71 -0
- package/features/runNextRoom.d.ts +8 -0
- package/features/runNextRoom.lua +40 -0
- package/features/saveDataManager/exports.lua +2 -2
- package/features/saveDataManager/load.lua +3 -3
- package/features/saveDataManager/main.lua +3 -3
- package/features/saveDataManager/merge.lua +2 -2
- package/features/saveDataManager/save.lua +3 -3
- package/features/saveDataManager/{constants.d.ts → saveDataManagerConstants.d.ts} +0 -0
- package/features/saveDataManager/{constants.lua → saveDataManagerConstants.lua} +0 -0
- package/functions/chargeBar.lua +4 -6
- package/functions/color.d.ts +0 -2
- package/functions/color.lua +0 -4
- package/functions/deepCopy.lua +2 -2
- package/functions/direction.d.ts +1 -1
- package/functions/doors.d.ts +12 -7
- package/functions/doors.lua +14 -11
- package/functions/entity.d.ts +5 -0
- package/functions/entity.lua +13 -0
- package/functions/gridEntity.d.ts +39 -0
- package/functions/gridEntity.lua +83 -2
- package/functions/kColor.d.ts +0 -2
- package/functions/kColor.lua +0 -4
- package/functions/log.lua +2 -1
- package/functions/pickups.d.ts +9 -9
- package/functions/playerCenter.lua +4 -5
- package/functions/playerIndex.d.ts +3 -0
- package/functions/playerIndex.lua +3 -0
- package/functions/roomShape.d.ts +10 -4
- package/functions/roomShape.lua +15 -2
- package/functions/run.d.ts +7 -0
- package/functions/run.lua +16 -4
- package/functions/sprite.d.ts +1 -1
- package/functions/sprite.lua +1 -1
- package/functions/ui.d.ts +2 -0
- package/functions/ui.lua +8 -0
- package/functions/utils.d.ts +6 -4
- package/functions/utils.lua +6 -4
- package/index.d.ts +1 -1
- package/index.lua +2 -0
- package/initFeatures.lua +7 -1
- package/interfaces/Corner.d.ts +6 -0
- package/interfaces/Corner.lua +2 -0
- package/interfaces/CustomStageLua.d.ts +236 -63
- package/objects/backdropTypeToRockAltType.d.ts +6 -0
- package/objects/backdropTypeToRockAltType.lua +69 -0
- package/objects/bossNamePNGFileNames.d.ts +5 -0
- package/objects/bossNamePNGFileNames.lua +108 -0
- package/objects/bossPortraitPNGFileNames.d.ts +5 -0
- package/objects/bossPortraitPNGFileNames.lua +108 -0
- package/objects/colors.d.ts +15 -8
- package/objects/colors.lua +9 -2
- package/objects/playerNamePNGFileNames.d.ts +5 -0
- package/objects/playerNamePNGFileNames.lua +49 -0
- package/objects/playerPortraitPNGFileNames.d.ts +5 -0
- package/objects/playerPortraitPNGFileNames.lua +49 -0
- package/objects/roomShapeCorners.d.ts +6 -0
- package/objects/roomShapeCorners.lua +259 -0
- package/objects/roomShapeToBottomRightPosition.d.ts +1 -1
- package/objects/roomShapeToTopLeftPosition.d.ts +1 -1
- package/objects/versusScreenBackgroundColors.d.ts +5 -0
- package/objects/versusScreenBackgroundColors.lua +38 -0
- package/objects/versusScreenDirtSpotColors.d.ts +5 -0
- package/objects/versusScreenDirtSpotColors.lua +38 -0
- package/package.json +2 -2
- package/sets/narrowRoomShapesSet.d.ts +2 -0
- package/sets/narrowRoomShapesSet.lua +8 -0
package/functions/doors.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare function getDevilRoomOrAngelRoomDoor(): GridEntityDoor | undefine
|
|
|
22
22
|
* they would immediately collide with the loading zone. Instead, they are offset by a certain
|
|
23
23
|
* amount of units.
|
|
24
24
|
*/
|
|
25
|
-
export declare function getDoorEnterPosition(door: GridEntityDoor): Vector
|
|
25
|
+
export declare function getDoorEnterPosition(door: GridEntityDoor): Readonly<Vector>;
|
|
26
26
|
/**
|
|
27
27
|
* Helper function to get the offset from a door position that a player will enter a room at.
|
|
28
28
|
*
|
|
@@ -30,7 +30,7 @@ export declare function getDoorEnterPosition(door: GridEntityDoor): Vector;
|
|
|
30
30
|
* they would immediately collide with the loading zone. Instead, they are offset by a certain
|
|
31
31
|
* amount of units.
|
|
32
32
|
*/
|
|
33
|
-
export declare function getDoorSlotEnterPositionOffset(doorSlot: DoorSlot): Vector
|
|
33
|
+
export declare function getDoorSlotEnterPositionOffset(doorSlot: DoorSlot): Readonly<Vector>;
|
|
34
34
|
/**
|
|
35
35
|
* Helper function to convert an array of door slots or a set of door slots to the resulting bit
|
|
36
36
|
* flag number.
|
|
@@ -70,31 +70,36 @@ export declare function isDevilRoomDoor(door: GridEntityDoor): boolean;
|
|
|
70
70
|
export declare function isDoorSlotInRoomShape(doorSlot: DoorSlot, roomShape: RoomShape): boolean;
|
|
71
71
|
/**
|
|
72
72
|
* This refers to the Repentance door that spawns in a boss room after defeating the boss. You have
|
|
73
|
-
* to spend one key to open it. It has a sprite filename of "gfx/grid/
|
|
73
|
+
* to spend one key to open it. It has a sprite filename of "gfx/grid/door_downpour.anm2".
|
|
74
74
|
*/
|
|
75
75
|
export declare function isDoorToDownpour(door: GridEntityDoor): boolean;
|
|
76
76
|
/**
|
|
77
77
|
* This refers to the Repentance door that spawns in a boss room after defeating the boss. You have
|
|
78
|
-
* to spend two hearts to open it. It has a sprite filename of "gfx/grid/
|
|
78
|
+
* to spend two hearts to open it. It has a sprite filename of "gfx/grid/door_mausoleum.anm2".
|
|
79
79
|
*/
|
|
80
80
|
export declare function isDoorToMausoleum(door: GridEntityDoor): boolean;
|
|
81
81
|
/**
|
|
82
82
|
* This refers to the "strange door" located on the first room of Depths 2. You open it with either
|
|
83
|
-
* a Polaroid or a Negative. It has a sprite filename of "gfx/grid/
|
|
83
|
+
* a Polaroid or a Negative. It has a sprite filename of "gfx/grid/door_mausoleum_alt.anm2".
|
|
84
84
|
*/
|
|
85
85
|
export declare function isDoorToMausoleumAscent(door: GridEntityDoor): boolean;
|
|
86
86
|
/**
|
|
87
87
|
* This refers to the Repentance door that spawns in a boss room after defeating the boss. You have
|
|
88
|
-
* to spend two bombs to open it. It has a sprite filename of "gfx/grid/
|
|
88
|
+
* to spend two bombs to open it. It has a sprite filename of "gfx/grid/door_mines.anm2".
|
|
89
89
|
*/
|
|
90
90
|
export declare function isDoorToMines(door: GridEntityDoor): boolean;
|
|
91
91
|
/**
|
|
92
92
|
* This refers to the Repentance door that spawns after defeating Mom. You open it with the
|
|
93
|
-
* completed knife. It has a sprite filename of "gfx/grid/
|
|
93
|
+
* completed knife. It has a sprite filename of "gfx/grid/door_momsheart.anm2".
|
|
94
94
|
*/
|
|
95
95
|
export declare function isDoorToMomsHeart(door: GridEntityDoor): boolean;
|
|
96
96
|
export declare function isHiddenSecretRoomDoor(door: GridEntityDoor): boolean;
|
|
97
97
|
export declare function isRepentanceDoor(door: GridEntityDoor): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* This refers to the hole in the wall that appears after bombing the entrance to a secret room.
|
|
100
|
+
* Note that the door still exists before it has been bombed open. It has a sprite filename of
|
|
101
|
+
* "gfx/grid/door_08_holeinwall.anm2".
|
|
102
|
+
*/
|
|
98
103
|
export declare function isSecretRoomDoor(door: GridEntityDoor): boolean;
|
|
99
104
|
/**
|
|
100
105
|
* Helper function to reset an unlocked door back to a locked state. Doing this is non-trivial
|
package/functions/doors.lua
CHANGED
|
@@ -77,10 +77,13 @@ end
|
|
|
77
77
|
function ____exports.isRepentanceDoor(self, door)
|
|
78
78
|
return door.TargetRoomIndex == GridRoom.SECRET_EXIT
|
|
79
79
|
end
|
|
80
|
+
--- This refers to the hole in the wall that appears after bombing the entrance to a secret room.
|
|
81
|
+
-- Note that the door still exists before it has been bombed open. It has a sprite filename of
|
|
82
|
+
-- "gfx/grid/door_08_holeinwall.anm2".
|
|
80
83
|
function ____exports.isSecretRoomDoor(self, door)
|
|
81
84
|
local sprite = door:GetSprite()
|
|
82
85
|
local filename = sprite:GetFilename()
|
|
83
|
-
return filename == "gfx/grid/
|
|
86
|
+
return filename == "gfx/grid/door_08_holeinwall.anm2"
|
|
84
87
|
end
|
|
85
88
|
--- Helper function to remove a single door.
|
|
86
89
|
function ____exports.removeDoor(self, door)
|
|
@@ -234,54 +237,54 @@ function ____exports.isDoorSlotInRoomShape(self, doorSlot, roomShape)
|
|
|
234
237
|
return doorSlots:has(doorSlot)
|
|
235
238
|
end
|
|
236
239
|
--- This refers to the Repentance door that spawns in a boss room after defeating the boss. You have
|
|
237
|
-
-- to spend one key to open it. It has a sprite filename of "gfx/grid/
|
|
240
|
+
-- to spend one key to open it. It has a sprite filename of "gfx/grid/door_downpour.anm2".
|
|
238
241
|
function ____exports.isDoorToDownpour(self, door)
|
|
239
242
|
if not ____exports.isRepentanceDoor(nil, door) then
|
|
240
243
|
return false
|
|
241
244
|
end
|
|
242
245
|
local sprite = door:GetSprite()
|
|
243
246
|
local filename = sprite:GetFilename()
|
|
244
|
-
return filename == "gfx/grid/
|
|
247
|
+
return string.lower(filename) == "gfx/grid/door_downpour.anm2"
|
|
245
248
|
end
|
|
246
249
|
--- This refers to the Repentance door that spawns in a boss room after defeating the boss. You have
|
|
247
|
-
-- to spend two hearts to open it. It has a sprite filename of "gfx/grid/
|
|
250
|
+
-- to spend two hearts to open it. It has a sprite filename of "gfx/grid/door_mausoleum.anm2".
|
|
248
251
|
function ____exports.isDoorToMausoleum(self, door)
|
|
249
252
|
if not ____exports.isRepentanceDoor(nil, door) then
|
|
250
253
|
return false
|
|
251
254
|
end
|
|
252
255
|
local sprite = door:GetSprite()
|
|
253
256
|
local filename = sprite:GetFilename()
|
|
254
|
-
return filename == "gfx/grid/
|
|
257
|
+
return string.lower(filename) == "gfx/grid/door_mausoleum.anm2"
|
|
255
258
|
end
|
|
256
259
|
--- This refers to the "strange door" located on the first room of Depths 2. You open it with either
|
|
257
|
-
-- a Polaroid or a Negative. It has a sprite filename of "gfx/grid/
|
|
260
|
+
-- a Polaroid or a Negative. It has a sprite filename of "gfx/grid/door_mausoleum_alt.anm2".
|
|
258
261
|
function ____exports.isDoorToMausoleumAscent(self, door)
|
|
259
262
|
if not ____exports.isRepentanceDoor(nil, door) then
|
|
260
263
|
return false
|
|
261
264
|
end
|
|
262
265
|
local sprite = door:GetSprite()
|
|
263
266
|
local filename = sprite:GetFilename()
|
|
264
|
-
return filename == "gfx/grid/
|
|
267
|
+
return string.lower(filename) == "gfx/grid/door_mausoleum_alt.anm2"
|
|
265
268
|
end
|
|
266
269
|
--- This refers to the Repentance door that spawns in a boss room after defeating the boss. You have
|
|
267
|
-
-- to spend two bombs to open it. It has a sprite filename of "gfx/grid/
|
|
270
|
+
-- to spend two bombs to open it. It has a sprite filename of "gfx/grid/door_mines.anm2".
|
|
268
271
|
function ____exports.isDoorToMines(self, door)
|
|
269
272
|
if not ____exports.isRepentanceDoor(nil, door) then
|
|
270
273
|
return false
|
|
271
274
|
end
|
|
272
275
|
local sprite = door:GetSprite()
|
|
273
276
|
local filename = sprite:GetFilename()
|
|
274
|
-
return filename == "gfx/grid/
|
|
277
|
+
return string.lower(filename) == "gfx/grid/door_mines.anm2"
|
|
275
278
|
end
|
|
276
279
|
--- This refers to the Repentance door that spawns after defeating Mom. You open it with the
|
|
277
|
-
-- completed knife. It has a sprite filename of "gfx/grid/
|
|
280
|
+
-- completed knife. It has a sprite filename of "gfx/grid/door_momsheart.anm2".
|
|
278
281
|
function ____exports.isDoorToMomsHeart(self, door)
|
|
279
282
|
if not ____exports.isRepentanceDoor(nil, door) then
|
|
280
283
|
return false
|
|
281
284
|
end
|
|
282
285
|
local sprite = door:GetSprite()
|
|
283
286
|
local filename = sprite:GetFilename()
|
|
284
|
-
return filename == "gfx/grid/
|
|
287
|
+
return filename == "gfx/grid/door_momsheart.anm2"
|
|
285
288
|
end
|
|
286
289
|
function ____exports.isHiddenSecretRoomDoor(self, door)
|
|
287
290
|
local sprite = door:GetSprite()
|
package/functions/entity.d.ts
CHANGED
|
@@ -72,6 +72,11 @@ export declare function getEntities(entityType?: EntityType, variant?: number, s
|
|
|
72
72
|
export declare function getEntityFields(entity: Entity): LuaTable<string, boolean | number | string>;
|
|
73
73
|
/** Helper function to return a string containing the entity's type, variant, and sub-type. */
|
|
74
74
|
export declare function getEntityID(entity: Entity): string;
|
|
75
|
+
/**
|
|
76
|
+
* Helper function to return a formatted string in the format returned by the `getEntityID`
|
|
77
|
+
* function.
|
|
78
|
+
*/
|
|
79
|
+
export declare function getEntityIDFromConstituents(entityType: EntityType, variant: int, subType: int): string;
|
|
75
80
|
/**
|
|
76
81
|
* Helper function to compare two different arrays of entities. Returns the entities that are in the
|
|
77
82
|
* second array but not in the first array.
|
package/functions/entity.lua
CHANGED
|
@@ -202,6 +202,11 @@ end
|
|
|
202
202
|
function ____exports.getEntityID(self, entity)
|
|
203
203
|
return (((tostring(entity.Type) .. ".") .. tostring(entity.Variant)) .. ".") .. tostring(entity.SubType)
|
|
204
204
|
end
|
|
205
|
+
--- Helper function to return a formatted string in the format returned by the `getEntityID`
|
|
206
|
+
-- function.
|
|
207
|
+
function ____exports.getEntityIDFromConstituents(self, entityType, variant, subType)
|
|
208
|
+
return (((tostring(entityType) .. ".") .. tostring(variant)) .. ".") .. tostring(subType)
|
|
209
|
+
end
|
|
205
210
|
--- Helper function to compare two different arrays of entities. Returns the entities that are in the
|
|
206
211
|
-- second array but not in the first array.
|
|
207
212
|
function ____exports.getFilteredNewEntities(self, oldEntities, newEntities)
|
|
@@ -349,6 +354,14 @@ function ____exports.spawn(self, entityType, variant, subType, position, velocit
|
|
|
349
354
|
if seedOrRNG == nil then
|
|
350
355
|
seedOrRNG = nil
|
|
351
356
|
end
|
|
357
|
+
if position == nil then
|
|
358
|
+
local entityID = ____exports.getEntityIDFromConstituents(nil, entityType, variant, subType)
|
|
359
|
+
error(("Failed to spawn entity " .. entityID) .. " since an undefined position was passed to the \"spawn\" function.")
|
|
360
|
+
end
|
|
361
|
+
if velocity == nil then
|
|
362
|
+
local entityID = ____exports.getEntityIDFromConstituents(nil, entityType, variant, subType)
|
|
363
|
+
error(("Failed to spawn entity " .. entityID) .. " since an undefined velocity was passed to the \"spawn\" function.")
|
|
364
|
+
end
|
|
352
365
|
if seedOrRNG == nil then
|
|
353
366
|
return Isaac.Spawn(
|
|
354
367
|
entityType,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GridEntityType, GridEntityXMLType } from "isaac-typescript-definitions";
|
|
2
|
+
import { RockAltType } from "../enums/RockAltType";
|
|
2
3
|
/**
|
|
3
4
|
* Helper function to convert the grid entity type found in a room XML file to the corresponding
|
|
4
5
|
* grid entity type and variant normally used by the game. For example, a rock is represented as
|
|
@@ -61,11 +62,31 @@ export declare function getGridEntitiesExcept(...gridEntityTypes: GridEntityType
|
|
|
61
62
|
export declare function getGridEntitiesMap(...gridEntityTypes: GridEntityType[]): Map<int, GridEntity>;
|
|
62
63
|
/** Helper function to return a string containing the grid entity's type and variant. */
|
|
63
64
|
export declare function getGridEntityID(gridEntity: GridEntity): string;
|
|
65
|
+
/**
|
|
66
|
+
* Helper function to return a formatted string in the format returned by the `getGridEntityID`
|
|
67
|
+
* function.
|
|
68
|
+
*/
|
|
69
|
+
export declare function getGridEntityIDFromConstituents(gridEntityType: GridEntityType, variant: int): string;
|
|
64
70
|
/**
|
|
65
71
|
* Helper function to get all of the grid entities in the room that specifically match the type and
|
|
66
72
|
* variant provided.
|
|
67
73
|
*/
|
|
68
74
|
export declare function getMatchingGridEntities(gridEntityType: GridEntityType, variant: int): GridEntity[];
|
|
75
|
+
/**
|
|
76
|
+
* Helper function to get the alternate rock type (i.e. urn, mushroom, etc.) that the current room
|
|
77
|
+
* will have.
|
|
78
|
+
*
|
|
79
|
+
* The rock type is based on the backdrop of the room.
|
|
80
|
+
*
|
|
81
|
+
* For example, if you change the backdrop of the starting room of the run to `BackdropType.CAVES`,
|
|
82
|
+
* and then spawn `GridEntityType.ROCK_ALT`, it will be a mushroom instead of an urn. Additionally,
|
|
83
|
+
* if it is destroyed, it will generate mushroom-appropriate rewards.
|
|
84
|
+
*
|
|
85
|
+
* On the other hand, if an urn is spawned first before the backdrop is changed to
|
|
86
|
+
* `BackdropType.CAVES`, the graphic of the urn will not switch to a mushroom. However, when
|
|
87
|
+
* destroyed, the urn will still generate mushroom-appropriate rewards.
|
|
88
|
+
*/
|
|
89
|
+
export declare function getRockAltType(): RockAltType;
|
|
69
90
|
export declare function getSurroundingGridEntities(gridEntity: GridEntity): GridEntity[];
|
|
70
91
|
export declare function getTopLeftWall(): GridEntity | undefined;
|
|
71
92
|
/**
|
|
@@ -173,6 +194,24 @@ export declare function spawnGrid(gridEntityType: GridEntityType, gridIndexOrPos
|
|
|
173
194
|
* - allows you to specify the grid index or the position
|
|
174
195
|
*/
|
|
175
196
|
export declare function spawnGridWithVariant(gridEntityType: GridEntityType, variant: int, gridIndexOrPosition: int | Vector): GridEntity | undefined;
|
|
197
|
+
/**
|
|
198
|
+
* Helper function for emulating what happens when a vanilla `GridEntityType.ROCK_ALT` grid entity
|
|
199
|
+
* breaks.
|
|
200
|
+
*
|
|
201
|
+
* Note that most of the time, this function will do nothing, similar to how most of the time, when
|
|
202
|
+
* an individual urn is destroyed, nothing will spawn.
|
|
203
|
+
*
|
|
204
|
+
* The logic in this function is based on the rewards listed on the wiki:
|
|
205
|
+
* https://bindingofisaacrebirth.fandom.com/wiki/Rocks
|
|
206
|
+
*
|
|
207
|
+
* @param rockAltType The type of reward to spawn. For example, `RockAltType.URN` will have a chance
|
|
208
|
+
* at spawning coins and spiders.
|
|
209
|
+
* @param _seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided,
|
|
210
|
+
* the `RNG.Next` method will be called. Default is `getRandomSeed()`. Normally,
|
|
211
|
+
* you should pass the `InitSeed` of the grid entity that was broken.
|
|
212
|
+
* @returns Whether or not this function spawned something.
|
|
213
|
+
*/
|
|
214
|
+
export declare function spawnRockAltReward(rockAltType: RockAltType, _seedOrRNG?: Seed | RNG): boolean;
|
|
176
215
|
/**
|
|
177
216
|
* Helper function to spawn a Void Portal. This is more complicated than simply spawning a trapdoor
|
|
178
217
|
* with the appropriate variant, as the game does not give it the correct sprite automatically.
|
package/functions/gridEntity.lua
CHANGED
|
@@ -15,6 +15,8 @@ local ____cachedClasses = require("cachedClasses")
|
|
|
15
15
|
local game = ____cachedClasses.game
|
|
16
16
|
local ____constants = require("constants")
|
|
17
17
|
local DISTANCE_OF_GRID_TILE = ____constants.DISTANCE_OF_GRID_TILE
|
|
18
|
+
local ____RockAltType = require("enums.RockAltType")
|
|
19
|
+
local RockAltType = ____RockAltType.RockAltType
|
|
18
20
|
local ____gridEntityTypeToBrokenStateMap = require("maps.gridEntityTypeToBrokenStateMap")
|
|
19
21
|
local GRID_ENTITY_TYPE_TO_BROKEN_STATE_MAP = ____gridEntityTypeToBrokenStateMap.GRID_ENTITY_TYPE_TO_BROKEN_STATE_MAP
|
|
20
22
|
local ____gridEntityXMLMap = require("maps.gridEntityXMLMap")
|
|
@@ -22,8 +24,12 @@ local GRID_ENTITY_XML_MAP = ____gridEntityXMLMap.GRID_ENTITY_XML_MAP
|
|
|
22
24
|
local ____roomShapeToTopLeftWallGridIndexMap = require("maps.roomShapeToTopLeftWallGridIndexMap")
|
|
23
25
|
local DEFAULT_TOP_LEFT_WALL_GRID_INDEX = ____roomShapeToTopLeftWallGridIndexMap.DEFAULT_TOP_LEFT_WALL_GRID_INDEX
|
|
24
26
|
local ROOM_SHAPE_TO_TOP_LEFT_WALL_GRID_INDEX_MAP = ____roomShapeToTopLeftWallGridIndexMap.ROOM_SHAPE_TO_TOP_LEFT_WALL_GRID_INDEX_MAP
|
|
27
|
+
local ____backdropTypeToRockAltType = require("objects.backdropTypeToRockAltType")
|
|
28
|
+
local BACKDROP_TYPE_TO_ROCK_ALT_TYPE = ____backdropTypeToRockAltType.BACKDROP_TYPE_TO_ROCK_ALT_TYPE
|
|
25
29
|
local ____math = require("functions.math")
|
|
26
30
|
local isCircleIntersectingRectangle = ____math.isCircleIntersectingRectangle
|
|
31
|
+
local ____rng = require("functions.rng")
|
|
32
|
+
local getRandomSeed = ____rng.getRandomSeed
|
|
27
33
|
local ____rooms = require("functions.rooms")
|
|
28
34
|
local roomUpdateSafe = ____rooms.roomUpdateSafe
|
|
29
35
|
local ____sprite = require("functions.sprite")
|
|
@@ -238,8 +244,13 @@ end
|
|
|
238
244
|
--- Helper function to return a string containing the grid entity's type and variant.
|
|
239
245
|
function ____exports.getGridEntityID(self, gridEntity)
|
|
240
246
|
local gridEntityType = gridEntity:GetType()
|
|
241
|
-
local
|
|
242
|
-
return (tostring(gridEntityType) .. ".") .. tostring(
|
|
247
|
+
local variant = gridEntity:GetVariant()
|
|
248
|
+
return (tostring(gridEntityType) .. ".") .. tostring(variant)
|
|
249
|
+
end
|
|
250
|
+
--- Helper function to return a formatted string in the format returned by the `getGridEntityID`
|
|
251
|
+
-- function.
|
|
252
|
+
function ____exports.getGridEntityIDFromConstituents(self, gridEntityType, variant)
|
|
253
|
+
return (tostring(gridEntityType) .. ".") .. tostring(variant)
|
|
243
254
|
end
|
|
244
255
|
--- Helper function to get all of the grid entities in the room that specifically match the type and
|
|
245
256
|
-- variant provided.
|
|
@@ -250,6 +261,23 @@ function ____exports.getMatchingGridEntities(self, gridEntityType, variant)
|
|
|
250
261
|
function(____, gridEntity) return gridEntity:GetVariant() == variant end
|
|
251
262
|
)
|
|
252
263
|
end
|
|
264
|
+
--- Helper function to get the alternate rock type (i.e. urn, mushroom, etc.) that the current room
|
|
265
|
+
-- will have.
|
|
266
|
+
--
|
|
267
|
+
-- The rock type is based on the backdrop of the room.
|
|
268
|
+
--
|
|
269
|
+
-- For example, if you change the backdrop of the starting room of the run to `BackdropType.CAVES`,
|
|
270
|
+
-- and then spawn `GridEntityType.ROCK_ALT`, it will be a mushroom instead of an urn. Additionally,
|
|
271
|
+
-- if it is destroyed, it will generate mushroom-appropriate rewards.
|
|
272
|
+
--
|
|
273
|
+
-- On the other hand, if an urn is spawned first before the backdrop is changed to
|
|
274
|
+
-- `BackdropType.CAVES`, the graphic of the urn will not switch to a mushroom. However, when
|
|
275
|
+
-- destroyed, the urn will still generate mushroom-appropriate rewards.
|
|
276
|
+
function ____exports.getRockAltType(self)
|
|
277
|
+
local room = game:GetRoom()
|
|
278
|
+
local backdropType = room:GetBackdropType()
|
|
279
|
+
return BACKDROP_TYPE_TO_ROCK_ALT_TYPE[backdropType]
|
|
280
|
+
end
|
|
253
281
|
function ____exports.getSurroundingGridEntities(self, gridEntity)
|
|
254
282
|
local room = game:GetRoom()
|
|
255
283
|
local gridWidth = room:GetGridWidth()
|
|
@@ -395,6 +423,59 @@ end
|
|
|
395
423
|
function ____exports.spawnGrid(self, gridEntityType, gridIndexOrPosition)
|
|
396
424
|
return ____exports.spawnGridWithVariant(nil, gridEntityType, 0, gridIndexOrPosition)
|
|
397
425
|
end
|
|
426
|
+
--- Helper function for emulating what happens when a vanilla `GridEntityType.ROCK_ALT` grid entity
|
|
427
|
+
-- breaks.
|
|
428
|
+
--
|
|
429
|
+
-- Note that most of the time, this function will do nothing, similar to how most of the time, when
|
|
430
|
+
-- an individual urn is destroyed, nothing will spawn.
|
|
431
|
+
--
|
|
432
|
+
-- The logic in this function is based on the rewards listed on the wiki:
|
|
433
|
+
-- https://bindingofisaacrebirth.fandom.com/wiki/Rocks
|
|
434
|
+
--
|
|
435
|
+
-- @param rockAltType The type of reward to spawn. For example, `RockAltType.URN` will have a chance
|
|
436
|
+
-- at spawning coins and spiders.
|
|
437
|
+
-- @param _seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided,
|
|
438
|
+
-- the `RNG.Next` method will be called. Default is `getRandomSeed()`. Normally,
|
|
439
|
+
-- you should pass the `InitSeed` of the grid entity that was broken.
|
|
440
|
+
-- @returns Whether or not this function spawned something.
|
|
441
|
+
function ____exports.spawnRockAltReward(self, rockAltType, _seedOrRNG)
|
|
442
|
+
if _seedOrRNG == nil then
|
|
443
|
+
_seedOrRNG = getRandomSeed(nil)
|
|
444
|
+
end
|
|
445
|
+
repeat
|
|
446
|
+
local ____switch56 = rockAltType
|
|
447
|
+
local ____cond56 = ____switch56 == RockAltType.URN
|
|
448
|
+
if ____cond56 then
|
|
449
|
+
do
|
|
450
|
+
return false
|
|
451
|
+
end
|
|
452
|
+
end
|
|
453
|
+
____cond56 = ____cond56 or ____switch56 == RockAltType.MUSHROOM
|
|
454
|
+
if ____cond56 then
|
|
455
|
+
do
|
|
456
|
+
return false
|
|
457
|
+
end
|
|
458
|
+
end
|
|
459
|
+
____cond56 = ____cond56 or ____switch56 == RockAltType.SKULL
|
|
460
|
+
if ____cond56 then
|
|
461
|
+
do
|
|
462
|
+
return false
|
|
463
|
+
end
|
|
464
|
+
end
|
|
465
|
+
____cond56 = ____cond56 or ____switch56 == RockAltType.POLYP
|
|
466
|
+
if ____cond56 then
|
|
467
|
+
do
|
|
468
|
+
return false
|
|
469
|
+
end
|
|
470
|
+
end
|
|
471
|
+
____cond56 = ____cond56 or ____switch56 == RockAltType.BUCKET
|
|
472
|
+
if ____cond56 then
|
|
473
|
+
do
|
|
474
|
+
return false
|
|
475
|
+
end
|
|
476
|
+
end
|
|
477
|
+
until true
|
|
478
|
+
end
|
|
398
479
|
--- Helper function to spawn a Void Portal. This is more complicated than simply spawning a trapdoor
|
|
399
480
|
-- with the appropriate variant, as the game does not give it the correct sprite automatically.
|
|
400
481
|
function ____exports.spawnVoidPortal(self, gridIndex)
|
package/functions/kColor.d.ts
CHANGED
|
@@ -18,8 +18,6 @@ interface CopyKColorReturn {
|
|
|
18
18
|
*/
|
|
19
19
|
export declare function copyKColor<K extends KColor | SerializedKColor, S extends SerializationType>(kColor: K, serializationType: S): CopyKColorReturn[S];
|
|
20
20
|
export declare function copyKColor<K extends KColor | SerializedKColor>(kColor: K): CopyKColorReturn[SerializationType.NONE];
|
|
21
|
-
/** Returns `KColor(1, 1, 1, 1)`. */
|
|
22
|
-
export declare function getDefaultKColor(): KColor;
|
|
23
21
|
/** Helper function to check if something is an instantiated KColor object. */
|
|
24
22
|
export declare function isKColor(object: unknown): object is KColor;
|
|
25
23
|
/**
|
package/functions/kColor.lua
CHANGED
|
@@ -80,10 +80,6 @@ function ____exports.copyKColor(self, kColor, serializationType)
|
|
|
80
80
|
end
|
|
81
81
|
until true
|
|
82
82
|
end
|
|
83
|
-
--- Returns `KColor(1, 1, 1, 1)`.
|
|
84
|
-
function ____exports.getDefaultKColor(self)
|
|
85
|
-
return KColor(1, 1, 1, 1)
|
|
86
|
-
end
|
|
87
83
|
--- Used to determine is the given table is a serialized `KColor` object created by the save data
|
|
88
84
|
-- manager and/or the `deepCopy` function.
|
|
89
85
|
function ____exports.isSerializedKColor(self, object)
|
package/functions/log.lua
CHANGED
|
@@ -247,7 +247,8 @@ function ____exports.logEntityFlags(flags)
|
|
|
247
247
|
____exports.logFlags(flags, EntityFlag, "entity")
|
|
248
248
|
end
|
|
249
249
|
function ____exports.logEntityID(entity)
|
|
250
|
-
|
|
250
|
+
local entityID = getEntityID(nil, entity)
|
|
251
|
+
____exports.log("Entity: " .. entityID)
|
|
251
252
|
end
|
|
252
253
|
--- Helper function to log an error message and also print it to the console for better visibility.
|
|
253
254
|
--
|
package/functions/pickups.d.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { BatterySubType, Card, CoinSubType, CollectibleType, HeartSubType, KeySubType, PillColor, SackSubType, TrinketType } from "isaac-typescript-definitions";
|
|
2
2
|
/** Helper function to get all of the battery entities in the room. */
|
|
3
|
-
export declare function getBatteries(matchingSubType?:
|
|
3
|
+
export declare function getBatteries(matchingSubType?: BatterySubType | -1): EntityPickupBattery[];
|
|
4
4
|
/** Helper function to get all of the card entities in the room. */
|
|
5
|
-
export declare function getCards(matchingSubType?:
|
|
5
|
+
export declare function getCards(matchingSubType?: Card | -1): EntityPickupCard[];
|
|
6
6
|
/**
|
|
7
7
|
* Helper function to get the corresponding coin amount from a `CoinSubType`. Returns 1 for modded
|
|
8
8
|
* sub-types.
|
|
9
9
|
*/
|
|
10
10
|
export declare function getCoinValue(coinSubType: CoinSubType): int;
|
|
11
11
|
/** Helper function to get all of the coin pickup entities in the room. */
|
|
12
|
-
export declare function getCoins(matchingSubType?:
|
|
12
|
+
export declare function getCoins(matchingSubType?: CoinSubType | -1): EntityPickupCoin[];
|
|
13
13
|
/** Helper function to get all of the collectible entities in the room. */
|
|
14
|
-
export declare function getCollectibles(matchingSubType?:
|
|
14
|
+
export declare function getCollectibles(matchingSubType?: CollectibleType | -1): EntityPickupCollectible[];
|
|
15
15
|
/** Helper function to get all of the heart pickup entities in the room. */
|
|
16
|
-
export declare function getHearts(matchingSubType?:
|
|
16
|
+
export declare function getHearts(matchingSubType?: HeartSubType | -1): EntityPickupHeart[];
|
|
17
17
|
/** Helper function to get all of the key pickup entities in the room. */
|
|
18
|
-
export declare function getKeys(matchingSubType?:
|
|
18
|
+
export declare function getKeys(matchingSubType?: KeySubType | -1): EntityPickupKey[];
|
|
19
19
|
/** Helper function to get all of the pill entities in the room. */
|
|
20
|
-
export declare function getPills(matchingSubType?:
|
|
20
|
+
export declare function getPills(matchingSubType?: PillColor | -1): EntityPickupPill[];
|
|
21
21
|
/** Helper function to get all of the red heart pickup entities in the room. */
|
|
22
22
|
export declare function getRedHearts(): EntityPickupHeart[];
|
|
23
23
|
/** Helper function to get all of the sack (i.e. grab bag) entities in the room. */
|
|
24
|
-
export declare function getSacks(matchingSubType?:
|
|
24
|
+
export declare function getSacks(matchingSubType?: SackSubType | -1): EntityPickupSack[];
|
|
25
25
|
/** Helper function to get all of the trinket entities in the room. */
|
|
26
|
-
export declare function getTrinkets(matchingSubType?:
|
|
26
|
+
export declare function getTrinkets(matchingSubType?: TrinketType | -1): EntityPickupTrinket[];
|
|
27
27
|
export declare function isChest(pickup: EntityPickup): boolean;
|
|
28
28
|
export declare function isRedHeart(pickup: EntityPickup): boolean;
|
|
29
29
|
/**
|
|
@@ -4,6 +4,9 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
|
|
|
4
4
|
local Direction = ____isaac_2Dtypescript_2Ddefinitions.Direction
|
|
5
5
|
local ____cachedClasses = require("cachedClasses")
|
|
6
6
|
local game = ____cachedClasses.game
|
|
7
|
+
local ____constants = require("constants")
|
|
8
|
+
local NEW_FLOOR_STARTING_POSITION_GREED_MODE = ____constants.NEW_FLOOR_STARTING_POSITION_GREED_MODE
|
|
9
|
+
local NEW_FLOOR_STARTING_POSITION_NORMAL_MODE = ____constants.NEW_FLOOR_STARTING_POSITION_NORMAL_MODE
|
|
7
10
|
local ____familiars = require("functions.familiars")
|
|
8
11
|
local getPlayerFamiliars = ____familiars.getPlayerFamiliars
|
|
9
12
|
local ____math = require("functions.math")
|
|
@@ -17,10 +20,6 @@ function movePlayerAndTheirFamiliars(self, player, position)
|
|
|
17
20
|
familiar.Position = position
|
|
18
21
|
end
|
|
19
22
|
end
|
|
20
|
-
--- This is in the center of the room.
|
|
21
|
-
local NORMAL_MODE_NEW_FLOOR_STARTING_POSITION = Vector(320, 380)
|
|
22
|
-
--- This is near the top door.
|
|
23
|
-
local GREED_MODE_NEW_FLOOR_STARTING_POSITION = Vector(320, 280)
|
|
24
23
|
local CIRCLE_RADIUS_BETWEEN_PLAYERS = 50
|
|
25
24
|
--- Helper function to move all of the players to where they would normally go when arriving at a new
|
|
26
25
|
-- floor. (In normal mode, this is the center of the room. In Greed Mode, this is below the top
|
|
@@ -31,7 +30,7 @@ local CIRCLE_RADIUS_BETWEEN_PLAYERS = 50
|
|
|
31
30
|
-- This function emulates what happens in the vanilla game when you travel to a new floor.
|
|
32
31
|
function ____exports.movePlayersToCenter(self)
|
|
33
32
|
local isGreedMode = game:IsGreedMode()
|
|
34
|
-
local startingPosition = isGreedMode and
|
|
33
|
+
local startingPosition = isGreedMode and NEW_FLOOR_STARTING_POSITION_GREED_MODE or NEW_FLOOR_STARTING_POSITION_NORMAL_MODE
|
|
35
34
|
local players = getPlayers(nil)
|
|
36
35
|
local firstPlayer = players[1]
|
|
37
36
|
if firstPlayer == nil then
|
|
@@ -44,6 +44,9 @@ export declare function getPlayerIndex(player: EntityPlayer, differentiateForgot
|
|
|
44
44
|
/**
|
|
45
45
|
* Helper function to return the index of this player with respect to the output of the
|
|
46
46
|
* `Isaac.GetPlayer` method.
|
|
47
|
+
*
|
|
48
|
+
* Note that if you storing information about a player in a data structure, you never want to use
|
|
49
|
+
* this index; use the `getPlayerIndex` function instead.
|
|
47
50
|
*/
|
|
48
51
|
export declare function getPlayerIndexVanilla(playerToFind: EntityPlayer): int | undefined;
|
|
49
52
|
/**
|
|
@@ -155,6 +155,9 @@ function ____exports.getPlayerFromIndex(self, playerIndex)
|
|
|
155
155
|
end
|
|
156
156
|
--- Helper function to return the index of this player with respect to the output of the
|
|
157
157
|
-- `Isaac.GetPlayer` method.
|
|
158
|
+
--
|
|
159
|
+
-- Note that if you storing information about a player in a data structure, you never want to use
|
|
160
|
+
-- this index; use the `getPlayerIndex` function instead.
|
|
158
161
|
function ____exports.getPlayerIndexVanilla(self, playerToFind)
|
|
159
162
|
local numPlayers = game:GetNumPlayers()
|
|
160
163
|
local playerToFindHash = GetPtrHash(playerToFind)
|
package/functions/roomShape.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DoorSlot, RoomShape } from "isaac-typescript-definitions";
|
|
2
|
+
import { Corner } from "../interfaces/Corner";
|
|
2
3
|
/**
|
|
3
4
|
* Helper function to get the grid index delta that a door out of the given room shape would lead
|
|
4
5
|
* to. For example, if you went through the bottom door in a room of `RoomShape.SHAPE_1x2`, you
|
|
@@ -12,7 +13,7 @@ export declare function getGridIndexDelta(roomShape: RoomShape, doorSlot: DoorSl
|
|
|
12
13
|
*
|
|
13
14
|
* For example, `RoomShape.SHAPE_2x2` will return 2.
|
|
14
15
|
*/
|
|
15
|
-
export declare function getRoomShapeBottomRightPosition(roomShape: RoomShape): Vector
|
|
16
|
+
export declare function getRoomShapeBottomRightPosition(roomShape: RoomShape): Readonly<Vector>;
|
|
16
17
|
/**
|
|
17
18
|
* Helper function to get the grid position of the bottom-right tile of a given room shape.
|
|
18
19
|
*
|
|
@@ -21,10 +22,14 @@ export declare function getRoomShapeBottomRightPosition(roomShape: RoomShape): V
|
|
|
21
22
|
*/
|
|
22
23
|
export declare function getRoomShapeBounds(roomShape: RoomShape): readonly [width: int, height: int];
|
|
23
24
|
/**
|
|
24
|
-
* Helper function to get the
|
|
25
|
-
*
|
|
25
|
+
* Helper function to get the number of charges that a given room shape will grant to a player upon
|
|
26
|
+
* clearing it.
|
|
27
|
+
*
|
|
28
|
+
* For example, `RoomShape.SHAPE_2x2` will return 2.
|
|
26
29
|
*/
|
|
27
30
|
export declare function getRoomShapeCharges(roomShape: RoomShape): int;
|
|
31
|
+
/** Helper function to get the corners that exist in the given room shape. */
|
|
32
|
+
export declare function getRoomShapeCorners(roomShape: RoomShape): readonly Corner[];
|
|
28
33
|
/**
|
|
29
34
|
* Helper function to get the dimensions of a room shape's layout. This is NOT the size of the
|
|
30
35
|
* room's actual contents! For that, use the `getRoomShapeBounds` function.
|
|
@@ -38,7 +43,7 @@ export declare function getRoomShapeLayoutSize(roomShape: RoomShape): readonly [
|
|
|
38
43
|
* "Vector(0, 0)" corresponds to the top left tile of a room, not including the walls. (The top-left
|
|
39
44
|
* wall would be at "Vector(-1, -1)".)
|
|
40
45
|
*/
|
|
41
|
-
export declare function getRoomShapeTopLeftPosition(roomShape: RoomShape): Vector
|
|
46
|
+
export declare function getRoomShapeTopLeftPosition(roomShape: RoomShape): Readonly<Vector>;
|
|
42
47
|
/**
|
|
43
48
|
* Helper function to get the volume of a room shape, which is the amount of tiles that are inside
|
|
44
49
|
* the room.
|
|
@@ -48,6 +53,7 @@ export declare function getRoomShapeTopLeftPosition(roomShape: RoomShape): Vecto
|
|
|
48
53
|
export declare function getRoomShapeVolume(roomShape: RoomShape): int;
|
|
49
54
|
export declare function getRoomShapeWidth(roomShape: RoomShape): int;
|
|
50
55
|
export declare function isLRoom(roomShape: RoomShape): boolean;
|
|
56
|
+
export declare function isNarrowRoom(roomShape: RoomShape): boolean;
|
|
51
57
|
/**
|
|
52
58
|
* Helper function to see if a given room shape will grant a single charge or a double charge to the
|
|
53
59
|
* player's active item(s).
|
package/functions/roomShape.lua
CHANGED
|
@@ -5,6 +5,8 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
|
|
|
5
5
|
local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
|
|
6
6
|
local ____roomShapeBounds = require("objects.roomShapeBounds")
|
|
7
7
|
local ROOM_SHAPE_BOUNDS = ____roomShapeBounds.ROOM_SHAPE_BOUNDS
|
|
8
|
+
local ____roomShapeCorners = require("objects.roomShapeCorners")
|
|
9
|
+
local ROOM_SHAPE_CORNERS = ____roomShapeCorners.ROOM_SHAPE_CORNERS
|
|
8
10
|
local ____roomShapeLayoutSizes = require("objects.roomShapeLayoutSizes")
|
|
9
11
|
local ROOM_SHAPE_LAYOUT_SIZES = ____roomShapeLayoutSizes.ROOM_SHAPE_LAYOUT_SIZES
|
|
10
12
|
local ____roomShapeToBottomRightPosition = require("objects.roomShapeToBottomRightPosition")
|
|
@@ -19,6 +21,8 @@ local ____roomShapeVolumes = require("objects.roomShapeVolumes")
|
|
|
19
21
|
local ROOM_SHAPE_VOLUMES = ____roomShapeVolumes.ROOM_SHAPE_VOLUMES
|
|
20
22
|
local ____LRoomShapesSet = require("sets.LRoomShapesSet")
|
|
21
23
|
local L_ROOM_SHAPES_SET = ____LRoomShapesSet.L_ROOM_SHAPES_SET
|
|
24
|
+
local ____narrowRoomShapesSet = require("sets.narrowRoomShapesSet")
|
|
25
|
+
local NARROW_ROOM_SHAPES_SET = ____narrowRoomShapesSet.NARROW_ROOM_SHAPES_SET
|
|
22
26
|
--- Helper function to see if a given room shape will grant a single charge or a double charge to the
|
|
23
27
|
-- player's active item(s).
|
|
24
28
|
--
|
|
@@ -48,11 +52,17 @@ end
|
|
|
48
52
|
function ____exports.getRoomShapeBounds(self, roomShape)
|
|
49
53
|
return ROOM_SHAPE_BOUNDS[roomShape]
|
|
50
54
|
end
|
|
51
|
-
--- Helper function to get the
|
|
52
|
-
--
|
|
55
|
+
--- Helper function to get the number of charges that a given room shape will grant to a player upon
|
|
56
|
+
-- clearing it.
|
|
57
|
+
--
|
|
58
|
+
-- For example, `RoomShape.SHAPE_2x2` will return 2.
|
|
53
59
|
function ____exports.getRoomShapeCharges(self, roomShape)
|
|
54
60
|
return ____exports.isRoomShapeDoubleCharge(nil, roomShape) and 2 or 1
|
|
55
61
|
end
|
|
62
|
+
--- Helper function to get the corners that exist in the given room shape.
|
|
63
|
+
function ____exports.getRoomShapeCorners(self, roomShape)
|
|
64
|
+
return ROOM_SHAPE_CORNERS[roomShape]
|
|
65
|
+
end
|
|
56
66
|
--- Helper function to get the dimensions of a room shape's layout. This is NOT the size of the
|
|
57
67
|
-- room's actual contents! For that, use the `getRoomShapeBounds` function.
|
|
58
68
|
--
|
|
@@ -80,4 +90,7 @@ end
|
|
|
80
90
|
function ____exports.isLRoom(self, roomShape)
|
|
81
91
|
return L_ROOM_SHAPES_SET:has(roomShape)
|
|
82
92
|
end
|
|
93
|
+
function ____exports.isNarrowRoom(self, roomShape)
|
|
94
|
+
return NARROW_ROOM_SHAPES_SET:has(roomShape)
|
|
95
|
+
end
|
|
83
96
|
return ____exports
|
package/functions/run.d.ts
CHANGED
|
@@ -13,3 +13,10 @@ export declare function onSetSeed(): boolean;
|
|
|
13
13
|
* You can optionally specify a `PlayerType` to restart the game as that character.
|
|
14
14
|
*/
|
|
15
15
|
export declare function restart(character?: PlayerType): void;
|
|
16
|
+
/**
|
|
17
|
+
* Helper function to change the run status to that of an unseeded run with a new random seed.
|
|
18
|
+
*
|
|
19
|
+
* This is useful to revert the behavior where playing on a set and restarting the game will not
|
|
20
|
+
* take you to a new seed.
|
|
21
|
+
*/
|
|
22
|
+
export declare function setUnseeded(): void;
|
package/functions/run.lua
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
2
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
3
3
|
local Challenge = ____isaac_2Dtypescript_2Ddefinitions.Challenge
|
|
4
|
+
local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
|
|
4
5
|
local ____cachedClasses = require("cachedClasses")
|
|
5
6
|
local game = ____cachedClasses.game
|
|
6
7
|
local ____constantsFirstLast = require("constantsFirstLast")
|
|
@@ -23,14 +24,25 @@ end
|
|
|
23
24
|
-- You can optionally specify a `PlayerType` to restart the game as that character.
|
|
24
25
|
function ____exports.restart(self, character)
|
|
25
26
|
if character == nil then
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
local command = "restart"
|
|
28
|
+
log("Restarting the run with a console command of: " .. command)
|
|
29
|
+
Isaac.ExecuteCommand(command)
|
|
28
30
|
return
|
|
29
31
|
end
|
|
30
32
|
if character < FIRST_CHARACTER then
|
|
31
33
|
error(("Restarting as a character of " .. tostring(character)) .. " would crash the game.")
|
|
32
34
|
end
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
local command = "restart " .. tostring(character)
|
|
36
|
+
log((((("Restarting the run as PlayerType." .. tostring(PlayerType[character])) .. " (") .. tostring(character)) .. ") with a console command of: ") .. command)
|
|
37
|
+
Isaac.ExecuteCommand(command)
|
|
38
|
+
end
|
|
39
|
+
--- Helper function to change the run status to that of an unseeded run with a new random seed.
|
|
40
|
+
--
|
|
41
|
+
-- This is useful to revert the behavior where playing on a set and restarting the game will not
|
|
42
|
+
-- take you to a new seed.
|
|
43
|
+
function ____exports.setUnseeded(self)
|
|
44
|
+
local seeds = game:GetSeeds()
|
|
45
|
+
seeds:Reset()
|
|
46
|
+
seeds:Restart(Challenge.NULL)
|
|
35
47
|
end
|
|
36
48
|
return ____exports
|
package/functions/sprite.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// <reference types="isaac-typescript-definitions" />
|
|
3
3
|
/// <reference types="isaac-typescript-definitions" />
|
|
4
4
|
/**
|
|
5
|
-
* Helper function to clear
|
|
5
|
+
* Helper function to clear all layers or specific layers from a sprite.
|
|
6
6
|
*
|
|
7
7
|
* This function is variadic, so pass as many layer IDs as you want to clear. If no specific layers
|
|
8
8
|
* are passed, it will clear every layer.
|