isaacscript-common 31.0.0 → 31.0.1
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 31.0.
|
|
3
|
+
isaacscript-common 31.0.1
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -9043,7 +9043,7 @@ ____exports.TrinketType[____exports.TrinketType.SIGIL_OF_BAPHOMET] = "SIGIL_OF_B
|
|
|
9043
9043
|
____exports.BedSubType = {}
|
|
9044
9044
|
____exports.BedSubType.ISAAC = 0
|
|
9045
9045
|
____exports.BedSubType[____exports.BedSubType.ISAAC] = "ISAAC"
|
|
9046
|
-
____exports.BedSubType.MOM =
|
|
9046
|
+
____exports.BedSubType.MOM = 10
|
|
9047
9047
|
____exports.BedSubType[____exports.BedSubType.MOM] = "MOM"
|
|
9048
9048
|
--- For `EntityType.LASER` (7).
|
|
9049
9049
|
____exports.LaserSubType = {}
|
|
@@ -50711,7 +50711,7 @@ function removeItemsAndTrinketsThatAffectItemPools(self)
|
|
|
50711
50711
|
end
|
|
50712
50712
|
mapSetPlayer(nil, removedTrinketsMap, player, removedTrinkets)
|
|
50713
50713
|
end
|
|
50714
|
-
return {removedItemsMap, removedTrinketsMap}
|
|
50714
|
+
return {removedItemsMap = removedItemsMap, removedTrinketsMap = removedTrinketsMap}
|
|
50715
50715
|
end
|
|
50716
50716
|
function restoreItemsAndTrinketsThatAffectItemPools(self, removedItemsMap, removedTrinketsMap)
|
|
50717
50717
|
for ____, player in ipairs(getAllPlayers(nil)) do
|
|
@@ -50762,7 +50762,9 @@ function ItemPoolDetection.prototype.isCollectibleInItemPool(self, collectibleTy
|
|
|
50762
50762
|
player:ChangePlayerType(PlayerType.ISAAC)
|
|
50763
50763
|
end
|
|
50764
50764
|
end
|
|
50765
|
-
local
|
|
50765
|
+
local ____removeItemsAndTrinketsThatAffectItemPools_result_0 = removeItemsAndTrinketsThatAffectItemPools(nil)
|
|
50766
|
+
local removedItemsMap = ____removeItemsAndTrinketsThatAffectItemPools_result_0.removedItemsMap
|
|
50767
|
+
local removedTrinketsMap = ____removeItemsAndTrinketsThatAffectItemPools_result_0.removedTrinketsMap
|
|
50766
50768
|
local itemPool = game:GetItemPool()
|
|
50767
50769
|
itemPool:ResetRoomBlacklist()
|
|
50768
50770
|
for ____, collectibleTypeInSet in ipairs(self.moddedElementSets:getCollectibleArray()) do
|
|
@@ -53190,34 +53192,37 @@ function hexToRGB(self, hexString)
|
|
|
53190
53192
|
hexString = __TS__StringReplace(hexString, "#", "")
|
|
53191
53193
|
if #hexString ~= HEX_STRING_LENGTH then
|
|
53192
53194
|
logError("Hex strings must be of length: " .. tostring(HEX_STRING_LENGTH))
|
|
53193
|
-
return {0, 0, 0}
|
|
53195
|
+
return {r = 0, g = 0, b = 0}
|
|
53194
53196
|
end
|
|
53195
53197
|
local rString = string.sub(hexString, 1, 2)
|
|
53196
53198
|
local r = tonumber("0x" .. rString)
|
|
53197
53199
|
if r == nil then
|
|
53198
53200
|
logError(("Failed to convert `0x" .. rString) .. "` to a number.")
|
|
53199
|
-
return {0, 0, 0}
|
|
53201
|
+
return {r = 0, g = 0, b = 0}
|
|
53200
53202
|
end
|
|
53201
53203
|
local gString = string.sub(hexString, 3, 4)
|
|
53202
53204
|
local g = tonumber("0x" .. gString)
|
|
53203
53205
|
if g == nil then
|
|
53204
53206
|
logError(("Failed to convert `0x" .. gString) .. "` to a number.")
|
|
53205
|
-
return {0, 0, 0}
|
|
53207
|
+
return {r = 0, g = 0, b = 0}
|
|
53206
53208
|
end
|
|
53207
53209
|
local bString = string.sub(hexString, 5, 6)
|
|
53208
53210
|
local b = tonumber("0x" .. bString)
|
|
53209
53211
|
if b == nil then
|
|
53210
53212
|
logError(("Failed to convert `0x" .. bString) .. "` to a number.")
|
|
53211
|
-
return {0, 0, 0}
|
|
53213
|
+
return {r = 0, g = 0, b = 0}
|
|
53212
53214
|
end
|
|
53213
|
-
return {r, g, b}
|
|
53215
|
+
return {r = r, g = g, b = b}
|
|
53214
53216
|
end
|
|
53215
53217
|
HEX_STRING_LENGTH = 6
|
|
53216
53218
|
function ____exports.hexToColor(self, hexString, alpha)
|
|
53217
53219
|
if alpha == nil then
|
|
53218
53220
|
alpha = 1
|
|
53219
53221
|
end
|
|
53220
|
-
local
|
|
53222
|
+
local ____hexToRGB_result_0 = hexToRGB(nil, hexString)
|
|
53223
|
+
local r = ____hexToRGB_result_0.r
|
|
53224
|
+
local g = ____hexToRGB_result_0.g
|
|
53225
|
+
local b = ____hexToRGB_result_0.b
|
|
53221
53226
|
local base = 255
|
|
53222
53227
|
return Color(r / base, g / base, b / base, alpha)
|
|
53223
53228
|
end
|
|
@@ -53225,7 +53230,10 @@ function ____exports.hexToKColor(self, hexString, alpha)
|
|
|
53225
53230
|
if alpha == nil then
|
|
53226
53231
|
alpha = 1
|
|
53227
53232
|
end
|
|
53228
|
-
local
|
|
53233
|
+
local ____hexToRGB_result_1 = hexToRGB(nil, hexString)
|
|
53234
|
+
local r = ____hexToRGB_result_1.r
|
|
53235
|
+
local g = ____hexToRGB_result_1.g
|
|
53236
|
+
local b = ____hexToRGB_result_1.b
|
|
53229
53237
|
local base = 255
|
|
53230
53238
|
return KColor(r / base, g / base, b / base, alpha)
|
|
53231
53239
|
end
|
|
@@ -65,7 +65,7 @@ function removeItemsAndTrinketsThatAffectItemPools(self)
|
|
|
65
65
|
end
|
|
66
66
|
mapSetPlayer(nil, removedTrinketsMap, player, removedTrinkets)
|
|
67
67
|
end
|
|
68
|
-
return {removedItemsMap, removedTrinketsMap}
|
|
68
|
+
return {removedItemsMap = removedItemsMap, removedTrinketsMap = removedTrinketsMap}
|
|
69
69
|
end
|
|
70
70
|
function restoreItemsAndTrinketsThatAffectItemPools(self, removedItemsMap, removedTrinketsMap)
|
|
71
71
|
for ____, player in ipairs(getAllPlayers(nil)) do
|
|
@@ -116,7 +116,9 @@ function ItemPoolDetection.prototype.isCollectibleInItemPool(self, collectibleTy
|
|
|
116
116
|
player:ChangePlayerType(PlayerType.ISAAC)
|
|
117
117
|
end
|
|
118
118
|
end
|
|
119
|
-
local
|
|
119
|
+
local ____removeItemsAndTrinketsThatAffectItemPools_result_0 = removeItemsAndTrinketsThatAffectItemPools(nil)
|
|
120
|
+
local removedItemsMap = ____removeItemsAndTrinketsThatAffectItemPools_result_0.removedItemsMap
|
|
121
|
+
local removedTrinketsMap = ____removeItemsAndTrinketsThatAffectItemPools_result_0.removedTrinketsMap
|
|
120
122
|
local itemPool = game:GetItemPool()
|
|
121
123
|
itemPool:ResetRoomBlacklist()
|
|
122
124
|
for ____, collectibleTypeInSet in ipairs(self.moddedElementSets:getCollectibleArray()) do
|
|
@@ -8,27 +8,27 @@ function hexToRGB(self, hexString)
|
|
|
8
8
|
hexString = __TS__StringReplace(hexString, "#", "")
|
|
9
9
|
if #hexString ~= HEX_STRING_LENGTH then
|
|
10
10
|
logError("Hex strings must be of length: " .. tostring(HEX_STRING_LENGTH))
|
|
11
|
-
return {0, 0, 0}
|
|
11
|
+
return {r = 0, g = 0, b = 0}
|
|
12
12
|
end
|
|
13
13
|
local rString = string.sub(hexString, 1, 2)
|
|
14
14
|
local r = tonumber("0x" .. rString)
|
|
15
15
|
if r == nil then
|
|
16
16
|
logError(("Failed to convert `0x" .. rString) .. "` to a number.")
|
|
17
|
-
return {0, 0, 0}
|
|
17
|
+
return {r = 0, g = 0, b = 0}
|
|
18
18
|
end
|
|
19
19
|
local gString = string.sub(hexString, 3, 4)
|
|
20
20
|
local g = tonumber("0x" .. gString)
|
|
21
21
|
if g == nil then
|
|
22
22
|
logError(("Failed to convert `0x" .. gString) .. "` to a number.")
|
|
23
|
-
return {0, 0, 0}
|
|
23
|
+
return {r = 0, g = 0, b = 0}
|
|
24
24
|
end
|
|
25
25
|
local bString = string.sub(hexString, 5, 6)
|
|
26
26
|
local b = tonumber("0x" .. bString)
|
|
27
27
|
if b == nil then
|
|
28
28
|
logError(("Failed to convert `0x" .. bString) .. "` to a number.")
|
|
29
|
-
return {0, 0, 0}
|
|
29
|
+
return {r = 0, g = 0, b = 0}
|
|
30
30
|
end
|
|
31
|
-
return {r, g, b}
|
|
31
|
+
return {r = r, g = g, b = b}
|
|
32
32
|
end
|
|
33
33
|
HEX_STRING_LENGTH = 6
|
|
34
34
|
--- Converts a hex string like "#33aa33" to a KColor object.
|
|
@@ -39,7 +39,10 @@ function ____exports.hexToColor(self, hexString, alpha)
|
|
|
39
39
|
if alpha == nil then
|
|
40
40
|
alpha = 1
|
|
41
41
|
end
|
|
42
|
-
local
|
|
42
|
+
local ____hexToRGB_result_0 = hexToRGB(nil, hexString)
|
|
43
|
+
local r = ____hexToRGB_result_0.r
|
|
44
|
+
local g = ____hexToRGB_result_0.g
|
|
45
|
+
local b = ____hexToRGB_result_0.b
|
|
43
46
|
local base = 255
|
|
44
47
|
return Color(r / base, g / base, b / base, alpha)
|
|
45
48
|
end
|
|
@@ -51,7 +54,10 @@ function ____exports.hexToKColor(self, hexString, alpha)
|
|
|
51
54
|
if alpha == nil then
|
|
52
55
|
alpha = 1
|
|
53
56
|
end
|
|
54
|
-
local
|
|
57
|
+
local ____hexToRGB_result_1 = hexToRGB(nil, hexString)
|
|
58
|
+
local r = ____hexToRGB_result_1.r
|
|
59
|
+
local g = ____hexToRGB_result_1.g
|
|
60
|
+
local b = ____hexToRGB_result_1.b
|
|
55
61
|
local base = 255
|
|
56
62
|
return KColor(r / base, g / base, b / base, alpha)
|
|
57
63
|
end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "31.0.
|
|
3
|
+
"version": "31.0.1",
|
|
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": "^13.0.
|
|
28
|
+
"isaac-typescript-definitions": "^13.0.24"
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -99,7 +99,7 @@ export class ItemPoolDetection extends Feature {
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
const
|
|
102
|
+
const { removedItemsMap, removedTrinketsMap } =
|
|
103
103
|
removeItemsAndTrinketsThatAffectItemPools();
|
|
104
104
|
|
|
105
105
|
// Blacklist every collectible in the game except for the provided collectible.
|
|
@@ -173,10 +173,10 @@ export class ItemPoolDetection extends Feature {
|
|
|
173
173
|
* Before checking the item pools, remove any collectibles or trinkets that would affect the
|
|
174
174
|
* retrieved collectible types.
|
|
175
175
|
*/
|
|
176
|
-
function removeItemsAndTrinketsThatAffectItemPools():
|
|
177
|
-
removedItemsMap: Map<PlayerIndex, CollectibleType[]
|
|
178
|
-
removedTrinketsMap: Map<PlayerIndex, TrinketType[]
|
|
179
|
-
|
|
176
|
+
function removeItemsAndTrinketsThatAffectItemPools(): {
|
|
177
|
+
removedItemsMap: Map<PlayerIndex, CollectibleType[]>;
|
|
178
|
+
removedTrinketsMap: Map<PlayerIndex, TrinketType[]>;
|
|
179
|
+
} {
|
|
180
180
|
const removedItemsMap = new Map<PlayerIndex, CollectibleType[]>();
|
|
181
181
|
const removedTrinketsMap = new Map<PlayerIndex, TrinketType[]>();
|
|
182
182
|
for (const player of getAllPlayers()) {
|
|
@@ -207,7 +207,7 @@ function removeItemsAndTrinketsThatAffectItemPools(): [
|
|
|
207
207
|
mapSetPlayer(removedTrinketsMap, player, removedTrinkets);
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
return
|
|
210
|
+
return { removedItemsMap, removedTrinketsMap };
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
function restoreItemsAndTrinketsThatAffectItemPools(
|
package/src/functions/hex.ts
CHANGED
|
@@ -9,7 +9,7 @@ const HEX_STRING_LENGTH = 6;
|
|
|
9
9
|
* @param alpha Optional. Range is from 0 to 1. Default is 1. (The same as the `Color` constructor.)
|
|
10
10
|
*/
|
|
11
11
|
export function hexToColor(hexString: string, alpha = 1): Readonly<Color> {
|
|
12
|
-
const
|
|
12
|
+
const { r, g, b } = hexToRGB(hexString);
|
|
13
13
|
|
|
14
14
|
// Color values should be between 0 and 1.
|
|
15
15
|
const base = 255;
|
|
@@ -23,40 +23,40 @@ export function hexToColor(hexString: string, alpha = 1): Readonly<Color> {
|
|
|
23
23
|
* @param alpha Range is from 0 to 1. Default is 1.
|
|
24
24
|
*/
|
|
25
25
|
export function hexToKColor(hexString: string, alpha = 1): Readonly<KColor> {
|
|
26
|
-
const
|
|
26
|
+
const { r, g, b } = hexToRGB(hexString);
|
|
27
27
|
|
|
28
28
|
// KColor values should be between 0 and 1.
|
|
29
29
|
const base = 255;
|
|
30
30
|
return KColor(r / base, g / base, b / base, alpha);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
function hexToRGB(hexString: string):
|
|
33
|
+
function hexToRGB(hexString: string): { r: float; g: float; b: float } {
|
|
34
34
|
hexString = hexString.replace("#", "");
|
|
35
35
|
if (hexString.length !== HEX_STRING_LENGTH) {
|
|
36
36
|
logError(`Hex strings must be of length: ${HEX_STRING_LENGTH}`);
|
|
37
|
-
return
|
|
37
|
+
return { r: 0, g: 0, b: 0 };
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
const rString = hexString.slice(0, 2);
|
|
41
41
|
const r = tonumber(`0x${rString}`);
|
|
42
42
|
if (r === undefined) {
|
|
43
43
|
logError(`Failed to convert \`0x${rString}\` to a number.`);
|
|
44
|
-
return
|
|
44
|
+
return { r: 0, g: 0, b: 0 };
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
const gString = hexString.slice(2, 4);
|
|
48
48
|
const g = tonumber(`0x${gString}`);
|
|
49
49
|
if (g === undefined) {
|
|
50
50
|
logError(`Failed to convert \`0x${gString}\` to a number.`);
|
|
51
|
-
return
|
|
51
|
+
return { r: 0, g: 0, b: 0 };
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
const bString = hexString.slice(4, 6);
|
|
55
55
|
const b = tonumber(`0x${bString}`);
|
|
56
56
|
if (b === undefined) {
|
|
57
57
|
logError(`Failed to convert \`0x${bString}\` to a number.`);
|
|
58
|
-
return
|
|
58
|
+
return { r: 0, g: 0, b: 0 };
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
return
|
|
61
|
+
return { r, g, b };
|
|
62
62
|
}
|