isaacscript-common 2.3.2 → 3.0.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.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/postSlotInitUpdate.lua +2 -0
- package/callbacks/postSlotRender.lua +2 -0
- 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.lua +6 -0
- package/callbacks/subscriptions/postDoorRender.lua +6 -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.lua +6 -0
- package/callbacks/subscriptions/postPickupInitLate.lua +6 -0
- package/callbacks/subscriptions/postPickupStateChanged.lua +6 -0
- package/callbacks/subscriptions/postPitRender.lua +6 -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.lua +6 -0
- package/callbacks/subscriptions/postPoopUpdate.lua +6 -0
- package/callbacks/subscriptions/postPressurePlateRender.lua +6 -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.lua +6 -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.lua +6 -0
- package/callbacks/subscriptions/postSpikesUpdate.lua +6 -0
- package/callbacks/subscriptions/postTNTRender.lua +6 -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.lua +90 -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/main.lua +6 -0
- package/features/saveDataManager/maps.lua +3 -0
- package/features/saveDataManager/merge.lua +20 -0
- package/features/sirenHelpers.lua +13 -0
- package/features/taintedLazarusPlayers.lua +11 -0
- package/featuresInitialized.lua +6 -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.lua +4 -0
- package/functions/collectibleCacheFlag.lua +15 -0
- package/functions/collectibleSet.lua +3 -0
- package/functions/collectibleTag.lua +9 -0
- package/functions/collectibles.lua +131 -0
- package/functions/color.lua +18 -0
- package/functions/debug.lua +18 -0
- package/functions/deepCopy.lua +25 -0
- package/functions/doors.lua +53 -0
- package/functions/entity.lua +88 -0
- package/functions/entitySpecific.lua +182 -0
- package/functions/entityTypes.d.ts +1 -1
- package/functions/entityTypes.lua +1 -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 +6 -0
- package/functions/gridEntity.lua +105 -0
- package/functions/gridEntitySpecific.lua +8 -0
- package/functions/input.lua +11 -0
- package/functions/isaacAPIClass.lua +12 -0
- package/functions/jsonHelpers.lua +11 -0
- package/functions/jsonRoom.lua +5 -0
- package/functions/kColor.lua +9 -0
- package/functions/language.lua +5 -0
- package/functions/log.lua +28 -0
- 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.lua +67 -0
- package/functions/pills.lua +45 -0
- package/functions/player.lua +166 -0
- package/functions/playerDataStructures.lua +65 -0
- package/functions/playerHealth.lua +10 -0
- package/functions/playerIndex.lua +47 -0
- package/functions/pocketItems.lua +18 -0
- package/functions/positionVelocity.lua +46 -0
- package/functions/random.lua +32 -0
- package/functions/revive.lua +15 -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 +4 -0
- package/functions/set.lua +22 -0
- package/functions/spawnCollectible.lua +24 -0
- package/functions/sprite.lua +25 -0
- package/functions/stage.lua +16 -0
- package/functions/string.lua +6 -0
- package/functions/table.lua +19 -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.lua +9 -0
- package/functions/ui.lua +16 -0
- package/functions/utils.d.ts +1 -0
- package/functions/utils.lua +88 -0
- package/functions/vector.lua +9 -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/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/PickingUpItem.lua +7 -0
- package/upgradeMod.d.ts +4 -4
- package/upgradeMod.lua +18 -0
|
@@ -25,6 +25,7 @@ function initCacheFlagMap(self)
|
|
|
25
25
|
CACHE_FLAG_TO_TRINKETS_MAP:set(cacheFlag, trinketsSet)
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
|
+
--- Returns a set containing every trinket type with the given cache flag, including modded trinkets.
|
|
28
29
|
function ____exports.getTrinketsForCacheFlag(self, cacheFlag)
|
|
29
30
|
if CACHE_FLAG_TO_TRINKETS_MAP.size == 0 then
|
|
30
31
|
initCacheFlagMap(nil)
|
|
@@ -36,6 +37,8 @@ function ____exports.getTrinketsForCacheFlag(self, cacheFlag)
|
|
|
36
37
|
return copySet(nil, trinketsSet)
|
|
37
38
|
end
|
|
38
39
|
CACHE_FLAG_TO_TRINKETS_MAP = __TS__New(Map)
|
|
40
|
+
--- Returns a map containing every trinket type that the player has that matches the provided
|
|
41
|
+
-- CacheFlag. The values of the map correspond to the multiplier for that trinket.
|
|
39
42
|
function ____exports.getPlayerTrinketsForCacheFlag(self, player, cacheFlag)
|
|
40
43
|
local trinketsForCacheFlag = ____exports.getTrinketsForCacheFlag(nil, cacheFlag)
|
|
41
44
|
local playerTrinkets = __TS__New(Map)
|
|
@@ -9,6 +9,11 @@ local ____trinkets = require("functions.trinkets")
|
|
|
9
9
|
local getGoldenTrinketType = ____trinkets.getGoldenTrinketType
|
|
10
10
|
local ____utils = require("functions.utils")
|
|
11
11
|
local ____repeat = ____utils["repeat"]
|
|
12
|
+
--- Helper function to temporarily removes a player's held trinkets, if any. This will not remove any
|
|
13
|
+
-- smelted trinkets. Use this in combination with the `giveTrinketsBack` function to take away and
|
|
14
|
+
-- give back trinkets on the same frame.
|
|
15
|
+
--
|
|
16
|
+
-- @returns Undefined if the player does not have any trinkets, or TrinketSituation if they do.
|
|
12
17
|
function ____exports.temporarilyRemoveTrinkets(self, player)
|
|
13
18
|
local trinketType1 = player:GetTrinket(TrinketSlot.SLOT_1)
|
|
14
19
|
local trinketType2 = player:GetTrinket(TrinketSlot.SLOT_2)
|
|
@@ -23,6 +28,9 @@ function ____exports.temporarilyRemoveTrinkets(self, player)
|
|
|
23
28
|
end
|
|
24
29
|
return {trinketTypeRemoved = TrinketType.NULL, trinketType1 = trinketType1, trinketType2 = trinketType2, numSmeltedTrinkets = 0}
|
|
25
30
|
end
|
|
31
|
+
--- Helper function to restore the player's trinkets back to the way they were before the
|
|
32
|
+
-- `temporarilyRemoveTrinket` function was used. It will re-smelt any smelted trinkets that were
|
|
33
|
+
-- removed.
|
|
26
34
|
function ____exports.giveTrinketsBack(self, player, trinketSituation)
|
|
27
35
|
if trinketSituation == nil then
|
|
28
36
|
return
|
|
@@ -50,6 +58,14 @@ function ____exports.giveTrinketsBack(self, player, trinketSituation)
|
|
|
50
58
|
player:AddTrinket(trinketSituation.trinketType2, false)
|
|
51
59
|
end
|
|
52
60
|
end
|
|
61
|
+
--- Helper function to smelt a trinket. Before smelting, this function will automatically remove the
|
|
62
|
+
-- trinkets that the player is holding, if any, and then give them back after the new trinket is
|
|
63
|
+
-- smelted.
|
|
64
|
+
--
|
|
65
|
+
-- @param player The player to smelt the trinkets to.
|
|
66
|
+
-- @param trinketType The trinket type to smelt.
|
|
67
|
+
-- @param numTrinkets Optional. If specified, will smelt the given number of trinkets. Use this to
|
|
68
|
+
-- avoid calling this function multiple times. Default is 1.
|
|
53
69
|
function ____exports.smeltTrinket(self, player, trinketType, numTrinkets)
|
|
54
70
|
if numTrinkets == nil then
|
|
55
71
|
numTrinkets = 1
|
|
@@ -65,6 +81,14 @@ function ____exports.smeltTrinket(self, player, trinketType, numTrinkets)
|
|
|
65
81
|
)
|
|
66
82
|
____exports.giveTrinketsBack(nil, player, trinketSituation)
|
|
67
83
|
end
|
|
84
|
+
--- Helper function to temporarily remove a specific kind of trinket from the player. Use this in
|
|
85
|
+
-- combination with the `giveTrinketsBack` function to take away and give back a trinket on the same
|
|
86
|
+
-- frame. This function correctly handles multiple trinket slots and ensures that all copies of the
|
|
87
|
+
-- trinket are removed, including smelted trinkets.
|
|
88
|
+
--
|
|
89
|
+
-- Note that one smelted golden trinket is the same as two smelted normal trinkets.
|
|
90
|
+
--
|
|
91
|
+
-- @returns Undefined if the player does not have the trinket, or TrinketSituation if they do.
|
|
68
92
|
function ____exports.temporarilyRemoveTrinket(self, player, trinketType)
|
|
69
93
|
if not player:HasTrinket(trinketType) then
|
|
70
94
|
return nil
|
package/functions/trinkets.lua
CHANGED
|
@@ -28,17 +28,41 @@ local ____sprite = require("functions.sprite")
|
|
|
28
28
|
local clearSprite = ____sprite.clearSprite
|
|
29
29
|
local ____utils = require("functions.utils")
|
|
30
30
|
local irange = ____utils.irange
|
|
31
|
+
--- Add this to a `TrinketType` to get the corresponding golden trinket type.
|
|
32
|
+
--
|
|
33
|
+
-- Corresponds to the vanilla `PillColor.TRINKET_GOLDEN_FLAG` value.
|
|
34
|
+
--
|
|
35
|
+
-- 1 << 15
|
|
31
36
|
local GOLDEN_TRINKET_ADJUSTMENT = 32768
|
|
32
37
|
local TRINKET_SPRITE_LAYER = 0
|
|
38
|
+
--- Helper function to get the corresponding golden trinket type from a normal trinket type.
|
|
39
|
+
--
|
|
40
|
+
-- For example, passing `TrinketType.SWALLOWED_PENNY` would result in 32769, which is the value that
|
|
41
|
+
-- corresponds to the golden trinket sub-type for Swallowed Penny.
|
|
33
42
|
function ____exports.getGoldenTrinketType(self, trinketType)
|
|
34
43
|
return trinketType + GOLDEN_TRINKET_ADJUSTMENT
|
|
35
44
|
end
|
|
45
|
+
--- Helper function to get an array that represents every modded trinket type.
|
|
46
|
+
--
|
|
47
|
+
-- Returns an empty array if there are no modded trinket types.
|
|
36
48
|
function ____exports.getModdedTrinketTypes(self)
|
|
37
49
|
if LAST_VANILLA_TRINKET_TYPE == LAST_TRINKET_TYPE then
|
|
38
50
|
return {}
|
|
39
51
|
end
|
|
40
52
|
return irange(nil, FIRST_MODDED_TRINKET_TYPE, LAST_TRINKET_TYPE)
|
|
41
53
|
end
|
|
54
|
+
--- Returns the slot number corresponding to where a trinket can be safely inserted.
|
|
55
|
+
--
|
|
56
|
+
-- For example:
|
|
57
|
+
--
|
|
58
|
+
-- ```ts
|
|
59
|
+
-- const player = Isaac.GetPlayer();
|
|
60
|
+
-- const trinketSlot = getOpenTrinketSlotNum(player);
|
|
61
|
+
-- if (trinketSlot !== undefined) {
|
|
62
|
+
-- // They have one or more open trinket slots
|
|
63
|
+
-- player.AddTrinket(TrinketType.SWALLOWED_PENNY);
|
|
64
|
+
-- }
|
|
65
|
+
-- ```
|
|
42
66
|
function ____exports.getOpenTrinketSlot(self, player)
|
|
43
67
|
local maxTrinkets = player:GetMaxTrinkets()
|
|
44
68
|
local trinketType1 = player:GetTrinket(TrinketSlot.SLOT_1)
|
|
@@ -54,6 +78,8 @@ function ____exports.getOpenTrinketSlot(self, player)
|
|
|
54
78
|
end
|
|
55
79
|
return error("The player has an unknown number of trinket slots: " .. tostring(maxTrinkets))
|
|
56
80
|
end
|
|
81
|
+
--- Helper function to get the in-game description for a trinket. Returns "Unknown" if the provided
|
|
82
|
+
-- trinket type was not valid.
|
|
57
83
|
function ____exports.getTrinketDescription(self, trinketType)
|
|
58
84
|
local trinketDescription = TRINKET_DESCRIPTION_MAP:get(trinketType)
|
|
59
85
|
if trinketDescription ~= nil then
|
|
@@ -65,6 +91,15 @@ function ____exports.getTrinketDescription(self, trinketType)
|
|
|
65
91
|
end
|
|
66
92
|
return DEFAULT_TRINKET_DESCRIPTION
|
|
67
93
|
end
|
|
94
|
+
--- Helper function to get the name of a trinket. Returns "Unknown" if the provided trinket type is
|
|
95
|
+
-- not valid.
|
|
96
|
+
--
|
|
97
|
+
-- For example:
|
|
98
|
+
--
|
|
99
|
+
-- ```ts
|
|
100
|
+
-- const trinketType = TrinketType.SWALLOWED_PENNY;
|
|
101
|
+
-- const trinketName = getTrinketName(trinketType); // trinketName is "Swallowed Penny"
|
|
102
|
+
-- ```
|
|
68
103
|
function ____exports.getTrinketName(self, trinketType)
|
|
69
104
|
local trinketName = TRINKET_NAME_MAP:get(trinketType)
|
|
70
105
|
if trinketName ~= nil then
|
|
@@ -76,12 +111,19 @@ function ____exports.getTrinketName(self, trinketType)
|
|
|
76
111
|
end
|
|
77
112
|
return DEFAULT_TRINKET_NAME
|
|
78
113
|
end
|
|
114
|
+
--- Helper function to get an array that contains every trinket type.
|
|
79
115
|
function ____exports.getTrinketTypes(self)
|
|
80
116
|
return irange(nil, FIRST_TRINKET_TYPE, LAST_TRINKET_TYPE)
|
|
81
117
|
end
|
|
118
|
+
--- Helper function to get an array that represents every vanilla trinket type.
|
|
82
119
|
function ____exports.getVanillaTrinketTypes(self)
|
|
83
120
|
return irange(nil, FIRST_TRINKET_TYPE, LAST_VANILLA_TRINKET_TYPE)
|
|
84
121
|
end
|
|
122
|
+
--- Returns whether or not the player can hold an additional trinket, beyond what they are currently
|
|
123
|
+
-- carrying. This takes into account items that modify the max number of trinkets, like Mom's Purse.
|
|
124
|
+
--
|
|
125
|
+
-- If the player is the Tainted Soul, this always returns false, since that character cannot pick up
|
|
126
|
+
-- items. (Only Tainted Forgotten can pick up items.)
|
|
85
127
|
function ____exports.hasOpenTrinketSlot(self, player)
|
|
86
128
|
if isCharacter(nil, player, PlayerType.THE_SOUL_B) then
|
|
87
129
|
return false
|
|
@@ -92,6 +134,16 @@ end
|
|
|
92
134
|
function ____exports.isGoldenTrinket(self, trinketType)
|
|
93
135
|
return trinketType > GOLDEN_TRINKET_ADJUSTMENT
|
|
94
136
|
end
|
|
137
|
+
--- Helper function to change the sprite of a trinket entity.
|
|
138
|
+
--
|
|
139
|
+
-- For more information about removing the trinket sprite, see the documentation for the
|
|
140
|
+
-- "clearSprite" helper function.
|
|
141
|
+
--
|
|
142
|
+
-- @param trinket The trinket whose sprite you want to modify.
|
|
143
|
+
-- @param pngPath Equal to either the spritesheet path to load (e.g.
|
|
144
|
+
-- "gfx/items/trinkets/trinket_001_swallowedpenny.png") or undefined. If undefined,
|
|
145
|
+
-- the sprite will be removed, making it appear like the collectible has already been
|
|
146
|
+
-- taken by the player.
|
|
95
147
|
function ____exports.setTrinketSprite(self, trinket, pngPath)
|
|
96
148
|
if not isTrinket(nil, trinket) then
|
|
97
149
|
local entityID = getEntityID(nil, trinket)
|
package/functions/tstlClass.lua
CHANGED
|
@@ -9,6 +9,8 @@ local ____exports = {}
|
|
|
9
9
|
local newTSTLClassFromMetatable
|
|
10
10
|
local ____DefaultMap = require("classes.DefaultMap")
|
|
11
11
|
local DefaultMap = ____DefaultMap.DefaultMap
|
|
12
|
+
--- Returns whether or not this is a class that is provided as part of the TypeScriptToLua
|
|
13
|
+
-- transpiler, such as a `Map` or a `Set`.
|
|
12
14
|
function ____exports.isVanillaTSTLClass(self, object)
|
|
13
15
|
return __TS__InstanceOf(object, Map) or __TS__InstanceOf(object, Set) or __TS__InstanceOf(object, WeakMap) or __TS__InstanceOf(object, WeakSet)
|
|
14
16
|
end
|
|
@@ -19,9 +21,12 @@ function newTSTLClassFromMetatable(self, metatable)
|
|
|
19
21
|
return newClass
|
|
20
22
|
end
|
|
21
23
|
local TSTL_CLASS_METATABLE_KEYS = __TS__New(Set, {"____constructor", "__index", "constructor"})
|
|
24
|
+
--- Returns whether or not this is a class that is provided by the `isaacscript-common` library, such
|
|
25
|
+
-- as a `DefaultMap`.
|
|
22
26
|
function ____exports.isIsaacScriptCommonClass(self, object)
|
|
23
27
|
return __TS__InstanceOf(object, DefaultMap)
|
|
24
28
|
end
|
|
29
|
+
--- TypeScriptToLua classes are Lua tables that have a metatable with a certain amount of keys.
|
|
25
30
|
function ____exports.isUserDefinedTSTLClass(self, object)
|
|
26
31
|
if ____exports.isVanillaTSTLClass(nil, object) or ____exports.isIsaacScriptCommonClass(nil, object) then
|
|
27
32
|
return false
|
|
@@ -46,6 +51,10 @@ function ____exports.isUserDefinedTSTLClass(self, object)
|
|
|
46
51
|
end
|
|
47
52
|
return numKeys == TSTL_CLASS_METATABLE_KEYS.size
|
|
48
53
|
end
|
|
54
|
+
--- Initializes a new TypeScriptToLua class in the situation where you do not know what kind of class
|
|
55
|
+
-- it is. This function requires that you provide an instantiated class of the same type, as it will
|
|
56
|
+
-- use the class constructor that is present on the other object's metatable to initialize the new
|
|
57
|
+
-- class.
|
|
49
58
|
function ____exports.newTSTLClass(self, oldClass)
|
|
50
59
|
local metatable = getmetatable(oldClass)
|
|
51
60
|
if metatable == nil then
|
package/functions/ui.lua
CHANGED
|
@@ -14,6 +14,14 @@ function ____exports.getScreenBottomRightPos(self)
|
|
|
14
14
|
local screenHeight = Isaac.GetScreenHeight()
|
|
15
15
|
return Vector(screenWidth, screenHeight)
|
|
16
16
|
end
|
|
17
|
+
--- In the options menu, players have the ability to set a HUD offset. However, mods do not have
|
|
18
|
+
-- access to this value. To get around this, Mod Config Menu provides a separate HUD offset setting
|
|
19
|
+
-- on the first page of the menu. This is intended to be set by end-users to match their vanilla HUD
|
|
20
|
+
-- offset setting so that mods can render UI elements to the screen in the correct position.
|
|
21
|
+
--
|
|
22
|
+
-- @returns If the user does not have Mod Config Menu enabled, or does not have this option set,
|
|
23
|
+
-- then this function will return `Vector.Zero.` Otherwise, it will return a Vector that
|
|
24
|
+
-- represents a HUD offset that should be added to the position of a UI element.
|
|
17
25
|
function ____exports.getHUDOffsetVector(self)
|
|
18
26
|
local defaultVector = copyVector(nil, VectorZero)
|
|
19
27
|
local hudOffset = math.floor(Options.HUDOffset * 10)
|
|
@@ -30,6 +38,8 @@ function ____exports.getHUDOffsetVector(self)
|
|
|
30
38
|
end
|
|
31
39
|
return Vector(x, y)
|
|
32
40
|
end
|
|
41
|
+
--- Returns how many hearts are in the heart UI row. If the player has more than 6 hearts, this
|
|
42
|
+
-- function will return 6.
|
|
33
43
|
function ____exports.getHeartRowLength(self, player)
|
|
34
44
|
local maxHearts = player:GetMaxHearts()
|
|
35
45
|
local soulHearts = player:GetSoulHearts()
|
|
@@ -38,6 +48,9 @@ function ____exports.getHeartRowLength(self, player)
|
|
|
38
48
|
local heartRowLength = combinedHearts / 2
|
|
39
49
|
return math.min(heartRowLength, 6)
|
|
40
50
|
end
|
|
51
|
+
--- Helper function to get the width of the first player's hearts on the UI. This is useful for
|
|
52
|
+
-- drawing UI elements to the right of where the player's hearts are. Make sure to use this in
|
|
53
|
+
-- combination with the the `getHUDOffsetVector` helper function.
|
|
41
54
|
function ____exports.getHeartsUIWidth(self)
|
|
42
55
|
local level = game:GetLevel()
|
|
43
56
|
local curses = level:GetCurses()
|
|
@@ -81,6 +94,9 @@ function ____exports.getScreenTopRightPos(self)
|
|
|
81
94
|
local bottomRight = ____exports.getScreenBottomRightPos(nil)
|
|
82
95
|
return Vector(bottomRight.X, 0)
|
|
83
96
|
end
|
|
97
|
+
--- Get how many hearts are currently being shown on the hearts UI.
|
|
98
|
+
--
|
|
99
|
+
-- This function is originally from piber20 Helper.
|
|
84
100
|
function ____exports.getVisibleHearts(self, player)
|
|
85
101
|
local effectiveMaxHearts = player:GetEffectiveMaxHearts()
|
|
86
102
|
local soulHearts = player:GetSoulHearts()
|
package/functions/utils.d.ts
CHANGED
|
@@ -65,6 +65,7 @@ export declare function hexToKColor(hexString: string, alpha: float): KColor;
|
|
|
65
65
|
* If only one argument is specified, then it will assume that the start is 0.
|
|
66
66
|
*/
|
|
67
67
|
export declare function irange(start: int, end?: int): int[];
|
|
68
|
+
export declare function isPrimitive(variable: unknown): boolean;
|
|
68
69
|
/**
|
|
69
70
|
* Since this is a UI element, we do not want to draw it in water reflections. `renderOffset` will
|
|
70
71
|
* be a non-zero value in reflections.
|
package/functions/utils.lua
CHANGED
|
@@ -1,13 +1,54 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__StringReplace = ____lualib.__TS__StringReplace
|
|
3
3
|
local __TS__StringSubstr = ____lualib.__TS__StringSubstr
|
|
4
|
+
local __TS__TypeOf = ____lualib.__TS__TypeOf
|
|
4
5
|
local ____exports = {}
|
|
5
6
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
6
7
|
local RenderMode = ____isaac_2Dtypescript_2Ddefinitions.RenderMode
|
|
7
8
|
local ____cachedClasses = require("cachedClasses")
|
|
8
9
|
local game = ____cachedClasses.game
|
|
9
10
|
local HEX_STRING_LENGTH = 6
|
|
11
|
+
--- Helper function to get type safety on a switch statement.
|
|
12
|
+
--
|
|
13
|
+
-- Very useful to be future-safe against people adding values to a type or an enum.
|
|
14
|
+
--
|
|
15
|
+
-- For example:
|
|
16
|
+
--
|
|
17
|
+
-- ```ts
|
|
18
|
+
-- enum Situation {
|
|
19
|
+
-- ONE,
|
|
20
|
+
-- TWO,
|
|
21
|
+
-- THREE,
|
|
22
|
+
-- // FOUR, // If we uncomment this line, the program will no longer compile
|
|
23
|
+
-- }
|
|
24
|
+
--
|
|
25
|
+
-- function handleSituation(situation: Situation) {
|
|
26
|
+
-- switch (situation) {
|
|
27
|
+
-- case Situation.ONE: {
|
|
28
|
+
-- return 41;
|
|
29
|
+
-- }
|
|
30
|
+
--
|
|
31
|
+
-- case Situation.TWO: {
|
|
32
|
+
-- return 68;
|
|
33
|
+
-- }
|
|
34
|
+
--
|
|
35
|
+
-- case Situation.THREE: {
|
|
36
|
+
-- return 12;
|
|
37
|
+
-- }
|
|
38
|
+
--
|
|
39
|
+
-- default: {
|
|
40
|
+
-- return ensureAllCases(situation);
|
|
41
|
+
-- }
|
|
42
|
+
-- }
|
|
43
|
+
-- }
|
|
44
|
+
-- ```
|
|
10
45
|
____exports.ensureAllCases = function(____, obj) return obj end
|
|
46
|
+
--- Helper function to return an array with the elements from start to end. It is inclusive at the
|
|
47
|
+
-- start and exclusive at the end. (The "e" stands for exclusive.)
|
|
48
|
+
--
|
|
49
|
+
-- For example, `erange(1, 3)` will return `[1, 2]`.
|
|
50
|
+
--
|
|
51
|
+
-- If only one argument is specified, then it will assume that the start is 0.
|
|
11
52
|
function ____exports.erange(self, start, ____end)
|
|
12
53
|
if ____end == nil then
|
|
13
54
|
____end = start
|
|
@@ -23,6 +64,8 @@ function ____exports.erange(self, start, ____end)
|
|
|
23
64
|
end
|
|
24
65
|
return array
|
|
25
66
|
end
|
|
67
|
+
--- Helper function to log what is happening in functions that recursively move through nested data
|
|
68
|
+
-- structures.
|
|
26
69
|
function ____exports.getTraversalDescription(self, key, traversalDescription)
|
|
27
70
|
if traversalDescription ~= "" then
|
|
28
71
|
traversalDescription = traversalDescription .. " --> "
|
|
@@ -30,6 +73,9 @@ function ____exports.getTraversalDescription(self, key, traversalDescription)
|
|
|
30
73
|
traversalDescription = traversalDescription .. tostring(key)
|
|
31
74
|
return traversalDescription
|
|
32
75
|
end
|
|
76
|
+
--- Converts a hex string like "#33aa33" to a KColor object.
|
|
77
|
+
--
|
|
78
|
+
-- @param hexString A hex string like "#ffffff" or "ffffff". (The "#" character is optional.)
|
|
33
79
|
function ____exports.hexToKColor(self, hexString, alpha)
|
|
34
80
|
hexString = __TS__StringReplace(hexString, "#", "")
|
|
35
81
|
if #hexString ~= HEX_STRING_LENGTH then
|
|
@@ -53,6 +99,12 @@ function ____exports.hexToKColor(self, hexString, alpha)
|
|
|
53
99
|
local base = 255
|
|
54
100
|
return KColor(R / base, G / base, B / base, alpha)
|
|
55
101
|
end
|
|
102
|
+
--- Helper function to return an array with the elements from start to end, inclusive. (The "i"
|
|
103
|
+
-- stands for inclusive.)
|
|
104
|
+
--
|
|
105
|
+
-- For example, `irange(1, 3)` will return `[1, 2, 3]`.
|
|
106
|
+
--
|
|
107
|
+
-- If only one argument is specified, then it will assume that the start is 0.
|
|
56
108
|
function ____exports.irange(self, start, ____end)
|
|
57
109
|
if ____end == nil then
|
|
58
110
|
____end = start
|
|
@@ -68,18 +120,46 @@ function ____exports.irange(self, start, ____end)
|
|
|
68
120
|
end
|
|
69
121
|
return array
|
|
70
122
|
end
|
|
123
|
+
function ____exports.isPrimitive(self, variable)
|
|
124
|
+
local ____type = __TS__TypeOf(variable)
|
|
125
|
+
return ____type == "boolean" or ____type == "number" or ____type == "string"
|
|
126
|
+
end
|
|
127
|
+
--- Since this is a UI element, we do not want to draw it in water reflections. `renderOffset` will
|
|
128
|
+
-- be a non-zero value in reflections.
|
|
71
129
|
function ____exports.isReflectionRender(self)
|
|
72
130
|
local room = game:GetRoom()
|
|
73
131
|
local renderMode = room:GetRenderMode()
|
|
74
132
|
return renderMode == RenderMode.WATER_REFLECT
|
|
75
133
|
end
|
|
134
|
+
--- Helper function to print something to the in-game console. Use this instead of invoking the
|
|
135
|
+
-- `Isaac.ConsoleOutput` method directly because it will automatically insert a newline at the end
|
|
136
|
+
-- of the message (which `Isaac.ConsoleOutput` does not do by default).
|
|
76
137
|
function ____exports.printConsole(self, msg)
|
|
77
138
|
Isaac.ConsoleOutput(msg .. "\n")
|
|
78
139
|
end
|
|
140
|
+
--- Helper function to print whether something was enabled or disabled to the in-game console.
|
|
79
141
|
function ____exports.printEnabled(self, enabled, description)
|
|
80
142
|
local enabledText = enabled and "Enabled" or "Disabled"
|
|
81
143
|
____exports.printConsole(nil, ((enabledText .. " ") .. description) .. ".")
|
|
82
144
|
end
|
|
145
|
+
--- Helper function to repeat code N times. This is faster to type and cleaner than using a for loop.
|
|
146
|
+
--
|
|
147
|
+
-- For example:
|
|
148
|
+
--
|
|
149
|
+
-- ```ts
|
|
150
|
+
-- const player = Isaac.GetPlayer();
|
|
151
|
+
-- repeat(10, () => {
|
|
152
|
+
-- player.AddCollectible(CollectibleType.STEVEN);
|
|
153
|
+
-- });
|
|
154
|
+
-- ```
|
|
155
|
+
--
|
|
156
|
+
-- The repeated function is passed the index of the iteration, if needed:
|
|
157
|
+
--
|
|
158
|
+
-- ```ts
|
|
159
|
+
-- repeat(3, (i) => {
|
|
160
|
+
-- print(i); // Prints "0", "1", "2"
|
|
161
|
+
-- });
|
|
162
|
+
-- ```
|
|
83
163
|
____exports["repeat"] = function(self, n, func)
|
|
84
164
|
do
|
|
85
165
|
local i = 0
|
|
@@ -89,6 +169,14 @@ ____exports["repeat"] = function(self, n, func)
|
|
|
89
169
|
end
|
|
90
170
|
end
|
|
91
171
|
end
|
|
172
|
+
--- Helper function to signify that the enclosing code block is not yet complete. Using this function
|
|
173
|
+
-- is similar to writing a "TODO" comment, but it has the benefit of preventing ESLint errors due to
|
|
174
|
+
-- early returns.
|
|
175
|
+
--
|
|
176
|
+
-- When you see this function, it simply means that the programmer intends to add in more code to
|
|
177
|
+
-- this spot later.
|
|
178
|
+
--
|
|
179
|
+
-- This function does not actually do anything. (It is an "empty" function.)
|
|
92
180
|
function ____exports.todo(self)
|
|
93
181
|
end
|
|
94
182
|
return ____exports
|
package/functions/vector.lua
CHANGED
|
@@ -15,11 +15,17 @@ local getNumbersFromTable = ____table.getNumbersFromTable
|
|
|
15
15
|
local tableHasKeys = ____table.tableHasKeys
|
|
16
16
|
local ____utils = require("functions.utils")
|
|
17
17
|
local ensureAllCases = ____utils.ensureAllCases
|
|
18
|
+
--- Helper function to check if something is an instantiated Vector object.
|
|
18
19
|
function ____exports.isVector(self, object)
|
|
19
20
|
return isIsaacAPIClassOfType(nil, object, OBJECT_NAME)
|
|
20
21
|
end
|
|
21
22
|
local KEYS = {"X", "Y"}
|
|
22
23
|
OBJECT_NAME = "Vector"
|
|
24
|
+
--- Helper function to copy a `Vector` object.
|
|
25
|
+
--
|
|
26
|
+
-- @param vector The vector to copy. In the case of deserialization, this will actually be a Lua
|
|
27
|
+
-- table instead of an instantiated Vector class.
|
|
28
|
+
-- @param serializationType Default is `SerializationType.NONE`.
|
|
23
29
|
function ____exports.copyVector(self, vector, serializationType)
|
|
24
30
|
if serializationType == nil then
|
|
25
31
|
serializationType = SerializationType.NONE
|
|
@@ -76,6 +82,8 @@ function ____exports.copyVector(self, vector, serializationType)
|
|
|
76
82
|
end
|
|
77
83
|
until true
|
|
78
84
|
end
|
|
85
|
+
--- Used to determine is the given table is a serialized `Vector` object created by the save data
|
|
86
|
+
-- manager and/or the `deepCopy` function.
|
|
79
87
|
function ____exports.isSerializedVector(self, object)
|
|
80
88
|
local objectType = type(object)
|
|
81
89
|
if objectType ~= "table" then
|
|
@@ -91,6 +99,7 @@ end
|
|
|
91
99
|
function ____exports.vectorEquals(self, vector1, vector2)
|
|
92
100
|
return isaacAPIClassEquals(nil, vector1, vector2, KEYS)
|
|
93
101
|
end
|
|
102
|
+
--- Helper function for finding out which way a vector is pointing.
|
|
94
103
|
function ____exports.vectorToDirection(self, vector)
|
|
95
104
|
local degrees = vector:GetAngleDegrees()
|
|
96
105
|
if degrees > -45 and degrees < 45 then
|
package/lualib_bundle.lua
CHANGED
|
@@ -753,7 +753,7 @@ local function __TS__AsyncAwaiter(generator)
|
|
|
753
753
|
return __TS__New(
|
|
754
754
|
__TS__Promise,
|
|
755
755
|
function(____, resolve, reject)
|
|
756
|
-
local adopt, fulfilled,
|
|
756
|
+
local adopt, fulfilled, step, resolved, asyncCoroutine
|
|
757
757
|
function adopt(self, value)
|
|
758
758
|
local ____temp_0
|
|
759
759
|
if __TS__InstanceOf(value, __TS__Promise) then
|
|
@@ -764,57 +764,44 @@ local function __TS__AsyncAwaiter(generator)
|
|
|
764
764
|
return ____temp_0
|
|
765
765
|
end
|
|
766
766
|
function fulfilled(self, value)
|
|
767
|
-
local success,
|
|
767
|
+
local success, resultOrError = coroutine.resume(asyncCoroutine, value)
|
|
768
768
|
if success then
|
|
769
|
-
step(nil, resultOrError
|
|
769
|
+
step(nil, resultOrError)
|
|
770
770
|
else
|
|
771
|
-
reject(nil,
|
|
771
|
+
reject(nil, resultOrError)
|
|
772
772
|
end
|
|
773
773
|
end
|
|
774
|
-
function
|
|
775
|
-
if
|
|
776
|
-
return
|
|
777
|
-
local success, hasReturnedOrError, returnedValue = pcall(handler, value)
|
|
778
|
-
if success then
|
|
779
|
-
if hasReturnedOrError then
|
|
780
|
-
resolve(nil, returnedValue)
|
|
781
|
-
else
|
|
782
|
-
step(nil, hasReturnedOrError, handler)
|
|
783
|
-
end
|
|
784
|
-
else
|
|
785
|
-
reject(nil, hasReturnedOrError)
|
|
786
|
-
end
|
|
787
|
-
end
|
|
788
|
-
else
|
|
789
|
-
return function(____, value)
|
|
790
|
-
reject(nil, value)
|
|
791
|
-
end
|
|
774
|
+
function step(self, result)
|
|
775
|
+
if resolved then
|
|
776
|
+
return
|
|
792
777
|
end
|
|
793
|
-
end
|
|
794
|
-
function step(self, result, errorHandler)
|
|
795
778
|
if coroutine.status(asyncCoroutine) == "dead" then
|
|
796
779
|
resolve(nil, result)
|
|
797
780
|
else
|
|
798
781
|
local ____self_1 = adopt(nil, result)
|
|
799
|
-
____self_1["then"](
|
|
800
|
-
____self_1,
|
|
801
|
-
fulfilled,
|
|
802
|
-
rejected(nil, errorHandler)
|
|
803
|
-
)
|
|
782
|
+
____self_1["then"](____self_1, fulfilled, reject)
|
|
804
783
|
end
|
|
805
784
|
end
|
|
785
|
+
resolved = false
|
|
806
786
|
asyncCoroutine = coroutine.create(generator)
|
|
807
|
-
local success,
|
|
787
|
+
local success, resultOrError = coroutine.resume(
|
|
788
|
+
asyncCoroutine,
|
|
789
|
+
function(____, v)
|
|
790
|
+
resolved = true
|
|
791
|
+
local ____self_2 = adopt(nil, v)
|
|
792
|
+
____self_2["then"](____self_2, resolve, reject)
|
|
793
|
+
end
|
|
794
|
+
)
|
|
808
795
|
if success then
|
|
809
|
-
step(nil, resultOrError
|
|
796
|
+
step(nil, resultOrError)
|
|
810
797
|
else
|
|
811
|
-
reject(nil,
|
|
798
|
+
reject(nil, resultOrError)
|
|
812
799
|
end
|
|
813
800
|
end
|
|
814
801
|
)
|
|
815
802
|
end
|
|
816
|
-
local function __TS__Await(
|
|
817
|
-
return coroutine.yield(
|
|
803
|
+
local function __TS__Await(thing)
|
|
804
|
+
return coroutine.yield(thing)
|
|
818
805
|
end
|
|
819
806
|
|
|
820
807
|
local function __TS__ClassExtends(target, base)
|
package/maps/cardMap.lua
CHANGED
|
@@ -4,6 +4,7 @@ local __TS__New = ____lualib.__TS__New
|
|
|
4
4
|
local ____exports = {}
|
|
5
5
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
6
6
|
local Card = ____isaac_2Dtypescript_2Ddefinitions.Card
|
|
7
|
+
--- Maps card names to card sub-types.
|
|
7
8
|
____exports.CARD_MAP = __TS__New(Map, {
|
|
8
9
|
{"fool", Card.FOOL},
|
|
9
10
|
{"magician", Card.MAGICIAN},
|
package/maps/characterMap.lua
CHANGED
|
@@ -2,6 +2,7 @@ local ____lualib = require("lualib_bundle")
|
|
|
2
2
|
local Map = ____lualib.Map
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
4
|
local ____exports = {}
|
|
5
|
+
--- Maps character names to character sub-types.
|
|
5
6
|
____exports.CHARACTER_MAP = __TS__New(Map, {
|
|
6
7
|
{"isaac", 0},
|
|
7
8
|
{"magdalene", 1},
|
|
@@ -7,6 +7,7 @@ local CacheFlag = ____isaac_2Dtypescript_2Ddefinitions.CacheFlag
|
|
|
7
7
|
local ____tears = require("functions.tears")
|
|
8
8
|
local getTearsStat = ____tears.getTearsStat
|
|
9
9
|
local DEFAULT_MAX_FIRE_DELAY = 10
|
|
10
|
+
--- The default fire delay is represented in the tear stat, not the `MaxFireDelay` value.
|
|
10
11
|
____exports.DEFAULT_PLAYER_STAT_MAP = __TS__New(
|
|
11
12
|
Map,
|
|
12
13
|
{
|
|
@@ -12,6 +12,8 @@ local PressurePlateVariant = ____isaac_2Dtypescript_2Ddefinitions.PressurePlateV
|
|
|
12
12
|
local RockVariant = ____isaac_2Dtypescript_2Ddefinitions.RockVariant
|
|
13
13
|
local StatueVariant = ____isaac_2Dtypescript_2Ddefinitions.StatueVariant
|
|
14
14
|
local TrapdoorVariant = ____isaac_2Dtypescript_2Ddefinitions.TrapdoorVariant
|
|
15
|
+
--- This maps the GridEntityXMLType (i.e. the type contained in the room XML/STB file) to the
|
|
16
|
+
-- GridEntityType and the variant used by the game.
|
|
15
17
|
____exports.GRID_ENTITY_XML_MAP = __TS__New(Map, {
|
|
16
18
|
{GridEntityXMLType.ROCK, {GridEntityType.ROCK, RockVariant.NORMAL}},
|
|
17
19
|
{GridEntityXMLType.ROCK_BOMB, {GridEntityType.ROCK_BOMB, 0}},
|
package/maps/pillEffectMap.lua
CHANGED
|
@@ -4,6 +4,7 @@ local __TS__New = ____lualib.__TS__New
|
|
|
4
4
|
local ____exports = {}
|
|
5
5
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
6
6
|
local PillEffect = ____isaac_2Dtypescript_2Ddefinitions.PillEffect
|
|
7
|
+
--- Maps pill effect names to the values of the `PillEffect` enum.
|
|
7
8
|
____exports.PILL_EFFECT_MAP = __TS__New(Map, {
|
|
8
9
|
{"badGas", PillEffect.BAD_GAS},
|
|
9
10
|
{"gas", PillEffect.BAD_GAS},
|
|
@@ -5,6 +5,8 @@ local ____exports = {}
|
|
|
5
5
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
6
6
|
local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
|
|
7
7
|
____exports.DEFAULT_TOP_LEFT_WALL_GRID_INDEX = 0
|
|
8
|
+
--- Only used for special room shapes where the top left wall grid index is not equal to
|
|
9
|
+
-- `DEFAULT_TOP_LEFT_WALL_GRID_INDEX`.
|
|
8
10
|
____exports.ROOM_SHAPE_TO_TOP_LEFT_WALL_GRID_INDEX_MAP = __TS__New(Map, {
|
|
9
11
|
{RoomShape.IH, 30},
|
|
10
12
|
{RoomShape.IV, 4},
|
package/maps/roomTypeMap.lua
CHANGED
|
@@ -4,6 +4,7 @@ local __TS__New = ____lualib.__TS__New
|
|
|
4
4
|
local ____exports = {}
|
|
5
5
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
6
6
|
local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
|
|
7
|
+
--- Maps room type names to room types.
|
|
7
8
|
____exports.ROOM_TYPE_MAP = __TS__New(Map, {
|
|
8
9
|
{"null", RoomType.NULL},
|
|
9
10
|
{"default", RoomType.DEFAULT},
|
|
@@ -4,6 +4,8 @@ local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
|
|
|
4
4
|
local ____constants = require("constants")
|
|
5
5
|
local VectorZero = ____constants.VectorZero
|
|
6
6
|
local TWO_BY_TWO_BOTTOM_RIGHT = Vector(25, 13)
|
|
7
|
+
--- "Vector(0, 0)" corresponds to the top left tile of a room, not including the walls. (The top-left
|
|
8
|
+
-- wall would be at "Vector(-1, -1)".)
|
|
7
9
|
____exports.L_ROOM_SHAPE_TO_RECTANGLES = {
|
|
8
10
|
[RoomShape.LTL] = {
|
|
9
11
|
Vector(13, 0),
|
package/objects/colors.lua
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
|
+
--- A collection of common colors that can be reused.
|
|
3
|
+
--
|
|
4
|
+
-- Note that if you want to further modify these colors, you should copy them first with the
|
|
5
|
+
-- `copyColor` function.
|
|
2
6
|
____exports.COLORS = {
|
|
3
7
|
Black = Color(1, 1, 1),
|
|
4
8
|
Red = Color(1, 0, 0),
|
|
@@ -7,6 +7,8 @@ local NARROW_CONTENTS_WIDTH = ____roomShapeVolumes.NARROW_CONTENTS_WIDTH
|
|
|
7
7
|
local ONE_BY_ONE_CONTENTS_HEIGHT = ____roomShapeVolumes.ONE_BY_ONE_CONTENTS_HEIGHT
|
|
8
8
|
local ONE_BY_ONE_CONTENTS_WIDTH = ____roomShapeVolumes.ONE_BY_ONE_CONTENTS_WIDTH
|
|
9
9
|
local TWO_BY_TWO_BOUNDS = Vector(ONE_BY_ONE_CONTENTS_WIDTH * 2, ONE_BY_ONE_CONTENTS_HEIGHT * 2)
|
|
10
|
+
--- The size of a room shape's contents. This does not include the tiles that the walls are on. L
|
|
11
|
+
-- rooms use the same bounds as a 2x2 room.
|
|
10
12
|
____exports.ROOM_SHAPE_BOUNDS = {
|
|
11
13
|
[RoomShape.SHAPE_1x1] = Vector(ONE_BY_ONE_CONTENTS_WIDTH, ONE_BY_ONE_CONTENTS_HEIGHT),
|
|
12
14
|
[RoomShape.IH] = Vector(ONE_BY_ONE_CONTENTS_WIDTH, NARROW_CONTENTS_HEIGHT),
|
|
@@ -8,6 +8,10 @@ local ONE_BY_ONE_LAYOUT_SIZE = Vector(ONE_BY_ONE_CONTENTS_WIDTH, ONE_BY_ONE_CONT
|
|
|
8
8
|
local TWO_BY_ONE_VERTICAL_LAYOUT_SIZE = Vector(ONE_BY_ONE_CONTENTS_WIDTH, ONE_BY_ONE_CONTENTS_HEIGHT * 2)
|
|
9
9
|
local TWO_BY_ONE_HORIZONTAL_LAYOUT_SIZE = Vector(ONE_BY_ONE_CONTENTS_WIDTH * 2, ONE_BY_ONE_CONTENTS_HEIGHT)
|
|
10
10
|
local TWO_BY_TWO_LAYOUT_SIZE = Vector(ONE_BY_ONE_CONTENTS_WIDTH * 2, ONE_BY_ONE_CONTENTS_HEIGHT * 2)
|
|
11
|
+
--- The dimensions of a room shape's layout. This is NOT the size of the room's actual contents! For
|
|
12
|
+
-- that, use `ROOM_SHAPE_BOUNDS`.
|
|
13
|
+
--
|
|
14
|
+
-- For example, a horizontal narrow room has a layout size of equal to that of a 1x1 room.
|
|
11
15
|
____exports.ROOM_SHAPE_LAYOUT_SIZES = {
|
|
12
16
|
[RoomShape.SHAPE_1x1] = ONE_BY_ONE_LAYOUT_SIZE,
|
|
13
17
|
[RoomShape.IH] = ONE_BY_ONE_LAYOUT_SIZE,
|
|
@@ -3,6 +3,8 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
|
|
|
3
3
|
local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
|
|
4
4
|
local TWO_BY_TWO_BOTTOM_RIGHT_POSITION = Vector(25, 13)
|
|
5
5
|
local ONE_BY_TWO_VERTICAL_BOTTOM_RIGHT_POSITION = Vector(12, 13)
|
|
6
|
+
--- "Vector(0, 0)" corresponds to the top left tile of a room, not including the walls. (The top-left
|
|
7
|
+
-- wall would be at "Vector(-1, -1)".)
|
|
6
8
|
____exports.ROOM_SHAPE_TO_BOTTOM_RIGHT_POSITION = {
|
|
7
9
|
[RoomShape.SHAPE_1x1] = Vector(12, 6),
|
|
8
10
|
[RoomShape.IH] = Vector(12, 4),
|
|
@@ -11,6 +11,8 @@ local LEFT = -1
|
|
|
11
11
|
local UP = -LEVEL_GRID_ROW_WIDTH
|
|
12
12
|
local RIGHT = 1
|
|
13
13
|
local DOWN = LEVEL_GRID_ROW_WIDTH
|
|
14
|
+
--- Deltas are considered to be from the safe grid index of the room (i.e. the top left corner, or
|
|
15
|
+
-- top right corner in the case of `RoomShape.LTL`).
|
|
14
16
|
____exports.ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA = {
|
|
15
17
|
[RoomShape.SHAPE_1x1] = __TS__New(Map, {{DoorSlot.LEFT_0, LEFT}, {DoorSlot.UP_0, UP}, {DoorSlot.RIGHT_0, RIGHT}, {DoorSlot.DOWN_0, DOWN}}),
|
|
16
18
|
[RoomShape.IH] = __TS__New(Map, {{DoorSlot.LEFT_0, LEFT}, {DoorSlot.RIGHT_0, RIGHT}}),
|