isaacscript-common 33.11.0 → 33.12.1
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 +33 -2
- package/dist/isaacscript-common.lua +26 -19
- package/dist/src/classes/features/other/saveDataManager/loadFromDisk.d.ts.map +1 -1
- package/dist/src/classes/features/other/saveDataManager/loadFromDisk.lua +1 -1
- package/dist/src/classes/features/other/saveDataManager/saveToDisk.d.ts.map +1 -1
- package/dist/src/classes/features/other/saveDataManager/saveToDisk.lua +1 -1
- package/dist/src/functions/direction.d.ts +21 -0
- package/dist/src/functions/direction.d.ts.map +1 -1
- package/dist/src/functions/direction.lua +11 -0
- package/dist/src/functions/players.d.ts +11 -2
- package/dist/src/functions/players.d.ts.map +1 -1
- package/dist/src/functions/players.lua +31 -18
- package/package.json +1 -1
- package/src/classes/features/other/SaveDataManager.ts +1 -1
- package/src/classes/features/other/saveDataManager/loadFromDisk.ts +3 -1
- package/src/classes/features/other/saveDataManager/saveToDisk.ts +3 -1
- package/src/functions/direction.ts +21 -0
- package/src/functions/players.ts +20 -5
package/dist/index.rollup.d.ts
CHANGED
|
@@ -3558,12 +3558,29 @@ export declare function deserializeVector(vector: SerializedVector): Vector;
|
|
|
3558
3558
|
/** For `EntityType.EFFECT` (1000), `EffectVariant.DICE_FLOOR` (76). */
|
|
3559
3559
|
export declare const DICE_FLOOR_TRIGGER_SQUARE_SIZE = 75;
|
|
3560
3560
|
|
|
3561
|
+
/**
|
|
3562
|
+
* Helper function to convert a direction to degrees. For example, `Direction.LEFT` (0) would return
|
|
3563
|
+
* 180 and `Direction.RIGHT` (2) would return 0. (This corresponds to how the
|
|
3564
|
+
* `Vector.GetAngleDegrees` method works.)
|
|
3565
|
+
*/
|
|
3561
3566
|
export declare function directionToDegrees(direction: Direction): int;
|
|
3562
3567
|
|
|
3568
|
+
/**
|
|
3569
|
+
* Helper function to convert a direction to a shoot `ButtonAction`. For example, `Direction.LEFT`
|
|
3570
|
+
* (0) would return `ButtonAction.LEFT` (0).
|
|
3571
|
+
*/
|
|
3563
3572
|
export declare function directionToMoveAction(direction: Direction): ButtonAction | undefined;
|
|
3564
3573
|
|
|
3574
|
+
/**
|
|
3575
|
+
* Helper function to convert a direction to a shoot `ButtonAction`. For example, `Direction.LEFT`
|
|
3576
|
+
* (0) would return `ButtonAction.SHOOT_LEFT` (4).
|
|
3577
|
+
*/
|
|
3565
3578
|
export declare function directionToShootAction(direction: Direction): ButtonAction | undefined;
|
|
3566
3579
|
|
|
3580
|
+
/**
|
|
3581
|
+
* Helper function to convert a direction to a `Vector`. For example, `Direction.LEFT` (0) would
|
|
3582
|
+
* convert to `Vector(-1, 0).
|
|
3583
|
+
*/
|
|
3567
3584
|
export declare function directionToVector(direction: Direction): Readonly<Vector>;
|
|
3568
3585
|
|
|
3569
3586
|
declare class DisableAllSound extends Feature {
|
|
@@ -5105,6 +5122,10 @@ export declare function getDevilRoomOrAngelRoomDoor(): GridEntityDoor | undefine
|
|
|
5105
5122
|
*/
|
|
5106
5123
|
export declare function getDimension(): Dimension;
|
|
5107
5124
|
|
|
5125
|
+
/**
|
|
5126
|
+
* Helper function to get the lowercase name of a direction. For example, `Direction.LEFT` (0) would
|
|
5127
|
+
* return "left".
|
|
5128
|
+
*/
|
|
5108
5129
|
export declare function getDirectionName(direction: Direction): string | undefined;
|
|
5109
5130
|
|
|
5110
5131
|
/**
|
|
@@ -7572,6 +7593,16 @@ export declare function hasPiercing(player: EntityPlayer): boolean;
|
|
|
7572
7593
|
*/
|
|
7573
7594
|
export declare function hasSpectral(player: EntityPlayer): boolean;
|
|
7574
7595
|
|
|
7596
|
+
/**
|
|
7597
|
+
* Helper function to check to see if a player has one or more trinkets.
|
|
7598
|
+
*
|
|
7599
|
+
* This function is variadic, meaning that you can supply as many trinket types as you want to check
|
|
7600
|
+
* for. Returns true if the player has any of the supplied trinket types.
|
|
7601
|
+
*
|
|
7602
|
+
* This function always passes `false` to the `ignoreModifiers` argument.
|
|
7603
|
+
*/
|
|
7604
|
+
export declare function hasTrinket(player: EntityPlayer, ...trinketTypes: TrinketType[]): boolean;
|
|
7605
|
+
|
|
7575
7606
|
/**
|
|
7576
7607
|
* Helper function to check if the current room has one or more open door slots that can be used to
|
|
7577
7608
|
* make custom doors.
|
|
@@ -14786,8 +14817,8 @@ export declare function removeAllPlayerHealth(player: EntityPlayer): void;
|
|
|
14786
14817
|
/**
|
|
14787
14818
|
* Helper function to remove all of the held trinkets from a player.
|
|
14788
14819
|
*
|
|
14789
|
-
* This will not remove any smelted trinkets, unless the player happens to be holding a trinket
|
|
14790
|
-
* they
|
|
14820
|
+
* This will not remove any smelted trinkets, unless the player happens to also be holding a trinket
|
|
14821
|
+
* that they have smelted. (In that case, both the held and the smelted trinket will be removed.)
|
|
14791
14822
|
*/
|
|
14792
14823
|
export declare function removeAllPlayerTrinkets(player: EntityPlayer): void;
|
|
14793
14824
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 33.
|
|
3
|
+
isaacscript-common 33.12.1
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -22161,6 +22161,13 @@ end
|
|
|
22161
22161
|
function ____exports.hasSpectral(self, player)
|
|
22162
22162
|
return hasFlag(nil, player.TearFlags, TearFlag.SPECTRAL)
|
|
22163
22163
|
end
|
|
22164
|
+
function ____exports.hasTrinket(self, player, ...)
|
|
22165
|
+
local trinketTypes = {...}
|
|
22166
|
+
return __TS__ArraySome(
|
|
22167
|
+
trinketTypes,
|
|
22168
|
+
function(____, trinketType) return player:HasTrinket(trinketType) end
|
|
22169
|
+
)
|
|
22170
|
+
end
|
|
22164
22171
|
function ____exports.isActiveSlotEmpty(self, player, activeSlot)
|
|
22165
22172
|
if activeSlot == nil then
|
|
22166
22173
|
activeSlot = ActiveSlot.PRIMARY
|
|
@@ -22227,7 +22234,7 @@ function ____exports.removeAllActiveItems(self, player)
|
|
|
22227
22234
|
do
|
|
22228
22235
|
local collectibleType = player:GetActiveItem(activeSlot)
|
|
22229
22236
|
if collectibleType == CollectibleType.NULL then
|
|
22230
|
-
goto
|
|
22237
|
+
goto __continue98
|
|
22231
22238
|
end
|
|
22232
22239
|
local stillHasCollectible
|
|
22233
22240
|
repeat
|
|
@@ -22237,7 +22244,7 @@ function ____exports.removeAllActiveItems(self, player)
|
|
|
22237
22244
|
end
|
|
22238
22245
|
until not stillHasCollectible
|
|
22239
22246
|
end
|
|
22240
|
-
::
|
|
22247
|
+
::__continue98::
|
|
22241
22248
|
end
|
|
22242
22249
|
end
|
|
22243
22250
|
function ____exports.removeAllPlayerTrinkets(self, player)
|
|
@@ -22245,17 +22252,17 @@ function ____exports.removeAllPlayerTrinkets(self, player)
|
|
|
22245
22252
|
do
|
|
22246
22253
|
local trinketType = player:GetTrinket(trinketSlot)
|
|
22247
22254
|
if trinketType == TrinketType.NULL then
|
|
22248
|
-
goto
|
|
22255
|
+
goto __continue103
|
|
22249
22256
|
end
|
|
22250
|
-
local
|
|
22257
|
+
local alreadyHasTrinket
|
|
22251
22258
|
repeat
|
|
22252
22259
|
do
|
|
22253
22260
|
player:TryRemoveTrinket(trinketType)
|
|
22254
|
-
|
|
22261
|
+
alreadyHasTrinket = player:HasTrinket(trinketType)
|
|
22255
22262
|
end
|
|
22256
|
-
until not
|
|
22263
|
+
until not alreadyHasTrinket
|
|
22257
22264
|
end
|
|
22258
|
-
::
|
|
22265
|
+
::__continue103::
|
|
22259
22266
|
end
|
|
22260
22267
|
end
|
|
22261
22268
|
function ____exports.removeCollectible(self, player, ...)
|
|
@@ -22315,9 +22322,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
22315
22322
|
itemPool:RemoveCollectible(collectibleType)
|
|
22316
22323
|
end
|
|
22317
22324
|
repeat
|
|
22318
|
-
local
|
|
22319
|
-
local
|
|
22320
|
-
if
|
|
22325
|
+
local ____switch125 = activeSlot
|
|
22326
|
+
local ____cond125 = ____switch125 == ActiveSlot.PRIMARY
|
|
22327
|
+
if ____cond125 then
|
|
22321
22328
|
do
|
|
22322
22329
|
if primaryCollectibleType ~= CollectibleType.NULL then
|
|
22323
22330
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -22326,8 +22333,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
22326
22333
|
break
|
|
22327
22334
|
end
|
|
22328
22335
|
end
|
|
22329
|
-
|
|
22330
|
-
if
|
|
22336
|
+
____cond125 = ____cond125 or ____switch125 == ActiveSlot.SECONDARY
|
|
22337
|
+
if ____cond125 then
|
|
22331
22338
|
do
|
|
22332
22339
|
if primaryCollectibleType ~= CollectibleType.NULL then
|
|
22333
22340
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -22342,16 +22349,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
22342
22349
|
break
|
|
22343
22350
|
end
|
|
22344
22351
|
end
|
|
22345
|
-
|
|
22346
|
-
if
|
|
22352
|
+
____cond125 = ____cond125 or ____switch125 == ActiveSlot.POCKET
|
|
22353
|
+
if ____cond125 then
|
|
22347
22354
|
do
|
|
22348
22355
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
22349
22356
|
player:SetActiveCharge(charge, activeSlot)
|
|
22350
22357
|
break
|
|
22351
22358
|
end
|
|
22352
22359
|
end
|
|
22353
|
-
|
|
22354
|
-
if
|
|
22360
|
+
____cond125 = ____cond125 or ____switch125 == ActiveSlot.POCKET_SINGLE_USE
|
|
22361
|
+
if ____cond125 then
|
|
22355
22362
|
do
|
|
22356
22363
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
22357
22364
|
break
|
|
@@ -37325,7 +37332,7 @@ function ____exports.loadFromDisk(self, mod, oldSaveData, classConstructors)
|
|
|
37325
37332
|
end,
|
|
37326
37333
|
SAVE_DATA_MANAGER_DEBUG
|
|
37327
37334
|
)
|
|
37328
|
-
log("The save data manager loaded data from the \"save#.dat\" file.
|
|
37335
|
+
log("The save data manager loaded data from the \"save#.dat\" file for mod: " .. mod.Name)
|
|
37329
37336
|
end
|
|
37330
37337
|
return ____exports
|
|
37331
37338
|
end,
|
|
@@ -37445,7 +37452,7 @@ function ____exports.saveToDisk(self, mod, saveDataMap, saveDataConditionalFuncM
|
|
|
37445
37452
|
local allSaveData = getAllSaveDataToWriteToDisk(nil, saveDataMap, saveDataConditionalFuncMap)
|
|
37446
37453
|
local jsonString = jsonEncode(nil, allSaveData)
|
|
37447
37454
|
mod:SaveData(jsonString)
|
|
37448
|
-
log("The save data manager wrote data to the \"save#.dat\" file.
|
|
37455
|
+
log("The save data manager wrote data to the \"save#.dat\" file for mod: " .. mod.Name)
|
|
37449
37456
|
end
|
|
37450
37457
|
return ____exports
|
|
37451
37458
|
end,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadFromDisk.d.ts","sourceRoot":"","sources":["../../../../../../src/classes/features/other/saveDataManager/loadFromDisk.ts"],"names":[],"mappings":";;AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAK3D,wBAAgB,YAAY,CAC1B,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EACrC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAC1C,IAAI,
|
|
1
|
+
{"version":3,"file":"loadFromDisk.d.ts","sourceRoot":"","sources":["../../../../../../src/classes/features/other/saveDataManager/loadFromDisk.ts"],"names":[],"mappings":";;AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAK3D,wBAAgB,YAAY,CAC1B,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EACrC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAC1C,IAAI,CAwDN"}
|
|
@@ -73,6 +73,6 @@ function ____exports.loadFromDisk(self, mod, oldSaveData, classConstructors)
|
|
|
73
73
|
end,
|
|
74
74
|
SAVE_DATA_MANAGER_DEBUG
|
|
75
75
|
)
|
|
76
|
-
log("The save data manager loaded data from the \"save#.dat\" file.
|
|
76
|
+
log("The save data manager loaded data from the \"save#.dat\" file for mod: " .. mod.Name)
|
|
77
77
|
end
|
|
78
78
|
return ____exports
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"saveToDisk.d.ts","sourceRoot":"","sources":["../../../../../../src/classes/features/other/saveDataManager/saveToDisk.ts"],"names":[],"mappings":";;AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAGhE,wBAAgB,UAAU,CACxB,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EACrC,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,GACxD,IAAI,
|
|
1
|
+
{"version":3,"file":"saveToDisk.d.ts","sourceRoot":"","sources":["../../../../../../src/classes/features/other/saveDataManager/saveToDisk.ts"],"names":[],"mappings":";;AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAGhE,wBAAgB,UAAU,CACxB,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EACrC,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,GACxD,IAAI,CAUN"}
|
|
@@ -41,6 +41,6 @@ function ____exports.saveToDisk(self, mod, saveDataMap, saveDataConditionalFuncM
|
|
|
41
41
|
local allSaveData = getAllSaveDataToWriteToDisk(nil, saveDataMap, saveDataConditionalFuncMap)
|
|
42
42
|
local jsonString = jsonEncode(nil, allSaveData)
|
|
43
43
|
mod:SaveData(jsonString)
|
|
44
|
-
log("The save data manager wrote data to the \"save#.dat\" file.
|
|
44
|
+
log("The save data manager wrote data to the \"save#.dat\" file for mod: " .. mod.Name)
|
|
45
45
|
end
|
|
46
46
|
return ____exports
|
|
@@ -8,9 +8,30 @@ import { Direction } from "isaac-typescript-definitions";
|
|
|
8
8
|
* works.)
|
|
9
9
|
*/
|
|
10
10
|
export declare function angleToDirection(angleDegrees: int): Direction;
|
|
11
|
+
/**
|
|
12
|
+
* Helper function to convert a direction to degrees. For example, `Direction.LEFT` (0) would return
|
|
13
|
+
* 180 and `Direction.RIGHT` (2) would return 0. (This corresponds to how the
|
|
14
|
+
* `Vector.GetAngleDegrees` method works.)
|
|
15
|
+
*/
|
|
11
16
|
export declare function directionToDegrees(direction: Direction): int;
|
|
17
|
+
/**
|
|
18
|
+
* Helper function to convert a direction to a shoot `ButtonAction`. For example, `Direction.LEFT`
|
|
19
|
+
* (0) would return `ButtonAction.LEFT` (0).
|
|
20
|
+
*/
|
|
12
21
|
export declare function directionToMoveAction(direction: Direction): ButtonAction | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Helper function to convert a direction to a shoot `ButtonAction`. For example, `Direction.LEFT`
|
|
24
|
+
* (0) would return `ButtonAction.SHOOT_LEFT` (4).
|
|
25
|
+
*/
|
|
13
26
|
export declare function directionToShootAction(direction: Direction): ButtonAction | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Helper function to convert a direction to a `Vector`. For example, `Direction.LEFT` (0) would
|
|
29
|
+
* convert to `Vector(-1, 0).
|
|
30
|
+
*/
|
|
14
31
|
export declare function directionToVector(direction: Direction): Readonly<Vector>;
|
|
32
|
+
/**
|
|
33
|
+
* Helper function to get the lowercase name of a direction. For example, `Direction.LEFT` (0) would
|
|
34
|
+
* return "left".
|
|
35
|
+
*/
|
|
15
36
|
export declare function getDirectionName(direction: Direction): string | undefined;
|
|
16
37
|
//# sourceMappingURL=direction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"direction.d.ts","sourceRoot":"","sources":["../../../src/functions/direction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAOzD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,GAAG,GAAG,SAAS,CAwB7D;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,GAAG,GAAG,CAE5D;AAED,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,SAAS,GACnB,YAAY,GAAG,SAAS,CAE1B;AAED,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,SAAS,GACnB,YAAY,GAAG,SAAS,CAE1B;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,CAExE;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAEzE"}
|
|
1
|
+
{"version":3,"file":"direction.d.ts","sourceRoot":"","sources":["../../../src/functions/direction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAOzD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,GAAG,GAAG,SAAS,CAwB7D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,GAAG,GAAG,CAE5D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,SAAS,GACnB,YAAY,GAAG,SAAS,CAE1B;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,SAAS,GACnB,YAAY,GAAG,SAAS,CAE1B;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,CAExE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAEzE"}
|
|
@@ -36,18 +36,29 @@ function ____exports.angleToDirection(self, angleDegrees)
|
|
|
36
36
|
end
|
|
37
37
|
return Direction.RIGHT
|
|
38
38
|
end
|
|
39
|
+
--- Helper function to convert a direction to degrees. For example, `Direction.LEFT` (0) would return
|
|
40
|
+
-- 180 and `Direction.RIGHT` (2) would return 0. (This corresponds to how the
|
|
41
|
+
-- `Vector.GetAngleDegrees` method works.)
|
|
39
42
|
function ____exports.directionToDegrees(self, direction)
|
|
40
43
|
return DIRECTION_TO_DEGREES[direction]
|
|
41
44
|
end
|
|
45
|
+
--- Helper function to convert a direction to a shoot `ButtonAction`. For example, `Direction.LEFT`
|
|
46
|
+
-- (0) would return `ButtonAction.LEFT` (0).
|
|
42
47
|
function ____exports.directionToMoveAction(self, direction)
|
|
43
48
|
return DIRECTION_TO_MOVE_ACTION[direction]
|
|
44
49
|
end
|
|
50
|
+
--- Helper function to convert a direction to a shoot `ButtonAction`. For example, `Direction.LEFT`
|
|
51
|
+
-- (0) would return `ButtonAction.SHOOT_LEFT` (4).
|
|
45
52
|
function ____exports.directionToShootAction(self, direction)
|
|
46
53
|
return DIRECTION_TO_SHOOT_ACTION[direction]
|
|
47
54
|
end
|
|
55
|
+
--- Helper function to convert a direction to a `Vector`. For example, `Direction.LEFT` (0) would
|
|
56
|
+
-- convert to `Vector(-1, 0).
|
|
48
57
|
function ____exports.directionToVector(self, direction)
|
|
49
58
|
return DIRECTION_TO_VECTOR[direction]
|
|
50
59
|
end
|
|
60
|
+
--- Helper function to get the lowercase name of a direction. For example, `Direction.LEFT` (0) would
|
|
61
|
+
-- return "left".
|
|
51
62
|
function ____exports.getDirectionName(self, direction)
|
|
52
63
|
return DIRECTION_NAMES[direction]
|
|
53
64
|
end
|
|
@@ -229,6 +229,15 @@ export declare function hasPiercing(player: EntityPlayer): boolean;
|
|
|
229
229
|
* Under the hood, this checks the `EntityPlayer.TearFlags` variable.
|
|
230
230
|
*/
|
|
231
231
|
export declare function hasSpectral(player: EntityPlayer): boolean;
|
|
232
|
+
/**
|
|
233
|
+
* Helper function to check to see if a player has one or more trinkets.
|
|
234
|
+
*
|
|
235
|
+
* This function is variadic, meaning that you can supply as many trinket types as you want to check
|
|
236
|
+
* for. Returns true if the player has any of the supplied trinket types.
|
|
237
|
+
*
|
|
238
|
+
* This function always passes `false` to the `ignoreModifiers` argument.
|
|
239
|
+
*/
|
|
240
|
+
export declare function hasTrinket(player: EntityPlayer, ...trinketTypes: TrinketType[]): boolean;
|
|
232
241
|
/**
|
|
233
242
|
* Helper function to check if the active slot of a particular player is empty.
|
|
234
243
|
*
|
|
@@ -293,8 +302,8 @@ export declare function removeAllActiveItems(player: EntityPlayer): void;
|
|
|
293
302
|
/**
|
|
294
303
|
* Helper function to remove all of the held trinkets from a player.
|
|
295
304
|
*
|
|
296
|
-
* This will not remove any smelted trinkets, unless the player happens to be holding a trinket
|
|
297
|
-
* they
|
|
305
|
+
* This will not remove any smelted trinkets, unless the player happens to also be holding a trinket
|
|
306
|
+
* that they have smelted. (In that case, both the held and the smelted trinket will be removed.)
|
|
298
307
|
*/
|
|
299
308
|
export declare function removeAllPlayerTrinkets(player: EntityPlayer): void;
|
|
300
309
|
/**
|
|
@@ -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,EAEV,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAmBtC;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,MAA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AC3B,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,EAEf,UAAU,EACV,UAAU,EAEV,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAmBtC;;;;;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;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,eAAe,EAAE,eAAe,EAChC,eAAe,CAAC,EAAE,OAAO,GACxB,OAAO,CAMT;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,WAAW,EACxB,eAAe,CAAC,EAAE,OAAO,GACxB,OAAO,CAMT;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAG9C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,kBAAkB,EAAE,UAAU,EAAE,GAAG,OAAO,CAKxE;AAED;;;;;;;;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G,OAAO,CAG7D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAa/D;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAalE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,IAAI,CAIN;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"}
|
|
@@ -481,6 +481,19 @@ end
|
|
|
481
481
|
function ____exports.hasSpectral(self, player)
|
|
482
482
|
return hasFlag(nil, player.TearFlags, TearFlag.SPECTRAL)
|
|
483
483
|
end
|
|
484
|
+
--- Helper function to check to see if a player has one or more trinkets.
|
|
485
|
+
--
|
|
486
|
+
-- This function is variadic, meaning that you can supply as many trinket types as you want to check
|
|
487
|
+
-- for. Returns true if the player has any of the supplied trinket types.
|
|
488
|
+
--
|
|
489
|
+
-- This function always passes `false` to the `ignoreModifiers` argument.
|
|
490
|
+
function ____exports.hasTrinket(self, player, ...)
|
|
491
|
+
local trinketTypes = {...}
|
|
492
|
+
return __TS__ArraySome(
|
|
493
|
+
trinketTypes,
|
|
494
|
+
function(____, trinketType) return player:HasTrinket(trinketType) end
|
|
495
|
+
)
|
|
496
|
+
end
|
|
484
497
|
--- Helper function to check if the active slot of a particular player is empty.
|
|
485
498
|
--
|
|
486
499
|
-- @param player The player to check.
|
|
@@ -571,7 +584,7 @@ function ____exports.removeAllActiveItems(self, player)
|
|
|
571
584
|
do
|
|
572
585
|
local collectibleType = player:GetActiveItem(activeSlot)
|
|
573
586
|
if collectibleType == CollectibleType.NULL then
|
|
574
|
-
goto
|
|
587
|
+
goto __continue98
|
|
575
588
|
end
|
|
576
589
|
local stillHasCollectible
|
|
577
590
|
repeat
|
|
@@ -581,29 +594,29 @@ function ____exports.removeAllActiveItems(self, player)
|
|
|
581
594
|
end
|
|
582
595
|
until not stillHasCollectible
|
|
583
596
|
end
|
|
584
|
-
::
|
|
597
|
+
::__continue98::
|
|
585
598
|
end
|
|
586
599
|
end
|
|
587
600
|
--- Helper function to remove all of the held trinkets from a player.
|
|
588
601
|
--
|
|
589
|
-
-- This will not remove any smelted trinkets, unless the player happens to be holding a trinket
|
|
590
|
-
-- they
|
|
602
|
+
-- This will not remove any smelted trinkets, unless the player happens to also be holding a trinket
|
|
603
|
+
-- that they have smelted. (In that case, both the held and the smelted trinket will be removed.)
|
|
591
604
|
function ____exports.removeAllPlayerTrinkets(self, player)
|
|
592
605
|
for ____, trinketSlot in ipairs(TRINKET_SLOT_VALUES) do
|
|
593
606
|
do
|
|
594
607
|
local trinketType = player:GetTrinket(trinketSlot)
|
|
595
608
|
if trinketType == TrinketType.NULL then
|
|
596
|
-
goto
|
|
609
|
+
goto __continue103
|
|
597
610
|
end
|
|
598
|
-
local
|
|
611
|
+
local alreadyHasTrinket
|
|
599
612
|
repeat
|
|
600
613
|
do
|
|
601
614
|
player:TryRemoveTrinket(trinketType)
|
|
602
|
-
|
|
615
|
+
alreadyHasTrinket = player:HasTrinket(trinketType)
|
|
603
616
|
end
|
|
604
|
-
until not
|
|
617
|
+
until not alreadyHasTrinket
|
|
605
618
|
end
|
|
606
|
-
::
|
|
619
|
+
::__continue103::
|
|
607
620
|
end
|
|
608
621
|
end
|
|
609
622
|
--- Helper function to remove one or more collectibles to a player.
|
|
@@ -694,9 +707,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
694
707
|
itemPool:RemoveCollectible(collectibleType)
|
|
695
708
|
end
|
|
696
709
|
repeat
|
|
697
|
-
local
|
|
698
|
-
local
|
|
699
|
-
if
|
|
710
|
+
local ____switch125 = activeSlot
|
|
711
|
+
local ____cond125 = ____switch125 == ActiveSlot.PRIMARY
|
|
712
|
+
if ____cond125 then
|
|
700
713
|
do
|
|
701
714
|
if primaryCollectibleType ~= CollectibleType.NULL then
|
|
702
715
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -705,8 +718,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
705
718
|
break
|
|
706
719
|
end
|
|
707
720
|
end
|
|
708
|
-
|
|
709
|
-
if
|
|
721
|
+
____cond125 = ____cond125 or ____switch125 == ActiveSlot.SECONDARY
|
|
722
|
+
if ____cond125 then
|
|
710
723
|
do
|
|
711
724
|
if primaryCollectibleType ~= CollectibleType.NULL then
|
|
712
725
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -721,16 +734,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
721
734
|
break
|
|
722
735
|
end
|
|
723
736
|
end
|
|
724
|
-
|
|
725
|
-
if
|
|
737
|
+
____cond125 = ____cond125 or ____switch125 == ActiveSlot.POCKET
|
|
738
|
+
if ____cond125 then
|
|
726
739
|
do
|
|
727
740
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
728
741
|
player:SetActiveCharge(charge, activeSlot)
|
|
729
742
|
break
|
|
730
743
|
end
|
|
731
744
|
end
|
|
732
|
-
|
|
733
|
-
if
|
|
745
|
+
____cond125 = ____cond125 or ____switch125 == ActiveSlot.POCKET_SINGLE_USE
|
|
746
|
+
if ____cond125 then
|
|
734
747
|
do
|
|
735
748
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
736
749
|
break
|
package/package.json
CHANGED
|
@@ -463,7 +463,7 @@ export class SaveDataManager extends Feature {
|
|
|
463
463
|
for (const tstlClass of tstlClasses) {
|
|
464
464
|
const { name } = tstlClass;
|
|
465
465
|
assertDefined(
|
|
466
|
-
// Since we are accepting untrusted user input, this might
|
|
466
|
+
// Since we are accepting untrusted user input, this might not be a real TSTL class.
|
|
467
467
|
name as string | undefined,
|
|
468
468
|
"Failed to register a class with the save data manager due to not being able to derive the name of the class.",
|
|
469
469
|
);
|
|
@@ -67,7 +67,9 @@ export function loadFromDisk(
|
|
|
67
67
|
SAVE_DATA_MANAGER_DEBUG,
|
|
68
68
|
);
|
|
69
69
|
|
|
70
|
-
log(
|
|
70
|
+
log(
|
|
71
|
+
`The save data manager loaded data from the "save#.dat" file for mod: ${mod.Name}`,
|
|
72
|
+
);
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
function readSaveDatFile(mod: Mod) {
|
|
@@ -17,7 +17,9 @@ export function saveToDisk(
|
|
|
17
17
|
);
|
|
18
18
|
const jsonString = jsonEncode(allSaveData);
|
|
19
19
|
mod.SaveData(jsonString);
|
|
20
|
-
log(
|
|
20
|
+
log(
|
|
21
|
+
`The save data manager wrote data to the "save#.dat" file for mod: ${mod.Name}`,
|
|
22
|
+
);
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
function getAllSaveDataToWriteToDisk(
|
|
@@ -39,26 +39,47 @@ export function angleToDirection(angleDegrees: int): Direction {
|
|
|
39
39
|
return Direction.RIGHT;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Helper function to convert a direction to degrees. For example, `Direction.LEFT` (0) would return
|
|
44
|
+
* 180 and `Direction.RIGHT` (2) would return 0. (This corresponds to how the
|
|
45
|
+
* `Vector.GetAngleDegrees` method works.)
|
|
46
|
+
*/
|
|
42
47
|
export function directionToDegrees(direction: Direction): int {
|
|
43
48
|
return DIRECTION_TO_DEGREES[direction];
|
|
44
49
|
}
|
|
45
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Helper function to convert a direction to a shoot `ButtonAction`. For example, `Direction.LEFT`
|
|
53
|
+
* (0) would return `ButtonAction.LEFT` (0).
|
|
54
|
+
*/
|
|
46
55
|
export function directionToMoveAction(
|
|
47
56
|
direction: Direction,
|
|
48
57
|
): ButtonAction | undefined {
|
|
49
58
|
return DIRECTION_TO_MOVE_ACTION[direction];
|
|
50
59
|
}
|
|
51
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Helper function to convert a direction to a shoot `ButtonAction`. For example, `Direction.LEFT`
|
|
63
|
+
* (0) would return `ButtonAction.SHOOT_LEFT` (4).
|
|
64
|
+
*/
|
|
52
65
|
export function directionToShootAction(
|
|
53
66
|
direction: Direction,
|
|
54
67
|
): ButtonAction | undefined {
|
|
55
68
|
return DIRECTION_TO_SHOOT_ACTION[direction];
|
|
56
69
|
}
|
|
57
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Helper function to convert a direction to a `Vector`. For example, `Direction.LEFT` (0) would
|
|
73
|
+
* convert to `Vector(-1, 0).
|
|
74
|
+
*/
|
|
58
75
|
export function directionToVector(direction: Direction): Readonly<Vector> {
|
|
59
76
|
return DIRECTION_TO_VECTOR[direction];
|
|
60
77
|
}
|
|
61
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Helper function to get the lowercase name of a direction. For example, `Direction.LEFT` (0) would
|
|
81
|
+
* return "left".
|
|
82
|
+
*/
|
|
62
83
|
export function getDirectionName(direction: Direction): string | undefined {
|
|
63
84
|
return DIRECTION_NAMES[direction];
|
|
64
85
|
}
|
package/src/functions/players.ts
CHANGED
|
@@ -599,6 +599,21 @@ export function hasSpectral(player: EntityPlayer): boolean {
|
|
|
599
599
|
return hasFlag(player.TearFlags, TearFlag.SPECTRAL);
|
|
600
600
|
}
|
|
601
601
|
|
|
602
|
+
/**
|
|
603
|
+
* Helper function to check to see if a player has one or more trinkets.
|
|
604
|
+
*
|
|
605
|
+
* This function is variadic, meaning that you can supply as many trinket types as you want to check
|
|
606
|
+
* for. Returns true if the player has any of the supplied trinket types.
|
|
607
|
+
*
|
|
608
|
+
* This function always passes `false` to the `ignoreModifiers` argument.
|
|
609
|
+
*/
|
|
610
|
+
export function hasTrinket(
|
|
611
|
+
player: EntityPlayer,
|
|
612
|
+
...trinketTypes: TrinketType[]
|
|
613
|
+
): boolean {
|
|
614
|
+
return trinketTypes.some((trinketType) => player.HasTrinket(trinketType));
|
|
615
|
+
}
|
|
616
|
+
|
|
602
617
|
/**
|
|
603
618
|
* Helper function to check if the active slot of a particular player is empty.
|
|
604
619
|
*
|
|
@@ -760,8 +775,8 @@ export function removeAllActiveItems(player: EntityPlayer): void {
|
|
|
760
775
|
/**
|
|
761
776
|
* Helper function to remove all of the held trinkets from a player.
|
|
762
777
|
*
|
|
763
|
-
* This will not remove any smelted trinkets, unless the player happens to be holding a trinket
|
|
764
|
-
* they
|
|
778
|
+
* This will not remove any smelted trinkets, unless the player happens to also be holding a trinket
|
|
779
|
+
* that they have smelted. (In that case, both the held and the smelted trinket will be removed.)
|
|
765
780
|
*/
|
|
766
781
|
export function removeAllPlayerTrinkets(player: EntityPlayer): void {
|
|
767
782
|
for (const trinketSlot of TRINKET_SLOT_VALUES) {
|
|
@@ -770,11 +785,11 @@ export function removeAllPlayerTrinkets(player: EntityPlayer): void {
|
|
|
770
785
|
continue;
|
|
771
786
|
}
|
|
772
787
|
|
|
773
|
-
let
|
|
788
|
+
let alreadyHasTrinket: boolean;
|
|
774
789
|
do {
|
|
775
790
|
player.TryRemoveTrinket(trinketType);
|
|
776
|
-
|
|
777
|
-
} while (
|
|
791
|
+
alreadyHasTrinket = player.HasTrinket(trinketType);
|
|
792
|
+
} while (alreadyHasTrinket);
|
|
778
793
|
}
|
|
779
794
|
}
|
|
780
795
|
|