isaacscript-common 30.4.4-dev.0 → 30.4.5

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.
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 30.4.4-dev.0
3
+ isaacscript-common 30.4.5
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -44295,6 +44295,7 @@ local removeUrnRewards = ____rockAlt.removeUrnRewards
44295
44295
  local ____rooms = require("src.functions.rooms")
44296
44296
  local getRoomDataForTypeVariant = ____rooms.getRoomDataForTypeVariant
44297
44297
  local getRoomsInsideGrid = ____rooms.getRoomsInsideGrid
44298
+ local inRoomType = ____rooms.inRoomType
44298
44299
  local ____sound = require("src.functions.sound")
44299
44300
  local getMusicForStage = ____sound.getMusicForStage
44300
44301
  local ____stage = require("src.functions.stage")
@@ -44379,6 +44380,14 @@ function CustomStages.prototype.____constructor(self, customGridEntities, custom
44379
44380
  end
44380
44381
  streakTextPostRender(nil)
44381
44382
  versusScreenPostRender(nil, self.pause, self.disableAllSound)
44383
+ if customStage.music ~= nil then
44384
+ local currentMusic = musicManager:GetCurrentMusicID()
44385
+ local music = Isaac.GetMusicIdByName(customStage.music)
44386
+ if currentMusic == music then
44387
+ musicManager:Resume()
44388
+ musicManager:UpdateVolume()
44389
+ end
44390
+ end
44382
44391
  end
44383
44392
  self.postCurseEval = function(____, curses)
44384
44393
  local customStage = v.run.currentCustomStage
@@ -44442,6 +44451,13 @@ function CustomStages.prototype.____constructor(self, customGridEntities, custom
44442
44451
  self.pause,
44443
44452
  self.runInNFrames
44444
44453
  )
44454
+ if customStage.music ~= nil and inRoomType(nil, RoomType.DEFAULT) then
44455
+ local music = Isaac.GetMusicIdByName(customStage.music)
44456
+ local currentMusic = musicManager:GetCurrentMusicID()
44457
+ if currentMusic ~= music then
44458
+ musicManager:Fadein(music)
44459
+ end
44460
+ end
44445
44461
  end
44446
44462
  self.featuresUsed = {
44447
44463
  ISCFeature.CUSTOM_GRID_ENTITIES,
@@ -44485,10 +44501,10 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
44485
44501
  for ____, room in ipairs(getRoomsInsideGrid(nil)) do
44486
44502
  do
44487
44503
  if room.SafeGridIndex == startingRoomGridIndex then
44488
- goto __continue27
44504
+ goto __continue31
44489
44505
  end
44490
44506
  if room.Data == nil then
44491
- goto __continue27
44507
+ goto __continue31
44492
44508
  end
44493
44509
  local roomType = room.Data.Type
44494
44510
  local roomShapeMap = customStage.roomTypeMap:get(roomType)
@@ -44496,13 +44512,13 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
44496
44512
  if roomType == RoomType.DEFAULT then
44497
44513
  logError((((("Failed to find any custom rooms for RoomType." .. RoomType[roomType]) .. " (") .. tostring(roomType)) .. ") for custom stage: ") .. customStage.name)
44498
44514
  end
44499
- goto __continue27
44515
+ goto __continue31
44500
44516
  end
44501
44517
  local roomShape = room.Data.Shape
44502
44518
  local roomDoorSlotFlagMap = roomShapeMap:get(roomShape)
44503
44519
  if roomDoorSlotFlagMap == nil then
44504
44520
  logError((((((((("Failed to find any custom rooms for RoomType." .. RoomType[roomType]) .. " (") .. tostring(roomType)) .. ") + RoomShape.") .. RoomShape[roomShape]) .. " (") .. tostring(roomShape)) .. ") for custom stage: ") .. customStage.name)
44505
- goto __continue27
44521
+ goto __continue31
44506
44522
  end
44507
44523
  local doorSlotFlags = room.Data.Doors
44508
44524
  local roomsMetadata = roomDoorSlotFlagMap:get(doorSlotFlags)
@@ -44512,13 +44528,13 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
44512
44528
  roomsMetadata = roomDoorSlotFlagMap:get(allDoorSlotFlags)
44513
44529
  if roomsMetadata == nil then
44514
44530
  logError((((((((("Failed to find any custom rooms for RoomType." .. RoomType[roomType]) .. " (") .. tostring(roomType)) .. ") + RoomShape.") .. RoomShape[roomShape]) .. " (") .. tostring(roomShape)) .. ") + all doors enabled for custom stage: ") .. customStage.name)
44515
- goto __continue27
44531
+ goto __continue31
44516
44532
  end
44517
44533
  end
44518
44534
  local randomRoom
44519
44535
  if roomType == RoomType.BOSS then
44520
44536
  if customStage.bossPool == nil then
44521
- goto __continue27
44537
+ goto __continue31
44522
44538
  end
44523
44539
  randomRoom = getRandomBossRoomFromPool(
44524
44540
  nil,
@@ -44541,13 +44557,13 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
44541
44557
  )
44542
44558
  if newRoomData == nil then
44543
44559
  logError((("Failed to get the room data for room variant " .. tostring(randomRoom.variant)) .. " for custom stage: ") .. customStage.name)
44544
- goto __continue27
44560
+ goto __continue31
44545
44561
  end
44546
44562
  self.customStageCachedRoomData:set(randomRoom.variant, newRoomData)
44547
44563
  end
44548
44564
  room.Data = newRoomData
44549
44565
  end
44550
- ::__continue27::
44566
+ ::__continue31::
44551
44567
  end
44552
44568
  end
44553
44569
  function CustomStages.prototype.setCustomStage(self, name, firstFloor, streakText, verbose)
@@ -44600,11 +44616,11 @@ function CustomStages.prototype.setCustomStage(self, name, firstFloor, streakTex
44600
44616
  end
44601
44617
  end
44602
44618
  local music = (customStageMusic == nil or customStageMusic == -1) and getMusicForStage(nil, baseStage, baseStageType) or customStageMusic
44603
- Isaac.DebugString("GETTING HERE - music: " .. tostring(music))
44604
44619
  self.runInNFrames:runInNRenderFrames(
44605
44620
  function()
44606
44621
  musicManager:Enable()
44607
- musicManager:Crossfade(music)
44622
+ musicManager:Play(music)
44623
+ musicManager:UpdateVolume()
44608
44624
  end,
44609
44625
  MUSIC_DELAY_RENDER_FRAMES
44610
44626
  )
@@ -1 +1 @@
1
- {"version":3,"file":"CustomStages.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/CustomStages.ts"],"names":[],"mappings":"AAwCA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AA2ChD,qBAAa,YAAa,SAAQ,OAAO;IAIvC,oCAAoC;IACpC,OA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,CAAQ;IACrB,OAAO,CAAC,YAAY,CAAe;IAqDnC,OAAO,CAAC,uBAAuB;IAc/B,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,6BAA6B;IAOrC,OAAO,CAAC,eAAe,CAarB;IAGF,OAAO,CAAC,UAAU,CAmBhB;IAGF,OAAO,CAAC,aAAa,CAcnB;IAGF,OAAO,CAAC,eAAe,CAUrB;IAIF,OAAO,CAAC,2BAA2B,CAejC;IAGF,OAAO,CAAC,kBAAkB,CAqBxB;IAGF,OAAO,CAAC,oBAAoB,CAwB1B;IAEF,gDAAgD;IAChD,OAAO,CAAC,iBAAiB;IAgGzB;;;;;;;;;;;;;;;;OAgBG;IAEI,cAAc,CACnB,IAAI,EAAE,MAAM,EACZ,UAAU,UAAO,EACjB,UAAU,UAAO,EACjB,OAAO,UAAQ,GACd,IAAI;IAkGP;;;;;OAKG;IAEI,kBAAkB,IAAI,IAAI;CAGlC"}
@@ -42,6 +42,7 @@ local removeUrnRewards = ____rockAlt.removeUrnRewards
42
42
  local ____rooms = require("src.functions.rooms")
43
43
  local getRoomDataForTypeVariant = ____rooms.getRoomDataForTypeVariant
44
44
  local getRoomsInsideGrid = ____rooms.getRoomsInsideGrid
45
+ local inRoomType = ____rooms.inRoomType
45
46
  local ____sound = require("src.functions.sound")
46
47
  local getMusicForStage = ____sound.getMusicForStage
47
48
  local ____stage = require("src.functions.stage")
@@ -128,6 +129,14 @@ function CustomStages.prototype.____constructor(self, customGridEntities, custom
128
129
  end
129
130
  streakTextPostRender(nil)
130
131
  versusScreenPostRender(nil, self.pause, self.disableAllSound)
132
+ if customStage.music ~= nil then
133
+ local currentMusic = musicManager:GetCurrentMusicID()
134
+ local music = Isaac.GetMusicIdByName(customStage.music)
135
+ if currentMusic == music then
136
+ musicManager:Resume()
137
+ musicManager:UpdateVolume()
138
+ end
139
+ end
131
140
  end
132
141
  self.postCurseEval = function(____, curses)
133
142
  local customStage = v.run.currentCustomStage
@@ -191,6 +200,13 @@ function CustomStages.prototype.____constructor(self, customGridEntities, custom
191
200
  self.pause,
192
201
  self.runInNFrames
193
202
  )
203
+ if customStage.music ~= nil and inRoomType(nil, RoomType.DEFAULT) then
204
+ local music = Isaac.GetMusicIdByName(customStage.music)
205
+ local currentMusic = musicManager:GetCurrentMusicID()
206
+ if currentMusic ~= music then
207
+ musicManager:Fadein(music)
208
+ end
209
+ end
194
210
  end
195
211
  self.featuresUsed = {
196
212
  ISCFeature.CUSTOM_GRID_ENTITIES,
@@ -234,10 +250,10 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
234
250
  for ____, room in ipairs(getRoomsInsideGrid(nil)) do
235
251
  do
236
252
  if room.SafeGridIndex == startingRoomGridIndex then
237
- goto __continue27
253
+ goto __continue31
238
254
  end
239
255
  if room.Data == nil then
240
- goto __continue27
256
+ goto __continue31
241
257
  end
242
258
  local roomType = room.Data.Type
243
259
  local roomShapeMap = customStage.roomTypeMap:get(roomType)
@@ -245,13 +261,13 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
245
261
  if roomType == RoomType.DEFAULT then
246
262
  logError((((("Failed to find any custom rooms for RoomType." .. RoomType[roomType]) .. " (") .. tostring(roomType)) .. ") for custom stage: ") .. customStage.name)
247
263
  end
248
- goto __continue27
264
+ goto __continue31
249
265
  end
250
266
  local roomShape = room.Data.Shape
251
267
  local roomDoorSlotFlagMap = roomShapeMap:get(roomShape)
252
268
  if roomDoorSlotFlagMap == nil then
253
269
  logError((((((((("Failed to find any custom rooms for RoomType." .. RoomType[roomType]) .. " (") .. tostring(roomType)) .. ") + RoomShape.") .. RoomShape[roomShape]) .. " (") .. tostring(roomShape)) .. ") for custom stage: ") .. customStage.name)
254
- goto __continue27
270
+ goto __continue31
255
271
  end
256
272
  local doorSlotFlags = room.Data.Doors
257
273
  local roomsMetadata = roomDoorSlotFlagMap:get(doorSlotFlags)
@@ -261,13 +277,13 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
261
277
  roomsMetadata = roomDoorSlotFlagMap:get(allDoorSlotFlags)
262
278
  if roomsMetadata == nil then
263
279
  logError((((((((("Failed to find any custom rooms for RoomType." .. RoomType[roomType]) .. " (") .. tostring(roomType)) .. ") + RoomShape.") .. RoomShape[roomShape]) .. " (") .. tostring(roomShape)) .. ") + all doors enabled for custom stage: ") .. customStage.name)
264
- goto __continue27
280
+ goto __continue31
265
281
  end
266
282
  end
267
283
  local randomRoom
268
284
  if roomType == RoomType.BOSS then
269
285
  if customStage.bossPool == nil then
270
- goto __continue27
286
+ goto __continue31
271
287
  end
272
288
  randomRoom = getRandomBossRoomFromPool(
273
289
  nil,
@@ -290,13 +306,13 @@ function CustomStages.prototype.setStageRoomsData(self, customStage, rng, verbos
290
306
  )
291
307
  if newRoomData == nil then
292
308
  logError((("Failed to get the room data for room variant " .. tostring(randomRoom.variant)) .. " for custom stage: ") .. customStage.name)
293
- goto __continue27
309
+ goto __continue31
294
310
  end
295
311
  self.customStageCachedRoomData:set(randomRoom.variant, newRoomData)
296
312
  end
297
313
  room.Data = newRoomData
298
314
  end
299
- ::__continue27::
315
+ ::__continue31::
300
316
  end
301
317
  end
302
318
  function CustomStages.prototype.setCustomStage(self, name, firstFloor, streakText, verbose)
@@ -349,11 +365,11 @@ function CustomStages.prototype.setCustomStage(self, name, firstFloor, streakTex
349
365
  end
350
366
  end
351
367
  local music = (customStageMusic == nil or customStageMusic == -1) and getMusicForStage(nil, baseStage, baseStageType) or customStageMusic
352
- Isaac.DebugString("GETTING HERE - music: " .. tostring(music))
353
368
  self.runInNFrames:runInNRenderFrames(
354
369
  function()
355
370
  musicManager:Enable()
356
- musicManager:Crossfade(music)
371
+ musicManager:Play(music)
372
+ musicManager:UpdateVolume()
357
373
  end,
358
374
  MUSIC_DELAY_RENDER_FRAMES
359
375
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "30.4.4-dev.0",
3
+ "version": "30.4.5",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -26,6 +26,7 @@ import { removeUrnRewards } from "../../../functions/rockAlt";
26
26
  import {
27
27
  getRoomDataForTypeVariant,
28
28
  getRoomsInsideGrid,
29
+ inRoomType,
29
30
  } from "../../../functions/rooms";
30
31
  import { getMusicForStage } from "../../../functions/sound";
31
32
  import { setStage } from "../../../functions/stage";
@@ -203,6 +204,17 @@ export class CustomStages extends Feature {
203
204
 
204
205
  streakTextPostRender();
205
206
  versusScreenPostRender(this.pause, this.disableAllSound);
207
+
208
+ // Fix the bug where the music will stop after loading a new room. (This does not work if placed
209
+ // in the `POST_NEW_ROOM_REORDERED` callback or the `POST_UPDATE` callback.)
210
+ if (customStage.music !== undefined) {
211
+ const currentMusic = musicManager.GetCurrentMusicID();
212
+ const music = Isaac.GetMusicIdByName(customStage.music);
213
+ if (currentMusic === music) {
214
+ musicManager.Resume();
215
+ musicManager.UpdateVolume();
216
+ }
217
+ }
206
218
  };
207
219
 
208
220
  // ModCallback.POST_CURSE_EVAL (12)
@@ -293,6 +305,16 @@ export class CustomStages extends Feature {
293
305
  this.pause,
294
306
  this.runInNFrames,
295
307
  );
308
+
309
+ // Fix the bug where music from special rooms (like the "Boss Over" music) will persist for the
310
+ // rest of the floor.
311
+ if (customStage.music !== undefined && inRoomType(RoomType.DEFAULT)) {
312
+ const music = Isaac.GetMusicIdByName(customStage.music);
313
+ const currentMusic = musicManager.GetCurrentMusicID();
314
+ if (currentMusic !== music) {
315
+ musicManager.Fadein(music);
316
+ }
317
+ }
296
318
  };
297
319
 
298
320
  /** Pick a custom room for each vanilla room. */
@@ -500,13 +522,10 @@ export class CustomStages extends Feature {
500
522
  ? getMusicForStage(baseStage, baseStageType)
501
523
  : customStageMusic;
502
524
 
503
- Isaac.DebugString(`GETTING HERE - music: ${music}`);
504
-
505
525
  this.runInNFrames.runInNRenderFrames(() => {
506
- // By default, the `MusicManager.Play` method will play the music at max volume (1.0), which
507
- // is around twice as loud as the vanilla music plays.
508
526
  musicManager.Enable();
509
- musicManager.Crossfade(music);
527
+ musicManager.Play(music);
528
+ musicManager.UpdateVolume();
510
529
  }, MUSIC_DELAY_RENDER_FRAMES);
511
530
 
512
531
  // We must reload the current room in order for the `Level.SetStage` method to take effect.