isaacscript-common 23.0.1 → 24.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.
- package/dist/index.rollup.d.ts +17 -3
- package/dist/isaacscript-common.lua +45 -28
- package/dist/src/functions/players.d.ts +12 -3
- package/dist/src/functions/players.d.ts.map +1 -1
- package/dist/src/functions/players.lua +34 -19
- package/dist/src/functions/ui.d.ts +2 -0
- package/dist/src/functions/ui.d.ts.map +1 -1
- package/dist/src/functions/ui.lua +18 -10
- package/package.json +1 -1
- package/src/functions/players.ts +25 -5
- package/src/functions/ui.ts +20 -10
package/dist/index.rollup.d.ts
CHANGED
|
@@ -4105,10 +4105,10 @@ declare class GameReorderedCallbacks extends Feature {
|
|
|
4105
4105
|
}
|
|
4106
4106
|
|
|
4107
4107
|
/**
|
|
4108
|
-
* Helper function to find the active
|
|
4109
|
-
* in. Returns
|
|
4108
|
+
* Helper function to find the active slots that the player has the corresponding collectible type
|
|
4109
|
+
* in. Returns an empty array if the player does not have the collectible in any active slot.
|
|
4110
4110
|
*/
|
|
4111
|
-
export declare function
|
|
4111
|
+
export declare function getActiveItemSlots(player: EntityPlayer, collectibleType: CollectibleType): ActiveSlot[];
|
|
4112
4112
|
|
|
4113
4113
|
/**
|
|
4114
4114
|
* Helper function to get the `PocketItemSlot` that the player's pocket active collectible item is
|
|
@@ -6465,8 +6465,12 @@ export declare function getScreenBottomLeftPos(): Readonly<Vector>;
|
|
|
6465
6465
|
|
|
6466
6466
|
export declare function getScreenBottomRightPos(): Readonly<Vector>;
|
|
6467
6467
|
|
|
6468
|
+
export declare function getScreenBottomY(): float;
|
|
6469
|
+
|
|
6468
6470
|
export declare function getScreenCenterPos(): Readonly<Vector>;
|
|
6469
6471
|
|
|
6472
|
+
export declare function getScreenRightX(): float;
|
|
6473
|
+
|
|
6470
6474
|
export declare function getScreenTopCenterPos(): Readonly<Vector>;
|
|
6471
6475
|
|
|
6472
6476
|
export declare function getScreenTopLeftPos(): Readonly<Vector>;
|
|
@@ -6950,6 +6954,16 @@ export declare function hasArmor(entity: Entity): boolean;
|
|
|
6950
6954
|
*/
|
|
6951
6955
|
export declare function hasCollectible(player: EntityPlayer, ...collectibleTypes: CollectibleType[]): boolean;
|
|
6952
6956
|
|
|
6957
|
+
/**
|
|
6958
|
+
* Helper function to check to see if a player has a specific collectible in one or more active
|
|
6959
|
+
* slots.
|
|
6960
|
+
*
|
|
6961
|
+
* This function is variadic, meaning that you can specify as many active slots as you want to check
|
|
6962
|
+
* for. This function will return true if the collectible type is located in any of the active slots
|
|
6963
|
+
* provided.
|
|
6964
|
+
*/
|
|
6965
|
+
export declare function hasCollectibleInActiveSlot(player: EntityPlayer, collectibleType: CollectibleType, ...activeSlots: ActiveSlot[]): boolean;
|
|
6966
|
+
|
|
6953
6967
|
export declare function hasCurse(curse: LevelCurse): boolean;
|
|
6954
6968
|
|
|
6955
6969
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common
|
|
3
|
+
isaacscript-common 24.1.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -22028,9 +22028,9 @@ local ____lualib = require("lualib_bundle")
|
|
|
22028
22028
|
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
22029
22029
|
local Set = ____lualib.Set
|
|
22030
22030
|
local __TS__New = ____lualib.__TS__New
|
|
22031
|
-
local __TS__ArrayFind = ____lualib.__TS__ArrayFind
|
|
22032
|
-
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
22033
22031
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
22032
|
+
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
22033
|
+
local __TS__ArrayFind = ____lualib.__TS__ArrayFind
|
|
22034
22034
|
local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
|
|
22035
22035
|
local ____exports = {}
|
|
22036
22036
|
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
|
|
@@ -22140,8 +22140,8 @@ function ____exports.dequeueItem(self, player)
|
|
|
22140
22140
|
player.QueuedItem = queue
|
|
22141
22141
|
return true
|
|
22142
22142
|
end
|
|
22143
|
-
function ____exports.
|
|
22144
|
-
return
|
|
22143
|
+
function ____exports.getActiveItemSlots(self, player, collectibleType)
|
|
22144
|
+
return __TS__ArrayFilter(
|
|
22145
22145
|
ACTIVE_SLOT_VALUES,
|
|
22146
22146
|
function(____, activeSlot)
|
|
22147
22147
|
local activeItem = player:GetActiveItem(activeSlot)
|
|
@@ -22326,6 +22326,15 @@ function ____exports.hasCollectible(self, player, ...)
|
|
|
22326
22326
|
function(____, collectibleType) return player:HasCollectible(collectibleType) end
|
|
22327
22327
|
)
|
|
22328
22328
|
end
|
|
22329
|
+
function ____exports.hasCollectibleInActiveSlot(self, player, collectibleType, ...)
|
|
22330
|
+
local activeSlots = {...}
|
|
22331
|
+
local matchingActiveSlotsSet = __TS__New(Set, activeSlots)
|
|
22332
|
+
local activeItemSlots = ____exports.getActiveItemSlots(nil, player, collectibleType)
|
|
22333
|
+
return __TS__ArraySome(
|
|
22334
|
+
activeItemSlots,
|
|
22335
|
+
function(____, activeSlot) return matchingActiveSlotsSet:has(activeSlot) end
|
|
22336
|
+
)
|
|
22337
|
+
end
|
|
22329
22338
|
function ____exports.hasForm(self, player, ...)
|
|
22330
22339
|
local playerForms = {...}
|
|
22331
22340
|
return __TS__ArraySome(
|
|
@@ -22415,7 +22424,7 @@ function ____exports.removeAllActiveItems(self, player)
|
|
|
22415
22424
|
do
|
|
22416
22425
|
local collectibleType = player:GetActiveItem(activeSlot)
|
|
22417
22426
|
if collectibleType == CollectibleType.NULL then
|
|
22418
|
-
goto
|
|
22427
|
+
goto __continue95
|
|
22419
22428
|
end
|
|
22420
22429
|
local stillHasCollectible
|
|
22421
22430
|
repeat
|
|
@@ -22425,7 +22434,7 @@ function ____exports.removeAllActiveItems(self, player)
|
|
|
22425
22434
|
end
|
|
22426
22435
|
until not stillHasCollectible
|
|
22427
22436
|
end
|
|
22428
|
-
::
|
|
22437
|
+
::__continue95::
|
|
22429
22438
|
end
|
|
22430
22439
|
end
|
|
22431
22440
|
function ____exports.removeAllPlayerTrinkets(self, player)
|
|
@@ -22433,7 +22442,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
|
|
|
22433
22442
|
do
|
|
22434
22443
|
local trinketType = player:GetTrinket(trinketSlot)
|
|
22435
22444
|
if trinketType == TrinketType.NULL then
|
|
22436
|
-
goto
|
|
22445
|
+
goto __continue100
|
|
22437
22446
|
end
|
|
22438
22447
|
local hasTrinket
|
|
22439
22448
|
repeat
|
|
@@ -22443,7 +22452,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
|
|
|
22443
22452
|
end
|
|
22444
22453
|
until not hasTrinket
|
|
22445
22454
|
end
|
|
22446
|
-
::
|
|
22455
|
+
::__continue100::
|
|
22447
22456
|
end
|
|
22448
22457
|
end
|
|
22449
22458
|
function ____exports.removeCollectible(self, player, ...)
|
|
@@ -22503,9 +22512,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
22503
22512
|
itemPool:RemoveCollectible(collectibleType)
|
|
22504
22513
|
end
|
|
22505
22514
|
repeat
|
|
22506
|
-
local
|
|
22507
|
-
local
|
|
22508
|
-
if
|
|
22515
|
+
local ____switch122 = activeSlot
|
|
22516
|
+
local ____cond122 = ____switch122 == ActiveSlot.PRIMARY
|
|
22517
|
+
if ____cond122 then
|
|
22509
22518
|
do
|
|
22510
22519
|
if primaryCollectibleType ~= CollectibleType.NULL then
|
|
22511
22520
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -22514,8 +22523,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
22514
22523
|
break
|
|
22515
22524
|
end
|
|
22516
22525
|
end
|
|
22517
|
-
|
|
22518
|
-
if
|
|
22526
|
+
____cond122 = ____cond122 or ____switch122 == ActiveSlot.SECONDARY
|
|
22527
|
+
if ____cond122 then
|
|
22519
22528
|
do
|
|
22520
22529
|
if primaryCollectibleType ~= CollectibleType.NULL then
|
|
22521
22530
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -22530,16 +22539,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
22530
22539
|
break
|
|
22531
22540
|
end
|
|
22532
22541
|
end
|
|
22533
|
-
|
|
22534
|
-
if
|
|
22542
|
+
____cond122 = ____cond122 or ____switch122 == ActiveSlot.POCKET
|
|
22543
|
+
if ____cond122 then
|
|
22535
22544
|
do
|
|
22536
22545
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
22537
22546
|
player:SetActiveCharge(charge, activeSlot)
|
|
22538
22547
|
break
|
|
22539
22548
|
end
|
|
22540
22549
|
end
|
|
22541
|
-
|
|
22542
|
-
if
|
|
22550
|
+
____cond122 = ____cond122 or ____switch122 == ActiveSlot.POCKET_SINGLE_USE
|
|
22551
|
+
if ____cond122 then
|
|
22543
22552
|
do
|
|
22544
22553
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
22545
22554
|
break
|
|
@@ -40578,27 +40587,35 @@ function ____exports.getHeartsUIWidth(self)
|
|
|
40578
40587
|
return width
|
|
40579
40588
|
end
|
|
40580
40589
|
function ____exports.getScreenBottomCenterPos(self)
|
|
40581
|
-
local
|
|
40582
|
-
return Vector(
|
|
40590
|
+
local bottomRightPos = ____exports.getScreenBottomRightPos(nil)
|
|
40591
|
+
return Vector(bottomRightPos.X / 2, bottomRightPos.Y)
|
|
40583
40592
|
end
|
|
40584
40593
|
function ____exports.getScreenBottomLeftPos(self)
|
|
40585
|
-
local
|
|
40586
|
-
return Vector(0,
|
|
40594
|
+
local bottomRightPos = ____exports.getScreenBottomRightPos(nil)
|
|
40595
|
+
return Vector(0, bottomRightPos.Y)
|
|
40596
|
+
end
|
|
40597
|
+
function ____exports.getScreenBottomY(self)
|
|
40598
|
+
local bottomRightPos = ____exports.getScreenBottomRightPos(nil)
|
|
40599
|
+
return bottomRightPos.Y
|
|
40587
40600
|
end
|
|
40588
40601
|
function ____exports.getScreenCenterPos(self)
|
|
40589
|
-
local
|
|
40590
|
-
return
|
|
40602
|
+
local bottomRightPos = ____exports.getScreenBottomRightPos(nil)
|
|
40603
|
+
return bottomRightPos / 2
|
|
40604
|
+
end
|
|
40605
|
+
function ____exports.getScreenRightX(self)
|
|
40606
|
+
local bottomRightPos = ____exports.getScreenBottomRightPos(nil)
|
|
40607
|
+
return bottomRightPos.X
|
|
40591
40608
|
end
|
|
40592
40609
|
function ____exports.getScreenTopCenterPos(self)
|
|
40593
|
-
local
|
|
40594
|
-
return Vector(
|
|
40610
|
+
local bottomRightPos = ____exports.getScreenBottomRightPos(nil)
|
|
40611
|
+
return Vector(bottomRightPos.X / 2, 0)
|
|
40595
40612
|
end
|
|
40596
40613
|
function ____exports.getScreenTopLeftPos(self)
|
|
40597
40614
|
return copyVector(nil, VectorZero)
|
|
40598
40615
|
end
|
|
40599
40616
|
function ____exports.getScreenTopRightPos(self)
|
|
40600
|
-
local
|
|
40601
|
-
return Vector(
|
|
40617
|
+
local bottomRightPos = ____exports.getScreenBottomRightPos(nil)
|
|
40618
|
+
return Vector(bottomRightPos.X, 0)
|
|
40602
40619
|
end
|
|
40603
40620
|
function ____exports.getVisibleHearts(self, player)
|
|
40604
40621
|
local effectiveMaxHearts = player:GetEffectiveMaxHearts()
|
|
@@ -37,10 +37,10 @@ export declare function canPlayerCrushRocks(player: EntityPlayer): boolean;
|
|
|
37
37
|
*/
|
|
38
38
|
export declare function dequeueItem(player: EntityPlayer): boolean;
|
|
39
39
|
/**
|
|
40
|
-
* Helper function to find the active
|
|
41
|
-
* in. Returns
|
|
40
|
+
* Helper function to find the active slots that the player has the corresponding collectible type
|
|
41
|
+
* in. Returns an empty array if the player does not have the collectible in any active slot.
|
|
42
42
|
*/
|
|
43
|
-
export declare function
|
|
43
|
+
export declare function getActiveItemSlots(player: EntityPlayer, collectibleType: CollectibleType): ActiveSlot[];
|
|
44
44
|
/**
|
|
45
45
|
* Helper function to get how long Azazel's Brimstone laser should be. You can pass either an
|
|
46
46
|
* `EntityPlayer` object or a tear height stat.
|
|
@@ -164,6 +164,15 @@ export declare function getTotalPlayerCollectibles(collectibleType: CollectibleT
|
|
|
164
164
|
* check for. Returns true if the player has any of the supplied collectible types.
|
|
165
165
|
*/
|
|
166
166
|
export declare function hasCollectible(player: EntityPlayer, ...collectibleTypes: CollectibleType[]): boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Helper function to check to see if a player has a specific collectible in one or more active
|
|
169
|
+
* slots.
|
|
170
|
+
*
|
|
171
|
+
* This function is variadic, meaning that you can specify as many active slots as you want to check
|
|
172
|
+
* for. This function will return true if the collectible type is located in any of the active slots
|
|
173
|
+
* provided.
|
|
174
|
+
*/
|
|
175
|
+
export declare function hasCollectibleInActiveSlot(player: EntityPlayer, collectibleType: CollectibleType, ...activeSlots: ActiveSlot[]): boolean;
|
|
167
176
|
/**
|
|
168
177
|
* Helper function to check to see if a player has one or more transformations.
|
|
169
178
|
*
|
|
@@ -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,EAEf,UAAU,EACV,UAAU,EACV,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAiBtC;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,YAAY,EACpB,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,IAAI,CAIN;AAED,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,
|
|
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,EACV,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAiBtC;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,YAAY,EACpB,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,IAAI,CAIN;AAED,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;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,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"}
|
|
@@ -2,9 +2,9 @@ local ____lualib = require("lualib_bundle")
|
|
|
2
2
|
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
3
3
|
local Set = ____lualib.Set
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
|
-
local __TS__ArrayFind = ____lualib.__TS__ArrayFind
|
|
6
|
-
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
7
5
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
6
|
+
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
7
|
+
local __TS__ArrayFind = ____lualib.__TS__ArrayFind
|
|
8
8
|
local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
|
|
9
9
|
local ____exports = {}
|
|
10
10
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
@@ -140,10 +140,10 @@ function ____exports.dequeueItem(self, player)
|
|
|
140
140
|
player.QueuedItem = queue
|
|
141
141
|
return true
|
|
142
142
|
end
|
|
143
|
-
--- Helper function to find the active
|
|
144
|
-
-- in. Returns
|
|
145
|
-
function ____exports.
|
|
146
|
-
return
|
|
143
|
+
--- Helper function to find the active slots that the player has the corresponding collectible type
|
|
144
|
+
-- in. Returns an empty array if the player does not have the collectible in any active slot.
|
|
145
|
+
function ____exports.getActiveItemSlots(self, player, collectibleType)
|
|
146
|
+
return __TS__ArrayFilter(
|
|
147
147
|
ACTIVE_SLOT_VALUES,
|
|
148
148
|
function(____, activeSlot)
|
|
149
149
|
local activeItem = player:GetActiveItem(activeSlot)
|
|
@@ -397,6 +397,21 @@ function ____exports.hasCollectible(self, player, ...)
|
|
|
397
397
|
function(____, collectibleType) return player:HasCollectible(collectibleType) end
|
|
398
398
|
)
|
|
399
399
|
end
|
|
400
|
+
--- Helper function to check to see if a player has a specific collectible in one or more active
|
|
401
|
+
-- slots.
|
|
402
|
+
--
|
|
403
|
+
-- This function is variadic, meaning that you can specify as many active slots as you want to check
|
|
404
|
+
-- for. This function will return true if the collectible type is located in any of the active slots
|
|
405
|
+
-- provided.
|
|
406
|
+
function ____exports.hasCollectibleInActiveSlot(self, player, collectibleType, ...)
|
|
407
|
+
local activeSlots = {...}
|
|
408
|
+
local matchingActiveSlotsSet = __TS__New(Set, activeSlots)
|
|
409
|
+
local activeItemSlots = ____exports.getActiveItemSlots(nil, player, collectibleType)
|
|
410
|
+
return __TS__ArraySome(
|
|
411
|
+
activeItemSlots,
|
|
412
|
+
function(____, activeSlot) return matchingActiveSlotsSet:has(activeSlot) end
|
|
413
|
+
)
|
|
414
|
+
end
|
|
400
415
|
--- Helper function to check to see if a player has one or more transformations.
|
|
401
416
|
--
|
|
402
417
|
-- This function is variadic, meaning that you can supply as many transformations as you want to
|
|
@@ -520,7 +535,7 @@ function ____exports.removeAllActiveItems(self, player)
|
|
|
520
535
|
do
|
|
521
536
|
local collectibleType = player:GetActiveItem(activeSlot)
|
|
522
537
|
if collectibleType == CollectibleType.NULL then
|
|
523
|
-
goto
|
|
538
|
+
goto __continue95
|
|
524
539
|
end
|
|
525
540
|
local stillHasCollectible
|
|
526
541
|
repeat
|
|
@@ -530,7 +545,7 @@ function ____exports.removeAllActiveItems(self, player)
|
|
|
530
545
|
end
|
|
531
546
|
until not stillHasCollectible
|
|
532
547
|
end
|
|
533
|
-
::
|
|
548
|
+
::__continue95::
|
|
534
549
|
end
|
|
535
550
|
end
|
|
536
551
|
--- Helper function to remove all of the held trinkets from a player.
|
|
@@ -542,7 +557,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
|
|
|
542
557
|
do
|
|
543
558
|
local trinketType = player:GetTrinket(trinketSlot)
|
|
544
559
|
if trinketType == TrinketType.NULL then
|
|
545
|
-
goto
|
|
560
|
+
goto __continue100
|
|
546
561
|
end
|
|
547
562
|
local hasTrinket
|
|
548
563
|
repeat
|
|
@@ -552,7 +567,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
|
|
|
552
567
|
end
|
|
553
568
|
until not hasTrinket
|
|
554
569
|
end
|
|
555
|
-
::
|
|
570
|
+
::__continue100::
|
|
556
571
|
end
|
|
557
572
|
end
|
|
558
573
|
--- Helper function to remove one or more collectibles to a player.
|
|
@@ -643,9 +658,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
643
658
|
itemPool:RemoveCollectible(collectibleType)
|
|
644
659
|
end
|
|
645
660
|
repeat
|
|
646
|
-
local
|
|
647
|
-
local
|
|
648
|
-
if
|
|
661
|
+
local ____switch122 = activeSlot
|
|
662
|
+
local ____cond122 = ____switch122 == ActiveSlot.PRIMARY
|
|
663
|
+
if ____cond122 then
|
|
649
664
|
do
|
|
650
665
|
if primaryCollectibleType ~= CollectibleType.NULL then
|
|
651
666
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -654,8 +669,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
654
669
|
break
|
|
655
670
|
end
|
|
656
671
|
end
|
|
657
|
-
|
|
658
|
-
if
|
|
672
|
+
____cond122 = ____cond122 or ____switch122 == ActiveSlot.SECONDARY
|
|
673
|
+
if ____cond122 then
|
|
659
674
|
do
|
|
660
675
|
if primaryCollectibleType ~= CollectibleType.NULL then
|
|
661
676
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -670,16 +685,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
670
685
|
break
|
|
671
686
|
end
|
|
672
687
|
end
|
|
673
|
-
|
|
674
|
-
if
|
|
688
|
+
____cond122 = ____cond122 or ____switch122 == ActiveSlot.POCKET
|
|
689
|
+
if ____cond122 then
|
|
675
690
|
do
|
|
676
691
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
677
692
|
player:SetActiveCharge(charge, activeSlot)
|
|
678
693
|
break
|
|
679
694
|
end
|
|
680
695
|
end
|
|
681
|
-
|
|
682
|
-
if
|
|
696
|
+
____cond122 = ____cond122 or ____switch122 == ActiveSlot.POCKET_SINGLE_USE
|
|
697
|
+
if ____cond122 then
|
|
683
698
|
do
|
|
684
699
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
685
700
|
break
|
|
@@ -26,7 +26,9 @@ export declare function getHeartsUIWidth(): int;
|
|
|
26
26
|
export declare function getScreenBottomCenterPos(): Readonly<Vector>;
|
|
27
27
|
export declare function getScreenBottomLeftPos(): Readonly<Vector>;
|
|
28
28
|
export declare function getScreenBottomRightPos(): Readonly<Vector>;
|
|
29
|
+
export declare function getScreenBottomY(): float;
|
|
29
30
|
export declare function getScreenCenterPos(): Readonly<Vector>;
|
|
31
|
+
export declare function getScreenRightX(): float;
|
|
30
32
|
export declare function getScreenTopCenterPos(): Readonly<Vector>;
|
|
31
33
|
export declare function getScreenTopLeftPos(): Readonly<Vector>;
|
|
32
34
|
export declare function getScreenTopRightPos(): Readonly<Vector>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../src/functions/ui.ts"],"names":[],"mappings":";;;AAKA;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,IAAI,QAAQ,CAAC,MAAM,CAAC,CAmBrD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAU3D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,GAAG,CAgCtC;AAED,wBAAgB,wBAAwB,IAAI,QAAQ,CAAC,MAAM,CAAC,CAG3D;AAED,wBAAgB,sBAAsB,IAAI,QAAQ,CAAC,MAAM,CAAC,CAGzD;AAED,wBAAgB,uBAAuB,IAAI,QAAQ,CAAC,MAAM,CAAC,CAK1D;AAED,wBAAgB,kBAAkB,IAAI,QAAQ,CAAC,MAAM,CAAC,CAGrD;AAED,wBAAgB,qBAAqB,IAAI,QAAQ,CAAC,MAAM,CAAC,CAGxD;AAED,wBAAgB,mBAAmB,IAAI,QAAQ,CAAC,MAAM,CAAC,CAEtD;AAED,wBAAgB,oBAAoB,IAAI,QAAQ,CAAC,MAAM,CAAC,CAGvD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAa1D"}
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../src/functions/ui.ts"],"names":[],"mappings":";;;AAKA;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,IAAI,QAAQ,CAAC,MAAM,CAAC,CAmBrD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAU3D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,GAAG,CAgCtC;AAED,wBAAgB,wBAAwB,IAAI,QAAQ,CAAC,MAAM,CAAC,CAG3D;AAED,wBAAgB,sBAAsB,IAAI,QAAQ,CAAC,MAAM,CAAC,CAGzD;AAED,wBAAgB,uBAAuB,IAAI,QAAQ,CAAC,MAAM,CAAC,CAK1D;AAED,wBAAgB,gBAAgB,IAAI,KAAK,CAGxC;AAED,wBAAgB,kBAAkB,IAAI,QAAQ,CAAC,MAAM,CAAC,CAGrD;AAED,wBAAgB,eAAe,IAAI,KAAK,CAGvC;AAED,wBAAgB,qBAAqB,IAAI,QAAQ,CAAC,MAAM,CAAC,CAGxD;AAED,wBAAgB,mBAAmB,IAAI,QAAQ,CAAC,MAAM,CAAC,CAEtD;AAED,wBAAgB,oBAAoB,IAAI,QAAQ,CAAC,MAAM,CAAC,CAGvD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAa1D"}
|
|
@@ -79,27 +79,35 @@ function ____exports.getHeartsUIWidth(self)
|
|
|
79
79
|
return width
|
|
80
80
|
end
|
|
81
81
|
function ____exports.getScreenBottomCenterPos(self)
|
|
82
|
-
local
|
|
83
|
-
return Vector(
|
|
82
|
+
local bottomRightPos = ____exports.getScreenBottomRightPos(nil)
|
|
83
|
+
return Vector(bottomRightPos.X / 2, bottomRightPos.Y)
|
|
84
84
|
end
|
|
85
85
|
function ____exports.getScreenBottomLeftPos(self)
|
|
86
|
-
local
|
|
87
|
-
return Vector(0,
|
|
86
|
+
local bottomRightPos = ____exports.getScreenBottomRightPos(nil)
|
|
87
|
+
return Vector(0, bottomRightPos.Y)
|
|
88
|
+
end
|
|
89
|
+
function ____exports.getScreenBottomY(self)
|
|
90
|
+
local bottomRightPos = ____exports.getScreenBottomRightPos(nil)
|
|
91
|
+
return bottomRightPos.Y
|
|
88
92
|
end
|
|
89
93
|
function ____exports.getScreenCenterPos(self)
|
|
90
|
-
local
|
|
91
|
-
return
|
|
94
|
+
local bottomRightPos = ____exports.getScreenBottomRightPos(nil)
|
|
95
|
+
return bottomRightPos / 2
|
|
96
|
+
end
|
|
97
|
+
function ____exports.getScreenRightX(self)
|
|
98
|
+
local bottomRightPos = ____exports.getScreenBottomRightPos(nil)
|
|
99
|
+
return bottomRightPos.X
|
|
92
100
|
end
|
|
93
101
|
function ____exports.getScreenTopCenterPos(self)
|
|
94
|
-
local
|
|
95
|
-
return Vector(
|
|
102
|
+
local bottomRightPos = ____exports.getScreenBottomRightPos(nil)
|
|
103
|
+
return Vector(bottomRightPos.X / 2, 0)
|
|
96
104
|
end
|
|
97
105
|
function ____exports.getScreenTopLeftPos(self)
|
|
98
106
|
return copyVector(nil, VectorZero)
|
|
99
107
|
end
|
|
100
108
|
function ____exports.getScreenTopRightPos(self)
|
|
101
|
-
local
|
|
102
|
-
return Vector(
|
|
109
|
+
local bottomRightPos = ____exports.getScreenBottomRightPos(nil)
|
|
110
|
+
return Vector(bottomRightPos.X, 0)
|
|
103
111
|
end
|
|
104
112
|
--- Get how many hearts are currently being shown on the hearts UI.
|
|
105
113
|
--
|
package/package.json
CHANGED
package/src/functions/players.ts
CHANGED
|
@@ -129,14 +129,14 @@ export function dequeueItem(player: EntityPlayer): boolean {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
/**
|
|
132
|
-
* Helper function to find the active
|
|
133
|
-
* in. Returns
|
|
132
|
+
* Helper function to find the active slots that the player has the corresponding collectible type
|
|
133
|
+
* in. Returns an empty array if the player does not have the collectible in any active slot.
|
|
134
134
|
*/
|
|
135
|
-
export function
|
|
135
|
+
export function getActiveItemSlots(
|
|
136
136
|
player: EntityPlayer,
|
|
137
137
|
collectibleType: CollectibleType,
|
|
138
|
-
): ActiveSlot
|
|
139
|
-
return ACTIVE_SLOT_VALUES.
|
|
138
|
+
): ActiveSlot[] {
|
|
139
|
+
return ACTIVE_SLOT_VALUES.filter((activeSlot) => {
|
|
140
140
|
const activeItem = player.GetActiveItem(activeSlot);
|
|
141
141
|
return activeItem === collectibleType;
|
|
142
142
|
});
|
|
@@ -468,6 +468,26 @@ export function hasCollectible(
|
|
|
468
468
|
);
|
|
469
469
|
}
|
|
470
470
|
|
|
471
|
+
/**
|
|
472
|
+
* Helper function to check to see if a player has a specific collectible in one or more active
|
|
473
|
+
* slots.
|
|
474
|
+
*
|
|
475
|
+
* This function is variadic, meaning that you can specify as many active slots as you want to check
|
|
476
|
+
* for. This function will return true if the collectible type is located in any of the active slots
|
|
477
|
+
* provided.
|
|
478
|
+
*/
|
|
479
|
+
export function hasCollectibleInActiveSlot(
|
|
480
|
+
player: EntityPlayer,
|
|
481
|
+
collectibleType: CollectibleType,
|
|
482
|
+
...activeSlots: ActiveSlot[]
|
|
483
|
+
): boolean {
|
|
484
|
+
const matchingActiveSlotsSet = new Set(activeSlots);
|
|
485
|
+
const activeItemSlots = getActiveItemSlots(player, collectibleType);
|
|
486
|
+
return activeItemSlots.some((activeSlot) =>
|
|
487
|
+
matchingActiveSlotsSet.has(activeSlot),
|
|
488
|
+
);
|
|
489
|
+
}
|
|
490
|
+
|
|
471
491
|
/**
|
|
472
492
|
* Helper function to check to see if a player has one or more transformations.
|
|
473
493
|
*
|
package/src/functions/ui.ts
CHANGED
|
@@ -90,13 +90,13 @@ export function getHeartsUIWidth(): int {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
export function getScreenBottomCenterPos(): Readonly<Vector> {
|
|
93
|
-
const
|
|
94
|
-
return Vector(
|
|
93
|
+
const bottomRightPos = getScreenBottomRightPos();
|
|
94
|
+
return Vector(bottomRightPos.X / 2, bottomRightPos.Y);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
export function getScreenBottomLeftPos(): Readonly<Vector> {
|
|
98
|
-
const
|
|
99
|
-
return Vector(0,
|
|
98
|
+
const bottomRightPos = getScreenBottomRightPos();
|
|
99
|
+
return Vector(0, bottomRightPos.Y);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
export function getScreenBottomRightPos(): Readonly<Vector> {
|
|
@@ -106,14 +106,24 @@ export function getScreenBottomRightPos(): Readonly<Vector> {
|
|
|
106
106
|
return Vector(screenWidth, screenHeight);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
export function getScreenBottomY(): float {
|
|
110
|
+
const bottomRightPos = getScreenBottomRightPos();
|
|
111
|
+
return bottomRightPos.Y;
|
|
112
|
+
}
|
|
113
|
+
|
|
109
114
|
export function getScreenCenterPos(): Readonly<Vector> {
|
|
110
|
-
const
|
|
111
|
-
return
|
|
115
|
+
const bottomRightPos = getScreenBottomRightPos();
|
|
116
|
+
return bottomRightPos.div(2);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function getScreenRightX(): float {
|
|
120
|
+
const bottomRightPos = getScreenBottomRightPos();
|
|
121
|
+
return bottomRightPos.X;
|
|
112
122
|
}
|
|
113
123
|
|
|
114
124
|
export function getScreenTopCenterPos(): Readonly<Vector> {
|
|
115
|
-
const
|
|
116
|
-
return Vector(
|
|
125
|
+
const bottomRightPos = getScreenBottomRightPos();
|
|
126
|
+
return Vector(bottomRightPos.X / 2, 0);
|
|
117
127
|
}
|
|
118
128
|
|
|
119
129
|
export function getScreenTopLeftPos(): Readonly<Vector> {
|
|
@@ -121,8 +131,8 @@ export function getScreenTopLeftPos(): Readonly<Vector> {
|
|
|
121
131
|
}
|
|
122
132
|
|
|
123
133
|
export function getScreenTopRightPos(): Readonly<Vector> {
|
|
124
|
-
const
|
|
125
|
-
return Vector(
|
|
134
|
+
const bottomRightPos = getScreenBottomRightPos();
|
|
135
|
+
return Vector(bottomRightPos.X, 0);
|
|
126
136
|
}
|
|
127
137
|
|
|
128
138
|
/**
|