isaacscript-common 1.2.100 → 1.2.101

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.
@@ -6,10 +6,11 @@ local ____exports = {}
6
6
  local hasSubscriptions, postPEffectUpdateReordered, getCurrentHealthValue, v
7
7
  local ____exports = require("features.saveDataManager.exports")
8
8
  local saveDataManager = ____exports.saveDataManager
9
- local ____bitwise = require("functions.bitwise")
10
- local countSetBits = ____bitwise.countSetBits
11
9
  local ____player = require("functions.player")
10
+ local getBlackHearts = ____player.getBlackHearts
11
+ local getHearts = ____player.getHearts
12
12
  local getPlayerIndex = ____player.getPlayerIndex
13
+ local getSoulHearts = ____player.getSoulHearts
13
14
  local ____utils = require("functions.utils")
14
15
  local ensureAllCases = ____utils.ensureAllCases
15
16
  local getEnumValues = ____utils.getEnumValues
@@ -47,19 +48,13 @@ function getCurrentHealthValue(self, player, healthType)
47
48
  local ____cond11 = ____switch11 == HealthType.RED
48
49
  if ____cond11 then
49
50
  do
50
- local rottenHearts = player:GetRottenHearts()
51
- local hearts = player:GetHearts()
52
- return hearts - rottenHearts * 2
51
+ return getHearts(nil, player)
53
52
  end
54
53
  end
55
54
  ____cond11 = ____cond11 or ____switch11 == HealthType.SOUL
56
55
  if ____cond11 then
57
56
  do
58
- local soulHearts = player:GetSoulHearts()
59
- local blackHeartsBitmask = player:GetBlackHearts()
60
- local blackHeartsBits = countSetBits(nil, blackHeartsBitmask)
61
- local blackHearts = blackHeartsBits * 2
62
- return soulHearts - blackHearts
57
+ return getSoulHearts(nil, player)
63
58
  end
64
59
  end
65
60
  ____cond11 = ____cond11 or ____switch11 == HealthType.ETERNAL
@@ -71,10 +66,7 @@ function getCurrentHealthValue(self, player, healthType)
71
66
  ____cond11 = ____cond11 or ____switch11 == HealthType.BLACK
72
67
  if ____cond11 then
73
68
  do
74
- local blackHeartsBitmask = player:GetBlackHearts()
75
- local blackHeartsBits = countSetBits(nil, blackHeartsBitmask)
76
- local blackHearts = blackHeartsBits * 2
77
- return blackHearts
69
+ return getBlackHearts(nil, player)
78
70
  end
79
71
  end
80
72
  ____cond11 = ____cond11 or ____switch11 == HealthType.GOLDEN
@@ -9,8 +9,8 @@ local ____exports = {}
9
9
  local hasSubscriptions, postUpdate, checkPickupsPurchased, getPlayerThatIsNoLongerHoldingAnItem, storePickupsInMap, storePlayersInMap, pickupAtIndexStillExists, v
10
10
  local ____exports = require("features.saveDataManager.exports")
11
11
  local saveDataManager = ____exports.saveDataManager
12
- local ____entity = require("functions.entity")
13
- local getPickups = ____entity.getPickups
12
+ local ____pickups = require("functions.pickups")
13
+ local getPickups = ____pickups.getPickups
14
14
  local ____player = require("functions.player")
15
15
  local getPlayerIndex = ____player.getPlayerIndex
16
16
  local getPlayers = ____player.getPlayers
@@ -11,7 +11,6 @@ local ____errors = require("errors")
11
11
  local getUpgradeErrorMsg = ____errors.getUpgradeErrorMsg
12
12
  local ____entity = require("functions.entity")
13
13
  local removeAllMatchingEntities = ____entity.removeAllMatchingEntities
14
- local removeAllPickups = ____entity.removeAllPickups
15
14
  local ____entitySpecific = require("functions.entitySpecific")
16
15
  local removeAllBombs = ____entitySpecific.removeAllBombs
17
16
  local ____gridEntity = require("functions.gridEntity")
@@ -28,6 +27,8 @@ local ____math = require("functions.math")
28
27
  local range = ____math.range
29
28
  local ____npc = require("functions.npc")
30
29
  local getNPCs = ____npc.getNPCs
30
+ local ____pickups = require("functions.pickups")
31
+ local removeAllPickups = ____pickups.removeAllPickups
31
32
  local ____random = require("functions.random")
32
33
  local nextSeed = ____random.nextSeed
33
34
  local ____rooms = require("functions.rooms")
@@ -1,5 +1,7 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
- require("lualib_bundle");
2
+ local ____lualib = require("lualib_bundle")
3
+ local Set = ____lualib.Set
4
+ local __TS__New = ____lualib.__TS__New
3
5
  local ____exports = {}
4
6
  local postPEffectUpdate, FLAGS_WHEN_PONY_IS_ACTIVE, v
5
7
  local ____errors = require("errors")
@@ -8,11 +8,11 @@ local ____collectibleDescriptionMap = require("maps.collectibleDescriptionMap")
8
8
  local COLLECTIBLE_DESCRIPTION_MAP = ____collectibleDescriptionMap.COLLECTIBLE_DESCRIPTION_MAP
9
9
  local ____collectibleNameMap = require("maps.collectibleNameMap")
10
10
  local COLLECTIBLE_NAME_MAP = ____collectibleNameMap.COLLECTIBLE_NAME_MAP
11
- local ____entity = require("functions.entity")
12
- local getPickups = ____entity.getPickups
13
- local removeAllPickups = ____entity.removeAllPickups
14
11
  local ____flag = require("functions.flag")
15
12
  local hasFlag = ____flag.hasFlag
13
+ local ____pickups = require("functions.pickups")
14
+ local getPickups = ____pickups.getPickups
15
+ local removeAllPickups = ____pickups.removeAllPickups
16
16
  local ____sprite = require("functions.sprite")
17
17
  local clearSprite = ____sprite.clearSprite
18
18
  function ____exports.setCollectibleSprite(self, collectible, pngPath)
@@ -42,18 +42,6 @@ export declare function getFilteredNewEntities<T extends AnyEntity>(oldEntities:
42
42
  * returned. False by default. Will only be taken into account if `matchingEntityType` is specified.
43
43
  */
44
44
  export declare function getEntities(matchingEntityType?: EntityType | int, matchingVariant?: number, matchingSubType?: number, ignoreFriendly?: boolean): Entity[];
45
- /**
46
- * Helper function to get all of the pickups in the room.
47
- *
48
- * Example:
49
- * ```
50
- * // Make all of the pickups in the room invisible
51
- * for (const pickup of getPickups()) {
52
- * pickup.Visible = false;
53
- * }
54
- * ```
55
- */
56
- export declare function getPickups(matchingVariant?: PickupVariant | int, matchingSubType?: number): EntityPickup[];
57
45
  /**
58
46
  * Helper function to measure an entity's velocity to see if it is moving.
59
47
  *
@@ -87,15 +75,6 @@ export declare function removeEntities(entities: Entity[], cap?: int): boolean;
87
75
  * @returns True if one or more entities was removed, false otherwise.
88
76
  */
89
77
  export declare function removeAllMatchingEntities(entityType: int, entityVariant?: number, entitySubType?: number, cap?: int | undefined): boolean;
90
- /**
91
- * Helper function to remove all of the pickups in the room.
92
- *
93
- * @param variant Optional. If specified, will only remove pickups that match this variant.
94
- * @param subType Optional. If specified, will only remove pickups that match this sub-type.
95
- * @param cap Optional. If specified, will only remove the given amount of pickups.
96
- * @returns True if one or more pickups was removed, false otherwise.
97
- */
98
- export declare function removeAllPickups(variant?: PickupVariant | int, subType?: int, cap?: int): boolean;
99
78
  /**
100
79
  * Helper function to reroll an enemy. Use this instead of the vanilla "Game.RerollEnemy" function
101
80
  * if you want the rerolled enemy to be returned.
@@ -63,23 +63,6 @@ function ____exports.getEntities(self, matchingEntityType, matchingVariant, matc
63
63
  end
64
64
  return Isaac.FindByType(matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
65
65
  end
66
- function ____exports.getPickups(self, matchingVariant, matchingSubType)
67
- if matchingVariant == nil then
68
- matchingVariant = -1
69
- end
70
- if matchingSubType == nil then
71
- matchingSubType = -1
72
- end
73
- local entities = ____exports.getEntities(nil, EntityType.ENTITY_PICKUP, matchingVariant, matchingSubType)
74
- local pickups = {}
75
- for ____, entity in ipairs(entities) do
76
- local pickup = entity:ToPickup()
77
- if pickup ~= nil then
78
- __TS__ArrayPush(pickups, pickup)
79
- end
80
- end
81
- return pickups
82
- end
83
66
  function ____exports.isEntityMoving(self, entity, threshold)
84
67
  if threshold == nil then
85
68
  threshold = 0.01
@@ -116,10 +99,6 @@ function ____exports.removeAllMatchingEntities(self, entityType, entityVariant,
116
99
  local entities = ____exports.getEntities(nil, entityType, entityVariant, entitySubType)
117
100
  return ____exports.removeEntities(nil, entities, cap)
118
101
  end
119
- function ____exports.removeAllPickups(self, variant, subType, cap)
120
- local pickups = ____exports.getPickups(nil, variant, subType)
121
- return ____exports.removeEntities(nil, pickups, cap)
122
- end
123
102
  function ____exports.rerollEnemy(self, entity)
124
103
  local game = Game()
125
104
  local oldEntities = ____exports.getEntities(nil)
@@ -1,4 +1,16 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
+ /**
3
+ * Helper function to get all of the pickups in the room.
4
+ *
5
+ * Example:
6
+ * ```
7
+ * // Make all of the pickups in the room invisible
8
+ * for (const pickup of getPickups()) {
9
+ * pickup.Visible = false;
10
+ * }
11
+ * ```
12
+ */
13
+ export declare function getPickups(matchingVariant?: PickupVariant | int, matchingSubType?: number): EntityPickup[];
2
14
  /**
3
15
  * Has as an equal chance of returning any value in the `HeartSubType` enum. Useful for spawning a random type of heart.
4
16
  *
@@ -7,3 +19,12 @@
7
19
  */
8
20
  export declare function getRandomHeartSubType(seed?: number, exceptions?: HeartSubType[]): HeartSubType;
9
21
  export declare function isChest(pickup: EntityPickup): boolean;
22
+ /**
23
+ * Helper function to remove all of the pickups in the room.
24
+ *
25
+ * @param variant Optional. If specified, will only remove pickups that match this variant.
26
+ * @param subType Optional. If specified, will only remove pickups that match this sub-type.
27
+ * @param cap Optional. If specified, will only remove the given amount of pickups.
28
+ * @returns True if one or more pickups was removed, false otherwise.
29
+ */
30
+ export declare function removeAllPickups(variant?: PickupVariant | int, subType?: int, cap?: int): boolean;
@@ -1,11 +1,33 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____lualib = require("lualib_bundle")
3
+ local __TS__ArrayPush = ____lualib.__TS__ArrayPush
2
4
  local ____exports = {}
3
5
  local ____constants = require("constants")
4
6
  local CHEST_PICKUP_VARIANTS = ____constants.CHEST_PICKUP_VARIANTS
5
7
  local ____array = require("functions.array")
6
8
  local getRandomArrayElement = ____array.getRandomArrayElement
9
+ local ____entity = require("functions.entity")
10
+ local getEntities = ____entity.getEntities
11
+ local removeEntities = ____entity.removeEntities
7
12
  local ____utils = require("functions.utils")
8
13
  local getEnumValues = ____utils.getEnumValues
14
+ function ____exports.getPickups(self, matchingVariant, matchingSubType)
15
+ if matchingVariant == nil then
16
+ matchingVariant = -1
17
+ end
18
+ if matchingSubType == nil then
19
+ matchingSubType = -1
20
+ end
21
+ local entities = getEntities(nil, EntityType.ENTITY_PICKUP, matchingVariant, matchingSubType)
22
+ local pickups = {}
23
+ for ____, entity in ipairs(entities) do
24
+ local pickup = entity:ToPickup()
25
+ if pickup ~= nil then
26
+ __TS__ArrayPush(pickups, pickup)
27
+ end
28
+ end
29
+ return pickups
30
+ end
9
31
  function ____exports.getRandomHeartSubType(self, seed, exceptions)
10
32
  if seed == nil then
11
33
  seed = Random()
@@ -19,4 +41,8 @@ end
19
41
  function ____exports.isChest(self, pickup)
20
42
  return CHEST_PICKUP_VARIANTS:has(pickup.Variant)
21
43
  end
44
+ function ____exports.removeAllPickups(self, variant, subType, cap)
45
+ local pickups = ____exports.getPickups(nil, variant, subType)
46
+ return removeEntities(nil, pickups, cap)
47
+ end
22
48
  return ____exports
@@ -6,10 +6,10 @@ local ____trinketDescriptionMap = require("maps.trinketDescriptionMap")
6
6
  local TRINKET_DESCRIPTION_MAP = ____trinketDescriptionMap.TRINKET_DESCRIPTION_MAP
7
7
  local ____trinketNameMap = require("maps.trinketNameMap")
8
8
  local TRINKET_NAME_MAP = ____trinketNameMap.TRINKET_NAME_MAP
9
- local ____entity = require("functions.entity")
10
- local getPickups = ____entity.getPickups
11
9
  local ____flag = require("functions.flag")
12
10
  local hasFlag = ____flag.hasFlag
11
+ local ____pickups = require("functions.pickups")
12
+ local getPickups = ____pickups.getPickups
13
13
  local ____player = require("functions.player")
14
14
  local useActiveItemTemp = ____player.useActiveItemTemp
15
15
  local ____trinketGive = require("functions.trinketGive")
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export { deployJSONRoom, deployRandomJSONRoom, emptyRoom, } from "./features/dep
4
4
  export { disableAllInputs, disableAllInputsExceptFor, disableMovementInputs, disableShootingInputs, enableAllInputs, enableAllInputsExceptFor, } from "./features/disableInputs";
5
5
  export { forgottenSwitch } from "./features/forgottenSwitch";
6
6
  export { getCollectibleItemPoolType } from "./features/getCollectibleItemPoolType";
7
+ export * from "./features/isPonyActive";
7
8
  export { preventCollectibleRotate } from "./features/preventCollectibleRotate";
8
9
  export { runInNGameFrames, runInNRenderFrames, runNextGameFrame, runNextRenderFrame, } from "./features/runInNFrames";
9
10
  export * from "./features/saveDataManager/exports";
package/dist/index.lua CHANGED
@@ -49,6 +49,14 @@ do
49
49
  local getCollectibleItemPoolType = ____getCollectibleItemPoolType.getCollectibleItemPoolType
50
50
  ____exports.getCollectibleItemPoolType = getCollectibleItemPoolType
51
51
  end
52
+ do
53
+ local ____export = require("features.isPonyActive")
54
+ for ____exportKey, ____exportValue in pairs(____export) do
55
+ if ____exportKey ~= "default" then
56
+ ____exports[____exportKey] = ____exportValue
57
+ end
58
+ end
59
+ end
52
60
  do
53
61
  local ____preventCollectibleRotate = require("features.preventCollectibleRotate")
54
62
  local preventCollectibleRotate = ____preventCollectibleRotate.preventCollectibleRotate
@@ -79,6 +79,8 @@ local ____forgottenSwitch = require("features.forgottenSwitch")
79
79
  local forgottenSwitchInit = ____forgottenSwitch.forgottenSwitchInit
80
80
  local ____getCollectibleItemPoolType = require("features.getCollectibleItemPoolType")
81
81
  local getCollectibleItemPoolTypeInit = ____getCollectibleItemPoolType.getCollectibleItemPoolTypeInit
82
+ local ____isPonyActive = require("features.isPonyActive")
83
+ local isPonyActiveInit = ____isPonyActive.isPonyActiveInit
82
84
  local ____preventCollectibleRotate = require("features.preventCollectibleRotate")
83
85
  local preventCollectibleRotateInit = ____preventCollectibleRotate.preventCollectibleRotateInit
84
86
  local ____runInNFrames = require("features.runInNFrames")
@@ -137,6 +139,7 @@ function initFeatures(self, mod)
137
139
  preventCollectibleRotateInit(nil, mod)
138
140
  runInNFramesInit(nil, mod)
139
141
  sirenHelpersInit(nil, mod)
142
+ isPonyActiveInit(nil, mod)
140
143
  end
141
144
  function ____exports.upgradeMod(self, modVanilla, verbose)
142
145
  if verbose == nil then
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.100",
3
+ "version": "1.2.101",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",