isaacscript-common 6.4.0 → 6.6.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/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.lua +7 -16
- package/features/customStage/gridEntities.d.ts +18 -0
- package/features/customStage/gridEntities.lua +215 -0
- package/features/customStage/init.lua +43 -1
- package/features/customStage/shadows.d.ts +3 -0
- package/features/customStage/shadows.lua +59 -0
- package/features/customStage/streakText.d.ts +1 -0
- package/features/customStage/streakText.lua +7 -0
- package/features/customStage/v.d.ts +3 -0
- package/features/customStage/v.lua +1 -1
- package/features/customStage/versusScreen.lua +18 -10
- package/features/extraConsoleCommands/init.lua +2 -0
- package/features/extraConsoleCommands/listCommands.d.ts +9 -2
- package/features/extraConsoleCommands/listCommands.lua +20 -4
- package/functions/doors.d.ts +10 -5
- package/functions/doors.lua +20 -17
- package/functions/gridEntity.d.ts +34 -0
- package/functions/gridEntity.lua +76 -0
- package/functions/pickups.d.ts +9 -9
- package/functions/run.d.ts +7 -0
- package/functions/run.lua +16 -4
- package/interfaces/CustomStageLua.d.ts +271 -88
- package/objects/backdropTypeToRockAltType.d.ts +6 -0
- package/objects/backdropTypeToRockAltType.lua +69 -0
- package/package.json +2 -2
- package/shaderCrashFix.d.ts +7 -0
- package/shaderCrashFix.lua +18 -0
- package/upgradeMod.lua +4 -1
|
@@ -153,10 +153,15 @@ export declare function goldenBomb(): void;
|
|
|
153
153
|
export declare function goldenHearts(params: string): void;
|
|
154
154
|
/** Gives the player a golden key. */
|
|
155
155
|
export declare function goldenKey(): void;
|
|
156
|
-
/**
|
|
156
|
+
/**
|
|
157
|
+
* Alias for the "debug 11" command. Useful for seeing the coordinates and grid index of each tile
|
|
158
|
+
* in the room.
|
|
159
|
+
*/
|
|
157
160
|
export declare function grid(): void;
|
|
158
|
-
/** Alias for the "
|
|
161
|
+
/** Alias for the "gridCosts" command. */
|
|
159
162
|
export declare function grid2(): void;
|
|
163
|
+
/** Alias for the "debug 2" command. Useful for seeing the grid costs of each tile in the room. */
|
|
164
|
+
export declare function gridCosts(): void;
|
|
160
165
|
/** Spawns every grid entity, starting at the top-left-most tile. */
|
|
161
166
|
export declare function gridEntities(): void;
|
|
162
167
|
/** Alias for the "hearts" command. */
|
|
@@ -346,6 +351,8 @@ export declare function trapdoorCommand(): void;
|
|
|
346
351
|
export declare function treasure(): void;
|
|
347
352
|
/** Warps to the first Ultra Secret Room on the floor. */
|
|
348
353
|
export declare function ultraSecret(): void;
|
|
354
|
+
/** If currently on a set seed, changes to an unseeded state and restarts the game. */
|
|
355
|
+
export declare function unseed(): void;
|
|
349
356
|
/** Moves the player 0.5 units up. Provide a number to move a custom amount of units. */
|
|
350
357
|
export declare function up(params: string): void;
|
|
351
358
|
/**
|
|
@@ -76,7 +76,9 @@ local ____rooms = require("functions.rooms")
|
|
|
76
76
|
local changeRoom = ____rooms.changeRoom
|
|
77
77
|
local getRoomGridIndexesForType = ____rooms.getRoomGridIndexesForType
|
|
78
78
|
local ____run = require("functions.run")
|
|
79
|
+
local onSetSeed = ____run.onSetSeed
|
|
79
80
|
local restart = ____run.restart
|
|
81
|
+
local setUnseeded = ____run.setUnseeded
|
|
80
82
|
local ____trinkets = require("functions.trinkets")
|
|
81
83
|
local getGoldenTrinketType = ____trinkets.getGoldenTrinketType
|
|
82
84
|
local ____utils = require("functions.utils")
|
|
@@ -137,6 +139,10 @@ function ____exports.goldenKey(self)
|
|
|
137
139
|
local player = Isaac.GetPlayer()
|
|
138
140
|
player:AddGoldenKey()
|
|
139
141
|
end
|
|
142
|
+
--- Alias for the "debug 2" command. Useful for seeing the grid costs of each tile in the room.
|
|
143
|
+
function ____exports.gridCosts(self)
|
|
144
|
+
Isaac.ExecuteCommand("debug 2")
|
|
145
|
+
end
|
|
140
146
|
--- Gives a half red heart. Provide a number to give a custom amount of hearts. (You can use negative
|
|
141
147
|
-- numbers to remove hearts.)
|
|
142
148
|
function ____exports.hearts(self, params)
|
|
@@ -583,13 +589,14 @@ end
|
|
|
583
589
|
function ____exports.goldKey(self)
|
|
584
590
|
____exports.goldenKey(nil)
|
|
585
591
|
end
|
|
586
|
-
--- Alias for the "debug
|
|
592
|
+
--- Alias for the "debug 11" command. Useful for seeing the coordinates and grid index of each tile
|
|
593
|
+
-- in the room.
|
|
587
594
|
function ____exports.grid(self)
|
|
588
|
-
Isaac.ExecuteCommand("debug
|
|
595
|
+
Isaac.ExecuteCommand("debug 11")
|
|
589
596
|
end
|
|
590
|
-
--- Alias for the "
|
|
597
|
+
--- Alias for the "gridCosts" command.
|
|
591
598
|
function ____exports.grid2(self)
|
|
592
|
-
|
|
599
|
+
____exports.gridCosts(nil)
|
|
593
600
|
end
|
|
594
601
|
--- Spawns every grid entity, starting at the top-left-most tile.
|
|
595
602
|
function ____exports.gridEntities(self)
|
|
@@ -1075,6 +1082,15 @@ end
|
|
|
1075
1082
|
function ____exports.ultraSecret(self)
|
|
1076
1083
|
warpToRoomType(nil, RoomType.ULTRA_SECRET)
|
|
1077
1084
|
end
|
|
1085
|
+
--- If currently on a set seed, changes to an unseeded state and restarts the game.
|
|
1086
|
+
function ____exports.unseed(self)
|
|
1087
|
+
if not onSetSeed(nil) then
|
|
1088
|
+
printConsole(nil, "You are not on a set seed, so you cannot unseed the run.")
|
|
1089
|
+
return
|
|
1090
|
+
end
|
|
1091
|
+
setUnseeded(nil)
|
|
1092
|
+
restart(nil)
|
|
1093
|
+
end
|
|
1078
1094
|
--- Moves the player 0.5 units up. Provide a number to move a custom amount of units.
|
|
1079
1095
|
function ____exports.up(self, params)
|
|
1080
1096
|
movePlayer(nil, params, Direction.UP)
|
package/functions/doors.d.ts
CHANGED
|
@@ -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
|
-
local
|
|
83
|
-
return
|
|
85
|
+
local fileName = sprite:GetFilename()
|
|
86
|
+
return string.lower(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
|
-
local
|
|
244
|
-
return
|
|
246
|
+
local fileName = sprite:GetFilename()
|
|
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
|
-
local
|
|
254
|
-
return
|
|
256
|
+
local fileName = sprite:GetFilename()
|
|
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
|
-
local
|
|
264
|
-
return
|
|
266
|
+
local fileName = sprite:GetFilename()
|
|
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
|
-
local
|
|
274
|
-
return
|
|
276
|
+
local fileName = sprite:GetFilename()
|
|
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
|
-
local
|
|
284
|
-
return
|
|
286
|
+
local fileName = sprite:GetFilename()
|
|
287
|
+
return string.lower(fileName) == "gfx/grid/door_momsheart.anm2"
|
|
285
288
|
end
|
|
286
289
|
function ____exports.isHiddenSecretRoomDoor(self, door)
|
|
287
290
|
local sprite = door:GetSprite()
|
|
@@ -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
|
|
@@ -71,6 +72,21 @@ export declare function getGridEntityIDFromConstituents(gridEntityType: GridEnti
|
|
|
71
72
|
* variant provided.
|
|
72
73
|
*/
|
|
73
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;
|
|
74
90
|
export declare function getSurroundingGridEntities(gridEntity: GridEntity): GridEntity[];
|
|
75
91
|
export declare function getTopLeftWall(): GridEntity | undefined;
|
|
76
92
|
/**
|
|
@@ -178,6 +194,24 @@ export declare function spawnGrid(gridEntityType: GridEntityType, gridIndexOrPos
|
|
|
178
194
|
* - allows you to specify the grid index or the position
|
|
179
195
|
*/
|
|
180
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;
|
|
181
215
|
/**
|
|
182
216
|
* Helper function to spawn a Void Portal. This is more complicated than simply spawning a trapdoor
|
|
183
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")
|
|
@@ -255,6 +261,23 @@ function ____exports.getMatchingGridEntities(self, gridEntityType, variant)
|
|
|
255
261
|
function(____, gridEntity) return gridEntity:GetVariant() == variant end
|
|
256
262
|
)
|
|
257
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
|
|
258
281
|
function ____exports.getSurroundingGridEntities(self, gridEntity)
|
|
259
282
|
local room = game:GetRoom()
|
|
260
283
|
local gridWidth = room:GetGridWidth()
|
|
@@ -400,6 +423,59 @@ end
|
|
|
400
423
|
function ____exports.spawnGrid(self, gridEntityType, gridIndexOrPosition)
|
|
401
424
|
return ____exports.spawnGridWithVariant(nil, gridEntityType, 0, gridIndexOrPosition)
|
|
402
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
|
|
403
479
|
--- Helper function to spawn a Void Portal. This is more complicated than simply spawning a trapdoor
|
|
404
480
|
-- with the appropriate variant, as the game does not give it the correct sprite automatically.
|
|
405
481
|
function ____exports.spawnVoidPortal(self, gridIndex)
|
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
|
/**
|
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
|