isaacscript-common 6.3.0 → 6.5.1

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 (78) hide show
  1. package/cachedClasses.d.ts +15 -0
  2. package/cachedClasses.lua +20 -0
  3. package/constants.d.ts +17 -4
  4. package/constants.lua +13 -4
  5. package/enums/DecorationVariant.d.ts +9 -0
  6. package/enums/DecorationVariant.lua +7 -0
  7. package/enums/RockAltType.d.ts +7 -0
  8. package/enums/RockAltType.lua +13 -0
  9. package/features/customGridEntity.d.ts +2 -2
  10. package/features/customGridEntity.lua +7 -5
  11. package/features/customStage/backdrop.lua +11 -18
  12. package/features/customStage/customStageConstants.d.ts +1 -0
  13. package/features/customStage/customStageConstants.lua +3 -0
  14. package/features/customStage/exports.d.ts +27 -0
  15. package/features/customStage/exports.lua +33 -3
  16. package/features/customStage/gridEntities.d.ts +18 -0
  17. package/features/customStage/gridEntities.lua +215 -0
  18. package/features/customStage/init.lua +57 -8
  19. package/features/customStage/shadows.d.ts +3 -0
  20. package/features/customStage/shadows.lua +58 -0
  21. package/features/customStage/streakText.d.ts +3 -0
  22. package/features/customStage/streakText.lua +29 -0
  23. package/features/customStage/v.d.ts +6 -0
  24. package/features/customStage/v.lua +3 -1
  25. package/features/customStage/versusScreen.d.ts +3 -0
  26. package/features/customStage/versusScreen.lua +201 -0
  27. package/features/deployJSONRoom.lua +6 -2
  28. package/features/extraConsoleCommands/init.lua +2 -0
  29. package/features/extraConsoleCommands/listCommands.d.ts +9 -2
  30. package/features/extraConsoleCommands/listCommands.lua +20 -4
  31. package/features/saveDataManager/exports.lua +2 -2
  32. package/features/saveDataManager/load.lua +3 -3
  33. package/features/saveDataManager/main.lua +3 -3
  34. package/features/saveDataManager/merge.lua +2 -2
  35. package/features/saveDataManager/save.lua +3 -3
  36. package/features/saveDataManager/{constants.d.ts → saveDataManagerConstants.d.ts} +0 -0
  37. package/features/saveDataManager/{constants.lua → saveDataManagerConstants.lua} +0 -0
  38. package/functions/color.d.ts +0 -2
  39. package/functions/color.lua +0 -4
  40. package/functions/deepCopy.lua +2 -2
  41. package/functions/doors.d.ts +10 -5
  42. package/functions/doors.lua +20 -17
  43. package/functions/entity.d.ts +5 -0
  44. package/functions/entity.lua +13 -0
  45. package/functions/gridEntity.d.ts +39 -0
  46. package/functions/gridEntity.lua +83 -2
  47. package/functions/kColor.d.ts +0 -2
  48. package/functions/kColor.lua +0 -4
  49. package/functions/log.lua +2 -1
  50. package/functions/pickups.d.ts +9 -9
  51. package/functions/run.d.ts +7 -0
  52. package/functions/run.lua +16 -4
  53. package/functions/ui.d.ts +2 -0
  54. package/functions/ui.lua +8 -0
  55. package/functions/utils.d.ts +6 -4
  56. package/functions/utils.lua +6 -4
  57. package/interfaces/CustomStageLua.d.ts +271 -63
  58. package/objects/backdropTypeToRockAltType.d.ts +6 -0
  59. package/objects/backdropTypeToRockAltType.lua +69 -0
  60. package/objects/bossNamePNGFileNames.d.ts +5 -0
  61. package/objects/bossNamePNGFileNames.lua +108 -0
  62. package/objects/bossPortraitPNGFileNames.d.ts +5 -0
  63. package/objects/bossPortraitPNGFileNames.lua +108 -0
  64. package/objects/colors.d.ts +15 -8
  65. package/objects/colors.lua +9 -2
  66. package/objects/playerNamePNGFileNames.d.ts +5 -0
  67. package/objects/playerNamePNGFileNames.lua +49 -0
  68. package/objects/playerPortraitPNGFileNames.d.ts +5 -0
  69. package/objects/playerPortraitPNGFileNames.lua +49 -0
  70. package/objects/versusScreenBackgroundColors.d.ts +5 -0
  71. package/objects/versusScreenBackgroundColors.lua +38 -0
  72. package/objects/versusScreenDirtSpotColors.d.ts +5 -0
  73. package/objects/versusScreenDirtSpotColors.lua +38 -0
  74. package/package.json +2 -2
  75. package/features/customStage/boss.d.ts +0 -2
  76. package/features/customStage/boss.lua +0 -74
  77. package/features/customStage/stageAPIBoss.d.ts +0 -29
  78. package/features/customStage/stageAPIBoss.lua +0 -9
@@ -3,9 +3,12 @@ local Map = ____lualib.Map
3
3
  local __TS__ObjectAssign = ____lualib.__TS__ObjectAssign
4
4
  local __TS__New = ____lualib.__TS__New
5
5
  local ____exports = {}
6
- local initRoomTypeMaps, getRoomTypeMap, postRender, postNewRoomReordered
6
+ local initRoomTypeMaps, getRoomTypeMap, postRender, getShaderParams, postGridEntityBrokenRockAlt, postGridEntityBrokenInit, postNewRoomReordered
7
7
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
8
+ local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
8
9
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
10
+ local ____cachedClasses = require("cachedClasses")
11
+ local game = ____cachedClasses.game
9
12
  local ____ModCallbackCustom = require("enums.ModCallbackCustom")
10
13
  local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
11
14
  local ____array = require("functions.array")
@@ -14,18 +17,30 @@ local ____exports = require("features.saveDataManager.exports")
14
17
  local saveDataManager = ____exports.saveDataManager
15
18
  local ____backdrop = require("features.customStage.backdrop")
16
19
  local setBackdrop = ____backdrop.setBackdrop
17
- local ____boss = require("features.customStage.boss")
18
- local bossPostRender = ____boss.bossPostRender
19
- local playBossRoomAnimation = ____boss.playBossRoomAnimation
20
+ local ____gridEntities = require("features.customStage.gridEntities")
21
+ local removeUrnRewards = ____gridEntities.removeUrnRewards
22
+ local setCustomDecorationGraphics = ____gridEntities.setCustomDecorationGraphics
23
+ local setCustomDoorGraphics = ____gridEntities.setCustomDoorGraphics
24
+ local setCustomPitGraphics = ____gridEntities.setCustomPitGraphics
25
+ local setCustomRockGraphics = ____gridEntities.setCustomRockGraphics
20
26
  local metadataJSON = require("features.customStage.metadata")
27
+ local ____shadows = require("features.customStage.shadows")
28
+ local setShadows = ____shadows.setShadows
29
+ local shadowsPostRender = ____shadows.shadowsPostRender
30
+ local ____streakText = require("features.customStage.streakText")
31
+ local streakTextGetShaderParams = ____streakText.streakTextGetShaderParams
32
+ local streakTextPostRender = ____streakText.streakTextPostRender
21
33
  local ____v = require("features.customStage.v")
22
34
  local v = ____v.default
23
35
  local customStagesMap = ____v.customStagesMap
36
+ local ____versusScreen = require("features.customStage.versusScreen")
37
+ local playVersusScreenAnimation = ____versusScreen.playVersusScreenAnimation
38
+ local versusScreenPostRender = ____versusScreen.versusScreenPostRender
24
39
  function initRoomTypeMaps(self)
25
- local customStagesLua = metadataJSON
26
- if not isArray(nil, customStagesLua) then
40
+ if not isArray(nil, metadataJSON) then
27
41
  error("The IsaacScript standard library attempted to read the custom stage metadata from the \"metadata.lua\" file, but it was not an array.")
28
42
  end
43
+ local customStagesLua = metadataJSON
29
44
  for ____, customStageLua in ipairs(customStagesLua) do
30
45
  local roomTypeMap = getRoomTypeMap(nil, customStageLua)
31
46
  local customStage = __TS__ObjectAssign({}, customStageLua, {roomTypeMap = roomTypeMap})
@@ -58,7 +73,37 @@ function getRoomTypeMap(self, customStageLua)
58
73
  return roomTypeMap
59
74
  end
60
75
  function postRender(self)
61
- bossPostRender(nil)
76
+ local customStage = v.run.currentCustomStage
77
+ if customStage == nil then
78
+ return
79
+ end
80
+ local isPaused = game:IsPaused()
81
+ if isPaused then
82
+ return
83
+ end
84
+ streakTextPostRender(nil, customStage)
85
+ shadowsPostRender(nil, customStage)
86
+ versusScreenPostRender(nil)
87
+ end
88
+ function getShaderParams(self, shaderName)
89
+ return streakTextGetShaderParams(nil, shaderName)
90
+ end
91
+ function postGridEntityBrokenRockAlt(self, gridEntity)
92
+ local customStage = v.run.currentCustomStage
93
+ if customStage == nil then
94
+ return
95
+ end
96
+ removeUrnRewards(nil, customStage, gridEntity)
97
+ end
98
+ function postGridEntityBrokenInit(self, gridEntity)
99
+ local customStage = v.run.currentCustomStage
100
+ if customStage == nil then
101
+ return
102
+ end
103
+ setCustomDecorationGraphics(nil, customStage, gridEntity)
104
+ setCustomRockGraphics(nil, customStage, gridEntity)
105
+ setCustomPitGraphics(nil, customStage, gridEntity)
106
+ setCustomDoorGraphics(nil, customStage, gridEntity)
62
107
  end
63
108
  function postNewRoomReordered(self)
64
109
  local customStage = v.run.currentCustomStage
@@ -66,12 +111,16 @@ function postNewRoomReordered(self)
66
111
  return
67
112
  end
68
113
  setBackdrop(nil, customStage)
69
- playBossRoomAnimation(nil)
114
+ setShadows(nil, customStage)
115
+ playVersusScreenAnimation(nil, customStage)
70
116
  end
71
117
  function ____exports.customStageInit(self, mod)
72
118
  saveDataManager(nil, "customStage", v)
73
119
  initRoomTypeMaps(nil)
74
120
  mod:AddCallback(ModCallback.POST_RENDER, postRender)
121
+ mod:AddCallback(ModCallback.GET_SHADER_PARAMS, getShaderParams)
122
+ mod:AddCallbackCustom(ModCallbackCustom.POST_GRID_ENTITY_BROKEN, postGridEntityBrokenRockAlt, GridEntityType.ROCK_ALT)
123
+ mod:AddCallbackCustom(ModCallbackCustom.POST_GRID_ENTITY_INIT, postGridEntityBrokenInit)
75
124
  mod:AddCallbackCustom(ModCallbackCustom.POST_NEW_ROOM_REORDERED, postNewRoomReordered)
76
125
  end
77
126
  return ____exports
@@ -0,0 +1,3 @@
1
+ import { CustomStage } from "../../interfaces/CustomStage";
2
+ export declare function setShadows(customStage: CustomStage): void;
3
+ export declare function shadowsPostRender(_customStage: CustomStage): void;
@@ -0,0 +1,58 @@
1
+ local ____exports = {}
2
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
+ local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
4
+ local ____cachedClasses = require("cachedClasses")
5
+ local game = ____cachedClasses.game
6
+ local ____constants = require("constants")
7
+ local VectorZero = ____constants.VectorZero
8
+ local ____array = require("functions.array")
9
+ local getRandomArrayElement = ____array.getRandomArrayElement
10
+ local ____customStageConstants = require("features.customStage.customStageConstants")
11
+ local ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH = ____customStageConstants.ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH
12
+ local ____v = require("features.customStage.v")
13
+ local v = ____v.default
14
+ --- The animation comes from StageAPI.
15
+ local ROOM_SHAPE_TO_SHADOW_ANIMATION = {
16
+ [RoomShape.SHAPE_1x1] = "1x1",
17
+ [RoomShape.IH] = "1x1",
18
+ [RoomShape.IV] = "1x1",
19
+ [RoomShape.SHAPE_1x2] = "1x2",
20
+ [RoomShape.IIV] = "1x2",
21
+ [RoomShape.SHAPE_2x1] = "2x1",
22
+ [RoomShape.IIH] = "2x1",
23
+ [RoomShape.SHAPE_2x2] = "2x2",
24
+ [RoomShape.LTL] = "2x2",
25
+ [RoomShape.LTR] = "2x2",
26
+ [RoomShape.LBL] = "2x2",
27
+ [RoomShape.LBR] = "2x2"
28
+ }
29
+ local shadowSprite = Sprite()
30
+ shadowSprite:Load(ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH .. "/stage-shadow.anm2", true)
31
+ function ____exports.setShadows(self, customStage)
32
+ if customStage.shadowPNGPaths == nil then
33
+ return
34
+ end
35
+ local room = game:GetRoom()
36
+ local roomShape = room:GetRoomShape()
37
+ local animation = ROOM_SHAPE_TO_SHADOW_ANIMATION[roomShape]
38
+ local shadowPNGPaths = customStage.shadowPNGPaths[animation]
39
+ if shadowPNGPaths == nil then
40
+ return
41
+ end
42
+ local decorationSeed = room:GetDecorationSeed()
43
+ local shadowPNGPath = getRandomArrayElement(nil, shadowPNGPaths, decorationSeed)
44
+ shadowSprite:ReplaceSpritesheet(0, shadowPNGPath)
45
+ shadowSprite:SetFrame(animation, 0)
46
+ v.room.showingShadows = true
47
+ end
48
+ function ____exports.shadowsPostRender(self, _customStage)
49
+ if not v.room.showingShadows then
50
+ return
51
+ end
52
+ local room = game:GetRoom()
53
+ local renderPosition = Isaac.WorldToRenderPosition(VectorZero)
54
+ local renderScrollOffset = room:GetRenderScrollOffset()
55
+ local position = renderPosition + renderScrollOffset
56
+ shadowSprite:Render(position)
57
+ end
58
+ return ____exports
@@ -0,0 +1,3 @@
1
+ import { CustomStage } from "../../interfaces/CustomStage";
2
+ export declare function streakTextPostRender(customStage: CustomStage): void;
3
+ export declare function streakTextGetShaderParams(shaderName: string): Record<string, unknown> | undefined;
@@ -0,0 +1,29 @@
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 EMPTY_SHADER_NAME = "IsaacScriptEmptyShader"
11
+ local STREAK_TEXT_BOTTOM_OFFSET = Vector(0, -60)
12
+ function ____exports.streakTextPostRender(self, customStage)
13
+ if not v.run.showingStreakText then
14
+ return
15
+ end
16
+ local font = fonts.upheaval
17
+ local length = font:GetStringWidthUTF8(customStage.name)
18
+ local bottomCenterPos = getScreenBottomCenterPos(nil)
19
+ local position = bottomCenterPos + STREAK_TEXT_BOTTOM_OFFSET
20
+ local adjustedX = position.X - length / 2
21
+ font:DrawString(customStage.name, adjustedX, position.Y, KColorDefault)
22
+ end
23
+ function ____exports.streakTextGetShaderParams(self, shaderName)
24
+ if shaderName ~= EMPTY_SHADER_NAME then
25
+ return nil
26
+ end
27
+ return {}
28
+ end
29
+ return ____exports
@@ -3,11 +3,17 @@ import { CustomStage } from "../../interfaces/CustomStage";
3
3
  declare const v: {
4
4
  run: {
5
5
  currentCustomStage: CustomStage | null;
6
+ showingStreakText: boolean;
6
7
  showingBossVersusScreen: boolean;
7
8
  };
9
+ room: {
10
+ showingShadows: boolean;
11
+ };
8
12
  };
9
13
  export default v;
10
14
  /** Indexed by custom stage name. */
11
15
  export declare const customStagesMap: Map<string, CustomStage>;
12
16
  /** Indexed by room variant. */
13
17
  export declare const customStageCachedRoomData: Map<number, Readonly<RoomConfig>>;
18
+ /** Indexed by entity ID. */
19
+ export declare const customBossPNGPaths: Map<string, [namePNGPath: string, portraitPNGPath: string]>;
@@ -2,10 +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, showingBossVersusScreen = false}}
5
+ local v = {run = {currentCustomStage = nil, showingStreakText = false, showingBossVersusScreen = false}, room = {showingShadows = false}}
6
6
  ____exports.default = v
7
7
  --- Indexed by custom stage name.
8
8
  ____exports.customStagesMap = __TS__New(Map)
9
9
  --- Indexed by room variant.
10
10
  ____exports.customStageCachedRoomData = __TS__New(Map)
11
+ --- Indexed by entity ID.
12
+ ____exports.customBossPNGPaths = __TS__New(Map)
11
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
@@ -28,6 +28,7 @@ local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNot
28
28
  local ____array = require("functions.array")
29
29
  local emptyArray = ____array.emptyArray
30
30
  local ____entity = require("functions.entity")
31
+ local getEntityIDFromConstituents = ____entity.getEntityIDFromConstituents
31
32
  local removeAllMatchingEntities = ____entity.removeAllMatchingEntities
32
33
  local spawn = ____entity.spawn
33
34
  local spawnWithSeed = ____entity.spawnWithSeed
@@ -39,6 +40,7 @@ local ____gridEntity = require("functions.gridEntity")
39
40
  local convertXMLGridEntityType = ____gridEntity.convertXMLGridEntityType
40
41
  local getAllGridIndexes = ____gridEntity.getAllGridIndexes
41
42
  local getGridEntities = ____gridEntity.getGridEntities
43
+ local getGridEntityIDFromConstituents = ____gridEntity.getGridEntityIDFromConstituents
42
44
  local removeAllGridExcept = ____gridEntity.removeAllGridExcept
43
45
  local removeGrid = ____gridEntity.removeGrid
44
46
  local setGridEntityInvisible = ____gridEntity.setGridEntityInvisible
@@ -239,7 +241,8 @@ function spawnAllEntities(self, jsonRoom, rng, verbose)
239
241
  end
240
242
  if entityType >= 1000 then
241
243
  if verbose then
242
- log(((((((("Spawning grid entity " .. tostring(entityType)) .. ".") .. tostring(variant)) .. " at: (") .. tostring(x)) .. ", ") .. tostring(y)) .. ")")
244
+ local gridEntityID = getGridEntityIDFromConstituents(nil, entityType, variant)
245
+ log(((((("Spawning grid entity " .. gridEntityID) .. " at: (") .. tostring(x)) .. ", ") .. tostring(y)) .. ")")
243
246
  end
244
247
  spawnGridEntityForJSONRoom(
245
248
  nil,
@@ -250,7 +253,8 @@ function spawnAllEntities(self, jsonRoom, rng, verbose)
250
253
  )
251
254
  else
252
255
  if verbose then
253
- log(((((((((("Spawning normal entity " .. tostring(entityType)) .. ".") .. tostring(variant)) .. ".") .. tostring(subType)) .. " at: (") .. tostring(x)) .. ", ") .. tostring(y)) .. ")")
256
+ local entityID = getEntityIDFromConstituents(nil, entityType, variant, subType)
257
+ log(((((("Spawning normal entity " .. entityID) .. " at: (") .. tostring(x)) .. ", ") .. tostring(y)) .. ")")
254
258
  end
255
259
  local entity = spawnNormalEntityForJSONRoom(
256
260
  nil,
@@ -84,6 +84,7 @@ function initMap(self)
84
84
  extraConsoleCommandsFunctionMap:set("goldenKey", commands.goldenKey)
85
85
  extraConsoleCommandsFunctionMap:set("grid", commands.grid)
86
86
  extraConsoleCommandsFunctionMap:set("grid2", commands.grid2)
87
+ extraConsoleCommandsFunctionMap:set("gridCosts", commands.gridCosts)
87
88
  extraConsoleCommandsFunctionMap:set("gridEntities", commands.gridEntities)
88
89
  extraConsoleCommandsFunctionMap:set("h", commands.h)
89
90
  extraConsoleCommandsFunctionMap:set("hearts", commands.hearts)
@@ -168,6 +169,7 @@ function initMap(self)
168
169
  extraConsoleCommandsFunctionMap:set("trapdoor", commands.trapdoorCommand)
169
170
  extraConsoleCommandsFunctionMap:set("treasure", commands.treasure)
170
171
  extraConsoleCommandsFunctionMap:set("ultraSecret", commands.ultraSecret)
172
+ extraConsoleCommandsFunctionMap:set("unseed", commands.unseed)
171
173
  extraConsoleCommandsFunctionMap:set("up", commands.up)
172
174
  extraConsoleCommandsFunctionMap:set("warp", commands.warp)
173
175
  end
@@ -153,10 +153,15 @@ export declare function goldenBomb(): void;
153
153
  export declare function goldenHearts(params: string): void;
154
154
  /** Gives the player a golden key. */
155
155
  export declare function goldenKey(): void;
156
- /** Alias for the "debug 2" command. */
156
+ /**
157
+ * Alias for the "debug 11" command. Useful for seeing the coordinates and grid index of each tile
158
+ * in the room.
159
+ */
157
160
  export declare function grid(): void;
158
- /** Alias for the "debug 11" command. */
161
+ /** Alias for the "gridCosts" command. */
159
162
  export declare function grid2(): void;
163
+ /** Alias for the "debug 2" command. Useful for seeing the grid costs of each tile in the room. */
164
+ export declare function gridCosts(): void;
160
165
  /** Spawns every grid entity, starting at the top-left-most tile. */
161
166
  export declare function gridEntities(): void;
162
167
  /** Alias for the "hearts" command. */
@@ -346,6 +351,8 @@ export declare function trapdoorCommand(): void;
346
351
  export declare function treasure(): void;
347
352
  /** Warps to the first Ultra Secret Room on the floor. */
348
353
  export declare function ultraSecret(): void;
354
+ /** If currently on a set seed, changes to an unseeded state and restarts the game. */
355
+ export declare function unseed(): void;
349
356
  /** Moves the player 0.5 units up. Provide a number to move a custom amount of units. */
350
357
  export declare function up(params: string): void;
351
358
  /**
@@ -76,7 +76,9 @@ local ____rooms = require("functions.rooms")
76
76
  local changeRoom = ____rooms.changeRoom
77
77
  local getRoomGridIndexesForType = ____rooms.getRoomGridIndexesForType
78
78
  local ____run = require("functions.run")
79
+ local onSetSeed = ____run.onSetSeed
79
80
  local restart = ____run.restart
81
+ local setUnseeded = ____run.setUnseeded
80
82
  local ____trinkets = require("functions.trinkets")
81
83
  local getGoldenTrinketType = ____trinkets.getGoldenTrinketType
82
84
  local ____utils = require("functions.utils")
@@ -137,6 +139,10 @@ function ____exports.goldenKey(self)
137
139
  local player = Isaac.GetPlayer()
138
140
  player:AddGoldenKey()
139
141
  end
142
+ --- Alias for the "debug 2" command. Useful for seeing the grid costs of each tile in the room.
143
+ function ____exports.gridCosts(self)
144
+ Isaac.ExecuteCommand("debug 2")
145
+ end
140
146
  --- Gives a half red heart. Provide a number to give a custom amount of hearts. (You can use negative
141
147
  -- numbers to remove hearts.)
142
148
  function ____exports.hearts(self, params)
@@ -583,13 +589,14 @@ end
583
589
  function ____exports.goldKey(self)
584
590
  ____exports.goldenKey(nil)
585
591
  end
586
- --- Alias for the "debug 2" command.
592
+ --- Alias for the "debug 11" command. Useful for seeing the coordinates and grid index of each tile
593
+ -- in the room.
587
594
  function ____exports.grid(self)
588
- Isaac.ExecuteCommand("debug 2")
595
+ Isaac.ExecuteCommand("debug 11")
589
596
  end
590
- --- Alias for the "debug 11" command.
597
+ --- Alias for the "gridCosts" command.
591
598
  function ____exports.grid2(self)
592
- Isaac.ExecuteCommand("debug 11")
599
+ ____exports.gridCosts(nil)
593
600
  end
594
601
  --- Spawns every grid entity, starting at the top-left-most tile.
595
602
  function ____exports.gridEntities(self)
@@ -1075,6 +1082,15 @@ end
1075
1082
  function ____exports.ultraSecret(self)
1076
1083
  warpToRoomType(nil, RoomType.ULTRA_SECRET)
1077
1084
  end
1085
+ --- If currently on a set seed, changes to an unseeded state and restarts the game.
1086
+ function ____exports.unseed(self)
1087
+ if not onSetSeed(nil) then
1088
+ printConsole(nil, "You are not on a set seed, so you cannot unseed the run.")
1089
+ return
1090
+ end
1091
+ setUnseeded(nil)
1092
+ restart(nil)
1093
+ end
1078
1094
  --- Moves the player 0.5 units up. Provide a number to move a custom amount of units.
1079
1095
  function ____exports.up(self, params)
1080
1096
  movePlayer(nil, params, Direction.UP)
@@ -11,8 +11,6 @@ local ____deepCopy = require("functions.deepCopy")
11
11
  local deepCopy = ____deepCopy.deepCopy
12
12
  local ____types = require("functions.types")
13
13
  local isString = ____types.isString
14
- local ____constants = require("features.saveDataManager.constants")
15
- local SAVE_DATA_MANAGER_FEATURE_NAME = ____constants.SAVE_DATA_MANAGER_FEATURE_NAME
16
14
  local ____main = require("features.saveDataManager.main")
17
15
  local forceSaveDataManagerLoad = ____main.forceSaveDataManagerLoad
18
16
  local forceSaveDataManagerSave = ____main.forceSaveDataManagerSave
@@ -21,6 +19,8 @@ local ____maps = require("features.saveDataManager.maps")
21
19
  local saveDataConditionalFuncMap = ____maps.saveDataConditionalFuncMap
22
20
  local saveDataDefaultsMap = ____maps.saveDataDefaultsMap
23
21
  local saveDataMap = ____maps.saveDataMap
22
+ local ____saveDataManagerConstants = require("features.saveDataManager.saveDataManagerConstants")
23
+ local SAVE_DATA_MANAGER_FEATURE_NAME = ____saveDataManagerConstants.SAVE_DATA_MANAGER_FEATURE_NAME
24
24
  --- This is the entry point to the save data manager, a system which provides two major features:
25
25
  --
26
26
  -- 1. automatic resetting of variables on a new run, on a new level, or on a new room (as desired)
@@ -12,11 +12,11 @@ local iterateTableInOrder = ____table.iterateTableInOrder
12
12
  local ____types = require("functions.types")
13
13
  local isString = ____types.isString
14
14
  local isTable = ____types.isTable
15
- local ____constants = require("features.saveDataManager.constants")
16
- local SAVE_DATA_MANAGER_DEBUG = ____constants.SAVE_DATA_MANAGER_DEBUG
17
- local SAVE_DATA_MANAGER_FEATURE_NAME = ____constants.SAVE_DATA_MANAGER_FEATURE_NAME
18
15
  local ____merge = require("features.saveDataManager.merge")
19
16
  local merge = ____merge.merge
17
+ local ____saveDataManagerConstants = require("features.saveDataManager.saveDataManagerConstants")
18
+ local SAVE_DATA_MANAGER_DEBUG = ____saveDataManagerConstants.SAVE_DATA_MANAGER_DEBUG
19
+ local SAVE_DATA_MANAGER_FEATURE_NAME = ____saveDataManagerConstants.SAVE_DATA_MANAGER_FEATURE_NAME
20
20
  function readSaveDatFile(self, mod)
21
21
  local renderFrameCount = Isaac.GetFrameCount()
22
22
  local ok, jsonStringOrErrMsg = pcall(tryLoadModData, mod)
@@ -21,9 +21,6 @@ local logError = ____log.logError
21
21
  local ____table = require("functions.table")
22
22
  local clearTable = ____table.clearTable
23
23
  local iterateTableInOrder = ____table.iterateTableInOrder
24
- local ____constants = require("features.saveDataManager.constants")
25
- local SAVE_DATA_MANAGER_DEBUG = ____constants.SAVE_DATA_MANAGER_DEBUG
26
- local SAVE_DATA_MANAGER_FEATURE_NAME = ____constants.SAVE_DATA_MANAGER_FEATURE_NAME
27
24
  local ____load = require("features.saveDataManager.load")
28
25
  local loadFromDisk = ____load.loadFromDisk
29
26
  local ____maps = require("features.saveDataManager.maps")
@@ -32,6 +29,9 @@ local saveDataDefaultsMap = ____maps.saveDataDefaultsMap
32
29
  local saveDataMap = ____maps.saveDataMap
33
30
  local ____save = require("features.saveDataManager.save")
34
31
  local saveToDisk = ____save.saveToDisk
32
+ local ____saveDataManagerConstants = require("features.saveDataManager.saveDataManagerConstants")
33
+ local SAVE_DATA_MANAGER_DEBUG = ____saveDataManagerConstants.SAVE_DATA_MANAGER_DEBUG
34
+ local SAVE_DATA_MANAGER_FEATURE_NAME = ____saveDataManagerConstants.SAVE_DATA_MANAGER_FEATURE_NAME
35
35
  function postPlayerInit(self)
36
36
  if mod == nil then
37
37
  error(("The mod for the " .. SAVE_DATA_MANAGER_FEATURE_NAME) .. " was not initialized.")
@@ -26,8 +26,8 @@ local ____types = require("functions.types")
26
26
  local isTable = ____types.isTable
27
27
  local ____utils = require("functions.utils")
28
28
  local getTraversalDescription = ____utils.getTraversalDescription
29
- local ____constants = require("features.saveDataManager.constants")
30
- local SAVE_DATA_MANAGER_DEBUG = ____constants.SAVE_DATA_MANAGER_DEBUG
29
+ local ____saveDataManagerConstants = require("features.saveDataManager.saveDataManagerConstants")
30
+ local SAVE_DATA_MANAGER_DEBUG = ____saveDataManagerConstants.SAVE_DATA_MANAGER_DEBUG
31
31
  local ____serializationBrand = require("features.saveDataManager.serializationBrand")
32
32
  local isSerializationBrand = ____serializationBrand.isSerializationBrand
33
33
  --- `merge` takes the values from a new table and recursively merges them into an old object (while