isaacscript-common 2.3.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/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/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 +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.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/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 +6 -1
- package/functions/collectibles.lua +146 -2
- 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 +1 -0
- package/functions/direction.lua +22 -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.lua +166 -0
- package/functions/playerDataStructures.lua +65 -0
- package/functions/playerHealth.d.ts +1 -0
- package/functions/playerHealth.lua +10 -0
- 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/initCustomCallbacks.lua +3 -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/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/classes/DefaultMap.lua
CHANGED
|
@@ -4,58 +4,106 @@ local Map = ____lualib.Map
|
|
|
4
4
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
5
5
|
local __TS__TypeOf = ____lualib.__TS__TypeOf
|
|
6
6
|
local ____exports = {}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
7
|
+
--- `DefaultMap` is a data structure that makes working with default values easier.
|
|
8
|
+
--
|
|
9
|
+
-- It is a common pattern to look up a value in a `Map`, and then, if the value does not exist, set
|
|
10
|
+
-- a default value for the key, and then return the default value. `DefaultMap` abstracts this
|
|
11
|
+
-- operation away by providing the `getAndSetDefault` method.
|
|
12
|
+
--
|
|
13
|
+
-- Using a `DefaultMap` is nice because it makes code more declarative, since you specify what the
|
|
14
|
+
-- default value is alongside the types of the keys/values.
|
|
15
|
+
--
|
|
16
|
+
-- When instantiating a new `DefaultMap`, you must specify default value as the first argument. (The
|
|
17
|
+
-- default value is the initial value that will be assigned to every new entry in the
|
|
18
|
+
-- `getAndSetDefault` method.) For example:
|
|
19
|
+
--
|
|
20
|
+
-- ```ts
|
|
21
|
+
-- // Initializes a new empty DefaultMap with a default value of "foo".
|
|
22
|
+
-- const defaultMapWithString = new DefaultMap<string, string>("foo");
|
|
23
|
+
--
|
|
24
|
+
-- const value = defaultMapWithString.getAndSetDefault("bar");
|
|
25
|
+
-- // value is now "foo" and an entry for "bar" is now set.
|
|
26
|
+
-- ```
|
|
27
|
+
--
|
|
28
|
+
-- Sometimes, instead of having a static initial value for every entry in the map, you will want a
|
|
29
|
+
-- dynamic initial value that is contingent upon the key or some other variable. In these cases, you
|
|
30
|
+
-- can instead specify that the `DefaultMap` should run a function that will return the initial
|
|
31
|
+
-- value. (This is referred to as a "factory function".) For example:
|
|
32
|
+
--
|
|
33
|
+
-- ```ts
|
|
34
|
+
-- // Initializes a new empty DefaultMap with a default value based on "someGlobalVariable".
|
|
35
|
+
-- const factoryFunction = () => someGlobalVariable ? 0 : 1;
|
|
36
|
+
-- const defaultMapWithFactoryFunction = new DefaultMap<string, string>(factoryFunction);
|
|
37
|
+
-- ```
|
|
38
|
+
--
|
|
39
|
+
-- Note that in TypeScript and Lua, booleans, numbers, and strings are "passed by value". This means
|
|
40
|
+
-- that when the `DefaultMap` creates a new entry, if the default value is one of these 3 types, the
|
|
41
|
+
-- values will be copied. On the other hand, arrays and maps and other complex data structures are
|
|
42
|
+
-- "passed by reference". This means that when the `DefaultMap` creates a new entry, if the default
|
|
43
|
+
-- value is an array, then it would not be copied. Instead, the same shared array would be assigned
|
|
44
|
+
-- to every entry. Thus, to solve this problem, any variable that is passed by reference must be
|
|
45
|
+
-- created using a factory function to ensure that each copy is unique. For example:
|
|
46
|
+
--
|
|
47
|
+
-- ```ts
|
|
48
|
+
-- // Initializes a new empty DefaultMap with a default value of a new empty array.
|
|
49
|
+
-- const factoryFunction = () => [] as ;
|
|
50
|
+
-- const defaultMapWithArray = new DefaultMap<string, string[]>(factoryFunction);
|
|
51
|
+
-- ```
|
|
52
|
+
--
|
|
53
|
+
-- In the previous two examples, the factory functions did not have any arguments. But you can also
|
|
54
|
+
-- specify a factory function that takes one or more arguments:
|
|
55
|
+
--
|
|
56
|
+
-- ```ts
|
|
57
|
+
-- const factoryFunction = (arg: boolean) => arg ? 0 : 1;
|
|
58
|
+
-- const defaultMapWithArg = new DefaultMap<string, string, [arg: boolean]>(factoryFunction);
|
|
59
|
+
-- ```
|
|
60
|
+
--
|
|
61
|
+
-- Similar to a normal `Map`, you can also include an initializer list in the constructor as the
|
|
62
|
+
-- second argument:
|
|
63
|
+
--
|
|
64
|
+
-- ```ts
|
|
65
|
+
-- // Initializes a DefaultMap with a default value of "foo" and some initial values.
|
|
66
|
+
-- const defaultMapWithInitialValues = new DefaultMap<string, string>("foo", [
|
|
67
|
+
-- ["a1", "a2"],
|
|
68
|
+
-- ["b1", "b2"],
|
|
69
|
+
-- ], );
|
|
70
|
+
-- ```
|
|
71
|
+
--
|
|
72
|
+
-- Finally, note that `DefaultMap` has the following additional utility methods:
|
|
73
|
+
--
|
|
74
|
+
-- - `getAndSetDefault` - The method that is called inside the overridden `get` method. In most
|
|
75
|
+
-- cases, you can use the overridden `get` method instead of calling this function directly.
|
|
76
|
+
-- However, if a factory function was provided during instantiation, and the factory function has
|
|
77
|
+
-- one or more arguments, then you must call this method instead (and provide the corresponding
|
|
78
|
+
-- arguments).
|
|
79
|
+
-- - `getWithoutDefault` - Calls the original `Map.get` function (without setting the default
|
|
80
|
+
-- value).
|
|
81
|
+
-- - `getDefaultValue` - Returns the default value to be used for a new key. (If a factory function
|
|
82
|
+
-- was provided during instantiation, this will execute the factory function.)
|
|
83
|
+
-- - `getConstructorArg` - Helper method for cloning the map. Returns either the default value or
|
|
84
|
+
-- the reference to the factory function.
|
|
37
85
|
____exports.DefaultMap = __TS__Class()
|
|
38
86
|
local DefaultMap = ____exports.DefaultMap
|
|
39
87
|
DefaultMap.name = "DefaultMap"
|
|
40
88
|
__TS__ClassExtends(DefaultMap, Map)
|
|
41
|
-
function DefaultMap.prototype.____constructor(self,
|
|
42
|
-
local
|
|
43
|
-
local
|
|
44
|
-
local
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
error("A DefaultMap must be instantiated with either a default value or a function that returns a default value.")
|
|
89
|
+
function DefaultMap.prototype.____constructor(self, defaultValueOrFactoryFunction, initializerArray)
|
|
90
|
+
local argType = __TS__TypeOf(defaultValueOrFactoryFunction)
|
|
91
|
+
local argIsPrimitive = argType == "boolean" or argType == "number" or argType == "string"
|
|
92
|
+
local argIsFunction = argType == "function"
|
|
93
|
+
if not argIsPrimitive and not argIsFunction then
|
|
94
|
+
error(("Failed to instantiate a DefaultMap since the provided default value was of type \"" .. argType) .. "\". This error usually means that you are trying to use an array (or some other non-primitive data structure that is passed by reference) as the default value. Instead, return the data structure in a factory function, like \"() => []\". See the DefaultMap documentation for more details.")
|
|
48
95
|
end
|
|
49
|
-
|
|
50
|
-
|
|
96
|
+
Map.prototype.____constructor(self, initializerArray)
|
|
97
|
+
if argIsFunction then
|
|
98
|
+
self.defaultValue = nil
|
|
99
|
+
self.defaultValueFactory = defaultValueOrFactoryFunction
|
|
51
100
|
else
|
|
52
|
-
|
|
101
|
+
self.defaultValue = defaultValueOrFactoryFunction
|
|
102
|
+
self.defaultValueFactory = nil
|
|
53
103
|
end
|
|
54
|
-
self.defaultValue = defaultValue
|
|
55
|
-
self.defaultValueFactory = defaultValueFactory
|
|
56
104
|
end
|
|
57
105
|
function DefaultMap.prototype.getAndSetDefault(self, key, ...)
|
|
58
|
-
local value =
|
|
106
|
+
local value = Map.prototype.get(self, key)
|
|
59
107
|
if value ~= nil then
|
|
60
108
|
return value
|
|
61
109
|
end
|
|
@@ -63,6 +111,9 @@ function DefaultMap.prototype.getAndSetDefault(self, key, ...)
|
|
|
63
111
|
self:set(key, defaultValue)
|
|
64
112
|
return defaultValue
|
|
65
113
|
end
|
|
114
|
+
function DefaultMap.prototype.getWithoutDefault(self, key)
|
|
115
|
+
return Map.prototype.get(self, key)
|
|
116
|
+
end
|
|
66
117
|
function DefaultMap.prototype.getDefaultValue(self, ...)
|
|
67
118
|
if self.defaultValue ~= nil then
|
|
68
119
|
return self.defaultValue
|
package/classes/ModUpgraded.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { ModCallback } from "isaac-typescript-definitions";
|
|
|
2
2
|
import { ModCallbackCustom } from "../enums/ModCallbackCustom";
|
|
3
3
|
import { AddCallbackParameterCustom } from "../interfaces/AddCallbackParameterCustom";
|
|
4
4
|
/**
|
|
5
|
-
* `isaacscript-common` has many custom callbacks that you can use in your
|
|
6
|
-
* hijacking the vanilla `Mod` object, we provide a `ModUpgraded` object for you to
|
|
7
|
-
* extends the base class and adds a new method of `AddCallbackCustom`.
|
|
5
|
+
* `isaacscript-common` has many {@link ModCallbackCustom custom callbacks} that you can use in your
|
|
6
|
+
* mods. Instead of hijacking the vanilla `Mod` object, we provide a `ModUpgraded` object for you to
|
|
7
|
+
* use, which extends the base class and adds a new method of `AddCallbackCustom`.
|
|
8
8
|
*
|
|
9
9
|
* To upgrade your mod, use the `upgradeMod` helper function.
|
|
10
10
|
*/
|
package/classes/ModUpgraded.lua
CHANGED
|
@@ -3,6 +3,11 @@ local __TS__Class = ____lualib.__TS__Class
|
|
|
3
3
|
local ____exports = {}
|
|
4
4
|
local ____callbackRegisterFunctions = require("objects.callbackRegisterFunctions")
|
|
5
5
|
local CALLBACK_REGISTER_FUNCTIONS = ____callbackRegisterFunctions.CALLBACK_REGISTER_FUNCTIONS
|
|
6
|
+
--- `isaacscript-common` has many {@link ModCallbackCustomcustom callbacks} that you can use in your
|
|
7
|
+
-- mods. Instead of hijacking the vanilla `Mod` object, we provide a `ModUpgraded` object for you to
|
|
8
|
+
-- use, which extends the base class and adds a new method of `AddCallbackCustom`.
|
|
9
|
+
--
|
|
10
|
+
-- To upgrade your mod, use the `upgradeMod` helper function.
|
|
6
11
|
____exports.ModUpgraded = __TS__Class()
|
|
7
12
|
local ModUpgraded = ____exports.ModUpgraded
|
|
8
13
|
ModUpgraded.name = "ModUpgraded"
|
package/constants.lua
CHANGED
|
@@ -8,38 +8,79 @@ local TrinketSlot = ____isaac_2Dtypescript_2Ddefinitions.TrinketSlot
|
|
|
8
8
|
local ____enums = require("functions.enums")
|
|
9
9
|
local getEnumLength = ____enums.getEnumLength
|
|
10
10
|
local getLastEnumValue = ____enums.getLastEnumValue
|
|
11
|
+
--- The distance of the laser when Azazel does not have any range up items yet. For more info, see
|
|
12
|
+
-- the documentation for the `getAzazelBrimstoneDistance` function.
|
|
11
13
|
____exports.AZAZEL_DEFAULT_BRIMSTONE_DISTANCE = 75.125
|
|
14
|
+
--- The path to the png file for collectible items during Curse of the Blind, making them appear with
|
|
15
|
+
-- a red question mark.
|
|
12
16
|
____exports.BLIND_ITEM_PNG_PATH = "gfx/items/collectibles/questionmark.png"
|
|
17
|
+
--- Bombs explode when their frame count is equal to this value.
|
|
13
18
|
____exports.BOMB_EXPLODE_FRAME = 45
|
|
14
19
|
____exports.DEFAULT_ITEM_POOL_TYPE = ItemPoolType.TREASURE
|
|
20
|
+
--- This is also the distance that a player spawns from the door that they enter a room from.
|
|
15
21
|
____exports.DISTANCE_OF_GRID_TILE = 40
|
|
16
22
|
____exports.DOOR_HITBOX_RADIUS = 11
|
|
23
|
+
--- When Eggies take fatal damage, they go into NpcState.STATE_SUICIDE and spawn 14 Swarm Spiders
|
|
24
|
+
-- while their StateFrame ticks upwards. The 14th spider appears when the StateFrame is at this
|
|
25
|
+
-- value.
|
|
17
26
|
____exports.EGGY_STATE_FRAME_OF_FINAL_SPIDER = 45
|
|
27
|
+
--- A non-existent or completely transparent PNG file for use in clearing sprites. For more
|
|
28
|
+
-- information, see the documentation for the `clearSprite` helper function.
|
|
18
29
|
____exports.EMPTY_PNG_PATH = "gfx/none.png"
|
|
30
|
+
--- The random items that appear when the player has TMTRAINER are generated on the fly as they are
|
|
31
|
+
-- encountered by the player. The first TMTRAINER item takes the final possible 32 bit number. The
|
|
32
|
+
-- second TMTRAINER item subtracts one from that, and so on.
|
|
19
33
|
____exports.FIRST_GLITCHED_COLLECTIBLE_TYPE = (1 << 32) - 1
|
|
20
34
|
____exports.GAME_FRAMES_PER_SECOND = 30
|
|
21
35
|
____exports.GRID_INDEX_CENTER_OF_1X1_ROOM = 67
|
|
22
36
|
____exports.ISAAC_FRAMES_PER_SECOND = 60
|
|
37
|
+
--- The floor is represented by a 13x13 grid. Room indexes start at 0. The first column is
|
|
38
|
+
-- represented by grid indexes 0, 13, 26, and so on.
|
|
23
39
|
____exports.LEVEL_GRID_COLUMN_HEIGHT = 13
|
|
40
|
+
--- The floor is represented by a 13x13 grid. Room indexes start at 0. The first row is represented
|
|
41
|
+
-- by grid indexes from 0 to 12. The second row is represented by grid indexes from 13 to 25, and so
|
|
42
|
+
-- on.
|
|
24
43
|
____exports.LEVEL_GRID_ROW_WIDTH = 13
|
|
44
|
+
--- The floor is represented by a 13x13 grid. Room indexes start at 0. The first row is represented
|
|
45
|
+
-- by grid indexes from 0 to 12. The second row is represented by grid indexes from 13 to 25, and so
|
|
46
|
+
-- on. The maximum room index possible is 168. (It is not 169 because we start at 0 instead of 1.)
|
|
25
47
|
____exports.MAX_LEVEL_GRID_INDEX = 168
|
|
48
|
+
--- The game has a limit on the number of currently spawned familiars and will refuse to spawn any
|
|
49
|
+
-- more if it reaches the limit. Blue flies and blue spiders have a lower priority and will be
|
|
50
|
+
-- deleted to make room for other familiars.
|
|
26
51
|
____exports.MAX_NUM_FAMILIARS = 64
|
|
52
|
+
--- The game can only handle up to four different players.
|
|
27
53
|
____exports.MAX_NUM_INPUTS = 4
|
|
54
|
+
--- With Birthright, it is possible for Magdalene to have 18 heart containers.
|
|
28
55
|
____exports.MAX_PLAYER_HEART_CONTAINERS = 18
|
|
56
|
+
--- As the player continues to move in a direction, they will accelerate. When going from one wall to
|
|
57
|
+
-- another in a 2x2 room at 2.0 speed (the maximum that the speed stat can rise to), the amount of
|
|
58
|
+
-- units moved per update frame will climb to around 9.797 as they hit the opposite wall. The
|
|
59
|
+
-- constant specifies a value of 9.8 to be safe.
|
|
29
60
|
____exports.MAX_PLAYER_SPEED_IN_UNITS = 9.8
|
|
30
61
|
____exports.MAX_PLAYER_TRINKET_SLOTS = getEnumLength(nil, TrinketSlot)
|
|
31
62
|
____exports.FIRST_ROOM_TYPE = RoomType.DEFAULT
|
|
32
63
|
____exports.LAST_ROOM_TYPE = getLastEnumValue(nil, RoomType)
|
|
64
|
+
--- The maximum speed stat that a player can have. Any additional speed beyond this will not take
|
|
65
|
+
-- effect.
|
|
33
66
|
____exports.MAX_SPEED_STAT = 2
|
|
34
67
|
____exports.FIRST_STAGE = LevelStage.BASEMENT_1
|
|
35
68
|
____exports.LAST_STAGE = getLastEnumValue(nil, LevelStage)
|
|
69
|
+
--- Corresponds to the maximum value for `EntityPlayer.SamsonBerserkCharge`.
|
|
36
70
|
____exports.MAX_TAINTED_SAMSON_BERSERK_CHARGE = 100000
|
|
37
71
|
____exports.NUM_DIMENSIONS = getEnumLength(nil, Dimension) - 1
|
|
38
72
|
____exports.SECOND_IN_MILLISECONDS = 1000
|
|
39
73
|
____exports.MINUTE_IN_MILLISECONDS = 60 * ____exports.SECOND_IN_MILLISECONDS
|
|
40
74
|
____exports.ONE_BY_ONE_ROOM_GRID_SIZE = 135
|
|
75
|
+
--- After taking damage, `EntityPlayer.SamsonBerserkCharge` is incremented by this amount.
|
|
41
76
|
____exports.TAINTED_SAMSON_BERSERK_CHARGE_FROM_TAKING_DAMAGE = 10000
|
|
77
|
+
--- This is the number of draw coordinates that each heart spans on the UI in the upper left hand
|
|
78
|
+
-- corner.
|
|
42
79
|
____exports.UI_HEART_WIDTH = 12
|
|
80
|
+
--- This is a safer version of the `Vector.One` constant. (Other mods can mutate this `Vector.One`,
|
|
81
|
+
-- so it is not safe to use.)
|
|
43
82
|
____exports.VectorOne = Vector(1, 1)
|
|
83
|
+
--- This is a safer version of the `Vector.Zero` constant. (Other mods can mutate `Vector.Zero`
|
|
84
|
+
-- vector, so it is not safe to use.)
|
|
44
85
|
____exports.VectorZero = Vector(0, 0)
|
|
45
86
|
return ____exports
|
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)
|
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
3
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
4
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
5
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
6
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
7
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
8
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
9
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
10
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
11
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
12
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
13
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
14
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
15
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
16
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
17
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
18
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
19
|
/**
|
|
3
20
|
* After using the "playerDisplay" console command, text will be drawn on each player for debugging
|
|
4
21
|
* purposes. Use this function to specify a callback function that will returns the string that
|