isaacscript-common 17.7.3 → 17.9.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 +34 -0
- package/dist/isaacscript-common.lua +27 -14
- package/dist/src/functions/players.d.ts +8 -1
- package/dist/src/functions/players.d.ts.map +1 -1
- package/dist/src/functions/players.lua +24 -13
- package/dist/src/functions/utils.d.ts +24 -0
- package/dist/src/functions/utils.d.ts.map +1 -1
- package/dist/src/functions/utils.lua +24 -0
- package/package.json +1 -1
- package/src/functions/players.ts +13 -0
- package/src/functions/utils.ts +30 -0
package/dist/index.d.ts
CHANGED
|
@@ -6839,6 +6839,19 @@ export declare function inDimension(dimension: Dimension): boolean;
|
|
|
6839
6839
|
|
|
6840
6840
|
export declare function inDoubleTrouble(): boolean;
|
|
6841
6841
|
|
|
6842
|
+
/**
|
|
6843
|
+
* Helper function to check if a variable is within a certain range, exclusive on both ends. (The
|
|
6844
|
+
* "e" stands for exclusive.)
|
|
6845
|
+
*
|
|
6846
|
+
* - For example, `inERange(1, 1, 3)` will return `false`.
|
|
6847
|
+
* - For example, `inERange(1.01, 1, 3)` will return `true`.
|
|
6848
|
+
*
|
|
6849
|
+
* @param num The number to check.
|
|
6850
|
+
* @param start The start of the range to check.
|
|
6851
|
+
* @param end The end of the range to check.
|
|
6852
|
+
*/
|
|
6853
|
+
export declare function inERange(num: int, start: int, end: int): boolean;
|
|
6854
|
+
|
|
6842
6855
|
export declare function inGenesisRoom(): boolean;
|
|
6843
6856
|
|
|
6844
6857
|
/**
|
|
@@ -6849,6 +6862,19 @@ export declare function inGenesisRoom(): boolean;
|
|
|
6849
6862
|
*/
|
|
6850
6863
|
export declare function inHomeCloset(): boolean;
|
|
6851
6864
|
|
|
6865
|
+
/**
|
|
6866
|
+
* Helper function to check if a variable is within a certain range, inclusive on both ends. (The
|
|
6867
|
+
* "i" stands for inclusive.)
|
|
6868
|
+
*
|
|
6869
|
+
* - For example, `inIRange(1, 1, 3)` will return `true`.
|
|
6870
|
+
* - For example, `inIRange(0, 1, 3)` will return `false`.
|
|
6871
|
+
*
|
|
6872
|
+
* @param num The number to check.
|
|
6873
|
+
* @param start The start of the range to check.
|
|
6874
|
+
* @param end The end of the range to check.
|
|
6875
|
+
*/
|
|
6876
|
+
export declare function inIRange(num: int, start: int, end: int): boolean;
|
|
6877
|
+
|
|
6852
6878
|
/**
|
|
6853
6879
|
* Initializes an array with all of the elements containing the specified default value.
|
|
6854
6880
|
*
|
|
@@ -11664,6 +11690,14 @@ export declare function playerConvertSoulHeartsToBlackHearts(player: EntityPlaye
|
|
|
11664
11690
|
*/
|
|
11665
11691
|
export declare function playerHasCollectible(player: EntityPlayer, ...collectibleTypes: CollectibleType[]): boolean;
|
|
11666
11692
|
|
|
11693
|
+
/**
|
|
11694
|
+
* Helper function to check to see if a player has one or more transformations.
|
|
11695
|
+
*
|
|
11696
|
+
* This function is variadic, meaning that you can supply as many transformations as you want to
|
|
11697
|
+
* check for. Returns true if the player has any of the supplied transformations.
|
|
11698
|
+
*/
|
|
11699
|
+
export declare function playerHasForm(player: EntityPlayer, ...playerForms: PlayerForm[]): boolean;
|
|
11700
|
+
|
|
11667
11701
|
/**
|
|
11668
11702
|
* Helper function to see if the player is out of health.
|
|
11669
11703
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 17.
|
|
3
|
+
isaacscript-common 17.9.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -15337,6 +15337,12 @@ function ____exports.iRange(self, start, ____end, increment)
|
|
|
15337
15337
|
end
|
|
15338
15338
|
return array
|
|
15339
15339
|
end
|
|
15340
|
+
function ____exports.inERange(self, num, start, ____end)
|
|
15341
|
+
return num > start and num < ____end
|
|
15342
|
+
end
|
|
15343
|
+
function ____exports.inIRange(self, num, start, ____end)
|
|
15344
|
+
return num >= start and num <= ____end
|
|
15345
|
+
end
|
|
15340
15346
|
function ____exports.isReflectionRender(self)
|
|
15341
15347
|
local room = game:GetRoom()
|
|
15342
15348
|
local renderMode = room:GetRenderMode()
|
|
@@ -21750,12 +21756,19 @@ function ____exports.playerHasCollectible(self, player, ...)
|
|
|
21750
21756
|
function(____, collectibleType) return player:HasCollectible(collectibleType) end
|
|
21751
21757
|
)
|
|
21752
21758
|
end
|
|
21759
|
+
function ____exports.playerHasForm(self, player, ...)
|
|
21760
|
+
local playerForms = {...}
|
|
21761
|
+
return __TS__ArraySome(
|
|
21762
|
+
playerForms,
|
|
21763
|
+
function(____, playerForm) return player:HasPlayerForm(playerForm) end
|
|
21764
|
+
)
|
|
21765
|
+
end
|
|
21753
21766
|
function ____exports.removeAllActiveItems(self, player)
|
|
21754
21767
|
for ____, activeSlot in ipairs(getEnumValues(nil, ActiveSlot)) do
|
|
21755
21768
|
do
|
|
21756
21769
|
local collectibleType = player:GetActiveItem(activeSlot)
|
|
21757
21770
|
if collectibleType == CollectibleType.NULL then
|
|
21758
|
-
goto
|
|
21771
|
+
goto __continue93
|
|
21759
21772
|
end
|
|
21760
21773
|
local hasCollectible
|
|
21761
21774
|
repeat
|
|
@@ -21765,7 +21778,7 @@ function ____exports.removeAllActiveItems(self, player)
|
|
|
21765
21778
|
end
|
|
21766
21779
|
until not hasCollectible
|
|
21767
21780
|
end
|
|
21768
|
-
::
|
|
21781
|
+
::__continue93::
|
|
21769
21782
|
end
|
|
21770
21783
|
end
|
|
21771
21784
|
function ____exports.removeAllPlayerTrinkets(self, player)
|
|
@@ -21773,7 +21786,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
|
|
|
21773
21786
|
do
|
|
21774
21787
|
local trinketType = player:GetTrinket(trinketSlot)
|
|
21775
21788
|
if trinketType == TrinketType.NULL then
|
|
21776
|
-
goto
|
|
21789
|
+
goto __continue98
|
|
21777
21790
|
end
|
|
21778
21791
|
local hasTrinket
|
|
21779
21792
|
repeat
|
|
@@ -21783,7 +21796,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
|
|
|
21783
21796
|
end
|
|
21784
21797
|
until not hasTrinket
|
|
21785
21798
|
end
|
|
21786
|
-
::
|
|
21799
|
+
::__continue98::
|
|
21787
21800
|
end
|
|
21788
21801
|
end
|
|
21789
21802
|
function ____exports.removeCollectibleCostume(self, player, collectibleType)
|
|
@@ -21837,9 +21850,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
21837
21850
|
itemPool:RemoveCollectible(collectibleType)
|
|
21838
21851
|
end
|
|
21839
21852
|
repeat
|
|
21840
|
-
local
|
|
21841
|
-
local
|
|
21842
|
-
if
|
|
21853
|
+
local ____switch117 = activeSlot
|
|
21854
|
+
local ____cond117 = ____switch117 == ActiveSlot.PRIMARY
|
|
21855
|
+
if ____cond117 then
|
|
21843
21856
|
do
|
|
21844
21857
|
if primaryCollectibleType ~= CollectibleType.NULL then
|
|
21845
21858
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -21848,8 +21861,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
21848
21861
|
break
|
|
21849
21862
|
end
|
|
21850
21863
|
end
|
|
21851
|
-
|
|
21852
|
-
if
|
|
21864
|
+
____cond117 = ____cond117 or ____switch117 == ActiveSlot.SECONDARY
|
|
21865
|
+
if ____cond117 then
|
|
21853
21866
|
do
|
|
21854
21867
|
if primaryCollectibleType ~= CollectibleType.NULL then
|
|
21855
21868
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -21864,16 +21877,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
21864
21877
|
break
|
|
21865
21878
|
end
|
|
21866
21879
|
end
|
|
21867
|
-
|
|
21868
|
-
if
|
|
21880
|
+
____cond117 = ____cond117 or ____switch117 == ActiveSlot.POCKET
|
|
21881
|
+
if ____cond117 then
|
|
21869
21882
|
do
|
|
21870
21883
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
21871
21884
|
player:SetActiveCharge(charge, activeSlot)
|
|
21872
21885
|
break
|
|
21873
21886
|
end
|
|
21874
21887
|
end
|
|
21875
|
-
|
|
21876
|
-
if
|
|
21888
|
+
____cond117 = ____cond117 or ____switch117 == ActiveSlot.POCKET_SINGLE_USE
|
|
21889
|
+
if ____cond117 then
|
|
21877
21890
|
do
|
|
21878
21891
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
21879
21892
|
break
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActiveSlot, CollectibleType, ControllerIndex, PlayerType, TrinketType } from "isaac-typescript-definitions";
|
|
1
|
+
import { ActiveSlot, CollectibleType, ControllerIndex, PlayerForm, PlayerType, TrinketType } from "isaac-typescript-definitions";
|
|
2
2
|
export declare function addCollectibleCostume(player: EntityPlayer, collectibleType: CollectibleType): void;
|
|
3
3
|
export declare function addTrinketCostume(player: EntityPlayer, trinketType: TrinketType): void;
|
|
4
4
|
export declare function anyPlayerHasCollectible(collectibleType: CollectibleType): boolean;
|
|
@@ -230,6 +230,13 @@ export declare function playerAddCollectible(player: EntityPlayer, ...collectibl
|
|
|
230
230
|
* check for. Returns true if the player has any of the supplied collectible types.
|
|
231
231
|
*/
|
|
232
232
|
export declare function playerHasCollectible(player: EntityPlayer, ...collectibleTypes: CollectibleType[]): boolean;
|
|
233
|
+
/**
|
|
234
|
+
* Helper function to check to see if a player has one or more transformations.
|
|
235
|
+
*
|
|
236
|
+
* This function is variadic, meaning that you can supply as many transformations as you want to
|
|
237
|
+
* check for. Returns true if the player has any of the supplied transformations.
|
|
238
|
+
*/
|
|
239
|
+
export declare function playerHasForm(player: EntityPlayer, ...playerForms: PlayerForm[]): boolean;
|
|
233
240
|
/**
|
|
234
241
|
* Helper function to remove all of the active items from a player. This includes the Schoolbag item
|
|
235
242
|
* and any pocket actives.
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"players.d.ts","sourceRoot":"","sources":["../../../src/functions/players.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAEV,eAAe,EACf,eAAe,EAEf,UAAU,EACV,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,CAON;AAED,wBAAgB,uBAAuB,CACrC,eAAe,EAAE,eAAe,GAC/B,OAAO,CAGT;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAGrE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,kBAAkB,EAAE,UAAU,EAAE,GAAG,OAAO,CAIxE;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CASjE;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAWzD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,UAAU,GAAG,SAAS,CAMxB;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,kBAAkB,EAAE,YAAY,GAAG,KAAK,GACvC,KAAK,CAMP;AAED,+FAA+F;AAC/F,wBAAgB,aAAa,IAAI,UAAU,EAAE,CAG5C;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,CAiB/D;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG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I,CAsBN;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAEN"}
|
|
@@ -504,6 +504,17 @@ function ____exports.playerHasCollectible(self, player, ...)
|
|
|
504
504
|
function(____, collectibleType) return player:HasCollectible(collectibleType) end
|
|
505
505
|
)
|
|
506
506
|
end
|
|
507
|
+
--- Helper function to check to see if a player has one or more transformations.
|
|
508
|
+
--
|
|
509
|
+
-- This function is variadic, meaning that you can supply as many transformations as you want to
|
|
510
|
+
-- check for. Returns true if the player has any of the supplied transformations.
|
|
511
|
+
function ____exports.playerHasForm(self, player, ...)
|
|
512
|
+
local playerForms = {...}
|
|
513
|
+
return __TS__ArraySome(
|
|
514
|
+
playerForms,
|
|
515
|
+
function(____, playerForm) return player:HasPlayerForm(playerForm) end
|
|
516
|
+
)
|
|
517
|
+
end
|
|
507
518
|
--- Helper function to remove all of the active items from a player. This includes the Schoolbag item
|
|
508
519
|
-- and any pocket actives.
|
|
509
520
|
function ____exports.removeAllActiveItems(self, player)
|
|
@@ -511,7 +522,7 @@ function ____exports.removeAllActiveItems(self, player)
|
|
|
511
522
|
do
|
|
512
523
|
local collectibleType = player:GetActiveItem(activeSlot)
|
|
513
524
|
if collectibleType == CollectibleType.NULL then
|
|
514
|
-
goto
|
|
525
|
+
goto __continue93
|
|
515
526
|
end
|
|
516
527
|
local hasCollectible
|
|
517
528
|
repeat
|
|
@@ -521,7 +532,7 @@ function ____exports.removeAllActiveItems(self, player)
|
|
|
521
532
|
end
|
|
522
533
|
until not hasCollectible
|
|
523
534
|
end
|
|
524
|
-
::
|
|
535
|
+
::__continue93::
|
|
525
536
|
end
|
|
526
537
|
end
|
|
527
538
|
--- Helper function to remove all of the held trinkets from a player.
|
|
@@ -533,7 +544,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
|
|
|
533
544
|
do
|
|
534
545
|
local trinketType = player:GetTrinket(trinketSlot)
|
|
535
546
|
if trinketType == TrinketType.NULL then
|
|
536
|
-
goto
|
|
547
|
+
goto __continue98
|
|
537
548
|
end
|
|
538
549
|
local hasTrinket
|
|
539
550
|
repeat
|
|
@@ -543,7 +554,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
|
|
|
543
554
|
end
|
|
544
555
|
until not hasTrinket
|
|
545
556
|
end
|
|
546
|
-
::
|
|
557
|
+
::__continue98::
|
|
547
558
|
end
|
|
548
559
|
end
|
|
549
560
|
--- Helper function to remove a collectible costume from a player. Use this helper function to avoid
|
|
@@ -624,9 +635,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
624
635
|
itemPool:RemoveCollectible(collectibleType)
|
|
625
636
|
end
|
|
626
637
|
repeat
|
|
627
|
-
local
|
|
628
|
-
local
|
|
629
|
-
if
|
|
638
|
+
local ____switch117 = activeSlot
|
|
639
|
+
local ____cond117 = ____switch117 == ActiveSlot.PRIMARY
|
|
640
|
+
if ____cond117 then
|
|
630
641
|
do
|
|
631
642
|
if primaryCollectibleType ~= CollectibleType.NULL then
|
|
632
643
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -635,8 +646,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
635
646
|
break
|
|
636
647
|
end
|
|
637
648
|
end
|
|
638
|
-
|
|
639
|
-
if
|
|
649
|
+
____cond117 = ____cond117 or ____switch117 == ActiveSlot.SECONDARY
|
|
650
|
+
if ____cond117 then
|
|
640
651
|
do
|
|
641
652
|
if primaryCollectibleType ~= CollectibleType.NULL then
|
|
642
653
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -651,16 +662,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
651
662
|
break
|
|
652
663
|
end
|
|
653
664
|
end
|
|
654
|
-
|
|
655
|
-
if
|
|
665
|
+
____cond117 = ____cond117 or ____switch117 == ActiveSlot.POCKET
|
|
666
|
+
if ____cond117 then
|
|
656
667
|
do
|
|
657
668
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
658
669
|
player:SetActiveCharge(charge, activeSlot)
|
|
659
670
|
break
|
|
660
671
|
end
|
|
661
672
|
end
|
|
662
|
-
|
|
663
|
-
if
|
|
673
|
+
____cond117 = ____cond117 or ____switch117 == ActiveSlot.POCKET_SINGLE_USE
|
|
674
|
+
if ____cond117 then
|
|
664
675
|
do
|
|
665
676
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
666
677
|
break
|
|
@@ -30,6 +30,30 @@ export declare function getTraversalDescription(key: unknown, traversalDescripti
|
|
|
30
30
|
* @param increment Optional. The increment to use. Default is 1.
|
|
31
31
|
*/
|
|
32
32
|
export declare function iRange(start: int, end?: int, increment?: number): int[];
|
|
33
|
+
/**
|
|
34
|
+
* Helper function to check if a variable is within a certain range, exclusive on both ends. (The
|
|
35
|
+
* "e" stands for exclusive.)
|
|
36
|
+
*
|
|
37
|
+
* - For example, `inERange(1, 1, 3)` will return `false`.
|
|
38
|
+
* - For example, `inERange(1.01, 1, 3)` will return `true`.
|
|
39
|
+
*
|
|
40
|
+
* @param num The number to check.
|
|
41
|
+
* @param start The start of the range to check.
|
|
42
|
+
* @param end The end of the range to check.
|
|
43
|
+
*/
|
|
44
|
+
export declare function inERange(num: int, start: int, end: int): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Helper function to check if a variable is within a certain range, inclusive on both ends. (The
|
|
47
|
+
* "i" stands for inclusive.)
|
|
48
|
+
*
|
|
49
|
+
* - For example, `inIRange(1, 1, 3)` will return `true`.
|
|
50
|
+
* - For example, `inIRange(0, 1, 3)` will return `false`.
|
|
51
|
+
*
|
|
52
|
+
* @param num The number to check.
|
|
53
|
+
* @param start The start of the range to check.
|
|
54
|
+
* @param end The end of the range to check.
|
|
55
|
+
*/
|
|
56
|
+
export declare function inIRange(num: int, start: int, end: int): boolean;
|
|
33
57
|
/**
|
|
34
58
|
* Helper function to see if the current render callback is rendering a water refl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gB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAEpE;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,SAAS,MAAM,GAAG,MAAM,EAC5B,CAAC,SAAS,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,EAE/B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAE1C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE9C;AAED,iGAAiG;AACjG,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAGxE;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAI3D;AAED;;;;;;;;;;;;GAYG;AAEH,wBAAgB,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAG;AAEjD;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAqB1E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,4BAA4B,CAE1C,CAAC,SAAS,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,EAC/B,IAAI,SAAS,MAAM,GAAG,MAAM,KACzB,IAAI,CAAG"}
|
|
@@ -70,6 +70,30 @@ function ____exports.iRange(self, start, ____end, increment)
|
|
|
70
70
|
end
|
|
71
71
|
return array
|
|
72
72
|
end
|
|
73
|
+
--- Helper function to check if a variable is within a certain range, exclusive on both ends. (The
|
|
74
|
+
-- "e" stands for exclusive.)
|
|
75
|
+
--
|
|
76
|
+
-- - For example, `inERange(1, 1, 3)` will return `false`.
|
|
77
|
+
-- - For example, `inERange(1.01, 1, 3)` will return `true`.
|
|
78
|
+
--
|
|
79
|
+
-- @param num The number to check.
|
|
80
|
+
-- @param start The start of the range to check.
|
|
81
|
+
-- @param end The end of the range to check.
|
|
82
|
+
function ____exports.inERange(self, num, start, ____end)
|
|
83
|
+
return num > start and num < ____end
|
|
84
|
+
end
|
|
85
|
+
--- Helper function to check if a variable is within a certain range, inclusive on both ends. (The
|
|
86
|
+
-- "i" stands for inclusive.)
|
|
87
|
+
--
|
|
88
|
+
-- - For example, `inIRange(1, 1, 3)` will return `true`.
|
|
89
|
+
-- - For example, `inIRange(0, 1, 3)` will return `false`.
|
|
90
|
+
--
|
|
91
|
+
-- @param num The number to check.
|
|
92
|
+
-- @param start The start of the range to check.
|
|
93
|
+
-- @param end The end of the range to check.
|
|
94
|
+
function ____exports.inIRange(self, num, start, ____end)
|
|
95
|
+
return num >= start and num <= ____end
|
|
96
|
+
end
|
|
73
97
|
--- Helper function to see if the current render callback is rendering a water reflection.
|
|
74
98
|
--
|
|
75
99
|
-- When the player is in a room with water, things will be rendered twice: once for the normal
|
package/package.json
CHANGED
package/src/functions/players.ts
CHANGED
|
@@ -642,6 +642,19 @@ export function playerHasCollectible(
|
|
|
642
642
|
);
|
|
643
643
|
}
|
|
644
644
|
|
|
645
|
+
/**
|
|
646
|
+
* Helper function to check to see if a player has one or more transformations.
|
|
647
|
+
*
|
|
648
|
+
* This function is variadic, meaning that you can supply as many transformations as you want to
|
|
649
|
+
* check for. Returns true if the player has any of the supplied transformations.
|
|
650
|
+
*/
|
|
651
|
+
export function playerHasForm(
|
|
652
|
+
player: EntityPlayer,
|
|
653
|
+
...playerForms: PlayerForm[]
|
|
654
|
+
): boolean {
|
|
655
|
+
return playerForms.some((playerForm) => player.HasPlayerForm(playerForm));
|
|
656
|
+
}
|
|
657
|
+
|
|
645
658
|
/**
|
|
646
659
|
* Helper function to remove all of the active items from a player. This includes the Schoolbag item
|
|
647
660
|
* and any pocket actives.
|
package/src/functions/utils.ts
CHANGED
|
@@ -71,6 +71,36 @@ export function iRange(start: int, end?: int, increment = 1): int[] {
|
|
|
71
71
|
return array;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Helper function to check if a variable is within a certain range, exclusive on both ends. (The
|
|
76
|
+
* "e" stands for exclusive.)
|
|
77
|
+
*
|
|
78
|
+
* - For example, `inERange(1, 1, 3)` will return `false`.
|
|
79
|
+
* - For example, `inERange(1.01, 1, 3)` will return `true`.
|
|
80
|
+
*
|
|
81
|
+
* @param num The number to check.
|
|
82
|
+
* @param start The start of the range to check.
|
|
83
|
+
* @param end The end of the range to check.
|
|
84
|
+
*/
|
|
85
|
+
export function inERange(num: int, start: int, end: int): boolean {
|
|
86
|
+
return num > start && num < end;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Helper function to check if a variable is within a certain range, inclusive on both ends. (The
|
|
91
|
+
* "i" stands for inclusive.)
|
|
92
|
+
*
|
|
93
|
+
* - For example, `inIRange(1, 1, 3)` will return `true`.
|
|
94
|
+
* - For example, `inIRange(0, 1, 3)` will return `false`.
|
|
95
|
+
*
|
|
96
|
+
* @param num The number to check.
|
|
97
|
+
* @param start The start of the range to check.
|
|
98
|
+
* @param end The end of the range to check.
|
|
99
|
+
*/
|
|
100
|
+
export function inIRange(num: int, start: int, end: int): boolean {
|
|
101
|
+
return num >= start && num <= end;
|
|
102
|
+
}
|
|
103
|
+
|
|
74
104
|
/**
|
|
75
105
|
* Helper function to see if the current render callback is rendering a water reflection.
|
|
76
106
|
*
|