isaacscript-common 9.11.1 → 9.13.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.
Files changed (45) hide show
  1. package/dist/callbacks/postEsauJr.lua +5 -13
  2. package/dist/functions/array.d.ts +0 -2
  3. package/dist/functions/array.d.ts.map +1 -1
  4. package/dist/functions/array.lua +0 -13
  5. package/dist/functions/benchmark.d.ts +6 -1
  6. package/dist/functions/benchmark.d.ts.map +1 -1
  7. package/dist/functions/benchmark.lua +6 -1
  8. package/dist/functions/deepCopy.d.ts +5 -2
  9. package/dist/functions/deepCopy.d.ts.map +1 -1
  10. package/dist/functions/deepCopy.lua +5 -2
  11. package/dist/functions/entities.d.ts +2 -3
  12. package/dist/functions/entities.d.ts.map +1 -1
  13. package/dist/functions/entities.lua +2 -3
  14. package/dist/functions/gridEntities.d.ts +2 -2
  15. package/dist/functions/gridEntities.d.ts.map +1 -1
  16. package/dist/functions/gridEntities.lua +2 -2
  17. package/dist/functions/initArray.d.ts +18 -0
  18. package/dist/functions/initArray.d.ts.map +1 -0
  19. package/dist/functions/initArray.lua +37 -0
  20. package/dist/functions/input.d.ts +9 -1
  21. package/dist/functions/input.d.ts.map +1 -1
  22. package/dist/functions/input.lua +7 -1
  23. package/dist/functions/playerIndex.lua +1 -1
  24. package/dist/functions/players.d.ts +19 -1
  25. package/dist/functions/players.d.ts.map +1 -1
  26. package/dist/functions/players.lua +40 -13
  27. package/dist/functions/positionVelocity.d.ts +6 -1
  28. package/dist/functions/positionVelocity.d.ts.map +1 -1
  29. package/dist/functions/positionVelocity.lua +3 -0
  30. package/dist/index.d.ts +66 -11
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.lua +8 -0
  33. package/package.json +1 -1
  34. package/src/callbacks/postEsauJr.ts +6 -7
  35. package/src/functions/array.ts +1 -11
  36. package/src/functions/benchmark.ts +6 -1
  37. package/src/functions/deepCopy.ts +5 -2
  38. package/src/functions/entities.ts +2 -3
  39. package/src/functions/gridEntities.ts +2 -2
  40. package/src/functions/initArray.ts +32 -0
  41. package/src/functions/input.ts +9 -1
  42. package/src/functions/playerIndex.ts +1 -1
  43. package/src/functions/players.ts +31 -0
  44. package/src/functions/positionVelocity.ts +6 -1
  45. package/src/index.ts +1 -0
@@ -1,7 +1,5 @@
1
- local ____lualib = require("lualib_bundle")
2
- local __TS__ArrayFind = ____lualib.__TS__ArrayFind
3
1
  local ____exports = {}
4
- local hasSubscriptions, postUpdate, getPlayerWithControllerIndex, useItemEsauJr, v
2
+ local hasSubscriptions, postUpdate, useItemEsauJr, v
5
3
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
6
4
  local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
7
5
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
@@ -9,8 +7,8 @@ local ____cachedClasses = require("core.cachedClasses")
9
7
  local game = ____cachedClasses.game
10
8
  local ____exports = require("features.saveDataManager.exports")
11
9
  local saveDataManager = ____exports.saveDataManager
12
- local ____playerIndex = require("functions.playerIndex")
13
- local getPlayers = ____playerIndex.getPlayers
10
+ local ____players = require("functions.players")
11
+ local getPlayersWithControllerIndex = ____players.getPlayersWithControllerIndex
14
12
  local ____postEsauJr = require("callbacks.subscriptions.postEsauJr")
15
13
  local postEsauJrFire = ____postEsauJr.postEsauJrFire
16
14
  local postEsauJrHasSubscriptions = ____postEsauJr.postEsauJrHasSubscriptions
@@ -32,8 +30,9 @@ function postUpdate(self)
32
30
  if v.run.usedEsauJrControllerIndex == nil then
33
31
  return
34
32
  end
35
- local player = getPlayerWithControllerIndex(nil, v.run.usedEsauJrControllerIndex)
33
+ local players = getPlayersWithControllerIndex(nil, v.run.usedEsauJrControllerIndex)
36
34
  v.run.usedEsauJrControllerIndex = nil
35
+ local player = players[1]
37
36
  if player == nil then
38
37
  return
39
38
  end
@@ -43,13 +42,6 @@ function postUpdate(self)
43
42
  end
44
43
  postEsauJrFire(nil, player)
45
44
  end
46
- function getPlayerWithControllerIndex(self, controllerIndex)
47
- local players = getPlayers(nil)
48
- return __TS__ArrayFind(
49
- players,
50
- function(____, player) return player.ControllerIndex == controllerIndex end
51
- )
52
- end
53
45
  function useItemEsauJr(self, _collectibleType, _rng, player, _useFlags, _activeSlot, _customVarData)
54
46
  if not hasSubscriptions(nil) then
55
47
  return nil
@@ -159,8 +159,6 @@ export declare function getRandomArrayElementAndRemove<T>(array: T[], seedOrRNG?
159
159
  * index. Default is an empty array.
160
160
  */
161
161
  export declare function getRandomArrayIndex<T>(array: T[] | readonly T[], seedOrRNG?: Seed | RNG, exceptions?: int[] | readonly int[]): int;
162
- /** Initializes an array with all elements containing the specified default value. */
163
- export declare function initArray<T>(defaultValue: T, size: int): T[];
164
162
  /**
165
163
  * Since Lua uses tables for every non-primitive data structure, it is non-trivial to determine if a
166
164
  * particular table is being used as an array. `isArray` returns true if:
@@ -1 +1 @@
1
- {"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../src/functions/array.ts"],"names":[],"mappings":";;;AAKA;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,MAAM,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,EAC1B,MAAM,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,GACzB,OAAO,CAST;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,aAAa,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,EACjC,GAAG,gBAAgB,EAAE,CAAC,EAAE,GACvB,CAAC,EAAE,CAIL;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,aAAa,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,EACjC,GAAG,gBAAgB,EAAE,CAAC,EAAE,GACvB,CAAC,EAAE,CAIL;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EACrC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E,GAAG,EAAE,GAAG,OAAO,CAavD;AAED,iEAAiE;AACjE,wBAAgB,cAAc,CAAC,CAAC,EAC9B,YAAY,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,EAChC,WAAW,EAAE,KAAK,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,CAAC,GACrC,OAAO,CAET;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,aAAa,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,EACjC,SAAS,GAAE,IAAI,GAAG,GAAqB,GACtC,CAAC,EAAE,CAKL;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,KAAK,EAAE,CAAC,EAAE,EACV,SAAS,GAAE,IAAI,GAAG,GAAqB,GACtC,IAAI,CAWN;AAED,+DAA+D;AAC/D,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,GAAG,MAAM,CAEpE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAM3E"}
@@ -26,7 +26,6 @@ local isNumber = ____types.isNumber
26
26
  local isTable = ____types.isTable
27
27
  local ____utils = require("functions.utils")
28
28
  local erange = ____utils.erange
29
- local ____repeat = ____utils["repeat"]
30
29
  --- Removes all of the specified element(s) from the array. If the specified element(s) are not found
31
30
  -- in the array, this function will do nothing.
32
31
  --
@@ -398,18 +397,6 @@ function ____exports.getRandomArrayElementAndRemove(self, array, seedOrRNG, exce
398
397
  ____exports.arrayRemoveInPlace(nil, array, randomArrayElement)
399
398
  return randomArrayElement
400
399
  end
401
- --- Initializes an array with all elements containing the specified default value.
402
- function ____exports.initArray(self, defaultValue, size)
403
- local array = {}
404
- ____repeat(
405
- nil,
406
- size,
407
- function()
408
- array[#array + 1] = defaultValue
409
- end
410
- )
411
- return array
412
- end
413
400
  --- Since Lua uses tables for every non-primitive data structure, it is non-trivial to determine if a
414
401
  -- particular table is being used as an array. `isArray` returns true if:
415
402
  --
@@ -2,7 +2,12 @@
2
2
  /**
3
3
  * Helper function to benchmark the performance of a function.
4
4
  *
5
- * This function is variadic, which means that you can supply as many as you want to benchmark.
5
+ * This function is variadic, which means that you can supply as many functions as you want to
6
+ * benchmark.
7
+ *
8
+ * This function uses the `Isaac.GetTime` method to record how long the function took to execute.
9
+ * This method only reports time in milliseconds. For this reason, if you are benchmarking smaller
10
+ * functions, then you should provide a very high value for the number of trials.
6
11
  *
7
12
  * @returns An array containing the average time in milliseconds for each function. (This will also
8
13
  * be printed to the log.)
@@ -1 +1 @@
1
- {"version":3,"file":"benchmark.d.ts","sourceRoot":"","sources":["../../src/functions/benchmark.ts"],"names":[],"mappings":";AAEA;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,SAAS,EAAE,GAAG,EACd,GAAG,SAAS,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,GAC9B,GAAG,EAAE,CAsBP"}
1
+ {"version":3,"file":"benchmark.d.ts","sourceRoot":"","sources":["../../src/functions/benchmark.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CACvB,SAAS,EAAE,GAAG,EACd,GAAG,SAAS,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,GAC9B,GAAG,EAAE,CAsBP"}
@@ -5,7 +5,12 @@ local ____log = require("functions.log")
5
5
  local log = ____log.log
6
6
  --- Helper function to benchmark the performance of a function.
7
7
  --
8
- -- This function is variadic, which means that you can supply as many as you want to benchmark.
8
+ -- This function is variadic, which means that you can supply as many functions as you want to
9
+ -- benchmark.
10
+ --
11
+ -- This function uses the `Isaac.GetTime` method to record how long the function took to execute.
12
+ -- This method only reports time in milliseconds. For this reason, if you are benchmarking smaller
13
+ -- functions, then you should provide a very high value for the number of trials.
9
14
  --
10
15
  -- @returns An array containing the average time in milliseconds for each function. (This will also
11
16
  -- be printed to the log.)
@@ -3,10 +3,13 @@ import { SerializationType } from "../enums/SerializationType";
3
3
  * `deepCopy` is a semi-generic deep cloner. It will recursively copy all of the values so that none
4
4
  * of the nested references remain.
5
5
  *
6
- * It supports the following object types:
6
+ * `deepCopy` is used by the IsaacScript save data manager to make a backup of your variables, so
7
+ * that it can restore them to the default values at the beginning of a new room, floor, or run.
8
+ *
9
+ * `deepCopy` supports the following object types:
7
10
  *
8
11
  * - Primitives (i.e. strings, numbers, and booleans)
9
- * - Basic TSTL objects / tables
12
+ * - Basic TSTL objects (which are the same thing as Lua tables)
10
13
  * - TSTL `Map`
11
14
  * - TSTL `Set`
12
15
  * - TSTL classes
@@ -1 +1 @@
1
- {"version":3,"file":"deepCopy.d.ts","sourceRoot":"","sources":["../../src/functions/deepCopy.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AA6B/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,OAAO,EACd,iBAAiB,oBAAyB,EAC1C,oBAAoB,SAAK,EACzB,SAAS,UAAQ,GAChB,OAAO,CAkDT"}
1
+ {"version":3,"file":"deepCopy.d.ts","sourceRoot":"","sources":["../../src/functions/deepCopy.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AA6B/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,OAAO,EACd,iBAAiB,oBAAyB,EAC1C,oBAAoB,SAAK,EACzB,SAAS,UAAQ,GAChB,OAAO,CAkDT"}
@@ -49,10 +49,13 @@ local twoDimensionalSort = ____utils.twoDimensionalSort
49
49
  --- `deepCopy` is a semi-generic deep cloner. It will recursively copy all of the values so that none
50
50
  -- of the nested references remain.
51
51
  --
52
- -- It supports the following object types:
52
+ -- `deepCopy` is used by the IsaacScript save data manager to make a backup of your variables, so
53
+ -- that it can restore them to the default values at the beginning of a new room, floor, or run.
54
+ --
55
+ -- `deepCopy` supports the following object types:
53
56
  --
54
57
  -- - Primitives (i.e. strings, numbers, and booleans)
55
- -- - Basic TSTL objects / tables
58
+ -- - Basic TSTL objects (which are the same thing as Lua tables)
56
59
  -- - TSTL `Map`
57
60
  -- - TSTL `Set`
58
61
  -- - TSTL classes
@@ -77,11 +77,10 @@ export declare function getEntityFields(entity: Entity): LuaMap<string, boolean
77
77
  * reference, you would use an `EntityPtr` instead of a `PtrHash`.
78
78
  */
79
79
  export declare function getEntityFromPtrHash(ptrHash: PtrHash): Entity | undefined;
80
- /** Helper function to return a string containing the entity's type, variant, and sub-type. */
80
+ /** Helper function to get a string containing the entity's type, variant, and sub-type. */
81
81
  export declare function getEntityID(entity: Entity): string;
82
82
  /**
83
- * Helper function to return a formatted string in the format returned by the `getEntityID`
84
- * function.
83
+ * Helper function to get a formatted string in the format returned by the `getEntityID` function.
85
84
  */
86
85
  export declare function getEntityIDFromConstituents(entityType: EntityType, variant: int, subType: int): string;
87
86
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../src/functions/entities.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAI1D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAO/C;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,UAAU,GAAE,UAAe,EAC3B,OAAO,SAAK,EACZ,OAAO,SAAK,EACZ,cAAc,UAAQ,GACrB,GAAG,CAcL;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,UAAU,GAAE,UAAe,EAC3B,OAAO,SAAK,EACZ,OAAO,SAAK,EACZ,cAAc,UAAQ,GACrB,OAAO,CAGT;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBA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CAC3B,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,GAAG,EACZ,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,IAAI,GAAG,GAAG,EACrB,QAAQ,GAAE,MAAmB,EAC7B,OAAO,GAAE,MAAM,GAAG,SAAqB,GACtC,MAAM,CAUR"}
@@ -219,12 +219,11 @@ function ____exports.getEntityFromPtrHash(self, ptrHash)
219
219
  function(____, entity) return GetPtrHash(entity) == ptrHash end
220
220
  )
221
221
  end
222
- --- Helper function to return a string containing the entity's type, variant, and sub-type.
222
+ --- Helper function to get a string containing the entity's type, variant, and sub-type.
223
223
  function ____exports.getEntityID(self, entity)
224
224
  return (((tostring(entity.Type) .. ".") .. tostring(entity.Variant)) .. ".") .. tostring(entity.SubType)
225
225
  end
226
- --- Helper function to return a formatted string in the format returned by the `getEntityID`
227
- -- function.
226
+ --- Helper function to get a formatted string in the format returned by the `getEntityID` function.
228
227
  function ____exports.getEntityIDFromConstituents(self, entityType, variant, subType)
229
228
  return (((tostring(entityType) .. ".") .. tostring(variant)) .. ".") .. tostring(subType)
230
229
  end
@@ -60,10 +60,10 @@ export declare function getGridEntitiesExcept(...gridEntityTypes: GridEntityType
60
60
  * arguments to match specific grid entity types.
61
61
  */
62
62
  export declare function getGridEntitiesMap(...gridEntityTypes: GridEntityType[]): Map<int, GridEntity>;
63
- /** Helper function to return a string containing the grid entity's type and variant. */
63
+ /** Helper function to get a string containing the grid entity's type and variant. */
64
64
  export declare function getGridEntityID(gridEntity: GridEntity): string;
65
65
  /**
66
- * Helper function to return a formatted string in the format returned by the `getGridEntityID`
66
+ * Helper function to get a formatted string in the format returned by the `getGridEntityID`
67
67
  * function.
68
68
  */
69
69
  export declare function getGridEntityIDFromConstituents(gridEntityType: GridEntityType, variant: int): string;
@@ -1 +1 @@
1
- {"version":3,"file":"gridEntities.d.ts","sourceRoot":"","sources":["../../src/functions/gridEntities.ts"],"names":[],"mappings":"AAAA,OAAO,E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ACH,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,GAAG,EACZ,mBAAmB,EAAE,GAAG,GAAG,MAAM,GAChC,UAAU,GAAG,SAAS,CAgCxB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,GAAG,GAAG,UAAU,GAAG,SAAS,CAkBtE"}
@@ -265,13 +265,13 @@ function ____exports.getGridEntitiesMap(self, ...)
265
265
  end
266
266
  return gridEntityMap
267
267
  end
268
- --- Helper function to return a string containing the grid entity's type and variant.
268
+ --- Helper function to get a string containing the grid entity's type and variant.
269
269
  function ____exports.getGridEntityID(self, gridEntity)
270
270
  local gridEntityType = gridEntity:GetType()
271
271
  local variant = gridEntity:GetVariant()
272
272
  return (tostring(gridEntityType) .. ".") .. tostring(variant)
273
273
  end
274
- --- Helper function to return a formatted string in the format returned by the `getGridEntityID`
274
+ --- Helper function to get a formatted string in the format returned by the `getGridEntityID`
275
275
  -- function.
276
276
  function ____exports.getGridEntityIDFromConstituents(self, gridEntityType, variant)
277
277
  return (tostring(gridEntityType) .. ".") .. tostring(variant)
@@ -0,0 +1,18 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ /**
3
+ * Initializes an array with all of the elements containing the specified default value.
4
+ *
5
+ * If the provided default value is not a boolean, number, or string, then it will be copied with
6
+ * the `deepCopy` function before adding it to the new array. In this way, you can initialize an
7
+ * array of arrays, or an array of maps, and so on. (If the `deepCopy` function was not used, then
8
+ * all of the array elements would just be references to the same underlying data structure.)
9
+ *
10
+ * For example:
11
+ *
12
+ * ```ts
13
+ * const arrayWithZeroes = initArray(0, 10); // Has 10 elements of 0.
14
+ * const arrayWithArrays = initArray([0], 20); // Has 20 elements of an array with a 0 in it.
15
+ * ```
16
+ */
17
+ export declare function initArray<T>(defaultValue: T, size: int): T[];
18
+ //# sourceMappingURL=initArray.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initArray.d.ts","sourceRoot":"","sources":["../../src/functions/initArray.ts"],"names":[],"mappings":";AAIA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,EAAE,CAY5D"}
@@ -0,0 +1,37 @@
1
+ local ____exports = {}
2
+ local ____deepCopy = require("functions.deepCopy")
3
+ local deepCopy = ____deepCopy.deepCopy
4
+ local ____types = require("functions.types")
5
+ local isPrimitive = ____types.isPrimitive
6
+ local ____utils = require("functions.utils")
7
+ local ____repeat = ____utils["repeat"]
8
+ --- Initializes an array with all of the elements containing the specified default value.
9
+ --
10
+ -- If the provided default value is not a boolean, number, or string, then it will be copied with
11
+ -- the `deepCopy` function before adding it to the new array. In this way, you can initialize an
12
+ -- array of arrays, or an array of maps, and so on. (If the `deepCopy` function was not used, then
13
+ -- all of the array elements would just be references to the same underlying data structure.)
14
+ --
15
+ -- For example:
16
+ --
17
+ -- ```ts
18
+ -- const arrayWithZeroes = initArray(0, 10); // Has 10 elements of 0.
19
+ -- const arrayWithArrays = initArray([0], 20); // Has 20 elements of an array with a 0 in it.
20
+ -- ```
21
+ function ____exports.initArray(self, defaultValue, size)
22
+ local array = {}
23
+ ____repeat(
24
+ nil,
25
+ size,
26
+ function()
27
+ if isPrimitive(nil, defaultValue) then
28
+ array[#array + 1] = defaultValue
29
+ else
30
+ local copy = deepCopy(nil, defaultValue)
31
+ array[#array + 1] = copy
32
+ end
33
+ end
34
+ )
35
+ return array
36
+ end
37
+ return ____exports
@@ -1,5 +1,8 @@
1
1
  import { ButtonAction, Controller, Keyboard } from "isaac-typescript-definitions";
2
- /** Helper function to get the enum name for the specified `Controller` value. */
2
+ /**
3
+ * Helper function to get the enum name for the specified `Controller` value. Note that this will
4
+ * trim off the "BUTTON_" prefix.
5
+ */
3
6
  export declare function controllerToString(controller: Controller): string | undefined;
4
7
  export declare function getMoveActions(): ReadonlySet<ButtonAction>;
5
8
  export declare function getShootActions(): ReadonlySet<ButtonAction>;
@@ -31,6 +34,11 @@ export declare function isShootActionPressedOnAnyInput(): boolean;
31
34
  export declare function isShootActionTriggeredOnAnyInput(): boolean;
32
35
  /**
33
36
  * Helper function to get the string that would be typed if someone pressed the corresponding key.
37
+ * This is useful for creating in-game chat.
38
+ *
39
+ * Note that this function will only work for the keyboard values that are printable. Thus, it will
40
+ * return undefined for e.g. `Keyboard.LEFT_SHIFT` (340). If all you want is the corresponding name
41
+ * of the key, then simply use the enum reverse mapping (e.g. `Keyboard[keyboard]`).
34
42
  */
35
43
  export declare function keyboardToString(keyboard: Keyboard, uppercase: boolean): string | undefined;
36
44
  //# sourceMappingURL=input.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/functions/input.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,UAAU,EAEV,QAAQ,EACT,MAAM,8BAA8B,CAAC;AAsCtC,iFAAiF;AACjF,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAO7E;AAED,wBAAgB,cAAc,IAAI,WAAW,CAAC,YAAY,CAAC,CAE1D;AAED,wBAAgB,eAAe,IAAI,WAAW,CAAC,YAAY,CAAC,CAE3D;AAED,gGAAgG;AAChG,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAK7E;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,YAAY,EAAE,YAAY,GACzB,OAAO,CAKT;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,IAAI,EAAE,QAAQ,EAAE,GAAG,OAAO,CAI9D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C;AAED,wBAAgB,YAAY,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAEhE;AAED,wBAAgB,6BAA6B,IAAI,OAAO,CAIvD;AAED,wBAAgB,+BAA+B,IAAI,OAAO,CAIzD;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BAAgB,gBAAgB,CAC9B,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,OAAO,GACjB,MAAM,GAAG,SAAS,CAQpB"}
@@ -28,7 +28,8 @@ local MOVEMENT_ACTIONS = {ButtonAction.LEFT, ButtonAction.RIGHT, ButtonAction.UP
28
28
  local MOVEMENT_ACTIONS_SET = __TS__New(Set, MOVEMENT_ACTIONS)
29
29
  local SHOOTING_ACTIONS = {ButtonAction.SHOOT_LEFT, ButtonAction.SHOOT_RIGHT, ButtonAction.SHOOT_UP, ButtonAction.SHOOT_DOWN}
30
30
  local SHOOTING_ACTIONS_SET = __TS__New(Set, SHOOTING_ACTIONS)
31
- --- Helper function to get the enum name for the specified `Controller` value.
31
+ --- Helper function to get the enum name for the specified `Controller` value. Note that this will
32
+ -- trim off the "BUTTON_" prefix.
32
33
  function ____exports.controllerToString(self, controller)
33
34
  local key = Controller[controller]
34
35
  if key == nil then
@@ -110,6 +111,11 @@ function ____exports.isShootActionTriggeredOnAnyInput(self)
110
111
  )
111
112
  end
112
113
  --- Helper function to get the string that would be typed if someone pressed the corresponding key.
114
+ -- This is useful for creating in-game chat.
115
+ --
116
+ -- Note that this function will only work for the keyboard values that are printable. Thus, it will
117
+ -- return undefined for e.g. `Keyboard.LEFT_SHIFT` (340). If all you want is the corresponding name
118
+ -- of the key, then simply use the enum reverse mapping (e.g. `Keyboard[keyboard]`).
113
119
  function ____exports.keyboardToString(self, keyboard, uppercase)
114
120
  local tuple = KEYBOARD_TO_STRING:get(keyboard)
115
121
  if tuple == nil then
@@ -145,7 +145,7 @@ end
145
145
  --- Helper function to get the corresponding `EntityPlayer` object that corresponds to a
146
146
  -- `PlayerIndex`.
147
147
  function ____exports.getPlayerFromIndex(self, playerIndex)
148
- local players = ____exports.getPlayers(nil)
148
+ local players = ____exports.getAllPlayers(nil)
149
149
  return __TS__ArrayFind(
150
150
  players,
151
151
  function(____, player) return ____exports.getPlayerIndex(nil, player) == playerIndex end
@@ -1,4 +1,4 @@
1
- import { ActiveSlot, CollectibleType, PlayerType, TrinketType } from "isaac-typescript-definitions";
1
+ import { ActiveSlot, CollectibleType, ControllerIndex, PlayerType, TrinketType } from "isaac-typescript-definitions";
2
2
  export declare function addCollectibleCostume(player: EntityPlayer, collectibleType: CollectibleType): void;
3
3
  export declare function addTrinketCostume(player: EntityPlayer, trinketType: TrinketType): void;
4
4
  export declare function anyPlayerHasCollectible(collectibleType: CollectibleType): boolean;
@@ -98,6 +98,15 @@ export declare function getPlayerNumHitsRemaining(player: EntityPlayer): int;
98
98
  * for. Returns true if any of the characters supplied are present.
99
99
  */
100
100
  export declare function getPlayersOfType(...characters: PlayerType[]): EntityPlayer[];
101
+ /**
102
+ * Helper function to get all of the players that match the provided controller index. This function
103
+ * returns an array of players because it is possible that there is more than one player with the
104
+ * same controller index (e.g. Jacob & Esau).
105
+ *
106
+ * Note that this function includes players with a non-undefined parent like e.g. the Strawman
107
+ * Keeper.
108
+ */
109
+ export declare function getPlayersOnKeyboard(): EntityPlayer[];
101
110
  /**
102
111
  * Helper function to get only the players that have a certain collectible.
103
112
  *
@@ -105,6 +114,15 @@ export declare function getPlayersOfType(...characters: PlayerType[]): EntityPla
105
114
  * check for. It only returns the players that have all of the collectibles.
106
115
  */
107
116
  export declare function getPlayersWithCollectible(...collectibleTypes: CollectibleType[]): EntityPlayer[];
117
+ /**
118
+ * Helper function to get all of the players that match the provided controller index. This function
119
+ * returns an array of players because it is possible that there is more than one player with the
120
+ * same controller index (e.g. Jacob & Esau).
121
+ *
122
+ * Note that this function includes players with a non-undefined parent like e.g. the Strawman
123
+ * Keeper.
124
+ */
125
+ export declare function getPlayersWithControllerIndex(controllerIndex: ControllerIndex): EntityPlayer[];
108
126
  /**
109
127
  * Helper function to get only the players that have a certain trinket.
110
128
  *
@@ -1 +1 @@
1
- {"version":3,"file":"players.d.ts","sourceRoot":"","sources":["../../src/functions/players.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAEV,eAAe,EAIf,UAAU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AI,CA6DN;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,aAAa,UAAO,GACnB,IAAI,CAsBN;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAEN"}
@@ -13,6 +13,7 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
13
13
  local ActiveSlot = ____isaac_2Dtypescript_2Ddefinitions.ActiveSlot
14
14
  local Challenge = ____isaac_2Dtypescript_2Ddefinitions.Challenge
15
15
  local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
16
+ local ControllerIndex = ____isaac_2Dtypescript_2Ddefinitions.ControllerIndex
16
17
  local FamiliarVariant = ____isaac_2Dtypescript_2Ddefinitions.FamiliarVariant
17
18
  local NullItemID = ____isaac_2Dtypescript_2Ddefinitions.NullItemID
18
19
  local PlayerForm = ____isaac_2Dtypescript_2Ddefinitions.PlayerForm
@@ -306,6 +307,19 @@ function ____exports.getPlayersOfType(self, ...)
306
307
  end
307
308
  )
308
309
  end
310
+ --- Helper function to get all of the players that match the provided controller index. This function
311
+ -- returns an array of players because it is possible that there is more than one player with the
312
+ -- same controller index (e.g. Jacob & Esau).
313
+ --
314
+ -- Note that this function includes players with a non-undefined parent like e.g. the Strawman
315
+ -- Keeper.
316
+ function ____exports.getPlayersOnKeyboard(self)
317
+ local players = getAllPlayers(nil)
318
+ return __TS__ArrayFilter(
319
+ players,
320
+ function(____, player) return player.ControllerIndex == ControllerIndex.KEYBOARD end
321
+ )
322
+ end
309
323
  --- Helper function to get only the players that have a certain collectible.
310
324
  --
311
325
  -- This function is variadic, meaning that you can supply as many collectible types as you want to
@@ -321,6 +335,19 @@ function ____exports.getPlayersWithCollectible(self, ...)
321
335
  ) end
322
336
  )
323
337
  end
338
+ --- Helper function to get all of the players that match the provided controller index. This function
339
+ -- returns an array of players because it is possible that there is more than one player with the
340
+ -- same controller index (e.g. Jacob & Esau).
341
+ --
342
+ -- Note that this function includes players with a non-undefined parent like e.g. the Strawman
343
+ -- Keeper.
344
+ function ____exports.getPlayersWithControllerIndex(self, controllerIndex)
345
+ local players = getAllPlayers(nil)
346
+ return __TS__ArrayFilter(
347
+ players,
348
+ function(____, player) return player.ControllerIndex == controllerIndex end
349
+ )
350
+ end
324
351
  --- Helper function to get only the players that have a certain trinket.
325
352
  --
326
353
  -- This function is variadic, meaning that you can supply as many trinket types as you want to check
@@ -461,7 +488,7 @@ function ____exports.removeAllActiveItems(self, player)
461
488
  do
462
489
  local collectibleType = player:GetActiveItem(activeSlot)
463
490
  if collectibleType == CollectibleType.NULL then
464
- goto __continue86
491
+ goto __continue90
465
492
  end
466
493
  local hasCollectible
467
494
  repeat
@@ -471,7 +498,7 @@ function ____exports.removeAllActiveItems(self, player)
471
498
  end
472
499
  until not hasCollectible
473
500
  end
474
- ::__continue86::
501
+ ::__continue90::
475
502
  end
476
503
  end
477
504
  --- Helper function to remove all of the held trinkets from a player.
@@ -483,7 +510,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
483
510
  do
484
511
  local trinketType = player:GetTrinket(trinketSlot)
485
512
  if trinketType == TrinketType.NULL then
486
- goto __continue91
513
+ goto __continue95
487
514
  end
488
515
  local hasTrinket
489
516
  repeat
@@ -493,7 +520,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
493
520
  end
494
521
  until not hasTrinket
495
522
  end
496
- ::__continue91::
523
+ ::__continue95::
497
524
  end
498
525
  end
499
526
  --- Helper function to remove a collectible costume from a player. Use this helper function to avoid
@@ -556,9 +583,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
556
583
  itemPool:RemoveCollectible(collectibleType)
557
584
  end
558
585
  repeat
559
- local ____switch104 = activeSlot
560
- local ____cond104 = ____switch104 == ActiveSlot.PRIMARY
561
- if ____cond104 then
586
+ local ____switch108 = activeSlot
587
+ local ____cond108 = ____switch108 == ActiveSlot.PRIMARY
588
+ if ____cond108 then
562
589
  do
563
590
  if primaryCollectibleType ~= CollectibleType.NULL then
564
591
  player:RemoveCollectible(primaryCollectibleType)
@@ -567,8 +594,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
567
594
  break
568
595
  end
569
596
  end
570
- ____cond104 = ____cond104 or ____switch104 == ActiveSlot.SECONDARY
571
- if ____cond104 then
597
+ ____cond108 = ____cond108 or ____switch108 == ActiveSlot.SECONDARY
598
+ if ____cond108 then
572
599
  do
573
600
  if primaryCollectibleType ~= CollectibleType.NULL then
574
601
  player:RemoveCollectible(primaryCollectibleType)
@@ -583,16 +610,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
583
610
  break
584
611
  end
585
612
  end
586
- ____cond104 = ____cond104 or ____switch104 == ActiveSlot.POCKET
587
- if ____cond104 then
613
+ ____cond108 = ____cond108 or ____switch108 == ActiveSlot.POCKET
614
+ if ____cond108 then
588
615
  do
589
616
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
590
617
  player:SetActiveCharge(charge, activeSlot)
591
618
  break
592
619
  end
593
620
  end
594
- ____cond104 = ____cond104 or ____switch104 == ActiveSlot.POCKET_SINGLE_USE
595
- if ____cond104 then
621
+ ____cond108 = ____cond108 or ____switch108 == ActiveSlot.POCKET_SINGLE_USE
622
+ if ____cond108 then
596
623
  do
597
624
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
598
625
  break
@@ -3,7 +3,12 @@
3
3
  /// <reference types="isaac-typescript-definitions" />
4
4
  /// <reference types="isaac-typescript-definitions" />
5
5
  export declare function anyEntityCloserThan(entities: Entity[], position: Vector, distance: int): boolean;
6
- /** Iterates over all players and checks if any player is close enough to the specified position. */
6
+ /**
7
+ * Iterates over all players and checks if any player is close enough to the specified position.
8
+ *
9
+ * Note that this function does not consider players with a non-undefined parent, since they are not
10
+ * real players (e.g. the Strawman Keeper).
11
+ */
7
12
  export declare function anyPlayerCloserThan(position: Vector, distance: float): boolean;
8
13
  /**
9
14
  * Helper function to get a room position that is not overlapping with a grid entity, a heaven door,
@@ -1 +1 @@
1
- {"version":3,"file":"positionVelocity.d.ts","sourceRoot":"","sources":["../../src/functions/positionVelocity.ts"],"names":[],"mappings":";;;;AAaA,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAAE,EAClB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,GAAG,GACZ,OAAO,CAIT;AAED,oGAAoG;AACpG,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,KAAK,GACd,OAAO,CAKT;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,gBAAgB,EAAE,MAAM,EACxB,mBAAmB,UAAQ,GAC1B,MAAM,CAiCR;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAY5E;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAY7E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,eAAe,EAAE,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,EACrC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAClB,IAAI,CAYN;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,gBAAgB,EAAE,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,EACtC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAClB,IAAI,CAYN"}
1
+ {"version":3,"file":"positionVelocity.d.ts","sourceRoot":"","sources":["../../src/functions/positionVelocity.ts"],"names":[],"mappings":";;;;AAaA,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAAE,EAClB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,GAAG,GACZ,OAAO,CAIT;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,KAAK,GACd,OAAO,CAKT;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,gBAAgB,EAAE,MAAM,EACxB,mBAAmB,UAAQ,GAC1B,MAAM,CAiCR;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAY5E;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAY7E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,eAAe,EAAE,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,EACrC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAClB,IAAI,CAYN;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,gBAAgB,EAAE,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,EACtC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAClB,IAAI,CAYN"}
@@ -26,6 +26,9 @@ function ____exports.anyEntityCloserThan(self, entities, position, distance)
26
26
  )
27
27
  end
28
28
  --- Iterates over all players and checks if any player is close enough to the specified position.
29
+ --
30
+ -- Note that this function does not consider players with a non-undefined parent, since they are not
31
+ -- real players (e.g. the Strawman Keeper).
29
32
  function ____exports.anyPlayerCloserThan(self, position, distance)
30
33
  local players = getPlayers(nil)
31
34
  return __TS__ArraySome(
package/dist/index.d.ts CHANGED
@@ -16,6 +16,7 @@ import { CoinSubType } from 'isaac-typescript-definitions';
16
16
  import { CollectiblePedestalType } from 'isaac-typescript-definitions';
17
17
  import { CollectibleType } from 'isaac-typescript-definitions';
18
18
  import { Controller } from 'isaac-typescript-definitions';
19
+ import { ControllerIndex } from 'isaac-typescript-definitions';
19
20
  import { CrawlSpaceVariant } from 'isaac-typescript-definitions';
20
21
  import { DamageFlag } from 'isaac-typescript-definitions';
21
22
  import { DiceFloorSubType } from 'isaac-typescript-definitions';
@@ -347,7 +348,12 @@ export declare function anyEntityCloserThan(entities: Entity[], position: Vector
347
348
  */
348
349
  export declare type AnyGridEntity = GridEntity | GridEntityDoor | GridEntityPit | GridEntityPoop | GridEntityPressurePlate | GridEntityRock | GridEntitySpikes | GridEntityTNT;
349
350
 
350
- /** Iterates over all players and checks if any player is close enough to the specified position. */
351
+ /**
352
+ * Iterates over all players and checks if any player is close enough to the specified position.
353
+ *
354
+ * Note that this function does not consider players with a non-undefined parent, since they are not
355
+ * real players (e.g. the Strawman Keeper).
356
+ */
351
357
  export declare function anyPlayerCloserThan(position: Vector, distance: float): boolean;
352
358
 
353
359
  export declare function anyPlayerHasCollectible(collectibleType: CollectibleType): boolean;
@@ -542,7 +548,12 @@ export declare const AZAZEL_DEFAULT_BRIMSTONE_DISTANCE = 75.125;
542
548
  /**
543
549
  * Helper function to benchmark the performance of a function.
544
550
  *
545
- * This function is variadic, which means that you can supply as many as you want to benchmark.
551
+ * This function is variadic, which means that you can supply as many functions as you want to
552
+ * benchmark.
553
+ *
554
+ * This function uses the `Isaac.GetTime` method to record how long the function took to execute.
555
+ * This method only reports time in milliseconds. For this reason, if you are benchmarking smaller
556
+ * functions, then you should provide a very high value for the number of trials.
546
557
  *
547
558
  * @returns An array containing the average time in milliseconds for each function. (This will also
548
559
  * be printed to the log.)
@@ -851,7 +862,10 @@ export declare function combineArrays<T>(...arrays: Array<T[] | readonly T[]>):
851
862
  */
852
863
  export declare function combineSets<T>(...sets: Array<Set<T> | ReadonlySet<T>>): Set<T>;
853
864
 
854
- /** Helper function to get the enum name for the specified `Controller` value. */
865
+ /**
866
+ * Helper function to get the enum name for the specified `Controller` value. Note that this will
867
+ * trim off the "BUTTON_" prefix.
868
+ */
855
869
  export declare function controllerToString(controller: Controller): string | undefined;
856
870
 
857
871
  export declare type ConversionHeartSubType = HeartSubType.SOUL | HeartSubType.BLACK;
@@ -1477,10 +1491,13 @@ export declare interface CustomStageTSConfig {
1477
1491
  * `deepCopy` is a semi-generic deep cloner. It will recursively copy all of the values so that none
1478
1492
  * of the nested references remain.
1479
1493
  *
1480
- * It supports the following object types:
1494
+ * `deepCopy` is used by the IsaacScript save data manager to make a backup of your variables, so
1495
+ * that it can restore them to the default values at the beginning of a new room, floor, or run.
1496
+ *
1497
+ * `deepCopy` supports the following object types:
1481
1498
  *
1482
1499
  * - Primitives (i.e. strings, numbers, and booleans)
1483
- * - Basic TSTL objects / tables
1500
+ * - Basic TSTL objects (which are the same thing as Lua tables)
1484
1501
  * - TSTL `Map`
1485
1502
  * - TSTL `Set`
1486
1503
  * - TSTL classes
@@ -2990,12 +3007,11 @@ export declare function getEntityFields(entity: Entity): LuaMap<string, boolean
2990
3007
  */
2991
3008
  export declare function getEntityFromPtrHash(ptrHash: PtrHash): Entity | undefined;
2992
3009
 
2993
- /** Helper function to return a string containing the entity's type, variant, and sub-type. */
3010
+ /** Helper function to get a string containing the entity's type, variant, and sub-type. */
2994
3011
  export declare function getEntityID(entity: Entity): string;
2995
3012
 
2996
3013
  /**
2997
- * Helper function to return a formatted string in the format returned by the `getEntityID`
2998
- * function.
3014
+ * Helper function to get a formatted string in the format returned by the `getEntityID` function.
2999
3015
  */
3000
3016
  export declare function getEntityIDFromConstituents(entityType: EntityType, variant: int, subType: int): string;
3001
3017
 
@@ -3249,11 +3265,11 @@ export declare function getGridEntitiesExcept(...gridEntityTypes: GridEntityType
3249
3265
  */
3250
3266
  export declare function getGridEntitiesMap(...gridEntityTypes: GridEntityType[]): Map<int, GridEntity>;
3251
3267
 
3252
- /** Helper function to return a string containing the grid entity's type and variant. */
3268
+ /** Helper function to get a string containing the grid entity's type and variant. */
3253
3269
  export declare function getGridEntityID(gridEntity: GridEntity): string;
3254
3270
 
3255
3271
  /**
3256
- * Helper function to return a formatted string in the format returned by the `getGridEntityID`
3272
+ * Helper function to get a formatted string in the format returned by the `getGridEntityID`
3257
3273
  * function.
3258
3274
  */
3259
3275
  export declare function getGridEntityIDFromConstituents(gridEntityType: GridEntityType, variant: int): string;
@@ -4139,6 +4155,16 @@ export declare function getPlayers(performCharacterExclusions?: boolean): Entity
4139
4155
  */
4140
4156
  export declare function getPlayersOfType(...characters: PlayerType[]): EntityPlayer[];
4141
4157
 
4158
+ /**
4159
+ * Helper function to get all of the players that match the provided controller index. This function
4160
+ * returns an array of players because it is possible that there is more than one player with the
4161
+ * same controller index (e.g. Jacob & Esau).
4162
+ *
4163
+ * Note that this function includes players with a non-undefined parent like e.g. the Strawman
4164
+ * Keeper.
4165
+ */
4166
+ export declare function getPlayersOnKeyboard(): EntityPlayer[];
4167
+
4142
4168
  /**
4143
4169
  * Returns the number of soul hearts that the player has, excluding any black hearts. For example,
4144
4170
  * if the player has one full black heart, one full soul heart, and one half black heart, this
@@ -4160,6 +4186,16 @@ export declare function getPlayerStat<T extends StatType>(player: EntityPlayer,
4160
4186
  */
4161
4187
  export declare function getPlayersWithCollectible(...collectibleTypes: CollectibleType[]): EntityPlayer[];
4162
4188
 
4189
+ /**
4190
+ * Helper function to get all of the players that match the provided controller index. This function
4191
+ * returns an array of players because it is possible that there is more than one player with the
4192
+ * same controller index (e.g. Jacob & Esau).
4193
+ *
4194
+ * Note that this function includes players with a non-undefined parent like e.g. the Strawman
4195
+ * Keeper.
4196
+ */
4197
+ export declare function getPlayersWithControllerIndex(controllerIndex: ControllerIndex): EntityPlayer[];
4198
+
4163
4199
  /**
4164
4200
  * Helper function to get only the players that have a certain trinket.
4165
4201
  *
@@ -5424,7 +5460,21 @@ export declare function inDoubleTrouble(): boolean;
5424
5460
 
5425
5461
  export declare function inGenesisRoom(): boolean;
5426
5462
 
5427
- /** Initializes an array with all elements containing the specified default value. */
5463
+ /**
5464
+ * Initializes an array with all of the elements containing the specified default value.
5465
+ *
5466
+ * If the provided default value is not a boolean, number, or string, then it will be copied with
5467
+ * the `deepCopy` function before adding it to the new array. In this way, you can initialize an
5468
+ * array of arrays, or an array of maps, and so on. (If the `deepCopy` function was not used, then
5469
+ * all of the array elements would just be references to the same underlying data structure.)
5470
+ *
5471
+ * For example:
5472
+ *
5473
+ * ```ts
5474
+ * const arrayWithZeroes = initArray(0, 10); // Has 10 elements of 0.
5475
+ * const arrayWithArrays = initArray([0], 20); // Has 20 elements of an array with a 0 in it.
5476
+ * ```
5477
+ */
5428
5478
  export declare function initArray<T>(defaultValue: T, size: int): T[];
5429
5479
 
5430
5480
  /**
@@ -6454,6 +6504,11 @@ export declare function kColorEquals(kColor1: KColor, kColor2: KColor): boolean;
6454
6504
 
6455
6505
  /**
6456
6506
  * Helper function to get the string that would be typed if someone pressed the corresponding key.
6507
+ * This is useful for creating in-game chat.
6508
+ *
6509
+ * Note that this function will only work for the keyboard values that are printable. Thus, it will
6510
+ * return undefined for e.g. `Keyboard.LEFT_SHIFT` (340). If all you want is the corresponding name
6511
+ * of the key, then simply use the enum reverse mapping (e.g. `Keyboard[keyboard]`).
6457
6512
  */
6458
6513
  export declare function keyboardToString(keyboard: Keyboard, uppercase: boolean): string | undefined;
6459
6514
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;A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cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,mBAAmB,CAAC"}
package/dist/index.lua CHANGED
@@ -687,6 +687,14 @@ do
687
687
  end
688
688
  end
689
689
  end
690
+ do
691
+ local ____export = require("functions.initArray")
692
+ for ____exportKey, ____exportValue in pairs(____export) do
693
+ if ____exportKey ~= "default" then
694
+ ____exports[____exportKey] = ____exportValue
695
+ end
696
+ end
697
+ end
690
698
  do
691
699
  local ____export = require("functions.input")
692
700
  for ____exportKey, ____exportValue in pairs(____export) do
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "9.11.1",
3
+ "version": "9.13.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -10,7 +10,7 @@ import {
10
10
  } from "isaac-typescript-definitions";
11
11
  import { game } from "../core/cachedClasses";
12
12
  import { saveDataManager } from "../features/saveDataManager/exports";
13
- import { getPlayers } from "../functions/playerIndex";
13
+ import { getPlayersWithControllerIndex } from "../functions/players";
14
14
  import {
15
15
  postEsauJrFire,
16
16
  postEsauJrHasSubscriptions,
@@ -65,8 +65,12 @@ function postUpdate() {
65
65
  if (v.run.usedEsauJrControllerIndex === null) {
66
66
  return;
67
67
  }
68
- const player = getPlayerWithControllerIndex(v.run.usedEsauJrControllerIndex);
68
+ const players = getPlayersWithControllerIndex(
69
+ v.run.usedEsauJrControllerIndex,
70
+ );
69
71
  v.run.usedEsauJrControllerIndex = null;
72
+
73
+ const player = players[0];
70
74
  if (player === undefined) {
71
75
  return;
72
76
  }
@@ -79,11 +83,6 @@ function postUpdate() {
79
83
  postEsauJrFire(player);
80
84
  }
81
85
 
82
- function getPlayerWithControllerIndex(controllerIndex: ControllerIndex) {
83
- const players = getPlayers();
84
- return players.find((player) => player.ControllerIndex === controllerIndex);
85
- }
86
-
87
86
  // ModCallback.POST_USE_ITEM (3)
88
87
  // CollectibleType.ESAU_JR (703)
89
88
  function useItemEsauJr(
@@ -1,7 +1,7 @@
1
1
  import { getRandomInt } from "./random";
2
2
  import { getRandomSeed, isRNG, newRNG } from "./rng";
3
3
  import { isNumber, isTable } from "./types";
4
- import { erange, repeat } from "./utils";
4
+ import { erange } from "./utils";
5
5
 
6
6
  /**
7
7
  * Helper function for determining if two arrays contain the exact same elements. Note that this
@@ -399,16 +399,6 @@ export function getRandomArrayIndex<T>(
399
399
  return getRandomInt(0, array.length - 1, seedOrRNG, exceptions);
400
400
  }
401
401
 
402
- /** Initializes an array with all elements containing the specified default value. */
403
- export function initArray<T>(defaultValue: T, size: int): T[] {
404
- const array: T[] = [];
405
- repeat(size, () => {
406
- array.push(defaultValue);
407
- });
408
-
409
- return array;
410
- }
411
-
412
402
  /**
413
403
  * Since Lua uses tables for every non-primitive data structure, it is non-trivial to determine if a
414
404
  * particular table is being used as an array. `isArray` returns true if:
@@ -3,7 +3,12 @@ import { log } from "./log";
3
3
  /**
4
4
  * Helper function to benchmark the performance of a function.
5
5
  *
6
- * This function is variadic, which means that you can supply as many as you want to benchmark.
6
+ * This function is variadic, which means that you can supply as many functions as you want to
7
+ * benchmark.
8
+ *
9
+ * This function uses the `Isaac.GetTime` method to record how long the function took to execute.
10
+ * This method only reports time in milliseconds. For this reason, if you are benchmarking smaller
11
+ * functions, then you should provide a very high value for the number of trials.
7
12
  *
8
13
  * @returns An array containing the average time in milliseconds for each function. (This will also
9
14
  * be printed to the log.)
@@ -34,10 +34,13 @@ const COPYABLE_ISAAC_API_CLASS_TYPES_SET = new Set<string>(
34
34
  * `deepCopy` is a semi-generic deep cloner. It will recursively copy all of the values so that none
35
35
  * of the nested references remain.
36
36
  *
37
- * It supports the following object types:
37
+ * `deepCopy` is used by the IsaacScript save data manager to make a backup of your variables, so
38
+ * that it can restore them to the default values at the beginning of a new room, floor, or run.
39
+ *
40
+ * `deepCopy` supports the following object types:
38
41
  *
39
42
  * - Primitives (i.e. strings, numbers, and booleans)
40
- * - Basic TSTL objects / tables
43
+ * - Basic TSTL objects (which are the same thing as Lua tables)
41
44
  * - TSTL `Map`
42
45
  * - TSTL `Set`
43
46
  * - TSTL classes
@@ -204,14 +204,13 @@ export function getEntityFromPtrHash(ptrHash: PtrHash): Entity | undefined {
204
204
  return entities.find((entity) => GetPtrHash(entity) === ptrHash);
205
205
  }
206
206
 
207
- /** Helper function to return a string containing the entity's type, variant, and sub-type. */
207
+ /** Helper function to get a string containing the entity's type, variant, and sub-type. */
208
208
  export function getEntityID(entity: Entity): string {
209
209
  return `${entity.Type}.${entity.Variant}.${entity.SubType}`;
210
210
  }
211
211
 
212
212
  /**
213
- * Helper function to return a formatted string in the format returned by the `getEntityID`
214
- * function.
213
+ * Helper function to get a formatted string in the format returned by the `getEntityID` function.
215
214
  */
216
215
  export function getEntityIDFromConstituents(
217
216
  entityType: EntityType,
@@ -226,7 +226,7 @@ export function getGridEntitiesMap(
226
226
  return gridEntityMap;
227
227
  }
228
228
 
229
- /** Helper function to return a string containing the grid entity's type and variant. */
229
+ /** Helper function to get a string containing the grid entity's type and variant. */
230
230
  export function getGridEntityID(gridEntity: GridEntity): string {
231
231
  const gridEntityType = gridEntity.GetType();
232
232
  const variant = gridEntity.GetVariant();
@@ -234,7 +234,7 @@ export function getGridEntityID(gridEntity: GridEntity): string {
234
234
  }
235
235
 
236
236
  /**
237
- * Helper function to return a formatted string in the format returned by the `getGridEntityID`
237
+ * Helper function to get a formatted string in the format returned by the `getGridEntityID`
238
238
  * function.
239
239
  */
240
240
  export function getGridEntityIDFromConstituents(
@@ -0,0 +1,32 @@
1
+ import { deepCopy } from "./deepCopy";
2
+ import { isPrimitive } from "./types";
3
+ import { repeat } from "./utils";
4
+
5
+ /**
6
+ * Initializes an array with all of the elements containing the specified default value.
7
+ *
8
+ * If the provided default value is not a boolean, number, or string, then it will be copied with
9
+ * the `deepCopy` function before adding it to the new array. In this way, you can initialize an
10
+ * array of arrays, or an array of maps, and so on. (If the `deepCopy` function was not used, then
11
+ * all of the array elements would just be references to the same underlying data structure.)
12
+ *
13
+ * For example:
14
+ *
15
+ * ```ts
16
+ * const arrayWithZeroes = initArray(0, 10); // Has 10 elements of 0.
17
+ * const arrayWithArrays = initArray([0], 20); // Has 20 elements of an array with a 0 in it.
18
+ * ```
19
+ */
20
+ export function initArray<T>(defaultValue: T, size: int): T[] {
21
+ const array: T[] = [];
22
+ repeat(size, () => {
23
+ if (isPrimitive(defaultValue)) {
24
+ array.push(defaultValue);
25
+ } else {
26
+ const copy = deepCopy(defaultValue) as T;
27
+ array.push(copy);
28
+ }
29
+ });
30
+
31
+ return array;
32
+ }
@@ -41,7 +41,10 @@ const SHOOTING_ACTIONS_SET: ReadonlySet<ButtonAction> = new Set(
41
41
  SHOOTING_ACTIONS,
42
42
  );
43
43
 
44
- /** Helper function to get the enum name for the specified `Controller` value. */
44
+ /**
45
+ * Helper function to get the enum name for the specified `Controller` value. Note that this will
46
+ * trim off the "BUTTON_" prefix.
47
+ */
45
48
  export function controllerToString(controller: Controller): string | undefined {
46
49
  const key = Controller[controller];
47
50
  if (key === undefined) {
@@ -135,6 +138,11 @@ export function isShootActionTriggeredOnAnyInput(): boolean {
135
138
 
136
139
  /**
137
140
  * Helper function to get the string that would be typed if someone pressed the corresponding key.
141
+ * This is useful for creating in-game chat.
142
+ *
143
+ * Note that this function will only work for the keyboard values that are printable. Thus, it will
144
+ * return undefined for e.g. `Keyboard.LEFT_SHIFT` (340). If all you want is the corresponding name
145
+ * of the key, then simply use the enum reverse mapping (e.g. `Keyboard[keyboard]`).
138
146
  */
139
147
  export function keyboardToString(
140
148
  keyboard: Keyboard,
@@ -47,7 +47,7 @@ export function getOtherPlayers(player: EntityPlayer): EntityPlayer[] {
47
47
  export function getPlayerFromIndex(
48
48
  playerIndex: PlayerIndex,
49
49
  ): EntityPlayer | undefined {
50
- const players = getPlayers();
50
+ const players = getAllPlayers();
51
51
  return players.find((player) => getPlayerIndex(player) === playerIndex);
52
52
  }
53
53
 
@@ -2,6 +2,7 @@ import {
2
2
  ActiveSlot,
3
3
  Challenge,
4
4
  CollectibleType,
5
+ ControllerIndex,
5
6
  FamiliarVariant,
6
7
  NullItemID,
7
8
  PlayerForm,
@@ -347,6 +348,21 @@ export function getPlayersOfType(...characters: PlayerType[]): EntityPlayer[] {
347
348
  });
348
349
  }
349
350
 
351
+ /**
352
+ * Helper function to get all of the players that match the provided controller index. This function
353
+ * returns an array of players because it is possible that there is more than one player with the
354
+ * same controller index (e.g. Jacob & Esau).
355
+ *
356
+ * Note that this function includes players with a non-undefined parent like e.g. the Strawman
357
+ * Keeper.
358
+ */
359
+ export function getPlayersOnKeyboard(): EntityPlayer[] {
360
+ const players = getAllPlayers();
361
+ return players.filter(
362
+ (player) => player.ControllerIndex === ControllerIndex.KEYBOARD,
363
+ );
364
+ }
365
+
350
366
  /**
351
367
  * Helper function to get only the players that have a certain collectible.
352
368
  *
@@ -364,6 +380,21 @@ export function getPlayersWithCollectible(
364
380
  );
365
381
  }
366
382
 
383
+ /**
384
+ * Helper function to get all of the players that match the provided controller index. This function
385
+ * returns an array of players because it is possible that there is more than one player with the
386
+ * same controller index (e.g. Jacob & Esau).
387
+ *
388
+ * Note that this function includes players with a non-undefined parent like e.g. the Strawman
389
+ * Keeper.
390
+ */
391
+ export function getPlayersWithControllerIndex(
392
+ controllerIndex: ControllerIndex,
393
+ ): EntityPlayer[] {
394
+ const players = getAllPlayers();
395
+ return players.filter((player) => player.ControllerIndex === controllerIndex);
396
+ }
397
+
367
398
  /**
368
399
  * Helper function to get only the players that have a certain trinket.
369
400
  *
@@ -21,7 +21,12 @@ export function anyEntityCloserThan(
21
21
  );
22
22
  }
23
23
 
24
- /** Iterates over all players and checks if any player is close enough to the specified position. */
24
+ /**
25
+ * Iterates over all players and checks if any player is close enough to the specified position.
26
+ *
27
+ * Note that this function does not consider players with a non-undefined parent, since they are not
28
+ * real players (e.g. the Strawman Keeper).
29
+ */
25
30
  export function anyPlayerCloserThan(
26
31
  position: Vector,
27
32
  distance: float,
package/src/index.ts CHANGED
@@ -84,6 +84,7 @@ export * from "./functions/globals";
84
84
  export * from "./functions/gridEntities";
85
85
  export * from "./functions/gridEntitiesSpecific";
86
86
  export * from "./functions/hex";
87
+ export * from "./functions/initArray";
87
88
  export * from "./functions/input";
88
89
  export * from "./functions/isaacAPIClass";
89
90
  export * from "./functions/itemPool";