isaacscript-common 1.2.72 → 1.2.73

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.
@@ -39,6 +39,15 @@ export declare function getSurroundingGridEntities(gridEntity: GridEntity): Grid
39
39
  * Returns true if there are no pressure plates in the room.
40
40
  */
41
41
  export declare function isAllPressurePlatesPushed(): boolean;
42
+ export declare function isBreakableGridEntityByExplosion(gridEntity: GridEntity): boolean;
43
+ /**
44
+ * Helper function to see if the provided gridEntity is in its respective broken state. See the
45
+ * `GRID_ENTITY_TYPE_TO_BROKEN_STATE_MAP` constant for more details.
46
+ *
47
+ * Note that in the case of `GridEntityType.GRID_LOCK` (11), the state will turn to being broken
48
+ * before the actual collision for the entity is removed.
49
+ */
50
+ export declare function isGridEntityBroken(gridEntity: GridEntity): boolean;
42
51
  /**
43
52
  * Helper function to detect whether a given Void Portal is one that randomly spawns after a boss is
44
53
  * defeated or is one that naturally spawns in the room after Hush. (This is determined by looking
@@ -1,13 +1,15 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____lualib = require("lualib_bundle")
3
- local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
4
3
  local Set = ____lualib.Set
5
4
  local __TS__New = ____lualib.__TS__New
5
+ local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
6
6
  local __TS__ArrayPush = ____lualib.__TS__ArrayPush
7
7
  local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
8
8
  local ____exports = {}
9
9
  local ____constants = require("constants")
10
10
  local DISTANCE_OF_GRID_TILE = ____constants.DISTANCE_OF_GRID_TILE
11
+ local ____gridEntityTypeToBrokenStateMap = require("maps.gridEntityTypeToBrokenStateMap")
12
+ local GRID_ENTITY_TYPE_TO_BROKEN_STATE_MAP = ____gridEntityTypeToBrokenStateMap.GRID_ENTITY_TYPE_TO_BROKEN_STATE_MAP
11
13
  local ____gridEntityXMLMap = require("maps.gridEntityXMLMap")
12
14
  local GRID_ENTITY_XML_MAP = ____gridEntityXMLMap.GRID_ENTITY_XML_MAP
13
15
  local ____roomShapeToTopLeftWallGridIndexMap = require("maps.roomShapeToTopLeftWallGridIndexMap")
@@ -61,6 +63,23 @@ function ____exports.spawnGridEntityWithVariant(self, gridEntityType, variant, g
61
63
  end
62
64
  return gridEntity
63
65
  end
66
+ local BREAKABLE_GRID_ENTITY_TYPES_BY_EXPLOSIONS = __TS__New(Set, {
67
+ GridEntityType.GRID_ROCK,
68
+ GridEntityType.GRID_ROCKT,
69
+ GridEntityType.GRID_ROCK_BOMB,
70
+ GridEntityType.GRID_ROCK_ALT,
71
+ GridEntityType.GRID_SPIDERWEB,
72
+ GridEntityType.GRID_TNT,
73
+ GridEntityType.GRID_POOP,
74
+ GridEntityType.GRID_ROCK_SS,
75
+ GridEntityType.GRID_ROCK_SPIKED,
76
+ GridEntityType.GRID_ROCK_ALT2,
77
+ GridEntityType.GRID_ROCK_GOLD
78
+ })
79
+ local BREAKABLE_GRID_ENTITY_TYPES_VARIANTS_BY_EXPLOSIONS = __TS__New(
80
+ Set,
81
+ {(tostring(GridEntityType.GRID_STATUE) .. ".") .. 1}
82
+ )
64
83
  function ____exports.convertXMLGridEntityType(self, gridEntityXMLType, gridEntityXMLVariant)
65
84
  if gridEntityXMLType == EntityType.ENTITY_TRIGGER_OUTPUT then
66
85
  return nil
@@ -167,6 +186,17 @@ function ____exports.isAllPressurePlatesPushed(self)
167
186
  end
168
187
  )
169
188
  end
189
+ function ____exports.isBreakableGridEntityByExplosion(self, gridEntity)
190
+ local gridEntityType = gridEntity:GetType()
191
+ local gridEntityVariant = gridEntity:GetVariant()
192
+ local gridEntityTypeVariant = (tostring(gridEntityType) .. ".") .. tostring(gridEntityVariant)
193
+ return BREAKABLE_GRID_ENTITY_TYPES_BY_EXPLOSIONS:has(gridEntityType) or BREAKABLE_GRID_ENTITY_TYPES_VARIANTS_BY_EXPLOSIONS:has(gridEntityTypeVariant)
194
+ end
195
+ function ____exports.isGridEntityBroken(self, gridEntity)
196
+ local gridEntityType = gridEntity:GetType()
197
+ local brokenState = GRID_ENTITY_TYPE_TO_BROKEN_STATE_MAP:get(gridEntityType)
198
+ return gridEntity.State == brokenState
199
+ end
170
200
  function ____exports.isPostBossVoidPortal(self, gridEntity)
171
201
  local saveState = gridEntity:GetSaveState()
172
202
  return saveState.VarData == 1
package/dist/index.d.ts CHANGED
@@ -61,14 +61,19 @@ export * from "./functions/trinketSet";
61
61
  export * from "./functions/ui";
62
62
  export * from "./functions/utils";
63
63
  export * from "./functions/vector";
64
+ export * from "./maps/cardDescriptionMap";
64
65
  export * from "./maps/cardNameMap";
66
+ export * from "./maps/challengeNameMap";
67
+ export * from "./maps/collectibleDescriptionMap";
65
68
  export * from "./maps/collectibleNameMap";
69
+ export * from "./maps/gridEntityTypeToBrokenStateMap";
66
70
  export * from "./maps/gridEntityXMLMap";
67
71
  export * from "./maps/pillEffectClassMap";
68
72
  export * from "./maps/pillEffectNameMap";
69
73
  export * from "./maps/pillEffectTypeMap";
70
74
  export * from "./maps/roomShapeToTopLeftWallGridIndexMap";
71
75
  export * from "./maps/transformationNameMap";
76
+ export * from "./maps/trinketDescriptionMap";
72
77
  export * from "./maps/trinketNameMap";
73
78
  export * from "./sets/cards";
74
79
  export * from "./types/AnyEntity";
package/dist/index.lua CHANGED
@@ -498,6 +498,14 @@ do
498
498
  end
499
499
  end
500
500
  end
501
+ do
502
+ local ____export = require("maps.cardDescriptionMap")
503
+ for ____exportKey, ____exportValue in pairs(____export) do
504
+ if ____exportKey ~= "default" then
505
+ ____exports[____exportKey] = ____exportValue
506
+ end
507
+ end
508
+ end
501
509
  do
502
510
  local ____export = require("maps.cardNameMap")
503
511
  for ____exportKey, ____exportValue in pairs(____export) do
@@ -506,6 +514,22 @@ do
506
514
  end
507
515
  end
508
516
  end
517
+ do
518
+ local ____export = require("maps.challengeNameMap")
519
+ for ____exportKey, ____exportValue in pairs(____export) do
520
+ if ____exportKey ~= "default" then
521
+ ____exports[____exportKey] = ____exportValue
522
+ end
523
+ end
524
+ end
525
+ do
526
+ local ____export = require("maps.collectibleDescriptionMap")
527
+ for ____exportKey, ____exportValue in pairs(____export) do
528
+ if ____exportKey ~= "default" then
529
+ ____exports[____exportKey] = ____exportValue
530
+ end
531
+ end
532
+ end
509
533
  do
510
534
  local ____export = require("maps.collectibleNameMap")
511
535
  for ____exportKey, ____exportValue in pairs(____export) do
@@ -514,6 +538,14 @@ do
514
538
  end
515
539
  end
516
540
  end
541
+ do
542
+ local ____export = require("maps.gridEntityTypeToBrokenStateMap")
543
+ for ____exportKey, ____exportValue in pairs(____export) do
544
+ if ____exportKey ~= "default" then
545
+ ____exports[____exportKey] = ____exportValue
546
+ end
547
+ end
548
+ end
517
549
  do
518
550
  local ____export = require("maps.gridEntityXMLMap")
519
551
  for ____exportKey, ____exportValue in pairs(____export) do
@@ -562,6 +594,14 @@ do
562
594
  end
563
595
  end
564
596
  end
597
+ do
598
+ local ____export = require("maps.trinketDescriptionMap")
599
+ for ____exportKey, ____exportValue in pairs(____export) do
600
+ if ____exportKey ~= "default" then
601
+ ____exports[____exportKey] = ____exportValue
602
+ end
603
+ end
604
+ end
565
605
  do
566
606
  local ____export = require("maps.trinketNameMap")
567
607
  for ____exportKey, ____exportValue in pairs(____export) do
@@ -0,0 +1,2 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare const GRID_ENTITY_TYPE_TO_BROKEN_STATE_MAP: ReadonlyMap<GridEntityType, int>;
@@ -0,0 +1,20 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____lualib = require("lualib_bundle")
3
+ local Map = ____lualib.Map
4
+ local __TS__New = ____lualib.__TS__New
5
+ local ____exports = {}
6
+ ____exports.GRID_ENTITY_TYPE_TO_BROKEN_STATE_MAP = __TS__New(Map, {
7
+ {GridEntityType.GRID_ROCK, 2},
8
+ {GridEntityType.GRID_ROCKT, 2},
9
+ {GridEntityType.GRID_ROCK_BOMB, 2},
10
+ {GridEntityType.GRID_ROCK_ALT, 2},
11
+ {GridEntityType.GRID_SPIDERWEB, 1},
12
+ {GridEntityType.GRID_LOCK, 1},
13
+ {GridEntityType.GRID_TNT, 4},
14
+ {GridEntityType.GRID_POOP, 1000},
15
+ {GridEntityType.GRID_ROCK_SS, 2},
16
+ {GridEntityType.GRID_ROCK_SPIKED, 2},
17
+ {GridEntityType.GRID_ROCK_ALT2, 2},
18
+ {GridEntityType.GRID_ROCK_GOLD, 2}
19
+ })
20
+ return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.72",
3
+ "version": "1.2.73",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -26,7 +26,7 @@
26
26
  ],
27
27
  "devDependencies": {
28
28
  "@zamiell/typescript-to-lua": "^1.4.0",
29
- "isaac-typescript-definitions": "^1.0.349",
29
+ "isaac-typescript-definitions": "^1.0.353",
30
30
  "isaacscript-lint": "^1.0.81",
31
31
  "isaacscript-tsconfig": "^1.1.8",
32
32
  "typedoc": "^0.22.12",