isaacscript-common 29.5.1 → 29.5.3
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/index.rollup.d.ts +9 -5
- package/dist/isaacscript-common.lua +40 -14
- package/dist/src/classes/features/callbackLogic/EsauJrDetection.d.ts +1 -1
- package/dist/src/classes/features/callbackLogic/EsauJrDetection.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/EsauJrDetection.lua +2 -2
- package/dist/src/classes/features/callbackLogic/FlipDetection.d.ts +1 -1
- package/dist/src/classes/features/callbackLogic/FlipDetection.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/FlipDetection.lua +2 -2
- package/dist/src/classes/features/callbackLogic/GameReorderedCallbacks.d.ts +1 -1
- package/dist/src/classes/features/callbackLogic/GameReorderedCallbacks.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/GameReorderedCallbacks.lua +2 -2
- package/dist/src/classes/features/callbackLogic/PlayerCollectibleDetection.d.ts +1 -1
- package/dist/src/classes/features/callbackLogic/PlayerCollectibleDetection.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/PlayerCollectibleDetection.lua +2 -2
- package/dist/src/classes/features/other/PreventCollectibleRotation.d.ts +3 -1
- package/dist/src/classes/features/other/PreventCollectibleRotation.d.ts.map +1 -1
- package/dist/src/classes/features/other/PreventCollectibleRotation.lua +31 -5
- package/dist/src/functions/utils.d.ts +2 -0
- package/dist/src/functions/utils.d.ts.map +1 -1
- package/dist/src/functions/utils.lua +2 -0
- package/dist/src/indexLua.d.ts +185 -0
- package/dist/src/indexLua.d.ts.map +1 -0
- package/dist/src/indexLua.lua +1114 -0
- package/package.json +1 -1
- package/src/classes/features/callbackLogic/EsauJrDetection.ts +2 -2
- package/src/classes/features/callbackLogic/FlipDetection.ts +2 -2
- package/src/classes/features/callbackLogic/GameReorderedCallbacks.ts +2 -2
- package/src/classes/features/callbackLogic/PlayerCollectibleDetection.ts +2 -2
- package/src/classes/features/other/PreventCollectibleRotation.ts +54 -2
- package/src/functions/utils.ts +2 -0
package/package.json
CHANGED
|
@@ -34,7 +34,7 @@ export class EsauJrDetection extends Feature {
|
|
|
34
34
|
// 3
|
|
35
35
|
[
|
|
36
36
|
ModCallback.POST_USE_ITEM,
|
|
37
|
-
this.
|
|
37
|
+
this.postUseItemEsauJr,
|
|
38
38
|
[CollectibleType.ESAU_JR],
|
|
39
39
|
],
|
|
40
40
|
];
|
|
@@ -81,7 +81,7 @@ export class EsauJrDetection extends Feature {
|
|
|
81
81
|
|
|
82
82
|
// ModCallback.POST_USE_ITEM (3)
|
|
83
83
|
// CollectibleType.ESAU_JR (703)
|
|
84
|
-
private
|
|
84
|
+
private postUseItemEsauJr = (
|
|
85
85
|
_collectibleType: CollectibleType,
|
|
86
86
|
_rng: RNG,
|
|
87
87
|
player: EntityPlayer,
|
|
@@ -27,7 +27,7 @@ export class FlipDetection extends Feature {
|
|
|
27
27
|
|
|
28
28
|
this.callbacksUsed = [
|
|
29
29
|
// 3
|
|
30
|
-
[ModCallback.POST_USE_ITEM, this.
|
|
30
|
+
[ModCallback.POST_USE_ITEM, this.postUseItemFlip, [CollectibleType.FLIP]],
|
|
31
31
|
];
|
|
32
32
|
|
|
33
33
|
this.postFlip = postFlip;
|
|
@@ -36,7 +36,7 @@ export class FlipDetection extends Feature {
|
|
|
36
36
|
|
|
37
37
|
// ModCallback.POST_USE_ITEM (3)
|
|
38
38
|
// CollectibleType.FLIP (711)
|
|
39
|
-
private
|
|
39
|
+
private postUseItemFlip = (
|
|
40
40
|
_collectibleType: CollectibleType,
|
|
41
41
|
_rng: RNG,
|
|
42
42
|
player: EntityPlayer,
|
|
@@ -52,7 +52,7 @@ export class GameReorderedCallbacks extends Feature {
|
|
|
52
52
|
// 3
|
|
53
53
|
[
|
|
54
54
|
ModCallback.POST_USE_ITEM,
|
|
55
|
-
this.
|
|
55
|
+
this.postUseItemGlowingHourGlass,
|
|
56
56
|
[CollectibleType.GLOWING_HOUR_GLASS],
|
|
57
57
|
],
|
|
58
58
|
|
|
@@ -77,7 +77,7 @@ export class GameReorderedCallbacks extends Feature {
|
|
|
77
77
|
|
|
78
78
|
// ModCallback.POST_USE_ITEM (3)
|
|
79
79
|
// CollectibleType.GLOWING_HOUR_GLASS (422)
|
|
80
|
-
private
|
|
80
|
+
private postUseItemGlowingHourGlass = (): boolean | undefined => {
|
|
81
81
|
// If Glowing Hourglass is used on the first room of a floor, it will send the player to the
|
|
82
82
|
// previous floor without triggering the `POST_NEW_LEVEL` callback. Manually check for this.
|
|
83
83
|
this.usedGlowingHourGlass = true;
|
|
@@ -63,7 +63,7 @@ export class PlayerCollectibleDetection extends Feature {
|
|
|
63
63
|
|
|
64
64
|
this.callbacksUsed = [
|
|
65
65
|
// 3
|
|
66
|
-
[ModCallback.POST_USE_ITEM, this.
|
|
66
|
+
[ModCallback.POST_USE_ITEM, this.postUseItemD4, [CollectibleType.D4]],
|
|
67
67
|
];
|
|
68
68
|
|
|
69
69
|
this.customCallbacksUsed = [
|
|
@@ -135,7 +135,7 @@ export class PlayerCollectibleDetection extends Feature {
|
|
|
135
135
|
|
|
136
136
|
// ModCallback.POST_USE_ITEM (3)
|
|
137
137
|
// CollectibleType.D4 (284)
|
|
138
|
-
private
|
|
138
|
+
private postUseItemD4 = (
|
|
139
139
|
_collectibleType: CollectibleType,
|
|
140
140
|
_rng: RNG,
|
|
141
141
|
player: EntityPlayer,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CardType,
|
|
3
3
|
CollectibleType,
|
|
4
|
+
DiceFloorSubType,
|
|
4
5
|
ModCallback,
|
|
5
6
|
PickupVariant,
|
|
6
7
|
} from "isaac-typescript-definitions";
|
|
8
|
+
import { game } from "../../../core/cachedClasses";
|
|
7
9
|
import { Exported } from "../../../decorators";
|
|
8
10
|
import { ISCFeature } from "../../../enums/ISCFeature";
|
|
9
11
|
import { ModCallbackCustom } from "../../../enums/ModCallbackCustom";
|
|
@@ -13,12 +15,27 @@ import { getCollectibles } from "../../../functions/pickupsSpecific";
|
|
|
13
15
|
import { isCollectible } from "../../../functions/pickupVariants";
|
|
14
16
|
import { asCollectibleType } from "../../../functions/types";
|
|
15
17
|
import { PickupIndex } from "../../../types/PickupIndex";
|
|
18
|
+
import { ReadonlySet } from "../../../types/ReadonlySet";
|
|
16
19
|
import { Feature } from "../../private/Feature";
|
|
17
20
|
import { PickupIndexCreation } from "./PickupIndexCreation";
|
|
18
21
|
|
|
22
|
+
const ROLL_COLLECTIBLE_TYPES = new ReadonlySet([
|
|
23
|
+
// The `PRE_USE_ITEM` D6 callback is fired for D6, D100, Dice Shard, 4-pip Dice Room, and 6-pip
|
|
24
|
+
// Dice Room.
|
|
25
|
+
CollectibleType.D6, // 105
|
|
26
|
+
CollectibleType.ETERNAL_D6, // 609
|
|
27
|
+
CollectibleType.SPINDOWN_DICE, // 723
|
|
28
|
+
]);
|
|
29
|
+
|
|
30
|
+
const ROLL_FLOOR_DICE_FLOOR_SUB_TYPES = new ReadonlySet([
|
|
31
|
+
DiceFloorSubType.FOUR_PIP,
|
|
32
|
+
DiceFloorSubType.SIX_PIP,
|
|
33
|
+
]);
|
|
34
|
+
|
|
19
35
|
const v = {
|
|
20
36
|
run: {
|
|
21
37
|
trackedCollectibles: new Map<PickupIndex, CollectibleType>(),
|
|
38
|
+
rollGameFrame: null as int | null,
|
|
22
39
|
},
|
|
23
40
|
};
|
|
24
41
|
|
|
@@ -38,25 +55,39 @@ export class PreventCollectibleRotation extends Feature {
|
|
|
38
55
|
// 5
|
|
39
56
|
[
|
|
40
57
|
ModCallback.POST_USE_CARD,
|
|
41
|
-
this.
|
|
58
|
+
this.postUseCardSoulOfIsaac,
|
|
42
59
|
[CardType.SOUL_ISAAC],
|
|
43
60
|
],
|
|
61
|
+
|
|
62
|
+
// 23, 105
|
|
63
|
+
[ModCallback.PRE_USE_ITEM, this.preUseItem],
|
|
44
64
|
];
|
|
45
65
|
|
|
46
66
|
this.customCallbacksUsed = [
|
|
67
|
+
[ModCallbackCustom.POST_DICE_ROOM_ACTIVATED, this.postDiceRoomActivated],
|
|
47
68
|
[ModCallbackCustom.POST_PICKUP_CHANGED, this.postPickupChanged],
|
|
48
69
|
];
|
|
49
70
|
|
|
50
71
|
this.pickupIndexCreation = pickupIndexCreation;
|
|
51
72
|
}
|
|
52
73
|
|
|
74
|
+
private preUseItem = (
|
|
75
|
+
collectibleType: CollectibleType,
|
|
76
|
+
): boolean | undefined => {
|
|
77
|
+
if (ROLL_COLLECTIBLE_TYPES.has(collectibleType)) {
|
|
78
|
+
v.run.rollGameFrame = game.GetFrameCount();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return undefined;
|
|
82
|
+
};
|
|
83
|
+
|
|
53
84
|
/**
|
|
54
85
|
* Soul of Isaac causes items to flip. We assume that the player deliberately wants to roll a
|
|
55
86
|
* quest item, so we delete all tracked items in the current room.
|
|
56
87
|
*/
|
|
57
88
|
// ModCallback.POST_USE_CARD (5)
|
|
58
89
|
// Card.SOUL_ISAAC (81)
|
|
59
|
-
private
|
|
90
|
+
private postUseCardSoulOfIsaac = () => {
|
|
60
91
|
const collectibles = getCollectibles();
|
|
61
92
|
for (const collectible of collectibles) {
|
|
62
93
|
const pickupIndex = this.pickupIndexCreation.getPickupIndex(collectible);
|
|
@@ -64,6 +95,16 @@ export class PreventCollectibleRotation extends Feature {
|
|
|
64
95
|
}
|
|
65
96
|
};
|
|
66
97
|
|
|
98
|
+
// ModCallbackCustom.POST_DICE_ROOM_ACTIVATED
|
|
99
|
+
private postDiceRoomActivated = (
|
|
100
|
+
_player: EntityPlayer,
|
|
101
|
+
diceFloorSubType: DiceFloorSubType,
|
|
102
|
+
) => {
|
|
103
|
+
if (ROLL_FLOOR_DICE_FLOOR_SUB_TYPES.has(diceFloorSubType)) {
|
|
104
|
+
v.run.trackedCollectibles.clear();
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
67
108
|
// ModCallbackCustom.POST_PICKUP_CHANGED
|
|
68
109
|
private postPickupChanged = (
|
|
69
110
|
pickup: EntityPickup,
|
|
@@ -91,6 +132,17 @@ export class PreventCollectibleRotation extends Feature {
|
|
|
91
132
|
return;
|
|
92
133
|
}
|
|
93
134
|
|
|
135
|
+
// It can take a frame after the activation of the D6 for the sub-type to change.
|
|
136
|
+
const gameFrameCount = game.GetFrameCount();
|
|
137
|
+
if (
|
|
138
|
+
v.run.rollGameFrame !== null &&
|
|
139
|
+
(gameFrameCount === v.run.rollGameFrame ||
|
|
140
|
+
gameFrameCount === v.run.rollGameFrame + 1)
|
|
141
|
+
) {
|
|
142
|
+
v.run.trackedCollectibles.delete(pickupIndex);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
|
|
94
146
|
if (trackedCollectibleType !== asCollectibleType(newSubType)) {
|
|
95
147
|
// This collectible has rotated, so restore it back to the way it was.
|
|
96
148
|
setCollectibleSubType(pickup, trackedCollectibleType);
|
package/src/functions/utils.ts
CHANGED
|
@@ -176,6 +176,8 @@ export function repeat(n: int, func: (i: int) => void): void {
|
|
|
176
176
|
* useful as a means to prevent unused variables.)
|
|
177
177
|
*
|
|
178
178
|
* This function does not actually do anything. (It is an "empty" function.)
|
|
179
|
+
*
|
|
180
|
+
* @allowEmptyVariadic
|
|
179
181
|
*/
|
|
180
182
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
181
183
|
export function todo(...args: unknown[]): void {}
|