isaacscript-common 6.2.1 → 6.3.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.
- package/callbacks/reorderedCallbacks.d.ts +9 -0
- package/callbacks/reorderedCallbacks.lua +9 -0
- package/constants.d.ts +9 -0
- package/constants.lua +7 -0
- package/enums/CornerType.d.ts +6 -0
- package/enums/CornerType.lua +11 -0
- package/features/customStage/backdrop.d.ts +2 -0
- package/features/customStage/backdrop.lua +200 -0
- package/features/customStage/boss.d.ts +2 -0
- package/features/customStage/boss.lua +74 -0
- package/features/customStage/exports.d.ts +1 -0
- package/features/customStage/exports.lua +28 -1
- package/features/customStage/init.d.ts +2 -1
- package/features/customStage/init.lua +39 -10
- package/features/customStage/stageAPIBoss.d.ts +29 -0
- package/features/customStage/stageAPIBoss.lua +9 -0
- package/features/customStage/v.d.ts +7 -0
- package/features/customStage/v.lua +2 -0
- package/features/debugDisplay/debugDisplay.lua +2 -0
- package/features/debugDisplay/exports.d.ts +108 -0
- package/features/debugDisplay/exports.lua +145 -0
- package/features/debugDisplay/v.d.ts +2 -0
- package/features/debugDisplay/v.lua +9 -0
- package/features/extraConsoleCommands/init.lua +8 -1
- package/features/extraConsoleCommands/listCommands.d.ts +12 -4
- package/features/extraConsoleCommands/listCommands.lua +30 -15
- package/features/extraConsoleCommands/v.d.ts +1 -0
- package/features/extraConsoleCommands/v.lua +2 -1
- package/features/pause.d.ts +11 -0
- package/features/pause.lua +71 -0
- package/features/runNextRoom.d.ts +8 -0
- package/features/runNextRoom.lua +40 -0
- package/functions/chargeBar.lua +4 -6
- package/functions/direction.d.ts +1 -1
- package/functions/doors.d.ts +2 -2
- package/functions/playerCenter.lua +4 -5
- package/functions/playerIndex.d.ts +3 -0
- package/functions/playerIndex.lua +3 -0
- package/functions/roomShape.d.ts +10 -4
- package/functions/roomShape.lua +15 -2
- package/functions/sprite.d.ts +1 -1
- package/functions/sprite.lua +1 -1
- package/index.d.ts +1 -1
- package/index.lua +2 -0
- package/initFeatures.lua +7 -1
- package/interfaces/Corner.d.ts +6 -0
- package/interfaces/Corner.lua +2 -0
- package/interfaces/CustomStageLua.d.ts +13 -9
- package/objects/roomShapeCorners.d.ts +6 -0
- package/objects/roomShapeCorners.lua +259 -0
- package/objects/roomShapeToBottomRightPosition.d.ts +1 -1
- package/objects/roomShapeToTopLeftPosition.d.ts +1 -1
- package/package.json +1 -1
- package/sets/narrowRoomShapesSet.d.ts +2 -0
- package/sets/narrowRoomShapesSet.lua +8 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LevelStage, StageType } from "isaac-typescript-definitions";
|
|
1
2
|
/**
|
|
2
3
|
* This is a utility function for users of the `ModCallbackCustom.POST_NEW_LEVEL_REORDERED` custom
|
|
3
4
|
* callback.
|
|
@@ -18,3 +19,11 @@ export declare function forceNewLevelCallback(): void;
|
|
|
18
19
|
* temporarily force the callback to fire.
|
|
19
20
|
*/
|
|
20
21
|
export declare function forceNewRoomCallback(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Helper function to manually set the variable that the reordered callback logic uses to track the
|
|
24
|
+
* current stage and stage type.
|
|
25
|
+
*
|
|
26
|
+
* This is useful because if the stage is changed with the `Game.SetStage` method, the reordered
|
|
27
|
+
* callbacks will stop working.
|
|
28
|
+
*/
|
|
29
|
+
export declare function reorderedCallbacksSetStage(stage: LevelStage, stageType: StageType): void;
|
|
@@ -106,4 +106,13 @@ end
|
|
|
106
106
|
function ____exports.forceNewRoomCallback(self)
|
|
107
107
|
forceNewRoom = true
|
|
108
108
|
end
|
|
109
|
+
--- Helper function to manually set the variable that the reordered callback logic uses to track the
|
|
110
|
+
-- current stage and stage type.
|
|
111
|
+
--
|
|
112
|
+
-- This is useful because if the stage is changed with the `Game.SetStage` method, the reordered
|
|
113
|
+
-- callbacks will stop working.
|
|
114
|
+
function ____exports.reorderedCallbacksSetStage(self, stage, stageType)
|
|
115
|
+
currentStage = stage
|
|
116
|
+
currentStageType = stageType
|
|
117
|
+
end
|
|
109
118
|
return ____exports
|
package/constants.d.ts
CHANGED
|
@@ -85,6 +85,15 @@ export declare const LAST_ROOM_TYPE: RoomType;
|
|
|
85
85
|
* effect.
|
|
86
86
|
*/
|
|
87
87
|
export declare const MAX_SPEED_STAT = 2;
|
|
88
|
+
/** This is in the center of the room. */
|
|
89
|
+
export declare const NEW_FLOOR_STARTING_POSITION_NORMAL_MODE: Vector;
|
|
90
|
+
/** This is near the top door. */
|
|
91
|
+
export declare const NEW_FLOOR_STARTING_POSITION_GREED_MODE: Vector;
|
|
92
|
+
/**
|
|
93
|
+
* This is next to the bottom door. Presumably, the player does not start in the center of the room
|
|
94
|
+
* (like they do when getting to a new stage) so that the controls graphic is more visible.
|
|
95
|
+
*/
|
|
96
|
+
export declare const NEW_RUN_PLAYER_STARTING_POSITION: Vector;
|
|
88
97
|
export declare const FIRST_STAGE = LevelStage.BASEMENT_1;
|
|
89
98
|
export declare const LAST_STAGE: LevelStage;
|
|
90
99
|
/** Corresponds to the maximum value for `EntityPlayer.SamsonBerserkCharge`. */
|
package/constants.lua
CHANGED
|
@@ -74,6 +74,13 @@ ____exports.LAST_ROOM_TYPE = getLastEnumValue(nil, RoomType)
|
|
|
74
74
|
--- The maximum speed stat that a player can have. Any additional speed beyond this will not take
|
|
75
75
|
-- effect.
|
|
76
76
|
____exports.MAX_SPEED_STAT = 2
|
|
77
|
+
--- This is in the center of the room.
|
|
78
|
+
____exports.NEW_FLOOR_STARTING_POSITION_NORMAL_MODE = Vector(320, 280)
|
|
79
|
+
--- This is near the top door.
|
|
80
|
+
____exports.NEW_FLOOR_STARTING_POSITION_GREED_MODE = Vector(320, 280)
|
|
81
|
+
--- This is next to the bottom door. Presumably, the player does not start in the center of the room
|
|
82
|
+
-- (like they do when getting to a new stage) so that the controls graphic is more visible.
|
|
83
|
+
____exports.NEW_RUN_PLAYER_STARTING_POSITION = Vector(320, 380)
|
|
77
84
|
____exports.FIRST_STAGE = LevelStage.BASEMENT_1
|
|
78
85
|
____exports.LAST_STAGE = getLastEnumValue(nil, LevelStage)
|
|
79
86
|
--- Corresponds to the maximum value for `EntityPlayer.SamsonBerserkCharge`.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
____exports.CornerType = {}
|
|
3
|
+
____exports.CornerType.TOP_LEFT = 0
|
|
4
|
+
____exports.CornerType[____exports.CornerType.TOP_LEFT] = "TOP_LEFT"
|
|
5
|
+
____exports.CornerType.TOP_RIGHT = 1
|
|
6
|
+
____exports.CornerType[____exports.CornerType.TOP_RIGHT] = "TOP_RIGHT"
|
|
7
|
+
____exports.CornerType.BOTTOM_LEFT = 2
|
|
8
|
+
____exports.CornerType[____exports.CornerType.BOTTOM_LEFT] = "BOTTOM_LEFT"
|
|
9
|
+
____exports.CornerType.BOTTOM_RIGHT = 3
|
|
10
|
+
____exports.CornerType[____exports.CornerType.BOTTOM_RIGHT] = "BOTTOM_RIGHT"
|
|
11
|
+
return ____exports
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local Set = ____lualib.Set
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
4
|
+
local ____exports = {}
|
|
5
|
+
local getBackdropPNGPath, spawnWallEntity, spawnSecondWallEntity, spawnFloorEntity, getNumFloorLayers, BackdropKind, BackdropEntitySubType, ROOM_SHAPE_WALL_ANM2_LAYERS, ROOM_SHAPE_WALL_EXTRA_ANM2_LAYERS, WALL_OFFSET, BACKDROP_EFFECT_VARIANT
|
|
6
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
7
|
+
local EffectVariant = ____isaac_2Dtypescript_2Ddefinitions.EffectVariant
|
|
8
|
+
local EntityFlag = ____isaac_2Dtypescript_2Ddefinitions.EntityFlag
|
|
9
|
+
local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
|
|
10
|
+
local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
|
|
11
|
+
local ____cachedClasses = require("cachedClasses")
|
|
12
|
+
local game = ____cachedClasses.game
|
|
13
|
+
local ____constants = require("constants")
|
|
14
|
+
local VectorZero = ____constants.VectorZero
|
|
15
|
+
local ____array = require("functions.array")
|
|
16
|
+
local getRandomArrayElement = ____array.getRandomArrayElement
|
|
17
|
+
local ____entitySpecific = require("functions.entitySpecific")
|
|
18
|
+
local spawnEffectWithSeed = ____entitySpecific.spawnEffectWithSeed
|
|
19
|
+
local ____rng = require("functions.rng")
|
|
20
|
+
local newRNG = ____rng.newRNG
|
|
21
|
+
local ____roomShape = require("functions.roomShape")
|
|
22
|
+
local isLRoom = ____roomShape.isLRoom
|
|
23
|
+
local isNarrowRoom = ____roomShape.isNarrowRoom
|
|
24
|
+
local ____string = require("functions.string")
|
|
25
|
+
local trimPrefix = ____string.trimPrefix
|
|
26
|
+
local ____utils = require("functions.utils")
|
|
27
|
+
local erange = ____utils.erange
|
|
28
|
+
local irange = ____utils.irange
|
|
29
|
+
function getBackdropPNGPath(self, customStage, backdropKind, rng)
|
|
30
|
+
local pathArray = customStage.backdrop[backdropKind]
|
|
31
|
+
local path = getRandomArrayElement(nil, pathArray, rng)
|
|
32
|
+
return (customStage.backdrop.prefix .. path) .. customStage.backdrop.suffix
|
|
33
|
+
end
|
|
34
|
+
function spawnWallEntity(self, customStage, rng, isExtraWall)
|
|
35
|
+
local room = game:GetRoom()
|
|
36
|
+
local roomShape = room:GetRoomShape()
|
|
37
|
+
local subType = isExtraWall and BackdropEntitySubType.WALL_EXTRA or BackdropEntitySubType.WALL
|
|
38
|
+
local wallEffect = spawnEffectWithSeed(
|
|
39
|
+
nil,
|
|
40
|
+
BACKDROP_EFFECT_VARIANT,
|
|
41
|
+
subType,
|
|
42
|
+
VectorZero,
|
|
43
|
+
1
|
|
44
|
+
)
|
|
45
|
+
wallEffect:AddEntityFlags(EntityFlag.RENDER_WALL)
|
|
46
|
+
local sprite = wallEffect:GetSprite()
|
|
47
|
+
sprite:Load("gfx/isaacscript-custom-stage/wall-backdrop.anm2", false)
|
|
48
|
+
local wallLayersArray = isExtraWall and ROOM_SHAPE_WALL_EXTRA_ANM2_LAYERS or ROOM_SHAPE_WALL_ANM2_LAYERS
|
|
49
|
+
local numWallLayers = wallLayersArray[roomShape]
|
|
50
|
+
if numWallLayers == nil then
|
|
51
|
+
error("Failed to get the layers when creating the backdrop for custom stage: " .. customStage.name)
|
|
52
|
+
end
|
|
53
|
+
if isLRoom(nil, roomShape) then
|
|
54
|
+
local cornerPNGPath = getBackdropPNGPath(nil, customStage, BackdropKind.CORNER, rng)
|
|
55
|
+
sprite:ReplaceSpritesheet(0, cornerPNGPath)
|
|
56
|
+
end
|
|
57
|
+
for ____, layerID in ipairs(irange(nil, 1, numWallLayers)) do
|
|
58
|
+
local wallPNGPath = getBackdropPNGPath(nil, customStage, BackdropKind.WALL, rng)
|
|
59
|
+
sprite:ReplaceSpritesheet(layerID, wallPNGPath)
|
|
60
|
+
end
|
|
61
|
+
local topLeftPos = room:GetTopLeftPos()
|
|
62
|
+
local renderPos = topLeftPos + WALL_OFFSET
|
|
63
|
+
local modifiedOffset = renderPos / 40 * 26
|
|
64
|
+
wallEffect.SpriteOffset = modifiedOffset
|
|
65
|
+
sprite:LoadGraphics()
|
|
66
|
+
local roomShapeName = RoomShape[roomShape]
|
|
67
|
+
local animation = trimPrefix(nil, roomShapeName, "SHAPE_")
|
|
68
|
+
local modifiedAnimation = isExtraWall and animation .. "X" or animation
|
|
69
|
+
sprite:Play(modifiedAnimation, true)
|
|
70
|
+
end
|
|
71
|
+
function spawnSecondWallEntity(self, customStage, rng)
|
|
72
|
+
local room = game:GetRoom()
|
|
73
|
+
local roomShape = room:GetRoomShape()
|
|
74
|
+
local extraLayers = ROOM_SHAPE_WALL_EXTRA_ANM2_LAYERS[roomShape]
|
|
75
|
+
local roomShapeHasExtraLayers = extraLayers ~= nil
|
|
76
|
+
if roomShapeHasExtraLayers then
|
|
77
|
+
spawnWallEntity(nil, customStage, rng, true)
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
function spawnFloorEntity(self, customStage, rng)
|
|
81
|
+
local room = game:GetRoom()
|
|
82
|
+
local roomShape = room:GetRoomShape()
|
|
83
|
+
local floorEffect = spawnEffectWithSeed(
|
|
84
|
+
nil,
|
|
85
|
+
BACKDROP_EFFECT_VARIANT,
|
|
86
|
+
BackdropEntitySubType.FLOOR,
|
|
87
|
+
VectorZero,
|
|
88
|
+
1
|
|
89
|
+
)
|
|
90
|
+
floorEffect:AddEntityFlags(EntityFlag.RENDER_FLOOR)
|
|
91
|
+
local sprite = floorEffect:GetSprite()
|
|
92
|
+
sprite:Load("gfx/isaacscript-custom-stage/floor-backdrop.anm2", false)
|
|
93
|
+
local numFloorLayers = getNumFloorLayers(nil, roomShape)
|
|
94
|
+
if numFloorLayers ~= nil then
|
|
95
|
+
for ____, layerID in ipairs(erange(nil, 0, numFloorLayers)) do
|
|
96
|
+
local wallPNGPath = getBackdropPNGPath(nil, customStage, BackdropKind.WALL, rng)
|
|
97
|
+
sprite:ReplaceSpritesheet(layerID, wallPNGPath)
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
if isLRoom(nil, roomShape) then
|
|
101
|
+
for ____, layerID in ipairs({16, 17}) do
|
|
102
|
+
local LFloorPNGPath = getBackdropPNGPath(nil, customStage, BackdropKind.L_FLOOR, rng)
|
|
103
|
+
sprite:ReplaceSpritesheet(layerID, LFloorPNGPath)
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
if isNarrowRoom(nil, roomShape) then
|
|
107
|
+
for ____, layerID in ipairs({18, 19}) do
|
|
108
|
+
local NFloorPNGPath = getBackdropPNGPath(nil, customStage, BackdropKind.N_FLOOR, rng)
|
|
109
|
+
sprite:ReplaceSpritesheet(layerID, NFloorPNGPath)
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
local topLeftPos = room:GetTopLeftPos()
|
|
113
|
+
local renderPos = topLeftPos
|
|
114
|
+
local modifiedOffset = renderPos / 40 * 26
|
|
115
|
+
floorEffect.SpriteOffset = modifiedOffset
|
|
116
|
+
sprite:LoadGraphics()
|
|
117
|
+
local roomShapeName = RoomShape[roomShape]
|
|
118
|
+
local animation = trimPrefix(nil, roomShapeName, "SHAPE_")
|
|
119
|
+
sprite:Play(animation, true)
|
|
120
|
+
end
|
|
121
|
+
function getNumFloorLayers(self, roomShape)
|
|
122
|
+
repeat
|
|
123
|
+
local ____switch23 = roomShape
|
|
124
|
+
local ____cond23 = ____switch23 == RoomShape.SHAPE_1x1
|
|
125
|
+
if ____cond23 then
|
|
126
|
+
do
|
|
127
|
+
return 4
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
____cond23 = ____cond23 or (____switch23 == RoomShape.SHAPE_1x2 or ____switch23 == RoomShape.SHAPE_2x1)
|
|
131
|
+
if ____cond23 then
|
|
132
|
+
do
|
|
133
|
+
return 8
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
____cond23 = ____cond23 or ____switch23 == RoomShape.SHAPE_2x2
|
|
137
|
+
if ____cond23 then
|
|
138
|
+
do
|
|
139
|
+
return 16
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
do
|
|
143
|
+
do
|
|
144
|
+
return nil
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
until true
|
|
148
|
+
end
|
|
149
|
+
BackdropKind = BackdropKind or ({})
|
|
150
|
+
BackdropKind.N_FLOOR = "nFloors"
|
|
151
|
+
BackdropKind.L_FLOOR = "lFloors"
|
|
152
|
+
BackdropKind.WALL = "walls"
|
|
153
|
+
BackdropKind.CORNER = "corners"
|
|
154
|
+
BackdropEntitySubType = BackdropEntitySubType or ({})
|
|
155
|
+
BackdropEntitySubType.VANILLA_LADDER = 0
|
|
156
|
+
BackdropEntitySubType[BackdropEntitySubType.VANILLA_LADDER] = "VANILLA_LADDER"
|
|
157
|
+
BackdropEntitySubType.WALL = 1
|
|
158
|
+
BackdropEntitySubType[BackdropEntitySubType.WALL] = "WALL"
|
|
159
|
+
BackdropEntitySubType.WALL_EXTRA = 2
|
|
160
|
+
BackdropEntitySubType[BackdropEntitySubType.WALL_EXTRA] = "WALL_EXTRA"
|
|
161
|
+
BackdropEntitySubType.FLOOR = 3
|
|
162
|
+
BackdropEntitySubType[BackdropEntitySubType.FLOOR] = "FLOOR"
|
|
163
|
+
ROOM_SHAPE_WALL_ANM2_LAYERS = {
|
|
164
|
+
[RoomShape.SHAPE_1x1] = 44,
|
|
165
|
+
[RoomShape.IH] = 36,
|
|
166
|
+
[RoomShape.IV] = 28,
|
|
167
|
+
[RoomShape.SHAPE_1x2] = 58,
|
|
168
|
+
[RoomShape.IIV] = 42,
|
|
169
|
+
[RoomShape.SHAPE_2x1] = 63,
|
|
170
|
+
[RoomShape.IIH] = 62,
|
|
171
|
+
[RoomShape.SHAPE_2x2] = 63,
|
|
172
|
+
[RoomShape.LTL] = 63,
|
|
173
|
+
[RoomShape.LTR] = 63,
|
|
174
|
+
[RoomShape.LBL] = 63,
|
|
175
|
+
[RoomShape.LBR] = 63
|
|
176
|
+
}
|
|
177
|
+
ROOM_SHAPE_WALL_EXTRA_ANM2_LAYERS = {
|
|
178
|
+
[RoomShape.SHAPE_2x1] = 7,
|
|
179
|
+
[RoomShape.SHAPE_2x2] = 21,
|
|
180
|
+
[RoomShape.LTL] = 19,
|
|
181
|
+
[RoomShape.LTR] = 19,
|
|
182
|
+
[RoomShape.LBL] = 19,
|
|
183
|
+
[RoomShape.LBR] = 19
|
|
184
|
+
}
|
|
185
|
+
WALL_OFFSET = Vector(-80, -80)
|
|
186
|
+
BACKDROP_EFFECT_VARIANT = EffectVariant.LADDER
|
|
187
|
+
local BACKDROP_ROOM_TYPE_SET = __TS__New(Set, {RoomType.DEFAULT, RoomType.BOSS, RoomType.MINI_BOSS})
|
|
188
|
+
function ____exports.setBackdrop(self, customStage)
|
|
189
|
+
local room = game:GetRoom()
|
|
190
|
+
local roomType = room:GetType()
|
|
191
|
+
local decorationSeed = room:GetDecorationSeed()
|
|
192
|
+
local rng = newRNG(nil, decorationSeed)
|
|
193
|
+
if not BACKDROP_ROOM_TYPE_SET:has(roomType) then
|
|
194
|
+
return
|
|
195
|
+
end
|
|
196
|
+
spawnWallEntity(nil, customStage, rng, false)
|
|
197
|
+
spawnSecondWallEntity(nil, customStage, rng)
|
|
198
|
+
spawnFloorEntity(nil, customStage, rng)
|
|
199
|
+
end
|
|
200
|
+
return ____exports
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
3
|
+
local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
|
|
4
|
+
local SoundEffect = ____isaac_2Dtypescript_2Ddefinitions.SoundEffect
|
|
5
|
+
local ____cachedClasses = require("cachedClasses")
|
|
6
|
+
local game = ____cachedClasses.game
|
|
7
|
+
local sfxManager = ____cachedClasses.sfxManager
|
|
8
|
+
local ____pause = require("features.pause")
|
|
9
|
+
local pause = ____pause.pause
|
|
10
|
+
local unpause = ____pause.unpause
|
|
11
|
+
local ____v = require("features.customStage.v")
|
|
12
|
+
local v = ____v.default
|
|
13
|
+
local VERSUS_SCREEN_ANIMATION = "Scene"
|
|
14
|
+
--- Taken from StageAPI. I do not know why rendering in a certain order is necessary, but otherwise
|
|
15
|
+
-- the overlay layer will be on top of everything else and will hide the other elements.
|
|
16
|
+
local VERSUS_SCREEN_LAYER_RENDER_ORDER = {
|
|
17
|
+
0,
|
|
18
|
+
1,
|
|
19
|
+
2,
|
|
20
|
+
3,
|
|
21
|
+
9,
|
|
22
|
+
14,
|
|
23
|
+
13,
|
|
24
|
+
4,
|
|
25
|
+
5,
|
|
26
|
+
12,
|
|
27
|
+
11,
|
|
28
|
+
6,
|
|
29
|
+
7,
|
|
30
|
+
8,
|
|
31
|
+
10
|
|
32
|
+
}
|
|
33
|
+
local versusScreenSprite = Sprite()
|
|
34
|
+
versusScreenSprite:Load("gfx/ui/boss/versusscreen.anm2", true)
|
|
35
|
+
function ____exports.playBossRoomAnimation(self, force)
|
|
36
|
+
if force == nil then
|
|
37
|
+
force = false
|
|
38
|
+
end
|
|
39
|
+
local room = game:GetRoom()
|
|
40
|
+
local roomType = room:GetType()
|
|
41
|
+
local hud = game:GetHUD()
|
|
42
|
+
if roomType ~= RoomType.BOSS and not force then
|
|
43
|
+
return
|
|
44
|
+
end
|
|
45
|
+
v.run.showingBossVersusScreen = true
|
|
46
|
+
pause(nil)
|
|
47
|
+
hud:SetVisible(false)
|
|
48
|
+
versusScreenSprite:Play(VERSUS_SCREEN_ANIMATION, true)
|
|
49
|
+
versusScreenSprite.PlaybackSpeed = 0.5
|
|
50
|
+
end
|
|
51
|
+
local function finishBossRoomAnimation(self)
|
|
52
|
+
local hud = game:GetHUD()
|
|
53
|
+
v.run.showingBossVersusScreen = false
|
|
54
|
+
unpause(nil)
|
|
55
|
+
hud:SetVisible(true)
|
|
56
|
+
sfxManager:Play(SoundEffect.CASTLE_PORTCULLIS)
|
|
57
|
+
end
|
|
58
|
+
function ____exports.bossPostRender(self)
|
|
59
|
+
if not v.run.showingBossVersusScreen then
|
|
60
|
+
return
|
|
61
|
+
end
|
|
62
|
+
if versusScreenSprite:IsFinished(VERSUS_SCREEN_ANIMATION) then
|
|
63
|
+
finishBossRoomAnimation(nil)
|
|
64
|
+
return
|
|
65
|
+
end
|
|
66
|
+
local room = game:GetRoom()
|
|
67
|
+
local centerPos = room:GetCenterPos()
|
|
68
|
+
local position = Isaac.WorldToRenderPosition(centerPos)
|
|
69
|
+
for ____, layerID in ipairs(VERSUS_SCREEN_LAYER_RENDER_ORDER) do
|
|
70
|
+
versusScreenSprite:RenderLayer(layerID, position)
|
|
71
|
+
end
|
|
72
|
+
versusScreenSprite:Update()
|
|
73
|
+
end
|
|
74
|
+
return ____exports
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local Map = ____lualib.Map
|
|
3
3
|
local ____exports = {}
|
|
4
|
+
local postRoomTransition
|
|
4
5
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
5
6
|
local Direction = ____isaac_2Dtypescript_2Ddefinitions.Direction
|
|
6
7
|
local GridRoom = ____isaac_2Dtypescript_2Ddefinitions.GridRoom
|
|
@@ -10,8 +11,13 @@ local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
|
|
|
10
11
|
local StageType = ____isaac_2Dtypescript_2Ddefinitions.StageType
|
|
11
12
|
local ____cachedClasses = require("cachedClasses")
|
|
12
13
|
local game = ____cachedClasses.game
|
|
14
|
+
local ____reorderedCallbacks = require("callbacks.reorderedCallbacks")
|
|
15
|
+
local reorderedCallbacksSetStage = ____reorderedCallbacks.reorderedCallbacksSetStage
|
|
13
16
|
local ____log = require("functions.log")
|
|
17
|
+
local log = ____log.log
|
|
14
18
|
local logError = ____log.logError
|
|
19
|
+
local ____playerCenter = require("functions.playerCenter")
|
|
20
|
+
local movePlayersToCenter = ____playerCenter.movePlayersToCenter
|
|
15
21
|
local ____rng = require("functions.rng")
|
|
16
22
|
local newRNG = ____rng.newRNG
|
|
17
23
|
local ____roomData = require("functions.roomData")
|
|
@@ -21,11 +27,19 @@ local getRooms = ____rooms.getRooms
|
|
|
21
27
|
local ____stage = require("functions.stage")
|
|
22
28
|
local getGotoCommand = ____stage.getGotoCommand
|
|
23
29
|
local setStage = ____stage.setStage
|
|
30
|
+
local ____runNextRoom = require("features.runNextRoom")
|
|
31
|
+
local runNextRoom = ____runNextRoom.runNextRoom
|
|
32
|
+
local ____boss = require("features.customStage.boss")
|
|
33
|
+
local playBossRoomAnimation = ____boss.playBossRoomAnimation
|
|
24
34
|
local ____util = require("features.customStage.util")
|
|
25
35
|
local getRandomCustomStageRoom = ____util.getRandomCustomStageRoom
|
|
26
36
|
local ____v = require("features.customStage.v")
|
|
37
|
+
local v = ____v.default
|
|
27
38
|
local customStageCachedRoomData = ____v.customStageCachedRoomData
|
|
28
39
|
local customStagesMap = ____v.customStagesMap
|
|
40
|
+
function postRoomTransition(self)
|
|
41
|
+
movePlayersToCenter(nil)
|
|
42
|
+
end
|
|
29
43
|
--- Helper function to warp to a custom stage/level.
|
|
30
44
|
--
|
|
31
45
|
-- Custom stages/levels must first be defined in the "tsconfig.json" file. See the documentation for
|
|
@@ -43,6 +57,7 @@ function ____exports.setCustomStage(self, name, verbose)
|
|
|
43
57
|
local seeds = game:GetSeeds()
|
|
44
58
|
local startSeed = seeds:GetStartSeed()
|
|
45
59
|
local rng = newRNG(nil, startSeed)
|
|
60
|
+
v.run.currentCustomStage = customStage
|
|
46
61
|
setStage(nil, customStage.baseStage, customStage.baseStageType)
|
|
47
62
|
for ____, room in ipairs(getRooms(nil)) do
|
|
48
63
|
do
|
|
@@ -88,7 +103,19 @@ function ____exports.setCustomStage(self, name, verbose)
|
|
|
88
103
|
end
|
|
89
104
|
::__continue4::
|
|
90
105
|
end
|
|
91
|
-
|
|
106
|
+
local stage = -1
|
|
107
|
+
local stageType = StageType.WRATH_OF_THE_LAMB
|
|
108
|
+
level:SetStage(stage, stageType)
|
|
109
|
+
reorderedCallbacksSetStage(nil, stage, stageType)
|
|
92
110
|
game:StartRoomTransition(startingRoomGridIndex, Direction.NO_DIRECTION, RoomTransitionAnim.FADE)
|
|
111
|
+
runNextRoom(nil, postRoomTransition)
|
|
112
|
+
end
|
|
113
|
+
function ____exports.setCustomStageDebug(self)
|
|
114
|
+
local customStage = v.run.currentCustomStage
|
|
115
|
+
if customStage == nil then
|
|
116
|
+
log("No custom stage is currently loaded.")
|
|
117
|
+
return
|
|
118
|
+
end
|
|
119
|
+
playBossRoomAnimation(nil, true)
|
|
93
120
|
end
|
|
94
121
|
return ____exports
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { ModUpgraded } from "../../classes/ModUpgraded";
|
|
2
|
+
export declare function customStageInit(mod: ModUpgraded): void;
|
|
@@ -3,12 +3,35 @@ 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, postNewRoomReordered
|
|
7
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
8
|
+
local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
|
|
9
|
+
local ____ModCallbackCustom = require("enums.ModCallbackCustom")
|
|
10
|
+
local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
|
|
7
11
|
local ____array = require("functions.array")
|
|
8
12
|
local isArray = ____array.isArray
|
|
13
|
+
local ____exports = require("features.saveDataManager.exports")
|
|
14
|
+
local saveDataManager = ____exports.saveDataManager
|
|
15
|
+
local ____backdrop = require("features.customStage.backdrop")
|
|
16
|
+
local setBackdrop = ____backdrop.setBackdrop
|
|
17
|
+
local ____boss = require("features.customStage.boss")
|
|
18
|
+
local bossPostRender = ____boss.bossPostRender
|
|
19
|
+
local playBossRoomAnimation = ____boss.playBossRoomAnimation
|
|
9
20
|
local metadataJSON = require("features.customStage.metadata")
|
|
10
21
|
local ____v = require("features.customStage.v")
|
|
22
|
+
local v = ____v.default
|
|
11
23
|
local customStagesMap = ____v.customStagesMap
|
|
24
|
+
function initRoomTypeMaps(self)
|
|
25
|
+
local customStagesLua = metadataJSON
|
|
26
|
+
if not isArray(nil, customStagesLua) then
|
|
27
|
+
error("The IsaacScript standard library attempted to read the custom stage metadata from the \"metadata.lua\" file, but it was not an array.")
|
|
28
|
+
end
|
|
29
|
+
for ____, customStageLua in ipairs(customStagesLua) do
|
|
30
|
+
local roomTypeMap = getRoomTypeMap(nil, customStageLua)
|
|
31
|
+
local customStage = __TS__ObjectAssign({}, customStageLua, {roomTypeMap = roomTypeMap})
|
|
32
|
+
customStagesMap:set(customStage.name, customStage)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
12
35
|
function getRoomTypeMap(self, customStageLua)
|
|
13
36
|
local roomTypeMap = __TS__New(Map)
|
|
14
37
|
for ____, roomMetadata in ipairs(customStageLua.roomsMetadata) do
|
|
@@ -34,15 +57,21 @@ function getRoomTypeMap(self, customStageLua)
|
|
|
34
57
|
end
|
|
35
58
|
return roomTypeMap
|
|
36
59
|
end
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
local customStage = __TS__ObjectAssign({}, customStageLua, {roomTypeMap = roomTypeMap})
|
|
45
|
-
customStagesMap:set(customStage.name, customStage)
|
|
60
|
+
function postRender(self)
|
|
61
|
+
bossPostRender(nil)
|
|
62
|
+
end
|
|
63
|
+
function postNewRoomReordered(self)
|
|
64
|
+
local customStage = v.run.currentCustomStage
|
|
65
|
+
if customStage == nil then
|
|
66
|
+
return
|
|
46
67
|
end
|
|
68
|
+
setBackdrop(nil, customStage)
|
|
69
|
+
playBossRoomAnimation(nil)
|
|
70
|
+
end
|
|
71
|
+
function ____exports.customStageInit(self, mod)
|
|
72
|
+
saveDataManager(nil, "customStage", v)
|
|
73
|
+
initRoomTypeMaps(nil)
|
|
74
|
+
mod:AddCallback(ModCallback.POST_RENDER, postRender)
|
|
75
|
+
mod:AddCallbackCustom(ModCallbackCustom.POST_NEW_ROOM_REORDERED, postNewRoomReordered)
|
|
47
76
|
end
|
|
48
77
|
return ____exports
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
3
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
4
|
+
interface ParamTable {
|
|
5
|
+
BossPortrait?: string;
|
|
6
|
+
BossPortraitTwo?: string;
|
|
7
|
+
BossName?: string;
|
|
8
|
+
BossSpot?: string;
|
|
9
|
+
PlayerPortrait?: string;
|
|
10
|
+
PlayerName?: string;
|
|
11
|
+
PlayerSpot?: string;
|
|
12
|
+
Unskippable?: boolean;
|
|
13
|
+
BackgroundColor?: Color;
|
|
14
|
+
DirtColor?: Color;
|
|
15
|
+
NoShake?: boolean;
|
|
16
|
+
Animation?: string;
|
|
17
|
+
Sprite?: Sprite;
|
|
18
|
+
NoLoadGraphics?: boolean;
|
|
19
|
+
BossOffset?: Vector;
|
|
20
|
+
}
|
|
21
|
+
declare const StageAPILocal: {
|
|
22
|
+
BossSprite: Sprite | undefined;
|
|
23
|
+
BossSpriteBg: Sprite | undefined;
|
|
24
|
+
BossSpriteDirt: Sprite | undefined;
|
|
25
|
+
PlayingBossSprite: Sprite | undefined;
|
|
26
|
+
PlayingBossSpriteBg: Sprite | undefined;
|
|
27
|
+
PlayingBossSpriteDirt: Sprite | undefined;
|
|
28
|
+
BossOffset: Vector | undefined;
|
|
29
|
+
};
|
|
@@ -1,5 +1,12 @@
|
|
|
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
|
+
showingBossVersusScreen: boolean;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export default v;
|
|
3
10
|
/** Indexed by custom stage name. */
|
|
4
11
|
export declare const customStagesMap: Map<string, CustomStage>;
|
|
5
12
|
/** Indexed by room variant. */
|
|
@@ -2,6 +2,8 @@ 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}}
|
|
6
|
+
____exports.default = v
|
|
5
7
|
--- Indexed by custom stage name.
|
|
6
8
|
____exports.customStagesMap = __TS__New(Map)
|
|
7
9
|
--- Indexed by room variant.
|
|
@@ -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",
|