isaacscript-common 6.4.0 → 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/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 +12 -3
- package/features/customStage/gridEntities.d.ts +18 -0
- package/features/customStage/gridEntities.lua +215 -0
- package/features/customStage/init.lua +27 -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 +14 -11
- 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 +236 -92
- package/objects/backdropTypeToRockAltType.d.ts +6 -0
- package/objects/backdropTypeToRockAltType.lua +69 -0
- package/package.json +2 -2
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare enum DecorationVariant {
|
|
2
|
+
VANILLA_DECORATION = 0,
|
|
3
|
+
/**
|
|
4
|
+
* The vanilla game does not support any custom grid entities. Under the hood, IsaacScript allows
|
|
5
|
+
* for custom grid entities by using decorations with this variant to represent custom grid
|
|
6
|
+
* entities.
|
|
7
|
+
*/
|
|
8
|
+
CUSTOM_GRID_ENTITY = 1
|
|
9
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
____exports.DecorationVariant = {}
|
|
3
|
+
____exports.DecorationVariant.VANILLA_DECORATION = 0
|
|
4
|
+
____exports.DecorationVariant[____exports.DecorationVariant.VANILLA_DECORATION] = "VANILLA_DECORATION"
|
|
5
|
+
____exports.DecorationVariant.CUSTOM_GRID_ENTITY = 1
|
|
6
|
+
____exports.DecorationVariant[____exports.DecorationVariant.CUSTOM_GRID_ENTITY] = "CUSTOM_GRID_ENTITY"
|
|
7
|
+
return ____exports
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
____exports.RockAltType = {}
|
|
3
|
+
____exports.RockAltType.URN = 0
|
|
4
|
+
____exports.RockAltType[____exports.RockAltType.URN] = "URN"
|
|
5
|
+
____exports.RockAltType.MUSHROOM = 1
|
|
6
|
+
____exports.RockAltType[____exports.RockAltType.MUSHROOM] = "MUSHROOM"
|
|
7
|
+
____exports.RockAltType.SKULL = 2
|
|
8
|
+
____exports.RockAltType[____exports.RockAltType.SKULL] = "SKULL"
|
|
9
|
+
____exports.RockAltType.POLYP = 3
|
|
10
|
+
____exports.RockAltType[____exports.RockAltType.POLYP] = "POLYP"
|
|
11
|
+
____exports.RockAltType.BUCKET = 4
|
|
12
|
+
____exports.RockAltType[____exports.RockAltType.BUCKET] = "BUCKET"
|
|
13
|
+
return ____exports
|
|
@@ -3,8 +3,8 @@ import { GridCollisionClass, GridEntityType } from "isaac-typescript-definitions
|
|
|
3
3
|
* Helper function to spawn a custom grid entity.
|
|
4
4
|
*
|
|
5
5
|
* This is an IsaacScript feature because the vanilla game does not support any custom grid
|
|
6
|
-
* entities. Under the hood, IsaacScript accomplishes this by using decorations
|
|
7
|
-
* grid entities.
|
|
6
|
+
* entities. Under the hood, IsaacScript accomplishes this by using decorations with an arbitrary
|
|
7
|
+
* non-zero variant to represent custom grid entities.
|
|
8
8
|
*
|
|
9
9
|
* Once a custom grid entity is spawned, you can take advantage of the custom grid callbacks such as
|
|
10
10
|
* `POST_GRID_ENTITY_CUSTOM_UPDATE`.
|
|
@@ -10,13 +10,15 @@ local ____cachedClasses = require("cachedClasses")
|
|
|
10
10
|
local game = ____cachedClasses.game
|
|
11
11
|
local ____DefaultMap = require("classes.DefaultMap")
|
|
12
12
|
local DefaultMap = ____DefaultMap.DefaultMap
|
|
13
|
+
local ____DecorationVariant = require("enums.DecorationVariant")
|
|
14
|
+
local DecorationVariant = ____DecorationVariant.DecorationVariant
|
|
13
15
|
local ____ModCallbackCustom = require("enums.ModCallbackCustom")
|
|
14
16
|
local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
|
|
15
17
|
local ____featuresInitialized = require("featuresInitialized")
|
|
16
18
|
local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
|
|
17
19
|
local ____gridEntity = require("functions.gridEntity")
|
|
18
20
|
local removeGrid = ____gridEntity.removeGrid
|
|
19
|
-
local
|
|
21
|
+
local spawnGridWithVariant = ____gridEntity.spawnGridWithVariant
|
|
20
22
|
local ____roomData = require("functions.roomData")
|
|
21
23
|
local getRoomListIndex = ____roomData.getRoomListIndex
|
|
22
24
|
local ____vector = require("functions.vector")
|
|
@@ -60,8 +62,8 @@ end
|
|
|
60
62
|
--- Helper function to spawn a custom grid entity.
|
|
61
63
|
--
|
|
62
64
|
-- This is an IsaacScript feature because the vanilla game does not support any custom grid
|
|
63
|
-
-- entities. Under the hood, IsaacScript accomplishes this by using decorations
|
|
64
|
-
-- grid entities.
|
|
65
|
+
-- entities. Under the hood, IsaacScript accomplishes this by using decorations with an arbitrary
|
|
66
|
+
-- non-zero variant to represent custom grid entities.
|
|
65
67
|
--
|
|
66
68
|
-- Once a custom grid entity is spawned, you can take advantage of the custom grid callbacks such as
|
|
67
69
|
-- `POST_GRID_ENTITY_CUSTOM_UPDATE`.
|
|
@@ -84,8 +86,8 @@ function ____exports.spawnCustomGrid(self, gridEntityTypeCustom, gridIndexOrPosi
|
|
|
84
86
|
local roomListIndex = getRoomListIndex(nil)
|
|
85
87
|
local gridIndex = isVector(nil, gridIndexOrPosition) and room:GetGridIndex(gridIndexOrPosition) or gridIndexOrPosition
|
|
86
88
|
local existingGridEntity = room:GetGridEntity(gridIndex)
|
|
87
|
-
local isExistingDecoration = existingGridEntity ~= nil and existingGridEntity:GetType() == GridEntityType.DECORATION
|
|
88
|
-
local decoration = isExistingDecoration and existingGridEntity or
|
|
89
|
+
local isExistingDecoration = existingGridEntity ~= nil and existingGridEntity:GetType() == GridEntityType.DECORATION and existingGridEntity:GetVariant() == DecorationVariant.CUSTOM_GRID_ENTITY
|
|
90
|
+
local decoration = isExistingDecoration and existingGridEntity or spawnGridWithVariant(nil, GridEntityType.DECORATION, DecorationVariant.CUSTOM_GRID_ENTITY, gridIndexOrPosition)
|
|
89
91
|
if decoration == nil then
|
|
90
92
|
error("Failed to spawn a decoration for a custom grid entity.")
|
|
91
93
|
end
|
|
@@ -2,7 +2,7 @@ local ____lualib = require("lualib_bundle")
|
|
|
2
2
|
local Set = ____lualib.Set
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
4
|
local ____exports = {}
|
|
5
|
-
local getBackdropPNGPath, spawnWallEntity, spawnSecondWallEntity, spawnFloorEntity, getNumFloorLayers, BackdropKind, BackdropEntitySubType, ROOM_SHAPE_WALL_ANM2_LAYERS, ROOM_SHAPE_WALL_EXTRA_ANM2_LAYERS, WALL_OFFSET, BACKDROP_EFFECT_VARIANT
|
|
5
|
+
local getBackdropPNGPath, spawnWallEntity, spawnSecondWallEntity, spawnFloorEntity, getNumFloorLayers, BackdropKind, BackdropEntitySubType, DEFAULT_BACKDROP, ROOM_SHAPE_WALL_ANM2_LAYERS, ROOM_SHAPE_WALL_EXTRA_ANM2_LAYERS, WALL_OFFSET, BACKDROP_EFFECT_VARIANT
|
|
6
6
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
7
7
|
local EffectVariant = ____isaac_2Dtypescript_2Ddefinitions.EffectVariant
|
|
8
8
|
local EntityFlag = ____isaac_2Dtypescript_2Ddefinitions.EntityFlag
|
|
@@ -29,9 +29,10 @@ local irange = ____utils.irange
|
|
|
29
29
|
local ____customStageConstants = require("features.customStage.customStageConstants")
|
|
30
30
|
local ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH = ____customStageConstants.ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH
|
|
31
31
|
function getBackdropPNGPath(self, customStage, backdropKind, rng)
|
|
32
|
-
local
|
|
32
|
+
local backdrop = customStage.backdrop == nil and DEFAULT_BACKDROP or customStage.backdrop
|
|
33
|
+
local pathArray = backdrop[backdropKind]
|
|
33
34
|
local path = getRandomArrayElement(nil, pathArray, rng)
|
|
34
|
-
return (
|
|
35
|
+
return (backdrop.prefix .. path) .. backdrop.suffix
|
|
35
36
|
end
|
|
36
37
|
function spawnWallEntity(self, customStage, rng, isExtraWall)
|
|
37
38
|
local room = game:GetRoom()
|
|
@@ -162,6 +163,14 @@ BackdropEntitySubType.WALL_EXTRA = 2
|
|
|
162
163
|
BackdropEntitySubType[BackdropEntitySubType.WALL_EXTRA] = "WALL_EXTRA"
|
|
163
164
|
BackdropEntitySubType.FLOOR = 3
|
|
164
165
|
BackdropEntitySubType[BackdropEntitySubType.FLOOR] = "FLOOR"
|
|
166
|
+
DEFAULT_BACKDROP = {
|
|
167
|
+
prefix = ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH .. "/backdrop",
|
|
168
|
+
suffix = ".png",
|
|
169
|
+
nFloors = {"nfloor"},
|
|
170
|
+
lFloors = {"lfloor"},
|
|
171
|
+
walls = {"wall"},
|
|
172
|
+
corners = {"corner"}
|
|
173
|
+
}
|
|
165
174
|
ROOM_SHAPE_WALL_ANM2_LAYERS = {
|
|
166
175
|
[RoomShape.SHAPE_1x1] = 44,
|
|
167
176
|
[RoomShape.IH] = 36,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
import { CustomStage } from "../../interfaces/CustomStage";
|
|
3
|
+
/** For `GridEntityType.DECORATION` (1) */
|
|
4
|
+
export declare function setCustomDecorationGraphics(customStage: CustomStage, gridEntity: GridEntity): void;
|
|
5
|
+
/** For `GridEntityType.ROCK` (2) */
|
|
6
|
+
export declare function setCustomRockGraphics(customStage: CustomStage, gridEntity: GridEntity): void;
|
|
7
|
+
/** For `GridEntityType.PIT` (7) */
|
|
8
|
+
export declare function setCustomPitGraphics(customStage: CustomStage, gridEntity: GridEntity): void;
|
|
9
|
+
/** For GridEntityType.DOOR (16) */
|
|
10
|
+
export declare function setCustomDoorGraphics(customStage: CustomStage, gridEntity: GridEntity): void;
|
|
11
|
+
/**
|
|
12
|
+
* The rewards are based on the ones from the wiki:
|
|
13
|
+
* https://bindingofisaacrebirth.fandom.com/wiki/Rocks#Urns
|
|
14
|
+
*
|
|
15
|
+
* On the bugged stage of -1, only urns will spawn, so we do not have to handle the case of mushroom
|
|
16
|
+
* rewards, skull rewards, and so on.
|
|
17
|
+
*/
|
|
18
|
+
export declare function removeUrnRewards(customStage: CustomStage, gridEntity: GridEntity): void;
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
3
|
+
local ____exports = {}
|
|
4
|
+
local getNewDoorPNGPath, removeEntitiesSpawnedFromGridEntity
|
|
5
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
6
|
+
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
7
|
+
local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
|
|
8
|
+
local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
|
|
9
|
+
local ____DecorationVariant = require("enums.DecorationVariant")
|
|
10
|
+
local DecorationVariant = ____DecorationVariant.DecorationVariant
|
|
11
|
+
local ____entity = require("functions.entity")
|
|
12
|
+
local removeEntities = ____entity.removeEntities
|
|
13
|
+
local ____entitySpecific = require("functions.entitySpecific")
|
|
14
|
+
local getNPCs = ____entitySpecific.getNPCs
|
|
15
|
+
local ____pickups = require("functions.pickups")
|
|
16
|
+
local getCoins = ____pickups.getCoins
|
|
17
|
+
local getCollectibles = ____pickups.getCollectibles
|
|
18
|
+
local getTrinkets = ____pickups.getTrinkets
|
|
19
|
+
local ____vector = require("functions.vector")
|
|
20
|
+
local vectorEquals = ____vector.vectorEquals
|
|
21
|
+
function getNewDoorPNGPath(self, customStage, fileName)
|
|
22
|
+
repeat
|
|
23
|
+
local ____switch16 = fileName
|
|
24
|
+
local ____cond16 = ____switch16 == "gfx/grid/door_01_normaldoor.anm2"
|
|
25
|
+
if ____cond16 then
|
|
26
|
+
do
|
|
27
|
+
local ____customStage_doorPNGPaths_normal_0 = customStage.doorPNGPaths
|
|
28
|
+
if ____customStage_doorPNGPaths_normal_0 ~= nil then
|
|
29
|
+
____customStage_doorPNGPaths_normal_0 = ____customStage_doorPNGPaths_normal_0.normal
|
|
30
|
+
end
|
|
31
|
+
return ____customStage_doorPNGPaths_normal_0
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
____cond16 = ____cond16 or ____switch16 == "gfx/grid/door_02_treasureroomdoor.anm2"
|
|
35
|
+
if ____cond16 then
|
|
36
|
+
do
|
|
37
|
+
local ____customStage_doorPNGPaths_treasureRoom_2 = customStage.doorPNGPaths
|
|
38
|
+
if ____customStage_doorPNGPaths_treasureRoom_2 ~= nil then
|
|
39
|
+
____customStage_doorPNGPaths_treasureRoom_2 = ____customStage_doorPNGPaths_treasureRoom_2.treasureRoom
|
|
40
|
+
end
|
|
41
|
+
return ____customStage_doorPNGPaths_treasureRoom_2
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
____cond16 = ____cond16 or ____switch16 == "gfx/grid/door_03_ambushroomdoor.anm2"
|
|
45
|
+
if ____cond16 then
|
|
46
|
+
do
|
|
47
|
+
local ____customStage_doorPNGPaths_normalChallengeRoom_4 = customStage.doorPNGPaths
|
|
48
|
+
if ____customStage_doorPNGPaths_normalChallengeRoom_4 ~= nil then
|
|
49
|
+
____customStage_doorPNGPaths_normalChallengeRoom_4 = ____customStage_doorPNGPaths_normalChallengeRoom_4.normalChallengeRoom
|
|
50
|
+
end
|
|
51
|
+
return ____customStage_doorPNGPaths_normalChallengeRoom_4
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
____cond16 = ____cond16 or ____switch16 == "gfx/grid/door_04_selfsacrificeroomdoor.anm2"
|
|
55
|
+
if ____cond16 then
|
|
56
|
+
do
|
|
57
|
+
local ____customStage_doorPNGPaths_curseRoom_6 = customStage.doorPNGPaths
|
|
58
|
+
if ____customStage_doorPNGPaths_curseRoom_6 ~= nil then
|
|
59
|
+
____customStage_doorPNGPaths_curseRoom_6 = ____customStage_doorPNGPaths_curseRoom_6.curseRoom
|
|
60
|
+
end
|
|
61
|
+
return ____customStage_doorPNGPaths_curseRoom_6
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
____cond16 = ____cond16 or ____switch16 == "gfx/grid/door_05_arcaderoomdoor.anm2"
|
|
65
|
+
if ____cond16 then
|
|
66
|
+
do
|
|
67
|
+
local ____customStage_doorPNGPaths_arcade_8 = customStage.doorPNGPaths
|
|
68
|
+
if ____customStage_doorPNGPaths_arcade_8 ~= nil then
|
|
69
|
+
____customStage_doorPNGPaths_arcade_8 = ____customStage_doorPNGPaths_arcade_8.arcade
|
|
70
|
+
end
|
|
71
|
+
return ____customStage_doorPNGPaths_arcade_8
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
____cond16 = ____cond16 or ____switch16 == "gfx/grid/door_07_devilroomdoor.anm2"
|
|
75
|
+
if ____cond16 then
|
|
76
|
+
do
|
|
77
|
+
local ____customStage_doorPNGPaths_devilRoom_10 = customStage.doorPNGPaths
|
|
78
|
+
if ____customStage_doorPNGPaths_devilRoom_10 ~= nil then
|
|
79
|
+
____customStage_doorPNGPaths_devilRoom_10 = ____customStage_doorPNGPaths_devilRoom_10.devilRoom
|
|
80
|
+
end
|
|
81
|
+
return ____customStage_doorPNGPaths_devilRoom_10
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
____cond16 = ____cond16 or ____switch16 == "gfx/grid/door_07_holyroomdoor.anm2"
|
|
85
|
+
if ____cond16 then
|
|
86
|
+
do
|
|
87
|
+
local ____customStage_doorPNGPaths_angelRoom_12 = customStage.doorPNGPaths
|
|
88
|
+
if ____customStage_doorPNGPaths_angelRoom_12 ~= nil then
|
|
89
|
+
____customStage_doorPNGPaths_angelRoom_12 = ____customStage_doorPNGPaths_angelRoom_12.angelRoom
|
|
90
|
+
end
|
|
91
|
+
return ____customStage_doorPNGPaths_angelRoom_12
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
____cond16 = ____cond16 or ____switch16 == "gfx/grid/door_08_holeinwall.anm2"
|
|
95
|
+
if ____cond16 then
|
|
96
|
+
do
|
|
97
|
+
local ____customStage_doorPNGPaths_secretRoom_14 = customStage.doorPNGPaths
|
|
98
|
+
if ____customStage_doorPNGPaths_secretRoom_14 ~= nil then
|
|
99
|
+
____customStage_doorPNGPaths_secretRoom_14 = ____customStage_doorPNGPaths_secretRoom_14.secretRoom
|
|
100
|
+
end
|
|
101
|
+
return ____customStage_doorPNGPaths_secretRoom_14
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
____cond16 = ____cond16 or ____switch16 == "gfx/grid/door_09_bossambushroomdoor.anm2"
|
|
105
|
+
if ____cond16 then
|
|
106
|
+
do
|
|
107
|
+
local ____customStage_doorPNGPaths_bossChallengeRoom_16 = customStage.doorPNGPaths
|
|
108
|
+
if ____customStage_doorPNGPaths_bossChallengeRoom_16 ~= nil then
|
|
109
|
+
____customStage_doorPNGPaths_bossChallengeRoom_16 = ____customStage_doorPNGPaths_bossChallengeRoom_16.bossChallengeRoom
|
|
110
|
+
end
|
|
111
|
+
return ____customStage_doorPNGPaths_bossChallengeRoom_16
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
____cond16 = ____cond16 or ____switch16 == "gfx/grid/door_10_bossroomdoor.anm2"
|
|
115
|
+
if ____cond16 then
|
|
116
|
+
do
|
|
117
|
+
local ____customStage_doorPNGPaths_bossRoom_18 = customStage.doorPNGPaths
|
|
118
|
+
if ____customStage_doorPNGPaths_bossRoom_18 ~= nil then
|
|
119
|
+
____customStage_doorPNGPaths_bossRoom_18 = ____customStage_doorPNGPaths_bossRoom_18.bossRoom
|
|
120
|
+
end
|
|
121
|
+
return ____customStage_doorPNGPaths_bossRoom_18
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
____cond16 = ____cond16 or ____switch16 == "gfx/grid/door_15_bossrushdoor.anm2"
|
|
125
|
+
if ____cond16 then
|
|
126
|
+
do
|
|
127
|
+
local ____customStage_doorPNGPaths_bossRush_20 = customStage.doorPNGPaths
|
|
128
|
+
if ____customStage_doorPNGPaths_bossRush_20 ~= nil then
|
|
129
|
+
____customStage_doorPNGPaths_bossRush_20 = ____customStage_doorPNGPaths_bossRush_20.bossRush
|
|
130
|
+
end
|
|
131
|
+
return ____customStage_doorPNGPaths_bossRush_20
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
until true
|
|
135
|
+
return nil
|
|
136
|
+
end
|
|
137
|
+
function removeEntitiesSpawnedFromGridEntity(self, entities, gridEntity)
|
|
138
|
+
local entitiesFromGridEntity = __TS__ArrayFilter(
|
|
139
|
+
entities,
|
|
140
|
+
function(____, entity) return entity.FrameCount == 0 and vectorEquals(nil, entity.Position, gridEntity.Position) end
|
|
141
|
+
)
|
|
142
|
+
removeEntities(nil, entitiesFromGridEntity)
|
|
143
|
+
end
|
|
144
|
+
--- For `GridEntityType.DECORATION` (1)
|
|
145
|
+
function ____exports.setCustomDecorationGraphics(self, customStage, gridEntity)
|
|
146
|
+
if customStage.decorationsPNGPath == nil then
|
|
147
|
+
return
|
|
148
|
+
end
|
|
149
|
+
local variant = gridEntity:GetVariant()
|
|
150
|
+
if variant ~= DecorationVariant.VANILLA_DECORATION then
|
|
151
|
+
return
|
|
152
|
+
end
|
|
153
|
+
local sprite = gridEntity:GetSprite()
|
|
154
|
+
local fileName = sprite:GetFilename()
|
|
155
|
+
if string.lower(fileName) == "gfx/grid/props_01_basement.anm2" then
|
|
156
|
+
sprite:ReplaceSpritesheet(0, customStage.decorationsPNGPath)
|
|
157
|
+
sprite:LoadGraphics()
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
--- For `GridEntityType.ROCK` (2)
|
|
161
|
+
function ____exports.setCustomRockGraphics(self, customStage, gridEntity)
|
|
162
|
+
if customStage.rocksPNGPath == nil then
|
|
163
|
+
return
|
|
164
|
+
end
|
|
165
|
+
local sprite = gridEntity:GetSprite()
|
|
166
|
+
local fileName = sprite:GetFilename()
|
|
167
|
+
if fileName == "gfx/grid/grid_rock.anm2" then
|
|
168
|
+
sprite:ReplaceSpritesheet(0, customStage.rocksPNGPath)
|
|
169
|
+
sprite:LoadGraphics()
|
|
170
|
+
elseif fileName == "gfx/grid/grid_pit.anm2" then
|
|
171
|
+
sprite:ReplaceSpritesheet(1, customStage.rocksPNGPath)
|
|
172
|
+
sprite:LoadGraphics()
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
--- For `GridEntityType.PIT` (7)
|
|
176
|
+
function ____exports.setCustomPitGraphics(self, customStage, gridEntity)
|
|
177
|
+
if customStage.pitsPNGPath == nil then
|
|
178
|
+
return
|
|
179
|
+
end
|
|
180
|
+
local sprite = gridEntity:GetSprite()
|
|
181
|
+
local fileName = sprite:GetFilename()
|
|
182
|
+
if fileName == "gfx/grid/grid_pit.anm2" then
|
|
183
|
+
sprite:ReplaceSpritesheet(0, customStage.pitsPNGPath)
|
|
184
|
+
sprite:LoadGraphics()
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
--- For GridEntityType.DOOR (16)
|
|
188
|
+
function ____exports.setCustomDoorGraphics(self, customStage, gridEntity)
|
|
189
|
+
local sprite = gridEntity:GetSprite()
|
|
190
|
+
local fileName = sprite:GetFilename()
|
|
191
|
+
local doorPNGPath = getNewDoorPNGPath(nil, customStage, fileName)
|
|
192
|
+
if doorPNGPath ~= nil then
|
|
193
|
+
sprite:ReplaceSpritesheet(0, doorPNGPath)
|
|
194
|
+
sprite:LoadGraphics()
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
--- The rewards are based on the ones from the wiki:
|
|
198
|
+
-- https://bindingofisaacrebirth.fandom.com/wiki/Rocks#Urns
|
|
199
|
+
--
|
|
200
|
+
-- On the bugged stage of -1, only urns will spawn, so we do not have to handle the case of mushroom
|
|
201
|
+
-- rewards, skull rewards, and so on.
|
|
202
|
+
function ____exports.removeUrnRewards(self, customStage, gridEntity)
|
|
203
|
+
if customStage.rocksPNGPath == nil then
|
|
204
|
+
return
|
|
205
|
+
end
|
|
206
|
+
local spiders = getNPCs(nil, EntityType.SPIDER)
|
|
207
|
+
removeEntitiesSpawnedFromGridEntity(nil, spiders, gridEntity)
|
|
208
|
+
local coins = getCoins(nil)
|
|
209
|
+
removeEntitiesSpawnedFromGridEntity(nil, coins, gridEntity)
|
|
210
|
+
local quarters = getCollectibles(nil, CollectibleType.QUARTER)
|
|
211
|
+
removeEntitiesSpawnedFromGridEntity(nil, quarters, gridEntity)
|
|
212
|
+
local swallowedPennies = getTrinkets(nil, TrinketType.SWALLOWED_PENNY)
|
|
213
|
+
removeEntitiesSpawnedFromGridEntity(nil, swallowedPennies, gridEntity)
|
|
214
|
+
end
|
|
215
|
+
return ____exports
|
|
@@ -3,8 +3,9 @@ local Map = ____lualib.Map
|
|
|
3
3
|
local __TS__ObjectAssign = ____lualib.__TS__ObjectAssign
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local ____exports = {}
|
|
6
|
-
local initRoomTypeMaps, getRoomTypeMap, postRender, postNewRoomReordered
|
|
6
|
+
local initRoomTypeMaps, getRoomTypeMap, postRender, postGridEntityBrokenRockAlt, postGridEntityBrokenInit, postNewRoomReordered
|
|
7
7
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
8
|
+
local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
|
|
8
9
|
local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
|
|
9
10
|
local ____ModCallbackCustom = require("enums.ModCallbackCustom")
|
|
10
11
|
local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
|
|
@@ -14,6 +15,12 @@ local ____exports = require("features.saveDataManager.exports")
|
|
|
14
15
|
local saveDataManager = ____exports.saveDataManager
|
|
15
16
|
local ____backdrop = require("features.customStage.backdrop")
|
|
16
17
|
local setBackdrop = ____backdrop.setBackdrop
|
|
18
|
+
local ____gridEntities = require("features.customStage.gridEntities")
|
|
19
|
+
local removeUrnRewards = ____gridEntities.removeUrnRewards
|
|
20
|
+
local setCustomDecorationGraphics = ____gridEntities.setCustomDecorationGraphics
|
|
21
|
+
local setCustomDoorGraphics = ____gridEntities.setCustomDoorGraphics
|
|
22
|
+
local setCustomPitGraphics = ____gridEntities.setCustomPitGraphics
|
|
23
|
+
local setCustomRockGraphics = ____gridEntities.setCustomRockGraphics
|
|
17
24
|
local metadataJSON = require("features.customStage.metadata")
|
|
18
25
|
local ____streakText = require("features.customStage.streakText")
|
|
19
26
|
local streakTextPostRender = ____streakText.streakTextPostRender
|
|
@@ -67,6 +74,23 @@ function postRender(self)
|
|
|
67
74
|
streakTextPostRender(nil, customStage)
|
|
68
75
|
versusScreenPostRender(nil)
|
|
69
76
|
end
|
|
77
|
+
function postGridEntityBrokenRockAlt(self, gridEntity)
|
|
78
|
+
local customStage = v.run.currentCustomStage
|
|
79
|
+
if customStage == nil then
|
|
80
|
+
return
|
|
81
|
+
end
|
|
82
|
+
removeUrnRewards(nil, customStage, gridEntity)
|
|
83
|
+
end
|
|
84
|
+
function postGridEntityBrokenInit(self, gridEntity)
|
|
85
|
+
local customStage = v.run.currentCustomStage
|
|
86
|
+
if customStage == nil then
|
|
87
|
+
return
|
|
88
|
+
end
|
|
89
|
+
setCustomDecorationGraphics(nil, customStage, gridEntity)
|
|
90
|
+
setCustomRockGraphics(nil, customStage, gridEntity)
|
|
91
|
+
setCustomPitGraphics(nil, customStage, gridEntity)
|
|
92
|
+
setCustomDoorGraphics(nil, customStage, gridEntity)
|
|
93
|
+
end
|
|
70
94
|
function postNewRoomReordered(self)
|
|
71
95
|
local customStage = v.run.currentCustomStage
|
|
72
96
|
if customStage == nil then
|
|
@@ -79,6 +103,8 @@ function ____exports.customStageInit(self, mod)
|
|
|
79
103
|
saveDataManager(nil, "customStage", v)
|
|
80
104
|
initRoomTypeMaps(nil)
|
|
81
105
|
mod:AddCallback(ModCallback.POST_RENDER, postRender)
|
|
106
|
+
mod:AddCallbackCustom(ModCallbackCustom.POST_GRID_ENTITY_BROKEN, postGridEntityBrokenRockAlt, GridEntityType.ROCK_ALT)
|
|
107
|
+
mod:AddCallbackCustom(ModCallbackCustom.POST_GRID_ENTITY_INIT, postGridEntityBrokenInit)
|
|
82
108
|
mod:AddCallbackCustom(ModCallbackCustom.POST_NEW_ROOM_REORDERED, postNewRoomReordered)
|
|
83
109
|
end
|
|
84
110
|
return ____exports
|
|
@@ -139,20 +139,28 @@ function ____exports.playVersusScreenAnimation(self, customStage, force)
|
|
|
139
139
|
versusScreenSprite:ReplaceSpritesheet(BOSS_PORTRAIT_ANM2_LAYER, bossPortraitPNGPath)
|
|
140
140
|
versusScreenSprite:LoadGraphics()
|
|
141
141
|
local backgroundColor = VERSUS_SCREEN_BACKGROUND_COLORS[DEFAULT_STAGE_ID]
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
142
|
+
local ____customStage_versusScreen_backgroundColor_0 = customStage.versusScreen
|
|
143
|
+
if ____customStage_versusScreen_backgroundColor_0 ~= nil then
|
|
144
|
+
____customStage_versusScreen_backgroundColor_0 = ____customStage_versusScreen_backgroundColor_0.backgroundColor
|
|
145
|
+
end
|
|
146
|
+
if ____customStage_versusScreen_backgroundColor_0 ~= nil then
|
|
147
|
+
local ____customStage_versusScreen_backgroundColor_2 = customStage.versusScreen.backgroundColor
|
|
148
|
+
local r = ____customStage_versusScreen_backgroundColor_2.r
|
|
149
|
+
local g = ____customStage_versusScreen_backgroundColor_2.g
|
|
150
|
+
local b = ____customStage_versusScreen_backgroundColor_2.b
|
|
147
151
|
backgroundColor = Color(r, g, b)
|
|
148
152
|
end
|
|
149
153
|
versusScreenBackgroundSprite.Color = backgroundColor
|
|
150
154
|
local dirtSpotColor = VERSUS_SCREEN_DIRT_SPOT_COLORS[DEFAULT_STAGE_ID]
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
155
|
+
local ____customStage_versusScreen_dirtSpotColor_3 = customStage.versusScreen
|
|
156
|
+
if ____customStage_versusScreen_dirtSpotColor_3 ~= nil then
|
|
157
|
+
____customStage_versusScreen_dirtSpotColor_3 = ____customStage_versusScreen_dirtSpotColor_3.dirtSpotColor
|
|
158
|
+
end
|
|
159
|
+
if ____customStage_versusScreen_dirtSpotColor_3 ~= nil then
|
|
160
|
+
local ____customStage_versusScreen_dirtSpotColor_5 = customStage.versusScreen.dirtSpotColor
|
|
161
|
+
local r = ____customStage_versusScreen_dirtSpotColor_5.r
|
|
162
|
+
local g = ____customStage_versusScreen_dirtSpotColor_5.g
|
|
163
|
+
local b = ____customStage_versusScreen_dirtSpotColor_5.b
|
|
156
164
|
dirtSpotColor = Color(r, g, b)
|
|
157
165
|
end
|
|
158
166
|
versusScreenDirtSpotSprite.Color = dirtSpotColor
|
|
@@ -84,6 +84,7 @@ function initMap(self)
|
|
|
84
84
|
extraConsoleCommandsFunctionMap:set("goldenKey", commands.goldenKey)
|
|
85
85
|
extraConsoleCommandsFunctionMap:set("grid", commands.grid)
|
|
86
86
|
extraConsoleCommandsFunctionMap:set("grid2", commands.grid2)
|
|
87
|
+
extraConsoleCommandsFunctionMap:set("gridCosts", commands.gridCosts)
|
|
87
88
|
extraConsoleCommandsFunctionMap:set("gridEntities", commands.gridEntities)
|
|
88
89
|
extraConsoleCommandsFunctionMap:set("h", commands.h)
|
|
89
90
|
extraConsoleCommandsFunctionMap:set("hearts", commands.hearts)
|
|
@@ -168,6 +169,7 @@ function initMap(self)
|
|
|
168
169
|
extraConsoleCommandsFunctionMap:set("trapdoor", commands.trapdoorCommand)
|
|
169
170
|
extraConsoleCommandsFunctionMap:set("treasure", commands.treasure)
|
|
170
171
|
extraConsoleCommandsFunctionMap:set("ultraSecret", commands.ultraSecret)
|
|
172
|
+
extraConsoleCommandsFunctionMap:set("unseed", commands.unseed)
|
|
171
173
|
extraConsoleCommandsFunctionMap:set("up", commands.up)
|
|
172
174
|
extraConsoleCommandsFunctionMap:set("warp", commands.warp)
|
|
173
175
|
end
|
|
@@ -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
|