isaacscript-common 84.0.1 → 84.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/dist/arrays/cachedEnumValues.js +33 -0
- package/dist/callbackClasses.js +289 -0
- package/dist/callbacks.js +181 -0
- package/dist/classes/DefaultMap.js +171 -0
- package/dist/classes/ModFeature.js +244 -0
- package/dist/classes/ModUpgraded.js +324 -0
- package/dist/classes/callbacks/EntityTakeDmgFilter.js +19 -0
- package/dist/classes/callbacks/EntityTakeDmgPlayer.js +29 -0
- package/dist/classes/callbacks/InputActionFilter.js +24 -0
- package/dist/classes/callbacks/InputActionPlayer.js +37 -0
- package/dist/classes/callbacks/PostAmbushFinished.js +40 -0
- package/dist/classes/callbacks/PostAmbushStarted.js +40 -0
- package/dist/classes/callbacks/PostBombExploded.js +24 -0
- package/dist/classes/callbacks/PostBombInitFilter.js +21 -0
- package/dist/classes/callbacks/PostBombInitLate.js +31 -0
- package/dist/classes/callbacks/PostBombRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostBombUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostBoneSwing.js +53 -0
- package/dist/classes/callbacks/PostCollectibleEmpty.js +50 -0
- package/dist/classes/callbacks/PostCursedTeleport.js +119 -0
- package/dist/classes/callbacks/PostCustomRevive.js +17 -0
- package/dist/classes/callbacks/PostDiceRoomActivated.js +50 -0
- package/dist/classes/callbacks/PostDoorRender.js +24 -0
- package/dist/classes/callbacks/PostDoorUpdate.js +24 -0
- package/dist/classes/callbacks/PostEffectInitFilter.js +21 -0
- package/dist/classes/callbacks/PostEffectInitLate.js +31 -0
- package/dist/classes/callbacks/PostEffectRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostEffectStateChanged.js +34 -0
- package/dist/classes/callbacks/PostEffectUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostEntityKillFilter.js +21 -0
- package/dist/classes/callbacks/PostEsauJr.js +12 -0
- package/dist/classes/callbacks/PostFamiliarInitFilter.js +21 -0
- package/dist/classes/callbacks/PostFamiliarInitLate.js +31 -0
- package/dist/classes/callbacks/PostFamiliarRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostFamiliarStateChanged.js +34 -0
- package/dist/classes/callbacks/PostFamiliarUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostFirstEsauJr.js +12 -0
- package/dist/classes/callbacks/PostFirstFlip.js +12 -0
- package/dist/classes/callbacks/PostFlip.js +12 -0
- package/dist/classes/callbacks/PostGameEndFilter.js +21 -0
- package/dist/classes/callbacks/PostGameStartedReordered.js +14 -0
- package/dist/classes/callbacks/PostGameStartedReorderedLast.js +14 -0
- package/dist/classes/callbacks/PostGreedModeWave.js +35 -0
- package/dist/classes/callbacks/PostGridEntityBroken.js +14 -0
- package/dist/classes/callbacks/PostGridEntityCollision.js +28 -0
- package/dist/classes/callbacks/PostGridEntityCustomBroken.js +14 -0
- package/dist/classes/callbacks/PostGridEntityCustomCollision.js +24 -0
- package/dist/classes/callbacks/PostGridEntityCustomInit.js +14 -0
- package/dist/classes/callbacks/PostGridEntityCustomRemove.js +18 -0
- package/dist/classes/callbacks/PostGridEntityCustomRender.js +14 -0
- package/dist/classes/callbacks/PostGridEntityCustomStateChanged.js +14 -0
- package/dist/classes/callbacks/PostGridEntityCustomUpdate.js +14 -0
- package/dist/classes/callbacks/PostGridEntityInit.js +14 -0
- package/dist/classes/callbacks/PostGridEntityRemove.js +19 -0
- package/dist/classes/callbacks/PostGridEntityRender.js +14 -0
- package/dist/classes/callbacks/PostGridEntityStateChanged.js +14 -0
- package/dist/classes/callbacks/PostGridEntityUpdate.js +14 -0
- package/dist/classes/callbacks/PostHolyMantleRemoved.js +43 -0
- package/dist/classes/callbacks/PostItemDischarge.js +122 -0
- package/dist/classes/callbacks/PostItemPickup.js +14 -0
- package/dist/classes/callbacks/PostKeyboardChanged.js +46 -0
- package/dist/classes/callbacks/PostKnifeInitFilter.js +21 -0
- package/dist/classes/callbacks/PostKnifeInitLate.js +31 -0
- package/dist/classes/callbacks/PostKnifeRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostKnifeUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostLaserInitFilter.js +21 -0
- package/dist/classes/callbacks/PostLaserInitLate.js +31 -0
- package/dist/classes/callbacks/PostLaserRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostLaserUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostNPCDeathFilter.js +21 -0
- package/dist/classes/callbacks/PostNPCInitFilter.js +21 -0
- package/dist/classes/callbacks/PostNPCInitLate.js +31 -0
- package/dist/classes/callbacks/PostNPCRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostNPCStateChanged.js +34 -0
- package/dist/classes/callbacks/PostNPCUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostNewLevelReordered.js +14 -0
- package/dist/classes/callbacks/PostNewRoomEarly.js +74 -0
- package/dist/classes/callbacks/PostNewRoomReordered.js +14 -0
- package/dist/classes/callbacks/PostPEffectUpdateReordered.js +14 -0
- package/dist/classes/callbacks/PostPickupChanged.js +14 -0
- package/dist/classes/callbacks/PostPickupCollect.js +38 -0
- package/dist/classes/callbacks/PostPickupInitFilter.js +21 -0
- package/dist/classes/callbacks/PostPickupInitFirst.js +33 -0
- package/dist/classes/callbacks/PostPickupInitLate.js +31 -0
- package/dist/classes/callbacks/PostPickupRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostPickupSelectionFilter.js +29 -0
- package/dist/classes/callbacks/PostPickupStateChanged.js +34 -0
- package/dist/classes/callbacks/PostPickupUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostPitRender.js +24 -0
- package/dist/classes/callbacks/PostPitUpdate.js +24 -0
- package/dist/classes/callbacks/PostPlayerChangeHealth.js +47 -0
- package/dist/classes/callbacks/PostPlayerChangeStat.js +79 -0
- package/dist/classes/callbacks/PostPlayerChangeType.js +36 -0
- package/dist/classes/callbacks/PostPlayerCollectibleAdded.js +14 -0
- package/dist/classes/callbacks/PostPlayerCollectibleRemoved.js +14 -0
- package/dist/classes/callbacks/PostPlayerFatalDamage.js +83 -0
- package/dist/classes/callbacks/PostPlayerInitFirst.js +41 -0
- package/dist/classes/callbacks/PostPlayerInitLate.js +33 -0
- package/dist/classes/callbacks/PostPlayerRenderReordered.js +14 -0
- package/dist/classes/callbacks/PostPlayerUpdateReordered.js +14 -0
- package/dist/classes/callbacks/PostPoopRender.js +24 -0
- package/dist/classes/callbacks/PostPoopUpdate.js +24 -0
- package/dist/classes/callbacks/PostPressurePlateRender.js +24 -0
- package/dist/classes/callbacks/PostPressurePlateUpdate.js +24 -0
- package/dist/classes/callbacks/PostProjectileInitFilter.js +21 -0
- package/dist/classes/callbacks/PostProjectileInitLate.js +31 -0
- package/dist/classes/callbacks/PostProjectileKill.js +52 -0
- package/dist/classes/callbacks/PostProjectileRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostProjectileUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostPurchase.js +90 -0
- package/dist/classes/callbacks/PostRockRender.js +24 -0
- package/dist/classes/callbacks/PostRockUpdate.js +24 -0
- package/dist/classes/callbacks/PostRoomClearChanged.js +46 -0
- package/dist/classes/callbacks/PostSacrifice.js +36 -0
- package/dist/classes/callbacks/PostSlotAnimationChanged.js +14 -0
- package/dist/classes/callbacks/PostSlotCollision.js +25 -0
- package/dist/classes/callbacks/PostSlotDestroyed.js +14 -0
- package/dist/classes/callbacks/PostSlotInit.js +14 -0
- package/dist/classes/callbacks/PostSlotRender.js +14 -0
- package/dist/classes/callbacks/PostSlotUpdate.js +14 -0
- package/dist/classes/callbacks/PostSpikesRender.js +24 -0
- package/dist/classes/callbacks/PostSpikesUpdate.js +24 -0
- package/dist/classes/callbacks/PostTNTRender.js +24 -0
- package/dist/classes/callbacks/PostTNTUpdate.js +24 -0
- package/dist/classes/callbacks/PostTearInitFilter.js +21 -0
- package/dist/classes/callbacks/PostTearInitLate.js +31 -0
- package/dist/classes/callbacks/PostTearInitVeryLate.js +35 -0
- package/dist/classes/callbacks/PostTearKill.js +52 -0
- package/dist/classes/callbacks/PostTearRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostTearUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostTransformation.js +47 -0
- package/dist/classes/callbacks/PostTrinketBreak.js +70 -0
- package/dist/classes/callbacks/PostUsePillFilter.js +76 -0
- package/dist/classes/callbacks/PreBerserkDeath.js +41 -0
- package/dist/classes/callbacks/PreBombCollisionFilter.js +19 -0
- package/dist/classes/callbacks/PreCustomRevive.js +14 -0
- package/dist/classes/callbacks/PreEntitySpawnFilter.js +24 -0
- package/dist/classes/callbacks/PreFamiliarCollisionFilter.js +19 -0
- package/dist/classes/callbacks/PreGetPedestal.js +46 -0
- package/dist/classes/callbacks/PreItemPickup.js +14 -0
- package/dist/classes/callbacks/PreKnifeCollisionFilter.js +19 -0
- package/dist/classes/callbacks/PreNPCCollisionFilter.js +19 -0
- package/dist/classes/callbacks/PreNPCUpdateFilter.js +19 -0
- package/dist/classes/callbacks/PreNewLevel.js +51 -0
- package/dist/classes/callbacks/PreProjectileCollisionFilter.js +19 -0
- package/dist/classes/callbacks/PreRoomEntitySpawnFilter.js +26 -0
- package/dist/classes/callbacks/PreTearCollisionFilter.js +19 -0
- package/dist/classes/features/callbackLogic/CustomGridEntities.js +359 -0
- package/dist/classes/features/callbackLogic/CustomRevive.js +170 -0
- package/dist/classes/features/callbackLogic/EsauJrDetection.js +70 -0
- package/dist/classes/features/callbackLogic/FlipDetection.js +61 -0
- package/dist/classes/features/callbackLogic/GameReorderedCallbacks.js +220 -0
- package/dist/classes/features/callbackLogic/GridEntityCollisionDetection.js +62 -0
- package/dist/classes/features/callbackLogic/GridEntityRenderDetection.js +35 -0
- package/dist/classes/features/callbackLogic/GridEntityUpdateDetection.js +147 -0
- package/dist/classes/features/callbackLogic/ItemPickupDetection.js +68 -0
- package/dist/classes/features/callbackLogic/PickupChangeDetection.js +43 -0
- package/dist/classes/features/callbackLogic/PlayerCollectibleDetection.js +193 -0
- package/dist/classes/features/callbackLogic/PlayerReorderedCallbacks.js +109 -0
- package/dist/classes/features/callbackLogic/SlotDestroyedDetection.js +95 -0
- package/dist/classes/features/callbackLogic/SlotRenderDetection.js +48 -0
- package/dist/classes/features/callbackLogic/SlotUpdateDetection.js +52 -0
- package/dist/classes/features/other/CharacterHealthConversion.js +112 -0
- package/dist/classes/features/other/CharacterStats.js +68 -0
- package/dist/classes/features/other/CollectibleItemPoolType.js +75 -0
- package/dist/classes/features/other/CustomHotkeys.js +144 -0
- package/dist/classes/features/other/CustomItemPools.js +128 -0
- package/dist/classes/features/other/CustomPickups.js +118 -0
- package/dist/classes/features/other/CustomStages.js +471 -0
- package/dist/classes/features/other/CustomTrapdoors.js +596 -0
- package/dist/classes/features/other/DebugDisplay.js +699 -0
- package/dist/classes/features/other/DeployJSONRoom.js +301 -0
- package/dist/classes/features/other/DisableAllSound.js +90 -0
- package/dist/classes/features/other/DisableInputs.js +249 -0
- package/dist/classes/features/other/EdenStartingStatsHealth.js +197 -0
- package/dist/classes/features/other/ExtraConsoleCommands.js +292 -0
- package/dist/classes/features/other/FadeInRemover.js +67 -0
- package/dist/classes/features/other/FastReset.js +88 -0
- package/dist/classes/features/other/FlyingDetection.js +64 -0
- package/dist/classes/features/other/ForgottenSwitch.js +43 -0
- package/dist/classes/features/other/ItemPoolDetection.js +187 -0
- package/dist/classes/features/other/ModdedElementDetection.js +399 -0
- package/dist/classes/features/other/ModdedElementSets.js +1251 -0
- package/dist/classes/features/other/NoSirenSteal.js +88 -0
- package/dist/classes/features/other/Pause.js +197 -0
- package/dist/classes/features/other/PersistentEntities.js +168 -0
- package/dist/classes/features/other/PickupIndexCreation.js +229 -0
- package/dist/classes/features/other/PlayerCollectibleTracking.js +102 -0
- package/dist/classes/features/other/PonyDetection.js +86 -0
- package/dist/classes/features/other/PressInput.js +71 -0
- package/dist/classes/features/other/PreventChildEntities.js +60 -0
- package/dist/classes/features/other/PreventGridEntityRespawn.js +159 -0
- package/dist/classes/features/other/RerunDetection.js +69 -0
- package/dist/classes/features/other/RoomClearFrame.js +94 -0
- package/dist/classes/features/other/RoomHistory.js +196 -0
- package/dist/classes/features/other/RunInNFrames.js +323 -0
- package/dist/classes/features/other/RunNextRoom.js +53 -0
- package/dist/classes/features/other/RunNextRun.js +60 -0
- package/dist/classes/features/other/SaveDataManager.js +383 -0
- package/dist/classes/features/other/SpawnRockAltRewards.js +469 -0
- package/dist/classes/features/other/StageHistory.js +244 -0
- package/dist/classes/features/other/StartAmbush.js +62 -0
- package/dist/classes/features/other/TaintedLazarusPlayers.js +115 -0
- package/dist/classes/features/other/UnlockAchievementsDetection.js +60 -0
- package/dist/classes/features/other/customStages/backdrop.js +195 -0
- package/dist/classes/features/other/customStages/constants.js +19 -0
- package/dist/classes/features/other/customStages/gridEntities.js +177 -0
- package/dist/classes/features/other/customStages/shadows.js +67 -0
- package/dist/classes/features/other/customStages/streakText.js +222 -0
- package/dist/classes/features/other/customStages/utils.js +65 -0
- package/dist/classes/features/other/customStages/v.js +27 -0
- package/dist/classes/features/other/customStages/versusScreen.js +227 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayBomb.js +23 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayDoor.js +22 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayEffect.js +23 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayFamiliar.js +23 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayKnife.js +23 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayLaser.js +23 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayNPC.js +23 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayPickup.js +23 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayPit.js +22 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayPlayer.js +25 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayPoop.js +22 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayPressurePlate.js +25 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayProjectile.js +23 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayRock.js +22 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplaySlot.js +22 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplaySpikes.js +22 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayTNT.js +22 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayTear.js +23 -0
- package/dist/classes/features/other/debugDisplay/utils.js +13 -0
- package/dist/classes/features/other/extraConsoleCommands/commands.js +1598 -0
- package/dist/classes/features/other/extraConsoleCommands/subroutines.js +135 -0
- package/dist/classes/features/other/extraConsoleCommands/v.js +30 -0
- package/dist/classes/features/other/saveDataManager/constants.js +4 -0
- package/dist/classes/features/other/saveDataManager/glowingHourGlass.js +106 -0
- package/dist/classes/features/other/saveDataManager/loadFromDisk.js +69 -0
- package/dist/classes/features/other/saveDataManager/restoreDefaults.js +69 -0
- package/dist/classes/features/other/saveDataManager/saveToDisk.js +46 -0
- package/dist/classes/private/CustomCallback.js +59 -0
- package/dist/classes/private/Feature.js +39 -0
- package/dist/core/cachedClasses.js +61 -0
- package/dist/core/constants.js +289 -0
- package/dist/core/constantsFirstLast.js +98 -0
- package/dist/core/constantsVanilla.js +131 -0
- package/dist/core/upgradeMod.js +71 -0
- package/dist/customStageMetadata.json +1 -0
- package/dist/data/itempools.json +16625 -0
- package/dist/decorators.js +21 -0
- package/dist/enums/AmbushType.js +9 -0
- package/dist/enums/CornerType.js +11 -0
- package/dist/enums/HealthType.js +20 -0
- package/dist/enums/ISCFeature.js +65 -0
- package/dist/enums/LadderSubTypeCustom.js +20 -0
- package/dist/enums/ModCallbackCustom.js +2477 -0
- package/dist/enums/MysteriousPaperEffect.js +16 -0
- package/dist/enums/PlayerStat.js +37 -0
- package/dist/enums/PocketItemType.js +13 -0
- package/dist/enums/RockAltType.js +23 -0
- package/dist/enums/SaveDataKey.js +14 -0
- package/dist/enums/SerializationType.js +10 -0
- package/dist/enums/SlotDestructionType.js +22 -0
- package/dist/enums/private/GridEntityTypeCustom.js +10 -0
- package/dist/enums/private/SerializationBrand.js +42 -0
- package/dist/enums/private/StageTravelState.js +13 -0
- package/dist/enums/private/TrapdoorAnimation.js +9 -0
- package/dist/enums/private/UIStreakAnimation.js +10 -0
- package/dist/features.js +150 -0
- package/dist/functions/ambush.js +26 -0
- package/dist/functions/array.js +586 -0
- package/dist/functions/arrayLua.js +81 -0
- package/dist/functions/benchmark.js +36 -0
- package/dist/functions/bitSet128.js +64 -0
- package/dist/functions/bitwise.js +82 -0
- package/dist/functions/bombs.js +14 -0
- package/dist/functions/bosses.js +238 -0
- package/dist/functions/cards.js +164 -0
- package/dist/functions/challenges.js +117 -0
- package/dist/functions/characters.js +182 -0
- package/dist/functions/charge.js +251 -0
- package/dist/functions/chargeBar.js +54 -0
- package/dist/functions/collectibleTag.js +24 -0
- package/dist/functions/collectibles.js +581 -0
- package/dist/functions/color.js +88 -0
- package/dist/functions/console.js +18 -0
- package/dist/functions/curses.js +37 -0
- package/dist/functions/debugFunctions.js +108 -0
- package/dist/functions/decorators.js +113 -0
- package/dist/functions/deepCopy.js +406 -0
- package/dist/functions/deepCopyTests.js +361 -0
- package/dist/functions/dimensions.js +30 -0
- package/dist/functions/direction.js +78 -0
- package/dist/functions/doors.js +524 -0
- package/dist/functions/easing.js +327 -0
- package/dist/functions/effects.js +14 -0
- package/dist/functions/emptyRoom.js +79 -0
- package/dist/functions/entities.js +529 -0
- package/dist/functions/entitiesSpecific.js +582 -0
- package/dist/functions/entityTypes.js +9 -0
- package/dist/functions/enums.js +244 -0
- package/dist/functions/external.js +59 -0
- package/dist/functions/familiars.js +136 -0
- package/dist/functions/flag.js +146 -0
- package/dist/functions/frames.js +166 -0
- package/dist/functions/globals.js +291 -0
- package/dist/functions/gridEntities.js +990 -0
- package/dist/functions/gridEntitiesSpecific.js +456 -0
- package/dist/functions/gridIndex.js +35 -0
- package/dist/functions/hash.js +75 -0
- package/dist/functions/hex.js +57 -0
- package/dist/functions/input.js +185 -0
- package/dist/functions/isaacAPIClass.js +157 -0
- package/dist/functions/itemPool.js +118 -0
- package/dist/functions/jsonHelpers.js +73 -0
- package/dist/functions/jsonRoom.js +184 -0
- package/dist/functions/kColor.js +89 -0
- package/dist/functions/language.js +16 -0
- package/dist/functions/level.js +66 -0
- package/dist/functions/levelGrid.js +497 -0
- package/dist/functions/log.js +86 -0
- package/dist/functions/logEntities.js +308 -0
- package/dist/functions/logMisc.js +510 -0
- package/dist/functions/map.js +121 -0
- package/dist/functions/math.js +149 -0
- package/dist/functions/merge.js +159 -0
- package/dist/functions/mergeTests.js +313 -0
- package/dist/functions/minimap.js +204 -0
- package/dist/functions/modFeatures.js +39 -0
- package/dist/functions/newArray.js +30 -0
- package/dist/functions/nextStage.js +169 -0
- package/dist/functions/npcDataStructures.js +146 -0
- package/dist/functions/npcs.js +132 -0
- package/dist/functions/pickupVariants.js +63 -0
- package/dist/functions/pickups.js +168 -0
- package/dist/functions/pickupsSpecific.js +376 -0
- package/dist/functions/pills.js +200 -0
- package/dist/functions/playerCenter.js +53 -0
- package/dist/functions/playerCollectibles.js +300 -0
- package/dist/functions/playerDataStructures.js +145 -0
- package/dist/functions/playerEffects.js +63 -0
- package/dist/functions/playerHealth.js +604 -0
- package/dist/functions/playerIndex.js +186 -0
- package/dist/functions/playerTrinkets.js +149 -0
- package/dist/functions/players.js +471 -0
- package/dist/functions/pocketItems.js +165 -0
- package/dist/functions/positionVelocity.js +158 -0
- package/dist/functions/pressurePlate.js +26 -0
- package/dist/functions/projectiles.js +57 -0
- package/dist/functions/random.js +90 -0
- package/dist/functions/readOnly.js +33 -0
- package/dist/functions/render.js +36 -0
- package/dist/functions/revive.js +151 -0
- package/dist/functions/rng.js +140 -0
- package/dist/functions/rockAlt.js +50 -0
- package/dist/functions/roomData.js +155 -0
- package/dist/functions/roomGrid.js +97 -0
- package/dist/functions/roomShape.js +143 -0
- package/dist/functions/roomShapeWalls.js +187 -0
- package/dist/functions/roomTransition.js +43 -0
- package/dist/functions/rooms.js +782 -0
- package/dist/functions/run.js +121 -0
- package/dist/functions/seeds.js +22 -0
- package/dist/functions/serialization.js +98 -0
- package/dist/functions/set.js +215 -0
- package/dist/functions/slots.js +41 -0
- package/dist/functions/sort.js +158 -0
- package/dist/functions/sound.js +45 -0
- package/dist/functions/spawnCollectible.js +112 -0
- package/dist/functions/sprites.js +130 -0
- package/dist/functions/stage.js +540 -0
- package/dist/functions/stats.js +104 -0
- package/dist/functions/storyBosses.js +63 -0
- package/dist/functions/string.js +194 -0
- package/dist/functions/table.js +162 -0
- package/dist/functions/tears.js +128 -0
- package/dist/functions/transformations.js +89 -0
- package/dist/functions/trinketGive.js +145 -0
- package/dist/functions/trinkets.js +213 -0
- package/dist/functions/tstlClass.js +97 -0
- package/dist/functions/types.js +225 -0
- package/dist/functions/ui.js +148 -0
- package/dist/functions/utils.d.ts +2 -0
- package/dist/functions/utils.d.ts.map +1 -1
- package/dist/functions/utils.js +195 -0
- package/dist/functions/utils.lua +4 -1
- package/dist/functions/vector.js +150 -0
- package/dist/functions/versusScreen.js +58 -0
- package/dist/functions/weighted.js +57 -0
- package/dist/index.js +219 -0
- package/dist/index.rollup.d.ts +2 -0
- package/dist/indexLua.js +220 -0
- package/dist/interfaces/ChargeBarSprites.js +2 -0
- package/dist/interfaces/Corner.js +2 -0
- package/dist/interfaces/CustomStageTSConfig.js +2 -0
- package/dist/interfaces/GridEntityCustomData.js +2 -0
- package/dist/interfaces/JSONRoomsFile.js +2 -0
- package/dist/interfaces/PlayerHealth.js +2 -0
- package/dist/interfaces/PlayerStats.js +4 -0
- package/dist/interfaces/PocketItemDescription.js +2 -0
- package/dist/interfaces/RoomDescription.js +2 -0
- package/dist/interfaces/SaveData.js +98 -0
- package/dist/interfaces/StageHistoryEntry.js +2 -0
- package/dist/interfaces/TSTLClassMetatable.js +2 -0
- package/dist/interfaces/TrinketSituation.js +2 -0
- package/dist/interfaces/private/AddCallbackParametersCustom.js +4 -0
- package/dist/interfaces/private/CustomStage.js +2 -0
- package/dist/interfaces/private/CustomTrapdoorDescription.js +2 -0
- package/dist/interfaces/private/ModUpgradedInterface.js +2 -0
- package/dist/isaacscript-common.lua +5 -2
- package/dist/maps/PHDPillConversionsMap.js +23 -0
- package/dist/maps/cardNameToTypeMap.js +211 -0
- package/dist/maps/characterNameToTypeMap.js +91 -0
- package/dist/maps/collectibleNameToTypeMap.js +19 -0
- package/dist/maps/defaultPlayerStatMap.js +17 -0
- package/dist/maps/entityTypeVariantToBossIDMap.js +11 -0
- package/dist/maps/falsePHDPillConversionsMap.js +37 -0
- package/dist/maps/gridEntityTypeToBrokenStateMap.js +32 -0
- package/dist/maps/gridEntityXMLMap.js +133 -0
- package/dist/maps/itemPoolTypeToItemPoolName.js +38 -0
- package/dist/maps/keyboardToStringMap.js +71 -0
- package/dist/maps/pillNameToEffectMap.js +91 -0
- package/dist/maps/roomNameToTypeMap.js +43 -0
- package/dist/maps/roomShapeToTopLeftWallGridIndexMap.js +17 -0
- package/dist/maps/transformationNameToPlayerFormMap.js +35 -0
- package/dist/maps/trinketNameToTypeMap.js +19 -0
- package/dist/objects/LRoomShapeToRectangles.js +43 -0
- package/dist/objects/backdropTypeToRockAltType.js +68 -0
- package/dist/objects/batteryNames.js +13 -0
- package/dist/objects/bombNames.js +17 -0
- package/dist/objects/bossIDToEntityTypeVariant.js +228 -0
- package/dist/objects/bossNamePNGFileNames.js +120 -0
- package/dist/objects/bossNames.js +119 -0
- package/dist/objects/bossPortraitPNGFileNames.js +123 -0
- package/dist/objects/cardDescriptions.js +106 -0
- package/dist/objects/cardNames.js +106 -0
- package/dist/objects/challengeBosses.js +60 -0
- package/dist/objects/challengeCharacters.js +58 -0
- package/dist/objects/challengeCollectibleTypes.js +255 -0
- package/dist/objects/challengeNames.js +54 -0
- package/dist/objects/challengeTrinketType.js +58 -0
- package/dist/objects/characterDamageMultipliers.js +49 -0
- package/dist/objects/characterNames.js +48 -0
- package/dist/objects/characterSpritePNGFileNames.js +50 -0
- package/dist/objects/characterStartingCollectibleTypes.js +105 -0
- package/dist/objects/characterStartingTrinketTypes.js +90 -0
- package/dist/objects/chestNames.js +20 -0
- package/dist/objects/coinNames.js +16 -0
- package/dist/objects/coinSubTypeToValue.js +15 -0
- package/dist/objects/collectibleDescriptions.js +742 -0
- package/dist/objects/collectibleNames.js +745 -0
- package/dist/objects/colors.js +26 -0
- package/dist/objects/directionNames.js +11 -0
- package/dist/objects/directionToDegrees.js +11 -0
- package/dist/objects/directionToMoveAction.js +11 -0
- package/dist/objects/directionToShootAction.js +11 -0
- package/dist/objects/directionToVector.js +13 -0
- package/dist/objects/doorSlotFlagToDoorSlot.js +15 -0
- package/dist/objects/doorSlotToDirection.js +15 -0
- package/dist/objects/doorSlotToDoorSlotFlag.js +15 -0
- package/dist/objects/gridEntityTypeToANM2Name.js +37 -0
- package/dist/objects/heartNames.js +21 -0
- package/dist/objects/isaacAPIClassTypeToBrand.js +12 -0
- package/dist/objects/isaacAPIClassTypeToFunctions.js +46 -0
- package/dist/objects/itemPoolTypeToCollectibleTypesSet.js +57 -0
- package/dist/objects/kColors.js +27 -0
- package/dist/objects/keyNames.js +13 -0
- package/dist/objects/languageNames.js +13 -0
- package/dist/objects/oppositeDoorSlots.js +15 -0
- package/dist/objects/pillEffectClasses.js +57 -0
- package/dist/objects/pillEffectNames.js +57 -0
- package/dist/objects/pillEffectTypeToPillEffects.js +23 -0
- package/dist/objects/pillEffectTypes.js +57 -0
- package/dist/objects/playerNamePNGFileNames.js +57 -0
- package/dist/objects/playerPortraitPNGFileNames.js +54 -0
- package/dist/objects/roomShapeBounds.js +48 -0
- package/dist/objects/roomShapeCorners.js +330 -0
- package/dist/objects/roomShapeLayoutSizes.js +41 -0
- package/dist/objects/roomShapeToBottomRightPosition.js +25 -0
- package/dist/objects/roomShapeToDoorSlotCoordinates.js +111 -0
- package/dist/objects/roomShapeToDoorSlots.js +72 -0
- package/dist/objects/roomShapeToDoorSlotsToGridIndexDelta.js +118 -0
- package/dist/objects/roomShapeToGridWidth.js +20 -0
- package/dist/objects/roomShapeToTopLeftPosition.js +26 -0
- package/dist/objects/roomShapeVolumes.js +32 -0
- package/dist/objects/roomTypeNames.js +35 -0
- package/dist/objects/roomTypeSpecialGotoPrefixes.js +35 -0
- package/dist/objects/sackNames.js +11 -0
- package/dist/objects/slotNames.js +26 -0
- package/dist/objects/stageIDNames.js +43 -0
- package/dist/objects/stageToMusic.js +91 -0
- package/dist/objects/stageToStageID.js +117 -0
- package/dist/objects/stageTypeSuffixes.js +14 -0
- package/dist/objects/transformationNames.js +20 -0
- package/dist/objects/trinketDescriptions.js +199 -0
- package/dist/objects/trinketNames.js +202 -0
- package/dist/objects/versusScreenBackgroundColors.js +46 -0
- package/dist/objects/versusScreenDirtSpotColors.js +46 -0
- package/dist/patchErrorFunctions.js +65 -0
- package/dist/serialization.js +21 -0
- package/dist/sets/LRoomShapesSet.js +11 -0
- package/dist/sets/bigRoomShapesSet.js +14 -0
- package/dist/sets/bossSets.js +465 -0
- package/dist/sets/charactersThatStartWithAnActiveItemSet.js +18 -0
- package/dist/sets/charactersWithBlackHeartFromEternalHeartSet.js +9 -0
- package/dist/sets/charactersWithFreeDevilDealsSet.js +6 -0
- package/dist/sets/charactersWithNoRedHeartsSet.js +19 -0
- package/dist/sets/charactersWithNoSoulHeartsSet.js +16 -0
- package/dist/sets/consoleCommandsSet.js +64 -0
- package/dist/sets/entitiesWithArmorSet.js +59 -0
- package/dist/sets/familiarsThatShootPlayerTearsSet.js +15 -0
- package/dist/sets/itemConfigCardTypesForCards.js +14 -0
- package/dist/sets/lostStyleCharactersSet.js +16 -0
- package/dist/sets/mineShaftRoomSubTypesSet.js +12 -0
- package/dist/sets/narrowRoomShapesSet.js +11 -0
- package/dist/sets/poopGridEntityXMLTypesSet.js +16 -0
- package/dist/sets/redHeartSubTypesSet.js +10 -0
- package/dist/sets/repentanceBossIDsSet.js +30 -0
- package/dist/sets/sinEntityTypesSet.js +14 -0
- package/dist/sets/singleUseActiveCollectibleTypesSet.js +15 -0
- package/dist/shaderCrashFix.js +24 -0
- package/dist/shouldFire.js +226 -0
- package/dist/types/AddSubtract.js +2 -0
- package/dist/types/AllButFirst.js +2 -0
- package/dist/types/AllButLast.js +2 -0
- package/dist/types/AnyClass.js +2 -0
- package/dist/types/AnyEntity.js +2 -0
- package/dist/types/AnyFunction.js +2 -0
- package/dist/types/AnyGridEntity.js +2 -0
- package/dist/types/CompositionTypeSatisfiesEnum.js +11 -0
- package/dist/types/ConversionHeartSubType.js +2 -0
- package/dist/types/Decrement.js +2 -0
- package/dist/types/ERange.js +2 -0
- package/dist/types/EntityID.js +2 -0
- package/dist/types/FunctionTuple.js +2 -0
- package/dist/types/GridEntityID.js +2 -0
- package/dist/types/HasFunction.js +2 -0
- package/dist/types/IRange.js +2 -0
- package/dist/types/Immutable.js +2 -0
- package/dist/types/Increment.js +2 -0
- package/dist/types/LowercaseKeys.js +2 -0
- package/dist/types/NaturalNumbersLessThan.js +2 -0
- package/dist/types/NaturalNumbersLessThanOrEqualTo.js +2 -0
- package/dist/types/PickingUpItem.js +44 -0
- package/dist/types/PickupIndex.js +2 -0
- package/dist/types/PlayerIndex.js +2 -0
- package/dist/types/PossibleStatType.js +2 -0
- package/dist/types/PublicInterface.js +2 -0
- package/dist/types/ReadonlyMap.js +6 -0
- package/dist/types/ReadonlyRecord.js +2 -0
- package/dist/types/ReadonlySet.js +6 -0
- package/dist/types/StartsWithLowercase.js +2 -0
- package/dist/types/StartsWithUppercase.js +2 -0
- package/dist/types/TSTLClass.js +2 -0
- package/dist/types/Tuple.js +2 -0
- package/dist/types/TupleKeys.js +2 -0
- package/dist/types/TupleToIntersection.js +2 -0
- package/dist/types/TupleToUnion.js +2 -0
- package/dist/types/TupleWithLengthBetween.js +22 -0
- package/dist/types/TupleWithMaxLength.js +27 -0
- package/dist/types/UnionToIntersection.js +2 -0
- package/dist/types/UppercaseKeys.js +2 -0
- package/dist/types/WeightedArray.js +2 -0
- package/dist/types/WidenLiteral.js +2 -0
- package/dist/types/Writable.js +2 -0
- package/dist/types/private/CallbackTuple.js +2 -0
- package/dist/types/private/ModUpgradedWithFeatures.js +2 -0
- package/package.json +1 -1
- package/src/functions/utils.ts +4 -1
- package/src/lib/jsonLua.js +701 -0
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* These functions have to do with the room grid index for the level (i.e. the position that the
|
|
4
|
+
* room is on the grid that represents the map for the level).
|
|
5
|
+
*
|
|
6
|
+
* For functions having to do with the grid index inside of the room, see the "Room Grid" functions.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.vectorToRoomGridIndex = exports.roomGridIndexToVector = exports.roomExists = exports.newRoom = exports.isRoomInsideGrid = exports.isRedKeyRoom = exports.isDoorSlotValidAtGridIndexForRedRoom = exports.isDoorSlotValidAtGridIndex = exports.isDeadEnd = exports.inRedKeyRoom = exports.inGrid = exports.getRoomShapeAdjacentNonExistingGridIndexes = exports.getRoomShapeAdjacentGridIndexes = exports.getRoomShapeAdjacentGridIndexDeltas = exports.getRoomShapeAdjacentExistingGridIndexes = exports.getRoomGridIndexesForType = exports.getRoomDescriptorsForType = exports.getRoomAdjacentGridIndexes = exports.getNewRoomCandidatesForLevel = exports.getNewRoomCandidatesBesideRoom = exports.getNewRoomCandidate = exports.getAllRoomGridIndexes = exports.getAdjacentRoomGridIndexes = exports.getAdjacentNonExistingRoomGridIndexes = exports.getAdjacentExistingRoomGridIndexes = void 0;
|
|
12
|
+
const isaac_typescript_definitions_1 = require("isaac-typescript-definitions");
|
|
13
|
+
const cachedClasses_1 = require("../core/cachedClasses");
|
|
14
|
+
const constants_1 = require("../core/constants");
|
|
15
|
+
const roomShapeToDoorSlotsToGridIndexDelta_1 = require("../objects/roomShapeToDoorSlotsToGridIndexDelta");
|
|
16
|
+
const array_1 = require("./array");
|
|
17
|
+
const doors_1 = require("./doors");
|
|
18
|
+
const flag_1 = require("./flag");
|
|
19
|
+
const map_1 = require("./map");
|
|
20
|
+
const rng_1 = require("./rng");
|
|
21
|
+
const roomData_1 = require("./roomData");
|
|
22
|
+
const roomShape_1 = require("./roomShape");
|
|
23
|
+
const rooms_1 = require("./rooms");
|
|
24
|
+
const LEFT = -1;
|
|
25
|
+
const UP = -constants_1.LEVEL_GRID_ROW_WIDTH;
|
|
26
|
+
const RIGHT = 1;
|
|
27
|
+
const DOWN = constants_1.LEVEL_GRID_ROW_WIDTH;
|
|
28
|
+
const ADJACENT_ROOM_GRID_INDEX_DELTAS = [LEFT, UP, RIGHT, DOWN];
|
|
29
|
+
/**
|
|
30
|
+
* Helper function to get only the adjacent room grid indexes that exist (i.e. have room data).
|
|
31
|
+
*
|
|
32
|
+
* This is just a filtering of the results of the `getAdjacentExistingRoomGridIndexes` function. See
|
|
33
|
+
* that function for more information.
|
|
34
|
+
*
|
|
35
|
+
* @param roomGridIndex Optional. Default is the current room index.
|
|
36
|
+
*/
|
|
37
|
+
function getAdjacentExistingRoomGridIndexes(roomGridIndex) {
|
|
38
|
+
const adjacentRoomGridIndexes = getAdjacentRoomGridIndexes(roomGridIndex);
|
|
39
|
+
return adjacentRoomGridIndexes.filter((adjacentRoomGridIndex) => (0, roomData_1.getRoomData)(adjacentRoomGridIndex) !== undefined);
|
|
40
|
+
}
|
|
41
|
+
exports.getAdjacentExistingRoomGridIndexes = getAdjacentExistingRoomGridIndexes;
|
|
42
|
+
/**
|
|
43
|
+
* Helper function to get only the adjacent room grid indexes that do not exist (i.e. do not have
|
|
44
|
+
* room data).
|
|
45
|
+
*
|
|
46
|
+
* This is just a filtering of the results of the `getAdjacentExistingRoomGridIndexes` function. See
|
|
47
|
+
* that function for more information.
|
|
48
|
+
*/
|
|
49
|
+
function getAdjacentNonExistingRoomGridIndexes(roomGridIndex) {
|
|
50
|
+
const adjacentRoomGridIndexes = getAdjacentRoomGridIndexes(roomGridIndex);
|
|
51
|
+
return adjacentRoomGridIndexes.filter((adjacentRoomGridIndex) => (0, roomData_1.getRoomData)(adjacentRoomGridIndex) === undefined);
|
|
52
|
+
}
|
|
53
|
+
exports.getAdjacentNonExistingRoomGridIndexes = getAdjacentNonExistingRoomGridIndexes;
|
|
54
|
+
/**
|
|
55
|
+
* Helper function to get all of the room grid indexes that are adjacent to a given room grid index
|
|
56
|
+
* (even if those room grid indexes do not have any rooms in them).
|
|
57
|
+
*
|
|
58
|
+
* Adjacent room grid indexes that are outside of the grid will not be included in the returned
|
|
59
|
+
* array.
|
|
60
|
+
*
|
|
61
|
+
* If a room grid index is provided that is outside of the grid, then an empty array will be
|
|
62
|
+
* returned.
|
|
63
|
+
*
|
|
64
|
+
* Note that this function does not take the shape of the room into account; it only looks at a
|
|
65
|
+
* single room grid index.
|
|
66
|
+
*
|
|
67
|
+
* @param roomGridIndex Optional. Default is the current room index.
|
|
68
|
+
*/
|
|
69
|
+
function getAdjacentRoomGridIndexes(roomGridIndex) {
|
|
70
|
+
const roomGridIndexToUse = roomGridIndex ?? (0, roomData_1.getRoomGridIndex)();
|
|
71
|
+
if (!isRoomInsideGrid(roomGridIndexToUse)) {
|
|
72
|
+
return [];
|
|
73
|
+
}
|
|
74
|
+
const adjacentRoomGridIndexes = ADJACENT_ROOM_GRID_INDEX_DELTAS.map((delta) => roomGridIndexToUse + delta);
|
|
75
|
+
return adjacentRoomGridIndexes.filter((adjacentRoomGridIndex) => isRoomInsideGrid(adjacentRoomGridIndex));
|
|
76
|
+
}
|
|
77
|
+
exports.getAdjacentRoomGridIndexes = getAdjacentRoomGridIndexes;
|
|
78
|
+
/**
|
|
79
|
+
* Helper function to get the room safe grid index for every room on the entire floor. This includes
|
|
80
|
+
* off-grid rooms, such as the Devil Room.
|
|
81
|
+
*
|
|
82
|
+
* Rooms without any data are assumed to be non-existent and are not included.
|
|
83
|
+
*/
|
|
84
|
+
function getAllRoomGridIndexes() {
|
|
85
|
+
const rooms = (0, rooms_1.getRooms)();
|
|
86
|
+
return rooms.map((roomDescriptor) => roomDescriptor.SafeGridIndex);
|
|
87
|
+
}
|
|
88
|
+
exports.getAllRoomGridIndexes = getAllRoomGridIndexes;
|
|
89
|
+
/**
|
|
90
|
+
* Helper function to pick a random valid spot on the floor to insert a brand new room. Note that
|
|
91
|
+
* some floors will not have any valid spots. If this is the case, this function will return
|
|
92
|
+
* undefined.
|
|
93
|
+
*
|
|
94
|
+
* If you want to get an unseeded room, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
95
|
+
* parameter.
|
|
96
|
+
*
|
|
97
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
98
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
99
|
+
* a random seed.
|
|
100
|
+
* @param ensureDeadEnd Optional. Whether to pick a valid dead end attached to a normal room. If
|
|
101
|
+
* false, the function will randomly pick from any valid location that would
|
|
102
|
+
* have a red door.
|
|
103
|
+
* @returns Either a tuple of adjacent room grid index, `DoorSlot`, and new room grid index, or
|
|
104
|
+
* undefined.
|
|
105
|
+
*/
|
|
106
|
+
function getNewRoomCandidate(seedOrRNG, ensureDeadEnd = true) {
|
|
107
|
+
const newRoomCandidatesForLevel = getNewRoomCandidatesForLevel(ensureDeadEnd);
|
|
108
|
+
if (newRoomCandidatesForLevel.length === 0) {
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
111
|
+
return (0, array_1.getRandomArrayElement)(newRoomCandidatesForLevel, seedOrRNG);
|
|
112
|
+
}
|
|
113
|
+
exports.getNewRoomCandidate = getNewRoomCandidate;
|
|
114
|
+
/**
|
|
115
|
+
* Helper function to iterate through the possible doors for a room and see if any of them would be
|
|
116
|
+
* a valid spot to insert a brand new room on the floor.
|
|
117
|
+
*
|
|
118
|
+
* @param roomGridIndex Optional. Default is the current room index.
|
|
119
|
+
* @param ensureDeadEnd Optional. Whether to only include doors that lead to a valid dead end
|
|
120
|
+
* attached to a normal room. If false, the function will include all doors
|
|
121
|
+
* that would have a red door.
|
|
122
|
+
* @returns A array of tuples of `DoorSlot` and room grid index.
|
|
123
|
+
*/
|
|
124
|
+
function getNewRoomCandidatesBesideRoom(roomGridIndex, ensureDeadEnd = true) {
|
|
125
|
+
const roomDescriptor = (0, roomData_1.getRoomDescriptor)(roomGridIndex);
|
|
126
|
+
// First, handle the case of rooms outside of the grid, which obviously cannot have any possible
|
|
127
|
+
// adjacent new room candidates.
|
|
128
|
+
if (!isRoomInsideGrid(roomDescriptor.SafeGridIndex)) {
|
|
129
|
+
return [];
|
|
130
|
+
}
|
|
131
|
+
// Rooms without data are non-existent, so they obviously cannot have any possible adjacent new
|
|
132
|
+
// room candidates.
|
|
133
|
+
const roomData = roomDescriptor.Data;
|
|
134
|
+
if (roomData === undefined) {
|
|
135
|
+
return [];
|
|
136
|
+
}
|
|
137
|
+
const doorSlotToRoomGridIndexes = getRoomShapeAdjacentNonExistingGridIndexes(roomDescriptor.SafeGridIndex, roomData.Shape);
|
|
138
|
+
const roomCandidates = [];
|
|
139
|
+
for (const [doorSlot, adjacentRoomGridIndex] of doorSlotToRoomGridIndexes) {
|
|
140
|
+
// The "getRoomShapeAdjacentNonExistingGridIndexes" returns grid indexes for every possible
|
|
141
|
+
// door, but the real room we are examining will only have a subset of these doors. Thus, we
|
|
142
|
+
// have to exclude adjacent grid indexes where it would not be possible to place a door.
|
|
143
|
+
const doorSlotFlag = (0, doors_1.doorSlotToDoorSlotFlag)(doorSlot);
|
|
144
|
+
if (!(0, flag_1.hasFlag)(roomData.Doors, doorSlotFlag)) {
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
// Check to see if hypothetically creating a room at the given room grid index would be a dead
|
|
148
|
+
// end. In other words, if we created the room, we would only want it to connect to one other
|
|
149
|
+
// room (this one).
|
|
150
|
+
if (ensureDeadEnd && !isDeadEnd(adjacentRoomGridIndex)) {
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
roomCandidates.push({
|
|
154
|
+
doorSlot,
|
|
155
|
+
roomGridIndex: adjacentRoomGridIndex,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
return roomCandidates;
|
|
159
|
+
}
|
|
160
|
+
exports.getNewRoomCandidatesBesideRoom = getNewRoomCandidatesBesideRoom;
|
|
161
|
+
/**
|
|
162
|
+
* Helper function to get all of the spots on the floor to insert a brand new room.
|
|
163
|
+
*
|
|
164
|
+
* @param ensureDeadEnd Optional. Whether to only include spots that are a valid dead end attached
|
|
165
|
+
* to a normal room. If false, the function will include all valid spots that
|
|
166
|
+
* have a red door.
|
|
167
|
+
* @returns A array of tuples containing the adjacent room grid index, the `DoorSlot`, and the new
|
|
168
|
+
* room grid index.
|
|
169
|
+
*/
|
|
170
|
+
function getNewRoomCandidatesForLevel(ensureDeadEnd = true) {
|
|
171
|
+
// We want to iterate over every room on the floor and search for potential new room spots.
|
|
172
|
+
const roomsInsideGrid = (0, rooms_1.getRoomsInsideGrid)();
|
|
173
|
+
// However, we want to filter out special rooms because they are supposed to be dead ends.
|
|
174
|
+
const normalRooms = roomsInsideGrid.filter((room) => room.Data !== undefined &&
|
|
175
|
+
room.Data.Type === isaac_typescript_definitions_1.RoomType.DEFAULT &&
|
|
176
|
+
!(0, rooms_1.isMirrorRoom)(room.Data) && // Mirror rooms do not count as special rooms.
|
|
177
|
+
!(0, rooms_1.isMineShaft)(room.Data));
|
|
178
|
+
const roomsToLookThrough = ensureDeadEnd ? normalRooms : roomsInsideGrid;
|
|
179
|
+
const newRoomCandidates = [];
|
|
180
|
+
for (const room of roomsToLookThrough) {
|
|
181
|
+
const newRoomCandidatesBesideRoom = getNewRoomCandidatesBesideRoom(room.SafeGridIndex, ensureDeadEnd);
|
|
182
|
+
for (const { doorSlot, roomGridIndex } of newRoomCandidatesBesideRoom) {
|
|
183
|
+
newRoomCandidates.push({
|
|
184
|
+
adjacentRoomGridIndex: room.SafeGridIndex,
|
|
185
|
+
doorSlot,
|
|
186
|
+
newRoomGridIndex: roomGridIndex,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return newRoomCandidates;
|
|
191
|
+
}
|
|
192
|
+
exports.getNewRoomCandidatesForLevel = getNewRoomCandidatesForLevel;
|
|
193
|
+
/**
|
|
194
|
+
* Helper function to get the grid indexes of all the rooms connected to the given room index,
|
|
195
|
+
* taking the shape of the room into account. (This will only include rooms with valid data.)
|
|
196
|
+
*
|
|
197
|
+
* Returns an empty map if the provided room grid index is out of bounds or has no associated room
|
|
198
|
+
* data.
|
|
199
|
+
*
|
|
200
|
+
* @param roomGridIndex Optional. Default is the current room index.
|
|
201
|
+
* @returns A map of `DoorSlot` to the corresponding room grid index.
|
|
202
|
+
*/
|
|
203
|
+
function getRoomAdjacentGridIndexes(roomGridIndex) {
|
|
204
|
+
const roomDescriptor = (0, roomData_1.getRoomDescriptor)(roomGridIndex);
|
|
205
|
+
if (!isRoomInsideGrid(roomDescriptor.SafeGridIndex)) {
|
|
206
|
+
return new Map();
|
|
207
|
+
}
|
|
208
|
+
const roomData = roomDescriptor.Data;
|
|
209
|
+
if (roomData === undefined) {
|
|
210
|
+
return new Map();
|
|
211
|
+
}
|
|
212
|
+
return getRoomShapeAdjacentExistingGridIndexes(roomDescriptor.SafeGridIndex, roomData.Shape);
|
|
213
|
+
}
|
|
214
|
+
exports.getRoomAdjacentGridIndexes = getRoomAdjacentGridIndexes;
|
|
215
|
+
/**
|
|
216
|
+
* Helper function to get an array of all of the room descriptors for rooms that match the specified
|
|
217
|
+
* room type.
|
|
218
|
+
*
|
|
219
|
+
* This function only searches through rooms in the current dimension and rooms inside the grid.
|
|
220
|
+
*
|
|
221
|
+
* This function is variadic, meaning that you can specify N arguments to get the combined room
|
|
222
|
+
* descriptors for N room types.
|
|
223
|
+
*/
|
|
224
|
+
function getRoomDescriptorsForType(...roomTypes) {
|
|
225
|
+
const roomTypesSet = new Set(roomTypes);
|
|
226
|
+
const roomsInsideGrid = (0, rooms_1.getRoomsInsideGrid)();
|
|
227
|
+
return roomsInsideGrid.filter((roomDescriptor) => roomDescriptor.Data !== undefined &&
|
|
228
|
+
roomTypesSet.has(roomDescriptor.Data.Type));
|
|
229
|
+
}
|
|
230
|
+
exports.getRoomDescriptorsForType = getRoomDescriptorsForType;
|
|
231
|
+
/**
|
|
232
|
+
* Helper function to get an array of all of the safe grid indexes for rooms that match the
|
|
233
|
+
* specified room type.
|
|
234
|
+
*
|
|
235
|
+
* This function only searches through rooms in the current dimension.
|
|
236
|
+
*
|
|
237
|
+
* This function is variadic, meaning that you can specify N arguments to get the combined grid
|
|
238
|
+
* indexes for N room types.
|
|
239
|
+
*/
|
|
240
|
+
function getRoomGridIndexesForType(...roomTypes) {
|
|
241
|
+
const roomDescriptors = getRoomDescriptorsForType(...roomTypes);
|
|
242
|
+
return roomDescriptors.map((roomDescriptor) => roomDescriptor.SafeGridIndex);
|
|
243
|
+
}
|
|
244
|
+
exports.getRoomGridIndexesForType = getRoomGridIndexesForType;
|
|
245
|
+
/**
|
|
246
|
+
* Helper function to get only the adjacent room grid indexes for a room shape that exist (i.e. have
|
|
247
|
+
* room data).
|
|
248
|
+
*
|
|
249
|
+
* This is just a filtering of the results of the `getRoomShapeAdjacentGridIndexes` function. See
|
|
250
|
+
* that function for more information.
|
|
251
|
+
*/
|
|
252
|
+
function getRoomShapeAdjacentExistingGridIndexes(safeRoomGridIndex, roomShape) {
|
|
253
|
+
const roomShapeAdjacentGridIndexes = (0, map_1.copyMap)(getRoomShapeAdjacentGridIndexes(safeRoomGridIndex, roomShape));
|
|
254
|
+
for (const [doorSlot, roomGridIndex] of roomShapeAdjacentGridIndexes) {
|
|
255
|
+
const roomData = (0, roomData_1.getRoomData)(roomGridIndex);
|
|
256
|
+
if (roomData === undefined) {
|
|
257
|
+
roomShapeAdjacentGridIndexes.delete(doorSlot);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return roomShapeAdjacentGridIndexes;
|
|
261
|
+
}
|
|
262
|
+
exports.getRoomShapeAdjacentExistingGridIndexes = getRoomShapeAdjacentExistingGridIndexes;
|
|
263
|
+
/**
|
|
264
|
+
* Helper function to get the room grid index delta that each hypothetical door in a given room
|
|
265
|
+
* shape would go to.
|
|
266
|
+
*
|
|
267
|
+
* This is used by the `getRoomShapeAdjacentGridIndexes` function.
|
|
268
|
+
*
|
|
269
|
+
* @returns A map of `DoorSlot` to the corresponding room grid index delta.
|
|
270
|
+
*/
|
|
271
|
+
function getRoomShapeAdjacentGridIndexDeltas(roomShape) {
|
|
272
|
+
return roomShapeToDoorSlotsToGridIndexDelta_1.ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA[roomShape];
|
|
273
|
+
}
|
|
274
|
+
exports.getRoomShapeAdjacentGridIndexDeltas = getRoomShapeAdjacentGridIndexDeltas;
|
|
275
|
+
/**
|
|
276
|
+
* Helper function to get the room grid index that each hypothetical door in a given room shape
|
|
277
|
+
* would go to. (This will not include room grid indexes that are outside of the grid.)
|
|
278
|
+
*
|
|
279
|
+
* @param safeRoomGridIndex This must be the room safe grid index (i.e. the top-left room grid index
|
|
280
|
+
* for the respective room).
|
|
281
|
+
* @param roomShape The shape of the hypothetical room.
|
|
282
|
+
* @returns A map of `DoorSlot` to the corresponding room grid index.
|
|
283
|
+
*/
|
|
284
|
+
function getRoomShapeAdjacentGridIndexes(safeRoomGridIndex, roomShape) {
|
|
285
|
+
const roomShapeAdjacentGridIndexDeltas = getRoomShapeAdjacentGridIndexDeltas(roomShape);
|
|
286
|
+
const adjacentGridIndexes = new Map();
|
|
287
|
+
for (const [doorSlot, delta] of roomShapeAdjacentGridIndexDeltas) {
|
|
288
|
+
const roomGridIndex = safeRoomGridIndex + delta;
|
|
289
|
+
if (isRoomInsideGrid(roomGridIndex)) {
|
|
290
|
+
adjacentGridIndexes.set(doorSlot, roomGridIndex);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
return adjacentGridIndexes;
|
|
294
|
+
}
|
|
295
|
+
exports.getRoomShapeAdjacentGridIndexes = getRoomShapeAdjacentGridIndexes;
|
|
296
|
+
/**
|
|
297
|
+
* Helper function to get only the adjacent room grid indexes for a room shape that do not exist
|
|
298
|
+
* (i.e. do not have room data).
|
|
299
|
+
*
|
|
300
|
+
* This is just a filtering of the results of the `getRoomShapeAdjacentGridIndexes` function. See
|
|
301
|
+
* that function for more information.
|
|
302
|
+
*/
|
|
303
|
+
function getRoomShapeAdjacentNonExistingGridIndexes(safeRoomGridIndex, roomShape) {
|
|
304
|
+
const roomShapeAdjacentGridIndexes = (0, map_1.copyMap)(getRoomShapeAdjacentGridIndexes(safeRoomGridIndex, roomShape));
|
|
305
|
+
for (const [doorSlot, roomGridIndex] of roomShapeAdjacentGridIndexes) {
|
|
306
|
+
const roomData = (0, roomData_1.getRoomData)(roomGridIndex);
|
|
307
|
+
if (roomData !== undefined) {
|
|
308
|
+
roomShapeAdjacentGridIndexes.delete(doorSlot);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return roomShapeAdjacentGridIndexes;
|
|
312
|
+
}
|
|
313
|
+
exports.getRoomShapeAdjacentNonExistingGridIndexes = getRoomShapeAdjacentNonExistingGridIndexes;
|
|
314
|
+
/**
|
|
315
|
+
* Helper function to determine if the current room grid index is inside of the normal 13x13 level
|
|
316
|
+
* grid.
|
|
317
|
+
*
|
|
318
|
+
* For example, Devil Rooms and the Mega Satan room are not considered to be inside the grid.
|
|
319
|
+
*/
|
|
320
|
+
function inGrid() {
|
|
321
|
+
const roomGridIndex = (0, roomData_1.getRoomGridIndex)();
|
|
322
|
+
return isRoomInsideGrid(roomGridIndex);
|
|
323
|
+
}
|
|
324
|
+
exports.inGrid = inGrid;
|
|
325
|
+
/**
|
|
326
|
+
* Helper function to detect if the current room was created by the Red Key item.
|
|
327
|
+
*
|
|
328
|
+
* Under the hood, this checks for the `RoomDescriptorFlag.FLAG_RED_ROOM` flag.
|
|
329
|
+
*/
|
|
330
|
+
function inRedKeyRoom() {
|
|
331
|
+
const roomGridIndex = (0, roomData_1.getRoomGridIndex)();
|
|
332
|
+
return isRedKeyRoom(roomGridIndex);
|
|
333
|
+
}
|
|
334
|
+
exports.inRedKeyRoom = inRedKeyRoom;
|
|
335
|
+
/**
|
|
336
|
+
* Helper function to check if the given room grid index is a dead end. Specifically, this is
|
|
337
|
+
* defined as having only one adjacent room that exists.
|
|
338
|
+
*
|
|
339
|
+
* Note that this function does not take the shape of the room into account; it only looks at a
|
|
340
|
+
* single room grid index.
|
|
341
|
+
*
|
|
342
|
+
* This function does not care if the given room grid index actually exists, so you can use it to
|
|
343
|
+
* check if a hypothetical room would be a dead end.
|
|
344
|
+
*
|
|
345
|
+
* @param roomGridIndex Optional. Default is the current room index.
|
|
346
|
+
*/
|
|
347
|
+
function isDeadEnd(roomGridIndex) {
|
|
348
|
+
const adjacentExistingRoomGridIndexes = getAdjacentExistingRoomGridIndexes(roomGridIndex);
|
|
349
|
+
return adjacentExistingRoomGridIndexes.length === 1;
|
|
350
|
+
}
|
|
351
|
+
exports.isDeadEnd = isDeadEnd;
|
|
352
|
+
function isDoorSlotValidAtGridIndex(doorSlot, roomGridIndex) {
|
|
353
|
+
const allowedDoors = (0, roomData_1.getRoomAllowedDoors)(roomGridIndex);
|
|
354
|
+
return allowedDoors.has(doorSlot);
|
|
355
|
+
}
|
|
356
|
+
exports.isDoorSlotValidAtGridIndex = isDoorSlotValidAtGridIndex;
|
|
357
|
+
function isDoorSlotValidAtGridIndexForRedRoom(doorSlot, roomGridIndex) {
|
|
358
|
+
const doorSlotValidAtGridIndex = isDoorSlotValidAtGridIndex(doorSlot, roomGridIndex);
|
|
359
|
+
if (!doorSlotValidAtGridIndex) {
|
|
360
|
+
return false;
|
|
361
|
+
}
|
|
362
|
+
const roomShape = (0, roomData_1.getRoomShape)(roomGridIndex);
|
|
363
|
+
if (roomShape === undefined) {
|
|
364
|
+
return false;
|
|
365
|
+
}
|
|
366
|
+
const delta = (0, roomShape_1.getGridIndexDelta)(roomShape, doorSlot);
|
|
367
|
+
if (delta === undefined) {
|
|
368
|
+
return false;
|
|
369
|
+
}
|
|
370
|
+
const redRoomGridIndex = roomGridIndex + delta;
|
|
371
|
+
return !roomExists(redRoomGridIndex) && isRoomInsideGrid(redRoomGridIndex);
|
|
372
|
+
}
|
|
373
|
+
exports.isDoorSlotValidAtGridIndexForRedRoom = isDoorSlotValidAtGridIndexForRedRoom;
|
|
374
|
+
/**
|
|
375
|
+
* Helper function to detect if the provided room was created by the Red Key item.
|
|
376
|
+
*
|
|
377
|
+
* Under the hood, this checks for the `RoomDescriptorFlag.FLAG_RED_ROOM` flag.
|
|
378
|
+
*
|
|
379
|
+
* @param roomGridIndex Optional. Default is the current room index.
|
|
380
|
+
*/
|
|
381
|
+
function isRedKeyRoom(roomGridIndex) {
|
|
382
|
+
const roomDescriptor = (0, roomData_1.getRoomDescriptor)(roomGridIndex);
|
|
383
|
+
return (0, flag_1.hasFlag)(roomDescriptor.Flags, isaac_typescript_definitions_1.RoomDescriptorFlag.RED_ROOM);
|
|
384
|
+
}
|
|
385
|
+
exports.isRedKeyRoom = isRedKeyRoom;
|
|
386
|
+
/**
|
|
387
|
+
* Helper function to determine if a given room grid index is inside of the normal 13x13 level grid.
|
|
388
|
+
*
|
|
389
|
+
* For example, Devil Rooms and the Mega Satan room are not considered to be inside the grid.
|
|
390
|
+
*
|
|
391
|
+
* @param roomGridIndex Optional. Default is the current room index.
|
|
392
|
+
*/
|
|
393
|
+
function isRoomInsideGrid(roomGridIndex) {
|
|
394
|
+
if (roomGridIndex === undefined) {
|
|
395
|
+
roomGridIndex = (0, roomData_1.getRoomGridIndex)();
|
|
396
|
+
}
|
|
397
|
+
return roomGridIndex >= 0 && roomGridIndex <= constants_1.MAX_LEVEL_GRID_INDEX;
|
|
398
|
+
}
|
|
399
|
+
exports.isRoomInsideGrid = isRoomInsideGrid;
|
|
400
|
+
/**
|
|
401
|
+
* Helper function to generate a new room on the floor.
|
|
402
|
+
*
|
|
403
|
+
* If you want to generate an unseeded room, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
404
|
+
* parameter.
|
|
405
|
+
*
|
|
406
|
+
* Under the hood, this function uses the `Level.MakeRedRoomDoor` method to create the room.
|
|
407
|
+
*
|
|
408
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
409
|
+
* `RNG.Next` method will be called. Default is `Level.GetDungeonPlacementSeed`.
|
|
410
|
+
* Note that the RNG is only used to select the random location to put the room on
|
|
411
|
+
* the floor; it does not influence the randomly chosen room contents. (That is
|
|
412
|
+
* performed by the game and can not be manipulated prior to its generation.)
|
|
413
|
+
* @param ensureDeadEnd Optional. Whether to place the room at a valid dead end attached to a normal
|
|
414
|
+
* room. If false, it will randomly appear at any valid location that would
|
|
415
|
+
* have a red door.
|
|
416
|
+
* @param customRoomData Optional. By default, the newly created room will have data corresponding
|
|
417
|
+
* to the game's randomly generated red room. If you provide this function
|
|
418
|
+
* with room data, it will be used to override the vanilla data.
|
|
419
|
+
* @returns The room grid index of the new room or undefined if the floor had no valid dead ends to
|
|
420
|
+
* place a room.
|
|
421
|
+
*/
|
|
422
|
+
function newRoom(seedOrRNG, ensureDeadEnd = true, customRoomData) {
|
|
423
|
+
const level = cachedClasses_1.game.GetLevel();
|
|
424
|
+
if (seedOrRNG === undefined) {
|
|
425
|
+
seedOrRNG = level.GetDungeonPlacementSeed();
|
|
426
|
+
}
|
|
427
|
+
const rng = (0, rng_1.isRNG)(seedOrRNG) ? seedOrRNG : (0, rng_1.newRNG)(seedOrRNG);
|
|
428
|
+
const newRoomCandidate = getNewRoomCandidate(rng, ensureDeadEnd);
|
|
429
|
+
if (newRoomCandidate === undefined) {
|
|
430
|
+
return undefined;
|
|
431
|
+
}
|
|
432
|
+
const { adjacentRoomGridIndex, doorSlot, newRoomGridIndex } = newRoomCandidate;
|
|
433
|
+
level.MakeRedRoomDoor(adjacentRoomGridIndex, doorSlot);
|
|
434
|
+
// By default, the room will be a "red room" and have a red graphical tint, so we want to make it
|
|
435
|
+
// a normal room.
|
|
436
|
+
const roomDescriptor = (0, roomData_1.getRoomDescriptor)(newRoomGridIndex);
|
|
437
|
+
roomDescriptor.Flags = (0, flag_1.removeFlag)(roomDescriptor.Flags, isaac_typescript_definitions_1.RoomDescriptorFlag.RED_ROOM);
|
|
438
|
+
if (customRoomData !== undefined) {
|
|
439
|
+
roomDescriptor.Data = customRoomData;
|
|
440
|
+
}
|
|
441
|
+
// By default, the new room will not appear on the map, even if the player has The Mind. Thus, we
|
|
442
|
+
// must manually alter the `DisplayFlags` of the room descriptor.
|
|
443
|
+
const roomData = roomDescriptor.Data;
|
|
444
|
+
if (roomData !== undefined) {
|
|
445
|
+
const hasFullMap = level.GetStateFlag(isaac_typescript_definitions_1.LevelStateFlag.FULL_MAP_EFFECT);
|
|
446
|
+
const hasCompass = level.GetStateFlag(isaac_typescript_definitions_1.LevelStateFlag.COMPASS_EFFECT);
|
|
447
|
+
const hasBlueMap = level.GetStateFlag(isaac_typescript_definitions_1.LevelStateFlag.BLUE_MAP_EFFECT);
|
|
448
|
+
const roomType = roomData.Type;
|
|
449
|
+
const isSecretRoom = (0, rooms_1.isSecretRoomType)(roomType);
|
|
450
|
+
if (hasFullMap) {
|
|
451
|
+
roomDescriptor.DisplayFlags = constants_1.ALL_DISPLAY_FLAGS;
|
|
452
|
+
}
|
|
453
|
+
else if (!isSecretRoom && hasCompass) {
|
|
454
|
+
roomDescriptor.DisplayFlags = (0, flag_1.addFlag)(isaac_typescript_definitions_1.DisplayFlag.VISIBLE, isaac_typescript_definitions_1.DisplayFlag.SHOW_ICON);
|
|
455
|
+
}
|
|
456
|
+
else if (isSecretRoom && hasBlueMap) {
|
|
457
|
+
roomDescriptor.DisplayFlags = (0, flag_1.addFlag)(isaac_typescript_definitions_1.DisplayFlag.VISIBLE, isaac_typescript_definitions_1.DisplayFlag.SHOW_ICON);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
return newRoomGridIndex;
|
|
461
|
+
}
|
|
462
|
+
exports.newRoom = newRoom;
|
|
463
|
+
/**
|
|
464
|
+
* Helper function to check if a room exists at the given room grid index. (A room will exist if it
|
|
465
|
+
* has non-undefined data in the room descriptor.)
|
|
466
|
+
*/
|
|
467
|
+
function roomExists(roomGridIndex) {
|
|
468
|
+
const roomData = (0, roomData_1.getRoomData)(roomGridIndex);
|
|
469
|
+
return roomData !== undefined;
|
|
470
|
+
}
|
|
471
|
+
exports.roomExists = roomExists;
|
|
472
|
+
/**
|
|
473
|
+
* Helper function to get the coordinates of a given room grid index. The floor is represented by a
|
|
474
|
+
* 13x13 grid.
|
|
475
|
+
*
|
|
476
|
+
* - Since the starting room is in the center, the starting room grid index of 84 is equal to
|
|
477
|
+
* coordinates of (6, 6).
|
|
478
|
+
* - The top-left grid index of 0 is equal to coordinates of: (12, 0)
|
|
479
|
+
* - The top-right grid index of 12 is equal to coordinates of: (0, 0)
|
|
480
|
+
* - The bottom-left grid index of 156 is equal to coordinates of: (0, 12)
|
|
481
|
+
* - The bottom-right grid index of 168 is equal to coordinates of: (12, 12)
|
|
482
|
+
*/
|
|
483
|
+
function roomGridIndexToVector(roomGridIndex) {
|
|
484
|
+
const x = roomGridIndex % constants_1.LEVEL_GRID_ROW_WIDTH;
|
|
485
|
+
const y = Math.floor(roomGridIndex / constants_1.LEVEL_GRID_ROW_WIDTH);
|
|
486
|
+
return Vector(x, y);
|
|
487
|
+
}
|
|
488
|
+
exports.roomGridIndexToVector = roomGridIndexToVector;
|
|
489
|
+
/**
|
|
490
|
+
* Helper function to convert a room grid index expressed as a vector back into an integer.
|
|
491
|
+
*
|
|
492
|
+
* Also see the `roomGridIndexToVector` helper function.
|
|
493
|
+
*/
|
|
494
|
+
function vectorToRoomGridIndex(roomVector) {
|
|
495
|
+
return roomVector.Y * constants_1.LEVEL_GRID_ROW_WIDTH + roomVector.X;
|
|
496
|
+
}
|
|
497
|
+
exports.vectorToRoomGridIndex = vectorToRoomGridIndex;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.logError = exports.logAndPrint = exports.log = exports.getParentFunctionDescription = void 0;
|
|
4
|
+
const types_1 = require("./types");
|
|
5
|
+
/**
|
|
6
|
+
* Helper function to get the name and the line number of the current calling function.
|
|
7
|
+
*
|
|
8
|
+
* For this function to work properly, the "--luadebug" flag must be enabled. Otherwise, it will
|
|
9
|
+
* always return undefined.
|
|
10
|
+
*
|
|
11
|
+
* @param levels Optional. The amount of levels to look backwards in the call stack. Default is 3
|
|
12
|
+
* (because the first level is this function, the second level is the calling
|
|
13
|
+
* function, and the third level is the parent of the calling function).
|
|
14
|
+
*/
|
|
15
|
+
function getParentFunctionDescription(
|
|
16
|
+
// We use 3 as a default because:
|
|
17
|
+
// - The first level is this function.
|
|
18
|
+
// - The second level is the calling function.
|
|
19
|
+
// - The third level is the parent of the calling function.
|
|
20
|
+
levels = 3) {
|
|
21
|
+
// "debug" is not always defined like the Lua definitions imply.
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
23
|
+
if (debug !== undefined) {
|
|
24
|
+
// The "--luadebug" launch flag is enabled.
|
|
25
|
+
const debugTable = debug.getinfo(levels);
|
|
26
|
+
if (debugTable !== undefined) {
|
|
27
|
+
return `${debugTable.name}:${debugTable.linedefined}`;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (SandboxGetParentFunctionDescription !== undefined) {
|
|
31
|
+
// The Racing+ sandbox is enabled.
|
|
32
|
+
return SandboxGetParentFunctionDescription(levels);
|
|
33
|
+
}
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
exports.getParentFunctionDescription = getParentFunctionDescription;
|
|
37
|
+
/**
|
|
38
|
+
* Helper function to avoid typing out `Isaac.DebugString()`.
|
|
39
|
+
*
|
|
40
|
+
* If you have the "--luadebug" launch flag turned on, then this function will also prepend the
|
|
41
|
+
* function name and the line number before the string, like this:
|
|
42
|
+
*
|
|
43
|
+
* ```text
|
|
44
|
+
* [INFO] - Lua Debug: saveToDisk:42494 - The save data manager wrote data to the "save#.dat" file.
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* Subsequently, it is recommended that you turn on the "--luadebug" launch flag when developing
|
|
48
|
+
* your mod so that debugging becomes a little bit easier.
|
|
49
|
+
*
|
|
50
|
+
* @param msg The message to log.
|
|
51
|
+
* @param includeParentFunction Optional. Whether to prefix the message with the function name and
|
|
52
|
+
* line number, as shown in the above example. Default is true.
|
|
53
|
+
*/
|
|
54
|
+
function log(msg, includeParentFunction = true) {
|
|
55
|
+
if ((0, types_1.isNumber)(msg)) {
|
|
56
|
+
msg = msg.toString();
|
|
57
|
+
}
|
|
58
|
+
const parentFunctionDescription = includeParentFunction
|
|
59
|
+
? getParentFunctionDescription()
|
|
60
|
+
: undefined;
|
|
61
|
+
const debugMsg = parentFunctionDescription === undefined
|
|
62
|
+
? msg
|
|
63
|
+
: `${parentFunctionDescription} - ${msg}`;
|
|
64
|
+
Isaac.DebugString(debugMsg);
|
|
65
|
+
}
|
|
66
|
+
exports.log = log;
|
|
67
|
+
/**
|
|
68
|
+
* Helper function to log a message to the "log.txt" file and to print it to the screen at the same
|
|
69
|
+
* time.
|
|
70
|
+
*/
|
|
71
|
+
function logAndPrint(msg) {
|
|
72
|
+
log(msg);
|
|
73
|
+
print(msg);
|
|
74
|
+
}
|
|
75
|
+
exports.logAndPrint = logAndPrint;
|
|
76
|
+
/**
|
|
77
|
+
* Helper function to log an error message and also print it to the console for better visibility.
|
|
78
|
+
*
|
|
79
|
+
* This is useful in situations where using the `error` function would be dangerous (since it
|
|
80
|
+
* prevents all of the subsequent code in the callback from running).
|
|
81
|
+
*/
|
|
82
|
+
function logError(msg) {
|
|
83
|
+
const errorMsg = `Error: ${msg}`;
|
|
84
|
+
logAndPrint(errorMsg);
|
|
85
|
+
}
|
|
86
|
+
exports.logError = logError;
|