isaacscript-common 8.4.4 → 8.5.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/dist/callbacks/postCursedTeleport.lua +4 -4
- package/dist/callbacks/postPlayerFatalDamage.lua +7 -7
- package/dist/callbacks/postSacrifice.lua +2 -2
- package/dist/callbacks/postTrinketBreak.lua +2 -2
- package/dist/callbacks/subscriptions/postPlayerFatalDamage.d.ts +2 -2
- package/dist/callbacks/subscriptions/postPlayerFatalDamage.d.ts.map +1 -1
- package/dist/callbacks/subscriptions/postPlayerFatalDamage.lua +4 -4
- package/dist/features/characterStats.d.ts.map +1 -1
- package/dist/features/characterStats.lua +1 -2
- package/dist/features/customGridEntity.d.ts.map +1 -1
- package/dist/features/customGridEntity.lua +3 -36
- package/dist/features/extraConsoleCommands/init.d.ts.map +1 -1
- package/dist/features/extraConsoleCommands/init.lua +1 -1
- package/dist/features/firstLast.d.ts +6 -3
- package/dist/features/firstLast.d.ts.map +1 -1
- package/dist/features/firstLast.lua +6 -3
- package/dist/functions/bosses.d.ts +5 -2
- package/dist/functions/bosses.d.ts.map +1 -1
- package/dist/functions/bosses.lua +11 -6
- package/dist/functions/collectibleCacheFlag.d.ts +1 -1
- package/dist/functions/collectibleCacheFlag.d.ts.map +1 -1
- package/dist/functions/collectibleCacheFlag.lua +1 -2
- package/dist/functions/collectibleSet.lua +32 -32
- package/dist/functions/collectibleTag.d.ts +1 -1
- package/dist/functions/collectibleTag.d.ts.map +1 -1
- package/dist/functions/collectibleTag.lua +1 -3
- package/dist/functions/eden.d.ts +1 -1
- package/dist/functions/eden.d.ts.map +1 -1
- package/dist/functions/eden.lua +1 -2
- package/dist/functions/flag.d.ts +1 -1
- package/dist/functions/flag.lua +1 -1
- package/dist/functions/flying.d.ts +1 -1
- package/dist/functions/flying.d.ts.map +1 -1
- package/dist/functions/flying.lua +5 -2
- package/dist/functions/input.d.ts +2 -2
- package/dist/functions/input.d.ts.map +1 -1
- package/dist/functions/input.lua +2 -4
- package/dist/functions/playerHealth.d.ts +93 -0
- package/dist/functions/playerHealth.d.ts.map +1 -1
- package/dist/functions/playerHealth.lua +216 -33
- package/dist/functions/players.d.ts +1 -111
- package/dist/functions/players.d.ts.map +1 -1
- package/dist/functions/players.lua +20 -279
- package/dist/functions/revive.d.ts +1 -1
- package/dist/functions/revive.d.ts.map +1 -1
- package/dist/functions/revive.lua +5 -4
- package/dist/functions/stats.d.ts +16 -0
- package/dist/functions/stats.d.ts.map +1 -1
- package/dist/functions/stats.lua +78 -0
- package/dist/functions/transformations.d.ts +1 -1
- package/dist/functions/transformations.d.ts.map +1 -1
- package/dist/functions/trinketCacheFlag.d.ts +1 -1
- package/dist/functions/trinketCacheFlag.d.ts.map +1 -1
- package/dist/functions/trinketCacheFlag.lua +1 -3
- package/dist/functions/trinketSet.lua +32 -32
- package/dist/index.d.ts +22 -33
- package/dist/sets/bossSets.d.ts +1 -0
- package/dist/sets/bossSets.d.ts.map +1 -1
- package/dist/sets/bossSets.lua +19 -0
- package/package.json +2 -2
- package/src/callbacks/postCursedTeleport.ts +7 -7
- package/src/callbacks/postPlayerFatalDamage.ts +9 -16
- package/src/callbacks/postSacrifice.ts +5 -5
- package/src/callbacks/postTrinketBreak.ts +5 -5
- package/src/callbacks/subscriptions/postPlayerFatalDamage.ts +9 -9
- package/src/features/characterStats.ts +1 -2
- package/src/features/customGridEntity.ts +0 -55
- package/src/features/extraConsoleCommands/init.ts +8 -1
- package/src/features/firstLast.ts +6 -3
- package/src/functions/bosses.ts +15 -6
- package/src/functions/collectibleCacheFlag.ts +3 -3
- package/src/functions/collectibleSet.ts +32 -32
- package/src/functions/collectibleTag.ts +2 -3
- package/src/functions/eden.ts +3 -3
- package/src/functions/flag.ts +1 -1
- package/src/functions/flying.ts +4 -4
- package/src/functions/input.ts +4 -5
- package/src/functions/playerHealth.ts +269 -7
- package/src/functions/players.ts +1 -348
- package/src/functions/revive.ts +6 -10
- package/src/functions/stats.ts +75 -0
- package/src/functions/transformations.ts +1 -1
- package/src/functions/trinketCacheFlag.ts +2 -3
- package/src/functions/trinketSet.ts +32 -32
- package/src/sets/bossSets.ts +24 -0
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
export type PostPlayerFatalDamageRegisterParameters = [
|
|
8
8
|
callback: (
|
|
9
9
|
player: EntityPlayer,
|
|
10
|
-
|
|
10
|
+
amount: float,
|
|
11
11
|
damageFlags: BitFlags<DamageFlag>,
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
source: EntityRef,
|
|
13
|
+
countdownFrames: int,
|
|
14
14
|
) => boolean | undefined,
|
|
15
15
|
playerVariant?: PlayerVariant,
|
|
16
16
|
character?: PlayerType,
|
|
@@ -30,10 +30,10 @@ export function postPlayerFatalDamageRegister(
|
|
|
30
30
|
|
|
31
31
|
export function postPlayerFatalDamageFire(
|
|
32
32
|
player: EntityPlayer,
|
|
33
|
-
|
|
33
|
+
amount: float,
|
|
34
34
|
damageFlags: BitFlags<DamageFlag>,
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
source: EntityRef,
|
|
36
|
+
countdownFrames: int,
|
|
37
37
|
): boolean | undefined {
|
|
38
38
|
const character = player.GetPlayerType();
|
|
39
39
|
|
|
@@ -50,10 +50,10 @@ export function postPlayerFatalDamageFire(
|
|
|
50
50
|
|
|
51
51
|
const shouldSustainDeath = callback(
|
|
52
52
|
player,
|
|
53
|
-
|
|
53
|
+
amount,
|
|
54
54
|
damageFlags,
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
source,
|
|
56
|
+
countdownFrames,
|
|
57
57
|
);
|
|
58
58
|
|
|
59
59
|
if (shouldSustainDeath !== undefined) {
|
|
@@ -10,8 +10,7 @@ import {
|
|
|
10
10
|
PlayerType,
|
|
11
11
|
} from "isaac-typescript-definitions";
|
|
12
12
|
import { errorIfFeaturesNotInitialized } from "../featuresInitialized";
|
|
13
|
-
import { addStat } from "../functions/
|
|
14
|
-
import { getDefaultPlayerStat } from "../functions/stats";
|
|
13
|
+
import { addStat, getDefaultPlayerStat } from "../functions/stats";
|
|
15
14
|
|
|
16
15
|
const FEATURE_NAME = "characterStats";
|
|
17
16
|
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ActiveSlot,
|
|
3
3
|
CollectibleType,
|
|
4
|
-
DamageFlag,
|
|
5
|
-
EntityType,
|
|
6
4
|
GridCollisionClass,
|
|
7
5
|
GridEntityType,
|
|
8
6
|
ModCallback,
|
|
9
7
|
UseFlag,
|
|
10
8
|
} from "isaac-typescript-definitions";
|
|
11
|
-
import { postGridEntityCustomBrokenFire } from "../callbacks/subscriptions/postGridEntityCustomBroken";
|
|
12
9
|
import { DefaultMap } from "../classes/DefaultMap";
|
|
13
10
|
import { ModUpgraded } from "../classes/ModUpgraded";
|
|
14
11
|
import { game } from "../core/cachedClasses";
|
|
@@ -17,7 +14,6 @@ import {
|
|
|
17
14
|
areFeaturesInitialized,
|
|
18
15
|
errorIfFeaturesNotInitialized,
|
|
19
16
|
} from "../featuresInitialized";
|
|
20
|
-
import { hasFlag } from "../functions/flag";
|
|
21
17
|
import {
|
|
22
18
|
removeGridEntity,
|
|
23
19
|
spawnGridEntityWithVariant,
|
|
@@ -49,12 +45,6 @@ const v = {
|
|
|
49
45
|
export function customGridEntityInit(mod: ModUpgraded): void {
|
|
50
46
|
saveDataManager(FEATURE_NAME, v);
|
|
51
47
|
|
|
52
|
-
mod.AddCallback(
|
|
53
|
-
ModCallback.ENTITY_TAKE_DMG,
|
|
54
|
-
entityTakeDmgGenericProp,
|
|
55
|
-
EntityType.GENERIC_PROP,
|
|
56
|
-
); // 11
|
|
57
|
-
|
|
58
48
|
mod.AddCallback(
|
|
59
49
|
ModCallback.PRE_USE_ITEM,
|
|
60
50
|
preUseItemWeNeedToGoDeeper,
|
|
@@ -67,51 +57,6 @@ export function customGridEntityInit(mod: ModUpgraded): void {
|
|
|
67
57
|
);
|
|
68
58
|
}
|
|
69
59
|
|
|
70
|
-
// ModCallback.ENTITY_TAKE_DMG (11)
|
|
71
|
-
// EntityType.GENERIC_PROP (960)
|
|
72
|
-
function entityTakeDmgGenericProp(
|
|
73
|
-
tookDamage: Entity,
|
|
74
|
-
_damageAmount: float,
|
|
75
|
-
damageFlags: BitFlags<DamageFlag>,
|
|
76
|
-
_damageSource: EntityRef,
|
|
77
|
-
_damageCountdownFrames: int,
|
|
78
|
-
): boolean | undefined {
|
|
79
|
-
const ptrHash = GetPtrHash(tookDamage);
|
|
80
|
-
if (!v.room.genericPropPtrHashes.has(ptrHash)) {
|
|
81
|
-
return undefined;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (!hasFlag(damageFlags, DamageFlag.EXPLOSION)) {
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const room = game.GetRoom();
|
|
89
|
-
const roomListIndex = getRoomListIndex();
|
|
90
|
-
const roomCustomGridEntities = v.level.customGridEntities.get(roomListIndex);
|
|
91
|
-
if (roomCustomGridEntities === undefined) {
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const gridIndex = room.GetGridIndex(tookDamage.Position);
|
|
96
|
-
const data = roomCustomGridEntities.get(gridIndex);
|
|
97
|
-
if (data === undefined) {
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const gridEntity = room.GetGridEntity(gridIndex);
|
|
102
|
-
if (gridEntity === undefined) {
|
|
103
|
-
error(
|
|
104
|
-
`Failed to get the grid entity for a custom grid entity that broke at grid index: ${gridIndex}`,
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
postGridEntityCustomBrokenFire(gridEntity, data.gridEntityTypeCustom);
|
|
109
|
-
|
|
110
|
-
// Even though the custom grid entity is now broken, we do not want to remove it, as the end-user
|
|
111
|
-
// could intend for it to persist with different graphics (or take multiple hits to be destroyed).
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
60
|
// ModCallback.PRE_USE_ITEM (23)
|
|
116
61
|
// CollectibleType.WE_NEED_TO_GO_DEEPER (84)
|
|
117
62
|
function preUseItemWeNeedToGoDeeper(
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CacheFlag,
|
|
3
3
|
CollectibleType,
|
|
4
|
+
DamageFlag,
|
|
4
5
|
EntityType,
|
|
5
6
|
LevelCurse,
|
|
6
7
|
ModCallback,
|
|
@@ -348,7 +349,13 @@ function evaluateCacheFlying(player: EntityPlayer) {
|
|
|
348
349
|
|
|
349
350
|
// ModCallback.ENTITY_TAKE_DMG (11)
|
|
350
351
|
// EntityType.PLAYER (1)
|
|
351
|
-
function entityTakeDmgPlayer(
|
|
352
|
+
function entityTakeDmgPlayer(
|
|
353
|
+
_entity: Entity,
|
|
354
|
+
_damageAmount: float,
|
|
355
|
+
_damageFlags: BitFlags<DamageFlag>,
|
|
356
|
+
_damageSource: EntityRef,
|
|
357
|
+
_damageCountdownFrames: int,
|
|
358
|
+
) {
|
|
352
359
|
if (v.run.spamBloodRights) {
|
|
353
360
|
return false;
|
|
354
361
|
}
|
|
@@ -95,11 +95,11 @@ export function getLastCollectibleType(): CollectibleType {
|
|
|
95
95
|
/**
|
|
96
96
|
* Helper function to get an array that represents the all modded collectible types.
|
|
97
97
|
*
|
|
98
|
-
* This function is only useful when building collectible type objects. For most purposes, you
|
|
99
|
-
* should use the `getModdedCollectibleSet` helper function instead.
|
|
100
|
-
*
|
|
101
98
|
* Returns an empty array if there are no modded collectible types.
|
|
102
99
|
*
|
|
100
|
+
* This function is only useful when building collectible type objects. For most purposes, you
|
|
101
|
+
* should use the `getModdedCollectibleArray` or `getModdedCollectibleSet` helper function instead.
|
|
102
|
+
*
|
|
103
103
|
* (This function is named differently from the `getVanillaCollectibleTypeRange` function because
|
|
104
104
|
* all modded collectible types are contiguous. Thus, each value represents a real
|
|
105
105
|
* `CollectibleType`.)
|
|
@@ -189,6 +189,9 @@ export function getLastTrinketType(): TrinketType {
|
|
|
189
189
|
*
|
|
190
190
|
* Returns an empty array if there are no modded trinket types.
|
|
191
191
|
*
|
|
192
|
+
* This function is only useful when building collectible type objects. For most purposes, you
|
|
193
|
+
* should use the `getModdedCollectibleArray` or `getModdedCollectibleSet` helper function instead.
|
|
194
|
+
*
|
|
192
195
|
* This function can only be called if at least one callback has been executed. This is because not
|
|
193
196
|
* all trinkets will necessarily be present when a mod first loads (due to mod load order).
|
|
194
197
|
*/
|
package/src/functions/bosses.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
} from "isaac-typescript-definitions";
|
|
6
6
|
import { VectorZero } from "../core/constants";
|
|
7
7
|
import {
|
|
8
|
+
ALL_BOSSES_EXCLUDING_STORY_BOSSES_SET,
|
|
8
9
|
ALL_BOSSES_SET,
|
|
9
10
|
STAGE_TO_COMBINED_BOSS_SET_MAP,
|
|
10
11
|
STAGE_TO_STAGE_TYPE_TO_BOSS_SET_MAP,
|
|
@@ -13,7 +14,6 @@ import { SIN_ENTITY_TYPES_SET } from "../sets/sinEntityTypesSet";
|
|
|
13
14
|
import { getNPCs, spawnNPC } from "./entitiesSpecific";
|
|
14
15
|
import { getAliveNPCs } from "./npcs";
|
|
15
16
|
import { isRNG } from "./rng";
|
|
16
|
-
import { copySet } from "./set";
|
|
17
17
|
import { asNumber } from "./types";
|
|
18
18
|
import { repeat } from "./utils";
|
|
19
19
|
|
|
@@ -57,9 +57,16 @@ export function getAliveBosses(
|
|
|
57
57
|
* The set contains strings with the entity type and variant, separated by a period.
|
|
58
58
|
*
|
|
59
59
|
* Also see the `getBossSet` and `getCombinedBossSet` functions.
|
|
60
|
+
*
|
|
61
|
+
* @param includeStoryBosses Optional. Whether to include "story" bosses like Mom and It Lives!
|
|
62
|
+
* Default is true.
|
|
60
63
|
*/
|
|
61
|
-
export function getAllBossesSet(
|
|
62
|
-
|
|
64
|
+
export function getAllBossesSet(
|
|
65
|
+
includeStoryBosses = true,
|
|
66
|
+
): ReadonlySet<string> {
|
|
67
|
+
return includeStoryBosses
|
|
68
|
+
? ALL_BOSSES_SET
|
|
69
|
+
: ALL_BOSSES_EXCLUDING_STORY_BOSSES_SET;
|
|
63
70
|
}
|
|
64
71
|
|
|
65
72
|
/**
|
|
@@ -84,7 +91,7 @@ export function getBossSet(
|
|
|
84
91
|
return undefined;
|
|
85
92
|
}
|
|
86
93
|
|
|
87
|
-
return
|
|
94
|
+
return bossSet;
|
|
88
95
|
}
|
|
89
96
|
|
|
90
97
|
/**
|
|
@@ -117,13 +124,15 @@ export function getBosses(
|
|
|
117
124
|
*
|
|
118
125
|
* Also see the `getAllBossesSet` and `getBossSet` functions.
|
|
119
126
|
*/
|
|
120
|
-
export function getCombinedBossSet(
|
|
127
|
+
export function getCombinedBossSet(
|
|
128
|
+
stage: int,
|
|
129
|
+
): ReadonlySet<string> | undefined {
|
|
121
130
|
const bossSet = STAGE_TO_COMBINED_BOSS_SET_MAP.get(stage);
|
|
122
131
|
if (bossSet === undefined) {
|
|
123
132
|
return undefined;
|
|
124
133
|
}
|
|
125
134
|
|
|
126
|
-
return
|
|
135
|
+
return bossSet;
|
|
127
136
|
}
|
|
128
137
|
|
|
129
138
|
/** Helper function to check if the provided NPC is a Sin miniboss, such as Sloth or Lust. */
|
|
@@ -3,7 +3,7 @@ import { itemConfig } from "../core/cachedClasses";
|
|
|
3
3
|
import { getCollectibleArray } from "./collectibleSet";
|
|
4
4
|
import { getEnumValues } from "./enums";
|
|
5
5
|
import { hasFlag } from "./flag";
|
|
6
|
-
import {
|
|
6
|
+
import { getSortedSetValues } from "./set";
|
|
7
7
|
import { repeat } from "./utils";
|
|
8
8
|
|
|
9
9
|
const CACHE_FLAG_TO_COLLECTIBLES_MAP = new Map<
|
|
@@ -51,7 +51,7 @@ export function collectibleHasCacheFlag(
|
|
|
51
51
|
*/
|
|
52
52
|
export function getCollectiblesForCacheFlag(
|
|
53
53
|
cacheFlag: CacheFlag,
|
|
54
|
-
):
|
|
54
|
+
): ReadonlySet<CollectibleType> {
|
|
55
55
|
lazyInitCacheFlagMap();
|
|
56
56
|
|
|
57
57
|
const collectiblesSet = CACHE_FLAG_TO_COLLECTIBLES_MAP.get(cacheFlag);
|
|
@@ -59,7 +59,7 @@ export function getCollectiblesForCacheFlag(
|
|
|
59
59
|
return new Set();
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
return
|
|
62
|
+
return collectiblesSet;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/**
|
|
@@ -3,17 +3,17 @@ import { itemConfig } from "../core/cachedClasses";
|
|
|
3
3
|
import { getModdedCollectibleTypes } from "../features/firstLast";
|
|
4
4
|
import { getVanillaCollectibleTypeRange } from "./collectibles";
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const ALL_COLLECTIBLE_TYPES_ARRAY: CollectibleType[] = [];
|
|
7
|
+
const ALL_COLLECTIBLE_TYPES_SET = new Set<CollectibleType>();
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const VANILLA_COLLECTIBLE_TYPES_ARRAY: CollectibleType[] = [];
|
|
10
|
+
const VANILLA_COLLECTIBLE_TYPES_SET = new Set<CollectibleType>();
|
|
11
11
|
|
|
12
|
-
const
|
|
13
|
-
const
|
|
12
|
+
const MODDED_COLLECTIBLE_TYPES_ARRAY: CollectibleType[] = [];
|
|
13
|
+
const MODDED_COLLECTIBLE_TYPES_SET = new Set<CollectibleType>();
|
|
14
14
|
|
|
15
|
-
function
|
|
16
|
-
if (
|
|
15
|
+
function lazyInitVanillaCollectibleTypes() {
|
|
16
|
+
if (VANILLA_COLLECTIBLE_TYPES_ARRAY.length > 0) {
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -22,22 +22,22 @@ function lazyInitVanillaCollectibles() {
|
|
|
22
22
|
// Vanilla collectible types are not contiguous, so we must check every value.
|
|
23
23
|
const itemConfigItem = itemConfig.GetCollectible(collectibleType);
|
|
24
24
|
if (itemConfigItem !== undefined) {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
VANILLA_COLLECTIBLE_TYPES_ARRAY.push(collectibleType);
|
|
26
|
+
VANILLA_COLLECTIBLE_TYPES_SET.add(collectibleType);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
function
|
|
32
|
-
if (
|
|
31
|
+
function lazyInitModdedCollectibleTypes() {
|
|
32
|
+
if (MODDED_COLLECTIBLE_TYPES_ARRAY.length > 0) {
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
lazyInitVanillaCollectibleTypes();
|
|
37
37
|
|
|
38
|
-
for (const collectibleType of
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
for (const collectibleType of VANILLA_COLLECTIBLE_TYPES_ARRAY) {
|
|
39
|
+
ALL_COLLECTIBLE_TYPES_ARRAY.push(collectibleType);
|
|
40
|
+
ALL_COLLECTIBLE_TYPES_SET.add(collectibleType);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
const moddedCollectibleTypes = getModdedCollectibleTypes();
|
|
@@ -45,11 +45,11 @@ function lazyInitModdedCollectibles() {
|
|
|
45
45
|
// Modded collectible types are contiguous, but we check every value just in case.
|
|
46
46
|
const itemConfigItem = itemConfig.GetCollectible(collectibleType);
|
|
47
47
|
if (itemConfigItem !== undefined) {
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
MODDED_COLLECTIBLE_TYPES_ARRAY.push(collectibleType);
|
|
49
|
+
MODDED_COLLECTIBLE_TYPES_SET.add(collectibleType);
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
ALL_COLLECTIBLE_TYPES_ARRAY.push(collectibleType);
|
|
52
|
+
ALL_COLLECTIBLE_TYPES_SET.add(collectibleType);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -65,8 +65,8 @@ function lazyInitModdedCollectibles() {
|
|
|
65
65
|
* all collectibles will necessarily be present when a mod first loads (due to mod load order).
|
|
66
66
|
*/
|
|
67
67
|
export function getCollectibleArray(): readonly CollectibleType[] {
|
|
68
|
-
|
|
69
|
-
return
|
|
68
|
+
lazyInitModdedCollectibleTypes();
|
|
69
|
+
return ALL_COLLECTIBLE_TYPES_ARRAY;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
/**
|
|
@@ -79,8 +79,8 @@ export function getCollectibleArray(): readonly CollectibleType[] {
|
|
|
79
79
|
* all collectibles will necessarily be present when a mod first loads (due to mod load order).
|
|
80
80
|
*/
|
|
81
81
|
export function getCollectibleSet(): ReadonlySet<CollectibleType> {
|
|
82
|
-
|
|
83
|
-
return
|
|
82
|
+
lazyInitModdedCollectibleTypes();
|
|
83
|
+
return ALL_COLLECTIBLE_TYPES_SET;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
/**
|
|
@@ -93,8 +93,8 @@ export function getCollectibleSet(): ReadonlySet<CollectibleType> {
|
|
|
93
93
|
* all collectibles will necessarily be present when a mod first loads (due to mod load order).
|
|
94
94
|
*/
|
|
95
95
|
export function getModdedCollectibleArray(): readonly CollectibleType[] {
|
|
96
|
-
|
|
97
|
-
return
|
|
96
|
+
lazyInitModdedCollectibleTypes();
|
|
97
|
+
return MODDED_COLLECTIBLE_TYPES_ARRAY;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
/**
|
|
@@ -107,8 +107,8 @@ export function getModdedCollectibleArray(): readonly CollectibleType[] {
|
|
|
107
107
|
* all collectibles will necessarily be present when a mod first loads (due to mod load order).
|
|
108
108
|
*/
|
|
109
109
|
export function getModdedCollectibleSet(): ReadonlySet<CollectibleType> {
|
|
110
|
-
|
|
111
|
-
return
|
|
110
|
+
lazyInitModdedCollectibleTypes();
|
|
111
|
+
return MODDED_COLLECTIBLE_TYPES_SET;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
/**
|
|
@@ -118,8 +118,8 @@ export function getModdedCollectibleSet(): ReadonlySet<CollectibleType> {
|
|
|
118
118
|
* then use the `getVanillaCollectibleSet` helper function instead.
|
|
119
119
|
*/
|
|
120
120
|
export function getVanillaCollectibleArray(): readonly CollectibleType[] {
|
|
121
|
-
|
|
122
|
-
return
|
|
121
|
+
lazyInitVanillaCollectibleTypes();
|
|
122
|
+
return VANILLA_COLLECTIBLE_TYPES_ARRAY;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
/**
|
|
@@ -129,6 +129,6 @@ export function getVanillaCollectibleArray(): readonly CollectibleType[] {
|
|
|
129
129
|
* then use the `getVanillaCollectibleArray` helper function instead.
|
|
130
130
|
*/
|
|
131
131
|
export function getVanillaCollectibleSet(): ReadonlySet<CollectibleType> {
|
|
132
|
-
|
|
133
|
-
return
|
|
132
|
+
lazyInitVanillaCollectibleTypes();
|
|
133
|
+
return VANILLA_COLLECTIBLE_TYPES_SET;
|
|
134
134
|
}
|
|
@@ -4,7 +4,6 @@ import { getCollectibleArray } from "./collectibleSet";
|
|
|
4
4
|
import { getEnumValues } from "./enums";
|
|
5
5
|
import { getFlagName } from "./flag";
|
|
6
6
|
import { getPlayerCollectibleCount } from "./players";
|
|
7
|
-
import { copySet } from "./set";
|
|
8
7
|
|
|
9
8
|
const TAG_TO_COLLECTIBLE_TYPES_MAP = new Map<
|
|
10
9
|
ItemConfigTag,
|
|
@@ -59,7 +58,7 @@ export function collectibleHasTag(
|
|
|
59
58
|
*/
|
|
60
59
|
export function getCollectibleTypesWithTag(
|
|
61
60
|
itemConfigTag: ItemConfigTag,
|
|
62
|
-
):
|
|
61
|
+
): ReadonlySet<CollectibleType> {
|
|
63
62
|
// Lazy initialize the map.
|
|
64
63
|
if (TAG_TO_COLLECTIBLE_TYPES_MAP.size === 0) {
|
|
65
64
|
initTagMap();
|
|
@@ -72,7 +71,7 @@ export function getCollectibleTypesWithTag(
|
|
|
72
71
|
);
|
|
73
72
|
}
|
|
74
73
|
|
|
75
|
-
return
|
|
74
|
+
return collectibleTypes;
|
|
76
75
|
}
|
|
77
76
|
|
|
78
77
|
/** Returns the number of items that a player has towards a particular transformation. */
|
package/src/functions/eden.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { isHiddenCollectible, isPassiveCollectible } from "./collectibles";
|
|
|
3
3
|
import { getCollectibleArray } from "./collectibleSet";
|
|
4
4
|
import { collectibleHasTag } from "./collectibleTag";
|
|
5
5
|
import { getRandomSeed } from "./rng";
|
|
6
|
-
import {
|
|
6
|
+
import { getRandomSetElement } from "./set";
|
|
7
7
|
|
|
8
8
|
const EDEN_PASSIVE_COLLECTIBLES_SET = new Set<CollectibleType>();
|
|
9
9
|
|
|
@@ -19,13 +19,13 @@ function initCollectibleSet() {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export function getEdenPassives():
|
|
22
|
+
export function getEdenPassives(): ReadonlySet<CollectibleType> {
|
|
23
23
|
// Lazy initialize the set.
|
|
24
24
|
if (EDEN_PASSIVE_COLLECTIBLES_SET.size === 0) {
|
|
25
25
|
initCollectibleSet();
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
return
|
|
28
|
+
return EDEN_PASSIVE_COLLECTIBLES_SET;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export function getRandomEdenPassive(
|
package/src/functions/flag.ts
CHANGED
|
@@ -119,7 +119,7 @@ export function isEmptyFlag<T extends BitFlag | BitFlag128>(flag: T): boolean {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
|
-
* Helper function to determine whether damage to a player in the
|
|
122
|
+
* Helper function to determine whether damage to a player in the `ENTITY_TAKE_DMG` callback was
|
|
123
123
|
* self-inflicted. For example, damage from a Curse Room door, a Razor, or a Blood Donation Machine
|
|
124
124
|
* would count as self-inflicted damage.
|
|
125
125
|
*/
|
package/src/functions/flying.ts
CHANGED
|
@@ -47,11 +47,11 @@ const CONDITIONAL_FLYING_COLLECTIBLE_TYPES: readonly CollectibleType[] = [
|
|
|
47
47
|
*/
|
|
48
48
|
export function getFlyingCollectibles(
|
|
49
49
|
pruneConditionalItems: boolean,
|
|
50
|
-
):
|
|
50
|
+
): ReadonlySet<CollectibleType> {
|
|
51
51
|
// Instead of manually compiling a list of collectibles that grant flying, we can instead
|
|
52
52
|
// dynamically look for collectibles that have `CacheFlag.FLYING`.
|
|
53
|
-
const collectiblesWithFlyingCacheFlag =
|
|
54
|
-
CacheFlag.FLYING,
|
|
53
|
+
const collectiblesWithFlyingCacheFlag = copySet(
|
|
54
|
+
getCollectiblesForCacheFlag(CacheFlag.FLYING),
|
|
55
55
|
);
|
|
56
56
|
|
|
57
57
|
// None of the collectibles with a cache of "all" grant flying, so we can safely remove them from
|
|
@@ -80,7 +80,7 @@ export function getFlyingCollectibles(
|
|
|
80
80
|
export function getFlyingTrinkets(): ReadonlySet<TrinketType> {
|
|
81
81
|
// We use a different algorithm than the "getFlyingCollectibles" function because Azazel's Stump
|
|
82
82
|
// has a cache of "all".
|
|
83
|
-
return
|
|
83
|
+
return FLYING_TRINKETS;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
export function hasFlyingTemporaryEffect(player: EntityPlayer): boolean {
|
package/src/functions/input.ts
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
} from "isaac-typescript-definitions";
|
|
7
7
|
import { KEYBOARD_TO_STRING } from "../maps/keyboardToString";
|
|
8
8
|
import { getEnumValues } from "./enums";
|
|
9
|
-
import { copySet } from "./set";
|
|
10
9
|
import { trimPrefix } from "./string";
|
|
11
10
|
|
|
12
11
|
const MODIFIER_KEYS: readonly Keyboard[] = [
|
|
@@ -52,12 +51,12 @@ export function controllerToString(controller: Controller): string | undefined {
|
|
|
52
51
|
return trimPrefix(key, "BUTTON_");
|
|
53
52
|
}
|
|
54
53
|
|
|
55
|
-
export function getMoveActions():
|
|
56
|
-
return
|
|
54
|
+
export function getMoveActions(): ReadonlySet<ButtonAction> {
|
|
55
|
+
return MOVEMENT_ACTIONS_SET;
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
export function getShootActions():
|
|
60
|
-
return
|
|
58
|
+
export function getShootActions(): ReadonlySet<ButtonAction> {
|
|
59
|
+
return SHOOTING_ACTIONS_SET;
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
/** Iterates over all inputs to determine if a particular button is pressed (i.e. held down). */
|