isaacscript-common 2.3.2 → 3.1.1
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/postPickupInitFirst.d.ts +1 -0
- package/callbacks/postPickupInitFirst.lua +55 -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/postPickupInitFirst.d.ts +3 -0
- package/callbacks/subscriptions/postPickupInitFirst.lua +29 -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 +62 -40
- package/enums/ModCallbackCustom.lua +46 -38
- 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/bombs.d.ts +3 -0
- package/functions/bombs.lua +12 -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 +13 -8
- package/functions/collectibles.lua +147 -3
- 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 +8 -0
- package/functions/direction.lua +27 -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.d.ts +7 -0
- package/functions/player.lua +210 -9
- package/functions/playerDataStructures.lua +65 -0
- package/functions/playerHealth.d.ts +3 -0
- package/functions/playerHealth.lua +92 -63
- 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/index.lua +8 -0
- package/initCustomCallbacks.lua +6 -0
- package/interfaces/AddCallbackParameterCustom.d.ts +2 -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/callbackRegisterFunctions.lua +3 -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/deepCopy.lua
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local Set = ____lualib.Set
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
|
-
local __TS__InstanceOf = ____lualib.__TS__InstanceOf
|
|
5
4
|
local Map = ____lualib.Map
|
|
6
|
-
local WeakMap = ____lualib.WeakMap
|
|
7
|
-
local WeakSet = ____lualib.WeakSet
|
|
8
5
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
6
|
+
local __TS__ArraySort = ____lualib.__TS__ArraySort
|
|
9
7
|
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
10
8
|
local ____exports = {}
|
|
11
9
|
local deepCopyTable, deepCopyDefaultMap, deepCopyMap, deepCopySet, deepCopyTSTLClass, deepCopyArray, deepCopyNormalLuaTable, getCopiedEntries, checkMetatable, deepCopyUserdata, COPYABLE_ISAAC_API_CLASS_TYPES_SET
|
|
@@ -26,19 +24,50 @@ local isArray = ____array.isArray
|
|
|
26
24
|
local ____enums = require("functions.enums")
|
|
27
25
|
local getEnumValues = ____enums.getEnumValues
|
|
28
26
|
local ____isaacAPIClass = require("functions.isaacAPIClass")
|
|
29
|
-
local
|
|
27
|
+
local getIsaacAPIClassName = ____isaacAPIClass.getIsaacAPIClassName
|
|
30
28
|
local ____log = require("functions.log")
|
|
31
29
|
local log = ____log.log
|
|
30
|
+
local logTable = ____log.logTable
|
|
32
31
|
local ____serialization = require("functions.serialization")
|
|
33
32
|
local copyIsaacAPIClass = ____serialization.copyIsaacAPIClass
|
|
34
33
|
local deserializeIsaacAPIClass = ____serialization.deserializeIsaacAPIClass
|
|
35
34
|
local isSerializedIsaacAPIClass = ____serialization.isSerializedIsaacAPIClass
|
|
36
35
|
local ____tstlClass = require("functions.tstlClass")
|
|
36
|
+
local getTSTLClassName = ____tstlClass.getTSTLClassName
|
|
37
|
+
local isDefaultMap = ____tstlClass.isDefaultMap
|
|
38
|
+
local isTSTLMap = ____tstlClass.isTSTLMap
|
|
39
|
+
local isTSTLSet = ____tstlClass.isTSTLSet
|
|
37
40
|
local isUserDefinedTSTLClass = ____tstlClass.isUserDefinedTSTLClass
|
|
38
41
|
local newTSTLClass = ____tstlClass.newTSTLClass
|
|
39
42
|
local ____utils = require("functions.utils")
|
|
40
43
|
local ensureAllCases = ____utils.ensureAllCases
|
|
41
44
|
local getTraversalDescription = ____utils.getTraversalDescription
|
|
45
|
+
local twoDimensionalSort = ____utils.twoDimensionalSort
|
|
46
|
+
--- `deepCopy` is a semi-generic deep cloner. It will recursively copy all of the values so that none
|
|
47
|
+
-- of the nested references remain.
|
|
48
|
+
--
|
|
49
|
+
-- It supports the following object types:
|
|
50
|
+
--
|
|
51
|
+
-- - Primitives (i.e. strings, numbers, and booleans)
|
|
52
|
+
-- - `LuaTable` / basic TSTL objects
|
|
53
|
+
-- - TSTL `Map`
|
|
54
|
+
-- - TSTL `Set`
|
|
55
|
+
-- - TSTL classes
|
|
56
|
+
-- - `DefaultMap`
|
|
57
|
+
-- - Isaac `Color` objects
|
|
58
|
+
-- - Isaac `KColor` objects
|
|
59
|
+
-- - Isaac `RNG` objects
|
|
60
|
+
-- - Isaac `Vector` objects
|
|
61
|
+
--
|
|
62
|
+
-- It does not support:
|
|
63
|
+
-- - objects with values of `null` (since that transpiles to `nil`)
|
|
64
|
+
-- - other Isaac API objects such as `EntityPtr` (that have a type of "userdata")
|
|
65
|
+
--
|
|
66
|
+
-- @param value The primitive or object to copy.
|
|
67
|
+
-- @param serializationType Has 3 possible values. Can leave objects as-is, or can serialize objects
|
|
68
|
+
-- to Lua tables, or can deserialize Lua tables to objects. Default is
|
|
69
|
+
-- `SerializationType.NONE`.
|
|
70
|
+
-- @param traversalDescription Used to track the current key that we are operating on.
|
|
42
71
|
function ____exports.deepCopy(self, value, serializationType, traversalDescription)
|
|
43
72
|
if serializationType == nil then
|
|
44
73
|
serializationType = SerializationType.NONE
|
|
@@ -95,19 +124,20 @@ function ____exports.deepCopy(self, value, serializationType, traversalDescripti
|
|
|
95
124
|
until true
|
|
96
125
|
end
|
|
97
126
|
function deepCopyTable(self, ____table, serializationType, traversalDescription)
|
|
98
|
-
if
|
|
127
|
+
if isDefaultMap(nil, ____table) or ____table[SerializationBrand.DEFAULT_MAP] ~= nil then
|
|
99
128
|
return deepCopyDefaultMap(nil, ____table, serializationType, traversalDescription)
|
|
100
129
|
end
|
|
101
|
-
if
|
|
130
|
+
if isTSTLMap(nil, ____table) or ____table[SerializationBrand.MAP] ~= nil then
|
|
102
131
|
return deepCopyMap(nil, ____table, serializationType, traversalDescription)
|
|
103
132
|
end
|
|
104
|
-
if
|
|
133
|
+
if isTSTLSet(nil, ____table) or ____table[SerializationBrand.SET] ~= nil then
|
|
105
134
|
return deepCopySet(nil, ____table, serializationType, traversalDescription)
|
|
106
135
|
end
|
|
107
|
-
|
|
136
|
+
local className = getTSTLClassName(nil, ____table)
|
|
137
|
+
if className == "WeakMap" then
|
|
108
138
|
error("The deep copy function does not support copying the \"WeakMap\" class for: " .. traversalDescription)
|
|
109
139
|
end
|
|
110
|
-
if
|
|
140
|
+
if className == "WeakSet" then
|
|
111
141
|
error("The deep copy function does not support copying the \"WeakSet\" class for: " .. traversalDescription)
|
|
112
142
|
end
|
|
113
143
|
if isUserDefinedTSTLClass(nil, ____table) then
|
|
@@ -123,13 +153,13 @@ function deepCopyTable(self, ____table, serializationType, traversalDescription)
|
|
|
123
153
|
return deepCopyNormalLuaTable(nil, ____table, serializationType, traversalDescription)
|
|
124
154
|
end
|
|
125
155
|
function deepCopyDefaultMap(self, defaultMap, serializationType, traversalDescription)
|
|
126
|
-
local
|
|
127
|
-
if
|
|
128
|
-
|
|
156
|
+
local ____isDefaultMap_result_0
|
|
157
|
+
if isDefaultMap(nil, defaultMap) then
|
|
158
|
+
____isDefaultMap_result_0 = defaultMap:getConstructorArg()
|
|
129
159
|
else
|
|
130
|
-
|
|
160
|
+
____isDefaultMap_result_0 = nil
|
|
131
161
|
end
|
|
132
|
-
local constructorArg =
|
|
162
|
+
local constructorArg = ____isDefaultMap_result_0
|
|
133
163
|
local newDefaultMap
|
|
134
164
|
repeat
|
|
135
165
|
local ____switch23 = serializationType
|
|
@@ -155,7 +185,7 @@ function deepCopyDefaultMap(self, defaultMap, serializationType, traversalDescri
|
|
|
155
185
|
____cond23 = ____cond23 or ____switch23 == SerializationType.DESERIALIZE
|
|
156
186
|
if ____cond23 then
|
|
157
187
|
do
|
|
158
|
-
if
|
|
188
|
+
if isDefaultMap(nil, defaultMap) then
|
|
159
189
|
error(("The deep copy function failed to deserialize a default map of \"" .. traversalDescription) .. "\", since it was not a Lua table.")
|
|
160
190
|
end
|
|
161
191
|
local defaultMapValue = defaultMap[SerializationBrand.DEFAULT_MAP_VALUE]
|
|
@@ -176,7 +206,7 @@ function deepCopyDefaultMap(self, defaultMap, serializationType, traversalDescri
|
|
|
176
206
|
local entries = ____getCopiedEntries_result_1.entries
|
|
177
207
|
local convertedNumberKeysToStrings = ____getCopiedEntries_result_1.convertedNumberKeysToStrings
|
|
178
208
|
if convertedNumberKeysToStrings then
|
|
179
|
-
if
|
|
209
|
+
if isDefaultMap(nil, newDefaultMap) then
|
|
180
210
|
newDefaultMap:set(SerializationBrand.OBJECT_WITH_NUMBER_KEYS, "")
|
|
181
211
|
else
|
|
182
212
|
newDefaultMap[SerializationBrand.OBJECT_WITH_NUMBER_KEYS] = ""
|
|
@@ -185,7 +215,7 @@ function deepCopyDefaultMap(self, defaultMap, serializationType, traversalDescri
|
|
|
185
215
|
for ____, ____value in ipairs(entries) do
|
|
186
216
|
local key = ____value[1]
|
|
187
217
|
local value = ____value[2]
|
|
188
|
-
if
|
|
218
|
+
if isDefaultMap(nil, newDefaultMap) then
|
|
189
219
|
newDefaultMap:set(key, value)
|
|
190
220
|
else
|
|
191
221
|
newDefaultMap[key] = value
|
|
@@ -205,7 +235,7 @@ function deepCopyMap(self, map, serializationType, traversalDescription)
|
|
|
205
235
|
local entries = ____getCopiedEntries_result_2.entries
|
|
206
236
|
local convertedNumberKeysToStrings = ____getCopiedEntries_result_2.convertedNumberKeysToStrings
|
|
207
237
|
if convertedNumberKeysToStrings then
|
|
208
|
-
if
|
|
238
|
+
if isTSTLMap(nil, newMap) then
|
|
209
239
|
newMap:set(SerializationBrand.OBJECT_WITH_NUMBER_KEYS, "")
|
|
210
240
|
else
|
|
211
241
|
newMap[SerializationBrand.OBJECT_WITH_NUMBER_KEYS] = ""
|
|
@@ -214,7 +244,7 @@ function deepCopyMap(self, map, serializationType, traversalDescription)
|
|
|
214
244
|
for ____, ____value in ipairs(entries) do
|
|
215
245
|
local key = ____value[1]
|
|
216
246
|
local value = ____value[2]
|
|
217
|
-
if
|
|
247
|
+
if isTSTLMap(nil, newMap) then
|
|
218
248
|
newMap:set(key, value)
|
|
219
249
|
else
|
|
220
250
|
newMap[key] = value
|
|
@@ -234,7 +264,7 @@ function deepCopySet(self, set, serializationType, traversalDescription)
|
|
|
234
264
|
local entries = ____getCopiedEntries_result_3.entries
|
|
235
265
|
local convertedNumberKeysToStrings = ____getCopiedEntries_result_3.convertedNumberKeysToStrings
|
|
236
266
|
if convertedNumberKeysToStrings then
|
|
237
|
-
if
|
|
267
|
+
if isTSTLSet(nil, newSet) then
|
|
238
268
|
error("The deep copy function cannot convert number keys to strings for a Set.")
|
|
239
269
|
else
|
|
240
270
|
newSet[SerializationBrand.OBJECT_WITH_NUMBER_KEYS] = ""
|
|
@@ -242,7 +272,7 @@ function deepCopySet(self, set, serializationType, traversalDescription)
|
|
|
242
272
|
end
|
|
243
273
|
for ____, ____value in ipairs(entries) do
|
|
244
274
|
local key = ____value[1]
|
|
245
|
-
if
|
|
275
|
+
if isTSTLSet(nil, newSet) then
|
|
246
276
|
newSet:add(key)
|
|
247
277
|
else
|
|
248
278
|
newSet[key] = ""
|
|
@@ -295,7 +325,7 @@ function deepCopyNormalLuaTable(self, ____table, serializationType, traversalDes
|
|
|
295
325
|
end
|
|
296
326
|
function getCopiedEntries(self, object, serializationType, traversalDescription)
|
|
297
327
|
local entries = {}
|
|
298
|
-
if
|
|
328
|
+
if isTSTLMap(nil, object) or isTSTLSet(nil, object) or isDefaultMap(nil, object) then
|
|
299
329
|
for ____, ____value in __TS__Iterator(object:entries()) do
|
|
300
330
|
local key = ____value[1]
|
|
301
331
|
local value = ____value[2]
|
|
@@ -306,6 +336,10 @@ function getCopiedEntries(self, object, serializationType, traversalDescription)
|
|
|
306
336
|
entries[#entries + 1] = {key, value}
|
|
307
337
|
end
|
|
308
338
|
end
|
|
339
|
+
if SAVE_DATA_MANAGER_DEBUG then
|
|
340
|
+
logTable(entries)
|
|
341
|
+
__TS__ArraySort(entries, twoDimensionalSort)
|
|
342
|
+
end
|
|
309
343
|
local hasNumberKeys = __TS__ArraySome(
|
|
310
344
|
entries,
|
|
311
345
|
function(____, ____bindingPattern0)
|
|
@@ -321,14 +355,14 @@ function getCopiedEntries(self, object, serializationType, traversalDescription)
|
|
|
321
355
|
local value = ____value[2]
|
|
322
356
|
do
|
|
323
357
|
if isSerializationBrand(nil, key) then
|
|
324
|
-
goto
|
|
358
|
+
goto __continue79
|
|
325
359
|
end
|
|
326
360
|
traversalDescription = getTraversalDescription(nil, key, traversalDescription)
|
|
327
361
|
local newValue = ____exports.deepCopy(nil, value, serializationType, traversalDescription)
|
|
328
362
|
local keyToUse = convertNumberKeysToStrings and tostring(key) or key
|
|
329
363
|
copiedEntries[#copiedEntries + 1] = {keyToUse, newValue}
|
|
330
364
|
end
|
|
331
|
-
::
|
|
365
|
+
::__continue79::
|
|
332
366
|
end
|
|
333
367
|
return {entries = copiedEntries, convertedNumberKeysToStrings = convertNumberKeysToStrings}
|
|
334
368
|
end
|
|
@@ -338,10 +372,10 @@ function checkMetatable(self, ____table, traversalDescription)
|
|
|
338
372
|
return
|
|
339
373
|
end
|
|
340
374
|
local tableDescription = traversalDescription == "" and "the table to copy" or ("\"" .. traversalDescription) .. "\""
|
|
341
|
-
error(("The deepCopy function detected that
|
|
375
|
+
error(("The deepCopy function detected that " .. tableDescription) .. " has a metatable. Copying tables with metatables is not supported, unless they are explicitly handled by the save data manager. (e.g. TypeScriptToLua Maps, TypeScriptToLua Sets, etc.)")
|
|
342
376
|
end
|
|
343
377
|
function deepCopyUserdata(self, value, serializationType, traversalDescription)
|
|
344
|
-
local classType =
|
|
378
|
+
local classType = getIsaacAPIClassName(nil, value)
|
|
345
379
|
if classType == nil then
|
|
346
380
|
error("The deep copy function was not able to derive the Isaac API class type for: " .. traversalDescription)
|
|
347
381
|
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local Map = ____lualib.Map
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
|
-
local __TS__InstanceOf = ____lualib.__TS__InstanceOf
|
|
5
4
|
local Set = ____lualib.Set
|
|
6
5
|
local ____exports = {}
|
|
7
6
|
local copiedObjectIsTable, copiedObjectHasKeyAndValueString, copiedTableHasKeyAndValueNumber, copiedTableDoesNotCoerceTypes, copiedObjectHasNoReferencesForPrimitivesForward, copiedObjectHasNoReferencesForPrimitivesBackward, copiedObjectHasNoReferencesForArray, copiedObjectHasChildObject, copiedMapIsMap, copiedMapHasValue, copiedSetIsSet, copiedSetHasValue, copiedMapHasChildMap, copiedDefaultMapHasChildDefaultMap, copiedDefaultMapHasBrand
|
|
@@ -17,6 +16,10 @@ local ____deepCopy = require("functions.deepCopy")
|
|
|
17
16
|
local deepCopy = ____deepCopy.deepCopy
|
|
18
17
|
local ____log = require("functions.log")
|
|
19
18
|
local log = ____log.log
|
|
19
|
+
local ____tstlClass = require("functions.tstlClass")
|
|
20
|
+
local isDefaultMap = ____tstlClass.isDefaultMap
|
|
21
|
+
local isTSTLMap = ____tstlClass.isTSTLMap
|
|
22
|
+
local isTSTLSet = ____tstlClass.isTSTLSet
|
|
20
23
|
function copiedObjectIsTable(self)
|
|
21
24
|
local oldObject = {abc = "def"}
|
|
22
25
|
local newObject = deepCopy(nil, oldObject)
|
|
@@ -173,7 +176,7 @@ function copiedMapIsMap(self)
|
|
|
173
176
|
if newMapType ~= "table" then
|
|
174
177
|
error("The copied Map was not a table.")
|
|
175
178
|
end
|
|
176
|
-
if not
|
|
179
|
+
if not isTSTLMap(nil, newMap) then
|
|
177
180
|
error("The copied Map was not a Map.")
|
|
178
181
|
end
|
|
179
182
|
end
|
|
@@ -202,7 +205,7 @@ function copiedSetIsSet(self)
|
|
|
202
205
|
if newSetType ~= "table" then
|
|
203
206
|
error("The copied Set was not a table.")
|
|
204
207
|
end
|
|
205
|
-
if not
|
|
208
|
+
if not isTSTLSet(nil, newSet) then
|
|
206
209
|
error("The copied Set was not a Map.")
|
|
207
210
|
end
|
|
208
211
|
end
|
|
@@ -235,7 +238,7 @@ function copiedMapHasChildMap(self)
|
|
|
235
238
|
if newChildMapType ~= "table" then
|
|
236
239
|
error("The copied child Map had a type of: " .. newChildMapType)
|
|
237
240
|
end
|
|
238
|
-
if not
|
|
241
|
+
if not isTSTLMap(nil, newChildMap) then
|
|
239
242
|
error("The copied child Map was not a Map.")
|
|
240
243
|
end
|
|
241
244
|
local value = newChildMap:get(childMapKey)
|
|
@@ -269,7 +272,7 @@ function copiedDefaultMapHasChildDefaultMap(self)
|
|
|
269
272
|
if newChildMapType ~= "table" then
|
|
270
273
|
error("The copied child DefaultMap had a type of: " .. newChildMapType)
|
|
271
274
|
end
|
|
272
|
-
if not
|
|
275
|
+
if not isDefaultMap(nil, newChildMap) then
|
|
273
276
|
error("The copied child DefaultMap was not a DefaultMap.")
|
|
274
277
|
end
|
|
275
278
|
local newChildMapValue1 = newChildMap:get(childMapKey1)
|
package/functions/direction.d.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { Direction } from "isaac-typescript-definitions";
|
|
2
|
+
/**
|
|
3
|
+
* Helper function to convert the degrees of an angle to the `Direction` enum.
|
|
4
|
+
*
|
|
5
|
+
* Note that this function considers 0 degrees to be pointing to the right, which is unusual because
|
|
6
|
+
* 0 normally corresponds to up. (This corresponds to how the `Vector.GetAngleDegrees` method
|
|
7
|
+
* works.)
|
|
8
|
+
*/
|
|
9
|
+
export declare function angleToDirection(angleDegrees: int): Direction;
|
|
2
10
|
export declare function directionToDegrees(direction: Direction): int;
|
|
3
11
|
export declare function directionToVector(direction: Direction): Vector;
|
|
4
12
|
export declare function getDirectionName(direction: Direction): string | undefined;
|
package/functions/direction.lua
CHANGED
|
@@ -1,10 +1,37 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
3
|
+
local Direction = ____isaac_2Dtypescript_2Ddefinitions.Direction
|
|
2
4
|
local ____directionNames = require("objects.directionNames")
|
|
3
5
|
local DIRECTION_NAMES = ____directionNames.DIRECTION_NAMES
|
|
4
6
|
local ____directionToDegrees = require("objects.directionToDegrees")
|
|
5
7
|
local DIRECTION_TO_DEGREES = ____directionToDegrees.DIRECTION_TO_DEGREES
|
|
6
8
|
local ____directionToVector = require("objects.directionToVector")
|
|
7
9
|
local DIRECTION_TO_VECTOR = ____directionToVector.DIRECTION_TO_VECTOR
|
|
10
|
+
--- Helper function to convert the degrees of an angle to the `Direction` enum.
|
|
11
|
+
--
|
|
12
|
+
-- Note that this function considers 0 degrees to be pointing to the right, which is unusual because
|
|
13
|
+
-- 0 normally corresponds to up. (This corresponds to how the `Vector.GetAngleDegrees` method
|
|
14
|
+
-- works.)
|
|
15
|
+
function ____exports.angleToDirection(self, angleDegrees)
|
|
16
|
+
local positiveDegrees = angleDegrees
|
|
17
|
+
while positiveDegrees < 0 do
|
|
18
|
+
positiveDegrees = positiveDegrees + 360
|
|
19
|
+
end
|
|
20
|
+
local normalizedDegrees = positiveDegrees % 360
|
|
21
|
+
if normalizedDegrees < 45 then
|
|
22
|
+
return Direction.RIGHT
|
|
23
|
+
end
|
|
24
|
+
if normalizedDegrees < 135 then
|
|
25
|
+
return Direction.DOWN
|
|
26
|
+
end
|
|
27
|
+
if normalizedDegrees < 225 then
|
|
28
|
+
return Direction.LEFT
|
|
29
|
+
end
|
|
30
|
+
if normalizedDegrees < 315 then
|
|
31
|
+
return Direction.UP
|
|
32
|
+
end
|
|
33
|
+
return Direction.RIGHT
|
|
34
|
+
end
|
|
8
35
|
function ____exports.directionToDegrees(self, direction)
|
|
9
36
|
return DIRECTION_TO_DEGREES[direction]
|
|
10
37
|
end
|
package/functions/doors.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export declare function getDoors(...roomTypes: RoomType[]): GridEntityDoor[];
|
|
|
45
45
|
* that match any of the N room grid indexes.
|
|
46
46
|
*/
|
|
47
47
|
export declare function getDoorsToRoomIndex(...roomGridIndex: int[]): GridEntityDoor[];
|
|
48
|
+
export declare function getOppositeDoorSlot(doorSlot: DoorSlot): DoorSlot | undefined;
|
|
48
49
|
export declare function getRepentanceDoor(): GridEntityDoor | undefined;
|
|
49
50
|
/** Helper function to find unused door slots in the room that can be used to make custom doors. */
|
|
50
51
|
export declare function getUnusedDoorSlots(): DoorSlot[];
|
package/functions/doors.lua
CHANGED
|
@@ -18,6 +18,8 @@ local DEFAULT_DOOR_SLOT = ____doorSlotFlagToDoorSlot.DEFAULT_DOOR_SLOT
|
|
|
18
18
|
local DOOR_SLOT_FLAG_TO_DOOR_SLOT = ____doorSlotFlagToDoorSlot.DOOR_SLOT_FLAG_TO_DOOR_SLOT
|
|
19
19
|
local ____doorSlotToDirection = require("objects.doorSlotToDirection")
|
|
20
20
|
local DOOR_SLOT_TO_DIRECTION = ____doorSlotToDirection.DOOR_SLOT_TO_DIRECTION
|
|
21
|
+
local ____oppositeDoorSlots = require("objects.oppositeDoorSlots")
|
|
22
|
+
local OPPOSITE_DOOR_SLOTS = ____oppositeDoorSlots.OPPOSITE_DOOR_SLOTS
|
|
21
23
|
local ____roomShapeToDoorSlots = require("objects.roomShapeToDoorSlots")
|
|
22
24
|
local ROOM_SHAPE_TO_DOOR_SLOTS = ____roomShapeToDoorSlots.ROOM_SHAPE_TO_DOOR_SLOTS
|
|
23
25
|
local ____direction = require("functions.direction")
|
|
@@ -27,11 +29,19 @@ local getEnumValues = ____enums.getEnumValues
|
|
|
27
29
|
function ____exports.doorSlotToDirection(self, doorSlot)
|
|
28
30
|
return DOOR_SLOT_TO_DIRECTION[doorSlot]
|
|
29
31
|
end
|
|
32
|
+
--- Helper function to help calculate the position that a player will enter a room at.
|
|
33
|
+
--
|
|
34
|
+
-- When players enter a room, they do not appear exactly on the location of the door, because then
|
|
35
|
+
-- they would immediately collide with the loading zone. Instead, they are offset by a certain
|
|
36
|
+
-- amount of units.
|
|
30
37
|
function ____exports.getDoorEnterPositionOffset(self, doorSlot)
|
|
31
38
|
local direction = ____exports.doorSlotToDirection(nil, doorSlot)
|
|
32
39
|
local vector = directionToVector(nil, direction)
|
|
33
40
|
return vector * ROOM_ENTRY_OFFSET_FROM_DOOR
|
|
34
41
|
end
|
|
42
|
+
--- Helper function to get all of the doors in the room. By default, it will return every door. You
|
|
43
|
+
-- can optionally specify one or more room types to return only the doors that match the specified
|
|
44
|
+
-- room types.
|
|
35
45
|
function ____exports.getDoors(self, ...)
|
|
36
46
|
local roomTypes = {...}
|
|
37
47
|
local room = game:GetRoom()
|
|
@@ -60,10 +70,14 @@ function ____exports.isSecretRoomDoor(self, door)
|
|
|
60
70
|
local filename = sprite:GetFilename()
|
|
61
71
|
return filename == "gfx/grid/Door_08_HoleInWall.anm2"
|
|
62
72
|
end
|
|
73
|
+
--- Helper function to remove a single door.
|
|
63
74
|
function ____exports.removeDoor(self, door)
|
|
64
75
|
local room = game:GetRoom()
|
|
65
76
|
room:RemoveDoor(door.Slot)
|
|
66
77
|
end
|
|
78
|
+
--- Helper function to remove the doors provided.
|
|
79
|
+
--
|
|
80
|
+
-- This function is variadic, meaning that you can specify as many doors as you want to remove.
|
|
67
81
|
function ____exports.removeDoors(self, ...)
|
|
68
82
|
local doors = {...}
|
|
69
83
|
for ____, door in ipairs(doors) do
|
|
@@ -76,6 +90,8 @@ function ____exports.closeAllDoors(self)
|
|
|
76
90
|
door:Close(true)
|
|
77
91
|
end
|
|
78
92
|
end
|
|
93
|
+
--- Use this instead of the `GridEntityDoor.Close` method if you want the door to immediately close
|
|
94
|
+
-- without an animation.
|
|
79
95
|
function ____exports.closeDoorFast(self, door)
|
|
80
96
|
door.State = DoorState.CLOSED
|
|
81
97
|
local sprite = door:GetSprite()
|
|
@@ -105,6 +121,8 @@ function ____exports.getDevilRoomDoor(self)
|
|
|
105
121
|
end
|
|
106
122
|
return ____temp_1
|
|
107
123
|
end
|
|
124
|
+
--- If there is both a Devil Room and an Angel Room door, this function will return door with the
|
|
125
|
+
-- lowest slot number.
|
|
108
126
|
function ____exports.getDevilRoomOrAngelRoomDoor(self)
|
|
109
127
|
local devilRoomOrAngelRoomDoors = ____exports.getDoors(nil, RoomType.DEVIL, RoomType.ANGEL)
|
|
110
128
|
local ____temp_2
|
|
@@ -115,14 +133,24 @@ function ____exports.getDevilRoomOrAngelRoomDoor(self)
|
|
|
115
133
|
end
|
|
116
134
|
return ____temp_2
|
|
117
135
|
end
|
|
136
|
+
--- Helper function to get the position that a player will enter a room at.
|
|
137
|
+
--
|
|
138
|
+
-- When players enter a room, they do not appear exactly on the location of the door, because then
|
|
139
|
+
-- they would immediately collide with the loading zone. Instead, they are offset by a certain
|
|
140
|
+
-- amount of units.
|
|
118
141
|
function ____exports.getDoorEnterPosition(self, door)
|
|
119
142
|
local offset = ____exports.getDoorEnterPositionOffset(nil, door.Slot)
|
|
120
143
|
return door.Position + offset
|
|
121
144
|
end
|
|
145
|
+
--- Helper function to get the possible door slots that can exist for a given room shape.
|
|
122
146
|
function ____exports.getDoorSlotsForRoomShape(self, roomShape)
|
|
123
147
|
local doorSlots = ROOM_SHAPE_TO_DOOR_SLOTS[roomShape]
|
|
124
148
|
return doorSlots == nil and __TS__New(Set) or doorSlots
|
|
125
149
|
end
|
|
150
|
+
--- Helper function to get all of the doors in the room that lead to the provided room index.
|
|
151
|
+
--
|
|
152
|
+
-- This function is variadic, meaning that you can specify N arguments to return all of the doors
|
|
153
|
+
-- that match any of the N room grid indexes.
|
|
126
154
|
function ____exports.getDoorsToRoomIndex(self, ...)
|
|
127
155
|
local roomGridIndex = {...}
|
|
128
156
|
local roomGridIndexesSet = __TS__New(Set, roomGridIndex)
|
|
@@ -132,6 +160,9 @@ function ____exports.getDoorsToRoomIndex(self, ...)
|
|
|
132
160
|
function(____, door) return roomGridIndexesSet:has(door.TargetRoomIndex) end
|
|
133
161
|
)
|
|
134
162
|
end
|
|
163
|
+
function ____exports.getOppositeDoorSlot(self, doorSlot)
|
|
164
|
+
return OPPOSITE_DOOR_SLOTS[doorSlot]
|
|
165
|
+
end
|
|
135
166
|
function ____exports.getRepentanceDoor(self)
|
|
136
167
|
local doors = ____exports.getDoors(nil)
|
|
137
168
|
return __TS__ArrayFind(
|
|
@@ -139,6 +170,7 @@ function ____exports.getRepentanceDoor(self)
|
|
|
139
170
|
function(____, door) return ____exports.isRepentanceDoor(nil, door) end
|
|
140
171
|
)
|
|
141
172
|
end
|
|
173
|
+
--- Helper function to find unused door slots in the room that can be used to make custom doors.
|
|
142
174
|
function ____exports.getUnusedDoorSlots(self)
|
|
143
175
|
local room = game:GetRoom()
|
|
144
176
|
local doorSlots = getEnumValues(nil, DoorSlot)
|
|
@@ -153,10 +185,13 @@ end
|
|
|
153
185
|
function ____exports.isDevilRoomDoor(self, door)
|
|
154
186
|
return door.TargetRoomType == RoomType.DEVIL
|
|
155
187
|
end
|
|
188
|
+
--- Helper function to see if a door slot could exist for a given room shape.
|
|
156
189
|
function ____exports.isDoorSlotInRoomShape(self, doorSlot, roomShape)
|
|
157
190
|
local doorSlots = ____exports.getDoorSlotsForRoomShape(nil, roomShape)
|
|
158
191
|
return doorSlots:has(doorSlot)
|
|
159
192
|
end
|
|
193
|
+
--- This refers to the Repentance door that spawns in a boss room after defeating the boss. You have
|
|
194
|
+
-- to spend one key to open it. It has a sprite filename of "gfx/grid/Door_Downpour.anm2".
|
|
160
195
|
function ____exports.isDoorToDownpour(self, door)
|
|
161
196
|
if not ____exports.isRepentanceDoor(nil, door) then
|
|
162
197
|
return false
|
|
@@ -165,6 +200,8 @@ function ____exports.isDoorToDownpour(self, door)
|
|
|
165
200
|
local filename = sprite:GetFilename()
|
|
166
201
|
return filename == "gfx/grid/Door_Downpour.anm2"
|
|
167
202
|
end
|
|
203
|
+
--- This refers to the Repentance door that spawns in a boss room after defeating the boss. You have
|
|
204
|
+
-- to spend two hearts to open it. It has a sprite filename of "gfx/grid/Door_Mausoleum.anm2".
|
|
168
205
|
function ____exports.isDoorToMausoleum(self, door)
|
|
169
206
|
if not ____exports.isRepentanceDoor(nil, door) then
|
|
170
207
|
return false
|
|
@@ -173,6 +210,8 @@ function ____exports.isDoorToMausoleum(self, door)
|
|
|
173
210
|
local filename = sprite:GetFilename()
|
|
174
211
|
return filename == "gfx/grid/Door_Mausoleum.anm2"
|
|
175
212
|
end
|
|
213
|
+
--- This refers to the "strange door" located on the first room of Depths 2. You open it with either
|
|
214
|
+
-- a Polaroid or a Negative. It has a sprite filename of "gfx/grid/Door_Mausoleum_Alt.anm2".
|
|
176
215
|
function ____exports.isDoorToMausoleumAscent(self, door)
|
|
177
216
|
if not ____exports.isRepentanceDoor(nil, door) then
|
|
178
217
|
return false
|
|
@@ -181,6 +220,8 @@ function ____exports.isDoorToMausoleumAscent(self, door)
|
|
|
181
220
|
local filename = sprite:GetFilename()
|
|
182
221
|
return filename == "gfx/grid/Door_Mausoleum_Alt.anm2"
|
|
183
222
|
end
|
|
223
|
+
--- This refers to the Repentance door that spawns in a boss room after defeating the boss. You have
|
|
224
|
+
-- to spend two bombs to open it. It has a sprite filename of "gfx/grid/Door_Mines.anm2".
|
|
184
225
|
function ____exports.isDoorToMines(self, door)
|
|
185
226
|
if not ____exports.isRepentanceDoor(nil, door) then
|
|
186
227
|
return false
|
|
@@ -189,6 +230,8 @@ function ____exports.isDoorToMines(self, door)
|
|
|
189
230
|
local filename = sprite:GetFilename()
|
|
190
231
|
return filename == "gfx/grid/Door_Mines.anm2"
|
|
191
232
|
end
|
|
233
|
+
--- This refers to the Repentance door that spawns after defeating Mom. You open it with the
|
|
234
|
+
-- completed knife. It has a sprite filename of "gfx/grid/Door_MomsHeart.anm2".
|
|
192
235
|
function ____exports.isDoorToMomsHeart(self, door)
|
|
193
236
|
if not ____exports.isRepentanceDoor(nil, door) then
|
|
194
237
|
return false
|
|
@@ -202,6 +245,12 @@ function ____exports.isHiddenSecretRoomDoor(self, door)
|
|
|
202
245
|
local animation = sprite:GetAnimation()
|
|
203
246
|
return ____exports.isSecretRoomDoor(nil, door) and animation == "Hidden"
|
|
204
247
|
end
|
|
248
|
+
--- Helper function to reset an unlocked door back to a locked state. Doing this is non-trivial
|
|
249
|
+
-- because in addition to calling the `GridEntityDoor.SetLocked` method, you must also:
|
|
250
|
+
--
|
|
251
|
+
-- - Set the `VisitedCount` of the room's `RoomDescription` to 0.
|
|
252
|
+
-- - Set the variant to `DoorVariant.DOOR_LOCKED`.
|
|
253
|
+
-- - Close the door.
|
|
205
254
|
function ____exports.lockDoor(self, door)
|
|
206
255
|
local level = game:GetLevel()
|
|
207
256
|
local roomDescriptor = level:GetRoomByIdx(door.TargetRoomIndex)
|
|
@@ -210,16 +259,25 @@ function ____exports.lockDoor(self, door)
|
|
|
210
259
|
door:SetLocked(true)
|
|
211
260
|
door:Close(true)
|
|
212
261
|
end
|
|
262
|
+
--- For the purposes of this function, doors to Secret Rooms or Super Secret Rooms that have not been
|
|
263
|
+
-- discovered yet will not be opened.
|
|
213
264
|
function ____exports.openAllDoors(self)
|
|
214
265
|
for ____, door in ipairs(____exports.getDoors(nil)) do
|
|
215
266
|
door:Open()
|
|
216
267
|
end
|
|
217
268
|
end
|
|
269
|
+
--- Use this instead of the `GridEntityDoor.Open` method if you want the door to immediately open
|
|
270
|
+
-- without an animation.
|
|
218
271
|
function ____exports.openDoorFast(self, door)
|
|
219
272
|
door.State = DoorState.OPEN
|
|
220
273
|
local sprite = door:GetSprite()
|
|
221
274
|
sprite:Play("Opened", true)
|
|
222
275
|
end
|
|
276
|
+
--- Helper function to remove all of the doors in the room. By default, it will remove every door.
|
|
277
|
+
-- You can optionally specify one or more room types to remove only the doors that match the
|
|
278
|
+
-- specified room types.
|
|
279
|
+
--
|
|
280
|
+
-- @returns The number of doors removed.
|
|
223
281
|
function ____exports.removeAllDoors(self, ...)
|
|
224
282
|
local doors = ____exports.getDoors(nil, ...)
|
|
225
283
|
____exports.removeDoors(
|
package/functions/entity.d.ts
CHANGED
|
@@ -96,17 +96,17 @@ export declare function parseEntityTypeVariantString(entityTypeVariantString: st
|
|
|
96
96
|
* @param entityVariant Optional. The variant to match. Default is -1. -1 matches every variant.
|
|
97
97
|
* @param entitySubType Optional. The sub-type to match. Default is -1. -1 matches every sub-type.
|
|
98
98
|
* @param cap Optional. If specified, will only remove the given amount of collectibles.
|
|
99
|
-
* @returns
|
|
99
|
+
* @returns An array of the entities that were removed.
|
|
100
100
|
*/
|
|
101
|
-
export declare function removeAllMatchingEntities(entityType: EntityType, entityVariant?: number, entitySubType?: number, cap?: int | undefined):
|
|
101
|
+
export declare function removeAllMatchingEntities(entityType: EntityType, entityVariant?: number, entitySubType?: number, cap?: int | undefined): Entity[];
|
|
102
102
|
/**
|
|
103
103
|
* Helper function to remove all of the entities in the supplied array.
|
|
104
104
|
*
|
|
105
105
|
* @param entities The array of entities to remove.
|
|
106
106
|
* @param cap Optional. If specified, will only remove the given amount of entities.
|
|
107
|
-
* @returns
|
|
107
|
+
* @returns An array of the entities that were removed.
|
|
108
108
|
*/
|
|
109
|
-
export declare function removeEntities(entities:
|
|
109
|
+
export declare function removeEntities<T extends AnyEntity>(entities: T[], cap?: int): T[];
|
|
110
110
|
/**
|
|
111
111
|
* Helper function to reroll an enemy. Use this instead of the vanilla "Game.RerollEnemy" function
|
|
112
112
|
* if you want the rerolled enemy to be returned.
|