isaacscript-common 2.3.2 → 3.0.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/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/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/postSlotInitUpdate.lua +2 -0
- package/callbacks/postSlotRender.lua +2 -0
- 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.lua +6 -0
- package/callbacks/subscriptions/postDoorRender.lua +6 -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.lua +6 -0
- package/callbacks/subscriptions/postPickupInitLate.lua +6 -0
- package/callbacks/subscriptions/postPickupStateChanged.lua +6 -0
- package/callbacks/subscriptions/postPitRender.lua +6 -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.lua +6 -0
- package/callbacks/subscriptions/postPoopUpdate.lua +6 -0
- package/callbacks/subscriptions/postPressurePlateRender.lua +6 -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.lua +6 -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.lua +6 -0
- package/callbacks/subscriptions/postSpikesUpdate.lua +6 -0
- package/callbacks/subscriptions/postTNTRender.lua +6 -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 +1 -1
- package/enums/ModCallbackCustom.lua +6 -0
- 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.lua +90 -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/main.lua +6 -0
- package/features/saveDataManager/maps.lua +3 -0
- package/features/saveDataManager/merge.lua +20 -0
- package/features/sirenHelpers.lua +13 -0
- package/features/taintedLazarusPlayers.lua +11 -0
- package/featuresInitialized.lua +6 -0
- package/functions/array.lua +85 -0
- package/functions/benchmark.lua +6 -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.lua +4 -0
- package/functions/collectibleCacheFlag.lua +15 -0
- package/functions/collectibleSet.lua +3 -0
- package/functions/collectibleTag.lua +9 -0
- package/functions/collectibles.lua +131 -0
- package/functions/color.lua +18 -0
- package/functions/debug.lua +18 -0
- package/functions/deepCopy.lua +25 -0
- package/functions/doors.lua +53 -0
- package/functions/entity.lua +88 -0
- package/functions/entitySpecific.lua +182 -0
- package/functions/entityTypes.d.ts +1 -1
- package/functions/entityTypes.lua +1 -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 +6 -0
- package/functions/gridEntity.lua +105 -0
- package/functions/gridEntitySpecific.lua +8 -0
- package/functions/input.lua +11 -0
- package/functions/isaacAPIClass.lua +12 -0
- package/functions/jsonHelpers.lua +11 -0
- package/functions/jsonRoom.lua +5 -0
- package/functions/kColor.lua +9 -0
- package/functions/language.lua +5 -0
- package/functions/log.lua +28 -0
- 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.lua +67 -0
- package/functions/pills.lua +45 -0
- package/functions/player.lua +166 -0
- package/functions/playerDataStructures.lua +65 -0
- package/functions/playerHealth.lua +10 -0
- package/functions/playerIndex.lua +47 -0
- package/functions/pocketItems.lua +18 -0
- package/functions/positionVelocity.lua +46 -0
- package/functions/random.lua +32 -0
- package/functions/revive.lua +15 -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 +4 -0
- package/functions/set.lua +22 -0
- package/functions/spawnCollectible.lua +24 -0
- package/functions/sprite.lua +25 -0
- package/functions/stage.lua +16 -0
- package/functions/string.lua +6 -0
- package/functions/table.lua +19 -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.lua +9 -0
- package/functions/ui.lua +16 -0
- package/functions/utils.d.ts +1 -0
- package/functions/utils.lua +88 -0
- package/functions/vector.lua +9 -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/colors.lua +4 -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/PickingUpItem.lua +7 -0
- package/upgradeMod.d.ts +4 -4
- package/upgradeMod.lua +18 -0
package/functions/entity.lua
CHANGED
|
@@ -14,6 +14,11 @@ 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 True if one or more entities were removed, false otherwise.
|
|
17
22
|
function ____exports.removeEntities(self, entities, cap)
|
|
18
23
|
if #entities == 0 then
|
|
19
24
|
return false
|
|
@@ -28,6 +33,14 @@ function ____exports.removeEntities(self, entities, cap)
|
|
|
28
33
|
end
|
|
29
34
|
return true
|
|
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 True if one or more entities were removed, false otherwise.
|
|
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
|
|
@@ -8,6 +8,16 @@ local getEntities = ____entity.getEntities
|
|
|
8
8
|
local getFilteredNewEntities = ____entity.getFilteredNewEntities
|
|
9
9
|
local removeEntities = ____entity.removeEntities
|
|
10
10
|
local spawn = ____entity.spawn
|
|
11
|
+
--- Helper function to get all of the `EntityType.BOMB` in the room.
|
|
12
|
+
--
|
|
13
|
+
-- For example:
|
|
14
|
+
--
|
|
15
|
+
-- ```ts
|
|
16
|
+
-- // Make all of the bombs in the room invisible
|
|
17
|
+
-- for (const bomb of getBombs()) {
|
|
18
|
+
-- bomb.Visible = false;
|
|
19
|
+
-- }
|
|
20
|
+
-- ```
|
|
11
21
|
function ____exports.getBombs(self, bombVariant, subType)
|
|
12
22
|
if bombVariant == nil then
|
|
13
23
|
bombVariant = -1
|
|
@@ -25,6 +35,16 @@ function ____exports.getBombs(self, bombVariant, subType)
|
|
|
25
35
|
end
|
|
26
36
|
return bombs
|
|
27
37
|
end
|
|
38
|
+
--- Helper function to get all of the `EntityType.EFFECT` in the room.
|
|
39
|
+
--
|
|
40
|
+
-- For example:
|
|
41
|
+
--
|
|
42
|
+
-- ```ts
|
|
43
|
+
-- // Make all of the effects in the room invisible
|
|
44
|
+
-- for (const effect of getEffects()) {
|
|
45
|
+
-- effect.Visible = false;
|
|
46
|
+
-- }
|
|
47
|
+
-- ```
|
|
28
48
|
function ____exports.getEffects(self, effectVariant, subType)
|
|
29
49
|
if effectVariant == nil then
|
|
30
50
|
effectVariant = -1
|
|
@@ -42,6 +62,16 @@ function ____exports.getEffects(self, effectVariant, subType)
|
|
|
42
62
|
end
|
|
43
63
|
return effects
|
|
44
64
|
end
|
|
65
|
+
--- Helper function to get all of the familiars in the room.
|
|
66
|
+
--
|
|
67
|
+
-- For example:
|
|
68
|
+
--
|
|
69
|
+
-- ```ts
|
|
70
|
+
-- // Make all of the familiars in the room invisible
|
|
71
|
+
-- for (const familiar of getFamiliars()) {
|
|
72
|
+
-- familiar.Visible = false;
|
|
73
|
+
-- }
|
|
74
|
+
-- ```
|
|
45
75
|
function ____exports.getFamiliars(self, familiarVariant, subType)
|
|
46
76
|
if familiarVariant == nil then
|
|
47
77
|
familiarVariant = -1
|
|
@@ -59,6 +89,16 @@ function ____exports.getFamiliars(self, familiarVariant, subType)
|
|
|
59
89
|
end
|
|
60
90
|
return familiars
|
|
61
91
|
end
|
|
92
|
+
--- Helper function to get all of the `EntityType.KNIFE` in the room.
|
|
93
|
+
--
|
|
94
|
+
-- For example:
|
|
95
|
+
--
|
|
96
|
+
-- ```ts
|
|
97
|
+
-- // Make all of the knives in the room invisible
|
|
98
|
+
-- for (const knife of getKnives()) {
|
|
99
|
+
-- knife.Visible = false;
|
|
100
|
+
-- }
|
|
101
|
+
-- ```
|
|
62
102
|
function ____exports.getKnives(self, knifeVariant, subType)
|
|
63
103
|
if knifeVariant == nil then
|
|
64
104
|
knifeVariant = -1
|
|
@@ -76,6 +116,16 @@ function ____exports.getKnives(self, knifeVariant, subType)
|
|
|
76
116
|
end
|
|
77
117
|
return knives
|
|
78
118
|
end
|
|
119
|
+
--- Helper function to get all of the `EntityType.LASER` in the room.
|
|
120
|
+
--
|
|
121
|
+
-- For example:
|
|
122
|
+
--
|
|
123
|
+
-- ```ts
|
|
124
|
+
-- // Make all of the lasers in the room invisible
|
|
125
|
+
-- for (const laser of getLasers()) {
|
|
126
|
+
-- laser.Visible = false;
|
|
127
|
+
-- }
|
|
128
|
+
-- ```
|
|
79
129
|
function ____exports.getLasers(self, laserVariant, subType)
|
|
80
130
|
if laserVariant == nil then
|
|
81
131
|
laserVariant = -1
|
|
@@ -93,6 +143,7 @@ function ____exports.getLasers(self, laserVariant, subType)
|
|
|
93
143
|
end
|
|
94
144
|
return lasers
|
|
95
145
|
end
|
|
146
|
+
--- The same thing as the `getEntities` function, but returns only NPCs.
|
|
96
147
|
function ____exports.getNPCs(self, entityType, variant, subType, ignoreFriendly)
|
|
97
148
|
if ignoreFriendly == nil then
|
|
98
149
|
ignoreFriendly = false
|
|
@@ -113,6 +164,16 @@ function ____exports.getNPCs(self, entityType, variant, subType, ignoreFriendly)
|
|
|
113
164
|
end
|
|
114
165
|
return npcs
|
|
115
166
|
end
|
|
167
|
+
--- Helper function to get all of the pickups in the room.
|
|
168
|
+
--
|
|
169
|
+
-- For example:
|
|
170
|
+
--
|
|
171
|
+
-- ```ts
|
|
172
|
+
-- // Make all of the pickups in the room invisible
|
|
173
|
+
-- for (const pickup of getPickups()) {
|
|
174
|
+
-- pickup.Visible = false;
|
|
175
|
+
-- }
|
|
176
|
+
-- ```
|
|
116
177
|
function ____exports.getPickups(self, pickupVariant, subType)
|
|
117
178
|
if pickupVariant == nil then
|
|
118
179
|
pickupVariant = -1
|
|
@@ -130,6 +191,16 @@ function ____exports.getPickups(self, pickupVariant, subType)
|
|
|
130
191
|
end
|
|
131
192
|
return pickups
|
|
132
193
|
end
|
|
194
|
+
--- Helper function to get all of the `EntityType.PROJECTILE` in the room.
|
|
195
|
+
--
|
|
196
|
+
-- For example:
|
|
197
|
+
--
|
|
198
|
+
-- ```ts
|
|
199
|
+
-- // Make all of the projectiles in the room invisible
|
|
200
|
+
-- for (const projectile of getProjectiles()) {
|
|
201
|
+
-- projectile.Visible = false;
|
|
202
|
+
-- }
|
|
203
|
+
-- ```
|
|
133
204
|
function ____exports.getProjectiles(self, projectileVariant, subType)
|
|
134
205
|
if projectileVariant == nil then
|
|
135
206
|
projectileVariant = -1
|
|
@@ -147,6 +218,16 @@ function ____exports.getProjectiles(self, projectileVariant, subType)
|
|
|
147
218
|
end
|
|
148
219
|
return projectiles
|
|
149
220
|
end
|
|
221
|
+
--- Helper function to get all of the `EntityType.SLOT` in the room.
|
|
222
|
+
--
|
|
223
|
+
-- For example:
|
|
224
|
+
--
|
|
225
|
+
-- ```ts
|
|
226
|
+
-- // Make all of the slots in the room invisible
|
|
227
|
+
-- for (const slot of getSlots()) {
|
|
228
|
+
-- slot.Visible = false;
|
|
229
|
+
-- }
|
|
230
|
+
-- ```
|
|
150
231
|
function ____exports.getSlots(self, slotVariant, subType)
|
|
151
232
|
if slotVariant == nil then
|
|
152
233
|
slotVariant = -1
|
|
@@ -157,6 +238,16 @@ function ____exports.getSlots(self, slotVariant, subType)
|
|
|
157
238
|
local slots = getEntities(nil, EntityType.SLOT, slotVariant, subType)
|
|
158
239
|
return slots
|
|
159
240
|
end
|
|
241
|
+
--- Helper function to get all of the `EntityType.TEAR` in the room.
|
|
242
|
+
--
|
|
243
|
+
-- For example:
|
|
244
|
+
--
|
|
245
|
+
-- ```ts
|
|
246
|
+
-- // Make all of the tears in the room invisible
|
|
247
|
+
-- for (const tear of getTears()) {
|
|
248
|
+
-- tear.Visible = false;
|
|
249
|
+
-- }
|
|
250
|
+
-- ```
|
|
160
251
|
function ____exports.getTears(self, tearVariant, subType)
|
|
161
252
|
if tearVariant == nil then
|
|
162
253
|
tearVariant = -1
|
|
@@ -174,6 +265,17 @@ function ____exports.getTears(self, tearVariant, subType)
|
|
|
174
265
|
end
|
|
175
266
|
return tears
|
|
176
267
|
end
|
|
268
|
+
--- The base game `EntityNPC.FireProjectiles` method does not return anything, which is a problem in
|
|
269
|
+
-- situations where you need to work with the fired projectiles. This function invokes that method,
|
|
270
|
+
-- and then returns the projectiles that were spawned.
|
|
271
|
+
--
|
|
272
|
+
-- @param npc The EntityNPC firing projectiles.
|
|
273
|
+
-- @param position The starting position of the projectiles.
|
|
274
|
+
-- @param velocity The starting velocity of the projectiles.
|
|
275
|
+
-- @param projectilesMode A ProjectilesMode enum value defining how to fire the projectiles.
|
|
276
|
+
-- @param projectileParams A ProjectileParams object containing various parameters for the
|
|
277
|
+
-- projectiles.
|
|
278
|
+
-- @returns An array of EntityProjectiles containing all fired projectiles.
|
|
177
279
|
function ____exports.npcFireProjectiles(self, npc, position, velocity, projectilesMode, projectileParams)
|
|
178
280
|
local oldEntities = ____exports.getProjectiles(nil)
|
|
179
281
|
npc:FireProjectiles(position, velocity, projectilesMode, projectileParams)
|
|
@@ -181,46 +283,107 @@ function ____exports.npcFireProjectiles(self, npc, position, velocity, projectil
|
|
|
181
283
|
local filteredNewEntities = getFilteredNewEntities(nil, oldEntities, newEntities)
|
|
182
284
|
return filteredNewEntities
|
|
183
285
|
end
|
|
286
|
+
--- Helper function to remove all of the `EntityType.BOMB` in the room.
|
|
287
|
+
--
|
|
288
|
+
-- @param bombVariant Optional. If specified, will only remove bombs that match this variant.
|
|
289
|
+
-- @param subType Optional. If specified, will only remove bombs that match this sub-type.
|
|
290
|
+
-- @param cap Optional. If specified, will only remove the given amount of bombs.
|
|
291
|
+
-- @returns True if one or more bombs were removed, false otherwise.
|
|
184
292
|
function ____exports.removeAllBombs(self, bombVariant, subType, cap)
|
|
185
293
|
local bombs = ____exports.getBombs(nil, bombVariant, subType)
|
|
186
294
|
return removeEntities(nil, bombs, cap)
|
|
187
295
|
end
|
|
296
|
+
--- Helper function to remove all of the effects in the room.
|
|
297
|
+
--
|
|
298
|
+
-- @param effectVariant Optional. If specified, will only remove effects that match this variant.
|
|
299
|
+
-- @param subType Optional. If specified, will only remove effects that match this sub-type.
|
|
300
|
+
-- @param cap Optional. If specified, will only remove the given amount of effects.
|
|
301
|
+
-- @returns True if one or more effects were removed, false otherwise.
|
|
188
302
|
function ____exports.removeAllEffects(self, effectVariant, subType, cap)
|
|
189
303
|
local effects = ____exports.getEffects(nil, effectVariant, subType)
|
|
190
304
|
return removeEntities(nil, effects, cap)
|
|
191
305
|
end
|
|
306
|
+
--- Helper function to remove all of the familiars in the room.
|
|
307
|
+
--
|
|
308
|
+
-- @param familiarVariant Optional. If specified, will only remove familiars that match this
|
|
309
|
+
-- variant.
|
|
310
|
+
-- @param subType Optional. If specified, will only remove familiars that match this sub-type.
|
|
311
|
+
-- @param cap Optional. If specified, will only remove the given amount of familiars.
|
|
312
|
+
-- @returns True if one or more familiars were removed, false otherwise.
|
|
192
313
|
function ____exports.removeAllFamiliars(self, familiarVariant, subType, cap)
|
|
193
314
|
local familiars = ____exports.getFamiliars(nil, familiarVariant, subType)
|
|
194
315
|
return removeEntities(nil, familiars, cap)
|
|
195
316
|
end
|
|
317
|
+
--- Helper function to remove all of the `EntityType.KNIFE` in the room.
|
|
318
|
+
--
|
|
319
|
+
-- @param knifeVariant Optional. If specified, will only remove knives that match this variant.
|
|
320
|
+
-- @param subType Optional. If specified, will only remove knives that match this sub-type.
|
|
321
|
+
-- @param cap Optional. If specified, will only remove the given amount of knives.
|
|
322
|
+
-- @returns True if one or more knives were removed, false otherwise.
|
|
196
323
|
function ____exports.removeAllKnives(self, knifeVariant, subType, cap)
|
|
197
324
|
local knives = ____exports.getKnives(nil, knifeVariant, subType)
|
|
198
325
|
return removeEntities(nil, knives, cap)
|
|
199
326
|
end
|
|
327
|
+
--- Helper function to remove all of the `EntityType.LASER` in the room.
|
|
328
|
+
--
|
|
329
|
+
-- @param laserVariant Optional. If specified, will only remove lasers that match this variant.
|
|
330
|
+
-- @param subType Optional. If specified, will only remove lasers that match this sub-type.
|
|
331
|
+
-- @param cap Optional. If specified, will only remove the given amount of lasers.
|
|
332
|
+
-- @returns True if one or more lasers were removed, false otherwise.
|
|
200
333
|
function ____exports.removeAllLasers(self, laserVariant, subType, cap)
|
|
201
334
|
local lasers = ____exports.getLasers(nil, laserVariant, subType)
|
|
202
335
|
return removeEntities(nil, lasers, cap)
|
|
203
336
|
end
|
|
337
|
+
--- Helper function to remove all NPCs in the room.
|
|
338
|
+
--
|
|
339
|
+
-- @param cap Optional. If specified, will only remove the given amount of NPCs.
|
|
340
|
+
-- @returns True if one or more NPCs were removed, false otherwise.
|
|
204
341
|
function ____exports.removeAllNPCs(self, cap)
|
|
205
342
|
local npcs = ____exports.getNPCs(nil)
|
|
206
343
|
return removeEntities(nil, npcs, cap)
|
|
207
344
|
end
|
|
345
|
+
--- Helper function to remove all of the pickups in the room.
|
|
346
|
+
--
|
|
347
|
+
-- @param pickupVariant Optional. If specified, will only remove pickups that match this variant.
|
|
348
|
+
-- @param subType Optional. If specified, will only remove pickups that match this sub-type.
|
|
349
|
+
-- @param cap Optional. If specified, will only remove the given amount of pickups.
|
|
350
|
+
-- @returns True if one or more pickups were removed, false otherwise.
|
|
208
351
|
function ____exports.removeAllPickups(self, pickupVariant, subType, cap)
|
|
209
352
|
local pickups = ____exports.getPickups(nil, pickupVariant, subType)
|
|
210
353
|
return removeEntities(nil, pickups, cap)
|
|
211
354
|
end
|
|
355
|
+
--- Helper function to remove all of the `EntityType.PROJECTILE` in the room.
|
|
356
|
+
--
|
|
357
|
+
-- @param projectileVariant Optional. If specified, will only remove projectiles that match this
|
|
358
|
+
-- variant.
|
|
359
|
+
-- @param subType Optional. If specified, will only remove projectiles that match this sub-type.
|
|
360
|
+
-- @param cap Optional. If specified, will only remove the given amount of projectiles.
|
|
361
|
+
-- @returns True if one or more projectiles were removed, false otherwise.
|
|
212
362
|
function ____exports.removeAllProjectiles(self, projectileVariant, subType, cap)
|
|
213
363
|
local projectiles = ____exports.getProjectiles(nil, projectileVariant, subType)
|
|
214
364
|
return removeEntities(nil, projectiles, cap)
|
|
215
365
|
end
|
|
366
|
+
--- Helper function to remove all of the `EntityType.SLOT` in the room.
|
|
367
|
+
--
|
|
368
|
+
-- @param slotVariant Optional. If specified, will only remove slots that match this variant.
|
|
369
|
+
-- @param subType Optional. If specified, will only remove slots that match this sub-type.
|
|
370
|
+
-- @param cap Optional. If specified, will only remove the given amount of slots.
|
|
371
|
+
-- @returns True if one or more slots were removed, false otherwise.
|
|
216
372
|
function ____exports.removeAllSlots(self, slotVariant, subType, cap)
|
|
217
373
|
local slots = ____exports.getSlots(nil, slotVariant, subType)
|
|
218
374
|
return removeEntities(nil, slots, cap)
|
|
219
375
|
end
|
|
376
|
+
--- Helper function to remove all of the `EntityType.TEAR` in the room.
|
|
377
|
+
--
|
|
378
|
+
-- @param tearVariant Optional. If specified, will only remove tears that match this variant.
|
|
379
|
+
-- @param subType Optional. If specified, will only remove tears that match this sub-type.
|
|
380
|
+
-- @param cap Optional. If specified, will only remove the given amount of tears.
|
|
381
|
+
-- @returns True if one or more tears were removed, false otherwise.
|
|
220
382
|
function ____exports.removeAllTears(self, tearVariant, subType, cap)
|
|
221
383
|
local tears = ____exports.getTears(nil, tearVariant, subType)
|
|
222
384
|
return removeEntities(nil, tears, cap)
|
|
223
385
|
end
|
|
386
|
+
--- Helper function to spawn a `EntityType.BOMB` (4).
|
|
224
387
|
function ____exports.spawnBomb(self, bombVariant, subType, position, velocity, spawner, seed)
|
|
225
388
|
if velocity == nil then
|
|
226
389
|
velocity = VectorZero
|
|
@@ -247,6 +410,7 @@ function ____exports.spawnBomb(self, bombVariant, subType, position, velocity, s
|
|
|
247
410
|
end
|
|
248
411
|
return bomb
|
|
249
412
|
end
|
|
413
|
+
--- Helper function to spawn a `EntityType.BOMB` (4) with a specific seed.
|
|
250
414
|
function ____exports.spawnBombWithSeed(self, bombVariant, subType, position, seed, velocity, spawner)
|
|
251
415
|
if velocity == nil then
|
|
252
416
|
velocity = VectorZero
|
|
@@ -264,6 +428,7 @@ function ____exports.spawnBombWithSeed(self, bombVariant, subType, position, see
|
|
|
264
428
|
seed
|
|
265
429
|
)
|
|
266
430
|
end
|
|
431
|
+
--- Helper function to spawn a `EntityType.EFFECT` (1000).
|
|
267
432
|
function ____exports.spawnEffect(self, effectVariant, subType, position, velocity, spawner, seed)
|
|
268
433
|
if velocity == nil then
|
|
269
434
|
velocity = VectorZero
|
|
@@ -290,6 +455,7 @@ function ____exports.spawnEffect(self, effectVariant, subType, position, velocit
|
|
|
290
455
|
end
|
|
291
456
|
return effect
|
|
292
457
|
end
|
|
458
|
+
--- Helper function to spawn a `EntityType.EFFECT` (1000) with a specific seed.
|
|
293
459
|
function ____exports.spawnEffectWithSeed(self, effectVariant, subType, position, seed, velocity, spawner)
|
|
294
460
|
if velocity == nil then
|
|
295
461
|
velocity = VectorZero
|
|
@@ -307,6 +473,7 @@ function ____exports.spawnEffectWithSeed(self, effectVariant, subType, position,
|
|
|
307
473
|
seed
|
|
308
474
|
)
|
|
309
475
|
end
|
|
476
|
+
--- Helper function to spawn a `EntityType.FAMILIAR` (3).
|
|
310
477
|
function ____exports.spawnFamiliar(self, familiarVariant, subType, position, velocity, spawner, seed)
|
|
311
478
|
if velocity == nil then
|
|
312
479
|
velocity = VectorZero
|
|
@@ -333,6 +500,7 @@ function ____exports.spawnFamiliar(self, familiarVariant, subType, position, vel
|
|
|
333
500
|
end
|
|
334
501
|
return familiar
|
|
335
502
|
end
|
|
503
|
+
--- Helper function to spawn a `EntityType.FAMILIAR` (3) with a specific seed.
|
|
336
504
|
function ____exports.spawnFamiliarWithSeed(self, familiarVariant, subType, position, seed, velocity, spawner)
|
|
337
505
|
if velocity == nil then
|
|
338
506
|
velocity = VectorZero
|
|
@@ -350,6 +518,7 @@ function ____exports.spawnFamiliarWithSeed(self, familiarVariant, subType, posit
|
|
|
350
518
|
seed
|
|
351
519
|
)
|
|
352
520
|
end
|
|
521
|
+
--- Helper function to spawn a `EntityType.KNIFE` (8).
|
|
353
522
|
function ____exports.spawnKnife(self, knifeVariant, subType, position, velocity, spawner, seed)
|
|
354
523
|
if velocity == nil then
|
|
355
524
|
velocity = VectorZero
|
|
@@ -376,6 +545,7 @@ function ____exports.spawnKnife(self, knifeVariant, subType, position, velocity,
|
|
|
376
545
|
end
|
|
377
546
|
return knife
|
|
378
547
|
end
|
|
548
|
+
--- Helper function to spawn a `EntityType.KNIFE` (8) with a specific seed.
|
|
379
549
|
function ____exports.spawnKnifeWithSeed(self, knifeVariant, subType, position, seed, velocity, spawner)
|
|
380
550
|
if velocity == nil then
|
|
381
551
|
velocity = VectorZero
|
|
@@ -393,6 +563,7 @@ function ____exports.spawnKnifeWithSeed(self, knifeVariant, subType, position, s
|
|
|
393
563
|
seed
|
|
394
564
|
)
|
|
395
565
|
end
|
|
566
|
+
--- Helper function to spawn a `EntityType.LASER` (7).
|
|
396
567
|
function ____exports.spawnLaser(self, laserVariant, subType, position, velocity, spawner, seed)
|
|
397
568
|
if velocity == nil then
|
|
398
569
|
velocity = VectorZero
|
|
@@ -419,6 +590,7 @@ function ____exports.spawnLaser(self, laserVariant, subType, position, velocity,
|
|
|
419
590
|
end
|
|
420
591
|
return laser
|
|
421
592
|
end
|
|
593
|
+
--- Helper function to spawn a `EntityType.LASER` (7) with a specific seed.
|
|
422
594
|
function ____exports.spawnLaserWithSeed(self, laserVariant, subType, position, seed, velocity, spawner)
|
|
423
595
|
if velocity == nil then
|
|
424
596
|
velocity = VectorZero
|
|
@@ -436,6 +608,7 @@ function ____exports.spawnLaserWithSeed(self, laserVariant, subType, position, s
|
|
|
436
608
|
seed
|
|
437
609
|
)
|
|
438
610
|
end
|
|
611
|
+
--- Helper function to spawn an NPC.
|
|
439
612
|
function ____exports.spawnNPC(self, entityType, variant, subType, position, velocity, spawner, seed)
|
|
440
613
|
if velocity == nil then
|
|
441
614
|
velocity = VectorZero
|
|
@@ -462,6 +635,7 @@ function ____exports.spawnNPC(self, entityType, variant, subType, position, velo
|
|
|
462
635
|
end
|
|
463
636
|
return npc
|
|
464
637
|
end
|
|
638
|
+
--- Helper function to spawn an NPC with a specific seed.
|
|
465
639
|
function ____exports.spawnNPCWithSeed(self, entityType, variant, subType, position, seed, velocity, spawner)
|
|
466
640
|
if velocity == nil then
|
|
467
641
|
velocity = VectorZero
|
|
@@ -480,6 +654,7 @@ function ____exports.spawnNPCWithSeed(self, entityType, variant, subType, positi
|
|
|
480
654
|
seed
|
|
481
655
|
)
|
|
482
656
|
end
|
|
657
|
+
--- Helper function to spawn a `EntityType.PICKUP` (5).
|
|
483
658
|
function ____exports.spawnPickup(self, pickupVariant, subType, position, velocity, spawner, seed)
|
|
484
659
|
if velocity == nil then
|
|
485
660
|
velocity = VectorZero
|
|
@@ -506,6 +681,7 @@ function ____exports.spawnPickup(self, pickupVariant, subType, position, velocit
|
|
|
506
681
|
end
|
|
507
682
|
return pickup
|
|
508
683
|
end
|
|
684
|
+
--- Helper function to spawn a `EntityType.PICKUP` (5) with a specific seed.
|
|
509
685
|
function ____exports.spawnPickupWithSeed(self, pickupVariant, subType, position, seed, velocity, spawner)
|
|
510
686
|
if velocity == nil then
|
|
511
687
|
velocity = VectorZero
|
|
@@ -523,6 +699,7 @@ function ____exports.spawnPickupWithSeed(self, pickupVariant, subType, position,
|
|
|
523
699
|
seed
|
|
524
700
|
)
|
|
525
701
|
end
|
|
702
|
+
--- Helper function to spawn a `EntityType.PROJECTILE` (9).
|
|
526
703
|
function ____exports.spawnProjectile(self, projectileVariant, subType, position, velocity, spawner, seed)
|
|
527
704
|
if velocity == nil then
|
|
528
705
|
velocity = VectorZero
|
|
@@ -549,6 +726,7 @@ function ____exports.spawnProjectile(self, projectileVariant, subType, position,
|
|
|
549
726
|
end
|
|
550
727
|
return projectile
|
|
551
728
|
end
|
|
729
|
+
--- Helper function to spawn a `EntityType.PROJECTILE` (9) with a specific seed.
|
|
552
730
|
function ____exports.spawnProjectileWithSeed(self, projectileVariant, subType, position, seed, velocity, spawner)
|
|
553
731
|
if velocity == nil then
|
|
554
732
|
velocity = VectorZero
|
|
@@ -566,6 +744,7 @@ function ____exports.spawnProjectileWithSeed(self, projectileVariant, subType, p
|
|
|
566
744
|
seed
|
|
567
745
|
)
|
|
568
746
|
end
|
|
747
|
+
--- Helper function to spawn a `EntityType.SLOT` (6).
|
|
569
748
|
function ____exports.spawnSlot(self, slotVariant, subType, position, velocity, spawner, seed)
|
|
570
749
|
if velocity == nil then
|
|
571
750
|
velocity = VectorZero
|
|
@@ -587,6 +766,7 @@ function ____exports.spawnSlot(self, slotVariant, subType, position, velocity, s
|
|
|
587
766
|
seed
|
|
588
767
|
)
|
|
589
768
|
end
|
|
769
|
+
--- Helper function to spawn a `EntityType.SLOT` (6) with a specific seed.
|
|
590
770
|
function ____exports.spawnSlotWithSeed(self, slotVariant, subType, position, seed, velocity, spawner)
|
|
591
771
|
if velocity == nil then
|
|
592
772
|
velocity = VectorZero
|
|
@@ -604,6 +784,7 @@ function ____exports.spawnSlotWithSeed(self, slotVariant, subType, position, see
|
|
|
604
784
|
seed
|
|
605
785
|
)
|
|
606
786
|
end
|
|
787
|
+
--- Helper function to spawn a `EntityType.TEAR` (2).
|
|
607
788
|
function ____exports.spawnTear(self, tearVariant, subType, position, velocity, spawner, seed)
|
|
608
789
|
if velocity == nil then
|
|
609
790
|
velocity = VectorZero
|
|
@@ -630,6 +811,7 @@ function ____exports.spawnTear(self, tearVariant, subType, position, velocity, s
|
|
|
630
811
|
end
|
|
631
812
|
return tear
|
|
632
813
|
end
|
|
814
|
+
--- Helper function to spawn a `EntityType.EntityType` (2) with a specific seed.
|
|
633
815
|
function ____exports.spawnTearWithSeed(self, tearVariant, subType, position, seed, velocity, spawner)
|
|
634
816
|
if velocity == nil then
|
|
635
817
|
velocity = VectorZero
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
2
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
3
3
|
local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
|
|
4
|
+
--- For `EntityType.SLOT` (6)
|
|
4
5
|
function ____exports.isSlot(self, entity)
|
|
5
6
|
return entity.Type == EntityType.SLOT
|
|
6
7
|
end
|