isaacscript-common 18.3.2 → 19.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.d.ts CHANGED
@@ -1320,6 +1320,8 @@ declare class CollectibleItemPoolType extends Feature {
1320
1320
  export declare function collectibleSpriteEquals(sprite1: Sprite, sprite2: Sprite): boolean;
1321
1321
 
1322
1322
  /**
1323
+ * Equal to `Color(1, 1, 1)`.
1324
+ *
1323
1325
  * This is a safe version of the `Color.Default` constant. (Other mods can mutate `Color.Default`,
1324
1326
  * so it is not safe to use.)
1325
1327
  *
@@ -6855,19 +6857,6 @@ export declare function inDimension(dimension: Dimension): boolean;
6855
6857
 
6856
6858
  export declare function inDoubleTrouble(): boolean;
6857
6859
 
6858
- /**
6859
- * Helper function to check if a variable is within a certain range, exclusive on both ends. (The
6860
- * "e" stands for exclusive.)
6861
- *
6862
- * - For example, `inERange(1, 1, 3)` will return `false`.
6863
- * - For example, `inERange(1.01, 1, 3)` will return `true`.
6864
- *
6865
- * @param num The number to check.
6866
- * @param start The start of the range to check.
6867
- * @param end The end of the range to check.
6868
- */
6869
- export declare function inERange(num: int, start: int, end: int): boolean;
6870
-
6871
6860
  export declare function inGenesisRoom(): boolean;
6872
6861
 
6873
6862
  /**
@@ -6878,19 +6867,6 @@ export declare function inGenesisRoom(): boolean;
6878
6867
  */
6879
6868
  export declare function inHomeCloset(): boolean;
6880
6869
 
6881
- /**
6882
- * Helper function to check if a variable is within a certain range, inclusive on both ends. (The
6883
- * "i" stands for inclusive.)
6884
- *
6885
- * - For example, `inIRange(1, 1, 3)` will return `true`.
6886
- * - For example, `inIRange(0, 1, 3)` will return `false`.
6887
- *
6888
- * @param num The number to check.
6889
- * @param start The start of the range to check.
6890
- * @param end The end of the range to check.
6891
- */
6892
- export declare function inIRange(num: int, start: int, end: int): boolean;
6893
-
6894
6870
  /**
6895
6871
  * Initializes an array with all of the elements containing the specified default value.
6896
6872
  *
@@ -6932,6 +6908,18 @@ export declare function inMinibossRoomOf(minibossID: MinibossID): boolean;
6932
6908
  */
6933
6909
  export declare function inMirrorRoom(): boolean;
6934
6910
 
6911
+ /**
6912
+ * Helper function to check if a variable is within a certain range, inclusive on both ends.
6913
+ *
6914
+ * - For example, `inRange(1, 1, 3)` will return `true`.
6915
+ * - For example, `inRange(0, 1, 3)` will return `false`.
6916
+ *
6917
+ * @param num The number to check.
6918
+ * @param start The start of the range to check.
6919
+ * @param end The end of the range to check.
6920
+ */
6921
+ export declare function inRange(num: int, start: int, end: int): boolean;
6922
+
6935
6923
  /**
6936
6924
  * Helper function to check if a given position is within a given rectangle.
6937
6925
  *
@@ -11230,8 +11218,18 @@ export declare class ModFeature {
11230
11218
  * conditional logic and early returning at the beginning of every callback function).
11231
11219
  *
11232
11220
  * By default, this is set to null. Override this property in your class if you need to use it.
11221
+ *
11222
+ * The function has the following signature:
11223
+ *
11224
+ * ```ts
11225
+ * (
11226
+ * vanilla: boolean, // Whether or not this is a vanilla or custom callback.
11227
+ * modCallback: ModCallback | ModCallbackCustom,
11228
+ * ...callbackArgs: unknown[]
11229
+ * ) => boolean;
11230
+ * ```
11233
11231
  */
11234
- protected callbackConditionalFunc: (() => boolean) | null;
11232
+ protected callbackConditionalFunc: ((vanilla: boolean, modCallback: ModCallback | ModCallbackCustom, ...callbackArgs: unknown[]) => boolean) | null;
11235
11233
  /**
11236
11234
  * Whether or not the feature has registered its callbacks yet (and submitted its variables to the
11237
11235
  * save data manager, if any).
@@ -11544,6 +11542,12 @@ export declare function onSetSeed(): boolean;
11544
11542
 
11545
11543
  export declare function onSheol(): boolean;
11546
11544
 
11545
+ /**
11546
+ * Helper function to check if the current stage is one that has the possibility to grant a natural
11547
+ * Devil Room or Angel Room after killing the boss.
11548
+ */
11549
+ export declare function onStageWithNaturalDevilRoom(): boolean;
11550
+
11547
11551
  /**
11548
11552
  * For the purposes of this function, doors to Secret Rooms or Super Secret Rooms that have not been
11549
11553
  * discovered yet will not be opened.
@@ -14941,6 +14945,8 @@ export declare function validateInterfaceMatchesEnum<T extends Record<Enum, unkn
14941
14945
  export declare function vectorEquals(vector1: Vector, vector2: Vector): boolean;
14942
14946
 
14943
14947
  /**
14948
+ * Equal to `Vector(1, 1)`.
14949
+ *
14944
14950
  * This is a safe version of the `Vector.One` constant. (Other mods can mutate `Vector.One`, so it
14945
14951
  * is not safe to use.)
14946
14952
  */
@@ -14952,6 +14958,8 @@ export declare function vectorToDirection(vector: Vector): Direction;
14952
14958
  export declare function vectorToString(vector: Vector, round?: boolean): string;
14953
14959
 
14954
14960
  /**
14961
+ * Equal to `Vector(0, 0)`.
14962
+ *
14955
14963
  * This is a safe version of the `Vector.Zero` constant. (Other mods can mutate `Vector.Zero`, so it
14956
14964
  * is not safe to use.)
14957
14965
  */
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 18.3.2
3
+ isaacscript-common 19.0.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -15343,10 +15343,7 @@ function ____exports.iRange(self, start, ____end, increment)
15343
15343
  end
15344
15344
  return array
15345
15345
  end
15346
- function ____exports.inERange(self, num, start, ____end)
15347
- return num > start and num < ____end
15348
- end
15349
- function ____exports.inIRange(self, num, start, ____end)
15346
+ function ____exports.inRange(self, num, start, ____end)
15350
15347
  return num >= start and num <= ____end
15351
15348
  end
15352
15349
  function ____exports.isReflectionRender(self)
@@ -25438,6 +25435,8 @@ local STAGE_TYPE_TO_LETTER = ____stageTypeToLetter.STAGE_TYPE_TO_LETTER
25438
25435
  local ____types = require("src.functions.types")
25439
25436
  local asLevelStage = ____types.asLevelStage
25440
25437
  local asNumber = ____types.asNumber
25438
+ local ____utils = require("src.functions.utils")
25439
+ local inRange = ____utils.inRange
25441
25440
  function ____exports.isRepentanceStage(self, stageType)
25442
25441
  return stageType == StageType.REPENTANCE or stageType == StageType.REPENTANCE_B
25443
25442
  end
@@ -25549,6 +25548,10 @@ function ____exports.onSheol(self)
25549
25548
  local stageType = level:GetStageType()
25550
25549
  return stage == LevelStage.SHEOL_CATHEDRAL and stageType == StageType.ORIGINAL
25551
25550
  end
25551
+ function ____exports.onStageWithNaturalDevilRoom(self)
25552
+ local effectiveStage = ____exports.getEffectiveStage(nil)
25553
+ return inRange(nil, effectiveStage, 2, 8)
25554
+ end
25552
25555
  function ____exports.setStage(self, stage, stageType, reseed)
25553
25556
  if reseed == nil then
25554
25557
  reseed = false
@@ -49377,7 +49380,7 @@ function addCallback(self, modFeature, modFeatureConstructor, mod, modCallback,
49377
49380
  local function wrappedCallback(____, ...)
49378
49381
  local conditionalFunc = modFeature.callbackConditionalFunc
49379
49382
  if conditionalFunc ~= nil then
49380
- local shouldRun = conditionalFunc(nil)
49383
+ local shouldRun = conditionalFunc(nil, vanilla, modCallback, ...)
49381
49384
  if not shouldRun then
49382
49385
  return nil
49383
49386
  end
@@ -1,3 +1,5 @@
1
+ import { ModCallback } from "isaac-typescript-definitions";
2
+ import { ModCallbackCustom } from "../enums/ModCallbackCustom";
1
3
  import { ModUpgradedBase } from "./ModUpgradedBase";
2
4
  export declare const MOD_FEATURE_CALLBACKS_KEY = "__callbacks";
3
5
  export declare const MOD_FEATURE_CUSTOM_CALLBACKS_KEY = "__customCallbacks";
@@ -45,8 +47,18 @@ export declare class ModFeature {
45
47
  * conditional logic and early returning at the beginning of every callback function).
46
48
  *
47
49
  * By default, this is set to null. Override this property in your class if you need to use it.
50
+ *
51
+ * The function has the following signature:
52
+ *
53
+ * ```ts
54
+ * (
55
+ * vanilla: boolean, // Whether or not this is a vanilla or custom callback.
56
+ * modCallback: ModCallback | ModCallbackCustom,
57
+ * ...callbackArgs: unknown[]
58
+ * ) => boolean;
59
+ * ```
48
60
  */
49
- protected callbackConditionalFunc: (() => boolean) | null;
61
+ protected callbackConditionalFunc: ((vanilla: boolean, modCallback: ModCallback | ModCallbackCustom, ...callbackArgs: unknown[]) => boolean) | null;
50
62
  /**
51
63
  * Whether or not the feature has registered its callbacks yet (and submitted its variables to the
52
64
  * save data manager, if any).
@@ -1 +1 @@
1
- {"version":3,"file":"ModFeature.d.ts","sourceRoot":"","sources":["../../../src/classes/ModFeature.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,eAAO,MAAM,yBAAyB,gBAAgB,CAAC;AACvD,eAAO,MAAM,gCAAgC,sBAAsB,CAAC;AAyBpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,qBAAa,UAAU;IACrB,OAAO,CAAC,GAAG,CAAkB;IAE7B;;;;;;;;;OASG;IACH,SAAS,CAAC,uBAAuB,EAAE,CAAC,MAAM,OAAO,CAAC,GAAG,IAAI,CAAQ;IAEjE;;;;;;OAMG;IACI,WAAW,UAAS;gBAEf,GAAG,EAAE,eAAe,EAAE,IAAI,UAAO;IAQ7C;;;;;OAKG;IACI,IAAI,CAAC,IAAI,UAAO,GAAG,IAAI;IAqB9B;;;;;;OAMG;IACI,MAAM,IAAI,IAAI;CAGtB"}
1
+ {"version":3,"file":"ModFeature.d.ts","sourceRoot":"","sources":["../../../src/classes/ModFeature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAS/D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,eAAO,MAAM,yBAAyB,gBAAgB,CAAC;AACvD,eAAO,MAAM,gCAAgC,sBAAsB,CAAC;AAyBpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,qBAAa,UAAU;IACrB,OAAO,CAAC,GAAG,CAAkB;IAE7B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,SAAS,CAAC,uBAAuB,EAC7B,CAAC,CACC,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,GAAG,iBAAiB,EAC5C,GAAG,YAAY,EAAE,OAAO,EAAE,KACvB,OAAO,CAAC,GACb,IAAI,CAAQ;IAEhB;;;;;;OAMG;IACI,WAAW,UAAS;gBAEf,GAAG,EAAE,eAAe,EAAE,IAAI,UAAO;IAQ7C;;;;;OAKG;IACI,IAAI,CAAC,IAAI,UAAO,GAAG,IAAI;IAqB9B;;;;;;OAMG;IACI,MAAM,IAAI,IAAI;CAGtB"}
@@ -66,7 +66,7 @@ function addCallback(self, modFeature, modFeatureConstructor, mod, modCallback,
66
66
  local function wrappedCallback(____, ...)
67
67
  local conditionalFunc = modFeature.callbackConditionalFunc
68
68
  if conditionalFunc ~= nil then
69
- local shouldRun = conditionalFunc(nil)
69
+ local shouldRun = conditionalFunc(nil, vanilla, modCallback, ...)
70
70
  if not shouldRun then
71
71
  return nil
72
72
  end
@@ -133,16 +133,22 @@ export declare const TELEPORTER_ACTIVATION_DISTANCE: number;
133
133
  */
134
134
  export declare const UI_HEART_WIDTH = 12;
135
135
  /**
136
+ * Equal to `Vector(1, 1)`.
137
+ *
136
138
  * This is a safe version of the `Vector.One` constant. (Other mods can mutate `Vector.One`, so it
137
139
  * is not safe to use.)
138
140
  */
139
141
  export declare const VectorOne: Readonly<Vector>;
140
142
  /**
143
+ * Equal to `Vector(0, 0)`.
144
+ *
141
145
  * This is a safe version of the `Vector.Zero` constant. (Other mods can mutate `Vector.Zero`, so it
142
146
  * is not safe to use.)
143
147
  */
144
148
  export declare const VectorZero: Readonly<Vector>;
145
149
  /**
150
+ * Equal to `Color(1, 1, 1)`.
151
+ *
146
152
  * This is a safe version of the `Color.Default` constant. (Other mods can mutate `Color.Default`,
147
153
  * so it is not safe to use.)
148
154
  *
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/core/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,kBAAkB,EAClB,YAAY,EAEb,MAAM,8BAA8B,CAAC;AAMtC;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB;;;;E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,19 @@ ____exports.TELEPORTER_ACTIVATION_DISTANCE = ____exports.DISTANCE_OF_GRID_TILE /
115
115
  --- This is the number of draw coordinates that each heart spans on the UI in the upper left hand
116
116
  -- corner.
117
117
  ____exports.UI_HEART_WIDTH = 12
118
- --- This is a safe version of the `Vector.One` constant. (Other mods can mutate `Vector.One`, so it
118
+ --- Equal to `Vector(1, 1)`.
119
+ --
120
+ -- This is a safe version of the `Vector.One` constant. (Other mods can mutate `Vector.One`, so it
119
121
  -- is not safe to use.)
120
122
  ____exports.VectorOne = Vector(1, 1)
121
- --- This is a safe version of the `Vector.Zero` constant. (Other mods can mutate `Vector.Zero`, so it
123
+ --- Equal to `Vector(0, 0)`.
124
+ --
125
+ -- This is a safe version of the `Vector.Zero` constant. (Other mods can mutate `Vector.Zero`, so it
122
126
  -- is not safe to use.)
123
127
  ____exports.VectorZero = Vector(0, 0)
124
- --- This is a safe version of the `Color.Default` constant. (Other mods can mutate `Color.Default`,
128
+ --- Equal to `Color(1, 1, 1)`.
129
+ --
130
+ -- This is a safe version of the `Color.Default` constant. (Other mods can mutate `Color.Default`,
125
131
  -- so it is not safe to use.)
126
132
  --
127
133
  -- If you need to mutate this, make a copy first with the `copyColor` helper function.
@@ -69,6 +69,11 @@ export declare function onFirstFloor(): boolean;
69
69
  */
70
70
  export declare function onRepentanceStage(): boolean;
71
71
  export declare function onSheol(): boolean;
72
+ /**
73
+ * Helper function to check if the current stage is one that has the possibility to grant a natural
74
+ * Devil Room or Angel Room after killing the boss.
75
+ */
76
+ export declare function onStageWithNaturalDevilRoom(): boolean;
72
77
  /**
73
78
  * Helper function to warp to a new stage/level.
74
79
  *
@@ -1 +1 @@
1
- {"version":3,"file":"stage.d.ts","sourceRoot":"","sources":["../../../src/functions/stage.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,QAAQ,EACR,SAAS,EACV,MAAM,8BAA8B,CAAC;AAQtC;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAA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C;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,IAAI,OAAO,CAGrD;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,UAAU,EACjB,SAAS,EAAE,SAAS,EACpB,MAAM,UAAQ,GACb,IAAI,CAUN;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAE9D"}
@@ -16,6 +16,8 @@ local STAGE_TYPE_TO_LETTER = ____stageTypeToLetter.STAGE_TYPE_TO_LETTER
16
16
  local ____types = require("src.functions.types")
17
17
  local asLevelStage = ____types.asLevelStage
18
18
  local asNumber = ____types.asNumber
19
+ local ____utils = require("src.functions.utils")
20
+ local inRange = ____utils.inRange
19
21
  --- Helper function to check if the provided stage type is equal to `StageType.REPENTANCE` or
20
22
  -- `StageType.REPENTANCE_B`.
21
23
  function ____exports.isRepentanceStage(self, stageType)
@@ -166,6 +168,12 @@ function ____exports.onSheol(self)
166
168
  local stageType = level:GetStageType()
167
169
  return stage == LevelStage.SHEOL_CATHEDRAL and stageType == StageType.ORIGINAL
168
170
  end
171
+ --- Helper function to check if the current stage is one that has the possibility to grant a natural
172
+ -- Devil Room or Angel Room after killing the boss.
173
+ function ____exports.onStageWithNaturalDevilRoom(self)
174
+ local effectiveStage = ____exports.getEffectiveStage(nil)
175
+ return inRange(nil, effectiveStage, 2, 8)
176
+ end
169
177
  --- Helper function to warp to a new stage/level.
170
178
  --
171
179
  -- @param stage The stage number to warp to.
@@ -31,29 +31,16 @@ export declare function getTraversalDescription(key: unknown, traversalDescripti
31
31
  */
32
32
  export declare function iRange(start: int, end?: int, increment?: number): int[];
33
33
  /**
34
- * Helper function to check if a variable is within a certain range, exclusive on both ends. (The
35
- * "e" stands for exclusive.)
34
+ * Helper function to check if a variable is within a certain range, inclusive on both ends.
36
35
  *
37
- * - For example, `inERange(1, 1, 3)` will return `false`.
38
- * - For example, `inERange(1.01, 1, 3)` will return `true`.
36
+ * - For example, `inRange(1, 1, 3)` will return `true`.
37
+ * - For example, `inRange(0, 1, 3)` will return `false`.
39
38
  *
40
39
  * @param num The number to check.
41
40
  * @param start The start of the range to check.
42
41
  * @param end The end of the range to check.
43
42
  */
44
- export declare function inERange(num: int, start: int, end: int): boolean;
45
- /**
46
- * Helper function to check if a variable is within a certain range, inclusive on both ends. (The
47
- * "i" stands for inclusive.)
48
- *
49
- * - For example, `inIRange(1, 1, 3)` will return `true`.
50
- * - For example, `inIRange(0, 1, 3)` will return `false`.
51
- *
52
- * @param num The number to check.
53
- * @param start The start of the range to check.
54
- * @param end The end of the range to check.
55
- */
56
- export declare function inIRange(num: int, start: int, end: int): boolean;
43
+ export declare function inRange(num: int, start: int, end: int): boolean;
57
44
  /**
58
45
  * Helper function to see if the current render callback is rendering a water reflection.
59
46
  *
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/functions/utils.ts"],"names":[],"mappings":";AAIA;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,SAAS,SAAI,GAAG,GAAG,EAAE,CAYlE;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,OAAO,EACZ,oBAAoB,EAAE,MAAM,GAC3B,MAAM,CAQR;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,SAAS,SAAI,GAAG,GAAG,EAAE,CAYlE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAEhE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GA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, start, ____end, increment)
70
70
  end
71
71
  return array
72
72
  end
73
- --- Helper function to check if a variable is within a certain range, exclusive on both ends. (The
74
- -- "e" stands for exclusive.)
73
+ --- Helper function to check if a variable is within a certain range, inclusive on both ends.
75
74
  --
76
- -- - For example, `inERange(1, 1, 3)` will return `false`.
77
- -- - For example, `inERange(1.01, 1, 3)` will return `true`.
75
+ -- - For example, `inRange(1, 1, 3)` will return `true`.
76
+ -- - For example, `inRange(0, 1, 3)` will return `false`.
78
77
  --
79
78
  -- @param num The number to check.
80
79
  -- @param start The start of the range to check.
81
80
  -- @param end The end of the range to check.
82
- function ____exports.inERange(self, num, start, ____end)
83
- return num > start and num < ____end
84
- end
85
- --- Helper function to check if a variable is within a certain range, inclusive on both ends. (The
86
- -- "i" stands for inclusive.)
87
- --
88
- -- - For example, `inIRange(1, 1, 3)` will return `true`.
89
- -- - For example, `inIRange(0, 1, 3)` will return `false`.
90
- --
91
- -- @param num The number to check.
92
- -- @param start The start of the range to check.
93
- -- @param end The end of the range to check.
94
- function ____exports.inIRange(self, num, start, ____end)
81
+ function ____exports.inRange(self, num, start, ____end)
95
82
  return num >= start and num <= ____end
96
83
  end
97
84
  --- Helper function to see if the current render callback is rendering a water reflection.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "18.3.2",
3
+ "version": "19.0.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -82,8 +82,24 @@ export class ModFeature {
82
82
  * conditional logic and early returning at the beginning of every callback function).
83
83
  *
84
84
  * By default, this is set to null. Override this property in your class if you need to use it.
85
+ *
86
+ * The function has the following signature:
87
+ *
88
+ * ```ts
89
+ * (
90
+ * vanilla: boolean, // Whether or not this is a vanilla or custom callback.
91
+ * modCallback: ModCallback | ModCallbackCustom,
92
+ * ...callbackArgs: unknown[]
93
+ * ) => boolean;
94
+ * ```
85
95
  */
86
- protected callbackConditionalFunc: (() => boolean) | null = null;
96
+ protected callbackConditionalFunc:
97
+ | ((
98
+ vanilla: boolean,
99
+ modCallback: ModCallback | ModCallbackCustom,
100
+ ...callbackArgs: unknown[]
101
+ ) => boolean)
102
+ | null = null;
87
103
 
88
104
  /**
89
105
  * Whether or not the feature has registered its callbacks yet (and submitted its variables to the
@@ -205,13 +221,18 @@ function initDecoratedCallbacks(
205
221
  modFeature,
206
222
  modFeatureConstructor,
207
223
  mod,
208
- modCallback,
224
+ modCallback, // eslint-disable-line isaacscript/strict-enums
209
225
  callback,
210
226
  parameters,
211
227
  vanilla,
212
228
  );
213
229
  } else {
214
- removeCallback(modFeatureConstructor, mod, modCallback, vanilla);
230
+ removeCallback(
231
+ modFeatureConstructor,
232
+ mod,
233
+ modCallback, // eslint-disable-line isaacscript/strict-enums
234
+ vanilla,
235
+ );
215
236
  }
216
237
  }
217
238
  }
@@ -220,9 +241,8 @@ function addCallback(
220
241
  modFeature: ModFeature,
221
242
  modFeatureConstructor: ModFeatureConstructor,
222
243
  mod: ModUpgradedBase,
223
- modCallback: unknown,
224
- // eslint-disable-next-line @typescript-eslint/ban-types
225
- callback: Function,
244
+ modCallback: ModCallback | ModCallbackCustom,
245
+ callback: Function, // eslint-disable-line @typescript-eslint/ban-types
226
246
  parameters: unknown[],
227
247
  vanilla: boolean,
228
248
  ) {
@@ -232,7 +252,7 @@ function addCallback(
232
252
  // eslint-disable-next-line @typescript-eslint/dot-notation
233
253
  const conditionalFunc = modFeature["callbackConditionalFunc"];
234
254
  if (conditionalFunc !== null) {
235
- const shouldRun = conditionalFunc();
255
+ const shouldRun = conditionalFunc(vanilla, modCallback, ...callbackArgs);
236
256
  if (!shouldRun) {
237
257
  return undefined;
238
258
  }
@@ -284,7 +304,7 @@ function addCallback(
284
304
  function removeCallback(
285
305
  modFeatureConstructor: ModFeatureConstructor,
286
306
  mod: ModUpgradedBase,
287
- modCallback: unknown,
307
+ modCallback: ModCallback | ModCallbackCustom,
288
308
  vanilla: boolean,
289
309
  ) {
290
310
  if (vanilla) {
@@ -190,18 +190,24 @@ export const TELEPORTER_ACTIVATION_DISTANCE = DISTANCE_OF_GRID_TILE / 2;
190
190
  export const UI_HEART_WIDTH = 12;
191
191
 
192
192
  /**
193
+ * Equal to `Vector(1, 1)`.
194
+ *
193
195
  * This is a safe version of the `Vector.One` constant. (Other mods can mutate `Vector.One`, so it
194
196
  * is not safe to use.)
195
197
  */
196
198
  export const VectorOne: Readonly<Vector> = Vector(1, 1);
197
199
 
198
200
  /**
201
+ * Equal to `Vector(0, 0)`.
202
+ *
199
203
  * This is a safe version of the `Vector.Zero` constant. (Other mods can mutate `Vector.Zero`, so it
200
204
  * is not safe to use.)
201
205
  */
202
206
  export const VectorZero: Readonly<Vector> = Vector(0, 0);
203
207
 
204
208
  /**
209
+ * Equal to `Color(1, 1, 1)`.
210
+ *
205
211
  * This is a safe version of the `Color.Default` constant. (Other mods can mutate `Color.Default`,
206
212
  * so it is not safe to use.)
207
213
  *
@@ -10,6 +10,7 @@ import { ROOM_TYPE_GOTO_PREFIXES } from "../objects/roomTypeGotoPrefixes";
10
10
  import { STAGE_TYPE_SUFFIXES } from "../objects/stageTypeSuffixes";
11
11
  import { STAGE_TYPE_TO_LETTER } from "../objects/stageTypeToLetter";
12
12
  import { asLevelStage, asNumber } from "./types";
13
+ import { inRange } from "./utils";
13
14
 
14
15
  /**
15
16
  * Helper function that calculates what the stage type should be for the provided stage. This
@@ -247,6 +248,15 @@ export function onSheol(): boolean {
247
248
  );
248
249
  }
249
250
 
251
+ /**
252
+ * Helper function to check if the current stage is one that has the possibility to grant a natural
253
+ * Devil Room or Angel Room after killing the boss.
254
+ */
255
+ export function onStageWithNaturalDevilRoom(): boolean {
256
+ const effectiveStage = getEffectiveStage();
257
+ return inRange(effectiveStage, 2, 8);
258
+ }
259
+
250
260
  /**
251
261
  * Helper function to warp to a new stage/level.
252
262
  *
@@ -72,32 +72,16 @@ export function iRange(start: int, end?: int, increment = 1): int[] {
72
72
  }
73
73
 
74
74
  /**
75
- * Helper function to check if a variable is within a certain range, exclusive on both ends. (The
76
- * "e" stands for exclusive.)
75
+ * Helper function to check if a variable is within a certain range, inclusive on both ends.
77
76
  *
78
- * - For example, `inERange(1, 1, 3)` will return `false`.
79
- * - For example, `inERange(1.01, 1, 3)` will return `true`.
77
+ * - For example, `inRange(1, 1, 3)` will return `true`.
78
+ * - For example, `inRange(0, 1, 3)` will return `false`.
80
79
  *
81
80
  * @param num The number to check.
82
81
  * @param start The start of the range to check.
83
82
  * @param end The end of the range to check.
84
83
  */
85
- export function inERange(num: int, start: int, end: int): boolean {
86
- return num > start && num < end;
87
- }
88
-
89
- /**
90
- * Helper function to check if a variable is within a certain range, inclusive on both ends. (The
91
- * "i" stands for inclusive.)
92
- *
93
- * - For example, `inIRange(1, 1, 3)` will return `true`.
94
- * - For example, `inIRange(0, 1, 3)` will return `false`.
95
- *
96
- * @param num The number to check.
97
- * @param start The start of the range to check.
98
- * @param end The end of the range to check.
99
- */
100
- export function inIRange(num: int, start: int, end: int): boolean {
84
+ export function inRange(num: int, start: int, end: int): boolean {
101
85
  return num >= start && num <= end;
102
86
  }
103
87