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/pickups.lua
CHANGED
|
@@ -18,52 +18,62 @@ local removeAllPickups = ____entitySpecific.removeAllPickups
|
|
|
18
18
|
local spawnPickup = ____entitySpecific.spawnPickup
|
|
19
19
|
local ____pickupVariants = require("functions.pickupVariants")
|
|
20
20
|
local isHeart = ____pickupVariants.isHeart
|
|
21
|
+
--- Helper function to get all of the battery entities in the room.
|
|
21
22
|
function ____exports.getBatteries(self, matchingSubType)
|
|
22
23
|
if matchingSubType == nil then
|
|
23
24
|
matchingSubType = -1
|
|
24
25
|
end
|
|
25
26
|
return getPickups(nil, PickupVariant.LIL_BATTERY, matchingSubType)
|
|
26
27
|
end
|
|
28
|
+
--- Helper function to get all of the card entities in the room.
|
|
27
29
|
function ____exports.getCards(self, matchingSubType)
|
|
28
30
|
if matchingSubType == nil then
|
|
29
31
|
matchingSubType = -1
|
|
30
32
|
end
|
|
31
33
|
return getPickups(nil, PickupVariant.TAROT_CARD, matchingSubType)
|
|
32
34
|
end
|
|
35
|
+
--- Helper function to get the corresponding coin amount from a `CoinSubType`. Returns 1 for modded
|
|
36
|
+
-- sub-types.
|
|
33
37
|
function ____exports.getCoinValue(self, coinSubType)
|
|
34
38
|
local value = COIN_SUBTYPE_TO_VALUE[coinSubType]
|
|
35
39
|
return value == nil and DEFAULT_COIN_VALUE or value
|
|
36
40
|
end
|
|
41
|
+
--- Helper function to get all of the coin pickup entities in the room.
|
|
37
42
|
function ____exports.getCoins(self, matchingSubType)
|
|
38
43
|
if matchingSubType == nil then
|
|
39
44
|
matchingSubType = -1
|
|
40
45
|
end
|
|
41
46
|
return getPickups(nil, PickupVariant.COIN, matchingSubType)
|
|
42
47
|
end
|
|
48
|
+
--- Helper function to get all of the collectible entities in the room.
|
|
43
49
|
function ____exports.getCollectibles(self, matchingSubType)
|
|
44
50
|
if matchingSubType == nil then
|
|
45
51
|
matchingSubType = -1
|
|
46
52
|
end
|
|
47
53
|
return getPickups(nil, PickupVariant.COLLECTIBLE, matchingSubType)
|
|
48
54
|
end
|
|
55
|
+
--- Helper function to get all of the heart pickup entities in the room.
|
|
49
56
|
function ____exports.getHearts(self, matchingSubType)
|
|
50
57
|
if matchingSubType == nil then
|
|
51
58
|
matchingSubType = -1
|
|
52
59
|
end
|
|
53
60
|
return getPickups(nil, PickupVariant.HEART, matchingSubType)
|
|
54
61
|
end
|
|
62
|
+
--- Helper function to get all of the key pickup entities in the room.
|
|
55
63
|
function ____exports.getKeys(self, matchingSubType)
|
|
56
64
|
if matchingSubType == nil then
|
|
57
65
|
matchingSubType = -1
|
|
58
66
|
end
|
|
59
67
|
return getPickups(nil, PickupVariant.KEY, matchingSubType)
|
|
60
68
|
end
|
|
69
|
+
--- Helper function to get all of the pill entities in the room.
|
|
61
70
|
function ____exports.getPills(self, matchingSubType)
|
|
62
71
|
if matchingSubType == nil then
|
|
63
72
|
matchingSubType = -1
|
|
64
73
|
end
|
|
65
74
|
return getPickups(nil, PickupVariant.PILL, matchingSubType)
|
|
66
75
|
end
|
|
76
|
+
--- Helper function to get all of the red heart pickup entities in the room.
|
|
67
77
|
function ____exports.getRedHearts(self)
|
|
68
78
|
local hearts = ____exports.getHearts(nil)
|
|
69
79
|
return __TS__ArrayFilter(
|
|
@@ -71,12 +81,14 @@ function ____exports.getRedHearts(self)
|
|
|
71
81
|
function(____, heart) return RED_HEART_SUB_TYPES_SET:has(heart.SubType) end
|
|
72
82
|
)
|
|
73
83
|
end
|
|
84
|
+
--- Helper function to get all of the sack (i.e. grab bag) entities in the room.
|
|
74
85
|
function ____exports.getSacks(self, matchingSubType)
|
|
75
86
|
if matchingSubType == nil then
|
|
76
87
|
matchingSubType = -1
|
|
77
88
|
end
|
|
78
89
|
return getPickups(nil, PickupVariant.SACK, matchingSubType)
|
|
79
90
|
end
|
|
91
|
+
--- Helper function to get all of the trinket entities in the room.
|
|
80
92
|
function ____exports.getTrinkets(self, matchingSubType)
|
|
81
93
|
if matchingSubType == nil then
|
|
82
94
|
matchingSubType = -1
|
|
@@ -89,33 +101,81 @@ end
|
|
|
89
101
|
function ____exports.isRedHeart(self, pickup)
|
|
90
102
|
return isHeart(nil, pickup) and RED_HEART_SUB_TYPES_SET:has(pickup.SubType)
|
|
91
103
|
end
|
|
104
|
+
--- Helper function to remove all of the batteries in the room.
|
|
105
|
+
--
|
|
106
|
+
-- @param batterySubType Optional. If specified, will only remove cards that match this sub-type.
|
|
107
|
+
-- @param cap Optional. If specified, will only remove the given amount of cards.
|
|
108
|
+
-- @returns True if one or more cards were removed, false otherwise.
|
|
92
109
|
function ____exports.removeAllBatteries(self, batterySubType, cap)
|
|
93
110
|
return removeAllPickups(nil, PickupVariant.LIL_BATTERY, batterySubType, cap)
|
|
94
111
|
end
|
|
112
|
+
--- Helper function to remove all of the cards in the room.
|
|
113
|
+
--
|
|
114
|
+
-- @param card Optional. If specified, will only remove cards that match this sub-type.
|
|
115
|
+
-- @param cap Optional. If specified, will only remove the given amount of cards.
|
|
116
|
+
-- @returns True if one or more cards were removed, false otherwise.
|
|
95
117
|
function ____exports.removeAllCards(self, card, cap)
|
|
96
118
|
return removeAllPickups(nil, PickupVariant.TAROT_CARD, card, cap)
|
|
97
119
|
end
|
|
120
|
+
--- Helper function to remove all of the coins in the room.
|
|
121
|
+
--
|
|
122
|
+
-- @param coinSubType Optional. If specified, will only remove coins that match this sub-type.
|
|
123
|
+
-- @param cap Optional. If specified, will only remove the given amount of coins.
|
|
124
|
+
-- @returns True if one or more coins were removed, false otherwise.
|
|
98
125
|
function ____exports.removeAllCoins(self, coinSubType, cap)
|
|
99
126
|
return removeAllPickups(nil, PickupVariant.COIN, coinSubType, cap)
|
|
100
127
|
end
|
|
128
|
+
--- Helper function to remove all of the collectibles in the room.
|
|
129
|
+
--
|
|
130
|
+
-- @param collectibleType Optional. If specified, will only remove collectibles that match this
|
|
131
|
+
-- collectible type.
|
|
132
|
+
-- @param cap Optional. If specified, will only remove the given amount of collectibles.
|
|
133
|
+
-- @returns True if one or more collectibles were removed, false otherwise.
|
|
101
134
|
function ____exports.removeAllCollectibles(self, collectibleType, cap)
|
|
102
135
|
return removeAllPickups(nil, PickupVariant.COLLECTIBLE, collectibleType, cap)
|
|
103
136
|
end
|
|
137
|
+
--- Helper function to remove all of the hearts in the room.
|
|
138
|
+
--
|
|
139
|
+
-- @param heartSubType Optional. If specified, will only remove hearts that match this sub-type.
|
|
140
|
+
-- @param cap Optional. If specified, will only remove the given amount of hearts.
|
|
141
|
+
-- @returns True if one or more hearts were removed, false otherwise.
|
|
104
142
|
function ____exports.removeAllHearts(self, heartSubType, cap)
|
|
105
143
|
return removeAllPickups(nil, PickupVariant.HEART, heartSubType, cap)
|
|
106
144
|
end
|
|
145
|
+
--- Helper function to remove all of the keys in the room.
|
|
146
|
+
--
|
|
147
|
+
-- @param keySubType Optional. If specified, will only remove keys that match this sub-type.
|
|
148
|
+
-- @param cap Optional. If specified, will only remove the given amount of keys.
|
|
149
|
+
-- @returns True if one or more keys were removed, false otherwise.
|
|
107
150
|
function ____exports.removeAllKeys(self, keySubType, cap)
|
|
108
151
|
return removeAllPickups(nil, PickupVariant.KEY, keySubType, cap)
|
|
109
152
|
end
|
|
153
|
+
--- Helper function to remove all of the pills in the room.
|
|
154
|
+
--
|
|
155
|
+
-- @param pillColor Optional. If specified, will only remove pills that match this color.
|
|
156
|
+
-- @param cap Optional. If specified, will only remove the given amount of pills.
|
|
157
|
+
-- @returns True if one or more pills were removed, false otherwise.
|
|
110
158
|
function ____exports.removeAllPills(self, pillColor, cap)
|
|
111
159
|
return removeAllPickups(nil, PickupVariant.PILL, pillColor, cap)
|
|
112
160
|
end
|
|
161
|
+
--- Helper function to remove all of the sacks (i.e. grab bags) in the room.
|
|
162
|
+
--
|
|
163
|
+
-- @param sackSubType Optional. If specified, will only remove sacks that match this sub-type.
|
|
164
|
+
-- @param cap Optional. If specified, will only remove the given amount of trinkets.
|
|
165
|
+
-- @returns True if one or more trinkets were removed, false otherwise.
|
|
113
166
|
function ____exports.removeAllSacks(self, sackSubType, cap)
|
|
114
167
|
return removeAllPickups(nil, PickupVariant.TRINKET, sackSubType, cap)
|
|
115
168
|
end
|
|
169
|
+
--- Helper function to remove all of the trinkets in the room.
|
|
170
|
+
--
|
|
171
|
+
-- @param trinketType Optional. If specified, will only remove trinkets that match this trinket
|
|
172
|
+
-- type.
|
|
173
|
+
-- @param cap Optional. If specified, will only remove the given amount of trinkets.
|
|
174
|
+
-- @returns True if one or more trinkets were removed, false otherwise.
|
|
116
175
|
function ____exports.removeAllTrinkets(self, trinketType, cap)
|
|
117
176
|
return removeAllPickups(nil, PickupVariant.TRINKET, trinketType, cap)
|
|
118
177
|
end
|
|
178
|
+
--- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.LIL_BATTERY` (90).
|
|
119
179
|
function ____exports.spawnBattery(self, subType, position, velocity, spawner, seed)
|
|
120
180
|
if velocity == nil then
|
|
121
181
|
velocity = VectorZero
|
|
@@ -152,6 +212,7 @@ function ____exports.spawnBatteryWithSeed(self, subType, position, seed, velocit
|
|
|
152
212
|
seed
|
|
153
213
|
)
|
|
154
214
|
end
|
|
215
|
+
--- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.TAROT_CARD` (300).
|
|
155
216
|
function ____exports.spawnCard(self, subType, position, velocity, spawner, seed)
|
|
156
217
|
if velocity == nil then
|
|
157
218
|
velocity = VectorZero
|
|
@@ -188,6 +249,7 @@ function ____exports.spawnCardWithSeed(self, subType, position, seed, velocity,
|
|
|
188
249
|
seed
|
|
189
250
|
)
|
|
190
251
|
end
|
|
252
|
+
--- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.COIN` (20).
|
|
191
253
|
function ____exports.spawnCoin(self, subType, position, velocity, spawner, seed)
|
|
192
254
|
if velocity == nil then
|
|
193
255
|
velocity = VectorZero
|
|
@@ -224,6 +286,7 @@ function ____exports.spawnCoinWithSeed(self, subType, position, seed, velocity,
|
|
|
224
286
|
seed
|
|
225
287
|
)
|
|
226
288
|
end
|
|
289
|
+
--- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.HEART` (10).
|
|
227
290
|
function ____exports.spawnHeart(self, subType, position, velocity, spawner, seed)
|
|
228
291
|
if velocity == nil then
|
|
229
292
|
velocity = VectorZero
|
|
@@ -260,6 +323,7 @@ function ____exports.spawnHeartWithSeed(self, subType, position, seed, velocity,
|
|
|
260
323
|
seed
|
|
261
324
|
)
|
|
262
325
|
end
|
|
326
|
+
--- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.KEY` (30).
|
|
263
327
|
function ____exports.spawnKey(self, subType, position, velocity, spawner, seed)
|
|
264
328
|
if velocity == nil then
|
|
265
329
|
velocity = VectorZero
|
|
@@ -296,6 +360,7 @@ function ____exports.spawnKeyWithSeed(self, subType, position, seed, velocity, s
|
|
|
296
360
|
seed
|
|
297
361
|
)
|
|
298
362
|
end
|
|
363
|
+
--- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.PILL` (70).
|
|
299
364
|
function ____exports.spawnPill(self, pillColor, position, velocity, spawner, seed)
|
|
300
365
|
if velocity == nil then
|
|
301
366
|
velocity = VectorZero
|
|
@@ -332,6 +397,7 @@ function ____exports.spawnPillWithSeed(self, subType, position, seed, velocity,
|
|
|
332
397
|
seed
|
|
333
398
|
)
|
|
334
399
|
end
|
|
400
|
+
--- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.SACK` (69).
|
|
335
401
|
function ____exports.spawnSack(self, subType, position, velocity, spawner, seed)
|
|
336
402
|
if velocity == nil then
|
|
337
403
|
velocity = VectorZero
|
|
@@ -368,6 +434,7 @@ function ____exports.spawnSackWithSeed(self, subType, position, seed, velocity,
|
|
|
368
434
|
seed
|
|
369
435
|
)
|
|
370
436
|
end
|
|
437
|
+
--- Helper function to spawn a `EntityType.PICKUP` (5) with variant `PickupVariant.TRINKET` (350).
|
|
371
438
|
function ____exports.spawnTrinket(self, subType, position, velocity, spawner, seed)
|
|
372
439
|
if velocity == nil then
|
|
373
440
|
velocity = VectorZero
|
package/functions/pills.lua
CHANGED
|
@@ -27,38 +27,75 @@ local ____enums = require("functions.enums")
|
|
|
27
27
|
local getEnumValues = ____enums.getEnumValues
|
|
28
28
|
local ____utils = require("functions.utils")
|
|
29
29
|
local irange = ____utils.irange
|
|
30
|
+
--- Add this to a `PillColor` to get the corresponding giant pill color.
|
|
31
|
+
--
|
|
32
|
+
-- Corresponds to the vanilla `PillColor.GIANT_FLAG` value.
|
|
33
|
+
--
|
|
34
|
+
-- 1 << 11
|
|
30
35
|
local HORSE_PILL_ADJUSTMENT = 2048
|
|
36
|
+
--- Helper function to get an array with every non-null pill color. This includes all gold colors and
|
|
37
|
+
-- all horse colors.
|
|
31
38
|
function ____exports.getAllPillColors(self)
|
|
32
39
|
local pillColors = getEnumValues(nil, PillColor)
|
|
33
40
|
__TS__ArraySlice(pillColors)
|
|
34
41
|
return pillColors
|
|
35
42
|
end
|
|
43
|
+
--- Helper function to get an array with every valid pill effect. This includes modded pill effects.
|
|
36
44
|
function ____exports.getAllPillEffects(self)
|
|
37
45
|
return irange(nil, FIRST_PILL_EFFECT, LAST_PILL_EFFECT)
|
|
38
46
|
end
|
|
47
|
+
--- Helper function to get the corresponding horse pill color from a normal pill color.
|
|
48
|
+
--
|
|
49
|
+
-- For example, passing `PillColor.BLUE_BLUE` would result in 2049, which is the value that
|
|
50
|
+
-- corresponds to the horse pill color for blue/blue.
|
|
39
51
|
function ____exports.getHorsePillColor(self, pillColor)
|
|
40
52
|
return pillColor + HORSE_PILL_ADJUSTMENT
|
|
41
53
|
end
|
|
54
|
+
--- Helper function to get an array with every non-gold horse pill color.
|
|
42
55
|
function ____exports.getHorsePillColors(self)
|
|
43
56
|
return irange(nil, FIRST_HORSE_PILL_COLOR, LAST_HORSE_PILL_COLOR)
|
|
44
57
|
end
|
|
58
|
+
--- Helper function to get an array with every modded pill effect.
|
|
59
|
+
--
|
|
60
|
+
-- Returns an empty array if there are no modded pill effects.
|
|
45
61
|
function ____exports.getModdedPillEffects(self)
|
|
46
62
|
if LAST_VANILLA_PILL_EFFECT == LAST_PILL_EFFECT then
|
|
47
63
|
return {}
|
|
48
64
|
end
|
|
49
65
|
return irange(nil, FIRST_MODDED_PILL_EFFECT, LAST_PILL_EFFECT)
|
|
50
66
|
end
|
|
67
|
+
--- Helper function to get the corresponding normal pill color from a horse pill color.
|
|
68
|
+
--
|
|
69
|
+
-- For example, passing 2049 would result in `PillColor.BLUE_BLUE`.
|
|
70
|
+
--
|
|
71
|
+
-- If called with a non-horse pill color, this function will return back the same color.
|
|
51
72
|
function ____exports.getNormalPillColorFromHorse(self, pillColor)
|
|
52
73
|
local normalPillColor = pillColor - HORSE_PILL_ADJUSTMENT
|
|
53
74
|
return normalPillColor > PillColor.NULL and normalPillColor or pillColor
|
|
54
75
|
end
|
|
76
|
+
--- Helper function to get an array with every non-gold and non-horse pill color.
|
|
55
77
|
function ____exports.getNormalPillColors(self)
|
|
56
78
|
return irange(nil, FIRST_PILL_COLOR, LAST_NORMAL_PILL_COLOR)
|
|
57
79
|
end
|
|
80
|
+
--- Helper function to get a pill effect class from a PillEffect enum value. In this context, the
|
|
81
|
+
-- class is equal to the numerical prefix in the "class" tag in the "pocketitems.xml" file. Use the
|
|
82
|
+
-- `getPillEffectType` helper function to determine whether or not the pill effect is positive,
|
|
83
|
+
-- negative, or neutral.
|
|
84
|
+
--
|
|
85
|
+
-- Due to limitations in the API, this function will not work properly for modded pill effects, and
|
|
86
|
+
-- will always return `DEFAULT_PILL_EFFECT_CLASS` in those cases.
|
|
58
87
|
function ____exports.getPillEffectClass(self, pillEffect)
|
|
59
88
|
local pillEffectClass = PILL_EFFECT_CLASSES[pillEffect]
|
|
60
89
|
return pillEffectClass == nil and DEFAULT_PILL_EFFECT_CLASS or pillEffectClass
|
|
61
90
|
end
|
|
91
|
+
--- Helper function to get a pill effect name from a PillEffect enum value.
|
|
92
|
+
--
|
|
93
|
+
-- For example:
|
|
94
|
+
--
|
|
95
|
+
-- ```ts
|
|
96
|
+
-- const pillEffect = PillEffect.BAD_GAS;
|
|
97
|
+
-- const pillEffectName = getPillEffectName(pillEffect); // trinketName is "Bad Gas"
|
|
98
|
+
-- ```
|
|
62
99
|
function ____exports.getPillEffectName(self, pillEffect)
|
|
63
100
|
local pillEffectName = PILL_EFFECT_NAMES[pillEffect]
|
|
64
101
|
if pillEffectName ~= nil and pillEffectName ~= DEFAULT_PILL_EFFECT_NAME then
|
|
@@ -70,10 +107,18 @@ function ____exports.getPillEffectName(self, pillEffect)
|
|
|
70
107
|
end
|
|
71
108
|
return DEFAULT_PILL_EFFECT_NAME
|
|
72
109
|
end
|
|
110
|
+
--- Helper function to get a pill effect type from a PillEffect enum value. In this context, the type
|
|
111
|
+
-- is equal to positive, negative, or neutral. This is derived from the suffix of the the "class"
|
|
112
|
+
-- tag in the "pocketitems.xml" file. Use the `getPillEffectClass` helper function to determine the
|
|
113
|
+
-- "power" of the pill.
|
|
114
|
+
--
|
|
115
|
+
-- Due to limitations in the API, this function will not work properly for modded pill effects, and
|
|
116
|
+
-- will always return `DEFAULT_PILL_EFFECT_TYPE` in those cases.
|
|
73
117
|
function ____exports.getPillEffectType(self, pillEffect)
|
|
74
118
|
local pillEffectClass = PILL_EFFECT_TYPES[pillEffect]
|
|
75
119
|
return pillEffectClass == nil and DEFAULT_PILL_EFFECT_TYPE or pillEffectClass
|
|
76
120
|
end
|
|
121
|
+
--- Helper function to get an array with every vanilla pill effect.
|
|
77
122
|
function ____exports.getVanillaPillEffects(self)
|
|
78
123
|
return irange(nil, FIRST_PILL_EFFECT, LAST_VANILLA_PILL_EFFECT)
|
|
79
124
|
end
|
package/functions/player.d.ts
CHANGED
|
@@ -100,6 +100,8 @@ export declare function getPlayerCollectibleCount(player: EntityPlayer, ...colle
|
|
|
100
100
|
* the player has.
|
|
101
101
|
*/
|
|
102
102
|
export declare function getPlayerCollectibleMap(player: EntityPlayer): Map<CollectibleType, int>;
|
|
103
|
+
/** Helper function to get the player from a tear, laser, bomb, etc. */
|
|
104
|
+
export declare function getPlayerFromTear(entity: Entity): EntityPlayer | undefined;
|
|
103
105
|
/**
|
|
104
106
|
* Returns the number of red hearts that the player has, excluding any rotten hearts. For example,
|
|
105
107
|
* if the player has one full black heart, one full soul heart, and one half black heart, this
|
|
@@ -207,6 +209,11 @@ export declare function isBethany(player: EntityPlayer): boolean;
|
|
|
207
209
|
* for. Returns true if the player is any of the supplied characters.
|
|
208
210
|
*/
|
|
209
211
|
export declare function isCharacter(player: EntityPlayer, ...characters: PlayerType[]): boolean;
|
|
212
|
+
/**
|
|
213
|
+
* Helper function to see if a damage source is from a player. Use this instead of comparing to the
|
|
214
|
+
* entity directly because it takes familiars into account.
|
|
215
|
+
*/
|
|
216
|
+
export declare function isDamageFromPlayer(damageSource: Entity): boolean;
|
|
210
217
|
/**
|
|
211
218
|
* Helper function for detecting when a player is Eden or Tainted Eden. Useful for situations where
|
|
212
219
|
* you want to know if the starting stats were randomized, for example.
|