isaacscript-common 1.2.156 → 1.2.157

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.
@@ -28,6 +28,9 @@ export declare function initCustomDoor(mod: Mod, effectVariant: int): void;
28
28
  * callback when the player enters a room that should have a custom door. (You could also call it
29
29
  * from another callback if you want the door to appear e.g. after clearing all enemies.)
30
30
  *
31
+ * Like other entities, the door is not persistent, so you must spawn it every time when re-entering
32
+ * the room.
33
+ *
31
34
  * Handle when a player enters the door by hooking the custom `MC_POST_CUSTOM_DOOR_ENTER` callback.
32
35
  *
33
36
  * The custom door is an `EntityEffect`. You can manually open or close the door by modifying its
@@ -80,17 +80,13 @@ function ____exports.getPlayerIndex(self, player, differentiateForgottenAndSoul)
80
80
  if differentiateForgottenAndSoul == nil then
81
81
  differentiateForgottenAndSoul = false
82
82
  end
83
- local character = player:GetPlayerType()
84
- local isSubPlayer = player:IsSubPlayer() and character ~= PlayerType.PLAYER_LAZARUS2_B
85
- local ____isSubPlayer_0
83
+ local playerToUse = player
84
+ local isSubPlayer = player:IsSubPlayer()
86
85
  if isSubPlayer then
87
- ____isSubPlayer_0 = ____exports.getSubPlayerParent(nil, player)
88
- else
89
- ____isSubPlayer_0 = player
90
- end
91
- local playerToUse = ____isSubPlayer_0
92
- if playerToUse == nil then
93
- error("Failed to get the sub-player parent when determining the index for the player with InitSeed: " .. tostring(player.InitSeed))
86
+ local playerParent = ____exports.getSubPlayerParent(nil, player)
87
+ if playerParent ~= nil then
88
+ playerToUse = playerParent
89
+ end
94
90
  end
95
91
  local collectibleType = getPlayerIndexCollectibleType(nil, player, differentiateForgottenAndSoul)
96
92
  local collectibleRNG = playerToUse:GetCollectibleRNG(collectibleType)
@@ -100,15 +96,15 @@ end
100
96
  function getPlayerIndexCollectibleType(self, player, differentiateForgottenAndSoul)
101
97
  local character = player:GetPlayerType()
102
98
  repeat
103
- local ____switch71 = character
104
- local ____cond71 = ____switch71 == PlayerType.PLAYER_THESOUL
105
- if ____cond71 then
99
+ local ____switch72 = character
100
+ local ____cond72 = ____switch72 == PlayerType.PLAYER_THESOUL
101
+ if ____cond72 then
106
102
  do
107
103
  return differentiateForgottenAndSoul and CollectibleType.COLLECTIBLE_SPOON_BENDER or DEFAULT_COLLECTIBLE_TYPE
108
104
  end
109
105
  end
110
- ____cond71 = ____cond71 or ____switch71 == PlayerType.PLAYER_LAZARUS2_B
111
- if ____cond71 then
106
+ ____cond72 = ____cond72 or ____switch72 == PlayerType.PLAYER_LAZARUS2_B
107
+ if ____cond72 then
112
108
  do
113
109
  return CollectibleType.COLLECTIBLE_INNER_EYE
114
110
  end
@@ -525,13 +521,13 @@ function ____exports.canTakeFreeDevilDeals(self, player)
525
521
  end
526
522
  function ____exports.isTainted(self, player)
527
523
  local character = player:GetPlayerType()
528
- local ____isVanillaCharacter_result_1
524
+ local ____isVanillaCharacter_result_0
529
525
  if ____exports.isVanillaCharacter(nil, player) then
530
- ____isVanillaCharacter_result_1 = character >= PlayerType.PLAYER_ISAAC_B
526
+ ____isVanillaCharacter_result_0 = character >= PlayerType.PLAYER_ISAAC_B
531
527
  else
532
- ____isVanillaCharacter_result_1 = isTaintedModded(nil, player)
528
+ ____isVanillaCharacter_result_0 = isTaintedModded(nil, player)
533
529
  end
534
- return ____isVanillaCharacter_result_1
530
+ return ____isVanillaCharacter_result_0
535
531
  end
536
532
  function ____exports.isTaintedLazarus(self, player)
537
533
  local character = player:GetPlayerType()
@@ -575,9 +571,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
575
571
  itemPool:RemoveCollectible(collectibleType)
576
572
  end
577
573
  repeat
578
- local ____switch125 = activeSlot
579
- local ____cond125 = ____switch125 == ActiveSlot.SLOT_PRIMARY
580
- if ____cond125 then
574
+ local ____switch126 = activeSlot
575
+ local ____cond126 = ____switch126 == ActiveSlot.SLOT_PRIMARY
576
+ if ____cond126 then
581
577
  do
582
578
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
583
579
  player:RemoveCollectible(primaryCollectibleType)
@@ -586,8 +582,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
586
582
  break
587
583
  end
588
584
  end
589
- ____cond125 = ____cond125 or ____switch125 == ActiveSlot.SLOT_SECONDARY
590
- if ____cond125 then
585
+ ____cond126 = ____cond126 or ____switch126 == ActiveSlot.SLOT_SECONDARY
586
+ if ____cond126 then
591
587
  do
592
588
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
593
589
  player:RemoveCollectible(primaryCollectibleType)
@@ -602,16 +598,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
602
598
  break
603
599
  end
604
600
  end
605
- ____cond125 = ____cond125 or ____switch125 == ActiveSlot.SLOT_POCKET
606
- if ____cond125 then
601
+ ____cond126 = ____cond126 or ____switch126 == ActiveSlot.SLOT_POCKET
602
+ if ____cond126 then
607
603
  do
608
604
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
609
605
  player:SetActiveCharge(charge, activeSlot)
610
606
  break
611
607
  end
612
608
  end
613
- ____cond125 = ____cond125 or ____switch125 == ActiveSlot.SLOT_POCKET2
614
- if ____cond125 then
609
+ ____cond126 = ____cond126 or ____switch126 == ActiveSlot.SLOT_POCKET2
610
+ if ____cond126 then
615
611
  do
616
612
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
617
613
  break
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.156",
3
+ "version": "1.2.157",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",