isaacscript-common 6.11.2 → 6.14.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 (189) hide show
  1. package/dist/callbacks/postGridEntityCustomRender.d.ts +2 -0
  2. package/dist/callbacks/postGridEntityCustomRender.d.ts.map +1 -0
  3. package/dist/callbacks/postGridEntityCustomRender.lua +36 -0
  4. package/dist/callbacks/postGridEntityCustomUpdate.d.ts +2 -0
  5. package/dist/callbacks/postGridEntityCustomUpdate.d.ts.map +1 -0
  6. package/dist/callbacks/postGridEntityCustomUpdate.lua +36 -0
  7. package/dist/callbacks/postNewRoomEarly.lua +2 -2
  8. package/dist/callbacks/postPickupInitFirst.lua +1 -20
  9. package/dist/callbacks/reorderedCallbacks.d.ts +5 -5
  10. package/dist/callbacks/reorderedCallbacks.d.ts.map +1 -1
  11. package/dist/callbacks/reorderedCallbacks.lua +5 -5
  12. package/dist/callbacks/subscriptions/postGridEntityCustomRender.d.ts +6 -0
  13. package/dist/callbacks/subscriptions/postGridEntityCustomRender.d.ts.map +1 -0
  14. package/dist/callbacks/subscriptions/postGridEntityCustomRender.lua +29 -0
  15. package/dist/callbacks/subscriptions/postGridEntityCustomUpdate.d.ts +6 -0
  16. package/dist/callbacks/subscriptions/postGridEntityCustomUpdate.d.ts.map +1 -0
  17. package/dist/callbacks/subscriptions/postGridEntityCustomUpdate.lua +29 -0
  18. package/dist/constants.d.ts +1 -5
  19. package/dist/constants.d.ts.map +1 -1
  20. package/dist/constants.lua +0 -7
  21. package/dist/constantsFirstLast.d.ts +5 -1
  22. package/dist/constantsFirstLast.d.ts.map +1 -1
  23. package/dist/constantsFirstLast.lua +6 -0
  24. package/dist/enums/ModCallbackCustom.d.ts +89 -66
  25. package/dist/enums/ModCallbackCustom.d.ts.map +1 -1
  26. package/dist/enums/ModCallbackCustom.lua +62 -58
  27. package/dist/enums/private/SerializationBrand.d.ts +1 -1
  28. package/dist/enums/private/SerializationBrand.lua +1 -1
  29. package/dist/features/collectibleItemPoolType.d.ts +2 -2
  30. package/dist/features/collectibleItemPoolType.lua +2 -2
  31. package/dist/features/customGridEntity.d.ts +11 -2
  32. package/dist/features/customGridEntity.d.ts.map +1 -1
  33. package/dist/features/customGridEntity.lua +22 -2
  34. package/dist/features/customTrapdoor/blackSprite.d.ts.map +1 -1
  35. package/dist/features/customTrapdoor/blackSprite.lua +6 -6
  36. package/dist/features/customTrapdoor/customTrapdoorConstants.d.ts +2 -2
  37. package/dist/features/customTrapdoor/customTrapdoorConstants.d.ts.map +1 -1
  38. package/dist/features/customTrapdoor/customTrapdoorConstants.lua +2 -2
  39. package/dist/features/customTrapdoor/init.d.ts.map +1 -1
  40. package/dist/features/customTrapdoor/init.lua +4 -3
  41. package/dist/features/customTrapdoor/touched.d.ts.map +1 -1
  42. package/dist/features/customTrapdoor/touched.lua +51 -33
  43. package/dist/features/deployJSONRoom.d.ts +2 -2
  44. package/dist/features/deployJSONRoom.lua +2 -2
  45. package/dist/features/extraConsoleCommands/exports.d.ts +4 -3
  46. package/dist/features/extraConsoleCommands/exports.d.ts.map +1 -1
  47. package/dist/features/extraConsoleCommands/exports.lua +4 -3
  48. package/dist/features/extraConsoleCommands/init.lua +12 -14
  49. package/dist/features/extraConsoleCommands/listCommands.d.ts +15 -19
  50. package/dist/features/extraConsoleCommands/listCommands.d.ts.map +1 -1
  51. package/dist/features/extraConsoleCommands/listCommands.lua +34 -42
  52. package/dist/features/pause.d.ts +1 -1
  53. package/dist/features/pause.d.ts.map +1 -1
  54. package/dist/features/pause.lua +87 -8
  55. package/dist/features/persistentEntities.d.ts.map +1 -1
  56. package/dist/features/persistentEntities.lua +7 -7
  57. package/dist/features/pickupIndex.d.ts +19 -0
  58. package/dist/features/pickupIndex.d.ts.map +1 -0
  59. package/dist/features/pickupIndex.lua +197 -0
  60. package/dist/features/roomHistory.d.ts +24 -0
  61. package/dist/features/roomHistory.d.ts.map +1 -0
  62. package/dist/features/roomHistory.lua +89 -0
  63. package/dist/functions/collectibles.d.ts +26 -13
  64. package/dist/functions/collectibles.d.ts.map +1 -1
  65. package/dist/functions/collectibles.lua +26 -13
  66. package/dist/functions/color.d.ts +10 -0
  67. package/dist/functions/color.d.ts.map +1 -1
  68. package/dist/functions/color.lua +24 -0
  69. package/dist/functions/entities.d.ts +3 -3
  70. package/dist/functions/entities.d.ts.map +1 -1
  71. package/dist/functions/entities.lua +8 -3
  72. package/dist/functions/gridEntities.d.ts +4 -22
  73. package/dist/functions/gridEntities.d.ts.map +1 -1
  74. package/dist/functions/gridEntities.lua +4 -61
  75. package/dist/functions/isaacAPIClass.d.ts +64 -0
  76. package/dist/functions/isaacAPIClass.d.ts.map +1 -1
  77. package/dist/functions/isaacAPIClass.lua +84 -1
  78. package/dist/functions/kColor.d.ts +10 -0
  79. package/dist/functions/kColor.d.ts.map +1 -1
  80. package/dist/functions/kColor.lua +24 -0
  81. package/dist/functions/map.d.ts +2 -0
  82. package/dist/functions/map.d.ts.map +1 -1
  83. package/dist/functions/map.lua +7 -0
  84. package/dist/functions/npcs.d.ts +2 -2
  85. package/dist/functions/npcs.lua +2 -2
  86. package/dist/functions/pickupVariants.d.ts +2 -2
  87. package/dist/functions/pickupVariants.d.ts.map +1 -1
  88. package/dist/functions/pickupVariants.lua +2 -2
  89. package/dist/functions/playerCenter.lua +2 -2
  90. package/dist/functions/playerIndex.d.ts +0 -3
  91. package/dist/functions/playerIndex.d.ts.map +1 -1
  92. package/dist/functions/playerIndex.lua +4 -23
  93. package/dist/functions/random.d.ts +1 -1
  94. package/dist/functions/random.lua +1 -1
  95. package/dist/functions/rockAlt.d.ts +28 -0
  96. package/dist/functions/rockAlt.d.ts.map +1 -0
  97. package/dist/functions/rockAlt.lua +140 -0
  98. package/dist/functions/roomData.d.ts +3 -2
  99. package/dist/functions/roomData.d.ts.map +1 -1
  100. package/dist/functions/roomData.lua +3 -2
  101. package/dist/functions/rooms.d.ts +6 -6
  102. package/dist/functions/rooms.lua +6 -6
  103. package/dist/functions/set.d.ts +2 -0
  104. package/dist/functions/set.d.ts.map +1 -1
  105. package/dist/functions/set.lua +6 -0
  106. package/dist/functions/stage.d.ts +1 -0
  107. package/dist/functions/stage.d.ts.map +1 -1
  108. package/dist/functions/stage.lua +4 -0
  109. package/dist/functions/vector.d.ts +11 -0
  110. package/dist/functions/vector.d.ts.map +1 -1
  111. package/dist/functions/vector.lua +23 -0
  112. package/dist/index.d.ts +4 -0
  113. package/dist/index.d.ts.map +1 -1
  114. package/dist/index.lua +31 -0
  115. package/dist/initCustomCallbacks.d.ts.map +1 -1
  116. package/dist/initCustomCallbacks.lua +6 -0
  117. package/dist/initFeatures.d.ts.map +1 -1
  118. package/dist/initFeatures.lua +6 -0
  119. package/dist/interfaces/AddCallbackParameterCustom.d.ts +4 -0
  120. package/dist/interfaces/AddCallbackParameterCustom.d.ts.map +1 -1
  121. package/dist/interfaces/RoomDescription.d.ts +14 -0
  122. package/dist/interfaces/RoomDescription.d.ts.map +1 -0
  123. package/dist/interfaces/RoomDescription.lua +2 -0
  124. package/dist/objects/callbackRegisterFunctions.d.ts.map +1 -1
  125. package/dist/objects/callbackRegisterFunctions.lua +6 -0
  126. package/dist/types/CollectibleIndex.d.ts +1 -1
  127. package/dist/types/PickupIndex.d.ts +17 -0
  128. package/dist/types/PickupIndex.d.ts.map +1 -0
  129. package/dist/types/PickupIndex.lua +2 -0
  130. package/dist/types/PlayerIndex.d.ts +1 -1
  131. package/dist/upgradeMod.d.ts.map +1 -1
  132. package/package.json +2 -2
  133. package/src/callbacks/postGridEntityCustomRender.ts +44 -0
  134. package/src/callbacks/postGridEntityCustomUpdate.ts +44 -0
  135. package/src/callbacks/postNewRoomEarly.ts +2 -2
  136. package/src/callbacks/postPickupInitFirst.ts +3 -32
  137. package/src/callbacks/postPlayerReorderedCallbacks.ts +3 -3
  138. package/src/callbacks/reorderedCallbacks.ts +9 -8
  139. package/src/callbacks/subscriptions/postGridEntityCustomRender.ts +41 -0
  140. package/src/callbacks/subscriptions/postGridEntityCustomUpdate.ts +41 -0
  141. package/src/constants.ts +1 -9
  142. package/src/constantsFirstLast.ts +16 -0
  143. package/src/enums/ModCallbackCustom.ts +33 -8
  144. package/src/enums/private/SerializationBrand.ts +1 -1
  145. package/src/features/collectibleItemPoolType.ts +3 -3
  146. package/src/features/customGridEntity.ts +27 -2
  147. package/src/features/customTrapdoor/blackSprite.ts +11 -5
  148. package/src/features/customTrapdoor/customTrapdoorConstants.ts +2 -2
  149. package/src/features/customTrapdoor/init.ts +7 -5
  150. package/src/features/customTrapdoor/touched.ts +59 -39
  151. package/src/features/deployJSONRoom.ts +4 -4
  152. package/src/features/extraConsoleCommands/exports.ts +4 -3
  153. package/src/features/extraConsoleCommands/init.ts +18 -14
  154. package/src/features/extraConsoleCommands/listCommands.ts +38 -43
  155. package/src/features/pause.ts +97 -7
  156. package/src/features/persistentEntities.ts +9 -8
  157. package/src/features/pickupIndex.ts +257 -0
  158. package/src/features/playerInventory.ts +2 -2
  159. package/src/features/roomHistory.ts +113 -0
  160. package/src/features/saveDataManager/main.ts +2 -2
  161. package/src/features/taintedLazarusPlayers.ts +5 -5
  162. package/src/functions/collectibles.ts +26 -13
  163. package/src/functions/color.ts +22 -0
  164. package/src/functions/entities.ts +6 -3
  165. package/src/functions/gridEntities.ts +4 -56
  166. package/src/functions/isaacAPIClass.ts +106 -1
  167. package/src/functions/kColor.ts +22 -0
  168. package/src/functions/map.ts +10 -0
  169. package/src/functions/npcs.ts +2 -2
  170. package/src/functions/pickupVariants.ts +2 -2
  171. package/src/functions/playerCenter.ts +2 -2
  172. package/src/functions/playerIndex.ts +8 -21
  173. package/src/functions/random.ts +1 -1
  174. package/src/functions/rockAlt.ts +117 -0
  175. package/src/functions/roomData.ts +3 -2
  176. package/src/functions/rooms.ts +6 -6
  177. package/src/functions/set.ts +7 -1
  178. package/src/functions/stage.ts +10 -1
  179. package/src/functions/vector.ts +23 -0
  180. package/src/index.ts +4 -0
  181. package/src/initCustomCallbacks.ts +4 -0
  182. package/src/initFeatures.ts +4 -0
  183. package/src/interfaces/AddCallbackParameterCustom.ts +4 -0
  184. package/src/interfaces/RoomDescription.ts +19 -0
  185. package/src/objects/callbackRegisterFunctions.ts +6 -0
  186. package/src/types/CollectibleIndex.ts +1 -1
  187. package/src/types/PickupIndex.ts +15 -0
  188. package/src/types/PlayerIndex.ts +1 -1
  189. package/src/upgradeMod.ts +2 -1
@@ -1,5 +1,5 @@
1
1
  // The item pool type of a collectible is not stored on the collectible. Thus, we scan for incoming
2
- // item pool types in the PreGetCollectible callback, and then assume that the next spawned
2
+ // item pool types in the `PRE_GET_COLLECTIBLE` callback, and then assume that the next spawned
3
3
  // collectible has this item pool type.
4
4
 
5
5
  import {
@@ -45,8 +45,8 @@ function postPickupInitCollectible(pickup: EntityPickup) {
45
45
 
46
46
  /**
47
47
  * Helper function to get the item pool type that a given collectible came from. Since there is no
48
- * native method in the API to get this, we listen in the PreGetCollectible callback for item pool
49
- * types, and then assume that the next spawned collectible will match.
48
+ * native method in the API to get this, we listen in the `PRE_GET_COLLECTIBLE` callback for item
49
+ * pool types, and then assume that the next spawned collectible will match.
50
50
  */
51
51
  export function getCollectibleItemPoolType(
52
52
  collectible: EntityPickup,
@@ -228,8 +228,8 @@ export function spawnCustomGridEntity(
228
228
  * Default is true. This is generally a good idea because if the room is not
229
229
  * updated, you will be unable to spawn another grid entity on the same tile until
230
230
  * a frame has passed. However, doing this is expensive, since it involves a call
231
- * to `Isaac.GetRoomEntities`, so set it to false if you need to invoke this
232
- * function multiple times.
231
+ * to `Isaac.GetRoomEntities`, so set it to false if you need to run this function
232
+ * multiple times.
233
233
  * @returns The grid entity that was removed. Returns undefined if no grid entity was found at the
234
234
  * given location or if the given grid entity was not a custom grid entity.
235
235
  */
@@ -274,3 +274,28 @@ export function removeCustomGrid(
274
274
 
275
275
  return decoration;
276
276
  }
277
+
278
+ /**
279
+ * Helper function to get the custom grid entities in the current room. Returns an array of tuples
280
+ * containing the raw decoration grid entity and the associated entity data.
281
+ */
282
+ export function getCustomGridEntities(): Array<
283
+ [gridEntity: GridEntity, data: CustomGridEntityData]
284
+ > {
285
+ const roomListIndex = getRoomListIndex();
286
+ const roomCustomGridEntities = v.level.customGridEntities.get(roomListIndex);
287
+ if (roomCustomGridEntities === undefined) {
288
+ return [];
289
+ }
290
+
291
+ const room = game.GetRoom();
292
+ const customGridEntities: Array<[GridEntity, CustomGridEntityData]> = [];
293
+ for (const [gridIndex, data] of roomCustomGridEntities.entries()) {
294
+ const gridEntity = room.GetGridEntity(gridIndex);
295
+ if (gridEntity !== undefined) {
296
+ customGridEntities.push([gridEntity, data]);
297
+ }
298
+ }
299
+
300
+ return customGridEntities;
301
+ }
@@ -1,16 +1,22 @@
1
1
  import { VectorZero } from "../../constants";
2
2
  import { StageTravelState } from "../../enums/private/StageTravelState";
3
- import { ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH } from "../customStage/customStageConstants";
4
3
  import v from "./v";
5
4
 
6
- const sprite = Sprite();
7
- sprite.Load(`${ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH}/black.anm2`, true);
8
- sprite.SetFrame("Default", 0);
5
+ // In order to represent a black sprite, we just use the first frame of the boss versus screen
6
+ // animation. However, we must lazy load the sprite in order to prevent issues with mods that
7
+ // replace the vanilla files. (For some reason, loading the sprites will cause the overwrite to no
8
+ // longer apply on the second and subsequent runs.)
9
+ const blackSprite = Sprite();
9
10
 
10
11
  export function drawBlackSprite(): void {
11
12
  if (v.run.state !== StageTravelState.PAUSING_ON_BLACK) {
12
13
  return;
13
14
  }
14
15
 
15
- sprite.RenderLayer(0, VectorZero);
16
+ if (!blackSprite.IsLoaded()) {
17
+ blackSprite.Load("gfx/ui/boss/versusscreen.anm2", true);
18
+ blackSprite.SetFrame("Scene", 0);
19
+ }
20
+
21
+ blackSprite.RenderLayer(0, VectorZero);
16
22
  }
@@ -19,5 +19,5 @@ export const ANIMATIONS_THAT_PREVENT_STAGE_TRAVEL: ReadonlySet<string> =
19
19
 
20
20
  export const PIXELATION_TO_BLACK_FRAMES = 52;
21
21
 
22
- export const OTHER_PLAYER_TRAPDOOR_JUMP_DELAY_GAME_FRAMES = 10;
23
- export const OTHER_PLAYER_TRAPDOOR_JUMP_DURATION_GAME_FRAMES = 8;
22
+ export const OTHER_PLAYER_TRAPDOOR_JUMP_DELAY_GAME_FRAMES = 6;
23
+ export const OTHER_PLAYER_TRAPDOOR_JUMP_DURATION_GAME_FRAMES = 5;
@@ -21,6 +21,7 @@ import { saveDataManager } from "../saveDataManager/exports";
21
21
  import { drawBlackSprite } from "./blackSprite";
22
22
  import {
23
23
  CUSTOM_TRAPDOOR_FEATURE_NAME,
24
+ GridEntityTypeCustom,
24
25
  PIXELATION_TO_BLACK_FRAMES,
25
26
  } from "./customTrapdoorConstants";
26
27
  import { checkCustomTrapdoorOpenClose } from "./openClose";
@@ -33,8 +34,9 @@ export function customTrapdoorInit(mod: ModUpgraded): void {
33
34
  mod.AddCallback(ModCallback.POST_RENDER, postRender); // 2
34
35
  mod.AddCallback(ModCallback.POST_PEFFECT_UPDATE, postPEffectUpdate); // 4
35
36
  mod.AddCallbackCustom(
36
- ModCallbackCustom.POST_GRID_ENTITY_UPDATE,
37
- postGridEntityUpdateTrapdoor,
37
+ ModCallbackCustom.POST_GRID_ENTITY_CUSTOM_UPDATE,
38
+ postGridEntityCustomUpdateTrapdoor,
39
+ GridEntityTypeCustom.TRAPDOOR_CUSTOM,
38
40
  );
39
41
  }
40
42
 
@@ -198,9 +200,9 @@ function checkJumpComplete(player: EntityPlayer) {
198
200
  }
199
201
  }
200
202
 
201
- // ModCallbackCustom.POST_GRID_ENTITY_UPDATE
202
- // GridEntityType.TRAPDOOR (17)
203
- function postGridEntityUpdateTrapdoor(gridEntity: GridEntity) {
203
+ // ModCallbackCustom.POST_GRID_ENTITY_CUSTOM_UPDATE
204
+ // GridEntityTypeCustom.TRAPDOOR_CUSTOM
205
+ function postGridEntityCustomUpdateTrapdoor(gridEntity: GridEntity) {
204
206
  const roomListIndex = getRoomListIndex();
205
207
  const gridIndex = gridEntity.GetGridIndex();
206
208
 
@@ -1,20 +1,23 @@
1
1
  import {
2
+ ButtonAction,
2
3
  EntityCollisionClass,
4
+ EntityGridCollisionClass,
3
5
  EntityPartition,
4
6
  PlayerType,
5
7
  } from "isaac-typescript-definitions";
6
8
  import { VectorZero } from "../../constants";
7
9
  import { StageTravelState } from "../../enums/private/StageTravelState";
10
+ import { easeOutSine } from "../../functions/easing";
8
11
  import {
12
+ getAllPlayers,
9
13
  getOtherPlayers,
10
- getPlayers,
11
14
  isChildPlayer,
12
15
  } from "../../functions/playerIndex";
13
16
  import { isCharacter } from "../../functions/players";
14
17
  import { CustomTrapdoorDescription } from "../../interfaces/private/CustomTrapdoorDescription";
15
- import { disableAllInputs } from "../disableInputs";
18
+ import { disableAllInputsExceptFor } from "../disableInputs";
16
19
  import { isPlayerUsingPony } from "../ponyDetection";
17
- import { runInNGameFrames, runNextGameFrame } from "../runInNFrames";
20
+ import { runInNGameFrames, runNextRenderFrame } from "../runInNFrames";
18
21
  import {
19
22
  ANIMATIONS_THAT_PREVENT_STAGE_TRAVEL,
20
23
  CUSTOM_TRAPDOOR_FEATURE_NAME,
@@ -78,7 +81,8 @@ function playerTouchedCustomTrapdoor(
78
81
  v.run.state = StageTravelState.PLAYERS_JUMPING_DOWN;
79
82
  v.run.destination = trapdoorDescription.destination;
80
83
 
81
- disableAllInputs(CUSTOM_TRAPDOOR_FEATURE_NAME);
84
+ const whitelist = new Set([ButtonAction.CONSOLE]);
85
+ disableAllInputsExceptFor(CUSTOM_TRAPDOOR_FEATURE_NAME, whitelist);
82
86
  setPlayerAttributes(player, gridEntity.Position);
83
87
  dropTaintedForgotten(player);
84
88
 
@@ -95,6 +99,35 @@ function playerTouchedCustomTrapdoor(
95
99
  });
96
100
  }
97
101
 
102
+ function setPlayerAttributes(trapdoorPlayer: EntityPlayer, position: Vector) {
103
+ // Snap the player to the exact position of the trapdoor so that they cleanly jump down the hole.
104
+ trapdoorPlayer.Position = position;
105
+
106
+ for (const player of getAllPlayers()) {
107
+ // Disable the controls to prevent the player from moving, shooting, and so on. (We also disable
108
+ // the inputs in the `INPUT_ACTION` callback, but that does not prevent mouse inputs.)
109
+ player.ControlsEnabled = false;
110
+
111
+ // Freeze all players.
112
+ player.Velocity = VectorZero;
113
+
114
+ // We don't want enemy attacks to move the players.
115
+ player.EntityCollisionClass = EntityCollisionClass.NONE;
116
+ player.GridCollisionClass = EntityGridCollisionClass.NONE;
117
+
118
+ player.SubType = -1;
119
+ }
120
+ }
121
+
122
+ function dropTaintedForgotten(player: EntityPlayer) {
123
+ if (isCharacter(player, PlayerType.THE_FORGOTTEN_B)) {
124
+ const taintedSoul = player.GetOtherTwin();
125
+ if (taintedSoul !== undefined) {
126
+ taintedSoul.ThrowHeldEntity(VectorZero);
127
+ }
128
+ }
129
+ }
130
+
98
131
  function startDelayedJump(entityPtr: EntityPtr, trapdoorPosition: Vector) {
99
132
  const entity = entityPtr.Ref;
100
133
  if (entity === undefined) {
@@ -108,14 +141,18 @@ function startDelayedJump(entityPtr: EntityPtr, trapdoorPosition: Vector) {
108
141
 
109
142
  player.PlayExtraAnimation("Trapdoor");
110
143
 
111
- adjustPlayerVelocityToTrapdoor(entityPtr, player.Position, trapdoorPosition);
144
+ adjustPlayerPositionToTrapdoor(entityPtr, player.Position, trapdoorPosition);
112
145
  }
113
146
 
114
- function adjustPlayerVelocityToTrapdoor(
147
+ function adjustPlayerPositionToTrapdoor(
115
148
  entityPtr: EntityPtr,
116
149
  startPos: Vector,
117
150
  endPos: Vector,
118
151
  ) {
152
+ if (v.run.state !== StageTravelState.PLAYERS_JUMPING_DOWN) {
153
+ return;
154
+ }
155
+
119
156
  const entity = entityPtr.Ref;
120
157
  if (entity === undefined) {
121
158
  return;
@@ -126,50 +163,33 @@ function adjustPlayerVelocityToTrapdoor(
126
163
  return;
127
164
  }
128
165
 
166
+ runNextRenderFrame(() => {
167
+ adjustPlayerPositionToTrapdoor(entityPtr, startPos, endPos);
168
+ });
169
+
129
170
  const sprite = player.GetSprite();
130
171
  if (sprite.IsFinished("Trapdoor")) {
172
+ player.Position = endPos;
173
+ player.Velocity = VectorZero;
131
174
  return;
132
175
  }
133
176
 
134
177
  const frame = sprite.GetFrame();
135
- if (frame > OTHER_PLAYER_TRAPDOOR_JUMP_DURATION_GAME_FRAMES) {
178
+ if (frame >= OTHER_PLAYER_TRAPDOOR_JUMP_DURATION_GAME_FRAMES) {
136
179
  // We have already arrived at the trapdoor.
180
+ player.Position = endPos;
181
+ player.Velocity = VectorZero;
137
182
  return;
138
183
  }
139
184
 
185
+ // Make the player jump towards the trapdoor. We use an easing function so that the distance
186
+ // traveled is not linear, emulating what the game does.
140
187
  const totalDifference = endPos.sub(startPos);
141
- const differencePerFrame = totalDifference.div(
142
- OTHER_PLAYER_TRAPDOOR_JUMP_DURATION_GAME_FRAMES,
143
- );
144
- const differenceForThisFrame = differencePerFrame.mul(frame + 1);
188
+ const progress = frame / OTHER_PLAYER_TRAPDOOR_JUMP_DURATION_GAME_FRAMES;
189
+ const easeProgress = easeOutSine(progress);
190
+ const differenceForThisFrame = totalDifference.mul(easeProgress);
145
191
  const targetPosition = startPos.add(differenceForThisFrame);
146
- const calculatedVelocity = player.Position.sub(targetPosition);
147
-
148
- player.Velocity = calculatedVelocity;
149
-
150
- runNextGameFrame(() => {
151
- adjustPlayerVelocityToTrapdoor(entityPtr, startPos, endPos);
152
- });
153
- }
154
192
 
155
- function setPlayerAttributes(trapdoorPlayer: EntityPlayer, position: Vector) {
156
- // Snap the player to the exact position of the trapdoor so that they cleanly jump down the hole.
157
- trapdoorPlayer.Position = position;
158
-
159
- for (const player of getPlayers()) {
160
- // Freeze all players.
161
- player.Velocity = VectorZero;
162
-
163
- // We don't want enemy attacks to move the players.
164
- player.EntityCollisionClass = EntityCollisionClass.NONE;
165
- }
166
- }
167
-
168
- function dropTaintedForgotten(player: EntityPlayer) {
169
- if (isCharacter(player, PlayerType.THE_FORGOTTEN_B)) {
170
- const taintedSoul = player.GetOtherTwin();
171
- if (taintedSoul !== undefined) {
172
- taintedSoul.ThrowHeldEntity(VectorZero);
173
- }
174
- }
193
+ player.Position = targetPosition;
194
+ player.Velocity = VectorZero;
175
195
  }
@@ -225,7 +225,7 @@ function respawnPersistentEntities() {
225
225
  * Specifically, this will clear the current room of all entities and grid entities, and then spawn
226
226
  * all of the entries and grid entities in the provided JSON room.
227
227
  *
228
- * This function is meant to be used in the PostNewRoom callback.
228
+ * This function is meant to be used in the `POST_NEW_ROOM` callback.
229
229
  *
230
230
  * For example:
231
231
  *
@@ -277,7 +277,7 @@ export function deployJSONRoom(
277
277
  * Specifically, this will clear the current room of all entities and grid entities, and then spawn
278
278
  * all of the entries and grid entities in one of the provided JSON rooms.
279
279
  *
280
- * This function is meant to be used in the PostNewRoom callback.
280
+ * This function is meant to be used in the `POST_NEW_ROOM` callback.
281
281
  *
282
282
  * Note that this function does not simply choose a random element in the provided array; it will
283
283
  * properly account for each room weight using the algorithm from:
@@ -355,8 +355,8 @@ export function emptyRoom(fillWithDecorations: boolean): void {
355
355
  }
356
356
 
357
357
  /**
358
- * We remove entities in the PostNewRoom callback instead of in the PreRoomEntitySpawn callback so
359
- * that they will not re-appear when we re-enter the room.
358
+ * We remove entities in the `POST_NEW_ROOM` callback instead of in the PreRoomEntitySpawn callback
359
+ * so that they will not re-appear when we re-enter the room.
360
360
  */
361
361
  function removeSpecificNPCs() {
362
362
  const room = game.GetRoom();
@@ -24,9 +24,10 @@ export function enableExtraConsoleCommands(mod: ModUpgraded): void {
24
24
  *
25
25
  * The standard library comes with many existing console commands that are useful for debugging, but
26
26
  * you can also add your own commands that are useful for your particular mod. It's easier to add
27
- * commands to the existing command system than to add logic manually to the ExecuteCmd callback.
27
+ * commands to the existing command system than to add your own logic manually to the `EXECUTE_CMD`
28
+ * callback.
28
29
  *
29
- * Before using this function, you must first invoke `enableExtraConsoleCommands`.
30
+ * Before using this function, you must first run the `enableExtraConsoleCommands` function.
30
31
  */
31
32
  export function addConsoleCommand(
32
33
  commandName: string,
@@ -59,7 +60,7 @@ export function addConsoleCommand(
59
60
  * The standard library comes with many existing console commands that are useful for debugging. If
60
61
  * you want to disable one of them, use this function.
61
62
  *
62
- * Before using this function, you must first invoke `enableExtraConsoleCommands`.
63
+ * Before using this function, you must first run the `enableExtraConsoleCommands` function.
63
64
  */
64
65
  export function removeConsoleCommand(commandName: string): void {
65
66
  if (!isExtraConsoleCommandsInitialized()) {
@@ -27,7 +27,7 @@ export function extraConsoleCommandsInit(mod: ModUpgraded): void {
27
27
  function initMap() {
28
28
  extraConsoleCommandsFunctionMap.set("1hp", commands.oneHP);
29
29
  extraConsoleCommandsFunctionMap.set("addCharges", commands.addCharges);
30
- extraConsoleCommandsFunctionMap.set("angel", commands.angel);
30
+ extraConsoleCommandsFunctionMap.set("angelRoom", commands.angelRoom);
31
31
  extraConsoleCommandsFunctionMap.set("ascent", commands.ascent);
32
32
  extraConsoleCommandsFunctionMap.set("bedroom", commands.bedroom);
33
33
  extraConsoleCommandsFunctionMap.set("bh", commands.bh);
@@ -46,7 +46,7 @@ function initMap() {
46
46
  );
47
47
  extraConsoleCommandsFunctionMap.set("bombs", commands.bombs);
48
48
  extraConsoleCommandsFunctionMap.set("boneHearts", commands.boneHearts);
49
- extraConsoleCommandsFunctionMap.set("boss", commands.boss);
49
+ extraConsoleCommandsFunctionMap.set("bossRoom", commands.bossRoom);
50
50
  extraConsoleCommandsFunctionMap.set("bossRush", commands.bossRush);
51
51
  extraConsoleCommandsFunctionMap.set("brokenHearts", commands.brokenHearts);
52
52
  extraConsoleCommandsFunctionMap.set("card", commands.card);
@@ -66,7 +66,7 @@ function initMap() {
66
66
  extraConsoleCommandsFunctionMap.set("d6", commands.d6);
67
67
  extraConsoleCommandsFunctionMap.set("damage", commands.damage);
68
68
  extraConsoleCommandsFunctionMap.set("dd", commands.dd);
69
- extraConsoleCommandsFunctionMap.set("devil", commands.devil);
69
+ extraConsoleCommandsFunctionMap.set("devilRoom", commands.devilRoom);
70
70
  extraConsoleCommandsFunctionMap.set("dirtyBedroom", commands.dirtyBedroom);
71
71
  extraConsoleCommandsFunctionMap.set("disableCurses", commands.disableCurses);
72
72
  extraConsoleCommandsFunctionMap.set(
@@ -89,7 +89,7 @@ function initMap() {
89
89
  commandsDisplay.effectsDisplay,
90
90
  );
91
91
  extraConsoleCommandsFunctionMap.set("eh", commands.eh);
92
- extraConsoleCommandsFunctionMap.set("error", commands.error);
92
+ extraConsoleCommandsFunctionMap.set("errorRoom", commands.errorRoom);
93
93
  extraConsoleCommandsFunctionMap.set("eternalHearts", commands.eternalHearts);
94
94
  extraConsoleCommandsFunctionMap.set(
95
95
  "familiarDisplay",
@@ -113,10 +113,9 @@ function initMap() {
113
113
  extraConsoleCommandsFunctionMap.set("grid2", commands.grid2);
114
114
  extraConsoleCommandsFunctionMap.set("gridCosts", commands.gridCosts);
115
115
  extraConsoleCommandsFunctionMap.set("gridEntities", commands.gridEntities);
116
- extraConsoleCommandsFunctionMap.set("h", commands.h);
117
116
  extraConsoleCommandsFunctionMap.set("hearts", commands.hearts);
118
117
  extraConsoleCommandsFunctionMap.set("hitboxes", commands.hitboxes);
119
- extraConsoleCommandsFunctionMap.set("iAmError", commands.iAmError);
118
+ extraConsoleCommandsFunctionMap.set("iAmErrorRoom", commands.iAmErrorRoom);
120
119
  extraConsoleCommandsFunctionMap.set("key", commands.key);
121
120
  extraConsoleCommandsFunctionMap.set("keys", commands.keys);
122
121
  extraConsoleCommandsFunctionMap.set(
@@ -146,7 +145,6 @@ function initMap() {
146
145
  extraConsoleCommandsFunctionMap.set("mana", commands.mana);
147
146
  extraConsoleCommandsFunctionMap.set("map", commands.map);
148
147
  extraConsoleCommandsFunctionMap.set("maxHearts", commands.maxHearts);
149
- extraConsoleCommandsFunctionMap.set("mh", commands.mh);
150
148
  extraConsoleCommandsFunctionMap.set("miniboss", commands.miniboss);
151
149
  extraConsoleCommandsFunctionMap.set("noCurses", commands.noCurses);
152
150
  extraConsoleCommandsFunctionMap.set("npcDisplay", commandsDisplay.npcDisplay);
@@ -207,7 +205,6 @@ function initMap() {
207
205
  commandsDisplay.projectilesDisplay,
208
206
  );
209
207
  extraConsoleCommandsFunctionMap.set("redHearts", commands.redHearts);
210
- extraConsoleCommandsFunctionMap.set("rh", commands.rh);
211
208
  extraConsoleCommandsFunctionMap.set("right", commands.right);
212
209
  extraConsoleCommandsFunctionMap.set(
213
210
  "rockDisplay",
@@ -221,13 +218,12 @@ function initMap() {
221
218
  extraConsoleCommandsFunctionMap.set("rottenHearts", commands.rottenHearts);
222
219
  extraConsoleCommandsFunctionMap.set("runTests", commands.runTests);
223
220
  extraConsoleCommandsFunctionMap.set("s", commands.s);
224
- extraConsoleCommandsFunctionMap.set("sacrifice", commands.sacrifice);
225
- extraConsoleCommandsFunctionMap.set("secret", commands.secret);
221
+ extraConsoleCommandsFunctionMap.set("sacrificeRoom", commands.sacrificeRoom);
222
+ extraConsoleCommandsFunctionMap.set("secretRoom", commands.secretRoom);
226
223
  extraConsoleCommandsFunctionMap.set("seedStick", commands.seedStick);
227
224
  extraConsoleCommandsFunctionMap.set("seeds", commands.seedsCommand);
228
225
  extraConsoleCommandsFunctionMap.set("setCharges", commands.setCharges);
229
226
  extraConsoleCommandsFunctionMap.set("setPosition", commands.setPosition);
230
- extraConsoleCommandsFunctionMap.set("sh", commands.sh);
231
227
  extraConsoleCommandsFunctionMap.set("shop", commands.shop);
232
228
  extraConsoleCommandsFunctionMap.set(
233
229
  "slotDisplay",
@@ -256,8 +252,12 @@ function initMap() {
256
252
  "spikesDisplay",
257
253
  commandsDisplay.spikesDisplay,
258
254
  );
259
- extraConsoleCommandsFunctionMap.set("supersecret", commands.superSecret);
255
+ extraConsoleCommandsFunctionMap.set(
256
+ "superSecretRoom",
257
+ commands.superSecretRoom,
258
+ );
260
259
  extraConsoleCommandsFunctionMap.set("startingRoom", commands.startingRoom);
260
+ extraConsoleCommandsFunctionMap.set("startRoom", commands.startRoom);
261
261
  extraConsoleCommandsFunctionMap.set(
262
262
  "tearDisplay",
263
263
  commandsDisplay.tearDisplay,
@@ -267,14 +267,18 @@ function initMap() {
267
267
  "tearsDisplay",
268
268
  commandsDisplay.tearsDisplay,
269
269
  );
270
+ extraConsoleCommandsFunctionMap.set("tests", commands.tests);
270
271
  extraConsoleCommandsFunctionMap.set("tntDisplay", commandsDisplay.tntDisplay);
271
272
  extraConsoleCommandsFunctionMap.set(
272
273
  "tntsDisplay",
273
274
  commandsDisplay.tntsDisplay,
274
275
  );
275
276
  extraConsoleCommandsFunctionMap.set("trapdoor", commands.trapdoorCommand);
276
- extraConsoleCommandsFunctionMap.set("treasure", commands.treasure);
277
- extraConsoleCommandsFunctionMap.set("ultraSecret", commands.ultraSecret);
277
+ extraConsoleCommandsFunctionMap.set("treasureRoom", commands.treasureRoom);
278
+ extraConsoleCommandsFunctionMap.set(
279
+ "ultraSecretRoom",
280
+ commands.ultraSecretRoom,
281
+ );
278
282
  extraConsoleCommandsFunctionMap.set("unseed", commands.unseed);
279
283
  extraConsoleCommandsFunctionMap.set("up", commands.up);
280
284
  extraConsoleCommandsFunctionMap.set("warp", commands.warp);
@@ -1,16 +1,23 @@
1
1
  // This file is arbitrarily named "listCommands.ts" instead of "commands.ts" so that it will appear
2
- // below the "init" page.
2
+ // below "exports.ts".
3
3
 
4
4
  // cspell:ignore addcharges
5
5
  /**
6
6
  * This is a list of custom console commands that are included with the standard library.
7
7
  *
8
- * Note that as a quality of life feature, you do not have to match the casing of the command. For
9
- * example, you can type the "addCharges" command as "addcharges", and it will still work the same.
8
+ * As a quality of life feature, you do not have to match the casing of the command. For example,
9
+ * you can type the "addCharges" command as "addcharges", and it will still work the same.
10
+ *
11
+ * Additionally, you can also abbreviate any command by omitting letters that do not overlap with
12
+ * any other command. For example, the command of "c" will be interpreted as the "card" command.
10
13
  *
11
14
  * In order for the custom console commands to work, you first have to call
12
15
  * `enableExtraConsoleCommands`. (See the "Extra Console Commands (Init)" page for more details.)
13
16
  *
17
+ * Each command has a corresponding function of the same name, but these functions are not actually
18
+ * exported for end-user consumption. (This is to cut down on namespace conflicts and because the
19
+ * names of the functions are not very descriptive.)
20
+ *
14
21
  * @module
15
22
  */
16
23
 
@@ -33,19 +40,17 @@ import {
33
40
  TrinketType,
34
41
  } from "isaac-typescript-definitions";
35
42
  import { game, sfxManager } from "../../cachedClasses";
36
- import {
37
- FIRST_ROOM_TYPE,
38
- FIRST_STAGE,
39
- LAST_ROOM_TYPE,
40
- LAST_STAGE,
41
- MAX_LEVEL_GRID_INDEX,
42
- } from "../../constants";
43
+ import { MAX_LEVEL_GRID_INDEX } from "../../constants";
43
44
  import {
44
45
  FIRST_CARD,
45
46
  FIRST_CHARACTER,
46
47
  FIRST_PILL_EFFECT,
48
+ FIRST_ROOM_TYPE,
49
+ FIRST_STAGE,
47
50
  LAST_CARD,
48
51
  LAST_PILL_EFFECT,
52
+ LAST_ROOM_TYPE,
53
+ LAST_STAGE,
49
54
  LAST_VANILLA_CHARACTER,
50
55
  } from "../../constantsFirstLast";
51
56
  import { HealthType } from "../../enums/HealthType";
@@ -153,7 +158,7 @@ export function addCharges(params: string): void {
153
158
  * Warps to the Angel Room for the floor. If the Devil Room has already been visited or initialized,
154
159
  * this will uninitialize it and make an Angel Room instead.
155
160
  */
156
- export function angel(): void {
161
+ export function angelRoom(): void {
157
162
  devilAngel(false);
158
163
  }
159
164
 
@@ -278,7 +283,7 @@ export function boneHearts(params: string): void {
278
283
  }
279
284
 
280
285
  /** Warps to the first Boss Room on the floor. */
281
- export function boss(): void {
286
+ export function bossRoom(): void {
282
287
  warpToRoomType(RoomType.BOSS);
283
288
  }
284
289
 
@@ -475,14 +480,14 @@ export function damage(): void {
475
480
 
476
481
  /** Alias for the "devil" command. */
477
482
  export function dd(): void {
478
- devil();
483
+ devilRoom();
479
484
  }
480
485
 
481
486
  /**
482
487
  * Warps to the Devil Room for the floor. If the Angel Room has already been visited or initialized,
483
488
  * this will uninitialize it and make an Devil Room instead.
484
489
  */
485
- export function devil(): void {
490
+ export function devilRoom(): void {
486
491
  devilAngel(true);
487
492
  }
488
493
 
@@ -502,7 +507,7 @@ export function down(params: string): void {
502
507
  movePlayer(params, Direction.DOWN);
503
508
  }
504
509
 
505
- /** Warps to the Dungeon (i.e. crawl space) for the floor. */
510
+ /** Warps to the Dungeon (i.e. the crawl space room) for the floor. */
506
511
  export function dungeon(): void {
507
512
  changeRoom(GridRoom.DUNGEON);
508
513
  }
@@ -520,8 +525,8 @@ export function eh(params: string): void {
520
525
  }
521
526
 
522
527
  /** Alias for the "iAmError" command. */
523
- export function error(): void {
524
- iAmError();
528
+ export function errorRoom(): void {
529
+ iAmErrorRoom();
525
530
  }
526
531
 
527
532
  /**
@@ -665,11 +670,6 @@ export function gridEntities(): void {
665
670
  }
666
671
  }
667
672
 
668
- /** Alias for the "hearts" command. */
669
- export function h(params: string): void {
670
- hearts(params);
671
- }
672
-
673
673
  /**
674
674
  * Gives a half red heart. Provide a number to give a custom amount of hearts. (You can use negative
675
675
  * numbers to remove hearts.)
@@ -684,7 +684,7 @@ export function hitboxes(): void {
684
684
  }
685
685
 
686
686
  /** Warps to the I AM ERROR room for the floor. */
687
- export function iAmError(): void {
687
+ export function iAmErrorRoom(): void {
688
688
  changeRoom(GridRoom.ERROR);
689
689
  }
690
690
 
@@ -818,11 +818,6 @@ export function maxHearts(params: string): void {
818
818
  addHeart(params, HealthType.MAX_HEARTS);
819
819
  }
820
820
 
821
- /** Alias for the "maxHearts" command. */
822
- export function mh(params: string): void {
823
- maxHearts(params);
824
- }
825
-
826
821
  /** Warps to the first Miniboss Room on the floor. */
827
822
  export function miniboss(): void {
828
823
  warpToRoomType(RoomType.MINI_BOSS);
@@ -966,11 +961,6 @@ export function redHearts(params: string): void {
966
961
  hearts(params);
967
962
  }
968
963
 
969
- /** Alias for the "redHearts" command. */
970
- export function rh(params: string): void {
971
- redHearts(params);
972
- }
973
-
974
964
  /** Moves the player 0.5 units right. Provide a number to move a custom amount of units. */
975
965
  export function right(params: string): void {
976
966
  movePlayer(params, Direction.RIGHT);
@@ -1050,12 +1040,12 @@ export function s(params: string): void {
1050
1040
  }
1051
1041
 
1052
1042
  /** Warps to the first Sacrifice Room on the floor. */
1053
- export function sacrifice(): void {
1043
+ export function sacrificeRoom(): void {
1054
1044
  warpToRoomType(RoomType.SACRIFICE);
1055
1045
  }
1056
1046
 
1057
1047
  /** Warps to the first Secret Room on the floor. */
1058
- export function secret(): void {
1048
+ export function secretRoom(): void {
1059
1049
  warpToRoomType(RoomType.SECRET);
1060
1050
  }
1061
1051
 
@@ -1162,11 +1152,6 @@ export function setPosition(params: string): void {
1162
1152
  player.Position = position;
1163
1153
  }
1164
1154
 
1165
- /** Alias for the "soulHearts" command. */
1166
- export function sh(params: string): void {
1167
- soulHearts(params);
1168
- }
1169
-
1170
1155
  /** Warps to the first shop on the floor. */
1171
1156
  export function shop(): void {
1172
1157
  warpToRoomType(RoomType.SHOP);
@@ -1282,8 +1267,13 @@ export function startingRoom(): void {
1282
1267
  changeRoom(startingRoomIndex);
1283
1268
  }
1284
1269
 
1270
+ /** Alias for the "startingRoom" command. */
1271
+ export function startRoom(): void {
1272
+ startingRoom();
1273
+ }
1274
+
1285
1275
  /** Warps to the first Super Secret Room on the floor. */
1286
- export function superSecret(): void {
1276
+ export function superSecretRoom(): void {
1287
1277
  warpToRoomType(RoomType.SUPER_SECRET);
1288
1278
  }
1289
1279
 
@@ -1301,18 +1291,23 @@ export function tears(): void {
1301
1291
  printEnabled(v.run.maxDamage, "debug tear-rate");
1302
1292
  }
1303
1293
 
1294
+ /** Alias for the "runTests" command. */
1295
+ export function tests(): void {
1296
+ runTests();
1297
+ }
1298
+
1304
1299
  /** Creates a trapdoor next to the player. */
1305
1300
  export function trapdoorCommand(): void {
1306
1301
  spawnTrapdoorOrCrawlSpace(true);
1307
1302
  }
1308
1303
 
1309
1304
  /** Warps to the first Treasure Room on the floor. */
1310
- export function treasure(): void {
1305
+ export function treasureRoom(): void {
1311
1306
  warpToRoomType(RoomType.TREASURE);
1312
1307
  }
1313
1308
 
1314
1309
  /** Warps to the first Ultra Secret Room on the floor. */
1315
- export function ultraSecret(): void {
1310
+ export function ultraSecretRoom(): void {
1316
1311
  warpToRoomType(RoomType.ULTRA_SECRET);
1317
1312
  }
1318
1313