isaacscript-common 1.2.23 → 1.2.27
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/features/runInNFrames.d.ts +29 -9
- package/dist/features/runInNFrames.lua +41 -16
- package/dist/features/sirenHelpers.lua +11 -11
- package/dist/functions/collectibleCacheFlag.d.ts +16 -0
- package/dist/functions/collectibleCacheFlag.lua +17 -0
- package/dist/functions/flying.d.ts +1 -0
- package/dist/functions/flying.lua +18 -0
- package/dist/functions/player.d.ts +0 -16
- package/dist/functions/player.lua +30 -47
- package/dist/functions/transformations.d.ts +1 -1
- package/dist/functions/transformations.lua +4 -4
- package/dist/functions/trinketCacheFlag.d.ts +5 -0
- package/dist/functions/trinketCacheFlag.lua +12 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.lua +8 -4
- package/package.json +2 -2
|
@@ -1,4 +1,26 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/**
|
|
3
|
+
* Supply a function to run N game frames from now in the PostUpdate callback.
|
|
4
|
+
*
|
|
5
|
+
* For a usage example, see the documentation for the `runNextGameFrame`, which is used in a similar
|
|
6
|
+
* way.
|
|
7
|
+
*
|
|
8
|
+
* Note that this function will not handle saving and quitting. If a player saving and quitting
|
|
9
|
+
* before the deferred function fires would cause a bug in your mod, then you should handle deferred
|
|
10
|
+
* functions manually using serializable data.
|
|
11
|
+
*/
|
|
12
|
+
export declare function runInNGameFrames(func: () => void, frames: int): void;
|
|
13
|
+
/**
|
|
14
|
+
* Supply a function to run N render frames from now in the PostRender callback.
|
|
15
|
+
*
|
|
16
|
+
* For a usage example, see the documentation for the `runNextGameFrame`, which is used in a similar
|
|
17
|
+
* way.
|
|
18
|
+
*
|
|
19
|
+
* Note that this function will not handle saving and quitting. If a player saving and quitting
|
|
20
|
+
* before the deferred function fires would cause a bug in your mod, then you should handle deferred
|
|
21
|
+
* functions manually using serializable data.
|
|
22
|
+
*/
|
|
23
|
+
export declare function runInNRenderFrames(func: () => void, frames: int): void;
|
|
2
24
|
/**
|
|
3
25
|
* Supply a function to run on the next PostUpdate callback.
|
|
4
26
|
*
|
|
@@ -22,19 +44,17 @@
|
|
|
22
44
|
* }
|
|
23
45
|
* ```
|
|
24
46
|
*
|
|
25
|
-
* Note that this function will not handle saving and quitting
|
|
26
|
-
* before the
|
|
47
|
+
* Note that this function will not handle saving and quitting. If a player saving and quitting
|
|
48
|
+
* before the deferred function fires would cause a bug in your mod, then you should handle deferred
|
|
27
49
|
* functions manually using serializable data.
|
|
28
50
|
*/
|
|
29
|
-
export declare function
|
|
51
|
+
export declare function runNextGameFrame(func: () => void): void;
|
|
30
52
|
/**
|
|
31
|
-
* Supply a function to run
|
|
53
|
+
* Supply a function to run on the next PostRender callback.
|
|
32
54
|
*
|
|
33
|
-
* For a usage example, see the documentation for the `
|
|
55
|
+
* For a usage example, see the documentation for the `runNextGameFrame`, which is used in a similar
|
|
34
56
|
* way.
|
|
35
57
|
*
|
|
36
|
-
* Note that this function will not handle saving and quitting
|
|
37
|
-
* before the next PostUpdate frame would cause a bug in your mod, then you should handle deferred
|
|
38
|
-
* functions manually using serializable data.
|
|
58
|
+
* Note that this function will not handle saving and quitting.
|
|
39
59
|
*/
|
|
40
|
-
export declare function
|
|
60
|
+
export declare function runNextRenderFrame(func: () => void): void;
|
|
@@ -3,7 +3,7 @@ local ____lualib = require("lualib_bundle")
|
|
|
3
3
|
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
4
4
|
local __TS__ArraySplice = ____lualib.__TS__ArraySplice
|
|
5
5
|
local ____exports = {}
|
|
6
|
-
local postUpdate,
|
|
6
|
+
local postUpdate, postRender, checkExecuteQueuedFunctions, v
|
|
7
7
|
local ____errors = require("errors")
|
|
8
8
|
local getUpgradeErrorMsg = ____errors.getUpgradeErrorMsg
|
|
9
9
|
local ____exports = require("features.saveDataManager.exports")
|
|
@@ -11,14 +11,21 @@ local saveDataManager = ____exports.saveDataManager
|
|
|
11
11
|
function postUpdate(self)
|
|
12
12
|
local game = Game()
|
|
13
13
|
local gameFrameCount = game:GetFrameCount()
|
|
14
|
+
checkExecuteQueuedFunctions(nil, gameFrameCount, v.run.queuedGameFunctionTuples)
|
|
15
|
+
end
|
|
16
|
+
function postRender(self)
|
|
17
|
+
local isaacFrameCount = Isaac.GetFrameCount()
|
|
18
|
+
checkExecuteQueuedFunctions(nil, isaacFrameCount, v.run.queuedRenderFunctionTuples)
|
|
19
|
+
end
|
|
20
|
+
function checkExecuteQueuedFunctions(self, frameCount, functionTuples)
|
|
14
21
|
local functionsToFire = {}
|
|
15
22
|
local indexesToRemove = {}
|
|
16
23
|
do
|
|
17
24
|
local i = 0
|
|
18
|
-
while i < #
|
|
19
|
-
local functionTuple =
|
|
25
|
+
while i < #functionTuples do
|
|
26
|
+
local functionTuple = functionTuples[i + 1]
|
|
20
27
|
local frame, func = table.unpack(functionTuple)
|
|
21
|
-
if
|
|
28
|
+
if frameCount >= frame then
|
|
22
29
|
__TS__ArrayPush(functionsToFire, func)
|
|
23
30
|
__TS__ArrayPush(indexesToRemove, i)
|
|
24
31
|
end
|
|
@@ -26,13 +33,22 @@ function postUpdate(self)
|
|
|
26
33
|
end
|
|
27
34
|
end
|
|
28
35
|
for ____, indexToRemove in ipairs(indexesToRemove) do
|
|
29
|
-
__TS__ArraySplice(
|
|
36
|
+
__TS__ArraySplice(functionTuples, indexToRemove, 1)
|
|
30
37
|
end
|
|
31
38
|
for ____, func in ipairs(functionsToFire) do
|
|
32
39
|
func(nil)
|
|
33
40
|
end
|
|
34
41
|
end
|
|
35
|
-
|
|
42
|
+
local FEATURE_NAME = "run in N frames"
|
|
43
|
+
local initialized = false
|
|
44
|
+
v = {dontSave = true, run = {queuedGameFunctionTuples = {}, queuedRenderFunctionTuples = {}}}
|
|
45
|
+
function ____exports.runInNFramesInit(self, mod)
|
|
46
|
+
initialized = true
|
|
47
|
+
saveDataManager(nil, "runInNFrames", v)
|
|
48
|
+
mod:AddCallback(ModCallbacks.MC_POST_UPDATE, postUpdate)
|
|
49
|
+
mod:AddCallback(ModCallbacks.MC_POST_RENDER, postRender)
|
|
50
|
+
end
|
|
51
|
+
function ____exports.runInNGameFrames(self, func, frames)
|
|
36
52
|
if not initialized then
|
|
37
53
|
local msg = getUpgradeErrorMsg(nil, FEATURE_NAME)
|
|
38
54
|
error(msg)
|
|
@@ -41,21 +57,30 @@ function ____exports.runInNFrames(self, func, frames)
|
|
|
41
57
|
local gameFrameCount = game:GetFrameCount()
|
|
42
58
|
local functionFireFrame = gameFrameCount + frames
|
|
43
59
|
local tuple = {functionFireFrame, func}
|
|
44
|
-
__TS__ArrayPush(v.run.
|
|
60
|
+
__TS__ArrayPush(v.run.queuedGameFunctionTuples, tuple)
|
|
45
61
|
end
|
|
46
|
-
|
|
47
|
-
initialized
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
62
|
+
function ____exports.runInNRenderFrames(self, func, frames)
|
|
63
|
+
if not initialized then
|
|
64
|
+
local msg = getUpgradeErrorMsg(nil, FEATURE_NAME)
|
|
65
|
+
error(msg)
|
|
66
|
+
end
|
|
67
|
+
local isaacFrameCount = Isaac.GetFrameCount()
|
|
68
|
+
local functionFireFrame = isaacFrameCount + frames
|
|
69
|
+
local tuple = {functionFireFrame, func}
|
|
70
|
+
__TS__ArrayPush(v.run.queuedRenderFunctionTuples, tuple)
|
|
71
|
+
end
|
|
72
|
+
function ____exports.runNextGameFrame(self, func)
|
|
73
|
+
if not initialized then
|
|
74
|
+
local msg = getUpgradeErrorMsg(nil, FEATURE_NAME)
|
|
75
|
+
error(msg)
|
|
76
|
+
end
|
|
77
|
+
____exports.runInNGameFrames(nil, func, 1)
|
|
53
78
|
end
|
|
54
|
-
function ____exports.
|
|
79
|
+
function ____exports.runNextRenderFrame(self, func)
|
|
55
80
|
if not initialized then
|
|
56
81
|
local msg = getUpgradeErrorMsg(nil, FEATURE_NAME)
|
|
57
82
|
error(msg)
|
|
58
83
|
end
|
|
59
|
-
____exports.
|
|
84
|
+
____exports.runInNRenderFrames(nil, func, 1)
|
|
60
85
|
end
|
|
61
86
|
return ____exports
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
local ____lualib = require("lualib_bundle")
|
|
3
3
|
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
4
4
|
local ____exports = {}
|
|
5
|
-
local postNPCInitSirenHelper, checkReturnFamiliarToPlayer, blacklistEntryExists, v
|
|
5
|
+
local postNPCInitSirenHelper, checkReturnFamiliarToPlayer, blacklistEntryExists, getSirenHelper, v
|
|
6
6
|
local ____errors = require("errors")
|
|
7
7
|
local getUpgradeErrorMsg = ____errors.getUpgradeErrorMsg
|
|
8
8
|
local ____entity = require("functions.entity")
|
|
@@ -38,6 +38,16 @@ function blacklistEntryExists(self, incomingFamiliarVariant, incomingFamiliarSub
|
|
|
38
38
|
end
|
|
39
39
|
return false
|
|
40
40
|
end
|
|
41
|
+
function getSirenHelper(self, familiar)
|
|
42
|
+
local familiarHash = GetPtrHash(familiar)
|
|
43
|
+
local sirenHelpers = getEntities(nil, EntityType.ENTITY_SIREN_HELPER)
|
|
44
|
+
for ____, sirenHelper in ipairs(sirenHelpers) do
|
|
45
|
+
if sirenHelper.Target ~= nil and GetPtrHash(sirenHelper.Target) == familiarHash then
|
|
46
|
+
return sirenHelper
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
return nil
|
|
50
|
+
end
|
|
41
51
|
local FEATURE_NAME = "siren helpers"
|
|
42
52
|
local initialized = false
|
|
43
53
|
v = {run = {familiarBlacklist = {}}}
|
|
@@ -56,16 +66,6 @@ function ____exports.setFamiliarNoSirenSteal(self, familiarVariant, familiarSubT
|
|
|
56
66
|
end
|
|
57
67
|
__TS__ArrayPush(v.run.familiarBlacklist, {familiarVariant, familiarSubType})
|
|
58
68
|
end
|
|
59
|
-
local function getSirenHelper(self, familiar)
|
|
60
|
-
local familiarHash = GetPtrHash(familiar)
|
|
61
|
-
local sirenHelpers = getEntities(nil, EntityType.ENTITY_SIREN_HELPER)
|
|
62
|
-
for ____, sirenHelper in ipairs(sirenHelpers) do
|
|
63
|
-
if sirenHelper.Target ~= nil and GetPtrHash(sirenHelper.Target) == familiarHash then
|
|
64
|
-
return sirenHelper
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
return nil
|
|
68
|
-
end
|
|
69
69
|
function ____exports.hasSirenStolenFamiliar(self, familiar)
|
|
70
70
|
return getSirenHelper(nil, familiar) ~= nil
|
|
71
71
|
end
|
|
@@ -4,3 +4,19 @@
|
|
|
4
4
|
* collectibles.
|
|
5
5
|
*/
|
|
6
6
|
export declare function getCollectiblesForCacheFlag(cacheFlag: CacheFlag): Set<CollectibleType | int>;
|
|
7
|
+
/**
|
|
8
|
+
* Returns an array containing every collectible type that the player has that matches the provided
|
|
9
|
+
* CacheFlag.
|
|
10
|
+
*
|
|
11
|
+
* For example, if a player has one Lord of the Pit and two Transcendences, then this function would
|
|
12
|
+
* return:
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* [
|
|
16
|
+
* CollectibleType.COLLECTIBLE_LORD_OF_THE_PIT,
|
|
17
|
+
* CollectibleType.COLLECTIBLE_TRANSCENDENCE,
|
|
18
|
+
* CollectibleType.COLLECTIBLE_TRANSCENDENCE,
|
|
19
|
+
* ]
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function getPlayerCollectiblesForCacheFlag(player: EntityPlayer, cacheFlag: CacheFlag): Array<CollectibleType | int>;
|
|
@@ -3,6 +3,8 @@ local ____lualib = require("lualib_bundle")
|
|
|
3
3
|
local Map = ____lualib.Map
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local Set = ____lualib.Set
|
|
6
|
+
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
7
|
+
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
6
8
|
local ____exports = {}
|
|
7
9
|
local ____collectibles = require("functions.collectibles")
|
|
8
10
|
local collectibleHasCacheFlag = ____collectibles.collectibleHasCacheFlag
|
|
@@ -38,4 +40,19 @@ function ____exports.getCollectiblesForCacheFlag(self, cacheFlag)
|
|
|
38
40
|
end
|
|
39
41
|
return copySet(nil, collectiblesSet)
|
|
40
42
|
end
|
|
43
|
+
function ____exports.getPlayerCollectiblesForCacheFlag(self, player, cacheFlag)
|
|
44
|
+
local collectiblesForCacheFlag = ____exports.getCollectiblesForCacheFlag(nil, cacheFlag)
|
|
45
|
+
local playerCollectibles = {}
|
|
46
|
+
for ____, collectibleType in __TS__Iterator(collectiblesForCacheFlag:values()) do
|
|
47
|
+
local numCollectibles = player:GetCollectibleNum(collectibleType)
|
|
48
|
+
do
|
|
49
|
+
local i = 0
|
|
50
|
+
while i < numCollectibles do
|
|
51
|
+
__TS__ArrayPush(playerCollectibles, collectibleType)
|
|
52
|
+
i = i + 1
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
return playerCollectibles
|
|
57
|
+
end
|
|
41
58
|
return ____exports
|
|
@@ -16,3 +16,4 @@ export declare function getFlyingCollectibles(pruneConditionalItems: boolean): S
|
|
|
16
16
|
*/
|
|
17
17
|
export declare function getFlyingTrinkets(): Set<CollectibleType | int>;
|
|
18
18
|
export declare function hasFlyingTemporaryEffect(player: EntityPlayer): boolean;
|
|
19
|
+
export declare function isFlyingCharacter(player: EntityPlayer): boolean;
|
|
@@ -9,7 +9,16 @@ local getCollectiblesForCacheFlag = ____collectibleCacheFlag.getCollectiblesForC
|
|
|
9
9
|
local ____set = require("functions.set")
|
|
10
10
|
local copySet = ____set.copySet
|
|
11
11
|
local deleteSetsFromSet = ____set.deleteSetsFromSet
|
|
12
|
+
local FLYING_CHARACTERS = __TS__New(Set, {
|
|
13
|
+
PlayerType.PLAYER_AZAZEL,
|
|
14
|
+
PlayerType.PLAYER_THELOST,
|
|
15
|
+
PlayerType.PLAYER_THESOUL,
|
|
16
|
+
PlayerType.PLAYER_THELOST_B,
|
|
17
|
+
PlayerType.PLAYER_JACOB2_B,
|
|
18
|
+
PlayerType.PLAYER_THESOUL_B
|
|
19
|
+
})
|
|
12
20
|
local FLYING_TRINKETS = __TS__New(Set, {TrinketType.TRINKET_BAT_WING, TrinketType.TRINKET_AZAZELS_STUMP})
|
|
21
|
+
local FLYING_NULL_ITEMS = {NullItemID.ID_REVERSE_SUN, NullItemID.ID_SPIRIT_SHACKLES_SOUL}
|
|
13
22
|
function ____exports.getFlyingCollectibles(self, pruneConditionalItems)
|
|
14
23
|
local collectiblesWithFlyingCacheFlag = getCollectiblesForCacheFlag(nil, CacheFlag.CACHE_FLYING)
|
|
15
24
|
local collectiblesWithAllCacheFlag = getCollectiblesForCacheFlag(nil, CacheFlag.CACHE_ALL)
|
|
@@ -39,6 +48,15 @@ function ____exports.hasFlyingTemporaryEffect(self, player)
|
|
|
39
48
|
return true
|
|
40
49
|
end
|
|
41
50
|
end
|
|
51
|
+
for ____, nullItemID in ipairs(FLYING_NULL_ITEMS) do
|
|
52
|
+
if effects:HasNullEffect(nullItemID) then
|
|
53
|
+
return true
|
|
54
|
+
end
|
|
55
|
+
end
|
|
42
56
|
return false
|
|
43
57
|
end
|
|
58
|
+
function ____exports.isFlyingCharacter(self, player)
|
|
59
|
+
local character = player:GetPlayerType()
|
|
60
|
+
return FLYING_CHARACTERS:has(character)
|
|
61
|
+
end
|
|
44
62
|
return ____exports
|
|
@@ -81,22 +81,6 @@ export declare function getNewestPlayer(): EntityPlayer;
|
|
|
81
81
|
* hearts and 3 broken hearts, then this function would return 6 (i.e. 12 - 1 - 2 - 3).
|
|
82
82
|
*/
|
|
83
83
|
export declare function getPlayerAvailableHeartSlots(player: EntityPlayer): int;
|
|
84
|
-
/**
|
|
85
|
-
* Returns an array containing every collectible type that the player has that matches the provided
|
|
86
|
-
* CacheFlag.
|
|
87
|
-
*
|
|
88
|
-
* For example, if a player has one Lord of the Pit and two Transcendences, then this function would
|
|
89
|
-
* return:
|
|
90
|
-
*
|
|
91
|
-
* ```ts
|
|
92
|
-
* [
|
|
93
|
-
* CollectibleType.COLLECTIBLE_LORD_OF_THE_PIT,
|
|
94
|
-
* CollectibleType.COLLECTIBLE_TRANSCENDENCE,
|
|
95
|
-
* CollectibleType.COLLECTIBLE_TRANSCENDENCE,
|
|
96
|
-
* ]
|
|
97
|
-
* ```
|
|
98
|
-
*/
|
|
99
|
-
export declare function getPlayerCollectiblesForCacheFlag(player: EntityPlayer, cacheFlag: CacheFlag): Array<CollectibleType | int>;
|
|
100
84
|
/**
|
|
101
85
|
* Returns the maximum heart containers that the provided character can have. Normally, this is 12,
|
|
102
86
|
* but with Keeper it is 3, with Tainted Keeper it is 2. Does not account for Birthright or Mother's
|
|
@@ -3,10 +3,10 @@ local ____lualib = require("lualib_bundle")
|
|
|
3
3
|
local Set = ____lualib.Set
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
6
|
-
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
7
|
-
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
8
6
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
9
7
|
local Map = ____lualib.Map
|
|
8
|
+
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
9
|
+
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
10
10
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
11
11
|
local ____exports = {}
|
|
12
12
|
local getAdjustedPlayerName, isTaintedModded, EXCLUDED_CHARACTERS
|
|
@@ -25,8 +25,6 @@ local arraySum = ____array.arraySum
|
|
|
25
25
|
local ____bitwise = require("functions.bitwise")
|
|
26
26
|
local getKBitOfN = ____bitwise.getKBitOfN
|
|
27
27
|
local getNumBitsOfN = ____bitwise.getNumBitsOfN
|
|
28
|
-
local ____collectibleCacheFlag = require("functions.collectibleCacheFlag")
|
|
29
|
-
local getCollectiblesForCacheFlag = ____collectibleCacheFlag.getCollectiblesForCacheFlag
|
|
30
28
|
local ____collectibles = require("functions.collectibles")
|
|
31
29
|
local getCollectibleMaxCharges = ____collectibles.getCollectibleMaxCharges
|
|
32
30
|
local ____collectibleSet = require("functions.collectibleSet")
|
|
@@ -74,39 +72,39 @@ end
|
|
|
74
72
|
function getAdjustedPlayerName(self, player)
|
|
75
73
|
local character = player:GetPlayerType()
|
|
76
74
|
repeat
|
|
77
|
-
local
|
|
78
|
-
local
|
|
79
|
-
if
|
|
75
|
+
local ____switch71 = character
|
|
76
|
+
local ____cond71 = ____switch71 == PlayerType.PLAYER_BLUEBABY or ____switch71 == PlayerType.PLAYER_BLUEBABY_B
|
|
77
|
+
if ____cond71 then
|
|
80
78
|
do
|
|
81
79
|
return "Blue Baby"
|
|
82
80
|
end
|
|
83
81
|
end
|
|
84
|
-
|
|
85
|
-
if
|
|
82
|
+
____cond71 = ____cond71 or ____switch71 == PlayerType.PLAYER_LAZARUS2
|
|
83
|
+
if ____cond71 then
|
|
86
84
|
do
|
|
87
85
|
return "Lazarus II"
|
|
88
86
|
end
|
|
89
87
|
end
|
|
90
|
-
|
|
91
|
-
if
|
|
88
|
+
____cond71 = ____cond71 or ____switch71 == PlayerType.PLAYER_BLACKJUDAS
|
|
89
|
+
if ____cond71 then
|
|
92
90
|
do
|
|
93
91
|
return "Dark Judas"
|
|
94
92
|
end
|
|
95
93
|
end
|
|
96
|
-
|
|
97
|
-
if
|
|
94
|
+
____cond71 = ____cond71 or ____switch71 == PlayerType.PLAYER_JACOB
|
|
95
|
+
if ____cond71 then
|
|
98
96
|
do
|
|
99
97
|
return "Jacob & Esau"
|
|
100
98
|
end
|
|
101
99
|
end
|
|
102
|
-
|
|
103
|
-
if
|
|
100
|
+
____cond71 = ____cond71 or ____switch71 == PlayerType.PLAYER_LAZARUS2_B
|
|
101
|
+
if ____cond71 then
|
|
104
102
|
do
|
|
105
103
|
return "Dead Tainted Lazarus"
|
|
106
104
|
end
|
|
107
105
|
end
|
|
108
|
-
|
|
109
|
-
if
|
|
106
|
+
____cond71 = ____cond71 or ____switch71 == PlayerType.PLAYER_JACOB2_B
|
|
107
|
+
if ____cond71 then
|
|
110
108
|
do
|
|
111
109
|
return "Dead Tainted Jacob"
|
|
112
110
|
end
|
|
@@ -130,18 +128,18 @@ function ____exports.getPlayers(self, performExclusions)
|
|
|
130
128
|
do
|
|
131
129
|
local player = Isaac.GetPlayer(i)
|
|
132
130
|
if player == nil then
|
|
133
|
-
goto
|
|
131
|
+
goto __continue81
|
|
134
132
|
end
|
|
135
133
|
if ____exports.isChildPlayer(nil, player) then
|
|
136
|
-
goto
|
|
134
|
+
goto __continue81
|
|
137
135
|
end
|
|
138
136
|
local character = player:GetPlayerType()
|
|
139
137
|
if performExclusions and EXCLUDED_CHARACTERS:has(character) then
|
|
140
|
-
goto
|
|
138
|
+
goto __continue81
|
|
141
139
|
end
|
|
142
140
|
__TS__ArrayPush(players, player)
|
|
143
141
|
end
|
|
144
|
-
::
|
|
142
|
+
::__continue81::
|
|
145
143
|
i = i + 1
|
|
146
144
|
end
|
|
147
145
|
end
|
|
@@ -332,21 +330,6 @@ function ____exports.getPlayerAvailableHeartSlots(self, player)
|
|
|
332
330
|
local totalOccupiedHeartSlots = totalHeartContainers + brokenHearts
|
|
333
331
|
return maxHeartContainers - totalOccupiedHeartSlots
|
|
334
332
|
end
|
|
335
|
-
function ____exports.getPlayerCollectiblesForCacheFlag(self, player, cacheFlag)
|
|
336
|
-
local collectiblesForCacheFlag = getCollectiblesForCacheFlag(nil, cacheFlag)
|
|
337
|
-
local playerCollectibles = {}
|
|
338
|
-
for ____, collectibleType in __TS__Iterator(collectiblesForCacheFlag:values()) do
|
|
339
|
-
local numCollectibles = player:GetCollectibleNum(collectibleType)
|
|
340
|
-
do
|
|
341
|
-
local i = 0
|
|
342
|
-
while i < numCollectibles do
|
|
343
|
-
__TS__ArrayPush(playerCollectibles, collectibleType)
|
|
344
|
-
i = i + 1
|
|
345
|
-
end
|
|
346
|
-
end
|
|
347
|
-
end
|
|
348
|
-
return playerCollectibles
|
|
349
|
-
end
|
|
350
333
|
function ____exports.getPlayerCloserThan(self, position, distance)
|
|
351
334
|
for ____, player in ipairs(____exports.getPlayers(nil)) do
|
|
352
335
|
if player.Position:Distance(position) <= distance then
|
|
@@ -384,14 +367,14 @@ function ____exports.getPlayerIndexVanilla(self, playerToFind)
|
|
|
384
367
|
do
|
|
385
368
|
local player = Isaac.GetPlayer(i)
|
|
386
369
|
if player == nil then
|
|
387
|
-
goto
|
|
370
|
+
goto __continue62
|
|
388
371
|
end
|
|
389
372
|
local playerHash = GetPtrHash(player)
|
|
390
373
|
if playerHash == playerToFindHash then
|
|
391
374
|
return i
|
|
392
375
|
end
|
|
393
376
|
end
|
|
394
|
-
::
|
|
377
|
+
::__continue62::
|
|
395
378
|
i = i + 1
|
|
396
379
|
end
|
|
397
380
|
end
|
|
@@ -561,9 +544,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
561
544
|
itemPool:RemoveCollectible(collectibleType)
|
|
562
545
|
end
|
|
563
546
|
repeat
|
|
564
|
-
local
|
|
565
|
-
local
|
|
566
|
-
if
|
|
547
|
+
local ____switch124 = activeSlot
|
|
548
|
+
local ____cond124 = ____switch124 == ActiveSlot.SLOT_PRIMARY
|
|
549
|
+
if ____cond124 then
|
|
567
550
|
do
|
|
568
551
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
569
552
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -572,8 +555,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
572
555
|
break
|
|
573
556
|
end
|
|
574
557
|
end
|
|
575
|
-
|
|
576
|
-
if
|
|
558
|
+
____cond124 = ____cond124 or ____switch124 == ActiveSlot.SLOT_SECONDARY
|
|
559
|
+
if ____cond124 then
|
|
577
560
|
do
|
|
578
561
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
579
562
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -588,16 +571,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
588
571
|
break
|
|
589
572
|
end
|
|
590
573
|
end
|
|
591
|
-
|
|
592
|
-
if
|
|
574
|
+
____cond124 = ____cond124 or ____switch124 == ActiveSlot.SLOT_POCKET
|
|
575
|
+
if ____cond124 then
|
|
593
576
|
do
|
|
594
577
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
595
578
|
player:SetActiveCharge(charge, activeSlot)
|
|
596
579
|
break
|
|
597
580
|
end
|
|
598
581
|
end
|
|
599
|
-
|
|
600
|
-
if
|
|
582
|
+
____cond124 = ____cond124 or ____switch124 == ActiveSlot.SLOT_POCKET2
|
|
583
|
+
if ____cond124 then
|
|
601
584
|
do
|
|
602
585
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
603
586
|
break
|
|
@@ -13,5 +13,5 @@ export declare function getPlayerNumTransformationCollectibles(player: EntityPla
|
|
|
13
13
|
*/
|
|
14
14
|
export declare function getTransformationName(playerForm: PlayerForm): string;
|
|
15
15
|
export declare function getTransformationsForCollectibleType(collectibleType: CollectibleType | int): Set<PlayerForm>;
|
|
16
|
+
export declare function hasFlyingTransformation(player: EntityPlayer): boolean;
|
|
16
17
|
export declare function isTransformationFlying(playerForm: PlayerForm): boolean;
|
|
17
|
-
export declare function playerHasFlyingTransformation(player: EntityPlayer): boolean;
|
|
@@ -102,10 +102,7 @@ function ____exports.getTransformationsForCollectibleType(self, collectibleType)
|
|
|
102
102
|
local transformations = COLLECTIBLE_TYPE_TO_TRANSFORMATION_MAP:get(collectibleType)
|
|
103
103
|
return transformations == nil and __TS__New(Set) or copySet(nil, transformations)
|
|
104
104
|
end
|
|
105
|
-
function ____exports.
|
|
106
|
-
return TRANSFORMATIONS_THAT_GRANT_FLYING:has(playerForm)
|
|
107
|
-
end
|
|
108
|
-
function ____exports.playerHasFlyingTransformation(self, player)
|
|
105
|
+
function ____exports.hasFlyingTransformation(self, player)
|
|
109
106
|
for ____, playerForm in __TS__Iterator(TRANSFORMATIONS_THAT_GRANT_FLYING:values()) do
|
|
110
107
|
if player:HasPlayerForm(playerForm) then
|
|
111
108
|
return true
|
|
@@ -113,4 +110,7 @@ function ____exports.playerHasFlyingTransformation(self, player)
|
|
|
113
110
|
end
|
|
114
111
|
return false
|
|
115
112
|
end
|
|
113
|
+
function ____exports.isTransformationFlying(self, playerForm)
|
|
114
|
+
return TRANSFORMATIONS_THAT_GRANT_FLYING:has(playerForm)
|
|
115
|
+
end
|
|
116
116
|
return ____exports
|
|
@@ -3,3 +3,8 @@
|
|
|
3
3
|
* Returns a set containing every trinket type with the given cache flag, including modded trinkets.
|
|
4
4
|
*/
|
|
5
5
|
export declare function getTrinketsForCacheFlag(cacheFlag: CacheFlag): Set<TrinketType | int>;
|
|
6
|
+
/**
|
|
7
|
+
* Returns a map containing every trinket type that the player has that matches the provided
|
|
8
|
+
* CacheFlag. The values of the map correspond to the multiplier for that trinket.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getPlayerTrinketsForCacheFlag(player: EntityPlayer, cacheFlag: CacheFlag): Map<TrinketType | int, int>;
|
|
@@ -3,6 +3,7 @@ local ____lualib = require("lualib_bundle")
|
|
|
3
3
|
local Map = ____lualib.Map
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local Set = ____lualib.Set
|
|
6
|
+
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
6
7
|
local ____exports = {}
|
|
7
8
|
local ____set = require("functions.set")
|
|
8
9
|
local copySet = ____set.copySet
|
|
@@ -38,4 +39,15 @@ function ____exports.getTrinketsForCacheFlag(self, cacheFlag)
|
|
|
38
39
|
end
|
|
39
40
|
return copySet(nil, trinketsSet)
|
|
40
41
|
end
|
|
42
|
+
function ____exports.getPlayerTrinketsForCacheFlag(self, player, cacheFlag)
|
|
43
|
+
local trinketsForCacheFlag = ____exports.getTrinketsForCacheFlag(nil, cacheFlag)
|
|
44
|
+
local playerTrinkets = __TS__New(Map)
|
|
45
|
+
for ____, trinketType in __TS__Iterator(trinketsForCacheFlag:values()) do
|
|
46
|
+
local trinketMultiplier = player:GetTrinketMultiplier(trinketType)
|
|
47
|
+
if trinketMultiplier > 0 then
|
|
48
|
+
playerTrinkets:set(trinketType, trinketMultiplier)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
return playerTrinkets
|
|
52
|
+
end
|
|
41
53
|
return ____exports
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { disableAllInputs, disableAllInputsExceptFor, disableMovementInputs, dis
|
|
|
5
5
|
export { forgottenSwitch } from "./features/forgottenSwitch";
|
|
6
6
|
export { getCollectibleItemPoolType } from "./features/getCollectibleItemPoolType";
|
|
7
7
|
export { preventCollectibleRotate } from "./features/preventCollectibleRotate";
|
|
8
|
-
export {
|
|
8
|
+
export { runInNGameFrames, runInNRenderFrames, runNextGameFrame, runNextRenderFrame, } from "./features/runInNFrames";
|
|
9
9
|
export * from "./features/saveDataManager/exports";
|
|
10
10
|
export { hasSirenStolenFamiliar, setFamiliarNoSirenSteal, } from "./features/sirenHelpers";
|
|
11
11
|
export * from "./functions/array";
|
package/dist/index.lua
CHANGED
|
@@ -56,10 +56,14 @@ do
|
|
|
56
56
|
end
|
|
57
57
|
do
|
|
58
58
|
local ____runInNFrames = require("features.runInNFrames")
|
|
59
|
-
local
|
|
60
|
-
local
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
local runInNGameFrames = ____runInNFrames.runInNGameFrames
|
|
60
|
+
local runInNRenderFrames = ____runInNFrames.runInNRenderFrames
|
|
61
|
+
local runNextGameFrame = ____runInNFrames.runNextGameFrame
|
|
62
|
+
local runNextRenderFrame = ____runInNFrames.runNextRenderFrame
|
|
63
|
+
____exports.runInNGameFrames = runInNGameFrames
|
|
64
|
+
____exports.runInNRenderFrames = runInNRenderFrames
|
|
65
|
+
____exports.runNextGameFrame = runNextGameFrame
|
|
66
|
+
____exports.runNextRenderFrame = runNextRenderFrame
|
|
63
67
|
end
|
|
64
68
|
do
|
|
65
69
|
local ____export = require("features.saveDataManager.exports")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.27",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@zamiell/typescript-to-lua": "^1.4.0",
|
|
29
|
-
"isaac-typescript-definitions": "^1.0.
|
|
29
|
+
"isaac-typescript-definitions": "^1.0.339",
|
|
30
30
|
"isaacscript-lint": "^1.0.79",
|
|
31
31
|
"isaacscript-tsconfig": "^1.1.8",
|
|
32
32
|
"typedoc": "^0.22.11",
|