isaacscript-common 6.6.3 → 6.7.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 (262) hide show
  1. package/dist/callbacks/customRevive.lua +4 -4
  2. package/dist/callbacks/postCursedTeleport.lua +2 -2
  3. package/dist/callbacks/postCustomDoorEnter.d.ts +1 -1
  4. package/dist/callbacks/postCustomDoorEnter.lua +6 -6
  5. package/dist/callbacks/postDiceRoomActivated.lua +2 -2
  6. package/dist/callbacks/postFlip.lua +3 -3
  7. package/dist/callbacks/postGridEntity.lua +3 -3
  8. package/dist/callbacks/postGridEntityCollision.lua +3 -3
  9. package/dist/callbacks/postGridEntityRender.lua +2 -2
  10. package/dist/callbacks/postNewRoomEarly.lua +5 -5
  11. package/dist/callbacks/postPickupCollect.lua +2 -2
  12. package/dist/callbacks/postPitRender.lua +2 -2
  13. package/dist/callbacks/postPitUpdate.lua +2 -2
  14. package/dist/callbacks/postPlayerCollectible.lua +2 -2
  15. package/dist/callbacks/postPoopRender.lua +2 -2
  16. package/dist/callbacks/postPoopUpdate.lua +2 -2
  17. package/dist/callbacks/postPressurePlateRender.lua +2 -2
  18. package/dist/callbacks/postPressurePlateUpdate.lua +2 -2
  19. package/dist/callbacks/postPurchase.lua +2 -2
  20. package/dist/callbacks/postRockRender.lua +2 -2
  21. package/dist/callbacks/postRockUpdate.lua +2 -2
  22. package/dist/callbacks/postSlotInitUpdate.lua +2 -2
  23. package/dist/callbacks/postSlotRender.lua +2 -2
  24. package/dist/callbacks/postSpikesRender.lua +2 -2
  25. package/dist/callbacks/postSpikesUpdate.lua +2 -2
  26. package/dist/callbacks/postTNTRender.lua +2 -2
  27. package/dist/callbacks/postTNTUpdate.lua +2 -2
  28. package/dist/callbacks/preBerserkDeath.lua +2 -2
  29. package/dist/callbacks/preNewLevel.lua +2 -2
  30. package/dist/callbacks/subscriptions/postDoorRender.d.ts +2 -3
  31. package/dist/callbacks/subscriptions/postDoorRender.d.ts.map +1 -1
  32. package/dist/callbacks/subscriptions/postDoorRender.lua +3 -3
  33. package/dist/callbacks/subscriptions/postDoorUpdate.d.ts +2 -3
  34. package/dist/callbacks/subscriptions/postDoorUpdate.d.ts.map +1 -1
  35. package/dist/callbacks/subscriptions/postDoorUpdate.lua +3 -3
  36. package/dist/callbacks/subscriptions/postPitRender.d.ts +2 -3
  37. package/dist/callbacks/subscriptions/postPitRender.d.ts.map +1 -1
  38. package/dist/callbacks/subscriptions/postPitRender.lua +3 -3
  39. package/dist/callbacks/subscriptions/postPitUpdate.d.ts +2 -3
  40. package/dist/callbacks/subscriptions/postPitUpdate.d.ts.map +1 -1
  41. package/dist/callbacks/subscriptions/postPitUpdate.lua +3 -3
  42. package/dist/callbacks/subscriptions/postPoopRender.d.ts +2 -3
  43. package/dist/callbacks/subscriptions/postPoopRender.d.ts.map +1 -1
  44. package/dist/callbacks/subscriptions/postPoopRender.lua +3 -3
  45. package/dist/callbacks/subscriptions/postPoopUpdate.d.ts +2 -3
  46. package/dist/callbacks/subscriptions/postPoopUpdate.d.ts.map +1 -1
  47. package/dist/callbacks/subscriptions/postPoopUpdate.lua +3 -3
  48. package/dist/callbacks/subscriptions/postPressurePlateRender.d.ts +2 -3
  49. package/dist/callbacks/subscriptions/postPressurePlateRender.d.ts.map +1 -1
  50. package/dist/callbacks/subscriptions/postPressurePlateRender.lua +3 -3
  51. package/dist/callbacks/subscriptions/postPressurePlateUpdate.d.ts +2 -3
  52. package/dist/callbacks/subscriptions/postPressurePlateUpdate.d.ts.map +1 -1
  53. package/dist/callbacks/subscriptions/postPressurePlateUpdate.lua +3 -3
  54. package/dist/enums/private/SerializationBrand.d.ts +0 -4
  55. package/dist/enums/private/SerializationBrand.d.ts.map +1 -1
  56. package/dist/features/characterStats.lua +2 -2
  57. package/dist/features/collectibleItemPoolType.lua +2 -2
  58. package/dist/features/customGridEntity.d.ts.map +1 -1
  59. package/dist/features/customGridEntity.lua +5 -5
  60. package/dist/features/customStage/backdrop.lua +2 -2
  61. package/dist/features/customStage/{gridEntities.d.ts → customStageGridEntities.d.ts} +1 -1
  62. package/dist/features/customStage/customStageGridEntities.d.ts.map +1 -0
  63. package/dist/features/customStage/{gridEntities.lua → customStageGridEntities.lua} +8 -8
  64. package/dist/features/customStage/{util.d.ts → customStageUtils.d.ts} +1 -1
  65. package/dist/features/customStage/customStageUtils.d.ts.map +1 -0
  66. package/dist/features/customStage/{util.lua → customStageUtils.lua} +0 -0
  67. package/dist/features/customStage/exports.lua +4 -4
  68. package/dist/features/customStage/init.lua +6 -6
  69. package/dist/features/customStage/shadows.lua +2 -2
  70. package/dist/features/customStage/versusScreen.lua +4 -4
  71. package/dist/features/debugDisplay/v.lua +4 -4
  72. package/dist/features/deployJSONRoom.lua +20 -20
  73. package/dist/features/extraConsoleCommands/commandsSubroutines.lua +3 -3
  74. package/dist/features/extraConsoleCommands/listCommands.d.ts.map +1 -1
  75. package/dist/features/extraConsoleCommands/listCommands.lua +14 -14
  76. package/dist/features/pause.lua +2 -2
  77. package/dist/features/persistentEntities.lua +2 -2
  78. package/dist/features/preventCollectibleRotation.lua +2 -2
  79. package/dist/features/saveDataManager/exports.d.ts.map +1 -1
  80. package/dist/features/saveDataManager/merge.lua +4 -3
  81. package/dist/features/sirenHelpers.lua +2 -2
  82. package/dist/functions/ambush.lua +5 -5
  83. package/dist/functions/array.d.ts.map +1 -1
  84. package/dist/functions/array.lua +1 -1
  85. package/dist/functions/{boss.d.ts → bosses.d.ts} +22 -4
  86. package/dist/functions/bosses.d.ts.map +1 -0
  87. package/dist/functions/{boss.lua → bosses.lua} +38 -13
  88. package/dist/functions/collectibleTag.lua +2 -2
  89. package/dist/functions/collectibles.lua +5 -5
  90. package/dist/functions/deepCopy.d.ts +8 -5
  91. package/dist/functions/deepCopy.d.ts.map +1 -1
  92. package/dist/functions/deepCopy.lua +142 -38
  93. package/dist/functions/deepCopyTests.d.ts +6 -1
  94. package/dist/functions/deepCopyTests.d.ts.map +1 -1
  95. package/dist/functions/deepCopyTests.lua +19 -16
  96. package/dist/functions/{entity.d.ts → entities.d.ts} +21 -19
  97. package/dist/functions/entities.d.ts.map +1 -0
  98. package/dist/functions/{entity.lua → entities.lua} +25 -20
  99. package/dist/functions/{entitySpecific.d.ts → entitiesSpecific.d.ts} +145 -68
  100. package/dist/functions/entitiesSpecific.d.ts.map +1 -0
  101. package/dist/functions/{entitySpecific.lua → entitiesSpecific.lua} +203 -65
  102. package/dist/functions/familiars.lua +2 -2
  103. package/dist/functions/{gridEntity.d.ts → gridEntities.d.ts} +48 -17
  104. package/dist/functions/gridEntities.d.ts.map +1 -0
  105. package/dist/functions/{gridEntity.lua → gridEntities.lua} +140 -90
  106. package/dist/functions/gridEntitiesSpecific.d.ts +141 -0
  107. package/dist/functions/gridEntitiesSpecific.d.ts.map +1 -0
  108. package/dist/functions/gridEntitiesSpecific.lua +366 -0
  109. package/dist/functions/log.d.ts +1 -1
  110. package/dist/functions/log.d.ts.map +1 -1
  111. package/dist/functions/log.lua +16 -12
  112. package/dist/functions/mergeTests.d.ts +7 -1
  113. package/dist/functions/mergeTests.d.ts.map +1 -1
  114. package/dist/functions/mergeTests.lua +86 -7
  115. package/dist/functions/{npc.d.ts → npcs.d.ts} +24 -2
  116. package/dist/functions/npcs.d.ts.map +1 -0
  117. package/dist/functions/{npc.lua → npcs.lua} +44 -9
  118. package/dist/functions/pickups.d.ts +4 -119
  119. package/dist/functions/pickups.d.ts.map +1 -1
  120. package/dist/functions/pickups.lua +10 -439
  121. package/dist/functions/pickupsSpecific.d.ts +229 -0
  122. package/dist/functions/pickupsSpecific.d.ts.map +1 -0
  123. package/dist/functions/pickupsSpecific.lua +560 -0
  124. package/dist/functions/playerHealth.lua +6 -6
  125. package/dist/functions/{player.d.ts → players.d.ts} +1 -1
  126. package/dist/functions/players.d.ts.map +1 -0
  127. package/dist/functions/{player.lua → players.lua} +0 -0
  128. package/dist/functions/pocketItems.lua +2 -2
  129. package/dist/functions/positionVelocity.lua +6 -6
  130. package/dist/functions/pressurePlate.d.ts +10 -0
  131. package/dist/functions/pressurePlate.d.ts.map +1 -0
  132. package/dist/functions/pressurePlate.lua +29 -0
  133. package/dist/functions/revive.lua +7 -7
  134. package/dist/functions/rooms.lua +2 -2
  135. package/dist/functions/saveFile.lua +3 -3
  136. package/dist/functions/spawnCollectible.lua +4 -4
  137. package/dist/functions/{sprite.d.ts → sprites.d.ts} +1 -1
  138. package/dist/functions/sprites.d.ts.map +1 -0
  139. package/dist/functions/{sprite.lua → sprites.lua} +0 -0
  140. package/dist/functions/table.d.ts +1 -1
  141. package/dist/functions/table.lua +1 -1
  142. package/dist/functions/transformations.lua +2 -2
  143. package/dist/functions/trinketGive.lua +2 -2
  144. package/dist/functions/trinkets.lua +6 -6
  145. package/dist/functions/utils.d.ts +7 -0
  146. package/dist/functions/utils.d.ts.map +1 -1
  147. package/dist/functions/utils.lua +35 -22
  148. package/dist/index.d.ts +10 -8
  149. package/dist/index.d.ts.map +1 -1
  150. package/dist/index.lua +26 -10
  151. package/dist/types/AnyGridEntity.d.ts +10 -0
  152. package/dist/types/AnyGridEntity.d.ts.map +1 -0
  153. package/dist/types/AnyGridEntity.lua +2 -0
  154. package/package.json +2 -2
  155. package/src/callbacks/customRevive.ts +2 -2
  156. package/src/callbacks/postCursedTeleport.ts +2 -2
  157. package/src/callbacks/postCustomDoorEnter.ts +3 -3
  158. package/src/callbacks/postDiceRoomActivated.ts +1 -1
  159. package/src/callbacks/postFlip.ts +1 -1
  160. package/src/callbacks/postGridEntity.ts +1 -1
  161. package/src/callbacks/postGridEntityCollision.ts +1 -1
  162. package/src/callbacks/postGridEntityRender.ts +1 -1
  163. package/src/callbacks/postNewRoomEarly.ts +9 -3
  164. package/src/callbacks/postPickupCollect.ts +1 -1
  165. package/src/callbacks/postPitRender.ts +1 -1
  166. package/src/callbacks/postPitUpdate.ts +1 -1
  167. package/src/callbacks/postPlayerCollectible.ts +2 -2
  168. package/src/callbacks/postPoopRender.ts +1 -1
  169. package/src/callbacks/postPoopUpdate.ts +1 -1
  170. package/src/callbacks/postPressurePlateRender.ts +1 -1
  171. package/src/callbacks/postPressurePlateUpdate.ts +1 -1
  172. package/src/callbacks/postPurchase.ts +1 -1
  173. package/src/callbacks/postRockRender.ts +1 -1
  174. package/src/callbacks/postRockUpdate.ts +1 -1
  175. package/src/callbacks/postSacrifice.ts +1 -1
  176. package/src/callbacks/postSlotInitUpdate.ts +1 -1
  177. package/src/callbacks/postSlotRender.ts +1 -1
  178. package/src/callbacks/postSpikesRender.ts +1 -1
  179. package/src/callbacks/postSpikesUpdate.ts +1 -1
  180. package/src/callbacks/postTNTRender.ts +1 -1
  181. package/src/callbacks/postTNTUpdate.ts +1 -1
  182. package/src/callbacks/preBerserkDeath.ts +1 -1
  183. package/src/callbacks/preNewLevel.ts +1 -1
  184. package/src/callbacks/subscriptions/postDoorRender.ts +7 -5
  185. package/src/callbacks/subscriptions/postDoorUpdate.ts +7 -5
  186. package/src/callbacks/subscriptions/postPitRender.ts +6 -7
  187. package/src/callbacks/subscriptions/postPitUpdate.ts +6 -7
  188. package/src/callbacks/subscriptions/postPoopRender.ts +7 -5
  189. package/src/callbacks/subscriptions/postPoopUpdate.ts +7 -5
  190. package/src/callbacks/subscriptions/postPressurePlateRender.ts +7 -5
  191. package/src/callbacks/subscriptions/postPressurePlateUpdate.ts +7 -5
  192. package/src/enums/private/SerializationBrand.ts +0 -4
  193. package/src/features/characterStats.ts +1 -1
  194. package/src/features/collectibleItemPoolType.ts +1 -1
  195. package/src/features/customGridEntity.ts +6 -3
  196. package/src/features/customStage/backdrop.ts +1 -1
  197. package/src/features/customStage/{gridEntities.ts → customStageGridEntities.ts} +3 -3
  198. package/src/features/customStage/{util.ts → customStageUtils.ts} +0 -0
  199. package/src/features/customStage/exports.ts +2 -2
  200. package/src/features/customStage/init.ts +1 -1
  201. package/src/features/customStage/shadows.ts +1 -1
  202. package/src/features/customStage/versusScreen.ts +2 -2
  203. package/src/features/debugDisplay/v.ts +2 -2
  204. package/src/features/deployJSONRoom.ts +11 -7
  205. package/src/features/extraConsoleCommands/commandsSubroutines.ts +2 -2
  206. package/src/features/extraConsoleCommands/listCommands.ts +13 -9
  207. package/src/features/pause.ts +1 -1
  208. package/src/features/persistentEntities.ts +2 -2
  209. package/src/features/preventCollectibleRotation.ts +1 -1
  210. package/src/features/saveDataManager/exports.ts +7 -4
  211. package/src/features/saveDataManager/merge.ts +3 -3
  212. package/src/features/sirenHelpers.ts +1 -1
  213. package/src/functions/ambush.ts +2 -2
  214. package/src/functions/array.ts +5 -2
  215. package/src/functions/bitwise.ts +2 -2
  216. package/src/functions/{boss.ts → bosses.ts} +29 -21
  217. package/src/functions/collectibleTag.ts +1 -1
  218. package/src/functions/collectibles.ts +2 -2
  219. package/src/functions/deepCopy.ts +98 -19
  220. package/src/functions/deepCopyTests.ts +75 -19
  221. package/src/functions/{entity.ts → entities.ts} +23 -21
  222. package/src/functions/{entitySpecific.ts → entitiesSpecific.ts} +170 -99
  223. package/src/functions/familiars.ts +1 -1
  224. package/src/functions/{gridEntity.ts → gridEntities.ts} +110 -34
  225. package/src/functions/gridEntitiesSpecific.ts +490 -0
  226. package/src/functions/log.ts +19 -10
  227. package/src/functions/mergeTests.ts +152 -4
  228. package/src/functions/{npc.ts → npcs.ts} +42 -11
  229. package/src/functions/pickups.ts +8 -475
  230. package/src/functions/pickupsSpecific.ts +613 -0
  231. package/src/functions/playerHealth.ts +1 -1
  232. package/src/functions/{player.ts → players.ts} +0 -0
  233. package/src/functions/pocketItems.ts +1 -1
  234. package/src/functions/positionVelocity.ts +3 -3
  235. package/src/functions/pressurePlate.ts +29 -0
  236. package/src/functions/revive.ts +2 -2
  237. package/src/functions/rooms.ts +1 -1
  238. package/src/functions/saveFile.ts +1 -1
  239. package/src/functions/spawnCollectible.ts +2 -2
  240. package/src/functions/{sprite.ts → sprites.ts} +0 -0
  241. package/src/functions/table.ts +1 -1
  242. package/src/functions/transformations.ts +1 -1
  243. package/src/functions/trinketGive.ts +4 -4
  244. package/src/functions/trinkets.ts +3 -3
  245. package/src/functions/tstlClass.ts +1 -1
  246. package/src/functions/ui.ts +3 -3
  247. package/src/functions/utils.ts +32 -13
  248. package/src/index.ts +10 -8
  249. package/src/types/AnyGridEntity.ts +9 -0
  250. package/dist/features/customStage/gridEntities.d.ts.map +0 -1
  251. package/dist/features/customStage/util.d.ts.map +0 -1
  252. package/dist/functions/boss.d.ts.map +0 -1
  253. package/dist/functions/entity.d.ts.map +0 -1
  254. package/dist/functions/entitySpecific.d.ts.map +0 -1
  255. package/dist/functions/gridEntity.d.ts.map +0 -1
  256. package/dist/functions/gridEntitySpecific.d.ts +0 -29
  257. package/dist/functions/gridEntitySpecific.d.ts.map +0 -1
  258. package/dist/functions/gridEntitySpecific.lua +0 -114
  259. package/dist/functions/npc.d.ts.map +0 -1
  260. package/dist/functions/player.d.ts.map +0 -1
  261. package/dist/functions/sprite.d.ts.map +0 -1
  262. package/src/functions/gridEntitySpecific.ts +0 -143
@@ -27,7 +27,7 @@ local isString = ____types.isString
27
27
  local isTable = ____types.isTable
28
28
  function copiedObjectIsTable(self)
29
29
  local oldObject = {abc = "def"}
30
- local newObject = deepCopy(nil, oldObject)
30
+ local newObject = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectIsTable")
31
31
  if not isTable(nil, newObject) then
32
32
  error("The copied object had a type of: " .. __TS__TypeOf(newObject))
33
33
  end
@@ -36,7 +36,7 @@ function copiedObjectHasKeyAndValueString(self)
36
36
  local keyToLookFor = "abc"
37
37
  local valueToLookFor = "def"
38
38
  local oldObject = {abc = valueToLookFor}
39
- local newTable = deepCopy(nil, oldObject)
39
+ local newTable = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectHasKeyAndValueString")
40
40
  local newObject = newTable
41
41
  local value = newObject[keyToLookFor]
42
42
  if value == nil then
@@ -54,7 +54,7 @@ function copiedTableHasKeyAndValueNumber(self)
54
54
  local valueToLookFor = 456
55
55
  local oldTable = {}
56
56
  oldTable[keyToLookFor] = valueToLookFor
57
- local newObject = deepCopy(nil, oldTable)
57
+ local newObject = deepCopy(nil, oldTable, SerializationType.NONE, "copiedTableHasKeyAndValueNumber")
58
58
  local newTable = newObject
59
59
  local value = newTable[keyToLookFor]
60
60
  if value == nil then
@@ -72,7 +72,7 @@ function copiedTableDoesNotCoerceTypes(self)
72
72
  local valueToLookFor = 456
73
73
  local oldTable = {}
74
74
  oldTable[keyToLookFor] = valueToLookFor
75
- local newObject = deepCopy(nil, oldTable)
75
+ local newObject = deepCopy(nil, oldTable, SerializationType.NONE, "copiedTableDoesNotCoerceTypes")
76
76
  local newTable = newObject
77
77
  local keyString = tostring(keyToLookFor)
78
78
  local valueString = tostring(valueToLookFor)
@@ -89,7 +89,7 @@ function copiedObjectHasNoReferencesForPrimitivesForward(self)
89
89
  local originalStringValue = "abcdef"
90
90
  local originalNumberValue = 123
91
91
  local oldObject = {abc = originalStringValue, def = originalNumberValue}
92
- local newTable = deepCopy(nil, oldObject)
92
+ local newTable = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectHasNoReferencesForPrimitivesForward")
93
93
  local newObject = newTable
94
94
  oldObject.abc = "newValue"
95
95
  if oldObject.abc == newObject.abc then
@@ -104,7 +104,7 @@ function copiedObjectHasNoReferencesForPrimitivesBackward(self)
104
104
  local originalStringValue = "abcdef"
105
105
  local originalNumberValue = 123
106
106
  local oldObject = {abc = originalStringValue, def = originalNumberValue}
107
- local newTable = deepCopy(nil, oldObject)
107
+ local newTable = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectHasNoReferencesForPrimitivesBackward")
108
108
  local newObject = newTable
109
109
  newObject.abc = "newValue"
110
110
  if newObject.abc == oldObject.abc then
@@ -117,7 +117,7 @@ function copiedObjectHasNoReferencesForPrimitivesBackward(self)
117
117
  end
118
118
  function copiedObjectHasNoReferencesForArray(self)
119
119
  local oldObject = {abc = {1, 2, 3}}
120
- local newTable = deepCopy(nil, oldObject)
120
+ local newTable = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectHasNoReferencesForArray")
121
121
  local newObject = newTable
122
122
  if oldObject.abc == newObject.abc then
123
123
  error("The copied object has the same point to the child array.")
@@ -145,7 +145,7 @@ function copiedObjectHasChildObject(self)
145
145
  local keyToLookFor = "def"
146
146
  local valueToLookFor = "ghi"
147
147
  local oldObject = {abc = {def = valueToLookFor}}
148
- local newTable = deepCopy(nil, oldObject)
148
+ local newTable = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectHasChildObject")
149
149
  local newObject = newTable
150
150
  local childObject = newObject[childObjectIndex]
151
151
  if childObject == nil then
@@ -170,7 +170,7 @@ function copiedMapIsMap(self)
170
170
  local valueToLookFor = "def"
171
171
  local oldMap = __TS__New(Map)
172
172
  oldMap:set(keyToLookFor, valueToLookFor)
173
- local newObject = deepCopy(nil, oldMap)
173
+ local newObject = deepCopy(nil, oldMap, SerializationType.NONE, "copiedMapIsMap")
174
174
  local newMap = newObject
175
175
  if not isTable(nil, newMap) then
176
176
  error("The copied Map had a type of: " .. __TS__TypeOf(newMap))
@@ -184,7 +184,7 @@ function copiedMapHasValue(self)
184
184
  local valueToLookFor = "def"
185
185
  local oldMap = __TS__New(Map)
186
186
  oldMap:set(keyToLookFor, valueToLookFor)
187
- local newTable = deepCopy(nil, oldMap)
187
+ local newTable = deepCopy(nil, oldMap, SerializationType.NONE, "copiedMapHasValue")
188
188
  local newMap = newTable
189
189
  local value = newMap:get(keyToLookFor)
190
190
  if value == nil then
@@ -198,7 +198,7 @@ function copiedSetIsSet(self)
198
198
  local valueToLookFor = "abc"
199
199
  local oldSet = __TS__New(Set)
200
200
  oldSet:add(valueToLookFor)
201
- local newTable = deepCopy(nil, oldSet)
201
+ local newTable = deepCopy(nil, oldSet, SerializationType.NONE, "copiedSetIsSet")
202
202
  local newSet = newTable
203
203
  if not isTable(nil, newSet) then
204
204
  error("The copied Set had a type of: " .. __TS__TypeOf(newSet))
@@ -211,7 +211,7 @@ function copiedSetHasValue(self)
211
211
  local valueToLookFor = "abc"
212
212
  local oldSet = __TS__New(Set)
213
213
  oldSet:add(valueToLookFor)
214
- local newTable = deepCopy(nil, oldSet)
214
+ local newTable = deepCopy(nil, oldSet, SerializationType.NONE, "copiedSetHasValue")
215
215
  local newSet = newTable
216
216
  local hasValue = newSet:has(valueToLookFor)
217
217
  if not hasValue then
@@ -226,7 +226,7 @@ function copiedMapHasChildMap(self)
226
226
  local keyToLookFor = "abc"
227
227
  local oldMap = __TS__New(Map)
228
228
  oldMap:set(keyToLookFor, oldChildMap)
229
- local newTable = deepCopy(nil, oldMap)
229
+ local newTable = deepCopy(nil, oldMap, SerializationType.NONE, "copiedMapHasChildMap")
230
230
  local newMap = newTable
231
231
  local newChildMap = newMap:get(keyToLookFor)
232
232
  if newChildMap == nil then
@@ -259,7 +259,7 @@ function copiedDefaultMapHasChildDefaultMap(self)
259
259
  local oldChildMap = oldParentMap:getAndSetDefault(parentMapKey)
260
260
  oldChildMap:getAndSetDefault(childMapKey1)
261
261
  oldChildMap:set(childMapKey2, childMapCustomValue)
262
- local newTable = deepCopy(nil, oldParentMap)
262
+ local newTable = deepCopy(nil, oldParentMap, SerializationType.NONE, "copiedDefaultMapHasChildDefaultMap")
263
263
  local newParentMap = newTable
264
264
  local newChildMap = newParentMap:get(parentMapKey)
265
265
  if newChildMap == nil then
@@ -289,12 +289,15 @@ end
289
289
  function copiedDefaultMapHasBrand(self)
290
290
  local oldDefaultValue = "foo"
291
291
  local oldDefaultMap = __TS__New(DefaultMap, oldDefaultValue)
292
- local newTable = deepCopy(nil, oldDefaultMap, SerializationType.SERIALIZE)
292
+ local newTable = deepCopy(nil, oldDefaultMap, SerializationType.SERIALIZE, "copiedDefaultMapHasBrand")
293
293
  if not (newTable[SerializationBrand.DEFAULT_MAP] ~= nil) then
294
294
  error("The copied DefaultMap does not have the brand: " .. SerializationBrand.DEFAULT_MAP)
295
295
  end
296
296
  end
297
- function ____exports.deepCopyTests(self)
297
+ --- Run the suite of tests that prove that the "deepCopy" helper function works properly.
298
+ --
299
+ -- This function is only useful if you are troubleshooting the "deepCopy" function.
300
+ function ____exports.runDeepCopyTests(self)
298
301
  copiedObjectIsTable(nil)
299
302
  copiedObjectHasKeyAndValueString(nil)
300
303
  copiedTableHasKeyAndValueNumber(nil)
@@ -6,20 +6,20 @@ import { AnyEntity } from "../types/AnyEntity";
6
6
  * `Isaac.CountEntities` method to avoid having to specify a spawner and to handle ignoring charmed
7
7
  * enemies.
8
8
  *
9
- * @param entityType Default is -1. -1 matches every entity type.
10
- * @param variant Default is -1. -1 matches every variant.
11
- * @param subType Default is -1. -1 matches every sub-type.
12
- * @param ignoreFriendly Default is false.
9
+ * @param entityType Optional. Default is -1, which matches every entity type.
10
+ * @param variant Optional. Default is -1, which matches every variant.
11
+ * @param subType Optional. Default is -1, which matches every sub-type.
12
+ * @param ignoreFriendly Optional. Default is false.
13
13
  */
14
14
  export declare function countEntities(entityType?: EntityType, variant?: number, subType?: number, ignoreFriendly?: boolean): int;
15
15
  /**
16
16
  * Helper function to check if one or more of a specific kind of entity is present in the current
17
17
  * room. It uses the `countEntities` helper function to determine this.
18
18
  *
19
- * @param entityType Default is -1. -1 matches every entity type.
20
- * @param variant Default is -1. -1 matches every variant.
21
- * @param subType Default is -1. -1 matches every sub-type.
22
- * @param ignoreFriendly Default is false.
19
+ * @param entityType Optional. Default is -1, which matches every entity type.
20
+ * @param variant Optional. Default is -1, which matches every variant.
21
+ * @param subType Optional. Default is -1, which matches every sub-type.
22
+ * @param ignoreFriendly Optional. Default is false.
23
23
  */
24
24
  export declare function doesEntityExist(entityType?: EntityType, variant?: number, subType?: number, ignoreFriendly?: boolean): boolean;
25
25
  /**
@@ -46,20 +46,21 @@ export declare function getClosestEntityTo<T extends AnyEntity>(referenceEntity:
46
46
  * For example:
47
47
  *
48
48
  * ```ts
49
- * // Make all of the entities in the room invisible
49
+ * // Make all of the entities in the room invisible.
50
50
  * for (const entity of getEntities()) {
51
51
  * entity.Visible = false;
52
52
  * }
53
53
  * ```
54
54
  *
55
- * @param entityType Optional. If specified, will only return NPCs that match this entity type.
56
- * @param variant Optional. If specified, will only return NPCs that match this variant. Default is
57
- * -1. -1 matches every variant.
58
- * @param subType Optional. If specified, will only return NPCs that match this sub-type. Default is
59
- * -1. -1 matches every sub-type.
55
+ * @param entityType Optional. If specified, will only get the entities that match the type. Default
56
+ * is -1, which matches every type.
57
+ * @param variant Optional. If specified, will only get the entities that match the variant. Default
58
+ * is -1, which matches every variant.
59
+ * @param subType Optional. If specified, will only get the entities that match the sub-type.
60
+ * Default is -1, which matches every sub-type.
60
61
  * @param ignoreFriendly Optional. If set to true, it will exclude friendly NPCs from being
61
- * returned. Default is false. Will only be taken into account if
62
- * `matchingEntityType` is specified.
62
+ * returned. Default is false. Will only be taken into account if the
63
+ * `entityType` is specified.
63
64
  */
64
65
  export declare function getEntities(entityType?: EntityType, variant?: number, subType?: number, ignoreFriendly?: boolean): Entity[];
65
66
  /**
@@ -117,8 +118,9 @@ export declare function parseEntityTypeVariantString(entityTypeVariantString: st
117
118
  * Helper function to remove all of the matching entities in the room.
118
119
  *
119
120
  * @param entityType The entity type to match.
120
- * @param entityVariant Optional. The variant to match. Default is -1. -1 matches every variant.
121
- * @param entitySubType Optional. The sub-type to match. Default is -1. -1 matches every sub-type.
121
+ * @param entityVariant Optional. The variant to match. Default is -1, which matches every variant.
122
+ * @param entitySubType Optional. The sub-type to match. Default is -1, which matches every
123
+ * sub-type.
122
124
  * @param cap Optional. If specified, will only remove the given amount of collectibles.
123
125
  * @returns An array of the entities that were removed.
124
126
  */
@@ -153,4 +155,4 @@ export declare function spawn(entityType: EntityType, variant: int, subType: int
153
155
  * need to specify the velocity or spawner.
154
156
  */
155
157
  export declare function spawnWithSeed(entityType: EntityType, variant: int, subType: int, position: Vector, seedOrRNG: Seed | RNG, velocity?: Vector, spawner?: Entity | undefined): Entity;
156
- //# sourceMappingURL=entity.d.ts.map
158
+ //# sourceMappingURL=entities.d.ts.map
@@ -0,0 +1 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,MAAM,CAsCR;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,GAAG,EACZ,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,IAAI,GAAG,GAAG,EACrB,QAAQ,GAAE,MAAmB,EAC7B,OAAO,GAAE,MAAM,GAAG,SAAqB,GACtC,MAAM,CAUR"}
@@ -47,7 +47,7 @@ function ____exports.removeEntities(self, entities, cap)
47
47
  entity:Remove()
48
48
  entitiesRemoved[#entitiesRemoved + 1] = entity
49
49
  if cap ~= nil and #entitiesRemoved >= cap then
50
- return entitiesRemoved
50
+ break
51
51
  end
52
52
  end
53
53
  return entitiesRemoved
@@ -56,10 +56,10 @@ end
56
56
  -- `Isaac.CountEntities` method to avoid having to specify a spawner and to handle ignoring charmed
57
57
  -- enemies.
58
58
  --
59
- -- @param entityType Default is -1. -1 matches every entity type.
60
- -- @param variant Default is -1. -1 matches every variant.
61
- -- @param subType Default is -1. -1 matches every sub-type.
62
- -- @param ignoreFriendly Default is false.
59
+ -- @param entityType Optional. Default is -1, which matches every entity type.
60
+ -- @param variant Optional. Default is -1, which matches every variant.
61
+ -- @param subType Optional. Default is -1, which matches every sub-type.
62
+ -- @param ignoreFriendly Optional. Default is false.
63
63
  function ____exports.countEntities(self, entityType, variant, subType, ignoreFriendly)
64
64
  if entityType == nil then
65
65
  entityType = -1
@@ -88,10 +88,10 @@ end
88
88
  --- Helper function to check if one or more of a specific kind of entity is present in the current
89
89
  -- room. It uses the `countEntities` helper function to determine this.
90
90
  --
91
- -- @param entityType Default is -1. -1 matches every entity type.
92
- -- @param variant Default is -1. -1 matches every variant.
93
- -- @param subType Default is -1. -1 matches every sub-type.
94
- -- @param ignoreFriendly Default is false.
91
+ -- @param entityType Optional. Default is -1, which matches every entity type.
92
+ -- @param variant Optional. Default is -1, which matches every variant.
93
+ -- @param subType Optional. Default is -1, which matches every sub-type.
94
+ -- @param ignoreFriendly Optional. Default is false.
95
95
  function ____exports.doesEntityExist(self, entityType, variant, subType, ignoreFriendly)
96
96
  if entityType == nil then
97
97
  entityType = -1
@@ -146,21 +146,25 @@ end
146
146
  -- For example:
147
147
  --
148
148
  -- ```ts
149
- -- // Make all of the entities in the room invisible
149
+ -- // Make all of the entities in the room invisible.
150
150
  -- for (const entity of getEntities()) {
151
151
  -- entity.Visible = false;
152
152
  -- }
153
153
  -- ```
154
154
  --
155
- -- @param entityType Optional. If specified, will only return NPCs that match this entity type.
156
- -- @param variant Optional. If specified, will only return NPCs that match this variant. Default is
157
- -- -1. -1 matches every variant.
158
- -- @param subType Optional. If specified, will only return NPCs that match this sub-type. Default is
159
- -- -1. -1 matches every sub-type.
155
+ -- @param entityType Optional. If specified, will only get the entities that match the type. Default
156
+ -- is -1, which matches every type.
157
+ -- @param variant Optional. If specified, will only get the entities that match the variant. Default
158
+ -- is -1, which matches every variant.
159
+ -- @param subType Optional. If specified, will only get the entities that match the sub-type.
160
+ -- Default is -1, which matches every sub-type.
160
161
  -- @param ignoreFriendly Optional. If set to true, it will exclude friendly NPCs from being
161
- -- returned. Default is false. Will only be taken into account if
162
- -- `matchingEntityType` is specified.
162
+ -- returned. Default is false. Will only be taken into account if the
163
+ -- `entityType` is specified.
163
164
  function ____exports.getEntities(self, entityType, variant, subType, ignoreFriendly)
165
+ if entityType == nil then
166
+ entityType = -1
167
+ end
164
168
  if variant == nil then
165
169
  variant = -1
166
170
  end
@@ -170,7 +174,7 @@ function ____exports.getEntities(self, entityType, variant, subType, ignoreFrien
170
174
  if ignoreFriendly == nil then
171
175
  ignoreFriendly = false
172
176
  end
173
- if entityType == nil then
177
+ if entityType == -1 then
174
178
  return Isaac.GetRoomEntities()
175
179
  end
176
180
  return Isaac.FindByType(entityType, variant, subType, ignoreFriendly)
@@ -290,8 +294,9 @@ end
290
294
  --- Helper function to remove all of the matching entities in the room.
291
295
  --
292
296
  -- @param entityType The entity type to match.
293
- -- @param entityVariant Optional. The variant to match. Default is -1. -1 matches every variant.
294
- -- @param entitySubType Optional. The sub-type to match. Default is -1. -1 matches every sub-type.
297
+ -- @param entityVariant Optional. The variant to match. Default is -1, which matches every variant.
298
+ -- @param entitySubType Optional. The sub-type to match. Default is -1, which matches every
299
+ -- sub-type.
295
300
  -- @param cap Optional. If specified, will only remove the given amount of collectibles.
296
301
  -- @returns An array of the entities that were removed.
297
302
  function ____exports.removeAllMatchingEntities(self, entityType, entityVariant, entitySubType, cap)