isaacscript-common 17.3.0 → 17.4.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.
package/dist/index.d.ts CHANGED
@@ -3023,6 +3023,14 @@ declare class DeployJSONRoom extends Feature {
3023
3023
  deployJSONRoom(jsonRoom: JSONRoom | Readonly<JSONRoom>, seedOrRNG?: Seed | RNG, verbose?: boolean): void;
3024
3024
  }
3025
3025
 
3026
+ /**
3027
+ * Helper function to remove a collectible or trinket that is currently queued to go into a player's
3028
+ * inventory (i.e. the item is being held over their head).
3029
+ *
3030
+ * Returns whether or not an item was actually dequeued.
3031
+ */
3032
+ export declare function dequeueItem(player: EntityPlayer): boolean;
3033
+
3026
3034
  /**
3027
3035
  * Helper function to convert a `SerializedBitSet128` object to a normal `BitSet128` object. (This
3028
3036
  * is used by the save data manager when reading data from the "save#.dat" file.)
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 17.3.0
3
+ isaacscript-common 17.4.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -21470,6 +21470,15 @@ function ____exports.canPlayerCrushRocks(self, player)
21470
21470
  local effects = player:GetEffects()
21471
21471
  return player:HasCollectible(CollectibleType.LEO) or player:HasCollectible(CollectibleType.THUNDER_THIGHS) or effects:HasCollectibleEffect(CollectibleType.MEGA_MUSH) or player:HasPlayerForm(PlayerForm.STOMPY)
21472
21472
  end
21473
+ function ____exports.dequeueItem(self, player)
21474
+ if player.QueuedItem.Item == nil then
21475
+ return false
21476
+ end
21477
+ local queue = player.QueuedItem
21478
+ queue.Item = nil
21479
+ player.QueuedItem = queue
21480
+ return true
21481
+ end
21473
21482
  function ____exports.getActiveItemSlot(self, player, collectibleType)
21474
21483
  local activeSlots = getEnumValues(nil, ActiveSlot)
21475
21484
  return __TS__ArrayFind(
@@ -21739,7 +21748,7 @@ function ____exports.removeAllActiveItems(self, player)
21739
21748
  do
21740
21749
  local collectibleType = player:GetActiveItem(activeSlot)
21741
21750
  if collectibleType == CollectibleType.NULL then
21742
- goto __continue89
21751
+ goto __continue91
21743
21752
  end
21744
21753
  local hasCollectible
21745
21754
  repeat
@@ -21749,7 +21758,7 @@ function ____exports.removeAllActiveItems(self, player)
21749
21758
  end
21750
21759
  until not hasCollectible
21751
21760
  end
21752
- ::__continue89::
21761
+ ::__continue91::
21753
21762
  end
21754
21763
  end
21755
21764
  function ____exports.removeAllPlayerTrinkets(self, player)
@@ -21757,7 +21766,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
21757
21766
  do
21758
21767
  local trinketType = player:GetTrinket(trinketSlot)
21759
21768
  if trinketType == TrinketType.NULL then
21760
- goto __continue94
21769
+ goto __continue96
21761
21770
  end
21762
21771
  local hasTrinket
21763
21772
  repeat
@@ -21767,7 +21776,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
21767
21776
  end
21768
21777
  until not hasTrinket
21769
21778
  end
21770
- ::__continue94::
21779
+ ::__continue96::
21771
21780
  end
21772
21781
  end
21773
21782
  function ____exports.removeCollectibleCostume(self, player, collectibleType)
@@ -21821,9 +21830,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
21821
21830
  itemPool:RemoveCollectible(collectibleType)
21822
21831
  end
21823
21832
  repeat
21824
- local ____switch113 = activeSlot
21825
- local ____cond113 = ____switch113 == ActiveSlot.PRIMARY
21826
- if ____cond113 then
21833
+ local ____switch115 = activeSlot
21834
+ local ____cond115 = ____switch115 == ActiveSlot.PRIMARY
21835
+ if ____cond115 then
21827
21836
  do
21828
21837
  if primaryCollectibleType ~= CollectibleType.NULL then
21829
21838
  player:RemoveCollectible(primaryCollectibleType)
@@ -21832,8 +21841,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
21832
21841
  break
21833
21842
  end
21834
21843
  end
21835
- ____cond113 = ____cond113 or ____switch113 == ActiveSlot.SECONDARY
21836
- if ____cond113 then
21844
+ ____cond115 = ____cond115 or ____switch115 == ActiveSlot.SECONDARY
21845
+ if ____cond115 then
21837
21846
  do
21838
21847
  if primaryCollectibleType ~= CollectibleType.NULL then
21839
21848
  player:RemoveCollectible(primaryCollectibleType)
@@ -21848,16 +21857,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
21848
21857
  break
21849
21858
  end
21850
21859
  end
21851
- ____cond113 = ____cond113 or ____switch113 == ActiveSlot.POCKET
21852
- if ____cond113 then
21860
+ ____cond115 = ____cond115 or ____switch115 == ActiveSlot.POCKET
21861
+ if ____cond115 then
21853
21862
  do
21854
21863
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
21855
21864
  player:SetActiveCharge(charge, activeSlot)
21856
21865
  break
21857
21866
  end
21858
21867
  end
21859
- ____cond113 = ____cond113 or ____switch113 == ActiveSlot.POCKET_SINGLE_USE
21860
- if ____cond113 then
21868
+ ____cond115 = ____cond115 or ____switch115 == ActiveSlot.POCKET_SINGLE_USE
21869
+ if ____cond115 then
21861
21870
  do
21862
21871
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
21863
21872
  break
@@ -20,6 +20,13 @@ export declare function anyPlayerIs(...matchingCharacters: PlayerType[]): boolea
20
20
  * - the player has Stompy (transformation 13)
21
21
  */
22
22
  export declare function canPlayerCrushRocks(player: EntityPlayer): boolean;
23
+ /**
24
+ * Helper function to remove a collectible or trinket that is currently queued to go into a player's
25
+ * inventory (i.e. the item is being held over their head).
26
+ *
27
+ * Returns whether or not an item was actually dequeued.
28
+ */
29
+ export declare function dequeueItem(player: EntityPlayer): boolean;
23
30
  /**
24
31
  * Helper function to find the active slot that the player has the corresponding collectible type
25
32
  * in. Returns undefined if the player does not have the collectible in any active slot.
@@ -1 +1 @@
1
- {"version":3,"file":"players.d.ts","sourceRoot":"","sources":["../../../src/functions/players.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAEV,eAAe,EACf,eAAe,EAGf,UAAU,EAEV,WAAW,EACZ,MAAM,8BAA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AAG,IAAI,CAa/D;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAalE;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAON;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAC7C,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,IAAI,CAQN;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAIlE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,YAAY,EACpB,WAAW,EAAE,WAAW,GACvB,IAAI,CAON;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,EAChC,UAAU,aAAqB,EAC/B,MAAM,CAAC,EAAE,GAAG,EACZ,WAAW,UAAQ,GAClB,IAAI,CA6DN;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,aAAa,UAAO,GACnB,IAAI,CAsBN;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAEN"}
1
+ {"version":3,"file":"players.d.ts","sourceRoot":"","sources":["../../../src/functions/players.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAEV,eAAe,EACf,eAAe,EAGf,UAAU,EAEV,WAAW,EACZ,MAAM,8BAA8B,CAAC;AActC,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAON;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,WAAW,EAAE,WAAW,GACvB,IAAI,CA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GAGG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAON;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAC7C,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,IAAI,CAQN;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAIlE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,YAAY,EACpB,WAAW,EAAE,WAAW,GACvB,IAAI,CAON;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,EAChC,UAAU,aAAqB,EAC/B,MAAM,CAAC,EAAE,GAAG,EACZ,WAAW,UAAQ,GAClB,IAAI,CA6DN;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,aAAa,UAAO,GACnB,IAAI,CAsBN;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAEN"}
@@ -122,6 +122,19 @@ function ____exports.canPlayerCrushRocks(self, player)
122
122
  local effects = player:GetEffects()
123
123
  return player:HasCollectible(CollectibleType.LEO) or player:HasCollectible(CollectibleType.THUNDER_THIGHS) or effects:HasCollectibleEffect(CollectibleType.MEGA_MUSH) or player:HasPlayerForm(PlayerForm.STOMPY)
124
124
  end
125
+ --- Helper function to remove a collectible or trinket that is currently queued to go into a player's
126
+ -- inventory (i.e. the item is being held over their head).
127
+ --
128
+ -- Returns whether or not an item was actually dequeued.
129
+ function ____exports.dequeueItem(self, player)
130
+ if player.QueuedItem.Item == nil then
131
+ return false
132
+ end
133
+ local queue = player.QueuedItem
134
+ queue.Item = nil
135
+ player.QueuedItem = queue
136
+ return true
137
+ end
125
138
  --- Helper function to find the active slot that the player has the corresponding collectible type
126
139
  -- in. Returns undefined if the player does not have the collectible in any active slot.
127
140
  function ____exports.getActiveItemSlot(self, player, collectibleType)
@@ -496,7 +509,7 @@ function ____exports.removeAllActiveItems(self, player)
496
509
  do
497
510
  local collectibleType = player:GetActiveItem(activeSlot)
498
511
  if collectibleType == CollectibleType.NULL then
499
- goto __continue89
512
+ goto __continue91
500
513
  end
501
514
  local hasCollectible
502
515
  repeat
@@ -506,7 +519,7 @@ function ____exports.removeAllActiveItems(self, player)
506
519
  end
507
520
  until not hasCollectible
508
521
  end
509
- ::__continue89::
522
+ ::__continue91::
510
523
  end
511
524
  end
512
525
  --- Helper function to remove all of the held trinkets from a player.
@@ -518,7 +531,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
518
531
  do
519
532
  local trinketType = player:GetTrinket(trinketSlot)
520
533
  if trinketType == TrinketType.NULL then
521
- goto __continue94
534
+ goto __continue96
522
535
  end
523
536
  local hasTrinket
524
537
  repeat
@@ -528,7 +541,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
528
541
  end
529
542
  until not hasTrinket
530
543
  end
531
- ::__continue94::
544
+ ::__continue96::
532
545
  end
533
546
  end
534
547
  --- Helper function to remove a collectible costume from a player. Use this helper function to avoid
@@ -609,9 +622,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
609
622
  itemPool:RemoveCollectible(collectibleType)
610
623
  end
611
624
  repeat
612
- local ____switch113 = activeSlot
613
- local ____cond113 = ____switch113 == ActiveSlot.PRIMARY
614
- if ____cond113 then
625
+ local ____switch115 = activeSlot
626
+ local ____cond115 = ____switch115 == ActiveSlot.PRIMARY
627
+ if ____cond115 then
615
628
  do
616
629
  if primaryCollectibleType ~= CollectibleType.NULL then
617
630
  player:RemoveCollectible(primaryCollectibleType)
@@ -620,8 +633,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
620
633
  break
621
634
  end
622
635
  end
623
- ____cond113 = ____cond113 or ____switch113 == ActiveSlot.SECONDARY
624
- if ____cond113 then
636
+ ____cond115 = ____cond115 or ____switch115 == ActiveSlot.SECONDARY
637
+ if ____cond115 then
625
638
  do
626
639
  if primaryCollectibleType ~= CollectibleType.NULL then
627
640
  player:RemoveCollectible(primaryCollectibleType)
@@ -636,16 +649,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
636
649
  break
637
650
  end
638
651
  end
639
- ____cond113 = ____cond113 or ____switch113 == ActiveSlot.POCKET
640
- if ____cond113 then
652
+ ____cond115 = ____cond115 or ____switch115 == ActiveSlot.POCKET
653
+ if ____cond115 then
641
654
  do
642
655
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
643
656
  player:SetActiveCharge(charge, activeSlot)
644
657
  break
645
658
  end
646
659
  end
647
- ____cond113 = ____cond113 or ____switch113 == ActiveSlot.POCKET_SINGLE_USE
648
- if ____cond113 then
660
+ ____cond115 = ____cond115 or ____switch115 == ActiveSlot.POCKET_SINGLE_USE
661
+ if ____cond115 then
649
662
  do
650
663
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
651
664
  break
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "17.3.0",
3
+ "version": "17.4.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -22,6 +22,6 @@
22
22
  "main": "dist/src/index",
23
23
  "types": "dist/src/index.d.ts",
24
24
  "dependencies": {
25
- "isaac-typescript-definitions": "^10.0.3"
25
+ "isaac-typescript-definitions": "^10.0.4"
26
26
  }
27
27
  }
@@ -90,6 +90,27 @@ export function canPlayerCrushRocks(player: EntityPlayer): boolean {
90
90
  );
91
91
  }
92
92
 
93
+ /**
94
+ * Helper function to remove a collectible or trinket that is currently queued to go into a player's
95
+ * inventory (i.e. the item is being held over their head).
96
+ *
97
+ * If the player does not have an item currently queued, then this function will be a no-op.
98
+ *
99
+ * Returns whether or not an item was actually dequeued.
100
+ */
101
+ export function dequeueItem(player: EntityPlayer): boolean {
102
+ if (player.QueuedItem.Item === undefined) {
103
+ return false;
104
+ }
105
+
106
+ // Doing `player.QueuedItem.Item = undefined` does not work for some reason.
107
+ const queue = player.QueuedItem;
108
+ queue.Item = undefined;
109
+ player.QueuedItem = queue;
110
+
111
+ return true;
112
+ }
113
+
93
114
  /**
94
115
  * Helper function to find the active slot that the player has the corresponding collectible type
95
116
  * in. Returns undefined if the player does not have the collectible in any active slot.