isaacscript-common 79.1.1 → 79.3.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/functions/map.d.ts +28 -0
- package/dist/functions/map.d.ts.map +1 -1
- package/dist/functions/map.lua +35 -0
- package/dist/functions/pickupsSpecific.d.ts +18 -0
- package/dist/functions/pickupsSpecific.d.ts.map +1 -1
- package/dist/functions/pickupsSpecific.lua +35 -0
- package/dist/index.rollup.d.ts +50 -0
- package/dist/isaacscript-common.lua +71 -1
- package/package.json +1 -1
- package/src/functions/map.ts +44 -0
- package/src/functions/pickupsSpecific.ts +34 -1
package/dist/functions/map.d.ts
CHANGED
|
@@ -44,6 +44,34 @@ export declare function getReversedMap<K, V>(map: ReadonlyMap<K, V>): ReadonlyMa
|
|
|
44
44
|
* the map uses `PtrHash` as an index.
|
|
45
45
|
*/
|
|
46
46
|
export declare function mapSetHash<V>(map: Map<PtrHash, V>, entity: Entity, value: V): void;
|
|
47
|
+
/**
|
|
48
|
+
* Helper function to convert an object to a map.
|
|
49
|
+
*
|
|
50
|
+
* This is useful when you need to construct a type safe object with the `satisfies` operator, but
|
|
51
|
+
* then later on you need to query it in a way where you expect the return value to be T or
|
|
52
|
+
* undefined. In this situation, by converting the object to a map, you can avoid unsafe type
|
|
53
|
+
* assertions.
|
|
54
|
+
*
|
|
55
|
+
* Note that the map values will be inserted in a random order, due to how `pairs` works under the
|
|
56
|
+
* hood.
|
|
57
|
+
*
|
|
58
|
+
* Also see the `objectToReadonlyMap` function.
|
|
59
|
+
*/
|
|
60
|
+
export declare function objectToMap<K extends string | number | symbol, V>(object: Record<K, V>): Map<K, V>;
|
|
61
|
+
/**
|
|
62
|
+
* Helper function to convert an object to a read-only map.
|
|
63
|
+
*
|
|
64
|
+
* This is useful when you need to construct a type safe object with the `satisfies` operator, but
|
|
65
|
+
* then later on you need to query it in a way where you expect the return value to be T or
|
|
66
|
+
* undefined. In this situation, by converting the object to a map, you can avoid unsafe type
|
|
67
|
+
* assertions.
|
|
68
|
+
*
|
|
69
|
+
* Note that the map values will be inserted in a random order, due to how `pairs` works under the
|
|
70
|
+
* hood.
|
|
71
|
+
*
|
|
72
|
+
* Also see the `objectToMap` function.
|
|
73
|
+
*/
|
|
74
|
+
export declare function objectToReadonlyMap<K extends string | number | symbol, V>(object: Record<K, V>): ReadonlyMap<K, V>;
|
|
47
75
|
/** Helper function to sum every value in a map together. */
|
|
48
76
|
export declare function sumMap(map: Map<unknown, number> | ReadonlyMap<unknown, number>): number;
|
|
49
77
|
//# sourceMappingURL=map.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../src/functions/map.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGxD,mGAAmG;AACnG,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,EAC1B,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAOX;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,EAAE,EACtD,GAAG,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,EAC9B,MAAM,EAAE,MAAM,EACd,GAAG,SAAS,EAAE,CAAC,GACd,CAAC,CAGH;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,GAAG,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,EACpB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,CAAC,GACP,IAAI,CAEN;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,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AC,GACP,IAAI,CAEN;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAChE,wBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAahF;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAC1B,GAAG,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,EACpB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,CAAC,GACP,IAAI,CAGN;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC,EAC/D,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GACnB,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAQX;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC,EACvE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GACnB,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAEnB;AAED,4DAA4D;AAC5D,wBAAgB,MAAM,CACpB,GAAG,EAAE,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,GACvD,MAAM,CAGR"}
|
package/dist/functions/map.lua
CHANGED
|
@@ -2,6 +2,7 @@ local ____lualib = require("lualib_bundle")
|
|
|
2
2
|
local Map = ____lualib.Map
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
4
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
5
|
+
local __TS__ObjectEntries = ____lualib.__TS__ObjectEntries
|
|
5
6
|
local __TS__Spread = ____lualib.__TS__Spread
|
|
6
7
|
local ____exports = {}
|
|
7
8
|
local ____array = require("functions.array")
|
|
@@ -64,6 +65,40 @@ function ____exports.getReversedMap(self, map)
|
|
|
64
65
|
end
|
|
65
66
|
return reverseMap
|
|
66
67
|
end
|
|
68
|
+
--- Helper function to convert an object to a map.
|
|
69
|
+
--
|
|
70
|
+
-- This is useful when you need to construct a type safe object with the `satisfies` operator, but
|
|
71
|
+
-- then later on you need to query it in a way where you expect the return value to be T or
|
|
72
|
+
-- undefined. In this situation, by converting the object to a map, you can avoid unsafe type
|
|
73
|
+
-- assertions.
|
|
74
|
+
--
|
|
75
|
+
-- Note that the map values will be inserted in a random order, due to how `pairs` works under the
|
|
76
|
+
-- hood.
|
|
77
|
+
--
|
|
78
|
+
-- Also see the `objectToReadonlyMap` function.
|
|
79
|
+
function ____exports.objectToMap(self, object)
|
|
80
|
+
local map = __TS__New(Map)
|
|
81
|
+
for ____, ____value in ipairs(__TS__ObjectEntries(object)) do
|
|
82
|
+
local key = ____value[1]
|
|
83
|
+
local value = ____value[2]
|
|
84
|
+
map:set(key, value)
|
|
85
|
+
end
|
|
86
|
+
return map
|
|
87
|
+
end
|
|
88
|
+
--- Helper function to convert an object to a read-only map.
|
|
89
|
+
--
|
|
90
|
+
-- This is useful when you need to construct a type safe object with the `satisfies` operator, but
|
|
91
|
+
-- then later on you need to query it in a way where you expect the return value to be T or
|
|
92
|
+
-- undefined. In this situation, by converting the object to a map, you can avoid unsafe type
|
|
93
|
+
-- assertions.
|
|
94
|
+
--
|
|
95
|
+
-- Note that the map values will be inserted in a random order, due to how `pairs` works under the
|
|
96
|
+
-- hood.
|
|
97
|
+
--
|
|
98
|
+
-- Also see the `objectToMap` function.
|
|
99
|
+
function ____exports.objectToReadonlyMap(self, object)
|
|
100
|
+
return ____exports.objectToMap(nil, object)
|
|
101
|
+
end
|
|
67
102
|
--- Helper function to sum every value in a map together.
|
|
68
103
|
function ____exports.sumMap(self, map)
|
|
69
104
|
local values = {__TS__Spread(map:values())}
|
|
@@ -21,6 +21,14 @@ export declare function getBombPickups(bombSubType?: BombSubType | -1): EntityPi
|
|
|
21
21
|
* is -1, which matches every sub-type.
|
|
22
22
|
*/
|
|
23
23
|
export declare function getCards(cardType?: CardType | -1): EntityPickupCard[];
|
|
24
|
+
/**
|
|
25
|
+
* Helper function to get all of the chest entities in the room. Specifically, this is all of the
|
|
26
|
+
* pickups with a variant in the `CHEST_PICKUP_VARIANTS` constant.
|
|
27
|
+
*
|
|
28
|
+
* @param subType Optional. If specified, will only get the chests that match the sub-type. Default
|
|
29
|
+
* is -1, which matches every sub-type.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getChests(subType?: number): EntityPickup[];
|
|
24
32
|
/**
|
|
25
33
|
* Helper function to get all of the coin pickup entities in the room.
|
|
26
34
|
*
|
|
@@ -98,6 +106,16 @@ export declare function removeAllBombPickups(bombSubType?: BombSubType | -1, cap
|
|
|
98
106
|
* @returns The cards that were removed.
|
|
99
107
|
*/
|
|
100
108
|
export declare function removeAllCards(cardType?: CardType | -1, cap?: int): EntityPickupCard[];
|
|
109
|
+
/**
|
|
110
|
+
* Helper function to remove all of the chests in the room. Specifically, this is all of the pickups
|
|
111
|
+
* with a variant in the `CHEST_PICKUP_VARIANTS` constant.
|
|
112
|
+
*
|
|
113
|
+
* @param subType Optional. If specified, will only remove chests that match this sub-type. Default
|
|
114
|
+
* is -1, which matches every sub-type.
|
|
115
|
+
* @param cap Optional. If specified, will only remove the given amount of chests.
|
|
116
|
+
* @returns The chests that were removed.
|
|
117
|
+
*/
|
|
118
|
+
export declare function removeAllChests(subType?: number, cap?: int): EntityPickup[];
|
|
101
119
|
/**
|
|
102
120
|
* Helper function to remove all of the coins in the room.
|
|
103
121
|
*
|
|
@@ -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;
|
|
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;AAMtC;;;;;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;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,OAAO,SAAK,GAAG,YAAY,EAAE,CAStD;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,UAA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C,gBAAgB,CAQlB;AAED,iGAAiG;AACjG,wBAAgB,SAAS,CACvB,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,gBAAgB,CASlB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,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,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"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__ArrayPushArray = ____lualib.__TS__ArrayPushArray
|
|
1
3
|
local ____exports = {}
|
|
2
4
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
3
5
|
local PickupVariant = ____isaac_2Dtypescript_2Ddefinitions.PickupVariant
|
|
4
6
|
local ____constants = require("core.constants")
|
|
7
|
+
local CHEST_PICKUP_VARIANTS = ____constants.CHEST_PICKUP_VARIANTS
|
|
5
8
|
local VectorZero = ____constants.VectorZero
|
|
9
|
+
local ____entities = require("functions.entities")
|
|
10
|
+
local removeEntities = ____entities.removeEntities
|
|
6
11
|
local ____entitiesSpecific = require("functions.entitiesSpecific")
|
|
7
12
|
local getPickups = ____entitiesSpecific.getPickups
|
|
8
13
|
local removeAllPickups = ____entitiesSpecific.removeAllPickups
|
|
@@ -38,6 +43,22 @@ function ____exports.getCards(self, cardType)
|
|
|
38
43
|
end
|
|
39
44
|
return getPickups(nil, PickupVariant.CARD, cardType)
|
|
40
45
|
end
|
|
46
|
+
--- Helper function to get all of the chest entities in the room. Specifically, this is all of the
|
|
47
|
+
-- pickups with a variant in the `CHEST_PICKUP_VARIANTS` constant.
|
|
48
|
+
--
|
|
49
|
+
-- @param subType Optional. If specified, will only get the chests that match the sub-type. Default
|
|
50
|
+
-- is -1, which matches every sub-type.
|
|
51
|
+
function ____exports.getChests(self, subType)
|
|
52
|
+
if subType == nil then
|
|
53
|
+
subType = -1
|
|
54
|
+
end
|
|
55
|
+
local chests = {}
|
|
56
|
+
for ____, pickupVariant in ipairs(CHEST_PICKUP_VARIANTS) do
|
|
57
|
+
local pickups = getPickups(nil, pickupVariant, subType)
|
|
58
|
+
__TS__ArrayPushArray(chests, pickups)
|
|
59
|
+
end
|
|
60
|
+
return chests
|
|
61
|
+
end
|
|
41
62
|
--- Helper function to get all of the coin pickup entities in the room.
|
|
42
63
|
--
|
|
43
64
|
-- @param coinSubType Optional. If specified, will only get the coins that match the sub-type.
|
|
@@ -145,6 +166,20 @@ function ____exports.removeAllCards(self, cardType, cap)
|
|
|
145
166
|
end
|
|
146
167
|
return removeAllPickups(nil, PickupVariant.CARD, cardType, cap)
|
|
147
168
|
end
|
|
169
|
+
--- Helper function to remove all of the chests in the room. Specifically, this is all of the pickups
|
|
170
|
+
-- with a variant in the `CHEST_PICKUP_VARIANTS` constant.
|
|
171
|
+
--
|
|
172
|
+
-- @param subType Optional. If specified, will only remove chests that match this sub-type. Default
|
|
173
|
+
-- is -1, which matches every sub-type.
|
|
174
|
+
-- @param cap Optional. If specified, will only remove the given amount of chests.
|
|
175
|
+
-- @returns The chests that were removed.
|
|
176
|
+
function ____exports.removeAllChests(self, subType, cap)
|
|
177
|
+
if subType == nil then
|
|
178
|
+
subType = -1
|
|
179
|
+
end
|
|
180
|
+
local chests = ____exports.getChests(nil, subType)
|
|
181
|
+
return removeEntities(nil, chests, cap)
|
|
182
|
+
end
|
|
148
183
|
--- Helper function to remove all of the coins in the room.
|
|
149
184
|
--
|
|
150
185
|
-- @param coinSubType Optional. If specified, will only remove coins that match this sub-type.
|
package/dist/index.rollup.d.ts
CHANGED
|
@@ -5322,6 +5322,15 @@ export declare function getChargesAwayFromMax(player: EntityPlayer, activeSlot?:
|
|
|
5322
5322
|
*/
|
|
5323
5323
|
export declare function getChestName(pickupVariant: PickupVariant): string;
|
|
5324
5324
|
|
|
5325
|
+
/**
|
|
5326
|
+
* Helper function to get all of the chest entities in the room. Specifically, this is all of the
|
|
5327
|
+
* pickups with a variant in the `CHEST_PICKUP_VARIANTS` constant.
|
|
5328
|
+
*
|
|
5329
|
+
* @param subType Optional. If specified, will only get the chests that match the sub-type. Default
|
|
5330
|
+
* is -1, which matches every sub-type.
|
|
5331
|
+
*/
|
|
5332
|
+
export declare function getChests(subType?: number): EntityPickup[];
|
|
5333
|
+
|
|
5325
5334
|
/**
|
|
5326
5335
|
* Helper function to get an array of equidistant points on the circumference around a circle.
|
|
5327
5336
|
* Useful for equally distributing things in a circle pattern.
|
|
@@ -14889,6 +14898,36 @@ export declare const NUM_VANILLA_PILL_EFFECTS: int;
|
|
|
14889
14898
|
/** Calculated from the `TrinketType` enum. (`TrinketType.NULL` is not included.) */
|
|
14890
14899
|
export declare const NUM_VANILLA_TRINKET_TYPES: number;
|
|
14891
14900
|
|
|
14901
|
+
/**
|
|
14902
|
+
* Helper function to convert an object to a map.
|
|
14903
|
+
*
|
|
14904
|
+
* This is useful when you need to construct a type safe object with the `satisfies` operator, but
|
|
14905
|
+
* then later on you need to query it in a way where you expect the return value to be T or
|
|
14906
|
+
* undefined. In this situation, by converting the object to a map, you can avoid unsafe type
|
|
14907
|
+
* assertions.
|
|
14908
|
+
*
|
|
14909
|
+
* Note that the map values will be inserted in a random order, due to how `pairs` works under the
|
|
14910
|
+
* hood.
|
|
14911
|
+
*
|
|
14912
|
+
* Also see the `objectToReadonlyMap` function.
|
|
14913
|
+
*/
|
|
14914
|
+
export declare function objectToMap<K extends string | number | symbol, V>(object: Record<K, V>): Map<K, V>;
|
|
14915
|
+
|
|
14916
|
+
/**
|
|
14917
|
+
* Helper function to convert an object to a read-only map.
|
|
14918
|
+
*
|
|
14919
|
+
* This is useful when you need to construct a type safe object with the `satisfies` operator, but
|
|
14920
|
+
* then later on you need to query it in a way where you expect the return value to be T or
|
|
14921
|
+
* undefined. In this situation, by converting the object to a map, you can avoid unsafe type
|
|
14922
|
+
* assertions.
|
|
14923
|
+
*
|
|
14924
|
+
* Note that the map values will be inserted in a random order, due to how `pairs` works under the
|
|
14925
|
+
* hood.
|
|
14926
|
+
*
|
|
14927
|
+
* Also see the `objectToMap` function.
|
|
14928
|
+
*/
|
|
14929
|
+
export declare function objectToReadonlyMap<K extends string | number | symbol, V>(object: Record<K, V>): ReadonlyMap<K, V>;
|
|
14930
|
+
|
|
14892
14931
|
/** Helper function to see if the player is playing any challenge. */
|
|
14893
14932
|
export declare function onAnyChallenge(): boolean;
|
|
14894
14933
|
|
|
@@ -15986,6 +16025,17 @@ export declare function removeAllCards(cardType?: CardType | -1, cap?: int): Ent
|
|
|
15986
16025
|
|
|
15987
16026
|
export declare function removeAllCharacters(string: string, character: string): string;
|
|
15988
16027
|
|
|
16028
|
+
/**
|
|
16029
|
+
* Helper function to remove all of the chests in the room. Specifically, this is all of the pickups
|
|
16030
|
+
* with a variant in the `CHEST_PICKUP_VARIANTS` constant.
|
|
16031
|
+
*
|
|
16032
|
+
* @param subType Optional. If specified, will only remove chests that match this sub-type. Default
|
|
16033
|
+
* is -1, which matches every sub-type.
|
|
16034
|
+
* @param cap Optional. If specified, will only remove the given amount of chests.
|
|
16035
|
+
* @returns The chests that were removed.
|
|
16036
|
+
*/
|
|
16037
|
+
export declare function removeAllChests(subType?: number, cap?: int): EntityPickup[];
|
|
16038
|
+
|
|
15989
16039
|
/**
|
|
15990
16040
|
* Helper function to remove all of the coins in the room.
|
|
15991
16041
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 79.
|
|
3
|
+
isaacscript-common 79.2.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -45920,11 +45920,16 @@ ____exports.RED_HEART_SUB_TYPES_SET = __TS__New(ReadonlySet, {HeartSubType.FULL,
|
|
|
45920
45920
|
return ____exports
|
|
45921
45921
|
end,
|
|
45922
45922
|
["functions.pickupsSpecific"] = function(...)
|
|
45923
|
+
local ____lualib = require("lualib_bundle")
|
|
45924
|
+
local __TS__ArrayPushArray = ____lualib.__TS__ArrayPushArray
|
|
45923
45925
|
local ____exports = {}
|
|
45924
45926
|
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.index")
|
|
45925
45927
|
local PickupVariant = ____isaac_2Dtypescript_2Ddefinitions.PickupVariant
|
|
45926
45928
|
local ____constants = require("core.constants")
|
|
45929
|
+
local CHEST_PICKUP_VARIANTS = ____constants.CHEST_PICKUP_VARIANTS
|
|
45927
45930
|
local VectorZero = ____constants.VectorZero
|
|
45931
|
+
local ____entities = require("functions.entities")
|
|
45932
|
+
local removeEntities = ____entities.removeEntities
|
|
45928
45933
|
local ____entitiesSpecific = require("functions.entitiesSpecific")
|
|
45929
45934
|
local getPickups = ____entitiesSpecific.getPickups
|
|
45930
45935
|
local removeAllPickups = ____entitiesSpecific.removeAllPickups
|
|
@@ -45960,6 +45965,22 @@ function ____exports.getCards(self, cardType)
|
|
|
45960
45965
|
end
|
|
45961
45966
|
return getPickups(nil, PickupVariant.CARD, cardType)
|
|
45962
45967
|
end
|
|
45968
|
+
--- Helper function to get all of the chest entities in the room. Specifically, this is all of the
|
|
45969
|
+
-- pickups with a variant in the `CHEST_PICKUP_VARIANTS` constant.
|
|
45970
|
+
--
|
|
45971
|
+
-- @param subType Optional. If specified, will only get the chests that match the sub-type. Default
|
|
45972
|
+
-- is -1, which matches every sub-type.
|
|
45973
|
+
function ____exports.getChests(self, subType)
|
|
45974
|
+
if subType == nil then
|
|
45975
|
+
subType = -1
|
|
45976
|
+
end
|
|
45977
|
+
local chests = {}
|
|
45978
|
+
for ____, pickupVariant in ipairs(CHEST_PICKUP_VARIANTS) do
|
|
45979
|
+
local pickups = getPickups(nil, pickupVariant, subType)
|
|
45980
|
+
__TS__ArrayPushArray(chests, pickups)
|
|
45981
|
+
end
|
|
45982
|
+
return chests
|
|
45983
|
+
end
|
|
45963
45984
|
--- Helper function to get all of the coin pickup entities in the room.
|
|
45964
45985
|
--
|
|
45965
45986
|
-- @param coinSubType Optional. If specified, will only get the coins that match the sub-type.
|
|
@@ -46067,6 +46088,20 @@ function ____exports.removeAllCards(self, cardType, cap)
|
|
|
46067
46088
|
end
|
|
46068
46089
|
return removeAllPickups(nil, PickupVariant.CARD, cardType, cap)
|
|
46069
46090
|
end
|
|
46091
|
+
--- Helper function to remove all of the chests in the room. Specifically, this is all of the pickups
|
|
46092
|
+
-- with a variant in the `CHEST_PICKUP_VARIANTS` constant.
|
|
46093
|
+
--
|
|
46094
|
+
-- @param subType Optional. If specified, will only remove chests that match this sub-type. Default
|
|
46095
|
+
-- is -1, which matches every sub-type.
|
|
46096
|
+
-- @param cap Optional. If specified, will only remove the given amount of chests.
|
|
46097
|
+
-- @returns The chests that were removed.
|
|
46098
|
+
function ____exports.removeAllChests(self, subType, cap)
|
|
46099
|
+
if subType == nil then
|
|
46100
|
+
subType = -1
|
|
46101
|
+
end
|
|
46102
|
+
local chests = ____exports.getChests(nil, subType)
|
|
46103
|
+
return removeEntities(nil, chests, cap)
|
|
46104
|
+
end
|
|
46070
46105
|
--- Helper function to remove all of the coins in the room.
|
|
46071
46106
|
--
|
|
46072
46107
|
-- @param coinSubType Optional. If specified, will only remove coins that match this sub-type.
|
|
@@ -46834,6 +46869,7 @@ local ____lualib = require("lualib_bundle")
|
|
|
46834
46869
|
local Map = ____lualib.Map
|
|
46835
46870
|
local __TS__New = ____lualib.__TS__New
|
|
46836
46871
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
46872
|
+
local __TS__ObjectEntries = ____lualib.__TS__ObjectEntries
|
|
46837
46873
|
local __TS__Spread = ____lualib.__TS__Spread
|
|
46838
46874
|
local ____exports = {}
|
|
46839
46875
|
local ____array = require("functions.array")
|
|
@@ -46896,6 +46932,40 @@ function ____exports.getReversedMap(self, map)
|
|
|
46896
46932
|
end
|
|
46897
46933
|
return reverseMap
|
|
46898
46934
|
end
|
|
46935
|
+
--- Helper function to convert an object to a map.
|
|
46936
|
+
--
|
|
46937
|
+
-- This is useful when you need to construct a type safe object with the `satisfies` operator, but
|
|
46938
|
+
-- then later on you need to query it in a way where you expect the return value to be T or
|
|
46939
|
+
-- undefined. In this situation, by converting the object to a map, you can avoid unsafe type
|
|
46940
|
+
-- assertions.
|
|
46941
|
+
--
|
|
46942
|
+
-- Note that the map values will be inserted in a random order, due to how `pairs` works under the
|
|
46943
|
+
-- hood.
|
|
46944
|
+
--
|
|
46945
|
+
-- Also see the `objectToReadonlyMap` function.
|
|
46946
|
+
function ____exports.objectToMap(self, object)
|
|
46947
|
+
local map = __TS__New(Map)
|
|
46948
|
+
for ____, ____value in ipairs(__TS__ObjectEntries(object)) do
|
|
46949
|
+
local key = ____value[1]
|
|
46950
|
+
local value = ____value[2]
|
|
46951
|
+
map:set(key, value)
|
|
46952
|
+
end
|
|
46953
|
+
return map
|
|
46954
|
+
end
|
|
46955
|
+
--- Helper function to convert an object to a read-only map.
|
|
46956
|
+
--
|
|
46957
|
+
-- This is useful when you need to construct a type safe object with the `satisfies` operator, but
|
|
46958
|
+
-- then later on you need to query it in a way where you expect the return value to be T or
|
|
46959
|
+
-- undefined. In this situation, by converting the object to a map, you can avoid unsafe type
|
|
46960
|
+
-- assertions.
|
|
46961
|
+
--
|
|
46962
|
+
-- Note that the map values will be inserted in a random order, due to how `pairs` works under the
|
|
46963
|
+
-- hood.
|
|
46964
|
+
--
|
|
46965
|
+
-- Also see the `objectToMap` function.
|
|
46966
|
+
function ____exports.objectToReadonlyMap(self, object)
|
|
46967
|
+
return ____exports.objectToMap(nil, object)
|
|
46968
|
+
end
|
|
46899
46969
|
--- Helper function to sum every value in a map together.
|
|
46900
46970
|
function ____exports.sumMap(self, map)
|
|
46901
46971
|
local values = {__TS__Spread(map:values())}
|
package/package.json
CHANGED
package/src/functions/map.ts
CHANGED
|
@@ -89,6 +89,50 @@ export function mapSetHash<V>(
|
|
|
89
89
|
map.set(hash, value);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Helper function to convert an object to a map.
|
|
94
|
+
*
|
|
95
|
+
* This is useful when you need to construct a type safe object with the `satisfies` operator, but
|
|
96
|
+
* then later on you need to query it in a way where you expect the return value to be T or
|
|
97
|
+
* undefined. In this situation, by converting the object to a map, you can avoid unsafe type
|
|
98
|
+
* assertions.
|
|
99
|
+
*
|
|
100
|
+
* Note that the map values will be inserted in a random order, due to how `pairs` works under the
|
|
101
|
+
* hood.
|
|
102
|
+
*
|
|
103
|
+
* Also see the `objectToReadonlyMap` function.
|
|
104
|
+
*/
|
|
105
|
+
export function objectToMap<K extends string | number | symbol, V>(
|
|
106
|
+
object: Record<K, V>,
|
|
107
|
+
): Map<K, V> {
|
|
108
|
+
const map = new Map<K, V>();
|
|
109
|
+
|
|
110
|
+
for (const [key, value] of Object.entries(object)) {
|
|
111
|
+
map.set(key as K, value as V);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return map;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Helper function to convert an object to a read-only map.
|
|
119
|
+
*
|
|
120
|
+
* This is useful when you need to construct a type safe object with the `satisfies` operator, but
|
|
121
|
+
* then later on you need to query it in a way where you expect the return value to be T or
|
|
122
|
+
* undefined. In this situation, by converting the object to a map, you can avoid unsafe type
|
|
123
|
+
* assertions.
|
|
124
|
+
*
|
|
125
|
+
* Note that the map values will be inserted in a random order, due to how `pairs` works under the
|
|
126
|
+
* hood.
|
|
127
|
+
*
|
|
128
|
+
* Also see the `objectToMap` function.
|
|
129
|
+
*/
|
|
130
|
+
export function objectToReadonlyMap<K extends string | number | symbol, V>(
|
|
131
|
+
object: Record<K, V>,
|
|
132
|
+
): ReadonlyMap<K, V> {
|
|
133
|
+
return objectToMap(object);
|
|
134
|
+
}
|
|
135
|
+
|
|
92
136
|
/** Helper function to sum every value in a map together. */
|
|
93
137
|
export function sumMap(
|
|
94
138
|
map: Map<unknown, number> | ReadonlyMap<unknown, number>,
|
|
@@ -11,7 +11,8 @@ import type {
|
|
|
11
11
|
TrinketType,
|
|
12
12
|
} from "isaac-typescript-definitions";
|
|
13
13
|
import { PickupVariant } from "isaac-typescript-definitions";
|
|
14
|
-
import { VectorZero } from "../core/constants";
|
|
14
|
+
import { CHEST_PICKUP_VARIANTS, VectorZero } from "../core/constants";
|
|
15
|
+
import { removeEntities } from "./entities";
|
|
15
16
|
import { getPickups, removeAllPickups, spawnPickup } from "./entitiesSpecific";
|
|
16
17
|
|
|
17
18
|
/**
|
|
@@ -52,6 +53,24 @@ export function getCards(cardType: CardType | -1 = -1): EntityPickupCard[] {
|
|
|
52
53
|
return getPickups(PickupVariant.CARD, cardType) as EntityPickupCard[];
|
|
53
54
|
}
|
|
54
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Helper function to get all of the chest entities in the room. Specifically, this is all of the
|
|
58
|
+
* pickups with a variant in the `CHEST_PICKUP_VARIANTS` constant.
|
|
59
|
+
*
|
|
60
|
+
* @param subType Optional. If specified, will only get the chests that match the sub-type. Default
|
|
61
|
+
* is -1, which matches every sub-type.
|
|
62
|
+
*/
|
|
63
|
+
export function getChests(subType = -1): EntityPickup[] {
|
|
64
|
+
const chests: EntityPickup[] = [];
|
|
65
|
+
|
|
66
|
+
for (const pickupVariant of CHEST_PICKUP_VARIANTS) {
|
|
67
|
+
const pickups = getPickups(pickupVariant, subType);
|
|
68
|
+
chests.push(...pickups);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return chests;
|
|
72
|
+
}
|
|
73
|
+
|
|
55
74
|
/**
|
|
56
75
|
* Helper function to get all of the coin pickup entities in the room.
|
|
57
76
|
*
|
|
@@ -196,6 +215,20 @@ export function removeAllCards(
|
|
|
196
215
|
) as EntityPickupCard[];
|
|
197
216
|
}
|
|
198
217
|
|
|
218
|
+
/**
|
|
219
|
+
* Helper function to remove all of the chests in the room. Specifically, this is all of the pickups
|
|
220
|
+
* with a variant in the `CHEST_PICKUP_VARIANTS` constant.
|
|
221
|
+
*
|
|
222
|
+
* @param subType Optional. If specified, will only remove chests that match this sub-type. Default
|
|
223
|
+
* is -1, which matches every sub-type.
|
|
224
|
+
* @param cap Optional. If specified, will only remove the given amount of chests.
|
|
225
|
+
* @returns The chests that were removed.
|
|
226
|
+
*/
|
|
227
|
+
export function removeAllChests(subType = -1, cap?: int): EntityPickup[] {
|
|
228
|
+
const chests = getChests(subType);
|
|
229
|
+
return removeEntities(chests, cap);
|
|
230
|
+
}
|
|
231
|
+
|
|
199
232
|
/**
|
|
200
233
|
* Helper function to remove all of the coins in the room.
|
|
201
234
|
*
|