isaacscript-common 3.3.0 → 3.4.2
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/cachedClasses.d.ts +2 -1
- package/callbacks/postHolyMantleRemoved.lua +2 -2
- package/callbacks/postPlayerCollectible.d.ts +1 -0
- package/callbacks/postPlayerCollectible.lua +95 -0
- package/callbacks/subscriptions/postPlayerCollectibleAdded.d.ts +6 -0
- package/callbacks/subscriptions/postPlayerCollectibleAdded.lua +34 -0
- package/callbacks/subscriptions/postPlayerCollectibleRemoved.d.ts +6 -0
- package/callbacks/subscriptions/postPlayerCollectibleRemoved.lua +34 -0
- package/callbacks/subscriptions/postRoomClearChanged.d.ts +2 -1
- package/callbacks/subscriptions/postRoomClearChanged.lua +8 -1
- package/constants.d.ts +8 -0
- package/constants.lua +5 -0
- package/constantsFirstLast.d.ts +3 -0
- package/enums/ModCallbackCustom.d.ts +430 -177
- package/enums/ModCallbackCustom.lua +36 -32
- package/features/playerInventory.d.ts +1 -10
- package/features/playerInventory.lua +23 -60
- package/functions/array.d.ts +3 -3
- package/functions/array.lua +3 -3
- package/functions/collectibleSet.d.ts +3 -3
- package/functions/collectibleSet.lua +3 -5
- package/functions/pills.d.ts +10 -0
- package/functions/pills.lua +16 -0
- package/functions/roomData.d.ts +5 -5
- package/functions/roomData.lua +7 -7
- package/functions/rooms.d.ts +1 -4
- package/functions/rooms.lua +19 -25
- package/functions/saveFile.lua +0 -1
- package/index.d.ts +1 -1
- package/index.lua +0 -2
- package/initCustomCallbacks.lua +3 -0
- package/interfaces/AddCallbackParameterCustom.d.ts +4 -0
- package/maps/PHDPillConversions.d.ts +2 -0
- package/maps/PHDPillConversions.lua +25 -0
- package/maps/falsePHDPillConversions.d.ts +2 -0
- package/maps/falsePHDPillConversions.lua +39 -0
- package/objects/callbackRegisterFunctions.lua +6 -0
- package/package.json +2 -2
package/cachedClasses.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
/// <reference types="isaac-typescript-definitions" />
|
|
3
3
|
/// <reference types="isaac-typescript-definitions" />
|
|
4
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
4
5
|
/**
|
|
5
6
|
* A cached version of the class returned from the `Game()` constructor.
|
|
6
7
|
*
|
|
@@ -18,7 +19,7 @@ export declare const game: Game;
|
|
|
18
19
|
* Caching the results of this constructor is safe, but caching other classes (like `Level` or
|
|
19
20
|
* `Room`) is not safe and can lead to the game crashing in certain situations.
|
|
20
21
|
*/
|
|
21
|
-
export declare const itemConfig:
|
|
22
|
+
export declare const itemConfig: ItemConfig;
|
|
22
23
|
/**
|
|
23
24
|
* A cached version of the class returned from the `MusicManager()` constructor.
|
|
24
25
|
*
|
|
@@ -12,7 +12,7 @@ local ____exports = require("features.saveDataManager.exports")
|
|
|
12
12
|
local saveDataManager = ____exports.saveDataManager
|
|
13
13
|
local ____playerDataStructures = require("functions.playerDataStructures")
|
|
14
14
|
local defaultMapGetPlayer = ____playerDataStructures.defaultMapGetPlayer
|
|
15
|
-
local
|
|
15
|
+
local mapSetPlayer = ____playerDataStructures.mapSetPlayer
|
|
16
16
|
local ____postHolyMantleRemoved = require("callbacks.subscriptions.postHolyMantleRemoved")
|
|
17
17
|
local postHolyMantleRemovedFire = ____postHolyMantleRemoved.postHolyMantleRemovedFire
|
|
18
18
|
local postHolyMantleRemovedHasSubscriptions = ____postHolyMantleRemoved.postHolyMantleRemovedHasSubscriptions
|
|
@@ -26,7 +26,7 @@ function postPEffectUpdateReordered(self, player)
|
|
|
26
26
|
local effects = player:GetEffects()
|
|
27
27
|
local newNumHolyMantles = effects:GetCollectibleEffectNum(CollectibleType.HOLY_MANTLE)
|
|
28
28
|
local oldNumHolyMantles = defaultMapGetPlayer(nil, v.run.playersHolyMantleMap, player)
|
|
29
|
-
|
|
29
|
+
mapSetPlayer(nil, v.run.playersHolyMantleMap, player, newNumHolyMantles)
|
|
30
30
|
if newNumHolyMantles < oldNumHolyMantles then
|
|
31
31
|
postHolyMantleRemovedFire(nil, player, oldNumHolyMantles, newNumHolyMantles)
|
|
32
32
|
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local Map = ____lualib.Map
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
4
|
+
local __TS__Spread = ____lualib.__TS__Spread
|
|
5
|
+
local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
|
|
6
|
+
local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
|
|
7
|
+
local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
|
|
8
|
+
local ____exports = {}
|
|
9
|
+
local hasSubscriptions, postPEffectUpdate, collectibleCountChanged, v
|
|
10
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
11
|
+
local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
|
|
12
|
+
local ____DefaultMap = require("classes.DefaultMap")
|
|
13
|
+
local DefaultMap = ____DefaultMap.DefaultMap
|
|
14
|
+
local ____exports = require("features.saveDataManager.exports")
|
|
15
|
+
local saveDataManager = ____exports.saveDataManager
|
|
16
|
+
local ____player = require("functions.player")
|
|
17
|
+
local getPlayerCollectibleMap = ____player.getPlayerCollectibleMap
|
|
18
|
+
local ____playerDataStructures = require("functions.playerDataStructures")
|
|
19
|
+
local defaultMapGetPlayer = ____playerDataStructures.defaultMapGetPlayer
|
|
20
|
+
local mapGetPlayer = ____playerDataStructures.mapGetPlayer
|
|
21
|
+
local mapSetPlayer = ____playerDataStructures.mapSetPlayer
|
|
22
|
+
local ____utils = require("functions.utils")
|
|
23
|
+
local ____repeat = ____utils["repeat"]
|
|
24
|
+
local ____postPlayerCollectibleAdded = require("callbacks.subscriptions.postPlayerCollectibleAdded")
|
|
25
|
+
local postPlayerCollectibleAddedFire = ____postPlayerCollectibleAdded.postPlayerCollectibleAddedFire
|
|
26
|
+
local postPlayerCollectibleAddedHasSubscriptions = ____postPlayerCollectibleAdded.postPlayerCollectibleAddedHasSubscriptions
|
|
27
|
+
local ____postPlayerCollectibleRemoved = require("callbacks.subscriptions.postPlayerCollectibleRemoved")
|
|
28
|
+
local postPlayerCollectibleRemovedFire = ____postPlayerCollectibleRemoved.postPlayerCollectibleRemovedFire
|
|
29
|
+
local postPlayerCollectibleRemovedHasSubscriptions = ____postPlayerCollectibleRemoved.postPlayerCollectibleRemovedHasSubscriptions
|
|
30
|
+
function hasSubscriptions(self)
|
|
31
|
+
return postPlayerCollectibleAddedHasSubscriptions(nil) or postPlayerCollectibleRemovedHasSubscriptions(nil)
|
|
32
|
+
end
|
|
33
|
+
function postPEffectUpdate(self, player)
|
|
34
|
+
if not hasSubscriptions(nil) then
|
|
35
|
+
return
|
|
36
|
+
end
|
|
37
|
+
local oldCollectibleCount = mapGetPlayer(nil, v.run.playersCollectibleCount, player)
|
|
38
|
+
local newCollectibleCount = player:GetCollectibleCount()
|
|
39
|
+
mapSetPlayer(nil, v.run.playersCollectibleCount, player, newCollectibleCount)
|
|
40
|
+
if oldCollectibleCount == nil then
|
|
41
|
+
return
|
|
42
|
+
end
|
|
43
|
+
local difference = newCollectibleCount - oldCollectibleCount
|
|
44
|
+
if difference > 0 then
|
|
45
|
+
collectibleCountChanged(nil, player, difference, true)
|
|
46
|
+
elseif difference < 0 then
|
|
47
|
+
collectibleCountChanged(nil, player, difference * -1, false)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
function collectibleCountChanged(self, player, numCollectiblesChanged, increased)
|
|
51
|
+
local oldCollectibleMap = defaultMapGetPlayer(nil, v.run.playersCollectibleMap, player, player)
|
|
52
|
+
local newCollectibleMap = getPlayerCollectibleMap(nil, player)
|
|
53
|
+
mapSetPlayer(nil, v.run.playersCollectibleMap, player, newCollectibleMap)
|
|
54
|
+
local ____array_0 = __TS__SparseArrayNew(__TS__Spread(oldCollectibleMap:keys()))
|
|
55
|
+
__TS__SparseArrayPush(
|
|
56
|
+
____array_0,
|
|
57
|
+
__TS__Spread(newCollectibleMap:keys())
|
|
58
|
+
)
|
|
59
|
+
local collectibleTypes = {__TS__SparseArraySpread(____array_0)}
|
|
60
|
+
local numFired = 0
|
|
61
|
+
for ____, collectibleType in ipairs(collectibleTypes) do
|
|
62
|
+
local oldNum = oldCollectibleMap:get(collectibleType) or 0
|
|
63
|
+
local newNum = newCollectibleMap:get(collectibleType) or 0
|
|
64
|
+
local difference = math.abs(newNum - oldNum)
|
|
65
|
+
____repeat(
|
|
66
|
+
nil,
|
|
67
|
+
difference,
|
|
68
|
+
function()
|
|
69
|
+
if increased then
|
|
70
|
+
postPlayerCollectibleAddedFire(nil, player, collectibleType)
|
|
71
|
+
else
|
|
72
|
+
postPlayerCollectibleRemovedFire(nil, player, collectibleType)
|
|
73
|
+
end
|
|
74
|
+
numFired = numFired + 1
|
|
75
|
+
end
|
|
76
|
+
)
|
|
77
|
+
if numFired == numCollectiblesChanged then
|
|
78
|
+
return
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
v = {run = {
|
|
83
|
+
playersCollectibleCount = __TS__New(Map),
|
|
84
|
+
playersCollectibleMap = __TS__New(
|
|
85
|
+
DefaultMap,
|
|
86
|
+
function(____, player) return getPlayerCollectibleMap(nil, player) end
|
|
87
|
+
)
|
|
88
|
+
}}
|
|
89
|
+
---
|
|
90
|
+
-- @internal
|
|
91
|
+
function ____exports.postPlayerCollectibleCallbackInit(self, mod)
|
|
92
|
+
saveDataManager(nil, "postPlayerCollectible", v, hasSubscriptions)
|
|
93
|
+
mod:AddCallback(ModCallback.POST_PEFFECT_UPDATE, postPEffectUpdate)
|
|
94
|
+
end
|
|
95
|
+
return ____exports
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CollectibleType, PlayerType, PlayerVariant } from "isaac-typescript-definitions";
|
|
2
|
+
export declare type PostPlayerCollectibleAddedRegisterParameters = [
|
|
3
|
+
callback: (player: EntityPlayer, collectibleType: CollectibleType) => void,
|
|
4
|
+
playerVariant?: PlayerVariant,
|
|
5
|
+
character?: PlayerType
|
|
6
|
+
];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local subscriptions = {}
|
|
3
|
+
---
|
|
4
|
+
-- @internal
|
|
5
|
+
function ____exports.postPlayerCollectibleAddedHasSubscriptions(self)
|
|
6
|
+
return #subscriptions > 0
|
|
7
|
+
end
|
|
8
|
+
---
|
|
9
|
+
-- @internal
|
|
10
|
+
function ____exports.postPlayerCollectibleAddedRegister(self, ...)
|
|
11
|
+
local args = {...}
|
|
12
|
+
subscriptions[#subscriptions + 1] = args
|
|
13
|
+
end
|
|
14
|
+
---
|
|
15
|
+
-- @internal
|
|
16
|
+
function ____exports.postPlayerCollectibleAddedFire(self, player, collectibleType)
|
|
17
|
+
local character = player:GetPlayerType()
|
|
18
|
+
for ____, ____value in ipairs(subscriptions) do
|
|
19
|
+
local callback = ____value[1]
|
|
20
|
+
local playerVariant = ____value[2]
|
|
21
|
+
local callbackCharacter = ____value[3]
|
|
22
|
+
do
|
|
23
|
+
if playerVariant ~= nil and playerVariant ~= player.Variant then
|
|
24
|
+
goto __continue5
|
|
25
|
+
end
|
|
26
|
+
if callbackCharacter ~= nil and callbackCharacter ~= character then
|
|
27
|
+
goto __continue5
|
|
28
|
+
end
|
|
29
|
+
callback(nil, player, collectibleType)
|
|
30
|
+
end
|
|
31
|
+
::__continue5::
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
return ____exports
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CollectibleType, PlayerType, PlayerVariant } from "isaac-typescript-definitions";
|
|
2
|
+
export declare type PostPlayerCollectibleRemovedRegisterParameters = [
|
|
3
|
+
callback: (player: EntityPlayer, collectibleType: CollectibleType) => void,
|
|
4
|
+
playerVariant?: PlayerVariant,
|
|
5
|
+
character?: PlayerType
|
|
6
|
+
];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local subscriptions = {}
|
|
3
|
+
---
|
|
4
|
+
-- @internal
|
|
5
|
+
function ____exports.postPlayerCollectibleRemovedHasSubscriptions(self)
|
|
6
|
+
return #subscriptions > 0
|
|
7
|
+
end
|
|
8
|
+
---
|
|
9
|
+
-- @internal
|
|
10
|
+
function ____exports.postPlayerCollectibleRemovedRegister(self, ...)
|
|
11
|
+
local args = {...}
|
|
12
|
+
subscriptions[#subscriptions + 1] = args
|
|
13
|
+
end
|
|
14
|
+
---
|
|
15
|
+
-- @internal
|
|
16
|
+
function ____exports.postPlayerCollectibleRemovedFire(self, player, collectibleType)
|
|
17
|
+
local character = player:GetPlayerType()
|
|
18
|
+
for ____, ____value in ipairs(subscriptions) do
|
|
19
|
+
local callback = ____value[1]
|
|
20
|
+
local playerVariant = ____value[2]
|
|
21
|
+
local callbackCharacter = ____value[3]
|
|
22
|
+
do
|
|
23
|
+
if playerVariant ~= nil and playerVariant ~= player.Variant then
|
|
24
|
+
goto __continue5
|
|
25
|
+
end
|
|
26
|
+
if callbackCharacter ~= nil and callbackCharacter ~= character then
|
|
27
|
+
goto __continue5
|
|
28
|
+
end
|
|
29
|
+
callback(nil, player, collectibleType)
|
|
30
|
+
end
|
|
31
|
+
::__continue5::
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
return ____exports
|
|
@@ -16,7 +16,14 @@ end
|
|
|
16
16
|
function ____exports.postRoomClearChangedFire(self, roomClear)
|
|
17
17
|
for ____, ____value in ipairs(subscriptions) do
|
|
18
18
|
local callback = ____value[1]
|
|
19
|
-
|
|
19
|
+
local callbackRoomClear = ____value[2]
|
|
20
|
+
do
|
|
21
|
+
if callbackRoomClear ~= nil and callbackRoomClear ~= roomClear then
|
|
22
|
+
goto __continue5
|
|
23
|
+
end
|
|
24
|
+
callback(nil, roomClear)
|
|
25
|
+
end
|
|
26
|
+
::__continue5::
|
|
20
27
|
end
|
|
21
28
|
end
|
|
22
29
|
return ____exports
|
package/constants.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Constants
|
|
3
|
+
*/
|
|
1
4
|
import { ItemPoolType, LevelStage, RoomType } from "isaac-typescript-definitions";
|
|
2
5
|
/**
|
|
3
6
|
* The distance of the laser when Azazel does not have any range up items yet. For more info, see
|
|
@@ -82,6 +85,11 @@ export declare const LAST_STAGE: LevelStage;
|
|
|
82
85
|
/** Corresponds to the maximum value for `EntityPlayer.SamsonBerserkCharge`. */
|
|
83
86
|
export declare const MAX_TAINTED_SAMSON_BERSERK_CHARGE = 100000;
|
|
84
87
|
export declare const NUM_DIMENSIONS: number;
|
|
88
|
+
/**
|
|
89
|
+
* The pill pool for each run is comprised of one effect for each unique pill color (minus gold and
|
|
90
|
+
* horse pills.)
|
|
91
|
+
*/
|
|
92
|
+
export declare const NUM_PILLS_IN_POOL: number;
|
|
85
93
|
export declare const SECOND_IN_MILLISECONDS = 1000;
|
|
86
94
|
export declare const MINUTE_IN_MILLISECONDS: number;
|
|
87
95
|
export declare const ONE_BY_ONE_ROOM_GRID_SIZE = 135;
|
package/constants.lua
CHANGED
|
@@ -5,6 +5,8 @@ local ItemPoolType = ____isaac_2Dtypescript_2Ddefinitions.ItemPoolType
|
|
|
5
5
|
local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
|
|
6
6
|
local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
|
|
7
7
|
local TrinketSlot = ____isaac_2Dtypescript_2Ddefinitions.TrinketSlot
|
|
8
|
+
local ____constantsFirstLast = require("constantsFirstLast")
|
|
9
|
+
local NUM_NORMAL_PILL_COLORS = ____constantsFirstLast.NUM_NORMAL_PILL_COLORS
|
|
8
10
|
local ____enums = require("functions.enums")
|
|
9
11
|
local getEnumLength = ____enums.getEnumLength
|
|
10
12
|
local getLastEnumValue = ____enums.getLastEnumValue
|
|
@@ -69,6 +71,9 @@ ____exports.LAST_STAGE = getLastEnumValue(nil, LevelStage)
|
|
|
69
71
|
--- Corresponds to the maximum value for `EntityPlayer.SamsonBerserkCharge`.
|
|
70
72
|
____exports.MAX_TAINTED_SAMSON_BERSERK_CHARGE = 100000
|
|
71
73
|
____exports.NUM_DIMENSIONS = getEnumLength(nil, Dimension) - 1
|
|
74
|
+
--- The pill pool for each run is comprised of one effect for each unique pill color (minus gold and
|
|
75
|
+
-- horse pills.)
|
|
76
|
+
____exports.NUM_PILLS_IN_POOL = NUM_NORMAL_PILL_COLORS
|
|
72
77
|
____exports.SECOND_IN_MILLISECONDS = 1000
|
|
73
78
|
____exports.MINUTE_IN_MILLISECONDS = 60 * ____exports.SECOND_IN_MILLISECONDS
|
|
74
79
|
____exports.ONE_BY_ONE_ROOM_GRID_SIZE = 135
|
package/constantsFirstLast.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Constants (First and Last)
|
|
3
|
+
*/
|
|
1
4
|
import { Card, CollectibleType, PillColor, PillEffect, PlayerType, TrinketType } from "isaac-typescript-definitions";
|
|
2
5
|
/** Equal to `CollectibleType.SAD_ONION`. */
|
|
3
6
|
export declare const FIRST_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION;
|