isaacscript-common 87.5.1 → 87.6.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 (201) hide show
  1. package/dist/callbackClasses.d.ts +1 -0
  2. package/dist/callbackClasses.d.ts.map +1 -1
  3. package/dist/callbackClasses.js +5 -3
  4. package/dist/callbackClasses.lua +4 -0
  5. package/dist/callbacks.d.ts +118 -117
  6. package/dist/callbacks.d.ts.map +1 -1
  7. package/dist/callbacks.js +1 -0
  8. package/dist/callbacks.lua +1 -0
  9. package/dist/classes/ModUpgraded.js +2 -2
  10. package/dist/classes/callbacks/InputActionFilter.js +3 -3
  11. package/dist/classes/callbacks/InputActionPlayer.js +6 -6
  12. package/dist/classes/callbacks/PostBoneSwing.js +2 -2
  13. package/dist/classes/callbacks/PostCollectibleEmpty.js +2 -2
  14. package/dist/classes/callbacks/PostCursedTeleport.js +5 -5
  15. package/dist/classes/callbacks/PostDiceRoomActivated.js +2 -2
  16. package/dist/classes/callbacks/PostEntityRemoveFilter.d.ts +9 -0
  17. package/dist/classes/callbacks/PostEntityRemoveFilter.d.ts.map +1 -0
  18. package/dist/classes/callbacks/PostEntityRemoveFilter.js +21 -0
  19. package/dist/classes/callbacks/PostEntityRemoveFilter.lua +23 -0
  20. package/dist/classes/callbacks/PostGridEntityCollision.js +10 -10
  21. package/dist/classes/callbacks/PostGridEntityCustomCollision.js +8 -8
  22. package/dist/classes/callbacks/PostGridEntityCustomRemove.js +2 -2
  23. package/dist/classes/callbacks/PostGridEntityRemove.js +3 -3
  24. package/dist/classes/callbacks/PostItemDischarge.js +2 -2
  25. package/dist/classes/callbacks/PostKeyboardChanged.js +2 -2
  26. package/dist/classes/callbacks/PostNewRoomEarly.js +2 -2
  27. package/dist/classes/callbacks/PostPickupSelectionFilter.d.ts.map +1 -1
  28. package/dist/classes/callbacks/PostPickupSelectionFilter.js +4 -3
  29. package/dist/classes/callbacks/PostPlayerChangeHealth.js +2 -2
  30. package/dist/classes/callbacks/PostPurchase.js +9 -9
  31. package/dist/classes/callbacks/PostUsePillFilter.js +2 -2
  32. package/dist/classes/callbacks/PreBerserkDeath.js +4 -4
  33. package/dist/classes/callbacks/PreEntitySpawnFilter.js +3 -3
  34. package/dist/classes/callbacks/PreRoomEntitySpawnFilter.js +5 -5
  35. package/dist/classes/features/callbackLogic/EsauJrDetection.js +2 -2
  36. package/dist/classes/features/callbackLogic/GameReorderedCallbacks.js +5 -5
  37. package/dist/classes/features/callbackLogic/GridEntityUpdateDetection.js +4 -4
  38. package/dist/classes/features/callbackLogic/ItemPickupDetection.js +4 -4
  39. package/dist/classes/features/callbackLogic/PlayerCollectibleDetection.js +2 -2
  40. package/dist/classes/features/other/CustomTrapdoors.d.ts.map +1 -1
  41. package/dist/classes/features/other/CustomTrapdoors.js +21 -21
  42. package/dist/classes/features/other/DeployJSONRoom.js +4 -4
  43. package/dist/classes/features/other/DisableInputs.js +3 -3
  44. package/dist/classes/features/other/ModdedElementSets.js +2 -2
  45. package/dist/classes/features/other/NoSirenSteal.js +4 -4
  46. package/dist/classes/features/other/PickupIndexCreation.js +5 -5
  47. package/dist/classes/features/other/PonyDetection.js +2 -2
  48. package/dist/classes/features/other/PressInput.js +2 -2
  49. package/dist/classes/features/other/PreventChildEntities.js +4 -4
  50. package/dist/classes/features/other/RoomHistory.js +5 -5
  51. package/dist/classes/features/other/SaveDataManager.js +2 -2
  52. package/dist/classes/features/other/StageHistory.js +2 -2
  53. package/dist/classes/features/other/StartAmbush.js +2 -2
  54. package/dist/classes/features/other/TaintedLazarusPlayers.js +2 -2
  55. package/dist/classes/features/other/customStages/gridEntities.js +4 -4
  56. package/dist/classes/features/other/customStages/streakText.js +4 -4
  57. package/dist/classes/features/other/extraConsoleCommands/commands.js +8 -8
  58. package/dist/classes/features/other/saveDataManager/glowingHourGlass.js +2 -2
  59. package/dist/enums/ModCallbackCustom.d.ts +134 -117
  60. package/dist/enums/ModCallbackCustom.d.ts.map +1 -1
  61. package/dist/enums/ModCallbackCustom.js +134 -117
  62. package/dist/enums/ModCallbackCustom.lua +119 -117
  63. package/dist/functions/bosses.js +2 -2
  64. package/dist/functions/charge.js +2 -2
  65. package/dist/functions/collectibles.js +2 -2
  66. package/dist/functions/deepCopy.js +6 -6
  67. package/dist/functions/doors.js +3 -3
  68. package/dist/functions/easing.js +2 -2
  69. package/dist/functions/emptyRoom.js +5 -5
  70. package/dist/functions/entities.js +8 -8
  71. package/dist/functions/familiars.js +2 -2
  72. package/dist/functions/flag.js +2 -2
  73. package/dist/functions/gridEntities.js +23 -23
  74. package/dist/functions/gridEntitiesSpecific.js +2 -2
  75. package/dist/functions/isaacAPIClass.js +2 -2
  76. package/dist/functions/level.js +3 -3
  77. package/dist/functions/levelGrid.js +6 -6
  78. package/dist/functions/logEntities.js +8 -8
  79. package/dist/functions/math.js +4 -4
  80. package/dist/functions/nextStage.js +10 -10
  81. package/dist/functions/npcs.js +10 -10
  82. package/dist/functions/pickupVariants.js +6 -6
  83. package/dist/functions/playerCollectibles.js +2 -2
  84. package/dist/functions/playerHealth.js +8 -8
  85. package/dist/functions/playerIndex.js +3 -3
  86. package/dist/functions/players.js +4 -4
  87. package/dist/functions/pocketItems.js +2 -2
  88. package/dist/functions/revive.js +15 -15
  89. package/dist/functions/roomGrid.js +2 -2
  90. package/dist/functions/rooms.d.ts +1 -2
  91. package/dist/functions/rooms.d.ts.map +1 -1
  92. package/dist/functions/rooms.js +39 -41
  93. package/dist/functions/rooms.lua +1 -2
  94. package/dist/functions/sort.js +2 -2
  95. package/dist/functions/spawnCollectible.js +3 -3
  96. package/dist/functions/stage.js +16 -16
  97. package/dist/functions/string.js +6 -6
  98. package/dist/functions/tears.js +2 -2
  99. package/dist/functions/trinketGive.js +4 -4
  100. package/dist/functions/types.js +3 -3
  101. package/dist/index.rollup.d.ts +151 -122
  102. package/dist/interfaces/private/AddCallbackParametersCustom.d.ts +6 -0
  103. package/dist/interfaces/private/AddCallbackParametersCustom.d.ts.map +1 -1
  104. package/dist/isaacscript-common.lua +159 -123
  105. package/dist/lib/jsonLua.js +32 -32
  106. package/dist/shouldFire.d.ts.map +1 -1
  107. package/dist/shouldFire.js +54 -57
  108. package/dist/types/Increment.d.ts.map +1 -1
  109. package/dist/types/PickingUpItem.d.ts +10 -3
  110. package/dist/types/PickingUpItem.d.ts.map +1 -1
  111. package/dist/types/PickingUpItem.js +10 -3
  112. package/dist/types/PickingUpItem.lua +8 -3
  113. package/package.json +1 -1
  114. package/src/callbackClasses.ts +1 -0
  115. package/src/callbacks.ts +1 -0
  116. package/src/classes/ModUpgraded.ts +2 -2
  117. package/src/classes/callbacks/InputActionFilter.ts +3 -3
  118. package/src/classes/callbacks/InputActionPlayer.ts +6 -6
  119. package/src/classes/callbacks/PostBoneSwing.ts +2 -2
  120. package/src/classes/callbacks/PostCollectibleEmpty.ts +2 -2
  121. package/src/classes/callbacks/PostCursedTeleport.ts +5 -5
  122. package/src/classes/callbacks/PostDiceRoomActivated.ts +2 -2
  123. package/src/classes/callbacks/PostEntityRemoveFilter.ts +22 -0
  124. package/src/classes/callbacks/PostGridEntityCollision.ts +10 -10
  125. package/src/classes/callbacks/PostGridEntityCustomCollision.ts +8 -8
  126. package/src/classes/callbacks/PostGridEntityCustomRemove.ts +2 -2
  127. package/src/classes/callbacks/PostGridEntityRemove.ts +3 -3
  128. package/src/classes/callbacks/PostItemDischarge.ts +2 -2
  129. package/src/classes/callbacks/PostKeyboardChanged.ts +2 -2
  130. package/src/classes/callbacks/PostNewRoomEarly.ts +2 -2
  131. package/src/classes/callbacks/PostPickupSelectionFilter.ts +4 -3
  132. package/src/classes/callbacks/PostPlayerChangeHealth.ts +2 -2
  133. package/src/classes/callbacks/PostPurchase.ts +9 -9
  134. package/src/classes/callbacks/PostUsePillFilter.ts +2 -2
  135. package/src/classes/callbacks/PreBerserkDeath.ts +4 -4
  136. package/src/classes/callbacks/PreEntitySpawnFilter.ts +3 -3
  137. package/src/classes/callbacks/PreRoomEntitySpawnFilter.ts +5 -5
  138. package/src/classes/features/callbackLogic/EsauJrDetection.ts +2 -2
  139. package/src/classes/features/callbackLogic/GameReorderedCallbacks.ts +5 -5
  140. package/src/classes/features/callbackLogic/GridEntityUpdateDetection.ts +4 -4
  141. package/src/classes/features/callbackLogic/ItemPickupDetection.ts +4 -4
  142. package/src/classes/features/callbackLogic/PlayerCollectibleDetection.ts +2 -2
  143. package/src/classes/features/other/CustomTrapdoors.ts +23 -21
  144. package/src/classes/features/other/DeployJSONRoom.ts +4 -4
  145. package/src/classes/features/other/DisableInputs.ts +3 -3
  146. package/src/classes/features/other/ModdedElementSets.ts +2 -2
  147. package/src/classes/features/other/NoSirenSteal.ts +4 -4
  148. package/src/classes/features/other/PickupIndexCreation.ts +5 -5
  149. package/src/classes/features/other/PonyDetection.ts +2 -2
  150. package/src/classes/features/other/PressInput.ts +2 -2
  151. package/src/classes/features/other/PreventChildEntities.ts +4 -4
  152. package/src/classes/features/other/RoomHistory.ts +5 -5
  153. package/src/classes/features/other/SaveDataManager.ts +2 -2
  154. package/src/classes/features/other/StageHistory.ts +2 -2
  155. package/src/classes/features/other/StartAmbush.ts +2 -2
  156. package/src/classes/features/other/TaintedLazarusPlayers.ts +2 -2
  157. package/src/classes/features/other/customStages/gridEntities.ts +4 -4
  158. package/src/classes/features/other/customStages/streakText.ts +4 -4
  159. package/src/classes/features/other/extraConsoleCommands/commands.ts +8 -8
  160. package/src/classes/features/other/saveDataManager/glowingHourGlass.ts +4 -2
  161. package/src/enums/ModCallbackCustom.ts +18 -0
  162. package/src/functions/bosses.ts +2 -2
  163. package/src/functions/charge.ts +2 -2
  164. package/src/functions/collectibles.ts +2 -2
  165. package/src/functions/deepCopy.ts +6 -6
  166. package/src/functions/doors.ts +3 -3
  167. package/src/functions/easing.ts +2 -2
  168. package/src/functions/emptyRoom.ts +5 -5
  169. package/src/functions/entities.ts +8 -8
  170. package/src/functions/familiars.ts +2 -2
  171. package/src/functions/flag.ts +2 -2
  172. package/src/functions/gridEntities.ts +23 -23
  173. package/src/functions/gridEntitiesSpecific.ts +2 -2
  174. package/src/functions/isaacAPIClass.ts +2 -2
  175. package/src/functions/level.ts +3 -3
  176. package/src/functions/levelGrid.ts +6 -6
  177. package/src/functions/logEntities.ts +8 -8
  178. package/src/functions/math.ts +4 -4
  179. package/src/functions/nextStage.ts +10 -10
  180. package/src/functions/npcs.ts +10 -10
  181. package/src/functions/pickupVariants.ts +6 -6
  182. package/src/functions/playerCollectibles.ts +2 -2
  183. package/src/functions/playerHealth.ts +8 -8
  184. package/src/functions/playerIndex.ts +3 -3
  185. package/src/functions/players.ts +4 -4
  186. package/src/functions/pocketItems.ts +2 -2
  187. package/src/functions/revive.ts +15 -15
  188. package/src/functions/roomGrid.ts +2 -2
  189. package/src/functions/rooms.ts +39 -41
  190. package/src/functions/sort.ts +2 -2
  191. package/src/functions/spawnCollectible.ts +3 -3
  192. package/src/functions/stage.ts +16 -16
  193. package/src/functions/string.ts +6 -6
  194. package/src/functions/tears.ts +2 -2
  195. package/src/functions/trinketGive.ts +4 -4
  196. package/src/functions/types.ts +3 -3
  197. package/src/interfaces/private/AddCallbackParametersCustom.ts +7 -0
  198. package/src/lib/jsonLua.js +32 -32
  199. package/src/shouldFire.ts +54 -57
  200. package/src/types/Increment.ts +2 -2
  201. package/src/types/PickingUpItem.ts +10 -3
@@ -30,11 +30,11 @@ function lua_load(a, b) {
30
30
  "Lua parser not available, perhaps you're not using the lua+parser.js version of the library?",
31
31
  );
32
32
  eval(
33
- "fn = function " +
34
- (b || "load") +
35
- "() {\nreturn (function () {\n" +
36
- lua_parser.parse(a) +
37
- "\n})()[0];\n};",
33
+ "fn = function "
34
+ + (b || "load")
35
+ + "() {\nreturn (function () {\n"
36
+ + lua_parser.parse(a)
37
+ + "\n})()[0];\n};",
38
38
  );
39
39
  }
40
40
  function slice(a, b) {
@@ -181,8 +181,8 @@ function lua_eq(a, b) {
181
181
  }
182
182
  function lua_lt(a, b) {
183
183
  if (
184
- ("number" == typeof a && "number" == typeof b) ||
185
- ("string" == typeof a && "string" == typeof b)
184
+ ("number" == typeof a && "number" == typeof b)
185
+ || ("string" == typeof a && "string" == typeof b)
186
186
  )
187
187
  return a < b;
188
188
  var c = a.metatable && a.metatable.str.__lt;
@@ -192,16 +192,16 @@ function lua_lt(a, b) {
192
192
  }
193
193
  function lua_lte(a, b) {
194
194
  if (
195
- ("number" == typeof a && "number" == typeof b) ||
196
- ("string" == typeof a && "string" == typeof b)
195
+ ("number" == typeof a && "number" == typeof b)
196
+ || ("string" == typeof a && "string" == typeof b)
197
197
  )
198
198
  return a <= b;
199
199
  var c = a.metatable && a.metatable.str.__le;
200
200
  if (c && c == (b.metatable && b.metatable.str.__le))
201
201
  return lua_true(lua_rawcall(c, [a, b])[0]);
202
202
  if (
203
- (c = a.metatable && a.metatable.str.__lt) &&
204
- c == (b.metatable && b.metatable.str.__lt)
203
+ (c = a.metatable && a.metatable.str.__lt)
204
+ && c == (b.metatable && b.metatable.str.__lt)
205
205
  )
206
206
  return lua_not(lua_rawcall(c, [b, a])[0]);
207
207
  throw Error("Unable to compare " + a + " and " + b);
@@ -221,8 +221,8 @@ function lua_add(a, b) {
221
221
  if (isNaN(c) || isNaN(d)) {
222
222
  if (
223
223
  (c =
224
- (a.metatable && a.metatable.str.__add) ||
225
- (b.metatable && b.metatable.str.__add))
224
+ (a.metatable && a.metatable.str.__add)
225
+ || (b.metatable && b.metatable.str.__add))
226
226
  )
227
227
  return lua_rawcall(c, [a, b])[0];
228
228
  throw Error("Adding <" + a + "> and <" + b + "> not supported");
@@ -235,8 +235,8 @@ function lua_subtract(a, b) {
235
235
  if (isNaN(c) || isNaN(d)) {
236
236
  if (
237
237
  (c =
238
- (a.metatable && a.metatable.str.__sub) ||
239
- (b.metatable && b.metatable.str.__sub))
238
+ (a.metatable && a.metatable.str.__sub)
239
+ || (b.metatable && b.metatable.str.__sub))
240
240
  )
241
241
  return lua_rawcall(c, [a, b])[0];
242
242
  throw Error("Subtracting <" + a + "> and <" + b + "> not supported");
@@ -249,8 +249,8 @@ function lua_divide(a, b) {
249
249
  if (isNaN(c) || isNaN(d)) {
250
250
  if (
251
251
  (c =
252
- (a.metatable && a.metatable.str.__div) ||
253
- (b.metatable && b.metatable.str.__div))
252
+ (a.metatable && a.metatable.str.__div)
253
+ || (b.metatable && b.metatable.str.__div))
254
254
  )
255
255
  return lua_rawcall(c, [a, b])[0];
256
256
  throw Error("Dividing <" + a + "> and <" + b + "> not supported");
@@ -263,8 +263,8 @@ function lua_multiply(a, b) {
263
263
  if (isNaN(c) || isNaN(d)) {
264
264
  if (
265
265
  (c =
266
- (a.metatable && a.metatable.str.__mul) ||
267
- (b.metatable && b.metatable.str.__mul))
266
+ (a.metatable && a.metatable.str.__mul)
267
+ || (b.metatable && b.metatable.str.__mul))
268
268
  )
269
269
  return lua_rawcall(c, [a, b])[0];
270
270
  throw Error("Multiplying <" + a + "> and <" + b + "> not supported");
@@ -277,8 +277,8 @@ function lua_power(a, b) {
277
277
  if (isNaN(c) || isNaN(d)) {
278
278
  if (
279
279
  (c =
280
- (a.metatable && a.metatable.str.__pow) ||
281
- (b.metatable && b.metatable.str.__pow))
280
+ (a.metatable && a.metatable.str.__pow)
281
+ || (b.metatable && b.metatable.str.__pow))
282
282
  )
283
283
  return lua_rawcall(c, [a, b])[0];
284
284
  throw Error("<" + a + "> to the power of <" + b + "> not supported");
@@ -291,8 +291,8 @@ function lua_mod(a, b) {
291
291
  if (isNaN(c) || isNaN(d)) {
292
292
  if (
293
293
  (c =
294
- (a.metatable && a.metatable.str.__mod) ||
295
- (b.metatable && b.metatable.str.__mod))
294
+ (a.metatable && a.metatable.str.__mod)
295
+ || (b.metatable && b.metatable.str.__mod))
296
296
  )
297
297
  return lua_rawcall(c, [a, b])[0];
298
298
  throw Error("Modulo <" + a + "> and <" + b + "> not supported");
@@ -393,13 +393,13 @@ function lua_concat(a, b) {
393
393
  if ("number" == typeof a && "number" == typeof b)
394
394
  throw Error("number concat not supported yet");
395
395
  if (
396
- ("string" == typeof a || "number" == typeof a) &&
397
- ("string" == typeof b || "number" == typeof b)
396
+ ("string" == typeof a || "number" == typeof a)
397
+ && ("string" == typeof b || "number" == typeof b)
398
398
  )
399
399
  return a + b;
400
400
  var c =
401
- (a.metatable && a.metatable.str.__concat) ||
402
- (b.metatable && b.metatable.str.__concat);
401
+ (a.metatable && a.metatable.str.__concat)
402
+ || (b.metatable && b.metatable.str.__concat);
403
403
  if (c) return lua_rawcall(c, [a, b])[0];
404
404
  throw Error("Unable to concat " + a + " and " + b);
405
405
  }
@@ -1075,8 +1075,8 @@ var lua_script = (function () {
1075
1075
  }
1076
1076
  lua_tableset(_stack, _val, true);
1077
1077
  if (
1078
- !lua_eq(lua_call(G.str["rawget"], [_val, 1])[0], null) ||
1079
- lua_eq(lua_call(G.str["next"], [_val])[0], null)
1078
+ !lua_eq(lua_call(G.str["rawget"], [_val, 1])[0], null)
1079
+ || lua_eq(lua_call(G.str["next"], [_val])[0], null)
1080
1080
  ) {
1081
1081
  var _n_8 = 0;
1082
1082
  tmp = lua_call(G.str["pairs"], [_val]);
@@ -1214,9 +1214,9 @@ var lua_script = (function () {
1214
1214
  var _encode_number_1 = function (_val) {
1215
1215
  var tmp;
1216
1216
  if (
1217
- !lua_eq(_val, _val) ||
1218
- lua_lte(_val, lua_unm(lua_tableget(G.str["math"], "huge"))) ||
1219
- lua_lte(lua_tableget(G.str["math"], "huge"), _val)
1217
+ !lua_eq(_val, _val)
1218
+ || lua_lte(_val, lua_unm(lua_tableget(G.str["math"], "huge")))
1219
+ || lua_lte(lua_tableget(G.str["math"], "huge"), _val)
1220
1220
  ) {
1221
1221
  lua_call(G.str["error"], [
1222
1222
  lua_concat(
package/src/shouldFire.ts CHANGED
@@ -68,9 +68,8 @@ export function shouldFireBomb(
68
68
  const [callbackBombVariant, callbackSubType] = optionalArgs;
69
69
 
70
70
  return (
71
- (callbackBombVariant === undefined ||
72
- callbackBombVariant === bomb.Variant) &&
73
- (callbackSubType === undefined || callbackSubType === bomb.SubType)
71
+ (callbackBombVariant === undefined || callbackBombVariant === bomb.Variant)
72
+ && (callbackSubType === undefined || callbackSubType === bomb.SubType)
74
73
  );
75
74
  }
76
75
 
@@ -92,8 +91,8 @@ export function shouldFireCollectibleType(
92
91
  const [callbackCollectibleType] = optionalArgs;
93
92
 
94
93
  return (
95
- callbackCollectibleType === undefined ||
96
- callbackCollectibleType === collectibleType
94
+ callbackCollectibleType === undefined
95
+ || callbackCollectibleType === collectibleType
97
96
  );
98
97
  }
99
98
 
@@ -122,9 +121,9 @@ export function shouldFireEffect(
122
121
  const [callbackEffectVariant, callbackSubType] = optionalArgs;
123
122
 
124
123
  return (
125
- (callbackEffectVariant === undefined ||
126
- callbackEffectVariant === effect.Variant) &&
127
- (callbackSubType === undefined || callbackSubType === effect.SubType)
124
+ (callbackEffectVariant === undefined
125
+ || callbackEffectVariant === effect.Variant)
126
+ && (callbackSubType === undefined || callbackSubType === effect.SubType)
128
127
  );
129
128
  }
130
129
 
@@ -144,9 +143,9 @@ export function shouldFireEntity(
144
143
  const [callbackEntityType, callbackVariant, callbackSubType] = optionalArgs;
145
144
 
146
145
  return (
147
- (callbackEntityType === undefined || callbackEntityType === entity.Type) &&
148
- (callbackVariant === undefined || callbackVariant === entity.Variant) &&
149
- (callbackSubType === undefined || callbackSubType === entity.SubType)
146
+ (callbackEntityType === undefined || callbackEntityType === entity.Type)
147
+ && (callbackVariant === undefined || callbackVariant === entity.Variant)
148
+ && (callbackSubType === undefined || callbackSubType === entity.SubType)
150
149
  );
151
150
  }
152
151
 
@@ -162,9 +161,9 @@ export function shouldFireFamiliar(
162
161
  const [callbackFamiliarVariant, callbackSubType] = optionalArgs;
163
162
 
164
163
  return (
165
- (callbackFamiliarVariant === undefined ||
166
- callbackFamiliarVariant === familiar.Variant) &&
167
- (callbackSubType === undefined || callbackSubType === familiar.SubType)
164
+ (callbackFamiliarVariant === undefined
165
+ || callbackFamiliarVariant === familiar.Variant)
166
+ && (callbackSubType === undefined || callbackSubType === familiar.SubType)
168
167
  );
169
168
  }
170
169
 
@@ -181,9 +180,9 @@ export function shouldFireGridEntity(
181
180
  const variant = gridEntity.GetVariant();
182
181
 
183
182
  return (
184
- (callbackGridEntityType === undefined ||
185
- callbackGridEntityType === gridEntityType) &&
186
- (callbackVariant === undefined || callbackVariant === variant)
183
+ (callbackGridEntityType === undefined
184
+ || callbackGridEntityType === gridEntityType)
185
+ && (callbackVariant === undefined || callbackVariant === variant)
187
186
  );
188
187
  }
189
188
 
@@ -202,8 +201,8 @@ export function shouldFireGridEntityCustom(
202
201
  const [callbackGridEntityTypeCustom] = optionalArgs;
203
202
 
204
203
  return (
205
- callbackGridEntityTypeCustom === undefined ||
206
- callbackGridEntityTypeCustom === gridEntityTypeCustom
204
+ callbackGridEntityTypeCustom === undefined
205
+ || callbackGridEntityTypeCustom === gridEntityTypeCustom
207
206
  );
208
207
  }
209
208
 
@@ -215,10 +214,11 @@ export function shouldFireItemPickup(
215
214
  const [callbackItemType, callbackSubtype] = optionalArgs;
216
215
 
217
216
  return (
218
- (callbackItemType === undefined ||
219
- callbackItemType === pickingUpItem.itemType) &&
220
- // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
221
- (callbackSubtype === undefined || callbackSubtype === pickingUpItem.subType)
217
+ (callbackItemType === undefined
218
+ || callbackItemType === pickingUpItem.itemType)
219
+ && (callbackSubtype === undefined
220
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
221
+ || callbackSubtype === pickingUpItem.subType)
222
222
  );
223
223
  }
224
224
 
@@ -233,9 +233,9 @@ export function shouldFireKnife(
233
233
  const [callbackKnifeVariant, callbackSubType] = optionalArgs;
234
234
 
235
235
  return (
236
- (callbackKnifeVariant === undefined ||
237
- callbackKnifeVariant === knife.Variant) &&
238
- (callbackSubType === undefined || callbackSubType === knife.SubType)
236
+ (callbackKnifeVariant === undefined
237
+ || callbackKnifeVariant === knife.Variant)
238
+ && (callbackSubType === undefined || callbackSubType === knife.SubType)
239
239
  );
240
240
  }
241
241
 
@@ -247,9 +247,9 @@ export function shouldFireLaser(
247
247
  const [callbackLaserVariant, callbackSubType] = optionalArgs;
248
248
 
249
249
  return (
250
- (callbackLaserVariant === undefined ||
251
- callbackLaserVariant === laser.Variant) &&
252
- (callbackSubType === undefined || callbackSubType === laser.SubType)
250
+ (callbackLaserVariant === undefined
251
+ || callbackLaserVariant === laser.Variant)
252
+ && (callbackSubType === undefined || callbackSubType === laser.SubType)
253
253
  );
254
254
  }
255
255
 
@@ -261,8 +261,8 @@ export function shouldFireLevel(
261
261
  const [callbackStage, callbackStageType] = optionalArgs;
262
262
 
263
263
  return (
264
- (callbackStage === undefined || callbackStage === stage) &&
265
- (callbackStageType === undefined || callbackStageType === stageType)
264
+ (callbackStage === undefined || callbackStage === stage)
265
+ && (callbackStageType === undefined || callbackStageType === stageType)
266
266
  );
267
267
  }
268
268
 
@@ -278,9 +278,9 @@ export function shouldFireNPC(
278
278
  const [callbackEntityType, callbackVariant, callbackSubType] = optionalArgs;
279
279
 
280
280
  return (
281
- (callbackEntityType === undefined || callbackEntityType === npc.Type) &&
282
- (callbackVariant === undefined || callbackVariant === npc.Variant) &&
283
- (callbackSubType === undefined || callbackSubType === npc.SubType)
281
+ (callbackEntityType === undefined || callbackEntityType === npc.Type)
282
+ && (callbackVariant === undefined || callbackVariant === npc.Variant)
283
+ && (callbackSubType === undefined || callbackSubType === npc.SubType)
284
284
  );
285
285
  }
286
286
 
@@ -303,10 +303,10 @@ export function shouldFirePickup(
303
303
  const [callbackPickupVariant, callbackPickupSubType] = optionalArgs;
304
304
 
305
305
  return (
306
- (callbackPickupVariant === undefined ||
307
- callbackPickupVariant === pickup.Variant) &&
308
- (callbackPickupSubType === undefined ||
309
- callbackPickupSubType === pickup.SubType)
306
+ (callbackPickupVariant === undefined
307
+ || callbackPickupVariant === pickup.Variant)
308
+ && (callbackPickupSubType === undefined
309
+ || callbackPickupSubType === pickup.SubType)
310
310
  );
311
311
  }
312
312
 
@@ -358,9 +358,9 @@ export function shouldFirePlayer(
358
358
  const character = player.GetPlayerType();
359
359
 
360
360
  return (
361
- (callbackPlayerVariant === undefined ||
362
- callbackPlayerVariant === player.Variant) &&
363
- (callbackCharacter === undefined || callbackCharacter === character)
361
+ (callbackPlayerVariant === undefined
362
+ || callbackPlayerVariant === player.Variant)
363
+ && (callbackCharacter === undefined || callbackCharacter === character)
364
364
  );
365
365
  }
366
366
 
@@ -374,8 +374,8 @@ export function shouldFirePoop(
374
374
  const poopGridEntityVariant = poop.GetVariant();
375
375
 
376
376
  return (
377
- callbackPoopGridEntityVariant === undefined ||
378
- callbackPoopGridEntityVariant === poopGridEntityVariant
377
+ callbackPoopGridEntityVariant === undefined
378
+ || callbackPoopGridEntityVariant === poopGridEntityVariant
379
379
  );
380
380
  }
381
381
 
@@ -389,8 +389,8 @@ export function shouldFirePressurePlate(
389
389
  const pressurePlateVariant = pressurePlate.GetVariant();
390
390
 
391
391
  return (
392
- callbackPressurePlateVariant === undefined ||
393
- callbackPressurePlateVariant === pressurePlateVariant
392
+ callbackPressurePlateVariant === undefined
393
+ || callbackPressurePlateVariant === pressurePlateVariant
394
394
  );
395
395
  }
396
396
 
@@ -405,9 +405,9 @@ export function shouldFireProjectile(
405
405
  const [callbackProjectileVariant, callbackSubType] = optionalArgs;
406
406
 
407
407
  return (
408
- (callbackProjectileVariant === undefined ||
409
- callbackProjectileVariant === projectile.Variant) &&
410
- (callbackSubType === undefined || callbackSubType === projectile.SubType)
408
+ (callbackProjectileVariant === undefined
409
+ || callbackProjectileVariant === projectile.Variant)
410
+ && (callbackSubType === undefined || callbackSubType === projectile.SubType)
411
411
  );
412
412
  }
413
413
 
@@ -422,9 +422,8 @@ export function shouldFireRock(
422
422
  const variant = rock.GetVariant();
423
423
 
424
424
  return (
425
- (callbackGridEntity === undefined ||
426
- callbackGridEntity === gridEntityType) &&
427
- (callbackVariant === undefined || callbackVariant === variant)
425
+ (callbackGridEntity === undefined || callbackGridEntity === gridEntityType)
426
+ && (callbackVariant === undefined || callbackVariant === variant)
428
427
  );
429
428
  }
430
429
 
@@ -450,9 +449,8 @@ export function shouldFireSlot(
450
449
  const [callbackSlotVariant, callbackSubType] = optionalArgs;
451
450
 
452
451
  return (
453
- (callbackSlotVariant === undefined ||
454
- callbackSlotVariant === slot.Variant) &&
455
- (callbackSubType === undefined || callbackSubType === slot.SubType)
452
+ (callbackSlotVariant === undefined || callbackSlotVariant === slot.Variant)
453
+ && (callbackSubType === undefined || callbackSubType === slot.SubType)
456
454
  );
457
455
  }
458
456
 
@@ -491,9 +489,8 @@ export function shouldFireTear(
491
489
  const [callbackTearVariant, callbackSubType] = optionalArgs;
492
490
 
493
491
  return (
494
- (callbackTearVariant === undefined ||
495
- callbackTearVariant === tear.Variant) &&
496
- (callbackSubType === undefined || callbackSubType === tear.SubType)
492
+ (callbackTearVariant === undefined || callbackTearVariant === tear.Variant)
493
+ && (callbackSubType === undefined || callbackSubType === tear.SubType)
497
494
  );
498
495
  }
499
496
 
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * From: https://stackoverflow.com/questions/54243431/typescript-increment-number-type
5
5
  */
6
- export type Increment<N extends number> = [...Arr<N>, unknown]["length"] &
7
- number;
6
+ export type Increment<N extends number> = [...Arr<N>, unknown]["length"]
7
+ & number;
8
8
 
9
9
  type Arr<N extends number, T extends unknown[] = []> = T["length"] extends N
10
10
  ? T
@@ -50,6 +50,7 @@ export function newPickingUpItem(): PickingUpItem {
50
50
  };
51
51
  }
52
52
 
53
+ /** Helper function to reset a `PickupUpItem` object to all 0 values. */
53
54
  export function resetPickingUpItem(pickingUpItem: PickingUpItem): void {
54
55
  pickingUpItem.itemType = DEFAULT_ITEM_TYPE;
55
56
  pickingUpItem.subType = DEFAULT_SUB_TYPE;
@@ -61,21 +62,27 @@ const COLLECTIBLE_ITEM_TYPES = new ReadonlySet<ItemType>([
61
62
  ItemType.FAMILIAR, // 4
62
63
  ]);
63
64
 
64
- /** Helper function to narrow the type of `PickingUpItem`. */
65
+ /** Helper function to narrow the type of `PickingUpItem` to `ItemType.NULL` (0). */
65
66
  export function isPickingUpItemNull(
66
67
  pickingUpItem: PickingUpItem,
67
68
  ): pickingUpItem is PickingUpItemTrinket {
68
69
  return pickingUpItem.itemType === ItemType.NULL;
69
70
  }
70
71
 
71
- /** Helper function to narrow the type of `PickingUpItem`. */
72
+ /**
73
+ * Helper function to narrow the type of `PickingUpItem` to one of the following:
74
+ *
75
+ * - `ItemType.PASSIVE` (1)
76
+ * - `ItemType.ACTIVE` (3)
77
+ * - `ItemType.FAMILIAR` (4)
78
+ */
72
79
  export function isPickingUpItemCollectible(
73
80
  pickingUpItem: PickingUpItem,
74
81
  ): pickingUpItem is PickingUpItemCollectible {
75
82
  return COLLECTIBLE_ITEM_TYPES.has(pickingUpItem.itemType);
76
83
  }
77
84
 
78
- /** Helper function to narrow the type of `PickingUpItem`. */
85
+ /** Helper function to narrow the type of `PickingUpItem` to `ItemType.TRINKET` (2). */
79
86
  export function isPickingUpItemTrinket(
80
87
  pickingUpItem: PickingUpItem,
81
88
  ): pickingUpItem is PickingUpItemTrinket {