isaacscript-common 34.1.1 → 35.0.1

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.
@@ -4739,6 +4739,10 @@ export declare function getArrayCombinations<T>(array: T[] | readonly T[], inclu
4739
4739
  * Helper function to get an array containing the indexes of an array.
4740
4740
  *
4741
4741
  * For example, an array of `["Apple", "Banana"]` would return an array of `[0, 1]`.
4742
+ *
4743
+ * Note that normally, you would use the `Object.keys` method to get the indexes of an array, but
4744
+ * due to implementation details of TypeScriptToLua, this results in an array of 1 through N
4745
+ * (instead of an array of 0 through N -1).
4742
4746
  */
4743
4747
  export declare function getArrayIndexes<T>(array: T[] | readonly T[]): int[];
4744
4748
 
@@ -6652,8 +6656,23 @@ export declare function getRoomAdjacentGridIndexes(roomGridIndex?: int): Readonl
6652
6656
  */
6653
6657
  export declare function getRoomAllowedDoors(roomGridIndex?: int): Set<DoorSlot>;
6654
6658
 
6659
+ /**
6660
+ * Helper function to get the room data for the current room.
6661
+ *
6662
+ * You can optionally provide a room grid index as an argument to get the data for that room
6663
+ * instead.
6664
+ *
6665
+ * (The version of the function without any arguments will not return undefined since the current
6666
+ * room is guaranteed to have data.)
6667
+ */
6655
6668
  export declare function getRoomData(): RoomConfig;
6656
6669
 
6670
+ /**
6671
+ * Helper function to get the room data for the current or provided room.
6672
+ *
6673
+ * @param roomGridIndex Optional. Default is the current room index.
6674
+ * @returns The room data for the room or undefined if the provided room does not have any data.
6675
+ */
6657
6676
  export declare function getRoomData(roomGridIndex?: int): RoomConfig | undefined;
6658
6677
 
6659
6678
  /**
@@ -6766,13 +6785,24 @@ export declare function getRoomItemPoolType(): ItemPoolType;
6766
6785
  */
6767
6786
  export declare function getRoomListIndex(roomGridIndex?: int): int;
6768
6787
 
6788
+ /**
6789
+ * Helper function to get the name of the current room as it appears in the STB/XML data.
6790
+ *
6791
+ * You can optionally provide a room grid index as an argument to get the name for that room
6792
+ * instead.
6793
+ *
6794
+ * (The version of the function without any arguments will not return undefined since the current
6795
+ * room is guaranteed to have data.)
6796
+ */
6797
+ export declare function getRoomName(): string;
6798
+
6769
6799
  /**
6770
6800
  * Helper function to get the name of the room as it appears in the STB/XML data.
6771
6801
  *
6772
6802
  * @param roomGridIndex Optional. Default is the current room index.
6773
- * @returns The room name. Returns "Unknown" if the room data was not found.
6803
+ * @returns The room name. Returns undefined if the room data was not found.
6774
6804
  */
6775
- export declare function getRoomName(roomGridIndex?: int): string;
6805
+ export declare function getRoomName(roomGridIndex?: int): string | undefined;
6776
6806
 
6777
6807
  /**
6778
6808
  * Helper function to get the room descriptor for every room on the level. This includes off-grid
@@ -6790,10 +6820,21 @@ export declare function getRoomName(roomGridIndex?: int): string;
6790
6820
  export declare function getRooms(includeExtraDimensionalRooms?: boolean): RoomDescriptor[];
6791
6821
 
6792
6822
  /**
6793
- * Helper function to get the name of the room as it appears in the STB/XML data.
6823
+ * Helper function to get the shape of the current room as it appears in the STB/XML data.
6824
+ *
6825
+ * You can optionally provide a room grid index as an argument to get the shape for that room
6826
+ * instead.
6827
+ *
6828
+ * (The version of the function without any arguments will not return undefined since the current
6829
+ * room is guaranteed to have data.)
6830
+ */
6831
+ export declare function getRoomShape(): RoomShape;
6832
+
6833
+ /**
6834
+ * Helper function to get the shape of the room as it appears in the STB/XML data.
6794
6835
  *
6795
6836
  * @param roomGridIndex Optional. Default is the current room index.
6796
- * @returns The room name. Returns "Unknown"if the room data was not found.
6837
+ * @returns The room shape. Returns undefined if the room data was not found.
6797
6838
  */
6798
6839
  export declare function getRoomShape(roomGridIndex?: int): RoomShape | undefined;
6799
6840
 
@@ -6934,33 +6975,77 @@ export declare function getRoomsOfDimension(dimension: Dimension): RoomDescripto
6934
6975
  export declare function getRoomsOutsideGrid(): RoomDescriptor[];
6935
6976
 
6936
6977
  /**
6937
- * Helper function to get the stage ID for a room from the XML/STB data. The room stage ID will
6938
- * correspond to the first number in the filename of the XML/STB file. For example, a Depths room
6939
- * would have a stage ID of 7.
6978
+ * Helper function to get the stage ID for the current room as it appears in the STB/XML data.
6979
+ *
6980
+ * The room stage ID will correspond to the first number in the filename of the XML/STB file. For
6981
+ * example, a Depths room would have a stage ID of `StageID.DEPTHS` (7).
6982
+ *
6983
+ * You can optionally provide a room grid index as an argument to get the stage ID for that room
6984
+ * instead.
6985
+ *
6986
+ * (The version of the function without any arguments will not return undefined since the current
6987
+ * room is guaranteed to have data.)
6988
+ */
6989
+ export declare function getRoomStageID(): StageID;
6990
+
6991
+ /**
6992
+ * Helper function to get the stage ID for a room as it appears in the STB/XML data.
6993
+ *
6994
+ * The room stage ID will correspond to the first number in the filename of the XML/STB file. For
6995
+ * example, a Depths room would have a stage ID of `StageID.DEPTHS` (7).
6940
6996
  *
6941
6997
  * @param roomGridIndex Optional. Default is the current room index.
6942
- * @returns The room stage ID. Returns -1 if the room data was not found.
6998
+ * @returns The room stage ID. Returns undefined if the room data was not found.
6943
6999
  */
6944
- export declare function getRoomStageID(roomGridIndex?: int): StageID | -1;
7000
+ export declare function getRoomStageID(roomGridIndex?: int): StageID | undefined;
6945
7001
 
6946
7002
  /**
6947
- * Helper function to get the sub-type for a room from the XML/STB data. The room sub-type will
6948
- * correspond to different things depending on what XML/STB file it draws from. For example, in the
6949
- * "00.special rooms.stb" file, an Angel Room with a sub-type of 0 will correspond to a normal Angel
6950
- * Room and a sub-type of 1 will correspond to an Angel Room shop for The Stairway.
7003
+ * Helper function to get the sub-type for the current room as it appears in the STB/XML data.
7004
+ *
7005
+ * The room sub-type will correspond to different things depending on what XML/STB file it draws
7006
+ * from. For example, in the "00.special rooms.stb" file, an Angel Room with a sub-type of 0 will
7007
+ * correspond to a normal Angel Room and a sub-type of 1 will correspond to an Angel Room shop from
7008
+ * The Stairway.
7009
+ *
7010
+ * You can optionally provide a room grid index as an argument to get the sub-type for that room
7011
+ * instead.
7012
+ *
7013
+ * (The version of the function without any arguments will not return undefined since the current
7014
+ * room is guaranteed to have data.)
7015
+ */
7016
+ export declare function getRoomSubType(): int;
7017
+
7018
+ /**
7019
+ * Helper function to get the sub-type for a room as it appears in the STB/XML data.
7020
+ *
7021
+ * The room sub-type will correspond to different things depending on what XML/STB file it draws
7022
+ * from. For example, in the "00.special rooms.stb" file, an Angel Room with a sub-type of 0 will
7023
+ * correspond to a normal Angel Room and a sub-type of 1 will correspond to an Angel Room shop from
7024
+ * The Stairway.
6951
7025
  *
6952
7026
  * @param roomGridIndex Optional. Default is the current room index.
6953
- * @returns The room sub-type. Returns -1 if the room data was not found.
7027
+ * @returns The room sub-type. Returns undefined if the room data was not found.
7028
+ */
7029
+ export declare function getRoomSubType(roomGridIndex?: int): int | undefined;
7030
+
7031
+ /**
7032
+ * Helper function to get the type for the current room as it appears in the STB/XML data.
7033
+ *
7034
+ * You can optionally provide a room grid index as an argument to get the type for that room
7035
+ * instead.
7036
+ *
7037
+ * (The version of the function without any arguments will not return undefined since the current
7038
+ * room is guaranteed to have data.)
6954
7039
  */
6955
- export declare function getRoomSubType(roomGridIndex?: int): int;
7040
+ export declare function getRoomType(): RoomType;
6956
7041
 
6957
7042
  /**
6958
- * Helper function for getting the type of the room with the given grid index.
7043
+ * Helper function to get the type for a room as it appears in the STB/XML data.
6959
7044
  *
6960
7045
  * @param roomGridIndex Optional. Default is the current room index.
6961
- * @returns The room data type. Returns -1 if the room data was not found.
7046
+ * @returns The room type. Returns undefined if the room data was not found.
6962
7047
  */
6963
- export declare function getRoomType(roomGridIndex?: int): RoomType | -1;
7048
+ export declare function getRoomType(roomGridIndex?: int): RoomType | undefined;
6964
7049
 
6965
7050
  /**
6966
7051
  * Helper function to get the proper name of a room type.
@@ -6970,14 +7055,29 @@ export declare function getRoomType(roomGridIndex?: int): RoomType | -1;
6970
7055
  export declare function getRoomTypeName(roomType: RoomType): string;
6971
7056
 
6972
7057
  /**
6973
- * Helper function to get the variant for a room from the XML/STB data. You can think of a room
6974
- * variant as its identifier. For example, to go to Basement room #123, you would use a console
6975
- * command of `goto d.123` while on the Basement.
7058
+ * Helper function to get the variant for the current room as it appears in the STB/XML data.
7059
+ *
7060
+ * You can think of a room variant as its identifier. For example, to go to Basement room #123, you
7061
+ * would use a console command of `goto d.123` while on the Basement.
7062
+ *
7063
+ * You can optionally provide a room grid index as an argument to get the variant for that room
7064
+ * instead.
7065
+ *
7066
+ * (The version of the function without any arguments will not return undefined since the current
7067
+ * room is guaranteed to have data.)
7068
+ */
7069
+ export declare function getRoomVariant(): int;
7070
+
7071
+ /**
7072
+ * Helper function to get the variant for a room as it appears in the STB/XML data.
7073
+ *
7074
+ * You can think of a room variant as its identifier. For example, to go to Basement room #123, you
7075
+ * would use a console command of `goto d.123` while on the Basement.
6976
7076
  *
6977
7077
  * @param roomGridIndex Optional. Default is the current room index.
6978
- * @returns The room variant. Returns -1 if the room data was not found.
7078
+ * @returns The room variant. Returns undefined if the room data was not found.
6979
7079
  */
6980
- export declare function getRoomVariant(roomGridIndex?: int): int;
7080
+ export declare function getRoomVariant(roomGridIndex?: int): int | undefined;
6981
7081
 
6982
7082
  /**
6983
7083
  * Note that the room visited count will be inaccurate during the period before the `POST_NEW_ROOM`
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 34.1.1
3
+ isaacscript-common 35.0.1
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -26817,30 +26817,54 @@ function ____exports.getRoomListIndex(self, roomGridIndex)
26817
26817
  return roomDescriptor.ListIndex
26818
26818
  end
26819
26819
  function ____exports.getRoomName(self, roomGridIndex)
26820
- local roomData = ____exports.getRoomData(nil, roomGridIndex)
26821
- return roomData == nil and "Unknown" or roomData.Name
26822
- end
26823
- function ____exports.getRoomShape(self, roomGridIndex)
26824
26820
  local roomData = ____exports.getRoomData(nil, roomGridIndex)
26825
26821
  local ____temp_0
26826
26822
  if roomData == nil then
26827
26823
  ____temp_0 = nil
26828
26824
  else
26829
- ____temp_0 = roomData.Shape
26825
+ ____temp_0 = roomData.Name
26830
26826
  end
26831
26827
  return ____temp_0
26832
26828
  end
26829
+ function ____exports.getRoomShape(self, roomGridIndex)
26830
+ local roomData = ____exports.getRoomData(nil, roomGridIndex)
26831
+ local ____temp_1
26832
+ if roomData == nil then
26833
+ ____temp_1 = nil
26834
+ else
26835
+ ____temp_1 = roomData.Shape
26836
+ end
26837
+ return ____temp_1
26838
+ end
26833
26839
  function ____exports.getRoomStageID(self, roomGridIndex)
26834
26840
  local roomData = ____exports.getRoomData(nil, roomGridIndex)
26835
- return roomData == nil and -1 or roomData.StageID
26841
+ local ____temp_2
26842
+ if roomData == nil then
26843
+ ____temp_2 = nil
26844
+ else
26845
+ ____temp_2 = roomData.StageID
26846
+ end
26847
+ return ____temp_2
26836
26848
  end
26837
26849
  function ____exports.getRoomSubType(self, roomGridIndex)
26838
26850
  local roomData = ____exports.getRoomData(nil, roomGridIndex)
26839
- return roomData == nil and -1 or roomData.Subtype
26851
+ local ____temp_3
26852
+ if roomData == nil then
26853
+ ____temp_3 = nil
26854
+ else
26855
+ ____temp_3 = roomData.Subtype
26856
+ end
26857
+ return ____temp_3
26840
26858
  end
26841
26859
  function ____exports.getRoomType(self, roomGridIndex)
26842
26860
  local roomData = ____exports.getRoomData(nil, roomGridIndex)
26843
- return roomData == nil and -1 or roomData.Type
26861
+ local ____temp_4
26862
+ if roomData == nil then
26863
+ ____temp_4 = nil
26864
+ else
26865
+ ____temp_4 = roomData.Type
26866
+ end
26867
+ return ____temp_4
26844
26868
  end
26845
26869
  function ____exports.getRoomVariant(self, roomGridIndex)
26846
26870
  local roomData = ____exports.getRoomData(nil, roomGridIndex)
@@ -30358,8 +30382,6 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
30358
30382
  local ____exports = {}
30359
30383
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
30360
30384
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
30361
- local ____shouldFire = require("src.shouldFire")
30362
- local shouldFirePickup = ____shouldFire.shouldFirePickup
30363
30385
  local ____CustomCallback = require("src.classes.private.CustomCallback")
30364
30386
  local CustomCallback = ____CustomCallback.CustomCallback
30365
30387
  ____exports.PostPickupSelectionFilter = __TS__Class()
@@ -30368,7 +30390,11 @@ PostPickupSelectionFilter.name = "PostPickupSelectionFilter"
30368
30390
  __TS__ClassExtends(PostPickupSelectionFilter, CustomCallback)
30369
30391
  function PostPickupSelectionFilter.prototype.____constructor(self)
30370
30392
  CustomCallback.prototype.____constructor(self)
30371
- self.shouldFire = shouldFirePickup
30393
+ self.shouldFire = function(____, fireArgs, optionalArgs)
30394
+ local _pickup, pickupVariant, subType = table.unpack(fireArgs)
30395
+ local callbackPickupVariant, callbackPickupSubType = table.unpack(optionalArgs)
30396
+ return (callbackPickupVariant == nil or callbackPickupVariant == pickupVariant) and (callbackPickupSubType == nil or callbackPickupSubType == subType)
30397
+ end
30372
30398
  self.postPickupSelection = function(____, pickup, variant, subType) return self:fire(pickup, variant, subType) end
30373
30399
  self.callbacksUsed = {{ModCallback.POST_PICKUP_SELECTION, self.postPickupSelection}}
30374
30400
  end
@@ -1,9 +1,16 @@
1
+ import type { PickupVariant } from "isaac-typescript-definitions";
1
2
  import type { ModCallbackCustom } from "../../enums/ModCallbackCustom";
2
- import { shouldFirePickup } from "../../shouldFire";
3
3
  import { CustomCallback } from "../private/CustomCallback";
4
- export declare class PostPickupSelectionFilter extends CustomCallback<ModCallbackCustom.POST_PICKUP_SELECTION_FILTER> {
4
+ type T = ModCallbackCustom.POST_PICKUP_SELECTION_FILTER;
5
+ export declare class PostPickupSelectionFilter extends CustomCallback<T> {
5
6
  constructor();
6
- protected shouldFire: typeof shouldFirePickup;
7
+ /**
8
+ * We cannot use the `shouldFirePickup` helper function because in the case of non-collectibles,
9
+ * `EntityPickup.Type` and `EntityPickup.Variant` and `EntityPickup.SubType` will all be set to 0
10
+ * in this callback.
11
+ */
12
+ protected shouldFire: (fireArgs: [pickup: EntityPickup, variant: PickupVariant, subType: int], optionalArgs: [pickupVariant?: PickupVariant | undefined, subType?: int | undefined]) => boolean;
7
13
  private readonly postPickupSelection;
8
14
  }
15
+ export {};
9
16
  //# sourceMappingURL=PostPickupSelectionFilter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PostPickupSelectionFilter.d.ts","sourceRoot":"","sources":["../../../../src/classes/callbacks/PostPickupSelectionFilter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,qBAAa,yBAA0B,SAAQ,cAAc,CAAC,iBAAiB,CAAC,4BAA4B,CAAC;;IAU3G,UAAmB,UAAU,0BAAoB;IAGjD,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAIuC;CAC5E"}
1
+ {"version":3,"file":"PostPickupSelectionFilter.d.ts","sourceRoot":"","sources":["../../../../src/classes/callbacks/PostPickupSelectionFilter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,KAAK,CAAC,GAAG,iBAAiB,CAAC,4BAA4B,CAAC;AAExD,qBAAa,yBAA0B,SAAQ,cAAc,CAAC,CAAC,CAAC;;IAU9D;;;;OAIG;IACH,UAAmB,UAAU,oKAG1B,OAAO,CASR;IAGF,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAIuC;CAC5E"}
@@ -4,8 +4,6 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
4
4
  local ____exports = {}
5
5
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
6
6
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
7
- local ____shouldFire = require("src.shouldFire")
8
- local shouldFirePickup = ____shouldFire.shouldFirePickup
9
7
  local ____CustomCallback = require("src.classes.private.CustomCallback")
10
8
  local CustomCallback = ____CustomCallback.CustomCallback
11
9
  ____exports.PostPickupSelectionFilter = __TS__Class()
@@ -14,7 +12,11 @@ PostPickupSelectionFilter.name = "PostPickupSelectionFilter"
14
12
  __TS__ClassExtends(PostPickupSelectionFilter, CustomCallback)
15
13
  function PostPickupSelectionFilter.prototype.____constructor(self)
16
14
  CustomCallback.prototype.____constructor(self)
17
- self.shouldFire = shouldFirePickup
15
+ self.shouldFire = function(____, fireArgs, optionalArgs)
16
+ local _pickup, pickupVariant, subType = table.unpack(fireArgs)
17
+ local callbackPickupVariant, callbackPickupSubType = table.unpack(optionalArgs)
18
+ return (callbackPickupVariant == nil or callbackPickupVariant == pickupVariant) and (callbackPickupSubType == nil or callbackPickupSubType == subType)
19
+ end
18
20
  self.postPickupSelection = function(____, pickup, variant, subType) return self:fire(pickup, variant, subType) end
19
21
  self.callbacksUsed = {{ModCallback.POST_PICKUP_SELECTION, self.postPickupSelection}}
20
22
  end
@@ -134,6 +134,10 @@ export declare function getArrayCombinations<T>(array: T[] | readonly T[], inclu
134
134
  * Helper function to get an array containing the indexes of an array.
135
135
  *
136
136
  * For example, an array of `["Apple", "Banana"]` would return an array of `[0, 1]`.
137
+ *
138
+ * Note that normally, you would use the `Object.keys` method to get the indexes of an array, but
139
+ * due to implementation details of TypeScriptToLua, this results in an array of 1 through N
140
+ * (instead of an array of 0 through N -1).
137
141
  */
138
142
  export declare function getArrayIndexes<T>(array: T[] | readonly T[]): int[];
139
143
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../../src/functions/array.ts"],"names":[],"mappings":";;;AAMA;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,MAAM,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,EAC1B,MAAM,EAAE,CAA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E,CAAC,GACrC,OAAO,CAET;AAED,4EAA4E;AAC5E,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAIjE;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,aAAa,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,EACjC,SAAS,GAAE,IAAI,GAAG,GAAqB,GACtC,CAAC,EAAE,CAKL;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,KAAK,EAAE,CAAC,EAAE,EACV,SAAS,GAAE,IAAI,GAAG,GAAqB,GACtC,IAAI,CAWN;AAED,+DAA+D;AAC/D,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,GAAG,MAAM,CAEpE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAM3E"}
@@ -364,6 +364,10 @@ end
364
364
  --- Helper function to get an array containing the indexes of an array.
365
365
  --
366
366
  -- For example, an array of `["Apple", "Banana"]` would return an array of `[0, 1]`.
367
+ --
368
+ -- Note that normally, you would use the `Object.keys` method to get the indexes of an array, but
369
+ -- due to implementation details of TypeScriptToLua, this results in an array of 1 through N
370
+ -- (instead of an array of 0 through N -1).
367
371
  function ____exports.getArrayIndexes(self, array)
368
372
  return eRange(nil, #array)
369
373
  end
@@ -4,7 +4,22 @@ import type { DoorSlot, RoomShape, RoomType, StageID } from "isaac-typescript-de
4
4
  * This corresponds to the doors that are enabled in the STB/XML file for the room.
5
5
  */
6
6
  export declare function getRoomAllowedDoors(roomGridIndex?: int): Set<DoorSlot>;
7
+ /**
8
+ * Helper function to get the room data for the current room.
9
+ *
10
+ * You can optionally provide a room grid index as an argument to get the data for that room
11
+ * instead.
12
+ *
13
+ * (The version of the function without any arguments will not return undefined since the current
14
+ * room is guaranteed to have data.)
15
+ */
7
16
  export declare function getRoomData(): RoomConfig;
17
+ /**
18
+ * Helper function to get the room data for the current or provided room.
19
+ *
20
+ * @param roomGridIndex Optional. Default is the current room index.
21
+ * @returns The room data for the room or undefined if the provided room does not have any data.
22
+ */
8
23
  export declare function getRoomData(roomGridIndex?: int): RoomConfig | undefined;
9
24
  /**
10
25
  * Helper function to get the descriptor for a room.
@@ -47,55 +62,130 @@ export declare function getRoomGridIndex(): int;
47
62
  * @param roomGridIndex Optional. Default is the current room index.
48
63
  */
49
64
  export declare function getRoomListIndex(roomGridIndex?: int): int;
65
+ /**
66
+ * Helper function to get the name of the current room as it appears in the STB/XML data.
67
+ *
68
+ * You can optionally provide a room grid index as an argument to get the name for that room
69
+ * instead.
70
+ *
71
+ * (The version of the function without any arguments will not return undefined since the current
72
+ * room is guaranteed to have data.)
73
+ */
74
+ export declare function getRoomName(): string;
50
75
  /**
51
76
  * Helper function to get the name of the room as it appears in the STB/XML data.
52
77
  *
53
78
  * @param roomGridIndex Optional. Default is the current room index.
54
- * @returns The room name. Returns "Unknown" if the room data was not found.
79
+ * @returns The room name. Returns undefined if the room data was not found.
55
80
  */
56
- export declare function getRoomName(roomGridIndex?: int): string;
81
+ export declare function getRoomName(roomGridIndex?: int): string | undefined;
57
82
  /**
58
- * Helper function to get the name of the room as it appears in the STB/XML data.
83
+ * Helper function to get the shape of the current room as it appears in the STB/XML data.
84
+ *
85
+ * You can optionally provide a room grid index as an argument to get the shape for that room
86
+ * instead.
87
+ *
88
+ * (The version of the function without any arguments will not return undefined since the current
89
+ * room is guaranteed to have data.)
90
+ */
91
+ export declare function getRoomShape(): RoomShape;
92
+ /**
93
+ * Helper function to get the shape of the room as it appears in the STB/XML data.
59
94
  *
60
95
  * @param roomGridIndex Optional. Default is the current room index.
61
- * @returns The room name. Returns "Unknown"if the room data was not found.
96
+ * @returns The room shape. Returns undefined if the room data was not found.
62
97
  */
63
98
  export declare function getRoomShape(roomGridIndex?: int): RoomShape | undefined;
64
99
  /**
65
- * Helper function to get the stage ID for a room from the XML/STB data. The room stage ID will
66
- * correspond to the first number in the filename of the XML/STB file. For example, a Depths room
67
- * would have a stage ID of 7.
100
+ * Helper function to get the stage ID for the current room as it appears in the STB/XML data.
101
+ *
102
+ * The room stage ID will correspond to the first number in the filename of the XML/STB file. For
103
+ * example, a Depths room would have a stage ID of `StageID.DEPTHS` (7).
104
+ *
105
+ * You can optionally provide a room grid index as an argument to get the stage ID for that room
106
+ * instead.
107
+ *
108
+ * (The version of the function without any arguments will not return undefined since the current
109
+ * room is guaranteed to have data.)
110
+ */
111
+ export declare function getRoomStageID(): StageID;
112
+ /**
113
+ * Helper function to get the stage ID for a room as it appears in the STB/XML data.
114
+ *
115
+ * The room stage ID will correspond to the first number in the filename of the XML/STB file. For
116
+ * example, a Depths room would have a stage ID of `StageID.DEPTHS` (7).
68
117
  *
69
118
  * @param roomGridIndex Optional. Default is the current room index.
70
- * @returns The room stage ID. Returns -1 if the room data was not found.
119
+ * @returns The room stage ID. Returns undefined if the room data was not found.
120
+ */
121
+ export declare function getRoomStageID(roomGridIndex?: int): StageID | undefined;
122
+ /**
123
+ * Helper function to get the sub-type for the current room as it appears in the STB/XML data.
124
+ *
125
+ * The room sub-type will correspond to different things depending on what XML/STB file it draws
126
+ * from. For example, in the "00.special rooms.stb" file, an Angel Room with a sub-type of 0 will
127
+ * correspond to a normal Angel Room and a sub-type of 1 will correspond to an Angel Room shop from
128
+ * The Stairway.
129
+ *
130
+ * You can optionally provide a room grid index as an argument to get the sub-type for that room
131
+ * instead.
132
+ *
133
+ * (The version of the function without any arguments will not return undefined since the current
134
+ * room is guaranteed to have data.)
71
135
  */
72
- export declare function getRoomStageID(roomGridIndex?: int): StageID | -1;
136
+ export declare function getRoomSubType(): int;
73
137
  /**
74
- * Helper function to get the sub-type for a room from the XML/STB data. The room sub-type will
75
- * correspond to different things depending on what XML/STB file it draws from. For example, in the
76
- * "00.special rooms.stb" file, an Angel Room with a sub-type of 0 will correspond to a normal Angel
77
- * Room and a sub-type of 1 will correspond to an Angel Room shop for The Stairway.
138
+ * Helper function to get the sub-type for a room as it appears in the STB/XML data.
139
+ *
140
+ * The room sub-type will correspond to different things depending on what XML/STB file it draws
141
+ * from. For example, in the "00.special rooms.stb" file, an Angel Room with a sub-type of 0 will
142
+ * correspond to a normal Angel Room and a sub-type of 1 will correspond to an Angel Room shop from
143
+ * The Stairway.
78
144
  *
79
145
  * @param roomGridIndex Optional. Default is the current room index.
80
- * @returns The room sub-type. Returns -1 if the room data was not found.
146
+ * @returns The room sub-type. Returns undefined if the room data was not found.
81
147
  */
82
- export declare function getRoomSubType(roomGridIndex?: int): int;
148
+ export declare function getRoomSubType(roomGridIndex?: int): int | undefined;
83
149
  /**
84
- * Helper function for getting the type of the room with the given grid index.
150
+ * Helper function to get the type for the current room as it appears in the STB/XML data.
151
+ *
152
+ * You can optionally provide a room grid index as an argument to get the type for that room
153
+ * instead.
154
+ *
155
+ * (The version of the function without any arguments will not return undefined since the current
156
+ * room is guaranteed to have data.)
157
+ */
158
+ export declare function getRoomType(): RoomType;
159
+ /**
160
+ * Helper function to get the type for a room as it appears in the STB/XML data.
85
161
  *
86
162
  * @param roomGridIndex Optional. Default is the current room index.
87
- * @returns The room data type. Returns -1 if the room data was not found.
163
+ * @returns The room type. Returns undefined if the room data was not found.
88
164
  */
89
- export declare function getRoomType(roomGridIndex?: int): RoomType | -1;
165
+ export declare function getRoomType(roomGridIndex?: int): RoomType | undefined;
90
166
  /**
91
- * Helper function to get the variant for a room from the XML/STB data. You can think of a room
92
- * variant as its identifier. For example, to go to Basement room #123, you would use a console
93
- * command of `goto d.123` while on the Basement.
167
+ * Helper function to get the variant for the current room as it appears in the STB/XML data.
168
+ *
169
+ * You can think of a room variant as its identifier. For example, to go to Basement room #123, you
170
+ * would use a console command of `goto d.123` while on the Basement.
171
+ *
172
+ * You can optionally provide a room grid index as an argument to get the variant for that room
173
+ * instead.
174
+ *
175
+ * (The version of the function without any arguments will not return undefined since the current
176
+ * room is guaranteed to have data.)
177
+ */
178
+ export declare function getRoomVariant(): int;
179
+ /**
180
+ * Helper function to get the variant for a room as it appears in the STB/XML data.
181
+ *
182
+ * You can think of a room variant as its identifier. For example, to go to Basement room #123, you
183
+ * would use a console command of `goto d.123` while on the Basement.
94
184
  *
95
185
  * @param roomGridIndex Optional. Default is the current room index.
96
- * @returns The room variant. Returns -1 if the room data was not found.
186
+ * @returns The room variant. Returns undefined if the room data was not found.
97
187
  */
98
- export declare function getRoomVariant(roomGridIndex?: int): int;
188
+ export declare function getRoomVariant(roomGridIndex?: int): int | undefined;
99
189
  /**
100
190
  * Note that the room visited count will be inaccurate during the period before the `POST_NEW_ROOM`
101
191
  * callback has fired (i.e. when entities are initializing and performing their first update). This
@@ -1 +1 @@
1
- {"version":3,"file":"roomData.d.ts","sourceRoot":"","sources":["../../../src/functions/roomData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,OAAO,EACR,MAAM,8BAA8B,CAAC;AAMtC;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,CAgBtE;AAGD,wBAAgB,WAAW,IAAI,UAAU,CAAC;AAC1C,wBAAgB,WAAW,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,UAAU,GAAG,SAAS,CAAC;AAYzE;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,cAAc,CAQrE;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,QAAQ,CAAC,cAAc,CAAC,CAGpE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,IAAI,GAAG,CAUtC;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,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AAE,GAAG,GAAG,GAAG,GAAG,SAAS,CAAC;AAOrE;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,GAAG,CAG5D;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,aAAa,EAAE,GAAG,EAAE,QAAQ,EAAE,UAAU,GAAG,IAAI,CAG1E"}
@@ -10,9 +10,17 @@ local ____doors = require("src.functions.doors")
10
10
  local doorSlotFlagToDoorSlot = ____doors.doorSlotFlagToDoorSlot
11
11
  local ____flag = require("src.functions.flag")
12
12
  local hasFlag = ____flag.hasFlag
13
- --- Helper function to get the room data for the provided room.
13
+ --- Helper function to get the room data for the current room.
14
+ --
15
+ -- You can optionally provide a room grid index as an argument to get the data for that room
16
+ -- instead.
17
+ --
18
+ -- (The version of the function without any arguments will not return undefined since the current
19
+ -- room is guaranteed to have data.)
20
+ -- Helper function to get the room data for the current or provided room.
14
21
  --
15
22
  -- @param roomGridIndex Optional. Default is the current room index.
23
+ -- @returns The room data for the room or undefined if the provided room does not have any data.
16
24
  function ____exports.getRoomData(self, roomGridIndex)
17
25
  local roomDescriptor = ____exports.getRoomDescriptor(nil, roomGridIndex)
18
26
  return roomDescriptor.Data
@@ -86,63 +94,147 @@ function ____exports.getRoomListIndex(self, roomGridIndex)
86
94
  local roomDescriptor = ____exports.getRoomDescriptor(nil, roomGridIndex)
87
95
  return roomDescriptor.ListIndex
88
96
  end
89
- --- Helper function to get the name of the room as it appears in the STB/XML data.
97
+ --- Helper function to get the name of the current room as it appears in the STB/XML data.
98
+ --
99
+ -- You can optionally provide a room grid index as an argument to get the name for that room
100
+ -- instead.
101
+ --
102
+ -- (The version of the function without any arguments will not return undefined since the current
103
+ -- room is guaranteed to have data.)
104
+ -- Helper function to get the name of the room as it appears in the STB/XML data.
90
105
  --
91
106
  -- @param roomGridIndex Optional. Default is the current room index.
92
- -- @returns The room name. Returns "Unknown" if the room data was not found.
107
+ -- @returns The room name. Returns undefined if the room data was not found.
93
108
  function ____exports.getRoomName(self, roomGridIndex)
94
109
  local roomData = ____exports.getRoomData(nil, roomGridIndex)
95
- return roomData == nil and "Unknown" or roomData.Name
110
+ local ____temp_0
111
+ if roomData == nil then
112
+ ____temp_0 = nil
113
+ else
114
+ ____temp_0 = roomData.Name
115
+ end
116
+ return ____temp_0
96
117
  end
97
- --- Helper function to get the name of the room as it appears in the STB/XML data.
118
+ --- Helper function to get the shape of the current room as it appears in the STB/XML data.
119
+ --
120
+ -- You can optionally provide a room grid index as an argument to get the shape for that room
121
+ -- instead.
122
+ --
123
+ -- (The version of the function without any arguments will not return undefined since the current
124
+ -- room is guaranteed to have data.)
125
+ -- Helper function to get the shape of the room as it appears in the STB/XML data.
98
126
  --
99
127
  -- @param roomGridIndex Optional. Default is the current room index.
100
- -- @returns The room name. Returns "Unknown"if the room data was not found.
128
+ -- @returns The room shape. Returns undefined if the room data was not found.
101
129
  function ____exports.getRoomShape(self, roomGridIndex)
102
130
  local roomData = ____exports.getRoomData(nil, roomGridIndex)
103
- local ____temp_0
131
+ local ____temp_1
104
132
  if roomData == nil then
105
- ____temp_0 = nil
133
+ ____temp_1 = nil
106
134
  else
107
- ____temp_0 = roomData.Shape
135
+ ____temp_1 = roomData.Shape
108
136
  end
109
- return ____temp_0
137
+ return ____temp_1
110
138
  end
111
- --- Helper function to get the stage ID for a room from the XML/STB data. The room stage ID will
112
- -- correspond to the first number in the filename of the XML/STB file. For example, a Depths room
113
- -- would have a stage ID of 7.
139
+ --- Helper function to get the stage ID for the current room as it appears in the STB/XML data.
140
+ --
141
+ -- The room stage ID will correspond to the first number in the filename of the XML/STB file. For
142
+ -- example, a Depths room would have a stage ID of `StageID.DEPTHS` (7).
143
+ --
144
+ -- You can optionally provide a room grid index as an argument to get the stage ID for that room
145
+ -- instead.
146
+ --
147
+ -- (The version of the function without any arguments will not return undefined since the current
148
+ -- room is guaranteed to have data.)
149
+ -- Helper function to get the stage ID for a room as it appears in the STB/XML data.
150
+ --
151
+ -- The room stage ID will correspond to the first number in the filename of the XML/STB file. For
152
+ -- example, a Depths room would have a stage ID of `StageID.DEPTHS` (7).
114
153
  --
115
154
  -- @param roomGridIndex Optional. Default is the current room index.
116
- -- @returns The room stage ID. Returns -1 if the room data was not found.
155
+ -- @returns The room stage ID. Returns undefined if the room data was not found.
117
156
  function ____exports.getRoomStageID(self, roomGridIndex)
118
157
  local roomData = ____exports.getRoomData(nil, roomGridIndex)
119
- return roomData == nil and -1 or roomData.StageID
158
+ local ____temp_2
159
+ if roomData == nil then
160
+ ____temp_2 = nil
161
+ else
162
+ ____temp_2 = roomData.StageID
163
+ end
164
+ return ____temp_2
120
165
  end
121
- --- Helper function to get the sub-type for a room from the XML/STB data. The room sub-type will
122
- -- correspond to different things depending on what XML/STB file it draws from. For example, in the
123
- -- "00.special rooms.stb" file, an Angel Room with a sub-type of 0 will correspond to a normal Angel
124
- -- Room and a sub-type of 1 will correspond to an Angel Room shop for The Stairway.
166
+ --- Helper function to get the sub-type for the current room as it appears in the STB/XML data.
167
+ --
168
+ -- The room sub-type will correspond to different things depending on what XML/STB file it draws
169
+ -- from. For example, in the "00.special rooms.stb" file, an Angel Room with a sub-type of 0 will
170
+ -- correspond to a normal Angel Room and a sub-type of 1 will correspond to an Angel Room shop from
171
+ -- The Stairway.
172
+ --
173
+ -- You can optionally provide a room grid index as an argument to get the sub-type for that room
174
+ -- instead.
175
+ --
176
+ -- (The version of the function without any arguments will not return undefined since the current
177
+ -- room is guaranteed to have data.)
178
+ -- Helper function to get the sub-type for a room as it appears in the STB/XML data.
179
+ --
180
+ -- The room sub-type will correspond to different things depending on what XML/STB file it draws
181
+ -- from. For example, in the "00.special rooms.stb" file, an Angel Room with a sub-type of 0 will
182
+ -- correspond to a normal Angel Room and a sub-type of 1 will correspond to an Angel Room shop from
183
+ -- The Stairway.
125
184
  --
126
185
  -- @param roomGridIndex Optional. Default is the current room index.
127
- -- @returns The room sub-type. Returns -1 if the room data was not found.
186
+ -- @returns The room sub-type. Returns undefined if the room data was not found.
128
187
  function ____exports.getRoomSubType(self, roomGridIndex)
129
188
  local roomData = ____exports.getRoomData(nil, roomGridIndex)
130
- return roomData == nil and -1 or roomData.Subtype
189
+ local ____temp_3
190
+ if roomData == nil then
191
+ ____temp_3 = nil
192
+ else
193
+ ____temp_3 = roomData.Subtype
194
+ end
195
+ return ____temp_3
131
196
  end
132
- --- Helper function for getting the type of the room with the given grid index.
197
+ --- Helper function to get the type for the current room as it appears in the STB/XML data.
198
+ --
199
+ -- You can optionally provide a room grid index as an argument to get the type for that room
200
+ -- instead.
133
201
  --
202
+ -- (The version of the function without any arguments will not return undefined since the current
203
+ -- room is guaranteed to have data.)
204
+ -- Helper function to get the type for a room as it appears in the STB/XML data.
205
+ -- Helper function for getting the type of the room with the given grid index.
206
+ --
207
+ -- @param roomGridIndex Optional. Default is the current room index.
208
+ -- @returns The room type. Returns undefined if the room data was not found.
134
209
  -- @param roomGridIndex Optional. Default is the current room index.
135
210
  -- @returns The room data type. Returns -1 if the room data was not found.
136
211
  function ____exports.getRoomType(self, roomGridIndex)
137
212
  local roomData = ____exports.getRoomData(nil, roomGridIndex)
138
- return roomData == nil and -1 or roomData.Type
213
+ local ____temp_4
214
+ if roomData == nil then
215
+ ____temp_4 = nil
216
+ else
217
+ ____temp_4 = roomData.Type
218
+ end
219
+ return ____temp_4
139
220
  end
140
- --- Helper function to get the variant for a room from the XML/STB data. You can think of a room
141
- -- variant as its identifier. For example, to go to Basement room #123, you would use a console
142
- -- command of `goto d.123` while on the Basement.
221
+ --- Helper function to get the variant for the current room as it appears in the STB/XML data.
222
+ --
223
+ -- You can think of a room variant as its identifier. For example, to go to Basement room #123, you
224
+ -- would use a console command of `goto d.123` while on the Basement.
225
+ --
226
+ -- You can optionally provide a room grid index as an argument to get the variant for that room
227
+ -- instead.
228
+ --
229
+ -- (The version of the function without any arguments will not return undefined since the current
230
+ -- room is guaranteed to have data.)
231
+ -- Helper function to get the variant for a room as it appears in the STB/XML data.
232
+ --
233
+ -- You can think of a room variant as its identifier. For example, to go to Basement room #123, you
234
+ -- would use a console command of `goto d.123` while on the Basement.
143
235
  --
144
236
  -- @param roomGridIndex Optional. Default is the current room index.
145
- -- @returns The room variant. Returns -1 if the room data was not found.
237
+ -- @returns The room variant. Returns undefined if the room data was not found.
146
238
  function ____exports.getRoomVariant(self, roomGridIndex)
147
239
  local roomData = ____exports.getRoomData(nil, roomGridIndex)
148
240
  return roomData == nil and -1 or roomData.Variant
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "34.1.1",
3
+ "version": "35.0.1",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -1,10 +1,12 @@
1
1
  import type { PickupVariant } from "isaac-typescript-definitions";
2
2
  import { ModCallback } from "isaac-typescript-definitions";
3
3
  import type { ModCallbackCustom } from "../../enums/ModCallbackCustom";
4
- import { shouldFirePickup } from "../../shouldFire";
4
+ import type { FireArgs, OptionalArgs } from "../private/CustomCallback";
5
5
  import { CustomCallback } from "../private/CustomCallback";
6
6
 
7
- export class PostPickupSelectionFilter extends CustomCallback<ModCallbackCustom.POST_PICKUP_SELECTION_FILTER> {
7
+ type T = ModCallbackCustom.POST_PICKUP_SELECTION_FILTER;
8
+
9
+ export class PostPickupSelectionFilter extends CustomCallback<T> {
8
10
  constructor() {
9
11
  super();
10
12
 
@@ -14,7 +16,24 @@ export class PostPickupSelectionFilter extends CustomCallback<ModCallbackCustom.
14
16
  ];
15
17
  }
16
18
 
17
- protected override shouldFire = shouldFirePickup;
19
+ /**
20
+ * We cannot use the `shouldFirePickup` helper function because in the case of non-collectibles,
21
+ * `EntityPickup.Type` and `EntityPickup.Variant` and `EntityPickup.SubType` will all be set to 0
22
+ * in this callback.
23
+ */
24
+ protected override shouldFire = (
25
+ fireArgs: FireArgs<T>,
26
+ optionalArgs: OptionalArgs<T>,
27
+ ): boolean => {
28
+ const [_pickup, pickupVariant, subType] = fireArgs;
29
+ const [callbackPickupVariant, callbackPickupSubType] = optionalArgs;
30
+
31
+ return (
32
+ (callbackPickupVariant === undefined ||
33
+ callbackPickupVariant === pickupVariant) &&
34
+ (callbackPickupSubType === undefined || callbackPickupSubType === subType)
35
+ );
36
+ };
18
37
 
19
38
  // ModCallback.POST_PICKUP_SELECTION (37)
20
39
  private readonly postPickupSelection = (
@@ -335,6 +335,10 @@ function addCombinations<T>(
335
335
  * Helper function to get an array containing the indexes of an array.
336
336
  *
337
337
  * For example, an array of `["Apple", "Banana"]` would return an array of `[0, 1]`.
338
+ *
339
+ * Note that normally, you would use the `Object.keys` method to get the indexes of an array, but
340
+ * due to implementation details of TypeScriptToLua, this results in an array of 1 through N
341
+ * (instead of an array of 0 through N -1).
338
342
  */
339
343
  export function getArrayIndexes<T>(array: T[] | readonly T[]): int[] {
340
344
  return eRange(array.length);
@@ -31,15 +31,25 @@ export function getRoomAllowedDoors(roomGridIndex?: int): Set<DoorSlot> {
31
31
  return allowedDoors;
32
32
  }
33
33
 
34
- // We provide an overload because the current room is guaranteed to have data.
34
+ /**
35
+ * Helper function to get the room data for the current room.
36
+ *
37
+ * You can optionally provide a room grid index as an argument to get the data for that room
38
+ * instead.
39
+ *
40
+ * (The version of the function without any arguments will not return undefined since the current
41
+ * room is guaranteed to have data.)
42
+ */
35
43
  export function getRoomData(): RoomConfig;
36
- export function getRoomData(roomGridIndex?: int): RoomConfig | undefined;
37
44
 
38
45
  /**
39
- * Helper function to get the room data for the provided room.
46
+ * Helper function to get the room data for the current or provided room.
40
47
  *
41
48
  * @param roomGridIndex Optional. Default is the current room index.
49
+ * @returns The room data for the room or undefined if the provided room does not have any data.
42
50
  */
51
+ export function getRoomData(roomGridIndex?: int): RoomConfig | undefined;
52
+
43
53
  export function getRoomData(roomGridIndex?: int): RoomConfig | undefined {
44
54
  const roomDescriptor = getRoomDescriptor(roomGridIndex);
45
55
  return roomDescriptor.Data;
@@ -114,74 +124,173 @@ export function getRoomListIndex(roomGridIndex?: int): int {
114
124
  return roomDescriptor.ListIndex;
115
125
  }
116
126
 
127
+ /**
128
+ * Helper function to get the name of the current room as it appears in the STB/XML data.
129
+ *
130
+ * You can optionally provide a room grid index as an argument to get the name for that room
131
+ * instead.
132
+ *
133
+ * (The version of the function without any arguments will not return undefined since the current
134
+ * room is guaranteed to have data.)
135
+ */
136
+ export function getRoomName(): string;
137
+
117
138
  /**
118
139
  * Helper function to get the name of the room as it appears in the STB/XML data.
119
140
  *
120
141
  * @param roomGridIndex Optional. Default is the current room index.
121
- * @returns The room name. Returns "Unknown" if the room data was not found.
142
+ * @returns The room name. Returns undefined if the room data was not found.
122
143
  */
123
- export function getRoomName(roomGridIndex?: int): string {
144
+ export function getRoomName(roomGridIndex?: int): string | undefined;
145
+
146
+ export function getRoomName(roomGridIndex?: int): string | undefined {
124
147
  const roomData = getRoomData(roomGridIndex);
125
- return roomData === undefined ? "Unknown" : roomData.Name;
148
+ return roomData === undefined ? undefined : roomData.Name;
126
149
  }
127
150
 
128
151
  /**
129
- * Helper function to get the name of the room as it appears in the STB/XML data.
152
+ * Helper function to get the shape of the current room as it appears in the STB/XML data.
153
+ *
154
+ * You can optionally provide a room grid index as an argument to get the shape for that room
155
+ * instead.
156
+ *
157
+ * (The version of the function without any arguments will not return undefined since the current
158
+ * room is guaranteed to have data.)
159
+ */
160
+ export function getRoomShape(): RoomShape;
161
+
162
+ /**
163
+ * Helper function to get the shape of the room as it appears in the STB/XML data.
130
164
  *
131
165
  * @param roomGridIndex Optional. Default is the current room index.
132
- * @returns The room name. Returns "Unknown"if the room data was not found.
166
+ * @returns The room shape. Returns undefined if the room data was not found.
133
167
  */
168
+ export function getRoomShape(roomGridIndex?: int): RoomShape | undefined;
169
+
134
170
  export function getRoomShape(roomGridIndex?: int): RoomShape | undefined {
135
171
  const roomData = getRoomData(roomGridIndex);
136
172
  return roomData === undefined ? undefined : roomData.Shape;
137
173
  }
138
174
 
139
175
  /**
140
- * Helper function to get the stage ID for a room from the XML/STB data. The room stage ID will
141
- * correspond to the first number in the filename of the XML/STB file. For example, a Depths room
142
- * would have a stage ID of 7.
176
+ * Helper function to get the stage ID for the current room as it appears in the STB/XML data.
177
+ *
178
+ * The room stage ID will correspond to the first number in the filename of the XML/STB file. For
179
+ * example, a Depths room would have a stage ID of `StageID.DEPTHS` (7).
180
+ *
181
+ * You can optionally provide a room grid index as an argument to get the stage ID for that room
182
+ * instead.
183
+ *
184
+ * (The version of the function without any arguments will not return undefined since the current
185
+ * room is guaranteed to have data.)
186
+ */
187
+ export function getRoomStageID(): StageID;
188
+
189
+ /**
190
+ * Helper function to get the stage ID for a room as it appears in the STB/XML data.
191
+ *
192
+ * The room stage ID will correspond to the first number in the filename of the XML/STB file. For
193
+ * example, a Depths room would have a stage ID of `StageID.DEPTHS` (7).
143
194
  *
144
195
  * @param roomGridIndex Optional. Default is the current room index.
145
- * @returns The room stage ID. Returns -1 if the room data was not found.
196
+ * @returns The room stage ID. Returns undefined if the room data was not found.
146
197
  */
147
- export function getRoomStageID(roomGridIndex?: int): StageID | -1 {
198
+ export function getRoomStageID(roomGridIndex?: int): StageID | undefined;
199
+
200
+ export function getRoomStageID(roomGridIndex?: int): StageID | undefined {
148
201
  const roomData = getRoomData(roomGridIndex);
149
- return roomData === undefined ? -1 : roomData.StageID;
202
+ return roomData === undefined ? undefined : roomData.StageID;
150
203
  }
151
204
 
152
205
  /**
153
- * Helper function to get the sub-type for a room from the XML/STB data. The room sub-type will
154
- * correspond to different things depending on what XML/STB file it draws from. For example, in the
155
- * "00.special rooms.stb" file, an Angel Room with a sub-type of 0 will correspond to a normal Angel
156
- * Room and a sub-type of 1 will correspond to an Angel Room shop for The Stairway.
206
+ * Helper function to get the sub-type for the current room as it appears in the STB/XML data.
207
+ *
208
+ * The room sub-type will correspond to different things depending on what XML/STB file it draws
209
+ * from. For example, in the "00.special rooms.stb" file, an Angel Room with a sub-type of 0 will
210
+ * correspond to a normal Angel Room and a sub-type of 1 will correspond to an Angel Room shop from
211
+ * The Stairway.
212
+ *
213
+ * You can optionally provide a room grid index as an argument to get the sub-type for that room
214
+ * instead.
215
+ *
216
+ * (The version of the function without any arguments will not return undefined since the current
217
+ * room is guaranteed to have data.)
218
+ */
219
+ export function getRoomSubType(): int;
220
+
221
+ /**
222
+ * Helper function to get the sub-type for a room as it appears in the STB/XML data.
223
+ *
224
+ * The room sub-type will correspond to different things depending on what XML/STB file it draws
225
+ * from. For example, in the "00.special rooms.stb" file, an Angel Room with a sub-type of 0 will
226
+ * correspond to a normal Angel Room and a sub-type of 1 will correspond to an Angel Room shop from
227
+ * The Stairway.
157
228
  *
158
229
  * @param roomGridIndex Optional. Default is the current room index.
159
- * @returns The room sub-type. Returns -1 if the room data was not found.
230
+ * @returns The room sub-type. Returns undefined if the room data was not found.
160
231
  */
161
- export function getRoomSubType(roomGridIndex?: int): int {
232
+ export function getRoomSubType(roomGridIndex?: int): int | undefined;
233
+
234
+ export function getRoomSubType(roomGridIndex?: int): int | undefined {
162
235
  const roomData = getRoomData(roomGridIndex);
163
- return roomData === undefined ? -1 : roomData.Subtype;
236
+ return roomData === undefined ? undefined : roomData.Subtype;
164
237
  }
165
238
 
239
+ /**
240
+ * Helper function to get the type for the current room as it appears in the STB/XML data.
241
+ *
242
+ * You can optionally provide a room grid index as an argument to get the type for that room
243
+ * instead.
244
+ *
245
+ * (The version of the function without any arguments will not return undefined since the current
246
+ * room is guaranteed to have data.)
247
+ */
248
+ export function getRoomType(): RoomType;
249
+
250
+ /**
251
+ * Helper function to get the type for a room as it appears in the STB/XML data.
252
+ *
253
+ * @param roomGridIndex Optional. Default is the current room index.
254
+ * @returns The room type. Returns undefined if the room data was not found.
255
+ */
256
+ export function getRoomType(roomGridIndex?: int): RoomType | undefined;
257
+
166
258
  /**
167
259
  * Helper function for getting the type of the room with the given grid index.
168
260
  *
169
261
  * @param roomGridIndex Optional. Default is the current room index.
170
262
  * @returns The room data type. Returns -1 if the room data was not found.
171
263
  */
172
- export function getRoomType(roomGridIndex?: int): RoomType | -1 {
264
+ export function getRoomType(roomGridIndex?: int): RoomType | undefined {
173
265
  const roomData = getRoomData(roomGridIndex);
174
- return roomData === undefined ? -1 : roomData.Type;
266
+ return roomData === undefined ? undefined : roomData.Type;
175
267
  }
176
268
 
177
269
  /**
178
- * Helper function to get the variant for a room from the XML/STB data. You can think of a room
179
- * variant as its identifier. For example, to go to Basement room #123, you would use a console
180
- * command of `goto d.123` while on the Basement.
270
+ * Helper function to get the variant for the current room as it appears in the STB/XML data.
271
+ *
272
+ * You can think of a room variant as its identifier. For example, to go to Basement room #123, you
273
+ * would use a console command of `goto d.123` while on the Basement.
274
+ *
275
+ * You can optionally provide a room grid index as an argument to get the variant for that room
276
+ * instead.
277
+ *
278
+ * (The version of the function without any arguments will not return undefined since the current
279
+ * room is guaranteed to have data.)
280
+ */
281
+ export function getRoomVariant(): int;
282
+
283
+ /**
284
+ * Helper function to get the variant for a room as it appears in the STB/XML data.
285
+ *
286
+ * You can think of a room variant as its identifier. For example, to go to Basement room #123, you
287
+ * would use a console command of `goto d.123` while on the Basement.
181
288
  *
182
289
  * @param roomGridIndex Optional. Default is the current room index.
183
- * @returns The room variant. Returns -1 if the room data was not found.
290
+ * @returns The room variant. Returns undefined if the room data was not found.
184
291
  */
292
+ export function getRoomVariant(roomGridIndex?: int): int | undefined;
293
+
185
294
  export function getRoomVariant(roomGridIndex?: int): int {
186
295
  const roomData = getRoomData(roomGridIndex);
187
296
  return roomData === undefined ? -1 : roomData.Variant;