isaacscript-common 6.2.1 → 6.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/cachedClasses.d.ts +15 -0
  2. package/cachedClasses.lua +20 -0
  3. package/callbacks/reorderedCallbacks.d.ts +9 -0
  4. package/callbacks/reorderedCallbacks.lua +9 -0
  5. package/constants.d.ts +26 -4
  6. package/constants.lua +20 -4
  7. package/enums/CornerType.d.ts +6 -0
  8. package/enums/CornerType.lua +11 -0
  9. package/enums/DecorationVariant.d.ts +9 -0
  10. package/enums/DecorationVariant.lua +7 -0
  11. package/enums/RockAltType.d.ts +7 -0
  12. package/enums/RockAltType.lua +13 -0
  13. package/features/customGridEntity.d.ts +2 -2
  14. package/features/customGridEntity.lua +7 -5
  15. package/features/customStage/backdrop.d.ts +2 -0
  16. package/features/customStage/backdrop.lua +211 -0
  17. package/features/customStage/customStageConstants.d.ts +1 -0
  18. package/features/customStage/customStageConstants.lua +3 -0
  19. package/features/customStage/exports.d.ts +28 -0
  20. package/features/customStage/exports.lua +58 -1
  21. package/features/customStage/gridEntities.d.ts +18 -0
  22. package/features/customStage/gridEntities.lua +215 -0
  23. package/features/customStage/init.d.ts +2 -1
  24. package/features/customStage/init.lua +71 -9
  25. package/features/customStage/streakText.d.ts +2 -0
  26. package/features/customStage/streakText.lua +22 -0
  27. package/features/customStage/v.d.ts +10 -0
  28. package/features/customStage/v.lua +4 -0
  29. package/features/customStage/versusScreen.d.ts +3 -0
  30. package/features/customStage/versusScreen.lua +201 -0
  31. package/features/debugDisplay/debugDisplay.lua +2 -0
  32. package/features/debugDisplay/exports.d.ts +108 -0
  33. package/features/debugDisplay/exports.lua +145 -0
  34. package/features/debugDisplay/v.d.ts +2 -0
  35. package/features/debugDisplay/v.lua +9 -0
  36. package/features/deployJSONRoom.lua +6 -2
  37. package/features/extraConsoleCommands/init.lua +10 -1
  38. package/features/extraConsoleCommands/listCommands.d.ts +21 -6
  39. package/features/extraConsoleCommands/listCommands.lua +50 -19
  40. package/features/extraConsoleCommands/v.d.ts +1 -0
  41. package/features/extraConsoleCommands/v.lua +2 -1
  42. package/features/pause.d.ts +11 -0
  43. package/features/pause.lua +71 -0
  44. package/features/runNextRoom.d.ts +8 -0
  45. package/features/runNextRoom.lua +40 -0
  46. package/features/saveDataManager/exports.lua +2 -2
  47. package/features/saveDataManager/load.lua +3 -3
  48. package/features/saveDataManager/main.lua +3 -3
  49. package/features/saveDataManager/merge.lua +2 -2
  50. package/features/saveDataManager/save.lua +3 -3
  51. package/features/saveDataManager/{constants.d.ts → saveDataManagerConstants.d.ts} +0 -0
  52. package/features/saveDataManager/{constants.lua → saveDataManagerConstants.lua} +0 -0
  53. package/functions/chargeBar.lua +4 -6
  54. package/functions/color.d.ts +0 -2
  55. package/functions/color.lua +0 -4
  56. package/functions/deepCopy.lua +2 -2
  57. package/functions/direction.d.ts +1 -1
  58. package/functions/doors.d.ts +12 -7
  59. package/functions/doors.lua +14 -11
  60. package/functions/entity.d.ts +5 -0
  61. package/functions/entity.lua +13 -0
  62. package/functions/gridEntity.d.ts +39 -0
  63. package/functions/gridEntity.lua +83 -2
  64. package/functions/kColor.d.ts +0 -2
  65. package/functions/kColor.lua +0 -4
  66. package/functions/log.lua +2 -1
  67. package/functions/pickups.d.ts +9 -9
  68. package/functions/playerCenter.lua +4 -5
  69. package/functions/playerIndex.d.ts +3 -0
  70. package/functions/playerIndex.lua +3 -0
  71. package/functions/roomShape.d.ts +10 -4
  72. package/functions/roomShape.lua +15 -2
  73. package/functions/run.d.ts +7 -0
  74. package/functions/run.lua +16 -4
  75. package/functions/sprite.d.ts +1 -1
  76. package/functions/sprite.lua +1 -1
  77. package/functions/ui.d.ts +2 -0
  78. package/functions/ui.lua +8 -0
  79. package/functions/utils.d.ts +6 -4
  80. package/functions/utils.lua +6 -4
  81. package/index.d.ts +1 -1
  82. package/index.lua +2 -0
  83. package/initFeatures.lua +7 -1
  84. package/interfaces/Corner.d.ts +6 -0
  85. package/interfaces/Corner.lua +2 -0
  86. package/interfaces/CustomStageLua.d.ts +236 -63
  87. package/objects/backdropTypeToRockAltType.d.ts +6 -0
  88. package/objects/backdropTypeToRockAltType.lua +69 -0
  89. package/objects/bossNamePNGFileNames.d.ts +5 -0
  90. package/objects/bossNamePNGFileNames.lua +108 -0
  91. package/objects/bossPortraitPNGFileNames.d.ts +5 -0
  92. package/objects/bossPortraitPNGFileNames.lua +108 -0
  93. package/objects/colors.d.ts +15 -8
  94. package/objects/colors.lua +9 -2
  95. package/objects/playerNamePNGFileNames.d.ts +5 -0
  96. package/objects/playerNamePNGFileNames.lua +49 -0
  97. package/objects/playerPortraitPNGFileNames.d.ts +5 -0
  98. package/objects/playerPortraitPNGFileNames.lua +49 -0
  99. package/objects/roomShapeCorners.d.ts +6 -0
  100. package/objects/roomShapeCorners.lua +259 -0
  101. package/objects/roomShapeToBottomRightPosition.d.ts +1 -1
  102. package/objects/roomShapeToTopLeftPosition.d.ts +1 -1
  103. package/objects/versusScreenBackgroundColors.d.ts +5 -0
  104. package/objects/versusScreenBackgroundColors.lua +38 -0
  105. package/objects/versusScreenDirtSpotColors.d.ts +5 -0
  106. package/objects/versusScreenDirtSpotColors.lua +38 -0
  107. package/package.json +2 -2
  108. package/sets/narrowRoomShapesSet.d.ts +2 -0
  109. package/sets/narrowRoomShapesSet.lua +8 -0
@@ -0,0 +1,215 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
3
+ local ____exports = {}
4
+ local getNewDoorPNGPath, removeEntitiesSpawnedFromGridEntity
5
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
6
+ local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
7
+ local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
8
+ local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
9
+ local ____DecorationVariant = require("enums.DecorationVariant")
10
+ local DecorationVariant = ____DecorationVariant.DecorationVariant
11
+ local ____entity = require("functions.entity")
12
+ local removeEntities = ____entity.removeEntities
13
+ local ____entitySpecific = require("functions.entitySpecific")
14
+ local getNPCs = ____entitySpecific.getNPCs
15
+ local ____pickups = require("functions.pickups")
16
+ local getCoins = ____pickups.getCoins
17
+ local getCollectibles = ____pickups.getCollectibles
18
+ local getTrinkets = ____pickups.getTrinkets
19
+ local ____vector = require("functions.vector")
20
+ local vectorEquals = ____vector.vectorEquals
21
+ function getNewDoorPNGPath(self, customStage, fileName)
22
+ repeat
23
+ local ____switch16 = fileName
24
+ local ____cond16 = ____switch16 == "gfx/grid/door_01_normaldoor.anm2"
25
+ if ____cond16 then
26
+ do
27
+ local ____customStage_doorPNGPaths_normal_0 = customStage.doorPNGPaths
28
+ if ____customStage_doorPNGPaths_normal_0 ~= nil then
29
+ ____customStage_doorPNGPaths_normal_0 = ____customStage_doorPNGPaths_normal_0.normal
30
+ end
31
+ return ____customStage_doorPNGPaths_normal_0
32
+ end
33
+ end
34
+ ____cond16 = ____cond16 or ____switch16 == "gfx/grid/door_02_treasureroomdoor.anm2"
35
+ if ____cond16 then
36
+ do
37
+ local ____customStage_doorPNGPaths_treasureRoom_2 = customStage.doorPNGPaths
38
+ if ____customStage_doorPNGPaths_treasureRoom_2 ~= nil then
39
+ ____customStage_doorPNGPaths_treasureRoom_2 = ____customStage_doorPNGPaths_treasureRoom_2.treasureRoom
40
+ end
41
+ return ____customStage_doorPNGPaths_treasureRoom_2
42
+ end
43
+ end
44
+ ____cond16 = ____cond16 or ____switch16 == "gfx/grid/door_03_ambushroomdoor.anm2"
45
+ if ____cond16 then
46
+ do
47
+ local ____customStage_doorPNGPaths_normalChallengeRoom_4 = customStage.doorPNGPaths
48
+ if ____customStage_doorPNGPaths_normalChallengeRoom_4 ~= nil then
49
+ ____customStage_doorPNGPaths_normalChallengeRoom_4 = ____customStage_doorPNGPaths_normalChallengeRoom_4.normalChallengeRoom
50
+ end
51
+ return ____customStage_doorPNGPaths_normalChallengeRoom_4
52
+ end
53
+ end
54
+ ____cond16 = ____cond16 or ____switch16 == "gfx/grid/door_04_selfsacrificeroomdoor.anm2"
55
+ if ____cond16 then
56
+ do
57
+ local ____customStage_doorPNGPaths_curseRoom_6 = customStage.doorPNGPaths
58
+ if ____customStage_doorPNGPaths_curseRoom_6 ~= nil then
59
+ ____customStage_doorPNGPaths_curseRoom_6 = ____customStage_doorPNGPaths_curseRoom_6.curseRoom
60
+ end
61
+ return ____customStage_doorPNGPaths_curseRoom_6
62
+ end
63
+ end
64
+ ____cond16 = ____cond16 or ____switch16 == "gfx/grid/door_05_arcaderoomdoor.anm2"
65
+ if ____cond16 then
66
+ do
67
+ local ____customStage_doorPNGPaths_arcade_8 = customStage.doorPNGPaths
68
+ if ____customStage_doorPNGPaths_arcade_8 ~= nil then
69
+ ____customStage_doorPNGPaths_arcade_8 = ____customStage_doorPNGPaths_arcade_8.arcade
70
+ end
71
+ return ____customStage_doorPNGPaths_arcade_8
72
+ end
73
+ end
74
+ ____cond16 = ____cond16 or ____switch16 == "gfx/grid/door_07_devilroomdoor.anm2"
75
+ if ____cond16 then
76
+ do
77
+ local ____customStage_doorPNGPaths_devilRoom_10 = customStage.doorPNGPaths
78
+ if ____customStage_doorPNGPaths_devilRoom_10 ~= nil then
79
+ ____customStage_doorPNGPaths_devilRoom_10 = ____customStage_doorPNGPaths_devilRoom_10.devilRoom
80
+ end
81
+ return ____customStage_doorPNGPaths_devilRoom_10
82
+ end
83
+ end
84
+ ____cond16 = ____cond16 or ____switch16 == "gfx/grid/door_07_holyroomdoor.anm2"
85
+ if ____cond16 then
86
+ do
87
+ local ____customStage_doorPNGPaths_angelRoom_12 = customStage.doorPNGPaths
88
+ if ____customStage_doorPNGPaths_angelRoom_12 ~= nil then
89
+ ____customStage_doorPNGPaths_angelRoom_12 = ____customStage_doorPNGPaths_angelRoom_12.angelRoom
90
+ end
91
+ return ____customStage_doorPNGPaths_angelRoom_12
92
+ end
93
+ end
94
+ ____cond16 = ____cond16 or ____switch16 == "gfx/grid/door_08_holeinwall.anm2"
95
+ if ____cond16 then
96
+ do
97
+ local ____customStage_doorPNGPaths_secretRoom_14 = customStage.doorPNGPaths
98
+ if ____customStage_doorPNGPaths_secretRoom_14 ~= nil then
99
+ ____customStage_doorPNGPaths_secretRoom_14 = ____customStage_doorPNGPaths_secretRoom_14.secretRoom
100
+ end
101
+ return ____customStage_doorPNGPaths_secretRoom_14
102
+ end
103
+ end
104
+ ____cond16 = ____cond16 or ____switch16 == "gfx/grid/door_09_bossambushroomdoor.anm2"
105
+ if ____cond16 then
106
+ do
107
+ local ____customStage_doorPNGPaths_bossChallengeRoom_16 = customStage.doorPNGPaths
108
+ if ____customStage_doorPNGPaths_bossChallengeRoom_16 ~= nil then
109
+ ____customStage_doorPNGPaths_bossChallengeRoom_16 = ____customStage_doorPNGPaths_bossChallengeRoom_16.bossChallengeRoom
110
+ end
111
+ return ____customStage_doorPNGPaths_bossChallengeRoom_16
112
+ end
113
+ end
114
+ ____cond16 = ____cond16 or ____switch16 == "gfx/grid/door_10_bossroomdoor.anm2"
115
+ if ____cond16 then
116
+ do
117
+ local ____customStage_doorPNGPaths_bossRoom_18 = customStage.doorPNGPaths
118
+ if ____customStage_doorPNGPaths_bossRoom_18 ~= nil then
119
+ ____customStage_doorPNGPaths_bossRoom_18 = ____customStage_doorPNGPaths_bossRoom_18.bossRoom
120
+ end
121
+ return ____customStage_doorPNGPaths_bossRoom_18
122
+ end
123
+ end
124
+ ____cond16 = ____cond16 or ____switch16 == "gfx/grid/door_15_bossrushdoor.anm2"
125
+ if ____cond16 then
126
+ do
127
+ local ____customStage_doorPNGPaths_bossRush_20 = customStage.doorPNGPaths
128
+ if ____customStage_doorPNGPaths_bossRush_20 ~= nil then
129
+ ____customStage_doorPNGPaths_bossRush_20 = ____customStage_doorPNGPaths_bossRush_20.bossRush
130
+ end
131
+ return ____customStage_doorPNGPaths_bossRush_20
132
+ end
133
+ end
134
+ until true
135
+ return nil
136
+ end
137
+ function removeEntitiesSpawnedFromGridEntity(self, entities, gridEntity)
138
+ local entitiesFromGridEntity = __TS__ArrayFilter(
139
+ entities,
140
+ function(____, entity) return entity.FrameCount == 0 and vectorEquals(nil, entity.Position, gridEntity.Position) end
141
+ )
142
+ removeEntities(nil, entitiesFromGridEntity)
143
+ end
144
+ --- For `GridEntityType.DECORATION` (1)
145
+ function ____exports.setCustomDecorationGraphics(self, customStage, gridEntity)
146
+ if customStage.decorationsPNGPath == nil then
147
+ return
148
+ end
149
+ local variant = gridEntity:GetVariant()
150
+ if variant ~= DecorationVariant.VANILLA_DECORATION then
151
+ return
152
+ end
153
+ local sprite = gridEntity:GetSprite()
154
+ local fileName = sprite:GetFilename()
155
+ if string.lower(fileName) == "gfx/grid/props_01_basement.anm2" then
156
+ sprite:ReplaceSpritesheet(0, customStage.decorationsPNGPath)
157
+ sprite:LoadGraphics()
158
+ end
159
+ end
160
+ --- For `GridEntityType.ROCK` (2)
161
+ function ____exports.setCustomRockGraphics(self, customStage, gridEntity)
162
+ if customStage.rocksPNGPath == nil then
163
+ return
164
+ end
165
+ local sprite = gridEntity:GetSprite()
166
+ local fileName = sprite:GetFilename()
167
+ if fileName == "gfx/grid/grid_rock.anm2" then
168
+ sprite:ReplaceSpritesheet(0, customStage.rocksPNGPath)
169
+ sprite:LoadGraphics()
170
+ elseif fileName == "gfx/grid/grid_pit.anm2" then
171
+ sprite:ReplaceSpritesheet(1, customStage.rocksPNGPath)
172
+ sprite:LoadGraphics()
173
+ end
174
+ end
175
+ --- For `GridEntityType.PIT` (7)
176
+ function ____exports.setCustomPitGraphics(self, customStage, gridEntity)
177
+ if customStage.pitsPNGPath == nil then
178
+ return
179
+ end
180
+ local sprite = gridEntity:GetSprite()
181
+ local fileName = sprite:GetFilename()
182
+ if fileName == "gfx/grid/grid_pit.anm2" then
183
+ sprite:ReplaceSpritesheet(0, customStage.pitsPNGPath)
184
+ sprite:LoadGraphics()
185
+ end
186
+ end
187
+ --- For GridEntityType.DOOR (16)
188
+ function ____exports.setCustomDoorGraphics(self, customStage, gridEntity)
189
+ local sprite = gridEntity:GetSprite()
190
+ local fileName = sprite:GetFilename()
191
+ local doorPNGPath = getNewDoorPNGPath(nil, customStage, fileName)
192
+ if doorPNGPath ~= nil then
193
+ sprite:ReplaceSpritesheet(0, doorPNGPath)
194
+ sprite:LoadGraphics()
195
+ end
196
+ end
197
+ --- The rewards are based on the ones from the wiki:
198
+ -- https://bindingofisaacrebirth.fandom.com/wiki/Rocks#Urns
199
+ --
200
+ -- On the bugged stage of -1, only urns will spawn, so we do not have to handle the case of mushroom
201
+ -- rewards, skull rewards, and so on.
202
+ function ____exports.removeUrnRewards(self, customStage, gridEntity)
203
+ if customStage.rocksPNGPath == nil then
204
+ return
205
+ end
206
+ local spiders = getNPCs(nil, EntityType.SPIDER)
207
+ removeEntitiesSpawnedFromGridEntity(nil, spiders, gridEntity)
208
+ local coins = getCoins(nil)
209
+ removeEntitiesSpawnedFromGridEntity(nil, coins, gridEntity)
210
+ local quarters = getCollectibles(nil, CollectibleType.QUARTER)
211
+ removeEntitiesSpawnedFromGridEntity(nil, quarters, gridEntity)
212
+ local swallowedPennies = getTrinkets(nil, TrinketType.SWALLOWED_PENNY)
213
+ removeEntitiesSpawnedFromGridEntity(nil, swallowedPennies, gridEntity)
214
+ end
215
+ return ____exports
@@ -1 +1,2 @@
1
- export declare function customStageInit(): void;
1
+ import { ModUpgraded } from "../../classes/ModUpgraded";
2
+ export declare function customStageInit(mod: ModUpgraded): void;
@@ -3,12 +3,44 @@ 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 getRoomTypeMap
6
+ local initRoomTypeMaps, getRoomTypeMap, postRender, postGridEntityBrokenRockAlt, postGridEntityBrokenInit, postNewRoomReordered
7
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
8
+ local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
9
+ local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
10
+ local ____ModCallbackCustom = require("enums.ModCallbackCustom")
11
+ local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
7
12
  local ____array = require("functions.array")
8
13
  local isArray = ____array.isArray
14
+ local ____exports = require("features.saveDataManager.exports")
15
+ local saveDataManager = ____exports.saveDataManager
16
+ local ____backdrop = require("features.customStage.backdrop")
17
+ local setBackdrop = ____backdrop.setBackdrop
18
+ local ____gridEntities = require("features.customStage.gridEntities")
19
+ local removeUrnRewards = ____gridEntities.removeUrnRewards
20
+ local setCustomDecorationGraphics = ____gridEntities.setCustomDecorationGraphics
21
+ local setCustomDoorGraphics = ____gridEntities.setCustomDoorGraphics
22
+ local setCustomPitGraphics = ____gridEntities.setCustomPitGraphics
23
+ local setCustomRockGraphics = ____gridEntities.setCustomRockGraphics
9
24
  local metadataJSON = require("features.customStage.metadata")
25
+ local ____streakText = require("features.customStage.streakText")
26
+ local streakTextPostRender = ____streakText.streakTextPostRender
10
27
  local ____v = require("features.customStage.v")
28
+ local v = ____v.default
11
29
  local customStagesMap = ____v.customStagesMap
30
+ local ____versusScreen = require("features.customStage.versusScreen")
31
+ local playVersusScreenAnimation = ____versusScreen.playVersusScreenAnimation
32
+ local versusScreenPostRender = ____versusScreen.versusScreenPostRender
33
+ function initRoomTypeMaps(self)
34
+ if not isArray(nil, metadataJSON) then
35
+ error("The IsaacScript standard library attempted to read the custom stage metadata from the \"metadata.lua\" file, but it was not an array.")
36
+ end
37
+ local customStagesLua = metadataJSON
38
+ for ____, customStageLua in ipairs(customStagesLua) do
39
+ local roomTypeMap = getRoomTypeMap(nil, customStageLua)
40
+ local customStage = __TS__ObjectAssign({}, customStageLua, {roomTypeMap = roomTypeMap})
41
+ customStagesMap:set(customStage.name, customStage)
42
+ end
43
+ end
12
44
  function getRoomTypeMap(self, customStageLua)
13
45
  local roomTypeMap = __TS__New(Map)
14
46
  for ____, roomMetadata in ipairs(customStageLua.roomsMetadata) do
@@ -34,15 +66,45 @@ function getRoomTypeMap(self, customStageLua)
34
66
  end
35
67
  return roomTypeMap
36
68
  end
37
- function ____exports.customStageInit(self)
38
- local customStagesLua = metadataJSON
39
- if not isArray(nil, customStagesLua) then
40
- error("The IsaacScript standard library attempted to read the custom stage metadata from the \"metadata.lua\" file, but it was not an array.")
69
+ function postRender(self)
70
+ local customStage = v.run.currentCustomStage
71
+ if customStage == nil then
72
+ return
41
73
  end
42
- for ____, customStageLua in ipairs(customStagesLua) do
43
- local roomTypeMap = getRoomTypeMap(nil, customStageLua)
44
- local customStage = __TS__ObjectAssign({}, customStageLua, {roomTypeMap = roomTypeMap})
45
- customStagesMap:set(customStage.name, customStage)
74
+ streakTextPostRender(nil, customStage)
75
+ versusScreenPostRender(nil)
76
+ end
77
+ function postGridEntityBrokenRockAlt(self, gridEntity)
78
+ local customStage = v.run.currentCustomStage
79
+ if customStage == nil then
80
+ return
46
81
  end
82
+ removeUrnRewards(nil, customStage, gridEntity)
83
+ end
84
+ function postGridEntityBrokenInit(self, gridEntity)
85
+ local customStage = v.run.currentCustomStage
86
+ if customStage == nil then
87
+ return
88
+ end
89
+ setCustomDecorationGraphics(nil, customStage, gridEntity)
90
+ setCustomRockGraphics(nil, customStage, gridEntity)
91
+ setCustomPitGraphics(nil, customStage, gridEntity)
92
+ setCustomDoorGraphics(nil, customStage, gridEntity)
93
+ end
94
+ function postNewRoomReordered(self)
95
+ local customStage = v.run.currentCustomStage
96
+ if customStage == nil then
97
+ return
98
+ end
99
+ setBackdrop(nil, customStage)
100
+ playVersusScreenAnimation(nil, customStage)
101
+ end
102
+ function ____exports.customStageInit(self, mod)
103
+ saveDataManager(nil, "customStage", v)
104
+ initRoomTypeMaps(nil)
105
+ mod:AddCallback(ModCallback.POST_RENDER, postRender)
106
+ mod:AddCallbackCustom(ModCallbackCustom.POST_GRID_ENTITY_BROKEN, postGridEntityBrokenRockAlt, GridEntityType.ROCK_ALT)
107
+ mod:AddCallbackCustom(ModCallbackCustom.POST_GRID_ENTITY_INIT, postGridEntityBrokenInit)
108
+ mod:AddCallbackCustom(ModCallbackCustom.POST_NEW_ROOM_REORDERED, postNewRoomReordered)
47
109
  end
48
110
  return ____exports
@@ -0,0 +1,2 @@
1
+ import { CustomStage } from "../../interfaces/CustomStage";
2
+ export declare function streakTextPostRender(customStage: CustomStage): void;
@@ -0,0 +1,22 @@
1
+ local ____exports = {}
2
+ local ____cachedClasses = require("cachedClasses")
3
+ local fonts = ____cachedClasses.fonts
4
+ local ____constants = require("constants")
5
+ local KColorDefault = ____constants.KColorDefault
6
+ local ____ui = require("functions.ui")
7
+ local getScreenBottomCenterPos = ____ui.getScreenBottomCenterPos
8
+ local ____v = require("features.customStage.v")
9
+ local v = ____v.default
10
+ local STREAK_TEXT_BOTTOM_OFFSET = Vector(0, -60)
11
+ function ____exports.streakTextPostRender(self, customStage)
12
+ if not v.run.showingStreakText then
13
+ return
14
+ end
15
+ local font = fonts.upheaval
16
+ local length = font:GetStringWidthUTF8(customStage.name)
17
+ local bottomCenterPos = getScreenBottomCenterPos(nil)
18
+ local position = bottomCenterPos + STREAK_TEXT_BOTTOM_OFFSET
19
+ local adjustedX = position.X - length / 2
20
+ font:DrawString(customStage.name, adjustedX, position.Y, KColorDefault)
21
+ end
22
+ return ____exports
@@ -1,6 +1,16 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  import { CustomStage } from "../../interfaces/CustomStage";
3
+ declare const v: {
4
+ run: {
5
+ currentCustomStage: CustomStage | null;
6
+ showingStreakText: boolean;
7
+ showingBossVersusScreen: boolean;
8
+ };
9
+ };
10
+ export default v;
3
11
  /** Indexed by custom stage name. */
4
12
  export declare const customStagesMap: Map<string, CustomStage>;
5
13
  /** Indexed by room variant. */
6
14
  export declare const customStageCachedRoomData: Map<number, Readonly<RoomConfig>>;
15
+ /** Indexed by entity ID. */
16
+ export declare const customBossPNGPaths: Map<string, [namePNGPath: string, portraitPNGPath: string]>;
@@ -2,8 +2,12 @@ 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 v = {run = {currentCustomStage = nil, showingStreakText = false, showingBossVersusScreen = false}}
6
+ ____exports.default = v
5
7
  --- Indexed by custom stage name.
6
8
  ____exports.customStagesMap = __TS__New(Map)
7
9
  --- Indexed by room variant.
8
10
  ____exports.customStageCachedRoomData = __TS__New(Map)
11
+ --- Indexed by entity ID.
12
+ ____exports.customBossPNGPaths = __TS__New(Map)
9
13
  return ____exports
@@ -0,0 +1,3 @@
1
+ import { CustomStage } from "../../interfaces/CustomStage";
2
+ export declare function playVersusScreenAnimation(customStage: CustomStage, force?: boolean): void;
3
+ export declare function versusScreenPostRender(): void;
@@ -0,0 +1,201 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local Map = ____lualib.Map
3
+ local ____exports = {}
4
+ local getPlayerPNGPaths, getBossPNGPaths, DEFAULT_CHARACTER, PNG_PATH_PREFIX, PLAYER_PORTRAIT_PNG_PATH_PREFIX
5
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
6
+ local BossID = ____isaac_2Dtypescript_2Ddefinitions.BossID
7
+ local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
8
+ local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
9
+ local SoundEffect = ____isaac_2Dtypescript_2Ddefinitions.SoundEffect
10
+ local StageID = ____isaac_2Dtypescript_2Ddefinitions.StageID
11
+ local ____cachedClasses = require("cachedClasses")
12
+ local game = ____cachedClasses.game
13
+ local sfxManager = ____cachedClasses.sfxManager
14
+ local ____array = require("functions.array")
15
+ local arrayRemove = ____array.arrayRemove
16
+ local ____boss = require("functions.boss")
17
+ local getBosses = ____boss.getBosses
18
+ local ____entity = require("functions.entity")
19
+ local getEntityID = ____entity.getEntityID
20
+ local ____utils = require("functions.utils")
21
+ local erange = ____utils.erange
22
+ local ____bossNamePNGFileNames = require("objects.bossNamePNGFileNames")
23
+ local BOSS_NAME_PNG_FILE_NAMES = ____bossNamePNGFileNames.BOSS_NAME_PNG_FILE_NAMES
24
+ local ____bossPortraitPNGFileNames = require("objects.bossPortraitPNGFileNames")
25
+ local BOSS_PORTRAIT_PNG_FILE_NAMES = ____bossPortraitPNGFileNames.BOSS_PORTRAIT_PNG_FILE_NAMES
26
+ local ____playerNamePNGFileNames = require("objects.playerNamePNGFileNames")
27
+ local PLAYER_NAME_PNG_FILE_NAMES = ____playerNamePNGFileNames.PLAYER_NAME_PNG_FILE_NAMES
28
+ local ____playerPortraitPNGFileNames = require("objects.playerPortraitPNGFileNames")
29
+ local PLAYER_PORTRAIT_PNG_FILE_NAMES = ____playerPortraitPNGFileNames.PLAYER_PORTRAIT_PNG_FILE_NAMES
30
+ local ____versusScreenBackgroundColors = require("objects.versusScreenBackgroundColors")
31
+ local VERSUS_SCREEN_BACKGROUND_COLORS = ____versusScreenBackgroundColors.VERSUS_SCREEN_BACKGROUND_COLORS
32
+ local ____versusScreenDirtSpotColors = require("objects.versusScreenDirtSpotColors")
33
+ local VERSUS_SCREEN_DIRT_SPOT_COLORS = ____versusScreenDirtSpotColors.VERSUS_SCREEN_DIRT_SPOT_COLORS
34
+ local ____pause = require("features.pause")
35
+ local pause = ____pause.pause
36
+ local unpause = ____pause.unpause
37
+ local ____customStageConstants = require("features.customStage.customStageConstants")
38
+ local ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH = ____customStageConstants.ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH
39
+ local ____v = require("features.customStage.v")
40
+ local v = ____v.default
41
+ local customBossPNGPaths = ____v.customBossPNGPaths
42
+ function getPlayerPNGPaths(self)
43
+ local player = Isaac.GetPlayer()
44
+ local character = player:GetPlayerType()
45
+ local playerNamePNGFileName = PLAYER_NAME_PNG_FILE_NAMES[character]
46
+ if playerNamePNGFileName == nil then
47
+ playerNamePNGFileName = PLAYER_NAME_PNG_FILE_NAMES[DEFAULT_CHARACTER]
48
+ end
49
+ local playerNamePNGPath = (PNG_PATH_PREFIX .. "/") .. tostring(playerNamePNGFileName)
50
+ local playerPortraitFileName = PLAYER_PORTRAIT_PNG_FILE_NAMES[character]
51
+ if playerNamePNGFileName == nil then
52
+ playerPortraitFileName = PLAYER_PORTRAIT_PNG_FILE_NAMES[DEFAULT_CHARACTER]
53
+ end
54
+ local playerPortraitPNGPath = (PLAYER_PORTRAIT_PNG_PATH_PREFIX .. "/") .. tostring(playerPortraitFileName)
55
+ return {playerNamePNGPath, playerPortraitPNGPath}
56
+ end
57
+ function getBossPNGPaths(self)
58
+ local bosses = getBosses(nil)
59
+ local firstBoss = bosses[1]
60
+ if firstBoss ~= nil then
61
+ local entityID = getEntityID(nil, firstBoss)
62
+ local pngPaths = customBossPNGPaths:get(entityID)
63
+ if pngPaths ~= nil then
64
+ return pngPaths
65
+ end
66
+ end
67
+ local bossID = firstBoss == nil and 0 or firstBoss:GetBossID()
68
+ if bossID == 0 then
69
+ local questionMarkSprite = (PNG_PATH_PREFIX .. "/") .. BOSS_NAME_PNG_FILE_NAMES[BossID.BLUE_BABY]
70
+ local bossNamePNGPath = questionMarkSprite
71
+ local bossPortraitPNGPath = questionMarkSprite
72
+ return {bossNamePNGPath, bossPortraitPNGPath}
73
+ end
74
+ local bossNamePNGFileName = BOSS_NAME_PNG_FILE_NAMES[bossID]
75
+ local bossNamePNGPath = (PNG_PATH_PREFIX .. "/") .. bossNamePNGFileName
76
+ local bossPortraitPNGFileName = BOSS_PORTRAIT_PNG_FILE_NAMES[bossID]
77
+ local bossPortraitPNGPath = (PNG_PATH_PREFIX .. "/") .. bossPortraitPNGFileName
78
+ return {bossNamePNGPath, bossPortraitPNGPath}
79
+ end
80
+ DEFAULT_CHARACTER = PlayerType.ISAAC
81
+ local DEFAULT_STAGE_ID = StageID.BASEMENT
82
+ local VERSUS_SCREEN_ANIMATION_NAME = "Scene"
83
+ --- The layers range from 0 to 13.
84
+ local NUM_VERSUS_SCREEN_ANM2_LAYERS = 14
85
+ local BACKGROUND_ANM2_LAYER = 0
86
+ local BOSS_DIRT_SPOT_ANM2_LAYER = 2
87
+ local PLAYER_DIRT_SPOT_ANM2_LAYER = 3
88
+ local BOSS_PORTRAIT_ANM2_LAYER = 4
89
+ local PLAYER_PORTRAIT_ANM2_LAYER = 5
90
+ local PLAYER_NAME_ANM2_LAYER = 6
91
+ local BOSS_NAME_ANM2_LAYER = 7
92
+ local OVERLAY_ANM2_LAYER = 11
93
+ --- We only need to render either the normal player portrait layer or the alternate player portrait
94
+ -- layer. Rendering both will cause the player not to shake.
95
+ local PLAYER_PORTRAIT_ALT_ANM2_LAYER = 12
96
+ --- These are the non-special layers that we will render last.
97
+ local OTHER_ANM2_LAYERS = arrayRemove(
98
+ nil,
99
+ erange(nil, NUM_VERSUS_SCREEN_ANM2_LAYERS),
100
+ BACKGROUND_ANM2_LAYER,
101
+ BOSS_DIRT_SPOT_ANM2_LAYER,
102
+ PLAYER_DIRT_SPOT_ANM2_LAYER,
103
+ OVERLAY_ANM2_LAYER,
104
+ PLAYER_PORTRAIT_ALT_ANM2_LAYER
105
+ )
106
+ PNG_PATH_PREFIX = "gfx/ui/boss"
107
+ PLAYER_PORTRAIT_PNG_PATH_PREFIX = "gfx/ui/stage"
108
+ local VANILLA_VERSUS_PLAYBACK_SPEED = 0.5
109
+ local versusScreenSprite = Sprite()
110
+ versusScreenSprite:Load("gfx/ui/boss/versusscreen.anm2", false)
111
+ versusScreenSprite:ReplaceSpritesheet(OVERLAY_ANM2_LAYER, ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH .. "/overlay.png")
112
+ versusScreenSprite:LoadGraphics()
113
+ --- Unfortunately, we must split the background layer into an entirely different sprite so that we
114
+ -- can color it with the `Color` property.
115
+ local versusScreenBackgroundSprite = Sprite()
116
+ versusScreenBackgroundSprite:Load("gfx/ui/boss/versusscreen.anm2", true)
117
+ --- Unfortunately, we must split the dirt layer into an entirely different sprite so that we can
118
+ -- color it with the `Color` property.
119
+ local versusScreenDirtSpotSprite = Sprite()
120
+ versusScreenDirtSpotSprite:Load("gfx/ui/boss/versusscreen.anm2", true)
121
+ function ____exports.playVersusScreenAnimation(self, customStage, force)
122
+ if force == nil then
123
+ force = false
124
+ end
125
+ local room = game:GetRoom()
126
+ local roomType = room:GetType()
127
+ local hud = game:GetHUD()
128
+ if roomType ~= RoomType.BOSS and not force then
129
+ return
130
+ end
131
+ v.run.showingBossVersusScreen = true
132
+ pause(nil)
133
+ hud:SetVisible(false)
134
+ local playerNamePNGPath, playerPortraitPNGPath = table.unpack(getPlayerPNGPaths(nil))
135
+ versusScreenSprite:ReplaceSpritesheet(PLAYER_NAME_ANM2_LAYER, playerNamePNGPath)
136
+ versusScreenSprite:ReplaceSpritesheet(PLAYER_PORTRAIT_ANM2_LAYER, playerPortraitPNGPath)
137
+ local bossNamePNGPath, bossPortraitPNGPath = table.unpack(getBossPNGPaths(nil))
138
+ versusScreenSprite:ReplaceSpritesheet(BOSS_NAME_ANM2_LAYER, bossNamePNGPath)
139
+ versusScreenSprite:ReplaceSpritesheet(BOSS_PORTRAIT_ANM2_LAYER, bossPortraitPNGPath)
140
+ versusScreenSprite:LoadGraphics()
141
+ local backgroundColor = VERSUS_SCREEN_BACKGROUND_COLORS[DEFAULT_STAGE_ID]
142
+ local ____customStage_versusScreen_backgroundColor_0 = customStage.versusScreen
143
+ if ____customStage_versusScreen_backgroundColor_0 ~= nil then
144
+ ____customStage_versusScreen_backgroundColor_0 = ____customStage_versusScreen_backgroundColor_0.backgroundColor
145
+ end
146
+ if ____customStage_versusScreen_backgroundColor_0 ~= nil then
147
+ local ____customStage_versusScreen_backgroundColor_2 = customStage.versusScreen.backgroundColor
148
+ local r = ____customStage_versusScreen_backgroundColor_2.r
149
+ local g = ____customStage_versusScreen_backgroundColor_2.g
150
+ local b = ____customStage_versusScreen_backgroundColor_2.b
151
+ backgroundColor = Color(r, g, b)
152
+ end
153
+ versusScreenBackgroundSprite.Color = backgroundColor
154
+ local dirtSpotColor = VERSUS_SCREEN_DIRT_SPOT_COLORS[DEFAULT_STAGE_ID]
155
+ local ____customStage_versusScreen_dirtSpotColor_3 = customStage.versusScreen
156
+ if ____customStage_versusScreen_dirtSpotColor_3 ~= nil then
157
+ ____customStage_versusScreen_dirtSpotColor_3 = ____customStage_versusScreen_dirtSpotColor_3.dirtSpotColor
158
+ end
159
+ if ____customStage_versusScreen_dirtSpotColor_3 ~= nil then
160
+ local ____customStage_versusScreen_dirtSpotColor_5 = customStage.versusScreen.dirtSpotColor
161
+ local r = ____customStage_versusScreen_dirtSpotColor_5.r
162
+ local g = ____customStage_versusScreen_dirtSpotColor_5.g
163
+ local b = ____customStage_versusScreen_dirtSpotColor_5.b
164
+ dirtSpotColor = Color(r, g, b)
165
+ end
166
+ versusScreenDirtSpotSprite.Color = dirtSpotColor
167
+ for ____, sprite in ipairs({versusScreenBackgroundSprite, versusScreenDirtSpotSprite, versusScreenSprite}) do
168
+ sprite:Play(VERSUS_SCREEN_ANIMATION_NAME, true)
169
+ sprite.PlaybackSpeed = VANILLA_VERSUS_PLAYBACK_SPEED
170
+ end
171
+ end
172
+ local function finishVersusScreenAnimation(self)
173
+ local hud = game:GetHUD()
174
+ v.run.showingBossVersusScreen = false
175
+ unpause(nil)
176
+ hud:SetVisible(true)
177
+ sfxManager:Play(SoundEffect.CASTLE_PORTCULLIS)
178
+ end
179
+ function ____exports.versusScreenPostRender(self)
180
+ if not v.run.showingBossVersusScreen then
181
+ return
182
+ end
183
+ if versusScreenSprite:IsFinished(VERSUS_SCREEN_ANIMATION_NAME) then
184
+ finishVersusScreenAnimation(nil)
185
+ return
186
+ end
187
+ local room = game:GetRoom()
188
+ local centerPos = room:GetCenterPos()
189
+ local position = Isaac.WorldToRenderPosition(centerPos)
190
+ versusScreenBackgroundSprite:RenderLayer(BACKGROUND_ANM2_LAYER, position)
191
+ versusScreenBackgroundSprite:Update()
192
+ versusScreenSprite:RenderLayer(OVERLAY_ANM2_LAYER, position)
193
+ versusScreenDirtSpotSprite:RenderLayer(BOSS_DIRT_SPOT_ANM2_LAYER, position)
194
+ versusScreenDirtSpotSprite:RenderLayer(PLAYER_DIRT_SPOT_ANM2_LAYER, position)
195
+ versusScreenDirtSpotSprite:Update()
196
+ for ____, layerID in ipairs(OTHER_ANM2_LAYERS) do
197
+ versusScreenSprite:RenderLayer(layerID, position)
198
+ end
199
+ versusScreenSprite:Update()
200
+ end
201
+ return ____exports
@@ -11,6 +11,7 @@ local saveDataManager = ____exports.saveDataManager
11
11
  local ____v = require("features.debugDisplay.v")
12
12
  local v = ____v.default
13
13
  local debugDisplayTextCallbacks = ____v.debugDisplayTextCallbacks
14
+ local setDebugDisplayEnabled = ____v.setDebugDisplayEnabled
14
15
  function renderTextOnEntity(self, entity, text)
15
16
  if isReflectionRender(nil) then
16
17
  return
@@ -155,6 +156,7 @@ end
155
156
  --- The debug display feature is only initialized when the extra console commands feature is
156
157
  -- initialized.
157
158
  function ____exports.debugDisplayInit(self, mod)
159
+ setDebugDisplayEnabled(nil)
158
160
  saveDataManager(
159
161
  nil,
160
162
  "debugDisplay",