isaacscript-common 20.12.0 → 20.12.2
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 +7 -2
- package/dist/isaacscript-common.lua +3 -2
- package/dist/src/functions/modFeatures.d.ts +6 -1
- package/dist/src/functions/modFeatures.d.ts.map +1 -1
- package/dist/src/functions/modFeatures.lua +5 -1
- package/dist/src/types/AnyClass.d.ts +1 -1
- package/dist/src/types/AnyClass.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/functions/modFeatures.ts +10 -5
- package/src/types/AnyClass.ts +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -787,7 +787,7 @@ export declare enum AmbushType {
|
|
|
787
787
|
export declare function angleToDirection(angleDegrees: int): Direction;
|
|
788
788
|
|
|
789
789
|
/** Helper type to represent any class. (This is the same type as any class constructor.) */
|
|
790
|
-
export declare type AnyClass = new (
|
|
790
|
+
export declare type AnyClass = new () => object;
|
|
791
791
|
|
|
792
792
|
/**
|
|
793
793
|
* A type union that matches `Entity`, `EntityBomb`, `EntityEffect`, and so on.
|
|
@@ -6948,6 +6948,9 @@ export declare function initArray<T>(defaultValue: T, size: int): T[];
|
|
|
6948
6948
|
* Helper function to instantiate an array of mod features all at once. Use this function if your
|
|
6949
6949
|
* mod uses the pattern of expressing mod features as `ModFeature` classes.
|
|
6950
6950
|
*
|
|
6951
|
+
* If your feature classes have `v` variables, then this function will successfully register them
|
|
6952
|
+
* with the save data manager.
|
|
6953
|
+
*
|
|
6951
6954
|
* For example:
|
|
6952
6955
|
*
|
|
6953
6956
|
* ```ts
|
|
@@ -6962,7 +6965,9 @@ export declare function initArray<T>(defaultValue: T, size: int): T[];
|
|
|
6962
6965
|
* @returns An array of the instantiated features in the same order that the constructors were
|
|
6963
6966
|
* passed in.
|
|
6964
6967
|
*/
|
|
6965
|
-
export declare function initModFeatures(mod: ModUpgraded, modFeatures:
|
|
6968
|
+
export declare function initModFeatures<T extends ReadonlyArray<typeof ModFeature>>(mod: ModUpgraded, modFeatures: T): {
|
|
6969
|
+
[Key in keyof T]: InstanceType<T[Key]>;
|
|
6970
|
+
};
|
|
6966
6971
|
|
|
6967
6972
|
/** Helper function to determine if the current room shape is one of the four L room shapes. */
|
|
6968
6973
|
export declare function inLRoom(): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 20.12.
|
|
3
|
+
isaacscript-common 20.12.2
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -51033,7 +51033,8 @@ local ____exports = {}
|
|
|
51033
51033
|
function ____exports.initModFeatures(self, mod, modFeatures)
|
|
51034
51034
|
local instantiatedModFeatures = {}
|
|
51035
51035
|
for ____, modFeature in ipairs(modFeatures) do
|
|
51036
|
-
local instantiatedModFeature = __TS__New(modFeature, mod)
|
|
51036
|
+
local instantiatedModFeature = __TS__New(modFeature, mod, false)
|
|
51037
|
+
instantiatedModFeature:init()
|
|
51037
51038
|
instantiatedModFeatures[#instantiatedModFeatures + 1] = instantiatedModFeature
|
|
51038
51039
|
end
|
|
51039
51040
|
return instantiatedModFeatures
|
|
@@ -4,6 +4,9 @@ import { ModUpgraded } from "../types/ModUpgraded";
|
|
|
4
4
|
* Helper function to instantiate an array of mod features all at once. Use this function if your
|
|
5
5
|
* mod uses the pattern of expressing mod features as `ModFeature` classes.
|
|
6
6
|
*
|
|
7
|
+
* If your feature classes have `v` variables, then this function will successfully register them
|
|
8
|
+
* with the save data manager.
|
|
9
|
+
*
|
|
7
10
|
* For example:
|
|
8
11
|
*
|
|
9
12
|
* ```ts
|
|
@@ -18,5 +21,7 @@ import { ModUpgraded } from "../types/ModUpgraded";
|
|
|
18
21
|
* @returns An array of the instantiated features in the same order that the constructors were
|
|
19
22
|
* passed in.
|
|
20
23
|
*/
|
|
21
|
-
export declare function initModFeatures(mod: ModUpgraded, modFeatures:
|
|
24
|
+
export declare function initModFeatures<T extends ReadonlyArray<typeof ModFeature>>(mod: ModUpgraded, modFeatures: T): {
|
|
25
|
+
[Key in keyof T]: InstanceType<T[Key]>;
|
|
26
|
+
};
|
|
22
27
|
//# sourceMappingURL=modFeatures.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modFeatures.d.ts","sourceRoot":"","sources":["../../../src/functions/modFeatures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"modFeatures.d.ts","sourceRoot":"","sources":["../../../src/functions/modFeatures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,aAAa,CAAC,OAAO,UAAU,CAAC,EACxE,GAAG,EAAE,WAAW,EAChB,WAAW,EAAE,CAAC,GACb;KAAG,GAAG,IAAI,MAAM,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CAAE,CAY5C"}
|
|
@@ -4,6 +4,9 @@ local ____exports = {}
|
|
|
4
4
|
--- Helper function to instantiate an array of mod features all at once. Use this function if your
|
|
5
5
|
-- mod uses the pattern of expressing mod features as `ModFeature` classes.
|
|
6
6
|
--
|
|
7
|
+
-- If your feature classes have `v` variables, then this function will successfully register them
|
|
8
|
+
-- with the save data manager.
|
|
9
|
+
--
|
|
7
10
|
-- For example:
|
|
8
11
|
--
|
|
9
12
|
-- ```ts
|
|
@@ -20,7 +23,8 @@ local ____exports = {}
|
|
|
20
23
|
function ____exports.initModFeatures(self, mod, modFeatures)
|
|
21
24
|
local instantiatedModFeatures = {}
|
|
22
25
|
for ____, modFeature in ipairs(modFeatures) do
|
|
23
|
-
local instantiatedModFeature = __TS__New(modFeature, mod)
|
|
26
|
+
local instantiatedModFeature = __TS__New(modFeature, mod, false)
|
|
27
|
+
instantiatedModFeature:init()
|
|
24
28
|
instantiatedModFeatures[#instantiatedModFeatures + 1] = instantiatedModFeature
|
|
25
29
|
end
|
|
26
30
|
return instantiatedModFeatures
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnyClass.d.ts","sourceRoot":"","sources":["../../../src/types/AnyClass.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,MAAM,MAAM,QAAQ,GAAG,
|
|
1
|
+
{"version":3,"file":"AnyClass.d.ts","sourceRoot":"","sources":["../../../src/types/AnyClass.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,MAAM,MAAM,QAAQ,GAAG,UAAU,MAAM,CAAC"}
|
package/package.json
CHANGED
|
@@ -5,6 +5,9 @@ import { ModUpgraded } from "../types/ModUpgraded";
|
|
|
5
5
|
* Helper function to instantiate an array of mod features all at once. Use this function if your
|
|
6
6
|
* mod uses the pattern of expressing mod features as `ModFeature` classes.
|
|
7
7
|
*
|
|
8
|
+
* If your feature classes have `v` variables, then this function will successfully register them
|
|
9
|
+
* with the save data manager.
|
|
10
|
+
*
|
|
8
11
|
* For example:
|
|
9
12
|
*
|
|
10
13
|
* ```ts
|
|
@@ -19,17 +22,19 @@ import { ModUpgraded } from "../types/ModUpgraded";
|
|
|
19
22
|
* @returns An array of the instantiated features in the same order that the constructors were
|
|
20
23
|
* passed in.
|
|
21
24
|
*/
|
|
22
|
-
export function initModFeatures(
|
|
25
|
+
export function initModFeatures<T extends ReadonlyArray<typeof ModFeature>>(
|
|
23
26
|
mod: ModUpgraded,
|
|
24
|
-
modFeatures:
|
|
25
|
-
):
|
|
27
|
+
modFeatures: T,
|
|
28
|
+
): { [Key in keyof T]: InstanceType<T[Key]> } {
|
|
26
29
|
const instantiatedModFeatures: ModFeature[] = [];
|
|
27
30
|
|
|
28
31
|
for (const modFeature of modFeatures) {
|
|
29
32
|
// eslint-disable-next-line new-cap
|
|
30
|
-
const instantiatedModFeature = new modFeature(mod);
|
|
33
|
+
const instantiatedModFeature = new modFeature(mod, false);
|
|
34
|
+
instantiatedModFeature.init();
|
|
35
|
+
|
|
31
36
|
instantiatedModFeatures.push(instantiatedModFeature);
|
|
32
37
|
}
|
|
33
38
|
|
|
34
|
-
return instantiatedModFeatures;
|
|
39
|
+
return instantiatedModFeatures as { [Key in keyof T]: InstanceType<T[Key]> };
|
|
35
40
|
}
|
package/src/types/AnyClass.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Helper type to represent any class. (This is the same type as any class constructor.) */
|
|
2
|
-
export type AnyClass = new (
|
|
2
|
+
export type AnyClass = new () => object;
|