isaacscript-common 7.2.0 → 7.3.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/itemPickup.d.ts.map +1 -1
- package/dist/callbacks/itemPickup.lua +3 -1
- package/dist/callbacks/postCustomDoorEnter.d.ts.map +1 -1
- package/dist/callbacks/postCustomDoorEnter.lua +14 -11
- package/dist/callbacks/postItemDischarged.d.ts.map +1 -1
- package/dist/callbacks/postItemDischarged.lua +3 -1
- package/dist/callbacks/postPlayerChangeStat.d.ts.map +1 -1
- package/dist/callbacks/postPlayerChangeStat.lua +10 -7
- package/dist/callbacks/postSlotDestroyed.lua +3 -3
- package/dist/core/constants.d.ts +2 -2
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/constants.lua +3 -1
- package/dist/core/constantsFirstLast.d.ts +2 -0
- package/dist/core/constantsFirstLast.d.ts.map +1 -1
- package/dist/core/constantsFirstLast.lua +36 -9
- package/dist/enums/SaveDataKey.d.ts +11 -0
- package/dist/enums/SaveDataKey.d.ts.map +1 -0
- package/dist/enums/{private/SaveDataKey.lua → SaveDataKey.lua} +2 -0
- package/dist/enums/index.d.ts +1 -0
- package/dist/enums/index.d.ts.map +1 -1
- package/dist/enums/index.lua +8 -0
- package/dist/features/customGridEntity.d.ts.map +1 -1
- package/dist/features/customGridEntity.lua +3 -1
- package/dist/features/customStage/backdrop.lua +4 -2
- package/dist/features/customStage/customStageGridEntities.d.ts.map +1 -1
- package/dist/features/customStage/customStageGridEntities.lua +3 -1
- package/dist/features/customStage/exports.d.ts.map +1 -1
- package/dist/features/customStage/exports.lua +3 -1
- package/dist/features/customStage/shadows.d.ts.map +1 -1
- package/dist/features/customStage/shadows.lua +2 -1
- package/dist/features/deployJSONRoom.lua +13 -10
- package/dist/features/extraConsoleCommands/listCommands.d.ts.map +1 -1
- package/dist/features/extraConsoleCommands/listCommands.lua +8 -2
- package/dist/features/saveDataManager/exports.d.ts +2 -1
- package/dist/features/saveDataManager/exports.d.ts.map +1 -1
- package/dist/features/saveDataManager/main.d.ts +1 -1
- package/dist/features/saveDataManager/main.d.ts.map +1 -1
- package/dist/features/saveDataManager/main.lua +1 -1
- package/dist/functions/bitSet128.d.ts.map +1 -1
- package/dist/functions/bosses.d.ts.map +1 -1
- package/dist/functions/bosses.lua +3 -1
- package/dist/functions/collectibles.d.ts.map +1 -1
- package/dist/functions/deepCopy.lua +2 -1
- package/dist/functions/doors.d.ts.map +1 -1
- package/dist/functions/doors.lua +3 -1
- package/dist/functions/entities.lua +2 -1
- package/dist/functions/gridEntities.lua +2 -1
- package/dist/functions/gridEntitiesSpecific.d.ts.map +1 -1
- package/dist/functions/gridEntitiesSpecific.lua +5 -3
- package/dist/functions/input.d.ts +1 -1
- package/dist/functions/input.d.ts.map +1 -1
- package/dist/functions/input.lua +1 -1
- package/dist/functions/kColor.d.ts.map +1 -1
- package/dist/functions/levelGrid.d.ts.map +1 -1
- package/dist/functions/levelGrid.lua +3 -1
- package/dist/functions/nextStage.d.ts.map +1 -1
- package/dist/functions/nextStage.lua +7 -5
- package/dist/functions/npcs.d.ts.map +1 -1
- package/dist/functions/npcs.lua +4 -2
- package/dist/functions/pills.d.ts.map +1 -1
- package/dist/functions/pills.lua +9 -3
- package/dist/functions/playerIndex.d.ts.map +1 -1
- package/dist/functions/playerIndex.lua +2 -1
- package/dist/functions/players.d.ts +1 -1
- package/dist/functions/players.d.ts.map +1 -1
- package/dist/functions/players.lua +13 -15
- package/dist/functions/pocketItems.d.ts.map +1 -1
- package/dist/functions/pocketItems.lua +3 -1
- package/dist/functions/rng.d.ts.map +1 -1
- package/dist/functions/rng.lua +3 -0
- package/dist/functions/rooms.d.ts +4 -4
- package/dist/functions/rooms.d.ts.map +1 -1
- package/dist/functions/rooms.lua +17 -16
- package/dist/functions/spawnCollectible.d.ts.map +1 -1
- package/dist/functions/stage.d.ts.map +1 -1
- package/dist/functions/stage.lua +8 -2
- package/dist/functions/trinkets.d.ts.map +1 -1
- package/dist/functions/trinkets.lua +4 -2
- package/dist/functions/types.d.ts +71 -0
- package/dist/functions/types.d.ts.map +1 -1
- package/dist/functions/types.lua +70 -0
- package/dist/functions/vector.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/callbacks/itemPickup.ts +5 -2
- package/src/callbacks/postCustomDoorEnter.ts +18 -11
- package/src/callbacks/postItemDischarged.ts +2 -1
- package/src/callbacks/postPlayerChangeStat.ts +4 -8
- package/src/callbacks/postSlotDestroyed.ts +3 -2
- package/src/callbacks/reorderedCallbacks.ts +2 -2
- package/src/classes/DefaultMap.ts +1 -1
- package/src/core/constants.ts +3 -3
- package/src/core/constantsFirstLast.ts +29 -14
- package/src/enums/SaveDataKey.ts +10 -0
- package/src/enums/index.ts +1 -0
- package/src/enums/indexTypeDoc.ts +1 -0
- package/src/features/customGridEntity.ts +2 -1
- package/src/features/customStage/backdrop.ts +4 -2
- package/src/features/customStage/customStageGridEntities.ts +2 -1
- package/src/features/customStage/exports.ts +5 -4
- package/src/features/customStage/shadows.ts +2 -1
- package/src/features/deployJSONRoom.ts +14 -19
- package/src/features/extraConsoleCommands/listCommands.ts +3 -2
- package/src/features/saveDataManager/exports.ts +4 -4
- package/src/features/saveDataManager/main.ts +1 -1
- package/src/features/saveDataManager/save.ts +1 -1
- package/src/functions/bitSet128.ts +1 -5
- package/src/functions/bosses.ts +2 -1
- package/src/functions/cards.ts +3 -3
- package/src/functions/collectibles.ts +2 -8
- package/src/functions/color.ts +1 -1
- package/src/functions/deepCopy.ts +2 -2
- package/src/functions/dimensions.ts +1 -1
- package/src/functions/doors.ts +2 -2
- package/src/functions/entities.ts +2 -2
- package/src/functions/gridEntities.ts +2 -2
- package/src/functions/gridEntitiesSpecific.ts +4 -3
- package/src/functions/input.ts +2 -2
- package/src/functions/jsonHelpers.ts +1 -1
- package/src/functions/kColor.ts +1 -5
- package/src/functions/levelGrid.ts +3 -2
- package/src/functions/nextStage.ts +6 -5
- package/src/functions/npcs.ts +3 -2
- package/src/functions/pills.ts +11 -9
- package/src/functions/playerIndex.ts +3 -1
- package/src/functions/players.ts +5 -6
- package/src/functions/pocketItems.ts +4 -4
- package/src/functions/rng.ts +8 -5
- package/src/functions/rooms.ts +26 -26
- package/src/functions/spawnCollectible.ts +1 -2
- package/src/functions/stage.ts +3 -2
- package/src/functions/trinkets.ts +6 -5
- package/src/functions/types.ts +111 -0
- package/src/functions/vector.ts +1 -5
- package/dist/enums/private/SaveDataKey.d.ts +0 -7
- package/dist/enums/private/SaveDataKey.d.ts.map +0 -1
- package/src/enums/private/SaveDataKey.ts +0 -6
package/src/functions/types.ts
CHANGED
|
@@ -1,3 +1,114 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Card,
|
|
3
|
+
CollectibleType,
|
|
4
|
+
LevelStage,
|
|
5
|
+
NpcState,
|
|
6
|
+
PillColor,
|
|
7
|
+
PillEffect,
|
|
8
|
+
PlayerType,
|
|
9
|
+
TrinketType,
|
|
10
|
+
} from "isaac-typescript-definitions";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Helper function to safely cast a `number` to a `Card`. (This is better than using the `as`
|
|
14
|
+
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
15
|
+
*
|
|
16
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
17
|
+
*/
|
|
18
|
+
export function asCard(num: number): Card {
|
|
19
|
+
return num;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Helper function to safely cast a `number` to a `CollectibleType`. (This is better than using the
|
|
24
|
+
* `as` TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
25
|
+
*
|
|
26
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
27
|
+
*/
|
|
28
|
+
export function asCollectibleType(num: number): CollectibleType {
|
|
29
|
+
return num;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Helper function to safely cast a `number` to a `LevelStage`. (This is better than using the `as`
|
|
34
|
+
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
35
|
+
*
|
|
36
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
37
|
+
*/
|
|
38
|
+
export function asLevelStage(num: number): LevelStage {
|
|
39
|
+
return num;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Helper function to safely cast a `number` to a `NpcState`. (This is better than using the `as`
|
|
44
|
+
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
45
|
+
*
|
|
46
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
47
|
+
*/
|
|
48
|
+
export function asNpcState(num: number): NpcState {
|
|
49
|
+
return num;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Helper function to safely cast an enum to a `number`. (This is better than using the `as`
|
|
54
|
+
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
55
|
+
*
|
|
56
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
57
|
+
*/
|
|
58
|
+
export function asNumber(num: number): number {
|
|
59
|
+
return num;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Helper function to safely cast a `number` to a `PillColor`. (This is better than using the `as`
|
|
64
|
+
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
65
|
+
*
|
|
66
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
67
|
+
*/
|
|
68
|
+
export function asPillColor(num: number): PillColor {
|
|
69
|
+
return num;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Helper function to safely cast a `number` to a `PillEffect`. (This is better than using the `as`
|
|
74
|
+
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
75
|
+
*
|
|
76
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
77
|
+
*/
|
|
78
|
+
export function asPillEffect(num: number): PillEffect {
|
|
79
|
+
return num;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Helper function to safely cast a `number` to a `PlayerType`. (This is better than using the `as`
|
|
84
|
+
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
85
|
+
*
|
|
86
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
87
|
+
*/
|
|
88
|
+
export function asPlayerType(num: number): PlayerType {
|
|
89
|
+
return num;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Helper function to safely cast an enum to a `string`. (This is better than using the `as`
|
|
94
|
+
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
95
|
+
*
|
|
96
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
97
|
+
*/
|
|
98
|
+
export function asString(str: string): string {
|
|
99
|
+
return str;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Helper function to safely cast a `number` to a `TrinketType`. (This is better than using the `as`
|
|
104
|
+
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
105
|
+
*
|
|
106
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
107
|
+
*/
|
|
108
|
+
export function asTrinketType(num: number): TrinketType {
|
|
109
|
+
return num;
|
|
110
|
+
}
|
|
111
|
+
|
|
1
112
|
export function isBoolean(variable: unknown): variable is boolean {
|
|
2
113
|
return type(variable) === "boolean";
|
|
3
114
|
}
|
package/src/functions/vector.ts
CHANGED
|
@@ -36,11 +36,7 @@ export function deserializeVector(vector: SerializedVector): Vector {
|
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
const [x, y] = getNumbersFromTable(
|
|
40
|
-
vector as LuaMap<string, unknown>,
|
|
41
|
-
OBJECT_NAME,
|
|
42
|
-
...KEYS,
|
|
43
|
-
);
|
|
39
|
+
const [x, y] = getNumbersFromTable(vector, OBJECT_NAME, ...KEYS);
|
|
44
40
|
|
|
45
41
|
if (x === undefined) {
|
|
46
42
|
error(
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SaveDataKey.d.ts","sourceRoot":"","sources":["../../../src/enums/private/SaveDataKey.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,UAAU,eAAe;IACzB,GAAG,QAAQ;IACX,KAAK,UAAU;IACf,IAAI,SAAS;CACd"}
|