isaacscript-common 20.14.3 → 20.14.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 20.14.3
3
+ isaacscript-common 20.14.5
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -25,15 +25,7 @@ information about using TypeScript, see the website: https://isaacscript.github.
25
25
 
26
26
  --]]
27
27
 
28
- ---@diagnostic disable: assign-type-mismatch
29
- ---@diagnostic disable: deprecated
30
- ---@diagnostic disable: lowercase-global
31
- ---@diagnostic disable: need-check-nil
32
- ---@diagnostic disable: redefined-local
33
- ---@diagnostic disable: redundant-parameter
34
- ---@diagnostic disable: unused-function
35
- ---@diagnostic disable: unused-local
36
- ---@diagnostic disable: unused-vararg
28
+ ---@diagnostic disable
37
29
 
38
30
 
39
31
  local ____modules = {}
@@ -42265,6 +42257,7 @@ function getRoomTypeMap(self, customStageLua)
42265
42257
  end
42266
42258
  return roomTypeMap
42267
42259
  end
42260
+ local MUSIC_DELAY_RENDER_FRAMES = 70
42268
42261
  ____exports.CustomStages = __TS__Class()
42269
42262
  local CustomStages = ____exports.CustomStages
42270
42263
  CustomStages.name = "CustomStages"
@@ -42493,6 +42486,7 @@ function CustomStages.prototype.setCustomStage(self, name, firstFloor, streakTex
42493
42486
  local baseStageType = customStage.baseStageType == nil and DEFAULT_BASE_STAGE_TYPE or customStage.baseStageType
42494
42487
  local reseed = asNumber(nil, stage) >= baseStage
42495
42488
  setStage(nil, baseStage, baseStageType, reseed)
42489
+ musicManager:Disable()
42496
42490
  self:setStageRoomsData(customStage, rng, verbose)
42497
42491
  local targetStage = CUSTOM_FLOOR_STAGE
42498
42492
  local targetStageType = CUSTOM_FLOOR_STAGE_TYPE
@@ -42504,9 +42498,13 @@ function CustomStages.prototype.setCustomStage(self, name, firstFloor, streakTex
42504
42498
  end)
42505
42499
  end
42506
42500
  local music = customStage.music == nil and getMusicForStage(nil, baseStage, baseStageType) or Isaac.GetMusicIdByName(customStage.music)
42507
- self.runInNFrames:runNextGameFrame(function()
42508
- musicManager:Play(music, 0.5)
42509
- end)
42501
+ self.runInNFrames:runInNRenderFrames(
42502
+ function()
42503
+ musicManager:Enable()
42504
+ musicManager:Crossfade(music)
42505
+ end,
42506
+ MUSIC_DELAY_RENDER_FRAMES
42507
+ )
42510
42508
  end
42511
42509
  function CustomStages.prototype.disableCustomStage(self)
42512
42510
  self.v.run.currentCustomStage = nil
@@ -1 +1 @@
1
- {"version":3,"file":"CustomStages.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/CustomStages.ts"],"names":[],"mappings":"AAyCA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAoChD,qBAAa,YAAa,SAAQ,OAAO;IA8BvC,oCAAoC;IACpC,OAAO,CAAC,eAAe,CAAkC;IAEzD,+BAA+B;IAC/B,OAAO,CAAC,yBAAyB,CAAwC;IAEzE,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,sBAAsB,CAAyB;IACvD,OAAO,CAAC,KAAK,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,CAQhB;IAGF,OAAO,CAAC,aAAa,CAcnB;IAGF,OAAO,CAAC,eAAe,CAUrB;IAIF,OAAO,CAAC,2BAA2B,CAejC;IAGF,OAAO,CAAC,kBAAkB,CAqBxB;IAGF,OAAO,CAAC,oBAAoB,CAe1B;IAEF,gDAAgD;IAChD,OAAO,CAAC,iBAAiB;IA+FzB;;;;;;;;;;;;;;;;OAgBG;IAEI,cAAc,CACnB,IAAI,EAAE,MAAM,EACZ,UAAU,UAAO,EACjB,UAAU,UAAO,EACjB,OAAO,UAAQ,GACd,IAAI;IAiFP;;;;;OAKG;IAEI,kBAAkB,IAAI,IAAI;CAGlC"}
1
+ {"version":3,"file":"CustomStages.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/CustomStages.ts"],"names":[],"mappings":"AAyCA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AA0ChD,qBAAa,YAAa,SAAQ,OAAO;IA8BvC,oCAAoC;IACpC,OAAO,CAAC,eAAe,CAAkC;IAEzD,+BAA+B;IAC/B,OAAO,CAAC,yBAAyB,CAAwC;IAEzE,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,sBAAsB,CAAyB;IACvD,OAAO,CAAC,KAAK,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,CAQhB;IAGF,OAAO,CAAC,aAAa,CAcnB;IAGF,OAAO,CAAC,eAAe,CAUrB;IAIF,OAAO,CAAC,2BAA2B,CAejC;IAGF,OAAO,CAAC,kBAAkB,CAqBxB;IAGF,OAAO,CAAC,oBAAoB,CAe1B;IAEF,gDAAgD;IAChD,OAAO,CAAC,iBAAiB;IA+FzB;;;;;;;;;;;;;;;;OAgBG;IAEI,cAAc,CACnB,IAAI,EAAE,MAAM,EACZ,UAAU,UAAO,EACjB,UAAU,UAAO,EACjB,OAAO,UAAQ,GACd,IAAI;IAuFP;;;;;OAKG;IAEI,kBAAkB,IAAI,IAAI;CAGlC"}
@@ -102,6 +102,9 @@ function getRoomTypeMap(self, customStageLua)
102
102
  end
103
103
  return roomTypeMap
104
104
  end
105
+ --- 60 does not work correctly (the music kicking in from stage -1 will mute it), so we use 70 to be
106
+ -- safe.
107
+ local MUSIC_DELAY_RENDER_FRAMES = 70
105
108
  ____exports.CustomStages = __TS__Class()
106
109
  local CustomStages = ____exports.CustomStages
107
110
  CustomStages.name = "CustomStages"
@@ -330,6 +333,7 @@ function CustomStages.prototype.setCustomStage(self, name, firstFloor, streakTex
330
333
  local baseStageType = customStage.baseStageType == nil and DEFAULT_BASE_STAGE_TYPE or customStage.baseStageType
331
334
  local reseed = asNumber(nil, stage) >= baseStage
332
335
  setStage(nil, baseStage, baseStageType, reseed)
336
+ musicManager:Disable()
333
337
  self:setStageRoomsData(customStage, rng, verbose)
334
338
  local targetStage = CUSTOM_FLOOR_STAGE
335
339
  local targetStageType = CUSTOM_FLOOR_STAGE_TYPE
@@ -341,9 +345,13 @@ function CustomStages.prototype.setCustomStage(self, name, firstFloor, streakTex
341
345
  end)
342
346
  end
343
347
  local music = customStage.music == nil and getMusicForStage(nil, baseStage, baseStageType) or Isaac.GetMusicIdByName(customStage.music)
344
- self.runInNFrames:runNextGameFrame(function()
345
- musicManager:Play(music, 0.5)
346
- end)
348
+ self.runInNFrames:runInNRenderFrames(
349
+ function()
350
+ musicManager:Enable()
351
+ musicManager:Crossfade(music)
352
+ end,
353
+ MUSIC_DELAY_RENDER_FRAMES
354
+ )
347
355
  end
348
356
  function CustomStages.prototype.disableCustomStage(self)
349
357
  self.v.run.currentCustomStage = nil
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "20.14.3",
3
+ "version": "20.14.5",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -22,6 +22,6 @@
22
22
  "main": "dist/src/index",
23
23
  "types": "dist/src/index.d.ts",
24
24
  "dependencies": {
25
- "isaac-typescript-definitions": "^11.0.2"
25
+ "isaac-typescript-definitions": "^11.0.3"
26
26
  }
27
27
  }
@@ -75,6 +75,12 @@ import { DisableAllSound } from "./DisableAllSound";
75
75
  import { Pause } from "./Pause";
76
76
  import { RunInNFrames } from "./RunInNFrames";
77
77
 
78
+ /**
79
+ * 60 does not work correctly (the music kicking in from stage -1 will mute it), so we use 70 to be
80
+ * safe.
81
+ */
82
+ const MUSIC_DELAY_RENDER_FRAMES = 70;
83
+
78
84
  export class CustomStages extends Feature {
79
85
  /** @internal */
80
86
  public override v = {
@@ -476,6 +482,10 @@ export class CustomStages extends Feature {
476
482
 
477
483
  setStage(baseStage, baseStageType, reseed);
478
484
 
485
+ // As soon as we warp to the base stage, the base stage music will begin to play. Thus, we
486
+ // temporarily mute all music.
487
+ musicManager.Disable();
488
+
479
489
  this.setStageRoomsData(customStage, rng, verbose);
480
490
 
481
491
  // Set the stage to an invalid value, which will prevent the walls and floors from loading.
@@ -503,11 +513,13 @@ export class CustomStages extends Feature {
503
513
  customStage.music === undefined
504
514
  ? getMusicForStage(baseStage, baseStageType)
505
515
  : Isaac.GetMusicIdByName(customStage.music);
506
- this.runInNFrames.runNextGameFrame(() => {
516
+
517
+ this.runInNFrames.runInNRenderFrames(() => {
507
518
  // By default, the `MusicManager.Play` method will play the music at max volume (1.0), which
508
519
  // is around twice as loud as the vanilla music plays.
509
- musicManager.Play(music, 0.5);
510
- });
520
+ musicManager.Enable();
521
+ musicManager.Crossfade(music);
522
+ }, MUSIC_DELAY_RENDER_FRAMES);
511
523
 
512
524
  // We must reload the current room in order for the `Level.SetStage` method to take effect.
513
525
  // Furthermore, we need to cancel the queued warp to the `GridRoom.DEBUG` room. We can