isaacscript-common 84.0.0 → 84.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +4 -1
- package/dist/functions/utils.d.ts.map +1 -1
- package/dist/functions/utils.js +195 -0
- package/dist/functions/utils.lua +6 -2
- 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 +4 -1
- 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 +7 -3
- 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 +6 -2
|
@@ -0,0 +1,529 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.spawnWithSeed = exports.spawnEntityID = exports.spawn = exports.setEntityRandomColor = exports.setEntityOpacity = exports.setEntityDamageFlash = exports.rerollEnemy = exports.removeEntities = exports.removeAllMatchingEntities = exports.parseEntityTypeVariantString = exports.parseEntityID = exports.isEntityMoving = exports.isActiveEnemy = exports.hasArmor = exports.getFilteredNewEntities = exports.getEntityIDFromConstituents = exports.getEntityID = exports.getEntityFromPtrHash = exports.getEntityFields = exports.getEntities = exports.getConstituentsFromEntityID = exports.getClosestEntityTo = exports.doesEntityExist = exports.doesAnyEntityExist = exports.countEntities = void 0;
|
|
4
|
+
const isaac_typescript_definitions_1 = require("isaac-typescript-definitions");
|
|
5
|
+
const cachedClasses_1 = require("../core/cachedClasses");
|
|
6
|
+
const constants_1 = require("../core/constants");
|
|
7
|
+
const entitiesWithArmorSet_1 = require("../sets/entitiesWithArmorSet");
|
|
8
|
+
const isaacAPIClass_1 = require("./isaacAPIClass");
|
|
9
|
+
const random_1 = require("./random");
|
|
10
|
+
const readOnly_1 = require("./readOnly");
|
|
11
|
+
const rng_1 = require("./rng");
|
|
12
|
+
const sprites_1 = require("./sprites");
|
|
13
|
+
const tstlClass_1 = require("./tstlClass");
|
|
14
|
+
const types_1 = require("./types");
|
|
15
|
+
const utils_1 = require("./utils");
|
|
16
|
+
const vector_1 = require("./vector");
|
|
17
|
+
/** From DeadInfinity. */
|
|
18
|
+
const DAMAGE_FLASH_COLOR = (0, readOnly_1.newReadonlyColor)(0.5, 0.5, 0.5, 1, 200 / 255, 0 / 255, 0 / 255);
|
|
19
|
+
/**
|
|
20
|
+
* Helper function to count the number of entities in room. Use this over the vanilla
|
|
21
|
+
* `Isaac.CountEntities` method to avoid having to specify a spawner and to handle ignoring charmed
|
|
22
|
+
* enemies.
|
|
23
|
+
*
|
|
24
|
+
* @param entityType Optional. Default is -1, which matches every entity type.
|
|
25
|
+
* @param variant Optional. Default is -1, which matches every variant.
|
|
26
|
+
* @param subType Optional. Default is -1, which matches every sub-type.
|
|
27
|
+
* @param ignoreFriendly Optional. Default is false. Will throw a runtime error if set to true and
|
|
28
|
+
* the `entityType` is equal to -1.
|
|
29
|
+
*/
|
|
30
|
+
function countEntities(entityType = -1, variant = -1, subType = -1, ignoreFriendly = false) {
|
|
31
|
+
if (entityType === -1) {
|
|
32
|
+
// The `Isaac.CountEntities` method requires an argument of `EntityType`, so we must revert to
|
|
33
|
+
// using the `Isaac.GetRoomEntities` method, which is slower.
|
|
34
|
+
const entities = Isaac.GetRoomEntities();
|
|
35
|
+
if (!ignoreFriendly) {
|
|
36
|
+
return entities.length;
|
|
37
|
+
}
|
|
38
|
+
const nonFriendlyEntities = entities.filter((entity) => !entity.HasEntityFlags(isaac_typescript_definitions_1.EntityFlag.FRIENDLY));
|
|
39
|
+
return nonFriendlyEntities.length;
|
|
40
|
+
}
|
|
41
|
+
if (!ignoreFriendly) {
|
|
42
|
+
return Isaac.CountEntities(undefined, entityType, variant, subType);
|
|
43
|
+
}
|
|
44
|
+
const entities = Isaac.FindByType(entityType, variant, subType, false, ignoreFriendly);
|
|
45
|
+
return entities.length;
|
|
46
|
+
}
|
|
47
|
+
exports.countEntities = countEntities;
|
|
48
|
+
/**
|
|
49
|
+
* Helper function to check if one or more matching entities exist in the current room. It uses the
|
|
50
|
+
* `doesEntityExist` helper function to determine this.
|
|
51
|
+
*
|
|
52
|
+
* @param entityTypes An array or set of the entity types that you want to check for. Will return
|
|
53
|
+
* true if any of the provided entity types exist.
|
|
54
|
+
* @param ignoreFriendly Optional. Default is false.
|
|
55
|
+
*/
|
|
56
|
+
function doesAnyEntityExist(entityTypes, ignoreFriendly = false) {
|
|
57
|
+
const entityTypesMutable = entityTypes;
|
|
58
|
+
const entityTypesArray = (0, tstlClass_1.isTSTLSet)(entityTypesMutable)
|
|
59
|
+
? [...entityTypesMutable.values()]
|
|
60
|
+
: entityTypesMutable;
|
|
61
|
+
return entityTypesArray.some((entityType) => doesEntityExist(entityType, -1, -1, ignoreFriendly));
|
|
62
|
+
}
|
|
63
|
+
exports.doesAnyEntityExist = doesAnyEntityExist;
|
|
64
|
+
/**
|
|
65
|
+
* Helper function to check if one or more of a specific kind of entity is present in the current
|
|
66
|
+
* room. It uses the `countEntities` helper function to determine this.
|
|
67
|
+
*
|
|
68
|
+
* @param entityType Optional. Default is -1, which matches every entity type.
|
|
69
|
+
* @param variant Optional. Default is -1, which matches every variant.
|
|
70
|
+
* @param subType Optional. Default is -1, which matches every sub-type.
|
|
71
|
+
* @param ignoreFriendly Optional. Default is false.
|
|
72
|
+
*/
|
|
73
|
+
function doesEntityExist(entityType = -1, variant = -1, subType = -1, ignoreFriendly = false) {
|
|
74
|
+
const count = countEntities(entityType, variant, subType, ignoreFriendly);
|
|
75
|
+
return count > 0;
|
|
76
|
+
}
|
|
77
|
+
exports.doesEntityExist = doesEntityExist;
|
|
78
|
+
/**
|
|
79
|
+
* Given an array of entities, this helper function returns the closest one to a provided reference
|
|
80
|
+
* entity.
|
|
81
|
+
*
|
|
82
|
+
* For example:
|
|
83
|
+
*
|
|
84
|
+
* ```ts
|
|
85
|
+
* const player = Isaac.GetPlayer();
|
|
86
|
+
* const gapers = getEntities(EntityType.GAPER);
|
|
87
|
+
* const closestGaper = getClosestEntityTo(player, gapers);
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* @param referenceEntity The entity that is close by.
|
|
91
|
+
* @param entities The array of entities to look through.
|
|
92
|
+
* @param filterFunc Optional. A function to filter for a specific type of entity, like e.g. an
|
|
93
|
+
* enemy with a certain amount of HP left.
|
|
94
|
+
*/
|
|
95
|
+
function getClosestEntityTo(referenceEntity, entities, filterFunc) {
|
|
96
|
+
let closestEntity;
|
|
97
|
+
let closestDistance = math.huge;
|
|
98
|
+
for (const entity of entities) {
|
|
99
|
+
const distance = referenceEntity.Position.Distance(entity.Position);
|
|
100
|
+
if (distance < closestDistance &&
|
|
101
|
+
(filterFunc === undefined || filterFunc(entity))) {
|
|
102
|
+
closestEntity = entity;
|
|
103
|
+
closestDistance = distance;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return closestEntity;
|
|
107
|
+
}
|
|
108
|
+
exports.getClosestEntityTo = getClosestEntityTo;
|
|
109
|
+
/** Helper function to get the entity type, variant, and sub-type from an `EntityID`. */
|
|
110
|
+
function getConstituentsFromEntityID(entityID) {
|
|
111
|
+
const parts = entityID.split(".");
|
|
112
|
+
if (parts.length !== 3) {
|
|
113
|
+
error(`Failed to get the constituents from entity ID: ${entityID}`);
|
|
114
|
+
}
|
|
115
|
+
const [entityTypeString, variantString, subTypeString] = parts;
|
|
116
|
+
(0, utils_1.assertDefined)(entityTypeString, `Failed to get the first constituent from an entity ID: ${entityID}`);
|
|
117
|
+
(0, utils_1.assertDefined)(variantString, `Failed to get the second constituent from an entity ID: ${entityID}`);
|
|
118
|
+
(0, utils_1.assertDefined)(subTypeString, `Failed to get the third constituent from an entity ID: ${entityID}`);
|
|
119
|
+
const entityType = (0, types_1.parseIntSafe)(entityTypeString);
|
|
120
|
+
(0, utils_1.assertDefined)(entityType, `Failed to convert the entity type to an integer: ${entityTypeString}`);
|
|
121
|
+
const variant = (0, types_1.parseIntSafe)(variantString);
|
|
122
|
+
(0, utils_1.assertDefined)(variant, `Failed to convert the entity variant to an integer: ${variantString}`);
|
|
123
|
+
const subType = (0, types_1.parseIntSafe)(subTypeString);
|
|
124
|
+
(0, utils_1.assertDefined)(subType, `Failed to convert the entity sub-type to an integer: ${subTypeString}`);
|
|
125
|
+
return [entityType, variant, subType];
|
|
126
|
+
}
|
|
127
|
+
exports.getConstituentsFromEntityID = getConstituentsFromEntityID;
|
|
128
|
+
/**
|
|
129
|
+
* Helper function to get all of the entities in the room or all of the entities that match a
|
|
130
|
+
* specific entity type / variant / sub-type.
|
|
131
|
+
*
|
|
132
|
+
* Due to bugs with `Isaac.FindInRadius`, this function uses `Isaac.GetRoomEntities`, which is more
|
|
133
|
+
* expensive but also more robust. (If a matching entity type is provided, then `Isaac.FindByType`
|
|
134
|
+
* will be used instead.)
|
|
135
|
+
*
|
|
136
|
+
* For example:
|
|
137
|
+
*
|
|
138
|
+
* ```ts
|
|
139
|
+
* // Make all of the entities in the room invisible.
|
|
140
|
+
* for (const entity of getEntities()) {
|
|
141
|
+
* entity.Visible = false;
|
|
142
|
+
* }
|
|
143
|
+
* ```
|
|
144
|
+
*
|
|
145
|
+
* @param entityType Optional. If specified, will only get the entities that match the type. Default
|
|
146
|
+
* is -1, which matches every type.
|
|
147
|
+
* @param variant Optional. If specified, will only get the entities that match the variant. Default
|
|
148
|
+
* is -1, which matches every variant.
|
|
149
|
+
* @param subType Optional. If specified, will only get the entities that match the sub-type.
|
|
150
|
+
* Default is -1, which matches every sub-type.
|
|
151
|
+
* @param ignoreFriendly Optional. If set to true, it will exclude friendly NPCs from being
|
|
152
|
+
* returned. Default is false. Will only be taken into account if the
|
|
153
|
+
* `entityType` is specified.
|
|
154
|
+
*/
|
|
155
|
+
function getEntities(entityType = -1, variant = -1, subType = -1, ignoreFriendly = false) {
|
|
156
|
+
if (entityType === -1) {
|
|
157
|
+
return Isaac.GetRoomEntities();
|
|
158
|
+
}
|
|
159
|
+
return Isaac.FindByType(entityType, variant, subType, ignoreFriendly);
|
|
160
|
+
}
|
|
161
|
+
exports.getEntities = getEntities;
|
|
162
|
+
/**
|
|
163
|
+
* Helper function to get all the fields on an entity. For example, this is useful for comparing it
|
|
164
|
+
* to another entity later. (One option is to use the `logTableDifferences` function for this.)
|
|
165
|
+
*
|
|
166
|
+
* This function will only get fields that are equal to booleans, numbers, or strings, or Vectors,
|
|
167
|
+
* as comparing other types is non-trivial.
|
|
168
|
+
*/
|
|
169
|
+
function getEntityFields(entity) {
|
|
170
|
+
const entityFields = new LuaMap();
|
|
171
|
+
const metatable = getmetatable(entity);
|
|
172
|
+
(0, utils_1.assertDefined)(metatable, "Failed to get the metatable for an entity.");
|
|
173
|
+
setPrimitiveEntityFields(entity, metatable, entityFields);
|
|
174
|
+
// If this is a class that inherits from `Entity` (like `EntityPlayer`), the "__propget" table
|
|
175
|
+
// will not contain the attributes for `Entity`. Thus, if this is not an `Entity`, we have
|
|
176
|
+
// additional fields to add.
|
|
177
|
+
const className = (0, isaacAPIClass_1.getIsaacAPIClassName)(entity);
|
|
178
|
+
if (className === "Entity") {
|
|
179
|
+
return entityFields;
|
|
180
|
+
}
|
|
181
|
+
const parentTable = metatable.get("__parent");
|
|
182
|
+
(0, utils_1.assertDefined)(parentTable, 'Failed to get the "__parent" table for an entity.');
|
|
183
|
+
setPrimitiveEntityFields(entity, parentTable, entityFields);
|
|
184
|
+
return entityFields;
|
|
185
|
+
}
|
|
186
|
+
exports.getEntityFields = getEntityFields;
|
|
187
|
+
function setPrimitiveEntityFields(entity, metatable, entityFields) {
|
|
188
|
+
const propGetTable = metatable.get("__propget");
|
|
189
|
+
(0, utils_1.assertDefined)(propGetTable, 'Failed to get the "__propget" table for an entity.');
|
|
190
|
+
for (const [key] of propGetTable) {
|
|
191
|
+
// The values of this table are functions. Thus, we use the key to index the original entity.
|
|
192
|
+
const indexKey = key;
|
|
193
|
+
const value = entity[indexKey];
|
|
194
|
+
if ((0, types_1.isPrimitive)(value)) {
|
|
195
|
+
entityFields.set(indexKey, value);
|
|
196
|
+
}
|
|
197
|
+
else if ((0, vector_1.isVector)(value)) {
|
|
198
|
+
entityFields.set(indexKey, (0, vector_1.vectorToString)(value));
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Helper function to get an entity from a `PtrHash`. Note that doing this is very expensive, so you
|
|
204
|
+
* should only use this function when debugging. (Normally, if you need to work backwards from a
|
|
205
|
+
* reference, you would use an `EntityPtr` instead of a `PtrHash`.
|
|
206
|
+
*/
|
|
207
|
+
function getEntityFromPtrHash(ptrHash) {
|
|
208
|
+
const entities = getEntities();
|
|
209
|
+
return entities.find((entity) => GetPtrHash(entity) === ptrHash);
|
|
210
|
+
}
|
|
211
|
+
exports.getEntityFromPtrHash = getEntityFromPtrHash;
|
|
212
|
+
/** Helper function to get a string containing the entity's type, variant, and sub-type. */
|
|
213
|
+
function getEntityID(entity) {
|
|
214
|
+
return `${entity.Type}.${entity.Variant}.${entity.SubType}`;
|
|
215
|
+
}
|
|
216
|
+
exports.getEntityID = getEntityID;
|
|
217
|
+
/**
|
|
218
|
+
* Helper function to get a formatted string in the format returned by the `getEntityID` function.
|
|
219
|
+
*/
|
|
220
|
+
function getEntityIDFromConstituents(entityType, variant, subType) {
|
|
221
|
+
return `${entityType}.${variant}.${subType}`;
|
|
222
|
+
}
|
|
223
|
+
exports.getEntityIDFromConstituents = getEntityIDFromConstituents;
|
|
224
|
+
/**
|
|
225
|
+
* Helper function to compare two different arrays of entities. Returns the entities that are in the
|
|
226
|
+
* second array but not in the first array.
|
|
227
|
+
*/
|
|
228
|
+
function getFilteredNewEntities(oldEntities, newEntities) {
|
|
229
|
+
const oldEntitiesSet = new Set();
|
|
230
|
+
for (const entity of oldEntities) {
|
|
231
|
+
const ptrHash = GetPtrHash(entity);
|
|
232
|
+
oldEntitiesSet.add(ptrHash);
|
|
233
|
+
}
|
|
234
|
+
return newEntities.filter((entity) => {
|
|
235
|
+
const ptrHash = GetPtrHash(entity);
|
|
236
|
+
return !oldEntitiesSet.has(ptrHash);
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
exports.getFilteredNewEntities = getFilteredNewEntities;
|
|
240
|
+
/**
|
|
241
|
+
* Helper function to see if a particular entity has armor. In this context, armor refers to the
|
|
242
|
+
* damage scaling mechanic. For example, Ultra Greed has armor, but a Gaper does not.
|
|
243
|
+
*
|
|
244
|
+
* For more on armor, see the wiki: https://bindingofisaacrebirth.fandom.com/wiki/Damage_Scaling
|
|
245
|
+
*/
|
|
246
|
+
function hasArmor(entity) {
|
|
247
|
+
const typeVariantString = `${entity.Type}.${entity.Variant}`;
|
|
248
|
+
return entitiesWithArmorSet_1.ENTITIES_WITH_ARMOR_SET.has(typeVariantString);
|
|
249
|
+
}
|
|
250
|
+
exports.hasArmor = hasArmor;
|
|
251
|
+
/**
|
|
252
|
+
* Helper function to detect if a particular entity is an active enemy. Use this over the
|
|
253
|
+
* `Entity.IsActiveEnemy` method since it is bugged with friendly enemies, Grimaces, Ultra Greed,
|
|
254
|
+
* and Mother.
|
|
255
|
+
*/
|
|
256
|
+
function isActiveEnemy(entity) {
|
|
257
|
+
if (entity.HasEntityFlags(isaac_typescript_definitions_1.EntityFlag.FRIENDLY)) {
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
const room = cachedClasses_1.game.GetRoom();
|
|
261
|
+
const isClear = room.IsClear();
|
|
262
|
+
// Some entities count as being "active" enemies, but they deactivate when the room is cleared.
|
|
263
|
+
if (isClear) {
|
|
264
|
+
switch (entity.Type) {
|
|
265
|
+
// 42
|
|
266
|
+
case isaac_typescript_definitions_1.EntityType.GRIMACE: {
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
269
|
+
// 294
|
|
270
|
+
case isaac_typescript_definitions_1.EntityType.ULTRA_DOOR: {
|
|
271
|
+
return false;
|
|
272
|
+
}
|
|
273
|
+
// 406
|
|
274
|
+
case isaac_typescript_definitions_1.EntityType.ULTRA_GREED: {
|
|
275
|
+
const npc = entity.ToNPC();
|
|
276
|
+
if (npc !== undefined) {
|
|
277
|
+
const ultraGreedVariant = npc.Variant;
|
|
278
|
+
switch (ultraGreedVariant) {
|
|
279
|
+
case isaac_typescript_definitions_1.UltraGreedVariant.ULTRA_GREED: {
|
|
280
|
+
if (npc.State === (0, types_1.asNPCState)(isaac_typescript_definitions_1.UltraGreedState.GOLD_STATUE)) {
|
|
281
|
+
return false;
|
|
282
|
+
}
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
case isaac_typescript_definitions_1.UltraGreedVariant.ULTRA_GREEDIER: {
|
|
286
|
+
if (npc.State === (0, types_1.asNPCState)(isaac_typescript_definitions_1.UltraGreedierState.POST_EXPLOSION)) {
|
|
287
|
+
return false;
|
|
288
|
+
}
|
|
289
|
+
break;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
// 912
|
|
296
|
+
case isaac_typescript_definitions_1.EntityType.MOTHER: {
|
|
297
|
+
if (entity.Variant === isaac_typescript_definitions_1.MotherVariant.MOTHER_1) {
|
|
298
|
+
const npc = entity.ToNPC();
|
|
299
|
+
if (npc !== undefined && npc.State === isaac_typescript_definitions_1.NPCState.SPECIAL) {
|
|
300
|
+
return false;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
break;
|
|
304
|
+
}
|
|
305
|
+
default: {
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
311
|
+
return entity.IsActiveEnemy(false);
|
|
312
|
+
}
|
|
313
|
+
exports.isActiveEnemy = isActiveEnemy;
|
|
314
|
+
/**
|
|
315
|
+
* Helper function to measure an entity's velocity to see if it is moving.
|
|
316
|
+
*
|
|
317
|
+
* Use this helper function over checking if the velocity length is equal to 0 because entities can
|
|
318
|
+
* look like they are completely immobile but yet still have a non zero velocity. Thus, using a
|
|
319
|
+
* threshold is needed.
|
|
320
|
+
*
|
|
321
|
+
* @param entity The entity whose velocity to measure.
|
|
322
|
+
* @param threshold Optional. The threshold from 0 to consider to be moving. Default is 0.01.
|
|
323
|
+
*/
|
|
324
|
+
function isEntityMoving(entity, threshold = 0.01) {
|
|
325
|
+
return (0, vector_1.doesVectorHaveLength)(entity.Velocity, threshold);
|
|
326
|
+
}
|
|
327
|
+
exports.isEntityMoving = isEntityMoving;
|
|
328
|
+
/**
|
|
329
|
+
* Helper function to parse a string that contains an entity type, a variant, and a sub-type,
|
|
330
|
+
* separated by periods.
|
|
331
|
+
*
|
|
332
|
+
* For example, passing "45.0.1" would return an array of [45, 0, 1].
|
|
333
|
+
*
|
|
334
|
+
* Returns undefined if the string cannot be parsed.
|
|
335
|
+
*/
|
|
336
|
+
function parseEntityID(entityID) {
|
|
337
|
+
const entityIDArray = entityID.split(".");
|
|
338
|
+
if (entityIDArray.length !== 3) {
|
|
339
|
+
return undefined;
|
|
340
|
+
}
|
|
341
|
+
const [entityTypeString, variantString, subTypeString] = entityIDArray;
|
|
342
|
+
if (entityTypeString === undefined ||
|
|
343
|
+
variantString === undefined ||
|
|
344
|
+
subTypeString === undefined) {
|
|
345
|
+
return undefined;
|
|
346
|
+
}
|
|
347
|
+
const entityType = (0, types_1.parseIntSafe)(entityTypeString);
|
|
348
|
+
const variant = (0, types_1.parseIntSafe)(variantString);
|
|
349
|
+
const subType = (0, types_1.parseIntSafe)(subTypeString);
|
|
350
|
+
if (entityType === undefined ||
|
|
351
|
+
variant === undefined ||
|
|
352
|
+
subType === undefined) {
|
|
353
|
+
return undefined;
|
|
354
|
+
}
|
|
355
|
+
return [entityType, variant, subType];
|
|
356
|
+
}
|
|
357
|
+
exports.parseEntityID = parseEntityID;
|
|
358
|
+
/**
|
|
359
|
+
* Helper function to parse a string that contains an entity type and a variant separated by a
|
|
360
|
+
* period.
|
|
361
|
+
*
|
|
362
|
+
* For example, passing "45.0" would return an array of [45, 0].
|
|
363
|
+
*
|
|
364
|
+
* Returns undefined if the string cannot be parsed.
|
|
365
|
+
*/
|
|
366
|
+
function parseEntityTypeVariantString(entityTypeVariantString) {
|
|
367
|
+
const entityTypeVariantArray = entityTypeVariantString.split(".");
|
|
368
|
+
if (entityTypeVariantArray.length !== 2) {
|
|
369
|
+
return undefined;
|
|
370
|
+
}
|
|
371
|
+
const [entityTypeString, variantString] = entityTypeVariantArray;
|
|
372
|
+
if (entityTypeString === undefined || variantString === undefined) {
|
|
373
|
+
return undefined;
|
|
374
|
+
}
|
|
375
|
+
const entityType = (0, types_1.parseIntSafe)(entityTypeString);
|
|
376
|
+
const variant = (0, types_1.parseIntSafe)(variantString);
|
|
377
|
+
if (entityType === undefined || variant === undefined) {
|
|
378
|
+
return undefined;
|
|
379
|
+
}
|
|
380
|
+
return [entityType, variant];
|
|
381
|
+
}
|
|
382
|
+
exports.parseEntityTypeVariantString = parseEntityTypeVariantString;
|
|
383
|
+
/**
|
|
384
|
+
* Helper function to remove all of the matching entities in the room.
|
|
385
|
+
*
|
|
386
|
+
* @param entityType The entity type to match.
|
|
387
|
+
* @param entityVariant Optional. The variant to match. Default is -1, which matches every variant.
|
|
388
|
+
* @param entitySubType Optional. The sub-type to match. Default is -1, which matches every
|
|
389
|
+
* sub-type.
|
|
390
|
+
* @param cap Optional. If specified, will only remove the given amount of collectibles.
|
|
391
|
+
* @returns An array of the entities that were removed.
|
|
392
|
+
*/
|
|
393
|
+
function removeAllMatchingEntities(entityType, entityVariant = -1, entitySubType = -1, cap = undefined) {
|
|
394
|
+
const entities = getEntities(entityType, entityVariant, entitySubType);
|
|
395
|
+
return removeEntities(entities, cap);
|
|
396
|
+
}
|
|
397
|
+
exports.removeAllMatchingEntities = removeAllMatchingEntities;
|
|
398
|
+
/**
|
|
399
|
+
* Helper function to remove all of the entities in the supplied array.
|
|
400
|
+
*
|
|
401
|
+
* @param entities The array of entities to remove.
|
|
402
|
+
* @param cap Optional. If specified, will only remove the given amount of entities.
|
|
403
|
+
* @returns An array of the entities that were removed.
|
|
404
|
+
*/
|
|
405
|
+
function removeEntities(entities, cap) {
|
|
406
|
+
if (entities.length === 0) {
|
|
407
|
+
return [];
|
|
408
|
+
}
|
|
409
|
+
const entitiesRemoved = [];
|
|
410
|
+
for (const entity of entities) {
|
|
411
|
+
entity.Remove();
|
|
412
|
+
entitiesRemoved.push(entity);
|
|
413
|
+
if (cap !== undefined && entitiesRemoved.length >= cap) {
|
|
414
|
+
break;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
return entitiesRemoved;
|
|
418
|
+
}
|
|
419
|
+
exports.removeEntities = removeEntities;
|
|
420
|
+
/**
|
|
421
|
+
* Helper function to reroll an enemy. Use this instead of the vanilla "Game.RerollEnemy" function
|
|
422
|
+
* if you want the rerolled enemy to be returned.
|
|
423
|
+
*
|
|
424
|
+
* @param entity The entity to reroll.
|
|
425
|
+
* @returns If the game failed to reroll the enemy, returns undefined. Otherwise, returns the
|
|
426
|
+
* rerolled entity.
|
|
427
|
+
*/
|
|
428
|
+
function rerollEnemy(entity) {
|
|
429
|
+
const oldEntities = getEntities();
|
|
430
|
+
const wasRerolled = cachedClasses_1.game.RerollEnemy(entity);
|
|
431
|
+
if (!wasRerolled) {
|
|
432
|
+
return undefined;
|
|
433
|
+
}
|
|
434
|
+
const newEntities = getEntities();
|
|
435
|
+
const filteredNewEntities = getFilteredNewEntities(oldEntities, newEntities);
|
|
436
|
+
if (filteredNewEntities.length === 0) {
|
|
437
|
+
error('Failed to find the new entity generated by the "Game.RerollEnemy" method.');
|
|
438
|
+
}
|
|
439
|
+
return filteredNewEntities[0];
|
|
440
|
+
}
|
|
441
|
+
exports.rerollEnemy = rerollEnemy;
|
|
442
|
+
/**
|
|
443
|
+
* Helper function to make an entity flash red like it is taking damage. This is useful when you
|
|
444
|
+
* want to make it appear as if an entity is taking damage without actually dealing any damage to
|
|
445
|
+
* it.
|
|
446
|
+
*/
|
|
447
|
+
function setEntityDamageFlash(entity) {
|
|
448
|
+
entity.SetColor(DAMAGE_FLASH_COLOR, 2, 0);
|
|
449
|
+
}
|
|
450
|
+
exports.setEntityDamageFlash = setEntityDamageFlash;
|
|
451
|
+
/**
|
|
452
|
+
* Helper function to keep an entity's color the same values as it already is but set the opacity to
|
|
453
|
+
* a specific value.
|
|
454
|
+
*
|
|
455
|
+
* @param entity The entity to set.
|
|
456
|
+
* @param alpha A value between 0 and 1 that represents the fade amount.
|
|
457
|
+
*/
|
|
458
|
+
function setEntityOpacity(entity, alpha) {
|
|
459
|
+
const sprite = entity.GetSprite();
|
|
460
|
+
(0, sprites_1.setSpriteOpacity)(sprite, alpha);
|
|
461
|
+
}
|
|
462
|
+
exports.setEntityOpacity = setEntityOpacity;
|
|
463
|
+
function setEntityRandomColor(entity) {
|
|
464
|
+
const seed = entity.InitSeed === 0 ? (0, rng_1.getRandomSeed)() : entity.InitSeed;
|
|
465
|
+
const rng = (0, rng_1.newRNG)(seed);
|
|
466
|
+
const r = (0, random_1.getRandom)(rng);
|
|
467
|
+
const g = (0, random_1.getRandom)(rng);
|
|
468
|
+
const b = (0, random_1.getRandom)(rng);
|
|
469
|
+
const color = Color(r, g, b);
|
|
470
|
+
entity.SetColor(color, 100_000, 100_000, false, false);
|
|
471
|
+
}
|
|
472
|
+
exports.setEntityRandomColor = setEntityRandomColor;
|
|
473
|
+
/**
|
|
474
|
+
* Helper function to spawn an entity. Use this instead of the `Isaac.Spawn` method if you do not
|
|
475
|
+
* need to specify the velocity or spawner.
|
|
476
|
+
*
|
|
477
|
+
* Also see the `spawnWithSeed` helper function.
|
|
478
|
+
*
|
|
479
|
+
* @param entityType The `EntityType` of the entity to spawn.
|
|
480
|
+
* @param variant The variant of the entity to spawn.
|
|
481
|
+
* @param subType The sub-type of the entity to spawn.
|
|
482
|
+
* @param positionOrGridIndex The position or grid index of the entity to spawn.
|
|
483
|
+
* @param velocity Optional. The velocity of the entity to spawn. Default is `VectorZero`.
|
|
484
|
+
* @param spawner Optional. The entity that will be the `SpawnerEntity`. Default is undefined.
|
|
485
|
+
* @param seedOrRNG Optional. The seed or RNG object to use to generate the `InitSeed` of the
|
|
486
|
+
* entity. Default is undefined, which will make the entity spawn with a random
|
|
487
|
+
* seed using the `Isaac.Spawn` method.
|
|
488
|
+
*/
|
|
489
|
+
function spawn(entityType, variant, subType, positionOrGridIndex, velocity = constants_1.VectorZero, spawner = undefined, seedOrRNG = undefined) {
|
|
490
|
+
const room = cachedClasses_1.game.GetRoom();
|
|
491
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
492
|
+
if (positionOrGridIndex === undefined) {
|
|
493
|
+
const entityID = getEntityIDFromConstituents(entityType, variant, subType);
|
|
494
|
+
error(`Failed to spawn entity ${entityID} since an undefined position was passed to the "spawn" function.`);
|
|
495
|
+
}
|
|
496
|
+
const position = (0, vector_1.isVector)(positionOrGridIndex)
|
|
497
|
+
? positionOrGridIndex
|
|
498
|
+
: room.GetGridPosition(positionOrGridIndex);
|
|
499
|
+
if (seedOrRNG === undefined) {
|
|
500
|
+
return Isaac.Spawn(entityType, variant, subType, position, velocity, spawner);
|
|
501
|
+
}
|
|
502
|
+
const seed = (0, rng_1.isRNG)(seedOrRNG) ? seedOrRNG.Next() : seedOrRNG;
|
|
503
|
+
return cachedClasses_1.game.Spawn(entityType, variant, position, velocity, spawner, subType, seed);
|
|
504
|
+
}
|
|
505
|
+
exports.spawn = spawn;
|
|
506
|
+
/**
|
|
507
|
+
* Helper function to spawn the entity corresponding to an `EntityID`.
|
|
508
|
+
*
|
|
509
|
+
* @param entityID The `EntityID` of the entity to spawn.
|
|
510
|
+
* @param positionOrGridIndex The position or grid index of the entity to spawn.
|
|
511
|
+
* @param velocity Optional. The velocity of the entity to spawn. Default is `VectorZero`.
|
|
512
|
+
* @param spawner Optional. The entity that will be the `SpawnerEntity`. Default is undefined.
|
|
513
|
+
* @param seedOrRNG Optional. The seed or RNG object to use to generate the `InitSeed` of the
|
|
514
|
+
* entity. Default is undefined, which will make the entity spawn with a random
|
|
515
|
+
* seed using the `Isaac.Spawn` method.
|
|
516
|
+
*/
|
|
517
|
+
function spawnEntityID(entityID, positionOrGridIndex, velocity = constants_1.VectorZero, spawner = undefined, seedOrRNG = undefined) {
|
|
518
|
+
const [entityType, variant, subType] = getConstituentsFromEntityID(entityID);
|
|
519
|
+
return spawn(entityType, variant, subType, positionOrGridIndex, velocity, spawner, seedOrRNG);
|
|
520
|
+
}
|
|
521
|
+
exports.spawnEntityID = spawnEntityID;
|
|
522
|
+
/**
|
|
523
|
+
* Helper function to spawn an entity. Use this instead of the `Game.Spawn` method if you do not
|
|
524
|
+
* need to specify the velocity or spawner.
|
|
525
|
+
*/
|
|
526
|
+
function spawnWithSeed(entityType, variant, subType, positionOrGridIndex, seedOrRNG, velocity = constants_1.VectorZero, spawner = undefined) {
|
|
527
|
+
return spawn(entityType, variant, subType, positionOrGridIndex, velocity, spawner, seedOrRNG);
|
|
528
|
+
}
|
|
529
|
+
exports.spawnWithSeed = spawnWithSeed;
|