isaacscript-common 25.2.0 → 25.4.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/index.rollup.d.ts +27 -2
- package/dist/isaacscript-common.lua +803 -693
- package/dist/src/classes/ModFeature.d.ts.map +1 -1
- package/dist/src/classes/ModFeature.lua +12 -5
- package/dist/src/classes/callbacks/PostAmbushFinished.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostAmbushFinished.lua +4 -3
- package/dist/src/classes/callbacks/PostAmbushStarted.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostAmbushStarted.lua +4 -3
- package/dist/src/classes/callbacks/PostBombInitLate.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostBombInitLate.lua +6 -5
- package/dist/src/classes/callbacks/PostBoneSwing.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostBoneSwing.lua +5 -4
- package/dist/src/classes/callbacks/PostCollectibleEmpty.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostCollectibleEmpty.lua +6 -5
- package/dist/src/classes/callbacks/PostCollectibleInitFirst.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostCollectibleInitFirst.lua +6 -5
- package/dist/src/classes/callbacks/PostCursedTeleport.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostCursedTeleport.lua +14 -13
- package/dist/src/classes/callbacks/PostDiceRoomActivated.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostDiceRoomActivated.lua +4 -3
- package/dist/src/classes/callbacks/PostEffectInitLate.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostEffectInitLate.lua +6 -5
- package/dist/src/classes/callbacks/PostEffectStateChanged.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostEffectStateChanged.lua +8 -7
- package/dist/src/classes/callbacks/PostFamiliarInitLate.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostFamiliarInitLate.lua +6 -5
- package/dist/src/classes/callbacks/PostFamiliarStateChanged.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostFamiliarStateChanged.lua +8 -7
- package/dist/src/classes/callbacks/PostGameStartedReordered.d.ts +2 -0
- package/dist/src/classes/callbacks/PostGameStartedReordered.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostGameStartedReordered.lua +3 -0
- package/dist/src/classes/callbacks/PostGameStartedReorderedLast.d.ts +2 -0
- package/dist/src/classes/callbacks/PostGameStartedReorderedLast.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostGameStartedReorderedLast.lua +3 -0
- package/dist/src/classes/callbacks/PostGreedModeWave.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostGreedModeWave.lua +4 -3
- package/dist/src/classes/callbacks/PostHolyMantleRemoved.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostHolyMantleRemoved.lua +5 -4
- package/dist/src/classes/callbacks/PostItemDischarge.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostItemDischarge.lua +20 -19
- package/dist/src/classes/callbacks/PostKeyboardChanged.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostKeyboardChanged.lua +8 -7
- package/dist/src/classes/callbacks/PostKnifeInitLate.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostKnifeInitLate.lua +6 -5
- package/dist/src/classes/callbacks/PostLaserInitLate.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostLaserInitLate.lua +6 -5
- package/dist/src/classes/callbacks/PostNPCInitLate.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostNPCInitLate.lua +6 -5
- package/dist/src/classes/callbacks/PostNPCStateChanged.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostNPCStateChanged.lua +8 -7
- package/dist/src/classes/callbacks/PostPickupCollect.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostPickupCollect.lua +6 -5
- package/dist/src/classes/callbacks/PostPickupInitLate.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostPickupInitLate.lua +6 -5
- package/dist/src/classes/callbacks/PostPickupStateChanged.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostPickupStateChanged.lua +8 -7
- package/dist/src/classes/callbacks/PostPlayerChangeHealth.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostPlayerChangeHealth.lua +8 -7
- package/dist/src/classes/callbacks/PostPlayerChangeStat.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostPlayerChangeStat.lua +8 -7
- package/dist/src/classes/callbacks/PostPlayerChangeType.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostPlayerChangeType.lua +8 -7
- package/dist/src/classes/callbacks/PostPlayerFatalDamage.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostPlayerFatalDamage.lua +6 -5
- package/dist/src/classes/callbacks/PostPlayerInitLate.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostPlayerInitLate.lua +6 -5
- package/dist/src/classes/callbacks/PostProjectileInitLate.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostProjectileInitLate.lua +6 -5
- package/dist/src/classes/callbacks/PostPurchase.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostPurchase.lua +5 -4
- package/dist/src/classes/callbacks/PostRoomClearChanged.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostRoomClearChanged.lua +5 -4
- package/dist/src/classes/callbacks/PostSacrifice.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostSacrifice.lua +5 -4
- package/dist/src/classes/callbacks/PostTearInitLate.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostTearInitLate.lua +6 -5
- package/dist/src/classes/callbacks/PostTearInitVeryLate.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostTearInitVeryLate.lua +6 -5
- package/dist/src/classes/callbacks/PostTransformation.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostTransformation.lua +8 -7
- package/dist/src/classes/callbacks/PostTrinketBreak.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostTrinketBreak.lua +9 -8
- package/dist/src/classes/callbacks/PreNewLevel.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PreNewLevel.lua +4 -3
- package/dist/src/classes/features/callbackLogic/CustomGridEntities.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/CustomGridEntities.lua +21 -20
- package/dist/src/classes/features/callbackLogic/CustomRevive.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/CustomRevive.lua +18 -17
- package/dist/src/classes/features/callbackLogic/EsauJrDetection.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/EsauJrDetection.lua +11 -10
- package/dist/src/classes/features/callbackLogic/FlipDetection.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/FlipDetection.lua +4 -3
- package/dist/src/classes/features/callbackLogic/GridEntityCollisionDetection.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/GridEntityCollisionDetection.lua +8 -7
- package/dist/src/classes/features/callbackLogic/GridEntityUpdateDetection.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/GridEntityUpdateDetection.lua +9 -8
- package/dist/src/classes/features/callbackLogic/ItemPickupDetection.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/ItemPickupDetection.lua +7 -6
- package/dist/src/classes/features/callbackLogic/PickupChangeDetection.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/PickupChangeDetection.lua +11 -10
- package/dist/src/classes/features/callbackLogic/PlayerCollectibleDetection.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/PlayerCollectibleDetection.lua +20 -19
- package/dist/src/classes/features/callbackLogic/PlayerReorderedCallbacks.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/PlayerReorderedCallbacks.lua +15 -14
- package/dist/src/classes/features/callbackLogic/SlotDestroyedDetection.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/SlotDestroyedDetection.lua +6 -5
- package/dist/src/classes/features/callbackLogic/SlotRenderDetection.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/SlotRenderDetection.lua +15 -14
- package/dist/src/classes/features/callbackLogic/SlotUpdateDetection.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/SlotUpdateDetection.lua +6 -5
- package/dist/src/classes/features/other/CollectibleItemPoolType.d.ts.map +1 -1
- package/dist/src/classes/features/other/CollectibleItemPoolType.lua +6 -5
- package/dist/src/classes/features/other/CustomItemPools.d.ts.map +1 -1
- package/dist/src/classes/features/other/CustomItemPools.lua +6 -5
- package/dist/src/classes/features/other/CustomPickups.d.ts.map +1 -1
- package/dist/src/classes/features/other/CustomStages.d.ts.map +1 -1
- package/dist/src/classes/features/other/CustomStages.lua +17 -26
- package/dist/src/classes/features/other/CustomTrapdoors.d.ts.map +1 -1
- package/dist/src/classes/features/other/CustomTrapdoors.lua +36 -35
- package/dist/src/classes/features/other/DisableAllSound.d.ts.map +1 -1
- package/dist/src/classes/features/other/DisableAllSound.lua +10 -9
- package/dist/src/classes/features/other/DisableInputs.d.ts.map +1 -1
- package/dist/src/classes/features/other/DisableInputs.lua +21 -20
- package/dist/src/classes/features/other/ExtraConsoleCommands.lua +19 -19
- package/dist/src/classes/features/other/NoSirenSteal.d.ts.map +1 -1
- package/dist/src/classes/features/other/NoSirenSteal.lua +5 -4
- package/dist/src/classes/features/other/Pause.d.ts.map +1 -1
- package/dist/src/classes/features/other/Pause.lua +20 -19
- package/dist/src/classes/features/other/PersistentEntities.d.ts.map +1 -1
- package/dist/src/classes/features/other/PersistentEntities.lua +20 -19
- package/dist/src/classes/features/other/PickupIndexCreation.d.ts.map +1 -1
- package/dist/src/classes/features/other/PickupIndexCreation.lua +29 -28
- package/dist/src/classes/features/other/PlayerInventory.d.ts.map +1 -1
- package/dist/src/classes/features/other/PlayerInventory.lua +9 -8
- package/dist/src/classes/features/other/PonyDetection.d.ts.map +1 -1
- package/dist/src/classes/features/other/PonyDetection.lua +8 -7
- package/dist/src/classes/features/other/PressInput.d.ts.map +1 -1
- package/dist/src/classes/features/other/PressInput.lua +7 -6
- package/dist/src/classes/features/other/PreventChildEntities.d.ts.map +1 -1
- package/dist/src/classes/features/other/PreventChildEntities.lua +7 -6
- package/dist/src/classes/features/other/PreventCollectibleRotation.d.ts.map +1 -1
- package/dist/src/classes/features/other/PreventCollectibleRotation.lua +7 -6
- package/dist/src/classes/features/other/PreventGridEntityRespawn.d.ts.map +1 -1
- package/dist/src/classes/features/other/PreventGridEntityRespawn.lua +16 -15
- package/dist/src/classes/features/other/RoomClearFrame.d.ts.map +1 -1
- package/dist/src/classes/features/other/RoomClearFrame.lua +6 -5
- package/dist/src/classes/features/other/RoomHistory.d.ts.map +1 -1
- package/dist/src/classes/features/other/RoomHistory.lua +9 -8
- package/dist/src/classes/features/other/RunInNFrames.d.ts.map +1 -1
- package/dist/src/classes/features/other/RunInNFrames.lua +14 -13
- package/dist/src/classes/features/other/RunNextRoom.d.ts.map +1 -1
- package/dist/src/classes/features/other/RunNextRoom.lua +6 -5
- package/dist/src/classes/features/other/SaveDataManager.d.ts +1 -0
- package/dist/src/classes/features/other/SaveDataManager.d.ts.map +1 -1
- package/dist/src/classes/features/other/SaveDataManager.lua +12 -0
- package/dist/src/classes/features/other/StageHistory.d.ts.map +1 -1
- package/dist/src/classes/features/other/StageHistory.lua +7 -6
- package/dist/src/classes/features/other/TaintedLazarusPlayers.d.ts.map +1 -1
- package/dist/src/classes/features/other/TaintedLazarusPlayers.lua +18 -17
- package/dist/src/classes/features/other/customStages/streakText.d.ts +3 -25
- package/dist/src/classes/features/other/customStages/streakText.d.ts.map +1 -1
- package/dist/src/classes/features/other/customStages/streakText.lua +16 -26
- package/dist/src/classes/features/other/customStages/v.d.ts +25 -0
- package/dist/src/classes/features/other/customStages/v.d.ts.map +1 -0
- package/dist/src/classes/features/other/customStages/v.lua +16 -0
- package/dist/src/classes/features/other/customStages/versusScreen.d.ts +2 -8
- package/dist/src/classes/features/other/customStages/versusScreen.d.ts.map +1 -1
- package/dist/src/classes/features/other/customStages/versusScreen.lua +6 -4
- package/dist/src/enums/ModCallbackCustom.d.ts +6 -0
- package/dist/src/enums/ModCallbackCustom.d.ts.map +1 -1
- package/dist/src/functions/decorators.d.ts +15 -0
- package/dist/src/functions/decorators.d.ts.map +1 -1
- package/dist/src/functions/decorators.lua +21 -5
- package/dist/src/interfaces/SaveData.d.ts.map +1 -1
- package/dist/src/interfaces/private/AddCallbackParametersCustom.d.ts +4 -2
- package/dist/src/interfaces/private/AddCallbackParametersCustom.d.ts.map +1 -1
- package/dist/src/shouldFire.d.ts +1 -0
- package/dist/src/shouldFire.d.ts.map +1 -1
- package/dist/src/shouldFire.lua +5 -0
- package/package.json +1 -1
- package/src/classes/ModFeature.ts +16 -4
- package/src/classes/callbacks/PostAmbushFinished.ts +9 -7
- package/src/classes/callbacks/PostAmbushStarted.ts +9 -7
- package/src/classes/callbacks/PostBombInitLate.ts +9 -7
- package/src/classes/callbacks/PostBoneSwing.ts +9 -7
- package/src/classes/callbacks/PostCollectibleEmpty.ts +9 -7
- package/src/classes/callbacks/PostCollectibleInitFirst.ts +9 -7
- package/src/classes/callbacks/PostCursedTeleport.ts +20 -24
- package/src/classes/callbacks/PostDiceRoomActivated.ts +9 -7
- package/src/classes/callbacks/PostEffectInitLate.ts +9 -7
- package/src/classes/callbacks/PostEffectStateChanged.ts +9 -7
- package/src/classes/callbacks/PostFamiliarInitLate.ts +9 -7
- package/src/classes/callbacks/PostFamiliarStateChanged.ts +9 -7
- package/src/classes/callbacks/PostGameStartedReordered.ts +3 -0
- package/src/classes/callbacks/PostGameStartedReorderedLast.ts +3 -0
- package/src/classes/callbacks/PostGreedModeWave.ts +9 -7
- package/src/classes/callbacks/PostHolyMantleRemoved.ts +9 -7
- package/src/classes/callbacks/PostItemDischarge.ts +21 -27
- package/src/classes/callbacks/PostKeyboardChanged.ts +11 -9
- package/src/classes/callbacks/PostKnifeInitLate.ts +9 -7
- package/src/classes/callbacks/PostLaserInitLate.ts +9 -7
- package/src/classes/callbacks/PostNPCInitLate.ts +9 -7
- package/src/classes/callbacks/PostNPCStateChanged.ts +11 -12
- package/src/classes/callbacks/PostPickupCollect.ts +9 -7
- package/src/classes/callbacks/PostPickupInitLate.ts +9 -7
- package/src/classes/callbacks/PostPickupStateChanged.ts +9 -7
- package/src/classes/callbacks/PostPlayerChangeHealth.ts +10 -8
- package/src/classes/callbacks/PostPlayerChangeStat.ts +11 -10
- package/src/classes/callbacks/PostPlayerChangeType.ts +13 -11
- package/src/classes/callbacks/PostPlayerFatalDamage.ts +10 -8
- package/src/classes/callbacks/PostPlayerInitLate.ts +9 -7
- package/src/classes/callbacks/PostProjectileInitLate.ts +9 -7
- package/src/classes/callbacks/PostPurchase.ts +11 -9
- package/src/classes/callbacks/PostRoomClearChanged.ts +10 -8
- package/src/classes/callbacks/PostSacrifice.ts +9 -7
- package/src/classes/callbacks/PostTearInitLate.ts +9 -7
- package/src/classes/callbacks/PostTearInitVeryLate.ts +9 -7
- package/src/classes/callbacks/PostTransformation.ts +12 -10
- package/src/classes/callbacks/PostTrinketBreak.ts +12 -16
- package/src/classes/callbacks/PreNewLevel.ts +9 -7
- package/src/classes/features/callbackLogic/CustomGridEntities.ts +23 -21
- package/src/classes/features/callbackLogic/CustomRevive.ts +26 -27
- package/src/classes/features/callbackLogic/EsauJrDetection.ts +19 -17
- package/src/classes/features/callbackLogic/FlipDetection.ts +10 -8
- package/src/classes/features/callbackLogic/GridEntityCollisionDetection.ts +11 -9
- package/src/classes/features/callbackLogic/GridEntityUpdateDetection.ts +13 -12
- package/src/classes/features/callbackLogic/ItemPickupDetection.ts +10 -8
- package/src/classes/features/callbackLogic/PickupChangeDetection.ts +12 -10
- package/src/classes/features/callbackLogic/PlayerCollectibleDetection.ts +21 -27
- package/src/classes/features/callbackLogic/PlayerReorderedCallbacks.ts +22 -29
- package/src/classes/features/callbackLogic/SlotDestroyedDetection.ts +9 -7
- package/src/classes/features/callbackLogic/SlotRenderDetection.ts +15 -13
- package/src/classes/features/callbackLogic/SlotUpdateDetection.ts +9 -7
- package/src/classes/features/other/CollectibleItemPoolType.ts +9 -7
- package/src/classes/features/other/CustomItemPools.ts +9 -7
- package/src/classes/features/other/CustomPickups.ts +0 -1
- package/src/classes/features/other/CustomStages.ts +16 -44
- package/src/classes/features/other/CustomTrapdoors.ts +53 -54
- package/src/classes/features/other/DisableAllSound.ts +13 -11
- package/src/classes/features/other/DisableInputs.ts +39 -37
- package/src/classes/features/other/ExtraConsoleCommands.ts +19 -19
- package/src/classes/features/other/NoSirenSteal.ts +11 -9
- package/src/classes/features/other/Pause.ts +21 -19
- package/src/classes/features/other/PersistentEntities.ts +33 -31
- package/src/classes/features/other/PickupIndexCreation.ts +35 -33
- package/src/classes/features/other/PlayerInventory.ts +14 -12
- package/src/classes/features/other/PonyDetection.ts +11 -9
- package/src/classes/features/other/PressInput.ts +11 -9
- package/src/classes/features/other/PreventChildEntities.ts +10 -8
- package/src/classes/features/other/PreventCollectibleRotation.ts +20 -18
- package/src/classes/features/other/PreventGridEntityRespawn.ts +18 -18
- package/src/classes/features/other/RoomClearFrame.ts +12 -10
- package/src/classes/features/other/RoomHistory.ts +13 -11
- package/src/classes/features/other/RunInNFrames.ts +19 -17
- package/src/classes/features/other/RunNextRoom.ts +10 -8
- package/src/classes/features/other/SaveDataManager.ts +11 -0
- package/src/classes/features/other/StageHistory.ts +11 -9
- package/src/classes/features/other/TaintedLazarusPlayers.ts +31 -30
- package/src/classes/features/other/customStages/streakText.ts +14 -44
- package/src/classes/features/other/customStages/v.ts +31 -0
- package/src/classes/features/other/customStages/versusScreen.ts +2 -10
- package/src/enums/ModCallbackCustom.ts +6 -0
- package/src/functions/decorators.ts +45 -4
- package/src/interfaces/SaveData.ts +0 -1
- package/src/interfaces/private/AddCallbackParametersCustom.ts +2 -0
- package/src/shouldFire.ts +10 -0
|
@@ -4,12 +4,14 @@ import { shouldFirePickup } from "../../shouldFire";
|
|
|
4
4
|
import { DefaultMap } from "../DefaultMap";
|
|
5
5
|
import { CustomCallback } from "../private/CustomCallback";
|
|
6
6
|
|
|
7
|
+
const v = {
|
|
8
|
+
run: {
|
|
9
|
+
stateMap: new DefaultMap<PtrHash, int, [int]>((state) => state),
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
|
|
7
13
|
export class PostPickupStateChanged extends CustomCallback<ModCallbackCustom.POST_PICKUP_STATE_CHANGED> {
|
|
8
|
-
public override v =
|
|
9
|
-
run: {
|
|
10
|
-
stateMap: new DefaultMap<PtrHash, int, [int]>((state) => state),
|
|
11
|
-
},
|
|
12
|
-
};
|
|
14
|
+
public override v = v;
|
|
13
15
|
|
|
14
16
|
constructor() {
|
|
15
17
|
super();
|
|
@@ -25,12 +27,12 @@ export class PostPickupStateChanged extends CustomCallback<ModCallbackCustom.POS
|
|
|
25
27
|
// ModCallback.POST_PICKUP_UPDATE (35)
|
|
26
28
|
private postPickupUpdate = (pickup: EntityPickup) => {
|
|
27
29
|
const ptrHash = GetPtrHash(pickup);
|
|
28
|
-
const previousState =
|
|
30
|
+
const previousState = v.run.stateMap.getAndSetDefault(
|
|
29
31
|
ptrHash,
|
|
30
32
|
pickup.State,
|
|
31
33
|
);
|
|
32
34
|
const currentState = pickup.State;
|
|
33
|
-
|
|
35
|
+
v.run.stateMap.set(ptrHash, currentState);
|
|
34
36
|
|
|
35
37
|
if (previousState !== currentState) {
|
|
36
38
|
this.fire(pickup, previousState, currentState);
|
|
@@ -8,14 +8,16 @@ import { PlayerIndex } from "../../types/PlayerIndex";
|
|
|
8
8
|
import { DefaultMap } from "../DefaultMap";
|
|
9
9
|
import { CustomCallback } from "../private/CustomCallback";
|
|
10
10
|
|
|
11
|
+
const v = {
|
|
12
|
+
run: {
|
|
13
|
+
playersHealthMap: new DefaultMap<PlayerIndex, Map<HealthType, int>>(
|
|
14
|
+
() => new Map(),
|
|
15
|
+
),
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
11
19
|
export class PostPlayerChangeHealth extends CustomCallback<ModCallbackCustom.POST_PLAYER_CHANGE_HEALTH> {
|
|
12
|
-
public override v =
|
|
13
|
-
run: {
|
|
14
|
-
playersHealthMap: new DefaultMap<PlayerIndex, Map<HealthType, int>>(
|
|
15
|
-
() => new Map(),
|
|
16
|
-
),
|
|
17
|
-
},
|
|
18
|
-
};
|
|
20
|
+
public override v = v;
|
|
19
21
|
|
|
20
22
|
constructor() {
|
|
21
23
|
super();
|
|
@@ -37,7 +39,7 @@ export class PostPlayerChangeHealth extends CustomCallback<ModCallbackCustom.POS
|
|
|
37
39
|
// the player switches between the two.
|
|
38
40
|
const playerIndex = getPlayerIndex(player, true);
|
|
39
41
|
const playerHealthMap =
|
|
40
|
-
|
|
42
|
+
v.run.playersHealthMap.getAndSetDefault(playerIndex);
|
|
41
43
|
|
|
42
44
|
for (const healthType of HEALTH_TYPE_VALUES) {
|
|
43
45
|
const storedHealthValue = playerHealthMap.get(healthType);
|
|
@@ -13,15 +13,17 @@ import { PossibleStatType } from "../../types/PossibleStatType";
|
|
|
13
13
|
import { DefaultMap } from "../DefaultMap";
|
|
14
14
|
import { CustomCallback } from "../private/CustomCallback";
|
|
15
15
|
|
|
16
|
+
const v = {
|
|
17
|
+
run: {
|
|
18
|
+
playersStatMap: new DefaultMap<
|
|
19
|
+
PlayerIndex,
|
|
20
|
+
Map<StatType, PossibleStatType>
|
|
21
|
+
>(() => new Map()),
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
16
25
|
export class PostPlayerChangeStat extends CustomCallback<ModCallbackCustom.POST_PLAYER_CHANGE_STAT> {
|
|
17
|
-
public override v =
|
|
18
|
-
run: {
|
|
19
|
-
playersStatMap: new DefaultMap<
|
|
20
|
-
PlayerIndex,
|
|
21
|
-
Map<StatType, PossibleStatType>
|
|
22
|
-
>(() => new Map()),
|
|
23
|
-
},
|
|
24
|
-
};
|
|
26
|
+
public override v = v;
|
|
25
27
|
|
|
26
28
|
constructor() {
|
|
27
29
|
super();
|
|
@@ -42,8 +44,7 @@ export class PostPlayerChangeStat extends CustomCallback<ModCallbackCustom.POST_
|
|
|
42
44
|
// we don't differentiate between The Forgotten and The Soul, the callback will fire every time
|
|
43
45
|
// the player switches between the two.
|
|
44
46
|
const playerIndex = getPlayerIndex(player, true);
|
|
45
|
-
const playerStatMap =
|
|
46
|
-
this.v.run.playersStatMap.getAndSetDefault(playerIndex);
|
|
47
|
+
const playerStatMap = v.run.playersStatMap.getAndSetDefault(playerIndex);
|
|
47
48
|
|
|
48
49
|
for (const statType of STAT_TYPE_VALUES) {
|
|
49
50
|
const storedStatValue = playerStatMap.get(statType);
|
|
@@ -9,16 +9,18 @@ import { PlayerIndex } from "../../types/PlayerIndex";
|
|
|
9
9
|
import { DefaultMap } from "../DefaultMap";
|
|
10
10
|
import { CustomCallback } from "../private/CustomCallback";
|
|
11
11
|
|
|
12
|
+
const v = {
|
|
13
|
+
run: {
|
|
14
|
+
playersCharacterMap: new DefaultMap<
|
|
15
|
+
PlayerIndex,
|
|
16
|
+
PlayerType,
|
|
17
|
+
[character: PlayerType]
|
|
18
|
+
>((character: PlayerType) => character), // eslint-disable-line isaacscript/strict-enums
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
12
22
|
export class PostPlayerChangeType extends CustomCallback<ModCallbackCustom.POST_PLAYER_CHANGE_TYPE> {
|
|
13
|
-
public override v =
|
|
14
|
-
run: {
|
|
15
|
-
playersCharacterMap: new DefaultMap<
|
|
16
|
-
PlayerIndex,
|
|
17
|
-
PlayerType,
|
|
18
|
-
[character: PlayerType]
|
|
19
|
-
>((character: PlayerType) => character), // eslint-disable-line isaacscript/strict-enums
|
|
20
|
-
},
|
|
21
|
-
};
|
|
23
|
+
public override v = v;
|
|
22
24
|
|
|
23
25
|
constructor() {
|
|
24
26
|
super();
|
|
@@ -37,12 +39,12 @@ export class PostPlayerChangeType extends CustomCallback<ModCallbackCustom.POST_
|
|
|
37
39
|
private postPEffectReordered = (player: EntityPlayer) => {
|
|
38
40
|
const character = player.GetPlayerType();
|
|
39
41
|
const storedCharacter = defaultMapGetPlayer(
|
|
40
|
-
|
|
42
|
+
v.run.playersCharacterMap,
|
|
41
43
|
player,
|
|
42
44
|
character,
|
|
43
45
|
);
|
|
44
46
|
if (character !== storedCharacter) {
|
|
45
|
-
mapSetPlayer(
|
|
47
|
+
mapSetPlayer(v.run.playersCharacterMap, player, character);
|
|
46
48
|
this.fire(player, storedCharacter, character);
|
|
47
49
|
}
|
|
48
50
|
};
|
|
@@ -23,13 +23,15 @@ import { shouldFirePlayer } from "../../shouldFire";
|
|
|
23
23
|
import { PlayerIndex } from "../../types/PlayerIndex";
|
|
24
24
|
import { CustomCallback } from "../private/CustomCallback";
|
|
25
25
|
|
|
26
|
+
const v = {
|
|
27
|
+
run: {
|
|
28
|
+
/** Needed to detect if Glass Cannon will kill the player or not. */
|
|
29
|
+
playersLastDamageGameFrame: new Map<PlayerIndex, int>(),
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
26
33
|
export class PostPlayerFatalDamage extends CustomCallback<ModCallbackCustom.POST_PLAYER_FATAL_DAMAGE> {
|
|
27
|
-
public override v =
|
|
28
|
-
run: {
|
|
29
|
-
/** Needed to detect if Glass Cannon will kill the player or not. */
|
|
30
|
-
playersLastDamageGameFrame: new Map<PlayerIndex, int>(),
|
|
31
|
-
},
|
|
32
|
-
};
|
|
34
|
+
public override v = v;
|
|
33
35
|
|
|
34
36
|
constructor() {
|
|
35
37
|
super();
|
|
@@ -100,10 +102,10 @@ export class PostPlayerFatalDamage extends CustomCallback<ModCallbackCustom.POST
|
|
|
100
102
|
|
|
101
103
|
const gameFrameCount = game.GetFrameCount();
|
|
102
104
|
const lastDamageGameFrame = mapGetPlayer(
|
|
103
|
-
|
|
105
|
+
v.run.playersLastDamageGameFrame,
|
|
104
106
|
player,
|
|
105
107
|
);
|
|
106
|
-
mapSetPlayer(
|
|
108
|
+
mapSetPlayer(v.run.playersLastDamageGameFrame, player, gameFrameCount);
|
|
107
109
|
|
|
108
110
|
// If the player has a revival item such as Dead Cat, this will not be fatal damage.
|
|
109
111
|
if (willPlayerRevive(player)) {
|
|
@@ -7,12 +7,14 @@ import { shouldFirePlayer } from "../../shouldFire";
|
|
|
7
7
|
import { PlayerIndex } from "../../types/PlayerIndex";
|
|
8
8
|
import { CustomCallback } from "../private/CustomCallback";
|
|
9
9
|
|
|
10
|
+
const v = {
|
|
11
|
+
run: {
|
|
12
|
+
playersFiredSet: new Set<PlayerIndex>(),
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
10
16
|
export class PostPlayerInitLate extends CustomCallback<ModCallbackCustom.POST_PLAYER_INIT_LATE> {
|
|
11
|
-
public override v =
|
|
12
|
-
run: {
|
|
13
|
-
playersFiredSet: new Set<PlayerIndex>(),
|
|
14
|
-
},
|
|
15
|
-
};
|
|
17
|
+
public override v = v;
|
|
16
18
|
|
|
17
19
|
constructor() {
|
|
18
20
|
super();
|
|
@@ -29,8 +31,8 @@ export class PostPlayerInitLate extends CustomCallback<ModCallbackCustom.POST_PL
|
|
|
29
31
|
|
|
30
32
|
// ModCallbackCustom.POST_PEFFECT_UPDATE_REORDERED
|
|
31
33
|
private postPEffectUpdateReordered = (player: EntityPlayer) => {
|
|
32
|
-
if (!setHasPlayer(
|
|
33
|
-
setAddPlayer(
|
|
34
|
+
if (!setHasPlayer(v.run.playersFiredSet, player)) {
|
|
35
|
+
setAddPlayer(v.run.playersFiredSet, player);
|
|
34
36
|
this.fire(player);
|
|
35
37
|
}
|
|
36
38
|
};
|
|
@@ -3,12 +3,14 @@ import { ModCallbackCustom } from "../../enums/ModCallbackCustom";
|
|
|
3
3
|
import { shouldFireProjectile } from "../../shouldFire";
|
|
4
4
|
import { CustomCallback } from "../private/CustomCallback";
|
|
5
5
|
|
|
6
|
+
const v = {
|
|
7
|
+
room: {
|
|
8
|
+
firedSet: new Set<PtrHash>(),
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
|
|
6
12
|
export class PostProjectileInitLate extends CustomCallback<ModCallbackCustom.POST_PROJECTILE_INIT_LATE> {
|
|
7
|
-
public override v =
|
|
8
|
-
room: {
|
|
9
|
-
firedSet: new Set<PtrHash>(),
|
|
10
|
-
},
|
|
11
|
-
};
|
|
13
|
+
public override v = v;
|
|
12
14
|
|
|
13
15
|
constructor() {
|
|
14
16
|
super();
|
|
@@ -24,8 +26,8 @@ export class PostProjectileInitLate extends CustomCallback<ModCallbackCustom.POS
|
|
|
24
26
|
// ModCallback.POST_PROJECTILE_UPDATE (44)
|
|
25
27
|
private postProjectileUpdate = (projectile: EntityProjectile): void => {
|
|
26
28
|
const ptrHash = GetPtrHash(projectile);
|
|
27
|
-
if (!
|
|
28
|
-
|
|
29
|
+
if (!v.room.firedSet.has(ptrHash)) {
|
|
30
|
+
v.room.firedSet.add(ptrHash);
|
|
29
31
|
this.fire(projectile);
|
|
30
32
|
}
|
|
31
33
|
};
|
|
@@ -14,14 +14,16 @@ import {
|
|
|
14
14
|
|
|
15
15
|
type T = ModCallbackCustom.POST_PURCHASE;
|
|
16
16
|
|
|
17
|
+
const v = {
|
|
18
|
+
room: {
|
|
19
|
+
playersHoldingItemOnLastFrameMap: new DefaultMap<PlayerIndex, boolean>(
|
|
20
|
+
false,
|
|
21
|
+
),
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
17
25
|
export class PostPurchase extends CustomCallback<T> {
|
|
18
|
-
public override v =
|
|
19
|
-
room: {
|
|
20
|
-
playersHoldingItemOnLastFrameMap: new DefaultMap<PlayerIndex, boolean>(
|
|
21
|
-
false,
|
|
22
|
-
),
|
|
23
|
-
},
|
|
24
|
-
};
|
|
26
|
+
public override v = v;
|
|
25
27
|
|
|
26
28
|
constructor() {
|
|
27
29
|
super();
|
|
@@ -53,11 +55,11 @@ export class PostPurchase extends CustomCallback<T> {
|
|
|
53
55
|
private postPEffectUpdateReordered = (player: EntityPlayer) => {
|
|
54
56
|
const isHoldingItem = player.IsHoldingItem();
|
|
55
57
|
const wasHoldingItemOnLastFrame = defaultMapGetPlayer(
|
|
56
|
-
|
|
58
|
+
v.room.playersHoldingItemOnLastFrameMap,
|
|
57
59
|
player,
|
|
58
60
|
);
|
|
59
61
|
mapSetPlayer(
|
|
60
|
-
|
|
62
|
+
v.room.playersHoldingItemOnLastFrameMap,
|
|
61
63
|
player,
|
|
62
64
|
isHoldingItem,
|
|
63
65
|
);
|
|
@@ -9,12 +9,14 @@ import {
|
|
|
9
9
|
|
|
10
10
|
type T = ModCallbackCustom.POST_ROOM_CLEAR_CHANGED;
|
|
11
11
|
|
|
12
|
+
const v = {
|
|
13
|
+
room: {
|
|
14
|
+
cleared: false,
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
12
18
|
export class PostRoomClearChanged extends CustomCallback<T> {
|
|
13
|
-
public override v =
|
|
14
|
-
room: {
|
|
15
|
-
cleared: false,
|
|
16
|
-
},
|
|
17
|
-
};
|
|
19
|
+
public override v = v;
|
|
18
20
|
|
|
19
21
|
constructor() {
|
|
20
22
|
super();
|
|
@@ -44,8 +46,8 @@ export class PostRoomClearChanged extends CustomCallback<T> {
|
|
|
44
46
|
const room = game.GetRoom();
|
|
45
47
|
const roomClear = room.IsClear();
|
|
46
48
|
|
|
47
|
-
if (roomClear !==
|
|
48
|
-
|
|
49
|
+
if (roomClear !== v.room.cleared) {
|
|
50
|
+
v.room.cleared = roomClear;
|
|
49
51
|
this.fire(roomClear);
|
|
50
52
|
}
|
|
51
53
|
};
|
|
@@ -55,6 +57,6 @@ export class PostRoomClearChanged extends CustomCallback<T> {
|
|
|
55
57
|
const room = game.GetRoom();
|
|
56
58
|
const roomClear = room.IsClear();
|
|
57
59
|
|
|
58
|
-
|
|
60
|
+
v.room.cleared = roomClear;
|
|
59
61
|
};
|
|
60
62
|
}
|
|
@@ -5,12 +5,14 @@ import { hasFlag } from "../../functions/flag";
|
|
|
5
5
|
import { shouldFirePlayer } from "../../shouldFire";
|
|
6
6
|
import { CustomCallback } from "../private/CustomCallback";
|
|
7
7
|
|
|
8
|
+
const v = {
|
|
9
|
+
level: {
|
|
10
|
+
numSacrifices: 0,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
8
14
|
export class PostSacrifice extends CustomCallback<ModCallbackCustom.POST_SACRIFICE> {
|
|
9
|
-
public override v =
|
|
10
|
-
level: {
|
|
11
|
-
numSacrifices: 0,
|
|
12
|
-
},
|
|
13
|
-
};
|
|
15
|
+
public override v = v;
|
|
14
16
|
|
|
15
17
|
constructor() {
|
|
16
18
|
super();
|
|
@@ -35,8 +37,8 @@ export class PostSacrifice extends CustomCallback<ModCallbackCustom.POST_SACRIFI
|
|
|
35
37
|
const isSpikeDamage = hasFlag(damageFlags, DamageFlag.SPIKES);
|
|
36
38
|
|
|
37
39
|
if (roomType === RoomType.SACRIFICE && isSpikeDamage) {
|
|
38
|
-
|
|
39
|
-
this.fire(player,
|
|
40
|
+
v.level.numSacrifices++;
|
|
41
|
+
this.fire(player, v.level.numSacrifices);
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
return undefined;
|
|
@@ -3,12 +3,14 @@ import { ModCallbackCustom } from "../../enums/ModCallbackCustom";
|
|
|
3
3
|
import { shouldFireTear } from "../../shouldFire";
|
|
4
4
|
import { CustomCallback } from "../private/CustomCallback";
|
|
5
5
|
|
|
6
|
+
const v = {
|
|
7
|
+
room: {
|
|
8
|
+
firedSet: new Set<PtrHash>(),
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
|
|
6
12
|
export class PostTearInitLate extends CustomCallback<ModCallbackCustom.POST_TEAR_INIT_LATE> {
|
|
7
|
-
public override v =
|
|
8
|
-
room: {
|
|
9
|
-
firedSet: new Set<PtrHash>(),
|
|
10
|
-
},
|
|
11
|
-
};
|
|
13
|
+
public override v = v;
|
|
12
14
|
|
|
13
15
|
constructor() {
|
|
14
16
|
super();
|
|
@@ -24,8 +26,8 @@ export class PostTearInitLate extends CustomCallback<ModCallbackCustom.POST_TEAR
|
|
|
24
26
|
// ModCallback.POST_TEAR_UPDATE (40)
|
|
25
27
|
private postTearUpdate = (tear: EntityTear): void => {
|
|
26
28
|
const ptrHash = GetPtrHash(tear);
|
|
27
|
-
if (!
|
|
28
|
-
|
|
29
|
+
if (!v.room.firedSet.has(ptrHash)) {
|
|
30
|
+
v.room.firedSet.add(ptrHash);
|
|
29
31
|
this.fire(tear);
|
|
30
32
|
}
|
|
31
33
|
};
|
|
@@ -3,12 +3,14 @@ import { ModCallbackCustom } from "../../enums/ModCallbackCustom";
|
|
|
3
3
|
import { shouldFireTear } from "../../shouldFire";
|
|
4
4
|
import { CustomCallback } from "../private/CustomCallback";
|
|
5
5
|
|
|
6
|
+
const v = {
|
|
7
|
+
room: {
|
|
8
|
+
firedSet: new Set<PtrHash>(),
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
|
|
6
12
|
export class PostTearInitVeryLate extends CustomCallback<ModCallbackCustom.POST_TEAR_INIT_VERY_LATE> {
|
|
7
|
-
public override v =
|
|
8
|
-
room: {
|
|
9
|
-
firedSet: new Set<PtrHash>(),
|
|
10
|
-
},
|
|
11
|
-
};
|
|
13
|
+
public override v = v;
|
|
12
14
|
|
|
13
15
|
constructor() {
|
|
14
16
|
super();
|
|
@@ -29,8 +31,8 @@ export class PostTearInitVeryLate extends CustomCallback<ModCallbackCustom.POST_
|
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
const index = GetPtrHash(tear);
|
|
32
|
-
if (!
|
|
33
|
-
|
|
34
|
+
if (!v.room.firedSet.has(index)) {
|
|
35
|
+
v.room.firedSet.add(index);
|
|
34
36
|
this.fire(tear);
|
|
35
37
|
}
|
|
36
38
|
};
|
|
@@ -12,16 +12,18 @@ import {
|
|
|
12
12
|
|
|
13
13
|
type T = ModCallbackCustom.POST_TRANSFORMATION;
|
|
14
14
|
|
|
15
|
+
const v = {
|
|
16
|
+
run: {
|
|
17
|
+
// We cannot use a nested `DefaultMap` here.
|
|
18
|
+
playersTransformationsMap: new DefaultMap<
|
|
19
|
+
PlayerIndex,
|
|
20
|
+
Map<PlayerForm, boolean>
|
|
21
|
+
>(() => new Map()),
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
15
25
|
export class PostTransformation extends CustomCallback<T> {
|
|
16
|
-
public override v =
|
|
17
|
-
run: {
|
|
18
|
-
// We cannot use a nested `DefaultMap` here.
|
|
19
|
-
playersTransformationsMap: new DefaultMap<
|
|
20
|
-
PlayerIndex,
|
|
21
|
-
Map<PlayerForm, boolean>
|
|
22
|
-
>(() => new Map()),
|
|
23
|
-
},
|
|
24
|
-
};
|
|
26
|
+
public override v = v;
|
|
25
27
|
|
|
26
28
|
constructor() {
|
|
27
29
|
super();
|
|
@@ -49,7 +51,7 @@ export class PostTransformation extends CustomCallback<T> {
|
|
|
49
51
|
// ModCallbackCustom.POST_PEFFECT_UPDATE_REORDERED
|
|
50
52
|
private postPEffectUpdateReordered = (player: EntityPlayer) => {
|
|
51
53
|
const playerTransformationsMap = defaultMapGetPlayer(
|
|
52
|
-
|
|
54
|
+
v.run.playersTransformationsMap,
|
|
53
55
|
player,
|
|
54
56
|
);
|
|
55
57
|
|
|
@@ -16,15 +16,17 @@ const TRINKETS_THAT_CAN_BREAK = [
|
|
|
16
16
|
TrinketType.WALNUT,
|
|
17
17
|
] as const;
|
|
18
18
|
|
|
19
|
+
const v = {
|
|
20
|
+
run: {
|
|
21
|
+
// We cannot use a nested `DefaultMap` here.
|
|
22
|
+
playersTrinketMap: new DefaultMap<PlayerIndex, Map<TrinketType, int>>(
|
|
23
|
+
() => new Map(),
|
|
24
|
+
),
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
19
28
|
export class PostTrinketBreak extends CustomCallback<ModCallbackCustom.POST_TRINKET_BREAK> {
|
|
20
|
-
public override v =
|
|
21
|
-
run: {
|
|
22
|
-
// We cannot use a nested `DefaultMap` here.
|
|
23
|
-
playersTrinketMap: new DefaultMap<PlayerIndex, Map<TrinketType, int>>(
|
|
24
|
-
() => new Map(),
|
|
25
|
-
),
|
|
26
|
-
},
|
|
27
|
-
};
|
|
29
|
+
public override v = v;
|
|
28
30
|
|
|
29
31
|
constructor() {
|
|
30
32
|
super();
|
|
@@ -48,10 +50,7 @@ export class PostTrinketBreak extends CustomCallback<ModCallbackCustom.POST_TRIN
|
|
|
48
50
|
_source: EntityRef,
|
|
49
51
|
_countdownFrames: int,
|
|
50
52
|
): boolean | undefined => {
|
|
51
|
-
const trinketMap = defaultMapGetPlayer(
|
|
52
|
-
this.v.run.playersTrinketMap,
|
|
53
|
-
player,
|
|
54
|
-
);
|
|
53
|
+
const trinketMap = defaultMapGetPlayer(v.run.playersTrinketMap, player);
|
|
55
54
|
|
|
56
55
|
for (const trinketType of TRINKETS_THAT_CAN_BREAK) {
|
|
57
56
|
const numTrinketsHeld = player.GetTrinketMultiplier(trinketType);
|
|
@@ -86,10 +85,7 @@ export class PostTrinketBreak extends CustomCallback<ModCallbackCustom.POST_TRIN
|
|
|
86
85
|
// ModCallbackCustom.POST_PEFFECT_UPDATE_REORDERED
|
|
87
86
|
private postPEffectUpdateReordered = (player: EntityPlayer) => {
|
|
88
87
|
// On every frame, keep track of how many trinkets we have.
|
|
89
|
-
const trinketMap = defaultMapGetPlayer(
|
|
90
|
-
this.v.run.playersTrinketMap,
|
|
91
|
-
player,
|
|
92
|
-
);
|
|
88
|
+
const trinketMap = defaultMapGetPlayer(v.run.playersTrinketMap, player);
|
|
93
89
|
|
|
94
90
|
for (const trinketType of TRINKETS_THAT_CAN_BREAK) {
|
|
95
91
|
const numTrinkets = player.GetTrinketMultiplier(trinketType);
|
|
@@ -10,12 +10,14 @@ const TRAVELING_TO_NEXT_FLOOR_ANIMATIONS = new ReadonlySet<string>([
|
|
|
10
10
|
"LightTravel",
|
|
11
11
|
]);
|
|
12
12
|
|
|
13
|
+
const v = {
|
|
14
|
+
run: {
|
|
15
|
+
firedOnStage: null as int | null,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
13
19
|
export class PreNewLevel extends CustomCallback<ModCallbackCustom.PRE_NEW_LEVEL> {
|
|
14
|
-
public override v =
|
|
15
|
-
run: {
|
|
16
|
-
firedOnStage: null as int | null,
|
|
17
|
-
},
|
|
18
|
-
};
|
|
20
|
+
public override v = v;
|
|
19
21
|
|
|
20
22
|
constructor() {
|
|
21
23
|
super();
|
|
@@ -29,7 +31,7 @@ export class PreNewLevel extends CustomCallback<ModCallbackCustom.PRE_NEW_LEVEL>
|
|
|
29
31
|
// ModCallback.POST_PLAYER_RENDER (32)
|
|
30
32
|
private postPlayerRender = (player: EntityPlayer) => {
|
|
31
33
|
const effectiveStage = getEffectiveStage();
|
|
32
|
-
if (effectiveStage ===
|
|
34
|
+
if (effectiveStage === v.run.firedOnStage) {
|
|
33
35
|
return;
|
|
34
36
|
}
|
|
35
37
|
|
|
@@ -45,7 +47,7 @@ export class PreNewLevel extends CustomCallback<ModCallbackCustom.PRE_NEW_LEVEL>
|
|
|
45
47
|
const frame = sprite.GetFrame();
|
|
46
48
|
const finalFrame = getLastFrameOfAnimation(sprite);
|
|
47
49
|
if (frame === finalFrame) {
|
|
48
|
-
|
|
50
|
+
v.run.firedOnStage = effectiveStage;
|
|
49
51
|
this.fire(player);
|
|
50
52
|
}
|
|
51
53
|
};
|
|
@@ -23,21 +23,23 @@ import { DefaultMap } from "../../DefaultMap";
|
|
|
23
23
|
import { Feature } from "../../private/Feature";
|
|
24
24
|
import { RunInNFrames } from "../other/RunInNFrames";
|
|
25
25
|
|
|
26
|
+
const v = {
|
|
27
|
+
level: {
|
|
28
|
+
/** Indexed by room list index and grid index. */
|
|
29
|
+
customGridEntities: new DefaultMap<int, Map<int, GridEntityCustomData>>(
|
|
30
|
+
() => new Map(),
|
|
31
|
+
),
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
room: {
|
|
35
|
+
genericPropPtrHashes: new Set<PtrHash>(),
|
|
36
|
+
manuallyUsingShovel: false,
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
26
40
|
export class CustomGridEntities extends Feature {
|
|
27
41
|
/** @internal */
|
|
28
|
-
public override v =
|
|
29
|
-
level: {
|
|
30
|
-
/** Indexed by room list index and grid index. */
|
|
31
|
-
customGridEntities: new DefaultMap<int, Map<int, GridEntityCustomData>>(
|
|
32
|
-
() => new Map(),
|
|
33
|
-
),
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
room: {
|
|
37
|
-
genericPropPtrHashes: new Set<PtrHash>(),
|
|
38
|
-
manuallyUsingShovel: false,
|
|
39
|
-
},
|
|
40
|
-
};
|
|
42
|
+
public override v = v;
|
|
41
43
|
|
|
42
44
|
private runInNFrames: RunInNFrames;
|
|
43
45
|
|
|
@@ -79,7 +81,7 @@ export class CustomGridEntities extends Feature {
|
|
|
79
81
|
const room = game.GetRoom();
|
|
80
82
|
const roomListIndex = getRoomListIndex();
|
|
81
83
|
const roomCustomGridEntities =
|
|
82
|
-
|
|
84
|
+
v.level.customGridEntities.get(roomListIndex);
|
|
83
85
|
if (roomCustomGridEntities === undefined) {
|
|
84
86
|
return undefined;
|
|
85
87
|
}
|
|
@@ -105,9 +107,9 @@ export class CustomGridEntities extends Feature {
|
|
|
105
107
|
return;
|
|
106
108
|
}
|
|
107
109
|
|
|
108
|
-
|
|
110
|
+
v.room.manuallyUsingShovel = true;
|
|
109
111
|
futurePlayer.UseActiveItem(CollectibleType.WE_NEED_TO_GO_DEEPER);
|
|
110
|
-
|
|
112
|
+
v.room.manuallyUsingShovel = false;
|
|
111
113
|
});
|
|
112
114
|
|
|
113
115
|
// Cancel the original effect.
|
|
@@ -120,7 +122,7 @@ export class CustomGridEntities extends Feature {
|
|
|
120
122
|
// of a normal decoration. Thus, we must re-apply the anm2.
|
|
121
123
|
const roomListIndex = getRoomListIndex();
|
|
122
124
|
const roomCustomGridEntities =
|
|
123
|
-
|
|
125
|
+
v.level.customGridEntities.get(roomListIndex);
|
|
124
126
|
if (roomCustomGridEntities === undefined) {
|
|
125
127
|
return;
|
|
126
128
|
}
|
|
@@ -274,7 +276,7 @@ export class CustomGridEntities extends Feature {
|
|
|
274
276
|
};
|
|
275
277
|
|
|
276
278
|
const roomCustomGridEntities =
|
|
277
|
-
|
|
279
|
+
v.level.customGridEntities.getAndSetDefault(roomListIndex);
|
|
278
280
|
roomCustomGridEntities.set(gridIndex, customGridEntityData);
|
|
279
281
|
|
|
280
282
|
return customGridEntity;
|
|
@@ -329,7 +331,7 @@ export class CustomGridEntities extends Feature {
|
|
|
329
331
|
|
|
330
332
|
const gridIndex = decoration.GetGridIndex();
|
|
331
333
|
const roomCustomGridEntities =
|
|
332
|
-
|
|
334
|
+
v.level.customGridEntities.getAndSetDefault(roomListIndex);
|
|
333
335
|
const exists = roomCustomGridEntities.has(gridIndex);
|
|
334
336
|
if (!exists) {
|
|
335
337
|
return undefined;
|
|
@@ -354,7 +356,7 @@ export class CustomGridEntities extends Feature {
|
|
|
354
356
|
> {
|
|
355
357
|
const roomListIndex = getRoomListIndex();
|
|
356
358
|
const roomCustomGridEntities =
|
|
357
|
-
|
|
359
|
+
v.level.customGridEntities.get(roomListIndex);
|
|
358
360
|
if (roomCustomGridEntities === undefined) {
|
|
359
361
|
return [];
|
|
360
362
|
}
|
|
@@ -393,7 +395,7 @@ export class CustomGridEntities extends Feature {
|
|
|
393
395
|
|
|
394
396
|
const roomListIndex = getRoomListIndex();
|
|
395
397
|
const roomCustomGridEntities =
|
|
396
|
-
|
|
398
|
+
v.level.customGridEntities.get(roomListIndex);
|
|
397
399
|
if (roomCustomGridEntities === undefined) {
|
|
398
400
|
return undefined;
|
|
399
401
|
}
|