isaacscript-common 1.2.228 → 1.2.229
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/features/deployJSONRoom.lua +2 -1
- package/dist/features/extraConsoleCommands/commands.lua +2 -1
- package/dist/functions/roomGrid.d.ts +20 -0
- package/dist/functions/roomGrid.lua +28 -0
- package/dist/functions/roomShape.lua +2 -5
- package/dist/functions/rooms.d.ts +0 -5
- package/dist/functions/rooms.lua +2 -9
- package/dist/index.d.ts +1 -0
- package/dist/index.lua +8 -0
- package/dist/objects/roomShapeToDoorSlotsToGridIndexDelta.d.ts +8 -0
- package/dist/objects/roomShapeToDoorSlotsToGridIndexDelta.lua +85 -0
- package/package.json +2 -2
|
@@ -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,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
|
|
@@ -7,17 +7,14 @@ local ____roomShapeLayoutSizes = require("objects.roomShapeLayoutSizes")
|
|
|
7
7
|
local ROOM_SHAPE_LAYOUT_SIZES = ____roomShapeLayoutSizes.ROOM_SHAPE_LAYOUT_SIZES
|
|
8
8
|
local ____roomShapeToBottomRightPosition = require("objects.roomShapeToBottomRightPosition")
|
|
9
9
|
local ROOM_SHAPE_TO_BOTTOM_RIGHT_POSITION = ____roomShapeToBottomRightPosition.ROOM_SHAPE_TO_BOTTOM_RIGHT_POSITION
|
|
10
|
-
local
|
|
11
|
-
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
|
|
12
12
|
local ____roomShapeToTopLeftPosition = require("objects.roomShapeToTopLeftPosition")
|
|
13
13
|
local ROOM_SHAPE_TO_TOP_LEFT_POSITION = ____roomShapeToTopLeftPosition.ROOM_SHAPE_TO_TOP_LEFT_POSITION
|
|
14
14
|
local ____roomShapeVolumes = require("objects.roomShapeVolumes")
|
|
15
15
|
local ROOM_SHAPE_VOLUMES = ____roomShapeVolumes.ROOM_SHAPE_VOLUMES
|
|
16
16
|
function ____exports.getGridIndexDelta(self, roomShape, doorSlot)
|
|
17
17
|
local doorSlotToGridIndexMap = ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA[roomShape]
|
|
18
|
-
if doorSlotToGridIndexMap == nil then
|
|
19
|
-
return nil
|
|
20
|
-
end
|
|
21
18
|
return doorSlotToGridIndexMap:get(doorSlot)
|
|
22
19
|
end
|
|
23
20
|
function ____exports.getRoomShapeBottomRightPosition(self, roomShape)
|
|
@@ -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
|
@@ -73,6 +73,7 @@ export * from "./functions/random";
|
|
|
73
73
|
export * from "./functions/revive";
|
|
74
74
|
export * from "./functions/rng";
|
|
75
75
|
export * from "./functions/roomData";
|
|
76
|
+
export * from "./functions/roomGrid";
|
|
76
77
|
export * from "./functions/rooms";
|
|
77
78
|
export * from "./functions/roomShape";
|
|
78
79
|
export * from "./functions/run";
|
package/dist/index.lua
CHANGED
|
@@ -584,6 +584,14 @@ do
|
|
|
584
584
|
end
|
|
585
585
|
end
|
|
586
586
|
end
|
|
587
|
+
do
|
|
588
|
+
local ____export = require("functions.roomGrid")
|
|
589
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
590
|
+
if ____exportKey ~= "default" then
|
|
591
|
+
____exports[____exportKey] = ____exportValue
|
|
592
|
+
end
|
|
593
|
+
end
|
|
594
|
+
end
|
|
587
595
|
do
|
|
588
596
|
local ____export = require("functions.rooms")
|
|
589
597
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.229",
|
|
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",
|