isaacscript-common 1.2.142 → 1.2.145
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.
|
@@ -4,3 +4,9 @@
|
|
|
4
4
|
* order. This does not include active items.
|
|
5
5
|
*/
|
|
6
6
|
export declare function getPlayerInventory(player: EntityPlayer): CollectibleType[];
|
|
7
|
+
/**
|
|
8
|
+
* Helper function to add a collectible to a player. Use this instead of the
|
|
9
|
+
* `EntityPlayer.AddCollectible` method if you want the collectible that is added to be
|
|
10
|
+
* automatically tracked by the player inventory tracker feature.
|
|
11
|
+
*/
|
|
12
|
+
export declare function addCollectible(player: EntityPlayer, collectibleType: CollectibleType, charge?: int, firstTimePickingUp?: boolean, activeSlot?: ActiveSlot, varData?: int): void;
|
|
@@ -8,6 +8,8 @@ local ____exports = {}
|
|
|
8
8
|
local newPlayerInventory, useItemD4, postPlayerInit, postItemPickup, v
|
|
9
9
|
local ____featuresInitialized = require("featuresInitialized")
|
|
10
10
|
local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
|
|
11
|
+
local ____array = require("functions.array")
|
|
12
|
+
local copyArray = ____array.copyArray
|
|
11
13
|
local ____collectibleSet = require("functions.collectibleSet")
|
|
12
14
|
local getCollectibleSet = ____collectibleSet.getCollectibleSet
|
|
13
15
|
local ____player = require("functions.player")
|
|
@@ -68,6 +70,19 @@ end
|
|
|
68
70
|
function ____exports.getPlayerInventory(self, player)
|
|
69
71
|
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
70
72
|
local playerIndex = getPlayerIndex(nil, player)
|
|
71
|
-
|
|
73
|
+
local inventory = v.run.playersInventory:getAndSetDefault(playerIndex, player)
|
|
74
|
+
return copyArray(nil, inventory)
|
|
75
|
+
end
|
|
76
|
+
function ____exports.addCollectible(self, player, collectibleType, charge, firstTimePickingUp, activeSlot, varData)
|
|
77
|
+
player:AddCollectible(
|
|
78
|
+
collectibleType,
|
|
79
|
+
charge,
|
|
80
|
+
firstTimePickingUp,
|
|
81
|
+
activeSlot,
|
|
82
|
+
varData
|
|
83
|
+
)
|
|
84
|
+
local playerIndex = getPlayerIndex(nil, player)
|
|
85
|
+
local inventory = v.run.playersInventory:getAndSetDefault(playerIndex, player)
|
|
86
|
+
__TS__ArrayPush(inventory, collectibleType)
|
|
72
87
|
end
|
|
73
88
|
return ____exports
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export { addConsoleCommand, enableExtraConsoleCommands, removeConsoleCommand, }
|
|
|
9
9
|
export { forgottenSwitch } from "./features/forgottenSwitch";
|
|
10
10
|
export { getCollectibleItemPoolType } from "./features/getCollectibleItemPoolType";
|
|
11
11
|
export * from "./features/isPonyActive";
|
|
12
|
-
export { getPlayerInventory } from "./features/playerInventory";
|
|
12
|
+
export { addCollectible, getPlayerInventory } from "./features/playerInventory";
|
|
13
13
|
export { preventCollectibleRotate } from "./features/preventCollectibleRotate";
|
|
14
14
|
export { runInNGameFrames, runInNRenderFrames, runNextGameFrame, runNextRenderFrame, } from "./features/runInNFrames";
|
|
15
15
|
export * from "./features/saveDataManager/exports";
|
package/dist/index.lua
CHANGED
|
@@ -88,7 +88,9 @@ do
|
|
|
88
88
|
end
|
|
89
89
|
do
|
|
90
90
|
local ____playerInventory = require("features.playerInventory")
|
|
91
|
+
local addCollectible = ____playerInventory.addCollectible
|
|
91
92
|
local getPlayerInventory = ____playerInventory.getPlayerInventory
|
|
93
|
+
____exports.addCollectible = addCollectible
|
|
92
94
|
____exports.getPlayerInventory = getPlayerInventory
|
|
93
95
|
end
|
|
94
96
|
do
|
package/dist/upgradeMod.lua
CHANGED
|
@@ -85,6 +85,8 @@ local ____getCollectibleItemPoolType = require("features.getCollectibleItemPoolT
|
|
|
85
85
|
local getCollectibleItemPoolTypeInit = ____getCollectibleItemPoolType.getCollectibleItemPoolTypeInit
|
|
86
86
|
local ____isPonyActive = require("features.isPonyActive")
|
|
87
87
|
local isPonyActiveInit = ____isPonyActive.isPonyActiveInit
|
|
88
|
+
local ____playerInventory = require("features.playerInventory")
|
|
89
|
+
local playerInventoryInit = ____playerInventory.playerInventoryInit
|
|
88
90
|
local ____preventCollectibleRotate = require("features.preventCollectibleRotate")
|
|
89
91
|
local preventCollectibleRotateInit = ____preventCollectibleRotate.preventCollectibleRotateInit
|
|
90
92
|
local ____runInNFrames = require("features.runInNFrames")
|
|
@@ -146,6 +148,7 @@ function initFeatures(self, mod)
|
|
|
146
148
|
runInNFramesInit(nil, mod)
|
|
147
149
|
sirenHelpersInit(nil, mod)
|
|
148
150
|
isPonyActiveInit(nil, mod)
|
|
151
|
+
playerInventoryInit(nil, mod)
|
|
149
152
|
end
|
|
150
153
|
function ____exports.upgradeMod(self, modVanilla, verbose)
|
|
151
154
|
if verbose == nil then
|