isaacscript-common 30.12.4 → 30.12.6
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 +17 -17
- package/dist/isaacscript-common.lua +41 -41
- package/dist/src/functions/array.lua +3 -3
- package/dist/src/functions/arrayLua.d.ts.map +1 -1
- package/dist/src/functions/{initArray.d.ts → newArray.d.ts} +4 -4
- package/dist/src/functions/newArray.d.ts.map +1 -0
- package/dist/src/functions/{initArray.lua → newArray.lua} +3 -3
- package/dist/src/functions/pickupsSpecific.lua +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.lua +8 -8
- package/package.json +2 -2
- package/src/functions/array.ts +3 -3
- package/src/functions/arrayLua.ts +0 -2
- package/src/functions/{initArray.ts → newArray.ts} +3 -3
- package/src/functions/pickupsSpecific.ts +1 -1
- package/src/index.ts +1 -1
- package/dist/src/functions/initArray.d.ts.map +0 -1
package/dist/index.rollup.d.ts
CHANGED
|
@@ -7556,23 +7556,6 @@ export declare function inGenesisRoom(): boolean;
|
|
|
7556
7556
|
*/
|
|
7557
7557
|
export declare function inHomeCloset(): boolean;
|
|
7558
7558
|
|
|
7559
|
-
/**
|
|
7560
|
-
* Initializes an array with all of the elements containing the specified default value.
|
|
7561
|
-
*
|
|
7562
|
-
* The provided default value will be copied with the `deepCopy` function before adding it to the
|
|
7563
|
-
* new array. Thus, you can initialize an array of arrays, or an array of maps, and so on. (If the
|
|
7564
|
-
* `deepCopy` function was not used, then all of the array elements would just be references to the
|
|
7565
|
-
* same underlying data structure.)
|
|
7566
|
-
*
|
|
7567
|
-
* For example:
|
|
7568
|
-
*
|
|
7569
|
-
* ```ts
|
|
7570
|
-
* const arrayWithZeroes = initArray(0, 10); // Has 10 elements of 0.
|
|
7571
|
-
* const arrayWithArrays = initArray([0], 20); // Has 20 elements of an array with a 0 in it.
|
|
7572
|
-
* ```
|
|
7573
|
-
*/
|
|
7574
|
-
export declare function initArray<T>(defaultValue: T, size: int): T[];
|
|
7575
|
-
|
|
7576
7559
|
/**
|
|
7577
7560
|
* Helper function to instantiate an array of mod features all at once. Use this function if your
|
|
7578
7561
|
* mod uses the pattern of expressing mod features as `ModFeature` classes.
|
|
@@ -13045,6 +13028,23 @@ export declare const NEW_FLOOR_STARTING_POSITION_NORMAL_MODE: Readonly<Vector>;
|
|
|
13045
13028
|
*/
|
|
13046
13029
|
export declare const NEW_RUN_PLAYER_STARTING_POSITION: Readonly<Vector>;
|
|
13047
13030
|
|
|
13031
|
+
/**
|
|
13032
|
+
* Initializes an array with all of the elements containing the specified default value.
|
|
13033
|
+
*
|
|
13034
|
+
* The provided default value will be copied with the `deepCopy` function before adding it to the
|
|
13035
|
+
* new array. Thus, you can initialize an array of arrays, or an array of maps, and so on. (If the
|
|
13036
|
+
* `deepCopy` function was not used, then all of the array elements would just be references to the
|
|
13037
|
+
* same underlying data structure.)
|
|
13038
|
+
*
|
|
13039
|
+
* For example:
|
|
13040
|
+
*
|
|
13041
|
+
* ```ts
|
|
13042
|
+
* const arrayWithZeroes = newArray(0, 10); // Has 10 elements of 0.
|
|
13043
|
+
* const arrayWithArrays = newArray([0], 20); // Has 20 elements of an array with a 0 in it.
|
|
13044
|
+
* ```
|
|
13045
|
+
*/
|
|
13046
|
+
export declare function newArray<T>(defaultValue: T, size: int): T[];
|
|
13047
|
+
|
|
13048
13048
|
/**
|
|
13049
13049
|
* Constructor for a `ChargeBarSprites` object. For more information, see the `renderChargeBar`
|
|
13050
13050
|
* helper function.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 30.12.
|
|
3
|
+
isaacscript-common 30.12.6
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -16705,15 +16705,15 @@ function ____exports.copyArray(self, oldArray, numElements)
|
|
|
16705
16705
|
if numElements == nil then
|
|
16706
16706
|
return {table.unpack(oldArray)}
|
|
16707
16707
|
end
|
|
16708
|
-
local
|
|
16708
|
+
local newArrayWithFirstNElements = {}
|
|
16709
16709
|
do
|
|
16710
16710
|
local i = 0
|
|
16711
16711
|
while i < numElements do
|
|
16712
|
-
|
|
16712
|
+
newArrayWithFirstNElements[#newArrayWithFirstNElements + 1] = oldArray[i + 1]
|
|
16713
16713
|
i = i + 1
|
|
16714
16714
|
end
|
|
16715
16715
|
end
|
|
16716
|
-
return
|
|
16716
|
+
return newArrayWithFirstNElements
|
|
16717
16717
|
end
|
|
16718
16718
|
function ____exports.getRandomArrayIndex(self, array, seedOrRNG, exceptions)
|
|
16719
16719
|
if seedOrRNG == nil then
|
|
@@ -39288,7 +39288,7 @@ function ____exports.removeAllPills(self, pillColor, cap)
|
|
|
39288
39288
|
return removeAllPickups(nil, PickupVariant.PILL, pillColor, cap)
|
|
39289
39289
|
end
|
|
39290
39290
|
function ____exports.removeAllSacks(self, sackSubType, cap)
|
|
39291
|
-
return removeAllPickups(nil, PickupVariant.
|
|
39291
|
+
return removeAllPickups(nil, PickupVariant.SACK, sackSubType, cap)
|
|
39292
39292
|
end
|
|
39293
39293
|
function ____exports.removeAllTrinkets(self, trinketType, cap)
|
|
39294
39294
|
return removeAllPickups(nil, PickupVariant.TRINKET, trinketType, cap)
|
|
@@ -53150,26 +53150,6 @@ function ____exports.hexToKColor(self, hexString, alpha)
|
|
|
53150
53150
|
local base = 255
|
|
53151
53151
|
return KColor(r / base, g / base, b / base, alpha)
|
|
53152
53152
|
end
|
|
53153
|
-
return ____exports
|
|
53154
|
-
end,
|
|
53155
|
-
["src.functions.initArray"] = function(...)
|
|
53156
|
-
local ____exports = {}
|
|
53157
|
-
local ____deepCopy = require("src.functions.deepCopy")
|
|
53158
|
-
local deepCopy = ____deepCopy.deepCopy
|
|
53159
|
-
local ____utils = require("src.functions.utils")
|
|
53160
|
-
local ____repeat = ____utils["repeat"]
|
|
53161
|
-
function ____exports.initArray(self, defaultValue, size)
|
|
53162
|
-
local array = {}
|
|
53163
|
-
____repeat(
|
|
53164
|
-
nil,
|
|
53165
|
-
size,
|
|
53166
|
-
function()
|
|
53167
|
-
local copy = deepCopy(nil, defaultValue)
|
|
53168
|
-
array[#array + 1] = copy
|
|
53169
|
-
end
|
|
53170
|
-
)
|
|
53171
|
-
return array
|
|
53172
|
-
end
|
|
53173
53153
|
return ____exports
|
|
53174
53154
|
end,
|
|
53175
53155
|
["src.functions.itemPool"] = function(...)
|
|
@@ -53444,6 +53424,26 @@ function ____exports.initModFeatures(self, mod, modFeatures)
|
|
|
53444
53424
|
end
|
|
53445
53425
|
return instantiatedModFeatures
|
|
53446
53426
|
end
|
|
53427
|
+
return ____exports
|
|
53428
|
+
end,
|
|
53429
|
+
["src.functions.newArray"] = function(...)
|
|
53430
|
+
local ____exports = {}
|
|
53431
|
+
local ____deepCopy = require("src.functions.deepCopy")
|
|
53432
|
+
local deepCopy = ____deepCopy.deepCopy
|
|
53433
|
+
local ____utils = require("src.functions.utils")
|
|
53434
|
+
local ____repeat = ____utils["repeat"]
|
|
53435
|
+
function ____exports.newArray(self, defaultValue, size)
|
|
53436
|
+
local array = {}
|
|
53437
|
+
____repeat(
|
|
53438
|
+
nil,
|
|
53439
|
+
size,
|
|
53440
|
+
function()
|
|
53441
|
+
local copy = deepCopy(nil, defaultValue)
|
|
53442
|
+
array[#array + 1] = copy
|
|
53443
|
+
end
|
|
53444
|
+
)
|
|
53445
|
+
return array
|
|
53446
|
+
end
|
|
53447
53447
|
return ____exports
|
|
53448
53448
|
end,
|
|
53449
53449
|
["src.functions.npcDataStructures"] = function(...)
|
|
@@ -54240,14 +54240,6 @@ do
|
|
|
54240
54240
|
end
|
|
54241
54241
|
end
|
|
54242
54242
|
end
|
|
54243
|
-
do
|
|
54244
|
-
local ____export = require("src.functions.initArray")
|
|
54245
|
-
for ____exportKey, ____exportValue in pairs(____export) do
|
|
54246
|
-
if ____exportKey ~= "default" then
|
|
54247
|
-
____exports[____exportKey] = ____exportValue
|
|
54248
|
-
end
|
|
54249
|
-
end
|
|
54250
|
-
end
|
|
54251
54243
|
do
|
|
54252
54244
|
local ____export = require("src.functions.input")
|
|
54253
54245
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -54392,6 +54384,14 @@ do
|
|
|
54392
54384
|
end
|
|
54393
54385
|
end
|
|
54394
54386
|
end
|
|
54387
|
+
do
|
|
54388
|
+
local ____export = require("src.functions.newArray")
|
|
54389
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
54390
|
+
if ____exportKey ~= "default" then
|
|
54391
|
+
____exports[____exportKey] = ____exportValue
|
|
54392
|
+
end
|
|
54393
|
+
end
|
|
54394
|
+
end
|
|
54395
54395
|
do
|
|
54396
54396
|
local ____export = require("src.functions.nextStage")
|
|
54397
54397
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -55356,14 +55356,6 @@ do
|
|
|
55356
55356
|
end
|
|
55357
55357
|
end
|
|
55358
55358
|
end
|
|
55359
|
-
do
|
|
55360
|
-
local ____export = require("src.functions.initArray")
|
|
55361
|
-
for ____exportKey, ____exportValue in pairs(____export) do
|
|
55362
|
-
if ____exportKey ~= "default" then
|
|
55363
|
-
____exports[____exportKey] = ____exportValue
|
|
55364
|
-
end
|
|
55365
|
-
end
|
|
55366
|
-
end
|
|
55367
55359
|
do
|
|
55368
55360
|
local ____export = require("src.functions.input")
|
|
55369
55361
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -55508,6 +55500,14 @@ do
|
|
|
55508
55500
|
end
|
|
55509
55501
|
end
|
|
55510
55502
|
end
|
|
55503
|
+
do
|
|
55504
|
+
local ____export = require("src.functions.newArray")
|
|
55505
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
55506
|
+
if ____exportKey ~= "default" then
|
|
55507
|
+
____exports[____exportKey] = ____exportValue
|
|
55508
|
+
end
|
|
55509
|
+
end
|
|
55510
|
+
end
|
|
55511
55511
|
do
|
|
55512
55512
|
local ____export = require("src.functions.nextStage")
|
|
55513
55513
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -88,15 +88,15 @@ function ____exports.copyArray(self, oldArray, numElements)
|
|
|
88
88
|
if numElements == nil then
|
|
89
89
|
return {table.unpack(oldArray)}
|
|
90
90
|
end
|
|
91
|
-
local
|
|
91
|
+
local newArrayWithFirstNElements = {}
|
|
92
92
|
do
|
|
93
93
|
local i = 0
|
|
94
94
|
while i < numElements do
|
|
95
|
-
|
|
95
|
+
newArrayWithFirstNElements[#newArrayWithFirstNElements + 1] = oldArray[i + 1]
|
|
96
96
|
i = i + 1
|
|
97
97
|
end
|
|
98
98
|
end
|
|
99
|
-
return
|
|
99
|
+
return newArrayWithFirstNElements
|
|
100
100
|
end
|
|
101
101
|
--- Helper function to get a random index from the provided array.
|
|
102
102
|
--
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrayLua.d.ts","sourceRoot":"","sources":["../../../src/functions/arrayLua.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"arrayLua.d.ts","sourceRoot":"","sources":["../../../src/functions/arrayLua.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,CAAC,EACrB,KAAK,EAAE,CAAC,EAAE,EACV,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,OAAO,GACrD,OAAO,CAET;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,CAAC,EACtB,KAAK,EAAE,CAAC,EAAE,EACV,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,OAAO,GACrD,CAAC,EAAE,CAEL;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,CAAC,EACpB,KAAK,EAAE,CAAC,EAAE,EACV,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,OAAO,GACrD,CAAC,GAAG,SAAS,CAEf;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,EACvB,KAAK,EAAE,CAAC,EAAE,EACV,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,IAAI,GAClD,IAAI,CAEN;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAE3D;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,CAAC,EACtB,KAAK,EAAE,CAAC,EAAE,EACV,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,GAC/C,CAAC,EAAE,CAEL;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,CAAC,EACpB,KAAK,EAAE,CAAC,EAAE,EACV,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,OAAO,GACrD,OAAO,CAET"}
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
* For example:
|
|
11
11
|
*
|
|
12
12
|
* ```ts
|
|
13
|
-
* const arrayWithZeroes =
|
|
14
|
-
* const arrayWithArrays =
|
|
13
|
+
* const arrayWithZeroes = newArray(0, 10); // Has 10 elements of 0.
|
|
14
|
+
* const arrayWithArrays = newArray([0], 20); // Has 20 elements of an array with a 0 in it.
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
|
-
export declare function
|
|
18
|
-
//# sourceMappingURL=
|
|
17
|
+
export declare function newArray<T>(defaultValue: T, size: int): T[];
|
|
18
|
+
//# sourceMappingURL=newArray.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"newArray.d.ts","sourceRoot":"","sources":["../../../src/functions/newArray.ts"],"names":[],"mappings":";AAGA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,EAAE,CAQ3D"}
|
|
@@ -13,10 +13,10 @@ local ____repeat = ____utils["repeat"]
|
|
|
13
13
|
-- For example:
|
|
14
14
|
--
|
|
15
15
|
-- ```ts
|
|
16
|
-
-- const arrayWithZeroes =
|
|
17
|
-
-- const arrayWithArrays =
|
|
16
|
+
-- const arrayWithZeroes = newArray(0, 10); // Has 10 elements of 0.
|
|
17
|
+
-- const arrayWithArrays = newArray([0], 20); // Has 20 elements of an array with a 0 in it.
|
|
18
18
|
-- ```
|
|
19
|
-
function ____exports.
|
|
19
|
+
function ____exports.newArray(self, defaultValue, size)
|
|
20
20
|
local array = {}
|
|
21
21
|
____repeat(
|
|
22
22
|
nil,
|
|
@@ -197,7 +197,7 @@ end
|
|
|
197
197
|
-- @param cap Optional. If specified, will only remove the given amount of sacks.
|
|
198
198
|
-- @returns The sacks that were removed.
|
|
199
199
|
function ____exports.removeAllSacks(self, sackSubType, cap)
|
|
200
|
-
return removeAllPickups(nil, PickupVariant.
|
|
200
|
+
return removeAllPickups(nil, PickupVariant.SACK, sackSubType, cap)
|
|
201
201
|
end
|
|
202
202
|
--- Helper function to remove all of the trinkets in the room.
|
|
203
203
|
--
|
package/dist/src/index.d.ts
CHANGED
|
@@ -57,7 +57,6 @@ export * from "./functions/gridEntities";
|
|
|
57
57
|
export * from "./functions/gridEntitiesSpecific";
|
|
58
58
|
export * from "./functions/gridIndex";
|
|
59
59
|
export * from "./functions/hex";
|
|
60
|
-
export * from "./functions/initArray";
|
|
61
60
|
export * from "./functions/input";
|
|
62
61
|
export * from "./functions/isaacAPIClass";
|
|
63
62
|
export * from "./functions/itemPool";
|
|
@@ -76,6 +75,7 @@ export * from "./functions/merge";
|
|
|
76
75
|
export * from "./functions/mergeTests";
|
|
77
76
|
export * from "./functions/minimap";
|
|
78
77
|
export * from "./functions/modFeatures";
|
|
78
|
+
export * from "./functions/newArray";
|
|
79
79
|
export * from "./functions/nextStage";
|
|
80
80
|
export * from "./functions/npcDataStructures";
|
|
81
81
|
export * from "./functions/npcs";
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,q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AC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yCAAyC,CAAC;AACxD,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC"}
|
package/dist/src/index.lua
CHANGED
|
@@ -471,14 +471,6 @@ do
|
|
|
471
471
|
end
|
|
472
472
|
end
|
|
473
473
|
end
|
|
474
|
-
do
|
|
475
|
-
local ____export = require("src.functions.initArray")
|
|
476
|
-
for ____exportKey, ____exportValue in pairs(____export) do
|
|
477
|
-
if ____exportKey ~= "default" then
|
|
478
|
-
____exports[____exportKey] = ____exportValue
|
|
479
|
-
end
|
|
480
|
-
end
|
|
481
|
-
end
|
|
482
474
|
do
|
|
483
475
|
local ____export = require("src.functions.input")
|
|
484
476
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -623,6 +615,14 @@ do
|
|
|
623
615
|
end
|
|
624
616
|
end
|
|
625
617
|
end
|
|
618
|
+
do
|
|
619
|
+
local ____export = require("src.functions.newArray")
|
|
620
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
621
|
+
if ____exportKey ~= "default" then
|
|
622
|
+
____exports[____exportKey] = ____exportValue
|
|
623
|
+
end
|
|
624
|
+
end
|
|
625
|
+
end
|
|
626
626
|
do
|
|
627
627
|
local ____export = require("src.functions.nextStage")
|
|
628
628
|
for ____exportKey, ____exportValue in pairs(____export) do
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "30.12.
|
|
3
|
+
"version": "30.12.6",
|
|
4
4
|
"description": "Helper functions and features for IsaacScript mods.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"license": "GPL-3.0",
|
|
23
23
|
"author": "Zamiell",
|
|
24
|
-
"type": "
|
|
24
|
+
"type": "module",
|
|
25
25
|
"main": "dist/src/index",
|
|
26
26
|
"types": "dist/index.rollup.d.ts",
|
|
27
27
|
"dependencies": {
|
package/src/functions/array.ts
CHANGED
|
@@ -218,13 +218,13 @@ export function copyArray<T>(
|
|
|
218
218
|
return [...oldArray];
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
-
const
|
|
221
|
+
const newArrayWithFirstNElements: T[] = [];
|
|
222
222
|
for (let i = 0; i < numElements; i++) {
|
|
223
223
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
224
|
-
|
|
224
|
+
newArrayWithFirstNElements.push(oldArray[i]!);
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
return
|
|
227
|
+
return newArrayWithFirstNElements;
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
/** Helper function to remove all of the elements in an array in-place. */
|
|
@@ -12,11 +12,11 @@ import { repeat } from "./utils";
|
|
|
12
12
|
* For example:
|
|
13
13
|
*
|
|
14
14
|
* ```ts
|
|
15
|
-
* const arrayWithZeroes =
|
|
16
|
-
* const arrayWithArrays =
|
|
15
|
+
* const arrayWithZeroes = newArray(0, 10); // Has 10 elements of 0.
|
|
16
|
+
* const arrayWithArrays = newArray([0], 20); // Has 20 elements of an array with a 0 in it.
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
export function
|
|
19
|
+
export function newArray<T>(defaultValue: T, size: int): T[] {
|
|
20
20
|
const array: T[] = [];
|
|
21
21
|
repeat(size, () => {
|
|
22
22
|
const copy = deepCopy(defaultValue);
|
package/src/index.ts
CHANGED
|
@@ -57,7 +57,6 @@ export * from "./functions/gridEntities";
|
|
|
57
57
|
export * from "./functions/gridEntitiesSpecific";
|
|
58
58
|
export * from "./functions/gridIndex";
|
|
59
59
|
export * from "./functions/hex";
|
|
60
|
-
export * from "./functions/initArray";
|
|
61
60
|
export * from "./functions/input";
|
|
62
61
|
export * from "./functions/isaacAPIClass";
|
|
63
62
|
export * from "./functions/itemPool";
|
|
@@ -76,6 +75,7 @@ export * from "./functions/merge";
|
|
|
76
75
|
export * from "./functions/mergeTests";
|
|
77
76
|
export * from "./functions/minimap";
|
|
78
77
|
export * from "./functions/modFeatures";
|
|
78
|
+
export * from "./functions/newArray";
|
|
79
79
|
export * from "./functions/nextStage";
|
|
80
80
|
export * from "./functions/npcDataStructures";
|
|
81
81
|
export * from "./functions/npcs";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initArray.d.ts","sourceRoot":"","sources":["../../../src/functions/initArray.ts"],"names":[],"mappings":";AAGA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,EAAE,CAQ5D"}
|