isaacscript-common 8.0.1 → 8.1.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.
|
@@ -279,6 +279,18 @@ export declare function playerAddCollectible(player: EntityPlayer, ...collectibl
|
|
|
279
279
|
* check for. Returns true if the player has any of the supplied collectible types.
|
|
280
280
|
*/
|
|
281
281
|
export declare function playerHasCollectible(player: EntityPlayer, ...collectibleTypes: CollectibleType[]): boolean;
|
|
282
|
+
/**
|
|
283
|
+
* Helper function to remove all of the active items from a player. This includes the Schoolbag item
|
|
284
|
+
* and any pocket actives.
|
|
285
|
+
*/
|
|
286
|
+
export declare function removeAllActiveItems(player: EntityPlayer): void;
|
|
287
|
+
/**
|
|
288
|
+
* Helper function to remove all of the held trinkets from a player.
|
|
289
|
+
*
|
|
290
|
+
* This will not remove any smelted trinkets, unless the player happens to be holding a trinket that
|
|
291
|
+
* they also have smelted. (In that case, both the held and the smelted trinket will be removed.)
|
|
292
|
+
*/
|
|
293
|
+
export declare function removeAllPlayerTrinkets(player: EntityPlayer): void;
|
|
282
294
|
/**
|
|
283
295
|
* Helper function to remove a collectible costume from a player. Use this helper function to avoid
|
|
284
296
|
* having to request the collectible from the item config.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"players.d.ts","sourceRoot":"","sources":["../../src/functions/players.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAET,eAAe,EAIf,UAAU,
|
|
1
|
+
{"version":3,"file":"players.d.ts","sourceRoot":"","sources":["../../src/functions/players.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAET,eAAe,EAIf,UAAU,EAEV,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AA6BjD,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,C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CAsBN;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAEN;AAED;;;;;;;;;GASG;AACH,wBAAgB,sDAAsD,CACpE,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,KAAK,GAClB,OAAO,CAyBT"}
|
|
@@ -18,6 +18,7 @@ local FamiliarVariant = ____isaac_2Dtypescript_2Ddefinitions.FamiliarVariant
|
|
|
18
18
|
local NullItemID = ____isaac_2Dtypescript_2Ddefinitions.NullItemID
|
|
19
19
|
local PlayerForm = ____isaac_2Dtypescript_2Ddefinitions.PlayerForm
|
|
20
20
|
local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
|
|
21
|
+
local TrinketSlot = ____isaac_2Dtypescript_2Ddefinitions.TrinketSlot
|
|
21
22
|
local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
|
|
22
23
|
local ____cachedClasses = require("core.cachedClasses")
|
|
23
24
|
local game = ____cachedClasses.game
|
|
@@ -682,6 +683,48 @@ function ____exports.playerHasCollectible(self, player, ...)
|
|
|
682
683
|
function(____, collectibleType) return player:HasCollectible(collectibleType) end
|
|
683
684
|
)
|
|
684
685
|
end
|
|
686
|
+
--- Helper function to remove all of the active items from a player. This includes the Schoolbag item
|
|
687
|
+
-- and any pocket actives.
|
|
688
|
+
function ____exports.removeAllActiveItems(self, player)
|
|
689
|
+
for ____, activeSlot in ipairs(getEnumValues(nil, ActiveSlot)) do
|
|
690
|
+
do
|
|
691
|
+
local collectibleType = player:GetActiveItem(activeSlot)
|
|
692
|
+
if collectibleType == CollectibleType.NULL then
|
|
693
|
+
goto __continue114
|
|
694
|
+
end
|
|
695
|
+
local hasCollectible
|
|
696
|
+
repeat
|
|
697
|
+
do
|
|
698
|
+
player:RemoveCollectible(collectibleType)
|
|
699
|
+
hasCollectible = player:HasCollectible(collectibleType)
|
|
700
|
+
end
|
|
701
|
+
until not hasCollectible
|
|
702
|
+
end
|
|
703
|
+
::__continue114::
|
|
704
|
+
end
|
|
705
|
+
end
|
|
706
|
+
--- Helper function to remove all of the held trinkets from a player.
|
|
707
|
+
--
|
|
708
|
+
-- This will not remove any smelted trinkets, unless the player happens to be holding a trinket that
|
|
709
|
+
-- they also have smelted. (In that case, both the held and the smelted trinket will be removed.)
|
|
710
|
+
function ____exports.removeAllPlayerTrinkets(self, player)
|
|
711
|
+
for ____, trinketSlot in ipairs(getEnumValues(nil, TrinketSlot)) do
|
|
712
|
+
do
|
|
713
|
+
local trinketType = player:GetTrinket(trinketSlot)
|
|
714
|
+
if trinketType == TrinketType.NULL then
|
|
715
|
+
goto __continue119
|
|
716
|
+
end
|
|
717
|
+
local hasTrinket
|
|
718
|
+
repeat
|
|
719
|
+
do
|
|
720
|
+
player:TryRemoveTrinket(trinketType)
|
|
721
|
+
hasTrinket = player:HasTrinket(trinketType)
|
|
722
|
+
end
|
|
723
|
+
until not hasTrinket
|
|
724
|
+
end
|
|
725
|
+
::__continue119::
|
|
726
|
+
end
|
|
727
|
+
end
|
|
685
728
|
--- Helper function to remove a collectible costume from a player. Use this helper function to avoid
|
|
686
729
|
-- having to request the collectible from the item config.
|
|
687
730
|
function ____exports.removeCollectibleCostume(self, player, collectibleType)
|
|
@@ -742,9 +785,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
742
785
|
itemPool:RemoveCollectible(collectibleType)
|
|
743
786
|
end
|
|
744
787
|
repeat
|
|
745
|
-
local
|
|
746
|
-
local
|
|
747
|
-
if
|
|
788
|
+
local ____switch132 = activeSlot
|
|
789
|
+
local ____cond132 = ____switch132 == ActiveSlot.PRIMARY
|
|
790
|
+
if ____cond132 then
|
|
748
791
|
do
|
|
749
792
|
if primaryCollectibleType ~= CollectibleType.NULL then
|
|
750
793
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -753,8 +796,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
753
796
|
break
|
|
754
797
|
end
|
|
755
798
|
end
|
|
756
|
-
|
|
757
|
-
if
|
|
799
|
+
____cond132 = ____cond132 or ____switch132 == ActiveSlot.SECONDARY
|
|
800
|
+
if ____cond132 then
|
|
758
801
|
do
|
|
759
802
|
if primaryCollectibleType ~= CollectibleType.NULL then
|
|
760
803
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -769,16 +812,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
769
812
|
break
|
|
770
813
|
end
|
|
771
814
|
end
|
|
772
|
-
|
|
773
|
-
if
|
|
815
|
+
____cond132 = ____cond132 or ____switch132 == ActiveSlot.POCKET
|
|
816
|
+
if ____cond132 then
|
|
774
817
|
do
|
|
775
818
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
776
819
|
player:SetActiveCharge(charge, activeSlot)
|
|
777
820
|
break
|
|
778
821
|
end
|
|
779
822
|
end
|
|
780
|
-
|
|
781
|
-
if
|
|
823
|
+
____cond132 = ____cond132 or ____switch132 == ActiveSlot.POCKET_SINGLE_USE
|
|
824
|
+
if ____cond132 then
|
|
782
825
|
do
|
|
783
826
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
784
827
|
break
|
package/dist/index.d.ts
CHANGED
|
@@ -8968,6 +8968,12 @@ export declare function registerHotkey(keyboardOrFunc: Keyboard | (() => Keyboar
|
|
|
8968
8968
|
*/
|
|
8969
8969
|
export declare function reloadRoom(): void;
|
|
8970
8970
|
|
|
8971
|
+
/**
|
|
8972
|
+
* Helper function to remove all of the active items from a player. This includes the Schoolbag item
|
|
8973
|
+
* and any pocket actives.
|
|
8974
|
+
*/
|
|
8975
|
+
export declare function removeAllActiveItems(player: EntityPlayer): void;
|
|
8976
|
+
|
|
8971
8977
|
/**
|
|
8972
8978
|
* Helper function to remove all of the batteries in the room.
|
|
8973
8979
|
*
|
|
@@ -9215,6 +9221,14 @@ export declare function removeAllPits(pitVariant?: PitVariant, updateRoom?: bool
|
|
|
9215
9221
|
|
|
9216
9222
|
export declare function removeAllPlayerHealth(player: EntityPlayer): void;
|
|
9217
9223
|
|
|
9224
|
+
/**
|
|
9225
|
+
* Helper function to remove all of the held trinkets from a player.
|
|
9226
|
+
*
|
|
9227
|
+
* This will not remove any smelted trinkets, unless the player happens to be holding a trinket that
|
|
9228
|
+
* they also have smelted. (In that case, both the held and the smelted trinket will be removed.)
|
|
9229
|
+
*/
|
|
9230
|
+
export declare function removeAllPlayerTrinkets(player: EntityPlayer): void;
|
|
9231
|
+
|
|
9218
9232
|
/**
|
|
9219
9233
|
* Helper function to remove all of the `GridEntityPoop` in the room.
|
|
9220
9234
|
*
|
package/package.json
CHANGED
package/src/functions/players.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
NullItemID,
|
|
8
8
|
PlayerForm,
|
|
9
9
|
PlayerType,
|
|
10
|
+
TrinketSlot,
|
|
10
11
|
TrinketType,
|
|
11
12
|
} from "isaac-typescript-definitions";
|
|
12
13
|
import { game, itemConfig } from "../core/cachedClasses";
|
|
@@ -882,6 +883,46 @@ export function playerHasCollectible(
|
|
|
882
883
|
);
|
|
883
884
|
}
|
|
884
885
|
|
|
886
|
+
/**
|
|
887
|
+
* Helper function to remove all of the active items from a player. This includes the Schoolbag item
|
|
888
|
+
* and any pocket actives.
|
|
889
|
+
*/
|
|
890
|
+
export function removeAllActiveItems(player: EntityPlayer): void {
|
|
891
|
+
for (const activeSlot of getEnumValues(ActiveSlot)) {
|
|
892
|
+
const collectibleType = player.GetActiveItem(activeSlot);
|
|
893
|
+
if (collectibleType === CollectibleType.NULL) {
|
|
894
|
+
continue;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
let hasCollectible: boolean;
|
|
898
|
+
do {
|
|
899
|
+
player.RemoveCollectible(collectibleType);
|
|
900
|
+
hasCollectible = player.HasCollectible(collectibleType);
|
|
901
|
+
} while (hasCollectible);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
/**
|
|
906
|
+
* Helper function to remove all of the held trinkets from a player.
|
|
907
|
+
*
|
|
908
|
+
* This will not remove any smelted trinkets, unless the player happens to be holding a trinket that
|
|
909
|
+
* they also have smelted. (In that case, both the held and the smelted trinket will be removed.)
|
|
910
|
+
*/
|
|
911
|
+
export function removeAllPlayerTrinkets(player: EntityPlayer): void {
|
|
912
|
+
for (const trinketSlot of getEnumValues(TrinketSlot)) {
|
|
913
|
+
const trinketType = player.GetTrinket(trinketSlot);
|
|
914
|
+
if (trinketType === TrinketType.NULL) {
|
|
915
|
+
continue;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
let hasTrinket: boolean;
|
|
919
|
+
do {
|
|
920
|
+
player.TryRemoveTrinket(trinketType);
|
|
921
|
+
hasTrinket = player.HasTrinket(trinketType);
|
|
922
|
+
} while (hasTrinket);
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
|
|
885
926
|
/**
|
|
886
927
|
* Helper function to remove a collectible costume from a player. Use this helper function to avoid
|
|
887
928
|
* having to request the collectible from the item config.
|