isaacscript-common 6.11.0 → 6.12.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/postFlip.lua +2 -2
- package/dist/callbacks/postGridEntityCustomRender.d.ts +2 -0
- package/dist/callbacks/postGridEntityCustomRender.d.ts.map +1 -0
- package/dist/callbacks/postGridEntityCustomRender.lua +36 -0
- package/dist/callbacks/postGridEntityCustomUpdate.d.ts +2 -0
- package/dist/callbacks/postGridEntityCustomUpdate.d.ts.map +1 -0
- package/dist/callbacks/postGridEntityCustomUpdate.lua +36 -0
- package/dist/callbacks/postNewRoomEarly.lua +2 -2
- package/dist/callbacks/postPickupInitFirst.lua +1 -20
- package/dist/callbacks/postPlayerFatalDamage.lua +1 -1
- package/dist/callbacks/postPlayerInitFirst.d.ts +2 -0
- package/dist/callbacks/postPlayerInitFirst.d.ts.map +1 -0
- package/dist/callbacks/postPlayerInitFirst.lua +42 -0
- package/dist/callbacks/postPlayerInitLate.lua +5 -5
- package/dist/callbacks/postPlayerReorderedCallbacks.d.ts +2 -0
- package/dist/callbacks/postPlayerReorderedCallbacks.d.ts.map +1 -0
- package/dist/callbacks/{postPlayerReordered.lua → postPlayerReorderedCallbacks.lua} +11 -37
- package/dist/callbacks/reorderedCallbacks.d.ts +5 -5
- package/dist/callbacks/reorderedCallbacks.d.ts.map +1 -1
- package/dist/callbacks/reorderedCallbacks.lua +5 -5
- package/dist/callbacks/subscriptions/postFirstFlip.d.ts +1 -1
- package/dist/callbacks/subscriptions/postFirstFlip.d.ts.map +1 -1
- package/dist/callbacks/subscriptions/postFirstFlip.lua +2 -2
- package/dist/callbacks/subscriptions/postFlip.d.ts +1 -1
- package/dist/callbacks/subscriptions/postFlip.d.ts.map +1 -1
- package/dist/callbacks/subscriptions/postFlip.lua +2 -2
- package/dist/callbacks/subscriptions/postGridEntityCustomRender.d.ts +6 -0
- package/dist/callbacks/subscriptions/postGridEntityCustomRender.d.ts.map +1 -0
- package/dist/callbacks/subscriptions/postGridEntityCustomRender.lua +29 -0
- package/dist/callbacks/subscriptions/postGridEntityCustomUpdate.d.ts +6 -0
- package/dist/callbacks/subscriptions/postGridEntityCustomUpdate.d.ts.map +1 -0
- package/dist/callbacks/subscriptions/postGridEntityCustomUpdate.lua +29 -0
- package/dist/callbacks/subscriptions/{postPlayerInitReordered.d.ts → postPlayerInitFirst.d.ts} +2 -2
- package/dist/callbacks/subscriptions/postPlayerInitFirst.d.ts.map +1 -0
- package/dist/callbacks/subscriptions/{postPlayerInitReordered.lua → postPlayerInitFirst.lua} +3 -3
- package/dist/constants.d.ts +1 -5
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.lua +0 -7
- package/dist/constantsFirstLast.d.ts +5 -1
- package/dist/constantsFirstLast.d.ts.map +1 -1
- package/dist/constantsFirstLast.lua +6 -0
- package/dist/enums/ModCallbackCustom.d.ts +106 -81
- package/dist/enums/ModCallbackCustom.d.ts.map +1 -1
- package/dist/enums/ModCallbackCustom.lua +63 -59
- package/dist/enums/private/StageTravelState.d.ts +9 -0
- package/dist/enums/private/StageTravelState.d.ts.map +1 -0
- package/dist/enums/private/StageTravelState.lua +15 -0
- package/dist/enums/private/TrapdoorAnimation.d.ts +6 -0
- package/dist/enums/private/TrapdoorAnimation.d.ts.map +1 -0
- package/dist/enums/private/TrapdoorAnimation.lua +6 -0
- package/dist/features/customGridEntity.d.ts +17 -5
- package/dist/features/customGridEntity.d.ts.map +1 -1
- package/dist/features/customGridEntity.lua +86 -17
- package/dist/features/customStage/exports.d.ts.map +1 -1
- package/dist/features/customStage/exports.lua +0 -13
- package/dist/features/customStage/init.d.ts.map +1 -1
- package/dist/features/customStage/init.lua +24 -2
- package/dist/features/customStage/streakText.d.ts +6 -0
- package/dist/features/customStage/streakText.d.ts.map +1 -1
- package/dist/features/customStage/streakText.lua +16 -12
- package/dist/features/customStage/versusScreen.d.ts +6 -0
- package/dist/features/customStage/versusScreen.d.ts.map +1 -1
- package/dist/features/customStage/versusScreen.lua +10 -5
- package/dist/features/customTrapdoor/blackSprite.d.ts +2 -0
- package/dist/features/customTrapdoor/blackSprite.d.ts.map +1 -0
- package/dist/features/customTrapdoor/blackSprite.lua +19 -0
- package/dist/features/customTrapdoor/customTrapdoorConstants.d.ts +15 -0
- package/dist/features/customTrapdoor/customTrapdoorConstants.d.ts.map +1 -0
- package/dist/features/customTrapdoor/customTrapdoorConstants.lua +16 -0
- package/dist/features/customTrapdoor/exports.d.ts +29 -0
- package/dist/features/customTrapdoor/exports.d.ts.map +1 -0
- package/dist/features/customTrapdoor/exports.lua +93 -0
- package/dist/features/customTrapdoor/init.d.ts +3 -0
- package/dist/features/customTrapdoor/init.d.ts.map +1 -0
- package/dist/features/customTrapdoor/init.lua +174 -0
- package/dist/features/customTrapdoor/openClose.d.ts +5 -0
- package/dist/features/customTrapdoor/openClose.d.ts.map +1 -0
- package/dist/features/customTrapdoor/openClose.lua +60 -0
- package/dist/features/customTrapdoor/touched.d.ts +4 -0
- package/dist/features/customTrapdoor/touched.d.ts.map +1 -0
- package/dist/features/customTrapdoor/touched.lua +159 -0
- package/dist/features/customTrapdoor/v.d.ts +18 -0
- package/dist/features/customTrapdoor/v.d.ts.map +1 -0
- package/dist/features/customTrapdoor/v.lua +17 -0
- package/dist/features/deployJSONRoom.d.ts +2 -2
- package/dist/features/deployJSONRoom.d.ts.map +1 -1
- package/dist/features/deployJSONRoom.lua +3 -3
- package/dist/features/extraConsoleCommands/init.d.ts.map +1 -1
- package/dist/features/extraConsoleCommands/init.lua +3 -1
- package/dist/features/extraConsoleCommands/listCommands.d.ts.map +1 -1
- package/dist/features/extraConsoleCommands/listCommands.lua +6 -6
- package/dist/features/pause.d.ts +1 -1
- package/dist/features/pause.d.ts.map +1 -1
- package/dist/features/pause.lua +87 -8
- package/dist/features/persistentEntities.d.ts.map +1 -1
- package/dist/features/persistentEntities.lua +7 -7
- package/dist/features/pickupIndex.d.ts +19 -0
- package/dist/features/pickupIndex.d.ts.map +1 -0
- package/dist/features/pickupIndex.lua +197 -0
- package/dist/features/roomHistory.d.ts +24 -0
- package/dist/features/roomHistory.d.ts.map +1 -0
- package/dist/features/roomHistory.lua +89 -0
- package/dist/features/taintedLazarusPlayers.d.ts.map +1 -1
- package/dist/features/taintedLazarusPlayers.lua +13 -21
- package/dist/functions/{character.d.ts → characters.d.ts} +3 -1
- package/dist/functions/characters.d.ts.map +1 -0
- package/dist/functions/{character.lua → characters.lua} +12 -0
- package/dist/functions/collectibles.d.ts +26 -13
- package/dist/functions/collectibles.d.ts.map +1 -1
- package/dist/functions/collectibles.lua +26 -13
- package/dist/functions/entities.d.ts +3 -3
- package/dist/functions/entities.d.ts.map +1 -1
- package/dist/functions/entities.lua +8 -3
- package/dist/functions/gridEntities.d.ts +2 -2
- package/dist/functions/gridEntities.lua +2 -2
- package/dist/functions/isaacAPIClass.d.ts +64 -0
- package/dist/functions/isaacAPIClass.d.ts.map +1 -1
- package/dist/functions/isaacAPIClass.lua +84 -1
- package/dist/functions/log.lua +3 -3
- package/dist/functions/pickupVariants.d.ts +2 -2
- package/dist/functions/pickupVariants.d.ts.map +1 -1
- package/dist/functions/pickupVariants.lua +2 -2
- package/dist/functions/playerCenter.lua +2 -2
- package/dist/functions/playerIndex.d.ts +11 -5
- package/dist/functions/playerIndex.d.ts.map +1 -1
- package/dist/functions/playerIndex.lua +19 -26
- package/dist/functions/players.lua +4 -4
- package/dist/functions/revive.lua +2 -2
- package/dist/functions/roomData.d.ts +3 -2
- package/dist/functions/roomData.d.ts.map +1 -1
- package/dist/functions/roomData.lua +3 -2
- package/dist/functions/rooms.d.ts +6 -6
- package/dist/functions/rooms.lua +6 -6
- package/dist/functions/stage.d.ts +1 -0
- package/dist/functions/stage.d.ts.map +1 -1
- package/dist/functions/stage.lua +4 -0
- package/dist/functions/table.d.ts +1 -1
- package/dist/functions/table.d.ts.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.lua +33 -2
- package/dist/initCustomCallbacks.d.ts.map +1 -1
- package/dist/initCustomCallbacks.lua +11 -2
- package/dist/initFeatures.d.ts +1 -2
- package/dist/initFeatures.d.ts.map +1 -1
- package/dist/initFeatures.lua +16 -2
- package/dist/interfaces/AddCallbackParameterCustom.d.ts +6 -2
- package/dist/interfaces/AddCallbackParameterCustom.d.ts.map +1 -1
- package/dist/interfaces/CustomGridEntityData.d.ts +6 -2
- package/dist/interfaces/CustomGridEntityData.d.ts.map +1 -1
- package/dist/interfaces/RoomDescription.d.ts +14 -0
- package/dist/interfaces/RoomDescription.d.ts.map +1 -0
- package/dist/interfaces/RoomDescription.lua +2 -0
- package/dist/interfaces/private/CustomTrapdoorDescription.d.ts +7 -0
- package/dist/interfaces/private/CustomTrapdoorDescription.d.ts.map +1 -0
- package/dist/interfaces/private/CustomTrapdoorDescription.lua +2 -0
- package/dist/lib/jsonLua.lua +2 -0
- package/dist/objects/callbackRegisterFunctions.d.ts.map +1 -1
- package/dist/objects/callbackRegisterFunctions.lua +9 -3
- package/dist/objects/characterDamageMultipliers.d.ts +6 -0
- package/dist/objects/characterDamageMultipliers.d.ts.map +1 -0
- package/dist/objects/characterDamageMultipliers.lua +49 -0
- package/dist/types/CollectibleIndex.d.ts +1 -1
- package/dist/types/PickupIndex.d.ts +17 -0
- package/dist/types/PickupIndex.d.ts.map +1 -0
- package/dist/types/PickupIndex.lua +2 -0
- package/dist/types/PlayerIndex.d.ts +1 -1
- package/dist/upgradeMod.lua +2 -4
- package/package.json +2 -2
- package/src/callbacks/customRevive.ts +3 -3
- package/src/callbacks/itemPickup.ts +3 -3
- package/src/callbacks/postAmbush.ts +3 -3
- package/src/callbacks/postEsauJr.ts +3 -3
- package/src/callbacks/postFlip.ts +6 -5
- package/src/callbacks/postGridEntity.ts +5 -5
- package/src/callbacks/postGridEntityCustomRender.ts +44 -0
- package/src/callbacks/postGridEntityCustomUpdate.ts +44 -0
- package/src/callbacks/postNewRoomEarly.ts +2 -2
- package/src/callbacks/postPickupInitFirst.ts +1 -32
- package/src/callbacks/postPlayerCollectible.ts +2 -2
- package/src/callbacks/postPlayerFatalDamage.ts +5 -0
- package/src/callbacks/postPlayerInitFirst.ts +57 -0
- package/src/callbacks/postPlayerInitLate.ts +9 -5
- package/src/callbacks/{postPlayerReordered.ts → postPlayerReorderedCallbacks.ts} +12 -32
- package/src/callbacks/postSlotInitUpdate.ts +5 -2
- package/src/callbacks/postSlotRender.ts +2 -2
- package/src/callbacks/reorderedCallbacks.ts +10 -9
- package/src/callbacks/subscriptions/postFirstFlip.ts +6 -3
- package/src/callbacks/subscriptions/postFlip.ts +6 -3
- package/src/callbacks/subscriptions/postGridEntityCustomRender.ts +41 -0
- package/src/callbacks/subscriptions/postGridEntityCustomUpdate.ts +41 -0
- package/src/callbacks/subscriptions/{postPlayerInitReordered.ts → postPlayerInitFirst.ts} +6 -6
- package/src/constants.ts +1 -9
- package/src/constantsFirstLast.ts +16 -0
- package/src/enums/ModCallbackCustom.ts +52 -25
- package/src/enums/private/StageTravelState.ts +8 -0
- package/src/enums/private/TrapdoorAnimation.ts +5 -0
- package/src/features/customGridEntity.ts +118 -12
- package/src/features/customStage/exports.ts +3 -22
- package/src/features/customStage/init.ts +30 -1
- package/src/features/customStage/streakText.ts +13 -5
- package/src/features/customStage/versusScreen.ts +20 -12
- package/src/features/customTrapdoor/blackSprite.ts +16 -0
- package/src/features/customTrapdoor/customTrapdoorConstants.ts +23 -0
- package/src/features/customTrapdoor/exports.ts +99 -0
- package/src/features/customTrapdoor/init.ts +217 -0
- package/src/features/customTrapdoor/openClose.ts +103 -0
- package/src/features/customTrapdoor/touched.ts +195 -0
- package/src/features/customTrapdoor/v.ts +26 -0
- package/src/features/deployJSONRoom.ts +10 -5
- package/src/features/extraConsoleCommands/init.ts +5 -2
- package/src/features/extraConsoleCommands/listCommands.ts +6 -8
- package/src/features/pause.ts +97 -7
- package/src/features/persistentEntities.ts +9 -8
- package/src/features/pickupIndex.ts +257 -0
- package/src/features/playerInventory.ts +2 -2
- package/src/features/roomHistory.ts +113 -0
- package/src/features/saveDataManager/main.ts +3 -3
- package/src/features/taintedLazarusPlayers.ts +37 -36
- package/src/functions/{character.ts → characters.ts} +13 -0
- package/src/functions/collectibles.ts +26 -13
- package/src/functions/deepCopy.ts +2 -2
- package/src/functions/entities.ts +7 -4
- package/src/functions/gridEntities.ts +2 -2
- package/src/functions/isaacAPIClass.ts +106 -1
- package/src/functions/pickupVariants.ts +2 -2
- package/src/functions/playerCenter.ts +2 -2
- package/src/functions/playerIndex.ts +26 -23
- package/src/functions/players.ts +1 -1
- package/src/functions/revive.ts +1 -1
- package/src/functions/rng.ts +1 -1
- package/src/functions/roomData.ts +3 -2
- package/src/functions/rooms.ts +6 -6
- package/src/functions/stage.ts +10 -1
- package/src/functions/table.ts +2 -2
- package/src/index.ts +9 -2
- package/src/initCustomCallbacks.ts +7 -1
- package/src/initFeatures.ts +13 -2
- package/src/interfaces/AddCallbackParameterCustom.ts +6 -2
- package/src/interfaces/CustomGridEntityData.ts +7 -2
- package/src/interfaces/RoomDescription.ts +19 -0
- package/src/interfaces/private/CustomTrapdoorDescription.ts +7 -0
- package/src/lib/jsonLua.lua +2 -0
- package/src/objects/callbackRegisterFunctions.ts +8 -3
- package/src/objects/characterDamageMultipliers.ts +49 -0
- package/src/types/CollectibleIndex.ts +1 -1
- package/src/types/PickupIndex.ts +15 -0
- package/src/types/PlayerIndex.ts +1 -1
- package/src/upgradeMod.ts +4 -4
- package/dist/callbacks/postPlayerReordered.d.ts +0 -2
- package/dist/callbacks/postPlayerReordered.d.ts.map +0 -1
- package/dist/callbacks/subscriptions/postPlayerInitReordered.d.ts.map +0 -1
- package/dist/functions/character.d.ts.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// This provides the logic for:
|
|
2
|
-
// - POST_AMBUSH_STARTED
|
|
3
|
-
// - POST_AMBUSH_FINISHED
|
|
1
|
+
// This provides the logic for the following callbacks:
|
|
2
|
+
// - `POST_AMBUSH_STARTED`
|
|
3
|
+
// - `POST_AMBUSH_FINISHED`
|
|
4
4
|
|
|
5
5
|
import { ModCallback, RoomType } from "isaac-typescript-definitions";
|
|
6
6
|
import { game } from "../cachedClasses";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// This provides the logic for:
|
|
2
|
-
// - POST_FLIP
|
|
3
|
-
// - POST_FIRST_FLIP
|
|
1
|
+
// This provides the logic for the following callbacks:
|
|
2
|
+
// - `POST_FLIP`
|
|
3
|
+
// - `POST_FIRST_FLIP`
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
CollectibleType,
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
|
|
22
22
|
const v = {
|
|
23
23
|
run: {
|
|
24
|
+
/** We don't consider the case of a multiplayer game with more than one Tainted Lazarus. */
|
|
24
25
|
usedFlipAtLeastOnce: false,
|
|
25
26
|
},
|
|
26
27
|
};
|
|
@@ -63,10 +64,10 @@ function useItemFlip(
|
|
|
63
64
|
|
|
64
65
|
if (!v.run.usedFlipAtLeastOnce) {
|
|
65
66
|
v.run.usedFlipAtLeastOnce = true;
|
|
66
|
-
postFirstFlipFire(newLazarus);
|
|
67
|
+
postFirstFlipFire(newLazarus, player);
|
|
67
68
|
}
|
|
68
69
|
|
|
69
|
-
postFlipFire(newLazarus);
|
|
70
|
+
postFlipFire(newLazarus, player);
|
|
70
71
|
|
|
71
72
|
return undefined;
|
|
72
73
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// This provides the logic for the following callbacks:
|
|
2
|
-
// -
|
|
3
|
-
// -
|
|
4
|
-
// -
|
|
5
|
-
// -
|
|
6
|
-
// -
|
|
2
|
+
// - `POST_GRID_ENTITY_INIT`
|
|
3
|
+
// - `POST_GRID_ENTITY_UPDATE`
|
|
4
|
+
// - `POST_GRID_ENTITY_REMOVE`
|
|
5
|
+
// - `POST_GRID_ENTITY_STATE_CHANGED`
|
|
6
|
+
// - `POST_GRID_ENTITY_BROKEN`
|
|
7
7
|
|
|
8
8
|
import { GridEntityType, ModCallback } from "isaac-typescript-definitions";
|
|
9
9
|
import { ModUpgraded } from "../classes/ModUpgraded";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { GridEntityType, ModCallback } from "isaac-typescript-definitions";
|
|
2
|
+
import { ModUpgraded } from "../classes/ModUpgraded";
|
|
3
|
+
import { getCustomGridEntities } from "../features/customGridEntity";
|
|
4
|
+
import { saveDataManager } from "../features/saveDataManager/exports";
|
|
5
|
+
import {
|
|
6
|
+
postGridEntityCustomRenderFire,
|
|
7
|
+
postGridEntityCustomRenderHasSubscriptions,
|
|
8
|
+
} from "./subscriptions/postGridEntityCustomRender";
|
|
9
|
+
|
|
10
|
+
type GridEntityTuple = [
|
|
11
|
+
gridEntityType: GridEntityType,
|
|
12
|
+
gridEntityVariant: int,
|
|
13
|
+
state: int,
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
const v = {
|
|
17
|
+
room: {
|
|
18
|
+
/** Indexed by grid index. */
|
|
19
|
+
initializedGridEntities: new Map<int, GridEntityTuple>(),
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/** @internal */
|
|
24
|
+
export function postGridEntityCustomRenderInit(mod: ModUpgraded): void {
|
|
25
|
+
saveDataManager("postGridEntityCustomRender", v, hasSubscriptions);
|
|
26
|
+
|
|
27
|
+
mod.AddCallback(ModCallback.POST_RENDER, postRender); // 2
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function hasSubscriptions() {
|
|
31
|
+
return postGridEntityCustomRenderHasSubscriptions();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// ModCallback.POST_RENDER (2)
|
|
35
|
+
function postRender() {
|
|
36
|
+
if (!hasSubscriptions()) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const customGridEntities = getCustomGridEntities();
|
|
41
|
+
for (const [gridEntity, data] of customGridEntities) {
|
|
42
|
+
postGridEntityCustomRenderFire(gridEntity, data.gridEntityTypeCustom);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { GridEntityType, ModCallback } from "isaac-typescript-definitions";
|
|
2
|
+
import { ModUpgraded } from "../classes/ModUpgraded";
|
|
3
|
+
import { getCustomGridEntities } from "../features/customGridEntity";
|
|
4
|
+
import { saveDataManager } from "../features/saveDataManager/exports";
|
|
5
|
+
import {
|
|
6
|
+
postGridEntityCustomUpdateFire,
|
|
7
|
+
postGridEntityCustomUpdateHasSubscriptions,
|
|
8
|
+
} from "./subscriptions/postGridEntityCustomUpdate";
|
|
9
|
+
|
|
10
|
+
type GridEntityTuple = [
|
|
11
|
+
gridEntityType: GridEntityType,
|
|
12
|
+
gridEntityVariant: int,
|
|
13
|
+
state: int,
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
const v = {
|
|
17
|
+
room: {
|
|
18
|
+
/** Indexed by grid index. */
|
|
19
|
+
initializedGridEntities: new Map<int, GridEntityTuple>(),
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/** @internal */
|
|
24
|
+
export function postGridEntityCustomUpdateInit(mod: ModUpgraded): void {
|
|
25
|
+
saveDataManager("postGridEntityCustomUpdate", v, hasSubscriptions);
|
|
26
|
+
|
|
27
|
+
mod.AddCallback(ModCallback.POST_UPDATE, postUpdate); // 1
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function hasSubscriptions() {
|
|
31
|
+
return postGridEntityCustomUpdateHasSubscriptions();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// ModCallback.POST_UPDATE (1)
|
|
35
|
+
function postUpdate() {
|
|
36
|
+
if (!hasSubscriptions()) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const customGridEntities = getCustomGridEntities();
|
|
41
|
+
for (const [gridEntity, data] of customGridEntities) {
|
|
42
|
+
postGridEntityCustomUpdateFire(gridEntity, data.gridEntityTypeCustom);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -67,7 +67,7 @@ function checkRoomChanged() {
|
|
|
67
67
|
topLeftWall = spawnGridEntity(GridEntityType.WALL, topLeftWallGridIndex);
|
|
68
68
|
if (topLeftWall === undefined) {
|
|
69
69
|
logError(
|
|
70
|
-
"Failed to spawn a new wall (1) for the
|
|
70
|
+
"Failed to spawn a new wall (1) for the POST_NEW_ROOM_EARLY callback.",
|
|
71
71
|
);
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
@@ -82,7 +82,7 @@ function checkRoomChanged() {
|
|
|
82
82
|
);
|
|
83
83
|
if (topLeftWall2 === undefined) {
|
|
84
84
|
logError(
|
|
85
|
-
"Failed to spawn a new wall (2) for the
|
|
85
|
+
"Failed to spawn a new wall (2) for the POST_NEW_ROOM_EARLY callback.",
|
|
86
86
|
);
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
@@ -1,31 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
GameStateFlag,
|
|
3
|
-
ModCallback,
|
|
4
|
-
RoomType,
|
|
5
|
-
} from "isaac-typescript-definitions";
|
|
1
|
+
import { ModCallback } from "isaac-typescript-definitions";
|
|
6
2
|
import { game } from "../cachedClasses";
|
|
7
|
-
import { saveDataManager } from "../features/saveDataManager/exports";
|
|
8
3
|
import { getRoomVisitedCount } from "../functions/roomData";
|
|
9
4
|
import {
|
|
10
5
|
postPickupInitFirstFire,
|
|
11
6
|
postPickupInitFirstHasSubscriptions,
|
|
12
7
|
} from "./subscriptions/postPickupInitFirst";
|
|
13
8
|
|
|
14
|
-
const POST_ASCENT_ROOM_TYPES: ReadonlySet<RoomType> = new Set([
|
|
15
|
-
RoomType.TREASURE,
|
|
16
|
-
RoomType.BOSS,
|
|
17
|
-
]);
|
|
18
|
-
|
|
19
|
-
const v = {
|
|
20
|
-
run: {
|
|
21
|
-
postAscentPickupInitSeeds: new Set<int>(),
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
|
|
25
9
|
/** @internal */
|
|
26
10
|
export function postPickupInitFirstInit(mod: Mod): void {
|
|
27
|
-
saveDataManager("postPickupInitFirst", v, hasSubscriptions);
|
|
28
|
-
|
|
29
11
|
mod.AddCallback(ModCallback.POST_PICKUP_INIT, postPickupInit); // 34
|
|
30
12
|
}
|
|
31
13
|
|
|
@@ -40,15 +22,8 @@ function postPickupInit(pickup: EntityPickup) {
|
|
|
40
22
|
}
|
|
41
23
|
|
|
42
24
|
const room = game.GetRoom();
|
|
43
|
-
const roomType = room.GetType();
|
|
44
25
|
const roomFrameCount = room.GetFrameCount();
|
|
45
26
|
|
|
46
|
-
// First, keep track of pickups in rooms that could appear again in The Ascent.
|
|
47
|
-
const previouslySeen = v.run.postAscentPickupInitSeeds.has(pickup.InitSeed);
|
|
48
|
-
if (POST_ASCENT_ROOM_TYPES.has(roomType)) {
|
|
49
|
-
v.run.postAscentPickupInitSeeds.add(pickup.InitSeed);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
27
|
if (roomFrameCount > 0) {
|
|
53
28
|
postPickupInitFirstFire(pickup);
|
|
54
29
|
return;
|
|
@@ -59,12 +34,6 @@ function postPickupInit(pickup: EntityPickup) {
|
|
|
59
34
|
return;
|
|
60
35
|
}
|
|
61
36
|
|
|
62
|
-
// Handle the special case of a post-Ascent Treasure Room or Boss Room.
|
|
63
|
-
const onAscent = game.GetStateFlag(GameStateFlag.BACKWARDS_PATH);
|
|
64
|
-
if (onAscent && POST_ASCENT_ROOM_TYPES.has(roomType) && previouslySeen) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
37
|
// We are entering a brand-new room.
|
|
69
38
|
postPickupInitFirstFire(pickup);
|
|
70
39
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// This provides the logic for the following callbacks:
|
|
2
|
-
// -
|
|
3
|
-
// -
|
|
2
|
+
// - `POST_PLAYER_COLLECTIBLE_ADDED`
|
|
3
|
+
// - `POST_PLAYER_COLLECTIBLE_REMOVED`
|
|
4
4
|
|
|
5
5
|
import { CollectibleType, ModCallback } from "isaac-typescript-definitions";
|
|
6
6
|
import { DefaultMap } from "../classes/DefaultMap";
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ActiveSlot,
|
|
2
3
|
BossID,
|
|
3
4
|
CollectibleType,
|
|
4
5
|
DamageFlag,
|
|
5
6
|
DamageFlagZero,
|
|
6
7
|
EntityType,
|
|
7
8
|
ModCallback,
|
|
9
|
+
UseFlag,
|
|
8
10
|
} from "isaac-typescript-definitions";
|
|
9
11
|
import { game } from "../cachedClasses";
|
|
10
12
|
import { saveDataManager } from "../features/saveDataManager/exports";
|
|
@@ -113,6 +115,9 @@ function preUseItemBible(
|
|
|
113
115
|
_collectibleType: CollectibleType,
|
|
114
116
|
_rng: RNG,
|
|
115
117
|
player: EntityPlayer,
|
|
118
|
+
_useFlags: BitFlags<UseFlag>,
|
|
119
|
+
_activeSlot: ActiveSlot,
|
|
120
|
+
_customVarData: int,
|
|
116
121
|
): boolean | undefined {
|
|
117
122
|
if (!hasSubscriptions()) {
|
|
118
123
|
return undefined;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ModUpgraded } from "../classes/ModUpgraded";
|
|
2
|
+
import { ModCallbackCustom } from "../enums/ModCallbackCustom";
|
|
3
|
+
import { getPlayers, isChildPlayer } from "../functions/playerIndex";
|
|
4
|
+
import { inGenesisRoom } from "../functions/rooms";
|
|
5
|
+
import {
|
|
6
|
+
postPlayerInitFirstFire,
|
|
7
|
+
postPlayerInitFirstHasSubscriptions,
|
|
8
|
+
} from "./subscriptions/postPlayerInitFirst";
|
|
9
|
+
|
|
10
|
+
/** @internal */
|
|
11
|
+
export function postPlayerInitFirstInit(mod: ModUpgraded): void {
|
|
12
|
+
mod.AddCallbackCustom(
|
|
13
|
+
ModCallbackCustom.POST_NEW_ROOM_REORDERED,
|
|
14
|
+
postNewRoomReordered,
|
|
15
|
+
);
|
|
16
|
+
mod.AddCallbackCustom(
|
|
17
|
+
ModCallbackCustom.POST_PLAYER_INIT_LATE,
|
|
18
|
+
postPlayerInitLate,
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function hasSubscriptions() {
|
|
23
|
+
return postPlayerInitFirstHasSubscriptions();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// ModCallbackCustom.POST_NEW_ROOM_REORDERED
|
|
27
|
+
function postNewRoomReordered() {
|
|
28
|
+
if (!hasSubscriptions()) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// When a player uses the Genesis collectible, they will lose all of their collectibles, trinkets,
|
|
33
|
+
// pocket items, and stats, so they will need to be re-initialized like they would be at the
|
|
34
|
+
// beginning of a run. However, in this case, the `POST_PLAYER_INIT_FIRST` callback will not fire,
|
|
35
|
+
// because that only fires once per run. Thus, we explicitly handle this special case.
|
|
36
|
+
if (!inGenesisRoom()) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
for (const player of getPlayers()) {
|
|
41
|
+
postPlayerInitFirstFire(player);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// ModCallback.POST_PEFFECT_UPDATE (4)
|
|
46
|
+
function postPlayerInitLate(player: EntityPlayer) {
|
|
47
|
+
if (!hasSubscriptions()) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// We want to exclude non-real players like the Strawman keeper.
|
|
52
|
+
if (isChildPlayer(player)) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
postPlayerInitFirstFire(player);
|
|
57
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModUpgraded } from "../classes/ModUpgraded";
|
|
2
|
+
import { ModCallbackCustom } from "../enums/ModCallbackCustom";
|
|
2
3
|
import { saveDataManager } from "../features/saveDataManager/exports";
|
|
3
4
|
import { setAddPlayer, setHasPlayer } from "../functions/playerDataStructures";
|
|
4
5
|
import { PlayerIndex } from "../types/PlayerIndex";
|
|
@@ -14,18 +15,21 @@ const v = {
|
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
/** @internal */
|
|
17
|
-
export function postPlayerInitLateInit(mod:
|
|
18
|
+
export function postPlayerInitLateInit(mod: ModUpgraded): void {
|
|
18
19
|
saveDataManager("postPlayerInitLate", v, hasSubscriptions);
|
|
19
20
|
|
|
20
|
-
mod.
|
|
21
|
+
mod.AddCallbackCustom(
|
|
22
|
+
ModCallbackCustom.POST_PEFFECT_UPDATE_REORDERED,
|
|
23
|
+
postPEffectUpdateReordered,
|
|
24
|
+
);
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
function hasSubscriptions() {
|
|
24
28
|
return postPlayerInitLateHasSubscriptions();
|
|
25
29
|
}
|
|
26
30
|
|
|
27
|
-
//
|
|
28
|
-
function
|
|
31
|
+
// ModCallbackCustom.POST_PEFFECT_UPDATE_REORDERED
|
|
32
|
+
function postPEffectUpdateReordered(player: EntityPlayer) {
|
|
29
33
|
if (!hasSubscriptions()) {
|
|
30
34
|
return;
|
|
31
35
|
}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// This handles logic for the following callbacks:
|
|
2
|
+
// - POST_PEFFECT_UPDATE_REORDERED
|
|
3
|
+
// - POST_PLAYER_RENDER_REORDERED
|
|
4
|
+
// - POST_PLAYER_UPDATE_REORDERED
|
|
5
|
+
|
|
1
6
|
import { ModCallback } from "isaac-typescript-definitions";
|
|
2
7
|
import { saveDataManager } from "../features/saveDataManager/exports";
|
|
3
8
|
import { emptyArray } from "../functions/array";
|
|
@@ -7,10 +12,6 @@ import {
|
|
|
7
12
|
postPEffectUpdateReorderedFire,
|
|
8
13
|
postPEffectUpdateReorderedHasSubscriptions,
|
|
9
14
|
} from "./subscriptions/postPEffectUpdateReordered";
|
|
10
|
-
import {
|
|
11
|
-
postPlayerInitReorderedFire,
|
|
12
|
-
postPlayerInitReorderedHasSubscriptions,
|
|
13
|
-
} from "./subscriptions/postPlayerInitReordered";
|
|
14
15
|
import {
|
|
15
16
|
postPlayerRenderReorderedFire,
|
|
16
17
|
postPlayerRenderReorderedHasSubscriptions,
|
|
@@ -24,7 +25,6 @@ const v = {
|
|
|
24
25
|
run: {
|
|
25
26
|
postGameStartedFiredOnThisRun: false,
|
|
26
27
|
|
|
27
|
-
postPlayerInitQueue: [] as PlayerIndex[],
|
|
28
28
|
postPEffectUpdateQueue: [] as PlayerIndex[],
|
|
29
29
|
postPlayerUpdateQueue: [] as PlayerIndex[],
|
|
30
30
|
postPlayerRenderQueue: [] as PlayerIndex[],
|
|
@@ -36,16 +36,13 @@ export function postPlayerReorderedCallbacksInit(mod: Mod): void {
|
|
|
36
36
|
saveDataManager("postPlayerReordered", v, hasSubscriptions);
|
|
37
37
|
|
|
38
38
|
mod.AddCallback(ModCallback.POST_PEFFECT_UPDATE, postPEffectUpdate); // 4
|
|
39
|
-
mod.AddCallback(ModCallback.
|
|
39
|
+
mod.AddCallback(ModCallback.POST_GAME_STARTED, postGameStarted); // 15
|
|
40
40
|
mod.AddCallback(ModCallback.POST_PLAYER_UPDATE, postPlayerUpdate); // 31
|
|
41
41
|
mod.AddCallback(ModCallback.POST_PLAYER_RENDER, postPlayerRender); // 32
|
|
42
|
-
|
|
43
|
-
mod.AddCallback(ModCallback.POST_GAME_STARTED, postGameStarted); // 15
|
|
44
42
|
}
|
|
45
43
|
|
|
46
44
|
function hasSubscriptions() {
|
|
47
45
|
return (
|
|
48
|
-
postPlayerInitReorderedHasSubscriptions() ||
|
|
49
46
|
postPEffectUpdateReorderedHasSubscriptions() ||
|
|
50
47
|
postPlayerUpdateReorderedHasSubscriptions() ||
|
|
51
48
|
postPlayerRenderReorderedHasSubscriptions()
|
|
@@ -61,27 +58,12 @@ function postPEffectUpdate(player: EntityPlayer) {
|
|
|
61
58
|
if (v.run.postGameStartedFiredOnThisRun) {
|
|
62
59
|
postPEffectUpdateReorderedFire(player);
|
|
63
60
|
} else {
|
|
64
|
-
// Defer callback execution until the
|
|
61
|
+
// Defer callback execution until the `POST_GAME_STARTED` callback fires.
|
|
65
62
|
const playerIndex = getPlayerIndex(player);
|
|
66
63
|
v.run.postPEffectUpdateQueue.push(playerIndex);
|
|
67
64
|
}
|
|
68
65
|
}
|
|
69
66
|
|
|
70
|
-
// ModCallback.POST_PLAYER_INIT (9)
|
|
71
|
-
function postPlayerInit(player: EntityPlayer) {
|
|
72
|
-
if (!hasSubscriptions()) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (v.run.postGameStartedFiredOnThisRun) {
|
|
77
|
-
postPlayerInitReorderedFire(player);
|
|
78
|
-
} else {
|
|
79
|
-
// Defer callback execution until the PostGameStarted callback fires.
|
|
80
|
-
const playerIndex = getPlayerIndex(player);
|
|
81
|
-
v.run.postPlayerInitQueue.push(playerIndex);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
67
|
// ModCallback.POST_PLAYER_UPDATE (31)
|
|
86
68
|
function postPlayerUpdate(player: EntityPlayer) {
|
|
87
69
|
if (!hasSubscriptions()) {
|
|
@@ -91,7 +73,7 @@ function postPlayerUpdate(player: EntityPlayer) {
|
|
|
91
73
|
if (v.run.postGameStartedFiredOnThisRun) {
|
|
92
74
|
postPlayerUpdateReorderedFire(player);
|
|
93
75
|
} else {
|
|
94
|
-
// Defer callback execution until the
|
|
76
|
+
// Defer callback execution until the `POST_GAME_STARTED` callback fires.
|
|
95
77
|
const playerIndex = getPlayerIndex(player);
|
|
96
78
|
v.run.postPlayerUpdateQueue.push(playerIndex);
|
|
97
79
|
}
|
|
@@ -106,7 +88,7 @@ function postPlayerRender(player: EntityPlayer) {
|
|
|
106
88
|
if (v.run.postGameStartedFiredOnThisRun) {
|
|
107
89
|
postPlayerRenderReorderedFire(player);
|
|
108
90
|
} else {
|
|
109
|
-
// Defer callback execution until the
|
|
91
|
+
// Defer callback execution until the `POST_GAME_STARTED` callback fires.
|
|
110
92
|
const playerIndex = getPlayerIndex(player);
|
|
111
93
|
v.run.postPlayerRenderQueue.push(playerIndex);
|
|
112
94
|
}
|
|
@@ -120,7 +102,7 @@ function postGameStarted() {
|
|
|
120
102
|
|
|
121
103
|
v.run.postGameStartedFiredOnThisRun = true;
|
|
122
104
|
|
|
123
|
-
dequeue(v.run.
|
|
105
|
+
dequeue(v.run.postPEffectUpdateQueue, postPEffectUpdateReorderedFire);
|
|
124
106
|
dequeue(v.run.postPlayerUpdateQueue, postPlayerUpdateReorderedFire);
|
|
125
107
|
dequeue(v.run.postPlayerRenderQueue, postPlayerRenderReorderedFire);
|
|
126
108
|
}
|
|
@@ -131,11 +113,9 @@ function dequeue(
|
|
|
131
113
|
) {
|
|
132
114
|
for (const playerIndex of playerIndexes) {
|
|
133
115
|
const player = getPlayerFromIndex(playerIndex);
|
|
134
|
-
if (player
|
|
135
|
-
|
|
116
|
+
if (player !== undefined) {
|
|
117
|
+
fireFunction(player);
|
|
136
118
|
}
|
|
137
|
-
|
|
138
|
-
fireFunction(player);
|
|
139
119
|
}
|
|
140
120
|
|
|
141
121
|
emptyArray(playerIndexes);
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
// This provides the logic for the
|
|
2
|
-
//
|
|
1
|
+
// This provides the logic for the following callbacks:
|
|
2
|
+
// - `POST_SLOT_INIT`
|
|
3
|
+
// - `POST_SLOT_UPDATE`
|
|
4
|
+
|
|
5
|
+
// (The other slot callbacks are handled in a different file.)
|
|
3
6
|
|
|
4
7
|
import { ModCallback } from "isaac-typescript-definitions";
|
|
5
8
|
import { ModUpgraded } from "../classes/ModUpgraded";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// This provides the logic for the following callbacks:
|
|
2
|
-
// -
|
|
3
|
-
// -
|
|
2
|
+
// - `POST_SLOT_RENDER`
|
|
3
|
+
// - `POST_SLOT_ANIMATION_CHANGED`
|
|
4
4
|
|
|
5
5
|
import { ModCallback } from "isaac-typescript-definitions";
|
|
6
6
|
import { DefaultMap } from "../classes/DefaultMap";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// This provides the logic for:
|
|
1
|
+
// This provides the logic for the following callbacks:
|
|
2
2
|
// - `POST_GAME_STARTED_REORDERED`
|
|
3
3
|
// - `POST_NEW_LEVEL_REORDERED`
|
|
4
4
|
// - `POST_NEW_ROOM_REORDERED`
|
|
@@ -61,7 +61,7 @@ function hasSubscriptions() {
|
|
|
61
61
|
// CollectibleType.GLOWING_HOUR_GLASS (422)
|
|
62
62
|
function useItemGlowingHourGlass(): boolean | undefined {
|
|
63
63
|
// If Glowing Hour Glass is used on the first room of a floor, it will send the player to the
|
|
64
|
-
// previous floor without triggering the
|
|
64
|
+
// previous floor without triggering the `POST_NEW_LEVEL` callback. Manually check for this.
|
|
65
65
|
usedGlowingHourGlass = true;
|
|
66
66
|
|
|
67
67
|
return undefined;
|
|
@@ -88,7 +88,7 @@ function postNewLevelVanilla() {
|
|
|
88
88
|
const gameFrameCount = game.GetFrameCount();
|
|
89
89
|
|
|
90
90
|
if (gameFrameCount === 0 && !forceNewLevel) {
|
|
91
|
-
// Wait for the
|
|
91
|
+
// Wait for the `POST_GAME_STARTED` callback to fire.
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
94
|
forceNewLevel = false;
|
|
@@ -114,7 +114,8 @@ function postNewRoomVanilla() {
|
|
|
114
114
|
|
|
115
115
|
if (currentStage !== stage || currentStageType !== stageType) {
|
|
116
116
|
// The player has used the Glowing Hour Glass to take them to the previous floor (which does
|
|
117
|
-
// not trigger the
|
|
117
|
+
// not trigger the `POST_NEW_LEVEL` callback). Emulate what happens in the `POST_NEW_LEVEL`
|
|
118
|
+
// callback.
|
|
118
119
|
recordCurrentStage();
|
|
119
120
|
postNewLevelReorderedFire();
|
|
120
121
|
postNewRoomReorderedFire();
|
|
@@ -149,9 +150,9 @@ function recordCurrentStage() {
|
|
|
149
150
|
* callback.
|
|
150
151
|
*
|
|
151
152
|
* If some specific cases, mods can change the current level during run initialization on the 0th
|
|
152
|
-
* frame. However, due to how the callback reordering works, the custom
|
|
153
|
-
* never fire on the 0th frame. To get around this, call this function before changing levels
|
|
154
|
-
* temporarily force the callback to fire.
|
|
153
|
+
* frame. However, due to how the callback reordering works, the custom `POST_NEW_LEVEL` callback
|
|
154
|
+
* will never fire on the 0th frame. To get around this, call this function before changing levels
|
|
155
|
+
* to temporarily force the callback to fire.
|
|
155
156
|
*/
|
|
156
157
|
export function forceNewLevelCallback(): void {
|
|
157
158
|
forceNewLevel = true;
|
|
@@ -162,8 +163,8 @@ export function forceNewLevelCallback(): void {
|
|
|
162
163
|
* callback.
|
|
163
164
|
*
|
|
164
165
|
* If some specific cases, mods can change the current room during run initialization on the 0th
|
|
165
|
-
* frame. However, due to how the callback reordering works, the custom
|
|
166
|
-
* never fire on the 0th frame. To get around this, call this function before changing rooms to
|
|
166
|
+
* frame. However, due to how the callback reordering works, the custom `POST_NEW_ROOM` callback
|
|
167
|
+
* will never fire on the 0th frame. To get around this, call this function before changing rooms to
|
|
167
168
|
* temporarily force the callback to fire.
|
|
168
169
|
*/
|
|
169
170
|
export function forceNewRoomCallback(): void {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type PostFirstFlipRegisterParameters = [
|
|
2
|
-
callback: (
|
|
2
|
+
callback: (newLazarus: EntityPlayer, oldLazarus: EntityPlayer) => void,
|
|
3
3
|
];
|
|
4
4
|
|
|
5
5
|
const subscriptions: PostFirstFlipRegisterParameters[] = [];
|
|
@@ -17,8 +17,11 @@ export function postFirstFlipRegister(
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/** @internal */
|
|
20
|
-
export function postFirstFlipFire(
|
|
20
|
+
export function postFirstFlipFire(
|
|
21
|
+
newLazarus: EntityPlayer,
|
|
22
|
+
oldLazarus: EntityPlayer,
|
|
23
|
+
): void {
|
|
21
24
|
for (const [callback] of subscriptions) {
|
|
22
|
-
callback(
|
|
25
|
+
callback(newLazarus, oldLazarus);
|
|
23
26
|
}
|
|
24
27
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type PostFlipRegisterParameters = [
|
|
2
|
-
callback: (
|
|
2
|
+
callback: (newLazarus: EntityPlayer, oldLazarus: EntityPlayer) => void,
|
|
3
3
|
];
|
|
4
4
|
|
|
5
5
|
const subscriptions: PostFlipRegisterParameters[] = [];
|
|
@@ -15,8 +15,11 @@ export function postFlipRegister(...args: PostFlipRegisterParameters): void {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/** @internal */
|
|
18
|
-
export function postFlipFire(
|
|
18
|
+
export function postFlipFire(
|
|
19
|
+
newLazarus: EntityPlayer,
|
|
20
|
+
oldLazarus: EntityPlayer,
|
|
21
|
+
): void {
|
|
19
22
|
for (const [callback] of subscriptions) {
|
|
20
|
-
callback(
|
|
23
|
+
callback(newLazarus, oldLazarus);
|
|
21
24
|
}
|
|
22
25
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { GridEntityType } from "isaac-typescript-definitions";
|
|
2
|
+
|
|
3
|
+
export type PostGridEntityCustomRenderRegisterParameters = [
|
|
4
|
+
callback: (
|
|
5
|
+
gridEntity: GridEntity,
|
|
6
|
+
gridEntityTypeCustom: GridEntityType,
|
|
7
|
+
) => void,
|
|
8
|
+
gridEntityTypeCustom?: GridEntityType,
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
const subscriptions: PostGridEntityCustomRenderRegisterParameters[] = [];
|
|
12
|
+
|
|
13
|
+
/** @internal */
|
|
14
|
+
export function postGridEntityCustomRenderHasSubscriptions(): boolean {
|
|
15
|
+
return subscriptions.length > 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** @internal */
|
|
19
|
+
export function postGridEntityCustomRenderRegister(
|
|
20
|
+
...args: PostGridEntityCustomRenderRegisterParameters
|
|
21
|
+
): void {
|
|
22
|
+
subscriptions.push(args);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** @internal */
|
|
26
|
+
export function postGridEntityCustomRenderFire(
|
|
27
|
+
gridEntity: GridEntity,
|
|
28
|
+
gridEntityTypeCustom: GridEntityType,
|
|
29
|
+
): void {
|
|
30
|
+
for (const [callback, callbackGridEntityTypeCustom] of subscriptions) {
|
|
31
|
+
// Handle the optional 2nd callback argument.
|
|
32
|
+
if (
|
|
33
|
+
callbackGridEntityTypeCustom !== undefined &&
|
|
34
|
+
callbackGridEntityTypeCustom !== gridEntityTypeCustom
|
|
35
|
+
) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
callback(gridEntity, gridEntityTypeCustom);
|
|
40
|
+
}
|
|
41
|
+
}
|