isaacscript-common 1.2.227 → 1.2.230
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants.d.ts +1 -0
- package/dist/constants.lua +1 -0
- package/dist/features/deployJSONRoom.lua +2 -1
- package/dist/features/extraConsoleCommands/commands.lua +2 -1
- package/dist/functions/chargeBar.d.ts +19 -0
- package/dist/functions/chargeBar.lua +42 -0
- package/dist/functions/roomGrid.d.ts +20 -0
- package/dist/functions/roomGrid.lua +28 -0
- package/dist/functions/roomShape.d.ts +31 -0
- package/dist/functions/roomShape.lua +17 -5
- package/dist/functions/rooms.d.ts +0 -5
- package/dist/functions/rooms.lua +2 -9
- package/dist/index.d.ts +2 -0
- package/dist/index.lua +16 -0
- package/dist/objects/roomShapeBounds.d.ts +8 -0
- package/dist/objects/roomShapeBounds.lua +24 -0
- package/dist/objects/roomShapeLayoutSizes.d.ts +10 -0
- package/dist/objects/roomShapeLayoutSizes.lua +25 -0
- package/dist/objects/roomShapeToDoorSlotsToGridIndexDelta.d.ts +8 -0
- package/dist/objects/roomShapeToDoorSlotsToGridIndexDelta.lua +85 -0
- package/dist/objects/roomShapeVolumes.d.ts +13 -0
- package/dist/objects/roomShapeVolumes.lua +27 -0
- package/package.json +2 -2
package/dist/constants.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export declare const FIRST_GLITCHED_COLLECTIBLE_TYPE: number;
|
|
|
37
37
|
export declare const GAME_FRAMES_PER_SECOND = 30;
|
|
38
38
|
export declare const GRID_INDEX_CENTER_OF_1X1_ROOM = 67;
|
|
39
39
|
export declare const ISAAC_FRAMES_PER_SECOND = 60;
|
|
40
|
+
export declare const LEVEL_GRID_COLUMN_HEIGHT = 13;
|
|
40
41
|
export declare const LEVEL_GRID_ROW_LENGTH = 13;
|
|
41
42
|
/** In a 2x2 room, there can be 8 doors. */
|
|
42
43
|
export declare const MAX_NUM_DOORS = 8;
|
package/dist/constants.lua
CHANGED
|
@@ -13,6 +13,7 @@ ____exports.FIRST_GLITCHED_COLLECTIBLE_TYPE = (1 << 32) - 1
|
|
|
13
13
|
____exports.GAME_FRAMES_PER_SECOND = 30
|
|
14
14
|
____exports.GRID_INDEX_CENTER_OF_1X1_ROOM = 67
|
|
15
15
|
____exports.ISAAC_FRAMES_PER_SECOND = 60
|
|
16
|
+
____exports.LEVEL_GRID_COLUMN_HEIGHT = 13
|
|
16
17
|
____exports.LEVEL_GRID_ROW_LENGTH = 13
|
|
17
18
|
____exports.MAX_NUM_DOORS = 8
|
|
18
19
|
____exports.MAX_NUM_FAMILIARS = 64
|
|
@@ -38,8 +38,9 @@ local isRNG = ____rng.isRNG
|
|
|
38
38
|
local newRNG = ____rng.newRNG
|
|
39
39
|
local ____roomData = require("functions.roomData")
|
|
40
40
|
local getRoomListIndex = ____roomData.getRoomListIndex
|
|
41
|
+
local ____roomGrid = require("functions.roomGrid")
|
|
42
|
+
local gridToPos = ____roomGrid.gridToPos
|
|
41
43
|
local ____rooms = require("functions.rooms")
|
|
42
|
-
local gridToPos = ____rooms.gridToPos
|
|
43
44
|
local setRoomCleared = ____rooms.setRoomCleared
|
|
44
45
|
local setRoomUncleared = ____rooms.setRoomUncleared
|
|
45
46
|
local ____spawnCollectible = require("functions.spawnCollectible")
|
|
@@ -41,10 +41,11 @@ local getPlayers = ____playerIndex.getPlayers
|
|
|
41
41
|
local ____roomData = require("functions.roomData")
|
|
42
42
|
local getRoomData = ____roomData.getRoomData
|
|
43
43
|
local getRoomDescriptor = ____roomData.getRoomDescriptor
|
|
44
|
+
local ____roomGrid = require("functions.roomGrid")
|
|
45
|
+
local gridToPos = ____roomGrid.gridToPos
|
|
44
46
|
local ____rooms = require("functions.rooms")
|
|
45
47
|
local changeRoom = ____rooms.changeRoom
|
|
46
48
|
local getRoomGridIndexesForType = ____rooms.getRoomGridIndexesForType
|
|
47
|
-
local gridToPos = ____rooms.gridToPos
|
|
48
49
|
local ____run = require("functions.run")
|
|
49
50
|
local restart = ____run.restart
|
|
50
51
|
local ____utils = require("functions.utils")
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/** A collection of the four sprites necessary in order to render a charge bar. */
|
|
3
|
+
export interface ChargeBarSprites {
|
|
4
|
+
back: Sprite;
|
|
5
|
+
meter: Sprite;
|
|
6
|
+
meterBattery: Sprite;
|
|
7
|
+
lines: Sprite;
|
|
8
|
+
maxCharges: int;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Constructor for a `ChargeBarSprites` object. For more information, see the `renderChargeBar`
|
|
12
|
+
* helper function.
|
|
13
|
+
*/
|
|
14
|
+
export declare function newChargeBarSprites(maxCharges: int): ChargeBarSprites;
|
|
15
|
+
/**
|
|
16
|
+
* Helper function to render a charge bar on the screen. First, call the `newChargeBarSprites`
|
|
17
|
+
* function to initialize the sprites, and then call this function on every render frame.
|
|
18
|
+
*/
|
|
19
|
+
export declare function renderChargeBar(sprites: ChargeBarSprites, position: Vector, normalCharges: int, batteryCharges: int): void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
local getChargeBarClamp
|
|
4
|
+
function getChargeBarClamp(self, charges, maxCharges)
|
|
5
|
+
local meterMultiplier = 24 / maxCharges
|
|
6
|
+
local meterClip = 26 - charges * meterMultiplier
|
|
7
|
+
return Vector(0, meterClip)
|
|
8
|
+
end
|
|
9
|
+
local CHARGE_BAR_ANM2 = "gfx/ui/ui_chargebar.anm2"
|
|
10
|
+
function ____exports.newChargeBarSprites(self, maxCharges)
|
|
11
|
+
local back = Sprite()
|
|
12
|
+
back:Load(CHARGE_BAR_ANM2, true)
|
|
13
|
+
back:Play("BarEmpty", true)
|
|
14
|
+
local meter = Sprite()
|
|
15
|
+
meter:Load(CHARGE_BAR_ANM2, true)
|
|
16
|
+
meter:Play("BarFull", true)
|
|
17
|
+
local meterBattery = Sprite()
|
|
18
|
+
meterBattery:Load(CHARGE_BAR_ANM2, true)
|
|
19
|
+
meterBattery:Play("BarFull", true)
|
|
20
|
+
local lines = Sprite()
|
|
21
|
+
lines:Load(CHARGE_BAR_ANM2, true)
|
|
22
|
+
lines:Play(
|
|
23
|
+
"BarOverlay" .. tostring(maxCharges),
|
|
24
|
+
true
|
|
25
|
+
)
|
|
26
|
+
return {
|
|
27
|
+
back = back,
|
|
28
|
+
meter = meter,
|
|
29
|
+
meterBattery = meterBattery,
|
|
30
|
+
lines = lines,
|
|
31
|
+
maxCharges = maxCharges
|
|
32
|
+
}
|
|
33
|
+
end
|
|
34
|
+
function ____exports.renderChargeBar(self, sprites, position, normalCharges, batteryCharges)
|
|
35
|
+
sprites.back:Render(position, Vector.Zero, Vector.Zero)
|
|
36
|
+
local normalChargesClamp = getChargeBarClamp(nil, normalCharges, sprites.maxCharges)
|
|
37
|
+
sprites.meter:Render(position, normalChargesClamp, Vector.Zero)
|
|
38
|
+
local batteryChargesClamp = getChargeBarClamp(nil, batteryCharges, sprites.maxCharges)
|
|
39
|
+
sprites.meterBattery:Render(position, batteryChargesClamp, Vector.Zero)
|
|
40
|
+
sprites.lines:Render(position, Vector.Zero, Vector.Zero)
|
|
41
|
+
end
|
|
42
|
+
return ____exports
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/**
|
|
3
|
+
* Helper function to convert a room X and Y coordinate to a position.
|
|
4
|
+
*
|
|
5
|
+
* For example, the coordinates of 0, 0 are equal to `Vector(80, 160)`.
|
|
6
|
+
*
|
|
7
|
+
* This function will crash the game if it is called in the menu, because it needs to access the
|
|
8
|
+
* current room's grid width.
|
|
9
|
+
*/
|
|
10
|
+
export declare function gridToPos(x: int, y: int): Vector;
|
|
11
|
+
/** Helper function to convert a grid position `Vector` to a world position `Vector`. */
|
|
12
|
+
export declare function gridToWorldPos(gridPos: Vector): Vector;
|
|
13
|
+
/** Helper function to convert a world position `Vector` to a grid position `Vector`. */
|
|
14
|
+
export declare function worldToGridPos(worldPos: Vector): Vector;
|
|
15
|
+
/**
|
|
16
|
+
* Helper function to convert a world position `Vector` to a grid position `Vector`.
|
|
17
|
+
*
|
|
18
|
+
* This is similar to the `worldToGridPos` position, but the values are not rounded.
|
|
19
|
+
*/
|
|
20
|
+
export declare function worldToGridPosFast(worldPos: Vector): Vector;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
local ____cachedClasses = require("cachedClasses")
|
|
4
|
+
local game = ____cachedClasses.game
|
|
5
|
+
function ____exports.gridToPos(self, x, y)
|
|
6
|
+
local room = game:GetRoom()
|
|
7
|
+
local gridWidth = room:GetGridWidth()
|
|
8
|
+
x = x + 1
|
|
9
|
+
y = y + 1
|
|
10
|
+
local gridIndex = y * gridWidth + x
|
|
11
|
+
return room:GetGridPosition(gridIndex)
|
|
12
|
+
end
|
|
13
|
+
function ____exports.gridToWorldPos(self, gridPos)
|
|
14
|
+
local x = (gridPos.X + 2) * 40
|
|
15
|
+
local y = (gridPos.Y + 4) * 40
|
|
16
|
+
return Vector(x, y)
|
|
17
|
+
end
|
|
18
|
+
function ____exports.worldToGridPos(self, worldPos)
|
|
19
|
+
local x = math.floor(worldPos.X / 40 - 2 + 0.5)
|
|
20
|
+
local y = math.floor(worldPos.Y / 40 - 4 + 0.5)
|
|
21
|
+
return Vector(x, y)
|
|
22
|
+
end
|
|
23
|
+
function ____exports.worldToGridPosFast(self, worldPos)
|
|
24
|
+
local x = worldPos.X / 40 - 2
|
|
25
|
+
local y = worldPos.Y / 40 - 4
|
|
26
|
+
return Vector(x, y)
|
|
27
|
+
end
|
|
28
|
+
return ____exports
|
|
@@ -6,5 +6,36 @@
|
|
|
6
6
|
* started.
|
|
7
7
|
*/
|
|
8
8
|
export declare function getGridIndexDelta(roomShape: RoomShape, doorSlot: DoorSlot): int | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Helper function to get the grid position of the bottom-right tile of a given room shape.
|
|
11
|
+
*
|
|
12
|
+
* "Vector(0, 0)" corresponds to the top left tile of a room, not including the walls. (The top-left
|
|
13
|
+
* wall would be at "Vector(-1, -1)".)
|
|
14
|
+
*/
|
|
9
15
|
export declare function getRoomShapeBottomRightPosition(roomShape: RoomShape): Vector;
|
|
16
|
+
/**
|
|
17
|
+
* Helper function to get the bounds of a room shape, which are a box representing its contents.
|
|
18
|
+
* This does not include the tiles that the walls are on. L rooms use the same bounds as a 2x2 room.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getRoomShapeBounds(roomShape: RoomShape): Vector;
|
|
21
|
+
/**
|
|
22
|
+
* Helper function to get the dimensions of a room shape's layout. This is NOT the size of the
|
|
23
|
+
* room's actual contents! For that, use the `getRoomShapeBounds` function.
|
|
24
|
+
*
|
|
25
|
+
* For example, a horizontal narrow room has a layout size of equal to that of a 1x1 room.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getRoomShapeLayoutSize(roomShape: RoomShape): Vector;
|
|
28
|
+
/**
|
|
29
|
+
* Helper function to get the grid position of the top-left tile of a given room shape.
|
|
30
|
+
*
|
|
31
|
+
* "Vector(0, 0)" corresponds to the top left tile of a room, not including the walls. (The top-left
|
|
32
|
+
* wall would be at "Vector(-1, -1)".)
|
|
33
|
+
*/
|
|
10
34
|
export declare function getRoomShapeTopLeftPosition(roomShape: RoomShape): Vector;
|
|
35
|
+
/**
|
|
36
|
+
* Helper function to get the volume of a room shape, which is the amount of tiles that are inside
|
|
37
|
+
* the room.
|
|
38
|
+
*
|
|
39
|
+
* (This cannot be directly calculated from the bounds since L rooms are a special case.)
|
|
40
|
+
*/
|
|
41
|
+
export declare function getRoomShapeVolume(roomShape: RoomShape): int;
|
|
@@ -1,23 +1,35 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local Map = ____lualib.Map
|
|
3
3
|
local ____exports = {}
|
|
4
|
+
local ____roomShapeBounds = require("objects.roomShapeBounds")
|
|
5
|
+
local ROOM_SHAPE_BOUNDS = ____roomShapeBounds.ROOM_SHAPE_BOUNDS
|
|
6
|
+
local ____roomShapeLayoutSizes = require("objects.roomShapeLayoutSizes")
|
|
7
|
+
local ROOM_SHAPE_LAYOUT_SIZES = ____roomShapeLayoutSizes.ROOM_SHAPE_LAYOUT_SIZES
|
|
4
8
|
local ____roomShapeToBottomRightPosition = require("objects.roomShapeToBottomRightPosition")
|
|
5
9
|
local ROOM_SHAPE_TO_BOTTOM_RIGHT_POSITION = ____roomShapeToBottomRightPosition.ROOM_SHAPE_TO_BOTTOM_RIGHT_POSITION
|
|
6
|
-
local
|
|
7
|
-
local ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA =
|
|
10
|
+
local ____roomShapeToDoorSlotsToGridIndexDelta = require("objects.roomShapeToDoorSlotsToGridIndexDelta")
|
|
11
|
+
local ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA = ____roomShapeToDoorSlotsToGridIndexDelta.ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA
|
|
8
12
|
local ____roomShapeToTopLeftPosition = require("objects.roomShapeToTopLeftPosition")
|
|
9
13
|
local ROOM_SHAPE_TO_TOP_LEFT_POSITION = ____roomShapeToTopLeftPosition.ROOM_SHAPE_TO_TOP_LEFT_POSITION
|
|
14
|
+
local ____roomShapeVolumes = require("objects.roomShapeVolumes")
|
|
15
|
+
local ROOM_SHAPE_VOLUMES = ____roomShapeVolumes.ROOM_SHAPE_VOLUMES
|
|
10
16
|
function ____exports.getGridIndexDelta(self, roomShape, doorSlot)
|
|
11
17
|
local doorSlotToGridIndexMap = ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA[roomShape]
|
|
12
|
-
if doorSlotToGridIndexMap == nil then
|
|
13
|
-
return nil
|
|
14
|
-
end
|
|
15
18
|
return doorSlotToGridIndexMap:get(doorSlot)
|
|
16
19
|
end
|
|
17
20
|
function ____exports.getRoomShapeBottomRightPosition(self, roomShape)
|
|
18
21
|
return ROOM_SHAPE_TO_BOTTOM_RIGHT_POSITION[roomShape]
|
|
19
22
|
end
|
|
23
|
+
function ____exports.getRoomShapeBounds(self, roomShape)
|
|
24
|
+
return ROOM_SHAPE_BOUNDS[roomShape]
|
|
25
|
+
end
|
|
26
|
+
function ____exports.getRoomShapeLayoutSize(self, roomShape)
|
|
27
|
+
return ROOM_SHAPE_LAYOUT_SIZES[roomShape]
|
|
28
|
+
end
|
|
20
29
|
function ____exports.getRoomShapeTopLeftPosition(self, roomShape)
|
|
21
30
|
return ROOM_SHAPE_TO_TOP_LEFT_POSITION[roomShape]
|
|
22
31
|
end
|
|
32
|
+
function ____exports.getRoomShapeVolume(self, roomShape)
|
|
33
|
+
return ROOM_SHAPE_VOLUMES[roomShape]
|
|
34
|
+
end
|
|
23
35
|
return ____exports
|
|
@@ -39,11 +39,6 @@ export declare function getRoomItemPoolType(): ItemPoolType;
|
|
|
39
39
|
* `RoomList`. Default is false.
|
|
40
40
|
*/
|
|
41
41
|
export declare function getRooms(includeExtraDimensionalRooms?: boolean): RoomDescriptor[];
|
|
42
|
-
/**
|
|
43
|
-
* Converts a room X and Y coordinate to a position. For example, the coordinates of 0, 0 are
|
|
44
|
-
* equal to `Vector(80, 160)`.
|
|
45
|
-
*/
|
|
46
|
-
export declare function gridToPos(x: int, y: int): Vector;
|
|
47
42
|
/**
|
|
48
43
|
* Helper function to determine if the current room shape is equal to `RoomShape.ROOMSHAPE_1x2` or
|
|
49
44
|
* `RoomShape.ROOMSHAPE_2x1`.
|
package/dist/functions/rooms.lua
CHANGED
|
@@ -133,13 +133,6 @@ function ____exports.getRoomItemPoolType(self)
|
|
|
133
133
|
local roomSeed = room:GetSpawnSeed()
|
|
134
134
|
return itemPool:GetPoolForRoom(roomType, roomSeed)
|
|
135
135
|
end
|
|
136
|
-
function ____exports.gridToPos(self, x, y)
|
|
137
|
-
local room = game:GetRoom()
|
|
138
|
-
x = x + 1
|
|
139
|
-
y = y + 1
|
|
140
|
-
local gridIndex = y * room:GetGridWidth() + x
|
|
141
|
-
return room:GetGridPosition(gridIndex)
|
|
142
|
-
end
|
|
143
136
|
function ____exports.in2x1Room(self)
|
|
144
137
|
local room = game:GetRoom()
|
|
145
138
|
local roomShape = room:GetRoomShape()
|
|
@@ -274,12 +267,12 @@ function ____exports.setRoomCleared(self)
|
|
|
274
267
|
for ____, door in ipairs(getDoors(nil)) do
|
|
275
268
|
do
|
|
276
269
|
if isHiddenSecretRoomDoor(nil, door) then
|
|
277
|
-
goto
|
|
270
|
+
goto __continue51
|
|
278
271
|
end
|
|
279
272
|
openDoorFast(nil, door)
|
|
280
273
|
door.ExtraVisible = false
|
|
281
274
|
end
|
|
282
|
-
::
|
|
275
|
+
::__continue51::
|
|
283
276
|
end
|
|
284
277
|
sfxManager:Stop(SoundEffect.SOUND_DOOR_HEAVY_OPEN)
|
|
285
278
|
game:ShakeScreen(0)
|
package/dist/index.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export * from "./functions/cards";
|
|
|
35
35
|
export * from "./functions/challenges";
|
|
36
36
|
export * from "./functions/character";
|
|
37
37
|
export * from "./functions/charge";
|
|
38
|
+
export * from "./functions/chargeBar";
|
|
38
39
|
export * from "./functions/collectibleCacheFlag";
|
|
39
40
|
export * from "./functions/collectibles";
|
|
40
41
|
export * from "./functions/collectibleSet";
|
|
@@ -73,6 +74,7 @@ export * from "./functions/random";
|
|
|
73
74
|
export * from "./functions/revive";
|
|
74
75
|
export * from "./functions/rng";
|
|
75
76
|
export * from "./functions/roomData";
|
|
77
|
+
export * from "./functions/roomGrid";
|
|
76
78
|
export * from "./functions/rooms";
|
|
77
79
|
export * from "./functions/roomShape";
|
|
78
80
|
export * from "./functions/run";
|
package/dist/index.lua
CHANGED
|
@@ -289,6 +289,14 @@ do
|
|
|
289
289
|
end
|
|
290
290
|
end
|
|
291
291
|
end
|
|
292
|
+
do
|
|
293
|
+
local ____export = require("functions.chargeBar")
|
|
294
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
295
|
+
if ____exportKey ~= "default" then
|
|
296
|
+
____exports[____exportKey] = ____exportValue
|
|
297
|
+
end
|
|
298
|
+
end
|
|
299
|
+
end
|
|
292
300
|
do
|
|
293
301
|
local ____export = require("functions.collectibleCacheFlag")
|
|
294
302
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -584,6 +592,14 @@ do
|
|
|
584
592
|
end
|
|
585
593
|
end
|
|
586
594
|
end
|
|
595
|
+
do
|
|
596
|
+
local ____export = require("functions.roomGrid")
|
|
597
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
598
|
+
if ____exportKey ~= "default" then
|
|
599
|
+
____exports[____exportKey] = ____exportValue
|
|
600
|
+
end
|
|
601
|
+
end
|
|
602
|
+
end
|
|
587
603
|
do
|
|
588
604
|
local ____export = require("functions.rooms")
|
|
589
605
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/**
|
|
3
|
+
* The size of a room shape's contents. This does not include the tiles that the walls are on. L
|
|
4
|
+
* rooms use the same bounds as a 2x2 room.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ROOM_SHAPE_BOUNDS: {
|
|
7
|
+
readonly [key in RoomShape]: Vector;
|
|
8
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
local ____roomShapeVolumes = require("objects.roomShapeVolumes")
|
|
4
|
+
local NARROW_CONTENTS_HEIGHT = ____roomShapeVolumes.NARROW_CONTENTS_HEIGHT
|
|
5
|
+
local NARROW_CONTENTS_WIDTH = ____roomShapeVolumes.NARROW_CONTENTS_WIDTH
|
|
6
|
+
local ONE_BY_ONE_CONTENTS_HEIGHT = ____roomShapeVolumes.ONE_BY_ONE_CONTENTS_HEIGHT
|
|
7
|
+
local ONE_BY_ONE_CONTENTS_WIDTH = ____roomShapeVolumes.ONE_BY_ONE_CONTENTS_WIDTH
|
|
8
|
+
local TWO_BY_TWO_BOUNDS = Vector(ONE_BY_ONE_CONTENTS_WIDTH * 2, ONE_BY_ONE_CONTENTS_HEIGHT * 2)
|
|
9
|
+
____exports.ROOM_SHAPE_BOUNDS = {
|
|
10
|
+
[RoomShape.ROOMSHAPE_1x1] = Vector(ONE_BY_ONE_CONTENTS_WIDTH, ONE_BY_ONE_CONTENTS_HEIGHT),
|
|
11
|
+
[RoomShape.ROOMSHAPE_IH] = Vector(ONE_BY_ONE_CONTENTS_WIDTH, NARROW_CONTENTS_HEIGHT),
|
|
12
|
+
[RoomShape.ROOMSHAPE_IV] = Vector(NARROW_CONTENTS_WIDTH, ONE_BY_ONE_CONTENTS_HEIGHT),
|
|
13
|
+
[RoomShape.ROOMSHAPE_1x2] = Vector(ONE_BY_ONE_CONTENTS_WIDTH, ONE_BY_ONE_CONTENTS_HEIGHT * 2),
|
|
14
|
+
[RoomShape.ROOMSHAPE_IIV] = Vector(NARROW_CONTENTS_WIDTH, ONE_BY_ONE_CONTENTS_HEIGHT * 2),
|
|
15
|
+
[RoomShape.ROOMSHAPE_2x1] = Vector(ONE_BY_ONE_CONTENTS_WIDTH * 2, ONE_BY_ONE_CONTENTS_HEIGHT),
|
|
16
|
+
[RoomShape.ROOMSHAPE_IIH] = Vector(ONE_BY_ONE_CONTENTS_WIDTH * 2, NARROW_CONTENTS_HEIGHT),
|
|
17
|
+
[RoomShape.ROOMSHAPE_2x2] = TWO_BY_TWO_BOUNDS,
|
|
18
|
+
[RoomShape.ROOMSHAPE_LTL] = TWO_BY_TWO_BOUNDS,
|
|
19
|
+
[RoomShape.ROOMSHAPE_LTR] = TWO_BY_TWO_BOUNDS,
|
|
20
|
+
[RoomShape.ROOMSHAPE_LBL] = TWO_BY_TWO_BOUNDS,
|
|
21
|
+
[RoomShape.ROOMSHAPE_LBR] = TWO_BY_TWO_BOUNDS,
|
|
22
|
+
[RoomShape.NUM_ROOMSHAPES] = Vector.Zero
|
|
23
|
+
}
|
|
24
|
+
return ____exports
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/**
|
|
3
|
+
* The dimensions of a room shape's layout. This is NOT the size of the room's actual contents! For
|
|
4
|
+
* that, use `ROOM_SHAPE_BOUNDS`.
|
|
5
|
+
*
|
|
6
|
+
* For example, a horizontal narrow room has a layout size of equal to that of a 1x1 room.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ROOM_SHAPE_LAYOUT_SIZES: {
|
|
9
|
+
readonly [key in RoomShape]: Vector;
|
|
10
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
local ____roomShapeVolumes = require("objects.roomShapeVolumes")
|
|
4
|
+
local ONE_BY_ONE_CONTENTS_HEIGHT = ____roomShapeVolumes.ONE_BY_ONE_CONTENTS_HEIGHT
|
|
5
|
+
local ONE_BY_ONE_CONTENTS_WIDTH = ____roomShapeVolumes.ONE_BY_ONE_CONTENTS_WIDTH
|
|
6
|
+
local ONE_BY_ONE_LAYOUT_SIZE = Vector(ONE_BY_ONE_CONTENTS_WIDTH, ONE_BY_ONE_CONTENTS_HEIGHT)
|
|
7
|
+
local TWO_BY_ONE_VERTICAL_LAYOUT_SIZE = Vector(ONE_BY_ONE_CONTENTS_WIDTH, ONE_BY_ONE_CONTENTS_HEIGHT * 2)
|
|
8
|
+
local TWO_BY_ONE_HORIZONTAL_LAYOUT_SIZE = Vector(ONE_BY_ONE_CONTENTS_WIDTH * 2, ONE_BY_ONE_CONTENTS_HEIGHT)
|
|
9
|
+
local TWO_BY_TWO_LAYOUT_SIZE = Vector(ONE_BY_ONE_CONTENTS_WIDTH * 2, ONE_BY_ONE_CONTENTS_HEIGHT * 2)
|
|
10
|
+
____exports.ROOM_SHAPE_LAYOUT_SIZES = {
|
|
11
|
+
[RoomShape.ROOMSHAPE_1x1] = ONE_BY_ONE_LAYOUT_SIZE,
|
|
12
|
+
[RoomShape.ROOMSHAPE_IH] = ONE_BY_ONE_LAYOUT_SIZE,
|
|
13
|
+
[RoomShape.ROOMSHAPE_IV] = ONE_BY_ONE_LAYOUT_SIZE,
|
|
14
|
+
[RoomShape.ROOMSHAPE_1x2] = TWO_BY_ONE_VERTICAL_LAYOUT_SIZE,
|
|
15
|
+
[RoomShape.ROOMSHAPE_IIV] = TWO_BY_ONE_VERTICAL_LAYOUT_SIZE,
|
|
16
|
+
[RoomShape.ROOMSHAPE_2x1] = TWO_BY_ONE_HORIZONTAL_LAYOUT_SIZE,
|
|
17
|
+
[RoomShape.ROOMSHAPE_IIH] = TWO_BY_ONE_HORIZONTAL_LAYOUT_SIZE,
|
|
18
|
+
[RoomShape.ROOMSHAPE_2x2] = TWO_BY_TWO_LAYOUT_SIZE,
|
|
19
|
+
[RoomShape.ROOMSHAPE_LTL] = TWO_BY_TWO_LAYOUT_SIZE,
|
|
20
|
+
[RoomShape.ROOMSHAPE_LTR] = TWO_BY_TWO_LAYOUT_SIZE,
|
|
21
|
+
[RoomShape.ROOMSHAPE_LBL] = TWO_BY_TWO_LAYOUT_SIZE,
|
|
22
|
+
[RoomShape.ROOMSHAPE_LBR] = TWO_BY_TWO_LAYOUT_SIZE,
|
|
23
|
+
[RoomShape.NUM_ROOMSHAPES] = TWO_BY_TWO_LAYOUT_SIZE
|
|
24
|
+
}
|
|
25
|
+
return ____exports
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/**
|
|
3
|
+
* Deltas are considered to be from the safe grid index of the room (i.e. the top left corner, or
|
|
4
|
+
* top right corner in the case of `RoomShape.ROOMSHAPE_LTL`).
|
|
5
|
+
*/
|
|
6
|
+
export declare const ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA: {
|
|
7
|
+
readonly [key in RoomShape]: Map<DoorSlot, int>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local Map = ____lualib.Map
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
4
|
+
local ____exports = {}
|
|
5
|
+
local ____constants = require("constants")
|
|
6
|
+
local LEVEL_GRID_ROW_LENGTH = ____constants.LEVEL_GRID_ROW_LENGTH
|
|
7
|
+
local LEFT = -1
|
|
8
|
+
local UP = -LEVEL_GRID_ROW_LENGTH
|
|
9
|
+
local RIGHT = 1
|
|
10
|
+
local DOWN = LEVEL_GRID_ROW_LENGTH
|
|
11
|
+
____exports.ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA = {
|
|
12
|
+
[RoomShape.ROOMSHAPE_1x1] = __TS__New(Map, {{DoorSlot.LEFT0, LEFT}, {DoorSlot.UP0, UP}, {DoorSlot.RIGHT0, RIGHT}, {DoorSlot.DOWN0, DOWN}}),
|
|
13
|
+
[RoomShape.ROOMSHAPE_IH] = __TS__New(Map, {{DoorSlot.LEFT0, LEFT}, {DoorSlot.RIGHT0, RIGHT}}),
|
|
14
|
+
[RoomShape.ROOMSHAPE_IV] = __TS__New(Map, {{DoorSlot.UP0, UP}, {DoorSlot.DOWN0, DOWN}}),
|
|
15
|
+
[RoomShape.ROOMSHAPE_1x2] = __TS__New(Map, {
|
|
16
|
+
{DoorSlot.LEFT0, LEFT},
|
|
17
|
+
{DoorSlot.UP0, UP},
|
|
18
|
+
{DoorSlot.RIGHT0, RIGHT},
|
|
19
|
+
{DoorSlot.DOWN0, DOWN + DOWN},
|
|
20
|
+
{DoorSlot.LEFT1, DOWN + LEFT},
|
|
21
|
+
{DoorSlot.RIGHT1, DOWN + RIGHT}
|
|
22
|
+
}),
|
|
23
|
+
[RoomShape.ROOMSHAPE_IIV] = __TS__New(Map, {{DoorSlot.UP0, UP}, {DoorSlot.DOWN0, DOWN + DOWN}}),
|
|
24
|
+
[RoomShape.ROOMSHAPE_2x1] = __TS__New(Map, {
|
|
25
|
+
{DoorSlot.LEFT0, LEFT},
|
|
26
|
+
{DoorSlot.UP0, UP},
|
|
27
|
+
{DoorSlot.RIGHT0, RIGHT + RIGHT},
|
|
28
|
+
{DoorSlot.DOWN0, DOWN},
|
|
29
|
+
{DoorSlot.UP1, RIGHT + UP},
|
|
30
|
+
{DoorSlot.DOWN1, RIGHT + DOWN}
|
|
31
|
+
}),
|
|
32
|
+
[RoomShape.ROOMSHAPE_IIH] = __TS__New(Map, {{DoorSlot.LEFT0, LEFT}, {DoorSlot.RIGHT0, RIGHT + RIGHT}}),
|
|
33
|
+
[RoomShape.ROOMSHAPE_2x2] = __TS__New(Map, {
|
|
34
|
+
{DoorSlot.LEFT0, LEFT},
|
|
35
|
+
{DoorSlot.UP0, UP},
|
|
36
|
+
{DoorSlot.RIGHT0, RIGHT + RIGHT},
|
|
37
|
+
{DoorSlot.DOWN0, DOWN + DOWN},
|
|
38
|
+
{DoorSlot.LEFT1, DOWN + LEFT},
|
|
39
|
+
{DoorSlot.UP1, RIGHT + UP},
|
|
40
|
+
{DoorSlot.RIGHT1, RIGHT + DOWN + RIGHT},
|
|
41
|
+
{DoorSlot.DOWN1, RIGHT + DOWN + DOWN}
|
|
42
|
+
}),
|
|
43
|
+
[RoomShape.ROOMSHAPE_LTL] = __TS__New(Map, {
|
|
44
|
+
{DoorSlot.LEFT0, LEFT},
|
|
45
|
+
{DoorSlot.UP0, DOWN + LEFT + UP},
|
|
46
|
+
{DoorSlot.RIGHT0, RIGHT},
|
|
47
|
+
{DoorSlot.DOWN0, DOWN + LEFT + DOWN},
|
|
48
|
+
{DoorSlot.LEFT1, DOWN + LEFT + LEFT},
|
|
49
|
+
{DoorSlot.UP1, UP},
|
|
50
|
+
{DoorSlot.RIGHT1, DOWN + RIGHT},
|
|
51
|
+
{DoorSlot.DOWN1, DOWN + DOWN}
|
|
52
|
+
}),
|
|
53
|
+
[RoomShape.ROOMSHAPE_LTR] = __TS__New(Map, {
|
|
54
|
+
{DoorSlot.LEFT0, LEFT},
|
|
55
|
+
{DoorSlot.UP0, UP},
|
|
56
|
+
{DoorSlot.RIGHT0, RIGHT},
|
|
57
|
+
{DoorSlot.DOWN0, DOWN + DOWN},
|
|
58
|
+
{DoorSlot.LEFT1, DOWN + LEFT},
|
|
59
|
+
{DoorSlot.UP1, DOWN + RIGHT + UP},
|
|
60
|
+
{DoorSlot.RIGHT1, DOWN + RIGHT + RIGHT},
|
|
61
|
+
{DoorSlot.DOWN1, DOWN + RIGHT + DOWN}
|
|
62
|
+
}),
|
|
63
|
+
[RoomShape.ROOMSHAPE_LBL] = __TS__New(Map, {
|
|
64
|
+
{DoorSlot.LEFT0, LEFT},
|
|
65
|
+
{DoorSlot.UP0, UP},
|
|
66
|
+
{DoorSlot.RIGHT0, RIGHT + RIGHT},
|
|
67
|
+
{DoorSlot.DOWN0, DOWN},
|
|
68
|
+
{DoorSlot.LEFT1, RIGHT + DOWN + LEFT},
|
|
69
|
+
{DoorSlot.UP1, RIGHT + UP},
|
|
70
|
+
{DoorSlot.RIGHT1, RIGHT + DOWN + RIGHT},
|
|
71
|
+
{DoorSlot.DOWN1, RIGHT + DOWN + DOWN}
|
|
72
|
+
}),
|
|
73
|
+
[RoomShape.ROOMSHAPE_LBR] = __TS__New(Map, {
|
|
74
|
+
{DoorSlot.LEFT0, LEFT},
|
|
75
|
+
{DoorSlot.UP0, UP},
|
|
76
|
+
{DoorSlot.RIGHT0, RIGHT + RIGHT},
|
|
77
|
+
{DoorSlot.DOWN0, DOWN + DOWN},
|
|
78
|
+
{DoorSlot.LEFT1, DOWN + LEFT},
|
|
79
|
+
{DoorSlot.UP1, RIGHT + UP},
|
|
80
|
+
{DoorSlot.RIGHT1, DOWN + RIGHT},
|
|
81
|
+
{DoorSlot.DOWN1, RIGHT + DOWN}
|
|
82
|
+
}),
|
|
83
|
+
[RoomShape.NUM_ROOMSHAPES] = __TS__New(Map)
|
|
84
|
+
}
|
|
85
|
+
return ____exports
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
export declare const ONE_BY_ONE_CONTENTS_WIDTH = 13;
|
|
3
|
+
export declare const ONE_BY_ONE_CONTENTS_HEIGHT = 7;
|
|
4
|
+
export declare const NARROW_CONTENTS_WIDTH = 5;
|
|
5
|
+
export declare const NARROW_CONTENTS_HEIGHT = 3;
|
|
6
|
+
/**
|
|
7
|
+
* Volume is the amount of tiles that are inside the room shape.
|
|
8
|
+
*
|
|
9
|
+
* (This cannot be directly calculated from the bounds since L rooms are a special case.)
|
|
10
|
+
*/
|
|
11
|
+
export declare const ROOM_SHAPE_VOLUMES: {
|
|
12
|
+
readonly [key in RoomShape]: int;
|
|
13
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
____exports.ONE_BY_ONE_CONTENTS_WIDTH = 13
|
|
4
|
+
____exports.ONE_BY_ONE_CONTENTS_HEIGHT = 7
|
|
5
|
+
local ONE_BY_ONE_VOLUME = ____exports.ONE_BY_ONE_CONTENTS_HEIGHT * ____exports.ONE_BY_ONE_CONTENTS_WIDTH
|
|
6
|
+
____exports.NARROW_CONTENTS_WIDTH = 5
|
|
7
|
+
____exports.NARROW_CONTENTS_HEIGHT = 3
|
|
8
|
+
local NARROW_HORIZONTAL_VOLUME = ____exports.ONE_BY_ONE_CONTENTS_WIDTH * ____exports.NARROW_CONTENTS_HEIGHT
|
|
9
|
+
local NARROW_VERTICAL_VOLUME = ____exports.NARROW_CONTENTS_WIDTH * ____exports.ONE_BY_ONE_CONTENTS_HEIGHT
|
|
10
|
+
local ONE_BY_TWO_VOLUME = ONE_BY_ONE_VOLUME * 2
|
|
11
|
+
local L_ROOM_VOLUME = ONE_BY_ONE_VOLUME * 3
|
|
12
|
+
____exports.ROOM_SHAPE_VOLUMES = {
|
|
13
|
+
[RoomShape.ROOMSHAPE_1x1] = ONE_BY_ONE_VOLUME,
|
|
14
|
+
[RoomShape.ROOMSHAPE_IH] = NARROW_HORIZONTAL_VOLUME,
|
|
15
|
+
[RoomShape.ROOMSHAPE_IV] = NARROW_VERTICAL_VOLUME,
|
|
16
|
+
[RoomShape.ROOMSHAPE_1x2] = ONE_BY_TWO_VOLUME,
|
|
17
|
+
[RoomShape.ROOMSHAPE_IIV] = NARROW_VERTICAL_VOLUME * 2,
|
|
18
|
+
[RoomShape.ROOMSHAPE_2x1] = ONE_BY_TWO_VOLUME,
|
|
19
|
+
[RoomShape.ROOMSHAPE_IIH] = NARROW_HORIZONTAL_VOLUME * 2,
|
|
20
|
+
[RoomShape.ROOMSHAPE_2x2] = ONE_BY_ONE_VOLUME * 4,
|
|
21
|
+
[RoomShape.ROOMSHAPE_LTL] = L_ROOM_VOLUME,
|
|
22
|
+
[RoomShape.ROOMSHAPE_LTR] = L_ROOM_VOLUME,
|
|
23
|
+
[RoomShape.ROOMSHAPE_LBL] = L_ROOM_VOLUME,
|
|
24
|
+
[RoomShape.ROOMSHAPE_LBR] = L_ROOM_VOLUME,
|
|
25
|
+
[RoomShape.NUM_ROOMSHAPES] = 0
|
|
26
|
+
}
|
|
27
|
+
return ____exports
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.230",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dist/**/*.d.ts"
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"isaac-typescript-definitions": "^1.0.
|
|
28
|
+
"isaac-typescript-definitions": "^1.0.385",
|
|
29
29
|
"isaacscript-lint": "^1.0.95",
|
|
30
30
|
"isaacscript-tsconfig": "^1.1.8",
|
|
31
31
|
"typedoc": "^0.22.13",
|