isaacscript-common 1.0.329 → 1.0.330

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.
@@ -7,6 +7,8 @@ export declare function changeCollectibleSubType(collectible: EntityPickup, newC
7
7
  export declare function collectibleHasTag(collectibleType: CollectibleType | int, tag: ItemConfigTag): boolean;
8
8
  export declare function getCollectibleInitCharges(collectibleType: CollectibleType | int): int;
9
9
  export declare function getCollectibleMaxCharges(collectibleType: CollectibleType | int): int;
10
+ /** Returns a set containing every valid collectible type in the game, including modded items. */
11
+ export declare function getCollectibleSet(): Set<CollectibleType | int>;
10
12
  export declare function getMaxCollectibleID(): int;
11
13
  export declare function isQuestCollectible(collectibleType: CollectibleType | int): boolean;
12
14
  export declare function setCollectibleBlind(pickup: EntityPickup): void;
@@ -1,6 +1,11 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ require("lualib_bundle");
2
3
  local ____exports = {}
3
4
  local COLLECTIBLE_SPRITE_LAYER
5
+ function ____exports.getMaxCollectibleID(self)
6
+ local itemConfig = Isaac.GetItemConfig()
7
+ return itemConfig:GetCollectibles().Size - 1
8
+ end
4
9
  function ____exports.setCollectibleSprite(self, pickup, pngPath)
5
10
  if pickup.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
6
11
  error(
@@ -48,9 +53,20 @@ function ____exports.getCollectibleMaxCharges(self, collectibleType)
48
53
  end
49
54
  return itemConfigItem.MaxCharges
50
55
  end
51
- function ____exports.getMaxCollectibleID(self)
56
+ function ____exports.getCollectibleSet(self)
52
57
  local itemConfig = Isaac.GetItemConfig()
53
- return itemConfig:GetCollectibles().Size - 1
58
+ local collectibleSet = __TS__New(Set)
59
+ do
60
+ local collectibleType = 1
61
+ while collectibleType <= ____exports.getMaxCollectibleID(nil) do
62
+ local itemConfigItem = itemConfig:GetCollectible(collectibleType)
63
+ if itemConfigItem ~= nil then
64
+ collectibleSet:add(collectibleType)
65
+ end
66
+ collectibleType = collectibleType + 1
67
+ end
68
+ end
69
+ return collectibleSet
54
70
  end
55
71
  function ____exports.isQuestCollectible(self, collectibleType)
56
72
  return ____exports.collectibleHasTag(nil, collectibleType, 32768)
@@ -53,7 +53,7 @@ export declare function getPlayerCloserThan(position: Vector, distance: float):
53
53
  * Iterates over every item in the game and returns a map containing the number of each item that
54
54
  * the player has.
55
55
  */
56
- export declare function getPlayerCollectibleMap(player: EntityPlayer): Map<CollectibleType | int, int>;
56
+ export declare function getPlayerCollectibleMap(player: EntityPlayer, collectibleSet: Set<int>): Map<CollectibleType | int, int>;
57
57
  export declare function getPlayerFromIndex(playerIndex: PlayerIndex): EntityPlayer | undefined;
58
58
  /**
59
59
  * This function always excludes players with a non-undefined parent, since they are not real
@@ -3,8 +3,6 @@ require("lualib_bundle");
3
3
  local ____exports = {}
4
4
  local ____PocketItemType = require("types.PocketItemType")
5
5
  local PocketItemType = ____PocketItemType.default
6
- local ____util = require("functions.util")
7
- local getCollectibleSet = ____util.getCollectibleSet
8
6
  local EXCLUDED_CHARACTERS
9
7
  function ____exports.getPlayers(self, performExclusions)
10
8
  if performExclusions == nil then
@@ -154,9 +152,8 @@ function ____exports.getPlayerCloserThan(self, position, distance)
154
152
  end
155
153
  return nil
156
154
  end
157
- function ____exports.getPlayerCollectibleMap(self, player)
155
+ function ____exports.getPlayerCollectibleMap(self, player, collectibleSet)
158
156
  local collectibleMap = __TS__New(Map)
159
- local collectibleSet = getCollectibleSet(nil)
160
157
  for ____, collectibleType in __TS__Iterator(
161
158
  collectibleSet:values()
162
159
  ) do
@@ -49,13 +49,11 @@ function ____exports.getScreenCenter(self)
49
49
  return bottomRight / 2
50
50
  end
51
51
  function ____exports.getVisibleHearts(self, player)
52
- local maxHearts = math.max(
53
- player:GetEffectiveMaxHearts(),
54
- player:GetBoneHearts() * 2
55
- )
56
- local visibleHearts = math.ceil(
57
- (maxHearts + player:GetSoulHearts()) / 2
58
- )
52
+ local effectiveMaxHearts = player:GetEffectiveMaxHearts()
53
+ local soulHearts = player:GetSoulHearts()
54
+ local boneHearts = player:GetBoneHearts()
55
+ local maxHearts = math.max(effectiveMaxHearts, boneHearts * 2)
56
+ local visibleHearts = math.ceil((maxHearts + soulHearts) / 2)
59
57
  if visibleHearts < 1 then
60
58
  visibleHearts = 1
61
59
  end
@@ -45,8 +45,6 @@ export declare const ensureAllCases: (obj: never) => never;
45
45
  * https://isaacscript.github.io/docs/gotchas#iterating-over-enums
46
46
  */
47
47
  export declare function getEnumValues(transpiledEnum: unknown): int[];
48
- /** Returns a set containing every valid collectible type in the game, including modded items. */
49
- export declare function getCollectibleSet(): Set<CollectibleType | int>;
50
48
  /**
51
49
  * Converts a hex string like "#33aa33" to a KColor object.
52
50
  *
@@ -3,8 +3,6 @@ require("lualib_bundle");
3
3
  local ____exports = {}
4
4
  local ____constants = require("constants")
5
5
  local VECTOR_BRAND = ____constants.VECTOR_BRAND
6
- local ____collectibles = require("functions.collectibles")
7
- local getMaxCollectibleID = ____collectibles.getMaxCollectibleID
8
6
  local ____math = require("functions.math")
9
7
  local getAngleDifference = ____math.getAngleDifference
10
8
  local HEX_STRING_LENGTH = 6
@@ -19,21 +17,6 @@ function ____exports.getEnumValues(self, transpiledEnum)
19
17
  __TS__ArraySort(enumValues)
20
18
  return enumValues
21
19
  end
22
- function ____exports.getCollectibleSet(self)
23
- local itemConfig = Isaac.GetItemConfig()
24
- local collectibleSet = __TS__New(Set)
25
- do
26
- local collectibleType = 1
27
- while collectibleType <= getMaxCollectibleID(nil) do
28
- local itemConfigItem = itemConfig:GetCollectible(collectibleType)
29
- if itemConfigItem ~= nil then
30
- collectibleSet:add(collectibleType)
31
- end
32
- collectibleType = collectibleType + 1
33
- end
34
- end
35
- return collectibleSet
36
- end
37
20
  function ____exports.hexToKColor(self, hexString, alpha)
38
21
  hexString = __TS__StringReplace(hexString, "#", "")
39
22
  if #hexString ~= HEX_STRING_LENGTH then
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.329",
3
+ "version": "1.0.330",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -28,7 +28,7 @@
28
28
  "isaac-typescript-definitions": "^1.0.190",
29
29
  "isaacscript-lint": "^1.0.61",
30
30
  "ts-prune": "^0.10.1",
31
- "typedoc": "^0.22.4",
31
+ "typedoc": "^0.22.5",
32
32
  "typescript": "4.4.3",
33
33
  "typescript-to-lua": "^1.0.1"
34
34
  }