isaacscript-common 1.0.494 → 1.0.498

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.
@@ -9,14 +9,28 @@ export declare const BOMB_EXPLODE_FRAME = 45;
9
9
  export declare const CHARACTERS_WITH_AN_ACTIVE_ITEM: Set<PlayerType>;
10
10
  /**
11
11
  * The set of characters where red heart containers will be turned into soul hearts (e.g. Blue
12
- * Baby). This set includes The Lost and Tainted Lost.
12
+ * Baby). This includes The Lost and Tainted Lost. This does not include Keeper or Tainted Keeper.
13
13
  */
14
14
  export declare const CHARACTERS_WITH_NO_RED_HEARTS: Set<PlayerType>;
15
15
  /**
16
16
  * The set of characters where soul hearts will be automatically stripped away (e.g. Bethany). This
17
- * set includes The Lost and Tainted Lost.
17
+ * includes The Lost and Tainted Lost.
18
18
  */
19
19
  export declare const CHARACTERS_WITH_NO_SOUL_HEARTS: Set<PlayerType>;
20
+ /**
21
+ * A collection of common colors that can be reused. Note that if you want to further modify these
22
+ * colors, you should copy them first with the `copyColor` function.
23
+ */
24
+ export declare const COLORS: {
25
+ BLACK: Color;
26
+ RED: Color;
27
+ GREEN: Color;
28
+ BLUE: Color;
29
+ YELLOW: Color;
30
+ PINK: Color;
31
+ CYAN: Color;
32
+ WHITE: Color;
33
+ };
20
34
  export declare const DEFAULT_ITEM_POOL_TYPE = ItemPoolType.POOL_TREASURE;
21
35
  /** This is also the distance that a player spawns from the door that they enter a room from. */
22
36
  export declare const DISTANCE_OF_GRID_TILE = 40;
@@ -27,6 +41,8 @@ export declare const DOOR_HITBOX_DISTANCE = 11;
27
41
  * value.
28
42
  */
29
43
  export declare const EGGY_STATE_FRAME_OF_FINAL_SPIDER = 45;
44
+ /** As of Repentance, the final stage is floor 13 (which is the Home floor). */
45
+ export declare const FINAL_STAGE: number;
30
46
  /**
31
47
  * The random items that appear when the player has TMTRAINER are generated on the fly as they are
32
48
  * encountered by the player. The first TMTRAINER item takes the final possible 32 bit number. The
@@ -26,11 +26,28 @@ ____exports.CHARACTERS_WITH_NO_RED_HEARTS = __TS__New(Set, {
26
26
  PlayerType.PLAYER_THEFORGOTTEN_B,
27
27
  PlayerType.PLAYER_BETHANY_B
28
28
  })
29
- ____exports.CHARACTERS_WITH_NO_SOUL_HEARTS = __TS__New(Set, {PlayerType.PLAYER_THELOST, PlayerType.PLAYER_BETHANY, PlayerType.PLAYER_THELOST_B})
29
+ ____exports.CHARACTERS_WITH_NO_SOUL_HEARTS = __TS__New(Set, {
30
+ PlayerType.PLAYER_THELOST,
31
+ PlayerType.PLAYER_KEEPER,
32
+ PlayerType.PLAYER_BETHANY,
33
+ PlayerType.PLAYER_THELOST_B,
34
+ PlayerType.PLAYER_KEEPER_B
35
+ })
36
+ ____exports.COLORS = {
37
+ BLACK = Color(1, 1, 1),
38
+ RED = Color(1, 0, 0),
39
+ GREEN = Color(0, 1, 0),
40
+ BLUE = Color(0, 0, 1),
41
+ YELLOW = Color(1, 1, 0),
42
+ PINK = Color(1, 0, 1),
43
+ CYAN = Color(0, 1, 1),
44
+ WHITE = Color(1, 1, 1)
45
+ }
30
46
  ____exports.DEFAULT_ITEM_POOL_TYPE = ItemPoolType.POOL_TREASURE
31
47
  ____exports.DISTANCE_OF_GRID_TILE = 40
32
48
  ____exports.DOOR_HITBOX_DISTANCE = 11
33
49
  ____exports.EGGY_STATE_FRAME_OF_FINAL_SPIDER = 45
50
+ ____exports.FINAL_STAGE = LevelStage.NUM_STAGES - 1
34
51
  ____exports.FIRST_GLITCHED_COLLECTIBLE_TYPE = (1 << 32) - 1
35
52
  ____exports.GENESIS_ROOM_VARIANT = 1000
36
53
  ____exports.GENESIS_ROOM_SUBTYPE = 99
@@ -56,6 +56,12 @@ export declare function isGlitchedCollectible(entity: Entity): boolean;
56
56
  */
57
57
  export declare function isPassiveCollectible(collectibleType: CollectibleType | int): boolean;
58
58
  export declare function isQuestCollectible(collectibleType: CollectibleType | int): boolean;
59
+ /**
60
+ * Helper function to see if a particular collectible will disappear from the player's inventory
61
+ * upon use. Note that this will not work will modded items, as there is no way to dynamically know
62
+ * if a modded item will disappear.
63
+ */
64
+ export declare function isSingleUseCollectible(collectibleType: CollectibleType | int): boolean;
59
65
  /**
60
66
  * Helper function to remove all of the collectibles in the room.
61
67
  *
@@ -2,6 +2,8 @@
2
2
  require("lualib_bundle");
3
3
  local ____exports = {}
4
4
  local COLLECTIBLE_SPRITE_LAYER
5
+ local ____constants = require("constants")
6
+ local SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES = ____constants.SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES
5
7
  local ____collectibleDescriptionMap = require("maps.collectibleDescriptionMap")
6
8
  local COLLECTIBLE_DESCRIPTION_MAP = ____collectibleDescriptionMap.COLLECTIBLE_DESCRIPTION_MAP
7
9
  local ____collectibleNameMap = require("maps.collectibleNameMap")
@@ -136,6 +138,9 @@ end
136
138
  function ____exports.isQuestCollectible(self, collectibleType)
137
139
  return ____exports.collectibleHasTag(nil, collectibleType, 32768)
138
140
  end
141
+ function ____exports.isSingleUseCollectible(self, collectibleType)
142
+ return SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES:has(collectibleType)
143
+ end
139
144
  function ____exports.removeAllCollectibles(self, collectibleType, cap)
140
145
  removeAllPickups(nil, PickupVariant.PICKUP_COLLECTIBLE, collectibleType, cap)
141
146
  end
@@ -22,8 +22,9 @@ export declare function anyPlayerHasTrinket(trinketType: TrinketType | int): boo
22
22
  export declare function anyPlayerIs(matchingCharacter: PlayerType): boolean;
23
23
  /**
24
24
  * Helper function to see if the provided character can have red heart containers. Returns true for
25
- * characters like Isaac, Magdalene, or Cain. Returns false for characters like Blue Baby. Returns
26
- * false for The Lost and Tainted Lost.
25
+ * characters like Isaac, Magdalene, or Cain. Returns true for Keeper and Tainted Keeper, even
26
+ * though coin containers are not technically the same as red heart containers. Returns false for
27
+ * characters like Blue Baby. Returns false for The Lost and Tainted Lost.
27
28
  */
28
29
  export declare function characterCanHaveRedHearts(character: PlayerType): boolean;
29
30
  /**
@@ -24,9 +24,9 @@ export declare function getRoomData(): RoomConfig | undefined;
24
24
  export declare function getRoomDataType(): int;
25
25
  /**
26
26
  * Helper function to get the room index of the current room. Use this instead of calling
27
- * `Game().GetLevel().GetCurrentRoomIndex()` directly to avoid bugs with big rooms.
28
- * (Big rooms will return the specific 1x1 quadrant that the player entered the room at,
29
- * which can break data structures that use the room index as an index.)
27
+ * `Level.GetCurrentRoomIndex()` directly to avoid bugs with big rooms. (Big rooms will return the
28
+ * specific 1x1 quadrant that the player entered the room at, which can break data structures that
29
+ * use the room index as an index.)
30
30
  */
31
31
  export declare function getRoomIndex(): int;
32
32
  /**
@@ -23,10 +23,6 @@ local hasFlag = ____flag.hasFlag
23
23
  function ____exports.getRoomIndex(self)
24
24
  local game = Game()
25
25
  local level = game:GetLevel()
26
- local roomIndex = level:GetCurrentRoomIndex()
27
- if roomIndex < 0 then
28
- return roomIndex
29
- end
30
26
  local roomDesc = level:GetCurrentRoomDesc()
31
27
  return roomDesc.SafeGridIndex
32
28
  end
@@ -223,14 +219,14 @@ function ____exports.setRoomCleared(self)
223
219
  for ____, door in ipairs(getDoors(nil)) do
224
220
  do
225
221
  if isHiddenSecretRoomDoor(nil, door) then
226
- goto __continue39
222
+ goto __continue38
227
223
  end
228
224
  door.State = DoorState.STATE_OPEN
229
225
  local sprite = door:GetSprite()
230
226
  sprite:Play("Opened", true)
231
227
  door.ExtraVisible = false
232
228
  end
233
- ::__continue39::
229
+ ::__continue38::
234
230
  end
235
231
  sfx:Stop(SoundEffect.SOUND_DOOR_HEAVY_OPEN)
236
232
  game:ShakeScreen(0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.494",
3
+ "version": "1.0.498",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -25,7 +25,7 @@
25
25
  "dist/**/*.d.ts"
26
26
  ],
27
27
  "devDependencies": {
28
- "isaac-typescript-definitions": "^1.0.285",
28
+ "isaac-typescript-definitions": "^1.0.286",
29
29
  "isaacscript-lint": "^1.0.68",
30
30
  "typedoc": "^0.22.10",
31
31
  "typescript": "4.5.2",