isaacscript-common 1.0.454 → 1.0.458

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.
@@ -6,7 +6,9 @@
6
6
  export declare const AZAZEL_DEFAULT_BRIMSTONE_DISTANCE = 75.125;
7
7
  /** Bombs explode when their frame count is equal to this value. */
8
8
  export declare const BOMB_EXPLODE_FRAME = 45;
9
+ export declare const CHARACTERS_WITH_AN_ACTIVE_ITEM: Set<PlayerType>;
9
10
  export declare const CHARACTERS_WITH_NO_RED_HEARTS: Set<PlayerType>;
11
+ export declare const DEFAULT_ITEM_POOL_TYPE = ItemPoolType.POOL_TREASURE;
10
12
  /** This is also the distance that a player spawns from the door that they enter a room from. */
11
13
  export declare const DISTANCE_OF_GRID_TILE = 40;
12
14
  export declare const DOOR_HITBOX_DISTANCE = 11;
@@ -23,6 +25,7 @@ export declare const EGGY_STATE_FRAME_OF_FINAL_SPIDER = 45;
23
25
  */
24
26
  export declare const FIRST_GLITCHED_COLLECTIBLE_TYPE: number;
25
27
  export declare const GENESIS_ROOM_VARIANT = 1000;
28
+ export declare const GENESIS_ROOM_SUBTYPE = 99;
26
29
  export declare const GOLDEN_TRINKET_SHIFT: number;
27
30
  /**
28
31
  * This maps the GridEntityXMLType (i.e. the type contained in the room XML/STB file) to the
@@ -62,6 +65,7 @@ export declare const MAX_ROOM_INDEX = 168;
62
65
  export declare const MAX_VANILLA_COLLECTIBLE_TYPE = CollectibleType.COLLECTIBLE_MOMS_RING;
63
66
  export declare const MOVEMENT_ACTIONS: Set<ButtonAction>;
64
67
  export declare const ONE_BY_ONE_ROOM_GRID_SIZE = 135;
68
+ export declare const ROOM_TYPE_TO_ITEM_POOL_TYPE_MAP: Map<RoomType, ItemPoolType>;
65
69
  export declare const SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES: Set<CollectibleType>;
66
70
  export declare const SHOOTING_ACTIONS: Set<ButtonAction>;
67
71
  /**
@@ -3,12 +3,15 @@ require("lualib_bundle");
3
3
  local ____exports = {}
4
4
  ____exports.AZAZEL_DEFAULT_BRIMSTONE_DISTANCE = 75.125
5
5
  ____exports.BOMB_EXPLODE_FRAME = 45
6
+ ____exports.CHARACTERS_WITH_AN_ACTIVE_ITEM = __TS__New(Set, {PlayerType.PLAYER_ISAAC, PlayerType.PLAYER_MAGDALENE, PlayerType.PLAYER_JUDAS, PlayerType.PLAYER_BLUEBABY, PlayerType.PLAYER_EVE, PlayerType.PLAYER_EDEN, PlayerType.PLAYER_THELOST, PlayerType.PLAYER_LILITH, PlayerType.PLAYER_KEEPER, PlayerType.PLAYER_APOLLYON, PlayerType.PLAYER_EDEN_B})
6
7
  ____exports.CHARACTERS_WITH_NO_RED_HEARTS = __TS__New(Set, {PlayerType.PLAYER_BLUEBABY, PlayerType.PLAYER_BLACKJUDAS, PlayerType.PLAYER_JUDAS_B, PlayerType.PLAYER_BLUEBABY_B, PlayerType.PLAYER_THEFORGOTTEN_B, PlayerType.PLAYER_BETHANY_B})
8
+ ____exports.DEFAULT_ITEM_POOL_TYPE = ItemPoolType.POOL_TREASURE
7
9
  ____exports.DISTANCE_OF_GRID_TILE = 40
8
10
  ____exports.DOOR_HITBOX_DISTANCE = 11
9
11
  ____exports.EGGY_STATE_FRAME_OF_FINAL_SPIDER = 45
10
12
  ____exports.FIRST_GLITCHED_COLLECTIBLE_TYPE = (1 << 32) - 1
11
13
  ____exports.GENESIS_ROOM_VARIANT = 1000
14
+ ____exports.GENESIS_ROOM_SUBTYPE = 99
12
15
  ____exports.GOLDEN_TRINKET_SHIFT = 1 << 15
13
16
  ____exports.GRID_ENTITY_XML_MAP = __TS__New(Map, {{1000, {GridEntityType.GRID_ROCK, 0}}, {1001, {GridEntityType.GRID_ROCK_BOMB, 0}}, {1002, {GridEntityType.GRID_ROCK_ALT, 0}}, {1003, {GridEntityType.GRID_ROCKT, 0}}, {1008, {GridEntityType.GRID_ROCK_ALT2, 0}}, {1009, {GridEntityType.GRID_ROCK_ALT2, 1}}, {1010, {GridEntityType.GRID_ROCK_SPIKED, 0}}, {1011, {GridEntityType.GRID_ROCK_GOLD, 0}}, {1300, {GridEntityType.GRID_TNT, 0}}, {1490, {GridEntityType.GRID_POOP, 1}}, {1494, {GridEntityType.GRID_POOP, 4}}, {1495, {GridEntityType.GRID_POOP, 2}}, {1496, {GridEntityType.GRID_POOP, 3}}, {1497, {GridEntityType.GRID_POOP, 5}}, {1498, {GridEntityType.GRID_POOP, 6}}, {1500, {GridEntityType.GRID_POOP, 0}}, {1501, {GridEntityType.GRID_POOP, 11}}, {1900, {GridEntityType.GRID_ROCKB, 0}}, {1901, {GridEntityType.GRID_PILLAR, 0}}, {1930, {GridEntityType.GRID_SPIKES, 0}}, {1931, {GridEntityType.GRID_SPIKES_ONOFF, 0}}, {1940, {GridEntityType.GRID_SPIDERWEB, 0}}, {1999, {GridEntityType.GRID_WALL, 0}}, {3000, {GridEntityType.GRID_PIT, 0}}, {3001, {GridEntityType.GRID_PIT, 16}}, {3009, {GridEntityType.GRID_PIT, 0}}, {4000, {GridEntityType.GRID_LOCK, 0}}, {4500, {GridEntityType.GRID_PRESSURE_PLATE, 0}}, {5000, {GridEntityType.GRID_STATUE, 0}}, {5001, {GridEntityType.GRID_STATUE, 1}}, {6100, {GridEntityType.GRID_TELEPORTER, 0}}, {9000, {GridEntityType.GRID_TRAPDOOR, 0}}, {9100, {GridEntityType.GRID_STAIRS, 0}}, {10000, {GridEntityType.GRID_GRAVITY, 0}}})
14
17
  ____exports.GRID_INDEX_CENTER_OF_1X1_ROOM = 67
@@ -25,6 +28,7 @@ ____exports.MAX_ROOM_INDEX = 168
25
28
  ____exports.MAX_VANILLA_COLLECTIBLE_TYPE = CollectibleType.COLLECTIBLE_MOMS_RING
26
29
  ____exports.MOVEMENT_ACTIONS = __TS__New(Set, {ButtonAction.ACTION_LEFT, ButtonAction.ACTION_RIGHT, ButtonAction.ACTION_UP, ButtonAction.ACTION_DOWN})
27
30
  ____exports.ONE_BY_ONE_ROOM_GRID_SIZE = 135
31
+ ____exports.ROOM_TYPE_TO_ITEM_POOL_TYPE_MAP = __TS__New(Map, {{RoomType.ROOM_SHOP, ItemPoolType.POOL_SHOP}, {RoomType.ROOM_TREASURE, ItemPoolType.POOL_TREASURE}, {RoomType.ROOM_BOSS, ItemPoolType.POOL_BOSS}, {RoomType.ROOM_SECRET, ItemPoolType.POOL_SECRET}, {RoomType.ROOM_CURSE, ItemPoolType.POOL_CURSE}, {RoomType.ROOM_CHALLENGE, ItemPoolType.POOL_BOSS}, {RoomType.ROOM_LIBRARY, ItemPoolType.POOL_LIBRARY}, {RoomType.ROOM_DEVIL, ItemPoolType.POOL_DEVIL}, {RoomType.ROOM_ANGEL, ItemPoolType.POOL_ANGEL}, {RoomType.ROOM_CHEST, ItemPoolType.POOL_GOLDEN_CHEST}, {RoomType.ROOM_BLACK_MARKET, ItemPoolType.POOL_SHOP}, {RoomType.ROOM_PLANETARIUM, ItemPoolType.POOL_PLANETARIUM}, {RoomType.ROOM_ULTRASECRET, ItemPoolType.POOL_ULTRA_SECRET}})
28
32
  ____exports.SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES = __TS__New(Set, {CollectibleType.COLLECTIBLE_FORGET_ME_NOW, CollectibleType.COLLECTIBLE_EDENS_SOUL, CollectibleType.COLLECTIBLE_ALABASTER_BOX, CollectibleType.COLLECTIBLE_PLAN_C, CollectibleType.COLLECTIBLE_MAMA_MEGA, CollectibleType.COLLECTIBLE_SACRIFICIAL_ALTAR, CollectibleType.COLLECTIBLE_DEATH_CERTIFICATE, CollectibleType.COLLECTIBLE_R_KEY})
29
33
  ____exports.SHOOTING_ACTIONS = __TS__New(Set, {ButtonAction.ACTION_SHOOTLEFT, ButtonAction.ACTION_SHOOTRIGHT, ButtonAction.ACTION_SHOOTUP, ButtonAction.ACTION_SHOOTDOWN})
30
34
  ____exports.UI_HEART_WIDTH = 12
@@ -38,6 +38,7 @@ export declare function logKColor(this: void, kColor: KColor): void;
38
38
  export declare function logMap(this: void, map: Map<AnyNotNil, unknown>): void;
39
39
  export declare function logTable(this: void, table: unknown): void;
40
40
  export declare function logSet(this: void, set: Set<AnyNotNil>): void;
41
+ export declare function logVector(this: void, vector: Vector): void;
41
42
  /**
42
43
  * Converts every `isaacscript-common` function that begins with "log" to a global function.
43
44
  * This is useful for printing out variables from the in-game debug console.
@@ -128,6 +128,11 @@ function ____exports.logSet(set)
128
128
  "The size of the set was: " .. tostring(set.size)
129
129
  )
130
130
  end
131
+ function ____exports.logVector(vector)
132
+ ____exports.log(
133
+ ((("Vector: (" .. tostring(vector.X)) .. ", ") .. tostring(vector.Y)) .. ")"
134
+ )
135
+ end
131
136
  function ____exports.setLogFunctionsGlobal(self)
132
137
  local globals = _G
133
138
  globals.log = ____exports.log
@@ -144,6 +149,7 @@ function ____exports.setLogFunctionsGlobal(self)
144
149
  globals.logMap = ____exports.logMap
145
150
  globals.logTable = ____exports.logTable
146
151
  globals.logSet = ____exports.logSet
152
+ globals.logVector = ____exports.logVector
147
153
  end
148
154
  function ____exports.traceback(self)
149
155
  if debug ~= nil then
@@ -36,6 +36,12 @@ export declare function getRoomIndex(): int;
36
36
  * This function only searches through rooms in the current dimension.
37
37
  */
38
38
  export declare function getRoomIndexesForType(roomType: RoomType): Set<int>;
39
+ /**
40
+ * Helper function to get the item pool type for the current room. For example, this returns
41
+ * `ItemPoolType.ItemPoolType.POOL_ANGEL` if you are in an Angel Room. Returns
42
+ * `DEFAULT_ITEM_POOL_TYPE` if there is no particular pool associated with the current room type.
43
+ */
44
+ export declare function getRoomItemPoolType(): ItemPoolType;
39
45
  /**
40
46
  * Helper function to get the name of the room as it appears in the STB/XML data.
41
47
  *
@@ -2,8 +2,11 @@
2
2
  require("lualib_bundle");
3
3
  local ____exports = {}
4
4
  local ____constants = require("constants")
5
+ local DEFAULT_ITEM_POOL_TYPE = ____constants.DEFAULT_ITEM_POOL_TYPE
6
+ local GENESIS_ROOM_SUBTYPE = ____constants.GENESIS_ROOM_SUBTYPE
5
7
  local GENESIS_ROOM_VARIANT = ____constants.GENESIS_ROOM_VARIANT
6
8
  local MAX_ROOM_INDEX = ____constants.MAX_ROOM_INDEX
9
+ local ROOM_TYPE_TO_ITEM_POOL_TYPE_MAP = ____constants.ROOM_TYPE_TO_ITEM_POOL_TYPE_MAP
7
10
  function ____exports.getRoomIndex(self)
8
11
  local game = Game()
9
12
  local level = game:GetLevel()
@@ -75,6 +78,13 @@ function ____exports.getRoomIndexesForType(self, roomType)
75
78
  end
76
79
  return roomIndexes
77
80
  end
81
+ function ____exports.getRoomItemPoolType(self)
82
+ local game = Game()
83
+ local room = game:GetRoom()
84
+ local roomType = room:GetType()
85
+ local itemPoolType = ROOM_TYPE_TO_ITEM_POOL_TYPE_MAP:get(roomType)
86
+ return ((itemPoolType == nil) and DEFAULT_ITEM_POOL_TYPE) or itemPoolType
87
+ end
78
88
  function ____exports.getRoomName(self)
79
89
  local roomData = ____exports.getRoomData(nil)
80
90
  if roomData == nil then
@@ -169,7 +179,8 @@ function ____exports.inGenesisRoom(self)
169
179
  local room = game:GetRoom()
170
180
  local roomType = room:GetType()
171
181
  local roomVariant = ____exports.getRoomVariant(nil)
172
- return (roomType == RoomType.ROOM_ISAACS) or (roomVariant == GENESIS_ROOM_VARIANT)
182
+ local roomSubType = ____exports.getRoomSubType(nil)
183
+ return ((roomType == RoomType.ROOM_ISAACS) and (roomVariant == GENESIS_ROOM_VARIANT)) and (roomSubType == GENESIS_ROOM_SUBTYPE)
173
184
  end
174
185
  function ____exports.inItLivesRoom(self)
175
186
  local roomStageID = ____exports.getRoomStageID(nil)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.454",
3
+ "version": "1.0.458",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",