isaacscript-common 66.0.0 → 67.1.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 +22 -8
- package/dist/isaacscript-common.lua +29 -13
- package/dist/src/functions/bitwise.d.ts +1 -1
- package/dist/src/functions/bitwise.d.ts.map +1 -1
- package/dist/src/functions/bitwise.lua +3 -3
- package/dist/src/functions/math.d.ts +15 -0
- package/dist/src/functions/math.d.ts.map +1 -1
- package/dist/src/functions/math.lua +28 -0
- package/dist/src/functions/pickupVariants.d.ts +1 -1
- package/dist/src/functions/pickupVariants.d.ts.map +1 -1
- package/dist/src/functions/pickupVariants.lua +2 -2
- package/dist/src/functions/pickupsSpecific.d.ts +3 -5
- package/dist/src/functions/pickupsSpecific.d.ts.map +1 -1
- package/dist/src/functions/pickupsSpecific.lua +6 -6
- package/dist/src/functions/utils.d.ts +1 -1
- package/dist/src/functions/utils.d.ts.map +1 -1
- package/dist/src/functions/utils.lua +2 -2
- package/package.json +2 -2
- package/src/functions/bitwise.ts +3 -3
- package/src/functions/math.ts +39 -0
- package/src/functions/pickupVariants.ts +2 -3
- package/src/functions/pickupsSpecific.ts +6 -8
- package/src/functions/utils.ts +2 -2
package/dist/index.rollup.d.ts
CHANGED
|
@@ -1862,7 +1862,7 @@ export declare function countEntities(entityType?: EntityType | -1, variant?: nu
|
|
|
1862
1862
|
* Helper function to count the number of bits that are set to 1 in a binary representation of a
|
|
1863
1863
|
* number.
|
|
1864
1864
|
*/
|
|
1865
|
-
export declare function countSetBits(
|
|
1865
|
+
export declare function countSetBits(num: int): int;
|
|
1866
1866
|
|
|
1867
1867
|
/**
|
|
1868
1868
|
* The base class for a custom callback. Individual custom callbacks (and validation callbacks) will
|
|
@@ -8789,7 +8789,7 @@ export declare function isBossRushDoor(door: GridEntityDoor): boolean;
|
|
|
8789
8789
|
*/
|
|
8790
8790
|
export declare function isCard(cardType: CardType): boolean;
|
|
8791
8791
|
|
|
8792
|
-
/** For `PickupVariant.
|
|
8792
|
+
/** For `PickupVariant.CARD` (300). */
|
|
8793
8793
|
export declare function isCardPickup(pickup: EntityPickup): pickup is EntityPickupCard;
|
|
8794
8794
|
|
|
8795
8795
|
/** Returns whether the given card type matches the specified item config card type. */
|
|
@@ -16091,7 +16091,7 @@ export declare function renderTextOnEntity(entity: Entity | GridEntity, text: st
|
|
|
16091
16091
|
* });
|
|
16092
16092
|
* ```
|
|
16093
16093
|
*/
|
|
16094
|
-
export declare function repeat(
|
|
16094
|
+
export declare function repeat(num: int, func: (i: int) => void): void;
|
|
16095
16095
|
|
|
16096
16096
|
/**
|
|
16097
16097
|
* Helper function to reroll an enemy. Use this instead of the vanilla "Game.RerollEnemy" function
|
|
@@ -17518,14 +17518,12 @@ export declare function spawnBoss(entityType: EntityType, variant: int, subType:
|
|
|
17518
17518
|
*/
|
|
17519
17519
|
export declare function spawnBossWithSeed(entityType: EntityType, variant: int, subType: int, positionOrGridIndex: Vector | int, seedOrRNG: Seed | RNG, velocity?: Vector, spawner?: Entity | undefined, numSegments?: int): EntityNPC;
|
|
17520
17520
|
|
|
17521
|
-
/**
|
|
17522
|
-
* Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.TAROT_CARD` (300).
|
|
17523
|
-
*/
|
|
17521
|
+
/** Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.CARD` (300). */
|
|
17524
17522
|
export declare function spawnCard(cardType: CardType, positionOrGridIndex: Vector | int, velocity?: Vector, spawner?: Entity | undefined, seedOrRNG?: Seed | RNG | undefined): EntityPickupCard;
|
|
17525
17523
|
|
|
17526
17524
|
/**
|
|
17527
|
-
* Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.
|
|
17528
|
-
*
|
|
17525
|
+
* Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.CARD` (300) and a
|
|
17526
|
+
* specific seed.
|
|
17529
17527
|
*/
|
|
17530
17528
|
export declare function spawnCardWithSeed(cardType: CardType, positionOrGridIndex: Vector | int, seedOrRNG: Seed | RNG, velocity?: Vector, spawner?: Entity | undefined): EntityPickupCard;
|
|
17531
17529
|
|
|
@@ -17949,6 +17947,22 @@ export declare function spawnVoidPortal(gridIndex: int): GridEntity | undefined;
|
|
|
17949
17947
|
*/
|
|
17950
17948
|
export declare function spawnWithSeed(entityType: EntityType, variant: int, subType: int, positionOrGridIndex: Vector | int, seedOrRNG: Seed | RNG, velocity?: Vector, spawner?: Entity | undefined): Entity;
|
|
17951
17949
|
|
|
17950
|
+
/**
|
|
17951
|
+
* Breaks a number into chunks of a given size. This is similar to the `String.split` method, but
|
|
17952
|
+
* for a number instead of a string.
|
|
17953
|
+
*
|
|
17954
|
+
* For example, `splitNumber(90, 25)` would return an array with four elements:
|
|
17955
|
+
*
|
|
17956
|
+
* - [1, 25]
|
|
17957
|
+
* - [26, 50]
|
|
17958
|
+
* - [51, 75]
|
|
17959
|
+
* - [76, 90]
|
|
17960
|
+
*
|
|
17961
|
+
* @param num The number to split into chunks. This must be a positive integer.
|
|
17962
|
+
* @param size The size of each chunk. This must be a positive integer.
|
|
17963
|
+
*/
|
|
17964
|
+
export declare function splitNumber(num: int, size: int): Array<[min: int, max: int]>;
|
|
17965
|
+
|
|
17952
17966
|
/**
|
|
17953
17967
|
* Helper function to check if two sprite layers have the same sprite sheet by using the
|
|
17954
17968
|
* `Sprite.GetTexel` method.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common
|
|
3
|
+
isaacscript-common 67.1.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -5007,8 +5007,8 @@ ____exports.PickupVariant.BROKEN_SHOVEL = 110
|
|
|
5007
5007
|
____exports.PickupVariant[____exports.PickupVariant.BROKEN_SHOVEL] = "BROKEN_SHOVEL"
|
|
5008
5008
|
____exports.PickupVariant.SHOP_ITEM = 150
|
|
5009
5009
|
____exports.PickupVariant[____exports.PickupVariant.SHOP_ITEM] = "SHOP_ITEM"
|
|
5010
|
-
____exports.PickupVariant.
|
|
5011
|
-
____exports.PickupVariant[____exports.PickupVariant.
|
|
5010
|
+
____exports.PickupVariant.CARD = 300
|
|
5011
|
+
____exports.PickupVariant[____exports.PickupVariant.CARD] = "CARD"
|
|
5012
5012
|
____exports.PickupVariant.BIG_CHEST = 340
|
|
5013
5013
|
____exports.PickupVariant[____exports.PickupVariant.BIG_CHEST] = "BIG_CHEST"
|
|
5014
5014
|
____exports.PickupVariant.TRINKET = 350
|
|
@@ -8592,7 +8592,7 @@ ____exports.CollectibleType.STYE = 731
|
|
|
8592
8592
|
____exports.CollectibleType[____exports.CollectibleType.STYE] = "STYE"
|
|
8593
8593
|
____exports.CollectibleType.MOMS_RING = 732
|
|
8594
8594
|
____exports.CollectibleType[____exports.CollectibleType.MOMS_RING] = "MOMS_RING"
|
|
8595
|
-
--- For `EntityType.PICKUP` (5), `PickupVariant.
|
|
8595
|
+
--- For `EntityType.PICKUP` (5), `PickupVariant.CARD` (300).
|
|
8596
8596
|
--
|
|
8597
8597
|
-- This is the sub-type of a card.
|
|
8598
8598
|
--
|
|
@@ -16336,10 +16336,10 @@ function ____exports.isRepentance(self)
|
|
|
16336
16336
|
local getAnimation = classTable.GetAnimation
|
|
16337
16337
|
return isFunction(nil, getAnimation)
|
|
16338
16338
|
end
|
|
16339
|
-
____exports["repeat"] = function(self,
|
|
16339
|
+
____exports["repeat"] = function(self, num, func)
|
|
16340
16340
|
do
|
|
16341
16341
|
local i = 0
|
|
16342
|
-
while i <
|
|
16342
|
+
while i < num do
|
|
16343
16343
|
func(nil, i)
|
|
16344
16344
|
i = i + 1
|
|
16345
16345
|
end
|
|
@@ -20285,6 +20285,22 @@ function ____exports.sign(self, n)
|
|
|
20285
20285
|
end
|
|
20286
20286
|
return 0
|
|
20287
20287
|
end
|
|
20288
|
+
function ____exports.splitNumber(self, num, size)
|
|
20289
|
+
if num <= 0 then
|
|
20290
|
+
error("The number to split needs to be a positive number and is instead: " .. tostring(num))
|
|
20291
|
+
end
|
|
20292
|
+
if size <= 0 then
|
|
20293
|
+
error("The size to split needs to be a positive number and is instead: " .. tostring(num))
|
|
20294
|
+
end
|
|
20295
|
+
local chunks = {}
|
|
20296
|
+
local min = 1
|
|
20297
|
+
while min <= num do
|
|
20298
|
+
local max = math.min(min + size - 1, num)
|
|
20299
|
+
chunks[#chunks + 1] = {min, max}
|
|
20300
|
+
min = max + 1
|
|
20301
|
+
end
|
|
20302
|
+
return chunks
|
|
20303
|
+
end
|
|
20288
20304
|
function ____exports.tanh(self, x)
|
|
20289
20305
|
return (math.exp(x) - math.exp(-x)) / (math.exp(x) + math.exp(-x))
|
|
20290
20306
|
end
|
|
@@ -20642,10 +20658,10 @@ function ____exports.convertDecimalToBinary(self, num, minLength)
|
|
|
20642
20658
|
end
|
|
20643
20659
|
return bits
|
|
20644
20660
|
end
|
|
20645
|
-
function ____exports.countSetBits(self,
|
|
20661
|
+
function ____exports.countSetBits(self, num)
|
|
20646
20662
|
local count = 0
|
|
20647
|
-
while
|
|
20648
|
-
|
|
20663
|
+
while num > 0 do
|
|
20664
|
+
num = num & num - 1
|
|
20649
20665
|
count = count + 1
|
|
20650
20666
|
end
|
|
20651
20667
|
return count
|
|
@@ -24105,7 +24121,7 @@ function ____exports.isCollectible(self, pickup)
|
|
|
24105
24121
|
return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.COLLECTIBLE
|
|
24106
24122
|
end
|
|
24107
24123
|
function ____exports.isCardPickup(self, pickup)
|
|
24108
|
-
return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.
|
|
24124
|
+
return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.CARD
|
|
24109
24125
|
end
|
|
24110
24126
|
function ____exports.isTrinket(self, pickup)
|
|
24111
24127
|
return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.TRINKET
|
|
@@ -40298,7 +40314,7 @@ function ____exports.getCards(self, cardType)
|
|
|
40298
40314
|
if cardType == nil then
|
|
40299
40315
|
cardType = -1
|
|
40300
40316
|
end
|
|
40301
|
-
return getPickups(nil, PickupVariant.
|
|
40317
|
+
return getPickups(nil, PickupVariant.CARD, cardType)
|
|
40302
40318
|
end
|
|
40303
40319
|
function ____exports.getCoins(self, coinSubType)
|
|
40304
40320
|
if coinSubType == nil then
|
|
@@ -40358,7 +40374,7 @@ function ____exports.removeAllCards(self, cardType, cap)
|
|
|
40358
40374
|
if cardType == nil then
|
|
40359
40375
|
cardType = -1
|
|
40360
40376
|
end
|
|
40361
|
-
return removeAllPickups(nil, PickupVariant.
|
|
40377
|
+
return removeAllPickups(nil, PickupVariant.CARD, cardType, cap)
|
|
40362
40378
|
end
|
|
40363
40379
|
function ____exports.removeAllCoins(self, coinSubType, cap)
|
|
40364
40380
|
return removeAllPickups(nil, PickupVariant.COIN, coinSubType, cap)
|
|
@@ -40441,7 +40457,7 @@ function ____exports.spawnCard(self, cardType, positionOrGridIndex, velocity, sp
|
|
|
40441
40457
|
end
|
|
40442
40458
|
return spawnPickup(
|
|
40443
40459
|
nil,
|
|
40444
|
-
PickupVariant.
|
|
40460
|
+
PickupVariant.CARD,
|
|
40445
40461
|
cardType,
|
|
40446
40462
|
positionOrGridIndex,
|
|
40447
40463
|
velocity,
|
|
@@ -20,7 +20,7 @@ export declare function convertDecimalToBinary(num: number, minLength?: int): in
|
|
|
20
20
|
* Helper function to count the number of bits that are set to 1 in a binary representation of a
|
|
21
21
|
* number.
|
|
22
22
|
*/
|
|
23
|
-
export declare function countSetBits(
|
|
23
|
+
export declare function countSetBits(num: int): int;
|
|
24
24
|
/** Helper function to get the value of a specific but in a binary representation of a number. */
|
|
25
25
|
export declare function getKBitOfN(k: int, n: int): int;
|
|
26
26
|
/** Helper function to get the number of bits in a binary representation of a number. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitwise.d.ts","sourceRoot":"","sources":["../../../src/functions/bitwise.ts"],"names":[],"mappings":";;;;AAGA,+EAA+E;AAC/E,wBAAgB,eAAe,CAAC,CAAC,SAAS,OAAO,GAAG,UAAU,EAC5D,KAAK,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,GACxB,QAAQ,CAAC,CAAC,CAAC,CAOb;AAED,mFAAmF;AACnF,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,CAG1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,CAqB1E;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"bitwise.d.ts","sourceRoot":"","sources":["../../../src/functions/bitwise.ts"],"names":[],"mappings":";;;;AAGA,+EAA+E;AAC/E,wBAAgB,eAAe,CAAC,CAAC,SAAS,OAAO,GAAG,UAAU,EAC5D,KAAK,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,GACxB,QAAQ,CAAC,CAAC,CAAC,CAOb;AAED,mFAAmF;AACnF,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,CAG1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,CAqB1E;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAS1C;AAED,iGAAiG;AACjG,wBAAgB,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,GAAG,CAE9C;AAED,wFAAwF;AACxF,wBAAgB,aAAa,CAAC,CAAC,EAAE,GAAG,GAAG,GAAG,CAQzC;AAED,+EAA+E;AAC/E,wBAAgB,aAAa,CAAC,CAAC,SAAS,OAAO,GAAG,UAAU,EAC1D,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAC3B,QAAQ,CAAC,CAAC,CAAC,CAOb"}
|
|
@@ -49,10 +49,10 @@ function ____exports.convertDecimalToBinary(self, num, minLength)
|
|
|
49
49
|
end
|
|
50
50
|
--- Helper function to count the number of bits that are set to 1 in a binary representation of a
|
|
51
51
|
-- number.
|
|
52
|
-
function ____exports.countSetBits(self,
|
|
52
|
+
function ____exports.countSetBits(self, num)
|
|
53
53
|
local count = 0
|
|
54
|
-
while
|
|
55
|
-
|
|
54
|
+
while num > 0 do
|
|
55
|
+
num = num & num - 1
|
|
56
56
|
count = count + 1
|
|
57
57
|
end
|
|
58
58
|
return count
|
|
@@ -46,5 +46,20 @@ export declare function lerpAngleDegrees(aStart: number, aEnd: number, percent:
|
|
|
46
46
|
export declare function round(num: float, numDecimalPlaces?: number): float;
|
|
47
47
|
/** @returns 1 if n is positive, -1 if n is negative, or 0 if n is 0. */
|
|
48
48
|
export declare function sign(n: number): int;
|
|
49
|
+
/**
|
|
50
|
+
* Breaks a number into chunks of a given size. This is similar to the `String.split` method, but
|
|
51
|
+
* for a number instead of a string.
|
|
52
|
+
*
|
|
53
|
+
* For example, `splitNumber(90, 25)` would return an array with four elements:
|
|
54
|
+
*
|
|
55
|
+
* - [1, 25]
|
|
56
|
+
* - [26, 50]
|
|
57
|
+
* - [51, 75]
|
|
58
|
+
* - [76, 90]
|
|
59
|
+
*
|
|
60
|
+
* @param num The number to split into chunks. This must be a positive integer.
|
|
61
|
+
* @param size The size of each chunk. This must be a positive integer.
|
|
62
|
+
*/
|
|
63
|
+
export declare function splitNumber(num: int, size: int): Array<[min: int, max: int]>;
|
|
49
64
|
export declare function tanh(x: number): number;
|
|
50
65
|
//# sourceMappingURL=math.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../../src/functions/math.ts"],"names":[],"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,EACZ,OAAO,EAAE,KAAK,GACb,MAAM,CAER;AAED;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,gBAAgB,SAAI,GAAG,KAAK,CAG7D;AAED,wEAAwE;AACxE,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAUnC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,KAAK,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAuB5E;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEtC"}
|
|
@@ -113,6 +113,34 @@ function ____exports.sign(self, n)
|
|
|
113
113
|
end
|
|
114
114
|
return 0
|
|
115
115
|
end
|
|
116
|
+
--- Breaks a number into chunks of a given size. This is similar to the `String.split` method, but
|
|
117
|
+
-- for a number instead of a string.
|
|
118
|
+
--
|
|
119
|
+
-- For example, `splitNumber(90, 25)` would return an array with four elements:
|
|
120
|
+
--
|
|
121
|
+
-- - [1, 25]
|
|
122
|
+
-- - [26, 50]
|
|
123
|
+
-- - [51, 75]
|
|
124
|
+
-- - [76, 90]
|
|
125
|
+
--
|
|
126
|
+
-- @param num The number to split into chunks. This must be a positive integer.
|
|
127
|
+
-- @param size The size of each chunk. This must be a positive integer.
|
|
128
|
+
function ____exports.splitNumber(self, num, size)
|
|
129
|
+
if num <= 0 then
|
|
130
|
+
error("The number to split needs to be a positive number and is instead: " .. tostring(num))
|
|
131
|
+
end
|
|
132
|
+
if size <= 0 then
|
|
133
|
+
error("The size to split needs to be a positive number and is instead: " .. tostring(num))
|
|
134
|
+
end
|
|
135
|
+
local chunks = {}
|
|
136
|
+
local min = 1
|
|
137
|
+
while min <= num do
|
|
138
|
+
local max = math.min(min + size - 1, num)
|
|
139
|
+
chunks[#chunks + 1] = {min, max}
|
|
140
|
+
min = max + 1
|
|
141
|
+
end
|
|
142
|
+
return chunks
|
|
143
|
+
end
|
|
116
144
|
function ____exports.tanh(self, x)
|
|
117
145
|
return (math.exp(x) - math.exp(-x)) / (math.exp(x) + math.exp(-x))
|
|
118
146
|
end
|
|
@@ -17,7 +17,7 @@ export declare function isPill(pickup: EntityPickup): pickup is EntityPickupPill
|
|
|
17
17
|
export declare function isBattery(pickup: EntityPickup): pickup is EntityPickupBattery;
|
|
18
18
|
/** For `PickupVariant.COLLECTIBLE` (100). */
|
|
19
19
|
export declare function isCollectible(pickup: EntityPickup): pickup is EntityPickupCollectible;
|
|
20
|
-
/** For `PickupVariant.
|
|
20
|
+
/** For `PickupVariant.CARD` (300). */
|
|
21
21
|
export declare function isCardPickup(pickup: EntityPickup): pickup is EntityPickupCard;
|
|
22
22
|
/** For `PickupVariant.TRINKET` (350). */
|
|
23
23
|
export declare function isTrinket(pickup: EntityPickup): pickup is EntityPickupTrinket;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pickupVariants.d.ts","sourceRoot":"","sources":["../../../src/functions/pickupVariants.ts"],"names":[],"mappings":";AAIA,sCAAsC;AACtC,wBAAgB,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,IAAI,iBAAiB,CAIzE;AAED,qCAAqC;AACrC,wBAAgB,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,IAAI,gBAAgB,CAIvE;AAED,oCAAoC;AACpC,wBAAgB,KAAK,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,IAAI,eAAe,CAIrE;AAED,qCAAqC;AACrC,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,IAAI,gBAAgB,CAI7E;AAED,qCAAqC;AACrC,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,IAAI,gBAAgB,CAI7E;AAED,qCAAqC;AACrC,wBAAgB,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,MAA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AsC;AACtC,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,IAAI,gBAAgB,CAI7E;AAED,yCAAyC;AACzC,wBAAgB,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,IAAI,mBAAmB,CAK7E"}
|
|
@@ -38,9 +38,9 @@ end
|
|
|
38
38
|
function ____exports.isCollectible(self, pickup)
|
|
39
39
|
return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.COLLECTIBLE
|
|
40
40
|
end
|
|
41
|
-
--- For `PickupVariant.
|
|
41
|
+
--- For `PickupVariant.CARD` (300).
|
|
42
42
|
function ____exports.isCardPickup(self, pickup)
|
|
43
|
-
return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.
|
|
43
|
+
return pickup.Type == EntityType.PICKUP and pickup.Variant == PickupVariant.CARD
|
|
44
44
|
end
|
|
45
45
|
--- For `PickupVariant.TRINKET` (350).
|
|
46
46
|
function ____exports.isTrinket(self, pickup)
|
|
@@ -177,13 +177,11 @@ export declare function spawnBombPickup(bombSubType: BombSubType, positionOrGrid
|
|
|
177
177
|
* specific seed.
|
|
178
178
|
*/
|
|
179
179
|
export declare function spawnBombPickupWithSeed(bombSubType: BombSubType, positionOrGridIndex: Vector | int, seedOrRNG: Seed | RNG, velocity?: Vector, spawner?: Entity | undefined): EntityPickupBomb;
|
|
180
|
-
/**
|
|
181
|
-
* Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.TAROT_CARD` (300).
|
|
182
|
-
*/
|
|
180
|
+
/** Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.CARD` (300). */
|
|
183
181
|
export declare function spawnCard(cardType: CardType, positionOrGridIndex: Vector | int, velocity?: Vector, spawner?: Entity | undefined, seedOrRNG?: Seed | RNG | undefined): EntityPickupCard;
|
|
184
182
|
/**
|
|
185
|
-
* Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.
|
|
186
|
-
*
|
|
183
|
+
* Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.CARD` (300) and a
|
|
184
|
+
* specific seed.
|
|
187
185
|
*/
|
|
188
186
|
export declare function spawnCardWithSeed(cardType: CardType, positionOrGridIndex: Vector | int, seedOrRNG: Seed | RNG, velocity?: Vector, spawner?: Entity | undefined): EntityPickupCard;
|
|
189
187
|
/** Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.COIN` (20). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pickupsSpecific.d.ts","sourceRoot":"","sources":["../../../src/functions/pickupsSpecific.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,QAAQ,EACR,WAAW,EACX,eAAe,EACf,YAAY,EACZ,UAAU,EACV,SAAS,EACT,WAAW,EACX,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAKtC;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,cAAc,GAAE,cAAc,GAAG,CAAC,CAAM,GACvC,mBAAmB,EAAE,CAKvB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,WAAW,GAAE,WAAW,GAAG,CAAC,CAAM,GACjC,gBAAgB,EAAE,CAEpB;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,GAAE,QAAQ,GAAG,CAAC,CAAM,GAAG,gBAAgB,EAAE,CAEzE;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CACtB,WAAW,GAAE,WAAW,GAAG,CAAC,CAAM,GACjC,gBAAgB,EAAE,CAEpB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,eAAe,GAAE,eAAe,GAAG,CAAC,CAAM,GACzC,uBAAuB,EAAE,CAK3B;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,YAAY,GAAE,YAAY,GAAG,CAAC,CAAM,GACnC,iBAAiB,EAAE,CAErB;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,UAAU,G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AW,EAAE,WAAW,EACxB,mBAAmB,EAAE,MAAM,GAAG,GAAG,EACjC,SAAS,EAAE,IAAI,GAAG,GAAG,EACrB,QAAQ,GAAE,MAAmB,EAC7B,OAAO,GAAE,MAAM,GAAG,SAAqB,GACtC,gBAAgB,CAQlB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,WAAW,EAAE,WAAW,EACxB,mBAAmB,EAAE,MAAM,GAAG,GAAG,EACjC,QAAQ,GAAE,MAAmB,EAC7B,OAAO,GAAE,MAAM,GAAG,SAAqB,EACvC,SAAS,GAAE,IAAI,GAAG,GAAG,GAAG,SAAqB,GAC5C,mBAAmB,CASrB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,WAAW,EACxB,mBAAmB,EAAE,MAAM,GAAG,GAAG,EACjC,SAAS,EAAE,IAAI,GAAG,GAAG,EACrB,QAAQ,GAAE,MAAmB,EAC7B,OAAO,GAAE,MAAM,GAAG,SAAqB,GACtC,mBAAmB,CAQrB"}
|
|
@@ -36,7 +36,7 @@ function ____exports.getCards(self, cardType)
|
|
|
36
36
|
if cardType == nil then
|
|
37
37
|
cardType = -1
|
|
38
38
|
end
|
|
39
|
-
return getPickups(nil, PickupVariant.
|
|
39
|
+
return getPickups(nil, PickupVariant.CARD, cardType)
|
|
40
40
|
end
|
|
41
41
|
--- Helper function to get all of the coin pickup entities in the room.
|
|
42
42
|
--
|
|
@@ -143,7 +143,7 @@ function ____exports.removeAllCards(self, cardType, cap)
|
|
|
143
143
|
if cardType == nil then
|
|
144
144
|
cardType = -1
|
|
145
145
|
end
|
|
146
|
-
return removeAllPickups(nil, PickupVariant.
|
|
146
|
+
return removeAllPickups(nil, PickupVariant.CARD, cardType, cap)
|
|
147
147
|
end
|
|
148
148
|
--- Helper function to remove all of the coins in the room.
|
|
149
149
|
--
|
|
@@ -268,14 +268,14 @@ function ____exports.spawnBombPickupWithSeed(self, bombSubType, positionOrGridIn
|
|
|
268
268
|
seedOrRNG
|
|
269
269
|
)
|
|
270
270
|
end
|
|
271
|
-
--- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.
|
|
271
|
+
--- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.CARD` (300).
|
|
272
272
|
function ____exports.spawnCard(self, cardType, positionOrGridIndex, velocity, spawner, seedOrRNG)
|
|
273
273
|
if velocity == nil then
|
|
274
274
|
velocity = VectorZero
|
|
275
275
|
end
|
|
276
276
|
return spawnPickup(
|
|
277
277
|
nil,
|
|
278
|
-
PickupVariant.
|
|
278
|
+
PickupVariant.CARD,
|
|
279
279
|
cardType,
|
|
280
280
|
positionOrGridIndex,
|
|
281
281
|
velocity,
|
|
@@ -283,8 +283,8 @@ function ____exports.spawnCard(self, cardType, positionOrGridIndex, velocity, sp
|
|
|
283
283
|
seedOrRNG
|
|
284
284
|
)
|
|
285
285
|
end
|
|
286
|
-
--- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.
|
|
287
|
-
--
|
|
286
|
+
--- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.CARD` (300) and a
|
|
287
|
+
-- specific seed.
|
|
288
288
|
function ____exports.spawnCardWithSeed(self, cardType, positionOrGridIndex, seedOrRNG, velocity, spawner)
|
|
289
289
|
if velocity == nil then
|
|
290
290
|
velocity = VectorZero
|
|
@@ -115,7 +115,7 @@ export declare function isRepentance(): boolean;
|
|
|
115
115
|
* });
|
|
116
116
|
* ```
|
|
117
117
|
*/
|
|
118
|
-
export declare function repeat(
|
|
118
|
+
export declare function repeat(num: int, func: (i: int) => void): void;
|
|
119
119
|
/**
|
|
120
120
|
* Helper function to signify that the enclosing code block is not yet complete. Using this function
|
|
121
121
|
* is similar to writing a "TODO" comment, but it has the benefit of preventing ESLint errors due to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/functions/utils.ts"],"names":[],"mappings":";AAIA;;;;;GAKG;AACH,wB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;GAOG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAiBtC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAI7D;AAED;;;;;;;;;;;;;;GAcG;AAEH,wBAAgB,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAG"}
|
|
@@ -175,10 +175,10 @@ end
|
|
|
175
175
|
-- print(i); // Prints "0", "1", "2"
|
|
176
176
|
-- });
|
|
177
177
|
-- ```
|
|
178
|
-
____exports["repeat"] = function(self,
|
|
178
|
+
____exports["repeat"] = function(self, num, func)
|
|
179
179
|
do
|
|
180
180
|
local i = 0
|
|
181
|
-
while i <
|
|
181
|
+
while i < num do
|
|
182
182
|
func(nil, i)
|
|
183
183
|
i = i + 1
|
|
184
184
|
end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "67.1.0",
|
|
4
4
|
"description": "Helper functions and features for IsaacScript mods.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -25,6 +25,6 @@
|
|
|
25
25
|
"main": "dist/src/index",
|
|
26
26
|
"types": "dist/index.rollup.d.ts",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"isaac-typescript-definitions": "^
|
|
28
|
+
"isaac-typescript-definitions": "^33.0.0"
|
|
29
29
|
}
|
|
30
30
|
}
|
package/src/functions/bitwise.ts
CHANGED
|
@@ -55,11 +55,11 @@ export function convertDecimalToBinary(num: number, minLength?: int): int[] {
|
|
|
55
55
|
* Helper function to count the number of bits that are set to 1 in a binary representation of a
|
|
56
56
|
* number.
|
|
57
57
|
*/
|
|
58
|
-
export function countSetBits(
|
|
58
|
+
export function countSetBits(num: int): int {
|
|
59
59
|
let count = 0;
|
|
60
60
|
|
|
61
|
-
while (
|
|
62
|
-
|
|
61
|
+
while (num > 0) {
|
|
62
|
+
num &= num - 1;
|
|
63
63
|
count++;
|
|
64
64
|
}
|
|
65
65
|
|
package/src/functions/math.ts
CHANGED
|
@@ -143,6 +143,45 @@ export function sign(n: number): int {
|
|
|
143
143
|
return 0;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
/**
|
|
147
|
+
* Breaks a number into chunks of a given size. This is similar to the `String.split` method, but
|
|
148
|
+
* for a number instead of a string.
|
|
149
|
+
*
|
|
150
|
+
* For example, `splitNumber(90, 25)` would return an array with four elements:
|
|
151
|
+
*
|
|
152
|
+
* - [1, 25]
|
|
153
|
+
* - [26, 50]
|
|
154
|
+
* - [51, 75]
|
|
155
|
+
* - [76, 90]
|
|
156
|
+
*
|
|
157
|
+
* @param num The number to split into chunks. This must be a positive integer.
|
|
158
|
+
* @param size The size of each chunk. This must be a positive integer.
|
|
159
|
+
*/
|
|
160
|
+
export function splitNumber(num: int, size: int): Array<[min: int, max: int]> {
|
|
161
|
+
if (num <= 0) {
|
|
162
|
+
error(
|
|
163
|
+
`The number to split needs to be a positive number and is instead: ${num}`,
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (size <= 0) {
|
|
168
|
+
error(
|
|
169
|
+
`The size to split needs to be a positive number and is instead: ${num}`,
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const chunks: Array<[number, number]> = [];
|
|
174
|
+
let min = 1;
|
|
175
|
+
|
|
176
|
+
while (min <= num) {
|
|
177
|
+
const max = Math.min(min + size - 1, num);
|
|
178
|
+
chunks.push([min, max]);
|
|
179
|
+
min = max + 1;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return chunks;
|
|
183
|
+
}
|
|
184
|
+
|
|
146
185
|
export function tanh(x: number): number {
|
|
147
186
|
return (Math.exp(x) - Math.exp(-x)) / (Math.exp(x) + Math.exp(-x));
|
|
148
187
|
}
|
|
@@ -69,11 +69,10 @@ export function isCollectible(
|
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
/** For `PickupVariant.
|
|
72
|
+
/** For `PickupVariant.CARD` (300). */
|
|
73
73
|
export function isCardPickup(pickup: EntityPickup): pickup is EntityPickupCard {
|
|
74
74
|
return (
|
|
75
|
-
pickup.Type === EntityType.PICKUP &&
|
|
76
|
-
pickup.Variant === PickupVariant.TAROT_CARD
|
|
75
|
+
pickup.Type === EntityType.PICKUP && pickup.Variant === PickupVariant.CARD
|
|
77
76
|
);
|
|
78
77
|
}
|
|
79
78
|
|
|
@@ -49,7 +49,7 @@ export function getBombPickups(
|
|
|
49
49
|
* is -1, which matches every sub-type.
|
|
50
50
|
*/
|
|
51
51
|
export function getCards(cardType: CardType | -1 = -1): EntityPickupCard[] {
|
|
52
|
-
return getPickups(PickupVariant.
|
|
52
|
+
return getPickups(PickupVariant.CARD, cardType) as EntityPickupCard[];
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
/**
|
|
@@ -190,7 +190,7 @@ export function removeAllCards(
|
|
|
190
190
|
cap?: int,
|
|
191
191
|
): EntityPickupCard[] {
|
|
192
192
|
return removeAllPickups(
|
|
193
|
-
PickupVariant.
|
|
193
|
+
PickupVariant.CARD,
|
|
194
194
|
cardType,
|
|
195
195
|
cap,
|
|
196
196
|
) as EntityPickupCard[];
|
|
@@ -407,9 +407,7 @@ export function spawnBombPickupWithSeed(
|
|
|
407
407
|
);
|
|
408
408
|
}
|
|
409
409
|
|
|
410
|
-
/**
|
|
411
|
-
* Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.TAROT_CARD` (300).
|
|
412
|
-
*/
|
|
410
|
+
/** Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.CARD` (300). */
|
|
413
411
|
export function spawnCard(
|
|
414
412
|
cardType: CardType,
|
|
415
413
|
positionOrGridIndex: Vector | int,
|
|
@@ -418,7 +416,7 @@ export function spawnCard(
|
|
|
418
416
|
seedOrRNG: Seed | RNG | undefined = undefined,
|
|
419
417
|
): EntityPickupCard {
|
|
420
418
|
return spawnPickup(
|
|
421
|
-
PickupVariant.
|
|
419
|
+
PickupVariant.CARD,
|
|
422
420
|
cardType,
|
|
423
421
|
positionOrGridIndex,
|
|
424
422
|
velocity,
|
|
@@ -428,8 +426,8 @@ export function spawnCard(
|
|
|
428
426
|
}
|
|
429
427
|
|
|
430
428
|
/**
|
|
431
|
-
* Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.
|
|
432
|
-
*
|
|
429
|
+
* Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.CARD` (300) and a
|
|
430
|
+
* specific seed.
|
|
433
431
|
*/
|
|
434
432
|
export function spawnCardWithSeed(
|
|
435
433
|
cardType: CardType,
|
package/src/functions/utils.ts
CHANGED
|
@@ -206,8 +206,8 @@ export function isRepentance(): boolean {
|
|
|
206
206
|
* });
|
|
207
207
|
* ```
|
|
208
208
|
*/
|
|
209
|
-
export function repeat(
|
|
210
|
-
for (let i = 0; i <
|
|
209
|
+
export function repeat(num: int, func: (i: int) => void): void {
|
|
210
|
+
for (let i = 0; i < num; i++) {
|
|
211
211
|
func(i);
|
|
212
212
|
}
|
|
213
213
|
}
|