isaacscript-common 1.2.40 → 1.2.43
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/callbacks/postBoneSwing.d.ts +1 -0
- package/dist/callbacks/postBoneSwing.lua +40 -0
- package/dist/callbacks/postPlayerChangeHealth.lua +4 -5
- package/dist/callbacks/subscriptions/postBoneSwing.d.ts +2 -0
- package/dist/callbacks/subscriptions/postBoneSwing.lua +18 -0
- package/dist/features/saveDataManager/main.lua +2 -2
- package/dist/features/saveDataManager/merge.lua +2 -2
- package/dist/functions/collectibleCacheFlag.lua +2 -2
- package/dist/functions/familiars.d.ts +35 -4
- package/dist/functions/familiars.lua +19 -9
- package/dist/functions/globals.lua +2 -2
- package/dist/functions/map.d.ts +2 -0
- package/dist/functions/map.lua +16 -0
- package/dist/functions/math.lua +3 -4
- package/dist/functions/pickups.lua +2 -2
- package/dist/functions/player.lua +5 -4
- package/dist/functions/sound.lua +2 -2
- package/dist/functions/stage.lua +3 -4
- package/dist/functions/string.d.ts +5 -0
- package/dist/functions/string.lua +23 -0
- package/dist/functions/table.d.ts +6 -0
- package/dist/functions/table.lua +8 -0
- package/dist/functions/trinketCacheFlag.lua +2 -2
- package/dist/functions/utils.d.ts +76 -0
- package/dist/functions/utils.lua +56 -0
- package/dist/functions/vector.lua +3 -4
- package/dist/index.d.ts +4 -1
- package/dist/index.lua +25 -1
- package/dist/patchErrorFunctions.lua +2 -2
- package/dist/types/CallbackParametersCustom.d.ts +4 -0
- package/dist/types/ModCallbacksCustom.d.ts +2 -1
- package/dist/types/ModCallbacksCustom.lua +2 -0
- package/dist/types/ModUpgraded.lua +11 -4
- package/dist/upgradeMod.lua +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____lualib = require("lualib_bundle")
|
|
3
|
+
local Set = ____lualib.Set
|
|
4
|
+
local __TS__New = ____lualib.__TS__New
|
|
5
|
+
local Map = ____lualib.Map
|
|
6
|
+
local ____exports = {}
|
|
7
|
+
local hasSubscriptions, postKnifeRenderBoneClub, boneClubAnimationChanged, BONE_SWING_ANIMATIONS, v
|
|
8
|
+
local ____exports = require("features.saveDataManager.exports")
|
|
9
|
+
local saveDataManager = ____exports.saveDataManager
|
|
10
|
+
local ____postBoneSwing = require("callbacks.subscriptions.postBoneSwing")
|
|
11
|
+
local postBoneSwingFire = ____postBoneSwing.postBoneSwingFire
|
|
12
|
+
local postBoneSwingHasSubscriptions = ____postBoneSwing.postBoneSwingHasSubscriptions
|
|
13
|
+
function hasSubscriptions(self)
|
|
14
|
+
return postBoneSwingHasSubscriptions(nil)
|
|
15
|
+
end
|
|
16
|
+
function postKnifeRenderBoneClub(self, boneClub)
|
|
17
|
+
if not hasSubscriptions(nil) then
|
|
18
|
+
return
|
|
19
|
+
end
|
|
20
|
+
local sprite = boneClub:GetSprite()
|
|
21
|
+
local animation = sprite:GetAnimation()
|
|
22
|
+
local ptrHash = GetPtrHash(boneClub)
|
|
23
|
+
local animationOnLastFrame = v.room.boneClubAnimations:get(ptrHash)
|
|
24
|
+
v.room.boneClubAnimations:set(ptrHash, animation)
|
|
25
|
+
if animationOnLastFrame ~= nil and animation ~= animationOnLastFrame then
|
|
26
|
+
boneClubAnimationChanged(nil, boneClub, animation)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
function boneClubAnimationChanged(self, boneClub, animation)
|
|
30
|
+
if BONE_SWING_ANIMATIONS:has(animation) then
|
|
31
|
+
postBoneSwingFire(nil, boneClub)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
BONE_SWING_ANIMATIONS = __TS__New(Set, {"Swing", "Swing2", "Spin"})
|
|
35
|
+
v = {room = {boneClubAnimations = __TS__New(Map)}}
|
|
36
|
+
function ____exports.postBoneSwingCallbackInit(self, mod)
|
|
37
|
+
saveDataManager(nil, "postBoneSwing", v, hasSubscriptions)
|
|
38
|
+
mod:AddCallback(ModCallbacks.MC_POST_KNIFE_RENDER, postKnifeRenderBoneClub, 1)
|
|
39
|
+
end
|
|
40
|
+
return ____exports
|
|
@@ -8,9 +8,9 @@ local ____exports = require("features.saveDataManager.exports")
|
|
|
8
8
|
local saveDataManager = ____exports.saveDataManager
|
|
9
9
|
local ____player = require("functions.player")
|
|
10
10
|
local getPlayerIndex = ____player.getPlayerIndex
|
|
11
|
-
local
|
|
12
|
-
local ensureAllCases =
|
|
13
|
-
local getEnumValues =
|
|
11
|
+
local ____utils = require("functions.utils")
|
|
12
|
+
local ensureAllCases = ____utils.ensureAllCases
|
|
13
|
+
local getEnumValues = ____utils.getEnumValues
|
|
14
14
|
local ____HealthType = require("types.HealthType")
|
|
15
15
|
local HealthType = ____HealthType.HealthType
|
|
16
16
|
local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
|
|
@@ -93,8 +93,7 @@ function getCurrentHealthValue(self, player, healthType)
|
|
|
93
93
|
end
|
|
94
94
|
do
|
|
95
95
|
do
|
|
96
|
-
ensureAllCases(nil, healthType)
|
|
97
|
-
return 0
|
|
96
|
+
return ensureAllCases(nil, healthType)
|
|
98
97
|
end
|
|
99
98
|
end
|
|
100
99
|
until true
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____lualib = require("lualib_bundle")
|
|
3
|
+
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
4
|
+
local ____exports = {}
|
|
5
|
+
local subscriptions = {}
|
|
6
|
+
function ____exports.postBoneSwingHasSubscriptions(self)
|
|
7
|
+
return #subscriptions > 0
|
|
8
|
+
end
|
|
9
|
+
function ____exports.postBoneSwingRegister(self, callback)
|
|
10
|
+
__TS__ArrayPush(subscriptions, {callback})
|
|
11
|
+
end
|
|
12
|
+
function ____exports.postBoneSwingFire(self, boneClub)
|
|
13
|
+
for ____, ____value in ipairs(subscriptions) do
|
|
14
|
+
local callback = ____value[1]
|
|
15
|
+
callback(nil, boneClub)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
return ____exports
|
|
@@ -8,8 +8,8 @@ local getUpgradeErrorMsg = ____errors.getUpgradeErrorMsg
|
|
|
8
8
|
local ____deepCopy = require("functions.deepCopy")
|
|
9
9
|
local deepCopy = ____deepCopy.deepCopy
|
|
10
10
|
local SerializationType = ____deepCopy.SerializationType
|
|
11
|
-
local
|
|
12
|
-
local tableClear =
|
|
11
|
+
local ____table = require("functions.table")
|
|
12
|
+
local tableClear = ____table.tableClear
|
|
13
13
|
local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
|
|
14
14
|
local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
|
|
15
15
|
local ____SaveData = require("types.SaveData")
|
|
@@ -20,8 +20,8 @@ local isSerializedVector = ____deepCopy.isSerializedVector
|
|
|
20
20
|
local SerializationType = ____deepCopy.SerializationType
|
|
21
21
|
local ____log = require("functions.log")
|
|
22
22
|
local log = ____log.log
|
|
23
|
-
local
|
|
24
|
-
local tableClear =
|
|
23
|
+
local ____table = require("functions.table")
|
|
24
|
+
local tableClear = ____table.tableClear
|
|
25
25
|
function ____exports.merge(self, oldObject, newTable, traversalDescription)
|
|
26
26
|
local oldObjectType = type(oldObject)
|
|
27
27
|
if oldObjectType ~= "table" then
|
|
@@ -11,8 +11,8 @@ local collectibleHasCacheFlag = ____collectibles.collectibleHasCacheFlag
|
|
|
11
11
|
local getMaxCollectibleID = ____collectibles.getMaxCollectibleID
|
|
12
12
|
local ____set = require("functions.set")
|
|
13
13
|
local copySet = ____set.copySet
|
|
14
|
-
local
|
|
15
|
-
local getEnumValues =
|
|
14
|
+
local ____utils = require("functions.utils")
|
|
15
|
+
local getEnumValues = ____utils.getEnumValues
|
|
16
16
|
local CACHE_FLAG_TO_COLLECTIBLES_MAP = __TS__New(Map)
|
|
17
17
|
local function initCacheFlagMap(self)
|
|
18
18
|
local maxCollectibleID = getMaxCollectibleID(nil)
|
|
@@ -1,21 +1,52 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/**
|
|
3
|
+
* Helper function to add and remove familiars based on a target amount that you specify. Use this
|
|
4
|
+
* instead of the `EntityPlayer.CheckFamiliar` method so that the InitSeed of the spawned familiar
|
|
5
|
+
* will be set properly. Note that when using this function, you need to manually account for Box of
|
|
6
|
+
* Friends (by looking at the number of collectible effects on the player for Box of Friends).
|
|
7
|
+
*
|
|
8
|
+
* This function is meant to be called in the EvaluateCache callback (when the cache flag is equal
|
|
9
|
+
* to `CacheFlag.CACHE_FAMILIARS`).
|
|
10
|
+
*
|
|
11
|
+
* Note that this function is only meant to be used in special circumstances. For general purpose
|
|
12
|
+
* usage, please use the `checkFamiliarFromCollectibles` helper function instead.
|
|
13
|
+
*
|
|
14
|
+
* @param player The player that owns the familiars.
|
|
15
|
+
* @param collectibleType The collectible type of the collectible associated with this familiar.
|
|
16
|
+
* @param numTargetFamiliars The number of familiars that should exist. This function will add or
|
|
17
|
+
* remove familiars until it matches the target count.
|
|
18
|
+
* @param familiarVariant The variant of the familiar to spawn or remove.
|
|
19
|
+
* @param familiarSubType Optional. The sub-type of the familiar to spawn or remove. If not
|
|
20
|
+
* specified, it will search for existing familiars of all sub-types, and spawn new familiars with a
|
|
21
|
+
* sub-type of 0.
|
|
22
|
+
* @returns The amount of familiars that were added or removed. For example, the player has 0
|
|
23
|
+
* collectibles and there were 2 familiars, this function would remove the 2 familiars and return
|
|
24
|
+
* -2.
|
|
25
|
+
*/
|
|
26
|
+
export declare function checkFamiliar(player: EntityPlayer, collectibleType: int, numTargetFamiliars: int, familiarVariant: int, familiarSubType?: int): int;
|
|
2
27
|
/**
|
|
3
28
|
* Helper function to add and remove familiars based on the amount of associated collectibles that a
|
|
4
29
|
* player has. Use this instead of the `EntityPlayer.CheckFamiliar` method so that the InitSeed of
|
|
5
|
-
* the spawned familiar will be set properly and Box of Friends
|
|
30
|
+
* the spawned familiar will be set properly and Box of Friends is handled automatically.
|
|
6
31
|
*
|
|
7
32
|
* This function is meant to be called in the EvaluateCache callback (when the cache flag is equal
|
|
8
33
|
* to `CacheFlag.CACHE_FAMILIARS`).
|
|
9
34
|
*
|
|
10
|
-
*
|
|
35
|
+
* Use this function when the amount of familiars should be equal to the amount of associated
|
|
36
|
+
* collectibles that the player has (plus any extras from having used Box of Friends). If you
|
|
37
|
+
* instead need to have a custom amount of familiars, use the `checkFamiliars` function instead.
|
|
38
|
+
*
|
|
39
|
+
* @param player The player that owns the familiars and collectibles.
|
|
11
40
|
* @param collectibleType The collectible type of the collectible associated with this familiar.
|
|
12
41
|
* @param familiarVariant The variant of the familiar to spawn or remove.
|
|
13
|
-
* @param familiarSubType Optional. The sub-type of the familiar to spawn or remove.
|
|
42
|
+
* @param familiarSubType Optional. The sub-type of the familiar to spawn or remove. If not
|
|
43
|
+
* specified, it will search for existing familiars of all sub-types, and spawn new familiars with a
|
|
44
|
+
* sub-type of 0.
|
|
14
45
|
* @returns The amount of familiars that were added or removed. For example, the player has 0
|
|
15
46
|
* collectibles and there were 2 familiars, this function would remove the 2 familiars and return
|
|
16
47
|
* -2.
|
|
17
48
|
*/
|
|
18
|
-
export declare function
|
|
49
|
+
export declare function checkFamiliarFromCollectibles(player: EntityPlayer, collectibleType: int, familiarVariant: int, familiarSubType?: int): int;
|
|
19
50
|
/**
|
|
20
51
|
* Helper function to get all of the familiars in the room.
|
|
21
52
|
*
|
|
@@ -25,7 +25,7 @@ function ____exports.getFamiliars(self, matchingVariant, matchingSubType)
|
|
|
25
25
|
end
|
|
26
26
|
return familiars
|
|
27
27
|
end
|
|
28
|
-
function ____exports.checkFamiliar(self, player, collectibleType, familiarVariant, familiarSubType)
|
|
28
|
+
function ____exports.checkFamiliar(self, player, collectibleType, numTargetFamiliars, familiarVariant, familiarSubType)
|
|
29
29
|
local game = Game()
|
|
30
30
|
local familiarSubTypeToSearchFor = familiarSubType == nil and -1 or familiarSubType
|
|
31
31
|
local playerPtrHash = GetPtrHash(player)
|
|
@@ -34,15 +34,11 @@ function ____exports.checkFamiliar(self, player, collectibleType, familiarVarian
|
|
|
34
34
|
familiars,
|
|
35
35
|
function(____, familiar) return GetPtrHash(familiar.Player) == playerPtrHash end
|
|
36
36
|
)
|
|
37
|
-
|
|
38
|
-
local effects = player:GetEffects()
|
|
39
|
-
local numBoxOfFriendsUses = effects:GetCollectibleEffectNum(CollectibleType.COLLECTIBLE_BOX_OF_FRIENDS)
|
|
40
|
-
local numFamiliarsThatShouldExist = numCollectibles * (numBoxOfFriendsUses + 1)
|
|
41
|
-
if #familiarsForThisPlayer == numFamiliarsThatShouldExist then
|
|
37
|
+
if #familiarsForThisPlayer == numTargetFamiliars then
|
|
42
38
|
return 0
|
|
43
39
|
end
|
|
44
|
-
if #familiarsForThisPlayer >
|
|
45
|
-
local numFamiliarsToRemove = #familiarsForThisPlayer -
|
|
40
|
+
if #familiarsForThisPlayer > numTargetFamiliars then
|
|
41
|
+
local numFamiliarsToRemove = #familiarsForThisPlayer - numTargetFamiliars
|
|
46
42
|
do
|
|
47
43
|
local i = 0
|
|
48
44
|
while i < numFamiliarsToRemove do
|
|
@@ -53,7 +49,7 @@ function ____exports.checkFamiliar(self, player, collectibleType, familiarVarian
|
|
|
53
49
|
end
|
|
54
50
|
return numFamiliarsToRemove * -1
|
|
55
51
|
end
|
|
56
|
-
local numFamiliarsToSpawn =
|
|
52
|
+
local numFamiliarsToSpawn = numTargetFamiliars - #familiarsForThisPlayer
|
|
57
53
|
local collectibleRNG = player:GetCollectibleRNG(collectibleType)
|
|
58
54
|
local familiarSubTypeToUse = familiarSubType == nil and 0 or familiarSubType
|
|
59
55
|
do
|
|
@@ -77,6 +73,20 @@ function ____exports.checkFamiliar(self, player, collectibleType, familiarVarian
|
|
|
77
73
|
end
|
|
78
74
|
return numFamiliarsToSpawn
|
|
79
75
|
end
|
|
76
|
+
function ____exports.checkFamiliarFromCollectibles(self, player, collectibleType, familiarVariant, familiarSubType)
|
|
77
|
+
local numCollectibles = player:GetCollectibleNum(collectibleType)
|
|
78
|
+
local effects = player:GetEffects()
|
|
79
|
+
local numBoxOfFriendsUses = effects:GetCollectibleEffectNum(CollectibleType.COLLECTIBLE_BOX_OF_FRIENDS)
|
|
80
|
+
local numTargetFamiliars = numCollectibles * (numBoxOfFriendsUses + 1)
|
|
81
|
+
return ____exports.checkFamiliar(
|
|
82
|
+
nil,
|
|
83
|
+
player,
|
|
84
|
+
collectibleType,
|
|
85
|
+
numTargetFamiliars,
|
|
86
|
+
familiarVariant,
|
|
87
|
+
familiarSubType
|
|
88
|
+
)
|
|
89
|
+
end
|
|
80
90
|
function ____exports.isFamiliarThatShootsPlayerTears(self, familiar)
|
|
81
91
|
return FAMILIARS_THAT_SHOOT_PLAYER_TEARS:has(familiar.Type)
|
|
82
92
|
end
|
|
@@ -11,8 +11,8 @@ local log = ____log.log
|
|
|
11
11
|
local ____set = require("functions.set")
|
|
12
12
|
local addSetsToSet = ____set.addSetsToSet
|
|
13
13
|
local copySet = ____set.copySet
|
|
14
|
-
local
|
|
15
|
-
local isLuaDebugEnabled =
|
|
14
|
+
local ____utils = require("functions.utils")
|
|
15
|
+
local isLuaDebugEnabled = ____utils.isLuaDebugEnabled
|
|
16
16
|
function twoDimensionalSort(self, a, b)
|
|
17
17
|
if a[1] == b[1] then
|
|
18
18
|
return 0
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____lualib = require("lualib_bundle")
|
|
3
|
+
local Map = ____lualib.Map
|
|
4
|
+
local __TS__New = ____lualib.__TS__New
|
|
5
|
+
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
6
|
+
local ____exports = {}
|
|
7
|
+
function ____exports.copyMap(self, oldMap)
|
|
8
|
+
local newMap = __TS__New(Map)
|
|
9
|
+
for ____, ____value in __TS__Iterator(oldMap:entries()) do
|
|
10
|
+
local key = ____value[1]
|
|
11
|
+
local value = ____value[2]
|
|
12
|
+
newMap:set(key, value)
|
|
13
|
+
end
|
|
14
|
+
return newMap
|
|
15
|
+
end
|
|
16
|
+
return ____exports
|
package/dist/functions/math.lua
CHANGED
|
@@ -3,8 +3,8 @@ local ____lualib = require("lualib_bundle")
|
|
|
3
3
|
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
4
4
|
local ____exports = {}
|
|
5
5
|
local getCircleInitialPosition
|
|
6
|
-
local
|
|
7
|
-
local ensureAllCases =
|
|
6
|
+
local ____utils = require("functions.utils")
|
|
7
|
+
local ensureAllCases = ____utils.ensureAllCases
|
|
8
8
|
function getCircleInitialPosition(self, direction, radius)
|
|
9
9
|
repeat
|
|
10
10
|
local ____switch6 = direction
|
|
@@ -40,8 +40,7 @@ function getCircleInitialPosition(self, direction, radius)
|
|
|
40
40
|
end
|
|
41
41
|
do
|
|
42
42
|
do
|
|
43
|
-
ensureAllCases(nil, direction)
|
|
44
|
-
return Vector.Zero
|
|
43
|
+
return ensureAllCases(nil, direction)
|
|
45
44
|
end
|
|
46
45
|
end
|
|
47
46
|
until true
|
|
@@ -5,8 +5,8 @@ local __TS__New = ____lualib.__TS__New
|
|
|
5
5
|
local ____exports = {}
|
|
6
6
|
local ____array = require("functions.array")
|
|
7
7
|
local getRandomArrayElement = ____array.getRandomArrayElement
|
|
8
|
-
local
|
|
9
|
-
local getEnumValues =
|
|
8
|
+
local ____utils = require("functions.utils")
|
|
9
|
+
local getEnumValues = ____utils.getEnumValues
|
|
10
10
|
function ____exports.getRandomHeartSubType(self, seed, exceptions)
|
|
11
11
|
if seed == nil then
|
|
12
12
|
seed = Random()
|
|
@@ -29,10 +29,11 @@ local ____collectibles = require("functions.collectibles")
|
|
|
29
29
|
local getCollectibleMaxCharges = ____collectibles.getCollectibleMaxCharges
|
|
30
30
|
local ____collectibleSet = require("functions.collectibleSet")
|
|
31
31
|
local getCollectibleSet = ____collectibleSet.getCollectibleSet
|
|
32
|
-
local
|
|
33
|
-
local
|
|
34
|
-
local
|
|
35
|
-
local
|
|
32
|
+
local ____string = require("functions.string")
|
|
33
|
+
local stringContains = ____string.stringContains
|
|
34
|
+
local trimPrefix = ____string.trimPrefix
|
|
35
|
+
local ____utils = require("functions.utils")
|
|
36
|
+
local ensureAllCases = ____utils.ensureAllCases
|
|
36
37
|
function ____exports.getCharacterMaxHeartContainers(self, character)
|
|
37
38
|
if character == PlayerType.PLAYER_KEEPER then
|
|
38
39
|
return 3
|
package/dist/functions/sound.lua
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____exports = {}
|
|
3
|
-
local
|
|
4
|
-
local getEnumValues =
|
|
3
|
+
local ____utils = require("functions.utils")
|
|
4
|
+
local getEnumValues = ____utils.getEnumValues
|
|
5
5
|
function ____exports.stopAllSoundEffects(self)
|
|
6
6
|
local sfxManager = SFXManager()
|
|
7
7
|
for ____, soundEffect in ipairs(getEnumValues(nil, SoundEffect)) do
|
package/dist/functions/stage.lua
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____exports = {}
|
|
3
|
-
local
|
|
4
|
-
local ensureAllCases =
|
|
3
|
+
local ____utils = require("functions.utils")
|
|
4
|
+
local ensureAllCases = ____utils.ensureAllCases
|
|
5
5
|
function ____exports.isRepentanceStage(self, stageType)
|
|
6
6
|
return stageType == StageType.STAGETYPE_REPENTANCE or stageType == StageType.STAGETYPE_REPENTANCE_B
|
|
7
7
|
end
|
|
@@ -52,8 +52,7 @@ function ____exports.stageTypeToLetter(self, stageType)
|
|
|
52
52
|
end
|
|
53
53
|
do
|
|
54
54
|
do
|
|
55
|
-
ensureAllCases(nil, stageType)
|
|
56
|
-
return ""
|
|
55
|
+
return ensureAllCases(nil, stageType)
|
|
57
56
|
end
|
|
58
57
|
end
|
|
59
58
|
until true
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function stringContains(string: string, searchString: string): boolean;
|
|
2
|
+
/** Helper function to trim a prefix from a string, if it exists. Returns the trimmed string. */
|
|
3
|
+
export declare function trimPrefix(string: string, prefix: string): string;
|
|
4
|
+
/** Helper function to trim a suffix from a string, if it exists. Returns the trimmed string. */
|
|
5
|
+
export declare function trimSuffix(string: string, prefix: string): string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____lualib = require("lualib_bundle")
|
|
3
|
+
local __TS__StringStartsWith = ____lualib.__TS__StringStartsWith
|
|
4
|
+
local __TS__StringSlice = ____lualib.__TS__StringSlice
|
|
5
|
+
local __TS__StringEndsWith = ____lualib.__TS__StringEndsWith
|
|
6
|
+
local ____exports = {}
|
|
7
|
+
function ____exports.stringContains(self, ____string, searchString)
|
|
8
|
+
return (string.find(____string, searchString, nil, true) or 0) - 1 ~= -1
|
|
9
|
+
end
|
|
10
|
+
function ____exports.trimPrefix(self, ____string, prefix)
|
|
11
|
+
if not __TS__StringStartsWith(____string, prefix) then
|
|
12
|
+
return ____string
|
|
13
|
+
end
|
|
14
|
+
return __TS__StringSlice(____string, #prefix)
|
|
15
|
+
end
|
|
16
|
+
function ____exports.trimSuffix(self, ____string, prefix)
|
|
17
|
+
if not __TS__StringEndsWith(____string, prefix) then
|
|
18
|
+
return ____string
|
|
19
|
+
end
|
|
20
|
+
local endCharacter = #____string - #prefix
|
|
21
|
+
return __TS__StringSlice(____string, 0, endCharacter)
|
|
22
|
+
end
|
|
23
|
+
return ____exports
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="typescript-to-lua/language-extensions" />
|
|
2
|
+
/**
|
|
3
|
+
* In a Map, you can use the `clear` method to delete every element. However, in a LuaTable, the
|
|
4
|
+
* `clear` method does not exist. Use this helper function as a drop-in replacement for this.
|
|
5
|
+
*/
|
|
6
|
+
export declare function tableClear(table: LuaTable): void;
|
|
@@ -10,8 +10,8 @@ local copySet = ____set.copySet
|
|
|
10
10
|
local ____trinkets = require("functions.trinkets")
|
|
11
11
|
local getMaxTrinketID = ____trinkets.getMaxTrinketID
|
|
12
12
|
local trinketHasCacheFlag = ____trinkets.trinketHasCacheFlag
|
|
13
|
-
local
|
|
14
|
-
local getEnumValues =
|
|
13
|
+
local ____utils = require("functions.utils")
|
|
14
|
+
local getEnumValues = ____utils.getEnumValues
|
|
15
15
|
local CACHE_FLAG_TO_TRINKETS_MAP = __TS__New(Map)
|
|
16
16
|
local function initCacheFlagMap(self)
|
|
17
17
|
local maxTrinketID = getMaxTrinketID(nil)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/**
|
|
3
|
+
* Helper function to get type safety on a switch statement.
|
|
4
|
+
* Very useful to be future-safe against people adding values to a type or an enum.
|
|
5
|
+
*
|
|
6
|
+
* Example:
|
|
7
|
+
* ```
|
|
8
|
+
* enum Situations {
|
|
9
|
+
* Situation1,
|
|
10
|
+
* Situation2,
|
|
11
|
+
* Situation3,
|
|
12
|
+
* // Situation4, // If we uncomment this line, the program will no longer compile
|
|
13
|
+
* }
|
|
14
|
+
*
|
|
15
|
+
* function doThingBasedOnSituation(situation: Situation) {
|
|
16
|
+
* switch (situation) {
|
|
17
|
+
* case Situation1: {
|
|
18
|
+
* return 41;
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* case Situation2: {
|
|
22
|
+
* return 68;
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* case Situation3: {
|
|
26
|
+
* return 12;
|
|
27
|
+
* }
|
|
28
|
+
*
|
|
29
|
+
* default: {
|
|
30
|
+
* ensureAllCases(situation);
|
|
31
|
+
* return 0;
|
|
32
|
+
* }
|
|
33
|
+
* }
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare const ensureAllCases: (obj: never) => never;
|
|
38
|
+
/**
|
|
39
|
+
* TypeScriptToLua will transpile TypeScript enums to Lua tables that have a double mapping. Thus,
|
|
40
|
+
* when you iterate over them, you will get both the names of the enums and the values of the enums,
|
|
41
|
+
* in a random order. If all you need are the values of an enum, use this helper function.
|
|
42
|
+
*
|
|
43
|
+
* For a more in depth explanation, see:
|
|
44
|
+
* https://isaacscript.github.io/docs/gotchas#iterating-over-enums
|
|
45
|
+
*/
|
|
46
|
+
export declare function getEnumValues(transpiledEnum: unknown): int[];
|
|
47
|
+
/**
|
|
48
|
+
* Converts a hex string like "#33aa33" to a KColor object.
|
|
49
|
+
*
|
|
50
|
+
* @param hexString A hex string like "#ffffff" or "ffffff". (The "#" character is optional.)
|
|
51
|
+
*/
|
|
52
|
+
export declare function hexToKColor(hexString: string, alpha: float): KColor;
|
|
53
|
+
/**
|
|
54
|
+
* Players can boot the game with an launch option called "--luadebug", which will enable additional
|
|
55
|
+
* functionality that is considered to be unsafe. For more information about this flag, see the
|
|
56
|
+
* wiki: https://bindingofisaacrebirth.fandom.com/wiki/Launch_Options
|
|
57
|
+
*
|
|
58
|
+
* When this flag is enabled, the global environment will be slightly different. The differences are
|
|
59
|
+
* documented here: https://wofsauge.github.io/IsaacDocs/rep/Globals.html
|
|
60
|
+
*
|
|
61
|
+
* This function uses the `package` global variable as a proxy to determine if the "--luadebug" flag
|
|
62
|
+
* is enabled or not.
|
|
63
|
+
*/
|
|
64
|
+
export declare function isLuaDebugEnabled(): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Whether or not the player is playing on a set seed (i.e. that they entered in a specific seed by
|
|
67
|
+
* pressing tab on the character selection screen). When the player resets the game on a set seed,
|
|
68
|
+
* the game will not switch to a different seed.
|
|
69
|
+
*/
|
|
70
|
+
export declare function onSetSeed(): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Helper function to print something to the in-game console. Use this instead of invoking
|
|
73
|
+
* `Isaac.ConsoleOutput()` directly because it will automatically insert a newline at the end of the
|
|
74
|
+
* message (which `Isaac.ConsoleOutput()` does not do by default).
|
|
75
|
+
*/
|
|
76
|
+
export declare function printConsole(msg: string): void;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____lualib = require("lualib_bundle")
|
|
3
|
+
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
4
|
+
local __TS__ArraySort = ____lualib.__TS__ArraySort
|
|
5
|
+
local __TS__StringReplace = ____lualib.__TS__StringReplace
|
|
6
|
+
local __TS__StringSubstr = ____lualib.__TS__StringSubstr
|
|
7
|
+
local ____exports = {}
|
|
8
|
+
local HEX_STRING_LENGTH = 6
|
|
9
|
+
____exports.ensureAllCases = function(____, obj) return obj end
|
|
10
|
+
function ____exports.getEnumValues(self, transpiledEnum)
|
|
11
|
+
local enumValues = {}
|
|
12
|
+
for key, value in pairs(transpiledEnum) do
|
|
13
|
+
if type(key) == "string" then
|
|
14
|
+
__TS__ArrayPush(enumValues, value)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
__TS__ArraySort(enumValues)
|
|
18
|
+
return enumValues
|
|
19
|
+
end
|
|
20
|
+
function ____exports.hexToKColor(self, hexString, alpha)
|
|
21
|
+
hexString = __TS__StringReplace(hexString, "#", "")
|
|
22
|
+
if #hexString ~= HEX_STRING_LENGTH then
|
|
23
|
+
error(("Hex strings must be of length " .. tostring(HEX_STRING_LENGTH)) .. ".")
|
|
24
|
+
end
|
|
25
|
+
local rString = __TS__StringSubstr(hexString, 0, 2)
|
|
26
|
+
local R = tonumber("0x" .. rString)
|
|
27
|
+
if R == nil then
|
|
28
|
+
error(("Failed to convert `0x" .. rString) .. "` to a number.")
|
|
29
|
+
end
|
|
30
|
+
local gString = __TS__StringSubstr(hexString, 2, 2)
|
|
31
|
+
local G = tonumber("0x" .. gString)
|
|
32
|
+
if G == nil then
|
|
33
|
+
error(("Failed to convert `0x" .. gString) .. "` to a number.")
|
|
34
|
+
end
|
|
35
|
+
local bString = __TS__StringSubstr(hexString, 4, 2)
|
|
36
|
+
local B = tonumber("0x" .. bString)
|
|
37
|
+
if B == nil then
|
|
38
|
+
error(("Failed to convert `0x" .. bString) .. "` to a number.")
|
|
39
|
+
end
|
|
40
|
+
local base = 255
|
|
41
|
+
return KColor(R / base, G / base, B / base, alpha)
|
|
42
|
+
end
|
|
43
|
+
function ____exports.isLuaDebugEnabled(self)
|
|
44
|
+
return package ~= nil
|
|
45
|
+
end
|
|
46
|
+
function ____exports.onSetSeed(self)
|
|
47
|
+
local game = Game()
|
|
48
|
+
local seeds = game:GetSeeds()
|
|
49
|
+
local customRun = seeds:IsCustomRun()
|
|
50
|
+
local challenge = Isaac.GetChallenge()
|
|
51
|
+
return challenge == Challenge.CHALLENGE_NULL and customRun
|
|
52
|
+
end
|
|
53
|
+
function ____exports.printConsole(self, msg)
|
|
54
|
+
Isaac.ConsoleOutput(msg .. "\n")
|
|
55
|
+
end
|
|
56
|
+
return ____exports
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____exports = {}
|
|
3
|
-
local
|
|
4
|
-
local ensureAllCases =
|
|
3
|
+
local ____utils = require("functions.utils")
|
|
4
|
+
local ensureAllCases = ____utils.ensureAllCases
|
|
5
5
|
function ____exports.copyVector(self, vector)
|
|
6
6
|
return Vector(vector.X, vector.Y)
|
|
7
7
|
end
|
|
@@ -40,8 +40,7 @@ function ____exports.directionToVector(self, direction)
|
|
|
40
40
|
end
|
|
41
41
|
do
|
|
42
42
|
do
|
|
43
|
-
ensureAllCases(nil, direction)
|
|
44
|
-
return Vector.Zero
|
|
43
|
+
return ensureAllCases(nil, direction)
|
|
45
44
|
end
|
|
46
45
|
end
|
|
47
46
|
until true
|
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export * from "./functions/json";
|
|
|
32
32
|
export * from "./functions/jsonRoom";
|
|
33
33
|
export * from "./functions/language";
|
|
34
34
|
export * from "./functions/log";
|
|
35
|
+
export * from "./functions/map";
|
|
35
36
|
export * from "./functions/math";
|
|
36
37
|
export * from "./functions/npc";
|
|
37
38
|
export * from "./functions/pickups";
|
|
@@ -49,6 +50,8 @@ export * from "./functions/sound";
|
|
|
49
50
|
export * from "./functions/spawnCollectible";
|
|
50
51
|
export * from "./functions/sprite";
|
|
51
52
|
export * from "./functions/stage";
|
|
53
|
+
export * from "./functions/string";
|
|
54
|
+
export * from "./functions/table";
|
|
52
55
|
export * from "./functions/tears";
|
|
53
56
|
export * from "./functions/transformations";
|
|
54
57
|
export * from "./functions/trinketCacheFlag";
|
|
@@ -56,7 +59,7 @@ export * from "./functions/trinketGive";
|
|
|
56
59
|
export * from "./functions/trinkets";
|
|
57
60
|
export * from "./functions/trinketSet";
|
|
58
61
|
export * from "./functions/ui";
|
|
59
|
-
export * from "./functions/
|
|
62
|
+
export * from "./functions/utils";
|
|
60
63
|
export * from "./functions/vector";
|
|
61
64
|
export * from "./maps/cardNameMap";
|
|
62
65
|
export * from "./maps/collectibleNameMap";
|
package/dist/index.lua
CHANGED
|
@@ -266,6 +266,14 @@ do
|
|
|
266
266
|
end
|
|
267
267
|
end
|
|
268
268
|
end
|
|
269
|
+
do
|
|
270
|
+
local ____export = require("functions.map")
|
|
271
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
272
|
+
if ____exportKey ~= "default" then
|
|
273
|
+
____exports[____exportKey] = ____exportValue
|
|
274
|
+
end
|
|
275
|
+
end
|
|
276
|
+
end
|
|
269
277
|
do
|
|
270
278
|
local ____export = require("functions.math")
|
|
271
279
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -402,6 +410,22 @@ do
|
|
|
402
410
|
end
|
|
403
411
|
end
|
|
404
412
|
end
|
|
413
|
+
do
|
|
414
|
+
local ____export = require("functions.string")
|
|
415
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
416
|
+
if ____exportKey ~= "default" then
|
|
417
|
+
____exports[____exportKey] = ____exportValue
|
|
418
|
+
end
|
|
419
|
+
end
|
|
420
|
+
end
|
|
421
|
+
do
|
|
422
|
+
local ____export = require("functions.table")
|
|
423
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
424
|
+
if ____exportKey ~= "default" then
|
|
425
|
+
____exports[____exportKey] = ____exportValue
|
|
426
|
+
end
|
|
427
|
+
end
|
|
428
|
+
end
|
|
405
429
|
do
|
|
406
430
|
local ____export = require("functions.tears")
|
|
407
431
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -459,7 +483,7 @@ do
|
|
|
459
483
|
end
|
|
460
484
|
end
|
|
461
485
|
do
|
|
462
|
-
local ____export = require("functions.
|
|
486
|
+
local ____export = require("functions.utils")
|
|
463
487
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
464
488
|
if ____exportKey ~= "default" then
|
|
465
489
|
____exports[____exportKey] = ____exportValue
|
|
@@ -7,8 +7,8 @@ local ____exports = {}
|
|
|
7
7
|
local errorWithTraceback, slimTracebackOutput, removeAnyLineThatContains, LINE_SEPARATOR, USELESS_TRACEBACK_MESSAGES, vanillaError
|
|
8
8
|
local ____debug = require("functions.debug")
|
|
9
9
|
local getTraceback = ____debug.getTraceback
|
|
10
|
-
local
|
|
11
|
-
local isLuaDebugEnabled =
|
|
10
|
+
local ____utils = require("functions.utils")
|
|
11
|
+
local isLuaDebugEnabled = ____utils.isLuaDebugEnabled
|
|
12
12
|
function errorWithTraceback(message, level)
|
|
13
13
|
if vanillaError == nil then
|
|
14
14
|
error(message, level)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
import { PostBombInitLateCallbackType } from "../callbacks/subscriptions/postBombInitLate";
|
|
3
|
+
import { PostBoneSwingCallbackType } from "../callbacks/subscriptions/postBoneSwing";
|
|
3
4
|
import { PostCursedTeleportCallbackType } from "../callbacks/subscriptions/postCursedTeleport";
|
|
4
5
|
import { PostCustomReviveCallbackType } from "../callbacks/subscriptions/postCustomRevive";
|
|
5
6
|
import { PostEffectInitLateCallbackType } from "../callbacks/subscriptions/postEffectInitLate";
|
|
@@ -212,4 +213,7 @@ export interface CallbackParametersCustom {
|
|
|
212
213
|
callback: PostGridEntityCollisionCallbackType,
|
|
213
214
|
gridEntityType?: GridEntityType
|
|
214
215
|
];
|
|
216
|
+
[ModCallbacksCustom.MC_POST_BONE_SWING]: [
|
|
217
|
+
callback: PostBoneSwingCallbackType
|
|
218
|
+
];
|
|
215
219
|
}
|
|
@@ -93,4 +93,6 @@ ____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_REMOVE = 44
|
|
|
93
93
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_REMOVE] = "MC_POST_GRID_ENTITY_REMOVE"
|
|
94
94
|
____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_COLLISION = 45
|
|
95
95
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_COLLISION] = "MC_POST_GRID_ENTITY_COLLISION"
|
|
96
|
+
____exports.ModCallbacksCustom.MC_POST_BONE_SWING = 46
|
|
97
|
+
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_BONE_SWING] = "MC_POST_BONE_SWING"
|
|
96
98
|
return ____exports
|
|
@@ -7,6 +7,8 @@ local ____exports = {}
|
|
|
7
7
|
local getCallbackName, getCallbackRegisterFunction
|
|
8
8
|
local ____postBombInitLate = require("callbacks.subscriptions.postBombInitLate")
|
|
9
9
|
local postBombInitLateRegister = ____postBombInitLate.postBombInitLateRegister
|
|
10
|
+
local ____postBoneSwing = require("callbacks.subscriptions.postBoneSwing")
|
|
11
|
+
local postBoneSwingRegister = ____postBoneSwing.postBoneSwingRegister
|
|
10
12
|
local ____postCursedTeleport = require("callbacks.subscriptions.postCursedTeleport")
|
|
11
13
|
local postCursedTeleportRegister = ____postCursedTeleport.postCursedTeleportRegister
|
|
12
14
|
local ____postCustomRevive = require("callbacks.subscriptions.postCustomRevive")
|
|
@@ -99,8 +101,8 @@ local ____preNewLevel = require("callbacks.subscriptions.preNewLevel")
|
|
|
99
101
|
local preNewLevelRegister = ____preNewLevel.preNewLevelRegister
|
|
100
102
|
local ____log = require("functions.log")
|
|
101
103
|
local getDebugPrependString = ____log.getDebugPrependString
|
|
102
|
-
local
|
|
103
|
-
local ensureAllCases =
|
|
104
|
+
local ____utils = require("functions.utils")
|
|
105
|
+
local ensureAllCases = ____utils.ensureAllCases
|
|
104
106
|
local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
|
|
105
107
|
local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
|
|
106
108
|
function getCallbackName(self, callbackID)
|
|
@@ -392,10 +394,15 @@ function getCallbackRegisterFunction(self, callbackID)
|
|
|
392
394
|
return postGridEntityCollisionRegister
|
|
393
395
|
end
|
|
394
396
|
end
|
|
397
|
+
____cond19 = ____cond19 or ____switch19 == ModCallbacksCustom.MC_POST_BONE_SWING
|
|
398
|
+
if ____cond19 then
|
|
399
|
+
do
|
|
400
|
+
return postBoneSwingRegister
|
|
401
|
+
end
|
|
402
|
+
end
|
|
395
403
|
do
|
|
396
404
|
do
|
|
397
|
-
ensureAllCases(nil, callbackID)
|
|
398
|
-
return error(("The custom callback ID of \"" .. tostring(callbackID)) .. "\" is not valid.")
|
|
405
|
+
return ensureAllCases(nil, callbackID)
|
|
399
406
|
end
|
|
400
407
|
end
|
|
401
408
|
until true
|
package/dist/upgradeMod.lua
CHANGED
|
@@ -9,6 +9,8 @@ local ____itemPickup = require("callbacks.itemPickup")
|
|
|
9
9
|
local itemPickupCallbacksInit = ____itemPickup.itemPickupCallbacksInit
|
|
10
10
|
local ____postBombInitLate = require("callbacks.postBombInitLate")
|
|
11
11
|
local postBombInitLateCallbackInit = ____postBombInitLate.postBombInitLateCallbackInit
|
|
12
|
+
local ____postBoneSwing = require("callbacks.postBoneSwing")
|
|
13
|
+
local postBoneSwingCallbackInit = ____postBoneSwing.postBoneSwingCallbackInit
|
|
12
14
|
local ____postCursedTeleport = require("callbacks.postCursedTeleport")
|
|
13
15
|
local postCursedTeleportCallbackInit = ____postCursedTeleport.postCursedTeleportCallbackInit
|
|
14
16
|
local ____postEffectInitLate = require("callbacks.postEffectInitLate")
|
|
@@ -125,6 +127,7 @@ function initCustomCallbacks(self, mod)
|
|
|
125
127
|
postSlotRenderBrokenCallbacksInit(nil, mod)
|
|
126
128
|
postGridEntityCallbacksInit(nil, mod)
|
|
127
129
|
postGridEntityCollisionInit(nil, mod)
|
|
130
|
+
postBoneSwingCallbackInit(nil, mod)
|
|
128
131
|
end
|
|
129
132
|
function initFeatures(self, mod)
|
|
130
133
|
deployJSONRoomInit(nil, mod)
|