isaacscript-common 7.10.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.
@@ -22,6 +22,7 @@ local ____roomShape = require("functions.roomShape")
22
22
  local isLRoom = ____roomShape.isLRoom
23
23
  local isNarrowRoom = ____roomShape.isNarrowRoom
24
24
  local ____string = require("functions.string")
25
+ local removeCharactersBefore = ____string.removeCharactersBefore
25
26
  local trimPrefix = ____string.trimPrefix
26
27
  local ____utils = require("functions.utils")
27
28
  local erange = ____utils.erange
@@ -31,7 +32,8 @@ local ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH = ____customStageConstants.ISAACSCRIPT_C
31
32
  function getBackdropPNGPath(self, customStage, backdropKind, rng)
32
33
  local backdrop = customStage.backdropPNGPaths == nil and DEFAULT_BACKDROP or customStage.backdropPNGPaths
33
34
  local pathArray = backdrop[backdropKind]
34
- return getRandomArrayElement(nil, pathArray, rng)
35
+ local randomPath = getRandomArrayElement(nil, pathArray, rng)
36
+ return removeCharactersBefore(nil, randomPath, "gfx/")
35
37
  end
36
38
  function spawnWallEntity(self, customStage, rng, isExtraWall)
37
39
  local room = game:GetRoom()
@@ -1 +1 @@
1
- {"version":3,"file":"customStageGridEntities.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/customStageGridEntities.ts"],"names":[],"mappings":";AAiBA,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AASnE,0CAA0C;AAC1C,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,GACrB,IAAI,CAuBN;AAED,oCAAoC;AACpC,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,GACrB,IAAI,CAyBN;AAED,mCAAmC;AACnC,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,GACrB,IAAI,CAsBN;AAED,mCAAmC;AACnC,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,GACrB,IAAI,CAuBN;AAuDD,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,GACrB,IAAI,CAwBN;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,GACrB,IAAI,CAsBN"}
1
+ {"version":3,"file":"customStageGridEntities.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/customStageGridEntities.ts"],"names":[],"mappings":";AAkBA,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AASnE,0CAA0C;AAC1C,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,GACrB,IAAI,CA4BN;AAED,oCAAoC;AACpC,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,GACrB,IAAI,CA2BN;AAED,mCAAmC;AACnC,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,GACrB,IAAI,CAwBN;AAED,mCAAmC;AACnC,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,GACrB,IAAI,CAwBN;AAuDD,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,GACrB,IAAI,CAwBN;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,GACrB,IAAI,CAsBN"}
@@ -19,6 +19,8 @@ local getCollectibles = ____pickupsSpecific.getCollectibles
19
19
  local getTrinkets = ____pickupsSpecific.getTrinkets
20
20
  local ____stage = require("functions.stage")
21
21
  local calculateStageType = ____stage.calculateStageType
22
+ local ____string = require("functions.string")
23
+ local removeCharactersBefore = ____string.removeCharactersBefore
22
24
  local ____vector = require("functions.vector")
23
25
  local vectorEquals = ____vector.vectorEquals
24
26
  local ____customGridEntity = require("features.customGridEntity")
@@ -158,6 +160,7 @@ function ____exports.setCustomDecorationGraphics(self, customStage, gridEntity)
158
160
  if customStage.decorationsPNGPath == nil then
159
161
  return
160
162
  end
163
+ local pngPath = removeCharactersBefore(nil, customStage.decorationsPNGPath, "gfx/")
161
164
  if isCustomGridEntity(nil, gridEntity) then
162
165
  return
163
166
  end
@@ -168,7 +171,7 @@ function ____exports.setCustomDecorationGraphics(self, customStage, gridEntity)
168
171
  local sprite = gridEntity:GetSprite()
169
172
  local fileName = sprite:GetFilename()
170
173
  if string.lower(fileName) == "gfx/grid/props_01_basement.anm2" then
171
- sprite:ReplaceSpritesheet(0, customStage.decorationsPNGPath)
174
+ sprite:ReplaceSpritesheet(0, pngPath)
172
175
  sprite:LoadGraphics()
173
176
  end
174
177
  end
@@ -177,6 +180,7 @@ function ____exports.setCustomRockGraphics(self, customStage, gridEntity)
177
180
  if customStage.rocksPNGPath == nil then
178
181
  return
179
182
  end
183
+ local pngPath = removeCharactersBefore(nil, customStage.rocksPNGPath, "gfx/")
180
184
  if isCustomGridEntity(nil, gridEntity) then
181
185
  return
182
186
  end
@@ -187,10 +191,10 @@ function ____exports.setCustomRockGraphics(self, customStage, gridEntity)
187
191
  local sprite = gridEntity:GetSprite()
188
192
  local fileName = sprite:GetFilename()
189
193
  if fileName == "gfx/grid/grid_rock.anm2" then
190
- sprite:ReplaceSpritesheet(0, customStage.rocksPNGPath)
194
+ sprite:ReplaceSpritesheet(0, pngPath)
191
195
  sprite:LoadGraphics()
192
196
  elseif fileName == "gfx/grid/grid_pit.anm2" then
193
- sprite:ReplaceSpritesheet(1, customStage.rocksPNGPath)
197
+ sprite:ReplaceSpritesheet(1, pngPath)
194
198
  sprite:LoadGraphics()
195
199
  end
196
200
  end
@@ -199,6 +203,7 @@ function ____exports.setCustomPitGraphics(self, customStage, gridEntity)
199
203
  if customStage.pitsPNGPath == nil then
200
204
  return
201
205
  end
206
+ local pngPath = removeCharactersBefore(nil, customStage.pitsPNGPath, "gfx/")
202
207
  if isCustomGridEntity(nil, gridEntity) then
203
208
  return
204
209
  end
@@ -209,7 +214,7 @@ function ____exports.setCustomPitGraphics(self, customStage, gridEntity)
209
214
  local sprite = gridEntity:GetSprite()
210
215
  local fileName = sprite:GetFilename()
211
216
  if fileName == "gfx/grid/grid_pit.anm2" then
212
- sprite:ReplaceSpritesheet(0, customStage.pitsPNGPath)
217
+ sprite:ReplaceSpritesheet(0, pngPath)
213
218
  sprite:LoadGraphics()
214
219
  end
215
220
  end
@@ -229,7 +234,8 @@ function ____exports.setCustomDoorGraphics(self, customStage, gridEntity)
229
234
  local fileName = sprite:GetFilename()
230
235
  local doorPNGPath = getNewDoorPNGPath(nil, customStage, fileName)
231
236
  if doorPNGPath ~= nil then
232
- sprite:ReplaceSpritesheet(0, doorPNGPath)
237
+ local fixedPath = removeCharactersBefore(nil, doorPNGPath, "gfx/")
238
+ sprite:ReplaceSpritesheet(0, fixedPath)
233
239
  sprite:LoadGraphics()
234
240
  end
235
241
  end
@@ -1 +1 @@
1
- {"version":3,"file":"shadows.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/shadows.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAqCnE,wBAAgB,UAAU,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAsCzD"}
1
+ {"version":3,"file":"shadows.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/shadows.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAqCnE,wBAAgB,UAAU,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAuCzD"}
@@ -8,6 +8,8 @@ local ____array = require("functions.array")
8
8
  local getRandomArrayElement = ____array.getRandomArrayElement
9
9
  local ____entitiesSpecific = require("functions.entitiesSpecific")
10
10
  local spawnEffectWithSeed = ____entitiesSpecific.spawnEffectWithSeed
11
+ local ____string = require("functions.string")
12
+ local removeCharactersBefore = ____string.removeCharactersBefore
11
13
  local ____customStageConstants = require("features.customStage.customStageConstants")
12
14
  local ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH = ____customStageConstants.ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH
13
15
  local ____v = require("features.customStage.v")
@@ -60,7 +62,8 @@ function ____exports.setShadows(self, customStage)
60
62
  sprite:Load(ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH .. "/stage-shadow.anm2", false)
61
63
  local decorationSeed = room:GetDecorationSeed()
62
64
  local shadow = getRandomArrayElement(nil, shadows, decorationSeed)
63
- sprite:ReplaceSpritesheet(0, shadow.pngPath)
65
+ local pngPath = removeCharactersBefore(nil, shadow.pngPath, "gfx/")
66
+ sprite:ReplaceSpritesheet(0, pngPath)
64
67
  sprite:LoadGraphics()
65
68
  sprite:SetFrame(animation, 0)
66
69
  sprite.Color = shadow.color == nil and FADED_BLACK or Color(shadow.color.r, shadow.color.g, shadow.color.b, shadow.color.a)
@@ -1 +1 @@
1
- {"version":3,"file":"versusScreen.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/versusScreen.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AA+EnE;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAavC;AAED,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CA4ExE;AAmGD,wBAAgB,sBAAsB,IAAI,IAAI,CAkC7C"}
1
+ {"version":3,"file":"versusScreen.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/versusScreen.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AA+EnE;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAavC;AAED,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAoFxE;AAmGD,wBAAgB,sBAAsB,IAAI,IAAI,CAkC7C"}
@@ -19,6 +19,8 @@ local ____bosses = require("functions.bosses")
19
19
  local getBosses = ____bosses.getBosses
20
20
  local ____roomData = require("functions.roomData")
21
21
  local getRoomSubType = ____roomData.getRoomSubType
22
+ local ____string = require("functions.string")
23
+ local removeCharactersBefore = ____string.removeCharactersBefore
22
24
  local ____utils = require("functions.utils")
23
25
  local erange = ____utils.erange
24
26
  local ____bossNamePNGFileNames = require("objects.bossNamePNGFileNames")
@@ -190,8 +192,10 @@ function ____exports.playVersusScreenAnimation(self, customStage)
190
192
  local ____getBossPNGPaths_result_1 = getBossPNGPaths(nil, customStage)
191
193
  local namePNGPath = ____getBossPNGPaths_result_1.namePNGPath
192
194
  local portraitPNGPath = ____getBossPNGPaths_result_1.portraitPNGPath
193
- versusScreenSprite:ReplaceSpritesheet(BOSS_NAME_ANM2_LAYER, namePNGPath)
194
- versusScreenSprite:ReplaceSpritesheet(BOSS_PORTRAIT_ANM2_LAYER, portraitPNGPath)
195
+ local trimmedNamePNGPath = removeCharactersBefore(nil, namePNGPath, "gfx/")
196
+ versusScreenSprite:ReplaceSpritesheet(BOSS_NAME_ANM2_LAYER, trimmedNamePNGPath)
197
+ local trimmedPortraitPNGPath = removeCharactersBefore(nil, portraitPNGPath, "gfx/")
198
+ versusScreenSprite:ReplaceSpritesheet(BOSS_PORTRAIT_ANM2_LAYER, trimmedPortraitPNGPath)
195
199
  end
196
200
  versusScreenSprite:LoadGraphics()
197
201
  local backgroundColor = VERSUS_SCREEN_BACKGROUND_COLORS[DEFAULT_STAGE_ID]
@@ -1,5 +1,10 @@
1
1
  export declare function capitalizeFirstLetter(string: string): string;
2
2
  export declare function removeAllCharacters(string: string, character: string): string;
3
+ /**
4
+ * Helper function to remove all of the characters in a string before a given substring. Returns the
5
+ * modified string.
6
+ */
7
+ export declare function removeCharactersBefore(string: string, substring: string): string;
3
8
  /**
4
9
  * Helper function to remove one or more substrings from a string, if they exist. Returns the
5
10
  * modified string.
@@ -1 +1 @@
1
- {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/functions/string.ts"],"names":[],"mappings":"AAAA,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAM5D;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE7E;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,GAAG,UAAU,EAAE,MAAM,EAAE,GACtB,MAAM,CAMR;AAED,gGAAgG;AAChG,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAMjE;AAED,gGAAgG;AAChG,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAOjE"}
1
+ {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/functions/string.ts"],"names":[],"mappings":"AAAA,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAM5D;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE7E;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,MAAM,CAGR;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,GAAG,UAAU,EAAE,MAAM,EAAE,GACtB,MAAM,CAMR;AAED,gGAAgG;AAChG,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAMjE;AAED,gGAAgG;AAChG,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAOjE"}
@@ -1,7 +1,7 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local __TS__StringReplaceAll = ____lualib.__TS__StringReplaceAll
3
- local __TS__StringStartsWith = ____lualib.__TS__StringStartsWith
4
3
  local __TS__StringSlice = ____lualib.__TS__StringSlice
4
+ local __TS__StringStartsWith = ____lualib.__TS__StringStartsWith
5
5
  local __TS__StringEndsWith = ____lualib.__TS__StringEndsWith
6
6
  local ____exports = {}
7
7
  function ____exports.capitalizeFirstLetter(self, ____string)
@@ -13,6 +13,12 @@ end
13
13
  function ____exports.removeAllCharacters(self, ____string, character)
14
14
  return __TS__StringReplaceAll(____string, character, "")
15
15
  end
16
+ --- Helper function to remove all of the characters in a string before a given substring. Returns the
17
+ -- modified string.
18
+ function ____exports.removeCharactersBefore(self, ____string, substring)
19
+ local index = (string.find(____string, substring, nil, true) or 0) - 1
20
+ return __TS__StringSlice(____string, index)
21
+ end
16
22
  --- Helper function to remove one or more substrings from a string, if they exist. Returns the
17
23
  -- modified string.
18
24
  --
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "7.10.0",
3
+ "version": "7.11.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -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
- return getRandomArrayElement(pathArray, rng);
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, customStage.decorationsPNGPath);
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, customStage.rocksPNGPath);
87
+ sprite.ReplaceSpritesheet(0, pngPath);
80
88
  sprite.LoadGraphics();
81
89
  } else if (fileName === "gfx/grid/grid_pit.anm2") {
82
- sprite.ReplaceSpritesheet(1, customStage.rocksPNGPath);
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, customStage.pitsPNGPath);
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
- sprite.ReplaceSpritesheet(0, doorPNGPath);
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
- sprite.ReplaceSpritesheet(0, shadow.pngPath);
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
- versusScreenSprite.ReplaceSpritesheet(BOSS_NAME_ANM2_LAYER, namePNGPath);
159
+ const trimmedNamePNGPath = removeCharactersBefore(namePNGPath, "gfx/");
159
160
  versusScreenSprite.ReplaceSpritesheet(
160
- BOSS_PORTRAIT_ANM2_LAYER,
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
 
@@ -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.