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/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,34 @@ ____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
|
|
182
|
+
--- Helper function to sort a two-dimensional array by the first element.
|
|
183
|
+
--
|
|
184
|
+
-- For example:
|
|
185
|
+
--
|
|
186
|
+
-- ```ts
|
|
187
|
+
-- const myArray = [[1, 2], [2, 3], [3, 4]];
|
|
188
|
+
-- myArray.sort(twoDimensionalSort);
|
|
189
|
+
-- ```
|
|
190
|
+
--
|
|
191
|
+
-- From:
|
|
192
|
+
-- https://stackoverflow.com/questions/16096872/how-to-sort-2-dimensional-array-by-column-value
|
|
193
|
+
function ____exports.twoDimensionalSort(self, a, b)
|
|
194
|
+
if a[1] == nil or b[1] == nil then
|
|
195
|
+
error("Failed to two-dimensional sort since the first element of the array was undefined.")
|
|
196
|
+
end
|
|
197
|
+
if a[1] == b[1] then
|
|
198
|
+
return 0
|
|
199
|
+
end
|
|
200
|
+
return a[1] < b[1] and -1 or 1
|
|
201
|
+
end
|
|
94
202
|
return ____exports
|
package/functions/vector.lua
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
2
|
local OBJECT_NAME
|
|
3
|
-
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
4
|
-
local Direction = ____isaac_2Dtypescript_2Ddefinitions.Direction
|
|
5
3
|
local ____SerializationBrand = require("enums.private.SerializationBrand")
|
|
6
4
|
local SerializationBrand = ____SerializationBrand.SerializationBrand
|
|
7
5
|
local ____SerializationType = require("enums.SerializationType")
|
|
8
6
|
local SerializationType = ____SerializationType.SerializationType
|
|
7
|
+
local ____direction = require("functions.direction")
|
|
8
|
+
local angleToDirection = ____direction.angleToDirection
|
|
9
9
|
local ____isaacAPIClass = require("functions.isaacAPIClass")
|
|
10
10
|
local isaacAPIClassEquals = ____isaacAPIClass.isaacAPIClassEquals
|
|
11
11
|
local isIsaacAPIClassOfType = ____isaacAPIClass.isIsaacAPIClassOfType
|
|
@@ -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,21 +99,10 @@ 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
|
-
local
|
|
96
|
-
|
|
97
|
-
return Direction.RIGHT
|
|
98
|
-
end
|
|
99
|
-
if degrees >= 45 and degrees <= 135 then
|
|
100
|
-
return Direction.DOWN
|
|
101
|
-
end
|
|
102
|
-
if degrees <= -45 and degrees >= -135 then
|
|
103
|
-
return Direction.UP
|
|
104
|
-
end
|
|
105
|
-
if degrees > 135 or degrees < -135 then
|
|
106
|
-
return Direction.LEFT
|
|
107
|
-
end
|
|
108
|
-
return Direction.NO_DIRECTION
|
|
104
|
+
local angleDegrees = vector:GetAngleDegrees()
|
|
105
|
+
return angleToDirection(nil, angleDegrees)
|
|
109
106
|
end
|
|
110
107
|
function ____exports.vectorToString(self, vector, round)
|
|
111
108
|
if round == nil then
|
package/index.d.ts
CHANGED
|
@@ -107,6 +107,7 @@ export * from "./functions/ui";
|
|
|
107
107
|
export * from "./functions/utils";
|
|
108
108
|
export * from "./functions/vector";
|
|
109
109
|
export * from "./interfaces/AddCallbackParameterCustom";
|
|
110
|
+
export * from "./interfaces/ChargeBarSprites";
|
|
110
111
|
export * from "./interfaces/JSONDoor";
|
|
111
112
|
export * from "./interfaces/JSONEntity";
|
|
112
113
|
export * from "./interfaces/JSONRoom";
|
package/initCustomCallbacks.lua
CHANGED
|
@@ -89,6 +89,8 @@ local ____postRoomClearChanged = require("callbacks.postRoomClearChanged")
|
|
|
89
89
|
local postRoomClearChangedCallbackInit = ____postRoomClearChanged.postRoomClearChangedCallbackInit
|
|
90
90
|
local ____postSacrifice = require("callbacks.postSacrifice")
|
|
91
91
|
local postSacrificeCallbackInit = ____postSacrifice.postSacrificeCallbackInit
|
|
92
|
+
local ____postSlotDestroyed = require("callbacks.postSlotDestroyed")
|
|
93
|
+
local postSlotDestroyedCallbacksInit = ____postSlotDestroyed.postSlotDestroyedCallbacksInit
|
|
92
94
|
local ____postSlotInitUpdate = require("callbacks.postSlotInitUpdate")
|
|
93
95
|
local postSlotInitUpdateCallbacksInit = ____postSlotInitUpdate.postSlotInitUpdateCallbacksInit
|
|
94
96
|
local ____postSlotRender = require("callbacks.postSlotRender")
|
|
@@ -161,6 +163,7 @@ function ____exports.initCustomCallbacks(self, mod)
|
|
|
161
163
|
postRockUpdateInit(nil, mod)
|
|
162
164
|
postRoomClearChangedCallbackInit(nil, mod)
|
|
163
165
|
postSacrificeCallbackInit(nil, mod)
|
|
166
|
+
postSlotDestroyedCallbacksInit(nil, mod)
|
|
164
167
|
postSlotInitUpdateCallbacksInit(nil, mod)
|
|
165
168
|
postSlotRenderCallbacksInit(nil, mod)
|
|
166
169
|
postSpikesRenderInit(nil, mod)
|
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),
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
3
|
+
local DoorSlot = ____isaac_2Dtypescript_2Ddefinitions.DoorSlot
|
|
4
|
+
____exports.OPPOSITE_DOOR_SLOTS = {
|
|
5
|
+
[DoorSlot.NO_DOOR_SLOT] = nil,
|
|
6
|
+
[DoorSlot.LEFT_0] = DoorSlot.RIGHT_0,
|
|
7
|
+
[DoorSlot.UP_0] = DoorSlot.DOWN_0,
|
|
8
|
+
[DoorSlot.RIGHT_0] = DoorSlot.LEFT_0,
|
|
9
|
+
[DoorSlot.LEFT_1] = DoorSlot.RIGHT_1,
|
|
10
|
+
[DoorSlot.DOWN_0] = DoorSlot.UP_0,
|
|
11
|
+
[DoorSlot.UP_1] = DoorSlot.DOWN_1,
|
|
12
|
+
[DoorSlot.RIGHT_1] = DoorSlot.LEFT_1,
|
|
13
|
+
[DoorSlot.DOWN_1] = DoorSlot.UP_1
|
|
14
|
+
}
|
|
15
|
+
return ____exports
|
|
@@ -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}}),
|
|
@@ -5,6 +5,8 @@ local ____constants = require("constants")
|
|
|
5
5
|
local VectorZero = ____constants.VectorZero
|
|
6
6
|
local NARROW_HORIZONTAL_TOP_LEFT_POSITION = Vector(0, 2)
|
|
7
7
|
local NARROW_VERTICAL_TOP_LEFT_POSITION = Vector(4, 0)
|
|
8
|
+
--- "Vector(0, 0)" corresponds to the top left tile of a room, not including the walls. (The top-left
|
|
9
|
+
-- wall would be at "Vector(-1, -1)".)
|
|
8
10
|
____exports.ROOM_SHAPE_TO_TOP_LEFT_POSITION = {
|
|
9
11
|
[RoomShape.SHAPE_1x1] = VectorZero,
|
|
10
12
|
[RoomShape.IH] = NARROW_HORIZONTAL_TOP_LEFT_POSITION,
|
|
@@ -10,6 +10,9 @@ local NARROW_HORIZONTAL_VOLUME = ____exports.ONE_BY_ONE_CONTENTS_WIDTH * ____exp
|
|
|
10
10
|
local NARROW_VERTICAL_VOLUME = ____exports.NARROW_CONTENTS_WIDTH * ____exports.ONE_BY_ONE_CONTENTS_HEIGHT
|
|
11
11
|
local ONE_BY_TWO_VOLUME = ONE_BY_ONE_VOLUME * 2
|
|
12
12
|
local L_ROOM_VOLUME = ONE_BY_ONE_VOLUME * 3
|
|
13
|
+
--- Volume is the amount of tiles that are inside the room shape.
|
|
14
|
+
--
|
|
15
|
+
-- (This cannot be directly calculated from the bounds since L rooms are a special case.)
|
|
13
16
|
____exports.ROOM_SHAPE_VOLUMES = {
|
|
14
17
|
[RoomShape.SHAPE_1x1] = ONE_BY_ONE_VOLUME,
|
|
15
18
|
[RoomShape.IH] = NARROW_HORIZONTAL_VOLUME,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Helper functions and features for IsaacScript mods.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
"main": "index",
|
|
23
23
|
"types": "index.d.ts",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"isaac-typescript-definitions": "^2.0.
|
|
25
|
+
"isaac-typescript-definitions": "^2.0.55"
|
|
26
26
|
}
|
|
27
27
|
}
|
package/patchErrorFunctions.lua
CHANGED
|
@@ -36,6 +36,14 @@ function removeLinesContaining(self, msg, containsMsg)
|
|
|
36
36
|
end
|
|
37
37
|
LINE_SEPARATOR = "\n"
|
|
38
38
|
USELESS_TRACEBACK_MESSAGES = {"in upvalue 'getTraceback'", "in function 'sandbox.GetTraceback'", "in function 'error'"}
|
|
39
|
+
--- In Lua, the `error` function will tell you the line number of the error, but not give you a full
|
|
40
|
+
-- traceback of the parent functions, which is unlike how JavaScript works. This function monkey
|
|
41
|
+
-- patches the `error` function to add this functionality.
|
|
42
|
+
--
|
|
43
|
+
-- Traceback functionality can only be added if the "--luadebug" flag is turned on, so this function
|
|
44
|
+
-- does nothing if the "--luadebug" flag is disabled.
|
|
45
|
+
--
|
|
46
|
+
-- @internal
|
|
39
47
|
function ____exports.patchErrorFunction(self)
|
|
40
48
|
if not isLuaDebugEnabled(nil) then
|
|
41
49
|
return
|