isaacscript-common 33.14.1 → 34.0.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.
@@ -5717,16 +5717,6 @@ export declare function getLanguageName(): string;
5717
5717
  */
5718
5718
  export declare function getLasers(laserVariant?: LaserVariant | -1, subType?: number): EntityLaser[];
5719
5719
 
5720
- /**
5721
- * Helper function to return the last element of an array.
5722
- *
5723
- * If the array is empty, this will return undefined.
5724
- *
5725
- * (Note that TSTL does not support `Array.at(-1)`, which would make this helper function largely
5726
- * unnecessary.)
5727
- */
5728
- export declare function getLastElement<T>(array: T[]): T | undefined;
5729
-
5730
5720
  /**
5731
5721
  * Helper function that returns the number of the final frame in a particular animation for a
5732
5722
  * sprite. By default, it will use the currently playing animation, but you can also specify a
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 33.14.1
3
+ isaacscript-common 34.0.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -49,6 +49,14 @@ local function require(file, ...)
49
49
  end
50
50
  ____modules = {
51
51
  ["lualib_bundle"] = function(...)
52
+ local function __TS__ArrayAt(self, relativeIndex)
53
+ local absoluteIndex = relativeIndex < 0 and #self + relativeIndex or relativeIndex
54
+ if absoluteIndex >= 0 and absoluteIndex < #self then
55
+ return self[absoluteIndex + 1]
56
+ end
57
+ return nil
58
+ end
59
+
52
60
  local function __TS__ArrayIsArray(value)
53
61
  return type(value) == "table" and (value[1] ~= nil or next(value) == nil)
54
62
  end
@@ -2524,6 +2532,7 @@ local function __TS__UsingAsync(self, cb, ...)
2524
2532
  end
2525
2533
 
2526
2534
  return {
2535
+ __TS__ArrayAt = __TS__ArrayAt,
2527
2536
  __TS__ArrayConcat = __TS__ArrayConcat,
2528
2537
  __TS__ArrayEntries = __TS__ArrayEntries,
2529
2538
  __TS__ArrayEvery = __TS__ArrayEvery,
@@ -17081,9 +17090,6 @@ function ____exports.getHighestArrayElement(self, array)
17081
17090
  end
17082
17091
  return highestValue
17083
17092
  end
17084
- function ____exports.getLastElement(self, array)
17085
- return array[#array]
17086
- end
17087
17093
  function ____exports.getLowestArrayElement(self, array)
17088
17094
  if #array == 0 then
17089
17095
  return nil
@@ -21826,6 +21832,7 @@ local __TS__ArraySome = ____lualib.__TS__ArraySome
21826
21832
  local __TS__New = ____lualib.__TS__New
21827
21833
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
21828
21834
  local __TS__ArrayMap = ____lualib.__TS__ArrayMap
21835
+ local __TS__ArrayAt = ____lualib.__TS__ArrayAt
21829
21836
  local __TS__ArrayFind = ____lualib.__TS__ArrayFind
21830
21837
  local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
21831
21838
  local ____exports = {}
@@ -21848,7 +21855,6 @@ local itemConfig = ____cachedClasses.itemConfig
21848
21855
  local ____ReadonlySet = require("src.types.ReadonlySet")
21849
21856
  local ReadonlySet = ____ReadonlySet.ReadonlySet
21850
21857
  local ____array = require("src.functions.array")
21851
- local getLastElement = ____array.getLastElement
21852
21858
  local sumArray = ____array.sumArray
21853
21859
  local ____characters = require("src.functions.characters")
21854
21860
  local getCharacterName = ____characters.getCharacterName
@@ -21993,7 +21999,7 @@ function ____exports.getEffectsList(self, player)
21993
21999
  end
21994
22000
  function ____exports.getFinalPlayer(self)
21995
22001
  local players = getPlayers(nil)
21996
- local lastPlayer = getLastElement(nil, players)
22002
+ local lastPlayer = __TS__ArrayAt(players, -1)
21997
22003
  assertDefined(nil, lastPlayer, "Failed to get the final player since there were 0 players.")
21998
22004
  return lastPlayer
21999
22005
  end
@@ -34598,6 +34604,7 @@ local ____lualib = require("lualib_bundle")
34598
34604
  local __TS__Class = ____lualib.__TS__Class
34599
34605
  local __TS__ClassExtends = ____lualib.__TS__ClassExtends
34600
34606
  local __TS__DecorateLegacy = ____lualib.__TS__DecorateLegacy
34607
+ local __TS__ArrayAt = ____lualib.__TS__ArrayAt
34601
34608
  local ____exports = {}
34602
34609
  local ____cachedClasses = require("src.core.cachedClasses")
34603
34610
  local game = ____cachedClasses.game
@@ -34605,8 +34612,6 @@ local ____decorators = require("src.decorators")
34605
34612
  local Exported = ____decorators.Exported
34606
34613
  local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
34607
34614
  local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
34608
- local ____array = require("src.functions.array")
34609
- local getLastElement = ____array.getLastElement
34610
34615
  local ____dimensions = require("src.functions.dimensions")
34611
34616
  local getDimension = ____dimensions.getDimension
34612
34617
  local ____roomData = require("src.functions.roomData")
@@ -34687,7 +34692,7 @@ function RoomHistory.prototype.getPreviousRoomDescription(self)
34687
34692
  end
34688
34693
  __TS__DecorateLegacy({Exported}, RoomHistory.prototype, "getPreviousRoomDescription", true)
34689
34694
  function RoomHistory.prototype.getLatestRoomDescription(self)
34690
- return getLastElement(nil, v.run.roomHistory)
34695
+ return __TS__ArrayAt(v.run.roomHistory, -1)
34691
34696
  end
34692
34697
  __TS__DecorateLegacy({Exported}, RoomHistory.prototype, "getLatestRoomDescription", true)
34693
34698
  function RoomHistory.prototype.inFirstRoom(self)
@@ -49725,7 +49730,34 @@ function ____exports.sound(self, params)
49725
49730
  end
49726
49731
  sfxManager:Play(soundEffect)
49727
49732
  end
49733
+ function ____exports.spawnCollectible(self, params)
49734
+ if params == "" then
49735
+ print("You must specify the collectible name or the number corresponding to the collectible type.")
49736
+ return
49737
+ end
49738
+ local collectibleTypeNumber = tonumber(params)
49739
+ local collectibleType
49740
+ if collectibleTypeNumber == nil then
49741
+ local match = getMapPartialMatch(nil, params, COLLECTIBLE_NAME_TO_TYPE_MAP)
49742
+ if match == nil then
49743
+ print("Unknown collectible: " .. params)
49744
+ return
49745
+ end
49746
+ collectibleType = match[2]
49747
+ else
49748
+ collectibleType = asCollectibleType(nil, collectibleTypeNumber)
49749
+ end
49750
+ local roomClass = game:GetRoom()
49751
+ local centerPos = roomClass:GetCenterPos()
49752
+ spawnCollectibleUnsafe(nil, collectibleType, centerPos)
49753
+ end
49728
49754
  function ____exports.spawnGoldenTrinket(self, params)
49755
+ ____exports.spawnTrinket(nil, params, true)
49756
+ end
49757
+ function ____exports.spawnTrinket(self, params, golden)
49758
+ if golden == nil then
49759
+ golden = false
49760
+ end
49729
49761
  if params == "" then
49730
49762
  print("You must specify the name or number corresponding to the trinket type.")
49731
49763
  return
@@ -49745,7 +49777,36 @@ function ____exports.spawnGoldenTrinket(self, params)
49745
49777
  local roomClass = game:GetRoom()
49746
49778
  local centerPos = roomClass:GetCenterPos()
49747
49779
  local goldenTrinketType = getGoldenTrinketType(nil, trinketType)
49748
- spawnTrinketFunction(nil, goldenTrinketType, centerPos)
49780
+ local trinketTypeToSpawn = golden and goldenTrinketType or trinketType
49781
+ spawnTrinketFunction(nil, trinketTypeToSpawn, centerPos)
49782
+ end
49783
+ function ____exports.spawnTrinketAt(self, params, golden)
49784
+ if golden == nil then
49785
+ golden = false
49786
+ end
49787
+ if params == "" then
49788
+ print("You must specify the number corresponding to the trinket type and the number corresponding to the grid tile location.")
49789
+ return
49790
+ end
49791
+ local args = __TS__StringSplit(params, " ")
49792
+ if #args ~= 2 then
49793
+ print("You must specify the number corresponding to the trinket type and the number corresponding to the grid tile location.")
49794
+ return
49795
+ end
49796
+ local trinketTypeNumber = tonumber(args[1])
49797
+ if trinketTypeNumber == nil or trinketTypeNumber < 0 then
49798
+ print("Failed to parse the trinket type of: " .. tostring(args[1]))
49799
+ return
49800
+ end
49801
+ local gridIndex = tonumber(args[2])
49802
+ if gridIndex == nil or gridIndex < 0 then
49803
+ print("Failed to parse the grid index of: " .. tostring(args[2]))
49804
+ return
49805
+ end
49806
+ local trinketType = asTrinketType(nil, trinketTypeNumber)
49807
+ local goldenTrinketType = getGoldenTrinketType(nil, trinketType)
49808
+ local trinketTypeToSpawn = golden and goldenTrinketType or trinketType
49809
+ spawnTrinketFunction(nil, trinketTypeToSpawn, gridIndex)
49749
49810
  end
49750
49811
  function ____exports.startingRoom(self)
49751
49812
  local level = game:GetLevel()
@@ -49982,6 +50043,9 @@ function ____exports.coins(self, params)
49982
50043
  local player = Isaac.GetPlayer()
49983
50044
  player:AddCoins(numCoins)
49984
50045
  end
50046
+ function ____exports.collectible(self, params)
50047
+ ____exports.spawnCollectible(nil, params)
50048
+ end
49985
50049
  function ____exports.crawlSpace(self)
49986
50050
  spawnTrapdoorOrCrawlSpace(nil, false)
49987
50051
  end
@@ -50129,6 +50193,9 @@ end
50129
50193
  function ____exports.goldKey(self)
50130
50194
  ____exports.goldenKey(nil)
50131
50195
  end
50196
+ function ____exports.goldTrinket(self, params)
50197
+ ____exports.spawnGoldenTrinket(nil, params)
50198
+ end
50132
50199
  function ____exports.goldenTrinket(self, params)
50133
50200
  ____exports.spawnGoldenTrinket(nil, params)
50134
50201
  end
@@ -50507,47 +50574,34 @@ function ____exports.spam(self)
50507
50574
  v.persistent.spamBloodRights = not v.persistent.spamBloodRights
50508
50575
  printEnabled(nil, v.persistent.spamBloodRights, "spamming Blood Rights")
50509
50576
  end
50510
- function ____exports.spawnCollectible(self, params)
50577
+ function ____exports.spawnCollectibleAt(self, params)
50511
50578
  if params == "" then
50512
- print("You must specify the name or number corresponding to the collectible type.")
50579
+ print("You must specify the number corresponding to the collectible type and the number corresponding to the grid tile location.")
50513
50580
  return
50514
50581
  end
50515
- local collectibleTypeNumber = tonumber(params)
50516
- local collectibleType
50517
- if collectibleTypeNumber == nil then
50518
- local match = getMapPartialMatch(nil, params, COLLECTIBLE_NAME_TO_TYPE_MAP)
50519
- if match == nil then
50520
- print("Unknown collectible: " .. params)
50521
- return
50522
- end
50523
- collectibleType = match[2]
50524
- else
50525
- collectibleType = asCollectibleType(nil, collectibleTypeNumber)
50582
+ local args = __TS__StringSplit(params, " ")
50583
+ if #args ~= 2 then
50584
+ print("You must specify the number corresponding to the collectible type and the number corresponding to the grid tile location.")
50585
+ return
50526
50586
  end
50527
- local roomClass = game:GetRoom()
50528
- local centerPos = roomClass:GetCenterPos()
50529
- spawnCollectibleUnsafe(nil, collectibleType, centerPos)
50530
- end
50531
- function ____exports.spawnTrinket(self, params)
50532
- if params == "" then
50533
- print("You must specify the name or number corresponding to the trinket type.")
50587
+ local collectibleTypeNumber = tonumber(args[1])
50588
+ if collectibleTypeNumber == nil or collectibleTypeNumber < 0 then
50589
+ print("Failed to parse the collectible type of: " .. tostring(args[1]))
50534
50590
  return
50535
50591
  end
50536
- local trinketTypeNumber = tonumber(params)
50537
- local trinketType
50538
- if trinketTypeNumber == nil then
50539
- local match = getMapPartialMatch(nil, params, TRINKET_NAME_TO_TYPE_MAP)
50540
- if match == nil then
50541
- print("Unknown trinket: " .. params)
50542
- return
50543
- end
50544
- trinketType = match[2]
50545
- else
50546
- trinketType = asTrinketType(nil, trinketTypeNumber)
50592
+ local gridIndex = tonumber(args[2])
50593
+ if gridIndex == nil or gridIndex < 0 then
50594
+ print("Failed to parse the grid index of: " .. tostring(args[2]))
50595
+ return
50547
50596
  end
50548
- local roomClass = game:GetRoom()
50549
- local centerPos = roomClass:GetCenterPos()
50550
- spawnTrinketFunction(nil, trinketType, centerPos)
50597
+ local collectibleType = asCollectibleType(nil, collectibleTypeNumber)
50598
+ spawnCollectibleUnsafe(nil, collectibleType, gridIndex)
50599
+ end
50600
+ function ____exports.spawnGoldTrinket(self, params)
50601
+ ____exports.spawnGoldenTrinket(nil, params)
50602
+ end
50603
+ function ____exports.spawnGoldenTrinketAt(self, params)
50604
+ ____exports.spawnTrinketAt(nil, params, true)
50551
50605
  end
50552
50606
  function ____exports.speed(self, params)
50553
50607
  local player = Isaac.GetPlayer()
@@ -50602,6 +50656,9 @@ end
50602
50656
  function ____exports.treasureRoom(self)
50603
50657
  warpToRoomType(nil, RoomType.TREASURE)
50604
50658
  end
50659
+ function ____exports.trinket(self, params)
50660
+ ____exports.spawnTrinket(nil, params)
50661
+ end
50605
50662
  function ____exports.ultraSecretRoom(self)
50606
50663
  warpToRoomType(nil, RoomType.ULTRA_SECRET)
50607
50664
  end
@@ -51434,6 +51491,7 @@ local __TS__Class = ____lualib.__TS__Class
51434
51491
  local __TS__ClassExtends = ____lualib.__TS__ClassExtends
51435
51492
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
51436
51493
  local __TS__DecorateLegacy = ____lualib.__TS__DecorateLegacy
51494
+ local __TS__ArrayAt = ____lualib.__TS__ArrayAt
51437
51495
  local ____exports = {}
51438
51496
  local ____decorators = require("src.decorators")
51439
51497
  local Exported = ____decorators.Exported
@@ -51442,7 +51500,6 @@ local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
51442
51500
  local ____array = require("src.functions.array")
51443
51501
  local arrayRemoveInPlace = ____array.arrayRemoveInPlace
51444
51502
  local copyArray = ____array.copyArray
51445
- local getLastElement = ____array.getLastElement
51446
51503
  local ____collectibles = require("src.functions.collectibles")
51447
51504
  local isActiveCollectible = ____collectibles.isActiveCollectible
51448
51505
  local ____playerDataStructures = require("src.functions.playerDataStructures")
@@ -51488,7 +51545,7 @@ end
51488
51545
  __TS__DecorateLegacy({Exported}, PlayerInventory.prototype, "getPlayerInventory", true)
51489
51546
  function PlayerInventory.prototype.getPlayerLastPassiveCollectible(self, player)
51490
51547
  local inventory = self:getPlayerInventory(player, false)
51491
- return getLastElement(nil, inventory)
51548
+ return __TS__ArrayAt(inventory, -1)
51492
51549
  end
51493
51550
  __TS__DecorateLegacy({Exported}, PlayerInventory.prototype, "getPlayerLastPassiveCollectible", true)
51494
51551
  return ____exports
@@ -1,3 +1,11 @@
1
+ local function __TS__ArrayAt(self, relativeIndex)
2
+ local absoluteIndex = relativeIndex < 0 and #self + relativeIndex or relativeIndex
3
+ if absoluteIndex >= 0 and absoluteIndex < #self then
4
+ return self[absoluteIndex + 1]
5
+ end
6
+ return nil
7
+ end
8
+
1
9
  local function __TS__ArrayIsArray(value)
2
10
  return type(value) == "table" and (value[1] ~= nil or next(value) == nil)
3
11
  end
@@ -2473,6 +2481,7 @@ local function __TS__UsingAsync(self, cb, ...)
2473
2481
  end
2474
2482
 
2475
2483
  return {
2484
+ __TS__ArrayAt = __TS__ArrayAt,
2476
2485
  __TS__ArrayConcat = __TS__ArrayConcat,
2477
2486
  __TS__ArrayEntries = __TS__ArrayEntries,
2478
2487
  __TS__ArrayEvery = __TS__ArrayEvery,
@@ -1 +1 @@
1
- {"version":3,"file":"PlayerInventory.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/PlayerInventory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAYpE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAYhD,qBAAa,eAAgB,SAAQ,OAAO;IAqB1C,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAUnC;IAGF,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAUrC;IAEF;;;;;;;;;;;;;;;;;;;;;OAqBG;IAEI,kBAAkB,CACvB,MAAM,EAAE,YAAY,EACpB,yBAAyB,UAAO,GAC/B,eAAe,EAAE;IAgBpB;;;;;;;OAOG;IAEI,+BAA+B,CACpC,MAAM,EAAE,YAAY,GACnB,eAAe,GAAG,SAAS;CAI/B"}
1
+ {"version":3,"file":"PlayerInventory.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/PlayerInventory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAQpE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAYhD,qBAAa,eAAgB,SAAQ,OAAO;IAqB1C,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAUnC;IAGF,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAUrC;IAEF;;;;;;;;;;;;;;;;;;;;;OAqBG;IAEI,kBAAkB,CACvB,MAAM,EAAE,YAAY,EACpB,yBAAyB,UAAO,GAC/B,eAAe,EAAE;IAgBpB;;;;;;;OAOG;IAEI,+BAA+B,CACpC,MAAM,EAAE,YAAY,GACnB,eAAe,GAAG,SAAS;CAI/B"}
@@ -4,6 +4,7 @@ local __TS__Class = ____lualib.__TS__Class
4
4
  local __TS__ClassExtends = ____lualib.__TS__ClassExtends
5
5
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
6
6
  local __TS__DecorateLegacy = ____lualib.__TS__DecorateLegacy
7
+ local __TS__ArrayAt = ____lualib.__TS__ArrayAt
7
8
  local ____exports = {}
8
9
  local ____decorators = require("src.decorators")
9
10
  local Exported = ____decorators.Exported
@@ -12,7 +13,6 @@ local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
12
13
  local ____array = require("src.functions.array")
13
14
  local arrayRemoveInPlace = ____array.arrayRemoveInPlace
14
15
  local copyArray = ____array.copyArray
15
- local getLastElement = ____array.getLastElement
16
16
  local ____collectibles = require("src.functions.collectibles")
17
17
  local isActiveCollectible = ____collectibles.isActiveCollectible
18
18
  local ____playerDataStructures = require("src.functions.playerDataStructures")
@@ -58,7 +58,7 @@ end
58
58
  __TS__DecorateLegacy({Exported}, PlayerInventory.prototype, "getPlayerInventory", true)
59
59
  function PlayerInventory.prototype.getPlayerLastPassiveCollectible(self, player)
60
60
  local inventory = self:getPlayerInventory(player, false)
61
- return getLastElement(nil, inventory)
61
+ return __TS__ArrayAt(inventory, -1)
62
62
  end
63
63
  __TS__DecorateLegacy({Exported}, PlayerInventory.prototype, "getPlayerLastPassiveCollectible", true)
64
64
  return ____exports
@@ -1 +1 @@
1
- {"version":3,"file":"RoomHistory.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/RoomHistory.ts"],"names":[],"mappings":";AAcA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAQhD,qBAAa,WAAY,SAAQ,OAAO;IActC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAgC/B;IAEF;;;;OAIG;IAEI,yBAAyB,IAAI,IAAI;IAIxC;;;;;OAKG;IAEI,kBAAkB,IAAI,GAAG;IAIhC;;;;;OAKG;IAEI,cAAc,IAAI,aAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IAIjE;;;;;;;OAOG;IAEI,0BAA0B,IAAI,QAAQ,CAAC,eAAe,CAAC;IAiB9D;;;;;;;;;;OAUG;IAEI,wBAAwB,IAAI,QAAQ,CAAC,eAAe,CAAC,GAAG,SAAS;IAIxE,gFAAgF;IAEzE,WAAW,IAAI,OAAO;IAI7B;;;;;;;;;;OAUG;IAEI,aAAa,IAAI,OAAO;CAwBhC"}
1
+ {"version":3,"file":"RoomHistory.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/RoomHistory.ts"],"names":[],"mappings":";AAaA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAQhD,qBAAa,WAAY,SAAQ,OAAO;IActC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAgC/B;IAEF;;;;OAIG;IAEI,yBAAyB,IAAI,IAAI;IAIxC;;;;;OAKG;IAEI,kBAAkB,IAAI,GAAG;IAIhC;;;;;OAKG;IAEI,cAAc,IAAI,aAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IAIjE;;;;;;;OAOG;IAEI,0BAA0B,IAAI,QAAQ,CAAC,eAAe,CAAC;IAiB9D;;;;;;;;;;OAUG;IAEI,wBAAwB,IAAI,QAAQ,CAAC,eAAe,CAAC,GAAG,SAAS;IAIxE,gFAAgF;IAEzE,WAAW,IAAI,OAAO;IAI7B;;;;;;;;;;OAUG;IAEI,aAAa,IAAI,OAAO;CAwBhC"}
@@ -2,6 +2,7 @@ local ____lualib = require("lualib_bundle")
2
2
  local __TS__Class = ____lualib.__TS__Class
3
3
  local __TS__ClassExtends = ____lualib.__TS__ClassExtends
4
4
  local __TS__DecorateLegacy = ____lualib.__TS__DecorateLegacy
5
+ local __TS__ArrayAt = ____lualib.__TS__ArrayAt
5
6
  local ____exports = {}
6
7
  local ____cachedClasses = require("src.core.cachedClasses")
7
8
  local game = ____cachedClasses.game
@@ -9,8 +10,6 @@ local ____decorators = require("src.decorators")
9
10
  local Exported = ____decorators.Exported
10
11
  local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
11
12
  local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
12
- local ____array = require("src.functions.array")
13
- local getLastElement = ____array.getLastElement
14
13
  local ____dimensions = require("src.functions.dimensions")
15
14
  local getDimension = ____dimensions.getDimension
16
15
  local ____roomData = require("src.functions.roomData")
@@ -91,7 +90,7 @@ function RoomHistory.prototype.getPreviousRoomDescription(self)
91
90
  end
92
91
  __TS__DecorateLegacy({Exported}, RoomHistory.prototype, "getPreviousRoomDescription", true)
93
92
  function RoomHistory.prototype.getLatestRoomDescription(self)
94
- return getLastElement(nil, v.run.roomHistory)
93
+ return __TS__ArrayAt(v.run.roomHistory, -1)
95
94
  end
96
95
  __TS__DecorateLegacy({Exported}, RoomHistory.prototype, "getLatestRoomDescription", true)
97
96
  function RoomHistory.prototype.inFirstRoom(self)
@@ -97,6 +97,8 @@ export declare function coin(params: string): void;
97
97
  * to remove coins.)
98
98
  */
99
99
  export declare function coins(params: string): void;
100
+ /** Alias for the "spawnCollectible" command. */
101
+ export declare function collectible(params: string): void;
100
102
  /** Creates a crawl space next to the player. */
101
103
  export declare function crawlSpace(): void;
102
104
  /** Toggles permanent Curse of the Cursed. */
@@ -165,6 +167,8 @@ export declare function goldBomb(): void;
165
167
  export declare function goldHearts(params: string): void;
166
168
  /** Alias for the "goldenKey" command. */
167
169
  export declare function goldKey(): void;
170
+ /** Alias for the "spawnGoldenTrinket" command. */
171
+ export declare function goldTrinket(params: string): void;
168
172
  /** Gives the player a golden bomb. */
169
173
  export declare function goldenBomb(): void;
170
174
  /**
@@ -371,10 +375,76 @@ export declare function sounds(): void;
371
375
  * "debug 10".
372
376
  */
373
377
  export declare function spam(): void;
378
+ /**
379
+ * Spawns a collectible in the center of the room. You must specify the collectible name or the
380
+ * number corresponding to the collectible type.
381
+ *
382
+ * For example, all of the following commands would spawn Spoon Bender:
383
+ *
384
+ * ```text
385
+ * spawnCollectible spoon bender
386
+ * spawnCollectible spoon
387
+ * spawnCollectible spo
388
+ * spawnCollectible 3
389
+ * ```
390
+ */
374
391
  export declare function spawnCollectible(params: string): void;
375
- /** Spawns a golden version of the specified trinket type. */
392
+ /**
393
+ * Spawns a collectible at a specific grid tile location. You must specify the number corresponding
394
+ * to the collectible type and the number corresponding to the grid tile location.
395
+ *
396
+ * For example, this would spawn Spoon Bender in the top-left corner of a 1x1 room:
397
+ *
398
+ * ```text
399
+ * spawnCollectibleAt 3 16
400
+ * ```
401
+ *
402
+ * (You can use the "grid" command to toggle displaying the numerical grid indexes corresponding to
403
+ * a grid tile.)
404
+ */
405
+ export declare function spawnCollectibleAt(params: string): void;
406
+ /** Alias for the `spawnGoldenTrinket` command. */
407
+ export declare function spawnGoldTrinket(params: string): void;
408
+ /**
409
+ * The same thing as the `spawnTrinket` command but spawns a golden version of the specified
410
+ * trinket.
411
+ */
376
412
  export declare function spawnGoldenTrinket(params: string): void;
377
- export declare function spawnTrinket(params: string): void;
413
+ /**
414
+ * The same thing as the `spawnTrinketAt` command but spawns a golden version of the specified
415
+ * trinket.
416
+ */
417
+ export declare function spawnGoldenTrinketAt(params: string): void;
418
+ /**
419
+ * Spawns a trinket in the center of the room. You must specify the trinket name or the number
420
+ * corresponding to the trinket type.
421
+ *
422
+ * For example, all of the following commands would spawn the Wiggle Worm trinket:
423
+ *
424
+ * ```text
425
+ * spawnTrinket wiggle worm
426
+ * spawnTrinket wiggle
427
+ * spawnTrinket wig
428
+ * spawnTrinket 10
429
+ * ```
430
+ *
431
+ * Also see the `spawnGoldenTrinket` command.
432
+ */
433
+ export declare function spawnTrinket(params: string, golden?: boolean): void;
434
+ /**
435
+ * Spawns a trinket at a specific grid tile location. You must specify the number corresponding to
436
+ * the trinket type and the number corresponding to the grid tile location.
437
+ *
438
+ * For example, this would spawn Wiggle Worm in the top-left corner of a 1x1 room:
439
+ *
440
+ * ```text
441
+ * spawnTrinketAt 10 16
442
+ * ```
443
+ *
444
+ * (You can use the "grid" command to toggle displaying the numerical grid indexes corresponding to
445
+ * a grid tile.)
446
+ */
447
+ export declare function spawnTrinketAt(params: string, golden?: boolean): void;
378
448
  /**
379
449
  * Toggles a set movement speed and flight for the player. You can provide an optional argument to
380
450
  * this command in order to set the speed to a specific amount. Default is 2.0 (which is the maximum
@@ -401,6 +471,8 @@ export declare function tests(): void;
401
471
  export declare function trapdoor(): void;
402
472
  /** Warps to the first Treasure Room on the floor. */
403
473
  export declare function treasureRoom(): void;
474
+ /** Alias for the "spawnTrinket" command. */
475
+ export declare function trinket(params: string): void;
404
476
  /** Warps to the first Ultra Secret Room on the floor. */
405
477
  export declare function ultraSecretRoom(): void;
406
478
  /** Toggles permanent Curse of the Unknown. */
@@ -1 +1 @@
1
- {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../../../../src/classes/features/other/extraConsoleCommands/commands.ts"],"names":[],"mappings":"AAkJA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CA2C/C;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,IAAI,CAEhC;AAED,gEAAgE;AAChE,wBAAgB,MAAM,IAAI,IAAI,CAK7B;AAED,sEAAsE;AACtE,wBAAgB,OAAO,IAAI,IAAI,CAkB9B;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEhD;AAED,+CAA+C;AAC/C,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAED,4CAA4C;AAC5C,wBAAgB,KAAK,IAAI,IAAI,CAG5B;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAcjD;AAED,2CAA2C;AAC3C,wBAAgB,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AAY,IAAI,IAAI,CAEnC;AAED,yDAAyD;AACzD,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED,8CAA8C;AAC9C,wBAAgB,OAAO,IAAI,IAAI,CAG9B;AAED,sFAAsF;AACtF,wBAAgB,MAAM,IAAI,IAAI,CAQ7B;AAED,wFAAwF;AACxF,wBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEvC;AAED;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CA0BzC"}
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../../../../src/classes/features/other/extraConsoleCommands/commands.ts"],"names":[],"mappings":"AAoJA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CA2C/C;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,IAAI,CAEhC;AAED,gEAAgE;AAChE,wBAAgB,MAAM,IAAI,IAAI,CAK7B;AAED,sEAAsE;AACtE,wBAAgB,OAAO,IAAI,IAAI,CAkB9B;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEhD;AAED,+CAA+C;AAC/C,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAED,4CAA4C;AAC5C,wBAAgB,KAAK,IAAI,IAAI,CAG5B;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAcjD;AAED,2CAA2C;AAC3C,wBAAgB,EAAE,IAAI,IAAI,CAEzB;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAczC;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAc1C;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAE/C;AAED,wCAAwC;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;AAC/C,wBAAgB,YAAY,IAAI,IAAI,CAInC;AAED,yDAAyD;AACzD,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAkB1C;AAED,wCAAwC;AACxC,wBAAgB,KAAK,IAAI,IAAI,CAE5B;AAED,6CAA6C;AAC7C,wBAAgB,QAAQ,IAAI,IAAI,CAE/B;AAED,qDAAqD;AACrD,wBAAgB,YAAY,IAAI,IAAI,CAEnC;AAED,4CAA4C;AAC5C,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAE5C;AAED,yDAAyD;AACzD,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED,8CAA8C;AAC9C,wBAAgB,OAAO,IAAI,IAAI,CAG9B;AAED,sFAAsF;AACtF,wBAAgB,MAAM,IAAI,IAAI,CAQ7B;AAED,wFAAwF;AACxF,wBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEvC;AAED;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CA0BzC"}
@@ -202,8 +202,60 @@ function ____exports.sound(self, params)
202
202
  end
203
203
  sfxManager:Play(soundEffect)
204
204
  end
205
- --- Spawns a golden version of the specified trinket type.
205
+ --- Spawns a collectible in the center of the room. You must specify the collectible name or the
206
+ -- number corresponding to the collectible type.
207
+ --
208
+ -- For example, all of the following commands would spawn Spoon Bender:
209
+ --
210
+ -- ```text
211
+ -- spawnCollectible spoon bender
212
+ -- spawnCollectible spoon
213
+ -- spawnCollectible spo
214
+ -- spawnCollectible 3
215
+ -- ```
216
+ function ____exports.spawnCollectible(self, params)
217
+ if params == "" then
218
+ print("You must specify the collectible name or the number corresponding to the collectible type.")
219
+ return
220
+ end
221
+ local collectibleTypeNumber = tonumber(params)
222
+ local collectibleType
223
+ if collectibleTypeNumber == nil then
224
+ local match = getMapPartialMatch(nil, params, COLLECTIBLE_NAME_TO_TYPE_MAP)
225
+ if match == nil then
226
+ print("Unknown collectible: " .. params)
227
+ return
228
+ end
229
+ collectibleType = match[2]
230
+ else
231
+ collectibleType = asCollectibleType(nil, collectibleTypeNumber)
232
+ end
233
+ local roomClass = game:GetRoom()
234
+ local centerPos = roomClass:GetCenterPos()
235
+ spawnCollectibleUnsafe(nil, collectibleType, centerPos)
236
+ end
237
+ --- The same thing as the `spawnTrinket` command but spawns a golden version of the specified
238
+ -- trinket.
206
239
  function ____exports.spawnGoldenTrinket(self, params)
240
+ ____exports.spawnTrinket(nil, params, true)
241
+ end
242
+ --- Spawns a trinket in the center of the room. You must specify the trinket name or the number
243
+ -- corresponding to the trinket type.
244
+ --
245
+ -- For example, all of the following commands would spawn the Wiggle Worm trinket:
246
+ --
247
+ -- ```text
248
+ -- spawnTrinket wiggle worm
249
+ -- spawnTrinket wiggle
250
+ -- spawnTrinket wig
251
+ -- spawnTrinket 10
252
+ -- ```
253
+ --
254
+ -- Also see the `spawnGoldenTrinket` command.
255
+ function ____exports.spawnTrinket(self, params, golden)
256
+ if golden == nil then
257
+ golden = false
258
+ end
207
259
  if params == "" then
208
260
  print("You must specify the name or number corresponding to the trinket type.")
209
261
  return
@@ -223,7 +275,47 @@ function ____exports.spawnGoldenTrinket(self, params)
223
275
  local roomClass = game:GetRoom()
224
276
  local centerPos = roomClass:GetCenterPos()
225
277
  local goldenTrinketType = getGoldenTrinketType(nil, trinketType)
226
- spawnTrinketFunction(nil, goldenTrinketType, centerPos)
278
+ local trinketTypeToSpawn = golden and goldenTrinketType or trinketType
279
+ spawnTrinketFunction(nil, trinketTypeToSpawn, centerPos)
280
+ end
281
+ --- Spawns a trinket at a specific grid tile location. You must specify the number corresponding to
282
+ -- the trinket type and the number corresponding to the grid tile location.
283
+ --
284
+ -- For example, this would spawn Wiggle Worm in the top-left corner of a 1x1 room:
285
+ --
286
+ -- ```text
287
+ -- spawnTrinketAt 10 16
288
+ -- ```
289
+ --
290
+ -- (You can use the "grid" command to toggle displaying the numerical grid indexes corresponding to
291
+ -- a grid tile.)
292
+ function ____exports.spawnTrinketAt(self, params, golden)
293
+ if golden == nil then
294
+ golden = false
295
+ end
296
+ if params == "" then
297
+ print("You must specify the number corresponding to the trinket type and the number corresponding to the grid tile location.")
298
+ return
299
+ end
300
+ local args = __TS__StringSplit(params, " ")
301
+ if #args ~= 2 then
302
+ print("You must specify the number corresponding to the trinket type and the number corresponding to the grid tile location.")
303
+ return
304
+ end
305
+ local trinketTypeNumber = tonumber(args[1])
306
+ if trinketTypeNumber == nil or trinketTypeNumber < 0 then
307
+ print("Failed to parse the trinket type of: " .. tostring(args[1]))
308
+ return
309
+ end
310
+ local gridIndex = tonumber(args[2])
311
+ if gridIndex == nil or gridIndex < 0 then
312
+ print("Failed to parse the grid index of: " .. tostring(args[2]))
313
+ return
314
+ end
315
+ local trinketType = asTrinketType(nil, trinketTypeNumber)
316
+ local goldenTrinketType = getGoldenTrinketType(nil, trinketType)
317
+ local trinketTypeToSpawn = golden and goldenTrinketType or trinketType
318
+ spawnTrinketFunction(nil, trinketTypeToSpawn, gridIndex)
227
319
  end
228
320
  --- Warps to the starting room of the floor.
229
321
  function ____exports.startingRoom(self)
@@ -505,6 +597,10 @@ function ____exports.coins(self, params)
505
597
  local player = Isaac.GetPlayer()
506
598
  player:AddCoins(numCoins)
507
599
  end
600
+ --- Alias for the "spawnCollectible" command.
601
+ function ____exports.collectible(self, params)
602
+ ____exports.spawnCollectible(nil, params)
603
+ end
508
604
  --- Creates a crawl space next to the player.
509
605
  function ____exports.crawlSpace(self)
510
606
  spawnTrapdoorOrCrawlSpace(nil, false)
@@ -683,6 +779,10 @@ function ____exports.goldKey(self)
683
779
  ____exports.goldenKey(nil)
684
780
  end
685
781
  --- Alias for the "spawnGoldenTrinket" command.
782
+ function ____exports.goldTrinket(self, params)
783
+ ____exports.spawnGoldenTrinket(nil, params)
784
+ end
785
+ --- Alias for the "spawnGoldenTrinket" command.
686
786
  function ____exports.goldenTrinket(self, params)
687
787
  ____exports.spawnGoldenTrinket(nil, params)
688
788
  end
@@ -1150,47 +1250,48 @@ function ____exports.spam(self)
1150
1250
  v.persistent.spamBloodRights = not v.persistent.spamBloodRights
1151
1251
  printEnabled(nil, v.persistent.spamBloodRights, "spamming Blood Rights")
1152
1252
  end
1153
- function ____exports.spawnCollectible(self, params)
1253
+ --- Spawns a collectible at a specific grid tile location. You must specify the number corresponding
1254
+ -- to the collectible type and the number corresponding to the grid tile location.
1255
+ --
1256
+ -- For example, this would spawn Spoon Bender in the top-left corner of a 1x1 room:
1257
+ --
1258
+ -- ```text
1259
+ -- spawnCollectibleAt 3 16
1260
+ -- ```
1261
+ --
1262
+ -- (You can use the "grid" command to toggle displaying the numerical grid indexes corresponding to
1263
+ -- a grid tile.)
1264
+ function ____exports.spawnCollectibleAt(self, params)
1154
1265
  if params == "" then
1155
- print("You must specify the name or number corresponding to the collectible type.")
1266
+ print("You must specify the number corresponding to the collectible type and the number corresponding to the grid tile location.")
1156
1267
  return
1157
1268
  end
1158
- local collectibleTypeNumber = tonumber(params)
1159
- local collectibleType
1160
- if collectibleTypeNumber == nil then
1161
- local match = getMapPartialMatch(nil, params, COLLECTIBLE_NAME_TO_TYPE_MAP)
1162
- if match == nil then
1163
- print("Unknown collectible: " .. params)
1164
- return
1165
- end
1166
- collectibleType = match[2]
1167
- else
1168
- collectibleType = asCollectibleType(nil, collectibleTypeNumber)
1269
+ local args = __TS__StringSplit(params, " ")
1270
+ if #args ~= 2 then
1271
+ print("You must specify the number corresponding to the collectible type and the number corresponding to the grid tile location.")
1272
+ return
1169
1273
  end
1170
- local roomClass = game:GetRoom()
1171
- local centerPos = roomClass:GetCenterPos()
1172
- spawnCollectibleUnsafe(nil, collectibleType, centerPos)
1173
- end
1174
- function ____exports.spawnTrinket(self, params)
1175
- if params == "" then
1176
- print("You must specify the name or number corresponding to the trinket type.")
1274
+ local collectibleTypeNumber = tonumber(args[1])
1275
+ if collectibleTypeNumber == nil or collectibleTypeNumber < 0 then
1276
+ print("Failed to parse the collectible type of: " .. tostring(args[1]))
1177
1277
  return
1178
1278
  end
1179
- local trinketTypeNumber = tonumber(params)
1180
- local trinketType
1181
- if trinketTypeNumber == nil then
1182
- local match = getMapPartialMatch(nil, params, TRINKET_NAME_TO_TYPE_MAP)
1183
- if match == nil then
1184
- print("Unknown trinket: " .. params)
1185
- return
1186
- end
1187
- trinketType = match[2]
1188
- else
1189
- trinketType = asTrinketType(nil, trinketTypeNumber)
1279
+ local gridIndex = tonumber(args[2])
1280
+ if gridIndex == nil or gridIndex < 0 then
1281
+ print("Failed to parse the grid index of: " .. tostring(args[2]))
1282
+ return
1190
1283
  end
1191
- local roomClass = game:GetRoom()
1192
- local centerPos = roomClass:GetCenterPos()
1193
- spawnTrinketFunction(nil, trinketType, centerPos)
1284
+ local collectibleType = asCollectibleType(nil, collectibleTypeNumber)
1285
+ spawnCollectibleUnsafe(nil, collectibleType, gridIndex)
1286
+ end
1287
+ --- Alias for the `spawnGoldenTrinket` command.
1288
+ function ____exports.spawnGoldTrinket(self, params)
1289
+ ____exports.spawnGoldenTrinket(nil, params)
1290
+ end
1291
+ --- The same thing as the `spawnTrinketAt` command but spawns a golden version of the specified
1292
+ -- trinket.
1293
+ function ____exports.spawnGoldenTrinketAt(self, params)
1294
+ ____exports.spawnTrinketAt(nil, params, true)
1194
1295
  end
1195
1296
  --- Toggles a set movement speed and flight for the player. You can provide an optional argument to
1196
1297
  -- this command in order to set the speed to a specific amount. Default is 2.0 (which is the maximum
@@ -1257,6 +1358,10 @@ end
1257
1358
  function ____exports.treasureRoom(self)
1258
1359
  warpToRoomType(nil, RoomType.TREASURE)
1259
1360
  end
1361
+ --- Alias for the "spawnTrinket" command.
1362
+ function ____exports.trinket(self, params)
1363
+ ____exports.spawnTrinket(nil, params)
1364
+ end
1260
1365
  --- Warps to the first Ultra Secret Room on the floor.
1261
1366
  function ____exports.ultraSecretRoom(self)
1262
1367
  warpToRoomType(nil, RoomType.ULTRA_SECRET)
@@ -141,15 +141,6 @@ export declare function getArrayIndexes<T>(array: T[] | readonly T[]): int[];
141
141
  * in the array.
142
142
  */
143
143
  export declare function getHighestArrayElement(array: number[]): number | undefined;
144
- /**
145
- * Helper function to return the last element of an array.
146
- *
147
- * If the array is empty, this will return undefined.
148
- *
149
- * (Note that TSTL does not support `Array.at(-1)`, which would make this helper function largely
150
- * unnecessary.)
151
- */
152
- export declare function getLastElement<T>(array: T[]): T | undefined;
153
144
  /**
154
145
  * Helper function to get the lowest value in an array. Returns undefined if there were no elements
155
146
  * in the array.
@@ -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,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,GACzB,OAAO,CAST;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,aAAa,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,EACjC,GAAG,gBAAgB,EAAE,CAAC,EAAE,GACvB,CAAC,EAAE,CAIL;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,aAAa,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,EACjC,GAAG,gBAAgB,EAAE,CAAC,EAAE,GACvB,CAAC,EAAE,CAIL;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,KAAK,EAAE,CAAC,EAAE,EACV,GAAG,gBAAgB,EAAE,CAAC,EAAE,GACvB,OAAO,CAcT;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,KAAK,EAAE,CAAC,EAAE,EACV,GAAG,gBAAgB,EAAE,CAAC,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AG,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"}
@@ -381,15 +381,6 @@ function ____exports.getHighestArrayElement(self, array)
381
381
  end
382
382
  return highestValue
383
383
  end
384
- --- Helper function to return the last element of an array.
385
- --
386
- -- If the array is empty, this will return undefined.
387
- --
388
- -- (Note that TSTL does not support `Array.at(-1)`, which would make this helper function largely
389
- -- unnecessary.)
390
- function ____exports.getLastElement(self, array)
391
- return array[#array]
392
- end
393
384
  --- Helper function to get the lowest value in an array. Returns undefined if there were no elements
394
385
  -- in the array.
395
386
  function ____exports.getLowestArrayElement(self, array)
@@ -3,6 +3,7 @@ local __TS__ArraySome = ____lualib.__TS__ArraySome
3
3
  local __TS__New = ____lualib.__TS__New
4
4
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
5
5
  local __TS__ArrayMap = ____lualib.__TS__ArrayMap
6
+ local __TS__ArrayAt = ____lualib.__TS__ArrayAt
6
7
  local __TS__ArrayFind = ____lualib.__TS__ArrayFind
7
8
  local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
8
9
  local ____exports = {}
@@ -25,7 +26,6 @@ local itemConfig = ____cachedClasses.itemConfig
25
26
  local ____ReadonlySet = require("src.types.ReadonlySet")
26
27
  local ReadonlySet = ____ReadonlySet.ReadonlySet
27
28
  local ____array = require("src.functions.array")
28
- local getLastElement = ____array.getLastElement
29
29
  local sumArray = ____array.sumArray
30
30
  local ____characters = require("src.functions.characters")
31
31
  local getCharacterName = ____characters.getCharacterName
@@ -222,7 +222,7 @@ end
222
222
  -- method.
223
223
  function ____exports.getFinalPlayer(self)
224
224
  local players = getPlayers(nil)
225
- local lastPlayer = getLastElement(nil, players)
225
+ local lastPlayer = __TS__ArrayAt(players, -1)
226
226
  assertDefined(nil, lastPlayer, "Failed to get the final player since there were 0 players.")
227
227
  return lastPlayer
228
228
  end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "33.14.1",
3
+ "version": "34.0.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -1,11 +1,7 @@
1
1
  import type { CollectibleType } from "isaac-typescript-definitions";
2
2
  import { Exported } from "../../../decorators";
3
3
  import { ModCallbackCustom } from "../../../enums/ModCallbackCustom";
4
- import {
5
- arrayRemoveInPlace,
6
- copyArray,
7
- getLastElement,
8
- } from "../../../functions/array";
4
+ import { arrayRemoveInPlace, copyArray } from "../../../functions/array";
9
5
  import { isActiveCollectible } from "../../../functions/collectibles";
10
6
  import { defaultMapGetPlayer } from "../../../functions/playerDataStructures";
11
7
  import type { PlayerIndex } from "../../../types/PlayerIndex";
@@ -123,6 +119,6 @@ export class PlayerInventory extends Feature {
123
119
  player: EntityPlayer,
124
120
  ): CollectibleType | undefined {
125
121
  const inventory = this.getPlayerInventory(player, false);
126
- return getLastElement(inventory);
122
+ return inventory.at(-1);
127
123
  }
128
124
  }
@@ -1,7 +1,6 @@
1
1
  import { game } from "../../../core/cachedClasses";
2
2
  import { Exported } from "../../../decorators";
3
3
  import { ModCallbackCustom } from "../../../enums/ModCallbackCustom";
4
- import { getLastElement } from "../../../functions/array";
5
4
  import { getDimension } from "../../../functions/dimensions";
6
5
  import {
7
6
  getRoomGridIndex,
@@ -140,7 +139,7 @@ export class RoomHistory extends Feature {
140
139
  */
141
140
  @Exported
142
141
  public getLatestRoomDescription(): Readonly<RoomDescription> | undefined {
143
- return getLastElement(v.run.roomHistory);
142
+ return v.run.roomHistory.at(-1);
144
143
  }
145
144
 
146
145
  /** Helper function to detect if the player is on the first room of the room. */
@@ -9,6 +9,8 @@ eslint "sort-exports/sort-exports": [
9
9
  ],
10
10
  */
11
11
 
12
+ /* eslint "require-jsdoc": "error" */
13
+
12
14
  /**
13
15
  * __DOCS_LINE_THAT_WILL_BE_AUTOMATICALLY_REMOVED__
14
16
  *
@@ -506,6 +508,11 @@ export function coins(params: string): void {
506
508
  player.AddCoins(numCoins);
507
509
  }
508
510
 
511
+ /** Alias for the "spawnCollectible" command. */
512
+ export function collectible(params: string): void {
513
+ spawnCollectible(params);
514
+ }
515
+
509
516
  /** Creates a crawl space next to the player. */
510
517
  export function crawlSpace(): void {
511
518
  spawnTrapdoorOrCrawlSpace(false);
@@ -747,6 +754,11 @@ export function goldKey(): void {
747
754
  goldenKey();
748
755
  }
749
756
 
757
+ /** Alias for the "spawnGoldenTrinket" command. */
758
+ export function goldTrinket(params: string): void {
759
+ spawnGoldenTrinket(params);
760
+ }
761
+
750
762
  /** Gives the player a golden bomb. */
751
763
  export function goldenBomb(): void {
752
764
  const player = Isaac.GetPlayer();
@@ -1420,10 +1432,23 @@ export function spam(): void {
1420
1432
  printEnabled(v.persistent.spamBloodRights, "spamming Blood Rights");
1421
1433
  }
1422
1434
 
1435
+ /**
1436
+ * Spawns a collectible in the center of the room. You must specify the collectible name or the
1437
+ * number corresponding to the collectible type.
1438
+ *
1439
+ * For example, all of the following commands would spawn Spoon Bender:
1440
+ *
1441
+ * ```text
1442
+ * spawnCollectible spoon bender
1443
+ * spawnCollectible spoon
1444
+ * spawnCollectible spo
1445
+ * spawnCollectible 3
1446
+ * ```
1447
+ */
1423
1448
  export function spawnCollectible(params: string): void {
1424
1449
  if (params === "") {
1425
1450
  print(
1426
- "You must specify the name or number corresponding to the collectible type.",
1451
+ "You must specify the collectible name or the number corresponding to the collectible type.",
1427
1452
  );
1428
1453
  return;
1429
1454
  }
@@ -1447,8 +1472,88 @@ export function spawnCollectible(params: string): void {
1447
1472
  spawnCollectibleUnsafe(collectibleType, centerPos);
1448
1473
  }
1449
1474
 
1450
- /** Spawns a golden version of the specified trinket type. */
1475
+ /**
1476
+ * Spawns a collectible at a specific grid tile location. You must specify the number corresponding
1477
+ * to the collectible type and the number corresponding to the grid tile location.
1478
+ *
1479
+ * For example, this would spawn Spoon Bender in the top-left corner of a 1x1 room:
1480
+ *
1481
+ * ```text
1482
+ * spawnCollectibleAt 3 16
1483
+ * ```
1484
+ *
1485
+ * (You can use the "grid" command to toggle displaying the numerical grid indexes corresponding to
1486
+ * a grid tile.)
1487
+ */
1488
+ export function spawnCollectibleAt(params: string): void {
1489
+ if (params === "") {
1490
+ print(
1491
+ "You must specify the number corresponding to the collectible type and the number corresponding to the grid tile location.",
1492
+ );
1493
+ return;
1494
+ }
1495
+
1496
+ const args = params.split(" ");
1497
+ if (args.length !== 2) {
1498
+ print(
1499
+ "You must specify the number corresponding to the collectible type and the number corresponding to the grid tile location.",
1500
+ );
1501
+ return;
1502
+ }
1503
+
1504
+ const collectibleTypeNumber = tonumber(args[0]);
1505
+ if (collectibleTypeNumber === undefined || collectibleTypeNumber < 0) {
1506
+ print(`Failed to parse the collectible type of: ${args[0]}`);
1507
+ return;
1508
+ }
1509
+
1510
+ const gridIndex = tonumber(args[1]);
1511
+ if (gridIndex === undefined || gridIndex < 0) {
1512
+ print(`Failed to parse the grid index of: ${args[1]}`);
1513
+ return;
1514
+ }
1515
+
1516
+ const collectibleType = asCollectibleType(collectibleTypeNumber);
1517
+ spawnCollectibleUnsafe(collectibleType, gridIndex);
1518
+ }
1519
+
1520
+ /** Alias for the `spawnGoldenTrinket` command. */
1521
+ export function spawnGoldTrinket(params: string): void {
1522
+ spawnGoldenTrinket(params);
1523
+ }
1524
+
1525
+ /**
1526
+ * The same thing as the `spawnTrinket` command but spawns a golden version of the specified
1527
+ * trinket.
1528
+ */
1451
1529
  export function spawnGoldenTrinket(params: string): void {
1530
+ spawnTrinket(params, true);
1531
+ }
1532
+
1533
+ /**
1534
+ * The same thing as the `spawnTrinketAt` command but spawns a golden version of the specified
1535
+ * trinket.
1536
+ */
1537
+ export function spawnGoldenTrinketAt(params: string): void {
1538
+ spawnTrinketAt(params, true);
1539
+ }
1540
+
1541
+ /**
1542
+ * Spawns a trinket in the center of the room. You must specify the trinket name or the number
1543
+ * corresponding to the trinket type.
1544
+ *
1545
+ * For example, all of the following commands would spawn the Wiggle Worm trinket:
1546
+ *
1547
+ * ```text
1548
+ * spawnTrinket wiggle worm
1549
+ * spawnTrinket wiggle
1550
+ * spawnTrinket wig
1551
+ * spawnTrinket 10
1552
+ * ```
1553
+ *
1554
+ * Also see the `spawnGoldenTrinket` command.
1555
+ */
1556
+ export function spawnTrinket(params: string, golden = false): void {
1452
1557
  if (params === "") {
1453
1558
  print(
1454
1559
  "You must specify the name or number corresponding to the trinket type.",
@@ -1473,34 +1578,55 @@ export function spawnGoldenTrinket(params: string): void {
1473
1578
  const roomClass = game.GetRoom();
1474
1579
  const centerPos = roomClass.GetCenterPos();
1475
1580
  const goldenTrinketType = getGoldenTrinketType(trinketType);
1476
- spawnTrinketFunction(goldenTrinketType, centerPos);
1581
+ const trinketTypeToSpawn = golden ? goldenTrinketType : trinketType;
1582
+ spawnTrinketFunction(trinketTypeToSpawn, centerPos);
1477
1583
  }
1478
1584
 
1479
- export function spawnTrinket(params: string): void {
1585
+ /**
1586
+ * Spawns a trinket at a specific grid tile location. You must specify the number corresponding to
1587
+ * the trinket type and the number corresponding to the grid tile location.
1588
+ *
1589
+ * For example, this would spawn Wiggle Worm in the top-left corner of a 1x1 room:
1590
+ *
1591
+ * ```text
1592
+ * spawnTrinketAt 10 16
1593
+ * ```
1594
+ *
1595
+ * (You can use the "grid" command to toggle displaying the numerical grid indexes corresponding to
1596
+ * a grid tile.)
1597
+ */
1598
+ export function spawnTrinketAt(params: string, golden = false): void {
1480
1599
  if (params === "") {
1481
1600
  print(
1482
- "You must specify the name or number corresponding to the trinket type.",
1601
+ "You must specify the number corresponding to the trinket type and the number corresponding to the grid tile location.",
1483
1602
  );
1484
1603
  return;
1485
1604
  }
1486
1605
 
1487
- const trinketTypeNumber = tonumber(params);
1488
- let trinketType: TrinketType;
1489
- if (trinketTypeNumber === undefined) {
1490
- const match = getMapPartialMatch(params, TRINKET_NAME_TO_TYPE_MAP);
1491
- if (match === undefined) {
1492
- print(`Unknown trinket: ${params}`);
1493
- return;
1494
- }
1606
+ const args = params.split(" ");
1607
+ if (args.length !== 2) {
1608
+ print(
1609
+ "You must specify the number corresponding to the trinket type and the number corresponding to the grid tile location.",
1610
+ );
1611
+ return;
1612
+ }
1495
1613
 
1496
- trinketType = match[1];
1497
- } else {
1498
- trinketType = asTrinketType(trinketTypeNumber);
1614
+ const trinketTypeNumber = tonumber(args[0]);
1615
+ if (trinketTypeNumber === undefined || trinketTypeNumber < 0) {
1616
+ print(`Failed to parse the trinket type of: ${args[0]}`);
1617
+ return;
1499
1618
  }
1500
1619
 
1501
- const roomClass = game.GetRoom();
1502
- const centerPos = roomClass.GetCenterPos();
1503
- spawnTrinketFunction(trinketType, centerPos);
1620
+ const gridIndex = tonumber(args[1]);
1621
+ if (gridIndex === undefined || gridIndex < 0) {
1622
+ print(`Failed to parse the grid index of: ${args[1]}`);
1623
+ return;
1624
+ }
1625
+
1626
+ const trinketType = asTrinketType(trinketTypeNumber);
1627
+ const goldenTrinketType = getGoldenTrinketType(trinketType);
1628
+ const trinketTypeToSpawn = golden ? goldenTrinketType : trinketType;
1629
+ spawnTrinketFunction(trinketTypeToSpawn, gridIndex);
1504
1630
  }
1505
1631
 
1506
1632
  /**
@@ -1598,6 +1724,11 @@ export function treasureRoom(): void {
1598
1724
  warpToRoomType(RoomType.TREASURE);
1599
1725
  }
1600
1726
 
1727
+ /** Alias for the "spawnTrinket" command. */
1728
+ export function trinket(params: string): void {
1729
+ spawnTrinket(params);
1730
+ }
1731
+
1601
1732
  /** Warps to the first Ultra Secret Room on the floor. */
1602
1733
  export function ultraSecretRoom(): void {
1603
1734
  warpToRoomType(RoomType.ULTRA_SECRET);
@@ -360,18 +360,6 @@ export function getHighestArrayElement(array: number[]): number | undefined {
360
360
  return highestValue;
361
361
  }
362
362
 
363
- /**
364
- * Helper function to return the last element of an array.
365
- *
366
- * If the array is empty, this will return undefined.
367
- *
368
- * (Note that TSTL does not support `Array.at(-1)`, which would make this helper function largely
369
- * unnecessary.)
370
- */
371
- export function getLastElement<T>(array: T[]): T | undefined {
372
- return array[array.length - 1];
373
- }
374
-
375
363
  /**
376
364
  * Helper function to get the lowest value in an array. Returns undefined if there were no elements
377
365
  * in the array.
@@ -15,7 +15,7 @@ import {
15
15
  } from "../arrays/cachedEnumValues";
16
16
  import { game, itemConfig } from "../core/cachedClasses";
17
17
  import { ReadonlySet } from "../types/ReadonlySet";
18
- import { getLastElement, sumArray } from "./array";
18
+ import { sumArray } from "./array";
19
19
  import { getCharacterName, isVanillaCharacter } from "./characters";
20
20
  import { getCollectibleMaxCharges } from "./collectibles";
21
21
  import { hasFlag } from "./flag";
@@ -250,7 +250,7 @@ export function getEffectsList(player: EntityPlayer): TemporaryEffect[] {
250
250
  export function getFinalPlayer(): EntityPlayer {
251
251
  const players = getPlayers();
252
252
 
253
- const lastPlayer = getLastElement(players);
253
+ const lastPlayer = players.at(-1);
254
254
  assertDefined(
255
255
  lastPlayer,
256
256
  "Failed to get the final player since there were 0 players.",