isaacscript-common 67.1.0 → 67.2.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
CHANGED
|
@@ -17960,8 +17960,10 @@ export declare function spawnWithSeed(entityType: EntityType, variant: int, subT
|
|
|
17960
17960
|
*
|
|
17961
17961
|
* @param num The number to split into chunks. This must be a positive integer.
|
|
17962
17962
|
* @param size The size of each chunk. This must be a positive integer.
|
|
17963
|
+
* @param startAtZero Whether to start at 0. Defaults to false. If true, the chunks will start at 0
|
|
17964
|
+
* instead of 1.
|
|
17963
17965
|
*/
|
|
17964
|
-
export declare function splitNumber(num: int, size: int): Array<[min: int, max: int]>;
|
|
17966
|
+
export declare function splitNumber(num: int, size: int, startAtZero?: boolean): Array<[min: int, max: int]>;
|
|
17965
17967
|
|
|
17966
17968
|
/**
|
|
17967
17969
|
* Helper function to check if two sprite layers have the same sprite sheet by using the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 67.
|
|
3
|
+
isaacscript-common 67.2.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -7147,6 +7147,22 @@ ____exports.BatterySubType[____exports.BatterySubType.GOLDEN] = "GOLDEN"
|
|
|
7147
7147
|
--- For `EntityType.PICKUP` (5), `PickupVariant.COLLECTIBLE` (100).
|
|
7148
7148
|
--
|
|
7149
7149
|
-- This is the sub-type of a collectible.
|
|
7150
|
+
--
|
|
7151
|
+
-- This enum is not contiguous. In other words, the enum ranges from `CollectibleType.NULL` (0) to
|
|
7152
|
+
-- `CollectibleType.MOMS_RING` (732), but there is no corresponding `CollectibleType` with the
|
|
7153
|
+
-- following values:
|
|
7154
|
+
--
|
|
7155
|
+
-- 1. 43 (Pills here)
|
|
7156
|
+
-- 2. 61 (Tarot Card)
|
|
7157
|
+
-- 3. 235
|
|
7158
|
+
-- 4. 587 (Menorah)
|
|
7159
|
+
-- 5. 613 (Salt Shaker)
|
|
7160
|
+
-- 6. 620 (Voodoo Pin)
|
|
7161
|
+
-- 7. 630 (Lucky Seven)
|
|
7162
|
+
-- 8. 648 (Pill Crusher)
|
|
7163
|
+
-- 9. 662
|
|
7164
|
+
-- 10. 666
|
|
7165
|
+
-- 11. 718
|
|
7150
7166
|
____exports.CollectibleType = {}
|
|
7151
7167
|
____exports.CollectibleType.NULL = 0
|
|
7152
7168
|
____exports.CollectibleType[____exports.CollectibleType.NULL] = "NULL"
|
|
@@ -8598,6 +8614,8 @@ ____exports.CollectibleType[____exports.CollectibleType.MOMS_RING] = "MOMS_RING"
|
|
|
8598
8614
|
--
|
|
8599
8615
|
-- This enum was renamed from "Card" to be consistent with the `CollectibleType` and `TrinketType`
|
|
8600
8616
|
-- enums.
|
|
8617
|
+
--
|
|
8618
|
+
-- This enum is contiguous. (Every value is satisfied between 0 and 97, inclusive.)
|
|
8601
8619
|
____exports.CardType = {}
|
|
8602
8620
|
____exports.CardType.NULL = 0
|
|
8603
8621
|
____exports.CardType[____exports.CardType.NULL] = "NULL"
|
|
@@ -8798,6 +8816,10 @@ ____exports.CardType[____exports.CardType.SOUL_OF_JACOB_AND_ESAU] = "SOUL_OF_JAC
|
|
|
8798
8816
|
--- For `EntityType.PICKUP` (5), `PickupVariant.TRINKET` (350).
|
|
8799
8817
|
--
|
|
8800
8818
|
-- This is the sub-type of a trinket.
|
|
8819
|
+
--
|
|
8820
|
+
-- This enum is not contiguous. In other words, the enum ranges from `TrinketType.NULL` (0) to
|
|
8821
|
+
-- `TrinketType.SIGIL_OF_BAPHOMET` (189), but there is no corresponding `TrinketType` with a value
|
|
8822
|
+
-- of 47.
|
|
8801
8823
|
____exports.TrinketType = {}
|
|
8802
8824
|
____exports.TrinketType.NULL = 0
|
|
8803
8825
|
____exports.TrinketType[____exports.TrinketType.NULL] = "NULL"
|
|
@@ -9615,6 +9637,8 @@ ____exports.TreasureRoomSubType[____exports.TreasureRoomSubType.KNIFE_PIECE] = "
|
|
|
9615
9637
|
-- The enum is named `BossID` instead of `BossRoomSubType` in order to match the `Entity.GetBossID`,
|
|
9616
9638
|
-- `Room.GetBossID` and `Room.GetSecondBossID` methods.
|
|
9617
9639
|
--
|
|
9640
|
+
-- This enum is contiguous. (Every value is satisfied between 1 and 102, inclusive.)
|
|
9641
|
+
--
|
|
9618
9642
|
-- Also see the `MinibossID` enum.
|
|
9619
9643
|
____exports.BossID = {}
|
|
9620
9644
|
____exports.BossID.MONSTRO = 1
|
|
@@ -12529,6 +12553,7 @@ return ____exports
|
|
|
12529
12553
|
end,
|
|
12530
12554
|
["lua_modules.isaac-typescript-definitions.dist.src.enums.PillEffect"] = function(...)
|
|
12531
12555
|
local ____exports = {}
|
|
12556
|
+
--- This enum is contiguous. (Every value is satisfied between 0 and 49, inclusive.)
|
|
12532
12557
|
____exports.PillEffect = {}
|
|
12533
12558
|
____exports.PillEffect.BAD_GAS = 0
|
|
12534
12559
|
____exports.PillEffect[____exports.PillEffect.BAD_GAS] = "BAD_GAS"
|
|
@@ -15286,6 +15311,7 @@ return ____exports
|
|
|
15286
15311
|
end,
|
|
15287
15312
|
["lua_modules.isaac-typescript-definitions.dist.src.enums.Challenge"] = function(...)
|
|
15288
15313
|
local ____exports = {}
|
|
15314
|
+
--- This enum is contiguous. (Every value is satisfied between 0 and 45, inclusive.)
|
|
15289
15315
|
____exports.Challenge = {}
|
|
15290
15316
|
____exports.Challenge.NULL = 0
|
|
15291
15317
|
____exports.Challenge[____exports.Challenge.NULL] = "NULL"
|
|
@@ -20285,7 +20311,10 @@ function ____exports.sign(self, n)
|
|
|
20285
20311
|
end
|
|
20286
20312
|
return 0
|
|
20287
20313
|
end
|
|
20288
|
-
function ____exports.splitNumber(self, num, size)
|
|
20314
|
+
function ____exports.splitNumber(self, num, size, startAtZero)
|
|
20315
|
+
if startAtZero == nil then
|
|
20316
|
+
startAtZero = false
|
|
20317
|
+
end
|
|
20289
20318
|
if num <= 0 then
|
|
20290
20319
|
error("The number to split needs to be a positive number and is instead: " .. tostring(num))
|
|
20291
20320
|
end
|
|
@@ -20293,11 +20322,11 @@ function ____exports.splitNumber(self, num, size)
|
|
|
20293
20322
|
error("The size to split needs to be a positive number and is instead: " .. tostring(num))
|
|
20294
20323
|
end
|
|
20295
20324
|
local chunks = {}
|
|
20296
|
-
local
|
|
20297
|
-
while
|
|
20298
|
-
local
|
|
20299
|
-
chunks[#chunks + 1] = {
|
|
20300
|
-
|
|
20325
|
+
local start = startAtZero and 0 or 1
|
|
20326
|
+
while start <= num do
|
|
20327
|
+
local ____end = math.min(start + size - 1, num)
|
|
20328
|
+
chunks[#chunks + 1] = {start, ____end}
|
|
20329
|
+
start = start + size
|
|
20301
20330
|
end
|
|
20302
20331
|
return chunks
|
|
20303
20332
|
end
|
|
@@ -59,7 +59,9 @@ export declare function sign(n: number): int;
|
|
|
59
59
|
*
|
|
60
60
|
* @param num The number to split into chunks. This must be a positive integer.
|
|
61
61
|
* @param size The size of each chunk. This must be a positive integer.
|
|
62
|
+
* @param startAtZero Whether to start at 0. Defaults to false. If true, the chunks will start at 0
|
|
63
|
+
* instead of 1.
|
|
62
64
|
*/
|
|
63
|
-
export declare function splitNumber(num: int, size: int): Array<[min: int, max: int]>;
|
|
65
|
+
export declare function splitNumber(num: int, size: int, startAtZero?: boolean): Array<[min: int, max: int]>;
|
|
64
66
|
export declare function tanh(x: number): number;
|
|
65
67
|
//# sourceMappingURL=math.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../../src/functions/math.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAGzD;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,CAEvD;AAED,wBAAg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gB,WAAW,CACzB,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,GAAG,EACT,WAAW,UAAQ,GAClB,KAAK,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAuB7B;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEtC"}
|
|
@@ -125,7 +125,12 @@ end
|
|
|
125
125
|
--
|
|
126
126
|
-- @param num The number to split into chunks. This must be a positive integer.
|
|
127
127
|
-- @param size The size of each chunk. This must be a positive integer.
|
|
128
|
-
|
|
128
|
+
-- @param startAtZero Whether to start at 0. Defaults to false. If true, the chunks will start at 0
|
|
129
|
+
-- instead of 1.
|
|
130
|
+
function ____exports.splitNumber(self, num, size, startAtZero)
|
|
131
|
+
if startAtZero == nil then
|
|
132
|
+
startAtZero = false
|
|
133
|
+
end
|
|
129
134
|
if num <= 0 then
|
|
130
135
|
error("The number to split needs to be a positive number and is instead: " .. tostring(num))
|
|
131
136
|
end
|
|
@@ -133,11 +138,11 @@ function ____exports.splitNumber(self, num, size)
|
|
|
133
138
|
error("The size to split needs to be a positive number and is instead: " .. tostring(num))
|
|
134
139
|
end
|
|
135
140
|
local chunks = {}
|
|
136
|
-
local
|
|
137
|
-
while
|
|
138
|
-
local
|
|
139
|
-
chunks[#chunks + 1] = {
|
|
140
|
-
|
|
141
|
+
local start = startAtZero and 0 or 1
|
|
142
|
+
while start <= num do
|
|
143
|
+
local ____end = math.min(start + size - 1, num)
|
|
144
|
+
chunks[#chunks + 1] = {start, ____end}
|
|
145
|
+
start = start + size
|
|
141
146
|
end
|
|
142
147
|
return chunks
|
|
143
148
|
end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "67.
|
|
3
|
+
"version": "67.2.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": "^33.0.
|
|
28
|
+
"isaac-typescript-definitions": "^33.0.1"
|
|
29
29
|
}
|
|
30
30
|
}
|
package/src/functions/math.ts
CHANGED
|
@@ -156,8 +156,14 @@ export function sign(n: number): int {
|
|
|
156
156
|
*
|
|
157
157
|
* @param num The number to split into chunks. This must be a positive integer.
|
|
158
158
|
* @param size The size of each chunk. This must be a positive integer.
|
|
159
|
+
* @param startAtZero Whether to start at 0. Defaults to false. If true, the chunks will start at 0
|
|
160
|
+
* instead of 1.
|
|
159
161
|
*/
|
|
160
|
-
export function splitNumber(
|
|
162
|
+
export function splitNumber(
|
|
163
|
+
num: int,
|
|
164
|
+
size: int,
|
|
165
|
+
startAtZero = false,
|
|
166
|
+
): Array<[min: int, max: int]> {
|
|
161
167
|
if (num <= 0) {
|
|
162
168
|
error(
|
|
163
169
|
`The number to split needs to be a positive number and is instead: ${num}`,
|
|
@@ -171,12 +177,12 @@ export function splitNumber(num: int, size: int): Array<[min: int, max: int]> {
|
|
|
171
177
|
}
|
|
172
178
|
|
|
173
179
|
const chunks: Array<[number, number]> = [];
|
|
174
|
-
let
|
|
180
|
+
let start = startAtZero ? 0 : 1;
|
|
175
181
|
|
|
176
|
-
while (
|
|
177
|
-
const
|
|
178
|
-
chunks.push([
|
|
179
|
-
|
|
182
|
+
while (start <= num) {
|
|
183
|
+
const end = Math.min(start + size - 1, num);
|
|
184
|
+
chunks.push([start, end]);
|
|
185
|
+
start += size;
|
|
180
186
|
}
|
|
181
187
|
|
|
182
188
|
return chunks;
|