isaacscript-common 1.0.485 → 1.0.489

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 (139) hide show
  1. package/README.md +2 -0
  2. package/dist/callbacks/itemPickup.lua +2 -6
  3. package/dist/callbacks/postBombInitLate.lua +6 -8
  4. package/dist/callbacks/postCursedTeleport.lua +8 -10
  5. package/dist/callbacks/postEffectInitLate.lua +6 -8
  6. package/dist/callbacks/postEsauJr.lua +2 -4
  7. package/dist/callbacks/postFamiliarInitLate.lua +6 -8
  8. package/dist/callbacks/postFlip.lua +2 -4
  9. package/dist/callbacks/postGridEntity.lua +8 -18
  10. package/dist/callbacks/postKnifeInitLate.lua +6 -8
  11. package/dist/callbacks/postLaserInitLate.lua +6 -8
  12. package/dist/callbacks/postNPCInitLate.lua +6 -8
  13. package/dist/callbacks/postPickupCollect.lua +1 -5
  14. package/dist/callbacks/postPickupInitLate.lua +6 -8
  15. package/dist/callbacks/postPlayerChangeHealth.lua +9 -13
  16. package/dist/callbacks/postPlayerChangeType.lua +1 -5
  17. package/dist/callbacks/postPlayerFatalDamage.lua +2 -2
  18. package/dist/callbacks/postPlayerInitLate.lua +1 -5
  19. package/dist/callbacks/postPlayerReordered.lua +1 -1
  20. package/dist/callbacks/postProjectileInitLate.lua +6 -8
  21. package/dist/callbacks/postPurchase.lua +10 -14
  22. package/dist/callbacks/postSacrifice.lua +3 -3
  23. package/dist/callbacks/postSlotInitUpdate.lua +3 -11
  24. package/dist/callbacks/postSlotRenderBroken.lua +2 -8
  25. package/dist/callbacks/postTearInitLate.lua +6 -8
  26. package/dist/callbacks/postTransformation.lua +1 -5
  27. package/dist/callbacks/reorderedCallbacks.lua +4 -4
  28. package/dist/callbacks/subscriptions/postBombInitLate.lua +3 -3
  29. package/dist/callbacks/subscriptions/postCursedTeleport.lua +1 -1
  30. package/dist/callbacks/subscriptions/postCustomRevive.lua +3 -3
  31. package/dist/callbacks/subscriptions/postEffectInitLate.lua +3 -3
  32. package/dist/callbacks/subscriptions/postEsauJr.lua +1 -1
  33. package/dist/callbacks/subscriptions/postFamiliarInitLate.lua +3 -3
  34. package/dist/callbacks/subscriptions/postFirstEsauJr.lua +1 -1
  35. package/dist/callbacks/subscriptions/postFirstFlip.lua +1 -1
  36. package/dist/callbacks/subscriptions/postFlip.lua +1 -1
  37. package/dist/callbacks/subscriptions/postGameStartedReordered.lua +1 -1
  38. package/dist/callbacks/subscriptions/postGridEntityInit.lua +3 -3
  39. package/dist/callbacks/subscriptions/postGridEntityRemove.lua +3 -3
  40. package/dist/callbacks/subscriptions/postGridEntityUpdate.lua +3 -3
  41. package/dist/callbacks/subscriptions/postItemPickup.lua +5 -5
  42. package/dist/callbacks/subscriptions/postKnifeInitLate.lua +3 -3
  43. package/dist/callbacks/subscriptions/postLaserInitLate.lua +3 -3
  44. package/dist/callbacks/subscriptions/postNPCInitLate.lua +3 -3
  45. package/dist/callbacks/subscriptions/postNewLevelReordered.lua +1 -1
  46. package/dist/callbacks/subscriptions/postNewRoomReordered.lua +1 -1
  47. package/dist/callbacks/subscriptions/postPickupCollect.lua +3 -3
  48. package/dist/callbacks/subscriptions/postPickupInitLate.lua +3 -3
  49. package/dist/callbacks/subscriptions/postPlayerChangeHealth.lua +3 -3
  50. package/dist/callbacks/subscriptions/postPlayerChangeType.lua +1 -1
  51. package/dist/callbacks/subscriptions/postPlayerFatalDamage.lua +3 -3
  52. package/dist/callbacks/subscriptions/postPlayerInitLate.lua +3 -3
  53. package/dist/callbacks/subscriptions/postPlayerInitReordered.lua +3 -3
  54. package/dist/callbacks/subscriptions/postPlayerRenderReordered.lua +3 -3
  55. package/dist/callbacks/subscriptions/postPlayerUpdateReordered.lua +3 -3
  56. package/dist/callbacks/subscriptions/postProjectileInitLate.lua +3 -3
  57. package/dist/callbacks/subscriptions/postPurchase.lua +8 -2
  58. package/dist/callbacks/subscriptions/postSacrifice.lua +1 -1
  59. package/dist/callbacks/subscriptions/postSlotDestroyed.lua +3 -3
  60. package/dist/callbacks/subscriptions/postSlotInit.lua +3 -3
  61. package/dist/callbacks/subscriptions/postSlotRender.lua +3 -3
  62. package/dist/callbacks/subscriptions/postSlotUpdate.lua +3 -3
  63. package/dist/callbacks/subscriptions/postTearInitLate.lua +3 -3
  64. package/dist/callbacks/subscriptions/postTransformation.lua +3 -3
  65. package/dist/callbacks/subscriptions/preCustomRevive.lua +1 -1
  66. package/dist/callbacks/subscriptions/preItemPickup.lua +5 -5
  67. package/dist/constants.d.ts +0 -6
  68. package/dist/constants.lua +38 -6
  69. package/dist/features/deployJSONRoom.lua +90 -61
  70. package/dist/features/disableInputs.lua +9 -3
  71. package/dist/features/forgottenSwitch.lua +1 -1
  72. package/dist/features/getCollectibleItemPoolType.lua +10 -14
  73. package/dist/features/preventCollectibleRotate.lua +3 -9
  74. package/dist/features/saveDataManager/load.lua +2 -6
  75. package/dist/features/saveDataManager/main.lua +1 -1
  76. package/dist/features/saveDataManager/merge.lua +2 -4
  77. package/dist/features/sirenHelpers.lua +5 -5
  78. package/dist/functions/array.d.ts +19 -7
  79. package/dist/functions/array.lua +32 -19
  80. package/dist/functions/bitwise.lua +1 -1
  81. package/dist/functions/cards.d.ts +15 -9
  82. package/dist/functions/cards.lua +40 -30
  83. package/dist/functions/charge.lua +10 -12
  84. package/dist/functions/collectibles.d.ts +1 -0
  85. package/dist/functions/collectibles.lua +26 -21
  86. package/dist/functions/color.lua +9 -1
  87. package/dist/functions/deepCopy.lua +42 -22
  88. package/dist/functions/deepCopyTests.lua +12 -20
  89. package/dist/functions/doors.lua +7 -19
  90. package/dist/functions/entity.lua +7 -1
  91. package/dist/functions/flag.lua +1 -1
  92. package/dist/functions/gridEntity.lua +15 -10
  93. package/dist/functions/input.lua +14 -18
  94. package/dist/functions/jsonRoom.lua +3 -9
  95. package/dist/functions/language.lua +9 -1
  96. package/dist/functions/log.lua +18 -46
  97. package/dist/functions/math.lua +15 -17
  98. package/dist/functions/npc.lua +15 -17
  99. package/dist/functions/pickups.d.ts +7 -2
  100. package/dist/functions/pickups.lua +19 -3
  101. package/dist/functions/player.d.ts +0 -43
  102. package/dist/functions/player.lua +37 -137
  103. package/dist/functions/playerHealth.lua +19 -9
  104. package/dist/functions/pocketItems.d.ts +16 -14
  105. package/dist/functions/pocketItems.lua +56 -30
  106. package/dist/functions/random.lua +2 -2
  107. package/dist/functions/revive.lua +4 -4
  108. package/dist/functions/rooms.lua +15 -18
  109. package/dist/functions/spawnCollectible.lua +10 -2
  110. package/dist/functions/sprite.lua +2 -2
  111. package/dist/functions/stage.lua +6 -6
  112. package/dist/functions/tears.lua +1 -1
  113. package/dist/functions/transformations.lua +4 -10
  114. package/dist/functions/trinketGive.lua +2 -2
  115. package/dist/functions/trinkets.d.ts +23 -1
  116. package/dist/functions/trinkets.lua +24 -0
  117. package/dist/functions/ui.lua +3 -3
  118. package/dist/functions/util.lua +4 -8
  119. package/dist/functions/vector.lua +8 -8
  120. package/dist/index.d.ts +4 -0
  121. package/dist/index.lua +32 -0
  122. package/dist/lualib_bundle.lua +603 -555
  123. package/dist/maps/cardDescriptionMap.lua +99 -1
  124. package/dist/maps/cardNameMap.lua +99 -1
  125. package/dist/maps/collectibleDescriptionMap.lua +722 -1
  126. package/dist/maps/collectibleNameMap.lua +722 -1
  127. package/dist/maps/gridEntityXMLMap.d.ts +6 -0
  128. package/dist/maps/gridEntityXMLMap.lua +40 -0
  129. package/dist/maps/pillEffectNameMap.lua +52 -1
  130. package/dist/maps/roomTypeToItemPoolMap.d.ts +2 -0
  131. package/dist/maps/roomTypeToItemPoolMap.lua +19 -0
  132. package/dist/maps/transformationMap.lua +19 -12
  133. package/dist/maps/trinketDescriptionMap.lua +190 -1
  134. package/dist/maps/trinketNameMap.lua +190 -1
  135. package/dist/sets/cards.d.ts +25 -0
  136. package/dist/sets/cards.lua +106 -0
  137. package/dist/types/ModUpgraded.lua +82 -166
  138. package/dist/types/PocketItemDescription.d.ts +1 -0
  139. package/package.json +5 -5
@@ -43,18 +43,14 @@ function copiedTableHasKeyAndValueNumber(self)
43
43
  local newTable = newObject
44
44
  local value = newTable[keyToLookFor]
45
45
  if value == nil then
46
- error(
47
- "The copied object did not have a key of: " .. tostring(keyToLookFor)
48
- )
46
+ error("The copied object did not have a key of: " .. tostring(keyToLookFor))
49
47
  end
50
48
  local valueType = type(value)
51
49
  if valueType ~= "number" then
52
50
  error("The copied object had a value type of: " .. valueType)
53
51
  end
54
52
  if value ~= valueToLookFor then
55
- error(
56
- "The copied object had a value of: " .. tostring(value)
57
- )
53
+ error("The copied object had a value of: " .. tostring(value))
58
54
  end
59
55
  end
60
56
  function copiedTableDoesNotCoerceTypes(self)
@@ -115,20 +111,20 @@ function copiedObjectHasNoReferencesForArray(self)
115
111
  if not arrayEquals(nil, oldObject.abc, newObject.abc) then
116
112
  error("The copied object does not have an equal array.")
117
113
  end
118
- local ____obj, ____index = oldObject.abc, 0 + 1
119
- ____obj[____index] = ____obj[____index] + 1
114
+ local ____oldObject_abc_0, ____1_1 = oldObject.abc, 1
115
+ ____oldObject_abc_0[____1_1] = ____oldObject_abc_0[____1_1] + 1
120
116
  if arrayEquals(nil, oldObject.abc, newObject.abc) then
121
117
  error("The copied object has an equal array after a modification to the old array.")
122
118
  end
123
- local ____obj, ____index = oldObject.abc, 0 + 1
124
- ____obj[____index] = ____obj[____index] - 1
125
- local ____obj, ____index = newObject.abc, 0 + 1
126
- ____obj[____index] = ____obj[____index] + 1
119
+ local ____oldObject_abc_2, ____1_3 = oldObject.abc, 1
120
+ ____oldObject_abc_2[____1_3] = ____oldObject_abc_2[____1_3] - 1
121
+ local ____newObject_abc_4, ____1_5 = newObject.abc, 1
122
+ ____newObject_abc_4[____1_5] = ____newObject_abc_4[____1_5] + 1
127
123
  if arrayEquals(nil, oldObject.abc, newObject.abc) then
128
124
  error("The copied object has an equal array after a modification to the new array.")
129
125
  end
130
- local ____obj, ____index = newObject.abc, 0 + 1
131
- ____obj[____index] = ____obj[____index] - 1
126
+ local ____newObject_abc_6, ____1_7 = newObject.abc, 1
127
+ ____newObject_abc_6[____1_7] = ____newObject_abc_6[____1_7] - 1
132
128
  end
133
129
  function copiedObjectHasChildObject(self)
134
130
  local childObjectIndex = "abc"
@@ -235,14 +231,10 @@ function copiedMapHasChildMap(self)
235
231
  end
236
232
  local value = newChildMap:get(childMapKey)
237
233
  if value == nil then
238
- error(
239
- "The copied child Map did not have a key of: " .. tostring(childMapKey)
240
- )
234
+ error("The copied child Map did not have a key of: " .. tostring(childMapKey))
241
235
  end
242
236
  if value ~= childMapValue then
243
- error(
244
- "The copied child Map did not have a value of: " .. tostring(childMapValue)
245
- )
237
+ error("The copied child Map did not have a value of: " .. tostring(childMapValue))
246
238
  end
247
239
  end
248
240
  function ____exports.deepCopyTests(self)
@@ -42,18 +42,14 @@ function ____exports.isSecretRoomDoor(self, door)
42
42
  return filename == "gfx/grid/Door_08_HoleInWall.anm2"
43
43
  end
44
44
  function ____exports.closeAllDoors(self)
45
- for ____, door in ipairs(
46
- ____exports.getDoors(nil)
47
- ) do
45
+ for ____, door in ipairs(____exports.getDoors(nil)) do
48
46
  door.State = DoorState.STATE_CLOSED
49
47
  local sprite = door:GetSprite()
50
48
  sprite:Play("Close", true)
51
49
  end
52
50
  end
53
51
  function ____exports.getAngelRoomDoor(self)
54
- for ____, door in ipairs(
55
- ____exports.getDoors(nil)
56
- ) do
52
+ for ____, door in ipairs(____exports.getDoors(nil)) do
57
53
  if ____exports.isAngelRoomDoor(nil, door) then
58
54
  return door
59
55
  end
@@ -61,9 +57,7 @@ function ____exports.getAngelRoomDoor(self)
61
57
  return nil
62
58
  end
63
59
  function ____exports.getDevilRoomDoor(self)
64
- for ____, door in ipairs(
65
- ____exports.getDoors(nil)
66
- ) do
60
+ for ____, door in ipairs(____exports.getDoors(nil)) do
67
61
  if ____exports.isDevilRoomDoor(nil, door) then
68
62
  return door
69
63
  end
@@ -71,9 +65,7 @@ function ____exports.getDevilRoomDoor(self)
71
65
  return nil
72
66
  end
73
67
  function ____exports.getDevilRoomOrAngelRoomDoor(self)
74
- for ____, door in ipairs(
75
- ____exports.getDoors(nil)
76
- ) do
68
+ for ____, door in ipairs(____exports.getDoors(nil)) do
77
69
  if ____exports.isDevilRoomDoor(nil, door) or ____exports.isAngelRoomDoor(nil, door) then
78
70
  return door
79
71
  end
@@ -81,9 +73,7 @@ function ____exports.getDevilRoomOrAngelRoomDoor(self)
81
73
  return nil
82
74
  end
83
75
  function ____exports.getRepentanceDoor(self)
84
- for ____, door in ipairs(
85
- ____exports.getDoors(nil)
86
- ) do
76
+ for ____, door in ipairs(____exports.getDoors(nil)) do
87
77
  if ____exports.isRepentanceDoor(nil, door) then
88
78
  return door
89
79
  end
@@ -93,7 +83,7 @@ end
93
83
  function ____exports.isHiddenSecretRoomDoor(self, door)
94
84
  local sprite = door:GetSprite()
95
85
  local animation = sprite:GetAnimation()
96
- return ____exports.isSecretRoomDoor(nil, door) and (animation == "Hidden")
86
+ return ____exports.isSecretRoomDoor(nil, door) and animation == "Hidden"
97
87
  end
98
88
  function ____exports.isDoorToDownpour(self, door)
99
89
  if not ____exports.isRepentanceDoor(nil, door) then
@@ -136,9 +126,7 @@ function ____exports.isDoorToMomsHeart(self, door)
136
126
  return filename == "gfx/grid/Door_MomsHeart.anm2"
137
127
  end
138
128
  function ____exports.openAllDoors(self)
139
- for ____, door in ipairs(
140
- ____exports.getDoors(nil)
141
- ) do
129
+ for ____, door in ipairs(____exports.getDoors(nil)) do
142
130
  door:Open()
143
131
  end
144
132
  end
@@ -298,7 +298,13 @@ function ____exports.setEntityRandomColor(self, entity)
298
298
  end
299
299
  end
300
300
  local color = Color(colorValues[1], colorValues[2], colorValues[3])
301
- entity:SetColor(color, 100000, 100000, false, false)
301
+ entity:SetColor(
302
+ color,
303
+ 100000,
304
+ 100000,
305
+ false,
306
+ false
307
+ )
302
308
  end
303
309
  function ____exports.setEntityVelocities(self, entityVelocities, entities)
304
310
  if entities == nil then
@@ -10,7 +10,7 @@ end
10
10
  function ____exports.hasFlag(self, flags, ...)
11
11
  local flag = {...}
12
12
  for ____, f in ipairs(flag) do
13
- if not ((flags & f) == f) then
13
+ if not (flags & f == f) then
14
14
  return false
15
15
  end
16
16
  end
@@ -1,8 +1,8 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  require("lualib_bundle");
3
3
  local ____exports = {}
4
- local ____constants = require("constants")
5
- local GRID_ENTITY_XML_MAP = ____constants.GRID_ENTITY_XML_MAP
4
+ local ____gridEntityXMLMap = require("maps.gridEntityXMLMap")
5
+ local GRID_ENTITY_XML_MAP = ____gridEntityXMLMap.GRID_ENTITY_XML_MAP
6
6
  local ____rooms = require("functions.rooms")
7
7
  local roomUpdateSafe = ____rooms.roomUpdateSafe
8
8
  function ____exports.removeGridEntity(self, gridEntity, updateRoom)
@@ -36,13 +36,11 @@ function ____exports.convertXMLGridEntityType(self, gridEntityXMLType, gridEntit
36
36
  end
37
37
  local gridEntityArray = GRID_ENTITY_XML_MAP:get(gridEntityXMLType)
38
38
  if gridEntityArray == nil then
39
- error(
40
- "Failed to find an entry in the grid entity map for XML entity type: " .. tostring(gridEntityXMLType)
41
- )
39
+ error("Failed to find an entry in the grid entity map for XML entity type: " .. tostring(gridEntityXMLType))
42
40
  end
43
41
  local gridEntityType = gridEntityArray[1]
44
42
  local gridEntityVariant = gridEntityArray[2]
45
- if ((gridEntityType == GridEntityType.GRID_SPIKES_ONOFF) or (gridEntityType == GridEntityType.GRID_PRESSURE_PLATE)) or (gridEntityType == GridEntityType.GRID_TELEPORTER) then
43
+ if gridEntityType == GridEntityType.GRID_SPIKES_ONOFF or gridEntityType == GridEntityType.GRID_PRESSURE_PLATE or gridEntityType == GridEntityType.GRID_TELEPORTER then
46
44
  gridEntityVariant = gridEntityXMLVariant
47
45
  end
48
46
  return {gridEntityType, gridEntityVariant}
@@ -82,7 +80,16 @@ function ____exports.getSurroundingGridEntities(self, gridEntity)
82
80
  local room = game:GetRoom()
83
81
  local gridWidth = room:GetGridWidth()
84
82
  local gridIndex = gridEntity:GetGridIndex()
85
- local surroundingGridIndexes = {gridIndex - 1, gridIndex + 1, (gridIndex - gridWidth) - 1, gridIndex - gridWidth, (gridIndex - gridWidth) + 1, (gridIndex + gridWidth) - 1, gridIndex + gridWidth, (gridIndex + gridWidth) + 1}
83
+ local surroundingGridIndexes = {
84
+ gridIndex - 1,
85
+ gridIndex + 1,
86
+ gridIndex - gridWidth - 1,
87
+ gridIndex - gridWidth,
88
+ gridIndex - gridWidth + 1,
89
+ gridIndex + gridWidth - 1,
90
+ gridIndex + gridWidth,
91
+ gridIndex + gridWidth + 1
92
+ }
86
93
  local surroundingGridEntities = {}
87
94
  for ____, surroundingGridIndex in ipairs(surroundingGridIndexes) do
88
95
  local surroundingGridEntity = room:GetGridEntity(surroundingGridIndex)
@@ -99,9 +106,7 @@ function ____exports.isAllPressurePlatesPushed(self)
99
106
  if not hasPressurePlates then
100
107
  return true
101
108
  end
102
- for ____, gridEntity in ipairs(
103
- ____exports.getGridEntities(nil, GridEntityType.GRID_PRESSURE_PLATE)
104
- ) do
109
+ for ____, gridEntity in ipairs(____exports.getGridEntities(nil, GridEntityType.GRID_PRESSURE_PLATE)) do
105
110
  local gridEntityDesc = gridEntity:GetSaveState()
106
111
  if gridEntityDesc.State ~= 3 then
107
112
  return false
@@ -39,12 +39,10 @@ ControllerLiteral[ControllerLiteral.BUTTON_BACK] = "BUTTON_BACK"
39
39
  ControllerLiteral.BUTTON_START = 15
40
40
  ControllerLiteral[ControllerLiteral.BUTTON_START] = "BUTTON_START"
41
41
  function ____exports.controllerToString(self, controller)
42
- for ____, ____value in ipairs(
43
- __TS__ObjectEntries(ControllerLiteral)
44
- ) do
45
- local key
42
+ local controllerLiteralCode
43
+ local key
44
+ for ____, ____value in ipairs(__TS__ObjectEntries(ControllerLiteral)) do
46
45
  key = ____value[1]
47
- local controllerLiteralCode
48
46
  controllerLiteralCode = ____value[2]
49
47
  do
50
48
  if type(key) ~= "string" then
@@ -55,7 +53,13 @@ function ____exports.controllerToString(self, controller)
55
53
  goto __continue3
56
54
  end
57
55
  local controllerName = key
58
- for ____, prefix in ipairs({"DPAD_", "BUTTON_", "BUMPER_", "TRIGGER_", "STICK_"}) do
56
+ for ____, prefix in ipairs({
57
+ "DPAD_",
58
+ "BUTTON_",
59
+ "BUMPER_",
60
+ "TRIGGER_",
61
+ "STICK_"
62
+ }) do
59
63
  controllerName = __TS__StringReplace(controllerName, prefix, "")
60
64
  end
61
65
  return controllerName
@@ -92,9 +96,7 @@ function ____exports.isKeyboardPressed(self, key)
92
96
  return Input.IsButtonPressed(key, 0)
93
97
  end
94
98
  function ____exports.isMoveActionPressedOnAnyInput(self)
95
- for ____, buttonAction in __TS__Iterator(
96
- MOVEMENT_ACTIONS:values()
97
- ) do
99
+ for ____, buttonAction in __TS__Iterator(MOVEMENT_ACTIONS:values()) do
98
100
  if ____exports.isActionPressedOnAnyInput(nil, buttonAction) then
99
101
  return true
100
102
  end
@@ -102,9 +104,7 @@ function ____exports.isMoveActionPressedOnAnyInput(self)
102
104
  return false
103
105
  end
104
106
  function ____exports.isMoveActionTriggeredOnAnyInput(self)
105
- for ____, buttonAction in __TS__Iterator(
106
- MOVEMENT_ACTIONS:values()
107
- ) do
107
+ for ____, buttonAction in __TS__Iterator(MOVEMENT_ACTIONS:values()) do
108
108
  if ____exports.isActionTriggeredOnAnyInput(nil, buttonAction) then
109
109
  return true
110
110
  end
@@ -112,9 +112,7 @@ function ____exports.isMoveActionTriggeredOnAnyInput(self)
112
112
  return false
113
113
  end
114
114
  function ____exports.isShootActionPressedOnAnyInput(self)
115
- for ____, buttonAction in __TS__Iterator(
116
- SHOOTING_ACTIONS:values()
117
- ) do
115
+ for ____, buttonAction in __TS__Iterator(SHOOTING_ACTIONS:values()) do
118
116
  if ____exports.isActionPressedOnAnyInput(nil, buttonAction) then
119
117
  return true
120
118
  end
@@ -122,9 +120,7 @@ function ____exports.isShootActionPressedOnAnyInput(self)
122
120
  return false
123
121
  end
124
122
  function ____exports.isShootActionTriggeredOnAnyInput(self)
125
- for ____, buttonAction in __TS__Iterator(
126
- SHOOTING_ACTIONS:values()
127
- ) do
123
+ for ____, buttonAction in __TS__Iterator(SHOOTING_ACTIONS:values()) do
128
124
  if ____exports.isActionTriggeredOnAnyInput(nil, buttonAction) then
129
125
  return true
130
126
  end
@@ -30,9 +30,7 @@ function getJSONRoomWithChosenWeight(self, jsonRooms, chosenWeight)
30
30
  end
31
31
  chosenWeight = chosenWeight - roomWeight
32
32
  end
33
- error(
34
- "Failed to get a room with chosen weight: " .. tostring(chosenWeight)
35
- )
33
+ error("Failed to get a room with chosen weight: " .. tostring(chosenWeight))
36
34
  return jsonRooms[1]
37
35
  end
38
36
  function ____exports.getJSONRoomOfVariant(self, jsonRooms, variant)
@@ -65,15 +63,11 @@ function ____exports.getRandomJSONRoom(self, jsonRooms, seed, verbose)
65
63
  end
66
64
  local totalWeight = getTotalWeightOfJSONRooms(nil, jsonRooms)
67
65
  if verbose then
68
- log(
69
- "Total weight of the JSON rooms provided: " .. tostring(totalWeight)
70
- )
66
+ log("Total weight of the JSON rooms provided: " .. tostring(totalWeight))
71
67
  end
72
68
  local chosenWeight = getRandomFloat(nil, 0, totalWeight, seed)
73
69
  if verbose then
74
- log(
75
- "Randomly chose weight: " .. tostring(chosenWeight)
76
- )
70
+ log("Randomly chose weight: " .. tostring(chosenWeight))
77
71
  end
78
72
  return getJSONRoomWithChosenWeight(nil, jsonRooms, chosenWeight)
79
73
  end
@@ -1,6 +1,14 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____exports = {}
3
- local LANGUAGE_NAMES = {en = "English", jp = "Japanese", kr = "Korean", zh = "Chinese (Simple)", ru = "Russian", de = "German", es = "Spanish"}
3
+ local LANGUAGE_NAMES = {
4
+ en = "English",
5
+ jp = "Japanese",
6
+ kr = "Korean",
7
+ zh = "Chinese (Simple)",
8
+ ru = "Russian",
9
+ de = "German",
10
+ es = "Spanish"
11
+ }
4
12
  function ____exports.getLanguageName(self)
5
13
  local languageAbbreviation = Options.Language
6
14
  return LANGUAGE_NAMES[languageAbbreviation]
@@ -16,9 +16,7 @@ function ____exports.getDebugPrependString(self, msg, numParentFunctions)
16
16
  end
17
17
  end
18
18
  if getParentFunctionDescription ~= nil then
19
- return (tostring(
20
- getParentFunctionDescription(numParentFunctions + 1)
21
- ) .. " - ") .. msg
19
+ return (tostring(getParentFunctionDescription(numParentFunctions + 1)) .. " - ") .. msg
22
20
  end
23
21
  return msg
24
22
  end
@@ -36,9 +34,7 @@ function ____exports.logAllFlags(flags, flagEnum, description)
36
34
  ____exports.log(("Logging all " .. description) .. "flags:")
37
35
  for key, value in pairs(flagEnum) do
38
36
  if hasFlag(nil, flags, value) then
39
- ____exports.log(
40
- "- Has flag: " .. tostring(key)
41
- )
37
+ ____exports.log("- Has flag: " .. tostring(key))
42
38
  end
43
39
  end
44
40
  end
@@ -51,12 +47,10 @@ end
51
47
  function ____exports.logAllGameStateFlags()
52
48
  local game = Game()
53
49
  ____exports.log("Logging all game state flags:")
54
- for ____, ____value in ipairs(
55
- __TS__ObjectEntries(GameStateFlag)
56
- ) do
57
- local key
50
+ local value
51
+ local key
52
+ for ____, ____value in ipairs(__TS__ObjectEntries(GameStateFlag)) do
58
53
  key = ____value[1]
59
- local value
60
54
  value = ____value[2]
61
55
  local gameStateFlag = value
62
56
  local flagValue = game:GetStateFlag(gameStateFlag)
@@ -79,62 +73,40 @@ function ____exports.logArray(array)
79
73
  ____exports.log("Array: " .. arrayString)
80
74
  end
81
75
  function ____exports.logColor(color)
82
- ____exports.log(
83
- (((((((((((("Color: R" .. tostring(color.R)) .. ", G") .. tostring(color.G)) .. ", B") .. tostring(color.B)) .. ", A") .. tostring(color.A)) .. ", RO") .. tostring(color.RO)) .. ", BO") .. tostring(color.BO)) .. ", GO") .. tostring(color.GO)
84
- )
76
+ ____exports.log((((((((((((("Color: R" .. tostring(color.R)) .. ", G") .. tostring(color.G)) .. ", B") .. tostring(color.B)) .. ", A") .. tostring(color.A)) .. ", RO") .. tostring(color.RO)) .. ", BO") .. tostring(color.BO)) .. ", GO") .. tostring(color.GO))
85
77
  end
86
78
  function ____exports.logEntity(entity)
87
- ____exports.log(
88
- (((("Entity: " .. tostring(entity.Type)) .. ".") .. tostring(entity.Variant)) .. ".") .. tostring(entity.SubType)
89
- )
79
+ ____exports.log((((("Entity: " .. tostring(entity.Type)) .. ".") .. tostring(entity.Variant)) .. ".") .. tostring(entity.SubType))
90
80
  end
91
81
  function ____exports.logKColor(kColor)
92
- ____exports.log(
93
- (((((("Color: R" .. tostring(kColor.Red)) .. ", G") .. tostring(kColor.Green)) .. ", B") .. tostring(kColor.Blue)) .. ", A") .. tostring(kColor.Alpha)
94
- )
82
+ ____exports.log((((((("Color: R" .. tostring(kColor.Red)) .. ", G") .. tostring(kColor.Green)) .. ", B") .. tostring(kColor.Blue)) .. ", A") .. tostring(kColor.Alpha))
95
83
  end
96
84
  function ____exports.logMap(map)
97
85
  ____exports.log("Printing out a TSTL Map:")
98
- for ____, ____value in __TS__Iterator(
99
- map:entries()
100
- ) do
101
- local key
86
+ local value
87
+ local key
88
+ for ____, ____value in __TS__Iterator(map:entries()) do
102
89
  key = ____value[1]
103
- local value
104
90
  value = ____value[2]
105
- ____exports.log(
106
- ((" Key: " .. tostring(key)) .. ", Value: ") .. tostring(value)
107
- )
91
+ ____exports.log(((" Key: " .. tostring(key)) .. ", Value: ") .. tostring(value))
108
92
  end
109
- ____exports.log(
110
- "The size of the map was: " .. tostring(map.size)
111
- )
93
+ ____exports.log("The size of the map was: " .. tostring(map.size))
112
94
  end
113
95
  function ____exports.logTable(____table)
114
96
  ____exports.log("Printing out a Lua table:")
115
97
  for key, value in pairs(____table) do
116
- ____exports.log(
117
- ((" Key: " .. tostring(key)) .. ", Value: ") .. tostring(value)
118
- )
98
+ ____exports.log(((" Key: " .. tostring(key)) .. ", Value: ") .. tostring(value))
119
99
  end
120
100
  end
121
101
  function ____exports.logSet(set)
122
102
  ____exports.log("Printing out a TSTL Set:")
123
- for ____, value in __TS__Iterator(
124
- set:values()
125
- ) do
126
- ____exports.log(
127
- " Value: " .. tostring(value)
128
- )
103
+ for ____, value in __TS__Iterator(set:values()) do
104
+ ____exports.log(" Value: " .. tostring(value))
129
105
  end
130
- ____exports.log(
131
- "The size of the set was: " .. tostring(set.size)
132
- )
106
+ ____exports.log("The size of the set was: " .. tostring(set.size))
133
107
  end
134
108
  function ____exports.logVector(vector)
135
- ____exports.log(
136
- ((("Vector: (" .. tostring(vector.X)) .. ", ") .. tostring(vector.Y)) .. ")"
137
- )
109
+ ____exports.log(((("Vector: (" .. tostring(vector.X)) .. ", ") .. tostring(vector.Y)) .. ")")
138
110
  end
139
111
  function ____exports.setLogFunctionsGlobal(self)
140
112
  local globals = _G
@@ -13,25 +13,25 @@ function getCircleInitialPosition(self, direction, radius)
13
13
  return Vector.Zero
14
14
  end
15
15
  end
16
- ____cond6 = ____cond6 or (____switch6 == Direction.LEFT)
16
+ ____cond6 = ____cond6 or ____switch6 == Direction.LEFT
17
17
  if ____cond6 then
18
18
  do
19
19
  return Vector(-radius, 0)
20
20
  end
21
21
  end
22
- ____cond6 = ____cond6 or (____switch6 == Direction.UP)
22
+ ____cond6 = ____cond6 or ____switch6 == Direction.UP
23
23
  if ____cond6 then
24
24
  do
25
25
  return Vector(0, -radius)
26
26
  end
27
27
  end
28
- ____cond6 = ____cond6 or (____switch6 == Direction.RIGHT)
28
+ ____cond6 = ____cond6 or ____switch6 == Direction.RIGHT
29
29
  if ____cond6 then
30
30
  do
31
31
  return Vector(radius, 0)
32
32
  end
33
33
  end
34
- ____cond6 = ____cond6 or (____switch6 == Direction.DOWN)
34
+ ____cond6 = ____cond6 or ____switch6 == Direction.DOWN
35
35
  if ____cond6 then
36
36
  do
37
37
  return Vector(0, radius)
@@ -47,7 +47,7 @@ function getCircleInitialPosition(self, direction, radius)
47
47
  end
48
48
  function ____exports.getAngleDifference(self, angle1, angle2)
49
49
  local subtractedAngle = angle1 - angle2
50
- return ((subtractedAngle + 180) % 360) - 180
50
+ return (subtractedAngle + 180) % 360 - 180
51
51
  end
52
52
  function ____exports.getCircleDiscretizedPoints(self, centerPos, radius, numPoints, xMultiplier, yMultiplier, initialDirection)
53
53
  if xMultiplier == nil then
@@ -64,7 +64,7 @@ function ____exports.getCircleDiscretizedPoints(self, centerPos, radius, numPoin
64
64
  do
65
65
  local i = 0
66
66
  while i < numPoints do
67
- local rotatedPosition = initialPosition:Rotated((i * 360) / numPoints)
67
+ local rotatedPosition = initialPosition:Rotated(i * 360 / numPoints)
68
68
  rotatedPosition.X = rotatedPosition.X * xMultiplier
69
69
  rotatedPosition.Y = rotatedPosition.Y * yMultiplier
70
70
  local positionFromCenter = centerPos + rotatedPosition
@@ -75,28 +75,26 @@ function ____exports.getCircleDiscretizedPoints(self, centerPos, radius, numPoin
75
75
  return positions
76
76
  end
77
77
  function ____exports.isEven(self, num)
78
- return (num & 1) == 0
78
+ return num & 1 == 0
79
79
  end
80
80
  function ____exports.isOdd(self, num)
81
- return (num & 1) == 1
81
+ return num & 1 == 1
82
82
  end
83
83
  function ____exports.lerp(self, a, b, pos)
84
- return a + ((b - a) * pos)
84
+ return a + (b - a) * pos
85
85
  end
86
86
  function ____exports.lerpAngleDegrees(self, aStart, aEnd, percent)
87
- return aStart + (____exports.getAngleDifference(nil, aStart, aEnd) * percent)
87
+ return aStart + ____exports.getAngleDifference(nil, aStart, aEnd) * percent
88
88
  end
89
89
  function ____exports.round(self, num, numDecimalPlaces)
90
90
  if numDecimalPlaces == nil then
91
91
  numDecimalPlaces = 0
92
92
  end
93
- local roundedNum = tonumber(
94
- string.format(
95
- ("%." .. tostring(numDecimalPlaces)) .. "f",
96
- num
97
- )
98
- )
99
- return ((roundedNum == nil) and 0) or roundedNum
93
+ local roundedNum = tonumber(string.format(
94
+ ("%." .. tostring(numDecimalPlaces)) .. "f",
95
+ num
96
+ ))
97
+ return roundedNum == nil and 0 or roundedNum
100
98
  end
101
99
  function ____exports.tanh(self, x)
102
100
  return (math.exp(x) - math.exp(-x)) / (math.exp(x) + math.exp(-x))
@@ -8,9 +8,7 @@ local ____entity = require("functions.entity")
8
8
  local getEntities = ____entity.getEntities
9
9
  function ____exports.getBosses(self)
10
10
  local bosses = {}
11
- for ____, npc in ipairs(
12
- ____exports.getNPCs(nil)
13
- ) do
11
+ for ____, npc in ipairs(____exports.getNPCs(nil)) do
14
12
  if npc:IsBoss() then
15
13
  __TS__ArrayPush(bosses, npc)
16
14
  end
@@ -21,7 +19,13 @@ function ____exports.getNPCs(self, matchingEntityType, matchingVariant, matching
21
19
  if ignoreFriendly == nil then
22
20
  ignoreFriendly = false
23
21
  end
24
- local entities = getEntities(nil, matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
22
+ local entities = getEntities(
23
+ nil,
24
+ matchingEntityType,
25
+ matchingVariant,
26
+ matchingSubType,
27
+ ignoreFriendly
28
+ )
25
29
  local npcs = {}
26
30
  for ____, entity in ipairs(entities) do
27
31
  local npc = entity:ToNPC()
@@ -49,10 +53,10 @@ function ____exports.isAliveExceptionNPC(self, npc)
49
53
  return false
50
54
  end
51
55
  function ____exports.isDyingEggyWithNoSpidersLeft(self, npc)
52
- return (npc.State == NpcState.STATE_SUICIDE) and (npc.StateFrame >= EGGY_STATE_FRAME_OF_FINAL_SPIDER)
56
+ return npc.State == NpcState.STATE_SUICIDE and npc.StateFrame >= EGGY_STATE_FRAME_OF_FINAL_SPIDER
53
57
  end
54
58
  function ____exports.isRaglingDeathPatch(self, npc)
55
- return ((npc.Type == EntityType.ENTITY_RAGLING) and (npc.Variant == 1)) and (npc.State == NpcState.STATE_SPECIAL)
59
+ return npc.Type == EntityType.ENTITY_RAGLING and npc.Variant == 1 and npc.State == NpcState.STATE_SPECIAL
56
60
  end
57
61
  NON_ALIVE_NPCS_TYPE_VARIANT = __TS__New(
58
62
  Set,
@@ -70,16 +74,12 @@ NON_ALIVE_NPCS_TYPE_VARIANT = __TS__New(
70
74
  )
71
75
  NON_ALIVE_NPCS_TYPE_VARIANT_SUBTYPE = __TS__New(
72
76
  Set,
73
- {
74
- (((tostring(EntityType.ENTITY_CHARGER) .. ".") .. 0) .. ".") .. 1
75
- }
77
+ {(((tostring(EntityType.ENTITY_CHARGER) .. ".") .. 0) .. ".") .. 1}
76
78
  )
77
79
  function ____exports.getAliveBosses(self)
78
80
  local aliveBosses = {}
79
- for ____, boss in ipairs(
80
- ____exports.getBosses(nil)
81
- ) do
82
- if (not boss:IsDead()) and (not ____exports.isAliveExceptionNPC(nil, boss)) then
81
+ for ____, boss in ipairs(____exports.getBosses(nil)) do
82
+ if not boss:IsDead() and not ____exports.isAliveExceptionNPC(nil, boss) then
83
83
  __TS__ArrayPush(aliveBosses, boss)
84
84
  end
85
85
  end
@@ -87,10 +87,8 @@ function ____exports.getAliveBosses(self)
87
87
  end
88
88
  function ____exports.getAliveNPCs(self)
89
89
  local aliveNPCs = {}
90
- for ____, npc in ipairs(
91
- ____exports.getNPCs(nil)
92
- ) do
93
- if (not npc:IsDead()) and (not ____exports.isAliveExceptionNPC(nil, npc)) then
90
+ for ____, npc in ipairs(____exports.getNPCs(nil)) do
91
+ if not npc:IsDead() and not ____exports.isAliveExceptionNPC(nil, npc) then
94
92
  __TS__ArrayPush(aliveNPCs, npc)
95
93
  end
96
94
  end
@@ -1,4 +1,9 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
- /** Has an equal chance of returning any value in the `HeartSubType` enum. */
3
- export declare function getRandomHeartSubType(seed?: number): HeartSubType;
2
+ /**
3
+ * Has as an equal chance of returning any value in the `HeartSubType` enum. Useful for spawning a random type of heart.
4
+ *
5
+ * @param seed Optional. The seed with which to select the random sub-type. `Random()` by default.
6
+ * @param exceptions Optional. An array of sub-types to not select.
7
+ */
8
+ export declare function getRandomHeartSubType(seed?: number, exceptions?: HeartSubType[]): HeartSubType;
4
9
  export declare function isChest(pickup: EntityPickup): boolean;
@@ -5,14 +5,30 @@ local ____array = require("functions.array")
5
5
  local getRandomArrayElement = ____array.getRandomArrayElement
6
6
  local ____util = require("functions.util")
7
7
  local getEnumValues = ____util.getEnumValues
8
- function ____exports.getRandomHeartSubType(self, seed)
8
+ function ____exports.getRandomHeartSubType(self, seed, exceptions)
9
9
  if seed == nil then
10
10
  seed = Random()
11
11
  end
12
+ if exceptions == nil then
13
+ exceptions = {}
14
+ end
12
15
  local heartSubTypes = getEnumValues(nil, HeartSubType)
13
- return getRandomArrayElement(nil, heartSubTypes, seed)
16
+ return getRandomArrayElement(nil, heartSubTypes, seed, exceptions)
14
17
  end
15
- local CHEST_PICKUP_VARIANTS = __TS__New(Set, {PickupVariant.PICKUP_CHEST, PickupVariant.PICKUP_BOMBCHEST, PickupVariant.PICKUP_SPIKEDCHEST, PickupVariant.PICKUP_ETERNALCHEST, PickupVariant.PICKUP_MIMICCHEST, PickupVariant.PICKUP_OLDCHEST, PickupVariant.PICKUP_WOODENCHEST, PickupVariant.PICKUP_MEGACHEST, PickupVariant.PICKUP_HAUNTEDCHEST, PickupVariant.PICKUP_LOCKEDCHEST, PickupVariant.PICKUP_REDCHEST, PickupVariant.PICKUP_MOMSCHEST})
18
+ local CHEST_PICKUP_VARIANTS = __TS__New(Set, {
19
+ PickupVariant.PICKUP_CHEST,
20
+ PickupVariant.PICKUP_BOMBCHEST,
21
+ PickupVariant.PICKUP_SPIKEDCHEST,
22
+ PickupVariant.PICKUP_ETERNALCHEST,
23
+ PickupVariant.PICKUP_MIMICCHEST,
24
+ PickupVariant.PICKUP_OLDCHEST,
25
+ PickupVariant.PICKUP_WOODENCHEST,
26
+ PickupVariant.PICKUP_MEGACHEST,
27
+ PickupVariant.PICKUP_HAUNTEDCHEST,
28
+ PickupVariant.PICKUP_LOCKEDCHEST,
29
+ PickupVariant.PICKUP_REDCHEST,
30
+ PickupVariant.PICKUP_MOMSCHEST
31
+ })
16
32
  function ____exports.isChest(self, pickup)
17
33
  return CHEST_PICKUP_VARIANTS:has(pickup.Variant)
18
34
  end