isaacscript-common 20.11.2 → 20.11.4

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.d.ts CHANGED
@@ -2494,6 +2494,7 @@ declare class CustomTrapdoors extends Feature {
2494
2494
  private postPEffectUpdateReordered;
2495
2495
  private checkJumpComplete;
2496
2496
  private shouldTrapdoorSpawnOpen;
2497
+ private logStateChanged;
2497
2498
  /**
2498
2499
  * Helper function to specify where your custom trapdoor should take the player. Call this once at
2499
2500
  * the beginning of your mod for each kind of custom trapdoor that you want to have. The provided
@@ -13395,11 +13396,6 @@ declare class RunInNFrames extends Feature {
13395
13396
  */
13396
13397
  export declare function runMergeTests(): void;
13397
13398
 
13398
- /**
13399
- * Using the "luamod" console command with a mod that has custom shaders can crash the game. A
13400
- * simple fix for this is automatically applied to any upgraded mods. This method was originally
13401
- * discovered by AgentCucco.
13402
- */
13403
13399
  declare class RunNextRoom extends Feature {
13404
13400
  vConditionalFunc: () => boolean;
13405
13401
  private postNewRoomReordered;
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 20.11.2
3
+ isaacscript-common 20.11.4
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -39206,6 +39206,8 @@ local ____TrapdoorAnimation = require("src.enums.private.TrapdoorAnimation")
39206
39206
  local TrapdoorAnimation = ____TrapdoorAnimation.TrapdoorAnimation
39207
39207
  local ____easing = require("src.functions.easing")
39208
39208
  local easeOutSine = ____easing.easeOutSine
39209
+ local ____log = require("src.functions.log")
39210
+ local log = ____log.log
39209
39211
  local ____playerCenter = require("src.functions.playerCenter")
39210
39212
  local movePlayersToCenter = ____playerCenter.movePlayersToCenter
39211
39213
  local ____playerIndex = require("src.functions.playerIndex")
@@ -39272,12 +39274,13 @@ end
39272
39274
  function goToVanillaStage(self, destinationStage, destinationStageType)
39273
39275
  setStage(nil, destinationStage, destinationStageType)
39274
39276
  end
39277
+ local DEBUG = false
39275
39278
  local TRAPDOOR_OPEN_DISTANCE = 60
39276
39279
  local TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS = TRAPDOOR_OPEN_DISTANCE * 2.5
39277
39280
  local TRAPDOOR_BOSS_REACTION_FRAMES = 30
39278
39281
  local TRAPDOOR_TOUCH_DISTANCE = 16.5
39279
- ANIMATIONS_THAT_PREVENT_STAGE_TRAVEL = __TS__New(Set, {"Happy", "Sad", "Jump"})
39280
- local PIXELATION_TO_BLACK_FRAMES = 52
39282
+ ANIMATIONS_THAT_PREVENT_STAGE_TRAVEL = __TS__New(Set, {"Death", "Happy", "Sad", "Jump"})
39283
+ local PIXELATION_TO_BLACK_FRAMES = 60
39281
39284
  local OTHER_PLAYER_TRAPDOOR_JUMP_DELAY_GAME_FRAMES = 6
39282
39285
  local OTHER_PLAYER_TRAPDOOR_JUMP_DURATION_GAME_FRAMES = 5
39283
39286
  ____exports.CustomTrapdoors = __TS__Class()
@@ -39346,6 +39349,7 @@ function CustomTrapdoors.prototype.checkAllPlayersJumpComplete(self)
39346
39349
  local roomGridIndex = getRoomGridIndex(nil)
39347
39350
  self.v.run.state = StageTravelState.PIXELATION_TO_BLACK
39348
39351
  self.v.run.stateRenderFrame = renderFrameCount
39352
+ self:logStateChanged()
39349
39353
  teleport(nil, roomGridIndex, Direction.NO_DIRECTION, RoomTransitionAnim.PIXELATION)
39350
39354
  end
39351
39355
  function CustomTrapdoors.prototype.checkPixelationToBlackComplete(self)
@@ -39359,6 +39363,7 @@ function CustomTrapdoors.prototype.checkPixelationToBlackComplete(self)
39359
39363
  return
39360
39364
  end
39361
39365
  self.v.run.state = StageTravelState.WAITING_FOR_FIRST_PIXELATION_TO_END
39366
+ self:logStateChanged()
39362
39367
  hud:SetVisible(false)
39363
39368
  self.runInNFrames:runNextGameFrame(function()
39364
39369
  local level = game:GetLevel()
@@ -39404,9 +39409,11 @@ function CustomTrapdoors.prototype.checkSecondPixelationHalfWay(self)
39404
39409
  return
39405
39410
  end
39406
39411
  self.v.run.state = StageTravelState.PIXELATION_TO_ROOM
39412
+ self:logStateChanged()
39407
39413
  hud:SetVisible(true)
39408
39414
  self.runNextRoom:runNextRoom(function()
39409
39415
  self.v.run.state = StageTravelState.PLAYERS_LAYING_DOWN
39416
+ self:logStateChanged()
39410
39417
  movePlayersToCenter(nil)
39411
39418
  for ____, player in ipairs(getAllPlayers(nil)) do
39412
39419
  player:AnimateAppear()
@@ -39423,6 +39430,7 @@ function CustomTrapdoors.prototype.checkAllPlayersLayingDownComplete(self)
39423
39430
  return
39424
39431
  end
39425
39432
  self.v.run.state = StageTravelState.NONE
39433
+ self:logStateChanged()
39426
39434
  local tstlClassName = getTSTLClassName(nil, self)
39427
39435
  if tstlClassName == nil then
39428
39436
  error("Failed to find get the class name for the custom trapdoor feature.")
@@ -39488,6 +39496,7 @@ end
39488
39496
  function CustomTrapdoors.prototype.playerTouchedCustomTrapdoor(self, gridEntity, trapdoorDescription, player)
39489
39497
  self.v.run.state = StageTravelState.PLAYERS_JUMPING_DOWN
39490
39498
  self.v.run.customTrapdoorActivated = trapdoorDescription
39499
+ self:logStateChanged()
39491
39500
  local tstlClassName = getTSTLClassName(nil, self)
39492
39501
  if tstlClassName == nil then
39493
39502
  error("Failed to find get the class name for the custom trapdoor feature.")
@@ -39580,6 +39589,14 @@ function CustomTrapdoors.prototype.shouldTrapdoorSpawnOpen(self, gridEntity, fir
39580
39589
  end
39581
39590
  return self:shouldTrapdoorOpen(gridEntity, firstSpawn)
39582
39591
  end
39592
+ function CustomTrapdoors.prototype.logStateChanged(self)
39593
+ if DEBUG then
39594
+ log(
39595
+ nil,
39596
+ ((("Custom trapdoors state changed: " .. StageTravelState[self.v.run.state]) .. " (") .. tostring(self.v.run.state)) .. ")"
39597
+ )
39598
+ end
39599
+ end
39583
39600
  function CustomTrapdoors.prototype.registerCustomTrapdoorDestination(self, destinationName, destinationFunc)
39584
39601
  if self.destinationFuncMap:has(destinationName) then
39585
39602
  error(("Failed to register a custom trapdoor type of " .. destinationName) .. " since this custom trapdoor type has already been registered.")
@@ -39591,7 +39608,7 @@ function CustomTrapdoors.prototype.spawnCustomTrapdoor(self, gridIndexOrPosition
39591
39608
  anm2Path = "gfx/grid/door_11_trapdoor.anm2"
39592
39609
  end
39593
39610
  if destinationName ~= nil and not self.destinationFuncMap:has(destinationName) then
39594
- error(("Failed to spawn a custom trapdoor with a destination of \"" .. destinationName) .. "\" since a destination with that name has not been registered with the \"registerCustomTrapdoor\" function.")
39611
+ error(("Failed to spawn a custom trapdoor with a destination of \"" .. destinationName) .. "\" since a destination with that name has not been registered with the \"registerCustomTrapdoorDestination\" function. (If you are trying to go to a custom stage, the custom stage library should automatically do this for you when your mod first boots.)")
39595
39612
  end
39596
39613
  if destinationStage == nil then
39597
39614
  destinationStage = self.stageHistory:getNextStageWithHistory()
@@ -42151,12 +42168,10 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
42151
42168
  local Map = ____lualib.Map
42152
42169
  local __TS__New = ____lualib.__TS__New
42153
42170
  local __TS__ObjectAssign = ____lualib.__TS__ObjectAssign
42154
- local __TS__ArrayMap = ____lualib.__TS__ArrayMap
42155
42171
  local __TS__Decorate = ____lualib.__TS__Decorate
42156
42172
  local ____exports = {}
42157
42173
  local getRoomTypeMap
42158
42174
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
42159
- local DoorSlot = ____isaac_2Dtypescript_2Ddefinitions.DoorSlot
42160
42175
  local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
42161
42176
  local LevelCurse = ____isaac_2Dtypescript_2Ddefinitions.LevelCurse
42162
42177
  local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
@@ -42178,7 +42193,8 @@ local UIStreakAnimation = ____UIStreakAnimation.UIStreakAnimation
42178
42193
  local ____array = require("src.functions.array")
42179
42194
  local isArray = ____array.isArray
42180
42195
  local ____doors = require("src.functions.doors")
42181
- local doorSlotFlagsToDoorSlots = ____doors.doorSlotFlagsToDoorSlots
42196
+ local doorSlotsToDoorSlotFlags = ____doors.doorSlotsToDoorSlotFlags
42197
+ local getDoorSlotsForRoomShape = ____doors.getDoorSlotsForRoomShape
42182
42198
  local ____flag = require("src.functions.flag")
42183
42199
  local hasFlag = ____flag.hasFlag
42184
42200
  local removeFlag = ____flag.removeFlag
@@ -42410,19 +42426,16 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
42410
42426
  local doorSlotFlags = room.Data.Doors
42411
42427
  local roomsMetadata = roomDoorSlotFlagMap:get(doorSlotFlags)
42412
42428
  if roomsMetadata == nil then
42413
- logError(
42414
- nil,
42415
- (((((((((("Failed to find any custom rooms for RoomType." .. RoomType[roomType]) .. " (") .. tostring(roomType)) .. ") + RoomShape.") .. RoomShape[roomShape]) .. " (") .. tostring(roomShape)) .. ") + DoorSlotFlags ") .. tostring(doorSlotFlags)) .. " for custom stage: ") .. customStage.name
42416
- )
42417
- local header = ("For reference, a DoorSlotFlags of " .. tostring(doorSlotFlags)) .. " is equal to the following doors being enabled:\n"
42418
- local doorSlots = doorSlotFlagsToDoorSlots(nil, doorSlotFlags)
42419
- local doorSlotLines = __TS__ArrayMap(
42420
- doorSlots,
42421
- function(____, doorSlot) return ((("- DoorSlot." .. DoorSlot[doorSlot]) .. " (") .. tostring(doorSlot)) .. ")" end
42422
- )
42423
- local explanation = header .. table.concat(doorSlotLines, "\n")
42424
- logError(nil, explanation)
42425
- goto __continue26
42429
+ local allDoorSlots = getDoorSlotsForRoomShape(nil, roomShape)
42430
+ local allDoorSlotFlags = doorSlotsToDoorSlotFlags(nil, allDoorSlots)
42431
+ roomsMetadata = roomDoorSlotFlagMap:get(allDoorSlotFlags)
42432
+ if roomsMetadata == nil then
42433
+ logError(
42434
+ nil,
42435
+ (((((((("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
42436
+ )
42437
+ goto __continue26
42438
+ end
42426
42439
  end
42427
42440
  local randomRoom
42428
42441
  if roomType == RoomType.BOSS then
@@ -1 +1 @@
1
- {"version":3,"file":"CustomStages.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/CustomStages.ts"],"names":[],"mappings":"AAsCA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAoChD,qBAAa,YAAa,SAAQ,OAAO;IA8BvC,oCAAoC;IACpC,OAAO,CAAC,eAAe,CAAkC;IAEzD,+BAA+B;IAC/B,OAAO,CAAC,yBAAyB,CAAwC;IAEzE,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,sBAAsB,CAAyB;IACvD,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,YAAY,CAAe;IAqDnC,OAAO,CAAC,uBAAuB;IAc/B,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,6BAA6B;IAOrC,OAAO,CAAC,eAAe,CAMrB;IAGF,OAAO,CAAC,UAAU,CAQhB;IAGF,OAAO,CAAC,aAAa,CAcnB;IAGF,OAAO,CAAC,eAAe,CAUrB;IAIF,OAAO,CAAC,2BAA2B,CAejC;IAGF,OAAO,CAAC,kBAAkB,CAqBxB;IAGF,OAAO,CAAC,oBAAoB,CAe1B;IAEF,gDAAgD;IAChD,OAAO,CAAC,iBAAiB;IA+FzB;;;;;;;;;;;;;;;;OAgBG;IAEI,cAAc,CACnB,IAAI,EAAE,MAAM,EACZ,UAAU,UAAO,EACjB,UAAU,UAAO,EACjB,OAAO,UAAQ,GACd,IAAI;IAoEP;;;;;OAKG;IAEI,kBAAkB,IAAI,IAAI;CAGlC"}
1
+ {"version":3,"file":"CustomStages.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/CustomStages.ts"],"names":[],"mappings":"AAwCA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAoChD,qBAAa,YAAa,SAAQ,OAAO;IA8BvC,oCAAoC;IACpC,OAAO,CAAC,eAAe,CAAkC;IAEzD,+BAA+B;IAC/B,OAAO,CAAC,yBAAyB,CAAwC;IAEzE,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,sBAAsB,CAAyB;IACvD,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,YAAY,CAAe;IAqDnC,OAAO,CAAC,uBAAuB;IAc/B,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,6BAA6B;IAOrC,OAAO,CAAC,eAAe,CAMrB;IAGF,OAAO,CAAC,UAAU,CAQhB;IAGF,OAAO,CAAC,aAAa,CAcnB;IAGF,OAAO,CAAC,eAAe,CAUrB;IAIF,OAAO,CAAC,2BAA2B,CAejC;IAGF,OAAO,CAAC,kBAAkB,CAqBxB;IAGF,OAAO,CAAC,oBAAoB,CAe1B;IAEF,gDAAgD;IAChD,OAAO,CAAC,iBAAiB;IA+FzB;;;;;;;;;;;;;;;;OAgBG;IAEI,cAAc,CACnB,IAAI,EAAE,MAAM,EACZ,UAAU,UAAO,EACjB,UAAU,UAAO,EACjB,OAAO,UAAQ,GACd,IAAI;IAoEP;;;;;OAKG;IAEI,kBAAkB,IAAI,IAAI;CAGlC"}
@@ -4,12 +4,10 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
4
4
  local Map = ____lualib.Map
5
5
  local __TS__New = ____lualib.__TS__New
6
6
  local __TS__ObjectAssign = ____lualib.__TS__ObjectAssign
7
- local __TS__ArrayMap = ____lualib.__TS__ArrayMap
8
7
  local __TS__Decorate = ____lualib.__TS__Decorate
9
8
  local ____exports = {}
10
9
  local getRoomTypeMap
11
10
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
12
- local DoorSlot = ____isaac_2Dtypescript_2Ddefinitions.DoorSlot
13
11
  local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
14
12
  local LevelCurse = ____isaac_2Dtypescript_2Ddefinitions.LevelCurse
15
13
  local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
@@ -31,7 +29,8 @@ local UIStreakAnimation = ____UIStreakAnimation.UIStreakAnimation
31
29
  local ____array = require("src.functions.array")
32
30
  local isArray = ____array.isArray
33
31
  local ____doors = require("src.functions.doors")
34
- local doorSlotFlagsToDoorSlots = ____doors.doorSlotFlagsToDoorSlots
32
+ local doorSlotsToDoorSlotFlags = ____doors.doorSlotsToDoorSlotFlags
33
+ local getDoorSlotsForRoomShape = ____doors.getDoorSlotsForRoomShape
35
34
  local ____flag = require("src.functions.flag")
36
35
  local hasFlag = ____flag.hasFlag
37
36
  local removeFlag = ____flag.removeFlag
@@ -263,19 +262,16 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
263
262
  local doorSlotFlags = room.Data.Doors
264
263
  local roomsMetadata = roomDoorSlotFlagMap:get(doorSlotFlags)
265
264
  if roomsMetadata == nil then
266
- logError(
267
- nil,
268
- (((((((((("Failed to find any custom rooms for RoomType." .. RoomType[roomType]) .. " (") .. tostring(roomType)) .. ") + RoomShape.") .. RoomShape[roomShape]) .. " (") .. tostring(roomShape)) .. ") + DoorSlotFlags ") .. tostring(doorSlotFlags)) .. " for custom stage: ") .. customStage.name
269
- )
270
- local header = ("For reference, a DoorSlotFlags of " .. tostring(doorSlotFlags)) .. " is equal to the following doors being enabled:\n"
271
- local doorSlots = doorSlotFlagsToDoorSlots(nil, doorSlotFlags)
272
- local doorSlotLines = __TS__ArrayMap(
273
- doorSlots,
274
- function(____, doorSlot) return ((("- DoorSlot." .. DoorSlot[doorSlot]) .. " (") .. tostring(doorSlot)) .. ")" end
275
- )
276
- local explanation = header .. table.concat(doorSlotLines, "\n")
277
- logError(nil, explanation)
278
- goto __continue26
265
+ local allDoorSlots = getDoorSlotsForRoomShape(nil, roomShape)
266
+ local allDoorSlotFlags = doorSlotsToDoorSlotFlags(nil, allDoorSlots)
267
+ roomsMetadata = roomDoorSlotFlagMap:get(allDoorSlotFlags)
268
+ if roomsMetadata == nil then
269
+ logError(
270
+ nil,
271
+ (((((((("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
272
+ )
273
+ goto __continue26
274
+ end
279
275
  end
280
276
  local randomRoom
281
277
  if roomType == RoomType.BOSS then
@@ -36,6 +36,7 @@ export declare class CustomTrapdoors extends Feature {
36
36
  private postPEffectUpdateReordered;
37
37
  private checkJumpComplete;
38
38
  private shouldTrapdoorSpawnOpen;
39
+ private logStateChanged;
39
40
  /**
40
41
  * Helper function to specify where your custom trapdoor should take the player. Call this once at
41
42
  * the beginning of your mod for each kind of custom trapdoor that you want to have. The provided
@@ -1 +1 @@
1
- {"version":3,"file":"CustomTrapdoors.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/CustomTrapdoors.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,UAAU,EAKV,SAAS,EACV,MAAM,8BAA8B,CAAC;AA4BtC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AA4BhD,qBAAa,eAAgB,SAAQ,OAAO;IAC1C,qCAAqC;IACrC,OAAO,CAAC,kBAAkB,CAGtB;IAqBJ;;;;;OAKG;IACH,OAAO,CAAC,WAAW,CAAY;IAE/B,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,YAAY,CAAe;IAmDnC,OA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C,EAAE,UAAU,EAC7B,oBAAoB,CAAC,EAAE,SAAS,EAChC,QAAQ,SAAmC,EAC3C,SAAS,CAAC,EAAE,OAAO,GAClB,UAAU;CA0Dd"}
@@ -40,6 +40,8 @@ local ____TrapdoorAnimation = require("src.enums.private.TrapdoorAnimation")
40
40
  local TrapdoorAnimation = ____TrapdoorAnimation.TrapdoorAnimation
41
41
  local ____easing = require("src.functions.easing")
42
42
  local easeOutSine = ____easing.easeOutSine
43
+ local ____log = require("src.functions.log")
44
+ local log = ____log.log
43
45
  local ____playerCenter = require("src.functions.playerCenter")
44
46
  local movePlayersToCenter = ____playerCenter.movePlayersToCenter
45
47
  local ____playerIndex = require("src.functions.playerIndex")
@@ -106,13 +108,14 @@ end
106
108
  function goToVanillaStage(self, destinationStage, destinationStageType)
107
109
  setStage(nil, destinationStage, destinationStageType)
108
110
  end
111
+ local DEBUG = false
109
112
  --- This also applies to crawl spaces. The value was determined through trial and error.
110
113
  local TRAPDOOR_OPEN_DISTANCE = 60
111
114
  local TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS = TRAPDOOR_OPEN_DISTANCE * 2.5
112
115
  local TRAPDOOR_BOSS_REACTION_FRAMES = 30
113
116
  local TRAPDOOR_TOUCH_DISTANCE = 16.5
114
- ANIMATIONS_THAT_PREVENT_STAGE_TRAVEL = __TS__New(Set, {"Happy", "Sad", "Jump"})
115
- local PIXELATION_TO_BLACK_FRAMES = 52
117
+ ANIMATIONS_THAT_PREVENT_STAGE_TRAVEL = __TS__New(Set, {"Death", "Happy", "Sad", "Jump"})
118
+ local PIXELATION_TO_BLACK_FRAMES = 60
116
119
  local OTHER_PLAYER_TRAPDOOR_JUMP_DELAY_GAME_FRAMES = 6
117
120
  local OTHER_PLAYER_TRAPDOOR_JUMP_DURATION_GAME_FRAMES = 5
118
121
  ____exports.CustomTrapdoors = __TS__Class()
@@ -181,6 +184,7 @@ function CustomTrapdoors.prototype.checkAllPlayersJumpComplete(self)
181
184
  local roomGridIndex = getRoomGridIndex(nil)
182
185
  self.v.run.state = StageTravelState.PIXELATION_TO_BLACK
183
186
  self.v.run.stateRenderFrame = renderFrameCount
187
+ self:logStateChanged()
184
188
  teleport(nil, roomGridIndex, Direction.NO_DIRECTION, RoomTransitionAnim.PIXELATION)
185
189
  end
186
190
  function CustomTrapdoors.prototype.checkPixelationToBlackComplete(self)
@@ -194,6 +198,7 @@ function CustomTrapdoors.prototype.checkPixelationToBlackComplete(self)
194
198
  return
195
199
  end
196
200
  self.v.run.state = StageTravelState.WAITING_FOR_FIRST_PIXELATION_TO_END
201
+ self:logStateChanged()
197
202
  hud:SetVisible(false)
198
203
  self.runInNFrames:runNextGameFrame(function()
199
204
  local level = game:GetLevel()
@@ -239,9 +244,11 @@ function CustomTrapdoors.prototype.checkSecondPixelationHalfWay(self)
239
244
  return
240
245
  end
241
246
  self.v.run.state = StageTravelState.PIXELATION_TO_ROOM
247
+ self:logStateChanged()
242
248
  hud:SetVisible(true)
243
249
  self.runNextRoom:runNextRoom(function()
244
250
  self.v.run.state = StageTravelState.PLAYERS_LAYING_DOWN
251
+ self:logStateChanged()
245
252
  movePlayersToCenter(nil)
246
253
  for ____, player in ipairs(getAllPlayers(nil)) do
247
254
  player:AnimateAppear()
@@ -258,6 +265,7 @@ function CustomTrapdoors.prototype.checkAllPlayersLayingDownComplete(self)
258
265
  return
259
266
  end
260
267
  self.v.run.state = StageTravelState.NONE
268
+ self:logStateChanged()
261
269
  local tstlClassName = getTSTLClassName(nil, self)
262
270
  if tstlClassName == nil then
263
271
  error("Failed to find get the class name for the custom trapdoor feature.")
@@ -323,6 +331,7 @@ end
323
331
  function CustomTrapdoors.prototype.playerTouchedCustomTrapdoor(self, gridEntity, trapdoorDescription, player)
324
332
  self.v.run.state = StageTravelState.PLAYERS_JUMPING_DOWN
325
333
  self.v.run.customTrapdoorActivated = trapdoorDescription
334
+ self:logStateChanged()
326
335
  local tstlClassName = getTSTLClassName(nil, self)
327
336
  if tstlClassName == nil then
328
337
  error("Failed to find get the class name for the custom trapdoor feature.")
@@ -415,6 +424,14 @@ function CustomTrapdoors.prototype.shouldTrapdoorSpawnOpen(self, gridEntity, fir
415
424
  end
416
425
  return self:shouldTrapdoorOpen(gridEntity, firstSpawn)
417
426
  end
427
+ function CustomTrapdoors.prototype.logStateChanged(self)
428
+ if DEBUG then
429
+ log(
430
+ nil,
431
+ ((("Custom trapdoors state changed: " .. StageTravelState[self.v.run.state]) .. " (") .. tostring(self.v.run.state)) .. ")"
432
+ )
433
+ end
434
+ end
418
435
  function CustomTrapdoors.prototype.registerCustomTrapdoorDestination(self, destinationName, destinationFunc)
419
436
  if self.destinationFuncMap:has(destinationName) then
420
437
  error(("Failed to register a custom trapdoor type of " .. destinationName) .. " since this custom trapdoor type has already been registered.")
@@ -426,7 +443,7 @@ function CustomTrapdoors.prototype.spawnCustomTrapdoor(self, gridIndexOrPosition
426
443
  anm2Path = "gfx/grid/door_11_trapdoor.anm2"
427
444
  end
428
445
  if destinationName ~= nil and not self.destinationFuncMap:has(destinationName) then
429
- error(("Failed to spawn a custom trapdoor with a destination of \"" .. destinationName) .. "\" since a destination with that name has not been registered with the \"registerCustomTrapdoor\" function.")
446
+ error(("Failed to spawn a custom trapdoor with a destination of \"" .. destinationName) .. "\" since a destination with that name has not been registered with the \"registerCustomTrapdoorDestination\" function. (If you are trying to go to a custom stage, the custom stage library should automatically do this for you when your mod first boots.)")
430
447
  end
431
448
  if destinationStage == nil then
432
449
  destinationStage = self.stageHistory:getNextStageWithHistory()
@@ -1,9 +1,4 @@
1
1
  import { Feature } from "../../private/Feature";
2
- /**
3
- * Using the "luamod" console command with a mod that has custom shaders can crash the game. A
4
- * simple fix for this is automatically applied to any upgraded mods. This method was originally
5
- * discovered by AgentCucco.
6
- */
7
2
  export declare class RunNextRoom extends Feature {
8
3
  vConditionalFunc: () => boolean;
9
4
  private postNewRoomReordered;
@@ -1 +1 @@
1
- {"version":3,"file":"RunNextRoom.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/RunNextRoom.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD;;;;GAIG;AACH,qBAAa,WAAY,SAAQ,OAAO;IAStB,gBAAgB,QAAO,OAAO,CAAU;IAYxD,OAAO,CAAC,oBAAoB,CAM1B;IAEF;;;;;;;;OAQG;IAEI,WAAW,CAAC,IAAI,EAAE,MAAM,IAAI,GAAG,IAAI;CAG3C"}
1
+ {"version":3,"file":"RunNextRoom.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/RunNextRoom.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,qBAAa,WAAY,SAAQ,OAAO;IAStB,gBAAgB,QAAO,OAAO,CAAU;IAYxD,OAAO,CAAC,oBAAoB,CAM1B;IAEF;;;;;;;;OAQG;IAEI,WAAW,CAAC,IAAI,EAAE,MAAM,IAAI,GAAG,IAAI;CAG3C"}
@@ -11,9 +11,6 @@ local ____array = require("src.functions.array")
11
11
  local emptyArray = ____array.emptyArray
12
12
  local ____Feature = require("src.classes.private.Feature")
13
13
  local Feature = ____Feature.Feature
14
- --- Using the "luamod" console command with a mod that has custom shaders can crash the game. A
15
- -- simple fix for this is automatically applied to any upgraded mods. This method was originally
16
- -- discovered by AgentCucco.
17
14
  ____exports.RunNextRoom = __TS__Class()
18
15
  local RunNextRoom = ____exports.RunNextRoom
19
16
  RunNextRoom.name = "RunNextRoom"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "20.11.2",
3
+ "version": "20.11.4",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -1,6 +1,5 @@
1
1
  import {
2
2
  ControllerIndex,
3
- DoorSlot,
4
3
  DoorSlotFlag,
5
4
  GridEntityType,
6
5
  LevelCurse,
@@ -17,7 +16,10 @@ import { ISCFeature } from "../../../enums/ISCFeature";
17
16
  import { ModCallbackCustom } from "../../../enums/ModCallbackCustom";
18
17
  import { UIStreakAnimation } from "../../../enums/private/UIStreakAnimation";
19
18
  import { isArray } from "../../../functions/array";
20
- import { doorSlotFlagsToDoorSlots } from "../../../functions/doors";
19
+ import {
20
+ doorSlotsToDoorSlotFlags,
21
+ getDoorSlotsForRoomShape,
22
+ } from "../../../functions/doors";
21
23
  import { hasFlag, removeFlag } from "../../../functions/flag";
22
24
  import { logError } from "../../../functions/logMisc";
23
25
  import { newRNG } from "../../../functions/rng";
@@ -348,20 +350,20 @@ export class CustomStages extends Feature {
348
350
  }
349
351
 
350
352
  const doorSlotFlags = room.Data.Doors;
351
- const roomsMetadata = roomDoorSlotFlagMap.get(doorSlotFlags);
353
+ let roomsMetadata = roomDoorSlotFlagMap.get(doorSlotFlags);
352
354
  if (roomsMetadata === undefined) {
353
- logError(
354
- `Failed to find any custom rooms for RoomType.${RoomType[roomType]} (${roomType}) + RoomShape.${RoomShape[roomShape]} (${roomShape}) + DoorSlotFlags ${doorSlotFlags} for custom stage: ${customStage.name}`,
355
- );
356
-
357
- const header = `For reference, a DoorSlotFlags of ${doorSlotFlags} is equal to the following doors being enabled:\n`;
358
- const doorSlots = doorSlotFlagsToDoorSlots(doorSlotFlags);
359
- const doorSlotLines = doorSlots.map(
360
- (doorSlot) => `- DoorSlot.${DoorSlot[doorSlot]} (${doorSlot})`,
361
- );
362
- const explanation = header + doorSlotLines.join("\n");
363
- logError(explanation);
364
- continue;
355
+ // The custom stage does not have any rooms for the specific room type + room shape + door
356
+ // slot combination. As a fallback, check to see if the custom stage has one or more rooms
357
+ // for this specific room type + room shape + all doors.
358
+ const allDoorSlots = getDoorSlotsForRoomShape(roomShape);
359
+ const allDoorSlotFlags = doorSlotsToDoorSlotFlags(allDoorSlots);
360
+ roomsMetadata = roomDoorSlotFlagMap.get(allDoorSlotFlags);
361
+ if (roomsMetadata === undefined) {
362
+ logError(
363
+ `Failed to find any custom rooms for RoomType.${RoomType[roomType]} (${roomType}) + RoomShape.${RoomShape[roomShape]} (${roomShape}) + all doors enabled for custom stage: ${customStage.name}`,
364
+ );
365
+ continue;
366
+ }
365
367
  }
366
368
 
367
369
  let randomRoom: CustomStageRoomMetadata;
@@ -21,6 +21,7 @@ import { GridEntityTypeCustom } from "../../../enums/private/GridEntityTypeCusto
21
21
  import { StageTravelState } from "../../../enums/private/StageTravelState";
22
22
  import { TrapdoorAnimation } from "../../../enums/private/TrapdoorAnimation";
23
23
  import { easeOutSine } from "../../../functions/easing";
24
+ import { log } from "../../../functions/log";
24
25
  import { movePlayersToCenter } from "../../../functions/playerCenter";
25
26
  import {
26
27
  getAllPlayers,
@@ -48,6 +49,8 @@ import { RunInNFrames } from "./RunInNFrames";
48
49
  import { RunNextRoom } from "./RunNextRoom";
49
50
  import { StageHistory } from "./StageHistory";
50
51
 
52
+ const DEBUG = false as boolean;
53
+
51
54
  /** This also applies to crawl spaces. The value was determined through trial and error. */
52
55
  const TRAPDOOR_OPEN_DISTANCE = 60;
53
56
 
@@ -57,12 +60,13 @@ const TRAPDOOR_BOSS_REACTION_FRAMES = 30;
57
60
  const TRAPDOOR_TOUCH_DISTANCE = 16.5;
58
61
 
59
62
  const ANIMATIONS_THAT_PREVENT_STAGE_TRAVEL: ReadonlySet<string> = new Set([
63
+ "Death",
60
64
  "Happy",
61
65
  "Sad",
62
66
  "Jump",
63
67
  ]);
64
68
 
65
- const PIXELATION_TO_BLACK_FRAMES = 52;
69
+ const PIXELATION_TO_BLACK_FRAMES = 60;
66
70
 
67
71
  const OTHER_PLAYER_TRAPDOOR_JUMP_DELAY_GAME_FRAMES = 6;
68
72
  const OTHER_PLAYER_TRAPDOOR_JUMP_DURATION_GAME_FRAMES = 5;
@@ -180,6 +184,7 @@ export class CustomTrapdoors extends Feature {
180
184
 
181
185
  this.v.run.state = StageTravelState.PIXELATION_TO_BLACK;
182
186
  this.v.run.stateRenderFrame = renderFrameCount;
187
+ this.logStateChanged();
183
188
 
184
189
  // In order to display the pixelation effect that should happen when we go to a new floor, we
185
190
  // need to start a room transition. We arbitrarily pick the current room for this purpose. (We
@@ -214,6 +219,7 @@ export class CustomTrapdoors extends Feature {
214
219
  }
215
220
 
216
221
  this.v.run.state = StageTravelState.WAITING_FOR_FIRST_PIXELATION_TO_END;
222
+ this.logStateChanged();
217
223
 
218
224
  // Now, we display a black sprite on top of the pixelation effect, to prevent showing the rest
219
225
  // of the animation.
@@ -303,11 +309,13 @@ export class CustomTrapdoors extends Feature {
303
309
  }
304
310
 
305
311
  this.v.run.state = StageTravelState.PIXELATION_TO_ROOM;
312
+ this.logStateChanged();
306
313
 
307
314
  hud.SetVisible(true);
308
315
 
309
316
  this.runNextRoom.runNextRoom(() => {
310
317
  this.v.run.state = StageTravelState.PLAYERS_LAYING_DOWN;
318
+ this.logStateChanged();
311
319
 
312
320
  // After the room transition, the players will be placed next to a door, but they should be in
313
321
  // the center of the room to emulate what happens on a vanilla stage.
@@ -333,6 +341,7 @@ export class CustomTrapdoors extends Feature {
333
341
  }
334
342
 
335
343
  this.v.run.state = StageTravelState.NONE;
344
+ this.logStateChanged();
336
345
 
337
346
  const tstlClassName = getTSTLClassName(this);
338
347
  if (tstlClassName === undefined) {
@@ -473,6 +482,7 @@ export class CustomTrapdoors extends Feature {
473
482
  ) {
474
483
  this.v.run.state = StageTravelState.PLAYERS_JUMPING_DOWN;
475
484
  this.v.run.customTrapdoorActivated = trapdoorDescription;
485
+ this.logStateChanged();
476
486
 
477
487
  const tstlClassName = getTSTLClassName(this);
478
488
  if (tstlClassName === undefined) {
@@ -620,6 +630,16 @@ export class CustomTrapdoors extends Feature {
620
630
  return this.shouldTrapdoorOpen(gridEntity, firstSpawn);
621
631
  }
622
632
 
633
+ private logStateChanged(): void {
634
+ if (DEBUG) {
635
+ log(
636
+ `Custom trapdoors state changed: ${
637
+ StageTravelState[this.v.run.state]
638
+ } (${this.v.run.state})`,
639
+ );
640
+ }
641
+ }
642
+
623
643
  /**
624
644
  * Helper function to specify where your custom trapdoor should take the player. Call this once at
625
645
  * the beginning of your mod for each kind of custom trapdoor that you want to have. The provided
@@ -708,7 +728,7 @@ export class CustomTrapdoors extends Feature {
708
728
  !this.destinationFuncMap.has(destinationName)
709
729
  ) {
710
730
  error(
711
- `Failed to spawn a custom trapdoor with a destination of "${destinationName}" since a destination with that name has not been registered with the "registerCustomTrapdoor" function.`,
731
+ `Failed to spawn a custom trapdoor with a destination of "${destinationName}" since a destination with that name has not been registered with the "registerCustomTrapdoorDestination" function. (If you are trying to go to a custom stage, the custom stage library should automatically do this for you when your mod first boots.)`,
712
732
  );
713
733
  }
714
734