isaacscript-common 20.11.3 → 20.11.4

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/index.d.ts CHANGED
@@ -2494,6 +2494,7 @@ declare class CustomTrapdoors extends Feature {
2494
2494
  private postPEffectUpdateReordered;
2495
2495
  private checkJumpComplete;
2496
2496
  private shouldTrapdoorSpawnOpen;
2497
+ private logStateChanged;
2497
2498
  /**
2498
2499
  * Helper function to specify where your custom trapdoor should take the player. Call this once at
2499
2500
  * the beginning of your mod for each kind of custom trapdoor that you want to have. The provided
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 20.11.3
3
+ isaacscript-common 20.11.4
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -39206,6 +39206,8 @@ local ____TrapdoorAnimation = require("src.enums.private.TrapdoorAnimation")
39206
39206
  local TrapdoorAnimation = ____TrapdoorAnimation.TrapdoorAnimation
39207
39207
  local ____easing = require("src.functions.easing")
39208
39208
  local easeOutSine = ____easing.easeOutSine
39209
+ local ____log = require("src.functions.log")
39210
+ local log = ____log.log
39209
39211
  local ____playerCenter = require("src.functions.playerCenter")
39210
39212
  local movePlayersToCenter = ____playerCenter.movePlayersToCenter
39211
39213
  local ____playerIndex = require("src.functions.playerIndex")
@@ -39272,12 +39274,13 @@ end
39272
39274
  function goToVanillaStage(self, destinationStage, destinationStageType)
39273
39275
  setStage(nil, destinationStage, destinationStageType)
39274
39276
  end
39277
+ local DEBUG = false
39275
39278
  local TRAPDOOR_OPEN_DISTANCE = 60
39276
39279
  local TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS = TRAPDOOR_OPEN_DISTANCE * 2.5
39277
39280
  local TRAPDOOR_BOSS_REACTION_FRAMES = 30
39278
39281
  local TRAPDOOR_TOUCH_DISTANCE = 16.5
39279
39282
  ANIMATIONS_THAT_PREVENT_STAGE_TRAVEL = __TS__New(Set, {"Death", "Happy", "Sad", "Jump"})
39280
- local PIXELATION_TO_BLACK_FRAMES = 52
39283
+ local PIXELATION_TO_BLACK_FRAMES = 60
39281
39284
  local OTHER_PLAYER_TRAPDOOR_JUMP_DELAY_GAME_FRAMES = 6
39282
39285
  local OTHER_PLAYER_TRAPDOOR_JUMP_DURATION_GAME_FRAMES = 5
39283
39286
  ____exports.CustomTrapdoors = __TS__Class()
@@ -39346,6 +39349,7 @@ function CustomTrapdoors.prototype.checkAllPlayersJumpComplete(self)
39346
39349
  local roomGridIndex = getRoomGridIndex(nil)
39347
39350
  self.v.run.state = StageTravelState.PIXELATION_TO_BLACK
39348
39351
  self.v.run.stateRenderFrame = renderFrameCount
39352
+ self:logStateChanged()
39349
39353
  teleport(nil, roomGridIndex, Direction.NO_DIRECTION, RoomTransitionAnim.PIXELATION)
39350
39354
  end
39351
39355
  function CustomTrapdoors.prototype.checkPixelationToBlackComplete(self)
@@ -39359,6 +39363,7 @@ function CustomTrapdoors.prototype.checkPixelationToBlackComplete(self)
39359
39363
  return
39360
39364
  end
39361
39365
  self.v.run.state = StageTravelState.WAITING_FOR_FIRST_PIXELATION_TO_END
39366
+ self:logStateChanged()
39362
39367
  hud:SetVisible(false)
39363
39368
  self.runInNFrames:runNextGameFrame(function()
39364
39369
  local level = game:GetLevel()
@@ -39404,9 +39409,11 @@ function CustomTrapdoors.prototype.checkSecondPixelationHalfWay(self)
39404
39409
  return
39405
39410
  end
39406
39411
  self.v.run.state = StageTravelState.PIXELATION_TO_ROOM
39412
+ self:logStateChanged()
39407
39413
  hud:SetVisible(true)
39408
39414
  self.runNextRoom:runNextRoom(function()
39409
39415
  self.v.run.state = StageTravelState.PLAYERS_LAYING_DOWN
39416
+ self:logStateChanged()
39410
39417
  movePlayersToCenter(nil)
39411
39418
  for ____, player in ipairs(getAllPlayers(nil)) do
39412
39419
  player:AnimateAppear()
@@ -39423,6 +39430,7 @@ function CustomTrapdoors.prototype.checkAllPlayersLayingDownComplete(self)
39423
39430
  return
39424
39431
  end
39425
39432
  self.v.run.state = StageTravelState.NONE
39433
+ self:logStateChanged()
39426
39434
  local tstlClassName = getTSTLClassName(nil, self)
39427
39435
  if tstlClassName == nil then
39428
39436
  error("Failed to find get the class name for the custom trapdoor feature.")
@@ -39488,6 +39496,7 @@ end
39488
39496
  function CustomTrapdoors.prototype.playerTouchedCustomTrapdoor(self, gridEntity, trapdoorDescription, player)
39489
39497
  self.v.run.state = StageTravelState.PLAYERS_JUMPING_DOWN
39490
39498
  self.v.run.customTrapdoorActivated = trapdoorDescription
39499
+ self:logStateChanged()
39491
39500
  local tstlClassName = getTSTLClassName(nil, self)
39492
39501
  if tstlClassName == nil then
39493
39502
  error("Failed to find get the class name for the custom trapdoor feature.")
@@ -39580,6 +39589,14 @@ function CustomTrapdoors.prototype.shouldTrapdoorSpawnOpen(self, gridEntity, fir
39580
39589
  end
39581
39590
  return self:shouldTrapdoorOpen(gridEntity, firstSpawn)
39582
39591
  end
39592
+ function CustomTrapdoors.prototype.logStateChanged(self)
39593
+ if DEBUG then
39594
+ log(
39595
+ nil,
39596
+ ((("Custom trapdoors state changed: " .. StageTravelState[self.v.run.state]) .. " (") .. tostring(self.v.run.state)) .. ")"
39597
+ )
39598
+ end
39599
+ end
39583
39600
  function CustomTrapdoors.prototype.registerCustomTrapdoorDestination(self, destinationName, destinationFunc)
39584
39601
  if self.destinationFuncMap:has(destinationName) then
39585
39602
  error(("Failed to register a custom trapdoor type of " .. destinationName) .. " since this custom trapdoor type has already been registered.")
@@ -36,6 +36,7 @@ export declare class CustomTrapdoors extends Feature {
36
36
  private postPEffectUpdateReordered;
37
37
  private checkJumpComplete;
38
38
  private shouldTrapdoorSpawnOpen;
39
+ private logStateChanged;
39
40
  /**
40
41
  * Helper function to specify where your custom trapdoor should take the player. Call this once at
41
42
  * the beginning of your mod for each kind of custom trapdoor that you want to have. The provided
@@ -1 +1 @@
1
- {"version":3,"file":"CustomTrapdoors.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/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,2BAA2B;IAqCnC,OAAO,CAAC,gBAAgB;IAoBxB,OAAO,CAAC,8BAA8B;IAmDtC,OAAO,CAAC,0BAA0B,CAEhC;IAEF,OAAO,CAAC,iBAAiB;IAezB,OAAO,CAAC,uBAAuB;IA4B/B,OAAO,CAAC,eAAe;IAUvB;;;;;;;;;;;;;;;;;;OAkBG;IAEI,iCAAiC,CACtC,eAAe,EAAE,MAAM,EACvB,eAAe,EAAE,CACf,gBAAgB,EAAE,UAAU,EAC5B,oBAAoB,EAAE,SAAS,KAC5B,IAAI,GACR,IAAI;IAUP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IAEI,mBAAmB,CACxB,mBAAmB,EAAE,GAAG,GAAG,MAAM,EACjC,eAAe,CAAC,EAAE,MAAM,EACxB,gBAAgB,CAAC,EAAE,UAAU,EAC7B,oBAAoB,CAAC,EAAE,SAAS,EAChC,QAAQ,SAAmC,EAC3C,SAAS,CAAC,EAAE,OAAO,GAClB,UAAU;CA0Dd"}
@@ -40,6 +40,8 @@ local ____TrapdoorAnimation = require("src.enums.private.TrapdoorAnimation")
40
40
  local TrapdoorAnimation = ____TrapdoorAnimation.TrapdoorAnimation
41
41
  local ____easing = require("src.functions.easing")
42
42
  local easeOutSine = ____easing.easeOutSine
43
+ local ____log = require("src.functions.log")
44
+ local log = ____log.log
43
45
  local ____playerCenter = require("src.functions.playerCenter")
44
46
  local movePlayersToCenter = ____playerCenter.movePlayersToCenter
45
47
  local ____playerIndex = require("src.functions.playerIndex")
@@ -106,13 +108,14 @@ end
106
108
  function goToVanillaStage(self, destinationStage, destinationStageType)
107
109
  setStage(nil, destinationStage, destinationStageType)
108
110
  end
111
+ local DEBUG = false
109
112
  --- This also applies to crawl spaces. The value was determined through trial and error.
110
113
  local TRAPDOOR_OPEN_DISTANCE = 60
111
114
  local TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS = TRAPDOOR_OPEN_DISTANCE * 2.5
112
115
  local TRAPDOOR_BOSS_REACTION_FRAMES = 30
113
116
  local TRAPDOOR_TOUCH_DISTANCE = 16.5
114
117
  ANIMATIONS_THAT_PREVENT_STAGE_TRAVEL = __TS__New(Set, {"Death", "Happy", "Sad", "Jump"})
115
- local PIXELATION_TO_BLACK_FRAMES = 52
118
+ local PIXELATION_TO_BLACK_FRAMES = 60
116
119
  local OTHER_PLAYER_TRAPDOOR_JUMP_DELAY_GAME_FRAMES = 6
117
120
  local OTHER_PLAYER_TRAPDOOR_JUMP_DURATION_GAME_FRAMES = 5
118
121
  ____exports.CustomTrapdoors = __TS__Class()
@@ -181,6 +184,7 @@ function CustomTrapdoors.prototype.checkAllPlayersJumpComplete(self)
181
184
  local roomGridIndex = getRoomGridIndex(nil)
182
185
  self.v.run.state = StageTravelState.PIXELATION_TO_BLACK
183
186
  self.v.run.stateRenderFrame = renderFrameCount
187
+ self:logStateChanged()
184
188
  teleport(nil, roomGridIndex, Direction.NO_DIRECTION, RoomTransitionAnim.PIXELATION)
185
189
  end
186
190
  function CustomTrapdoors.prototype.checkPixelationToBlackComplete(self)
@@ -194,6 +198,7 @@ function CustomTrapdoors.prototype.checkPixelationToBlackComplete(self)
194
198
  return
195
199
  end
196
200
  self.v.run.state = StageTravelState.WAITING_FOR_FIRST_PIXELATION_TO_END
201
+ self:logStateChanged()
197
202
  hud:SetVisible(false)
198
203
  self.runInNFrames:runNextGameFrame(function()
199
204
  local level = game:GetLevel()
@@ -239,9 +244,11 @@ function CustomTrapdoors.prototype.checkSecondPixelationHalfWay(self)
239
244
  return
240
245
  end
241
246
  self.v.run.state = StageTravelState.PIXELATION_TO_ROOM
247
+ self:logStateChanged()
242
248
  hud:SetVisible(true)
243
249
  self.runNextRoom:runNextRoom(function()
244
250
  self.v.run.state = StageTravelState.PLAYERS_LAYING_DOWN
251
+ self:logStateChanged()
245
252
  movePlayersToCenter(nil)
246
253
  for ____, player in ipairs(getAllPlayers(nil)) do
247
254
  player:AnimateAppear()
@@ -258,6 +265,7 @@ function CustomTrapdoors.prototype.checkAllPlayersLayingDownComplete(self)
258
265
  return
259
266
  end
260
267
  self.v.run.state = StageTravelState.NONE
268
+ self:logStateChanged()
261
269
  local tstlClassName = getTSTLClassName(nil, self)
262
270
  if tstlClassName == nil then
263
271
  error("Failed to find get the class name for the custom trapdoor feature.")
@@ -323,6 +331,7 @@ end
323
331
  function CustomTrapdoors.prototype.playerTouchedCustomTrapdoor(self, gridEntity, trapdoorDescription, player)
324
332
  self.v.run.state = StageTravelState.PLAYERS_JUMPING_DOWN
325
333
  self.v.run.customTrapdoorActivated = trapdoorDescription
334
+ self:logStateChanged()
326
335
  local tstlClassName = getTSTLClassName(nil, self)
327
336
  if tstlClassName == nil then
328
337
  error("Failed to find get the class name for the custom trapdoor feature.")
@@ -415,6 +424,14 @@ function CustomTrapdoors.prototype.shouldTrapdoorSpawnOpen(self, gridEntity, fir
415
424
  end
416
425
  return self:shouldTrapdoorOpen(gridEntity, firstSpawn)
417
426
  end
427
+ function CustomTrapdoors.prototype.logStateChanged(self)
428
+ if DEBUG then
429
+ log(
430
+ nil,
431
+ ((("Custom trapdoors state changed: " .. StageTravelState[self.v.run.state]) .. " (") .. tostring(self.v.run.state)) .. ")"
432
+ )
433
+ end
434
+ end
418
435
  function CustomTrapdoors.prototype.registerCustomTrapdoorDestination(self, destinationName, destinationFunc)
419
436
  if self.destinationFuncMap:has(destinationName) then
420
437
  error(("Failed to register a custom trapdoor type of " .. destinationName) .. " since this custom trapdoor type has already been registered.")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "20.11.3",
3
+ "version": "20.11.4",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -21,6 +21,7 @@ import { GridEntityTypeCustom } from "../../../enums/private/GridEntityTypeCusto
21
21
  import { StageTravelState } from "../../../enums/private/StageTravelState";
22
22
  import { TrapdoorAnimation } from "../../../enums/private/TrapdoorAnimation";
23
23
  import { easeOutSine } from "../../../functions/easing";
24
+ import { log } from "../../../functions/log";
24
25
  import { movePlayersToCenter } from "../../../functions/playerCenter";
25
26
  import {
26
27
  getAllPlayers,
@@ -48,6 +49,8 @@ import { RunInNFrames } from "./RunInNFrames";
48
49
  import { RunNextRoom } from "./RunNextRoom";
49
50
  import { StageHistory } from "./StageHistory";
50
51
 
52
+ const DEBUG = false as boolean;
53
+
51
54
  /** This also applies to crawl spaces. The value was determined through trial and error. */
52
55
  const TRAPDOOR_OPEN_DISTANCE = 60;
53
56
 
@@ -63,7 +66,7 @@ const ANIMATIONS_THAT_PREVENT_STAGE_TRAVEL: ReadonlySet<string> = new Set([
63
66
  "Jump",
64
67
  ]);
65
68
 
66
- const PIXELATION_TO_BLACK_FRAMES = 52;
69
+ const PIXELATION_TO_BLACK_FRAMES = 60;
67
70
 
68
71
  const OTHER_PLAYER_TRAPDOOR_JUMP_DELAY_GAME_FRAMES = 6;
69
72
  const OTHER_PLAYER_TRAPDOOR_JUMP_DURATION_GAME_FRAMES = 5;
@@ -181,6 +184,7 @@ export class CustomTrapdoors extends Feature {
181
184
 
182
185
  this.v.run.state = StageTravelState.PIXELATION_TO_BLACK;
183
186
  this.v.run.stateRenderFrame = renderFrameCount;
187
+ this.logStateChanged();
184
188
 
185
189
  // In order to display the pixelation effect that should happen when we go to a new floor, we
186
190
  // need to start a room transition. We arbitrarily pick the current room for this purpose. (We
@@ -215,6 +219,7 @@ export class CustomTrapdoors extends Feature {
215
219
  }
216
220
 
217
221
  this.v.run.state = StageTravelState.WAITING_FOR_FIRST_PIXELATION_TO_END;
222
+ this.logStateChanged();
218
223
 
219
224
  // Now, we display a black sprite on top of the pixelation effect, to prevent showing the rest
220
225
  // of the animation.
@@ -304,11 +309,13 @@ export class CustomTrapdoors extends Feature {
304
309
  }
305
310
 
306
311
  this.v.run.state = StageTravelState.PIXELATION_TO_ROOM;
312
+ this.logStateChanged();
307
313
 
308
314
  hud.SetVisible(true);
309
315
 
310
316
  this.runNextRoom.runNextRoom(() => {
311
317
  this.v.run.state = StageTravelState.PLAYERS_LAYING_DOWN;
318
+ this.logStateChanged();
312
319
 
313
320
  // After the room transition, the players will be placed next to a door, but they should be in
314
321
  // the center of the room to emulate what happens on a vanilla stage.
@@ -334,6 +341,7 @@ export class CustomTrapdoors extends Feature {
334
341
  }
335
342
 
336
343
  this.v.run.state = StageTravelState.NONE;
344
+ this.logStateChanged();
337
345
 
338
346
  const tstlClassName = getTSTLClassName(this);
339
347
  if (tstlClassName === undefined) {
@@ -474,6 +482,7 @@ export class CustomTrapdoors extends Feature {
474
482
  ) {
475
483
  this.v.run.state = StageTravelState.PLAYERS_JUMPING_DOWN;
476
484
  this.v.run.customTrapdoorActivated = trapdoorDescription;
485
+ this.logStateChanged();
477
486
 
478
487
  const tstlClassName = getTSTLClassName(this);
479
488
  if (tstlClassName === undefined) {
@@ -621,6 +630,16 @@ export class CustomTrapdoors extends Feature {
621
630
  return this.shouldTrapdoorOpen(gridEntity, firstSpawn);
622
631
  }
623
632
 
633
+ private logStateChanged(): void {
634
+ if (DEBUG) {
635
+ log(
636
+ `Custom trapdoors state changed: ${
637
+ StageTravelState[this.v.run.state]
638
+ } (${this.v.run.state})`,
639
+ );
640
+ }
641
+ }
642
+
624
643
  /**
625
644
  * Helper function to specify where your custom trapdoor should take the player. Call this once at
626
645
  * the beginning of your mod for each kind of custom trapdoor that you want to have. The provided