isaacscript-common 1.0.577 → 1.0.578
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/functions/rooms.d.ts +14 -2
- package/dist/functions/rooms.lua +16 -0
- package/dist/functions/util.d.ts +0 -11
- package/dist/functions/util.lua +0 -12
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
/**
|
|
3
3
|
* Helper function for quickly switching to a new room without playing a particular animation.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Use this helper function over invoking `Game().ChangeRoom()` directly to ensure that you do not
|
|
5
|
+
* forget to set the LeaveDoor property and to prevent crashing on invalid room grid indexes.
|
|
6
6
|
*/
|
|
7
7
|
export declare function changeRoom(roomGridIndex: int): void;
|
|
8
8
|
export declare function getAllRoomGridIndexes(): int[];
|
|
@@ -220,3 +220,15 @@ export declare function setRoomCleared(): void;
|
|
|
220
220
|
* spawns an NPC.
|
|
221
221
|
*/
|
|
222
222
|
export declare function setRoomUncleared(): void;
|
|
223
|
+
/**
|
|
224
|
+
* Helper function to change the current room. It can be used for both teleportation and "normal"
|
|
225
|
+
* room transitions, depending on what is passed for the `direction` and `roomTransitionAnim`
|
|
226
|
+
* arguments. Use this function instead of invoking `Game.StartRoomTransition()` directly so that
|
|
227
|
+
* you do not forget to set `Level.LeaveDoor` property and to prevent crashing on invalid room grid
|
|
228
|
+
* indexes.
|
|
229
|
+
*
|
|
230
|
+
* @param roomGridIndex The room grid index of the destination room.
|
|
231
|
+
* @param direction Optional. Default is `Direction.NO_DIRECTION`.
|
|
232
|
+
* @param roomTransitionAnim Optional. Default is `RoomTransitionAnim.TELEPORT`.
|
|
233
|
+
*/
|
|
234
|
+
export declare function teleport(roomGridIndex: int, direction?: Direction, roomTransitionAnim?: RoomTransitionAnim): void;
|
package/dist/functions/rooms.lua
CHANGED
|
@@ -312,4 +312,20 @@ function ____exports.setRoomUncleared(self)
|
|
|
312
312
|
room:SetClear(false)
|
|
313
313
|
closeAllDoors(nil)
|
|
314
314
|
end
|
|
315
|
+
function ____exports.teleport(self, roomGridIndex, direction, roomTransitionAnim)
|
|
316
|
+
if direction == nil then
|
|
317
|
+
direction = Direction.NO_DIRECTION
|
|
318
|
+
end
|
|
319
|
+
if roomTransitionAnim == nil then
|
|
320
|
+
roomTransitionAnim = RoomTransitionAnim.TELEPORT
|
|
321
|
+
end
|
|
322
|
+
local game = Game()
|
|
323
|
+
local level = game:GetLevel()
|
|
324
|
+
local roomData = ____exports.getRoomData(nil, roomGridIndex)
|
|
325
|
+
if roomData == nil then
|
|
326
|
+
error(("Failed to change the room to to grid index " .. tostring(roomGridIndex)) .. " because that room does not exist.")
|
|
327
|
+
end
|
|
328
|
+
level.LeaveDoor = -1
|
|
329
|
+
game:StartRoomTransition(roomGridIndex, direction, roomTransitionAnim)
|
|
330
|
+
end
|
|
315
331
|
return ____exports
|
package/dist/functions/util.d.ts
CHANGED
|
@@ -90,14 +90,3 @@ export declare function printConsole(msg: string): void;
|
|
|
90
90
|
* `clear` method does not exist. Use this helper function as a drop-in replacement for this.
|
|
91
91
|
*/
|
|
92
92
|
export declare function tableClear(table: LuaTable): void;
|
|
93
|
-
/**
|
|
94
|
-
* Helper function to change the current room. It can be used for both teleportation and "normal"
|
|
95
|
-
* room transitions, depending on what is passed for the `direction` and `roomTransitionAnim`
|
|
96
|
-
* arguments. Use this function instead of invoking `Game.StartRoomTransition()` directly so that
|
|
97
|
-
* you don't forget to set `Level.LeaveDoor` property.
|
|
98
|
-
*
|
|
99
|
-
* @param roomGridIndex The room grid index of the destination room.
|
|
100
|
-
* @param direction Optional. Default is `Direction.NO_DIRECTION`.
|
|
101
|
-
* @param roomTransitionAnim Optional. Default is `RoomTransitionAnim.TELEPORT`.
|
|
102
|
-
*/
|
|
103
|
-
export declare function teleport(roomGridIndex: int, direction?: Direction, roomTransitionAnim?: RoomTransitionAnim): void;
|
package/dist/functions/util.lua
CHANGED
|
@@ -70,16 +70,4 @@ function ____exports.tableClear(self, ____table)
|
|
|
70
70
|
____table[key] = nil
|
|
71
71
|
end
|
|
72
72
|
end
|
|
73
|
-
function ____exports.teleport(self, roomGridIndex, direction, roomTransitionAnim)
|
|
74
|
-
if direction == nil then
|
|
75
|
-
direction = Direction.NO_DIRECTION
|
|
76
|
-
end
|
|
77
|
-
if roomTransitionAnim == nil then
|
|
78
|
-
roomTransitionAnim = RoomTransitionAnim.TELEPORT
|
|
79
|
-
end
|
|
80
|
-
local game = Game()
|
|
81
|
-
local level = game:GetLevel()
|
|
82
|
-
level.LeaveDoor = -1
|
|
83
|
-
game:StartRoomTransition(roomGridIndex, direction, roomTransitionAnim)
|
|
84
|
-
end
|
|
85
73
|
return ____exports
|