isaacscript-common 1.2.53 → 1.2.56
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/itemPickup.lua +24 -11
- package/dist/callbacks/postEsauJr.lua +7 -6
- package/dist/callbacks/postTransformation.lua +2 -19
- package/dist/callbacks/subscriptions/postItemPickup.lua +2 -2
- package/dist/callbacks/subscriptions/preItemPickup.lua +2 -2
- package/dist/features/sirenHelpers.lua +6 -7
- package/dist/functions/doors.lua +33 -27
- package/dist/functions/player.d.ts +21 -13
- package/dist/functions/player.lua +75 -47
- package/dist/functions/pocketItems.lua +5 -6
- package/dist/index.lua +8 -0
- package/dist/types/PickingUpItem.d.ts +5 -2
- package/dist/types/PickingUpItem.lua +9 -0
- package/package.json +2 -2
|
@@ -10,6 +10,9 @@ local ____player = require("functions.player")
|
|
|
10
10
|
local getPlayerIndex = ____player.getPlayerIndex
|
|
11
11
|
local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
|
|
12
12
|
local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
|
|
13
|
+
local ____PickingUpItem = require("types.PickingUpItem")
|
|
14
|
+
local newPickingUpItem = ____PickingUpItem.newPickingUpItem
|
|
15
|
+
local resetPickingUpItem = ____PickingUpItem.resetPickingUpItem
|
|
13
16
|
local ____postItemPickup = require("callbacks.subscriptions.postItemPickup")
|
|
14
17
|
local postItemPickupFire = ____postItemPickup.postItemPickupFire
|
|
15
18
|
local postItemPickupHasSubscriptions = ____postItemPickup.postItemPickupHasSubscriptions
|
|
@@ -31,29 +34,39 @@ function postPEffectUpdateReordered(self, player)
|
|
|
31
34
|
end
|
|
32
35
|
end
|
|
33
36
|
function queueEmpty(self, player, pickingUpItem)
|
|
34
|
-
if pickingUpItem.
|
|
35
|
-
|
|
36
|
-
pickingUpItem.id = CollectibleType.COLLECTIBLE_NULL
|
|
37
|
-
pickingUpItem.type = ItemType.ITEM_NULL
|
|
37
|
+
if pickingUpItem.subType == CollectibleType.COLLECTIBLE_NULL then
|
|
38
|
+
return
|
|
38
39
|
end
|
|
40
|
+
postItemPickupFire(nil, player, pickingUpItem)
|
|
41
|
+
resetPickingUpItem(nil, pickingUpItem)
|
|
39
42
|
end
|
|
40
43
|
function queueNotEmpty(self, player, pickingUpItem)
|
|
41
44
|
local queuedItem = player.QueuedItem.Item
|
|
42
45
|
if queuedItem == nil then
|
|
43
46
|
return
|
|
44
47
|
end
|
|
45
|
-
if queuedItem.Type ~= pickingUpItem.
|
|
46
|
-
pickingUpItem.
|
|
47
|
-
pickingUpItem.
|
|
48
|
+
if queuedItem.Type ~= pickingUpItem.itemType or queuedItem.ID ~= pickingUpItem.subType then
|
|
49
|
+
pickingUpItem.itemType = queuedItem.Type
|
|
50
|
+
pickingUpItem.subType = queuedItem.ID
|
|
48
51
|
preItemPickupFire(nil, player, pickingUpItem)
|
|
49
52
|
end
|
|
50
53
|
end
|
|
51
54
|
function getPickingUpItemForPlayer(self, player)
|
|
52
|
-
local
|
|
53
|
-
local
|
|
55
|
+
local character = player:GetPlayerType()
|
|
56
|
+
local playerIndex
|
|
57
|
+
if character == PlayerType.PLAYER_THESOUL then
|
|
58
|
+
local forgotten = player:GetSubPlayer()
|
|
59
|
+
if forgotten == nil then
|
|
60
|
+
error("Failed")
|
|
61
|
+
end
|
|
62
|
+
playerIndex = getPlayerIndex(nil, forgotten)
|
|
63
|
+
else
|
|
64
|
+
playerIndex = getPlayerIndex(nil, player)
|
|
65
|
+
end
|
|
66
|
+
local pickingUpItem = v.run.pickingUpItem:get(playerIndex)
|
|
54
67
|
if pickingUpItem == nil then
|
|
55
|
-
pickingUpItem =
|
|
56
|
-
v.run.pickingUpItem:set(
|
|
68
|
+
pickingUpItem = newPickingUpItem(nil)
|
|
69
|
+
v.run.pickingUpItem:set(playerIndex, pickingUpItem)
|
|
57
70
|
end
|
|
58
71
|
return pickingUpItem
|
|
59
72
|
end
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____lualib = require("lualib_bundle")
|
|
3
|
+
local __TS__ArrayFind = ____lualib.__TS__ArrayFind
|
|
2
4
|
local ____exports = {}
|
|
3
5
|
local hasSubscriptions, postUpdate, getPlayerWithControllerIndex, useItemEsauJr, v
|
|
4
6
|
local ____exports = require("features.saveDataManager.exports")
|
|
@@ -39,12 +41,11 @@ function postUpdate(self)
|
|
|
39
41
|
postEsauJrFire(nil, player)
|
|
40
42
|
end
|
|
41
43
|
function getPlayerWithControllerIndex(self, controllerIndex)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
return nil
|
|
44
|
+
local players = getPlayers(nil)
|
|
45
|
+
return __TS__ArrayFind(
|
|
46
|
+
players,
|
|
47
|
+
function(____, player) return player.ControllerIndex == controllerIndex end
|
|
48
|
+
)
|
|
48
49
|
end
|
|
49
50
|
function useItemEsauJr(self, _collectibleType, _rng, player, _useFlags, _activeSlot, _customVarData)
|
|
50
51
|
if not hasSubscriptions(nil) then
|
|
@@ -5,7 +5,7 @@ local __TS__New = ____lualib.__TS__New
|
|
|
5
5
|
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
6
6
|
local Map = ____lualib.Map
|
|
7
7
|
local ____exports = {}
|
|
8
|
-
local hasSubscriptions, postPEffectUpdateReordered,
|
|
8
|
+
local hasSubscriptions, postPEffectUpdateReordered, TRANSFORMATIONS, v
|
|
9
9
|
local ____exports = require("features.saveDataManager.exports")
|
|
10
10
|
local saveDataManager = ____exports.saveDataManager
|
|
11
11
|
local ____array = require("functions.array")
|
|
@@ -40,27 +40,10 @@ function postPEffectUpdateReordered(self, player)
|
|
|
40
40
|
end
|
|
41
41
|
if hasForm ~= storedForm then
|
|
42
42
|
transformations:set(playerForm, hasForm)
|
|
43
|
-
|
|
43
|
+
postTransformationFire(nil, player, playerForm, hasForm)
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
|
-
function playerTransformationChanged(self, player, playerForm, hasForm)
|
|
48
|
-
postTransformationFire(nil, player, playerForm, hasForm)
|
|
49
|
-
updateForgottenOrSoulTransformation(nil, player, playerForm, hasForm)
|
|
50
|
-
end
|
|
51
|
-
function updateForgottenOrSoulTransformation(self, player, playerForm, hasForm)
|
|
52
|
-
local subPlayer = player:GetSubPlayer()
|
|
53
|
-
if subPlayer == nil then
|
|
54
|
-
return
|
|
55
|
-
end
|
|
56
|
-
local subPlayerIndex = getPlayerIndex(nil, subPlayer)
|
|
57
|
-
local transformations = v.run.transformations:get(subPlayerIndex)
|
|
58
|
-
if transformations == nil then
|
|
59
|
-
transformations = __TS__New(Map)
|
|
60
|
-
v.run.transformations:set(subPlayerIndex, transformations)
|
|
61
|
-
end
|
|
62
|
-
transformations:set(playerForm, hasForm)
|
|
63
|
-
end
|
|
64
47
|
local UNUSED_TRANSFORMATIONS = __TS__New(Set, {PlayerForm.PLAYERFORM_FLIGHT})
|
|
65
48
|
local tempTransformations = {}
|
|
66
49
|
do
|
|
@@ -15,10 +15,10 @@ function ____exports.postItemPickupFire(self, player, pickingUpItem)
|
|
|
15
15
|
local itemType = ____value[2]
|
|
16
16
|
local itemID = ____value[3]
|
|
17
17
|
do
|
|
18
|
-
if itemType ~= nil and itemType ~= pickingUpItem.
|
|
18
|
+
if itemType ~= nil and itemType ~= pickingUpItem.itemType then
|
|
19
19
|
goto __continue5
|
|
20
20
|
end
|
|
21
|
-
if itemID ~= nil and itemID ~= pickingUpItem.
|
|
21
|
+
if itemID ~= nil and itemID ~= pickingUpItem.subType then
|
|
22
22
|
goto __continue5
|
|
23
23
|
end
|
|
24
24
|
callback(nil, player, pickingUpItem)
|
|
@@ -15,10 +15,10 @@ function ____exports.preItemPickupFire(self, player, pickingUpItem)
|
|
|
15
15
|
local itemType = ____value[2]
|
|
16
16
|
local itemID = ____value[3]
|
|
17
17
|
do
|
|
18
|
-
if itemType ~= nil and itemType ~= pickingUpItem.
|
|
18
|
+
if itemType ~= nil and itemType ~= pickingUpItem.itemType then
|
|
19
19
|
goto __continue5
|
|
20
20
|
end
|
|
21
|
-
if itemID ~= nil and itemID ~= pickingUpItem.
|
|
21
|
+
if itemID ~= nil and itemID ~= pickingUpItem.subType then
|
|
22
22
|
goto __continue5
|
|
23
23
|
end
|
|
24
24
|
callback(nil, player, pickingUpItem)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____lualib = require("lualib_bundle")
|
|
3
3
|
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
4
|
+
local __TS__ArrayFind = ____lualib.__TS__ArrayFind
|
|
4
5
|
local ____exports = {}
|
|
5
6
|
local postNPCInitSirenHelper, checkReturnFamiliarToPlayer, blacklistEntryExists, getSirenHelper, v
|
|
6
7
|
local ____errors = require("errors")
|
|
@@ -39,14 +40,12 @@ function blacklistEntryExists(self, incomingFamiliarVariant, incomingFamiliarSub
|
|
|
39
40
|
return false
|
|
40
41
|
end
|
|
41
42
|
function getSirenHelper(self, familiar)
|
|
42
|
-
local
|
|
43
|
+
local familiarPtrHash = GetPtrHash(familiar)
|
|
43
44
|
local sirenHelpers = getEntities(nil, EntityType.ENTITY_SIREN_HELPER)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
end
|
|
49
|
-
return nil
|
|
45
|
+
return __TS__ArrayFind(
|
|
46
|
+
sirenHelpers,
|
|
47
|
+
function(____, sirenHelper) return sirenHelper.Target ~= nil and GetPtrHash(sirenHelper.Target) == familiarPtrHash end
|
|
48
|
+
)
|
|
50
49
|
end
|
|
51
50
|
local FEATURE_NAME = "siren helpers"
|
|
52
51
|
local initialized = false
|
package/dist/functions/doors.lua
CHANGED
|
@@ -3,6 +3,7 @@ local ____lualib = require("lualib_bundle")
|
|
|
3
3
|
local Set = ____lualib.Set
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
6
|
+
local __TS__ArrayFind = ____lualib.__TS__ArrayFind
|
|
6
7
|
local ____exports = {}
|
|
7
8
|
local ____constants = require("constants")
|
|
8
9
|
local MAX_NUM_DOORS = ____constants.MAX_NUM_DOORS
|
|
@@ -32,12 +33,6 @@ function ____exports.getDoors(self, ...)
|
|
|
32
33
|
end
|
|
33
34
|
return doors
|
|
34
35
|
end
|
|
35
|
-
function ____exports.isAngelRoomDoor(self, door)
|
|
36
|
-
return door.TargetRoomType == RoomType.ROOM_ANGEL
|
|
37
|
-
end
|
|
38
|
-
function ____exports.isDevilRoomDoor(self, door)
|
|
39
|
-
return door.TargetRoomType == RoomType.ROOM_DEVIL
|
|
40
|
-
end
|
|
41
36
|
function ____exports.isRepentanceDoor(self, door)
|
|
42
37
|
return door.TargetRoomIndex == GridRooms.ROOM_SECRET_EXIT_IDX
|
|
43
38
|
end
|
|
@@ -57,36 +52,47 @@ function ____exports.closeDoorFast(self, door)
|
|
|
57
52
|
sprite:Play("Closed", true)
|
|
58
53
|
end
|
|
59
54
|
function ____exports.getAngelRoomDoor(self)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
local angelRoomDoors = ____exports.getDoors(nil, RoomType.ROOM_ANGEL)
|
|
56
|
+
local ____temp_0
|
|
57
|
+
if #angelRoomDoors == 0 then
|
|
58
|
+
____temp_0 = nil
|
|
59
|
+
else
|
|
60
|
+
____temp_0 = angelRoomDoors[1]
|
|
64
61
|
end
|
|
65
|
-
return
|
|
62
|
+
return ____temp_0
|
|
66
63
|
end
|
|
67
64
|
function ____exports.getDevilRoomDoor(self)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
local devilRoomDoors = ____exports.getDoors(nil, RoomType.ROOM_DEVIL)
|
|
66
|
+
local ____temp_1
|
|
67
|
+
if #devilRoomDoors == 0 then
|
|
68
|
+
____temp_1 = nil
|
|
69
|
+
else
|
|
70
|
+
____temp_1 = devilRoomDoors[1]
|
|
72
71
|
end
|
|
73
|
-
return
|
|
72
|
+
return ____temp_1
|
|
74
73
|
end
|
|
75
74
|
function ____exports.getDevilRoomOrAngelRoomDoor(self)
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
local devilRoomOrAngelRoomDoors = ____exports.getDoors(nil, RoomType.ROOM_DEVIL, RoomType.ROOM_ANGEL)
|
|
76
|
+
local ____temp_2
|
|
77
|
+
if #devilRoomOrAngelRoomDoors == 0 then
|
|
78
|
+
____temp_2 = nil
|
|
79
|
+
else
|
|
80
|
+
____temp_2 = devilRoomOrAngelRoomDoors[1]
|
|
80
81
|
end
|
|
81
|
-
return
|
|
82
|
+
return ____temp_2
|
|
82
83
|
end
|
|
83
84
|
function ____exports.getRepentanceDoor(self)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
local doors = ____exports.getDoors(nil)
|
|
86
|
+
return __TS__ArrayFind(
|
|
87
|
+
doors,
|
|
88
|
+
function(____, door) return ____exports.isRepentanceDoor(nil, door) end
|
|
89
|
+
)
|
|
90
|
+
end
|
|
91
|
+
function ____exports.isAngelRoomDoor(self, door)
|
|
92
|
+
return door.TargetRoomType == RoomType.ROOM_ANGEL
|
|
93
|
+
end
|
|
94
|
+
function ____exports.isDevilRoomDoor(self, door)
|
|
95
|
+
return door.TargetRoomType == RoomType.ROOM_DEVIL
|
|
90
96
|
end
|
|
91
97
|
function ____exports.isHiddenSecretRoomDoor(self, door)
|
|
92
98
|
local sprite = door:GetSprite()
|
|
@@ -52,6 +52,14 @@ export declare function characterGetsBlackHeartFromEternalHeart(character: Playe
|
|
|
52
52
|
* The formula for calculating it is: 32 - 2.5 * player.TearHeight
|
|
53
53
|
*/
|
|
54
54
|
export declare function getAzazelBrimstoneDistance(playerOrTearHeight: EntityPlayer | float): number;
|
|
55
|
+
/**
|
|
56
|
+
* Returns the maximum heart containers that the provided character can have. Normally, this is 12,
|
|
57
|
+
* but with Keeper it is 3, with Tainted Keeper it is 2. Does not account for Birthright or Mother's
|
|
58
|
+
* Kiss; use the `getPlayerMaxHeartContainers()` function for that.
|
|
59
|
+
*/
|
|
60
|
+
export declare function getCharacterMaxHeartContainers(character: PlayerType | int): int;
|
|
61
|
+
/** Helper function to get an array containing the characters of all of the current players. */
|
|
62
|
+
export declare function getCharacters(): number[];
|
|
55
63
|
export declare function getClosestPlayer(position: Vector): EntityPlayer;
|
|
56
64
|
/**
|
|
57
65
|
* Most characters have a 56 frame death animation (i.e. the "Death" animation).
|
|
@@ -81,14 +89,6 @@ export declare function getNewestPlayer(): EntityPlayer;
|
|
|
81
89
|
* hearts and 3 broken hearts, then this function would return 6 (i.e. 12 - 1 - 2 - 3).
|
|
82
90
|
*/
|
|
83
91
|
export declare function getPlayerAvailableHeartSlots(player: EntityPlayer): int;
|
|
84
|
-
/**
|
|
85
|
-
* Returns the maximum heart containers that the provided character can have. Normally, this is 12,
|
|
86
|
-
* but with Keeper it is 3, with Tainted Keeper it is 2. Does not account for Birthright or Mother's
|
|
87
|
-
* Kiss; use the `getPlayerMaxHeartContainers()` function for that.
|
|
88
|
-
*/
|
|
89
|
-
export declare function getCharacterMaxHeartContainers(character: PlayerType | int): int;
|
|
90
|
-
/** Helper function to get an array containing the characters of all of the current players. */
|
|
91
|
-
export declare function getCharacters(): number[];
|
|
92
92
|
/**
|
|
93
93
|
* Iterates over all players and checks if any are close enough to the specified position.
|
|
94
94
|
*
|
|
@@ -122,13 +122,15 @@ export declare function getPlayerFromIndex(playerIndex: PlayerIndex): EntityPlay
|
|
|
122
122
|
* Instead, we use `EntityPlayer.GetCollectibleRNG()` with an arbitrary value of Sad Onion (1). This
|
|
123
123
|
* works even if the player does not have any Sad Onions.
|
|
124
124
|
*
|
|
125
|
-
* Since the RNG value is the same for both The Forgotten and The Soul, we revert to using the RNG
|
|
126
|
-
* of Inner Eye (2) for The Soul.
|
|
127
|
-
*
|
|
128
125
|
* Since the RNG value is the same for both Tainted Lazarus and Dead Tainted Lazarus, we revert to
|
|
129
|
-
* using the RNG of
|
|
126
|
+
* using the RNG of The Inner Eye (2) for Dead Tainted Lazarus.
|
|
127
|
+
*
|
|
128
|
+
* Note that by default, this returns the same index for both The Forgotten and The Soul. (Even
|
|
129
|
+
* though they are technically different characters, they share the same inventory and InitSeed.) If
|
|
130
|
+
* this is not desired, pass true for the `differentiateForgottenAndSoul` argument, and the RNG of
|
|
131
|
+
* Spoon Bender (3) will be used for The Soul.
|
|
130
132
|
*/
|
|
131
|
-
export declare function getPlayerIndex(player: EntityPlayer): PlayerIndex;
|
|
133
|
+
export declare function getPlayerIndex(player: EntityPlayer, differentiateForgottenAndSoul?: boolean): PlayerIndex;
|
|
132
134
|
/**
|
|
133
135
|
* Helper function to return the index of this player with respect to the output of the
|
|
134
136
|
* `Isaac.GetPlayer()` function.
|
|
@@ -171,6 +173,12 @@ export declare function getPlayers(performExclusions?: boolean): EntityPlayer[];
|
|
|
171
173
|
* for. Returns true if any of the characters supplied are present.
|
|
172
174
|
*/
|
|
173
175
|
export declare function getPlayersOfType(...characters: Array<PlayerType | int>): EntityPlayer[];
|
|
176
|
+
/**
|
|
177
|
+
* Helper function to get a parent `EntityPlayer` object for a given `EntitySubPlayer` object. This
|
|
178
|
+
* is useful because calling the `EntityPlayer.GetSubPlayer` method on a sub-player object will
|
|
179
|
+
* return undefined.
|
|
180
|
+
*/
|
|
181
|
+
export declare function getSubPlayerParent(subPlayer: EntitySubPlayer): EntityPlayer | undefined;
|
|
174
182
|
/**
|
|
175
183
|
* Helper function to return the active charge and the battery charge combined. This is useful
|
|
176
184
|
* because you are not able to set the battery charge directly.
|
|
@@ -4,12 +4,13 @@ local Set = ____lualib.Set
|
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
6
6
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
7
|
+
local __TS__ArrayFind = ____lualib.__TS__ArrayFind
|
|
7
8
|
local Map = ____lualib.Map
|
|
8
9
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
9
10
|
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
10
11
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
11
12
|
local ____exports = {}
|
|
12
|
-
local getPlayerIndexCollectibleType, getAdjustedPlayerName, isTaintedModded, EXCLUDED_CHARACTERS
|
|
13
|
+
local getPlayerIndexCollectibleType, getAdjustedPlayerName, isTaintedModded, DEFAULT_COLLECTIBLE_TYPE, EXCLUDED_CHARACTERS
|
|
13
14
|
local ____constants = require("constants")
|
|
14
15
|
local CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART = ____constants.CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART
|
|
15
16
|
local CHARACTERS_WITH_FREE_DEVIL_DEALS = ____constants.CHARACTERS_WITH_FREE_DEVIL_DEALS
|
|
@@ -50,31 +51,45 @@ function ____exports.getCharacters(self)
|
|
|
50
51
|
function(____, player) return player:GetPlayerType() end
|
|
51
52
|
)
|
|
52
53
|
end
|
|
53
|
-
function ____exports.getPlayerIndex(self, player)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
function ____exports.getPlayerIndex(self, player, differentiateForgottenAndSoul)
|
|
55
|
+
if differentiateForgottenAndSoul == nil then
|
|
56
|
+
differentiateForgottenAndSoul = false
|
|
57
|
+
end
|
|
58
|
+
local isSubPlayer = player:IsSubPlayer()
|
|
59
|
+
local ____isSubPlayer_0
|
|
60
|
+
if isSubPlayer then
|
|
61
|
+
____isSubPlayer_0 = ____exports.getSubPlayerParent(nil, player)
|
|
62
|
+
else
|
|
63
|
+
____isSubPlayer_0 = player
|
|
64
|
+
end
|
|
65
|
+
local playerToUse = ____isSubPlayer_0
|
|
66
|
+
if playerToUse == nil then
|
|
67
|
+
error("Failed to get the sub-player parent when determining the index for the player with InitSeed: " .. tostring(player.InitSeed))
|
|
68
|
+
end
|
|
69
|
+
local collectibleType = getPlayerIndexCollectibleType(nil, player, differentiateForgottenAndSoul)
|
|
70
|
+
local collectibleRNG = playerToUse:GetCollectibleRNG(collectibleType)
|
|
57
71
|
local seed = collectibleRNG:GetSeed()
|
|
58
72
|
return seed
|
|
59
73
|
end
|
|
60
|
-
function getPlayerIndexCollectibleType(self,
|
|
74
|
+
function getPlayerIndexCollectibleType(self, player, differentiateForgottenAndSoul)
|
|
75
|
+
local character = player:GetPlayerType()
|
|
61
76
|
repeat
|
|
62
|
-
local
|
|
63
|
-
local
|
|
64
|
-
if
|
|
77
|
+
local ____switch59 = character
|
|
78
|
+
local ____cond59 = ____switch59 == PlayerType.PLAYER_THESOUL
|
|
79
|
+
if ____cond59 then
|
|
65
80
|
do
|
|
66
|
-
return CollectibleType.
|
|
81
|
+
return differentiateForgottenAndSoul and CollectibleType.COLLECTIBLE_SPOON_BENDER or DEFAULT_COLLECTIBLE_TYPE
|
|
67
82
|
end
|
|
68
83
|
end
|
|
69
|
-
|
|
70
|
-
if
|
|
84
|
+
____cond59 = ____cond59 or ____switch59 == PlayerType.PLAYER_LAZARUS2_B
|
|
85
|
+
if ____cond59 then
|
|
71
86
|
do
|
|
72
|
-
return CollectibleType.
|
|
87
|
+
return CollectibleType.COLLECTIBLE_INNER_EYE
|
|
73
88
|
end
|
|
74
89
|
end
|
|
75
90
|
do
|
|
76
91
|
do
|
|
77
|
-
return
|
|
92
|
+
return DEFAULT_COLLECTIBLE_TYPE
|
|
78
93
|
end
|
|
79
94
|
end
|
|
80
95
|
until true
|
|
@@ -95,39 +110,39 @@ end
|
|
|
95
110
|
function getAdjustedPlayerName(self, player)
|
|
96
111
|
local character = player:GetPlayerType()
|
|
97
112
|
repeat
|
|
98
|
-
local
|
|
99
|
-
local
|
|
100
|
-
if
|
|
113
|
+
local ____switch72 = character
|
|
114
|
+
local ____cond72 = ____switch72 == PlayerType.PLAYER_BLUEBABY or ____switch72 == PlayerType.PLAYER_BLUEBABY_B
|
|
115
|
+
if ____cond72 then
|
|
101
116
|
do
|
|
102
117
|
return "Blue Baby"
|
|
103
118
|
end
|
|
104
119
|
end
|
|
105
|
-
|
|
106
|
-
if
|
|
120
|
+
____cond72 = ____cond72 or ____switch72 == PlayerType.PLAYER_LAZARUS2
|
|
121
|
+
if ____cond72 then
|
|
107
122
|
do
|
|
108
123
|
return "Lazarus II"
|
|
109
124
|
end
|
|
110
125
|
end
|
|
111
|
-
|
|
112
|
-
if
|
|
126
|
+
____cond72 = ____cond72 or ____switch72 == PlayerType.PLAYER_BLACKJUDAS
|
|
127
|
+
if ____cond72 then
|
|
113
128
|
do
|
|
114
129
|
return "Dark Judas"
|
|
115
130
|
end
|
|
116
131
|
end
|
|
117
|
-
|
|
118
|
-
if
|
|
132
|
+
____cond72 = ____cond72 or ____switch72 == PlayerType.PLAYER_JACOB
|
|
133
|
+
if ____cond72 then
|
|
119
134
|
do
|
|
120
135
|
return "Jacob & Esau"
|
|
121
136
|
end
|
|
122
137
|
end
|
|
123
|
-
|
|
124
|
-
if
|
|
138
|
+
____cond72 = ____cond72 or ____switch72 == PlayerType.PLAYER_LAZARUS2_B
|
|
139
|
+
if ____cond72 then
|
|
125
140
|
do
|
|
126
141
|
return "Dead Tainted Lazarus"
|
|
127
142
|
end
|
|
128
143
|
end
|
|
129
|
-
|
|
130
|
-
if
|
|
144
|
+
____cond72 = ____cond72 or ____switch72 == PlayerType.PLAYER_JACOB2_B
|
|
145
|
+
if ____cond72 then
|
|
131
146
|
do
|
|
132
147
|
return "Dead Tainted Jacob"
|
|
133
148
|
end
|
|
@@ -151,32 +166,47 @@ function ____exports.getPlayers(self, performExclusions)
|
|
|
151
166
|
do
|
|
152
167
|
local player = Isaac.GetPlayer(i)
|
|
153
168
|
if ____exports.isChildPlayer(nil, player) then
|
|
154
|
-
goto
|
|
169
|
+
goto __continue82
|
|
155
170
|
end
|
|
156
171
|
local character = player:GetPlayerType()
|
|
157
172
|
if performExclusions and EXCLUDED_CHARACTERS:has(character) then
|
|
158
|
-
goto
|
|
173
|
+
goto __continue82
|
|
159
174
|
end
|
|
160
175
|
__TS__ArrayPush(players, player)
|
|
161
176
|
end
|
|
162
|
-
::
|
|
177
|
+
::__continue82::
|
|
163
178
|
i = i + 1
|
|
164
179
|
end
|
|
165
180
|
end
|
|
166
181
|
return players
|
|
167
182
|
end
|
|
183
|
+
function ____exports.getSubPlayerParent(self, subPlayer)
|
|
184
|
+
local subPlayerPtrHash = GetPtrHash(subPlayer)
|
|
185
|
+
local players = ____exports.getPlayers(nil)
|
|
186
|
+
return __TS__ArrayFind(
|
|
187
|
+
players,
|
|
188
|
+
function(____, player)
|
|
189
|
+
local thisPlayerSubPlayer = player:GetSubPlayer()
|
|
190
|
+
if thisPlayerSubPlayer == nil then
|
|
191
|
+
return false
|
|
192
|
+
end
|
|
193
|
+
local thisPlayerSubPlayerPtrHash = GetPtrHash(thisPlayerSubPlayer)
|
|
194
|
+
return thisPlayerSubPlayerPtrHash == subPlayerPtrHash
|
|
195
|
+
end
|
|
196
|
+
)
|
|
197
|
+
end
|
|
168
198
|
function ____exports.isChildPlayer(self, player)
|
|
169
199
|
return player.Parent ~= nil
|
|
170
200
|
end
|
|
171
201
|
function ____exports.isTainted(self, player)
|
|
172
202
|
local character = player:GetPlayerType()
|
|
173
|
-
local
|
|
203
|
+
local ____isVanillaCharacter_result_1
|
|
174
204
|
if ____exports.isVanillaCharacter(nil, player) then
|
|
175
|
-
|
|
205
|
+
____isVanillaCharacter_result_1 = character >= PlayerType.PLAYER_ISAAC_B
|
|
176
206
|
else
|
|
177
|
-
|
|
207
|
+
____isVanillaCharacter_result_1 = isTaintedModded(nil, player)
|
|
178
208
|
end
|
|
179
|
-
return
|
|
209
|
+
return ____isVanillaCharacter_result_1
|
|
180
210
|
end
|
|
181
211
|
function isTaintedModded(self, player)
|
|
182
212
|
local character = player:GetPlayerType()
|
|
@@ -191,6 +221,7 @@ end
|
|
|
191
221
|
function ____exports.isVanillaCharacter(self, player)
|
|
192
222
|
return not ____exports.isModdedCharacter(nil, player)
|
|
193
223
|
end
|
|
224
|
+
DEFAULT_COLLECTIBLE_TYPE = CollectibleType.COLLECTIBLE_SAD_ONION
|
|
194
225
|
EXCLUDED_CHARACTERS = __TS__New(Set, {PlayerType.PLAYER_ESAU, PlayerType.PLAYER_THESOUL_B})
|
|
195
226
|
function ____exports.addCollectibleCostume(self, player, collectibleType)
|
|
196
227
|
local itemConfig = Isaac.GetItemConfig()
|
|
@@ -351,12 +382,11 @@ function ____exports.getPlayerAvailableHeartSlots(self, player)
|
|
|
351
382
|
return maxHeartContainers - totalOccupiedHeartSlots
|
|
352
383
|
end
|
|
353
384
|
function ____exports.getPlayerCloserThan(self, position, distance)
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
end
|
|
358
|
-
|
|
359
|
-
return nil
|
|
385
|
+
local players = ____exports.getPlayers(nil)
|
|
386
|
+
return __TS__ArrayFind(
|
|
387
|
+
players,
|
|
388
|
+
function(____, player) return player.Position:Distance(position) <= distance end
|
|
389
|
+
)
|
|
360
390
|
end
|
|
361
391
|
function ____exports.getPlayerCollectibleMap(self, player)
|
|
362
392
|
local collectibleSet = getCollectibleSet(nil)
|
|
@@ -370,13 +400,11 @@ function ____exports.getPlayerCollectibleMap(self, player)
|
|
|
370
400
|
return collectibleMap
|
|
371
401
|
end
|
|
372
402
|
function ____exports.getPlayerFromIndex(self, playerIndex)
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
end
|
|
379
|
-
return nil
|
|
403
|
+
local players = ____exports.getPlayers(nil)
|
|
404
|
+
return __TS__ArrayFind(
|
|
405
|
+
players,
|
|
406
|
+
function(____, player) return ____exports.getPlayerIndex(nil, player) == playerIndex end
|
|
407
|
+
)
|
|
380
408
|
end
|
|
381
409
|
function ____exports.getPlayerIndexVanilla(self, playerToFind)
|
|
382
410
|
local game = Game()
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____lualib = require("lualib_bundle")
|
|
3
|
+
local __TS__ArrayFind = ____lualib.__TS__ArrayFind
|
|
3
4
|
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
4
5
|
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
5
6
|
local ____exports = {}
|
|
@@ -46,12 +47,10 @@ function ____exports.getPocketItems(self, player)
|
|
|
46
47
|
end
|
|
47
48
|
function ____exports.getFirstCardOrPill(self, player)
|
|
48
49
|
local pocketItems = ____exports.getPocketItems(nil, player)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
end
|
|
54
|
-
return nil
|
|
50
|
+
return __TS__ArrayFind(
|
|
51
|
+
pocketItems,
|
|
52
|
+
function(____, pocketItem) return pocketItem.type == PocketItemType.CARD or pocketItem.type == PocketItemType.PILL end
|
|
53
|
+
)
|
|
55
54
|
end
|
|
56
55
|
function ____exports.hasOpenPocketItemSlot(self, player)
|
|
57
56
|
local character = player:GetPlayerType()
|
package/dist/index.lua
CHANGED
|
@@ -610,6 +610,14 @@ do
|
|
|
610
610
|
end
|
|
611
611
|
end
|
|
612
612
|
end
|
|
613
|
+
do
|
|
614
|
+
local ____export = require("types.PickingUpItem")
|
|
615
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
616
|
+
if ____exportKey ~= "default" then
|
|
617
|
+
____exports[____exportKey] = ____exportValue
|
|
618
|
+
end
|
|
619
|
+
end
|
|
620
|
+
end
|
|
613
621
|
do
|
|
614
622
|
local ____export = require("types.PillEffectClass")
|
|
615
623
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
export interface PickingUpItem {
|
|
3
3
|
/** Needed so that we can distinguish between picking up a collectible and a trinket. */
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
itemType: ItemType;
|
|
5
|
+
/** Equal to either the collectible type or the trinket type. */
|
|
6
|
+
subType: CollectibleType | TrinketType | int;
|
|
6
7
|
}
|
|
8
|
+
export declare function newPickingUpItem(): PickingUpItem;
|
|
9
|
+
export declare function resetPickingUpItem(pickingUpItem: PickingUpItem): void;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____exports = {}
|
|
3
|
+
local DEFAULT_ITEM_TYPE = ItemType.ITEM_NULL
|
|
4
|
+
local DEFAULT_SUB_TYPE = CollectibleType.COLLECTIBLE_NULL
|
|
5
|
+
function ____exports.newPickingUpItem(self)
|
|
6
|
+
return {itemType = DEFAULT_ITEM_TYPE, subType = DEFAULT_SUB_TYPE}
|
|
7
|
+
end
|
|
8
|
+
function ____exports.resetPickingUpItem(self, pickingUpItem)
|
|
9
|
+
pickingUpItem.itemType = DEFAULT_ITEM_TYPE
|
|
10
|
+
pickingUpItem.subType = DEFAULT_SUB_TYPE
|
|
11
|
+
end
|
|
3
12
|
return ____exports
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.56",
|
|
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.349",
|
|
30
30
|
"isaacscript-lint": "^1.0.79",
|
|
31
31
|
"isaacscript-tsconfig": "^1.1.8",
|
|
32
32
|
"typedoc": "^0.22.12",
|