isaacscript-common 20.3.2 → 20.4.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.
Files changed (58) hide show
  1. package/dist/index.d.ts +103 -50
  2. package/dist/isaacscript-common.lua +414 -389
  3. package/dist/src/classes/callbacks/PostSlotDestroyed.d.ts +0 -8
  4. package/dist/src/classes/callbacks/PostSlotDestroyed.d.ts.map +1 -1
  5. package/dist/src/classes/callbacks/PostSlotDestroyed.lua +3 -51
  6. package/dist/src/classes/features/callbackLogic/SlotDestroyedDetection.d.ts +36 -0
  7. package/dist/src/classes/features/callbackLogic/SlotDestroyedDetection.d.ts.map +1 -0
  8. package/dist/src/classes/features/callbackLogic/SlotDestroyedDetection.lua +91 -0
  9. package/dist/src/classes/features/other/ExtraConsoleCommands.d.ts.map +1 -1
  10. package/dist/src/classes/features/other/ExtraConsoleCommands.lua +2 -3
  11. package/dist/src/classes/features/other/RoomHistory.d.ts.map +1 -1
  12. package/dist/src/classes/features/other/RoomHistory.lua +6 -1
  13. package/dist/src/classes/features/other/extraConsoleCommands/commands.d.ts.map +1 -1
  14. package/dist/src/classes/features/other/extraConsoleCommands/commands.lua +69 -127
  15. package/dist/src/classes/features/other/extraConsoleCommands/subroutines.d.ts.map +1 -1
  16. package/dist/src/classes/features/other/extraConsoleCommands/subroutines.lua +11 -22
  17. package/dist/src/enums/ISCFeature.d.ts +44 -43
  18. package/dist/src/enums/ISCFeature.d.ts.map +1 -1
  19. package/dist/src/enums/ISCFeature.lua +45 -43
  20. package/dist/src/enums/SlotDestructionType.d.ts +13 -0
  21. package/dist/src/enums/SlotDestructionType.d.ts.map +1 -1
  22. package/dist/src/features.d.ts +46 -43
  23. package/dist/src/features.d.ts.map +1 -1
  24. package/dist/src/features.lua +3 -0
  25. package/dist/src/functions/deepCopyTests.d.ts.map +1 -1
  26. package/dist/src/functions/deepCopyTests.lua +1 -3
  27. package/dist/src/functions/logMisc.d.ts.map +1 -1
  28. package/dist/src/functions/logMisc.lua +1 -3
  29. package/dist/src/functions/mergeTests.d.ts.map +1 -1
  30. package/dist/src/functions/mergeTests.lua +2 -5
  31. package/dist/src/functions/slots.d.ts +4 -0
  32. package/dist/src/functions/slots.d.ts.map +1 -0
  33. package/dist/src/functions/slots.lua +27 -0
  34. package/dist/src/functions/utils.d.ts +3 -4
  35. package/dist/src/functions/utils.d.ts.map +1 -1
  36. package/dist/src/functions/utils.lua +8 -6
  37. package/dist/src/index.d.ts +1 -0
  38. package/dist/src/index.d.ts.map +1 -1
  39. package/dist/src/index.lua +8 -0
  40. package/dist/src/interfaces/RoomDescription.d.ts +1 -0
  41. package/dist/src/interfaces/RoomDescription.d.ts.map +1 -1
  42. package/package.json +1 -1
  43. package/src/classes/callbacks/PostSlotDestroyed.ts +2 -72
  44. package/src/classes/features/callbackLogic/SlotDestroyedDetection.ts +163 -0
  45. package/src/classes/features/other/ExtraConsoleCommands.ts +3 -6
  46. package/src/classes/features/other/RoomHistory.ts +6 -0
  47. package/src/classes/features/other/extraConsoleCommands/commands.ts +70 -78
  48. package/src/classes/features/other/extraConsoleCommands/subroutines.ts +11 -12
  49. package/src/enums/ISCFeature.ts +1 -0
  50. package/src/enums/SlotDestructionType.ts +14 -0
  51. package/src/features.ts +6 -0
  52. package/src/functions/deepCopyTests.ts +1 -2
  53. package/src/functions/logMisc.ts +1 -2
  54. package/src/functions/mergeTests.ts +2 -4
  55. package/src/functions/slots.ts +23 -0
  56. package/src/functions/utils.ts +7 -6
  57. package/src/index.ts +1 -0
  58. package/src/interfaces/RoomDescription.ts +1 -0
package/dist/index.d.ts CHANGED
@@ -3123,6 +3123,12 @@ export declare function deserializeRNG(rng: SerializedRNG): RNG;
3123
3123
  */
3124
3124
  export declare function deserializeVector(vector: SerializedVector): Vector;
3125
3125
 
3126
+ declare type DespawnedSlotTuple = [
3127
+ gameFrame: int,
3128
+ position: Vector,
3129
+ entityPtr: EntityPtr
3130
+ ];
3131
+
3126
3132
  /** For `EntityType.EFFECT` (1000), `EffectVariant.DICE_FLOOR` (76). */
3127
3133
  export declare const DICE_FLOOR_TRIGGER_SQUARE_SIZE = 75;
3128
3134
 
@@ -7204,49 +7210,50 @@ export declare enum ISCFeature {
7204
7210
  ITEM_PICKUP_DETECTION = 7,
7205
7211
  PLAYER_COLLECTIBLE_DETECTION = 8,
7206
7212
  PLAYER_REORDERED_CALLBACKS = 9,
7207
- SLOT_RENDER_DETECTION = 10,
7208
- SLOT_UPDATE_DETECTION = 11,
7209
- CHARACTER_HEALTH_CONVERSION = 12,
7210
- CHARACTER_STATS = 13,
7211
- COLLECTIBLE_ITEM_POOL_TYPE = 14,
7212
- CUSTOM_GRID_ENTITIES = 15,
7213
- CUSTOM_ITEM_POOLS = 16,
7214
- CUSTOM_HOTKEYS = 17,
7215
- CUSTOM_PICKUPS = 18,
7216
- CUSTOM_STAGES = 19,
7217
- CUSTOM_TRAPDOORS = 20,
7218
- DEBUG_DISPLAY = 21,
7219
- DEPLOY_JSON_ROOM = 22,
7220
- DISABLE_ALL_SOUND = 23,
7221
- DISABLE_INPUTS = 24,
7222
- FADE_IN_REMOVER = 25,
7223
- FAST_RESET = 26,
7224
- FLYING_DETECTION = 27,
7225
- FORGOTTEN_SWITCH = 28,
7226
- EXTRA_CONSOLE_COMMANDS = 29,
7227
- ITEM_POOL_DETECTION = 30,
7228
- MODDED_ELEMENT_DETECTION = 31,
7229
- MODDED_ELEMENT_SETS = 32,
7230
- NO_SIREN_STEAL = 33,
7231
- PAUSE = 34,
7232
- PERSISTENT_ENTITIES = 35,
7233
- PICKUP_INDEX_CREATION = 36,
7234
- PLAYER_INVENTORY = 37,
7235
- PONY_DETECTION = 38,
7236
- PRESS_INPUT = 39,
7237
- PREVENT_CHILD_ENTITIES = 40,
7238
- PREVENT_COLLECTIBLE_ROTATION = 41,
7239
- PREVENT_GRID_ENTITY_RESPAWN = 42,
7240
- ROOM_CLEAR_FRAME = 43,
7241
- ROOM_HISTORY = 44,
7242
- RUN_IN_N_FRAMES = 45,
7243
- RUN_NEXT_ROOM = 46,
7244
- SAVE_DATA_MANAGER = 47,
7245
- SPAWN_ALT_ROCK_REWARDS = 48,
7246
- SPAWN_COLLECTIBLE = 49,
7247
- STAGE_HISTORY = 50,
7248
- START_AMBUSH = 51,
7249
- TAINTED_LAZARUS_PLAYERS = 52
7213
+ SLOT_DESTROYED_DETECTION = 10,
7214
+ SLOT_RENDER_DETECTION = 11,
7215
+ SLOT_UPDATE_DETECTION = 12,
7216
+ CHARACTER_HEALTH_CONVERSION = 13,
7217
+ CHARACTER_STATS = 14,
7218
+ COLLECTIBLE_ITEM_POOL_TYPE = 15,
7219
+ CUSTOM_GRID_ENTITIES = 16,
7220
+ CUSTOM_ITEM_POOLS = 17,
7221
+ CUSTOM_HOTKEYS = 18,
7222
+ CUSTOM_PICKUPS = 19,
7223
+ CUSTOM_STAGES = 20,
7224
+ CUSTOM_TRAPDOORS = 21,
7225
+ DEBUG_DISPLAY = 22,
7226
+ DEPLOY_JSON_ROOM = 23,
7227
+ DISABLE_ALL_SOUND = 24,
7228
+ DISABLE_INPUTS = 25,
7229
+ FADE_IN_REMOVER = 26,
7230
+ FAST_RESET = 27,
7231
+ FLYING_DETECTION = 28,
7232
+ FORGOTTEN_SWITCH = 29,
7233
+ EXTRA_CONSOLE_COMMANDS = 30,
7234
+ ITEM_POOL_DETECTION = 31,
7235
+ MODDED_ELEMENT_DETECTION = 32,
7236
+ MODDED_ELEMENT_SETS = 33,
7237
+ NO_SIREN_STEAL = 34,
7238
+ PAUSE = 35,
7239
+ PERSISTENT_ENTITIES = 36,
7240
+ PICKUP_INDEX_CREATION = 37,
7241
+ PLAYER_INVENTORY = 38,
7242
+ PONY_DETECTION = 39,
7243
+ PRESS_INPUT = 40,
7244
+ PREVENT_CHILD_ENTITIES = 41,
7245
+ PREVENT_COLLECTIBLE_ROTATION = 42,
7246
+ PREVENT_GRID_ENTITY_RESPAWN = 43,
7247
+ ROOM_CLEAR_FRAME = 44,
7248
+ ROOM_HISTORY = 45,
7249
+ RUN_IN_N_FRAMES = 46,
7250
+ RUN_NEXT_ROOM = 47,
7251
+ SAVE_DATA_MANAGER = 48,
7252
+ SPAWN_ALT_ROCK_REWARDS = 49,
7253
+ SPAWN_COLLECTIBLE = 50,
7254
+ STAGE_HISTORY = 51,
7255
+ START_AMBUSH = 52,
7256
+ TAINTED_LAZARUS_PLAYERS = 53
7250
7257
  }
7251
7258
 
7252
7259
  /**
@@ -7266,6 +7273,7 @@ declare interface ISCFeatureToClass {
7266
7273
  [ISCFeature.ITEM_PICKUP_DETECTION]: ItemPickupDetection;
7267
7274
  [ISCFeature.PLAYER_COLLECTIBLE_DETECTION]: PlayerCollectibleDetection;
7268
7275
  [ISCFeature.PLAYER_REORDERED_CALLBACKS]: PlayerReorderedCallbacks;
7276
+ [ISCFeature.SLOT_DESTROYED_DETECTION]: SlotDestroyedDetection;
7269
7277
  [ISCFeature.SLOT_RENDER_DETECTION]: SlotRenderDetection;
7270
7278
  [ISCFeature.SLOT_UPDATE_DETECTION]: SlotUpdateDetection;
7271
7279
  [ISCFeature.CHARACTER_HEALTH_CONVERSION]: CharacterHealthConversion;
@@ -7883,6 +7891,9 @@ export declare function isSingleUseCollectible(collectibleType: CollectibleType)
7883
7891
  /** For `EntityType.SLOT` (6). */
7884
7892
  export declare function isSlot(entity: Entity): entity is EntitySlot;
7885
7893
 
7894
+ /** Returns true for the specific variants of `EntityType.SLOT` that are machines. */
7895
+ export declare function isSlotMachine(entity: Entity): boolean;
7896
+
7886
7897
  /** Returns true for cards that have `CardType.SPECIAL`. */
7887
7898
  export declare function isSpecialCard(cardType: CardType): boolean;
7888
7899
 
@@ -8374,6 +8385,12 @@ export declare function logAllEntities(includeBackgroundEffects: boolean, entity
8374
8385
  */
8375
8386
  export declare function logAllGridEntities(includeWalls?: boolean, gridEntityTypeFilter?: GridEntityType): void;
8376
8387
 
8388
+ /**
8389
+ * Helper function to log a message to the "log.txt" file and to print it to the screen at the same
8390
+ * time.
8391
+ */
8392
+ export declare function logAndPrint(msg: string): void;
8393
+
8377
8394
  /** Helper function to enumerate all of the values in an array. */
8378
8395
  export declare function logArray<T>(array: T[] | readonly T[]): void;
8379
8396
 
@@ -12257,6 +12274,11 @@ declare class PostSlotAnimationChanged extends CustomCallback<ModCallbackCustom.
12257
12274
  protected shouldFire: typeof shouldFireSlot;
12258
12275
  }
12259
12276
 
12277
+ declare class PostSlotDestroyed extends CustomCallback<ModCallbackCustom.POST_SLOT_DESTROYED> {
12278
+ constructor();
12279
+ protected shouldFire: typeof shouldFireSlot;
12280
+ }
12281
+
12260
12282
  declare class PostSlotInit extends CustomCallback<ModCallbackCustom.POST_SLOT_INIT> {
12261
12283
  constructor();
12262
12284
  protected shouldFire: typeof shouldFireSlot;
@@ -12364,13 +12386,6 @@ declare class PreventGridEntityRespawn extends Feature {
12364
12386
  preventGridEntityRespawn(): void;
12365
12387
  }
12366
12388
 
12367
- /**
12368
- * Helper function to print something to the in-game console. Use this instead of invoking the
12369
- * `Isaac.ConsoleOutput` method directly because it will automatically insert a newline at the end
12370
- * of the message (which `Isaac.ConsoleOutput` does not do by default).
12371
- */
12372
- export declare function printConsole(msg: string): void;
12373
-
12374
12389
  /** Helper function to print whether something was enabled or disabled to the in-game console. */
12375
12390
  export declare function printEnabled(enabled: boolean, description: string): void;
12376
12391
 
@@ -13073,6 +13088,7 @@ declare class RoomClearFrame extends Feature {
13073
13088
 
13074
13089
  /** This is used by the room history feature of the standard library. */
13075
13090
  export declare interface RoomDescription {
13091
+ startSeedString: string;
13076
13092
  stage: LevelStage;
13077
13093
  stageType: StageType;
13078
13094
  stageID: StageID;
@@ -14101,9 +14117,46 @@ export declare function shuffleArrayInPlace<T>(array: T[], seedOrRNG?: Seed | RN
14101
14117
  */
14102
14118
  export declare function sign(n: number): int;
14103
14119
 
14120
+ declare class SlotDestroyedDetection extends Feature {
14121
+ v: {
14122
+ room: {
14123
+ destroyedSlotSet: Set<PtrHash>;
14124
+ despawnedSlots: DespawnedSlotTuple[];
14125
+ };
14126
+ };
14127
+ private postSlotDestroyed;
14128
+ private roomHistory;
14129
+ constructor(postSlotDestroyed: PostSlotDestroyed, roomHistory: RoomHistory);
14130
+ private postPickupInitCollectible;
14131
+ private postEntityRemoveSlot;
14132
+ private postEntityRemoveSlotMachine;
14133
+ private postEntityRemoveBeggar;
14134
+ private postSlotUpdate;
14135
+ /**
14136
+ * Slots normally have an entity collision class of `EntityCollisionClass.ALL` (4) and a grid
14137
+ * collision class of `EntityGridCollisionClass.NONE` (0). When they are destroyed with a bomb,
14138
+ * the entity collision class stays the same, but the grid collision class switches to
14139
+ * `EntityGridCollisionClass.GROUND` (5).
14140
+ */
14141
+ private checkDestroyedFromCollisionClass;
14142
+ }
14143
+
14104
14144
  /** This is used in the `POST_SLOT_DESTROYED` custom callback. */
14105
14145
  export declare enum SlotDestructionType {
14146
+ /**
14147
+ * When a machine or a beggar is blown up by a bomb or is otherwise removed without spawning a
14148
+ * collectible.
14149
+ *
14150
+ * Note that the destruction type for a Crane Game will be `SlotDestructionType.NORMAL`, even if
14151
+ * it destroyed via spawning three separate collectibles.
14152
+ */
14106
14153
  NORMAL = 0,
14154
+ /**
14155
+ * When a machine or a beggar is removed while spawning a collectible reward.
14156
+ *
14157
+ * Note that the destruction type for a Crane Game will be `SlotDestructionType.NORMAL`, even if
14158
+ * it destroyed via spawning three separate collectibles.
14159
+ */
14107
14160
  COLLECTIBLE_PAYOUT = 1
14108
14161
  }
14109
14162