isaacscript-common 7.9.0 → 7.11.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/postPlayerReorderedCallbacks.d.ts +2 -2
- package/dist/callbacks/postPlayerReorderedCallbacks.d.ts.map +1 -1
- package/dist/callbacks/postPlayerReorderedCallbacks.lua +5 -3
- package/dist/callbacks/reorderedCallbacks.d.ts.map +1 -1
- package/dist/callbacks/reorderedCallbacks.lua +5 -1
- package/dist/callbacks/subscriptions/postGameStartedReorderedLast.d.ts +7 -0
- package/dist/callbacks/subscriptions/postGameStartedReorderedLast.d.ts.map +1 -0
- package/dist/callbacks/subscriptions/postGameStartedReorderedLast.lua +16 -0
- package/dist/enums/ModCallbackCustom.d.ts +86 -73
- package/dist/enums/ModCallbackCustom.d.ts.map +1 -1
- package/dist/enums/ModCallbackCustom.lua +71 -69
- package/dist/features/customStage/backdrop.lua +3 -1
- package/dist/features/customStage/customStageGridEntities.d.ts.map +1 -1
- package/dist/features/customStage/customStageGridEntities.lua +11 -5
- package/dist/features/customStage/shadows.d.ts.map +1 -1
- package/dist/features/customStage/shadows.lua +4 -1
- package/dist/features/customStage/versusScreen.d.ts.map +1 -1
- package/dist/features/customStage/versusScreen.lua +6 -2
- package/dist/functions/string.d.ts +5 -0
- package/dist/functions/string.d.ts.map +1 -1
- package/dist/functions/string.lua +7 -1
- package/dist/initFeatures.d.ts.map +1 -1
- package/dist/initFeatures.lua +3 -0
- package/dist/interfaces/private/AddCallbackParameterCustom.d.ts +2 -0
- package/dist/interfaces/private/AddCallbackParameterCustom.d.ts.map +1 -1
- package/dist/objects/callbackRegisterFunctions.d.ts.map +1 -1
- package/dist/objects/callbackRegisterFunctions.lua +3 -0
- package/package.json +1 -1
- package/src/callbacks/postPlayerReorderedCallbacks.ts +9 -4
- package/src/callbacks/reorderedCallbacks.ts +8 -0
- package/src/callbacks/subscriptions/postGameStartedReorderedLast.ts +21 -0
- package/src/enums/ModCallbackCustom.ts +18 -4
- package/src/features/customStage/backdrop.ts +3 -2
- package/src/features/customStage/customStageGridEntities.ts +16 -5
- package/src/features/customStage/shadows.ts +3 -1
- package/src/features/customStage/versusScreen.ts +11 -2
- package/src/functions/string.ts +12 -0
- package/src/initFeatures.ts +2 -0
- package/src/interfaces/private/AddCallbackParameterCustom.ts +2 -0
- package/src/objects/callbackRegisterFunctions.ts +3 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type PostGameStartedReorderedLastRegisterParameters = [
|
|
2
|
+
callback: (isContinued: boolean) => void,
|
|
3
|
+
];
|
|
4
|
+
|
|
5
|
+
const subscriptions: PostGameStartedReorderedLastRegisterParameters[] = [];
|
|
6
|
+
|
|
7
|
+
export function postGameStartedReorderedLastHasSubscriptions(): boolean {
|
|
8
|
+
return subscriptions.length > 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function postGameStartedReorderedLastRegister(
|
|
12
|
+
...args: PostGameStartedReorderedLastRegisterParameters
|
|
13
|
+
): void {
|
|
14
|
+
subscriptions.push(args);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function postGameStartedReorderedLastFire(isContinued: boolean): void {
|
|
18
|
+
for (const [callback] of subscriptions) {
|
|
19
|
+
callback(isContinued);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -327,6 +327,18 @@ export enum ModCallbackCustom {
|
|
|
327
327
|
*/
|
|
328
328
|
POST_GAME_STARTED_REORDERED,
|
|
329
329
|
|
|
330
|
+
/**
|
|
331
|
+
* Similar to the `POST_GAME_STARTED_REORDERED` callback, but fires after all of the subscribed
|
|
332
|
+
* callbacks have finished firing. Thus, you can use this callback to do perform things after a
|
|
333
|
+
* new run has started (or continued), but you can be sure that all new-run-related initialization
|
|
334
|
+
* has been completed.
|
|
335
|
+
*
|
|
336
|
+
* ```ts
|
|
337
|
+
* function postGameStartedReorderedLast(isContinued: boolean): void {}
|
|
338
|
+
* ```
|
|
339
|
+
*/
|
|
340
|
+
POST_GAME_STARTED_REORDERED_LAST,
|
|
341
|
+
|
|
330
342
|
/**
|
|
331
343
|
* Fires from the `POST_UPDATE` callback when the Greed Mode wave increases.
|
|
332
344
|
*
|
|
@@ -742,8 +754,9 @@ export enum ModCallbackCustom {
|
|
|
742
754
|
POST_NPC_STATE_CHANGED,
|
|
743
755
|
|
|
744
756
|
/**
|
|
745
|
-
* Similar to the vanilla callback of the same name, but fires after the
|
|
746
|
-
* callback fires (if the player is being updated on the 0th game
|
|
757
|
+
* Similar to the vanilla callback of the same name, but fires after the
|
|
758
|
+
* `POST_GAME_STARTED_REORDERED` callback fires (if the player is being updated on the 0th game
|
|
759
|
+
* frame of the run).
|
|
747
760
|
*
|
|
748
761
|
* This callback is useful for two reasons:
|
|
749
762
|
*
|
|
@@ -1038,8 +1051,9 @@ export enum ModCallbackCustom {
|
|
|
1038
1051
|
POST_PLAYER_RENDER_REORDERED,
|
|
1039
1052
|
|
|
1040
1053
|
/**
|
|
1041
|
-
* Similar to the vanilla callback of the same name, but fires after the
|
|
1042
|
-
* callback fires (if the player is being updated on the 0th game
|
|
1054
|
+
* Similar to the vanilla callback of the same name, but fires after the
|
|
1055
|
+
* `POST_GAME_STARTED_REORDERED` callback fires (if the player is being updated on the 0th game
|
|
1056
|
+
* frame of the run).
|
|
1043
1057
|
*
|
|
1044
1058
|
* This callback is useful for two reasons:
|
|
1045
1059
|
*
|
|
@@ -14,7 +14,7 @@ import { getRandomArrayElement } from "../../functions/array";
|
|
|
14
14
|
import { spawnEffectWithSeed } from "../../functions/entitiesSpecific";
|
|
15
15
|
import { newRNG } from "../../functions/rng";
|
|
16
16
|
import { isLRoom, isNarrowRoom } from "../../functions/roomShape";
|
|
17
|
-
import { trimPrefix } from "../../functions/string";
|
|
17
|
+
import { removeCharactersBefore, trimPrefix } from "../../functions/string";
|
|
18
18
|
import { erange, irange } from "../../functions/utils";
|
|
19
19
|
import { CustomStage } from "../../interfaces/private/CustomStage";
|
|
20
20
|
import { ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH } from "./customStageConstants";
|
|
@@ -118,7 +118,8 @@ function getBackdropPNGPath(
|
|
|
118
118
|
: customStage.backdropPNGPaths;
|
|
119
119
|
|
|
120
120
|
const pathArray = backdrop[backdropKind];
|
|
121
|
-
|
|
121
|
+
const randomPath = getRandomArrayElement(pathArray, rng);
|
|
122
|
+
return removeCharactersBefore(randomPath, "gfx/");
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
function spawnWallEntity(
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
getTrinkets,
|
|
15
15
|
} from "../../functions/pickupsSpecific";
|
|
16
16
|
import { calculateStageType } from "../../functions/stage";
|
|
17
|
+
import { removeCharactersBefore } from "../../functions/string";
|
|
17
18
|
import { vectorEquals } from "../../functions/vector";
|
|
18
19
|
import { CustomStage } from "../../interfaces/private/CustomStage";
|
|
19
20
|
import { isCustomGridEntity } from "../customGridEntity";
|
|
@@ -35,6 +36,11 @@ export function setCustomDecorationGraphics(
|
|
|
35
36
|
return;
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
const pngPath = removeCharactersBefore(
|
|
40
|
+
customStage.decorationsPNGPath,
|
|
41
|
+
"gfx/",
|
|
42
|
+
);
|
|
43
|
+
|
|
38
44
|
if (isCustomGridEntity(gridEntity)) {
|
|
39
45
|
return;
|
|
40
46
|
}
|
|
@@ -48,7 +54,7 @@ export function setCustomDecorationGraphics(
|
|
|
48
54
|
const fileName = sprite.GetFilename();
|
|
49
55
|
// On Windows, this is: gfx/grid/Props_01_Basement.anm2
|
|
50
56
|
if (fileName.toLowerCase() === "gfx/grid/props_01_basement.anm2") {
|
|
51
|
-
sprite.ReplaceSpritesheet(0,
|
|
57
|
+
sprite.ReplaceSpritesheet(0, pngPath);
|
|
52
58
|
sprite.LoadGraphics();
|
|
53
59
|
}
|
|
54
60
|
}
|
|
@@ -64,6 +70,8 @@ export function setCustomRockGraphics(
|
|
|
64
70
|
return;
|
|
65
71
|
}
|
|
66
72
|
|
|
73
|
+
const pngPath = removeCharactersBefore(customStage.rocksPNGPath, "gfx/");
|
|
74
|
+
|
|
67
75
|
if (isCustomGridEntity(gridEntity)) {
|
|
68
76
|
return;
|
|
69
77
|
}
|
|
@@ -76,10 +84,10 @@ export function setCustomRockGraphics(
|
|
|
76
84
|
const sprite = gridEntity.GetSprite();
|
|
77
85
|
const fileName = sprite.GetFilename();
|
|
78
86
|
if (fileName === "gfx/grid/grid_rock.anm2") {
|
|
79
|
-
sprite.ReplaceSpritesheet(0,
|
|
87
|
+
sprite.ReplaceSpritesheet(0, pngPath);
|
|
80
88
|
sprite.LoadGraphics();
|
|
81
89
|
} else if (fileName === "gfx/grid/grid_pit.anm2") {
|
|
82
|
-
sprite.ReplaceSpritesheet(1,
|
|
90
|
+
sprite.ReplaceSpritesheet(1, pngPath);
|
|
83
91
|
sprite.LoadGraphics();
|
|
84
92
|
}
|
|
85
93
|
}
|
|
@@ -95,6 +103,8 @@ export function setCustomPitGraphics(
|
|
|
95
103
|
return;
|
|
96
104
|
}
|
|
97
105
|
|
|
106
|
+
const pngPath = removeCharactersBefore(customStage.pitsPNGPath, "gfx/");
|
|
107
|
+
|
|
98
108
|
if (isCustomGridEntity(gridEntity)) {
|
|
99
109
|
return;
|
|
100
110
|
}
|
|
@@ -107,7 +117,7 @@ export function setCustomPitGraphics(
|
|
|
107
117
|
const sprite = gridEntity.GetSprite();
|
|
108
118
|
const fileName = sprite.GetFilename();
|
|
109
119
|
if (fileName === "gfx/grid/grid_pit.anm2") {
|
|
110
|
-
sprite.ReplaceSpritesheet(0,
|
|
120
|
+
sprite.ReplaceSpritesheet(0, pngPath);
|
|
111
121
|
sprite.LoadGraphics();
|
|
112
122
|
}
|
|
113
123
|
}
|
|
@@ -136,7 +146,8 @@ export function setCustomDoorGraphics(
|
|
|
136
146
|
const fileName = sprite.GetFilename();
|
|
137
147
|
const doorPNGPath = getNewDoorPNGPath(customStage, fileName);
|
|
138
148
|
if (doorPNGPath !== undefined) {
|
|
139
|
-
|
|
149
|
+
const fixedPath = removeCharactersBefore(doorPNGPath, "gfx/");
|
|
150
|
+
sprite.ReplaceSpritesheet(0, fixedPath);
|
|
140
151
|
sprite.LoadGraphics();
|
|
141
152
|
}
|
|
142
153
|
}
|
|
@@ -2,6 +2,7 @@ import { EffectVariant, RoomShape } from "isaac-typescript-definitions";
|
|
|
2
2
|
import { game } from "../../core/cachedClasses";
|
|
3
3
|
import { getRandomArrayElement } from "../../functions/array";
|
|
4
4
|
import { spawnEffectWithSeed } from "../../functions/entitiesSpecific";
|
|
5
|
+
import { removeCharactersBefore } from "../../functions/string";
|
|
5
6
|
import { CustomStage } from "../../interfaces/private/CustomStage";
|
|
6
7
|
import { ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH } from "./customStageConstants";
|
|
7
8
|
import v from "./v";
|
|
@@ -68,7 +69,8 @@ export function setShadows(customStage: CustomStage): void {
|
|
|
68
69
|
sprite.Load(`${ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH}/stage-shadow.anm2`, false);
|
|
69
70
|
const decorationSeed = room.GetDecorationSeed();
|
|
70
71
|
const shadow = getRandomArrayElement(shadows, decorationSeed);
|
|
71
|
-
|
|
72
|
+
const pngPath = removeCharactersBefore(shadow.pngPath, "gfx/");
|
|
73
|
+
sprite.ReplaceSpritesheet(0, pngPath);
|
|
72
74
|
sprite.LoadGraphics();
|
|
73
75
|
sprite.SetFrame(animation, 0);
|
|
74
76
|
sprite.Color =
|
|
@@ -10,6 +10,7 @@ import { game, sfxManager } from "../../core/cachedClasses";
|
|
|
10
10
|
import { arrayRemove } from "../../functions/array";
|
|
11
11
|
import { getBosses } from "../../functions/bosses";
|
|
12
12
|
import { getRoomSubType } from "../../functions/roomData";
|
|
13
|
+
import { removeCharactersBefore } from "../../functions/string";
|
|
13
14
|
import { erange } from "../../functions/utils";
|
|
14
15
|
import { CustomStage } from "../../interfaces/private/CustomStage";
|
|
15
16
|
import { BOSS_NAME_PNG_FILE_NAMES } from "../../objects/bossNamePNGFileNames";
|
|
@@ -155,10 +156,18 @@ export function playVersusScreenAnimation(customStage: CustomStage): void {
|
|
|
155
156
|
// Boss
|
|
156
157
|
{
|
|
157
158
|
const { namePNGPath, portraitPNGPath } = getBossPNGPaths(customStage);
|
|
158
|
-
|
|
159
|
+
const trimmedNamePNGPath = removeCharactersBefore(namePNGPath, "gfx/");
|
|
159
160
|
versusScreenSprite.ReplaceSpritesheet(
|
|
160
|
-
|
|
161
|
+
BOSS_NAME_ANM2_LAYER,
|
|
162
|
+
trimmedNamePNGPath,
|
|
163
|
+
);
|
|
164
|
+
const trimmedPortraitPNGPath = removeCharactersBefore(
|
|
161
165
|
portraitPNGPath,
|
|
166
|
+
"gfx/",
|
|
167
|
+
);
|
|
168
|
+
versusScreenSprite.ReplaceSpritesheet(
|
|
169
|
+
BOSS_PORTRAIT_ANM2_LAYER,
|
|
170
|
+
trimmedPortraitPNGPath,
|
|
162
171
|
);
|
|
163
172
|
}
|
|
164
173
|
|
package/src/functions/string.ts
CHANGED
|
@@ -10,6 +10,18 @@ export function removeAllCharacters(string: string, character: string): string {
|
|
|
10
10
|
return string.replaceAll(character, "");
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Helper function to remove all of the characters in a string before a given substring. Returns the
|
|
15
|
+
* modified string.
|
|
16
|
+
*/
|
|
17
|
+
export function removeCharactersBefore(
|
|
18
|
+
string: string,
|
|
19
|
+
substring: string,
|
|
20
|
+
): string {
|
|
21
|
+
const index = string.indexOf(substring);
|
|
22
|
+
return string.slice(index);
|
|
23
|
+
}
|
|
24
|
+
|
|
13
25
|
/**
|
|
14
26
|
* Helper function to remove one or more substrings from a string, if they exist. Returns the
|
|
15
27
|
* modified string.
|
package/src/initFeatures.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { persistentEntitiesInit } from "./features/persistentEntities";
|
|
|
16
16
|
import { pickupIndexInit } from "./features/pickupIndex";
|
|
17
17
|
import { playerInventoryInit } from "./features/playerInventory";
|
|
18
18
|
import { ponyDetectionInit } from "./features/ponyDetection";
|
|
19
|
+
import { preventChildEntitiesInit } from "./features/preventChildEntities";
|
|
19
20
|
import { preventCollectibleRotationInit } from "./features/preventCollectibleRotation";
|
|
20
21
|
import { registerHotkeyInit } from "./features/registerHotkey";
|
|
21
22
|
import { roomClearFrameInit } from "./features/roomClearFrame";
|
|
@@ -53,6 +54,7 @@ function initFeaturesMinor(mod: ModUpgraded) {
|
|
|
53
54
|
pickupIndexInit(mod);
|
|
54
55
|
playerInventoryInit(mod);
|
|
55
56
|
ponyDetectionInit(mod);
|
|
57
|
+
preventChildEntitiesInit(mod);
|
|
56
58
|
preventCollectibleRotationInit(mod);
|
|
57
59
|
registerHotkeyInit(mod);
|
|
58
60
|
roomClearFrameInit(mod);
|
|
@@ -20,6 +20,7 @@ import { PostFirstEsauJrRegisterParameters } from "../../callbacks/subscriptions
|
|
|
20
20
|
import { PostFirstFlipRegisterParameters } from "../../callbacks/subscriptions/postFirstFlip";
|
|
21
21
|
import { PostFlipRegisterParameters } from "../../callbacks/subscriptions/postFlip";
|
|
22
22
|
import { PostGameStartedReorderedRegisterParameters } from "../../callbacks/subscriptions/postGameStartedReordered";
|
|
23
|
+
import { PostGameStartedReorderedLastRegisterParameters } from "../../callbacks/subscriptions/postGameStartedReorderedLast";
|
|
23
24
|
import { PostGreedModeWaveRegisterParameters } from "../../callbacks/subscriptions/postGreedModeWave";
|
|
24
25
|
import { PostGridEntityBrokenRegisterParameters } from "../../callbacks/subscriptions/postGridEntityBroken";
|
|
25
26
|
import { PostGridEntityCollisionRegisterParameters } from "../../callbacks/subscriptions/postGridEntityCollision";
|
|
@@ -114,6 +115,7 @@ export interface AddCallbackParameterCustom {
|
|
|
114
115
|
[ModCallbackCustom.POST_FIRST_FLIP]: PostFirstFlipRegisterParameters;
|
|
115
116
|
[ModCallbackCustom.POST_FLIP]: PostFlipRegisterParameters;
|
|
116
117
|
[ModCallbackCustom.POST_GAME_STARTED_REORDERED]: PostGameStartedReorderedRegisterParameters;
|
|
118
|
+
[ModCallbackCustom.POST_GAME_STARTED_REORDERED_LAST]: PostGameStartedReorderedLastRegisterParameters;
|
|
117
119
|
[ModCallbackCustom.POST_GREED_MODE_WAVE]: PostGreedModeWaveRegisterParameters;
|
|
118
120
|
[ModCallbackCustom.POST_GRID_ENTITY_BROKEN]: PostGridEntityBrokenRegisterParameters;
|
|
119
121
|
[ModCallbackCustom.POST_GRID_ENTITY_COLLISION]: PostGridEntityCollisionRegisterParameters;
|
|
@@ -20,6 +20,7 @@ import { postFirstEsauJrRegister } from "../callbacks/subscriptions/postFirstEsa
|
|
|
20
20
|
import { postFirstFlipRegister } from "../callbacks/subscriptions/postFirstFlip";
|
|
21
21
|
import { postFlipRegister } from "../callbacks/subscriptions/postFlip";
|
|
22
22
|
import { postGameStartedReorderedRegister } from "../callbacks/subscriptions/postGameStartedReordered";
|
|
23
|
+
import { postGameStartedReorderedLastRegister } from "../callbacks/subscriptions/postGameStartedReorderedLast";
|
|
23
24
|
import { postGreedModeWaveRegister } from "../callbacks/subscriptions/postGreedModeWave";
|
|
24
25
|
import { postGridEntityBrokenRegister } from "../callbacks/subscriptions/postGridEntityBroken";
|
|
25
26
|
import { postGridEntityCollisionRegister } from "../callbacks/subscriptions/postGridEntityCollision";
|
|
@@ -122,6 +123,8 @@ export const CALLBACK_REGISTER_FUNCTIONS: {
|
|
|
122
123
|
[ModCallbackCustom.POST_FLIP]: postFlipRegister,
|
|
123
124
|
[ModCallbackCustom.POST_GAME_STARTED_REORDERED]:
|
|
124
125
|
postGameStartedReorderedRegister,
|
|
126
|
+
[ModCallbackCustom.POST_GAME_STARTED_REORDERED_LAST]:
|
|
127
|
+
postGameStartedReorderedLastRegister,
|
|
125
128
|
[ModCallbackCustom.POST_GREED_MODE_WAVE]: postGreedModeWaveRegister,
|
|
126
129
|
[ModCallbackCustom.POST_GRID_ENTITY_BROKEN]: postGridEntityBrokenRegister,
|
|
127
130
|
[ModCallbackCustom.POST_GRID_ENTITY_COLLISION]:
|