isaacscript-common 2.3.1 → 3.1.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/cachedClasses.d.ts +6 -4
- package/cachedClasses.lua +24 -0
- package/callbacks/customRevive.lua +2 -0
- package/callbacks/itemPickup.lua +2 -0
- package/callbacks/postBombInitLate.lua +2 -0
- package/callbacks/postBoneSwing.lua +2 -0
- package/callbacks/postCollectibleInitFirst.lua +2 -0
- package/callbacks/postCursedTeleport.lua +2 -0
- package/callbacks/postCustomDoorEnter.lua +44 -0
- package/callbacks/postDoorRender.lua +2 -0
- package/callbacks/postDoorUpdate.lua +2 -0
- package/callbacks/postEffectInitLate.lua +2 -0
- package/callbacks/postEffectStateChanged.lua +2 -0
- package/callbacks/postEsauJr.lua +2 -0
- package/callbacks/postFamiliarInitLate.lua +2 -0
- package/callbacks/postFamiliarStateChanged.lua +2 -0
- package/callbacks/postFlip.lua +2 -0
- package/callbacks/postGreedModeWave.lua +2 -0
- package/callbacks/postGridEntity.lua +2 -0
- package/callbacks/postGridEntityCollision.lua +2 -0
- package/callbacks/postGridEntityRender.lua +2 -0
- package/callbacks/postHolyMantleRemoved.lua +2 -0
- package/callbacks/postKnifeInitLate.lua +2 -0
- package/callbacks/postLaserInitLate.lua +2 -0
- package/callbacks/postNPCInitLate.lua +2 -0
- package/callbacks/postNPCStateChanged.lua +2 -0
- package/callbacks/postNewRoomEarly.lua +2 -0
- package/callbacks/postPickupCollect.lua +2 -0
- package/callbacks/postPickupInitLate.lua +2 -0
- package/callbacks/postPickupStateChanged.lua +2 -0
- package/callbacks/postPitRender.lua +2 -0
- package/callbacks/postPitUpdate.lua +2 -0
- package/callbacks/postPlayerChangeHealth.lua +2 -0
- package/callbacks/postPlayerChangeType.lua +2 -0
- package/callbacks/postPlayerFatalDamage.lua +2 -0
- package/callbacks/postPlayerInitLate.lua +2 -0
- package/callbacks/postPlayerReordered.lua +2 -0
- package/callbacks/postPoopRender.lua +2 -0
- package/callbacks/postPoopUpdate.lua +2 -0
- package/callbacks/postPressurePlateRender.lua +2 -0
- package/callbacks/postPressurePlateUpdate.lua +2 -0
- package/callbacks/postProjectileInitLate.lua +2 -0
- package/callbacks/postPurchase.lua +2 -0
- package/callbacks/postRockRender.lua +2 -0
- package/callbacks/postRockUpdate.lua +2 -0
- package/callbacks/postRoomClearChanged.lua +2 -0
- package/callbacks/postSacrifice.lua +2 -0
- package/callbacks/postSlotDestroyed.d.ts +1 -0
- package/callbacks/postSlotDestroyed.lua +66 -0
- package/callbacks/postSlotInitUpdate.lua +2 -0
- package/callbacks/postSlotRender.lua +5 -21
- package/callbacks/postSpikesRender.lua +2 -0
- package/callbacks/postSpikesUpdate.lua +2 -0
- package/callbacks/postTNTRender.lua +2 -0
- package/callbacks/postTNTUpdate.lua +2 -0
- package/callbacks/postTearInitLate.lua +2 -0
- package/callbacks/postTearInitVeryLate.lua +2 -0
- package/callbacks/postTransformation.lua +2 -0
- package/callbacks/postTrinketBreak.lua +2 -0
- package/callbacks/preBerserkDeath.lua +2 -0
- package/callbacks/preNewLevel.lua +2 -0
- package/callbacks/reorderedCallbacks.lua +16 -0
- package/callbacks/subscriptions/postBombInitLate.lua +6 -0
- package/callbacks/subscriptions/postBoneSwing.lua +6 -0
- package/callbacks/subscriptions/postCollectibleInitFirst.lua +6 -0
- package/callbacks/subscriptions/postCursedTeleport.lua +6 -0
- package/callbacks/subscriptions/postCustomDoorEnter.lua +6 -0
- package/callbacks/subscriptions/postCustomRevive.d.ts +1 -0
- package/callbacks/subscriptions/postCustomRevive.lua +6 -0
- package/callbacks/subscriptions/postDoorRender.d.ts +1 -0
- package/callbacks/subscriptions/postDoorRender.lua +6 -0
- package/callbacks/subscriptions/postDoorUpdate.d.ts +1 -0
- package/callbacks/subscriptions/postDoorUpdate.lua +6 -0
- package/callbacks/subscriptions/postEffectInitLate.lua +6 -0
- package/callbacks/subscriptions/postEffectStateChanged.lua +6 -0
- package/callbacks/subscriptions/postEsauJr.lua +6 -0
- package/callbacks/subscriptions/postFamiliarInitLate.lua +6 -0
- package/callbacks/subscriptions/postFamiliarStateChanged.lua +6 -0
- package/callbacks/subscriptions/postFirstEsauJr.lua +6 -0
- package/callbacks/subscriptions/postFirstFlip.lua +6 -0
- package/callbacks/subscriptions/postFlip.lua +6 -0
- package/callbacks/subscriptions/postGameStartedReordered.lua +6 -0
- package/callbacks/subscriptions/postGreedModeWave.lua +6 -0
- package/callbacks/subscriptions/postGridEntityBroken.lua +6 -0
- package/callbacks/subscriptions/postGridEntityCollision.lua +6 -0
- package/callbacks/subscriptions/postGridEntityInit.lua +6 -0
- package/callbacks/subscriptions/postGridEntityRemove.lua +6 -0
- package/callbacks/subscriptions/postGridEntityRender.lua +6 -0
- package/callbacks/subscriptions/postGridEntityStateChanged.lua +6 -0
- package/callbacks/subscriptions/postGridEntityUpdate.lua +6 -0
- package/callbacks/subscriptions/postHolyMantleRemoved.lua +6 -0
- package/callbacks/subscriptions/postItemDischarged.lua +6 -0
- package/callbacks/subscriptions/postItemPickup.lua +6 -0
- package/callbacks/subscriptions/postKnifeInitLate.lua +6 -0
- package/callbacks/subscriptions/postLaserInitLate.lua +6 -0
- package/callbacks/subscriptions/postNPCInitLate.lua +6 -0
- package/callbacks/subscriptions/postNPCStateChanged.lua +6 -0
- package/callbacks/subscriptions/postNewLevelReordered.lua +6 -0
- package/callbacks/subscriptions/postNewRoomEarly.lua +6 -0
- package/callbacks/subscriptions/postNewRoomReordered.lua +6 -0
- package/callbacks/subscriptions/postPEffectUpdateReordered.lua +6 -0
- package/callbacks/subscriptions/postPickupCollect.d.ts +1 -0
- package/callbacks/subscriptions/postPickupCollect.lua +6 -0
- package/callbacks/subscriptions/postPickupInitLate.lua +6 -0
- package/callbacks/subscriptions/postPickupStateChanged.d.ts +1 -0
- package/callbacks/subscriptions/postPickupStateChanged.lua +6 -0
- package/callbacks/subscriptions/postPitRender.d.ts +1 -0
- package/callbacks/subscriptions/postPitRender.lua +6 -0
- package/callbacks/subscriptions/postPitUpdate.d.ts +1 -0
- package/callbacks/subscriptions/postPitUpdate.lua +6 -0
- package/callbacks/subscriptions/postPlayerChangeHealth.lua +6 -0
- package/callbacks/subscriptions/postPlayerChangeType.lua +6 -0
- package/callbacks/subscriptions/postPlayerFatalDamage.lua +6 -0
- package/callbacks/subscriptions/postPlayerInitLate.lua +6 -0
- package/callbacks/subscriptions/postPlayerInitReordered.lua +6 -0
- package/callbacks/subscriptions/postPlayerRenderReordered.lua +6 -0
- package/callbacks/subscriptions/postPlayerUpdateReordered.lua +6 -0
- package/callbacks/subscriptions/postPoopRender.d.ts +1 -0
- package/callbacks/subscriptions/postPoopRender.lua +6 -0
- package/callbacks/subscriptions/postPoopUpdate.d.ts +1 -0
- package/callbacks/subscriptions/postPoopUpdate.lua +6 -0
- package/callbacks/subscriptions/postPressurePlateRender.d.ts +1 -0
- package/callbacks/subscriptions/postPressurePlateRender.lua +6 -0
- package/callbacks/subscriptions/postPressurePlateUpdate.d.ts +1 -0
- package/callbacks/subscriptions/postPressurePlateUpdate.lua +6 -0
- package/callbacks/subscriptions/postProjectileInitLate.lua +6 -0
- package/callbacks/subscriptions/postPurchase.lua +6 -0
- package/callbacks/subscriptions/postRockRender.d.ts +1 -0
- package/callbacks/subscriptions/postRockRender.lua +6 -0
- package/callbacks/subscriptions/postRockUpdate.d.ts +1 -0
- package/callbacks/subscriptions/postRockUpdate.lua +6 -0
- package/callbacks/subscriptions/postRoomClearChanged.lua +6 -0
- package/callbacks/subscriptions/postSacrifice.lua +6 -0
- package/callbacks/subscriptions/postSlotAnimationChanged.lua +6 -0
- package/callbacks/subscriptions/postSlotDestroyed.lua +6 -0
- package/callbacks/subscriptions/postSlotInit.lua +6 -0
- package/callbacks/subscriptions/postSlotRender.lua +6 -0
- package/callbacks/subscriptions/postSlotUpdate.lua +6 -0
- package/callbacks/subscriptions/postSpikesRender.d.ts +1 -0
- package/callbacks/subscriptions/postSpikesRender.lua +6 -0
- package/callbacks/subscriptions/postSpikesUpdate.d.ts +1 -0
- package/callbacks/subscriptions/postSpikesUpdate.lua +6 -0
- package/callbacks/subscriptions/postTNTRender.d.ts +1 -0
- package/callbacks/subscriptions/postTNTRender.lua +6 -0
- package/callbacks/subscriptions/postTNTUpdate.d.ts +1 -0
- package/callbacks/subscriptions/postTNTUpdate.lua +6 -0
- package/callbacks/subscriptions/postTearInitLate.lua +6 -0
- package/callbacks/subscriptions/postTearInitVeryLate.lua +6 -0
- package/callbacks/subscriptions/postTransformation.lua +6 -0
- package/callbacks/subscriptions/postTrinketBreak.lua +6 -0
- package/callbacks/subscriptions/preBerserkDeath.lua +6 -0
- package/callbacks/subscriptions/preCustomRevive.lua +6 -0
- package/callbacks/subscriptions/preItemPickup.lua +6 -0
- package/callbacks/subscriptions/preNewLevel.lua +6 -0
- package/classes/DefaultMap.d.ts +70 -39
- package/classes/DefaultMap.lua +94 -43
- package/classes/ModUpgraded.d.ts +3 -3
- package/classes/ModUpgraded.lua +5 -0
- package/constants.lua +41 -0
- package/constantsFirstLast.lua +63 -0
- package/enums/HealthType.lua +3 -0
- package/enums/ModCallbackCustom.d.ts +1 -1
- package/enums/ModCallbackCustom.lua +6 -0
- package/enums/private/CopyableIsaacAPIClassType.lua +1 -0
- package/enums/private/SerializationBrand.lua +5 -0
- package/features/characterHealthConversion.lua +6 -0
- package/features/characterStats.lua +17 -0
- package/features/debugDisplay/exports.d.ts +17 -0
- package/features/debugDisplay/exports.lua +90 -0
- package/features/debugDisplay/v.d.ts +17 -0
- package/features/deployJSONRoom.d.ts +1 -0
- package/features/deployJSONRoom.lua +56 -0
- package/features/disableInputs.lua +45 -0
- package/features/disableSound.lua +14 -0
- package/features/extraConsoleCommands/commandsDisplay.lua +90 -0
- package/features/extraConsoleCommands/init.lua +16 -0
- package/features/extraConsoleCommands/listCommands.lua +172 -0
- package/features/fadeInRemover.lua +10 -0
- package/features/fastReset.lua +10 -0
- package/features/forgottenSwitch.lua +4 -0
- package/features/getCollectibleItemPoolType.lua +5 -0
- package/features/playerInventory.lua +18 -0
- package/features/ponyDetection.lua +4 -0
- package/features/preventCollectibleRotation.lua +9 -0
- package/features/runInNFrames.lua +50 -0
- package/features/saveDataManager/constants.lua +1 -0
- package/features/saveDataManager/exports.lua +115 -0
- package/features/saveDataManager/load.lua +12 -8
- package/features/saveDataManager/main.lua +16 -3
- package/features/saveDataManager/maps.lua +3 -0
- package/features/saveDataManager/merge.lua +53 -21
- package/features/saveDataManager/save.lua +12 -7
- package/features/sirenHelpers.lua +13 -0
- package/features/taintedLazarusPlayers.lua +11 -0
- package/featuresInitialized.lua +6 -0
- package/functions/array.d.ts +2 -0
- package/functions/array.lua +85 -0
- package/functions/benchmark.lua +6 -0
- package/functions/boss.lua +35 -0
- package/functions/cacheFlag.lua +4 -0
- package/functions/cards.lua +60 -0
- package/functions/challenges.lua +1 -0
- package/functions/character.lua +23 -0
- package/functions/charge.lua +39 -0
- package/functions/chargeBar.d.ts +1 -0
- package/functions/chargeBar.lua +4 -0
- package/functions/collectibleCacheFlag.lua +15 -0
- package/functions/collectibleSet.lua +3 -0
- package/functions/collectibleTag.lua +9 -0
- package/functions/collectibles.d.ts +6 -1
- package/functions/collectibles.lua +146 -2
- package/functions/color.lua +18 -0
- package/functions/debug.lua +18 -0
- package/functions/deepCopy.lua +60 -26
- package/functions/deepCopyTests.lua +8 -5
- package/functions/direction.d.ts +1 -0
- package/functions/direction.lua +22 -0
- package/functions/doors.d.ts +1 -0
- package/functions/doors.lua +58 -0
- package/functions/entity.d.ts +4 -4
- package/functions/entity.lua +94 -6
- package/functions/entitySpecific.d.ts +20 -20
- package/functions/entitySpecific.lua +182 -0
- package/functions/entityTypes.d.ts +1 -1
- package/functions/entityTypes.lua +1 -0
- package/functions/enums.d.ts +2 -0
- package/functions/enums.lua +62 -0
- package/functions/familiars.lua +52 -0
- package/functions/flag.lua +77 -0
- package/functions/flying.lua +10 -0
- package/functions/globals.lua +8 -10
- package/functions/gridEntity.lua +105 -0
- package/functions/gridEntitySpecific.d.ts +5 -0
- package/functions/gridEntitySpecific.lua +8 -0
- package/functions/input.lua +11 -0
- package/functions/isaacAPIClass.d.ts +4 -4
- package/functions/isaacAPIClass.lua +15 -3
- package/functions/jsonHelpers.lua +11 -0
- package/functions/jsonRoom.d.ts +2 -0
- package/functions/jsonRoom.lua +5 -0
- package/functions/kColor.lua +9 -0
- package/functions/language.lua +5 -0
- package/functions/log.lua +31 -3
- package/functions/map.lua +18 -0
- package/functions/math.lua +26 -0
- package/functions/npc.lua +24 -0
- package/functions/pickupVariants.d.ts +11 -11
- package/functions/pickupVariants.lua +11 -0
- package/functions/pickups.d.ts +9 -9
- package/functions/pickups.lua +67 -0
- package/functions/pills.lua +45 -0
- package/functions/player.lua +166 -0
- package/functions/playerDataStructures.lua +65 -0
- package/functions/playerHealth.d.ts +1 -0
- package/functions/playerHealth.lua +10 -0
- package/functions/playerIndex.d.ts +2 -0
- package/functions/playerIndex.lua +47 -0
- package/functions/pocketItems.lua +18 -0
- package/functions/positionVelocity.d.ts +3 -0
- package/functions/positionVelocity.lua +46 -0
- package/functions/random.d.ts +2 -0
- package/functions/random.lua +32 -0
- package/functions/revive.d.ts +2 -0
- package/functions/revive.lua +15 -0
- package/functions/rng.d.ts +1 -0
- package/functions/rng.lua +19 -0
- package/functions/roomData.lua +68 -0
- package/functions/roomGrid.lua +21 -0
- package/functions/roomShape.lua +22 -0
- package/functions/rooms.lua +100 -0
- package/functions/run.lua +5 -0
- package/functions/seeds.lua +4 -0
- package/functions/serialization.lua +6 -2
- package/functions/set.d.ts +1 -0
- package/functions/set.lua +22 -0
- package/functions/spawnCollectible.lua +24 -0
- package/functions/sprite.d.ts +2 -0
- package/functions/sprite.lua +25 -0
- package/functions/stage.lua +16 -0
- package/functions/string.lua +6 -0
- package/functions/table.d.ts +12 -0
- package/functions/table.lua +53 -0
- package/functions/tears.d.ts +1 -0
- package/functions/tears.lua +12 -0
- package/functions/transformations.lua +18 -0
- package/functions/trinketCacheFlag.lua +3 -0
- package/functions/trinketGive.lua +24 -0
- package/functions/trinkets.lua +52 -0
- package/functions/tstlClass.d.ts +34 -0
- package/functions/tstlClass.lua +63 -9
- package/functions/ui.d.ts +2 -0
- package/functions/ui.lua +16 -0
- package/functions/utils.d.ts +16 -0
- package/functions/utils.lua +108 -0
- package/functions/vector.lua +13 -16
- package/index.d.ts +1 -0
- package/initCustomCallbacks.lua +3 -0
- package/interfaces/ChargeBarSprites.d.ts +1 -0
- package/interfaces/private/TSTLClassMetatable.d.ts +2 -0
- package/lualib_bundle.lua +21 -34
- package/maps/cardMap.lua +1 -0
- package/maps/characterMap.lua +1 -0
- package/maps/defaultPlayerStatMap.lua +1 -0
- package/maps/gridEntityXMLMap.lua +2 -0
- package/maps/pillEffectMap.lua +1 -0
- package/maps/roomShapeToTopLeftWallGridIndexMap.lua +2 -0
- package/maps/roomTypeMap.lua +1 -0
- package/objects/LRoomShapeToRectangles.lua +2 -0
- package/objects/colors.lua +4 -0
- package/objects/oppositeDoorSlots.d.ts +4 -0
- package/objects/oppositeDoorSlots.lua +15 -0
- package/objects/roomShapeBounds.lua +2 -0
- package/objects/roomShapeLayoutSizes.lua +4 -0
- package/objects/roomShapeToBottomRightPosition.lua +2 -0
- package/objects/roomShapeToDoorSlotsToGridIndexDelta.lua +2 -0
- package/objects/roomShapeToTopLeftPosition.lua +2 -0
- package/objects/roomShapeVolumes.lua +3 -0
- package/package.json +2 -2
- package/patchErrorFunctions.lua +8 -0
- package/sets/bossSets.lua +23 -0
- package/sets/charactersWithNoRedHeartsSet.lua +2 -0
- package/sets/charactersWithNoSoulHeartsSet.lua +2 -0
- package/sets/lostStyleCharactersSet.lua +2 -0
- package/types/AnyEntity.d.ts +10 -0
- package/types/PickingUpItem.lua +7 -0
- package/upgradeMod.d.ts +4 -4
- package/upgradeMod.lua +18 -0
package/functions/chargeBar.lua
CHANGED
|
@@ -8,6 +8,8 @@ function getChargeBarClamp(self, charges, maxCharges)
|
|
|
8
8
|
return Vector(0, meterClip)
|
|
9
9
|
end
|
|
10
10
|
local CHARGE_BAR_ANM2 = "gfx/ui/ui_chargebar.anm2"
|
|
11
|
+
--- Constructor for a `ChargeBarSprites` object. For more information, see the `renderChargeBar`
|
|
12
|
+
-- helper function.
|
|
11
13
|
function ____exports.newChargeBarSprites(self, maxCharges)
|
|
12
14
|
local back = Sprite()
|
|
13
15
|
back:Load(CHARGE_BAR_ANM2, true)
|
|
@@ -32,6 +34,8 @@ function ____exports.newChargeBarSprites(self, maxCharges)
|
|
|
32
34
|
maxCharges = maxCharges
|
|
33
35
|
}
|
|
34
36
|
end
|
|
37
|
+
--- Helper function to render a charge bar on the screen. First, call the `newChargeBarSprites`
|
|
38
|
+
-- function to initialize the sprites, and then call this function on every render frame.
|
|
35
39
|
function ____exports.renderChargeBar(self, sprites, position, normalCharges, batteryCharges)
|
|
36
40
|
sprites.back:Render(position, VectorZero, VectorZero)
|
|
37
41
|
local normalChargesClamp = getChargeBarClamp(nil, normalCharges, sprites.maxCharges)
|
|
@@ -37,6 +37,8 @@ local function initCacheFlagMap(self)
|
|
|
37
37
|
CACHE_FLAG_TO_COLLECTIBLES_MAP:set(cacheFlag, collectiblesSet)
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
|
+
--- Returns a set containing every collectible type with the given cache flag, including modded
|
|
41
|
+
-- collectibles.
|
|
40
42
|
function ____exports.getCollectiblesForCacheFlag(self, cacheFlag)
|
|
41
43
|
if CACHE_FLAG_TO_COLLECTIBLES_MAP.size == 0 then
|
|
42
44
|
initCacheFlagMap(nil)
|
|
@@ -47,6 +49,19 @@ function ____exports.getCollectiblesForCacheFlag(self, cacheFlag)
|
|
|
47
49
|
end
|
|
48
50
|
return copySet(nil, collectiblesSet)
|
|
49
51
|
end
|
|
52
|
+
--- Returns an array containing every collectible type that the player has that matches the provided
|
|
53
|
+
-- CacheFlag.
|
|
54
|
+
--
|
|
55
|
+
-- For example, if the cache flag is `CacheFlag.FLYING`, and the player has one Lord of the Pit and
|
|
56
|
+
-- two Dead Doves, then this function would return:
|
|
57
|
+
--
|
|
58
|
+
-- ```ts
|
|
59
|
+
-- [
|
|
60
|
+
-- CollectibleType.LORD_OF_THE_PIT,
|
|
61
|
+
-- CollectibleType.DEAD_DOVE,
|
|
62
|
+
-- CollectibleType.DEAD_DOVE,
|
|
63
|
+
-- ]
|
|
64
|
+
-- ```
|
|
50
65
|
function ____exports.getPlayerCollectiblesForCacheFlag(self, player, cacheFlag)
|
|
51
66
|
local collectiblesForCacheFlag = ____exports.getCollectiblesForCacheFlag(nil, cacheFlag)
|
|
52
67
|
local playerCollectibles = {}
|
|
@@ -30,18 +30,21 @@ local function initCollectibleSets(self)
|
|
|
30
30
|
::__continue3::
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
|
+
--- Returns a set containing every valid collectible type in the game, including modded collectibles.
|
|
33
34
|
function ____exports.getCollectibleSet(self)
|
|
34
35
|
if ALL_COLLECTIBLES_SET.size == 0 then
|
|
35
36
|
initCollectibleSets(nil)
|
|
36
37
|
end
|
|
37
38
|
return copySet(nil, ALL_COLLECTIBLES_SET)
|
|
38
39
|
end
|
|
40
|
+
--- Returns a set containing every modded collectible type in the game.
|
|
39
41
|
function ____exports.getModdedCollectibleSet(self)
|
|
40
42
|
if ALL_COLLECTIBLES_SET.size == 0 then
|
|
41
43
|
initCollectibleSets(nil)
|
|
42
44
|
end
|
|
43
45
|
return copySet(nil, MODDED_COLLECTIBLES_SET)
|
|
44
46
|
end
|
|
47
|
+
--- Returns a set containing every valid vanilla collectible type in the game.
|
|
45
48
|
function ____exports.getVanillaCollectibleSet(self)
|
|
46
49
|
if ALL_COLLECTIBLES_SET.size == 0 then
|
|
47
50
|
initCollectibleSets(nil)
|
|
@@ -50,6 +50,14 @@ local function initTagMap(self)
|
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
|
+
--- Helper function to get all of the collectible types in the game that have a certain tag.
|
|
54
|
+
--
|
|
55
|
+
-- For example, to get all of the collectible types that count as offensive for the purposes of
|
|
56
|
+
-- Tainted Lost:
|
|
57
|
+
--
|
|
58
|
+
-- ```ts
|
|
59
|
+
-- const offensiveCollectibleTypes = getCollectibleTypesWithTag(ItemConfigTag.OFFENSIVE);
|
|
60
|
+
-- ```
|
|
53
61
|
function ____exports.getCollectibleTypesWithTag(self, itemConfigTag)
|
|
54
62
|
if TAG_TO_COLLECTIBLE_TYPES_MAP.size == 0 then
|
|
55
63
|
initTagMap(nil)
|
|
@@ -60,6 +68,7 @@ function ____exports.getCollectibleTypesWithTag(self, itemConfigTag)
|
|
|
60
68
|
end
|
|
61
69
|
return copySet(nil, collectibleTypes)
|
|
62
70
|
end
|
|
71
|
+
--- Returns the number of items that a player has towards a particular transformation.
|
|
63
72
|
function ____exports.getPlayerNumCollectiblesWithTag(self, player, itemConfigTag)
|
|
64
73
|
local collectibleTypesSet = ____exports.getCollectibleTypesWithTag(nil, itemConfigTag)
|
|
65
74
|
return getPlayerCollectibleCount(
|
|
@@ -8,9 +8,14 @@ export declare function collectibleSpriteEquals(sprite1: Sprite, sprite2: Sprite
|
|
|
8
8
|
* provided collectible type was not valid.
|
|
9
9
|
*/
|
|
10
10
|
export declare function getCollectibleDescription(collectibleType: CollectibleType): string;
|
|
11
|
+
/**
|
|
12
|
+
* Helper function to get the coin cost that a collectible item would be if it were being offered in
|
|
13
|
+
* a Devil Room deal. Returns 0 if passed `CollectibleType.NULL`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getCollectibleDevilCoinPrice(collectibleType: CollectibleType): int;
|
|
11
16
|
/**
|
|
12
17
|
* Helper function to get the heart cost that a collectible item would be if it were being offered
|
|
13
|
-
* in a Devil Room deal. Returns 0 if passed CollectibleType.NULL
|
|
18
|
+
* in a Devil Room deal. Returns 0 if passed `CollectibleType.NULL`.
|
|
14
19
|
*/
|
|
15
20
|
export declare function getCollectibleDevilHeartPrice(collectibleType: CollectibleType, player: EntityPlayer): PickupPrice;
|
|
16
21
|
/**
|
|
@@ -44,6 +44,16 @@ function initQuestionMarkSprite(self)
|
|
|
44
44
|
sprite:LoadGraphics()
|
|
45
45
|
return sprite
|
|
46
46
|
end
|
|
47
|
+
--- Helper function to change the sprite of a collectible pedestal entity.
|
|
48
|
+
--
|
|
49
|
+
-- For more information about removing the collectible sprite, see the documentation for the
|
|
50
|
+
-- "clearSprite" helper function.
|
|
51
|
+
--
|
|
52
|
+
-- @param collectible The collectible whose sprite you want to modify.
|
|
53
|
+
-- @param pngPath Equal to either the spritesheet path to load (e.g.
|
|
54
|
+
-- "gfx/items/collectibles/collectibles_001_thesadonion.png") or undefined. If
|
|
55
|
+
-- undefined, the sprite will be removed, making it appear like the collectible has
|
|
56
|
+
-- already been taken by the player.
|
|
47
57
|
function ____exports.setCollectibleSprite(self, collectible, pngPath)
|
|
48
58
|
if not isCollectible(nil, collectible) then
|
|
49
59
|
local entityID = getEntityID(nil, collectible)
|
|
@@ -64,6 +74,7 @@ local questionMarkSprite = initQuestionMarkSprite(nil)
|
|
|
64
74
|
function ____exports.clearCollectibleSprite(self, collectible)
|
|
65
75
|
____exports.setCollectibleSprite(nil, collectible, nil)
|
|
66
76
|
end
|
|
77
|
+
--- Helper function to check if two collectible sprites have the same sprite sheet loaded.
|
|
67
78
|
function ____exports.collectibleSpriteEquals(self, sprite1, sprite2)
|
|
68
79
|
local xStart = -1
|
|
69
80
|
local xFinish = 1
|
|
@@ -84,6 +95,8 @@ function ____exports.collectibleSpriteEquals(self, sprite1, sprite2)
|
|
|
84
95
|
yIncrement
|
|
85
96
|
)
|
|
86
97
|
end
|
|
98
|
+
--- Helper function to get the in-game description for a collectible. Returns "Unknown" if the
|
|
99
|
+
-- provided collectible type was not valid.
|
|
87
100
|
function ____exports.getCollectibleDescription(self, collectibleType)
|
|
88
101
|
local collectibleDescription = COLLECTIBLE_DESCRIPTION_MAP:get(collectibleType)
|
|
89
102
|
if collectibleDescription ~= nil then
|
|
@@ -95,6 +108,21 @@ function ____exports.getCollectibleDescription(self, collectibleType)
|
|
|
95
108
|
end
|
|
96
109
|
return DEFAULT_COLLECTIBLE_DESCRIPTION
|
|
97
110
|
end
|
|
111
|
+
--- Helper function to get the coin cost that a collectible item would be if it were being offered in
|
|
112
|
+
-- a Devil Room deal. Returns 0 if passed `CollectibleType.NULL`.
|
|
113
|
+
function ____exports.getCollectibleDevilCoinPrice(self, collectibleType)
|
|
114
|
+
if collectibleType == CollectibleType.NULL then
|
|
115
|
+
return 0
|
|
116
|
+
end
|
|
117
|
+
local defaultCollectiblePrice = 15
|
|
118
|
+
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
119
|
+
if itemConfigItem == nil then
|
|
120
|
+
return defaultCollectiblePrice
|
|
121
|
+
end
|
|
122
|
+
return itemConfigItem.DevilPrice * defaultCollectiblePrice
|
|
123
|
+
end
|
|
124
|
+
--- Helper function to get the heart cost that a collectible item would be if it were being offered
|
|
125
|
+
-- in a Devil Room deal. Returns 0 if passed `CollectibleType.NULL`.
|
|
98
126
|
function ____exports.getCollectibleDevilHeartPrice(self, collectibleType, player)
|
|
99
127
|
local maxHearts = player:GetMaxHearts()
|
|
100
128
|
if collectibleType == CollectibleType.NULL then
|
|
@@ -103,14 +131,16 @@ function ____exports.getCollectibleDevilHeartPrice(self, collectibleType, player
|
|
|
103
131
|
if maxHearts == 0 then
|
|
104
132
|
return PickupPrice.THREE_SOUL_HEARTS
|
|
105
133
|
end
|
|
106
|
-
local
|
|
134
|
+
local defaultCollectiblePrice = PickupPrice.ONE_HEART
|
|
107
135
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
108
136
|
if itemConfigItem == nil then
|
|
109
|
-
return
|
|
137
|
+
return defaultCollectiblePrice
|
|
110
138
|
end
|
|
111
139
|
local twoHeartPrice = maxHearts == 2 and PickupPrice.ONE_HEART_AND_TWO_SOUL_HEARTS or PickupPrice.TWO_HEARTS
|
|
112
140
|
return itemConfigItem.DevilPrice == 2 and twoHeartPrice or PickupPrice.ONE_HEART
|
|
113
141
|
end
|
|
142
|
+
--- Helper function to get the path to a collectible's sprite. Returns the path to the question mark
|
|
143
|
+
-- sprite (i.e. from Curse of the Blind) if the provided collectible type was not valid.
|
|
114
144
|
function ____exports.getCollectibleGfxFilename(self, collectibleType)
|
|
115
145
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
116
146
|
if itemConfigItem == nil then
|
|
@@ -118,6 +148,41 @@ function ____exports.getCollectibleGfxFilename(self, collectibleType)
|
|
|
118
148
|
end
|
|
119
149
|
return itemConfigItem.GfxFileName
|
|
120
150
|
end
|
|
151
|
+
--- Mods often have to track variables relating to a collectible. Finding an index for these kinds of
|
|
152
|
+
-- data structures is difficult, since collectibles are respawned every time a player re-enters a
|
|
153
|
+
-- room, so the `PtrHash` will change. Instead, we use a 4-tuple of the room list index, the grid
|
|
154
|
+
-- index of the collectible in the room, the collectible's SubType, and the collectible's InitSeed.
|
|
155
|
+
--
|
|
156
|
+
-- Collectibles that are shifted by Tainted Isaac's mechanic will have unique collectible indexes
|
|
157
|
+
-- because the SubType is different. (The collectible entities share the same InitSeed.)
|
|
158
|
+
--
|
|
159
|
+
-- Collectibles that are rolled (with e.g. a D6) will have unique collectible indexes because the
|
|
160
|
+
-- SubType and InitSeed are different. If you want to track collectibles independently of any
|
|
161
|
+
-- rerolls, then you can use the `PtrHash` as an index instead. (The `PtrHash` will not persist
|
|
162
|
+
-- between rooms, however.)
|
|
163
|
+
--
|
|
164
|
+
-- Note that:
|
|
165
|
+
-- - The grid index is a necessary part of the collectible index because Diplopia and Crooked Penny
|
|
166
|
+
-- can cause two or more collectibles with the same SubType and InitSeed to exist in the same
|
|
167
|
+
-- room.
|
|
168
|
+
-- - This index will fail in the case where the player uses Diplopia or a successful Crooked Penny
|
|
169
|
+
-- seven or more times in the same room, since that will cause two or more collectibles with the
|
|
170
|
+
-- same grid index, SubType, and InitSeed to exist.
|
|
171
|
+
-- - The SubType is a necessary part of the collectible index because Tainted Isaac will
|
|
172
|
+
-- continuously cause collectibles to morph into new sub-types with the same InitSeed.
|
|
173
|
+
-- - Using a collectible's position as part of the index is problematic, since players can push a
|
|
174
|
+
-- pedestal. (Even using the grid index does not solve this problem, since it is possible in
|
|
175
|
+
-- certain cases for collectibles to be spawned at a position that is not aligned with the grid,
|
|
176
|
+
-- and the pedestal pushed to an adjacent tile, but this case should be extremely rare.)
|
|
177
|
+
-- - Mega Chests spawn two collectibles on the exact same position. However, both of them will have
|
|
178
|
+
-- different InitSeeds, so this is not a problem for this indexing scheme.
|
|
179
|
+
-- - The indexing scheme used is different for collectibles that are inside of a Treasure Room, in
|
|
180
|
+
-- order to handle the case of the player seeing the same collectible again in a post-Ascent
|
|
181
|
+
-- Treasure Room. A 5-tuple of stage, stage type, grid index, SubType, and InitSeed is used in
|
|
182
|
+
-- this case. (Using the room list index or the room grid index is not suitable for this purpose,
|
|
183
|
+
-- since both of these values can change in the post-Ascent Treasure Room.) Even though there can
|
|
184
|
+
-- be two Treasure Rooms on an XL floor, both Treasure Rooms should not have collectibles with the
|
|
185
|
+
-- same grid index, Subtype, and InitSeed.
|
|
121
186
|
function ____exports.getCollectibleIndex(self, collectible)
|
|
122
187
|
if not isCollectible(nil, collectible) then
|
|
123
188
|
local entityID = getEntityID(nil, collectible)
|
|
@@ -135,6 +200,8 @@ function ____exports.getCollectibleIndex(self, collectible)
|
|
|
135
200
|
end
|
|
136
201
|
return (((((tostring(roomListIndex) .. ",") .. tostring(gridIndex)) .. ",") .. tostring(collectible.SubType)) .. ",") .. tostring(collectible.InitSeed)
|
|
137
202
|
end
|
|
203
|
+
--- Helper function to get the initial amount of charges that a collectible has. Returns 0 if the
|
|
204
|
+
-- provided collectible type was not valid.
|
|
138
205
|
function ____exports.getCollectibleInitCharge(self, collectibleType)
|
|
139
206
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
140
207
|
if itemConfigItem == nil then
|
|
@@ -142,6 +209,8 @@ function ____exports.getCollectibleInitCharge(self, collectibleType)
|
|
|
142
209
|
end
|
|
143
210
|
return itemConfigItem.InitCharge
|
|
144
211
|
end
|
|
212
|
+
--- Helper function to get the `ItemType` of a collectible. Returns `ItemType.ITEM_NULL` if the
|
|
213
|
+
-- provided collectible type was not valid.
|
|
145
214
|
function ____exports.getCollectibleItemType(self, collectibleType)
|
|
146
215
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
147
216
|
if itemConfigItem == nil then
|
|
@@ -149,6 +218,8 @@ function ____exports.getCollectibleItemType(self, collectibleType)
|
|
|
149
218
|
end
|
|
150
219
|
return itemConfigItem.Type
|
|
151
220
|
end
|
|
221
|
+
--- Helper function to get the maximum amount of charges that a collectible has. Returns 0 if the
|
|
222
|
+
-- provided collectible type was not valid.
|
|
152
223
|
function ____exports.getCollectibleMaxCharges(self, collectibleType)
|
|
153
224
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
154
225
|
if itemConfigItem == nil then
|
|
@@ -156,6 +227,15 @@ function ____exports.getCollectibleMaxCharges(self, collectibleType)
|
|
|
156
227
|
end
|
|
157
228
|
return itemConfigItem.MaxCharges
|
|
158
229
|
end
|
|
230
|
+
--- Helper function to get the name of a collectible. Returns "Unknown" if the provided collectible
|
|
231
|
+
-- type is not valid.
|
|
232
|
+
--
|
|
233
|
+
-- For example:
|
|
234
|
+
--
|
|
235
|
+
-- ```ts
|
|
236
|
+
-- const collectibleType = CollectibleType.SAD_ONION;
|
|
237
|
+
-- const collectibleName = getCollectibleName(collectibleType); // collectibleName is "Sad Onion"
|
|
238
|
+
-- ```
|
|
159
239
|
function ____exports.getCollectibleName(self, collectibleType)
|
|
160
240
|
local collectibleName = COLLECTIBLE_NAME_MAP:get(collectibleType)
|
|
161
241
|
if collectibleName ~= nil then
|
|
@@ -175,6 +255,8 @@ function ____exports.getCollectiblePedestalType(self, collectible)
|
|
|
175
255
|
local sprite = collectible:GetSprite()
|
|
176
256
|
return sprite:GetOverlayFrame()
|
|
177
257
|
end
|
|
258
|
+
--- Helper function to get the path to a collectible's quality. Returns 0 if the provided collectible
|
|
259
|
+
-- type was not valid.
|
|
178
260
|
function ____exports.getCollectibleQuality(self, collectibleType)
|
|
179
261
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
180
262
|
if itemConfigItem == nil then
|
|
@@ -182,26 +264,59 @@ function ____exports.getCollectibleQuality(self, collectibleType)
|
|
|
182
264
|
end
|
|
183
265
|
return itemConfigItem.Quality
|
|
184
266
|
end
|
|
267
|
+
--- Helper function to get the tags of a collectible (which is the composition of zero or more
|
|
268
|
+
-- `ItemConfigTag`). Returns 0 if the provided collectible type is not valid.
|
|
269
|
+
--
|
|
270
|
+
-- For example:
|
|
271
|
+
--
|
|
272
|
+
-- ```ts
|
|
273
|
+
-- const collectibleType = CollectibleType.SAD_ONION;
|
|
274
|
+
-- const itemConfigTags = getCollectibleTags(collectibleType); // itemConfigTags is "18350080"
|
|
275
|
+
-- ```
|
|
185
276
|
function ____exports.getCollectibleTags(self, collectibleType)
|
|
186
277
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
187
278
|
return itemConfigItem == nil and ItemConfigTagZero or itemConfigItem.Tags
|
|
188
279
|
end
|
|
280
|
+
--- Helper function to get an array that represents the range from the first collectible type to the
|
|
281
|
+
-- last collectible type. This will include integers that do not represent any valid collectible
|
|
282
|
+
-- types.
|
|
283
|
+
--
|
|
284
|
+
-- This function is only useful when building collectible type objects. For most purposes, you
|
|
285
|
+
-- should use the `getCollectibleSet` helper function instead.
|
|
189
286
|
function ____exports.getCollectibleTypeRange(self)
|
|
190
287
|
return irange(nil, FIRST_COLLECTIBLE_TYPE, LAST_COLLECTIBLE_TYPE)
|
|
191
288
|
end
|
|
289
|
+
--- Helper function to get an array that represents the all modded collectible types.
|
|
290
|
+
--
|
|
291
|
+
-- This function is only useful when building collectible type objects. For most purposes, you
|
|
292
|
+
-- should use the `getModdedCollectibleSet` helper function instead.
|
|
293
|
+
--
|
|
294
|
+
-- Returns an empty array if there are no modded collectible types.
|
|
295
|
+
--
|
|
296
|
+
-- (This function is named differently from the `getVanillaCollectibleTypeRange` function because
|
|
297
|
+
-- all modded collectible types are contiguous. Thus, each value represents a real
|
|
298
|
+
-- `CollectibleType`.)
|
|
192
299
|
function ____exports.getModdedCollectibleTypes(self)
|
|
193
300
|
if LAST_VANILLA_COLLECTIBLE_TYPE == LAST_COLLECTIBLE_TYPE then
|
|
194
301
|
return {}
|
|
195
302
|
end
|
|
196
303
|
return irange(nil, FIRST_MODDED_COLLECTIBLE_TYPE, LAST_COLLECTIBLE_TYPE)
|
|
197
304
|
end
|
|
305
|
+
--- Helper function to get an array that represents the range from the first collectible type to the
|
|
306
|
+
-- last vanilla collectible type. This will include integers that do not represent any valid
|
|
307
|
+
-- collectible types.
|
|
308
|
+
--
|
|
309
|
+
-- This function is only useful when building collectible type objects. For most purposes, you
|
|
310
|
+
-- should use the `getVanillaCollectibleSet` helper function instead.
|
|
198
311
|
function ____exports.getVanillaCollectibleTypeRange(self)
|
|
199
312
|
return irange(nil, FIRST_COLLECTIBLE_TYPE, LAST_VANILLA_COLLECTIBLE_TYPE)
|
|
200
313
|
end
|
|
314
|
+
--- Returns true if the item type in the item config is equal to `ItemType.ITEM_ACTIVE`.
|
|
201
315
|
function ____exports.isActiveCollectible(self, collectibleType)
|
|
202
316
|
local itemType = ____exports.getCollectibleItemType(nil, collectibleType)
|
|
203
317
|
return itemType == ItemType.ACTIVE
|
|
204
318
|
end
|
|
319
|
+
--- Returns true if the collectible has a red question mark sprite.
|
|
205
320
|
function ____exports.isBlindCollectible(self, collectible)
|
|
206
321
|
if not isCollectible(nil, collectible) then
|
|
207
322
|
local entityID = getEntityID(nil, collectible)
|
|
@@ -213,17 +328,28 @@ function ____exports.isBlindCollectible(self, collectible)
|
|
|
213
328
|
questionMarkSprite:SetFrame(animation, frame)
|
|
214
329
|
return ____exports.collectibleSpriteEquals(nil, sprite, questionMarkSprite)
|
|
215
330
|
end
|
|
331
|
+
--- Returns whether or not the given collectible is a "glitched" item. All items are replaced by
|
|
332
|
+
-- glitched items once a player has TMTRAINER. However, glitched items can also "naturally" appear
|
|
333
|
+
-- in secret rooms and I AM ERROR rooms if the "Corrupted Data" achievement is unlocked.
|
|
216
334
|
function ____exports.isGlitchedCollectible(self, pickup)
|
|
217
335
|
return pickup.Variant == PickupVariant.COLLECTIBLE and pickup.SubType > GLITCHED_ITEM_THRESHOLD
|
|
218
336
|
end
|
|
337
|
+
--- Returns true if the collectible has the "Hidden" attribute in the item config.
|
|
338
|
+
--
|
|
339
|
+
-- Hidden collectibles will not show up in any pools and Eden will not start with them.
|
|
219
340
|
function ____exports.isHiddenCollectible(self, collectibleType)
|
|
220
341
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
221
342
|
return itemConfigItem ~= nil and itemConfigItem.Hidden
|
|
222
343
|
end
|
|
344
|
+
--- Returns true if the item type in the item config is equal to `ItemType.ITEM_PASSIVE` or
|
|
345
|
+
-- `ItemType.ITEM_FAMILIAR`.
|
|
223
346
|
function ____exports.isPassiveCollectible(self, collectibleType)
|
|
224
347
|
local itemType = ____exports.getCollectibleItemType(nil, collectibleType)
|
|
225
348
|
return itemType == ItemType.PASSIVE or itemType == ItemType.FAMILIAR
|
|
226
349
|
end
|
|
350
|
+
--- Helper function to determine if a particular collectible will disappear from the player's
|
|
351
|
+
-- inventory upon use. Note that this will not work will modded items, as there is no way to
|
|
352
|
+
-- dynamically know if a modded item will disappear.
|
|
227
353
|
function ____exports.isSingleUseCollectible(self, collectibleType)
|
|
228
354
|
return SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES_SET:has(collectibleType)
|
|
229
355
|
end
|
|
@@ -231,10 +357,17 @@ function ____exports.isValidCollectibleType(self, collectibleType)
|
|
|
231
357
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
232
358
|
return itemConfigItem ~= nil
|
|
233
359
|
end
|
|
360
|
+
--- Helper function to put a message in the log.txt file to let the Rebirth Item Tracker know that it
|
|
361
|
+
-- should remove an item.
|
|
362
|
+
--
|
|
363
|
+
-- The "item tracker" in this function does not refer to the in-game item tracker, but rather to the
|
|
364
|
+
-- Python program located at: https://github.com/Rchardon/RebirthItemTracker
|
|
234
365
|
function ____exports.removeCollectibleFromItemTracker(self, collectibleType)
|
|
235
366
|
local collectibleName = ____exports.getCollectibleName(nil, collectibleType)
|
|
236
367
|
Isaac.DebugString(((("Removing collectible " .. tostring(collectibleType)) .. " (") .. collectibleName) .. ") on player 0 (Player)")
|
|
237
368
|
end
|
|
369
|
+
--- Helper function to remove all pickup delay on a collectible. By default, collectibles have a 20
|
|
370
|
+
-- frame delay before they can be picked up by a player.
|
|
238
371
|
function ____exports.removeCollectiblePickupDelay(self, collectible)
|
|
239
372
|
if not isCollectible(nil, collectible) then
|
|
240
373
|
local entityID = getEntityID(nil, collectible)
|
|
@@ -242,6 +375,8 @@ function ____exports.removeCollectiblePickupDelay(self, collectible)
|
|
|
242
375
|
end
|
|
243
376
|
collectible.Wait = 0
|
|
244
377
|
end
|
|
378
|
+
--- Helper function to set a collectible sprite to a question mark (i.e. how collectibles look when
|
|
379
|
+
-- the player has Curse of the Blind).
|
|
245
380
|
function ____exports.setCollectibleBlind(self, collectible)
|
|
246
381
|
if not isCollectible(nil, collectible) then
|
|
247
382
|
local entityID = getEntityID(nil, collectible)
|
|
@@ -249,6 +384,11 @@ function ____exports.setCollectibleBlind(self, collectible)
|
|
|
249
384
|
end
|
|
250
385
|
____exports.setCollectibleSprite(nil, collectible, BLIND_ITEM_PNG_PATH)
|
|
251
386
|
end
|
|
387
|
+
--- Helper function to remove the collectible from a collectible pedestal and make it appear as if a
|
|
388
|
+
-- player has already taken the item. This is accomplished by changing the sub-type to
|
|
389
|
+
-- `CollectibleType.NULL` and then setting the sprite to an empty/missing PNG file.
|
|
390
|
+
--
|
|
391
|
+
-- For more information, see the documentation for the "clearSprite" helper function.
|
|
252
392
|
function ____exports.setCollectibleEmpty(self, collectible)
|
|
253
393
|
if not isCollectible(nil, collectible) then
|
|
254
394
|
local entityID = getEntityID(nil, collectible)
|
|
@@ -257,6 +397,8 @@ function ____exports.setCollectibleEmpty(self, collectible)
|
|
|
257
397
|
collectible.SubType = CollectibleType.NULL
|
|
258
398
|
____exports.clearCollectibleSprite(nil, collectible)
|
|
259
399
|
end
|
|
400
|
+
--- Helper function to change the collectible on a pedestal. Simply updating the `SubType` property
|
|
401
|
+
-- is not sufficient because the sprite will not change.
|
|
260
402
|
function ____exports.setCollectibleSubType(self, collectible, newCollectibleType)
|
|
261
403
|
if not isCollectible(nil, collectible) then
|
|
262
404
|
local entityID = getEntityID(nil, collectible)
|
|
@@ -275,6 +417,8 @@ function ____exports.setCollectibleSubType(self, collectible, newCollectibleType
|
|
|
275
417
|
true
|
|
276
418
|
)
|
|
277
419
|
end
|
|
420
|
+
--- Helper function to put a message in the log.txt file to let the Rebirth Item Tracker know that
|
|
421
|
+
-- the build has been rerolled.
|
|
278
422
|
function ____exports.setCollectiblesRerolledForItemTracker(self)
|
|
279
423
|
Isaac.DebugString("Added 3 Collectibles")
|
|
280
424
|
end
|
package/functions/color.lua
CHANGED
|
@@ -13,6 +13,9 @@ local getNumbersFromTable = ____table.getNumbersFromTable
|
|
|
13
13
|
local tableHasKeys = ____table.tableHasKeys
|
|
14
14
|
local ____utils = require("functions.utils")
|
|
15
15
|
local ensureAllCases = ____utils.ensureAllCases
|
|
16
|
+
--- Helper function to check if something is an instantiated Color object.
|
|
17
|
+
--
|
|
18
|
+
-- @category color
|
|
16
19
|
function ____exports.isColor(self, object)
|
|
17
20
|
return isIsaacAPIClassOfType(nil, object, OBJECT_NAME)
|
|
18
21
|
end
|
|
@@ -26,9 +29,17 @@ local KEYS = {
|
|
|
26
29
|
"BO"
|
|
27
30
|
}
|
|
28
31
|
OBJECT_NAME = "Color"
|
|
32
|
+
---
|
|
33
|
+
-- @category color
|
|
29
34
|
function ____exports.colorEquals(self, color1, color2)
|
|
30
35
|
return isaacAPIClassEquals(nil, color1, color2, KEYS)
|
|
31
36
|
end
|
|
37
|
+
--- Helper function to copy a `Color` object.
|
|
38
|
+
--
|
|
39
|
+
-- @param color The Color object to copy. In the case of deserialization, this will actually be a
|
|
40
|
+
-- Lua table instead of an instantiated Color class.
|
|
41
|
+
-- @param serializationType Default is `SerializationType.NONE`.
|
|
42
|
+
-- @category color
|
|
32
43
|
function ____exports.copyColor(self, color, serializationType)
|
|
33
44
|
if serializationType == nil then
|
|
34
45
|
serializationType = SerializationType.NONE
|
|
@@ -104,9 +115,16 @@ function ____exports.copyColor(self, color, serializationType)
|
|
|
104
115
|
end
|
|
105
116
|
until true
|
|
106
117
|
end
|
|
118
|
+
--- Returns `Color(1, 1, 1)`.
|
|
119
|
+
--
|
|
120
|
+
-- @category color
|
|
107
121
|
function ____exports.getDefaultColor(self)
|
|
108
122
|
return Color(1, 1, 1)
|
|
109
123
|
end
|
|
124
|
+
--- Used to determine is the given table is a serialized `Color` object created by the save data
|
|
125
|
+
-- manager and/or the `deepCopy` function.
|
|
126
|
+
--
|
|
127
|
+
-- @category color
|
|
110
128
|
function ____exports.isSerializedColor(self, object)
|
|
111
129
|
local objectType = type(object)
|
|
112
130
|
if objectType ~= "table" then
|
package/functions/debug.lua
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
2
|
local ____log = require("functions.log")
|
|
3
3
|
local log = ____log.log
|
|
4
|
+
--- Helper function to get a stack trace.
|
|
5
|
+
--
|
|
6
|
+
-- This will only work if the `--luadebug` launch option is enabled or the Racing+ sandbox is
|
|
7
|
+
-- enabled.
|
|
4
8
|
function ____exports.getTraceback(self)
|
|
5
9
|
if debug ~= nil then
|
|
6
10
|
return debug.traceback()
|
|
@@ -10,9 +14,23 @@ function ____exports.getTraceback(self)
|
|
|
10
14
|
end
|
|
11
15
|
return "stack traceback:\n(the \"--luadebug\" flag is not enabled)"
|
|
12
16
|
end
|
|
17
|
+
--- Players can boot the game with an launch option called "--luadebug", which will enable additional
|
|
18
|
+
-- functionality that is considered to be unsafe. For more information about this flag, see the
|
|
19
|
+
-- wiki: https://bindingofisaacrebirth.fandom.com/wiki/Launch_Options
|
|
20
|
+
--
|
|
21
|
+
-- When this flag is enabled, the global environment will be slightly different. The differences are
|
|
22
|
+
-- documented here: https://wofsauge.github.io/IsaacDocs/rep/Globals.html
|
|
23
|
+
--
|
|
24
|
+
-- This function uses the `package` global variable as a proxy to determine if the "--luadebug" flag
|
|
25
|
+
-- is enabled or not.
|
|
13
26
|
function ____exports.isLuaDebugEnabled(self)
|
|
14
27
|
return package ~= nil
|
|
15
28
|
end
|
|
29
|
+
--- Helper function to print a stack trace to the "log.txt" file, similar to JavaScript's
|
|
30
|
+
-- `console.trace` function.
|
|
31
|
+
--
|
|
32
|
+
-- This will only work if the `--luadebug` launch option is enabled or the Racing+ sandbox is
|
|
33
|
+
-- enabled.
|
|
16
34
|
function ____exports.traceback(self)
|
|
17
35
|
local tracebackOutput = ____exports.getTraceback(nil)
|
|
18
36
|
log(tracebackOutput)
|