isaacscript-common 40.0.0 → 41.0.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/dist/index.rollup.d.ts +364 -334
- package/dist/isaacscript-common.lua +379 -378
- package/dist/src/classes/features/other/FlyingDetection.lua +2 -2
- package/dist/src/classes/features/other/ItemPoolDetection.lua +2 -2
- package/dist/src/classes/features/other/ModdedElementDetection.d.ts +0 -86
- package/dist/src/classes/features/other/ModdedElementDetection.d.ts.map +1 -1
- package/dist/src/classes/features/other/ModdedElementDetection.lua +1 -57
- package/dist/src/classes/features/other/ModdedElementSets.d.ts +250 -210
- package/dist/src/classes/features/other/ModdedElementSets.d.ts.map +1 -1
- package/dist/src/classes/features/other/ModdedElementSets.lua +285 -284
- package/dist/src/core/constants.d.ts +17 -2
- package/dist/src/core/constants.d.ts.map +1 -1
- package/dist/src/core/constants.lua +8 -1
- package/dist/src/core/constantsFirstLast.d.ts +5 -0
- package/dist/src/core/constantsFirstLast.d.ts.map +1 -1
- package/dist/src/core/constantsVanilla.d.ts +93 -0
- package/dist/src/core/constantsVanilla.d.ts.map +1 -0
- package/dist/src/core/constantsVanilla.lua +115 -0
- package/dist/src/core/upgradeMod.lua +3 -0
- package/dist/src/functions/cards.d.ts +0 -7
- package/dist/src/functions/cards.d.ts.map +1 -1
- package/dist/src/functions/cards.lua +0 -10
- package/dist/src/functions/collectibles.d.ts +0 -10
- package/dist/src/functions/collectibles.d.ts.map +1 -1
- package/dist/src/functions/collectibles.lua +0 -13
- package/dist/src/functions/dimensions.d.ts +0 -4
- package/dist/src/functions/dimensions.d.ts.map +1 -1
- package/dist/src/functions/dimensions.lua +2 -8
- package/dist/src/functions/pills.d.ts +0 -2
- package/dist/src/functions/pills.d.ts.map +1 -1
- package/dist/src/functions/pills.lua +0 -5
- package/dist/src/functions/rooms.lua +2 -2
- package/dist/src/functions/trinkets.d.ts +0 -9
- package/dist/src/functions/trinkets.d.ts.map +1 -1
- package/dist/src/functions/trinkets.lua +0 -12
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.lua +8 -0
- package/package.json +1 -1
- package/src/classes/features/other/FlyingDetection.ts +2 -2
- package/src/classes/features/other/ItemPoolDetection.ts +2 -2
- package/src/classes/features/other/ModdedElementDetection.ts +4 -156
- package/src/classes/features/other/ModdedElementSets.ts +552 -486
- package/src/core/constants.ts +15 -2
- package/src/core/constantsFirstLast.ts +5 -1
- package/src/core/constantsVanilla.ts +183 -0
- package/src/core/upgradeMod.ts +6 -1
- package/src/functions/cards.ts +1 -15
- package/src/functions/collectibles.ts +1 -18
- package/src/functions/dimensions.ts +2 -10
- package/src/functions/pills.ts +0 -6
- package/src/functions/rooms.ts +3 -3
- package/src/functions/trinkets.ts +1 -17
- package/src/index.ts +1 -0
package/src/core/constants.ts
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
newReadonlyVector,
|
|
15
15
|
} from "../functions/readOnly";
|
|
16
16
|
import { asCollectibleType } from "../functions/types";
|
|
17
|
+
import { eRange } from "../functions/utils";
|
|
17
18
|
import { NUM_NORMAL_PILL_COLORS } from "./constantsFirstLast";
|
|
18
19
|
|
|
19
20
|
/**
|
|
@@ -245,7 +246,19 @@ export const NEW_RUN_PLAYER_STARTING_POSITION = newReadonlyVector(320, 380);
|
|
|
245
246
|
/** Corresponds to the maximum value for `EntityPlayer.SamsonBerserkCharge`. */
|
|
246
247
|
export const MAX_TAINTED_SAMSON_BERSERK_CHARGE = 100_000;
|
|
247
248
|
|
|
248
|
-
|
|
249
|
+
/**
|
|
250
|
+
* The number of dimensions, not including `Dimension.CURRENT`. (This is derived from the
|
|
251
|
+
* `Dimension` enum.)
|
|
252
|
+
*/
|
|
253
|
+
export const NUM_DIMENSIONS = getEnumLength(Dimension) - 1;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* An array containing every valid `Dimension`, not including `Dimension.CURRENT`. (This is derived
|
|
257
|
+
* from the `NUM_DIMENSIONS` constant.)
|
|
258
|
+
*/
|
|
259
|
+
export const DIMENSIONS: readonly Dimension[] = eRange(
|
|
260
|
+
NUM_DIMENSIONS,
|
|
261
|
+
) as Dimension[];
|
|
249
262
|
|
|
250
263
|
/**
|
|
251
264
|
* The pill pool for each run is comprised of one effect for each unique pill color (minus gold and
|
|
@@ -253,7 +266,7 @@ export const NUM_DIMENSIONS = getEnumLength(Dimension) - 1; // Account for "Dime
|
|
|
253
266
|
*/
|
|
254
267
|
// TypeDoc will not work properly with the preferred export form.
|
|
255
268
|
// eslint-disable-next-line unicorn/prefer-export-from
|
|
256
|
-
export const
|
|
269
|
+
export const NUM_PILL_COLORS_IN_POOL = NUM_NORMAL_PILL_COLORS;
|
|
257
270
|
|
|
258
271
|
export const ONE_BY_ONE_ROOM_GRID_SIZE = 135;
|
|
259
272
|
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants relating to collections for various vanilla objects.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type {
|
|
8
|
+
CardType,
|
|
9
|
+
CollectibleType,
|
|
10
|
+
PillEffect,
|
|
11
|
+
TrinketType,
|
|
12
|
+
} from "isaac-typescript-definitions";
|
|
13
|
+
import {
|
|
14
|
+
asCardType,
|
|
15
|
+
asCollectibleType,
|
|
16
|
+
asPillEffect,
|
|
17
|
+
asTrinketType,
|
|
18
|
+
} from "../functions/types";
|
|
19
|
+
import { iRange } from "../functions/utils";
|
|
20
|
+
import { ReadonlySet } from "../types/ReadonlySet";
|
|
21
|
+
import { itemConfig } from "./cachedClasses";
|
|
22
|
+
import {
|
|
23
|
+
FIRST_CARD_TYPE,
|
|
24
|
+
FIRST_COLLECTIBLE_TYPE,
|
|
25
|
+
FIRST_PILL_EFFECT,
|
|
26
|
+
FIRST_TRINKET_TYPE,
|
|
27
|
+
LAST_VANILLA_CARD_TYPE,
|
|
28
|
+
LAST_VANILLA_COLLECTIBLE_TYPE,
|
|
29
|
+
LAST_VANILLA_PILL_EFFECT,
|
|
30
|
+
LAST_VANILLA_TRINKET_TYPE,
|
|
31
|
+
} from "./constantsFirstLast";
|
|
32
|
+
|
|
33
|
+
// ------------
|
|
34
|
+
// Collectibles
|
|
35
|
+
// ------------
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* An array that represents the range from the first vanilla collectible type to the last vanilla
|
|
39
|
+
* collectible type. This will include integers that do not represent any valid collectible types.
|
|
40
|
+
*
|
|
41
|
+
* This function is only useful when building collectible type objects. For most purposes, you
|
|
42
|
+
* should use the `VANILLA_COLLECTIBLE_TYPES` or `VANILLA_COLLECTIBLE_TYPES_SET` constants instead.
|
|
43
|
+
*/
|
|
44
|
+
export const VANILLA_COLLECTIBLE_TYPE_RANGE: readonly int[] = iRange(
|
|
45
|
+
FIRST_COLLECTIBLE_TYPE,
|
|
46
|
+
LAST_VANILLA_COLLECTIBLE_TYPE,
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* An array that contains every valid vanilla collectible type, as verified by the
|
|
51
|
+
* `ItemConfig.GetCollectible` method. Vanilla collectible types are not contiguous, so every valid
|
|
52
|
+
* must be verified. (There are several gaps, e.g. 666.)
|
|
53
|
+
*
|
|
54
|
+
* If you need to do O(1) lookups, use the `VANILLA_COLLECTIBLE_TYPES_SET` constant instead.
|
|
55
|
+
*/
|
|
56
|
+
// eslint-disable-next-line isaacscript/strict-enums
|
|
57
|
+
export const VANILLA_COLLECTIBLE_TYPES: readonly CollectibleType[] =
|
|
58
|
+
VANILLA_COLLECTIBLE_TYPE_RANGE.filter((potentialCollectibleType) => {
|
|
59
|
+
const collectibleType = asCollectibleType(potentialCollectibleType);
|
|
60
|
+
const itemConfigItem = itemConfig.GetCollectible(collectibleType);
|
|
61
|
+
return itemConfigItem !== undefined;
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* A set that contains every valid vanilla collectible type, as verified by the
|
|
66
|
+
* `ItemConfig.GetCollectible` method. Vanilla collectible types are not contiguous, so every valid
|
|
67
|
+
* must be verified. (There are several gaps, e.g. 666.)
|
|
68
|
+
*/
|
|
69
|
+
export const VANILLA_COLLECTIBLE_TYPES_SET = new ReadonlySet(
|
|
70
|
+
VANILLA_COLLECTIBLE_TYPES,
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
// --------
|
|
74
|
+
// Trinkets
|
|
75
|
+
// --------
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* An array that represents the range from the first vanilla trinket type to the last vanilla
|
|
79
|
+
* trinket type. This will include integers that do not represent any valid trinket types.
|
|
80
|
+
*
|
|
81
|
+
* This function is only useful when building trinket type objects. For most purposes, you should
|
|
82
|
+
* use the `VANILLA_TRINKET_TYPES` or `VANILLA_TRINKET_TYPES_SET` constants instead.
|
|
83
|
+
*/
|
|
84
|
+
export const VANILLA_TRINKET_TYPE_RANGE: readonly int[] = iRange(
|
|
85
|
+
FIRST_TRINKET_TYPE,
|
|
86
|
+
LAST_VANILLA_TRINKET_TYPE,
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* An array that contains every valid vanilla trinket type, as verified by the
|
|
91
|
+
* `ItemConfig.GetTrinket` method. Vanilla trinket types are not contiguous, so every valid must be
|
|
92
|
+
* verified. (The only gap is 47 for `POLAROID_OBSOLETE`.)
|
|
93
|
+
*
|
|
94
|
+
* If you need to do O(1) lookups, use the `VANILLA_TRINKET_TYPES_SET` constant instead.
|
|
95
|
+
*/
|
|
96
|
+
// eslint-disable-next-line isaacscript/strict-enums
|
|
97
|
+
export const VANILLA_TRINKET_TYPES: readonly TrinketType[] =
|
|
98
|
+
VANILLA_TRINKET_TYPE_RANGE.filter((potentialTrinketType) => {
|
|
99
|
+
const trinketType = asTrinketType(potentialTrinketType);
|
|
100
|
+
const itemConfigTrinket = itemConfig.GetTrinket(trinketType);
|
|
101
|
+
return itemConfigTrinket !== undefined;
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* A set that contains every valid vanilla trinket type, as verified by the `ItemConfig.GetTrinket`
|
|
106
|
+
* method. Vanilla trinket types are not contiguous, so every valid must be verified. (The only gap
|
|
107
|
+
* is 47 for `POLAROID_OBSOLETE`.)
|
|
108
|
+
*/
|
|
109
|
+
export const VANILLA_TRINKET_TYPES_SET = new ReadonlySet(VANILLA_TRINKET_TYPES);
|
|
110
|
+
|
|
111
|
+
// ----------
|
|
112
|
+
// Card Types
|
|
113
|
+
// ----------
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* An array that represents the range from the first vanilla card type to the last vanilla card
|
|
117
|
+
* type.
|
|
118
|
+
*
|
|
119
|
+
* This function is only useful when building card type objects. For most purposes, you should use
|
|
120
|
+
* the `VANILLA_CARD_TYPES` or `VANILLA_CARD_TYPES_SET` constants instead.
|
|
121
|
+
*/
|
|
122
|
+
export const VANILLA_CARD_TYPE_RANGE: readonly int[] = iRange(
|
|
123
|
+
FIRST_CARD_TYPE,
|
|
124
|
+
LAST_VANILLA_CARD_TYPE,
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* An array that contains every valid vanilla card type, as verified by the `ItemConfig.GetCard`
|
|
129
|
+
* method. Vanilla card types are contiguous, but we validate every entry to double check.
|
|
130
|
+
*
|
|
131
|
+
* If you need to do O(1) lookups, use the `VANILLA_CARD_TYPES_SET` constant instead.
|
|
132
|
+
*/
|
|
133
|
+
// eslint-disable-next-line isaacscript/strict-enums
|
|
134
|
+
export const VANILLA_CARD_TYPES: readonly CardType[] =
|
|
135
|
+
VANILLA_CARD_TYPE_RANGE.filter((potentialCardType) => {
|
|
136
|
+
const cardType = asCardType(potentialCardType);
|
|
137
|
+
const itemConfigCard = itemConfig.GetCard(cardType);
|
|
138
|
+
return itemConfigCard !== undefined;
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* A set that contains every valid vanilla card type, as verified by the `ItemConfig.GetCard`
|
|
143
|
+
* method. Vanilla card types are contiguous, but we validate every entry to double check.
|
|
144
|
+
*/
|
|
145
|
+
export const VANILLA_CARD_TYPES_SET = new ReadonlySet(VANILLA_CARD_TYPES);
|
|
146
|
+
|
|
147
|
+
// ------------
|
|
148
|
+
// Pill Effects
|
|
149
|
+
// ------------
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* An array that represents the range from the first vanilla pill effect to the last vanilla pill
|
|
153
|
+
* effect.
|
|
154
|
+
*
|
|
155
|
+
* This function is only useful when building pill effect objects. For most purposes, you should use
|
|
156
|
+
* the `VANILLA_PILL_EFFECTS` or `VANILLA_PILL_EFFECTS_SET` constants instead.
|
|
157
|
+
*/
|
|
158
|
+
export const VANILLA_PILL_EFFECT_RANGE: readonly int[] = iRange(
|
|
159
|
+
FIRST_PILL_EFFECT,
|
|
160
|
+
LAST_VANILLA_PILL_EFFECT,
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* An array that contains every valid vanilla pill effect, as verified by the
|
|
165
|
+
* `ItemConfig.GetPillEffect` method. Vanilla pill effects are contiguous, but we validate every
|
|
166
|
+
* entry to double check.
|
|
167
|
+
*
|
|
168
|
+
* If you need to do O(1) lookups, use the `VANILLA_PILL_EFFECT_SET` constant instead.
|
|
169
|
+
*/
|
|
170
|
+
// eslint-disable-next-line isaacscript/strict-enums
|
|
171
|
+
export const VANILLA_PILL_EFFECTS: readonly PillEffect[] =
|
|
172
|
+
VANILLA_PILL_EFFECT_RANGE.filter((potentialPillEffect) => {
|
|
173
|
+
const pillEffect = asPillEffect(potentialPillEffect);
|
|
174
|
+
const itemConfigPillEffect = itemConfig.GetPillEffect(pillEffect);
|
|
175
|
+
return itemConfigPillEffect !== undefined;
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* A set that contains every valid vanilla pill effect, as verified by the
|
|
180
|
+
* `ItemConfig.GetPillEffect` method. Vanilla pill effects are contiguous, but we validate every
|
|
181
|
+
* entry to double check.
|
|
182
|
+
*/
|
|
183
|
+
export const VANILLA_PILL_EFFECTS_SET = new ReadonlySet(VANILLA_PILL_EFFECTS);
|
package/src/core/upgradeMod.ts
CHANGED
|
@@ -62,7 +62,7 @@ export function upgradeMod<T extends readonly ISCFeature[] = never[]>(
|
|
|
62
62
|
return mod as ModUpgradedWithFeatures<T>;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
/** Initialize every optional feature that the end-user specified. */
|
|
65
|
+
/** Initialize every optional feature that the end-user specified, if any. */
|
|
66
66
|
function initOptionalFeatures(mod: ModUpgraded, features: ISCFeature[]) {
|
|
67
67
|
for (const feature of features) {
|
|
68
68
|
// We intentionally access the private method here, so we use the string index escape hatch:
|
|
@@ -74,6 +74,11 @@ function initOptionalFeatures(mod: ModUpgraded, features: ISCFeature[]) {
|
|
|
74
74
|
// provides a convenient API for end-users.)
|
|
75
75
|
const modRecord = mod as unknown as Record<string, AnyFunction>;
|
|
76
76
|
for (const [funcName, func] of exportedMethodTuples) {
|
|
77
|
+
if (modRecord[funcName] !== undefined) {
|
|
78
|
+
error(
|
|
79
|
+
`Failed to upgrade the mod since two or more features share the name function name of "${funcName}". This should never happen, so report this error to the library authors.`,
|
|
80
|
+
);
|
|
81
|
+
}
|
|
77
82
|
modRecord[funcName] = func;
|
|
78
83
|
}
|
|
79
84
|
}
|
package/src/functions/cards.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { CardType } from "isaac-typescript-definitions";
|
|
2
2
|
import { ItemConfigCardType, UseFlag } from "isaac-typescript-definitions";
|
|
3
3
|
import { itemConfig } from "../core/cachedClasses";
|
|
4
|
-
import {
|
|
5
|
-
FIRST_CARD_TYPE,
|
|
6
|
-
LAST_VANILLA_CARD_TYPE,
|
|
7
|
-
} from "../core/constantsFirstLast";
|
|
4
|
+
import { LAST_VANILLA_CARD_TYPE } from "../core/constantsFirstLast";
|
|
8
5
|
import {
|
|
9
6
|
CARD_DESCRIPTIONS,
|
|
10
7
|
DEFAULT_CARD_DESCRIPTION,
|
|
@@ -12,7 +9,6 @@ import {
|
|
|
12
9
|
import { CARD_NAMES, DEFAULT_CARD_NAME } from "../objects/cardNames";
|
|
13
10
|
import { ITEM_CONFIG_CARD_TYPES_FOR_CARDS_SET } from "../sets/itemConfigCardTypesForCardsSet";
|
|
14
11
|
import { addFlag } from "./flag";
|
|
15
|
-
import { iRange } from "./utils";
|
|
16
12
|
|
|
17
13
|
/**
|
|
18
14
|
* Helper function to get a card description from a Card enum value.
|
|
@@ -77,16 +73,6 @@ export function getItemConfigCardType(
|
|
|
77
73
|
return itemConfigCard.CardType;
|
|
78
74
|
}
|
|
79
75
|
|
|
80
|
-
/**
|
|
81
|
-
* Helper function to get an array with every valid vanilla card sub-type.
|
|
82
|
-
*
|
|
83
|
-
* Note that unlike collectibles and trinkets, there are no gaps in the card types, so this is a
|
|
84
|
-
* simple range from the first card type to the last vanilla card type.
|
|
85
|
-
*/
|
|
86
|
-
export function getVanillaCardTypes(): CardType[] {
|
|
87
|
-
return iRange(FIRST_CARD_TYPE, LAST_VANILLA_CARD_TYPE);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
76
|
/**
|
|
91
77
|
* Returns true for cards that have the following card type:
|
|
92
78
|
* - CardType.TAROT
|
|
@@ -16,10 +16,7 @@ import {
|
|
|
16
16
|
} from "isaac-typescript-definitions";
|
|
17
17
|
import { game, itemConfig } from "../core/cachedClasses";
|
|
18
18
|
import { BLIND_ITEM_PNG_PATH, DEFAULT_ITEM_POOL_TYPE } from "../core/constants";
|
|
19
|
-
import {
|
|
20
|
-
FIRST_COLLECTIBLE_TYPE,
|
|
21
|
-
LAST_VANILLA_COLLECTIBLE_TYPE,
|
|
22
|
-
} from "../core/constantsFirstLast";
|
|
19
|
+
import { LAST_VANILLA_COLLECTIBLE_TYPE } from "../core/constantsFirstLast";
|
|
23
20
|
import {
|
|
24
21
|
COLLECTIBLE_DESCRIPTION_MAP,
|
|
25
22
|
DEFAULT_COLLECTIBLE_DESCRIPTION,
|
|
@@ -34,7 +31,6 @@ import { hasFlag } from "./flag";
|
|
|
34
31
|
import { isCollectible } from "./pickupVariants";
|
|
35
32
|
import { clearSprite, spriteEquals } from "./sprites";
|
|
36
33
|
import { isInteger } from "./types";
|
|
37
|
-
import { iRange } from "./utils";
|
|
38
34
|
|
|
39
35
|
const COLLECTIBLE_ANM2_PATH = "gfx/005.100_collectible.anm2";
|
|
40
36
|
|
|
@@ -406,19 +402,6 @@ export function getCollectibleTags(
|
|
|
406
402
|
return itemConfigItem === undefined ? ItemConfigTagZero : itemConfigItem.Tags;
|
|
407
403
|
}
|
|
408
404
|
|
|
409
|
-
/**
|
|
410
|
-
* Helper function to get an array that represents the range from the first collectible type to the
|
|
411
|
-
* last vanilla collectible type. This will include integers that do not represent any valid
|
|
412
|
-
* collectible types.
|
|
413
|
-
*
|
|
414
|
-
* This function is only useful when building collectible type objects. For most purposes, you
|
|
415
|
-
* should use the `getVanillaCollectibleArray` or `getVanillaCollectibleSet` helper functions
|
|
416
|
-
* instead (which are part of `ISCFeature.MODDED_ELEMENT_SETS`).
|
|
417
|
-
*/
|
|
418
|
-
export function getVanillaCollectibleTypeRange(): CollectibleType[] {
|
|
419
|
-
return iRange(FIRST_COLLECTIBLE_TYPE, LAST_VANILLA_COLLECTIBLE_TYPE);
|
|
420
|
-
}
|
|
421
|
-
|
|
422
405
|
/** Returns true if the item type in the item config is equal to `ItemType.ITEM_ACTIVE`. */
|
|
423
406
|
export function isActiveCollectible(collectibleType: CollectibleType): boolean {
|
|
424
407
|
const itemType = getCollectibleItemType(collectibleType);
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
import { Dimension } from "isaac-typescript-definitions";
|
|
2
2
|
import { game } from "../core/cachedClasses";
|
|
3
|
-
import {
|
|
3
|
+
import { DIMENSIONS } from "../core/constants";
|
|
4
4
|
import { getRoomGridIndex } from "./roomData";
|
|
5
|
-
import { eRange } from "./utils";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Helper function to get an array with every valid `Dimension` (not including `Dimension.CURRENT`).
|
|
9
|
-
*/
|
|
10
|
-
export function getAllDimensions(): Dimension[] {
|
|
11
|
-
return eRange(NUM_DIMENSIONS);
|
|
12
|
-
}
|
|
13
5
|
|
|
14
6
|
/**
|
|
15
7
|
* Helper function to get the current dimension. Most of the time, this will be `Dimension.MAIN`,
|
|
@@ -21,7 +13,7 @@ export function getDimension(): Dimension {
|
|
|
21
13
|
const roomDescription = level.GetRoomByIdx(roomGridIndex, Dimension.CURRENT);
|
|
22
14
|
const currentRoomHash = GetPtrHash(roomDescription);
|
|
23
15
|
|
|
24
|
-
for (const dimension of
|
|
16
|
+
for (const dimension of DIMENSIONS) {
|
|
25
17
|
const dimensionRoomDescription = level.GetRoomByIdx(
|
|
26
18
|
roomGridIndex,
|
|
27
19
|
dimension,
|
package/src/functions/pills.ts
CHANGED
|
@@ -9,7 +9,6 @@ import { game, itemConfig } from "../core/cachedClasses";
|
|
|
9
9
|
import {
|
|
10
10
|
FIRST_HORSE_PILL_COLOR,
|
|
11
11
|
FIRST_PILL_COLOR,
|
|
12
|
-
FIRST_PILL_EFFECT,
|
|
13
12
|
LAST_HORSE_PILL_COLOR,
|
|
14
13
|
LAST_NORMAL_PILL_COLOR,
|
|
15
14
|
LAST_VANILLA_PILL_EFFECT,
|
|
@@ -193,11 +192,6 @@ export function getPillEffectType(
|
|
|
193
192
|
return pillEffectClass ?? DEFAULT_PILL_EFFECT_TYPE;
|
|
194
193
|
}
|
|
195
194
|
|
|
196
|
-
/** Helper function to get an array with every vanilla pill effect. */
|
|
197
|
-
export function getVanillaPillEffects(): PillEffect[] {
|
|
198
|
-
return iRange(FIRST_PILL_EFFECT, LAST_VANILLA_PILL_EFFECT);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
195
|
/** Helper function to see if the given pill color is either a gold pill or a horse gold pill. */
|
|
202
196
|
export function isGoldPill(pillColor: PillColor): boolean {
|
|
203
197
|
return pillColor === PillColor.GOLD || pillColor === PillColor.HORSE_GOLD;
|
package/src/functions/rooms.ts
CHANGED
|
@@ -19,11 +19,11 @@ import {
|
|
|
19
19
|
StageID,
|
|
20
20
|
} from "isaac-typescript-definitions";
|
|
21
21
|
import { game, sfxManager } from "../core/cachedClasses";
|
|
22
|
-
import { MAX_LEVEL_GRID_INDEX } from "../core/constants";
|
|
22
|
+
import { DIMENSIONS, MAX_LEVEL_GRID_INDEX } from "../core/constants";
|
|
23
23
|
import { ROOM_TYPE_NAMES } from "../objects/roomTypeNames";
|
|
24
24
|
import { MINE_SHAFT_ROOM_SUB_TYPE_SET } from "../sets/mineShaftRoomSubTypesSet";
|
|
25
25
|
import { ReadonlySet } from "../types/ReadonlySet";
|
|
26
|
-
import {
|
|
26
|
+
import { inDimension } from "./dimensions";
|
|
27
27
|
import {
|
|
28
28
|
closeAllDoors,
|
|
29
29
|
getDoors,
|
|
@@ -223,7 +223,7 @@ export function getRoomsInsideGrid(
|
|
|
223
223
|
const level = game.GetLevel();
|
|
224
224
|
|
|
225
225
|
const dimensions = includeExtraDimensionalRooms
|
|
226
|
-
?
|
|
226
|
+
? DIMENSIONS
|
|
227
227
|
: [Dimension.CURRENT];
|
|
228
228
|
|
|
229
229
|
/** We use a map instead of an array because room shapes occupy more than one room grid index. */
|
|
@@ -7,10 +7,7 @@ import {
|
|
|
7
7
|
import { TRINKET_SLOT_VALUES } from "../arrays/cachedEnumValues";
|
|
8
8
|
import { itemConfig } from "../core/cachedClasses";
|
|
9
9
|
import { BLIND_ITEM_PNG_PATH } from "../core/constants";
|
|
10
|
-
import {
|
|
11
|
-
FIRST_TRINKET_TYPE,
|
|
12
|
-
LAST_VANILLA_TRINKET_TYPE,
|
|
13
|
-
} from "../core/constantsFirstLast";
|
|
10
|
+
import { LAST_VANILLA_TRINKET_TYPE } from "../core/constantsFirstLast";
|
|
14
11
|
import { MysteriousPaperEffect } from "../enums/MysteriousPaperEffect";
|
|
15
12
|
import {
|
|
16
13
|
DEFAULT_TRINKET_DESCRIPTION,
|
|
@@ -27,7 +24,6 @@ import { isTrinket } from "./pickupVariants";
|
|
|
27
24
|
import { isCharacter } from "./players";
|
|
28
25
|
import { clearSprite } from "./sprites";
|
|
29
26
|
import { asNumber } from "./types";
|
|
30
|
-
import { iRange } from "./utils";
|
|
31
27
|
|
|
32
28
|
/**
|
|
33
29
|
* Add this to a `TrinketType` to get the corresponding golden trinket type.
|
|
@@ -185,18 +181,6 @@ export function getTrinketName(trinketType: TrinketType): string {
|
|
|
185
181
|
return DEFAULT_TRINKET_NAME;
|
|
186
182
|
}
|
|
187
183
|
|
|
188
|
-
/**
|
|
189
|
-
* Helper function to get an array that represents the range from the first trinket type to the last
|
|
190
|
-
* vanilla trinket type. This will include integers that do not represent any valid trinket types.
|
|
191
|
-
*
|
|
192
|
-
* This function is only useful when building collectible type objects. For most purposes, you
|
|
193
|
-
* should use the `getVanillaTrinketArray` or `getVanillaTrinketSet` helper functions instead (which
|
|
194
|
-
* are part of `ISCFeature.MODDED_ELEMENT_SETS`).
|
|
195
|
-
*/
|
|
196
|
-
export function getVanillaTrinketTypeRange(): TrinketType[] {
|
|
197
|
-
return iRange(FIRST_TRINKET_TYPE, LAST_VANILLA_TRINKET_TYPE);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
184
|
/** Helper function to check to see if the player is holding one or more trinkets. */
|
|
201
185
|
export function hasAnyTrinket(player: EntityPlayer): boolean {
|
|
202
186
|
const playerTrinketTypes = TRINKET_SLOT_VALUES.map((trinketSlot) =>
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from "./classes/ModUpgraded";
|
|
|
4
4
|
export * from "./core/cachedClasses";
|
|
5
5
|
export * from "./core/constants";
|
|
6
6
|
export * from "./core/constantsFirstLast";
|
|
7
|
+
export * from "./core/constantsVanilla";
|
|
7
8
|
export * from "./core/upgradeMod";
|
|
8
9
|
export * from "./enums/AmbushType";
|
|
9
10
|
export * from "./enums/CornerType";
|