isaacscript-common 6.20.1 → 6.22.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.
Files changed (122) hide show
  1. package/dist/constants.d.ts +6 -0
  2. package/dist/constants.d.ts.map +1 -1
  3. package/dist/constants.lua +4 -0
  4. package/dist/constantsFirstLast.d.ts +2 -2
  5. package/dist/constantsFirstLast.lua +2 -2
  6. package/dist/enums/RockAltType.d.ts +12 -1
  7. package/dist/enums/RockAltType.d.ts.map +1 -1
  8. package/dist/enums/RockAltType.lua +4 -2
  9. package/dist/enums/private/StageTravelState.d.ts +4 -3
  10. package/dist/enums/private/StageTravelState.d.ts.map +1 -1
  11. package/dist/enums/private/StageTravelState.lua +6 -4
  12. package/dist/features/customStage/backdrop.d.ts.map +1 -1
  13. package/dist/features/customStage/backdrop.lua +3 -2
  14. package/dist/features/customStage/customStageConstants.d.ts +11 -0
  15. package/dist/features/customStage/customStageConstants.d.ts.map +1 -1
  16. package/dist/features/customStage/customStageConstants.lua +10 -0
  17. package/dist/features/customStage/customStageGridEntities.d.ts +1 -0
  18. package/dist/features/customStage/customStageGridEntities.d.ts.map +1 -1
  19. package/dist/features/customStage/customStageGridEntities.lua +65 -23
  20. package/dist/features/customStage/exports.d.ts +17 -3
  21. package/dist/features/customStage/exports.d.ts.map +1 -1
  22. package/dist/features/customStage/exports.lua +65 -46
  23. package/dist/features/customStage/init.d.ts.map +1 -1
  24. package/dist/features/customStage/init.lua +7 -12
  25. package/dist/features/customStage/shadows.d.ts.map +1 -1
  26. package/dist/features/customStage/shadows.lua +2 -1
  27. package/dist/features/customStage/streakText.d.ts +0 -7
  28. package/dist/features/customStage/streakText.d.ts.map +1 -1
  29. package/dist/features/customStage/streakText.lua +52 -85
  30. package/dist/features/customStage/v.d.ts +13 -0
  31. package/dist/features/customStage/v.d.ts.map +1 -1
  32. package/dist/features/customStage/v.lua +6 -1
  33. package/dist/features/customStage/versusScreen.d.ts.map +1 -1
  34. package/dist/features/customStage/versusScreen.lua +32 -1
  35. package/dist/features/customTrapdoor/blackSprite.d.ts.map +1 -1
  36. package/dist/features/customTrapdoor/blackSprite.lua +2 -1
  37. package/dist/features/customTrapdoor/customTrapdoorConstants.d.ts +4 -0
  38. package/dist/features/customTrapdoor/customTrapdoorConstants.d.ts.map +1 -1
  39. package/dist/features/customTrapdoor/exports.d.ts +11 -7
  40. package/dist/features/customTrapdoor/exports.d.ts.map +1 -1
  41. package/dist/features/customTrapdoor/exports.lua +6 -5
  42. package/dist/features/customTrapdoor/init.d.ts.map +1 -1
  43. package/dist/features/customTrapdoor/init.lua +35 -20
  44. package/dist/features/customTrapdoor/touched.lua +1 -1
  45. package/dist/features/customTrapdoor/v.d.ts +2 -2
  46. package/dist/features/customTrapdoor/v.d.ts.map +1 -1
  47. package/dist/features/extraConsoleCommands/commandsSubroutines.d.ts.map +1 -1
  48. package/dist/features/extraConsoleCommands/commandsSubroutines.lua +3 -3
  49. package/dist/features/playerInventory.d.ts +7 -0
  50. package/dist/features/playerInventory.d.ts.map +1 -1
  51. package/dist/features/playerInventory.lua +7 -0
  52. package/dist/features/saveDataManager/exports.d.ts +3 -0
  53. package/dist/features/saveDataManager/exports.d.ts.map +1 -1
  54. package/dist/features/saveDataManager/exports.lua +3 -0
  55. package/dist/functions/collectibleSet.d.ts +1 -1
  56. package/dist/functions/collectibleSet.lua +1 -1
  57. package/dist/functions/doors.d.ts +10 -0
  58. package/dist/functions/doors.d.ts.map +1 -1
  59. package/dist/functions/doors.lua +6 -0
  60. package/dist/functions/levelGrid.lua +1 -1
  61. package/dist/functions/log.d.ts +1 -15
  62. package/dist/functions/log.d.ts.map +1 -1
  63. package/dist/functions/log.lua +3 -218
  64. package/dist/functions/logEntities.d.ts +16 -0
  65. package/dist/functions/logEntities.d.ts.map +1 -0
  66. package/dist/functions/logEntities.lua +220 -0
  67. package/dist/functions/rockAlt.d.ts +6 -5
  68. package/dist/functions/rockAlt.d.ts.map +1 -1
  69. package/dist/functions/rockAlt.lua +147 -18
  70. package/dist/functions/roomData.d.ts +1 -1
  71. package/dist/functions/roomData.d.ts.map +1 -1
  72. package/dist/functions/roomTransition.d.ts +26 -0
  73. package/dist/functions/roomTransition.d.ts.map +1 -0
  74. package/dist/functions/roomTransition.lua +75 -0
  75. package/dist/functions/rooms.d.ts +36 -35
  76. package/dist/functions/rooms.d.ts.map +1 -1
  77. package/dist/functions/rooms.lua +94 -99
  78. package/dist/index.d.ts +1 -0
  79. package/dist/index.d.ts.map +1 -1
  80. package/dist/index.lua +8 -0
  81. package/dist/interfaces/private/CustomTrapdoorDescription.d.ts +2 -2
  82. package/dist/interfaces/private/CustomTrapdoorDescription.d.ts.map +1 -1
  83. package/dist/objects/backdropTypeToRockAltType.lua +3 -3
  84. package/dist/types/TrapdoorDestination.d.ts +3 -0
  85. package/dist/types/TrapdoorDestination.d.ts.map +1 -0
  86. package/dist/types/TrapdoorDestination.lua +2 -0
  87. package/package.json +2 -2
  88. package/src/constants.ts +6 -0
  89. package/src/constantsFirstLast.ts +2 -2
  90. package/src/enums/RockAltType.ts +14 -1
  91. package/src/enums/private/StageTravelState.ts +2 -1
  92. package/src/features/customStage/backdrop.ts +2 -1
  93. package/src/features/customStage/customStageConstants.ts +16 -0
  94. package/src/features/customStage/customStageGridEntities.ts +61 -0
  95. package/src/features/customStage/exports.ts +81 -42
  96. package/src/features/customStage/init.ts +7 -18
  97. package/src/features/customStage/shadows.ts +2 -1
  98. package/src/features/customStage/streakText.ts +59 -96
  99. package/src/features/customStage/v.ts +17 -0
  100. package/src/features/customStage/versusScreen.ts +29 -0
  101. package/src/features/customTrapdoor/blackSprite.ts +6 -1
  102. package/src/features/customTrapdoor/customTrapdoorConstants.ts +4 -0
  103. package/src/features/customTrapdoor/exports.ts +8 -6
  104. package/src/features/customTrapdoor/init.ts +55 -23
  105. package/src/features/customTrapdoor/touched.ts +4 -1
  106. package/src/features/customTrapdoor/v.ts +2 -5
  107. package/src/features/extraConsoleCommands/commandsSubroutines.ts +4 -1
  108. package/src/features/playerInventory.ts +7 -0
  109. package/src/features/saveDataManager/exports.ts +3 -0
  110. package/src/functions/collectibleSet.ts +1 -1
  111. package/src/functions/doors.ts +10 -0
  112. package/src/functions/levelGrid.ts +1 -1
  113. package/src/functions/log.ts +1 -279
  114. package/src/functions/logEntities.ts +276 -0
  115. package/src/functions/rockAlt.ts +147 -19
  116. package/src/functions/roomData.ts +1 -1
  117. package/src/functions/roomTransition.ts +78 -0
  118. package/src/functions/rooms.ts +104 -107
  119. package/src/index.ts +1 -0
  120. package/src/interfaces/private/CustomTrapdoorDescription.ts +2 -2
  121. package/src/objects/backdropTypeToRockAltType.ts +3 -3
  122. package/src/types/TrapdoorDestination.ts +5 -0
@@ -1,6 +1,7 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local Map = ____lualib.Map
3
3
  local ____exports = {}
4
+ local setStageRoomsData
4
5
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
5
6
  local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
6
7
  local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
@@ -13,101 +14,114 @@ local reorderedCallbacksSetStage = ____reorderedCallbacks.reorderedCallbacksSetS
13
14
  local ____entities = require("functions.entities")
14
15
  local getEntityIDFromConstituents = ____entities.getEntityIDFromConstituents
15
16
  local ____log = require("functions.log")
16
- local log = ____log.log
17
17
  local logError = ____log.logError
18
18
  local ____rng = require("functions.rng")
19
19
  local newRNG = ____rng.newRNG
20
20
  local ____rooms = require("functions.rooms")
21
21
  local getRoomDataForTypeVariant = ____rooms.getRoomDataForTypeVariant
22
- local getRooms = ____rooms.getRooms
22
+ local getRoomsInGrid = ____rooms.getRoomsInGrid
23
23
  local ____stage = require("functions.stage")
24
24
  local setStage = ____stage.setStage
25
25
  local ____customStageUtils = require("features.customStage.customStageUtils")
26
26
  local getRandomCustomStageRoom = ____customStageUtils.getRandomCustomStageRoom
27
- local ____streakText = require("features.customStage.streakText")
28
- local topStreakTextStart = ____streakText.topStreakTextStart
29
27
  local ____v = require("features.customStage.v")
30
28
  local v = ____v.default
31
29
  local customBossPNGPaths = ____v.customBossPNGPaths
32
30
  local customStageCachedRoomData = ____v.customStageCachedRoomData
33
31
  local customStagesMap = ____v.customStagesMap
34
- local DEFAULT_BASE_STAGE = LevelStage.BASEMENT_2
35
- local DEFAULT_BASE_STAGE_TYPE = StageType.ORIGINAL
36
- --- Helper function to warp to a custom stage/level.
37
- --
38
- -- Custom stages/levels must first be defined in the "tsconfig.json" file. See the documentation for
39
- -- more details: https://isaacscript.github.io/main/custom-stages/
40
- function ____exports.setCustomStage(self, name, verbose)
41
- if verbose == nil then
42
- verbose = false
43
- end
44
- local customStage = customStagesMap:get(name)
45
- if customStage == nil then
46
- error(("Failed to set the custom stage of \"" .. name) .. "\" because it was not found in the custom stages map. (Try restarting IsaacScript / recompiling the mod, and try again. If that does not work, you probably forgot to define it in your \"tsconfig.json\" file.) See the website for more details on how to set up custom stages.")
47
- end
32
+ function setStageRoomsData(self, customStage, rng, verbose)
48
33
  local level = game:GetLevel()
49
34
  local startingRoomGridIndex = level:GetStartingRoomIndex()
50
- local seeds = game:GetSeeds()
51
- local startSeed = seeds:GetStartSeed()
52
- local rng = newRNG(nil, startSeed)
53
- v.run.currentCustomStage = customStage
54
- local baseStage = customStage.baseStage == nil and DEFAULT_BASE_STAGE or customStage.baseStage
55
- local baseStageType = customStage.baseStageType == nil and DEFAULT_BASE_STAGE_TYPE or customStage.baseStageType
56
- setStage(nil, baseStage, baseStageType)
57
- for ____, room in ipairs(getRooms(nil)) do
35
+ for ____, room in ipairs(getRoomsInGrid(nil)) do
58
36
  do
59
37
  if room.SafeGridIndex == startingRoomGridIndex then
60
- goto __continue4
38
+ goto __continue7
61
39
  end
62
40
  if room.Data == nil then
63
- goto __continue4
41
+ goto __continue7
64
42
  end
65
43
  local roomType = room.Data.Type
66
44
  local roomShapeMap = customStage.roomTypeMap:get(roomType)
67
45
  if roomShapeMap == nil then
68
46
  if roomType == RoomType.DEFAULT then
69
- logError((((("Failed to find any custom rooms for RoomType." .. tostring(RoomType[roomType])) .. " (") .. tostring(roomType)) .. ") for custom stage: ") .. name)
47
+ logError((((("Failed to find any custom rooms for RoomType." .. tostring(RoomType[roomType])) .. " (") .. tostring(roomType)) .. ") for custom stage: ") .. customStage.name)
70
48
  end
71
- goto __continue4
49
+ goto __continue7
72
50
  end
73
51
  local roomShape = room.Data.Shape
74
52
  local roomDoorSlotFlagMap = roomShapeMap:get(roomShape)
75
53
  if roomDoorSlotFlagMap == nil then
76
- logError((((((((("Failed to find any custom rooms for RoomType." .. tostring(RoomType[roomType])) .. " (") .. tostring(roomType)) .. ") + RoomShape.") .. tostring(RoomShape[roomShape])) .. " (") .. tostring(roomShape)) .. ") for custom stage: ") .. name)
77
- goto __continue4
54
+ logError((((((((("Failed to find any custom rooms for RoomType." .. tostring(RoomType[roomType])) .. " (") .. tostring(roomType)) .. ") + RoomShape.") .. tostring(RoomShape[roomShape])) .. " (") .. tostring(roomShape)) .. ") for custom stage: ") .. customStage.name)
55
+ goto __continue7
78
56
  end
79
57
  local doorSlotFlags = room.Data.Doors
80
58
  local roomsMetadata = roomDoorSlotFlagMap:get(doorSlotFlags)
81
59
  if roomsMetadata == nil then
82
- logError((((((((((("Failed to find any custom rooms for RoomType." .. tostring(RoomType[roomType])) .. " (") .. tostring(roomType)) .. ") + RoomShape.") .. tostring(RoomShape[roomShape])) .. " (") .. tostring(roomShape)) .. ") + DoorSlotFlags ") .. tostring(doorSlotFlags)) .. " for custom stage: ") .. name)
83
- goto __continue4
60
+ logError((((((((((("Failed to find any custom rooms for RoomType." .. tostring(RoomType[roomType])) .. " (") .. tostring(roomType)) .. ") + RoomShape.") .. tostring(RoomShape[roomShape])) .. " (") .. tostring(roomShape)) .. ") + DoorSlotFlags ") .. tostring(doorSlotFlags)) .. " for custom stage: ") .. customStage.name)
61
+ goto __continue7
84
62
  end
85
63
  local randomRoom = getRandomCustomStageRoom(nil, roomsMetadata, rng, verbose)
86
64
  local newRoomData = customStageCachedRoomData:get(randomRoom.variant)
87
65
  if newRoomData == nil then
88
66
  newRoomData = getRoomDataForTypeVariant(nil, roomType, randomRoom.variant, false)
89
67
  if newRoomData == nil then
90
- logError((("Failed to get the room data for room variant " .. tostring(randomRoom.variant)) .. " for custom stage: ") .. name)
91
- goto __continue4
68
+ logError((("Failed to get the room data for room variant " .. tostring(randomRoom.variant)) .. " for custom stage: ") .. customStage.name)
69
+ goto __continue7
92
70
  end
93
71
  customStageCachedRoomData:set(randomRoom.variant, newRoomData)
94
72
  end
95
73
  room.Data = newRoomData
96
74
  end
97
- ::__continue4::
75
+ ::__continue7::
98
76
  end
99
- local stage = -1
100
- local stageType = StageType.WRATH_OF_THE_LAMB
101
- level:SetStage(stage, stageType)
102
- reorderedCallbacksSetStage(nil, stage, stageType)
103
77
  end
104
- function ____exports.setCustomStageDebug(self)
105
- local customStage = v.run.currentCustomStage
78
+ ____exports.DEFAULT_BASE_STAGE = LevelStage.BASEMENT_2
79
+ ____exports.DEFAULT_BASE_STAGE_TYPE = StageType.ORIGINAL
80
+ ____exports.INVALID_STAGE_VALUE = -1
81
+ --- Helper function to warp to a custom stage/level.
82
+ --
83
+ -- Custom stages/levels must first be defined in the "tsconfig.json" file. See the documentation for
84
+ -- more details: https://isaacscript.github.io/main/custom-stages/
85
+ --
86
+ -- @param name The name of the custom stage, corresponding to what is in the "tsconfig.json" file.
87
+ -- @param firstFloor Optional. Whether to go to the first floor or the second floor. For example, if
88
+ -- you have a custom stage emulating Caves, then the first floor would be Caves 1,
89
+ -- and the second floor would be Caves 2. Default is true.
90
+ -- @param verbose Optional. Whether to log additional information about the rooms that are chosen.
91
+ -- Default is false.
92
+ function ____exports.setCustomStage(self, name, firstFloor, verbose)
93
+ if firstFloor == nil then
94
+ firstFloor = true
95
+ end
96
+ if verbose == nil then
97
+ verbose = false
98
+ end
99
+ local customStage = customStagesMap:get(name)
106
100
  if customStage == nil then
107
- log("No custom stage is currently loaded.")
108
- return
101
+ error(("Failed to set the custom stage of \"" .. name) .. "\" because it was not found in the custom stages map. (Try restarting IsaacScript / recompiling the mod / restarting the game, and try again. If that does not work, you probably forgot to define it in your \"tsconfig.json\" file.) See the website for more details on how to set up custom stages.")
109
102
  end
110
- topStreakTextStart(nil)
103
+ local level = game:GetLevel()
104
+ local stage = level:GetStage()
105
+ local seeds = game:GetSeeds()
106
+ local startSeed = seeds:GetStartSeed()
107
+ local rng = newRNG(nil, startSeed)
108
+ v.run.currentCustomStage = customStage
109
+ v.run.firstFloor = firstFloor
110
+ if stage == ____exports.INVALID_STAGE_VALUE then
111
+ level:SetStage(LevelStage.BASEMENT_1, StageType.ORIGINAL)
112
+ end
113
+ local baseStage = customStage.baseStage == nil and ____exports.DEFAULT_BASE_STAGE or customStage.baseStage
114
+ if not firstFloor then
115
+ baseStage = baseStage + 1
116
+ end
117
+ local baseStageType = customStage.baseStageType == nil and ____exports.DEFAULT_BASE_STAGE_TYPE or customStage.baseStageType
118
+ local reseed = stage >= baseStage
119
+ setStage(nil, baseStage, baseStageType, reseed)
120
+ setStageRoomsData(nil, customStage, rng, verbose)
121
+ local targetStage = ____exports.INVALID_STAGE_VALUE
122
+ local targetStageType = StageType.WRATH_OF_THE_LAMB
123
+ level:SetStage(targetStage, targetStageType)
124
+ reorderedCallbacksSetStage(nil, targetStage, targetStageType)
111
125
  end
112
126
  --- By default, unknown bosses will be drawn on the boss "versus" screen as "???". If your custom
113
127
  -- stage has custom bosses, you can use this function to register the corresponding graphic file
@@ -136,4 +150,9 @@ function ____exports.registerCustomBoss(self, entityType, variant, subType, name
136
150
  local entityID = getEntityIDFromConstituents(nil, entityType, variant, subType)
137
151
  customBossPNGPaths:set(entityID, {namePNGPath, portraitPNGPath})
138
152
  end
153
+ --- Helper function to disable the custom stage. This is typically called before taking the player to
154
+ -- a vanilla floor.
155
+ function ____exports.disableCustomStage(self)
156
+ v.run.currentCustomStage = nil
157
+ end
139
158
  return ____exports
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/init.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAiCxD,wBAAgB,eAAe,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CA4BtD"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/init.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AA6BxD,wBAAgB,eAAe,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CA0BtD"}
@@ -3,7 +3,7 @@ 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, postCurseEval, postGameStarted, getShaderParams, postGridEntityBrokenRockAlt, postGridEntityBrokenInit, postNewRoomReordered
6
+ local initRoomTypeMaps, getRoomTypeMap, postRender, postCurseEval, getShaderParams, postGridEntityBrokenRockAlt, postGridEntityInit, postNewRoomReordered
7
7
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
8
8
  local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
9
9
  local LevelCurse = ____isaac_2Dtypescript_2Ddefinitions.LevelCurse
@@ -20,6 +20,7 @@ local saveDataManager = ____exports.saveDataManager
20
20
  local ____backdrop = require("features.customStage.backdrop")
21
21
  local setBackdrop = ____backdrop.setBackdrop
22
22
  local ____customStageGridEntities = require("features.customStage.customStageGridEntities")
23
+ local convertVanillaTrapdoors = ____customStageGridEntities.convertVanillaTrapdoors
23
24
  local removeUrnRewards = ____customStageGridEntities.removeUrnRewards
24
25
  local setCustomDecorationGraphics = ____customStageGridEntities.setCustomDecorationGraphics
25
26
  local setCustomDoorGraphics = ____customStageGridEntities.setCustomDoorGraphics
@@ -30,8 +31,6 @@ local ____shadows = require("features.customStage.shadows")
30
31
  local setShadows = ____shadows.setShadows
31
32
  local ____streakText = require("features.customStage.streakText")
32
33
  local streakTextGetShaderParams = ____streakText.streakTextGetShaderParams
33
- local streakTextInit = ____streakText.streakTextInit
34
- local streakTextPostGameStarted = ____streakText.streakTextPostGameStarted
35
34
  local streakTextPostRender = ____streakText.streakTextPostRender
36
35
  local ____v = require("features.customStage.v")
37
36
  local v = ____v.default
@@ -89,14 +88,11 @@ function postCurseEval(self, curses)
89
88
  if customStage == nil then
90
89
  return nil
91
90
  end
92
- if hasFlag(nil, curses, LevelCurse.MAZE) then
93
- return removeFlag(nil, curses, LevelCurse.MAZE)
91
+ if hasFlag(nil, curses, LevelCurse.LABYRINTH) then
92
+ return removeFlag(nil, curses, LevelCurse.LABYRINTH)
94
93
  end
95
94
  return nil
96
95
  end
97
- function postGameStarted(self)
98
- streakTextPostGameStarted(nil)
99
- end
100
96
  function getShaderParams(self, shaderName)
101
97
  local customStage = v.run.currentCustomStage
102
98
  if customStage == nil then
@@ -112,7 +108,7 @@ function postGridEntityBrokenRockAlt(self, gridEntity)
112
108
  end
113
109
  removeUrnRewards(nil, customStage, gridEntity)
114
110
  end
115
- function postGridEntityBrokenInit(self, gridEntity)
111
+ function postGridEntityInit(self, gridEntity)
116
112
  local customStage = v.run.currentCustomStage
117
113
  if customStage == nil then
118
114
  return
@@ -121,6 +117,7 @@ function postGridEntityBrokenInit(self, gridEntity)
121
117
  setCustomRockGraphics(nil, customStage, gridEntity)
122
118
  setCustomPitGraphics(nil, customStage, gridEntity)
123
119
  setCustomDoorGraphics(nil, customStage, gridEntity)
120
+ convertVanillaTrapdoors(nil, customStage, gridEntity)
124
121
  end
125
122
  function postNewRoomReordered(self)
126
123
  local customStage = v.run.currentCustomStage
@@ -137,14 +134,12 @@ function ____exports.customStageInit(self, mod)
137
134
  return
138
135
  end
139
136
  saveDataManager(nil, "customStage", v)
140
- streakTextInit(nil)
141
137
  versusScreenInit(nil)
142
138
  mod:AddCallback(ModCallback.POST_RENDER, postRender)
143
139
  mod:AddCallback(ModCallback.POST_CURSE_EVAL, postCurseEval)
144
- mod:AddCallback(ModCallback.POST_GAME_STARTED, postGameStarted)
145
140
  mod:AddCallback(ModCallback.GET_SHADER_PARAMS, getShaderParams)
146
141
  mod:AddCallbackCustom(ModCallbackCustom.POST_GRID_ENTITY_BROKEN, postGridEntityBrokenRockAlt, GridEntityType.ROCK_ALT)
147
- mod:AddCallbackCustom(ModCallbackCustom.POST_GRID_ENTITY_INIT, postGridEntityBrokenInit)
142
+ mod:AddCallbackCustom(ModCallbackCustom.POST_GRID_ENTITY_INIT, postGridEntityInit)
148
143
  mod:AddCallbackCustom(ModCallbackCustom.POST_NEW_ROOM_REORDERED, postNewRoomReordered)
149
144
  end
150
145
  return ____exports
@@ -1 +1 @@
1
- {"version":3,"file":"shadows.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/shadows.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAoC3D,wBAAgB,UAAU,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAqCzD"}
1
+ {"version":3,"file":"shadows.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/shadows.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAqC3D,wBAAgB,UAAU,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAqCzD"}
@@ -19,6 +19,7 @@ local v = ____v.default
19
19
  -- We arbitrarily choose a ladder for this purpose because it will not automatically despawn after
20
20
  -- time passes, like most other effects.
21
21
  local SHADOW_EFFECT_VARIANT = EffectVariant.LADDER
22
+ local SHADOW_EFFECT_SUBTYPE = 102
22
23
  --- The animation comes from StageAPI.
23
24
  local ROOM_SHAPE_TO_SHADOW_ANIMATION = {
24
25
  [RoomShape.SHAPE_1x1] = "1x1",
@@ -50,7 +51,7 @@ function ____exports.setShadows(self, customStage)
50
51
  local shadowEffect = spawnEffectWithSeed(
51
52
  nil,
52
53
  SHADOW_EFFECT_VARIANT,
53
- 0,
54
+ SHADOW_EFFECT_SUBTYPE,
54
55
  centerPos,
55
56
  1
56
57
  )
@@ -1,12 +1,5 @@
1
1
  import { CustomStage } from "../../interfaces/CustomStage";
2
- /**
3
- * We must load the sprites in an init function to prevent issues with mods that replace the vanilla
4
- * files. (For some reason, loading the sprites will cause the overwrite to no longer apply on the
5
- * second and subsequent runs.)
6
- */
7
- export declare function streakTextInit(): void;
8
2
  export declare function streakTextPostRender(): void;
9
- export declare function streakTextPostGameStarted(): void;
10
3
  export declare function streakTextGetShaderParams(customStage: CustomStage, shaderName: string): void;
11
4
  export declare function topStreakTextStart(): void;
12
5
  //# sourceMappingURL=streakText.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"streakText.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/streakText.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AA0F3D;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAMrC;AAGD,wBAAgB,oBAAoB,IAAI,IAAI,CAS3C;AAmFD,wBAAgB,yBAAyB,IAAI,IAAI,CAGhD;AAGD,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,MAAM,GACjB,IAAI,CAYN;AAgFD,wBAAgB,kBAAkB,IAAI,IAAI,CAUzC"}
1
+ {"version":3,"file":"streakText.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/streakText.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAuE3D,wBAAgB,oBAAoB,IAAI,IAAI,CAS3C;AA0FD,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,MAAM,GACjB,IAAI,CAYN;AA0ED,wBAAgB,kBAAkB,IAAI,IAAI,CAWzC"}
@@ -1,7 +1,7 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local __TS__Spread = ____lualib.__TS__Spread
3
3
  local ____exports = {}
4
- local checkEndTopStreakText, trackMapInputPressed, checkStartBottomStreakText, checkEndBottomStreakText, renderSprite, playTextOut, UIStreakAnimation, TEXT_STAY_FRAME, TEXT_OUT_FRAME, STREAK_TEXT_BOTTOM_Y_OFFSET, NUM_RENDER_FRAMES_MAP_HELD_BEFORE_STREAK_TEXT, TEXT_IN_ADJUSTMENTS, TEXT_OUT_ADJUSTMENTS, TEXT_IN_SCALES, TEXT_OUT_SCALES, topStreakSprite, bottomStreakSprite
4
+ local checkEndTopStreakText, trackMapInputPressed, checkStartBottomStreakText, checkEndBottomStreakText, renderStreakText, TEXT_STAY_FRAME, TEXT_OUT_FRAME, STREAK_TEXT_BOTTOM_Y_OFFSET, NUM_RENDER_FRAMES_MAP_HELD_BEFORE_STREAK_TEXT, TEXT_IN_ADJUSTMENTS, TEXT_OUT_ADJUSTMENTS, TEXT_IN_SCALES, TEXT_OUT_SCALES
5
5
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
6
6
  local ButtonAction = ____isaac_2Dtypescript_2Ddefinitions.ButtonAction
7
7
  local ControllerIndex = ____isaac_2Dtypescript_2Ddefinitions.ControllerIndex
@@ -16,16 +16,20 @@ local getEnumValues = ____enums.getEnumValues
16
16
  local ____ui = require("functions.ui")
17
17
  local getScreenBottomCenterPos = ____ui.getScreenBottomCenterPos
18
18
  local getScreenTopCenterPos = ____ui.getScreenTopCenterPos
19
+ local ____customStageConstants = require("features.customStage.customStageConstants")
20
+ local UIStreakAnimation = ____customStageConstants.UIStreakAnimation
21
+ local UI_STREAK_ANIMATION_END_FRAMES = ____customStageConstants.UI_STREAK_ANIMATION_END_FRAMES
19
22
  local ____v = require("features.customStage.v")
20
23
  local v = ____v.default
21
24
  function checkEndTopStreakText(self)
22
- if v.run.topStreakTextStartedRenderFrame == nil or not topStreakSprite:IsPlaying(UIStreakAnimation.TEXT_STAY) then
25
+ if v.run.topStreakTextStartedRenderFrame == nil or v.run.topStreakText.animation ~= UIStreakAnimation.TEXT_STAY then
23
26
  return
24
27
  end
25
28
  local renderFrameCount = Isaac.GetFrameCount()
26
29
  local elapsedFrames = renderFrameCount - v.run.topStreakTextStartedRenderFrame
27
30
  if elapsedFrames >= 115 then
28
- playTextOut(nil, topStreakSprite)
31
+ v.run.topStreakText.animation = UIStreakAnimation.TEXT
32
+ v.run.topStreakText.frame = TEXT_OUT_FRAME - 2
29
33
  end
30
34
  end
31
35
  function trackMapInputPressed(self)
@@ -43,7 +47,7 @@ function trackMapInputPressed(self)
43
47
  end
44
48
  end
45
49
  function checkStartBottomStreakText(self)
46
- if bottomStreakSprite:IsPlaying() then
50
+ if v.run.bottomStreakText.animation ~= UIStreakAnimation.NONE then
47
51
  return
48
52
  end
49
53
  local pushedMapFrames = {__TS__Spread(v.run.controllerIndexPushingMapRenderFrame:values())}
@@ -54,81 +58,69 @@ function checkStartBottomStreakText(self)
54
58
  local gameFrameCount = game:GetFrameCount()
55
59
  local elapsedFrames = gameFrameCount - earliestFrame
56
60
  if elapsedFrames >= NUM_RENDER_FRAMES_MAP_HELD_BEFORE_STREAK_TEXT then
57
- bottomStreakSprite:Play(UIStreakAnimation.TEXT, true)
61
+ v.run.bottomStreakText.animation = UIStreakAnimation.TEXT
62
+ v.run.bottomStreakText.frame = 0
58
63
  end
59
64
  end
60
65
  function checkEndBottomStreakText(self)
61
- if not bottomStreakSprite:IsPlaying(UIStreakAnimation.TEXT_STAY) then
66
+ if v.run.bottomStreakText.animation ~= UIStreakAnimation.TEXT_STAY then
62
67
  return
63
68
  end
64
69
  local pushedMapFrames = {__TS__Spread(v.run.controllerIndexPushingMapRenderFrame:values())}
65
70
  if #pushedMapFrames == 0 then
66
- playTextOut(nil, bottomStreakSprite)
71
+ v.run.bottomStreakText.animation = UIStreakAnimation.TEXT
72
+ v.run.bottomStreakText.frame = TEXT_OUT_FRAME - 2
67
73
  end
68
74
  end
69
- function renderSprite(self, customStage, sprite, position)
70
- sprite:Update()
71
- if not sprite:IsPlaying() then
75
+ function renderStreakText(self, customStage, streakText, position)
76
+ if streakText.animation == UIStreakAnimation.NONE then
72
77
  return
73
78
  end
74
- local animation = sprite:GetAnimation()
75
- local frame = sprite:GetFrame()
76
- if animation == UIStreakAnimation.TEXT and frame == TEXT_STAY_FRAME then
77
- sprite:Play(UIStreakAnimation.TEXT_STAY, true)
79
+ if streakText.animation ~= UIStreakAnimation.TEXT_STAY then
80
+ local ____streakText_0 = streakText
81
+ local pauseFrame = ____streakText_0.pauseFrame
82
+ streakText.pauseFrame = not streakText.pauseFrame
83
+ if not pauseFrame then
84
+ streakText.frame = streakText.frame + 1
85
+ end
86
+ end
87
+ local endFrame = UI_STREAK_ANIMATION_END_FRAMES[streakText.animation]
88
+ if streakText.frame > endFrame then
89
+ streakText.animation = UIStreakAnimation.NONE
90
+ streakText.frame = 0
91
+ return
92
+ end
93
+ if streakText.animation == UIStreakAnimation.TEXT and streakText.frame == TEXT_STAY_FRAME then
94
+ streakText.animation = UIStreakAnimation.TEXT_STAY
95
+ streakText.frame = 0
78
96
  end
79
97
  local isPaused = game:IsPaused()
80
98
  if isPaused then
81
99
  return
82
100
  end
83
101
  local font = fonts.upheaval
84
- local ____customStage_0 = customStage
85
- local name = ____customStage_0.name
86
- local length = font:GetStringWidthUTF8(name)
102
+ local ____customStage_1 = customStage
103
+ local name = ____customStage_1.name
104
+ local numberSuffix = v.run.firstFloor and "I" or "II"
105
+ local nameWithNumberSuffix = (name .. " ") .. numberSuffix
106
+ local length = font:GetStringWidthUTF8(nameWithNumberSuffix)
87
107
  local centeredX = position.X - length / 2
88
108
  local adjustment = 0
89
109
  local scale = VectorOne
90
- repeat
91
- local ____switch27 = animation
92
- local ____cond27 = ____switch27 == UIStreakAnimation.TEXT
93
- if ____cond27 then
94
- do
95
- if frame < TEXT_STAY_FRAME then
96
- adjustment = TEXT_IN_ADJUSTMENTS[frame + 1] or 0
97
- scale = TEXT_IN_SCALES[frame + 1] or VectorOne
98
- else
99
- local adjustedFrame = frame - TEXT_OUT_FRAME
100
- adjustment = TEXT_OUT_ADJUSTMENTS[adjustedFrame + 1] or 0
101
- scale = TEXT_OUT_SCALES[adjustedFrame + 1] or VectorOne
102
- end
103
- break
104
- end
105
- end
106
- ____cond27 = ____cond27 or ____switch27 == UIStreakAnimation.TEXT_IN
107
- if ____cond27 then
108
- do
109
- adjustment = TEXT_IN_ADJUSTMENTS[frame + 1] or 0
110
- scale = TEXT_IN_SCALES[frame + 1] or VectorOne
111
- break
112
- end
113
- end
114
- ____cond27 = ____cond27 or ____switch27 == UIStreakAnimation.TEXT_OUT
115
- if ____cond27 then
116
- do
117
- adjustment = TEXT_OUT_ADJUSTMENTS[frame + 1] or 0
118
- scale = TEXT_OUT_SCALES[frame + 1] or VectorOne
119
- break
120
- end
121
- end
122
- do
123
- do
124
- break
125
- end
110
+ if streakText.animation == UIStreakAnimation.TEXT then
111
+ if streakText.frame < TEXT_STAY_FRAME then
112
+ adjustment = TEXT_IN_ADJUSTMENTS[streakText.frame + 1] or 0
113
+ scale = TEXT_IN_SCALES[streakText.frame + 1] or VectorOne
114
+ else
115
+ local adjustedFrame = streakText.frame - TEXT_OUT_FRAME
116
+ adjustment = TEXT_OUT_ADJUSTMENTS[adjustedFrame + 1] or 0
117
+ scale = TEXT_OUT_SCALES[adjustedFrame + 1] or VectorOne
126
118
  end
127
- until true
119
+ end
128
120
  local adjustedX = centeredX + adjustment
129
121
  local adjustedY = position.Y + STREAK_TEXT_BOTTOM_Y_OFFSET
130
122
  font:DrawStringScaled(
131
- name,
123
+ nameWithNumberSuffix,
132
124
  adjustedX,
133
125
  adjustedY,
134
126
  scale.X,
@@ -136,27 +128,16 @@ function renderSprite(self, customStage, sprite, position)
136
128
  KColorDefault
137
129
  )
138
130
  end
139
- function playTextOut(self, sprite)
140
- sprite:Play(UIStreakAnimation.TEXT, true)
141
- sprite:SetFrame(TEXT_OUT_FRAME - 2)
142
- end
143
- UIStreakAnimation = UIStreakAnimation or ({})
144
- UIStreakAnimation.TEXT = "Text"
145
- UIStreakAnimation.TEXT_IN = "TextIn"
146
- UIStreakAnimation.TEXT_OUT = "TextOut"
147
- UIStreakAnimation.TEXT_STAY = "TextStay"
148
131
  --- This must match the name of the shader in "shaders.xml".
149
132
  local EMPTY_SHADER_NAME = "IsaacScript-RenderAboveHUD"
150
133
  TEXT_STAY_FRAME = 8
151
134
  TEXT_OUT_FRAME = 60
152
135
  --- This matches the offset that the vanilla game uses; determined via trial and error.
153
- local STREAK_SPRITE_TOP_OFFSET = Vector(0, 48.25)
136
+ local STREAK_SPRITE_TOP_OFFSET = Vector(0, 47)
154
137
  --- This matches the offset that the vanilla game uses; determined via trial and error.
155
138
  local STREAK_SPRITE_BOTTOM_OFFSET = Vector(0, -48.25)
156
139
  STREAK_TEXT_BOTTOM_Y_OFFSET = -9
157
140
  NUM_RENDER_FRAMES_MAP_HELD_BEFORE_STREAK_TEXT = 11
158
- --- Corresponds to the vanilla value; determined through trial and error.
159
- local TEXT_PLAYBACK_SPEED = 0.5
160
141
  TEXT_IN_ADJUSTMENTS = {
161
142
  -800,
162
143
  -639,
@@ -201,43 +182,29 @@ TEXT_OUT_SCALES = {
201
182
  Vector(2.59, 0.38),
202
183
  Vector(3, 0.2)
203
184
  }
204
- topStreakSprite = Sprite()
205
- bottomStreakSprite = Sprite()
206
- --- We must load the sprites in an init function to prevent issues with mods that replace the vanilla
207
- -- files. (For some reason, loading the sprites will cause the overwrite to no longer apply on the
208
- -- second and subsequent runs.)
209
- function ____exports.streakTextInit(self)
210
- topStreakSprite:Load("resources/gfx/ui/ui_streak.anm2", false)
211
- topStreakSprite.PlaybackSpeed = TEXT_PLAYBACK_SPEED
212
- bottomStreakSprite:Load("resources/gfx/ui/ui_streak.anm2", false)
213
- bottomStreakSprite.PlaybackSpeed = TEXT_PLAYBACK_SPEED
214
- end
215
185
  function ____exports.streakTextPostRender(self)
216
186
  checkEndTopStreakText(nil)
217
187
  trackMapInputPressed(nil)
218
188
  checkStartBottomStreakText(nil)
219
189
  checkEndBottomStreakText(nil)
220
190
  end
221
- function ____exports.streakTextPostGameStarted(self)
222
- topStreakSprite:Stop()
223
- bottomStreakSprite:Stop()
224
- end
225
191
  function ____exports.streakTextGetShaderParams(self, customStage, shaderName)
226
192
  if shaderName ~= EMPTY_SHADER_NAME then
227
193
  return
228
194
  end
229
195
  local topCenterPos = getScreenTopCenterPos(nil)
230
196
  local topStreakPosition = topCenterPos + STREAK_SPRITE_TOP_OFFSET
231
- renderSprite(nil, customStage, topStreakSprite, topStreakPosition)
197
+ renderStreakText(nil, customStage, v.run.topStreakText, topStreakPosition)
232
198
  local bottomCenterPos = getScreenBottomCenterPos(nil)
233
199
  local bottomStreakPosition = bottomCenterPos + STREAK_SPRITE_BOTTOM_OFFSET
234
- renderSprite(nil, customStage, bottomStreakSprite, bottomStreakPosition)
200
+ renderStreakText(nil, customStage, v.run.bottomStreakText, bottomStreakPosition)
235
201
  end
236
202
  function ____exports.topStreakTextStart(self)
237
203
  local level = game:GetLevel()
238
204
  local renderFrameCount = Isaac.GetFrameCount()
239
205
  level:ShowName(false)
206
+ v.run.topStreakText.animation = UIStreakAnimation.TEXT
207
+ v.run.topStreakText.frame = 0
240
208
  v.run.topStreakTextStartedRenderFrame = renderFrameCount
241
- topStreakSprite:Play(UIStreakAnimation.TEXT, true)
242
209
  end
243
210
  return ____exports
@@ -1,12 +1,25 @@
1
1
  import { ControllerIndex } from "isaac-typescript-definitions";
2
2
  import { CustomStage } from "../../interfaces/CustomStage";
3
+ import { UIStreakAnimation } from "./customStageConstants";
3
4
  declare const v: {
4
5
  run: {
5
6
  currentCustomStage: CustomStage | null;
7
+ /** Whether we are on e.g. Caves 1 or Caves 2. */
8
+ firstFloor: boolean;
6
9
  showingBossVersusScreen: boolean;
7
10
  /** Values are the render frame that the controller first pressed the map button. */
8
11
  controllerIndexPushingMapRenderFrame: Map<ControllerIndex, number>;
9
12
  topStreakTextStartedRenderFrame: number | null;
13
+ topStreakText: {
14
+ animation: UIStreakAnimation;
15
+ frame: number;
16
+ pauseFrame: boolean;
17
+ };
18
+ bottomStreakText: {
19
+ animation: UIStreakAnimation;
20
+ frame: number;
21
+ pauseFrame: boolean;
22
+ };
10
23
  };
11
24
  room: {
12
25
  showingShadows: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"v.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/v.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,QAAA,MAAM,CAAC;;;;QAKH,oFAAoF;;;;;;;CASvF,CAAC;AACF,eAAe,CAAC,CAAC;AAEjB,oCAAoC;AACpC,eAAO,MAAM,eAAe,0BAAiC,CAAC;AAE9D,+BAA+B;AAC/B,eAAO,MAAM,yBAAyB,mCAAuC,CAAC;AAE9E,4BAA4B;AAC5B,eAAO,MAAM,kBAAkB,6DAG5B,CAAC"}
1
+ {"version":3,"file":"v.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/v.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,QAAA,MAAM,CAAC;;;QAIH,iDAAiD;;;QAKjD,oFAAoF;;;;;;;;;;;;;;;;;CAqBvF,CAAC;AACF,eAAe,CAAC,CAAC;AAEjB,oCAAoC;AACpC,eAAO,MAAM,eAAe,0BAAiC,CAAC;AAE9D,+BAA+B;AAC/B,eAAO,MAAM,yBAAyB,mCAAuC,CAAC;AAE9E,4BAA4B;AAC5B,eAAO,MAAM,kBAAkB,6DAG5B,CAAC"}
@@ -2,12 +2,17 @@ local ____lualib = require("lualib_bundle")
2
2
  local Map = ____lualib.Map
3
3
  local __TS__New = ____lualib.__TS__New
4
4
  local ____exports = {}
5
+ local ____customStageConstants = require("features.customStage.customStageConstants")
6
+ local UIStreakAnimation = ____customStageConstants.UIStreakAnimation
5
7
  local v = {
6
8
  run = {
7
9
  currentCustomStage = nil,
10
+ firstFloor = true,
8
11
  showingBossVersusScreen = false,
9
12
  controllerIndexPushingMapRenderFrame = __TS__New(Map),
10
- topStreakTextStartedRenderFrame = nil
13
+ topStreakTextStartedRenderFrame = nil,
14
+ topStreakText = {animation = UIStreakAnimation.NONE, frame = 0, pauseFrame = false},
15
+ bottomStreakText = {animation = UIStreakAnimation.NONE, frame = 0, pauseFrame = false}
11
16
  },
12
17
  room = {showingShadows = false}
13
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"versusScreen.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/versusScreen.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAqE3D;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAavC;AAED,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAuDxE;AA+ED,wBAAgB,sBAAsB,IAAI,IAAI,CAoC7C"}
1
+ {"version":3,"file":"versusScreen.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/versusScreen.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AA2E3D;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAavC;AAED,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAwExE;AAoFD,wBAAgB,sBAAsB,IAAI,IAAI,CAoC7C"}