isaacscript-common 30.12.10 → 30.12.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.rollup.d.ts +11 -0
- package/dist/isaacscript-common.lua +43 -10
- package/dist/src/classes/features/other/CustomStages.d.ts +11 -0
- package/dist/src/classes/features/other/CustomStages.d.ts.map +1 -1
- package/dist/src/classes/features/other/CustomStages.lua +42 -9
- package/package.json +1 -1
- package/src/classes/features/other/CustomStages.ts +60 -0
package/dist/index.rollup.d.ts
CHANGED
|
@@ -2174,6 +2174,7 @@ declare class CustomStages extends Feature {
|
|
|
2174
2174
|
private readonly customStagesMap;
|
|
2175
2175
|
/** Indexed by room variant. */
|
|
2176
2176
|
private readonly customStageCachedRoomData;
|
|
2177
|
+
private usingRedKey;
|
|
2177
2178
|
private readonly customGridEntities;
|
|
2178
2179
|
private readonly customTrapdoors;
|
|
2179
2180
|
private readonly disableAllSound;
|
|
@@ -2185,8 +2186,18 @@ declare class CustomStages extends Feature {
|
|
|
2185
2186
|
private initCustomTrapdoorDestination;
|
|
2186
2187
|
private readonly goToCustomStage;
|
|
2187
2188
|
private readonly postRender;
|
|
2189
|
+
/**
|
|
2190
|
+
* Fix the bug where Red Key will not work on custom floors (due to the stage being a bugged
|
|
2191
|
+
* value).
|
|
2192
|
+
*/
|
|
2193
|
+
private readonly postUseItemRedKey;
|
|
2188
2194
|
private readonly postCurseEval;
|
|
2189
2195
|
private readonly getShaderParams;
|
|
2196
|
+
/**
|
|
2197
|
+
* Fix the bug where Red Key will not work on custom floors (due to the stage being a bugged
|
|
2198
|
+
* value).
|
|
2199
|
+
*/
|
|
2200
|
+
private readonly preUseItemRedKey;
|
|
2190
2201
|
private readonly postGridEntityBrokenRockAlt;
|
|
2191
2202
|
private readonly postGridEntityInit;
|
|
2192
2203
|
private readonly postNewRoomReordered;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 30.12.
|
|
3
|
+
isaacscript-common 30.12.11
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -44638,6 +44638,7 @@ local __TS__DecorateLegacy = ____lualib.__TS__DecorateLegacy
|
|
|
44638
44638
|
local ____exports = {}
|
|
44639
44639
|
local getRoomTypeMap
|
|
44640
44640
|
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
|
|
44641
|
+
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
44641
44642
|
local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
|
|
44642
44643
|
local LevelCurse = ____isaac_2Dtypescript_2Ddefinitions.LevelCurse
|
|
44643
44644
|
local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
|
|
@@ -44743,6 +44744,7 @@ function CustomStages.prototype.____constructor(self, customGridEntities, custom
|
|
|
44743
44744
|
self.v = v
|
|
44744
44745
|
self.customStagesMap = __TS__New(Map)
|
|
44745
44746
|
self.customStageCachedRoomData = __TS__New(Map)
|
|
44747
|
+
self.usingRedKey = false
|
|
44746
44748
|
self.goToCustomStage = function(____, destinationName, destinationStage, _destinationStageType)
|
|
44747
44749
|
if destinationName == nil then
|
|
44748
44750
|
error("Failed to go to a custom stage since the custom trapdoors feature did not pass a destination name to the logic function.")
|
|
@@ -44766,6 +44768,19 @@ function CustomStages.prototype.____constructor(self, customGridEntities, custom
|
|
|
44766
44768
|
end
|
|
44767
44769
|
end
|
|
44768
44770
|
end
|
|
44771
|
+
self.postUseItemRedKey = function()
|
|
44772
|
+
local customStage = v.run.currentCustomStage
|
|
44773
|
+
if customStage == nil then
|
|
44774
|
+
return nil
|
|
44775
|
+
end
|
|
44776
|
+
if not self.usingRedKey then
|
|
44777
|
+
return
|
|
44778
|
+
end
|
|
44779
|
+
self.usingRedKey = false
|
|
44780
|
+
local level = game:GetLevel()
|
|
44781
|
+
level:SetStage(CUSTOM_FLOOR_STAGE, CUSTOM_FLOOR_STAGE_TYPE)
|
|
44782
|
+
return nil
|
|
44783
|
+
end
|
|
44769
44784
|
self.postCurseEval = function(____, curses)
|
|
44770
44785
|
local customStage = v.run.currentCustomStage
|
|
44771
44786
|
if customStage == nil then
|
|
@@ -44784,6 +44799,18 @@ function CustomStages.prototype.____constructor(self, customGridEntities, custom
|
|
|
44784
44799
|
streakTextGetShaderParams(nil, customStage, shaderName)
|
|
44785
44800
|
return nil
|
|
44786
44801
|
end
|
|
44802
|
+
self.preUseItemRedKey = function()
|
|
44803
|
+
local customStage = v.run.currentCustomStage
|
|
44804
|
+
if customStage == nil then
|
|
44805
|
+
return nil
|
|
44806
|
+
end
|
|
44807
|
+
self.usingRedKey = true
|
|
44808
|
+
local level = game:GetLevel()
|
|
44809
|
+
local stage = customStage.baseStage or DEFAULT_BASE_STAGE
|
|
44810
|
+
local stageType = customStage.baseStageType or DEFAULT_BASE_STAGE_TYPE
|
|
44811
|
+
level:SetStage(stage, stageType)
|
|
44812
|
+
return nil
|
|
44813
|
+
end
|
|
44787
44814
|
self.postGridEntityBrokenRockAlt = function(____, gridEntity)
|
|
44788
44815
|
local customStage = v.run.currentCustomStage
|
|
44789
44816
|
if customStage == nil then
|
|
@@ -44844,7 +44871,13 @@ function CustomStages.prototype.____constructor(self, customGridEntities, custom
|
|
|
44844
44871
|
ISCFeature.PAUSE,
|
|
44845
44872
|
ISCFeature.RUN_IN_N_FRAMES
|
|
44846
44873
|
}
|
|
44847
|
-
self.callbacksUsed = {
|
|
44874
|
+
self.callbacksUsed = {
|
|
44875
|
+
{ModCallback.POST_RENDER, self.postRender},
|
|
44876
|
+
{ModCallback.POST_USE_ITEM, self.postUseItemRedKey, {CollectibleType.RED_KEY}},
|
|
44877
|
+
{ModCallback.POST_CURSE_EVAL, self.postCurseEval},
|
|
44878
|
+
{ModCallback.GET_SHADER_PARAMS, self.getShaderParams},
|
|
44879
|
+
{ModCallback.PRE_USE_ITEM, self.preUseItemRedKey, {CollectibleType.RED_KEY}}
|
|
44880
|
+
}
|
|
44848
44881
|
self.customCallbacksUsed = {{ModCallbackCustom.POST_GRID_ENTITY_BROKEN, self.postGridEntityBrokenRockAlt, {GridEntityType.ROCK_ALT}}, {ModCallbackCustom.POST_GRID_ENTITY_INIT, self.postGridEntityInit}, {ModCallbackCustom.POST_NEW_ROOM_REORDERED, self.postNewRoomReordered}}
|
|
44849
44882
|
self.customGridEntities = customGridEntities
|
|
44850
44883
|
self.customTrapdoors = customTrapdoors
|
|
@@ -44878,10 +44911,10 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
|
|
|
44878
44911
|
for ____, room in ipairs(getRoomsInsideGrid(nil)) do
|
|
44879
44912
|
do
|
|
44880
44913
|
if room.SafeGridIndex == startingRoomGridIndex then
|
|
44881
|
-
goto
|
|
44914
|
+
goto __continue36
|
|
44882
44915
|
end
|
|
44883
44916
|
if room.Data == nil then
|
|
44884
|
-
goto
|
|
44917
|
+
goto __continue36
|
|
44885
44918
|
end
|
|
44886
44919
|
local roomType = room.Data.Type
|
|
44887
44920
|
local roomShapeMap = customStage.roomTypeMap:get(roomType)
|
|
@@ -44889,13 +44922,13 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
|
|
|
44889
44922
|
if roomType == RoomType.DEFAULT then
|
|
44890
44923
|
logError((((("Failed to find any custom rooms for RoomType." .. RoomType[roomType]) .. " (") .. tostring(roomType)) .. ") for custom stage: ") .. customStage.name)
|
|
44891
44924
|
end
|
|
44892
|
-
goto
|
|
44925
|
+
goto __continue36
|
|
44893
44926
|
end
|
|
44894
44927
|
local roomShape = room.Data.Shape
|
|
44895
44928
|
local roomDoorSlotFlagMap = roomShapeMap:get(roomShape)
|
|
44896
44929
|
if roomDoorSlotFlagMap == nil then
|
|
44897
44930
|
logError((((((((("Failed to find any custom rooms for RoomType." .. RoomType[roomType]) .. " (") .. tostring(roomType)) .. ") + RoomShape.") .. RoomShape[roomShape]) .. " (") .. tostring(roomShape)) .. ") for custom stage: ") .. customStage.name)
|
|
44898
|
-
goto
|
|
44931
|
+
goto __continue36
|
|
44899
44932
|
end
|
|
44900
44933
|
local doorSlotFlags = room.Data.Doors
|
|
44901
44934
|
local roomsMetadata = roomDoorSlotFlagMap:get(doorSlotFlags)
|
|
@@ -44905,13 +44938,13 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
|
|
|
44905
44938
|
roomsMetadata = roomDoorSlotFlagMap:get(allDoorSlotFlags)
|
|
44906
44939
|
if roomsMetadata == nil then
|
|
44907
44940
|
logError((((((((("Failed to find any custom rooms for RoomType." .. RoomType[roomType]) .. " (") .. tostring(roomType)) .. ") + RoomShape.") .. RoomShape[roomShape]) .. " (") .. tostring(roomShape)) .. ") + all doors enabled for custom stage: ") .. customStage.name)
|
|
44908
|
-
goto
|
|
44941
|
+
goto __continue36
|
|
44909
44942
|
end
|
|
44910
44943
|
end
|
|
44911
44944
|
local randomRoom
|
|
44912
44945
|
if roomType == RoomType.BOSS then
|
|
44913
44946
|
if customStage.bossPool == nil then
|
|
44914
|
-
goto
|
|
44947
|
+
goto __continue36
|
|
44915
44948
|
end
|
|
44916
44949
|
randomRoom = getRandomBossRoomFromPool(
|
|
44917
44950
|
nil,
|
|
@@ -44934,13 +44967,13 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
|
|
|
44934
44967
|
)
|
|
44935
44968
|
if newRoomData == nil then
|
|
44936
44969
|
logError((("Failed to get the room data for room variant " .. tostring(randomRoom.variant)) .. " for custom stage: ") .. customStage.name)
|
|
44937
|
-
goto
|
|
44970
|
+
goto __continue36
|
|
44938
44971
|
end
|
|
44939
44972
|
self.customStageCachedRoomData:set(randomRoom.variant, newRoomData)
|
|
44940
44973
|
end
|
|
44941
44974
|
room.Data = newRoomData
|
|
44942
44975
|
end
|
|
44943
|
-
::
|
|
44976
|
+
::__continue36::
|
|
44944
44977
|
end
|
|
44945
44978
|
end
|
|
44946
44979
|
function CustomStages.prototype.setCustomStage(self, name, firstFloor, streakText, verbose)
|
|
@@ -4,6 +4,7 @@ export declare class CustomStages extends Feature {
|
|
|
4
4
|
private readonly customStagesMap;
|
|
5
5
|
/** Indexed by room variant. */
|
|
6
6
|
private readonly customStageCachedRoomData;
|
|
7
|
+
private usingRedKey;
|
|
7
8
|
private readonly customGridEntities;
|
|
8
9
|
private readonly customTrapdoors;
|
|
9
10
|
private readonly disableAllSound;
|
|
@@ -15,8 +16,18 @@ export declare class CustomStages extends Feature {
|
|
|
15
16
|
private initCustomTrapdoorDestination;
|
|
16
17
|
private readonly goToCustomStage;
|
|
17
18
|
private readonly postRender;
|
|
19
|
+
/**
|
|
20
|
+
* Fix the bug where Red Key will not work on custom floors (due to the stage being a bugged
|
|
21
|
+
* value).
|
|
22
|
+
*/
|
|
23
|
+
private readonly postUseItemRedKey;
|
|
18
24
|
private readonly postCurseEval;
|
|
19
25
|
private readonly getShaderParams;
|
|
26
|
+
/**
|
|
27
|
+
* Fix the bug where Red Key will not work on custom floors (due to the stage being a bugged
|
|
28
|
+
* value).
|
|
29
|
+
*/
|
|
30
|
+
private readonly preUseItemRedKey;
|
|
20
31
|
private readonly postGridEntityBrokenRockAlt;
|
|
21
32
|
private readonly postGridEntityInit;
|
|
22
33
|
private readonly postNewRoomReordered;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomStages.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/CustomStages.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CustomStages.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/CustomStages.ts"],"names":[],"mappings":"AAyCA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AA2ChD,qBAAa,YAAa,SAAQ,OAAO;IAIvC,oCAAoC;IACpC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAkC;IAElE,+BAA+B;IAC/B,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAA8B;IAExE,OAAO,CAAC,WAAW,CAAS;IAE5B,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAqB;IACxD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAkB;IAClD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAkB;IAClD,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAyB;IAChE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAQ;IAC9B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAmE5C,OAAO,CAAC,uBAAuB;IAc/B,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,6BAA6B;IAOrC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAa9B;IAGF,OAAO,CAAC,QAAQ,CAAC,UAAU,CAmBzB;IAEF;;;OAGG;IAEH,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAehC;IAGF,OAAO,CAAC,QAAQ,CAAC,aAAa,CAc5B;IAGF,OAAO,CAAC,QAAQ,CAAC,eAAe,CAU9B;IAEF;;;OAGG;IAEH,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAc/B;IAIF,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAe1C;IAGF,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAqBjC;IAGF,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAwBnC;IAEF,gDAAgD;IAChD,OAAO,CAAC,iBAAiB;IAgGzB;;;;;;;;;;;;;;;;OAgBG;IAEI,cAAc,CACnB,IAAI,EAAE,MAAM,EACZ,UAAU,UAAO,EACjB,UAAU,UAAO,EACjB,OAAO,UAAQ,GACd,IAAI;IAkGP;;;;;OAKG;IAEI,kBAAkB,IAAI,IAAI;CAGlC"}
|
|
@@ -8,6 +8,7 @@ local __TS__DecorateLegacy = ____lualib.__TS__DecorateLegacy
|
|
|
8
8
|
local ____exports = {}
|
|
9
9
|
local getRoomTypeMap
|
|
10
10
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
11
|
+
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
11
12
|
local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
|
|
12
13
|
local LevelCurse = ____isaac_2Dtypescript_2Ddefinitions.LevelCurse
|
|
13
14
|
local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
|
|
@@ -115,6 +116,7 @@ function CustomStages.prototype.____constructor(self, customGridEntities, custom
|
|
|
115
116
|
self.v = v
|
|
116
117
|
self.customStagesMap = __TS__New(Map)
|
|
117
118
|
self.customStageCachedRoomData = __TS__New(Map)
|
|
119
|
+
self.usingRedKey = false
|
|
118
120
|
self.goToCustomStage = function(____, destinationName, destinationStage, _destinationStageType)
|
|
119
121
|
if destinationName == nil then
|
|
120
122
|
error("Failed to go to a custom stage since the custom trapdoors feature did not pass a destination name to the logic function.")
|
|
@@ -138,6 +140,19 @@ function CustomStages.prototype.____constructor(self, customGridEntities, custom
|
|
|
138
140
|
end
|
|
139
141
|
end
|
|
140
142
|
end
|
|
143
|
+
self.postUseItemRedKey = function()
|
|
144
|
+
local customStage = v.run.currentCustomStage
|
|
145
|
+
if customStage == nil then
|
|
146
|
+
return nil
|
|
147
|
+
end
|
|
148
|
+
if not self.usingRedKey then
|
|
149
|
+
return
|
|
150
|
+
end
|
|
151
|
+
self.usingRedKey = false
|
|
152
|
+
local level = game:GetLevel()
|
|
153
|
+
level:SetStage(CUSTOM_FLOOR_STAGE, CUSTOM_FLOOR_STAGE_TYPE)
|
|
154
|
+
return nil
|
|
155
|
+
end
|
|
141
156
|
self.postCurseEval = function(____, curses)
|
|
142
157
|
local customStage = v.run.currentCustomStage
|
|
143
158
|
if customStage == nil then
|
|
@@ -156,6 +171,18 @@ function CustomStages.prototype.____constructor(self, customGridEntities, custom
|
|
|
156
171
|
streakTextGetShaderParams(nil, customStage, shaderName)
|
|
157
172
|
return nil
|
|
158
173
|
end
|
|
174
|
+
self.preUseItemRedKey = function()
|
|
175
|
+
local customStage = v.run.currentCustomStage
|
|
176
|
+
if customStage == nil then
|
|
177
|
+
return nil
|
|
178
|
+
end
|
|
179
|
+
self.usingRedKey = true
|
|
180
|
+
local level = game:GetLevel()
|
|
181
|
+
local stage = customStage.baseStage or DEFAULT_BASE_STAGE
|
|
182
|
+
local stageType = customStage.baseStageType or DEFAULT_BASE_STAGE_TYPE
|
|
183
|
+
level:SetStage(stage, stageType)
|
|
184
|
+
return nil
|
|
185
|
+
end
|
|
159
186
|
self.postGridEntityBrokenRockAlt = function(____, gridEntity)
|
|
160
187
|
local customStage = v.run.currentCustomStage
|
|
161
188
|
if customStage == nil then
|
|
@@ -216,7 +243,13 @@ function CustomStages.prototype.____constructor(self, customGridEntities, custom
|
|
|
216
243
|
ISCFeature.PAUSE,
|
|
217
244
|
ISCFeature.RUN_IN_N_FRAMES
|
|
218
245
|
}
|
|
219
|
-
self.callbacksUsed = {
|
|
246
|
+
self.callbacksUsed = {
|
|
247
|
+
{ModCallback.POST_RENDER, self.postRender},
|
|
248
|
+
{ModCallback.POST_USE_ITEM, self.postUseItemRedKey, {CollectibleType.RED_KEY}},
|
|
249
|
+
{ModCallback.POST_CURSE_EVAL, self.postCurseEval},
|
|
250
|
+
{ModCallback.GET_SHADER_PARAMS, self.getShaderParams},
|
|
251
|
+
{ModCallback.PRE_USE_ITEM, self.preUseItemRedKey, {CollectibleType.RED_KEY}}
|
|
252
|
+
}
|
|
220
253
|
self.customCallbacksUsed = {{ModCallbackCustom.POST_GRID_ENTITY_BROKEN, self.postGridEntityBrokenRockAlt, {GridEntityType.ROCK_ALT}}, {ModCallbackCustom.POST_GRID_ENTITY_INIT, self.postGridEntityInit}, {ModCallbackCustom.POST_NEW_ROOM_REORDERED, self.postNewRoomReordered}}
|
|
221
254
|
self.customGridEntities = customGridEntities
|
|
222
255
|
self.customTrapdoors = customTrapdoors
|
|
@@ -250,10 +283,10 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
|
|
|
250
283
|
for ____, room in ipairs(getRoomsInsideGrid(nil)) do
|
|
251
284
|
do
|
|
252
285
|
if room.SafeGridIndex == startingRoomGridIndex then
|
|
253
|
-
goto
|
|
286
|
+
goto __continue36
|
|
254
287
|
end
|
|
255
288
|
if room.Data == nil then
|
|
256
|
-
goto
|
|
289
|
+
goto __continue36
|
|
257
290
|
end
|
|
258
291
|
local roomType = room.Data.Type
|
|
259
292
|
local roomShapeMap = customStage.roomTypeMap:get(roomType)
|
|
@@ -261,13 +294,13 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
|
|
|
261
294
|
if roomType == RoomType.DEFAULT then
|
|
262
295
|
logError((((("Failed to find any custom rooms for RoomType." .. RoomType[roomType]) .. " (") .. tostring(roomType)) .. ") for custom stage: ") .. customStage.name)
|
|
263
296
|
end
|
|
264
|
-
goto
|
|
297
|
+
goto __continue36
|
|
265
298
|
end
|
|
266
299
|
local roomShape = room.Data.Shape
|
|
267
300
|
local roomDoorSlotFlagMap = roomShapeMap:get(roomShape)
|
|
268
301
|
if roomDoorSlotFlagMap == nil then
|
|
269
302
|
logError((((((((("Failed to find any custom rooms for RoomType." .. RoomType[roomType]) .. " (") .. tostring(roomType)) .. ") + RoomShape.") .. RoomShape[roomShape]) .. " (") .. tostring(roomShape)) .. ") for custom stage: ") .. customStage.name)
|
|
270
|
-
goto
|
|
303
|
+
goto __continue36
|
|
271
304
|
end
|
|
272
305
|
local doorSlotFlags = room.Data.Doors
|
|
273
306
|
local roomsMetadata = roomDoorSlotFlagMap:get(doorSlotFlags)
|
|
@@ -277,13 +310,13 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
|
|
|
277
310
|
roomsMetadata = roomDoorSlotFlagMap:get(allDoorSlotFlags)
|
|
278
311
|
if roomsMetadata == nil then
|
|
279
312
|
logError((((((((("Failed to find any custom rooms for RoomType." .. RoomType[roomType]) .. " (") .. tostring(roomType)) .. ") + RoomShape.") .. RoomShape[roomShape]) .. " (") .. tostring(roomShape)) .. ") + all doors enabled for custom stage: ") .. customStage.name)
|
|
280
|
-
goto
|
|
313
|
+
goto __continue36
|
|
281
314
|
end
|
|
282
315
|
end
|
|
283
316
|
local randomRoom
|
|
284
317
|
if roomType == RoomType.BOSS then
|
|
285
318
|
if customStage.bossPool == nil then
|
|
286
|
-
goto
|
|
319
|
+
goto __continue36
|
|
287
320
|
end
|
|
288
321
|
randomRoom = getRandomBossRoomFromPool(
|
|
289
322
|
nil,
|
|
@@ -306,13 +339,13 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
|
|
|
306
339
|
)
|
|
307
340
|
if newRoomData == nil then
|
|
308
341
|
logError((("Failed to get the room data for room variant " .. tostring(randomRoom.variant)) .. " for custom stage: ") .. customStage.name)
|
|
309
|
-
goto
|
|
342
|
+
goto __continue36
|
|
310
343
|
end
|
|
311
344
|
self.customStageCachedRoomData:set(randomRoom.variant, newRoomData)
|
|
312
345
|
end
|
|
313
346
|
room.Data = newRoomData
|
|
314
347
|
end
|
|
315
|
-
::
|
|
348
|
+
::__continue36::
|
|
316
349
|
end
|
|
317
350
|
end
|
|
318
351
|
function CustomStages.prototype.setCustomStage(self, name, firstFloor, streakText, verbose)
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { DoorSlotFlag, Music } from "isaac-typescript-definitions";
|
|
2
2
|
import {
|
|
3
|
+
CollectibleType,
|
|
3
4
|
GridEntityType,
|
|
4
5
|
LevelCurse,
|
|
5
6
|
LevelStage,
|
|
@@ -91,6 +92,8 @@ export class CustomStages extends Feature {
|
|
|
91
92
|
/** Indexed by room variant. */
|
|
92
93
|
private readonly customStageCachedRoomData = new Map<int, RoomConfig>();
|
|
93
94
|
|
|
95
|
+
private usingRedKey = false;
|
|
96
|
+
|
|
94
97
|
private readonly customGridEntities: CustomGridEntities;
|
|
95
98
|
private readonly customTrapdoors: CustomTrapdoors;
|
|
96
99
|
private readonly disableAllSound: DisableAllSound;
|
|
@@ -122,11 +125,25 @@ export class CustomStages extends Feature {
|
|
|
122
125
|
// 2
|
|
123
126
|
[ModCallback.POST_RENDER, this.postRender],
|
|
124
127
|
|
|
128
|
+
// 3
|
|
129
|
+
[
|
|
130
|
+
ModCallback.POST_USE_ITEM,
|
|
131
|
+
this.postUseItemRedKey,
|
|
132
|
+
[CollectibleType.RED_KEY],
|
|
133
|
+
],
|
|
134
|
+
|
|
125
135
|
// 12
|
|
126
136
|
[ModCallback.POST_CURSE_EVAL, this.postCurseEval],
|
|
127
137
|
|
|
128
138
|
// 21
|
|
129
139
|
[ModCallback.GET_SHADER_PARAMS, this.getShaderParams],
|
|
140
|
+
|
|
141
|
+
// 23
|
|
142
|
+
[
|
|
143
|
+
ModCallback.PRE_USE_ITEM,
|
|
144
|
+
this.preUseItemRedKey,
|
|
145
|
+
[CollectibleType.RED_KEY],
|
|
146
|
+
],
|
|
130
147
|
];
|
|
131
148
|
|
|
132
149
|
this.customCallbacksUsed = [
|
|
@@ -216,6 +233,28 @@ export class CustomStages extends Feature {
|
|
|
216
233
|
}
|
|
217
234
|
};
|
|
218
235
|
|
|
236
|
+
/**
|
|
237
|
+
* Fix the bug where Red Key will not work on custom floors (due to the stage being a bugged
|
|
238
|
+
* value).
|
|
239
|
+
*/
|
|
240
|
+
// ModCallback.POST_USE_ITEM (3)
|
|
241
|
+
private readonly postUseItemRedKey = (): boolean | undefined => {
|
|
242
|
+
const customStage = v.run.currentCustomStage;
|
|
243
|
+
if (customStage === null) {
|
|
244
|
+
return undefined;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (!this.usingRedKey) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
this.usingRedKey = false;
|
|
251
|
+
|
|
252
|
+
const level = game.GetLevel();
|
|
253
|
+
level.SetStage(CUSTOM_FLOOR_STAGE, CUSTOM_FLOOR_STAGE_TYPE);
|
|
254
|
+
|
|
255
|
+
return undefined;
|
|
256
|
+
};
|
|
257
|
+
|
|
219
258
|
// ModCallback.POST_CURSE_EVAL (12)
|
|
220
259
|
private readonly postCurseEval = (
|
|
221
260
|
curses: BitFlags<LevelCurse>,
|
|
@@ -246,6 +285,27 @@ export class CustomStages extends Feature {
|
|
|
246
285
|
return undefined;
|
|
247
286
|
};
|
|
248
287
|
|
|
288
|
+
/**
|
|
289
|
+
* Fix the bug where Red Key will not work on custom floors (due to the stage being a bugged
|
|
290
|
+
* value).
|
|
291
|
+
*/
|
|
292
|
+
// ModCallback.PRE_USE_ITEM (23)
|
|
293
|
+
private readonly preUseItemRedKey = (): boolean | undefined => {
|
|
294
|
+
const customStage = v.run.currentCustomStage;
|
|
295
|
+
if (customStage === null) {
|
|
296
|
+
return undefined;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
this.usingRedKey = true;
|
|
300
|
+
|
|
301
|
+
const level = game.GetLevel();
|
|
302
|
+
const stage = customStage.baseStage ?? DEFAULT_BASE_STAGE;
|
|
303
|
+
const stageType = customStage.baseStageType ?? DEFAULT_BASE_STAGE_TYPE;
|
|
304
|
+
level.SetStage(stage, stageType); // eslint-disable-line isaacscript/strict-enums
|
|
305
|
+
|
|
306
|
+
return undefined;
|
|
307
|
+
};
|
|
308
|
+
|
|
249
309
|
// ModCallbackCustom.POST_GRID_ENTITY_BROKEN
|
|
250
310
|
// GridEntityType.ROCK_ALT
|
|
251
311
|
private readonly postGridEntityBrokenRockAlt = (gridEntity: GridEntity) => {
|