isaacscript-common 31.5.0 → 31.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 (140) hide show
  1. package/dist/index.rollup.d.ts +34 -6
  2. package/dist/isaacscript-common.lua +641 -655
  3. package/dist/src/classes/DefaultMap.d.ts +2 -0
  4. package/dist/src/classes/DefaultMap.d.ts.map +1 -1
  5. package/dist/src/classes/ModFeature.d.ts.map +1 -1
  6. package/dist/src/classes/ModFeature.lua +5 -9
  7. package/dist/src/classes/ModUpgraded.d.ts.map +1 -1
  8. package/dist/src/classes/ModUpgraded.lua +8 -14
  9. package/dist/src/classes/callbacks/PostNewRoomEarly.lua +2 -2
  10. package/dist/src/classes/features/callbackLogic/CustomGridEntities.d.ts.map +1 -1
  11. package/dist/src/classes/features/callbackLogic/CustomGridEntities.lua +3 -3
  12. package/dist/src/classes/features/other/CharacterHealthConversion.lua +1 -1
  13. package/dist/src/classes/features/other/CustomItemPools.d.ts.map +1 -1
  14. package/dist/src/classes/features/other/CustomItemPools.lua +12 -6
  15. package/dist/src/classes/features/other/CustomStages.d.ts.map +1 -1
  16. package/dist/src/classes/features/other/CustomStages.lua +12 -14
  17. package/dist/src/classes/features/other/CustomTrapdoors.d.ts.map +1 -1
  18. package/dist/src/classes/features/other/CustomTrapdoors.lua +6 -8
  19. package/dist/src/classes/features/other/DeployJSONRoom.d.ts.map +1 -1
  20. package/dist/src/classes/features/other/DeployJSONRoom.lua +15 -15
  21. package/dist/src/classes/features/other/DisableInputs.d.ts.map +1 -1
  22. package/dist/src/classes/features/other/DisableInputs.lua +4 -6
  23. package/dist/src/classes/features/other/ModdedElementSets.d.ts.map +1 -1
  24. package/dist/src/classes/features/other/ModdedElementSets.lua +21 -12
  25. package/dist/src/classes/features/other/Pause.d.ts.map +1 -1
  26. package/dist/src/classes/features/other/Pause.lua +4 -6
  27. package/dist/src/classes/features/other/SaveDataManager.d.ts.map +1 -1
  28. package/dist/src/classes/features/other/SaveDataManager.lua +5 -9
  29. package/dist/src/classes/features/other/customStages/backdrop.lua +9 -10
  30. package/dist/src/classes/features/other/saveDataManager/restoreDefaults.lua +1 -1
  31. package/dist/src/functions/array.d.ts +3 -0
  32. package/dist/src/functions/array.d.ts.map +1 -1
  33. package/dist/src/functions/array.lua +9 -3
  34. package/dist/src/functions/bitSet128.d.ts.map +1 -1
  35. package/dist/src/functions/bitSet128.lua +4 -6
  36. package/dist/src/functions/bitwise.d.ts.map +1 -1
  37. package/dist/src/functions/bitwise.lua +7 -3
  38. package/dist/src/functions/color.d.ts.map +1 -1
  39. package/dist/src/functions/color.lua +5 -9
  40. package/dist/src/functions/deepCopy.lua +23 -31
  41. package/dist/src/functions/entities.d.ts.map +1 -1
  42. package/dist/src/functions/entities.lua +20 -18
  43. package/dist/src/functions/entitiesSpecific.d.ts.map +1 -1
  44. package/dist/src/functions/entitiesSpecific.lua +11 -27
  45. package/dist/src/functions/enums.d.ts +6 -4
  46. package/dist/src/functions/enums.d.ts.map +1 -1
  47. package/dist/src/functions/enums.lua +13 -9
  48. package/dist/src/functions/gridEntities.d.ts.map +1 -1
  49. package/dist/src/functions/gridEntities.lua +18 -11
  50. package/dist/src/functions/gridEntitiesSpecific.d.ts.map +1 -1
  51. package/dist/src/functions/gridEntitiesSpecific.lua +16 -28
  52. package/dist/src/functions/input.d.ts +5 -2
  53. package/dist/src/functions/input.d.ts.map +1 -1
  54. package/dist/src/functions/input.lua +25 -18
  55. package/dist/src/functions/jsonRoom.d.ts.map +1 -1
  56. package/dist/src/functions/jsonRoom.lua +35 -23
  57. package/dist/src/functions/kColor.d.ts.map +1 -1
  58. package/dist/src/functions/kColor.lua +6 -12
  59. package/dist/src/functions/map.d.ts.map +1 -1
  60. package/dist/src/functions/map.lua +3 -3
  61. package/dist/src/functions/minimap.d.ts.map +1 -1
  62. package/dist/src/functions/minimap.lua +17 -9
  63. package/dist/src/functions/playerDataStructures.d.ts +2 -0
  64. package/dist/src/functions/playerDataStructures.d.ts.map +1 -1
  65. package/dist/src/functions/playerDataStructures.lua +2 -0
  66. package/dist/src/functions/players.d.ts.map +1 -1
  67. package/dist/src/functions/players.lua +17 -22
  68. package/dist/src/functions/rng.d.ts.map +1 -1
  69. package/dist/src/functions/rng.lua +3 -3
  70. package/dist/src/functions/roomShapeWalls.d.ts.map +1 -1
  71. package/dist/src/functions/roomShapeWalls.lua +7 -3
  72. package/dist/src/functions/roomTransition.d.ts.map +1 -1
  73. package/dist/src/functions/roomTransition.lua +7 -3
  74. package/dist/src/functions/rooms.d.ts.map +1 -1
  75. package/dist/src/functions/rooms.lua +8 -5
  76. package/dist/src/functions/serialization.d.ts.map +1 -1
  77. package/dist/src/functions/serialization.lua +8 -18
  78. package/dist/src/functions/sprites.d.ts +2 -0
  79. package/dist/src/functions/sprites.d.ts.map +1 -1
  80. package/dist/src/functions/sprites.lua +2 -0
  81. package/dist/src/functions/table.d.ts.map +1 -1
  82. package/dist/src/functions/table.lua +6 -12
  83. package/dist/src/functions/tstlClass.d.ts.map +1 -1
  84. package/dist/src/functions/tstlClass.lua +3 -3
  85. package/dist/src/functions/utils.d.ts +9 -0
  86. package/dist/src/functions/utils.d.ts.map +1 -1
  87. package/dist/src/functions/utils.lua +14 -6
  88. package/dist/src/functions/vector.d.ts.map +1 -1
  89. package/dist/src/functions/vector.lua +4 -6
  90. package/dist/src/functions/weighted.d.ts.map +1 -1
  91. package/dist/src/functions/weighted.lua +7 -3
  92. package/dist/src/sets/bossSets.d.ts.map +1 -1
  93. package/dist/src/sets/bossSets.lua +3 -3
  94. package/package.json +2 -2
  95. package/src/classes/DefaultMap.ts +2 -0
  96. package/src/classes/ModFeature.ts +16 -12
  97. package/src/classes/ModUpgraded.ts +19 -16
  98. package/src/classes/callbacks/PostNewRoomEarly.ts +2 -2
  99. package/src/classes/features/callbackLogic/CustomGridEntities.ts +2 -3
  100. package/src/classes/features/other/CharacterHealthConversion.ts +1 -1
  101. package/src/classes/features/other/CustomItemPools.ts +9 -8
  102. package/src/classes/features/other/CustomStages.ts +9 -10
  103. package/src/classes/features/other/CustomTrapdoors.ts +9 -10
  104. package/src/classes/features/other/DeployJSONRoom.ts +21 -21
  105. package/src/classes/features/other/DisableInputs.ts +6 -5
  106. package/src/classes/features/other/ModdedElementSets.ts +18 -21
  107. package/src/classes/features/other/Pause.ts +9 -6
  108. package/src/classes/features/other/SaveDataManager.ts +14 -16
  109. package/src/classes/features/other/customStages/backdrop.ts +5 -6
  110. package/src/classes/features/other/saveDataManager/restoreDefaults.ts +1 -1
  111. package/src/functions/array.ts +8 -6
  112. package/src/functions/bitSet128.ts +9 -10
  113. package/src/functions/bitwise.ts +6 -3
  114. package/src/functions/color.ts +13 -15
  115. package/src/functions/deepCopy.ts +18 -24
  116. package/src/functions/deepCopyTests.ts +5 -6
  117. package/src/functions/entities.ts +22 -20
  118. package/src/functions/entitiesSpecific.ts +10 -27
  119. package/src/functions/enums.ts +29 -17
  120. package/src/functions/gridEntities.ts +14 -16
  121. package/src/functions/gridEntitiesSpecific.ts +15 -28
  122. package/src/functions/input.ts +15 -7
  123. package/src/functions/jsonRoom.ts +39 -27
  124. package/src/functions/kColor.ts +17 -20
  125. package/src/functions/map.ts +5 -5
  126. package/src/functions/minimap.ts +16 -15
  127. package/src/functions/playerDataStructures.ts +2 -0
  128. package/src/functions/players.ts +7 -10
  129. package/src/functions/rng.ts +5 -5
  130. package/src/functions/roomShapeWalls.ts +3 -4
  131. package/src/functions/roomTransition.ts +5 -5
  132. package/src/functions/rooms.ts +5 -6
  133. package/src/functions/serialization.ts +25 -30
  134. package/src/functions/sprites.ts +2 -0
  135. package/src/functions/table.ts +18 -20
  136. package/src/functions/tstlClass.ts +5 -5
  137. package/src/functions/utils.ts +27 -6
  138. package/src/functions/vector.ts +9 -10
  139. package/src/functions/weighted.ts +5 -5
  140. package/src/sets/bossSets.ts +5 -5
@@ -7,6 +7,8 @@ local ____entities = require("src.functions.entities")
7
7
  local getEntities = ____entities.getEntities
8
8
  local removeEntities = ____entities.removeEntities
9
9
  local spawn = ____entities.spawn
10
+ local ____utils = require("src.functions.utils")
11
+ local assertDefined = ____utils.assertDefined
10
12
  --- Helper function to get all of the bombs in the room. (Specifically, this refers to the
11
13
  -- `EntityBomb` class, not bomb pickups.)
12
14
  --
@@ -531,9 +533,7 @@ function ____exports.spawnBomb(self, bombVariant, subType, positionOrGridIndex,
531
533
  seedOrRNG
532
534
  )
533
535
  local bomb = entity:ToBomb()
534
- if bomb == nil then
535
- error("Failed to spawn a bomb.")
536
- end
536
+ assertDefined(nil, bomb, "Failed to spawn a bomb.")
537
537
  return bomb
538
538
  end
539
539
  --- Helper function to spawn a `EntityType.BOMB` (4) with a specific seed.
@@ -567,9 +567,7 @@ function ____exports.spawnEffect(self, effectVariant, subType, positionOrGridInd
567
567
  seedOrRNG
568
568
  )
569
569
  local effect = entity:ToEffect()
570
- if effect == nil then
571
- error("Failed to spawn an effect.")
572
- end
570
+ assertDefined(nil, effect, "Failed to spawn an effect.")
573
571
  return effect
574
572
  end
575
573
  --- Helper function to spawn a `EntityType.EFFECT` (1000) with a specific seed.
@@ -606,9 +604,7 @@ function ____exports.spawnFamiliar(self, familiarVariant, subType, positionOrGri
606
604
  seedOrRNG
607
605
  )
608
606
  local familiar = entity:ToFamiliar()
609
- if familiar == nil then
610
- error("Failed to spawn a familiar.")
611
- end
607
+ assertDefined(nil, familiar, "Failed to spawn a familiar.")
612
608
  return familiar
613
609
  end
614
610
  --- Helper function to spawn a `EntityType.FAMILIAR` (3) with a specific seed.
@@ -642,9 +638,7 @@ function ____exports.spawnKnife(self, knifeVariant, subType, positionOrGridIndex
642
638
  seedOrRNG
643
639
  )
644
640
  local knife = entity:ToKnife()
645
- if knife == nil then
646
- error("Failed to spawn a knife.")
647
- end
641
+ assertDefined(nil, knife, "Failed to spawn a knife.")
648
642
  return knife
649
643
  end
650
644
  --- Helper function to spawn a `EntityType.KNIFE` (8) with a specific seed.
@@ -678,9 +672,7 @@ function ____exports.spawnLaser(self, laserVariant, subType, positionOrGridIndex
678
672
  seedOrRNG
679
673
  )
680
674
  local laser = entity:ToLaser()
681
- if laser == nil then
682
- error("Failed to spawn a laser.")
683
- end
675
+ assertDefined(nil, laser, "Failed to spawn a laser.")
684
676
  return laser
685
677
  end
686
678
  --- Helper function to spawn a `EntityType.LASER` (7) with a specific seed.
@@ -717,9 +709,7 @@ function ____exports.spawnNPC(self, entityType, variant, subType, positionOrGrid
717
709
  seedOrRNG
718
710
  )
719
711
  local npc = entity:ToNPC()
720
- if npc == nil then
721
- error("Failed to spawn an NPC.")
722
- end
712
+ assertDefined(nil, npc, "Failed to spawn an NPC.")
723
713
  return npc
724
714
  end
725
715
  --- Helper function to spawn an NPC with a specific seed.
@@ -757,9 +747,7 @@ function ____exports.spawnPickup(self, pickupVariant, subType, positionOrGridInd
757
747
  seedOrRNG
758
748
  )
759
749
  local pickup = entity:ToPickup()
760
- if pickup == nil then
761
- error("Failed to spawn a pickup.")
762
- end
750
+ assertDefined(nil, pickup, "Failed to spawn a pickup.")
763
751
  return pickup
764
752
  end
765
753
  --- Helper function to spawn a `EntityType.PICKUP` (5) with a specific seed.
@@ -793,9 +781,7 @@ function ____exports.spawnProjectile(self, projectileVariant, subType, positionO
793
781
  seedOrRNG
794
782
  )
795
783
  local projectile = entity:ToProjectile()
796
- if projectile == nil then
797
- error("Failed to spawn a projectile.")
798
- end
784
+ assertDefined(nil, projectile, "Failed to spawn a projectile.")
799
785
  return projectile
800
786
  end
801
787
  --- Helper function to spawn a `EntityType.PROJECTILE` (9) with a specific seed.
@@ -860,9 +846,7 @@ function ____exports.spawnTear(self, tearVariant, subType, positionOrGridIndex,
860
846
  seedOrRNG
861
847
  )
862
848
  local tear = entity:ToTear()
863
- if tear == nil then
864
- error("Failed to spawn a tear.")
865
- end
849
+ assertDefined(nil, tear, "Failed to spawn a tear.")
866
850
  return tear
867
851
  end
868
852
  --- Helper function to spawn a `EntityType.EntityType` (2) with a specific seed.
@@ -35,9 +35,9 @@ export declare function getEnumEntries<T>(transpiledEnum: T): Array<[key: string
35
35
  * For a more in depth explanation, see:
36
36
  * https://isaacscript.github.io/main/gotchas#iterating-over-enums
37
37
  */
38
- export declare function getEnumKeys<T>(transpiledEnum: T): string[];
38
+ export declare function getEnumKeys(transpiledEnum: Record<string | number, string | number>): string[];
39
39
  /** Helper function to get the amount of entries inside of an enum. */
40
- export declare function getEnumLength<T>(transpiledEnum: T): int;
40
+ export declare function getEnumLength(transpiledEnum: Record<string | number, string | number>): int;
41
41
  /**
42
42
  * TypeScriptToLua will transpile TypeScript enums to Lua tables that have a double mapping. Thus,
43
43
  * when you iterate over them, you will get both the names of the enums and the values of the enums,
@@ -58,8 +58,8 @@ export declare function getEnumValues<T>(transpiledEnum: T): Array<T[keyof T]>;
58
58
  /**
59
59
  * Helper function to get the enum value with the highest value.
60
60
  *
61
- * Note that this is not necessarily the enum value that is declared last, since there is no way to
62
- * infer that at run-time.
61
+ * Note that this is not necessarily the enum value that is declared last in the code, since there
62
+ * is no way to infer that at run-time.
63
63
  */
64
64
  export declare function getHighestEnumValue<T>(transpiledEnum: T): T[keyof T];
65
65
  /**
@@ -71,6 +71,8 @@ export declare function getHighestEnumValue<T>(transpiledEnum: T): T[keyof T];
71
71
  * @param exceptions Optional. An array of elements to skip over if selected.
72
72
  */
73
73
  export declare function getRandomEnumValue<T>(transpiledEnum: T, seedOrRNG?: Seed | RNG, exceptions?: Array<T[keyof T]> | ReadonlyArray<T[keyof T]>): T[keyof T];
74
+ /** Helper function to validate that a particular value exists inside of an enum. */
75
+ export declare function isEnumValue(value: number | string, transpiledEnum: Record<string | number, string | number>): boolean;
74
76
  /**
75
77
  * Helper function to check every value of a custom enum for -1. Will throw an run-time error if any
76
78
  * -1 values are found. This is helpful because many methods of the Isaac class return -1 if they
@@ -1 +1 @@
1
- {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../src/functions/enums.ts"],"names":[],"mappings":";;;AAMA;;;;;;;;;;;;;;;;GAgBG;AACH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,GAAG,MAAM,EACtB,cAAc,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GACvD,OAAO,CAGT;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAChC,kBAAkB,EAAE,MAAM,EAC1B,cAAc,EAAE,OAAO,GACtB,IAAI,CAQN;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,kBAAkB,EAAE,MAAM,EAC1B,cAAc,EAAE,CAAC,GAChB,IAAI,CAsBN;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,4BAA4B,CAE1C,CAAC,SAAS,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,EAC/B,IAAI,SAAS,MAAM,GAAG,MAAM,KACzB,IAAI,CAAG"}
@@ -1,6 +1,7 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local __TS__ArraySort = ____lualib.__TS__ArraySort
3
3
  local __TS__ArrayMap = ____lualib.__TS__ArrayMap
4
+ local __TS__ArrayIncludes = ____lualib.__TS__ArrayIncludes
4
5
  local __TS__New = ____lualib.__TS__New
5
6
  local ____exports = {}
6
7
  local ____ReadonlySet = require("src.types.ReadonlySet")
@@ -10,8 +11,10 @@ local getRandomArrayElement = ____array.getRandomArrayElement
10
11
  local ____rng = require("src.functions.rng")
11
12
  local getRandomSeed = ____rng.getRandomSeed
12
13
  local ____types = require("src.functions.types")
14
+ local isNumber = ____types.isNumber
13
15
  local isString = ____types.isString
14
16
  local ____utils = require("src.functions.utils")
17
+ local assertDefined = ____utils.assertDefined
15
18
  local iRange = ____utils.iRange
16
19
  --- TypeScriptToLua will transpile TypeScript enums to Lua tables that have a double mapping. Thus,
17
20
  -- when you iterate over them, you will get both the names of the enums and the values of the enums,
@@ -108,14 +111,12 @@ function ____exports.getEnumValues(self, transpiledEnum)
108
111
  end
109
112
  --- Helper function to get the enum value with the highest value.
110
113
  --
111
- -- Note that this is not necessarily the enum value that is declared last, since there is no way to
112
- -- infer that at run-time.
114
+ -- Note that this is not necessarily the enum value that is declared last in the code, since there
115
+ -- is no way to infer that at run-time.
113
116
  function ____exports.getHighestEnumValue(self, transpiledEnum)
114
117
  local enumValues = ____exports.getEnumValues(nil, transpiledEnum)
115
118
  local lastElement = enumValues[#enumValues]
116
- if lastElement == nil then
117
- error("Failed to get the last value from an enum since the enum was empty.")
118
- end
119
+ assertDefined(nil, lastElement, "Failed to get the last value from an enum since the enum was empty.")
119
120
  return lastElement
120
121
  end
121
122
  --- Helper function to get a random value from the provided enum.
@@ -134,6 +135,11 @@ function ____exports.getRandomEnumValue(self, transpiledEnum, seedOrRNG, excepti
134
135
  local enumValues = ____exports.getEnumValues(nil, transpiledEnum)
135
136
  return getRandomArrayElement(nil, enumValues, seedOrRNG, exceptions)
136
137
  end
138
+ --- Helper function to validate that a particular value exists inside of an enum.
139
+ function ____exports.isEnumValue(self, value, transpiledEnum)
140
+ local enumValues = ____exports.getEnumValues(nil, transpiledEnum)
141
+ return __TS__ArrayIncludes(enumValues, value)
142
+ end
137
143
  --- Helper function to check every value of a custom enum for -1. Will throw an run-time error if any
138
144
  -- -1 values are found. This is helpful because many methods of the Isaac class return -1 if they
139
145
  -- fail.
@@ -162,10 +168,8 @@ end
162
168
  function ____exports.validateEnumContiguous(self, transpiledEnumName, transpiledEnum)
163
169
  local values = ____exports.getEnumValues(nil, transpiledEnum)
164
170
  local lastValue = values[#values]
165
- if lastValue == nil then
166
- error("Failed to validate that an enum was contiguous, since the last value was undefined.")
167
- end
168
- if type(lastValue) ~= "number" then
171
+ assertDefined(nil, lastValue, "Failed to validate that an enum was contiguous, since the last value was undefined.")
172
+ if not isNumber(nil, lastValue) then
169
173
  error("Failed to validate that an enum was contiguous, since the last value was not a number.")
170
174
  end
171
175
  local valuesSet = __TS__New(ReadonlySet, values)
@@ -1 +1 @@
1
- {"version":3,"file":"gridEntities.d.ts","sourceRoot":"","sources":["../../../src/functions/gridEntities.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EAAE,GAAG,GAAG,IAAI,CA4B1D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,cAAc,EAAE,cAAc,EAC9B,mBAAmB,EAAE,GAAG,GAAG,MAAM,GAChC,UAAU,GAAG,SAAS,CAExB;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,GAAG,EACZ,mBAAmB,EAAE,GAAG,GAAG,MAAM,GAChC,UAAU,GAAG,SAAS,CAgCxB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,GAAG,GAAG,UAAU,GAAG,SAAS,CAkBtE"}
@@ -40,6 +40,7 @@ local ____types = require("src.functions.types")
40
40
  local asNumber = ____types.asNumber
41
41
  local isNumber = ____types.isNumber
42
42
  local ____utils = require("src.functions.utils")
43
+ local assertDefined = ____utils.assertDefined
43
44
  local eRange = ____utils.eRange
44
45
  local iRange = ____utils.iRange
45
46
  local ____vector = require("src.functions.vector")
@@ -175,9 +176,11 @@ local BREAKABLE_GRID_ENTITY_TYPES_VARIANTS_BY_EXPLOSIONS = __TS__New(
175
176
  -- 1000.0 in a room XML file, but `GridEntityType.ROCK` is equal to 2.
176
177
  function ____exports.convertXMLGridEntityType(self, gridEntityXMLType, gridEntityXMLVariant)
177
178
  local gridEntityArray = GRID_ENTITY_XML_MAP:get(gridEntityXMLType)
178
- if gridEntityArray == nil then
179
- error("Failed to find an entry in the grid entity map for XML entity type: " .. tostring(gridEntityXMLType))
180
- end
179
+ assertDefined(
180
+ nil,
181
+ gridEntityArray,
182
+ "Failed to find an entry in the grid entity map for XML entity type: " .. tostring(gridEntityXMLType)
183
+ )
181
184
  local gridEntityType = gridEntityArray[1]
182
185
  local variant = gridEntityArray[2]
183
186
  if gridEntityType == GridEntityType.SPIKES_ON_OFF or gridEntityType == GridEntityType.PRESSURE_PLATE or gridEntityType == GridEntityType.TELEPORTER then
@@ -236,13 +239,17 @@ function ____exports.getConstituentsFromGridEntityID(self, gridEntityID)
236
239
  end
237
240
  local gridEntityTypeString, variantString = table.unpack(parts)
238
241
  local gridEntityType = tonumber(gridEntityTypeString)
239
- if gridEntityType == nil then
240
- error("Failed to convert the grid entity type to a number: " .. tostring(gridEntityTypeString))
241
- end
242
+ assertDefined(
243
+ nil,
244
+ gridEntityType,
245
+ "Failed to convert the grid entity type to a number: " .. tostring(gridEntityTypeString)
246
+ )
242
247
  local variant = tonumber(variantString)
243
- if variant == nil then
244
- error("Failed to convert the grid entity variant to a number: " .. tostring(variantString))
245
- end
248
+ assertDefined(
249
+ nil,
250
+ variant,
251
+ "Failed to convert the grid entity variant to a number: " .. tostring(variantString)
252
+ )
246
253
  return {gridEntityType, variant}
247
254
  end
248
255
  --- Helper function to get every grid entity in the current room.
@@ -321,7 +328,7 @@ function ____exports.getGridEntitiesInRadius(self, targetPosition, radius)
321
328
  local gridIndex = room:GetGridIndex(position)
322
329
  local gridEntity = room:GetGridEntityFromPos(position)
323
330
  if gridEntity == nil or registeredGridIndexes:has(gridIndex) then
324
- goto __continue27
331
+ goto __continue24
325
332
  end
326
333
  registeredGridIndexes:add(gridIndex)
327
334
  local topLeft, bottomRight = table.unpack(____exports.getGridEntityCollisionPoints(nil, gridEntity))
@@ -335,7 +342,7 @@ function ____exports.getGridEntitiesInRadius(self, targetPosition, radius)
335
342
  gridEntities[#gridEntities + 1] = gridEntity
336
343
  end
337
344
  end
338
- ::__continue27::
345
+ ::__continue24::
339
346
  end
340
347
  end
341
348
  return gridEntities
@@ -1 +1 @@
1
- {"version":3,"file":"gridEntitiesSpecific.d.ts","sourceRoot":"","sources":["../../../src/functions/gridEntitiesSpecific.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EACL,iBAAiB,EACjB,WAAW,EAEX,UAAU,EACV,qBAAqB,EACrB,oBAAoB,EACpB,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAStC;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AAG,MAAM,GAChC,gBAAgB,GAAG,SAAS,CAE9B;AAED,sFAAsF;AACtF,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,GAAG,EACZ,mBAAmB,EAAE,GAAG,GAAG,MAAM,GAChC,gBAAgB,GAAG,SAAS,CAgB9B;AAED,4DAA4D;AAC5D,wBAAgB,QAAQ,CACtB,mBAAmB,EAAE,GAAG,GAAG,MAAM,GAChC,aAAa,GAAG,SAAS,CAE3B;AAED,oFAAoF;AACpF,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,GAAG,EACZ,mBAAmB,EAAE,GAAG,GAAG,MAAM,GAChC,aAAa,GAAG,SAAS,CAgB3B;AAED,mEAAmE;AACnE,wBAAgB,eAAe,CAC7B,mBAAmB,EAAE,GAAG,GAAG,MAAM,GAChC,UAAU,GAAG,SAAS,CAExB;AAED,2FAA2F;AAC3F,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,GAAG,EACZ,mBAAmB,EAAE,GAAG,GAAG,MAAM,GAChC,UAAU,GAAG,SAAS,CAMxB;AAED,iEAAiE;AACjE,wBAAgB,aAAa,CAC3B,mBAAmB,EAAE,GAAG,GAAG,MAAM,GAChC,UAAU,GAAG,SAAS,CAKxB;AAED,yFAAyF;AACzF,wBAAgB,wBAAwB,CACtC,eAAe,EAAE,eAAe,EAChC,mBAAmB,EAAE,GAAG,GAAG,MAAM,GAChC,UAAU,GAAG,SAAS,CAMxB"}
1
+ {"version":3,"file":"gridEntitiesSpecific.d.ts","sourceRoot":"","sources":["../../../src/functions/gridEntitiesSpecific.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EACL,iBAAiB,EACjB,WAAW,EAEX,UAAU,EACV,qBAAqB,EACrB,oBAAoB,EACpB,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAUtC;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,iBAAiB,GAAE,iBAAiB,GAAG,CAA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sB,CACpC,OAAO,EAAE,GAAG,EACZ,mBAAmB,EAAE,GAAG,GAAG,MAAM,GAChC,gBAAgB,GAAG,SAAS,CAc9B;AAED,4DAA4D;AAC5D,wBAAgB,QAAQ,CACtB,mBAAmB,EAAE,GAAG,GAAG,MAAM,GAChC,aAAa,GAAG,SAAS,CAE3B;AAED,oFAAoF;AACpF,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,GAAG,EACZ,mBAAmB,EAAE,GAAG,GAAG,MAAM,GAChC,aAAa,GAAG,SAAS,CAc3B;AAED,mEAAmE;AACnE,wBAAgB,eAAe,CAC7B,mBAAmB,EAAE,GAAG,GAAG,MAAM,GAChC,UAAU,GAAG,SAAS,CAExB;AAED,2FAA2F;AAC3F,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,GAAG,EACZ,mBAAmB,EAAE,GAAG,GAAG,MAAM,GAChC,UAAU,GAAG,SAAS,CAMxB;AAED,iEAAiE;AACjE,wBAAgB,aAAa,CAC3B,mBAAmB,EAAE,GAAG,GAAG,MAAM,GAChC,UAAU,GAAG,SAAS,CAKxB;AAED,yFAAyF;AACzF,wBAAgB,wBAAwB,CACtC,eAAe,EAAE,eAAe,EAChC,mBAAmB,EAAE,GAAG,GAAG,MAAM,GAChC,UAAU,GAAG,SAAS,CAMxB"}
@@ -14,6 +14,8 @@ local removeGridEntities = ____gridEntities.removeGridEntities
14
14
  local spawnGridEntityWithVariant = ____gridEntities.spawnGridEntityWithVariant
15
15
  local ____types = require("src.functions.types")
16
16
  local asNumber = ____types.asNumber
17
+ local ____utils = require("src.functions.utils")
18
+ local assertDefined = ____utils.assertDefined
17
19
  --- Helper function to spawn a `GridEntityType.CRAWL_SPACE` (18) with a specific variant.
18
20
  function ____exports.spawnCrawlSpaceWithVariant(self, crawlSpaceVariant, gridIndexOrPosition)
19
21
  return spawnGridEntityWithVariant(nil, GridEntityType.CRAWL_SPACE, crawlSpaceVariant, gridIndexOrPosition)
@@ -22,84 +24,70 @@ end
22
24
  function ____exports.spawnDoorWithVariant(self, doorVariant, gridIndexOrPosition)
23
25
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.DOOR, doorVariant, gridIndexOrPosition)
24
26
  if gridEntity == nil then
25
- return gridEntity
27
+ return nil
26
28
  end
27
29
  local door = gridEntity:ToDoor()
28
- if door == nil then
29
- error("Failed to spawn a door.")
30
- end
30
+ assertDefined(nil, door, "Failed to spawn a door.")
31
31
  return door
32
32
  end
33
33
  --- Helper function to spawn a `GridEntityType.PIT` (7) with a specific variant.
34
34
  function ____exports.spawnPitWithVariant(self, pitVariant, gridIndexOrPosition)
35
35
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.PIT, pitVariant, gridIndexOrPosition)
36
36
  if gridEntity == nil then
37
- return gridEntity
37
+ return nil
38
38
  end
39
39
  local pit = gridEntity:ToPit()
40
- if pit == nil then
41
- error("Failed to spawn a pit.")
42
- end
40
+ assertDefined(nil, pit, "Failed to spawn a pit.")
43
41
  return pit
44
42
  end
45
43
  --- Helper function to spawn a `GridEntityType.POOP` (14) with a specific variant.
46
44
  function ____exports.spawnPoopWithVariant(self, poopVariant, gridIndexOrPosition)
47
45
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.POOP, poopVariant, gridIndexOrPosition)
48
46
  if gridEntity == nil then
49
- return gridEntity
47
+ return nil
50
48
  end
51
49
  local poop = gridEntity:ToPoop()
52
- if poop == nil then
53
- error("Failed to spawn a poop.")
54
- end
50
+ assertDefined(nil, poop, "Failed to spawn a poop.")
55
51
  return poop
56
52
  end
57
53
  --- Helper function to spawn a `GridEntityType.PRESSURE_PLATE` (20) with a specific variant.
58
54
  function ____exports.spawnPressurePlateWithVariant(self, pressurePlateVariant, gridIndexOrPosition)
59
55
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.PRESSURE_PLATE, pressurePlateVariant, gridIndexOrPosition)
60
56
  if gridEntity == nil then
61
- return gridEntity
57
+ return nil
62
58
  end
63
59
  local pressurePlate = gridEntity:ToPressurePlate()
64
- if pressurePlate == nil then
65
- error("Failed to spawn a pressure plate.")
66
- end
60
+ assertDefined(nil, pressurePlate, "Failed to spawn a pressure plate.")
67
61
  return pressurePlate
68
62
  end
69
63
  --- Helper function to spawn a `GridEntityType.ROCK` (2) with a specific variant.
70
64
  function ____exports.spawnRockWithVariant(self, rockVariant, gridIndexOrPosition)
71
65
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.ROCK, rockVariant, gridIndexOrPosition)
72
66
  if gridEntity == nil then
73
- return gridEntity
67
+ return nil
74
68
  end
75
69
  local rock = gridEntity:ToRock()
76
- if rock == nil then
77
- error("Failed to spawn a rock.")
78
- end
70
+ assertDefined(nil, rock, "Failed to spawn a rock.")
79
71
  return rock
80
72
  end
81
73
  --- Helper function to spawn a `GridEntityType.SPIKES` (8) with a specific variant.
82
74
  function ____exports.spawnSpikesWithVariant(self, variant, gridIndexOrPosition)
83
75
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.SPIKES, variant, gridIndexOrPosition)
84
76
  if gridEntity == nil then
85
- return gridEntity
77
+ return nil
86
78
  end
87
79
  local spikes = gridEntity:ToSpikes()
88
- if spikes == nil then
89
- error("Failed to spawn spikes.")
90
- end
80
+ assertDefined(nil, spikes, "Failed to spawn spikes.")
91
81
  return spikes
92
82
  end
93
83
  --- Helper function to spawn a `GridEntityType.TNT` (12) with a specific variant.
94
84
  function ____exports.spawnTNTWithVariant(self, variant, gridIndexOrPosition)
95
85
  local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.TNT, variant, gridIndexOrPosition)
96
86
  if gridEntity == nil then
97
- return gridEntity
87
+ return nil
98
88
  end
99
89
  local tnt = gridEntity:ToTNT()
100
- if tnt == nil then
101
- error("Failed to spawn TNT.")
102
- end
90
+ assertDefined(nil, tnt, "Failed to spawn TNT.")
103
91
  return tnt
104
92
  end
105
93
  --- Helper function to spawn a `GridEntityType.TELEPORTER` (23) with a specific variant.
@@ -1,5 +1,8 @@
1
1
  import { ButtonAction, Controller, ControllerIndex, Keyboard } from "isaac-typescript-definitions";
2
+ export declare const MODIFIER_KEYS: readonly [Keyboard.LEFT_SHIFT, Keyboard.LEFT_CONTROL, Keyboard.LEFT_ALT, Keyboard.LEFT_SUPER, Keyboard.RIGHT_SHIFT, Keyboard.RIGHT_CONTROL, Keyboard.RIGHT_ALT, Keyboard.RIGHT_SUPER];
3
+ export declare const MOVEMENT_ACTIONS: readonly [ButtonAction.LEFT, ButtonAction.RIGHT, ButtonAction.UP, ButtonAction.DOWN];
2
4
  export declare const MOVEMENT_ACTIONS_SET: ReadonlySet<ButtonAction>;
5
+ export declare const SHOOTING_ACTIONS: readonly [ButtonAction.SHOOT_LEFT, ButtonAction.SHOOT_RIGHT, ButtonAction.SHOOT_UP, ButtonAction.SHOOT_DOWN];
3
6
  export declare const SHOOTING_ACTIONS_SET: ReadonlySet<ButtonAction>;
4
7
  /**
5
8
  * Helper function to get the enum name for the specified `Controller` value. Note that this will
@@ -8,8 +11,8 @@ export declare const SHOOTING_ACTIONS_SET: ReadonlySet<ButtonAction>;
8
11
  * Returns undefined if the submitted controller value was not valid.
9
12
  */
10
13
  export declare function controllerToString(controller: Controller): string | undefined;
11
- export declare function getMoveActions(): ReadonlySet<ButtonAction>;
12
- export declare function getShootActions(): ReadonlySet<ButtonAction>;
14
+ export declare function getMoveActions(controllerIndex: ControllerIndex): ButtonAction[];
15
+ export declare function getShootActions(controllerIndex: ControllerIndex): ButtonAction[];
13
16
  /**
14
17
  * Helper function to check if a player is pressing a specific button (i.e. holding it down).
15
18
  *
@@ -1 +1 @@
1
- {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/functions/input.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,UAAU,EACV,eAAe,EACf,QAAQ,EACT,MAAM,8BAA8B,CAAC;AAwBtC,eAAO,MAAM,oBAAoB,2BAEhC,CAAC;AASF,eAAO,MAAM,oBAAoB,2BAEhC,CAAC;AAEF;;;;;G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;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,IAAI,EAAE,QAAQ,EAAE,GAAG,OAAO,CAI9D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C;AAED,wBAAgB,YAAY,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAEhE;AAED,wBAAgB,mBAAmB,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAE7E;AAED,wBAAgB,6BAA6B,IAAI,OAAO,CAIvD;AAED,wBAAgB,qBAAqB,CACnC,eAAe,EAAE,eAAe,GAC/B,OAAO,CAET;AAED,wBAAgB,+BAA+B,IAAI,OAAO,CAIzD;AAED,wBAAgB,aAAa,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAEjE;AAED,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,eAAe,GAC/B,OAAO,CAET;AAED,wBAAgB,8BAA8B,IAAI,OAAO,CAIxD;AAED,wBAAgB,sBAAsB,CACpC,eAAe,EAAE,eAAe,GAC/B,OAAO,CAET;AAED,wBAAgB,gCAAgC,IAAI,OAAO,CAI1D;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,OAAO,GACjB,MAAM,GAAG,SAAS,CAQpB"}
@@ -1,5 +1,6 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local __TS__New = ____lualib.__TS__New
3
+ local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
3
4
  local __TS__ArraySome = ____lualib.__TS__ArraySome
4
5
  local ____exports = {}
5
6
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
@@ -15,7 +16,7 @@ local ____ReadonlySet = require("src.types.ReadonlySet")
15
16
  local ReadonlySet = ____ReadonlySet.ReadonlySet
16
17
  local ____string = require("src.functions.string")
17
18
  local trimPrefix = ____string.trimPrefix
18
- local MODIFIER_KEYS = {
19
+ ____exports.MODIFIER_KEYS = {
19
20
  Keyboard.LEFT_SHIFT,
20
21
  Keyboard.LEFT_CONTROL,
21
22
  Keyboard.LEFT_ALT,
@@ -25,10 +26,10 @@ local MODIFIER_KEYS = {
25
26
  Keyboard.RIGHT_ALT,
26
27
  Keyboard.RIGHT_SUPER
27
28
  }
28
- local MOVEMENT_ACTIONS = {ButtonAction.LEFT, ButtonAction.RIGHT, ButtonAction.UP, ButtonAction.DOWN}
29
- ____exports.MOVEMENT_ACTIONS_SET = __TS__New(ReadonlySet, MOVEMENT_ACTIONS)
30
- local SHOOTING_ACTIONS = {ButtonAction.SHOOT_LEFT, ButtonAction.SHOOT_RIGHT, ButtonAction.SHOOT_UP, ButtonAction.SHOOT_DOWN}
31
- ____exports.SHOOTING_ACTIONS_SET = __TS__New(ReadonlySet, SHOOTING_ACTIONS)
29
+ ____exports.MOVEMENT_ACTIONS = {ButtonAction.LEFT, ButtonAction.RIGHT, ButtonAction.UP, ButtonAction.DOWN}
30
+ ____exports.MOVEMENT_ACTIONS_SET = __TS__New(ReadonlySet, ____exports.MOVEMENT_ACTIONS)
31
+ ____exports.SHOOTING_ACTIONS = {ButtonAction.SHOOT_LEFT, ButtonAction.SHOOT_RIGHT, ButtonAction.SHOOT_UP, ButtonAction.SHOOT_DOWN}
32
+ ____exports.SHOOTING_ACTIONS_SET = __TS__New(ReadonlySet, ____exports.SHOOTING_ACTIONS)
32
33
  --- Helper function to get the enum name for the specified `Controller` value. Note that this will
33
34
  -- trim off the "BUTTON_" prefix.
34
35
  --
@@ -40,11 +41,17 @@ function ____exports.controllerToString(self, controller)
40
41
  end
41
42
  return trimPrefix(nil, key, "BUTTON_")
42
43
  end
43
- function ____exports.getMoveActions(self)
44
- return ____exports.MOVEMENT_ACTIONS_SET
44
+ function ____exports.getMoveActions(self, controllerIndex)
45
+ return __TS__ArrayFilter(
46
+ ____exports.MOVEMENT_ACTIONS,
47
+ function(____, buttonAction) return Input.IsActionPressed(buttonAction, controllerIndex) end
48
+ )
45
49
  end
46
- function ____exports.getShootActions(self)
47
- return ____exports.SHOOTING_ACTIONS_SET
50
+ function ____exports.getShootActions(self, controllerIndex)
51
+ return __TS__ArrayFilter(
52
+ ____exports.SHOOTING_ACTIONS,
53
+ function(____, buttonAction) return Input.IsActionPressed(buttonAction, controllerIndex) end
54
+ )
48
55
  end
49
56
  --- Helper function to check if a player is pressing a specific button (i.e. holding it down).
50
57
  --
@@ -119,7 +126,7 @@ end
119
126
  function ____exports.isModifierKeyPressed(self)
120
127
  return ____exports.isKeyboardPressed(
121
128
  nil,
122
- table.unpack(MODIFIER_KEYS)
129
+ table.unpack(____exports.MODIFIER_KEYS)
123
130
  )
124
131
  end
125
132
  function ____exports.isMoveAction(self, buttonAction)
@@ -129,12 +136,12 @@ function ____exports.isMoveActionPressed(self, controllerIndex)
129
136
  return ____exports.isActionPressed(
130
137
  nil,
131
138
  controllerIndex,
132
- table.unpack(MOVEMENT_ACTIONS)
139
+ table.unpack(____exports.MOVEMENT_ACTIONS)
133
140
  )
134
141
  end
135
142
  function ____exports.isMoveActionPressedOnAnyInput(self)
136
143
  return __TS__ArraySome(
137
- MOVEMENT_ACTIONS,
144
+ ____exports.MOVEMENT_ACTIONS,
138
145
  function(____, moveAction) return ____exports.isActionPressedOnAnyInput(nil, moveAction) end
139
146
  )
140
147
  end
@@ -142,12 +149,12 @@ function ____exports.isMoveActionTriggered(self, controllerIndex)
142
149
  return ____exports.isActionTriggered(
143
150
  nil,
144
151
  controllerIndex,
145
- table.unpack(MOVEMENT_ACTIONS)
152
+ table.unpack(____exports.MOVEMENT_ACTIONS)
146
153
  )
147
154
  end
148
155
  function ____exports.isMoveActionTriggeredOnAnyInput(self)
149
156
  return __TS__ArraySome(
150
- MOVEMENT_ACTIONS,
157
+ ____exports.MOVEMENT_ACTIONS,
151
158
  function(____, moveAction) return ____exports.isActionTriggeredOnAnyInput(nil, moveAction) end
152
159
  )
153
160
  end
@@ -158,12 +165,12 @@ function ____exports.isShootActionPressed(self, controllerIndex)
158
165
  return ____exports.isActionPressed(
159
166
  nil,
160
167
  controllerIndex,
161
- table.unpack(SHOOTING_ACTIONS)
168
+ table.unpack(____exports.SHOOTING_ACTIONS)
162
169
  )
163
170
  end
164
171
  function ____exports.isShootActionPressedOnAnyInput(self)
165
172
  return __TS__ArraySome(
166
- SHOOTING_ACTIONS,
173
+ ____exports.SHOOTING_ACTIONS,
167
174
  function(____, shootAction) return ____exports.isActionPressedOnAnyInput(nil, shootAction) end
168
175
  )
169
176
  end
@@ -171,12 +178,12 @@ function ____exports.isShootActionTriggered(self, controllerIndex)
171
178
  return ____exports.isActionTriggered(
172
179
  nil,
173
180
  controllerIndex,
174
- table.unpack(SHOOTING_ACTIONS)
181
+ table.unpack(____exports.SHOOTING_ACTIONS)
175
182
  )
176
183
  end
177
184
  function ____exports.isShootActionTriggeredOnAnyInput(self)
178
185
  return __TS__ArraySome(
179
- SHOOTING_ACTIONS,
186
+ ____exports.SHOOTING_ACTIONS,
180
187
  function(____, shootAction) return ____exports.isActionTriggeredOnAnyInput(nil, shootAction) end
181
188
  )
182
189
  end
@@ -1 +1 @@
1
- {"version":3,"file":"jsonRoom.d.ts","sourceRoot":"","sources":["../../../src/functions/jsonRoom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAa,MAAM,8BAA8B,CAAC;AAE5E,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAaxE;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,QAAQ,GACjB,QAAQ,CAAC,YAAY,CAAC,CAgDxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,QAAQ,EAAE,GAAG,SAAS,QAAQ,EAAE,EAC3C,OAAO,EAAE,GAAG,GACX,QAAQ,GAAG,SAAS,CAoBtB;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,QAAQ,EAAE,GAAG,SAAS,QAAQ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