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,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setSeed = exports.setAllRNGToStartSeed = exports.setAllRNGToSeed = exports.serializeRNG = exports.rngEquals = exports.newRNG = exports.isSerializedRNG = exports.isRNG = exports.getRandomSeed = exports.deserializeRNG = exports.copyRNG = void 0;
|
|
4
|
+
const cachedClasses_1 = require("../core/cachedClasses");
|
|
5
|
+
const SerializationBrand_1 = require("../enums/private/SerializationBrand");
|
|
6
|
+
const debugFunctions_1 = require("./debugFunctions");
|
|
7
|
+
const isaacAPIClass_1 = require("./isaacAPIClass");
|
|
8
|
+
const log_1 = require("./log");
|
|
9
|
+
const table_1 = require("./table");
|
|
10
|
+
const types_1 = require("./types");
|
|
11
|
+
const utils_1 = require("./utils");
|
|
12
|
+
/**
|
|
13
|
+
* This is the ShiftIdx that Blade recommended after having reviewing the game's internal functions.
|
|
14
|
+
* Any value between 0 and 80 should work equally well.
|
|
15
|
+
* https://www.jstatsoft.org/article/view/v008i14/xorshift.pdf
|
|
16
|
+
*/
|
|
17
|
+
const RECOMMENDED_SHIFT_IDX = 35;
|
|
18
|
+
const OBJECT_NAME = "RNG";
|
|
19
|
+
const KEYS = ["seed"];
|
|
20
|
+
/** Helper function to copy an `RNG` Isaac API class. */
|
|
21
|
+
function copyRNG(rng) {
|
|
22
|
+
if (!isRNG(rng)) {
|
|
23
|
+
error(`Failed to copy a ${OBJECT_NAME} object since the provided object was not a userdata ${OBJECT_NAME} class.`);
|
|
24
|
+
}
|
|
25
|
+
const seed = rng.GetSeed();
|
|
26
|
+
return newRNG(seed);
|
|
27
|
+
}
|
|
28
|
+
exports.copyRNG = copyRNG;
|
|
29
|
+
/**
|
|
30
|
+
* Helper function to convert a `SerializedRNG` object to a normal `RNG` object. (This is used by
|
|
31
|
+
* the save data manager when reading data from the "save#.dat" file.)
|
|
32
|
+
*/
|
|
33
|
+
function deserializeRNG(rng) {
|
|
34
|
+
if (!(0, types_1.isTable)(rng)) {
|
|
35
|
+
error(`Failed to deserialize a ${OBJECT_NAME} object since the provided object was not a Lua table.`);
|
|
36
|
+
}
|
|
37
|
+
const [seed] = (0, table_1.getNumbersFromTable)(rng, OBJECT_NAME, ...KEYS);
|
|
38
|
+
(0, utils_1.assertDefined)(seed, `Failed to deserialize a ${OBJECT_NAME} object since the provided object did not have a value for: seed`);
|
|
39
|
+
return newRNG(seed);
|
|
40
|
+
}
|
|
41
|
+
exports.deserializeRNG = deserializeRNG;
|
|
42
|
+
/**
|
|
43
|
+
* Helper function to get a random `Seed` value to be used in spawning entities and so on. Use this
|
|
44
|
+
* instead of calling the `Random` function directly since that can return a value of 0 and crash
|
|
45
|
+
* the game.
|
|
46
|
+
*/
|
|
47
|
+
function getRandomSeed() {
|
|
48
|
+
const randomNumber = Random(); // eslint-disable-line deprecation/deprecation
|
|
49
|
+
const safeRandomNumber = randomNumber === 0 ? 1 : randomNumber;
|
|
50
|
+
return safeRandomNumber;
|
|
51
|
+
}
|
|
52
|
+
exports.getRandomSeed = getRandomSeed;
|
|
53
|
+
/** Helper function to check if something is an instantiated `RNG` object. */
|
|
54
|
+
function isRNG(object) {
|
|
55
|
+
return (0, isaacAPIClass_1.isIsaacAPIClassOfType)(object, OBJECT_NAME);
|
|
56
|
+
}
|
|
57
|
+
exports.isRNG = isRNG;
|
|
58
|
+
/**
|
|
59
|
+
* Used to determine is the given table is a serialized `RNG` object created by the `deepCopy`
|
|
60
|
+
* function.
|
|
61
|
+
*/
|
|
62
|
+
function isSerializedRNG(object) {
|
|
63
|
+
if (!(0, types_1.isTable)(object)) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
return (0, table_1.tableHasKeys)(object, ...KEYS) && object.has(SerializationBrand_1.SerializationBrand.RNG);
|
|
67
|
+
}
|
|
68
|
+
exports.isSerializedRNG = isSerializedRNG;
|
|
69
|
+
/**
|
|
70
|
+
* Helper function to initialize a new RNG object using Blade's recommended shift index.
|
|
71
|
+
*
|
|
72
|
+
* @param seed Optional. The seed to initialize it with. Default is a random seed.
|
|
73
|
+
*/
|
|
74
|
+
function newRNG(seed = getRandomSeed()) {
|
|
75
|
+
const rng = RNG();
|
|
76
|
+
setSeed(rng, seed);
|
|
77
|
+
return rng;
|
|
78
|
+
}
|
|
79
|
+
exports.newRNG = newRNG;
|
|
80
|
+
function rngEquals(rng1, rng2) {
|
|
81
|
+
return (0, isaacAPIClass_1.isaacAPIClassEquals)(rng1, rng2, KEYS);
|
|
82
|
+
}
|
|
83
|
+
exports.rngEquals = rngEquals;
|
|
84
|
+
/**
|
|
85
|
+
* Helper function to convert a `RNG` object to a `SerializedRNG` object. (This is used by the save
|
|
86
|
+
* data manager when writing data from the "save#.dat" file.)
|
|
87
|
+
*/
|
|
88
|
+
function serializeRNG(rng) {
|
|
89
|
+
if (!isRNG(rng)) {
|
|
90
|
+
error(`Failed to serialize a ${OBJECT_NAME} object since the provided object was not a userdata ${OBJECT_NAME} class.`);
|
|
91
|
+
}
|
|
92
|
+
const seed = rng.GetSeed();
|
|
93
|
+
const rngTable = new LuaMap();
|
|
94
|
+
rngTable.set("seed", seed);
|
|
95
|
+
rngTable.set(SerializationBrand_1.SerializationBrand.RNG, "");
|
|
96
|
+
return rngTable;
|
|
97
|
+
}
|
|
98
|
+
exports.serializeRNG = serializeRNG;
|
|
99
|
+
/**
|
|
100
|
+
* Helper function to iterate over the provided object and set the seed for all of the values that
|
|
101
|
+
* are RNG objects equal to a particular seed.
|
|
102
|
+
*/
|
|
103
|
+
function setAllRNGToSeed(object, seed) {
|
|
104
|
+
if (!(0, types_1.isTable)(object)) {
|
|
105
|
+
error(`Failed to iterate over the object containing RNG objects since the type of the provided object was: ${typeof object}`);
|
|
106
|
+
}
|
|
107
|
+
let setAtLeastOneSeed = false;
|
|
108
|
+
for (const [_key, value] of object) {
|
|
109
|
+
if (isRNG(value)) {
|
|
110
|
+
setSeed(value, seed);
|
|
111
|
+
setAtLeastOneSeed = true;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (!setAtLeastOneSeed) {
|
|
115
|
+
error(`Failed to set all RNG objects to seed ${seed} because the parent object did not contain any RNG objects.`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
exports.setAllRNGToSeed = setAllRNGToSeed;
|
|
119
|
+
/**
|
|
120
|
+
* Helper function to iterate over the provided object and set the seed for all of the values that
|
|
121
|
+
* are RNG objects equal to the start seed for the current run.
|
|
122
|
+
*/
|
|
123
|
+
function setAllRNGToStartSeed(object) {
|
|
124
|
+
const seeds = cachedClasses_1.game.GetSeeds();
|
|
125
|
+
const startSeed = seeds.GetStartSeed();
|
|
126
|
+
setAllRNGToSeed(object, startSeed);
|
|
127
|
+
}
|
|
128
|
+
exports.setAllRNGToStartSeed = setAllRNGToStartSeed;
|
|
129
|
+
/** Helper function to set a seed to an RNG object using Blade's recommended shift index. */
|
|
130
|
+
function setSeed(rng, seed) {
|
|
131
|
+
if (seed === 0) {
|
|
132
|
+
seed = getRandomSeed();
|
|
133
|
+
(0, log_1.logError)("Failed to set a RNG object to a seed of 0. Using a random value instead.");
|
|
134
|
+
(0, debugFunctions_1.traceback)();
|
|
135
|
+
}
|
|
136
|
+
// The game expects seeds in the range of 1 to 4294967295 (1^32 - 1).
|
|
137
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
138
|
+
rng.SetSeed(seed, RECOMMENDED_SHIFT_IDX);
|
|
139
|
+
}
|
|
140
|
+
exports.setSeed = setSeed;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeUrnRewards = exports.getRockAltType = void 0;
|
|
4
|
+
const isaac_typescript_definitions_1 = require("isaac-typescript-definitions");
|
|
5
|
+
const cachedClasses_1 = require("../core/cachedClasses");
|
|
6
|
+
const backdropTypeToRockAltType_1 = require("../objects/backdropTypeToRockAltType");
|
|
7
|
+
const entitiesSpecific_1 = require("./entitiesSpecific");
|
|
8
|
+
const gridEntities_1 = require("./gridEntities");
|
|
9
|
+
const pickupsSpecific_1 = require("./pickupsSpecific");
|
|
10
|
+
/**
|
|
11
|
+
* Helper function to get the alternate rock type (i.e. urn, mushroom, etc.) that the current room
|
|
12
|
+
* will have.
|
|
13
|
+
*
|
|
14
|
+
* The rock type is based on the backdrop of the room.
|
|
15
|
+
*
|
|
16
|
+
* For example, if you change the backdrop of the starting room of the run to `BackdropType.CAVES`,
|
|
17
|
+
* and then spawn `GridEntityType.ROCK_ALT`, it will be a mushroom instead of an urn. Additionally,
|
|
18
|
+
* if it is destroyed, it will generate mushroom-appropriate rewards.
|
|
19
|
+
*
|
|
20
|
+
* On the other hand, if an urn is spawned first before the backdrop is changed to
|
|
21
|
+
* `BackdropType.CAVES`, the graphic of the urn will not switch to a mushroom. However, when
|
|
22
|
+
* destroyed, the urn will still generate mushroom-appropriate rewards.
|
|
23
|
+
*/
|
|
24
|
+
function getRockAltType() {
|
|
25
|
+
const room = cachedClasses_1.game.GetRoom();
|
|
26
|
+
const backdropType = room.GetBackdropType();
|
|
27
|
+
return backdropTypeToRockAltType_1.BACKDROP_TYPE_TO_ROCK_ALT_TYPE[backdropType];
|
|
28
|
+
}
|
|
29
|
+
exports.getRockAltType = getRockAltType;
|
|
30
|
+
/**
|
|
31
|
+
* Helper function to remove all coins, trinkets, and so on that spawned from breaking an urn.
|
|
32
|
+
*
|
|
33
|
+
* The rewards are based on the ones from the wiki:
|
|
34
|
+
* https://bindingofisaacrebirth.fandom.com/wiki/Rocks#Urns
|
|
35
|
+
*/
|
|
36
|
+
function removeUrnRewards(gridEntity) {
|
|
37
|
+
// Coins
|
|
38
|
+
const coins = (0, pickupsSpecific_1.getCoins)();
|
|
39
|
+
(0, gridEntities_1.removeEntitiesSpawnedFromGridEntity)(coins, gridEntity);
|
|
40
|
+
// A Quarter
|
|
41
|
+
const quarters = (0, pickupsSpecific_1.getCollectibles)(isaac_typescript_definitions_1.CollectibleType.QUARTER);
|
|
42
|
+
(0, gridEntities_1.removeEntitiesSpawnedFromGridEntity)(quarters, gridEntity);
|
|
43
|
+
// Swallowed Penny
|
|
44
|
+
const swallowedPennies = (0, pickupsSpecific_1.getTrinkets)(isaac_typescript_definitions_1.TrinketType.SWALLOWED_PENNY);
|
|
45
|
+
(0, gridEntities_1.removeEntitiesSpawnedFromGridEntity)(swallowedPennies, gridEntity);
|
|
46
|
+
// Spiders
|
|
47
|
+
const spiders = (0, entitiesSpecific_1.getNPCs)(isaac_typescript_definitions_1.EntityType.SPIDER);
|
|
48
|
+
(0, gridEntities_1.removeEntitiesSpawnedFromGridEntity)(spiders, gridEntity);
|
|
49
|
+
}
|
|
50
|
+
exports.removeUrnRewards = removeUrnRewards;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setRoomData = exports.getRoomVisitedCount = exports.getRoomVariant = exports.getRoomType = exports.getRoomSubType = exports.getRoomStageID = exports.getRoomShape = exports.getRoomName = exports.getRoomListIndex = exports.getRoomGridIndex = exports.getRoomDescriptorReadOnly = exports.getRoomDescriptor = exports.getRoomData = exports.getRoomAllowedDoors = void 0;
|
|
4
|
+
const cachedEnumValues_1 = require("../arrays/cachedEnumValues");
|
|
5
|
+
const cachedClasses_1 = require("../core/cachedClasses");
|
|
6
|
+
const doors_1 = require("./doors");
|
|
7
|
+
const flag_1 = require("./flag");
|
|
8
|
+
/**
|
|
9
|
+
* Helper function to get the set of allowed door slots for the room at the supplied grid index.
|
|
10
|
+
* This corresponds to the doors that are enabled in the STB/XML file for the room.
|
|
11
|
+
*/
|
|
12
|
+
function getRoomAllowedDoors(roomGridIndex) {
|
|
13
|
+
const allowedDoors = new Set();
|
|
14
|
+
const roomData = getRoomData(roomGridIndex);
|
|
15
|
+
if (roomData === undefined) {
|
|
16
|
+
return allowedDoors;
|
|
17
|
+
}
|
|
18
|
+
for (const doorSlotFlag of cachedEnumValues_1.DOOR_SLOT_FLAG_VALUES) {
|
|
19
|
+
if ((0, flag_1.hasFlag)(roomData.Doors, doorSlotFlag)) {
|
|
20
|
+
const doorSlot = (0, doors_1.doorSlotFlagToDoorSlot)(doorSlotFlag);
|
|
21
|
+
allowedDoors.add(doorSlot);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return allowedDoors;
|
|
25
|
+
}
|
|
26
|
+
exports.getRoomAllowedDoors = getRoomAllowedDoors;
|
|
27
|
+
function getRoomData(roomGridIndex) {
|
|
28
|
+
const roomDescriptor = getRoomDescriptor(roomGridIndex);
|
|
29
|
+
return roomDescriptor.Data;
|
|
30
|
+
}
|
|
31
|
+
exports.getRoomData = getRoomData;
|
|
32
|
+
/**
|
|
33
|
+
* Helper function to get the descriptor for a room.
|
|
34
|
+
*
|
|
35
|
+
* @param roomGridIndex Optional. Default is the current room index.
|
|
36
|
+
*/
|
|
37
|
+
function getRoomDescriptor(roomGridIndex) {
|
|
38
|
+
const level = cachedClasses_1.game.GetLevel();
|
|
39
|
+
if (roomGridIndex === undefined) {
|
|
40
|
+
roomGridIndex = getRoomGridIndex();
|
|
41
|
+
}
|
|
42
|
+
return level.GetRoomByIdx(roomGridIndex);
|
|
43
|
+
}
|
|
44
|
+
exports.getRoomDescriptor = getRoomDescriptor;
|
|
45
|
+
/**
|
|
46
|
+
* Alias for the `Level.GetCurrentRoomDesc` method. Use this to make it more clear what type of
|
|
47
|
+
* `RoomDescriptor` object that you are retrieving.
|
|
48
|
+
*/
|
|
49
|
+
function getRoomDescriptorReadOnly() {
|
|
50
|
+
const level = cachedClasses_1.game.GetLevel();
|
|
51
|
+
return level.GetCurrentRoomDesc();
|
|
52
|
+
}
|
|
53
|
+
exports.getRoomDescriptorReadOnly = getRoomDescriptorReadOnly;
|
|
54
|
+
/**
|
|
55
|
+
* Helper function to get the grid index of the current room.
|
|
56
|
+
*
|
|
57
|
+
* - If the current room is inside of the grid, this function will return the `SafeGridIndex` from
|
|
58
|
+
* the room descriptor. (The safe grid index is defined as the top-left 1x1 section that the room
|
|
59
|
+
* overlaps with, or the top-right 1x1 section of a `RoomType.SHAPE_LTL` room.)
|
|
60
|
+
* - If the current room is outside of the grid, it will return the index from the
|
|
61
|
+
* `Level.GetCurrentRoomIndex` method, since `SafeGridIndex` is bugged for these cases, as
|
|
62
|
+
* demonstrated by entering a Genesis room and entering `l
|
|
63
|
+
* print(Game():GetLevel():GetCurrentRoomDesc().SafeGridIndex)` into the console. (It prints -1
|
|
64
|
+
* instead of -12.)
|
|
65
|
+
*
|
|
66
|
+
* Use this function instead of the `Level.GetCurrentRoomIndex` method directly because the latter
|
|
67
|
+
* will return the specific 1x1 quadrant that the player entered the room at. For most situations,
|
|
68
|
+
* using the safe grid index is more reliable than this.
|
|
69
|
+
*
|
|
70
|
+
* Data structures that store data per room should use the room's `ListIndex` instead of
|
|
71
|
+
* `SafeGridIndex`, since the former is unique across different dimensions.
|
|
72
|
+
*/
|
|
73
|
+
function getRoomGridIndex() {
|
|
74
|
+
const level = cachedClasses_1.game.GetLevel();
|
|
75
|
+
const currentRoomIndex = level.GetCurrentRoomIndex();
|
|
76
|
+
if (currentRoomIndex < 0) {
|
|
77
|
+
return currentRoomIndex;
|
|
78
|
+
}
|
|
79
|
+
const roomDescriptor = getRoomDescriptorReadOnly();
|
|
80
|
+
return roomDescriptor.SafeGridIndex;
|
|
81
|
+
}
|
|
82
|
+
exports.getRoomGridIndex = getRoomGridIndex;
|
|
83
|
+
/**
|
|
84
|
+
* Helper function to get the list grid index of the provided room, which is equal to the index in
|
|
85
|
+
* the `RoomList.Get` method. In other words, this is equal to the order that the room was created
|
|
86
|
+
* by the floor generation algorithm.
|
|
87
|
+
*
|
|
88
|
+
* Use this as an index for data structures that store data per room, since it is unique across
|
|
89
|
+
* different dimensions.
|
|
90
|
+
*
|
|
91
|
+
* @param roomGridIndex Optional. Default is the current room index.
|
|
92
|
+
*/
|
|
93
|
+
function getRoomListIndex(roomGridIndex) {
|
|
94
|
+
const roomDescriptor = getRoomDescriptor(roomGridIndex);
|
|
95
|
+
return roomDescriptor.ListIndex;
|
|
96
|
+
}
|
|
97
|
+
exports.getRoomListIndex = getRoomListIndex;
|
|
98
|
+
function getRoomName(roomGridIndex) {
|
|
99
|
+
const roomData = getRoomData(roomGridIndex);
|
|
100
|
+
return roomData === undefined ? undefined : roomData.Name;
|
|
101
|
+
}
|
|
102
|
+
exports.getRoomName = getRoomName;
|
|
103
|
+
function getRoomShape(roomGridIndex) {
|
|
104
|
+
const roomData = getRoomData(roomGridIndex);
|
|
105
|
+
return roomData === undefined ? undefined : roomData.Shape;
|
|
106
|
+
}
|
|
107
|
+
exports.getRoomShape = getRoomShape;
|
|
108
|
+
function getRoomStageID(roomGridIndex) {
|
|
109
|
+
const roomData = getRoomData(roomGridIndex);
|
|
110
|
+
return roomData === undefined ? undefined : roomData.StageID;
|
|
111
|
+
}
|
|
112
|
+
exports.getRoomStageID = getRoomStageID;
|
|
113
|
+
function getRoomSubType(roomGridIndex) {
|
|
114
|
+
const roomData = getRoomData(roomGridIndex);
|
|
115
|
+
return roomData === undefined ? undefined : roomData.Subtype;
|
|
116
|
+
}
|
|
117
|
+
exports.getRoomSubType = getRoomSubType;
|
|
118
|
+
/**
|
|
119
|
+
* Helper function for getting the type of the room with the given grid index.
|
|
120
|
+
*
|
|
121
|
+
* @param roomGridIndex Optional. Default is the current room index.
|
|
122
|
+
* @returns The room data type. Returns -1 if the room data was not found.
|
|
123
|
+
*/
|
|
124
|
+
function getRoomType(roomGridIndex) {
|
|
125
|
+
const roomData = getRoomData(roomGridIndex);
|
|
126
|
+
return roomData === undefined ? undefined : roomData.Type;
|
|
127
|
+
}
|
|
128
|
+
exports.getRoomType = getRoomType;
|
|
129
|
+
function getRoomVariant(roomGridIndex) {
|
|
130
|
+
const roomData = getRoomData(roomGridIndex);
|
|
131
|
+
return roomData === undefined ? -1 : roomData.Variant;
|
|
132
|
+
}
|
|
133
|
+
exports.getRoomVariant = getRoomVariant;
|
|
134
|
+
/**
|
|
135
|
+
* Note that the room visited count will be inaccurate during the period before the `POST_NEW_ROOM`
|
|
136
|
+
* callback has fired (i.e. when entities are initializing and performing their first update). This
|
|
137
|
+
* is because the variable is only incremented immediately before the `POST_NEW_ROOM` callback
|
|
138
|
+
* fires.
|
|
139
|
+
*
|
|
140
|
+
* @param roomGridIndex Optional. Default is the current room index.
|
|
141
|
+
*/
|
|
142
|
+
function getRoomVisitedCount(roomGridIndex) {
|
|
143
|
+
const roomDescriptor = getRoomDescriptor(roomGridIndex);
|
|
144
|
+
return roomDescriptor.VisitedCount;
|
|
145
|
+
}
|
|
146
|
+
exports.getRoomVisitedCount = getRoomVisitedCount;
|
|
147
|
+
/**
|
|
148
|
+
* Helper function to set the data for a given room. This will change the room type, contents, and
|
|
149
|
+
* so on.
|
|
150
|
+
*/
|
|
151
|
+
function setRoomData(roomGridIndex, roomData) {
|
|
152
|
+
const roomDescriptor = getRoomDescriptor(roomGridIndex);
|
|
153
|
+
roomDescriptor.Data = roomData;
|
|
154
|
+
}
|
|
155
|
+
exports.setRoomData = setRoomData;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* These functions have to do with the grid index inside of a room (i.e. the grid index that grid
|
|
4
|
+
* entities use).
|
|
5
|
+
*
|
|
6
|
+
* For functions having to do with the room grid index of the level, see the "Level Grid" functions.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.worldPositionToGridPositionFast = exports.worldPositionToGridPosition = exports.isValidGridPosition = exports.gridPositionToWorldPosition = exports.gridIndexToGridPosition = exports.gridCoordinatesToWorldPosition = void 0;
|
|
12
|
+
const LRoomShapeToRectangles_1 = require("../objects/LRoomShapeToRectangles");
|
|
13
|
+
const math_1 = require("./math");
|
|
14
|
+
const roomShape_1 = require("./roomShape");
|
|
15
|
+
/**
|
|
16
|
+
* Helper function to convert grid coordinates to a world position `Vector`.
|
|
17
|
+
*
|
|
18
|
+
* For example, the coordinates of (0, 0) are equal to `Vector(80, 160)`.
|
|
19
|
+
*/
|
|
20
|
+
function gridCoordinatesToWorldPosition(x, y) {
|
|
21
|
+
const gridPosition = Vector(x, y);
|
|
22
|
+
return gridPositionToWorldPosition(gridPosition);
|
|
23
|
+
}
|
|
24
|
+
exports.gridCoordinatesToWorldPosition = gridCoordinatesToWorldPosition;
|
|
25
|
+
/**
|
|
26
|
+
* Helper function to convert a grid index to a grid position.
|
|
27
|
+
*
|
|
28
|
+
* For example, in a 1x1 room, grid index 0 is equal to "Vector(-1, -1) and grid index 16 is equal
|
|
29
|
+
* to "Vector(0, 0)".
|
|
30
|
+
*/
|
|
31
|
+
function gridIndexToGridPosition(gridIndex, roomShape) {
|
|
32
|
+
const gridWidth = (0, roomShape_1.getRoomShapeWidth)(roomShape);
|
|
33
|
+
const x = (gridIndex % gridWidth) - 1;
|
|
34
|
+
const y = Math.floor(gridIndex / gridWidth) - 1;
|
|
35
|
+
return Vector(x, y);
|
|
36
|
+
}
|
|
37
|
+
exports.gridIndexToGridPosition = gridIndexToGridPosition;
|
|
38
|
+
/**
|
|
39
|
+
* Helper function to convert a grid position `Vector` to a world position `Vector`.
|
|
40
|
+
*
|
|
41
|
+
* For example, the coordinates of (0, 0) are equal to `Vector(80, 160)`.
|
|
42
|
+
*/
|
|
43
|
+
function gridPositionToWorldPosition(gridPosition) {
|
|
44
|
+
const x = (gridPosition.X + 2) * 40;
|
|
45
|
+
const y = (gridPosition.Y + 4) * 40;
|
|
46
|
+
return Vector(x, y);
|
|
47
|
+
}
|
|
48
|
+
exports.gridPositionToWorldPosition = gridPositionToWorldPosition;
|
|
49
|
+
/**
|
|
50
|
+
* Test if a grid position is actually in the given `RoomShape`.
|
|
51
|
+
*
|
|
52
|
+
* In this context, the grid position of the top-left wall is "Vector(-1, -1)".
|
|
53
|
+
*/
|
|
54
|
+
function isValidGridPosition(gridPosition, roomShape) {
|
|
55
|
+
return (0, roomShape_1.isLRoomShape)(roomShape)
|
|
56
|
+
? isValidGridPositionLRoom(gridPosition, roomShape)
|
|
57
|
+
: isValidGridPositionNormal(gridPosition, roomShape);
|
|
58
|
+
}
|
|
59
|
+
exports.isValidGridPosition = isValidGridPosition;
|
|
60
|
+
function isValidGridPositionNormal(gridPosition, roomShape) {
|
|
61
|
+
const topLeft = (0, roomShape_1.getRoomShapeTopLeftPosition)(roomShape);
|
|
62
|
+
const bottomRight = (0, roomShape_1.getRoomShapeBottomRightPosition)(roomShape);
|
|
63
|
+
return (0, math_1.inRectangle)(gridPosition, topLeft, bottomRight);
|
|
64
|
+
}
|
|
65
|
+
function isValidGridPositionLRoom(gridPosition, roomShape) {
|
|
66
|
+
const rectangles = LRoomShapeToRectangles_1.L_ROOM_SHAPE_TO_RECTANGLES[roomShape];
|
|
67
|
+
if (rectangles === undefined) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
const { verticalTopLeft, verticalBottomRight, horizontalTopLeft, horizontalBottomRight, } = rectangles;
|
|
71
|
+
return ((0, math_1.inRectangle)(gridPosition, verticalTopLeft, verticalBottomRight) ||
|
|
72
|
+
(0, math_1.inRectangle)(gridPosition, horizontalTopLeft, horizontalBottomRight));
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Helper function to convert a world position `Vector` to a grid position `Vector`.
|
|
76
|
+
*
|
|
77
|
+
* In this context, the grid position of the top-left wall is "Vector(-1, -1)".
|
|
78
|
+
*/
|
|
79
|
+
function worldPositionToGridPosition(worldPos) {
|
|
80
|
+
const x = Math.round(worldPos.X / 40 - 2);
|
|
81
|
+
const y = Math.round(worldPos.Y / 40 - 4);
|
|
82
|
+
return Vector(x, y);
|
|
83
|
+
}
|
|
84
|
+
exports.worldPositionToGridPosition = worldPositionToGridPosition;
|
|
85
|
+
/**
|
|
86
|
+
* Helper function to convert a world position `Vector` to a grid position `Vector`.
|
|
87
|
+
*
|
|
88
|
+
* In this context, the grid position of the top-left wall is "Vector(-1, -1)".
|
|
89
|
+
*
|
|
90
|
+
* This is similar to the `worldPositionToGridPosition` function, but the values are not rounded.
|
|
91
|
+
*/
|
|
92
|
+
function worldPositionToGridPositionFast(worldPos) {
|
|
93
|
+
const x = worldPos.X / 40 - 2;
|
|
94
|
+
const y = worldPos.Y / 40 - 4;
|
|
95
|
+
return Vector(x, y);
|
|
96
|
+
}
|
|
97
|
+
exports.worldPositionToGridPositionFast = worldPositionToGridPositionFast;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isRoomShapeDoubleCharge = exports.isNarrowRoom = exports.isLRoomShape = exports.isBigRoomShape = exports.is2x1RoomShape = exports.getRoomShapeWidth = exports.getRoomShapeVolume = exports.getRoomShapeTopLeftPosition = exports.getRoomShapeLayoutSize = exports.getRoomShapeCorners = exports.getRoomShapeCharges = exports.getRoomShapeBounds = exports.getRoomShapeBottomRightPosition = exports.getGridIndexDelta = void 0;
|
|
4
|
+
const isaac_typescript_definitions_1 = require("isaac-typescript-definitions");
|
|
5
|
+
const roomShapeBounds_1 = require("../objects/roomShapeBounds");
|
|
6
|
+
const roomShapeCorners_1 = require("../objects/roomShapeCorners");
|
|
7
|
+
const roomShapeLayoutSizes_1 = require("../objects/roomShapeLayoutSizes");
|
|
8
|
+
const roomShapeToBottomRightPosition_1 = require("../objects/roomShapeToBottomRightPosition");
|
|
9
|
+
const roomShapeToDoorSlotsToGridIndexDelta_1 = require("../objects/roomShapeToDoorSlotsToGridIndexDelta");
|
|
10
|
+
const roomShapeToGridWidth_1 = require("../objects/roomShapeToGridWidth");
|
|
11
|
+
const roomShapeToTopLeftPosition_1 = require("../objects/roomShapeToTopLeftPosition");
|
|
12
|
+
const roomShapeVolumes_1 = require("../objects/roomShapeVolumes");
|
|
13
|
+
const LRoomShapesSet_1 = require("../sets/LRoomShapesSet");
|
|
14
|
+
const bigRoomShapesSet_1 = require("../sets/bigRoomShapesSet");
|
|
15
|
+
const narrowRoomShapesSet_1 = require("../sets/narrowRoomShapesSet");
|
|
16
|
+
/**
|
|
17
|
+
* Helper function to get the grid index delta that a door out of the given room shape would lead
|
|
18
|
+
* to. For example, if you went through the bottom door in a room of `RoomShape.SHAPE_1x2`, you
|
|
19
|
+
* would end up in a room with a grid index that is +26 units from the `SafeGridIndex` of where you
|
|
20
|
+
* started.
|
|
21
|
+
*/
|
|
22
|
+
function getGridIndexDelta(roomShape, doorSlot) {
|
|
23
|
+
const doorSlotToGridIndexMap = roomShapeToDoorSlotsToGridIndexDelta_1.ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA[roomShape];
|
|
24
|
+
return doorSlotToGridIndexMap.get(doorSlot);
|
|
25
|
+
}
|
|
26
|
+
exports.getGridIndexDelta = getGridIndexDelta;
|
|
27
|
+
/**
|
|
28
|
+
* Helper function to see if a given room shape will grant a single charge or a double charge to the
|
|
29
|
+
* player's active item(s).
|
|
30
|
+
*
|
|
31
|
+
* For example, `RoomShape.SHAPE_2x2` will return 2.
|
|
32
|
+
*/
|
|
33
|
+
function getRoomShapeBottomRightPosition(roomShape) {
|
|
34
|
+
return roomShapeToBottomRightPosition_1.ROOM_SHAPE_TO_BOTTOM_RIGHT_POSITION[roomShape];
|
|
35
|
+
}
|
|
36
|
+
exports.getRoomShapeBottomRightPosition = getRoomShapeBottomRightPosition;
|
|
37
|
+
/**
|
|
38
|
+
* Helper function to get the grid position of the bottom-right tile of a given room shape.
|
|
39
|
+
*
|
|
40
|
+
* "Vector(0, 0)" corresponds to the top left tile of a room, not including the walls. (The top-left
|
|
41
|
+
* wall would be at "Vector(-1, -1)".)
|
|
42
|
+
*/
|
|
43
|
+
function getRoomShapeBounds(roomShape) {
|
|
44
|
+
return roomShapeBounds_1.ROOM_SHAPE_BOUNDS[roomShape];
|
|
45
|
+
}
|
|
46
|
+
exports.getRoomShapeBounds = getRoomShapeBounds;
|
|
47
|
+
/**
|
|
48
|
+
* Helper function to get the number of charges that a given room shape will grant to a player upon
|
|
49
|
+
* clearing it.
|
|
50
|
+
*
|
|
51
|
+
* For example, `RoomShape.SHAPE_2x2` will return 2.
|
|
52
|
+
*/
|
|
53
|
+
function getRoomShapeCharges(roomShape) {
|
|
54
|
+
return isRoomShapeDoubleCharge(roomShape) ? 2 : 1;
|
|
55
|
+
}
|
|
56
|
+
exports.getRoomShapeCharges = getRoomShapeCharges;
|
|
57
|
+
/**
|
|
58
|
+
* Helper function to get the corners that exist in the given room shape.
|
|
59
|
+
*
|
|
60
|
+
* Note that these corner locations are not accurate for the Mother Boss Room and the Home closet
|
|
61
|
+
* rooms. (Those rooms have custom shapes.)
|
|
62
|
+
*/
|
|
63
|
+
function getRoomShapeCorners(roomShape) {
|
|
64
|
+
return roomShapeCorners_1.ROOM_SHAPE_CORNERS[roomShape];
|
|
65
|
+
}
|
|
66
|
+
exports.getRoomShapeCorners = getRoomShapeCorners;
|
|
67
|
+
/**
|
|
68
|
+
* Helper function to get the dimensions of a room shape's layout. This is NOT the size of the
|
|
69
|
+
* room's actual contents! For that, use the `getRoomShapeBounds` function.
|
|
70
|
+
*
|
|
71
|
+
* For example, a horizontal narrow room has a layout size of equal to that of a 1x1 room.
|
|
72
|
+
*/
|
|
73
|
+
function getRoomShapeLayoutSize(roomShape) {
|
|
74
|
+
return roomShapeLayoutSizes_1.ROOM_SHAPE_LAYOUT_SIZES[roomShape];
|
|
75
|
+
}
|
|
76
|
+
exports.getRoomShapeLayoutSize = getRoomShapeLayoutSize;
|
|
77
|
+
/**
|
|
78
|
+
* Helper function to get the grid position of the top-left tile of a given room shape.
|
|
79
|
+
*
|
|
80
|
+
* "Vector(0, 0)" corresponds to the top left tile of a room, not including the walls. (The top-left
|
|
81
|
+
* wall would be at "Vector(-1, -1)".)
|
|
82
|
+
*/
|
|
83
|
+
function getRoomShapeTopLeftPosition(roomShape) {
|
|
84
|
+
return roomShapeToTopLeftPosition_1.ROOM_SHAPE_TO_TOP_LEFT_POSITION[roomShape];
|
|
85
|
+
}
|
|
86
|
+
exports.getRoomShapeTopLeftPosition = getRoomShapeTopLeftPosition;
|
|
87
|
+
/**
|
|
88
|
+
* Helper function to get the volume of a room shape, which is the amount of tiles that are inside
|
|
89
|
+
* the room.
|
|
90
|
+
*
|
|
91
|
+
* (This cannot be directly calculated from the bounds since L rooms are a special case.)
|
|
92
|
+
*/
|
|
93
|
+
function getRoomShapeVolume(roomShape) {
|
|
94
|
+
return roomShapeVolumes_1.ROOM_SHAPE_VOLUMES[roomShape];
|
|
95
|
+
}
|
|
96
|
+
exports.getRoomShapeVolume = getRoomShapeVolume;
|
|
97
|
+
function getRoomShapeWidth(roomShape) {
|
|
98
|
+
return roomShapeToGridWidth_1.ROOM_SHAPE_TO_GRID_WIDTH[roomShape];
|
|
99
|
+
}
|
|
100
|
+
exports.getRoomShapeWidth = getRoomShapeWidth;
|
|
101
|
+
/**
|
|
102
|
+
* Helper function to determine if the provided room is equal to `RoomShape.1x2` (4) or
|
|
103
|
+
* `RoomShape.2x1` (6).
|
|
104
|
+
*/
|
|
105
|
+
function is2x1RoomShape(roomShape) {
|
|
106
|
+
return roomShape === isaac_typescript_definitions_1.RoomShape.SHAPE_1x2 || roomShape === isaac_typescript_definitions_1.RoomShape.SHAPE_2x1;
|
|
107
|
+
}
|
|
108
|
+
exports.is2x1RoomShape = is2x1RoomShape;
|
|
109
|
+
/**
|
|
110
|
+
* Helper function to detect if the provided room shape is big. Specifically, this is all 1x2 rooms,
|
|
111
|
+
* 2x2 rooms, and L rooms.
|
|
112
|
+
*/
|
|
113
|
+
function isBigRoomShape(roomShape) {
|
|
114
|
+
return bigRoomShapesSet_1.BIG_ROOM_SHAPES_SET.has(roomShape);
|
|
115
|
+
}
|
|
116
|
+
exports.isBigRoomShape = isBigRoomShape;
|
|
117
|
+
/**
|
|
118
|
+
* Helper function to determine if the provided room is equal to `RoomShape.LTL` (9),
|
|
119
|
+
* `RoomShape.LTR` (10), `RoomShape.LBL` (11), or `RoomShape.LBR` (12).
|
|
120
|
+
*/
|
|
121
|
+
function isLRoomShape(roomShape) {
|
|
122
|
+
return LRoomShapesSet_1.L_ROOM_SHAPES_SET.has(roomShape);
|
|
123
|
+
}
|
|
124
|
+
exports.isLRoomShape = isLRoomShape;
|
|
125
|
+
/**
|
|
126
|
+
* Helper function to determine if the provided room is equal to `RoomShape.IH` (2), `RoomShape.IV`
|
|
127
|
+
* (3), `RoomShape.IIV` (5), or `RoomShape.IIH` (7).
|
|
128
|
+
*/
|
|
129
|
+
function isNarrowRoom(roomShape) {
|
|
130
|
+
return narrowRoomShapesSet_1.NARROW_ROOM_SHAPES_SET.has(roomShape);
|
|
131
|
+
}
|
|
132
|
+
exports.isNarrowRoom = isNarrowRoom;
|
|
133
|
+
/**
|
|
134
|
+
* Helper function to see if a given room shape will grant a single charge or a double charge to the
|
|
135
|
+
* player's active item(s).
|
|
136
|
+
*
|
|
137
|
+
* For example, `RoomShape.SHAPE_2x2` will return true.
|
|
138
|
+
*/
|
|
139
|
+
function isRoomShapeDoubleCharge(roomShape) {
|
|
140
|
+
// 2x2 rooms and L rooms should grant 2 charges.
|
|
141
|
+
return roomShape >= isaac_typescript_definitions_1.RoomShape.SHAPE_2x2;
|
|
142
|
+
}
|
|
143
|
+
exports.isRoomShapeDoubleCharge = isRoomShapeDoubleCharge;
|