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/constantsFirstLast.lua
CHANGED
|
@@ -11,40 +11,103 @@ local itemConfig = ____cachedClasses.itemConfig
|
|
|
11
11
|
local ____enums = require("functions.enums")
|
|
12
12
|
local getEnumLength = ____enums.getEnumLength
|
|
13
13
|
local getLastEnumValue = ____enums.getLastEnumValue
|
|
14
|
+
--- Equal to `CollectibleType.SAD_ONION`.
|
|
14
15
|
____exports.FIRST_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION
|
|
16
|
+
--- Will change depending on how many modded collectibles there are.
|
|
17
|
+
--
|
|
18
|
+
-- Equal to `itemConfig.GetCollectibles().Size - 1`. (`Size` includes invalid collectibles. We
|
|
19
|
+
-- subtract one to account for `CollectibleType.NULL`.)
|
|
15
20
|
____exports.LAST_COLLECTIBLE_TYPE = itemConfig:GetCollectibles().Size - 1
|
|
21
|
+
--- Calculated from the `CollectibleType` enum.
|
|
22
|
+
--
|
|
23
|
+
-- Note that this cannot be calculated from the length of the enum, because unlike all of the other
|
|
24
|
+
-- enums, collectible types are not contiguous.
|
|
16
25
|
____exports.LAST_VANILLA_COLLECTIBLE_TYPE = getLastEnumValue(nil, CollectibleType)
|
|
26
|
+
--- If there are no modded collectibles, this constant will represent a collectible type that does
|
|
27
|
+
-- not exist.
|
|
17
28
|
____exports.FIRST_MODDED_COLLECTIBLE_TYPE = ____exports.LAST_VANILLA_COLLECTIBLE_TYPE + 1
|
|
29
|
+
--- Calculated from the `CollectibleType` enum. `CollectibleType.NULL` is not included.
|
|
18
30
|
____exports.NUM_VANILLA_COLLECTIBLE_TYPES = getEnumLength(nil, CollectibleType) - 1
|
|
31
|
+
--- Unlike vanilla collectible types, modded collectible types are always contiguous.
|
|
19
32
|
____exports.NUM_MODDED_COLLECTIBLE_TYPES = ____exports.LAST_COLLECTIBLE_TYPE - ____exports.LAST_VANILLA_COLLECTIBLE_TYPE
|
|
20
33
|
____exports.NUM_COLLECTIBLE_TYPES = ____exports.NUM_VANILLA_COLLECTIBLE_TYPES + ____exports.NUM_MODDED_COLLECTIBLE_TYPES
|
|
34
|
+
--- Will change depending on how many modded cards there are.
|
|
35
|
+
--
|
|
36
|
+
-- Equal to `itemConfig.GetTrinkets().Size - 1`. (We subtract one to account for
|
|
37
|
+
-- `TrinketType.NULL`.)
|
|
21
38
|
____exports.NUM_TRINKET_TYPES = itemConfig:GetTrinkets().Size - 1
|
|
39
|
+
--- Calculated from the `TrinketType` enum. `TrinketType.NULL` is not included.
|
|
22
40
|
____exports.NUM_VANILLA_TRINKET_TYPES = getEnumLength(nil, TrinketType) - 1
|
|
23
41
|
____exports.NUM_MODDED_TRINKET_TYPES = ____exports.NUM_TRINKET_TYPES - ____exports.NUM_VANILLA_TRINKET_TYPES
|
|
42
|
+
--- Equal to `TrinketType.SWALLOWED_PENNY`.
|
|
24
43
|
____exports.FIRST_TRINKET_TYPE = TrinketType.SWALLOWED_PENNY
|
|
44
|
+
--- Will change depending on how many modded cards there are.
|
|
45
|
+
--
|
|
46
|
+
-- Equal to `itemConfig.GetTrinkets().Size - 1`. (We subtract one to account for
|
|
47
|
+
-- `TrinketType.NULL`.)
|
|
25
48
|
____exports.LAST_TRINKET_TYPE = ____exports.NUM_TRINKET_TYPES
|
|
49
|
+
--- Calculated from the `TrinketType` enum.
|
|
26
50
|
____exports.LAST_VANILLA_TRINKET_TYPE = getLastEnumValue(nil, TrinketType)
|
|
51
|
+
--- If there are no modded trinkets, this constant will represent a trinket type that does not exist.
|
|
27
52
|
____exports.FIRST_MODDED_TRINKET_TYPE = ____exports.LAST_VANILLA_TRINKET_TYPE + 1
|
|
53
|
+
--- Will change depending on how many modded cards there are.
|
|
54
|
+
--
|
|
55
|
+
-- Equal to `itemConfig.GetCards().Size - 1`. (We subtract one to account for `Card.NULL`.)
|
|
28
56
|
____exports.NUM_CARDS = itemConfig:GetCards().Size - 1
|
|
57
|
+
--- Calculated from the `Card` enum. `Card.NULL` is not included.
|
|
29
58
|
____exports.NUM_VANILLA_CARDS = getEnumLength(nil, Card) - 1
|
|
30
59
|
____exports.NUM_MODDED_CARDS = ____exports.NUM_CARDS - ____exports.NUM_VANILLA_CARDS
|
|
60
|
+
--- Equal to `Card.FOOL`.
|
|
31
61
|
____exports.FIRST_CARD = Card.FOOL
|
|
62
|
+
--- Will change depending on how many modded cards there are.
|
|
63
|
+
--
|
|
64
|
+
-- Equal to `itemConfig.GetCards().Size - 1`. (We subtract one to account for `Card.NULL`.)
|
|
32
65
|
____exports.LAST_CARD = ____exports.NUM_CARDS
|
|
66
|
+
--- Calculated from the `Card` enum.
|
|
33
67
|
____exports.MAX_VANILLA_CARD = getLastEnumValue(nil, Card)
|
|
68
|
+
--- If there are no modded cards, this constant will represent a card that does not exist.
|
|
34
69
|
____exports.FIRST_MODDED_CARD = ____exports.MAX_VANILLA_CARD + 1
|
|
70
|
+
--- Will change depending on how many modded pill effects there are.
|
|
71
|
+
--
|
|
72
|
+
-- Equal to `itemConfig.GetPillEffects().Size - 1`. (We subtract one to account for
|
|
73
|
+
-- `PillEffect.NULL`.)
|
|
35
74
|
____exports.NUM_PILL_EFFECTS = itemConfig:GetPillEffects().Size - 1
|
|
75
|
+
--- Calculated from the `PillEffect` enum.
|
|
76
|
+
--
|
|
77
|
+
-- (There is no `PillEffect.NULL` in the custom enum, so we don't have to subtract one here.)
|
|
36
78
|
____exports.NUM_VANILLA_PILL_EFFECTS = getEnumLength(nil, PillEffect)
|
|
37
79
|
____exports.NUM_MODDED_PILL_EFFECTS = ____exports.NUM_PILL_EFFECTS - ____exports.NUM_VANILLA_PILL_EFFECTS
|
|
80
|
+
--- Equal to `PillEffect.BAD_GAS`.
|
|
38
81
|
____exports.FIRST_PILL_EFFECT = PillEffect.BAD_GAS
|
|
82
|
+
--- Will change depending on how many modded pill effects there are.
|
|
83
|
+
--
|
|
84
|
+
-- Equal to `itemConfig.GetPillEffects().Size - 1`. (We subtract one to account for
|
|
85
|
+
-- `PillEffect.NULL`.)
|
|
39
86
|
____exports.LAST_PILL_EFFECT = ____exports.NUM_PILL_EFFECTS
|
|
87
|
+
--- Calculated from the `PillEffect` enum.
|
|
40
88
|
____exports.LAST_VANILLA_PILL_EFFECT = getLastEnumValue(nil, PillEffect)
|
|
89
|
+
--- If there are no modded pill effects, this constant will represent a pill effect that does not
|
|
90
|
+
-- exist.
|
|
41
91
|
____exports.FIRST_MODDED_PILL_EFFECT = ____exports.LAST_VANILLA_PILL_EFFECT + 1
|
|
92
|
+
--- Equal to `PillColor.BLUE_BLUE`.
|
|
42
93
|
____exports.FIRST_PILL_COLOR = PillColor.BLUE_BLUE
|
|
94
|
+
--- Equal to `PillColor.WHITE_YELLOW`.
|
|
95
|
+
--
|
|
96
|
+
-- Note that `PillColor.GOLD` is technically higher, but that is not considered for the purposes of
|
|
97
|
+
-- this constant.
|
|
43
98
|
____exports.LAST_NORMAL_PILL_COLOR = PillColor.WHITE_YELLOW
|
|
99
|
+
--- Equal to `PillColor.HORSE_BLUE_BLUE`.
|
|
44
100
|
____exports.FIRST_HORSE_PILL_COLOR = PillColor.HORSE_BLUE_BLUE
|
|
101
|
+
--- Equal to `PillColor.HORSE_WHITE_YELLOW`.
|
|
102
|
+
--
|
|
103
|
+
-- Note that `PillColor.HORSE_GOLD` is technically higher, but that is not considered for the
|
|
104
|
+
-- purposes of this constant.
|
|
45
105
|
____exports.LAST_HORSE_PILL_COLOR = PillColor.HORSE_WHITE_YELLOW
|
|
46
106
|
____exports.NUM_NORMAL_PILL_COLORS = ____exports.LAST_NORMAL_PILL_COLOR - ____exports.FIRST_PILL_COLOR
|
|
107
|
+
--- Equal to `PlayerType.ISAAC`.
|
|
47
108
|
____exports.FIRST_CHARACTER = PlayerType.ISAAC
|
|
109
|
+
--- Calculated from the `PlayerType` enum.
|
|
48
110
|
____exports.LAST_VANILLA_CHARACTER = getLastEnumValue(nil, PlayerType)
|
|
111
|
+
--- If there are no modded characters, this constant will represent a character that does not exist.
|
|
49
112
|
____exports.FIRST_MODDED_CHARACTER = ____exports.LAST_VANILLA_CHARACTER + 1
|
|
50
113
|
return ____exports
|
package/enums/HealthType.lua
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
|
+
--- This represents the type of health that is either given or taken away from a player. Note that we
|
|
3
|
+
-- cannot use the `HeartSubType` enum for this purpose this since it has no value for broken hearts
|
|
4
|
+
-- or max hearts.
|
|
2
5
|
____exports.HealthType = {}
|
|
3
6
|
____exports.HealthType.RED = 0
|
|
4
7
|
____exports.HealthType[____exports.HealthType.RED] = "RED"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* - The Isaac API offers a lot of callbacks, but a lot of times there isn't one for the specific
|
|
3
3
|
* thing that you are looking to do. So, `isaacscript-common` adds a bunch of new callbacks that
|
|
4
4
|
* you can use.
|
|
5
|
-
* - The extra callbacks are efficient such that no code is
|
|
5
|
+
* - The extra callbacks are efficient such that no code is executed until there is one or more
|
|
6
6
|
* subscriptions.
|
|
7
7
|
* - You must upgrade your mod with the `upgradeMod` helper function before using a custom callback.
|
|
8
8
|
*/
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
|
+
--- - The Isaac API offers a lot of callbacks, but a lot of times there isn't one for the specific
|
|
3
|
+
-- thing that you are looking to do. So, `isaacscript-common` adds a bunch of new callbacks that
|
|
4
|
+
-- you can use.
|
|
5
|
+
-- - The extra callbacks are efficient such that no code is executed until there is one or more
|
|
6
|
+
-- subscriptions.
|
|
7
|
+
-- - You must upgrade your mod with the `upgradeMod` helper function before using a custom callback.
|
|
2
8
|
____exports.ModCallbackCustom = {}
|
|
3
9
|
____exports.ModCallbackCustom.POST_BOMB_INIT_LATE = 0
|
|
4
10
|
____exports.ModCallbackCustom[____exports.ModCallbackCustom.POST_BOMB_INIT_LATE] = "POST_BOMB_INIT_LATE"
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
|
+
--- During serialization, we write an arbitrary string key to the object with a value of an empty
|
|
3
|
+
-- string. This is used during deserialization to instantiate the correct type of object.
|
|
4
|
+
--
|
|
5
|
+
-- Note that we do not bother branding TSTL classes because we have no way to invoke the proper
|
|
6
|
+
-- constructor during deserialization.
|
|
2
7
|
____exports.SerializationBrand = {}
|
|
3
8
|
____exports.SerializationBrand.DEFAULT_MAP = "__TSTL_DEFAULT_MAP"
|
|
4
9
|
____exports.SerializationBrand.MAP = "__TSTL_MAP"
|
|
@@ -74,10 +74,16 @@ function prePickupCollisionHeart(self, pickup, collider)
|
|
|
74
74
|
end
|
|
75
75
|
local FEATURE_NAME = "character health manager"
|
|
76
76
|
characterHealthReplacementMap = __TS__New(Map)
|
|
77
|
+
---
|
|
78
|
+
-- @internal
|
|
77
79
|
function ____exports.characterHealthConversionInit(self, mod)
|
|
78
80
|
mod:AddCallback(ModCallback.POST_PEFFECT_UPDATE, postPEffectUpdate)
|
|
79
81
|
mod:AddCallback(ModCallback.PRE_PICKUP_COLLISION, prePickupCollisionHeart, PickupVariant.HEART)
|
|
80
82
|
end
|
|
83
|
+
--- Helper function to make a character that has the same health mechanic as Blue Baby (red heart
|
|
84
|
+
-- containers --> soul hearts) or Dark Judas (red heart containers --> black hearts).
|
|
85
|
+
--
|
|
86
|
+
-- Call this function once at the beginning of your mod to declare the health conversion type.
|
|
81
87
|
function ____exports.registerCharacterHealthConversion(self, playerType, conversionHeartSubType)
|
|
82
88
|
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
83
89
|
characterHealthReplacementMap:set(playerType, conversionHeartSubType)
|
|
@@ -27,9 +27,26 @@ function evaluateCache(self, player, cacheFlag)
|
|
|
27
27
|
end
|
|
28
28
|
local FEATURE_NAME = "character stat manager"
|
|
29
29
|
charactersStatMap = __TS__New(Map)
|
|
30
|
+
---
|
|
31
|
+
-- @internal
|
|
30
32
|
function ____exports.characterStatsInit(self, mod)
|
|
31
33
|
mod:AddCallback(ModCallback.EVALUATE_CACHE, evaluateCache)
|
|
32
34
|
end
|
|
35
|
+
--- Helper function to manage the stats for a vanilla or custom character. Call this function once at
|
|
36
|
+
-- the beginning of your mod to declare the starting stats.
|
|
37
|
+
--
|
|
38
|
+
-- You must provide this function with a map of CacheFlag to the default stat amount. For example,
|
|
39
|
+
-- the default amount of damage is 3.5. To make a custom character start with 4.5 damage:
|
|
40
|
+
--
|
|
41
|
+
-- ```ts
|
|
42
|
+
-- const fooDefaultStats = new Map<CacheFlag, number>([
|
|
43
|
+
-- [CacheFlag.DAMAGE, 4.5],
|
|
44
|
+
-- ])
|
|
45
|
+
-- registerCharacterStats(PlayerTypeCustom.FOO, fooDefaultStats);
|
|
46
|
+
-- ```
|
|
47
|
+
--
|
|
48
|
+
-- Note that the format for the `CacheFlag.FIRE_DELAY` value should be in the tears stat format, not
|
|
49
|
+
-- the `MaxFireDelay` format.
|
|
33
50
|
function ____exports.registerCharacterStats(self, playerType, statMap)
|
|
34
51
|
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
35
52
|
charactersStatMap:set(playerType, statMap)
|
|
@@ -4,128 +4,218 @@ local printEnabled = ____utils.printEnabled
|
|
|
4
4
|
local ____v = require("features.debugDisplay.v")
|
|
5
5
|
local v = ____v.default
|
|
6
6
|
local debugDisplayTextCallbacks = ____v.debugDisplayTextCallbacks
|
|
7
|
+
--- After using the "playerDisplay" console command, text will be drawn on each player for debugging
|
|
8
|
+
-- purposes. Use this function to specify a callback function that will returns the string that
|
|
9
|
+
-- should be drawn.
|
|
7
10
|
function ____exports.setPlayerDisplay(self, textCallback)
|
|
8
11
|
debugDisplayTextCallbacks.player = textCallback
|
|
9
12
|
end
|
|
13
|
+
--- After using the "tearDisplay" console command, text will be drawn on each tear for debugging
|
|
14
|
+
-- purposes. Use this function to specify a callback function that will returns the string that
|
|
15
|
+
-- should be drawn.
|
|
10
16
|
function ____exports.setTearDisplay(self, textCallback)
|
|
11
17
|
debugDisplayTextCallbacks.tear = textCallback
|
|
12
18
|
end
|
|
19
|
+
--- After using the "familiarDisplay" console command, text will be drawn on each familiar for
|
|
20
|
+
-- debugging purposes. Use this function to specify a callback function that will returns the string
|
|
21
|
+
-- that should be drawn.
|
|
13
22
|
function ____exports.setFamiliarDisplay(self, textCallback)
|
|
14
23
|
debugDisplayTextCallbacks.familiar = textCallback
|
|
15
24
|
end
|
|
25
|
+
--- After using the "bombDisplay" console command, text will be drawn on each bomb for debugging
|
|
26
|
+
-- purposes. Use this function to specify a callback function that will returns the string that
|
|
27
|
+
-- should be drawn.
|
|
16
28
|
function ____exports.setBombDisplay(self, textCallback)
|
|
17
29
|
debugDisplayTextCallbacks.bomb = textCallback
|
|
18
30
|
end
|
|
31
|
+
--- After using the "pickupDisplay" console command, text will be drawn on each pickup for debugging
|
|
32
|
+
-- purposes. Use this function to specify a callback function that will returns the string that
|
|
33
|
+
-- should be drawn.
|
|
19
34
|
function ____exports.setPickupDisplay(self, textCallback)
|
|
20
35
|
debugDisplayTextCallbacks.pickup = textCallback
|
|
21
36
|
end
|
|
37
|
+
--- After using the "slotDisplay" console command, text will be drawn on each slot for debugging
|
|
38
|
+
-- purposes. Use this function to specify a callback function that will returns the string that
|
|
39
|
+
-- should be drawn.
|
|
22
40
|
function ____exports.setSlotDisplay(self, textCallback)
|
|
23
41
|
debugDisplayTextCallbacks.slot = textCallback
|
|
24
42
|
end
|
|
43
|
+
--- After using the "laserDisplay" console command, text will be drawn on each laser for debugging
|
|
44
|
+
-- purposes. Use this function to specify a callback function that will returns the string that
|
|
45
|
+
-- should be drawn.
|
|
25
46
|
function ____exports.setLaserDisplay(self, textCallback)
|
|
26
47
|
debugDisplayTextCallbacks.laser = textCallback
|
|
27
48
|
end
|
|
49
|
+
--- After using the "knifeDisplay" console command, text will be drawn on each knife for debugging
|
|
50
|
+
-- purposes. Use this function to specify a callback function that will returns the string that
|
|
51
|
+
-- should be drawn.
|
|
28
52
|
function ____exports.setKnifeDisplay(self, textCallback)
|
|
29
53
|
debugDisplayTextCallbacks.knife = textCallback
|
|
30
54
|
end
|
|
55
|
+
--- After using the "projectileDisplay" console command, text will be drawn on each projectile for
|
|
56
|
+
-- debugging purposes. Use this function to specify a callback function that will returns the string
|
|
57
|
+
-- that should be drawn.
|
|
31
58
|
function ____exports.setProjectileDisplay(self, textCallback)
|
|
32
59
|
debugDisplayTextCallbacks.projectile = textCallback
|
|
33
60
|
end
|
|
61
|
+
--- After using the "effectDisplay" console command, text will be drawn on each effect for debugging
|
|
62
|
+
-- purposes. Use this function to specify a callback function that will returns the string that
|
|
63
|
+
-- should be drawn.
|
|
34
64
|
function ____exports.setEffectDisplay(self, textCallback)
|
|
35
65
|
debugDisplayTextCallbacks.effect = textCallback
|
|
36
66
|
end
|
|
67
|
+
--- After using the "npcDisplay" console command, text will be drawn on each NPC for debugging
|
|
68
|
+
-- purposes. Use this function to specify a callback function that will returns the string that
|
|
69
|
+
-- should be drawn.
|
|
37
70
|
function ____exports.setNPCDisplay(self, textCallback)
|
|
38
71
|
debugDisplayTextCallbacks.npc = textCallback
|
|
39
72
|
end
|
|
73
|
+
--- After using the "rockDisplay" console command, text will be drawn on each rock for debugging
|
|
74
|
+
-- purposes. Use this function to specify a callback function that will returns the string that
|
|
75
|
+
-- should be drawn.
|
|
40
76
|
function ____exports.setRockDisplay(self, textCallback)
|
|
41
77
|
debugDisplayTextCallbacks.rock = textCallback
|
|
42
78
|
end
|
|
79
|
+
--- After using the "pitDisplay" console command, text will be drawn on each pit for debugging
|
|
80
|
+
-- purposes. Use this function to specify a callback function that will returns the string that
|
|
81
|
+
-- should be drawn.
|
|
43
82
|
function ____exports.setPitDisplay(self, textCallback)
|
|
44
83
|
debugDisplayTextCallbacks.pit = textCallback
|
|
45
84
|
end
|
|
85
|
+
--- After using the "spikesDisplay" console command, text will be drawn on each spikes for debugging
|
|
86
|
+
-- purposes. Use this function to specify a callback function that will returns the string that
|
|
87
|
+
-- should be drawn.
|
|
46
88
|
function ____exports.setSpikesDisplay(self, textCallback)
|
|
47
89
|
debugDisplayTextCallbacks.spikes = textCallback
|
|
48
90
|
end
|
|
91
|
+
--- After using the "tntDisplay" console command, text will be drawn on each TNT for debugging
|
|
92
|
+
-- purposes. Use this function to specify a callback function that will returns the string that
|
|
93
|
+
-- should be drawn.
|
|
49
94
|
function ____exports.setTNTDisplay(self, textCallback)
|
|
50
95
|
debugDisplayTextCallbacks.tnt = textCallback
|
|
51
96
|
end
|
|
97
|
+
--- After using the "poopDisplay" console command, text will be drawn on each poop for debugging
|
|
98
|
+
-- purposes. Use this function to specify a callback function that will returns the string that
|
|
99
|
+
-- should be drawn.
|
|
52
100
|
function ____exports.setPoopDisplay(self, textCallback)
|
|
53
101
|
debugDisplayTextCallbacks.poop = textCallback
|
|
54
102
|
end
|
|
103
|
+
--- After using the "poopDisplay" console command, text will be drawn on each poop for debugging
|
|
104
|
+
-- purposes. Use this function to specify a callback function that will returns the string that
|
|
105
|
+
-- should be drawn.
|
|
55
106
|
function ____exports.setDoorDisplay(self, textCallback)
|
|
56
107
|
debugDisplayTextCallbacks.door = textCallback
|
|
57
108
|
end
|
|
109
|
+
--- After using the "pressurePlateDisplay" console command, text will be drawn on each pressure plate
|
|
110
|
+
-- for debugging purposes. Use this function to specify a callback function that will returns the
|
|
111
|
+
-- string that should be drawn.
|
|
58
112
|
function ____exports.setPressurePlateDisplay(self, textCallback)
|
|
59
113
|
debugDisplayTextCallbacks.pressurePlate = textCallback
|
|
60
114
|
end
|
|
115
|
+
--- Toggles the debug display for players. This is the function that runs when you use the
|
|
116
|
+
-- "playerDisplay" custom console command.
|
|
61
117
|
function ____exports.togglePlayerDisplay(self)
|
|
62
118
|
v.run.player = not v.run.player
|
|
63
119
|
printEnabled(nil, v.run.player, "player display")
|
|
64
120
|
end
|
|
121
|
+
--- Toggles the debug display for tears. This is the function that runs when you use the
|
|
122
|
+
-- "tearDisplay" custom console command.
|
|
65
123
|
function ____exports.toggleTearDisplay(self)
|
|
66
124
|
v.run.tear = not v.run.tear
|
|
67
125
|
printEnabled(nil, v.run.tear, "tear display")
|
|
68
126
|
end
|
|
127
|
+
--- Toggles the debug display for familiars. This is the function that runs when you use the
|
|
128
|
+
-- "familiarDisplay" custom console command.
|
|
69
129
|
function ____exports.toggleFamiliarDisplay(self)
|
|
70
130
|
v.run.familiar = not v.run.familiar
|
|
71
131
|
printEnabled(nil, v.run.familiar, "familiar display")
|
|
72
132
|
end
|
|
133
|
+
--- Toggles the debug display for bombs. This is the function that runs when you use the
|
|
134
|
+
-- "bombDisplay" custom console command.
|
|
73
135
|
function ____exports.toggleBombDisplay(self)
|
|
74
136
|
v.run.bomb = not v.run.bomb
|
|
75
137
|
printEnabled(nil, v.run.bomb, "bomb display")
|
|
76
138
|
end
|
|
139
|
+
--- Toggles the debug display for pickups. This is the function that runs when you use the
|
|
140
|
+
-- "pickupDisplay" custom console command.
|
|
77
141
|
function ____exports.togglePickupDisplay(self)
|
|
78
142
|
v.run.pickup = not v.run.pickup
|
|
79
143
|
printEnabled(nil, v.run.pickup, "pickup display")
|
|
80
144
|
end
|
|
145
|
+
--- Toggles the debug display for slots. This is the function that runs when you use the
|
|
146
|
+
-- "slotDisplay" custom console command.
|
|
81
147
|
function ____exports.toggleSlotDisplay(self)
|
|
82
148
|
v.run.slot = not v.run.slot
|
|
83
149
|
printEnabled(nil, v.run.slot, "slot display")
|
|
84
150
|
end
|
|
151
|
+
--- Toggles the debug display for lasers. This is the function that runs when you use the
|
|
152
|
+
-- "laserDisplay" custom console command.
|
|
85
153
|
function ____exports.toggleLaserDisplay(self)
|
|
86
154
|
v.run.laser = not v.run.laser
|
|
87
155
|
printEnabled(nil, v.run.laser, "laser display")
|
|
88
156
|
end
|
|
157
|
+
--- Toggles the debug display for knives. This is the function that runs when you use the
|
|
158
|
+
-- "knifeDisplay" custom console command.
|
|
89
159
|
function ____exports.toggleKnifeDisplay(self)
|
|
90
160
|
v.run.knife = not v.run.knife
|
|
91
161
|
printEnabled(nil, v.run.knife, "knife display")
|
|
92
162
|
end
|
|
163
|
+
--- Toggles the debug display for projectiles. This is the function that runs when you use the
|
|
164
|
+
-- "projectileDisplay" custom console command.
|
|
93
165
|
function ____exports.toggleProjectileDisplay(self)
|
|
94
166
|
v.run.projectile = not v.run.projectile
|
|
95
167
|
printEnabled(nil, v.run.projectile, "projectile display")
|
|
96
168
|
end
|
|
169
|
+
--- Toggles the debug display for effects. This is the function that runs when you use the
|
|
170
|
+
-- "effectDisplay" custom console command.
|
|
97
171
|
function ____exports.toggleEffectDisplay(self)
|
|
98
172
|
v.run.effect = not v.run.effect
|
|
99
173
|
printEnabled(nil, v.run.effect, "effect display")
|
|
100
174
|
end
|
|
175
|
+
--- Toggles the debug display for NPCs. This is the function that runs when you use the "npcDisplay"
|
|
176
|
+
-- custom console command.
|
|
101
177
|
function ____exports.toggleNPCDisplay(self)
|
|
102
178
|
v.run.npc = not v.run.npc
|
|
103
179
|
printEnabled(nil, v.run.npc, "NPC display")
|
|
104
180
|
end
|
|
181
|
+
--- Toggles the debug display for rocks. This is the function that runs when you use the
|
|
182
|
+
-- "rockDisplay" custom console command.
|
|
105
183
|
function ____exports.toggleRockDisplay(self)
|
|
106
184
|
v.run.rock = not v.run.rock
|
|
107
185
|
printEnabled(nil, v.run.rock, "rock display")
|
|
108
186
|
end
|
|
187
|
+
--- Toggles the debug display for pits. This is the function that runs when you use the "pitDisplay"
|
|
188
|
+
-- custom console command.
|
|
109
189
|
function ____exports.togglePitDisplay(self)
|
|
110
190
|
v.run.pit = not v.run.pit
|
|
111
191
|
printEnabled(nil, v.run.pit, "pit display")
|
|
112
192
|
end
|
|
193
|
+
--- Toggles the debug display for spikes. This is the function that runs when you use the
|
|
194
|
+
-- "spikesDisplay" custom console command.
|
|
113
195
|
function ____exports.toggleSpikesDisplay(self)
|
|
114
196
|
v.run.spikes = not v.run.spikes
|
|
115
197
|
printEnabled(nil, v.run.spikes, "spikes display")
|
|
116
198
|
end
|
|
199
|
+
--- Toggles the debug display for TNT. This is the function that runs when you use the "tntDisplay"
|
|
200
|
+
-- custom console command.
|
|
117
201
|
function ____exports.toggleTNTDisplay(self)
|
|
118
202
|
v.run.tnt = not v.run.tnt
|
|
119
203
|
printEnabled(nil, v.run.tnt, "TNT display")
|
|
120
204
|
end
|
|
205
|
+
--- Toggles the debug display for poop. This is the function that runs when you use the "poopDisplay"
|
|
206
|
+
-- custom console command.
|
|
121
207
|
function ____exports.togglePoopDisplay(self)
|
|
122
208
|
v.run.poop = not v.run.poop
|
|
123
209
|
printEnabled(nil, v.run.poop, "poop display")
|
|
124
210
|
end
|
|
211
|
+
--- Toggles the debug display for doors. This is the function that runs when you use the
|
|
212
|
+
-- "doorDisplay" custom console command.
|
|
125
213
|
function ____exports.toggleDoorDisplay(self)
|
|
126
214
|
v.run.door = not v.run.door
|
|
127
215
|
printEnabled(nil, v.run.door, "door display")
|
|
128
216
|
end
|
|
217
|
+
--- Toggles the debug display for pressure plates. This is the function that runs when you use the
|
|
218
|
+
-- "pressurePlateDisplay" custom console command.
|
|
129
219
|
function ____exports.togglePressurePlateDisplay(self)
|
|
130
220
|
v.run.pressurePlate = not v.run.pressurePlate
|
|
131
221
|
printEnabled(nil, v.run.pressurePlate, "pressure plate display")
|
|
@@ -94,6 +94,14 @@ function respawnPersistentEntities(self)
|
|
|
94
94
|
)
|
|
95
95
|
end
|
|
96
96
|
end
|
|
97
|
+
--- Helper function to remove all naturally spawning entities and grid entities from a room. Notably,
|
|
98
|
+
-- this will not remove players (1), tears (2), familiars (3), lasers (7), knives (8), projectiles
|
|
99
|
+
-- (9), blacklisted NPCs such as Dark Esau, charmed NPCs, friendly NPCs, persistent NPCs, most
|
|
100
|
+
-- effects (1000), doors, and walls.
|
|
101
|
+
--
|
|
102
|
+
-- @param fillWithDecorations Optional. Set to true to fill every grid tile with an invisible
|
|
103
|
+
-- decoration, which prevents vanilla entities in the room from
|
|
104
|
+
-- respawning the next time that the player enters. Default is false.
|
|
97
105
|
function ____exports.emptyRoom(self, fillWithDecorations)
|
|
98
106
|
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
99
107
|
local roomListIndex = getRoomListIndex(nil)
|
|
@@ -415,10 +423,33 @@ v = {level = {
|
|
|
415
423
|
function() return {} end
|
|
416
424
|
)
|
|
417
425
|
}}
|
|
426
|
+
---
|
|
427
|
+
-- @internal
|
|
418
428
|
function ____exports.deployJSONRoomInit(self, mod)
|
|
419
429
|
saveDataManager(nil, "deployJSONRoom", v)
|
|
420
430
|
mod:AddCallback(ModCallback.POST_NEW_ROOM, postNewRoom)
|
|
421
431
|
end
|
|
432
|
+
--- Helper function to deconstruct a vanilla room and set up a custom room in its place.
|
|
433
|
+
-- Specifically, this will clear the current room of all entities and grid entities, and then spawn
|
|
434
|
+
-- all of the entries and grid entities in the provided JSON room.
|
|
435
|
+
--
|
|
436
|
+
-- This function is meant to be used in the PostNewRoom callback.
|
|
437
|
+
--
|
|
438
|
+
-- For example:
|
|
439
|
+
--
|
|
440
|
+
-- ```ts
|
|
441
|
+
--
|
|
442
|
+
-- import customRooms from "./customRooms";
|
|
443
|
+
--
|
|
444
|
+
-- const firstJSONRoom = customRooms.rooms.room[0];
|
|
445
|
+
-- deployJSONRoom(firstJSONRoom);
|
|
446
|
+
-- ```
|
|
447
|
+
--
|
|
448
|
+
-- @param jsonRoom The JSON room to deploy. *
|
|
449
|
+
-- @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
450
|
+
-- `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
451
|
+
-- @param verbose Optional. If specified, will write entries to the "log.txt" file that describe
|
|
452
|
+
-- what the function is doing. Default is false.
|
|
422
453
|
function ____exports.deployJSONRoom(self, jsonRoom, seedOrRNG, verbose)
|
|
423
454
|
if seedOrRNG == nil then
|
|
424
455
|
seedOrRNG = getRandomSeed(nil)
|
|
@@ -445,6 +476,31 @@ function ____exports.deployJSONRoom(self, jsonRoom, seedOrRNG, verbose)
|
|
|
445
476
|
fixPitGraphics(nil)
|
|
446
477
|
fillRoomWithDecorations(nil)
|
|
447
478
|
end
|
|
479
|
+
--- Helper function to deconstruct a vanilla room and set up a custom room in its place.
|
|
480
|
+
-- Specifically, this will clear the current room of all entities and grid entities, and then spawn
|
|
481
|
+
-- all of the entries and grid entities in one of the provided JSON rooms.
|
|
482
|
+
--
|
|
483
|
+
-- This function is meant to be used in the PostNewRoom callback.
|
|
484
|
+
--
|
|
485
|
+
-- Note that this function does not simply choose a random element in the provided array; it will
|
|
486
|
+
-- properly account for each room weight using the algorithm from:
|
|
487
|
+
-- https://stackoverflow.com/questions/1761626/weighted-random-numbers
|
|
488
|
+
--
|
|
489
|
+
-- For example:
|
|
490
|
+
--
|
|
491
|
+
-- ```ts
|
|
492
|
+
-- import customRooms from "./customRooms";
|
|
493
|
+
--
|
|
494
|
+
-- const jsonRooms = customRooms.rooms.room;
|
|
495
|
+
-- deployRandomJSONRoom(jsonRooms);
|
|
496
|
+
-- ```
|
|
497
|
+
--
|
|
498
|
+
-- @param jsonRooms An array of JSON rooms to randomly select from. In practice, this will be
|
|
499
|
+
-- something like.
|
|
500
|
+
-- @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
501
|
+
-- `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
502
|
+
-- @param verbose Optional. If specified, will write entries to the "log.txt" file that describe
|
|
503
|
+
-- what the function is doing. Default is false.
|
|
448
504
|
function ____exports.deployRandomJSONRoom(self, jsonRooms, seedOrRNG, verbose)
|
|
449
505
|
if seedOrRNG == nil then
|
|
450
506
|
seedOrRNG = getRandomSeed(nil)
|
|
@@ -49,17 +49,31 @@ v = {run = {
|
|
|
49
49
|
disableInputsWithWhitelistMap = __TS__New(Map),
|
|
50
50
|
enableInputsWithBlacklistMap = __TS__New(Map)
|
|
51
51
|
}}
|
|
52
|
+
---
|
|
53
|
+
-- @internal
|
|
52
54
|
function ____exports.disableInputsInit(self, mod)
|
|
53
55
|
saveDataManager(nil, "disableInputs", v)
|
|
54
56
|
mod:AddCallback(ModCallback.INPUT_ACTION, isActionPressed, InputHook.IS_ACTION_PRESSED)
|
|
55
57
|
mod:AddCallback(ModCallback.INPUT_ACTION, isActionTriggered, InputHook.IS_ACTION_TRIGGERED)
|
|
56
58
|
mod:AddCallback(ModCallback.INPUT_ACTION, getActionValue, InputHook.GET_ACTION_VALUE)
|
|
57
59
|
end
|
|
60
|
+
--- Helper function to enable all inputs. Use this function to set things back to normal after having
|
|
61
|
+
-- used one of the other helper functions to disable inputs.
|
|
62
|
+
--
|
|
63
|
+
-- @param key The name of the mod feature that is requesting the enable/disable. This is needed so
|
|
64
|
+
-- that multiple mod features can work in tandem.
|
|
58
65
|
function ____exports.enableAllInputs(self, key)
|
|
59
66
|
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
60
67
|
v.run.disableInputsWithWhitelistMap:delete(key)
|
|
61
68
|
v.run.enableInputsWithBlacklistMap:delete(key)
|
|
62
69
|
end
|
|
70
|
+
--- Helper function to disable all inputs. This is useful because `EntityPlayer.ControlsEnabled` can
|
|
71
|
+
-- be changed by the game under certain conditions.
|
|
72
|
+
--
|
|
73
|
+
-- Use the `enableAllInputs` helper function to set things back to normal.
|
|
74
|
+
--
|
|
75
|
+
-- @param key The name of the mod feature that is requesting the enable/disable. This is needed so
|
|
76
|
+
-- that multiple mod features can work in tandem.
|
|
63
77
|
function ____exports.disableAllInputs(self, key)
|
|
64
78
|
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
65
79
|
v.run.disableInputsWithWhitelistMap:set(
|
|
@@ -68,20 +82,51 @@ function ____exports.disableAllInputs(self, key)
|
|
|
68
82
|
)
|
|
69
83
|
v.run.enableInputsWithBlacklistMap:delete(key)
|
|
70
84
|
end
|
|
85
|
+
--- Helper function to enable all inputs besides the ones provided. This is useful because
|
|
86
|
+
-- `EntityPlayer.ControlsEnabled` can be changed by the game under certain conditions.
|
|
87
|
+
--
|
|
88
|
+
-- Use the `enableAllInputs` helper function to set things back to normal.
|
|
89
|
+
--
|
|
90
|
+
-- @param key The name of the mod feature that is requesting the enable/disable. This is needed so
|
|
91
|
+
-- that multiple mod features can work in tandem.
|
|
92
|
+
-- @param blacklist A set of ButtonActions to disallow.
|
|
71
93
|
function ____exports.enableAllInputsExceptFor(self, key, blacklist)
|
|
72
94
|
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
73
95
|
v.run.disableInputsWithWhitelistMap:delete(key)
|
|
74
96
|
v.run.enableInputsWithBlacklistMap:set(key, blacklist)
|
|
75
97
|
end
|
|
98
|
+
--- Helper function to disable all inputs besides the ones provided. This is useful because
|
|
99
|
+
-- `EntityPlayer.ControlsEnabled` can be changed by the game under certain conditions.
|
|
100
|
+
--
|
|
101
|
+
-- Use the `enableAllInputs` helper function to set things back to normal.
|
|
102
|
+
--
|
|
103
|
+
-- @param key The name of the mod feature that is requesting the enable/disable. This is needed so
|
|
104
|
+
-- that multiple mod features can work in tandem.
|
|
105
|
+
-- @param whitelist A set of ButtonActions to allow.
|
|
76
106
|
function ____exports.disableAllInputsExceptFor(self, key, whitelist)
|
|
77
107
|
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
78
108
|
v.run.disableInputsWithWhitelistMap:set(key, whitelist)
|
|
79
109
|
v.run.enableInputsWithBlacklistMap:delete(key)
|
|
80
110
|
end
|
|
111
|
+
--- Helper function to disable only the inputs used for moving the character (or moving the cursor in
|
|
112
|
+
-- the UI). This is useful because `EntityPlayer.ControlsEnabled` can be changed by the game under
|
|
113
|
+
-- certain conditions.
|
|
114
|
+
--
|
|
115
|
+
-- Use the `enableAllInputs` helper function to set things back to normal.
|
|
116
|
+
--
|
|
117
|
+
-- @param key The name of the mod feature that is requesting the enable/disable. This is needed so
|
|
118
|
+
-- that multiple mod features can work in tandem.
|
|
81
119
|
function ____exports.disableMovementInputs(self, key)
|
|
82
120
|
local moveActions = getMoveActions(nil)
|
|
83
121
|
____exports.enableAllInputsExceptFor(nil, key, moveActions)
|
|
84
122
|
end
|
|
123
|
+
--- Helper function to disable only the inputs used for shooting tears. This is useful because
|
|
124
|
+
-- `EntityPlayer.ControlsEnabled` can be changed by the game under certain conditions.
|
|
125
|
+
--
|
|
126
|
+
-- Use the `enableAllInputs` helper function to set things back to normal.
|
|
127
|
+
--
|
|
128
|
+
-- @param key The name of the mod feature that is requesting the enable/disable. This is needed so
|
|
129
|
+
-- that multiple mod features can work in tandem.
|
|
85
130
|
function ____exports.disableShootingInputs(self, key)
|
|
86
131
|
local shootActions = getShootActions(nil)
|
|
87
132
|
____exports.enableAllInputsExceptFor(nil, key, shootActions)
|
|
@@ -22,10 +22,18 @@ end
|
|
|
22
22
|
local FEATURE_NAME = "sound disabler"
|
|
23
23
|
local musicWasEnabled = false
|
|
24
24
|
v = {run = {disableSoundSet = __TS__New(Set)}}
|
|
25
|
+
---
|
|
26
|
+
-- @internal
|
|
25
27
|
function ____exports.disableSoundsInit(self, mod)
|
|
26
28
|
saveDataManager(nil, "disableSounds", v)
|
|
27
29
|
mod:AddCallback(ModCallback.POST_RENDER, postRender)
|
|
28
30
|
end
|
|
31
|
+
--- Helper function to stop muting all sound effects and music.
|
|
32
|
+
--
|
|
33
|
+
-- Use this function to set things back to normal after having used `disableAllSounds`.
|
|
34
|
+
--
|
|
35
|
+
-- @param key The name of the mod feature that is requesting the enable/disable. This is needed so
|
|
36
|
+
-- that multiple mod features can work in tandem.
|
|
29
37
|
function ____exports.enableAllSound(self, key)
|
|
30
38
|
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
31
39
|
if not v.run.disableSoundSet:has(key) then
|
|
@@ -37,6 +45,12 @@ function ____exports.enableAllSound(self, key)
|
|
|
37
45
|
end
|
|
38
46
|
stopAllSoundEffects(nil)
|
|
39
47
|
end
|
|
48
|
+
--- Helper function to disable all sound effects and music (by constantly musting them).
|
|
49
|
+
--
|
|
50
|
+
-- Use the `enableAllSounds` helper function to set things back to normal.
|
|
51
|
+
--
|
|
52
|
+
-- @param key The name of the mod feature that is requesting the enable/disable. This is needed so
|
|
53
|
+
-- that multiple mod features can work in tandem.
|
|
40
54
|
function ____exports.disableAllSound(self, key)
|
|
41
55
|
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
42
56
|
if v.run.disableSoundSet.size == 0 then
|