isaacscript-common 1.2.211 → 1.2.214
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.d.ts +6 -6
- package/dist/features/deployJSONRoom.lua +10 -6
- package/dist/features/saveDataManager/merge.d.ts +1 -0
- package/dist/functions/array.d.ts +25 -7
- package/dist/functions/array.lua +21 -21
- package/dist/functions/cards.d.ts +9 -6
- package/dist/functions/cards.lua +13 -13
- package/dist/functions/deepCopy.d.ts +1 -0
- package/dist/functions/deepCopy.lua +8 -3
- package/dist/functions/jsonRoom.d.ts +1 -1
- package/dist/functions/jsonRoom.lua +5 -5
- package/dist/functions/npc.d.ts +2 -0
- package/dist/functions/npc.lua +5 -0
- package/dist/functions/random.d.ts +18 -27
- package/dist/functions/random.lua +14 -22
- package/dist/functions/rooms.d.ts +7 -0
- package/dist/functions/rooms.lua +12 -3
- package/dist/functions/set.d.ts +3 -2
- package/dist/functions/set.lua +5 -5
- package/dist/objects/roomShapeToGridIndexDelta.d.ts +8 -0
- package/dist/objects/roomShapeToGridIndexDelta.lua +85 -0
- package/dist/sets/sinEntityTypesSet.d.ts +2 -0
- package/dist/sets/sinEntityTypesSet.lua +14 -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_ROW_LENGTH = 13;
|
|
40
41
|
/** In a 2x2 room, there can be 8 doors. */
|
|
41
42
|
export declare const MAX_NUM_DOORS = 8;
|
|
42
43
|
/**
|
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_ROW_LENGTH = 13
|
|
16
17
|
____exports.MAX_NUM_DOORS = 8
|
|
17
18
|
____exports.MAX_NUM_FAMILIARS = 64
|
|
18
19
|
____exports.MAX_NUM_INPUTS = 4
|
|
@@ -14,12 +14,12 @@ import { JSONRoom } from "../types/JSONRoom";
|
|
|
14
14
|
* const firstJSONRoom = customRooms.rooms.room[0];
|
|
15
15
|
* deployJSONRoom(firstJSONRoom);
|
|
16
16
|
* ```
|
|
17
|
-
* @param
|
|
18
|
-
*
|
|
17
|
+
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
18
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
19
19
|
* @param verbose Optional. If specified, will write entries to the "log.txt" file that describe
|
|
20
20
|
* what the function is doing. Default is false.
|
|
21
21
|
*/
|
|
22
|
-
export declare function deployJSONRoom(jsonRoom: JSONRoom,
|
|
22
|
+
export declare function deployJSONRoom(jsonRoom: JSONRoom, seedOrRNG?: Seed | RNG, verbose?: boolean): void;
|
|
23
23
|
/**
|
|
24
24
|
* Helper function to deconstruct a vanilla room and set up a custom room in its place.
|
|
25
25
|
* Specifically, this will clear the current room of all entities and grid entities, and then spawn
|
|
@@ -39,12 +39,12 @@ export declare function deployJSONRoom(jsonRoom: JSONRoom, rng?: RNG, verbose?:
|
|
|
39
39
|
* const jsonRooms = customRooms.rooms.room;
|
|
40
40
|
* deployRandomJSONRoom(jsonRooms);
|
|
41
41
|
* ```
|
|
42
|
-
* @param
|
|
43
|
-
*
|
|
42
|
+
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
43
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
44
44
|
* @param verbose Optional. If specified, will write entries to the "log.txt" file that describe
|
|
45
45
|
* what the function is doing. Default is false.
|
|
46
46
|
*/
|
|
47
|
-
export declare function deployRandomJSONRoom(jsonRooms: JSONRoom[],
|
|
47
|
+
export declare function deployRandomJSONRoom(jsonRooms: JSONRoom[], seedOrRNG?: Seed | RNG, verbose?: boolean): void;
|
|
48
48
|
/**
|
|
49
49
|
* Helper function to remove all naturally spawning entities and grid entities from a room. Notably,
|
|
50
50
|
* this will not remove players (1), tears (2), familiars (3), lasers (7), knives (8),
|
|
@@ -33,6 +33,8 @@ local getNPCs = ____npc.getNPCs
|
|
|
33
33
|
local ____pickups = require("functions.pickups")
|
|
34
34
|
local removeAllPickups = ____pickups.removeAllPickups
|
|
35
35
|
local ____rng = require("functions.rng")
|
|
36
|
+
local getRandomSeed = ____rng.getRandomSeed
|
|
37
|
+
local isRNG = ____rng.isRNG
|
|
36
38
|
local newRNG = ____rng.newRNG
|
|
37
39
|
local ____roomData = require("functions.roomData")
|
|
38
40
|
local getRoomListIndex = ____roomData.getRoomListIndex
|
|
@@ -402,14 +404,15 @@ function ____exports.deployJSONRoomInit(self, mod)
|
|
|
402
404
|
saveDataManager(nil, "deployJSONRoom", v)
|
|
403
405
|
mod:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, postNewRoom)
|
|
404
406
|
end
|
|
405
|
-
function ____exports.deployJSONRoom(self, jsonRoom,
|
|
406
|
-
if
|
|
407
|
-
|
|
407
|
+
function ____exports.deployJSONRoom(self, jsonRoom, seedOrRNG, verbose)
|
|
408
|
+
if seedOrRNG == nil then
|
|
409
|
+
seedOrRNG = getRandomSeed(nil)
|
|
408
410
|
end
|
|
409
411
|
if verbose == nil then
|
|
410
412
|
verbose = false
|
|
411
413
|
end
|
|
412
414
|
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
415
|
+
local rng = isRNG(nil, seedOrRNG) and seedOrRNG or newRNG(nil, seedOrRNG)
|
|
413
416
|
if verbose then
|
|
414
417
|
log("Starting to empty the room of entities and grid entities.")
|
|
415
418
|
end
|
|
@@ -427,14 +430,15 @@ function ____exports.deployJSONRoom(self, jsonRoom, rng, verbose)
|
|
|
427
430
|
fixPitGraphics(nil)
|
|
428
431
|
fillRoomWithDecorations(nil)
|
|
429
432
|
end
|
|
430
|
-
function ____exports.deployRandomJSONRoom(self, jsonRooms,
|
|
431
|
-
if
|
|
432
|
-
|
|
433
|
+
function ____exports.deployRandomJSONRoom(self, jsonRooms, seedOrRNG, verbose)
|
|
434
|
+
if seedOrRNG == nil then
|
|
435
|
+
seedOrRNG = getRandomSeed(nil)
|
|
433
436
|
end
|
|
434
437
|
if verbose == nil then
|
|
435
438
|
verbose = false
|
|
436
439
|
end
|
|
437
440
|
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
441
|
+
local rng = isRNG(nil, seedOrRNG) and seedOrRNG or newRNG(nil, seedOrRNG)
|
|
438
442
|
local randomJSONRoom = getRandomJSONRoom(nil, jsonRooms, rng, verbose)
|
|
439
443
|
if verbose then
|
|
440
444
|
log((((((("Randomly chose JSON room " .. randomJSONRoom["$"].type) .. ".") .. randomJSONRoom["$"].variant) .. ".") .. randomJSONRoom["$"].subtype) .. " with name: ") .. randomJSONRoom["$"].name)
|
|
@@ -43,20 +43,29 @@ export declare function getLastElement<T>(array: T[]): T;
|
|
|
43
43
|
* Helper function to get a random element from the provided array.
|
|
44
44
|
*
|
|
45
45
|
* @param array The array to get an element from.
|
|
46
|
-
* @param
|
|
46
|
+
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
47
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
47
48
|
* @param exceptions Optional. An array of elements to skip over if selected.
|
|
48
49
|
*/
|
|
49
|
-
export declare function getRandomArrayElement<T>(array: T[] | readonly T[],
|
|
50
|
+
export declare function getRandomArrayElement<T>(array: T[] | readonly T[], seedOrRNG?: Seed | RNG, exceptions?: T[] | readonly T[]): T;
|
|
50
51
|
/**
|
|
51
52
|
* Helper function to get a random element from the provided array. Once the random element is
|
|
52
53
|
* decided, it is then removed from the array (in-place).
|
|
53
54
|
*
|
|
54
55
|
* @param array The array to get an element from.
|
|
55
|
-
* @param
|
|
56
|
+
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
57
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
56
58
|
* @param exceptions Optional. An array of elements to skip over if selected.
|
|
57
59
|
*/
|
|
58
|
-
export declare function getRandomArrayElementAndRemove<T>(array: T[],
|
|
59
|
-
|
|
60
|
+
export declare function getRandomArrayElementAndRemove<T>(array: T[], seedOrRNG?: Seed | RNG, exceptions?: T[] | readonly T[]): T;
|
|
61
|
+
/**
|
|
62
|
+
* Helper function to get a random index from the provided array.
|
|
63
|
+
*
|
|
64
|
+
* @param array The array to get the index from.
|
|
65
|
+
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
66
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
67
|
+
*/
|
|
68
|
+
export declare function getRandomArrayIndex<T>(array: T[] | readonly T[], seedOrRNG?: Seed | RNG): int;
|
|
60
69
|
/**
|
|
61
70
|
* Initializes an array with all elements containing the specified default value.
|
|
62
71
|
*
|
|
@@ -74,17 +83,26 @@ export declare function initArray<T>(defaultValue: T, size: int): T[];
|
|
|
74
83
|
* - the table has no keys (i.e. an "empty" table)
|
|
75
84
|
*/
|
|
76
85
|
export declare function isArray(thing: unknown): boolean;
|
|
86
|
+
/** Checks if an array is in the provided 2-dimensional array. */
|
|
77
87
|
export declare function isArrayInArray<T>(arrayToMatch: T[] | readonly T[], parentArray: Array<T[] | readonly T[]>): boolean;
|
|
78
88
|
/**
|
|
79
89
|
* Shallow copies and shuffles the array using the Fisher-Yates algorithm. Returns the copied array.
|
|
80
90
|
*
|
|
81
91
|
* From: https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
|
|
92
|
+
*
|
|
93
|
+
* @param originalArray The array to shuffle.
|
|
94
|
+
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
95
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
82
96
|
*/
|
|
83
|
-
export declare function shuffleArray<T>(originalArray: T[] | readonly T[],
|
|
97
|
+
export declare function shuffleArray<T>(originalArray: T[] | readonly T[], seedOrRNG?: Seed | RNG): T[];
|
|
84
98
|
/**
|
|
85
99
|
* Shuffles the provided array in-place using the Fisher-Yates algorithm.
|
|
86
100
|
*
|
|
87
101
|
* From: https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
|
|
102
|
+
*
|
|
103
|
+
* @param array The array to shuffle.
|
|
104
|
+
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
105
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
88
106
|
*/
|
|
89
|
-
export declare function shuffleArrayInPlace<T>(array: T[],
|
|
107
|
+
export declare function shuffleArrayInPlace<T>(array: T[], seedOrRNG?: Seed | RNG): void;
|
|
90
108
|
export declare function sumArray(array: number[] | readonly number[]): number;
|
package/dist/functions/array.lua
CHANGED
|
@@ -12,27 +12,27 @@ local ____exports = {}
|
|
|
12
12
|
local ____random = require("functions.random")
|
|
13
13
|
local getRandomInt = ____random.getRandomInt
|
|
14
14
|
local ____rng = require("functions.rng")
|
|
15
|
-
local
|
|
15
|
+
local getRandomSeed = ____rng.getRandomSeed
|
|
16
16
|
local ____utils = require("functions.utils")
|
|
17
17
|
local ____repeat = ____utils["repeat"]
|
|
18
|
-
function ____exports.getRandomArrayIndex(self, array,
|
|
19
|
-
if
|
|
20
|
-
|
|
18
|
+
function ____exports.getRandomArrayIndex(self, array, seedOrRNG)
|
|
19
|
+
if seedOrRNG == nil then
|
|
20
|
+
seedOrRNG = getRandomSeed(nil)
|
|
21
21
|
end
|
|
22
22
|
if #array == 0 then
|
|
23
23
|
error("Failed to get a random array index since the provided array is empty.")
|
|
24
24
|
end
|
|
25
|
-
return getRandomInt(nil, 0, #array - 1,
|
|
25
|
+
return getRandomInt(nil, 0, #array - 1, seedOrRNG)
|
|
26
26
|
end
|
|
27
|
-
function ____exports.shuffleArrayInPlace(self, array,
|
|
28
|
-
if
|
|
29
|
-
|
|
27
|
+
function ____exports.shuffleArrayInPlace(self, array, seedOrRNG)
|
|
28
|
+
if seedOrRNG == nil then
|
|
29
|
+
seedOrRNG = getRandomSeed(nil)
|
|
30
30
|
end
|
|
31
31
|
local currentIndex = #array
|
|
32
32
|
local randomIndex
|
|
33
33
|
while currentIndex > 0 do
|
|
34
34
|
currentIndex = currentIndex - 1
|
|
35
|
-
randomIndex = ____exports.getRandomArrayIndex(nil, array,
|
|
35
|
+
randomIndex = ____exports.getRandomArrayIndex(nil, array, seedOrRNG)
|
|
36
36
|
local ____temp_0 = {array[randomIndex + 1], array[currentIndex + 1]}
|
|
37
37
|
array[currentIndex + 1] = ____temp_0[1]
|
|
38
38
|
array[randomIndex + 1] = ____temp_0[2]
|
|
@@ -115,9 +115,9 @@ end
|
|
|
115
115
|
function ____exports.getLastElement(self, array)
|
|
116
116
|
return array[#array]
|
|
117
117
|
end
|
|
118
|
-
function ____exports.getRandomArrayElement(self, array,
|
|
119
|
-
if
|
|
120
|
-
|
|
118
|
+
function ____exports.getRandomArrayElement(self, array, seedOrRNG, exceptions)
|
|
119
|
+
if seedOrRNG == nil then
|
|
120
|
+
seedOrRNG = getRandomSeed(nil)
|
|
121
121
|
end
|
|
122
122
|
if exceptions == nil then
|
|
123
123
|
exceptions = {}
|
|
@@ -130,17 +130,17 @@ function ____exports.getRandomArrayElement(self, array, rng, exceptions)
|
|
|
130
130
|
array,
|
|
131
131
|
table.unpack(exceptions)
|
|
132
132
|
)
|
|
133
|
-
local randomIndex = ____exports.getRandomArrayIndex(nil, arrayWithoutExceptions,
|
|
133
|
+
local randomIndex = ____exports.getRandomArrayIndex(nil, arrayWithoutExceptions, seedOrRNG)
|
|
134
134
|
return arrayWithoutExceptions[randomIndex + 1]
|
|
135
135
|
end
|
|
136
|
-
function ____exports.getRandomArrayElementAndRemove(self, array,
|
|
137
|
-
if
|
|
138
|
-
|
|
136
|
+
function ____exports.getRandomArrayElementAndRemove(self, array, seedOrRNG, exceptions)
|
|
137
|
+
if seedOrRNG == nil then
|
|
138
|
+
seedOrRNG = getRandomSeed(nil)
|
|
139
139
|
end
|
|
140
140
|
if exceptions == nil then
|
|
141
141
|
exceptions = {}
|
|
142
142
|
end
|
|
143
|
-
local randomArrayElement = ____exports.getRandomArrayElement(nil, array,
|
|
143
|
+
local randomArrayElement = ____exports.getRandomArrayElement(nil, array, seedOrRNG, exceptions)
|
|
144
144
|
____exports.arrayRemoveInPlace(nil, array, randomArrayElement)
|
|
145
145
|
return randomArrayElement
|
|
146
146
|
end
|
|
@@ -192,12 +192,12 @@ function ____exports.isArrayInArray(self, arrayToMatch, parentArray)
|
|
|
192
192
|
function(____, element) return ____exports.arrayEquals(nil, element, arrayToMatch) end
|
|
193
193
|
)
|
|
194
194
|
end
|
|
195
|
-
function ____exports.shuffleArray(self, originalArray,
|
|
196
|
-
if
|
|
197
|
-
|
|
195
|
+
function ____exports.shuffleArray(self, originalArray, seedOrRNG)
|
|
196
|
+
if seedOrRNG == nil then
|
|
197
|
+
seedOrRNG = getRandomSeed(nil)
|
|
198
198
|
end
|
|
199
199
|
local array = ____exports.copyArray(nil, originalArray)
|
|
200
|
-
____exports.shuffleArrayInPlace(nil, array,
|
|
200
|
+
____exports.shuffleArrayInPlace(nil, array, seedOrRNG)
|
|
201
201
|
return array
|
|
202
202
|
end
|
|
203
203
|
function ____exports.sumArray(self, array)
|
|
@@ -43,24 +43,27 @@ export declare function getMaxCards(): int;
|
|
|
43
43
|
* - any objects like Dice Shard
|
|
44
44
|
* - any modded cards.
|
|
45
45
|
*
|
|
46
|
-
* @param
|
|
46
|
+
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
47
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
47
48
|
* @param exceptions Optional. An array of cards to not select.
|
|
48
49
|
*/
|
|
49
|
-
export declare function getRandomCard(
|
|
50
|
+
export declare function getRandomCard(seedOrRNG?: Seed | RNG, exceptions?: Card[]): Card;
|
|
50
51
|
/**
|
|
51
52
|
* @param cardType The card type that represents the pool of cards to select from.
|
|
52
|
-
* @param
|
|
53
|
+
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
54
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
53
55
|
* @param exceptions Optional. An array of cards to not select.
|
|
54
56
|
*/
|
|
55
|
-
export declare function getRandomCardOfType(cardType: CardType,
|
|
57
|
+
export declare function getRandomCardOfType(cardType: CardType, seedOrRNG?: Seed | RNG, exceptions?: Card[]): Card;
|
|
56
58
|
/**
|
|
57
59
|
* Has an equal chance of returning any rune (e.g. Rune of Hagalaz, Blank Rune, Black Rune, Soul of
|
|
58
60
|
* Isaac, etc.). This will never return a Rune Shard.
|
|
59
61
|
*
|
|
60
|
-
* @param
|
|
62
|
+
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
63
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
61
64
|
* @param exceptions Optional. An array of runes to not select.
|
|
62
65
|
*/
|
|
63
|
-
export declare function getRandomRune(
|
|
66
|
+
export declare function getRandomRune(seedOrRNG?: Seed | RNG, exceptions?: Card[]): Card;
|
|
64
67
|
/**
|
|
65
68
|
* Returns true for cards that have the following card type:
|
|
66
69
|
* - CardType.TAROT
|
package/dist/functions/cards.lua
CHANGED
|
@@ -21,7 +21,7 @@ local DEFAULT_CARD_TYPE = ____cardTypes.DEFAULT_CARD_TYPE
|
|
|
21
21
|
local ____math = require("functions.math")
|
|
22
22
|
local range = ____math.range
|
|
23
23
|
local ____rng = require("functions.rng")
|
|
24
|
-
local
|
|
24
|
+
local getRandomSeed = ____rng.getRandomSeed
|
|
25
25
|
local ____set = require("functions.set")
|
|
26
26
|
local addSetsToSet = ____set.addSetsToSet
|
|
27
27
|
local getRandomSetElement = ____set.getRandomSetElement
|
|
@@ -100,35 +100,35 @@ function ____exports.getCardName(self, card)
|
|
|
100
100
|
end
|
|
101
101
|
return DEFAULT_CARD_NAME
|
|
102
102
|
end
|
|
103
|
-
function ____exports.getRandomCard(self,
|
|
104
|
-
if
|
|
105
|
-
|
|
103
|
+
function ____exports.getRandomCard(self, seedOrRNG, exceptions)
|
|
104
|
+
if seedOrRNG == nil then
|
|
105
|
+
seedOrRNG = getRandomSeed(nil)
|
|
106
106
|
end
|
|
107
107
|
if exceptions == nil then
|
|
108
108
|
exceptions = {}
|
|
109
109
|
end
|
|
110
|
-
return getRandomSetElement(nil, CARD_SET,
|
|
110
|
+
return getRandomSetElement(nil, CARD_SET, seedOrRNG, exceptions)
|
|
111
111
|
end
|
|
112
|
-
function ____exports.getRandomCardOfType(self, cardType,
|
|
113
|
-
if
|
|
114
|
-
|
|
112
|
+
function ____exports.getRandomCardOfType(self, cardType, seedOrRNG, exceptions)
|
|
113
|
+
if seedOrRNG == nil then
|
|
114
|
+
seedOrRNG = getRandomSeed(nil)
|
|
115
115
|
end
|
|
116
116
|
if exceptions == nil then
|
|
117
117
|
exceptions = {}
|
|
118
118
|
end
|
|
119
119
|
local cardSet = ____exports.getCardsOfType(nil, cardType)
|
|
120
|
-
return getRandomSetElement(nil, cardSet,
|
|
120
|
+
return getRandomSetElement(nil, cardSet, seedOrRNG, exceptions)
|
|
121
121
|
end
|
|
122
|
-
function ____exports.getRandomRune(self,
|
|
123
|
-
if
|
|
124
|
-
|
|
122
|
+
function ____exports.getRandomRune(self, seedOrRNG, exceptions)
|
|
123
|
+
if seedOrRNG == nil then
|
|
124
|
+
seedOrRNG = getRandomSeed(nil)
|
|
125
125
|
end
|
|
126
126
|
if exceptions == nil then
|
|
127
127
|
exceptions = {}
|
|
128
128
|
end
|
|
129
129
|
local runesSet = ____exports.getCardsOfType(nil, CardType.RUNE)
|
|
130
130
|
runesSet:delete(Card.RUNE_SHARD)
|
|
131
|
-
return getRandomSetElement(nil, runesSet,
|
|
131
|
+
return getRandomSetElement(nil, runesSet, seedOrRNG, exceptions)
|
|
132
132
|
end
|
|
133
133
|
function ____exports.isCard(self, card)
|
|
134
134
|
return CARD_SET:has(card)
|
|
@@ -5,7 +5,7 @@ local Map = ____lualib.Map
|
|
|
5
5
|
local __TS__InstanceOf = ____lualib.__TS__InstanceOf
|
|
6
6
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
7
7
|
local ____exports = {}
|
|
8
|
-
local isTSTLClass, copyClass, getNewClassFromMetatable, deepCopyValue, checkMetatable, validateValue, TSTL_CLASS_KEYS
|
|
8
|
+
local isTSTLClass, copyClass, getNewClassFromMetatable, deepCopyValue, checkMetatable, validateValue, isCopyableIsaacAPIClass, TSTL_CLASS_KEYS
|
|
9
9
|
local ____DefaultMap = require("classes.DefaultMap")
|
|
10
10
|
local DefaultMap = ____DefaultMap.DefaultMap
|
|
11
11
|
local ____SerializationBrand = require("enums.private.SerializationBrand")
|
|
@@ -15,6 +15,8 @@ local ____SerializationType = require("enums.SerializationType")
|
|
|
15
15
|
local SerializationType = ____SerializationType.SerializationType
|
|
16
16
|
local ____constants = require("features.saveDataManager.constants")
|
|
17
17
|
local SAVE_DATA_MANAGER_DEBUG = ____constants.SAVE_DATA_MANAGER_DEBUG
|
|
18
|
+
local ____color = require("functions.color")
|
|
19
|
+
local isColor = ____color.isColor
|
|
18
20
|
local ____log = require("functions.log")
|
|
19
21
|
local log = ____log.log
|
|
20
22
|
local ____rng = require("functions.rng")
|
|
@@ -236,12 +238,15 @@ function checkMetatable(self, ____table, traversalDescription)
|
|
|
236
238
|
error(("The deepCopy function detected that \"" .. tableDescription) .. "\" has a metatable. Copying tables with metatables is not supported, unless they are explicitly handled by the save data manager. (e.g. Vectors, TypeScriptToLua Maps, etc.)")
|
|
237
239
|
end
|
|
238
240
|
function validateValue(self, value, valueType, traversalDescription)
|
|
239
|
-
if
|
|
241
|
+
if isCopyableIsaacAPIClass(nil, value) then
|
|
240
242
|
return
|
|
241
243
|
end
|
|
242
244
|
if valueType == "function" or valueType == "nil" or valueType == "thread" or valueType == "userdata" then
|
|
243
|
-
error(((("The deepCopy function detected that \"" .. traversalDescription) .. "\"
|
|
245
|
+
error(((("The deepCopy function detected that \"" .. traversalDescription) .. "\" has a value of type \"") .. valueType) .. "\", which is not supported.")
|
|
244
246
|
end
|
|
245
247
|
end
|
|
248
|
+
function isCopyableIsaacAPIClass(self, value)
|
|
249
|
+
return isColor(nil, value) or isRNG(nil, value) or isVector(nil, value)
|
|
250
|
+
end
|
|
246
251
|
TSTL_CLASS_KEYS = __TS__New(Set, {"____constructor", "__index", "constructor"})
|
|
247
252
|
return ____exports
|
|
@@ -9,4 +9,4 @@ export declare function getJSONRoomsOfSubType(jsonRooms: JSONRoom[], subType: in
|
|
|
9
9
|
* properly account for each room weight using the algorithm from:
|
|
10
10
|
* https://stackoverflow.com/questions/1761626/weighted-random-numbers
|
|
11
11
|
*/
|
|
12
|
-
export declare function getRandomJSONRoom(jsonRooms: JSONRoom[],
|
|
12
|
+
export declare function getRandomJSONRoom(jsonRooms: JSONRoom[], seedOrRNG?: Seed | RNG, verbose?: boolean): JSONRoom;
|
|
@@ -10,7 +10,7 @@ local log = ____log.log
|
|
|
10
10
|
local ____random = require("functions.random")
|
|
11
11
|
local getRandomFloat = ____random.getRandomFloat
|
|
12
12
|
local ____rng = require("functions.rng")
|
|
13
|
-
local
|
|
13
|
+
local getRandomSeed = ____rng.getRandomSeed
|
|
14
14
|
function getTotalWeightOfJSONRooms(self, jsonRooms)
|
|
15
15
|
local weights = __TS__ArrayMap(
|
|
16
16
|
jsonRooms,
|
|
@@ -66,9 +66,9 @@ function ____exports.getJSONRoomsOfSubType(self, jsonRooms, subType)
|
|
|
66
66
|
end
|
|
67
67
|
)
|
|
68
68
|
end
|
|
69
|
-
function ____exports.getRandomJSONRoom(self, jsonRooms,
|
|
70
|
-
if
|
|
71
|
-
|
|
69
|
+
function ____exports.getRandomJSONRoom(self, jsonRooms, seedOrRNG, verbose)
|
|
70
|
+
if seedOrRNG == nil then
|
|
71
|
+
seedOrRNG = getRandomSeed(nil)
|
|
72
72
|
end
|
|
73
73
|
if verbose == nil then
|
|
74
74
|
verbose = false
|
|
@@ -77,7 +77,7 @@ function ____exports.getRandomJSONRoom(self, jsonRooms, rng, verbose)
|
|
|
77
77
|
if verbose then
|
|
78
78
|
log("Total weight of the JSON rooms provided: " .. tostring(totalWeight))
|
|
79
79
|
end
|
|
80
|
-
local chosenWeight = getRandomFloat(nil, 0, totalWeight,
|
|
80
|
+
local chosenWeight = getRandomFloat(nil, 0, totalWeight, seedOrRNG)
|
|
81
81
|
if verbose then
|
|
82
82
|
log("Randomly chose weight for JSON room: " .. tostring(chosenWeight))
|
|
83
83
|
end
|
package/dist/functions/npc.d.ts
CHANGED
|
@@ -49,6 +49,8 @@ export declare function isDyingEggyWithNoSpidersLeft(npc: EntityNPC): boolean;
|
|
|
49
49
|
* enemies.
|
|
50
50
|
*/
|
|
51
51
|
export declare function isRaglingDeathPatch(npc: EntityNPC): boolean;
|
|
52
|
+
/** Helper function to check if the provided NPC is a Sin miniboss, such as Sloth or Lust. */
|
|
53
|
+
export declare function isSin(npc: EntityNPC): boolean;
|
|
52
54
|
/**
|
|
53
55
|
* Helper function to remove all NPCs in the room.
|
|
54
56
|
*
|
package/dist/functions/npc.lua
CHANGED
|
@@ -7,6 +7,8 @@ local ____exports = {}
|
|
|
7
7
|
local NON_ALIVE_NPCS_TYPE_VARIANT, NON_ALIVE_NPCS_TYPE_VARIANT_SUBTYPE
|
|
8
8
|
local ____constants = require("constants")
|
|
9
9
|
local EGGY_STATE_FRAME_OF_FINAL_SPIDER = ____constants.EGGY_STATE_FRAME_OF_FINAL_SPIDER
|
|
10
|
+
local ____sinEntityTypesSet = require("sets.sinEntityTypesSet")
|
|
11
|
+
local SIN_ENTITY_TYPES_SET = ____sinEntityTypesSet.SIN_ENTITY_TYPES_SET
|
|
10
12
|
local ____entity = require("functions.entity")
|
|
11
13
|
local getEntities = ____entity.getEntities
|
|
12
14
|
local getFilteredNewEntities = ____entity.getFilteredNewEntities
|
|
@@ -139,6 +141,9 @@ function ____exports.getBosses(self, matchingEntityType, matchingVariant, matchi
|
|
|
139
141
|
function(____, npc) return npc:IsBoss() end
|
|
140
142
|
)
|
|
141
143
|
end
|
|
144
|
+
function ____exports.isSin(self, npc)
|
|
145
|
+
return SIN_ENTITY_TYPES_SET:has(npc.Type)
|
|
146
|
+
end
|
|
142
147
|
function ____exports.removeAllNPCs(self, cap)
|
|
143
148
|
local npcs = ____exports.getNPCs(nil)
|
|
144
149
|
return removeEntities(nil, npcs, cap)
|
|
@@ -1,39 +1,27 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
/**
|
|
3
3
|
* This returns a random float between 0 and 1. It is inclusive on the low end, but exclusive on
|
|
4
|
-
* the high end. (This is because the `RNG.RandomFloat` method
|
|
5
|
-
*
|
|
4
|
+
* the high end. (This is because the `RNG.RandomFloat` method will never return a value of exactly
|
|
5
|
+
* 1.)
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
8
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
9
9
|
*/
|
|
10
|
-
export declare function getRandom(
|
|
10
|
+
export declare function getRandom(seedOrRNG?: Seed | RNG): float;
|
|
11
11
|
/**
|
|
12
|
-
* This returns a random float between min and max.
|
|
13
|
-
* the high end. (This is because the `RNG.RandomFloat` method can return a value of 0.999, but it
|
|
14
|
-
* will never return a value of exactly 1.)
|
|
15
|
-
*
|
|
16
|
-
* Note that this function will invoke the `Next` method on the `RNG` object before returning the
|
|
17
|
-
* random number.
|
|
12
|
+
* This returns a random float between min and max.
|
|
18
13
|
*
|
|
19
14
|
* Example:
|
|
20
15
|
* ```ts
|
|
21
16
|
* const realNumberBetweenOneAndThree = getRandomFloat(1, 3);
|
|
22
17
|
* ```
|
|
18
|
+
*
|
|
19
|
+
* @param min The lower bound for the random number (inclusive).
|
|
20
|
+
* @param max The upper bound for the random number (exclusive).
|
|
21
|
+
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
22
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
23
23
|
*/
|
|
24
|
-
export declare function getRandomFloat(min: int, max: int,
|
|
25
|
-
/**
|
|
26
|
-
* This returns a random float between min and max. It is inclusive on the low end, but exclusive on
|
|
27
|
-
* the high end. (This is because the `RNG.RandomFloat` method can return a value of 0.999, but it
|
|
28
|
-
* will never return a value of exactly 1.)
|
|
29
|
-
*/
|
|
30
|
-
export declare function getRandomFloatFromSeed(min: int, max: int, seed: Seed): float;
|
|
31
|
-
/**
|
|
32
|
-
* This returns a random float between 0 and 1. It is inclusive on the low end, but exclusive on
|
|
33
|
-
* the high end. (This is because the `RNG.RandomFloat` method can return a value of 0.999, but it
|
|
34
|
-
* will never return a value of exactly 1.)
|
|
35
|
-
*/
|
|
36
|
-
export declare function getRandomFromSeed(seed: Seed): float;
|
|
24
|
+
export declare function getRandomFloat(min: int, max: int, seedOrRNG?: Seed | RNG): float;
|
|
37
25
|
/**
|
|
38
26
|
* This returns a random integer between min and max. It is inclusive on both ends.
|
|
39
27
|
*
|
|
@@ -44,7 +32,10 @@ export declare function getRandomFromSeed(seed: Seed): float;
|
|
|
44
32
|
* ```ts
|
|
45
33
|
* const oneTwoOrThree = getRandomInt(1, 3);
|
|
46
34
|
* ```
|
|
35
|
+
*
|
|
36
|
+
* @param min The lower bound for the random number (inclusive).
|
|
37
|
+
* @param max The upper bound for the random number (inclusive).
|
|
38
|
+
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
39
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
47
40
|
*/
|
|
48
|
-
export declare function getRandomInt(min: int, max: int,
|
|
49
|
-
/** This returns a random integer between min and max. It is inclusive on both ends. */
|
|
50
|
-
export declare function getRandomIntFromSeed(min: int, max: int, seed: Seed): int;
|
|
41
|
+
export declare function getRandomInt(min: int, max: int, seedOrRNG?: Seed | RNG): int;
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____exports = {}
|
|
3
3
|
local ____rng = require("functions.rng")
|
|
4
|
+
local getRandomSeed = ____rng.getRandomSeed
|
|
5
|
+
local isRNG = ____rng.isRNG
|
|
4
6
|
local newRNG = ____rng.newRNG
|
|
5
|
-
function ____exports.getRandom(self,
|
|
6
|
-
if
|
|
7
|
-
|
|
7
|
+
function ____exports.getRandom(self, seedOrRNG)
|
|
8
|
+
if seedOrRNG == nil then
|
|
9
|
+
seedOrRNG = getRandomSeed(nil)
|
|
8
10
|
end
|
|
11
|
+
local rng = isRNG(nil, seedOrRNG) and seedOrRNG or newRNG(nil, seedOrRNG)
|
|
9
12
|
return rng:RandomFloat()
|
|
10
13
|
end
|
|
11
|
-
function ____exports.getRandomFloat(self, min, max,
|
|
12
|
-
if
|
|
13
|
-
|
|
14
|
+
function ____exports.getRandomFloat(self, min, max, seedOrRNG)
|
|
15
|
+
if seedOrRNG == nil then
|
|
16
|
+
seedOrRNG = getRandomSeed(nil)
|
|
14
17
|
end
|
|
15
18
|
if min > max then
|
|
16
19
|
local oldMin = min
|
|
@@ -18,20 +21,13 @@ function ____exports.getRandomFloat(self, min, max, rng)
|
|
|
18
21
|
min = oldMax
|
|
19
22
|
max = oldMin
|
|
20
23
|
end
|
|
21
|
-
return min + ____exports.getRandom(nil,
|
|
24
|
+
return min + ____exports.getRandom(nil, seedOrRNG) * (max - min)
|
|
22
25
|
end
|
|
23
|
-
function ____exports.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
end
|
|
27
|
-
function ____exports.getRandomFromSeed(self, seed)
|
|
28
|
-
local rng = newRNG(nil, seed)
|
|
29
|
-
return ____exports.getRandom(nil, rng)
|
|
30
|
-
end
|
|
31
|
-
function ____exports.getRandomInt(self, min, max, rng)
|
|
32
|
-
if rng == nil then
|
|
33
|
-
rng = newRNG(nil)
|
|
26
|
+
function ____exports.getRandomInt(self, min, max, seedOrRNG)
|
|
27
|
+
if seedOrRNG == nil then
|
|
28
|
+
seedOrRNG = getRandomSeed(nil)
|
|
34
29
|
end
|
|
30
|
+
local rng = isRNG(nil, seedOrRNG) and seedOrRNG or newRNG(nil, seedOrRNG)
|
|
35
31
|
if min > max then
|
|
36
32
|
local oldMin = min
|
|
37
33
|
local oldMax = max
|
|
@@ -40,8 +36,4 @@ function ____exports.getRandomInt(self, min, max, rng)
|
|
|
40
36
|
end
|
|
41
37
|
return rng:RandomInt(max - min + 1) + min
|
|
42
38
|
end
|
|
43
|
-
function ____exports.getRandomIntFromSeed(self, min, max, seed)
|
|
44
|
-
local rng = newRNG(nil, seed)
|
|
45
|
-
return ____exports.getRandomInt(nil, min, max, rng)
|
|
46
|
-
end
|
|
47
39
|
return ____exports
|
|
@@ -15,6 +15,13 @@ export declare function getAllRoomGridIndexes(): int[];
|
|
|
15
15
|
* tricky to properly detect.
|
|
16
16
|
*/
|
|
17
17
|
export declare function getCurrentDimension(): Dimension;
|
|
18
|
+
/**
|
|
19
|
+
* Helper function to get the grid index delta that a door out of the given room shape would lead
|
|
20
|
+
* to. For example, if you went through the bottom door in a room of `RoomShape.ROOMSHAPE_1x2`, you
|
|
21
|
+
* would end up in a room with a grid index that is +26 units from the `SafeGridIndex` of where you
|
|
22
|
+
* started.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getGridIndexDelta(roomShape: RoomShape, doorSlot: DoorSlot): int | undefined;
|
|
18
25
|
/**
|
|
19
26
|
* Helper function to get an array of all of the safe grid indexes for rooms that match the
|
|
20
27
|
* specified room type.
|
package/dist/functions/rooms.lua
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
3
|
+
local Map = ____lualib.Map
|
|
3
4
|
local Set = ____lualib.Set
|
|
4
5
|
local __TS__New = ____lualib.__TS__New
|
|
5
6
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
6
7
|
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
7
8
|
local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
|
|
8
|
-
local Map = ____lualib.Map
|
|
9
9
|
local ____exports = {}
|
|
10
10
|
local ____cachedClasses = require("cachedClasses")
|
|
11
11
|
local game = ____cachedClasses.game
|
|
@@ -13,6 +13,8 @@ local sfxManager = ____cachedClasses.sfxManager
|
|
|
13
13
|
local ____constants = require("constants")
|
|
14
14
|
local MAX_ROOM_INDEX = ____constants.MAX_ROOM_INDEX
|
|
15
15
|
local NUM_DIMENSIONS = ____constants.NUM_DIMENSIONS
|
|
16
|
+
local ____roomShapeToGridIndexDelta = require("objects.roomShapeToGridIndexDelta")
|
|
17
|
+
local ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA = ____roomShapeToGridIndexDelta.ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA
|
|
16
18
|
local ____doors = require("functions.doors")
|
|
17
19
|
local closeAllDoors = ____doors.closeAllDoors
|
|
18
20
|
local getDoors = ____doors.getDoors
|
|
@@ -106,6 +108,13 @@ function ____exports.getCurrentDimension(self)
|
|
|
106
108
|
end
|
|
107
109
|
return error("Failed to get the current dimension using the starting room index of: " .. tostring(startingRoomGridIndex))
|
|
108
110
|
end
|
|
111
|
+
function ____exports.getGridIndexDelta(self, roomShape, doorSlot)
|
|
112
|
+
local doorSlotToGridIndexMap = ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA[roomShape]
|
|
113
|
+
if doorSlotToGridIndexMap == nil then
|
|
114
|
+
return nil
|
|
115
|
+
end
|
|
116
|
+
return doorSlotToGridIndexMap:get(doorSlot)
|
|
117
|
+
end
|
|
109
118
|
function ____exports.getRoomGridIndexesForType(self, ...)
|
|
110
119
|
local roomTypesSet = __TS__New(Set, {...})
|
|
111
120
|
local rooms = ____exports.getRooms(nil)
|
|
@@ -246,12 +255,12 @@ function ____exports.setRoomCleared(self)
|
|
|
246
255
|
for ____, door in ipairs(getDoors(nil)) do
|
|
247
256
|
do
|
|
248
257
|
if isHiddenSecretRoomDoor(nil, door) then
|
|
249
|
-
goto
|
|
258
|
+
goto __continue48
|
|
250
259
|
end
|
|
251
260
|
openDoorFast(nil, door)
|
|
252
261
|
door.ExtraVisible = false
|
|
253
262
|
end
|
|
254
|
-
::
|
|
263
|
+
::__continue48::
|
|
255
264
|
end
|
|
256
265
|
sfxManager:Stop(SoundEffect.SOUND_DOOR_HEAVY_OPEN)
|
|
257
266
|
game:ShakeScreen(0)
|
package/dist/functions/set.d.ts
CHANGED
|
@@ -25,10 +25,11 @@ export declare function deleteSetsFromSet<T>(mainSet: Set<T>, ...setsToRemove: A
|
|
|
25
25
|
* Helper function to get a random element from the provided set.
|
|
26
26
|
*
|
|
27
27
|
* @param set The set to get an element from.
|
|
28
|
-
* @param
|
|
28
|
+
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
29
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
29
30
|
* @param exceptions Optional. An array of elements to skip over if selected.
|
|
30
31
|
*/
|
|
31
|
-
export declare function getRandomSetElement<T>(set: Set<T> | ReadonlySet<T>,
|
|
32
|
+
export declare function getRandomSetElement<T>(set: Set<T> | ReadonlySet<T>, seedOrRNG?: Seed | RNG, exceptions?: T[] | readonly T[]): T;
|
|
32
33
|
/**
|
|
33
34
|
* Helper function to get a sorted array based on the contents of a set.
|
|
34
35
|
*
|
package/dist/functions/set.lua
CHANGED
|
@@ -8,7 +8,7 @@ local ____exports = {}
|
|
|
8
8
|
local ____array = require("functions.array")
|
|
9
9
|
local getRandomArrayElement = ____array.getRandomArrayElement
|
|
10
10
|
local ____rng = require("functions.rng")
|
|
11
|
-
local
|
|
11
|
+
local getRandomSeed = ____rng.getRandomSeed
|
|
12
12
|
function ____exports.getSortedSetValues(self, set)
|
|
13
13
|
local values = set:values()
|
|
14
14
|
local array = {__TS__Spread(values)}
|
|
@@ -48,14 +48,14 @@ function ____exports.deleteSetsFromSet(self, mainSet, ...)
|
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
|
-
function ____exports.getRandomSetElement(self, set,
|
|
52
|
-
if
|
|
53
|
-
|
|
51
|
+
function ____exports.getRandomSetElement(self, set, seedOrRNG, exceptions)
|
|
52
|
+
if seedOrRNG == nil then
|
|
53
|
+
seedOrRNG = getRandomSeed(nil)
|
|
54
54
|
end
|
|
55
55
|
if exceptions == nil then
|
|
56
56
|
exceptions = {}
|
|
57
57
|
end
|
|
58
58
|
local array = ____exports.getSortedSetValues(nil, set)
|
|
59
|
-
return getRandomArrayElement(nil, array,
|
|
59
|
+
return getRandomArrayElement(nil, array, seedOrRNG, exceptions)
|
|
60
60
|
end
|
|
61
61
|
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> | undefined;
|
|
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] = nil
|
|
84
|
+
}
|
|
85
|
+
return ____exports
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local Set = ____lualib.Set
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
4
|
+
local ____exports = {}
|
|
5
|
+
____exports.SIN_ENTITY_TYPES_SET = __TS__New(Set, {
|
|
6
|
+
EntityType.ENTITY_SLOTH,
|
|
7
|
+
EntityType.ENTITY_LUST,
|
|
8
|
+
EntityType.ENTITY_WRATH,
|
|
9
|
+
EntityType.ENTITY_GLUTTONY,
|
|
10
|
+
EntityType.ENTITY_GREED,
|
|
11
|
+
EntityType.ENTITY_ENVY,
|
|
12
|
+
EntityType.ENTITY_PRIDE
|
|
13
|
+
})
|
|
14
|
+
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.214",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"isaacscript-lint": "^1.0.95",
|
|
30
30
|
"isaacscript-tsconfig": "^1.1.8",
|
|
31
31
|
"typedoc": "^0.22.13",
|
|
32
|
-
"typescript": "4.6.
|
|
32
|
+
"typescript": "4.6.3",
|
|
33
33
|
"typescript-to-lua": "^1.4.2"
|
|
34
34
|
}
|
|
35
35
|
}
|