isaacscript-common 1.0.549 → 1.0.550
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,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
/** Returns the number of items that a player has towards a particular transformation. */
|
|
3
3
|
export declare function getPlayerNumTransformationCollectibles(player: EntityPlayer, playerForm: PlayerForm): int;
|
|
4
|
-
export declare function getTransformationsForItem(collectibleType: CollectibleType | int):
|
|
4
|
+
export declare function getTransformationsForItem(collectibleType: CollectibleType | int): PlayerForm[];
|
|
5
5
|
/**
|
|
6
6
|
* Helper function to get a transformation name from a PlayerForm enum.
|
|
7
7
|
*
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
-
require("lualib_bundle");
|
|
3
2
|
local ____exports = {}
|
|
4
3
|
local ____transformationMaps = require("maps.transformationMaps")
|
|
5
4
|
local ITEM_TO_TRANSFORMATION_MAP = ____transformationMaps.ITEM_TO_TRANSFORMATION_MAP
|
|
@@ -7,8 +6,6 @@ local TRANSFORMATIONS_NOT_BASED_ON_ITEMS = ____transformationMaps.TRANSFORMATION
|
|
|
7
6
|
local TRANSFORMATION_TO_ITEMS_MAP = ____transformationMaps.TRANSFORMATION_TO_ITEMS_MAP
|
|
8
7
|
local ____transformationNameMap = require("maps.transformationNameMap")
|
|
9
8
|
local TRANSFORMATION_NAME_MAP = ____transformationNameMap.TRANSFORMATION_NAME_MAP
|
|
10
|
-
local ____util = require("functions.util")
|
|
11
|
-
local copySet = ____util.copySet
|
|
12
9
|
function ____exports.getPlayerNumTransformationCollectibles(self, player, playerForm)
|
|
13
10
|
if TRANSFORMATIONS_NOT_BASED_ON_ITEMS:has(playerForm) then
|
|
14
11
|
error(
|
|
@@ -22,16 +19,16 @@ function ____exports.getPlayerNumTransformationCollectibles(self, player, player
|
|
|
22
19
|
)
|
|
23
20
|
end
|
|
24
21
|
local numCollectibles = 0
|
|
25
|
-
for ____, collectibleType in
|
|
26
|
-
itemsForTransformation:values()
|
|
27
|
-
) do
|
|
22
|
+
for ____, collectibleType in ipairs(itemsForTransformation) do
|
|
28
23
|
numCollectibles = numCollectibles + player:GetCollectibleNum(collectibleType)
|
|
29
24
|
end
|
|
30
25
|
return numCollectibles
|
|
31
26
|
end
|
|
32
27
|
function ____exports.getTransformationsForItem(self, collectibleType)
|
|
33
28
|
local transformations = ITEM_TO_TRANSFORMATION_MAP:get(collectibleType)
|
|
34
|
-
return ((transformations == nil) and
|
|
29
|
+
return ((transformations == nil) and ({})) or ({
|
|
30
|
+
table.unpack(transformations)
|
|
31
|
+
})
|
|
35
32
|
end
|
|
36
33
|
function ____exports.getTransformationName(self, transformation)
|
|
37
34
|
local defaultName = "Unknown"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
export declare const TRANSFORMATION_TO_TAG_MAP: Map<PlayerForm, ItemConfigTag>;
|
|
3
3
|
export declare const TRANSFORMATIONS_NOT_BASED_ON_ITEMS: Set<PlayerForm>;
|
|
4
|
-
export declare const TRANSFORMATION_TO_ITEMS_MAP: Map<PlayerForm,
|
|
5
|
-
export declare const ITEM_TO_TRANSFORMATION_MAP: Map<number,
|
|
4
|
+
export declare const TRANSFORMATION_TO_ITEMS_MAP: Map<PlayerForm, number[]>;
|
|
5
|
+
export declare const ITEM_TO_TRANSFORMATION_MAP: Map<number, PlayerForm[]>;
|
|
@@ -9,10 +9,7 @@ function initMaps(self)
|
|
|
9
9
|
for ____, playerForm in __TS__Iterator(
|
|
10
10
|
____exports.TRANSFORMATION_TO_TAG_MAP:keys()
|
|
11
11
|
) do
|
|
12
|
-
____exports.TRANSFORMATION_TO_ITEMS_MAP:set(
|
|
13
|
-
playerForm,
|
|
14
|
-
__TS__New(Set)
|
|
15
|
-
)
|
|
12
|
+
____exports.TRANSFORMATION_TO_ITEMS_MAP:set(playerForm, {})
|
|
16
13
|
end
|
|
17
14
|
do
|
|
18
15
|
local collectibleType = 1
|
|
@@ -34,13 +31,13 @@ function initMaps(self)
|
|
|
34
31
|
"Failed to get the items for transformation: " .. tostring(playerForm)
|
|
35
32
|
)
|
|
36
33
|
end
|
|
37
|
-
items
|
|
34
|
+
__TS__ArrayPush(items, collectibleType)
|
|
38
35
|
local transformations = ____exports.ITEM_TO_TRANSFORMATION_MAP:get(collectibleType)
|
|
39
36
|
if transformations == nil then
|
|
40
|
-
transformations =
|
|
37
|
+
transformations = {}
|
|
41
38
|
____exports.ITEM_TO_TRANSFORMATION_MAP:set(collectibleType, transformations)
|
|
42
39
|
end
|
|
43
|
-
transformations
|
|
40
|
+
__TS__ArrayPush(transformations, playerForm)
|
|
44
41
|
end
|
|
45
42
|
::__continue5::
|
|
46
43
|
end
|