isaacscript-common 2.3.2 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cachedClasses.d.ts +6 -4
- package/cachedClasses.lua +24 -0
- package/callbacks/customRevive.lua +2 -0
- package/callbacks/itemPickup.lua +2 -0
- package/callbacks/postBombInitLate.lua +2 -0
- package/callbacks/postBoneSwing.lua +2 -0
- package/callbacks/postCollectibleInitFirst.lua +2 -0
- package/callbacks/postCursedTeleport.lua +2 -0
- package/callbacks/postCustomDoorEnter.lua +44 -0
- package/callbacks/postDoorRender.lua +2 -0
- package/callbacks/postDoorUpdate.lua +2 -0
- package/callbacks/postEffectInitLate.lua +2 -0
- package/callbacks/postEffectStateChanged.lua +2 -0
- package/callbacks/postEsauJr.lua +2 -0
- package/callbacks/postFamiliarInitLate.lua +2 -0
- package/callbacks/postFamiliarStateChanged.lua +2 -0
- package/callbacks/postFlip.lua +2 -0
- package/callbacks/postGreedModeWave.lua +2 -0
- package/callbacks/postGridEntity.lua +2 -0
- package/callbacks/postGridEntityCollision.lua +2 -0
- package/callbacks/postGridEntityRender.lua +2 -0
- package/callbacks/postHolyMantleRemoved.lua +2 -0
- package/callbacks/postKnifeInitLate.lua +2 -0
- package/callbacks/postLaserInitLate.lua +2 -0
- package/callbacks/postNPCInitLate.lua +2 -0
- package/callbacks/postNPCStateChanged.lua +2 -0
- package/callbacks/postNewRoomEarly.lua +2 -0
- package/callbacks/postPickupCollect.lua +2 -0
- package/callbacks/postPickupInitFirst.d.ts +1 -0
- package/callbacks/postPickupInitFirst.lua +55 -0
- package/callbacks/postPickupInitLate.lua +2 -0
- package/callbacks/postPickupStateChanged.lua +2 -0
- package/callbacks/postPitRender.lua +2 -0
- package/callbacks/postPitUpdate.lua +2 -0
- package/callbacks/postPlayerChangeHealth.lua +2 -0
- package/callbacks/postPlayerChangeType.lua +2 -0
- package/callbacks/postPlayerFatalDamage.lua +2 -0
- package/callbacks/postPlayerInitLate.lua +2 -0
- package/callbacks/postPlayerReordered.lua +2 -0
- package/callbacks/postPoopRender.lua +2 -0
- package/callbacks/postPoopUpdate.lua +2 -0
- package/callbacks/postPressurePlateRender.lua +2 -0
- package/callbacks/postPressurePlateUpdate.lua +2 -0
- package/callbacks/postProjectileInitLate.lua +2 -0
- package/callbacks/postPurchase.lua +2 -0
- package/callbacks/postRockRender.lua +2 -0
- package/callbacks/postRockUpdate.lua +2 -0
- package/callbacks/postRoomClearChanged.lua +2 -0
- package/callbacks/postSacrifice.lua +2 -0
- package/callbacks/postSlotDestroyed.d.ts +1 -0
- package/callbacks/postSlotDestroyed.lua +66 -0
- package/callbacks/postSlotInitUpdate.lua +2 -0
- package/callbacks/postSlotRender.lua +5 -21
- package/callbacks/postSpikesRender.lua +2 -0
- package/callbacks/postSpikesUpdate.lua +2 -0
- package/callbacks/postTNTRender.lua +2 -0
- package/callbacks/postTNTUpdate.lua +2 -0
- package/callbacks/postTearInitLate.lua +2 -0
- package/callbacks/postTearInitVeryLate.lua +2 -0
- package/callbacks/postTransformation.lua +2 -0
- package/callbacks/postTrinketBreak.lua +2 -0
- package/callbacks/preBerserkDeath.lua +2 -0
- package/callbacks/preNewLevel.lua +2 -0
- package/callbacks/reorderedCallbacks.lua +16 -0
- package/callbacks/subscriptions/postBombInitLate.lua +6 -0
- package/callbacks/subscriptions/postBoneSwing.lua +6 -0
- package/callbacks/subscriptions/postCollectibleInitFirst.lua +6 -0
- package/callbacks/subscriptions/postCursedTeleport.lua +6 -0
- package/callbacks/subscriptions/postCustomDoorEnter.lua +6 -0
- package/callbacks/subscriptions/postCustomRevive.d.ts +1 -0
- package/callbacks/subscriptions/postCustomRevive.lua +6 -0
- package/callbacks/subscriptions/postDoorRender.d.ts +1 -0
- package/callbacks/subscriptions/postDoorRender.lua +6 -0
- package/callbacks/subscriptions/postDoorUpdate.d.ts +1 -0
- package/callbacks/subscriptions/postDoorUpdate.lua +6 -0
- package/callbacks/subscriptions/postEffectInitLate.lua +6 -0
- package/callbacks/subscriptions/postEffectStateChanged.lua +6 -0
- package/callbacks/subscriptions/postEsauJr.lua +6 -0
- package/callbacks/subscriptions/postFamiliarInitLate.lua +6 -0
- package/callbacks/subscriptions/postFamiliarStateChanged.lua +6 -0
- package/callbacks/subscriptions/postFirstEsauJr.lua +6 -0
- package/callbacks/subscriptions/postFirstFlip.lua +6 -0
- package/callbacks/subscriptions/postFlip.lua +6 -0
- package/callbacks/subscriptions/postGameStartedReordered.lua +6 -0
- package/callbacks/subscriptions/postGreedModeWave.lua +6 -0
- package/callbacks/subscriptions/postGridEntityBroken.lua +6 -0
- package/callbacks/subscriptions/postGridEntityCollision.lua +6 -0
- package/callbacks/subscriptions/postGridEntityInit.lua +6 -0
- package/callbacks/subscriptions/postGridEntityRemove.lua +6 -0
- package/callbacks/subscriptions/postGridEntityRender.lua +6 -0
- package/callbacks/subscriptions/postGridEntityStateChanged.lua +6 -0
- package/callbacks/subscriptions/postGridEntityUpdate.lua +6 -0
- package/callbacks/subscriptions/postHolyMantleRemoved.lua +6 -0
- package/callbacks/subscriptions/postItemDischarged.lua +6 -0
- package/callbacks/subscriptions/postItemPickup.lua +6 -0
- package/callbacks/subscriptions/postKnifeInitLate.lua +6 -0
- package/callbacks/subscriptions/postLaserInitLate.lua +6 -0
- package/callbacks/subscriptions/postNPCInitLate.lua +6 -0
- package/callbacks/subscriptions/postNPCStateChanged.lua +6 -0
- package/callbacks/subscriptions/postNewLevelReordered.lua +6 -0
- package/callbacks/subscriptions/postNewRoomEarly.lua +6 -0
- package/callbacks/subscriptions/postNewRoomReordered.lua +6 -0
- package/callbacks/subscriptions/postPEffectUpdateReordered.lua +6 -0
- package/callbacks/subscriptions/postPickupCollect.d.ts +1 -0
- package/callbacks/subscriptions/postPickupCollect.lua +6 -0
- package/callbacks/subscriptions/postPickupInitFirst.d.ts +3 -0
- package/callbacks/subscriptions/postPickupInitFirst.lua +29 -0
- package/callbacks/subscriptions/postPickupInitLate.lua +6 -0
- package/callbacks/subscriptions/postPickupStateChanged.d.ts +1 -0
- package/callbacks/subscriptions/postPickupStateChanged.lua +6 -0
- package/callbacks/subscriptions/postPitRender.d.ts +1 -0
- package/callbacks/subscriptions/postPitRender.lua +6 -0
- package/callbacks/subscriptions/postPitUpdate.d.ts +1 -0
- package/callbacks/subscriptions/postPitUpdate.lua +6 -0
- package/callbacks/subscriptions/postPlayerChangeHealth.lua +6 -0
- package/callbacks/subscriptions/postPlayerChangeType.lua +6 -0
- package/callbacks/subscriptions/postPlayerFatalDamage.lua +6 -0
- package/callbacks/subscriptions/postPlayerInitLate.lua +6 -0
- package/callbacks/subscriptions/postPlayerInitReordered.lua +6 -0
- package/callbacks/subscriptions/postPlayerRenderReordered.lua +6 -0
- package/callbacks/subscriptions/postPlayerUpdateReordered.lua +6 -0
- package/callbacks/subscriptions/postPoopRender.d.ts +1 -0
- package/callbacks/subscriptions/postPoopRender.lua +6 -0
- package/callbacks/subscriptions/postPoopUpdate.d.ts +1 -0
- package/callbacks/subscriptions/postPoopUpdate.lua +6 -0
- package/callbacks/subscriptions/postPressurePlateRender.d.ts +1 -0
- package/callbacks/subscriptions/postPressurePlateRender.lua +6 -0
- package/callbacks/subscriptions/postPressurePlateUpdate.d.ts +1 -0
- package/callbacks/subscriptions/postPressurePlateUpdate.lua +6 -0
- package/callbacks/subscriptions/postProjectileInitLate.lua +6 -0
- package/callbacks/subscriptions/postPurchase.lua +6 -0
- package/callbacks/subscriptions/postRockRender.d.ts +1 -0
- package/callbacks/subscriptions/postRockRender.lua +6 -0
- package/callbacks/subscriptions/postRockUpdate.d.ts +1 -0
- package/callbacks/subscriptions/postRockUpdate.lua +6 -0
- package/callbacks/subscriptions/postRoomClearChanged.lua +6 -0
- package/callbacks/subscriptions/postSacrifice.lua +6 -0
- package/callbacks/subscriptions/postSlotAnimationChanged.lua +6 -0
- package/callbacks/subscriptions/postSlotDestroyed.lua +6 -0
- package/callbacks/subscriptions/postSlotInit.lua +6 -0
- package/callbacks/subscriptions/postSlotRender.lua +6 -0
- package/callbacks/subscriptions/postSlotUpdate.lua +6 -0
- package/callbacks/subscriptions/postSpikesRender.d.ts +1 -0
- package/callbacks/subscriptions/postSpikesRender.lua +6 -0
- package/callbacks/subscriptions/postSpikesUpdate.d.ts +1 -0
- package/callbacks/subscriptions/postSpikesUpdate.lua +6 -0
- package/callbacks/subscriptions/postTNTRender.d.ts +1 -0
- package/callbacks/subscriptions/postTNTRender.lua +6 -0
- package/callbacks/subscriptions/postTNTUpdate.d.ts +1 -0
- package/callbacks/subscriptions/postTNTUpdate.lua +6 -0
- package/callbacks/subscriptions/postTearInitLate.lua +6 -0
- package/callbacks/subscriptions/postTearInitVeryLate.lua +6 -0
- package/callbacks/subscriptions/postTransformation.lua +6 -0
- package/callbacks/subscriptions/postTrinketBreak.lua +6 -0
- package/callbacks/subscriptions/preBerserkDeath.lua +6 -0
- package/callbacks/subscriptions/preCustomRevive.lua +6 -0
- package/callbacks/subscriptions/preItemPickup.lua +6 -0
- package/callbacks/subscriptions/preNewLevel.lua +6 -0
- package/classes/DefaultMap.d.ts +70 -39
- package/classes/DefaultMap.lua +94 -43
- package/classes/ModUpgraded.d.ts +3 -3
- package/classes/ModUpgraded.lua +5 -0
- package/constants.lua +41 -0
- package/constantsFirstLast.lua +63 -0
- package/enums/HealthType.lua +3 -0
- package/enums/ModCallbackCustom.d.ts +62 -40
- package/enums/ModCallbackCustom.lua +46 -38
- package/enums/private/CopyableIsaacAPIClassType.lua +1 -0
- package/enums/private/SerializationBrand.lua +5 -0
- package/features/characterHealthConversion.lua +6 -0
- package/features/characterStats.lua +17 -0
- package/features/debugDisplay/exports.d.ts +17 -0
- package/features/debugDisplay/exports.lua +90 -0
- package/features/debugDisplay/v.d.ts +17 -0
- package/features/deployJSONRoom.d.ts +1 -0
- package/features/deployJSONRoom.lua +56 -0
- package/features/disableInputs.lua +45 -0
- package/features/disableSound.lua +14 -0
- package/features/extraConsoleCommands/commandsDisplay.lua +90 -0
- package/features/extraConsoleCommands/init.lua +16 -0
- package/features/extraConsoleCommands/listCommands.lua +172 -0
- package/features/fadeInRemover.lua +10 -0
- package/features/fastReset.lua +10 -0
- package/features/forgottenSwitch.lua +4 -0
- package/features/getCollectibleItemPoolType.lua +5 -0
- package/features/playerInventory.lua +18 -0
- package/features/ponyDetection.lua +4 -0
- package/features/preventCollectibleRotation.lua +9 -0
- package/features/runInNFrames.lua +50 -0
- package/features/saveDataManager/constants.lua +1 -0
- package/features/saveDataManager/exports.lua +115 -0
- package/features/saveDataManager/load.lua +12 -8
- package/features/saveDataManager/main.lua +16 -3
- package/features/saveDataManager/maps.lua +3 -0
- package/features/saveDataManager/merge.lua +53 -21
- package/features/saveDataManager/save.lua +12 -7
- package/features/sirenHelpers.lua +13 -0
- package/features/taintedLazarusPlayers.lua +11 -0
- package/featuresInitialized.lua +6 -0
- package/functions/array.d.ts +2 -0
- package/functions/array.lua +85 -0
- package/functions/benchmark.lua +6 -0
- package/functions/bombs.d.ts +3 -0
- package/functions/bombs.lua +12 -0
- package/functions/boss.lua +35 -0
- package/functions/cacheFlag.lua +4 -0
- package/functions/cards.lua +60 -0
- package/functions/challenges.lua +1 -0
- package/functions/character.lua +23 -0
- package/functions/charge.lua +39 -0
- package/functions/chargeBar.d.ts +1 -0
- package/functions/chargeBar.lua +4 -0
- package/functions/collectibleCacheFlag.lua +15 -0
- package/functions/collectibleSet.lua +3 -0
- package/functions/collectibleTag.lua +9 -0
- package/functions/collectibles.d.ts +13 -8
- package/functions/collectibles.lua +147 -3
- package/functions/color.lua +18 -0
- package/functions/debug.lua +18 -0
- package/functions/deepCopy.lua +60 -26
- package/functions/deepCopyTests.lua +8 -5
- package/functions/direction.d.ts +8 -0
- package/functions/direction.lua +27 -0
- package/functions/doors.d.ts +1 -0
- package/functions/doors.lua +58 -0
- package/functions/entity.d.ts +4 -4
- package/functions/entity.lua +94 -6
- package/functions/entitySpecific.d.ts +20 -20
- package/functions/entitySpecific.lua +182 -0
- package/functions/entityTypes.d.ts +1 -1
- package/functions/entityTypes.lua +1 -0
- package/functions/enums.d.ts +2 -0
- package/functions/enums.lua +62 -0
- package/functions/familiars.lua +52 -0
- package/functions/flag.lua +77 -0
- package/functions/flying.lua +10 -0
- package/functions/globals.lua +8 -10
- package/functions/gridEntity.lua +105 -0
- package/functions/gridEntitySpecific.d.ts +5 -0
- package/functions/gridEntitySpecific.lua +8 -0
- package/functions/input.lua +11 -0
- package/functions/isaacAPIClass.d.ts +4 -4
- package/functions/isaacAPIClass.lua +15 -3
- package/functions/jsonHelpers.lua +11 -0
- package/functions/jsonRoom.d.ts +2 -0
- package/functions/jsonRoom.lua +5 -0
- package/functions/kColor.lua +9 -0
- package/functions/language.lua +5 -0
- package/functions/log.lua +31 -3
- package/functions/map.lua +18 -0
- package/functions/math.lua +26 -0
- package/functions/npc.lua +24 -0
- package/functions/pickupVariants.d.ts +11 -11
- package/functions/pickupVariants.lua +11 -0
- package/functions/pickups.d.ts +9 -9
- package/functions/pickups.lua +67 -0
- package/functions/pills.lua +45 -0
- package/functions/player.d.ts +7 -0
- package/functions/player.lua +210 -9
- package/functions/playerDataStructures.lua +65 -0
- package/functions/playerHealth.d.ts +3 -0
- package/functions/playerHealth.lua +92 -63
- package/functions/playerIndex.d.ts +2 -0
- package/functions/playerIndex.lua +47 -0
- package/functions/pocketItems.lua +18 -0
- package/functions/positionVelocity.d.ts +3 -0
- package/functions/positionVelocity.lua +46 -0
- package/functions/random.d.ts +2 -0
- package/functions/random.lua +32 -0
- package/functions/revive.d.ts +2 -0
- package/functions/revive.lua +15 -0
- package/functions/rng.d.ts +1 -0
- package/functions/rng.lua +19 -0
- package/functions/roomData.lua +68 -0
- package/functions/roomGrid.lua +21 -0
- package/functions/roomShape.lua +22 -0
- package/functions/rooms.lua +100 -0
- package/functions/run.lua +5 -0
- package/functions/seeds.lua +4 -0
- package/functions/serialization.lua +6 -2
- package/functions/set.d.ts +1 -0
- package/functions/set.lua +22 -0
- package/functions/spawnCollectible.lua +24 -0
- package/functions/sprite.d.ts +2 -0
- package/functions/sprite.lua +25 -0
- package/functions/stage.lua +16 -0
- package/functions/string.lua +6 -0
- package/functions/table.d.ts +12 -0
- package/functions/table.lua +53 -0
- package/functions/tears.d.ts +1 -0
- package/functions/tears.lua +12 -0
- package/functions/transformations.lua +18 -0
- package/functions/trinketCacheFlag.lua +3 -0
- package/functions/trinketGive.lua +24 -0
- package/functions/trinkets.lua +52 -0
- package/functions/tstlClass.d.ts +34 -0
- package/functions/tstlClass.lua +63 -9
- package/functions/ui.d.ts +2 -0
- package/functions/ui.lua +16 -0
- package/functions/utils.d.ts +16 -0
- package/functions/utils.lua +108 -0
- package/functions/vector.lua +13 -16
- package/index.d.ts +1 -0
- package/index.lua +8 -0
- package/initCustomCallbacks.lua +6 -0
- package/interfaces/AddCallbackParameterCustom.d.ts +2 -0
- package/interfaces/ChargeBarSprites.d.ts +1 -0
- package/interfaces/private/TSTLClassMetatable.d.ts +2 -0
- package/lualib_bundle.lua +21 -34
- package/maps/cardMap.lua +1 -0
- package/maps/characterMap.lua +1 -0
- package/maps/defaultPlayerStatMap.lua +1 -0
- package/maps/gridEntityXMLMap.lua +2 -0
- package/maps/pillEffectMap.lua +1 -0
- package/maps/roomShapeToTopLeftWallGridIndexMap.lua +2 -0
- package/maps/roomTypeMap.lua +1 -0
- package/objects/LRoomShapeToRectangles.lua +2 -0
- package/objects/callbackRegisterFunctions.lua +3 -0
- package/objects/colors.lua +4 -0
- package/objects/oppositeDoorSlots.d.ts +4 -0
- package/objects/oppositeDoorSlots.lua +15 -0
- package/objects/roomShapeBounds.lua +2 -0
- package/objects/roomShapeLayoutSizes.lua +4 -0
- package/objects/roomShapeToBottomRightPosition.lua +2 -0
- package/objects/roomShapeToDoorSlotsToGridIndexDelta.lua +2 -0
- package/objects/roomShapeToTopLeftPosition.lua +2 -0
- package/objects/roomShapeVolumes.lua +3 -0
- package/package.json +2 -2
- package/patchErrorFunctions.lua +8 -0
- package/sets/bossSets.lua +23 -0
- package/sets/charactersWithNoRedHeartsSet.lua +2 -0
- package/sets/charactersWithNoSoulHeartsSet.lua +2 -0
- package/sets/lostStyleCharactersSet.lua +2 -0
- package/types/AnyEntity.d.ts +10 -0
- package/types/PickingUpItem.lua +7 -0
- package/upgradeMod.d.ts +4 -4
- package/upgradeMod.lua +18 -0
package/functions/entity.lua
CHANGED
|
@@ -14,20 +14,33 @@ local ____random = require("functions.random")
|
|
|
14
14
|
local getRandom = ____random.getRandom
|
|
15
15
|
local ____rng = require("functions.rng")
|
|
16
16
|
local newRNG = ____rng.newRNG
|
|
17
|
+
--- Helper function to remove all of the entities in the supplied array.
|
|
18
|
+
--
|
|
19
|
+
-- @param entities The array of entities to remove.
|
|
20
|
+
-- @param cap Optional. If specified, will only remove the given amount of entities.
|
|
21
|
+
-- @returns An array of the entities that were removed.
|
|
17
22
|
function ____exports.removeEntities(self, entities, cap)
|
|
18
23
|
if #entities == 0 then
|
|
19
|
-
return
|
|
24
|
+
return {}
|
|
20
25
|
end
|
|
21
|
-
local
|
|
26
|
+
local entitiesRemoved = {}
|
|
22
27
|
for ____, entity in ipairs(entities) do
|
|
23
28
|
entity:Remove()
|
|
24
|
-
|
|
25
|
-
if cap ~= nil and
|
|
26
|
-
return
|
|
29
|
+
entitiesRemoved[#entitiesRemoved + 1] = entity
|
|
30
|
+
if cap ~= nil and #entitiesRemoved >= cap then
|
|
31
|
+
return entitiesRemoved
|
|
27
32
|
end
|
|
28
33
|
end
|
|
29
|
-
return
|
|
34
|
+
return entitiesRemoved
|
|
30
35
|
end
|
|
36
|
+
--- Helper function to count the number of entities in room. Use this over the vanilla
|
|
37
|
+
-- `Isaac.CountEntities` method to avoid having to specify a spawner and to handle ignoring charmed
|
|
38
|
+
-- enemies.
|
|
39
|
+
--
|
|
40
|
+
-- @param entityType Default is -1. -1 matches every entity type.
|
|
41
|
+
-- @param variant Default is -1. -1 matches every variant.
|
|
42
|
+
-- @param subType Default is -1. -1 matches every sub-type.
|
|
43
|
+
-- @param ignoreFriendly Default is false.
|
|
31
44
|
function ____exports.countEntities(self, entityType, variant, subType, ignoreFriendly)
|
|
32
45
|
if entityType == nil then
|
|
33
46
|
entityType = -1
|
|
@@ -53,6 +66,16 @@ function ____exports.countEntities(self, entityType, variant, subType, ignoreFri
|
|
|
53
66
|
)
|
|
54
67
|
return #entities
|
|
55
68
|
end
|
|
69
|
+
--- Given an array of entities, this helper function returns the closest one to a provided reference
|
|
70
|
+
-- entity.
|
|
71
|
+
--
|
|
72
|
+
-- For example:
|
|
73
|
+
--
|
|
74
|
+
-- ```ts
|
|
75
|
+
-- const player = Isaac.GetPlayer();
|
|
76
|
+
-- const gapers = getEntities(EntityType.GAPER);
|
|
77
|
+
-- const closestGaper = getClosestEntityTo(player, gapers);
|
|
78
|
+
-- ```
|
|
56
79
|
function ____exports.getClosestEntityTo(self, referenceEntity, entities)
|
|
57
80
|
local closestEntity
|
|
58
81
|
local closestDistance = math.huge
|
|
@@ -65,6 +88,30 @@ function ____exports.getClosestEntityTo(self, referenceEntity, entities)
|
|
|
65
88
|
end
|
|
66
89
|
return closestEntity
|
|
67
90
|
end
|
|
91
|
+
--- Helper function to get all of the entities in the room or all of the entities that match a
|
|
92
|
+
-- specific entity type / variant / sub-type.
|
|
93
|
+
--
|
|
94
|
+
-- Due to bugs with `Isaac.FindInRadius`, this function uses `Isaac.GetRoomEntities`, which is more
|
|
95
|
+
-- expensive but also more robust. (If a matching entity type is provided, then `Isaac.FindByType`
|
|
96
|
+
-- will be used instead.)
|
|
97
|
+
--
|
|
98
|
+
-- For example:
|
|
99
|
+
--
|
|
100
|
+
-- ```ts
|
|
101
|
+
-- // Make all of the entities in the room invisible
|
|
102
|
+
-- for (const entity of getEntities()) {
|
|
103
|
+
-- entity.Visible = false;
|
|
104
|
+
-- }
|
|
105
|
+
-- ```
|
|
106
|
+
--
|
|
107
|
+
-- @param entityType Optional. If specified, will only return NPCs that match this entity type.
|
|
108
|
+
-- @param variant Optional. If specified, will only return NPCs that match this variant. Default is
|
|
109
|
+
-- -1. -1 matches every variant.
|
|
110
|
+
-- @param subType Optional. If specified, will only return NPCs that match this sub-type. Default is
|
|
111
|
+
-- -1. -1 matches every sub-type.
|
|
112
|
+
-- @param ignoreFriendly Optional. If set to true, it will exclude friendly NPCs from being
|
|
113
|
+
-- returned. Default is false. Will only be taken into account if
|
|
114
|
+
-- `matchingEntityType` is specified.
|
|
68
115
|
function ____exports.getEntities(self, entityType, variant, subType, ignoreFriendly)
|
|
69
116
|
if variant == nil then
|
|
70
117
|
variant = -1
|
|
@@ -80,9 +127,12 @@ function ____exports.getEntities(self, entityType, variant, subType, ignoreFrien
|
|
|
80
127
|
end
|
|
81
128
|
return Isaac.FindByType(entityType, variant, subType, ignoreFriendly)
|
|
82
129
|
end
|
|
130
|
+
--- Helper function to return a string containing the entity's type, variant, and sub-type.
|
|
83
131
|
function ____exports.getEntityID(self, entity)
|
|
84
132
|
return (((tostring(entity.Type) .. ".") .. tostring(entity.Variant)) .. ".") .. tostring(entity.SubType)
|
|
85
133
|
end
|
|
134
|
+
--- Helper function to compare two different arrays of entities. Returns the entities that are in the
|
|
135
|
+
-- second array but not in the first array.
|
|
86
136
|
function ____exports.getFilteredNewEntities(self, oldEntities, newEntities)
|
|
87
137
|
local oldEntitiesSet = __TS__New(Set)
|
|
88
138
|
for ____, entity in ipairs(oldEntities) do
|
|
@@ -97,15 +147,28 @@ function ____exports.getFilteredNewEntities(self, oldEntities, newEntities)
|
|
|
97
147
|
end
|
|
98
148
|
)
|
|
99
149
|
end
|
|
150
|
+
--- Helper function to measure an entity's velocity to see if it is moving.
|
|
151
|
+
--
|
|
152
|
+
-- @param entity The entity whose velocity to measure.
|
|
153
|
+
-- @param threshold Optional. The threshold from 0 to consider to be moving. Default is 0.01.
|
|
100
154
|
function ____exports.isEntityMoving(self, entity, threshold)
|
|
101
155
|
if threshold == nil then
|
|
102
156
|
threshold = 0.01
|
|
103
157
|
end
|
|
104
158
|
return entity.Velocity:Length() >= threshold
|
|
105
159
|
end
|
|
160
|
+
--- Helper function to determine if the specified entity type is an end-game story boss, like Isaac,
|
|
161
|
+
-- Blue Baby, Mega Satan, The Beast, and so on. This is useful because certain effects should only
|
|
162
|
+
-- apply to non-story bosses, like Vanishing Twin. Also see the `STORY_BOSSES` constant.
|
|
106
163
|
function ____exports.isStoryBoss(self, entityType)
|
|
107
164
|
return STORY_BOSSES_SET:has(entityType)
|
|
108
165
|
end
|
|
166
|
+
--- Helper function to parse a string that contains an entity type, a variant, and a sub-type,
|
|
167
|
+
-- separated by periods.
|
|
168
|
+
--
|
|
169
|
+
-- For example, passing "45.0.1" would return an array of [45, 0, 1].
|
|
170
|
+
--
|
|
171
|
+
-- Returns undefined if the string cannot be parsed.
|
|
109
172
|
function ____exports.parseEntityID(self, entityID)
|
|
110
173
|
local entityIDArray = __TS__StringSplit(entityID, ".")
|
|
111
174
|
if #entityIDArray ~= 3 then
|
|
@@ -126,6 +189,12 @@ function ____exports.parseEntityID(self, entityID)
|
|
|
126
189
|
end
|
|
127
190
|
return {entityType, variant, subType}
|
|
128
191
|
end
|
|
192
|
+
--- Helper function to parse a string that contains an entity type and a variant separated by a
|
|
193
|
+
-- period.
|
|
194
|
+
--
|
|
195
|
+
-- For example, passing "45.0" would return an array of [45, 0].
|
|
196
|
+
--
|
|
197
|
+
-- Returns undefined if the string cannot be parsed.
|
|
129
198
|
function ____exports.parseEntityTypeVariantString(self, entityTypeVariantString)
|
|
130
199
|
local entityTypeVariantArray = __TS__StringSplit(entityTypeVariantString, ".")
|
|
131
200
|
if #entityTypeVariantArray ~= 2 then
|
|
@@ -142,6 +211,13 @@ function ____exports.parseEntityTypeVariantString(self, entityTypeVariantString)
|
|
|
142
211
|
end
|
|
143
212
|
return {entityType, variant}
|
|
144
213
|
end
|
|
214
|
+
--- Helper function to remove all of the matching entities in the room.
|
|
215
|
+
--
|
|
216
|
+
-- @param entityType The entity type to match.
|
|
217
|
+
-- @param entityVariant Optional. The variant to match. Default is -1. -1 matches every variant.
|
|
218
|
+
-- @param entitySubType Optional. The sub-type to match. Default is -1. -1 matches every sub-type.
|
|
219
|
+
-- @param cap Optional. If specified, will only remove the given amount of collectibles.
|
|
220
|
+
-- @returns An array of the entities that were removed.
|
|
145
221
|
function ____exports.removeAllMatchingEntities(self, entityType, entityVariant, entitySubType, cap)
|
|
146
222
|
if entityVariant == nil then
|
|
147
223
|
entityVariant = -1
|
|
@@ -155,6 +231,12 @@ function ____exports.removeAllMatchingEntities(self, entityType, entityVariant,
|
|
|
155
231
|
local entities = ____exports.getEntities(nil, entityType, entityVariant, entitySubType)
|
|
156
232
|
return ____exports.removeEntities(nil, entities, cap)
|
|
157
233
|
end
|
|
234
|
+
--- Helper function to reroll an enemy. Use this instead of the vanilla "Game.RerollEnemy" function
|
|
235
|
+
-- if you want the rerolled enemy to be returned.
|
|
236
|
+
--
|
|
237
|
+
-- @param entity The entity to reroll.
|
|
238
|
+
-- @returns If the game failed to reroll the enemy, returns undefined. Otherwise, returns the
|
|
239
|
+
-- rerolled entity.
|
|
158
240
|
function ____exports.rerollEnemy(self, entity)
|
|
159
241
|
local oldEntities = ____exports.getEntities(nil)
|
|
160
242
|
local wasRerolled = game:RerollEnemy(entity)
|
|
@@ -182,6 +264,10 @@ function ____exports.setEntityRandomColor(self, entity)
|
|
|
182
264
|
false
|
|
183
265
|
)
|
|
184
266
|
end
|
|
267
|
+
--- Helper function to spawn an entity. Use this instead of the `Isaac.Spawn` method if you do not
|
|
268
|
+
-- need to specify the velocity or spawner.
|
|
269
|
+
--
|
|
270
|
+
-- Also see the `spawnWithSeed` helper function.
|
|
185
271
|
function ____exports.spawn(self, entityType, variant, subType, position, velocity, spawner, seed)
|
|
186
272
|
if velocity == nil then
|
|
187
273
|
velocity = VectorZero
|
|
@@ -212,6 +298,8 @@ function ____exports.spawn(self, entityType, variant, subType, position, velocit
|
|
|
212
298
|
seed
|
|
213
299
|
)
|
|
214
300
|
end
|
|
301
|
+
--- Helper function to spawn an entity. Use this instead of the `Game.Spawn` method if you do not
|
|
302
|
+
-- need to specify the velocity or spawner.
|
|
215
303
|
function ____exports.spawnWithSeed(self, entityType, variant, subType, position, seed, velocity, spawner)
|
|
216
304
|
if velocity == nil then
|
|
217
305
|
velocity = VectorZero
|
|
@@ -138,18 +138,18 @@ export declare function npcFireProjectiles(npc: EntityNPC, position: Vector, vel
|
|
|
138
138
|
* @param bombVariant Optional. If specified, will only remove bombs that match this variant.
|
|
139
139
|
* @param subType Optional. If specified, will only remove bombs that match this sub-type.
|
|
140
140
|
* @param cap Optional. If specified, will only remove the given amount of bombs.
|
|
141
|
-
* @returns
|
|
141
|
+
* @returns An array of the bombs that were removed.
|
|
142
142
|
*/
|
|
143
|
-
export declare function removeAllBombs(bombVariant?: BombVariant, subType?: int, cap?: int):
|
|
143
|
+
export declare function removeAllBombs(bombVariant?: BombVariant, subType?: int, cap?: int): EntityBomb[];
|
|
144
144
|
/**
|
|
145
145
|
* Helper function to remove all of the effects in the room.
|
|
146
146
|
*
|
|
147
147
|
* @param effectVariant Optional. If specified, will only remove effects that match this variant.
|
|
148
148
|
* @param subType Optional. If specified, will only remove effects that match this sub-type.
|
|
149
149
|
* @param cap Optional. If specified, will only remove the given amount of effects.
|
|
150
|
-
* @returns
|
|
150
|
+
* @returns An array of the effects that were removed.
|
|
151
151
|
*/
|
|
152
|
-
export declare function removeAllEffects(effectVariant?: EffectVariant, subType?: int, cap?: int):
|
|
152
|
+
export declare function removeAllEffects(effectVariant?: EffectVariant, subType?: int, cap?: int): EntityEffect[];
|
|
153
153
|
/**
|
|
154
154
|
* Helper function to remove all of the familiars in the room.
|
|
155
155
|
*
|
|
@@ -157,43 +157,43 @@ export declare function removeAllEffects(effectVariant?: EffectVariant, subType?
|
|
|
157
157
|
* variant.
|
|
158
158
|
* @param subType Optional. If specified, will only remove familiars that match this sub-type.
|
|
159
159
|
* @param cap Optional. If specified, will only remove the given amount of familiars.
|
|
160
|
-
* @returns
|
|
160
|
+
* @returns An array of the familiars that were removed.
|
|
161
161
|
*/
|
|
162
|
-
export declare function removeAllFamiliars(familiarVariant?: FamiliarVariant, subType?: int, cap?: int):
|
|
162
|
+
export declare function removeAllFamiliars(familiarVariant?: FamiliarVariant, subType?: int, cap?: int): EntityFamiliar[];
|
|
163
163
|
/**
|
|
164
164
|
* Helper function to remove all of the `EntityType.KNIFE` in the room.
|
|
165
165
|
*
|
|
166
166
|
* @param knifeVariant Optional. If specified, will only remove knives that match this variant.
|
|
167
167
|
* @param subType Optional. If specified, will only remove knives that match this sub-type.
|
|
168
168
|
* @param cap Optional. If specified, will only remove the given amount of knives.
|
|
169
|
-
* @returns
|
|
169
|
+
* @returns An array of the knives that were removed.
|
|
170
170
|
*/
|
|
171
|
-
export declare function removeAllKnives(knifeVariant?: KnifeVariant, subType?: int, cap?: int):
|
|
171
|
+
export declare function removeAllKnives(knifeVariant?: KnifeVariant, subType?: int, cap?: int): EntityKnife[];
|
|
172
172
|
/**
|
|
173
173
|
* Helper function to remove all of the `EntityType.LASER` in the room.
|
|
174
174
|
*
|
|
175
175
|
* @param laserVariant Optional. If specified, will only remove lasers that match this variant.
|
|
176
176
|
* @param subType Optional. If specified, will only remove lasers that match this sub-type.
|
|
177
177
|
* @param cap Optional. If specified, will only remove the given amount of lasers.
|
|
178
|
-
* @returns
|
|
178
|
+
* @returns An array of the lasers that were removed.
|
|
179
179
|
*/
|
|
180
|
-
export declare function removeAllLasers(laserVariant?: LaserVariant, subType?: int, cap?: int):
|
|
180
|
+
export declare function removeAllLasers(laserVariant?: LaserVariant, subType?: int, cap?: int): EntityLaser[];
|
|
181
181
|
/**
|
|
182
182
|
* Helper function to remove all NPCs in the room.
|
|
183
183
|
*
|
|
184
184
|
* @param cap Optional. If specified, will only remove the given amount of NPCs.
|
|
185
|
-
* @returns
|
|
185
|
+
* @returns An array of the NPCs that were removed.
|
|
186
186
|
*/
|
|
187
|
-
export declare function removeAllNPCs(cap?: int):
|
|
187
|
+
export declare function removeAllNPCs(cap?: int): EntityNPC[];
|
|
188
188
|
/**
|
|
189
189
|
* Helper function to remove all of the pickups in the room.
|
|
190
190
|
*
|
|
191
191
|
* @param pickupVariant Optional. If specified, will only remove pickups that match this variant.
|
|
192
192
|
* @param subType Optional. If specified, will only remove pickups that match this sub-type.
|
|
193
193
|
* @param cap Optional. If specified, will only remove the given amount of pickups.
|
|
194
|
-
* @returns
|
|
194
|
+
* @returns An array of the pickups that were removed.
|
|
195
195
|
*/
|
|
196
|
-
export declare function removeAllPickups(pickupVariant?: PickupVariant, subType?: int, cap?: int):
|
|
196
|
+
export declare function removeAllPickups(pickupVariant?: PickupVariant, subType?: int, cap?: int): EntityPickup[];
|
|
197
197
|
/**
|
|
198
198
|
* Helper function to remove all of the `EntityType.PROJECTILE` in the room.
|
|
199
199
|
*
|
|
@@ -201,27 +201,27 @@ export declare function removeAllPickups(pickupVariant?: PickupVariant, subType?
|
|
|
201
201
|
* variant.
|
|
202
202
|
* @param subType Optional. If specified, will only remove projectiles that match this sub-type.
|
|
203
203
|
* @param cap Optional. If specified, will only remove the given amount of projectiles.
|
|
204
|
-
* @returns
|
|
204
|
+
* @returns An array of the projectiles that were removed.
|
|
205
205
|
*/
|
|
206
|
-
export declare function removeAllProjectiles(projectileVariant?: ProjectileVariant, subType?: int, cap?: int):
|
|
206
|
+
export declare function removeAllProjectiles(projectileVariant?: ProjectileVariant, subType?: int, cap?: int): EntityProjectile[];
|
|
207
207
|
/**
|
|
208
208
|
* Helper function to remove all of the `EntityType.SLOT` in the room.
|
|
209
209
|
*
|
|
210
210
|
* @param slotVariant Optional. If specified, will only remove slots that match this variant.
|
|
211
211
|
* @param subType Optional. If specified, will only remove slots that match this sub-type.
|
|
212
212
|
* @param cap Optional. If specified, will only remove the given amount of slots.
|
|
213
|
-
* @returns
|
|
213
|
+
* @returns An array of the slots that were removed.
|
|
214
214
|
*/
|
|
215
|
-
export declare function removeAllSlots(slotVariant?: SlotVariant, subType?: int, cap?: int):
|
|
215
|
+
export declare function removeAllSlots(slotVariant?: SlotVariant, subType?: int, cap?: int): Entity[];
|
|
216
216
|
/**
|
|
217
217
|
* Helper function to remove all of the `EntityType.TEAR` in the room.
|
|
218
218
|
*
|
|
219
219
|
* @param tearVariant Optional. If specified, will only remove tears that match this variant.
|
|
220
220
|
* @param subType Optional. If specified, will only remove tears that match this sub-type.
|
|
221
221
|
* @param cap Optional. If specified, will only remove the given amount of tears.
|
|
222
|
-
* @returns
|
|
222
|
+
* @returns An array of the tears that were removed.
|
|
223
223
|
*/
|
|
224
|
-
export declare function removeAllTears(tearVariant?: TearVariant, subType?: int, cap?: int):
|
|
224
|
+
export declare function removeAllTears(tearVariant?: TearVariant, subType?: int, cap?: int): EntityTear[];
|
|
225
225
|
/** Helper function to spawn a `EntityType.BOMB` (4). */
|
|
226
226
|
export declare function spawnBomb(bombVariant: BombVariant, subType: int, position: Vector, velocity?: Readonly<Vector>, spawner?: Entity | undefined, seed?: Seed | undefined): EntityBomb;
|
|
227
227
|
/** Helper function to spawn a `EntityType.BOMB` (4) with a specific seed. */
|