isaacscript-common 1.2.174 → 1.2.177
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 +0 -1
- package/dist/callbacks/postBombInitLate.lua +0 -1
- package/dist/callbacks/postBoneSwing.lua +0 -1
- package/dist/callbacks/postCursedTeleport.lua +0 -1
- package/dist/callbacks/postCustomDoorEnter.lua +0 -1
- package/dist/callbacks/postEffectInitLate.lua +0 -1
- package/dist/callbacks/postEsauJr.lua +0 -1
- package/dist/callbacks/postFamiliarInitLate.lua +0 -1
- package/dist/callbacks/postFlip.lua +0 -1
- package/dist/callbacks/postGridEntity.lua +0 -1
- package/dist/callbacks/postGridEntityCollision.lua +0 -1
- package/dist/callbacks/postKnifeInitLate.lua +0 -1
- package/dist/callbacks/postLaserInitLate.lua +0 -1
- package/dist/callbacks/postNPCInitLate.lua +0 -1
- package/dist/callbacks/postPickupCollect.lua +0 -1
- package/dist/callbacks/postPickupInitLate.lua +0 -1
- package/dist/callbacks/postPlayerChangeHealth.lua +0 -1
- package/dist/callbacks/postPlayerChangeType.lua +0 -1
- package/dist/callbacks/postPlayerFatalDamage.lua +0 -1
- package/dist/callbacks/postPlayerInitLate.lua +0 -1
- package/dist/callbacks/postPlayerReordered.lua +0 -1
- package/dist/callbacks/postProjectileInitLate.lua +0 -1
- package/dist/callbacks/postPurchase.lua +0 -1
- package/dist/callbacks/postSlotInitUpdate.lua +0 -1
- package/dist/callbacks/postSlotRender.lua +0 -1
- package/dist/callbacks/postTearInitLate.lua +0 -1
- package/dist/callbacks/postTearInitVeryLate.lua +0 -1
- package/dist/callbacks/postTransformation.lua +0 -1
- package/dist/callbacks/postTrinketBreak.lua +0 -1
- package/dist/callbacks/preNewLevel.lua +0 -1
- package/dist/callbacks/subscriptions/postBombInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postBoneSwing.lua +0 -1
- package/dist/callbacks/subscriptions/postCursedTeleport.lua +0 -1
- package/dist/callbacks/subscriptions/postCustomDoorEnter.lua +0 -1
- package/dist/callbacks/subscriptions/postCustomRevive.lua +0 -1
- package/dist/callbacks/subscriptions/postEffectInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postEsauJr.lua +0 -1
- package/dist/callbacks/subscriptions/postFamiliarInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postFirstEsauJr.lua +0 -1
- package/dist/callbacks/subscriptions/postFirstFlip.lua +0 -1
- package/dist/callbacks/subscriptions/postFlip.lua +0 -1
- package/dist/callbacks/subscriptions/postGameStartedReordered.lua +0 -1
- package/dist/callbacks/subscriptions/postGridEntityBroken.lua +0 -1
- package/dist/callbacks/subscriptions/postGridEntityCollision.lua +0 -1
- package/dist/callbacks/subscriptions/postGridEntityInit.lua +0 -1
- package/dist/callbacks/subscriptions/postGridEntityRemove.lua +0 -1
- package/dist/callbacks/subscriptions/postGridEntityStateChange.lua +0 -1
- package/dist/callbacks/subscriptions/postGridEntityUpdate.lua +0 -1
- package/dist/callbacks/subscriptions/postItemPickup.lua +0 -1
- package/dist/callbacks/subscriptions/postKnifeInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postLaserInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postNPCInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postNewLevelReordered.lua +0 -1
- package/dist/callbacks/subscriptions/postNewRoomEarly.lua +0 -1
- package/dist/callbacks/subscriptions/postNewRoomReordered.lua +0 -1
- package/dist/callbacks/subscriptions/postPEffectUpdateReordered.lua +0 -1
- package/dist/callbacks/subscriptions/postPickupCollect.lua +0 -1
- package/dist/callbacks/subscriptions/postPickupInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postPlayerChangeHealth.lua +0 -1
- package/dist/callbacks/subscriptions/postPlayerChangeType.lua +0 -1
- package/dist/callbacks/subscriptions/postPlayerFatalDamage.lua +0 -1
- package/dist/callbacks/subscriptions/postPlayerInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postPlayerInitReordered.lua +0 -1
- package/dist/callbacks/subscriptions/postPlayerRenderReordered.lua +0 -1
- package/dist/callbacks/subscriptions/postPlayerUpdateReordered.lua +0 -1
- package/dist/callbacks/subscriptions/postProjectileInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postPurchase.lua +0 -1
- package/dist/callbacks/subscriptions/postSacrifice.lua +0 -1
- package/dist/callbacks/subscriptions/postSlotAnimationChanged.lua +0 -1
- package/dist/callbacks/subscriptions/postSlotDestroyed.lua +0 -1
- package/dist/callbacks/subscriptions/postSlotInit.lua +0 -1
- package/dist/callbacks/subscriptions/postSlotRender.lua +0 -1
- package/dist/callbacks/subscriptions/postSlotUpdate.lua +0 -1
- package/dist/callbacks/subscriptions/postTearInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postTearInitVeryLate.lua +0 -1
- package/dist/callbacks/subscriptions/postTransformation.lua +0 -1
- package/dist/callbacks/subscriptions/postTrinketBreak.lua +0 -1
- package/dist/callbacks/subscriptions/preBerserkDeath.lua +0 -1
- package/dist/callbacks/subscriptions/preCustomRevive.lua +0 -1
- package/dist/callbacks/subscriptions/preItemPickup.lua +0 -1
- package/dist/callbacks/subscriptions/preNewLevel.lua +0 -1
- package/dist/callbacks/subscriptions/roomClearChange.lua +0 -1
- package/dist/classes/DefaultMap.lua +0 -1
- package/dist/classes/ModUpgraded.lua +0 -1
- package/dist/classes/null.d.ts +6 -7
- package/dist/classes/null.lua +5 -6
- package/dist/constants.d.ts +10 -10
- package/dist/constants.lua +3 -4
- package/dist/enums/private/SerializationBrand.lua +0 -1
- package/dist/features/collectiblesSeen.d.ts +6 -0
- package/dist/features/collectiblesSeen.lua +42 -0
- package/dist/features/deployJSONRoom.lua +2 -2
- package/dist/features/disableInputs.lua +0 -1
- package/dist/features/disableSound.lua +0 -1
- package/dist/features/extraConsoleCommands/commands.d.ts +11 -11
- package/dist/features/extraConsoleCommands/commands.lua +23 -23
- package/dist/features/extraConsoleCommands/init.lua +6 -7
- package/dist/features/getCollectibleItemPoolType.lua +0 -1
- package/dist/features/isPonyActive.lua +0 -1
- package/dist/features/playerInventory.d.ts +10 -2
- package/dist/features/playerInventory.lua +51 -16
- package/dist/features/preventCollectibleRotate.lua +0 -1
- package/dist/features/runInNFrames.lua +0 -1
- package/dist/features/saveDataManager/constants.d.ts +1 -1
- package/dist/features/saveDataManager/constants.lua +1 -1
- package/dist/features/saveDataManager/exports.d.ts +6 -6
- package/dist/features/saveDataManager/exports.lua +4 -5
- package/dist/features/saveDataManager/load.lua +0 -1
- package/dist/features/saveDataManager/main.lua +0 -1
- package/dist/features/saveDataManager/maps.lua +0 -1
- package/dist/features/saveDataManager/merge.lua +5 -4
- package/dist/features/saveDataManager/save.lua +0 -1
- package/dist/features/sirenHelpers.lua +0 -1
- package/dist/features/taintedLazarusPlayers.lua +0 -1
- package/dist/featuresInitialized.d.ts +1 -1
- package/dist/featuresInitialized.lua +3 -3
- package/dist/functions/array.d.ts +39 -39
- package/dist/functions/array.lua +79 -80
- package/dist/functions/cards.d.ts +3 -3
- package/dist/functions/cards.lua +7 -8
- package/dist/functions/charge.d.ts +11 -11
- package/dist/functions/charge.lua +13 -13
- package/dist/functions/collectibleCacheFlag.lua +0 -1
- package/dist/functions/collectibleSet.lua +0 -1
- package/dist/functions/collectibles.d.ts +53 -15
- package/dist/functions/collectibles.lua +44 -21
- package/dist/functions/color.d.ts +2 -2
- package/dist/functions/color.lua +6 -6
- package/dist/functions/deepCopy.d.ts +0 -3
- package/dist/functions/deepCopy.lua +5 -23
- package/dist/functions/deepCopyTests.lua +0 -1
- package/dist/functions/doors.d.ts +8 -8
- package/dist/functions/doors.lua +16 -17
- package/dist/functions/entity.d.ts +13 -14
- package/dist/functions/entity.lua +27 -35
- package/dist/functions/entitySpecific.lua +0 -1
- package/dist/functions/familiars.lua +0 -1
- package/dist/functions/flying.lua +1 -2
- package/dist/functions/globals.lua +0 -1
- package/dist/functions/gridEntity.d.ts +1 -1
- package/dist/functions/gridEntity.lua +5 -6
- package/dist/functions/input.lua +0 -1
- package/dist/functions/jsonHelpers.d.ts +7 -7
- package/dist/functions/jsonHelpers.lua +10 -11
- package/dist/functions/jsonRoom.lua +0 -1
- package/dist/functions/log.d.ts +21 -21
- package/dist/functions/log.lua +75 -75
- package/dist/functions/map.lua +0 -1
- package/dist/functions/math.d.ts +1 -1
- package/dist/functions/math.lua +3 -4
- package/dist/functions/npc.lua +0 -1
- package/dist/functions/pickups.lua +0 -1
- package/dist/functions/player.d.ts +6 -8
- package/dist/functions/player.lua +22 -30
- package/dist/functions/playerDataStructures.lua +0 -1
- package/dist/functions/playerHealth.d.ts +1 -1
- package/dist/functions/playerHealth.lua +20 -21
- package/dist/functions/pocketItems.lua +0 -1
- package/dist/functions/positionVelocity.d.ts +3 -0
- package/dist/functions/positionVelocity.lua +19 -6
- package/dist/functions/random.d.ts +7 -7
- package/dist/functions/revive.d.ts +5 -5
- package/dist/functions/revive.lua +8 -8
- package/dist/functions/roomData.d.ts +96 -0
- package/dist/functions/roomData.lua +57 -0
- package/dist/functions/rooms.d.ts +1 -96
- package/dist/functions/rooms.lua +30 -76
- package/dist/functions/set.d.ts +2 -2
- package/dist/functions/set.lua +7 -8
- package/dist/functions/string.lua +0 -1
- package/dist/functions/transformations.lua +0 -1
- package/dist/functions/trinketCacheFlag.d.ts +4 -4
- package/dist/functions/trinketCacheFlag.lua +3 -3
- package/dist/functions/trinketGive.d.ts +7 -7
- package/dist/functions/trinketGive.lua +27 -27
- package/dist/functions/trinketSet.lua +0 -1
- package/dist/functions/trinkets.d.ts +2 -2
- package/dist/functions/trinkets.lua +6 -6
- package/dist/functions/ui.d.ts +13 -13
- package/dist/functions/ui.lua +28 -28
- package/dist/functions/utils.d.ts +6 -0
- package/dist/functions/utils.lua +7 -1
- package/dist/functions/vector.d.ts +2 -0
- package/dist/functions/vector.lua +13 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.lua +13 -0
- package/dist/lualib_bundle.lua +83 -49
- package/dist/maps/cardMap.lua +0 -1
- package/dist/maps/characterMap.lua +0 -1
- package/dist/maps/collectibleDescriptionMap.lua +0 -1
- package/dist/maps/collectibleNameMap.lua +0 -1
- package/dist/maps/gridEntityTypeToBrokenStateMap.lua +0 -1
- package/dist/maps/gridEntityXMLMap.lua +0 -1
- package/dist/maps/pillEffectMap.lua +0 -1
- package/dist/maps/roomShapeToTopLeftWallGridIndexMap.d.ts +1 -1
- package/dist/maps/roomShapeToTopLeftWallGridIndexMap.lua +1 -2
- package/dist/maps/roomTypeMap.lua +0 -1
- package/dist/maps/trinketDescriptionMap.lua +0 -1
- package/dist/maps/trinketNameMap.lua +0 -1
- package/dist/patchErrorFunctions.lua +0 -1
- package/dist/types/CollectibleIndex.d.ts +15 -0
- package/dist/types/CollectibleIndex.lua +3 -0
- package/dist/upgradeMod.lua +3 -1
- package/package.json +3 -3
package/dist/constants.d.ts
CHANGED
|
@@ -63,8 +63,8 @@ export declare const FINAL_STAGE: number;
|
|
|
63
63
|
* second TMTRAINER item subtracts one from that, and so on.
|
|
64
64
|
*/
|
|
65
65
|
export declare const FIRST_GLITCHED_COLLECTIBLE_TYPE: number;
|
|
66
|
-
export declare const GRID_INDEX_CENTER_OF_1X1_ROOM = 67;
|
|
67
66
|
export declare const GAME_FRAMES_PER_SECOND = 30;
|
|
67
|
+
export declare const GRID_INDEX_CENTER_OF_1X1_ROOM = 67;
|
|
68
68
|
export declare const ISAAC_FRAMES_PER_SECOND = 60;
|
|
69
69
|
/**
|
|
70
70
|
* This is the set of characters that look like The Lost and play the "LostDeath" animation when
|
|
@@ -81,11 +81,6 @@ export declare const MAX_NUM_DOORS = 8;
|
|
|
81
81
|
export declare const MAX_NUM_FAMILIARS = 64;
|
|
82
82
|
/** The game can only handle up to four different players. */
|
|
83
83
|
export declare const MAX_NUM_INPUTS = 4;
|
|
84
|
-
/**
|
|
85
|
-
* The maximum speed stat that a player can have. Any additional speed beyond this will not take
|
|
86
|
-
* effect.
|
|
87
|
-
*/
|
|
88
|
-
export declare const MAX_SPEED_STAT = 2;
|
|
89
84
|
/** With Birthright, it is possible for Magdalene to have 18 heart containers. */
|
|
90
85
|
export declare const MAX_PLAYER_HEART_CONTAINERS = 18;
|
|
91
86
|
export declare const MAX_PLAYER_POCKET_ITEM_SLOTS = 4;
|
|
@@ -103,6 +98,11 @@ export declare const MAX_PLAYER_TRINKET_SLOTS = 2;
|
|
|
103
98
|
* on. The maximum room index possible is 168. (It is not 169 because we start at 0 instead of 1.)
|
|
104
99
|
*/
|
|
105
100
|
export declare const MAX_ROOM_INDEX = 168;
|
|
101
|
+
/**
|
|
102
|
+
* The maximum speed stat that a player can have. Any additional speed beyond this will not take
|
|
103
|
+
* effect.
|
|
104
|
+
*/
|
|
105
|
+
export declare const MAX_SPEED_STAT = 2;
|
|
106
106
|
export declare const MAX_VANILLA_CHARACTER = PlayerType.PLAYER_THESOUL_B;
|
|
107
107
|
export declare const MAX_VANILLA_COLLECTIBLE_TYPE = CollectibleType.COLLECTIBLE_MOMS_RING;
|
|
108
108
|
export declare const NUM_DIMENSIONS = 3;
|
|
@@ -113,16 +113,16 @@ export declare const ONE_BY_ONE_ROOM_GRID_SIZE = 135;
|
|
|
113
113
|
* In vanilla, this is part of the `PillColor` enum, but we implement it as a constant in
|
|
114
114
|
* IsaacScript since it is not a real pill color.
|
|
115
115
|
*
|
|
116
|
-
* 1 << 11
|
|
116
|
+
* (1 << 11) - 1
|
|
117
117
|
*/
|
|
118
|
-
export declare const
|
|
118
|
+
export declare const PILL_COLOR_MASK = 2047;
|
|
119
119
|
/**
|
|
120
120
|
* In vanilla, this is part of the `PillColor` enum, but we implement it as a constant in
|
|
121
121
|
* IsaacScript since it is not a real pill color.
|
|
122
122
|
*
|
|
123
|
-
*
|
|
123
|
+
* 1 << 11
|
|
124
124
|
*/
|
|
125
|
-
export declare const
|
|
125
|
+
export declare const PILL_GIANT_FLAG = 2048;
|
|
126
126
|
export declare const SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES: ReadonlySet<CollectibleType>;
|
|
127
127
|
export declare const STORY_BOSSES: ReadonlySet<EntityType>;
|
|
128
128
|
/**
|
package/dist/constants.lua
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
1
|
local ____lualib = require("lualib_bundle")
|
|
3
2
|
local Set = ____lualib.Set
|
|
4
3
|
local __TS__New = ____lualib.__TS__New
|
|
@@ -79,8 +78,8 @@ ____exports.FAMILIARS_THAT_SHOOT_PLAYER_TEARS = __TS__New(Set, {
|
|
|
79
78
|
})
|
|
80
79
|
____exports.FINAL_STAGE = LevelStage.NUM_STAGES - 1
|
|
81
80
|
____exports.FIRST_GLITCHED_COLLECTIBLE_TYPE = (1 << 32) - 1
|
|
82
|
-
____exports.GRID_INDEX_CENTER_OF_1X1_ROOM = 67
|
|
83
81
|
____exports.GAME_FRAMES_PER_SECOND = 30
|
|
82
|
+
____exports.GRID_INDEX_CENTER_OF_1X1_ROOM = 67
|
|
84
83
|
____exports.ISAAC_FRAMES_PER_SECOND = 60
|
|
85
84
|
____exports.LOST_STYLE_PLAYER_TYPES = __TS__New(Set, {
|
|
86
85
|
PlayerType.PLAYER_THELOST,
|
|
@@ -92,20 +91,20 @@ ____exports.LOST_STYLE_PLAYER_TYPES = __TS__New(Set, {
|
|
|
92
91
|
____exports.MAX_NUM_DOORS = 8
|
|
93
92
|
____exports.MAX_NUM_FAMILIARS = 64
|
|
94
93
|
____exports.MAX_NUM_INPUTS = 4
|
|
95
|
-
____exports.MAX_SPEED_STAT = 2
|
|
96
94
|
____exports.MAX_PLAYER_HEART_CONTAINERS = 18
|
|
97
95
|
____exports.MAX_PLAYER_POCKET_ITEM_SLOTS = 4
|
|
98
96
|
____exports.MAX_PLAYER_SPEED_IN_UNITS = 9.8
|
|
99
97
|
____exports.MAX_PLAYER_TRINKET_SLOTS = 2
|
|
100
98
|
____exports.MAX_ROOM_INDEX = 168
|
|
99
|
+
____exports.MAX_SPEED_STAT = 2
|
|
101
100
|
____exports.MAX_VANILLA_CHARACTER = PlayerType.PLAYER_THESOUL_B
|
|
102
101
|
____exports.MAX_VANILLA_COLLECTIBLE_TYPE = CollectibleType.COLLECTIBLE_MOMS_RING
|
|
103
102
|
____exports.NUM_DIMENSIONS = 3
|
|
104
103
|
____exports.SECOND_IN_MILLISECONDS = 1000
|
|
105
104
|
____exports.MINUTE_IN_MILLISECONDS = 60 * ____exports.SECOND_IN_MILLISECONDS
|
|
106
105
|
____exports.ONE_BY_ONE_ROOM_GRID_SIZE = 135
|
|
107
|
-
____exports.PILL_GIANT_FLAG = 2048
|
|
108
106
|
____exports.PILL_COLOR_MASK = 2047
|
|
107
|
+
____exports.PILL_GIANT_FLAG = 2048
|
|
109
108
|
____exports.SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES = __TS__New(Set, {
|
|
110
109
|
CollectibleType.COLLECTIBLE_FORGET_ME_NOW,
|
|
111
110
|
CollectibleType.COLLECTIBLE_EDENS_SOUL,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/**
|
|
3
|
+
* Helper function to determine if a collectible has been previously seen on the run before this
|
|
4
|
+
* room was entered.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isCollectiblePreviouslySeen(collectible: EntityPickup): boolean;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local Set = ____lualib.Set
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
4
|
+
local ____exports = {}
|
|
5
|
+
local postPickupInitCollectible, postNewRoomEarly, v
|
|
6
|
+
local ____ModCallbacksCustom = require("enums.ModCallbacksCustom")
|
|
7
|
+
local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
|
|
8
|
+
local ____featuresInitialized = require("featuresInitialized")
|
|
9
|
+
local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
|
|
10
|
+
local ____collectibles = require("functions.collectibles")
|
|
11
|
+
local getCollectibleIndex = ____collectibles.getCollectibleIndex
|
|
12
|
+
local ____set = require("functions.set")
|
|
13
|
+
local addSetsToSet = ____set.addSetsToSet
|
|
14
|
+
local ____exports = require("features.saveDataManager.exports")
|
|
15
|
+
local saveDataManager = ____exports.saveDataManager
|
|
16
|
+
function postPickupInitCollectible(self, collectible)
|
|
17
|
+
local collectibleIndex = getCollectibleIndex(nil, collectible)
|
|
18
|
+
v.run.collectiblesSeenInThisRoom:add(collectibleIndex)
|
|
19
|
+
end
|
|
20
|
+
function postNewRoomEarly(self)
|
|
21
|
+
addSetsToSet(nil, v.run.collectiblesSeenInPreviousRooms, v.run.collectiblesSeenInThisRoom)
|
|
22
|
+
v.run.collectiblesSeenInThisRoom:clear()
|
|
23
|
+
end
|
|
24
|
+
local FEATURE_NAME = "collectibles tracker"
|
|
25
|
+
v = {run = {
|
|
26
|
+
collectiblesSeenInPreviousRooms = __TS__New(Set),
|
|
27
|
+
collectiblesSeenInThisRoom = __TS__New(Set)
|
|
28
|
+
}}
|
|
29
|
+
function ____exports.collectiblesSeenInit(self, mod)
|
|
30
|
+
saveDataManager(nil, "collectiblesSave", v)
|
|
31
|
+
mod:AddCallback(ModCallbacks.MC_POST_PICKUP_INIT, postPickupInitCollectible, PickupVariant.PICKUP_COLLECTIBLE)
|
|
32
|
+
mod:AddCallbackCustom(ModCallbacksCustom.MC_POST_NEW_ROOM_EARLY, postNewRoomEarly)
|
|
33
|
+
end
|
|
34
|
+
function ____exports.isCollectiblePreviouslySeen(self, collectible)
|
|
35
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
36
|
+
if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
|
|
37
|
+
error("You cannot request if the following pickup variant is previously seen: " .. tostring(collectible.Variant))
|
|
38
|
+
end
|
|
39
|
+
local collectibleIndex = getCollectibleIndex(nil, collectible)
|
|
40
|
+
return v.run.collectiblesSeenInPreviousRooms:has(collectibleIndex)
|
|
41
|
+
end
|
|
42
|
+
return ____exports
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
1
|
local ____lualib = require("lualib_bundle")
|
|
3
2
|
local Set = ____lualib.Set
|
|
4
3
|
local __TS__New = ____lualib.__TS__New
|
|
@@ -35,8 +34,9 @@ local ____pickups = require("functions.pickups")
|
|
|
35
34
|
local removeAllPickups = ____pickups.removeAllPickups
|
|
36
35
|
local ____random = require("functions.random")
|
|
37
36
|
local nextSeed = ____random.nextSeed
|
|
37
|
+
local ____roomData = require("functions.roomData")
|
|
38
|
+
local getRoomListIndex = ____roomData.getRoomListIndex
|
|
38
39
|
local ____rooms = require("functions.rooms")
|
|
39
|
-
local getRoomListIndex = ____rooms.getRoomListIndex
|
|
40
40
|
local gridToPos = ____rooms.gridToPos
|
|
41
41
|
local setRoomCleared = ____rooms.setRoomCleared
|
|
42
42
|
local setRoomUncleared = ____rooms.setRoomUncleared
|
|
@@ -27,6 +27,8 @@ export declare function blackMarket(): void;
|
|
|
27
27
|
* charges. (You can use negative numbers to remove charges.)
|
|
28
28
|
*/
|
|
29
29
|
export declare function bloodCharges(params: string): void;
|
|
30
|
+
/** Alias for the "blackmarket" command. */
|
|
31
|
+
export declare function bm(): void;
|
|
30
32
|
/**
|
|
31
33
|
* Gives a bomb. Provide a number to give a custom amount of bombs. (You can use negative numbers to
|
|
32
34
|
* remove bombs.)
|
|
@@ -46,8 +48,6 @@ export declare function boneHearts(params: string): void;
|
|
|
46
48
|
export declare function boss(): void;
|
|
47
49
|
/** Warps to the Boss Rush for the floor. */
|
|
48
50
|
export declare function bossRush(): void;
|
|
49
|
-
/** Alias for the "blackmarket" command. */
|
|
50
|
-
export declare function bm(): void;
|
|
51
51
|
/**
|
|
52
52
|
* Gives a broken heart. Provide a number to give a custom amount of hearts. (You can use negative
|
|
53
53
|
* numbers to remove hearts.)
|
|
@@ -92,10 +92,10 @@ export declare function coin(params: string): void;
|
|
|
92
92
|
export declare function coins(params: string): void;
|
|
93
93
|
/** Creates a crawlspace next to the player. */
|
|
94
94
|
export declare function crawlspace(): void;
|
|
95
|
-
/** Uses the D6. */
|
|
96
|
-
export declare function d6(): void;
|
|
97
95
|
/** Uses the D20. */
|
|
98
96
|
export declare function d20(): void;
|
|
97
|
+
/** Uses the D6. */
|
|
98
|
+
export declare function d6(): void;
|
|
99
99
|
/** Toggles extremely high-damage tears. */
|
|
100
100
|
export declare function damage(): void;
|
|
101
101
|
/** Alias for the "devil" command. */
|
|
@@ -135,6 +135,10 @@ export declare function getPosition(): void;
|
|
|
135
135
|
export declare function gigaBomb(params: string): void;
|
|
136
136
|
/** Alias for the "goldenbomb" command. */
|
|
137
137
|
export declare function goldBomb(): void;
|
|
138
|
+
/** Alias for the "goldenhearts" command. */
|
|
139
|
+
export declare function goldHearts(params: string): void;
|
|
140
|
+
/** Alias for the "goldenkey" command. */
|
|
141
|
+
export declare function goldKey(): void;
|
|
138
142
|
/** Gives the player a golden bomb. */
|
|
139
143
|
export declare function goldenBomb(): void;
|
|
140
144
|
/**
|
|
@@ -144,10 +148,6 @@ export declare function goldenBomb(): void;
|
|
|
144
148
|
export declare function goldenHearts(params: string): void;
|
|
145
149
|
/** Gives the player a golden key. */
|
|
146
150
|
export declare function goldenKey(): void;
|
|
147
|
-
/** Alias for the "goldenhearts" command. */
|
|
148
|
-
export declare function goldHearts(params: string): void;
|
|
149
|
-
/** Alias for the "goldenkey" command. */
|
|
150
|
-
export declare function goldKey(): void;
|
|
151
151
|
/** Alias for the "debug 2" command. */
|
|
152
152
|
export declare function grid(): void;
|
|
153
153
|
/** Alias for the "debug 11" command. */
|
|
@@ -162,7 +162,7 @@ export declare function hearts(params: string): void;
|
|
|
162
162
|
/** Alias for the "debug 6" command. */
|
|
163
163
|
export declare function hitboxes(): void;
|
|
164
164
|
/** Warps to the I AM ERROR room for the floor. */
|
|
165
|
-
export declare function
|
|
165
|
+
export declare function iAmError(): void;
|
|
166
166
|
/**
|
|
167
167
|
* Gives a key. Provide a number to give a custom amount of key. (You can use negative numbers to
|
|
168
168
|
* remove keys.)
|
|
@@ -263,10 +263,10 @@ export declare function s(params: string): void;
|
|
|
263
263
|
export declare function sacrifice(): void;
|
|
264
264
|
/** Warps to the first Secret Room on the floor. */
|
|
265
265
|
export declare function secret(): void;
|
|
266
|
-
/** Logs all of the current run's seed effects to the "log.txt" file. */
|
|
267
|
-
export declare function seedsCommand(): void;
|
|
268
266
|
/** Changes to a seeded run, using the seed of the current run. */
|
|
269
267
|
export declare function seedStick(): void;
|
|
268
|
+
/** Logs all of the current run's seed effects to the "log.txt" file. */
|
|
269
|
+
export declare function seedsCommand(): void;
|
|
270
270
|
/**
|
|
271
271
|
* Sets a charge to the player's specified active item. You must provide the active slot number and
|
|
272
272
|
* the number of charges to set.
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
1
|
local ____lualib = require("lualib_bundle")
|
|
3
2
|
local Map = ____lualib.Map
|
|
4
3
|
local __TS__StringSplit = ____lualib.__TS__StringSplit
|
|
@@ -18,10 +17,10 @@ local getCardName = ____cards.getCardName
|
|
|
18
17
|
local ____gridEntity = require("functions.gridEntity")
|
|
19
18
|
local spawnGridEntityWithVariant = ____gridEntity.spawnGridEntityWithVariant
|
|
20
19
|
local ____log = require("functions.log")
|
|
21
|
-
local logAllSeedEffects = ____log.logAllSeedEffects
|
|
22
20
|
local logEntities = ____log.logEntities
|
|
23
21
|
local logGridEntities = ____log.logGridEntities
|
|
24
22
|
local logRoom = ____log.logRoom
|
|
23
|
+
local logSeedEffects = ____log.logSeedEffects
|
|
25
24
|
local logSounds = ____log.logSounds
|
|
26
25
|
local logTemporaryEffects = ____log.logTemporaryEffects
|
|
27
26
|
local ____map = require("functions.map")
|
|
@@ -36,9 +35,10 @@ local getPlayers = ____player.getPlayers
|
|
|
36
35
|
local useActiveItemTemp = ____player.useActiveItemTemp
|
|
37
36
|
local ____playerHealth = require("functions.playerHealth")
|
|
38
37
|
local addPlayerHealthType = ____playerHealth.addPlayerHealthType
|
|
38
|
+
local ____roomData = require("functions.roomData")
|
|
39
|
+
local getRoomData = ____roomData.getRoomData
|
|
39
40
|
local ____rooms = require("functions.rooms")
|
|
40
41
|
local changeRoom = ____rooms.changeRoom
|
|
41
|
-
local getRoomData = ____rooms.getRoomData
|
|
42
42
|
local getRoomGridIndexesForType = ____rooms.getRoomGridIndexesForType
|
|
43
43
|
local gridToPos = ____rooms.gridToPos
|
|
44
44
|
local ____run = require("functions.run")
|
|
@@ -77,10 +77,17 @@ function ____exports.goldenBomb(self)
|
|
|
77
77
|
local player = Isaac.GetPlayer()
|
|
78
78
|
player:AddGoldenBomb()
|
|
79
79
|
end
|
|
80
|
+
function ____exports.goldenHearts(self, params)
|
|
81
|
+
addHeart(nil, params, HealthType.GOLDEN)
|
|
82
|
+
end
|
|
83
|
+
function ____exports.goldenKey(self)
|
|
84
|
+
local player = Isaac.GetPlayer()
|
|
85
|
+
player:AddGoldenKey()
|
|
86
|
+
end
|
|
80
87
|
function ____exports.hearts(self, params)
|
|
81
88
|
addHeart(nil, params, HealthType.RED)
|
|
82
89
|
end
|
|
83
|
-
function ____exports.
|
|
90
|
+
function ____exports.iAmError(self)
|
|
84
91
|
changeRoom(nil, GridRooms.ROOM_ERROR_IDX)
|
|
85
92
|
end
|
|
86
93
|
function ____exports.soulHearts(self, params)
|
|
@@ -279,6 +286,9 @@ function ____exports.bloodCharges(self, params)
|
|
|
279
286
|
local player = Isaac.GetPlayer()
|
|
280
287
|
player:AddBloodCharge(charges)
|
|
281
288
|
end
|
|
289
|
+
function ____exports.bm(self)
|
|
290
|
+
____exports.blackMarket(nil)
|
|
291
|
+
end
|
|
282
292
|
function ____exports.bomb(self, params)
|
|
283
293
|
local numBombs = 1
|
|
284
294
|
if params ~= "" then
|
|
@@ -314,9 +324,6 @@ end
|
|
|
314
324
|
function ____exports.bossRush(self)
|
|
315
325
|
changeRoom(nil, GridRooms.ROOM_BOSSRUSH_IDX)
|
|
316
326
|
end
|
|
317
|
-
function ____exports.bm(self)
|
|
318
|
-
____exports.blackMarket(nil)
|
|
319
|
-
end
|
|
320
327
|
function ____exports.brokenHearts(self, params)
|
|
321
328
|
addHeart(nil, params, HealthType.BROKEN)
|
|
322
329
|
end
|
|
@@ -448,14 +455,14 @@ end
|
|
|
448
455
|
function ____exports.crawlspace(self)
|
|
449
456
|
spawnTrapdoorOrCrawlspace(nil, false)
|
|
450
457
|
end
|
|
451
|
-
function ____exports.d6(self)
|
|
452
|
-
local player = Isaac.GetPlayer()
|
|
453
|
-
useActiveItemTemp(nil, player, CollectibleType.COLLECTIBLE_D6)
|
|
454
|
-
end
|
|
455
458
|
function ____exports.d20(self)
|
|
456
459
|
local player = Isaac.GetPlayer()
|
|
457
460
|
useActiveItemTemp(nil, player, CollectibleType.COLLECTIBLE_D20)
|
|
458
461
|
end
|
|
462
|
+
function ____exports.d6(self)
|
|
463
|
+
local player = Isaac.GetPlayer()
|
|
464
|
+
useActiveItemTemp(nil, player, CollectibleType.COLLECTIBLE_D6)
|
|
465
|
+
end
|
|
459
466
|
function ____exports.damage(self)
|
|
460
467
|
v.run.maxDamage = not v.run.maxDamage
|
|
461
468
|
printEnabled(nil, v.run.maxDamage, "debug damage")
|
|
@@ -485,7 +492,7 @@ function ____exports.eh(self, params)
|
|
|
485
492
|
____exports.eternalHearts(nil, params)
|
|
486
493
|
end
|
|
487
494
|
function ____exports.error(self)
|
|
488
|
-
____exports.
|
|
495
|
+
____exports.iAmError(nil)
|
|
489
496
|
end
|
|
490
497
|
function ____exports.fool(self)
|
|
491
498
|
____exports.startingRoom(nil)
|
|
@@ -515,13 +522,6 @@ end
|
|
|
515
522
|
function ____exports.goldBomb(self)
|
|
516
523
|
____exports.goldenBomb(nil)
|
|
517
524
|
end
|
|
518
|
-
function ____exports.goldenHearts(self, params)
|
|
519
|
-
addHeart(nil, params, HealthType.GOLDEN)
|
|
520
|
-
end
|
|
521
|
-
function ____exports.goldenKey(self)
|
|
522
|
-
local player = Isaac.GetPlayer()
|
|
523
|
-
player:AddGoldenKey()
|
|
524
|
-
end
|
|
525
525
|
function ____exports.goldHearts(self, params)
|
|
526
526
|
____exports.goldenHearts(nil, params)
|
|
527
527
|
end
|
|
@@ -755,15 +755,15 @@ end
|
|
|
755
755
|
function ____exports.secret(self)
|
|
756
756
|
warpToRoomType(nil, RoomType.ROOM_SECRET)
|
|
757
757
|
end
|
|
758
|
-
function ____exports.seedsCommand(self)
|
|
759
|
-
logAllSeedEffects()
|
|
760
|
-
printConsole(nil, "Logged the seed effects to the \"log.txt\" file.")
|
|
761
|
-
end
|
|
762
758
|
function ____exports.seedStick(self)
|
|
763
759
|
local seeds = game:GetSeeds()
|
|
764
760
|
local startSeedString = seeds:GetStartSeedString()
|
|
765
761
|
Isaac.ExecuteCommand("seed " .. startSeedString)
|
|
766
762
|
end
|
|
763
|
+
function ____exports.seedsCommand(self)
|
|
764
|
+
logSeedEffects()
|
|
765
|
+
printConsole(nil, "Logged the seed effects to the \"log.txt\" file.")
|
|
766
|
+
end
|
|
767
767
|
function ____exports.setCharges(self, params)
|
|
768
768
|
if params == "" then
|
|
769
769
|
printConsole(nil, "You must specify a slot number and a charge amount. (Use 0 for the primary slot, 1 for the Schoolbag slot, 2 for the pocket item slot, and 3 for the Dice Bag slot.)")
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
1
|
local ____lualib = require("lualib_bundle")
|
|
3
2
|
local Map = ____lualib.Map
|
|
4
3
|
local __TS__New = ____lualib.__TS__New
|
|
@@ -101,12 +100,12 @@ commandFunctionsMap:set("bh", commands.bh)
|
|
|
101
100
|
commandFunctionsMap:set("blackhearts", commands.blackHearts)
|
|
102
101
|
commandFunctionsMap:set("blackmarket", commands.blackMarket)
|
|
103
102
|
commandFunctionsMap:set("bloodcharges", commands.bloodCharges)
|
|
103
|
+
commandFunctionsMap:set("bm", commands.bm)
|
|
104
104
|
commandFunctionsMap:set("bomb", commands.bomb)
|
|
105
105
|
commandFunctionsMap:set("bombs", commands.bombs)
|
|
106
106
|
commandFunctionsMap:set("bonehearts", commands.boneHearts)
|
|
107
107
|
commandFunctionsMap:set("boss", commands.boss)
|
|
108
108
|
commandFunctionsMap:set("bossrush", commands.bossRush)
|
|
109
|
-
commandFunctionsMap:set("bm", commands.bm)
|
|
110
109
|
commandFunctionsMap:set("brokenhearts", commands.brokenHearts)
|
|
111
110
|
commandFunctionsMap:set("card", commands.card)
|
|
112
111
|
commandFunctionsMap:set("cards", commands.cards)
|
|
@@ -118,8 +117,8 @@ commandFunctionsMap:set("cleanbedroom", commands.cleanBedroom)
|
|
|
118
117
|
commandFunctionsMap:set("coin", commands.coin)
|
|
119
118
|
commandFunctionsMap:set("coins", commands.coins)
|
|
120
119
|
commandFunctionsMap:set("crawlspace", commands.crawlspace)
|
|
121
|
-
commandFunctionsMap:set("d6", commands.d6)
|
|
122
120
|
commandFunctionsMap:set("d20", commands.d20)
|
|
121
|
+
commandFunctionsMap:set("d6", commands.d6)
|
|
123
122
|
commandFunctionsMap:set("damage", commands.damage)
|
|
124
123
|
commandFunctionsMap:set("dd", commands.dd)
|
|
125
124
|
commandFunctionsMap:set("devil", commands.devil)
|
|
@@ -135,17 +134,17 @@ commandFunctionsMap:set("fool", commands.fool)
|
|
|
135
134
|
commandFunctionsMap:set("getposition", commands.getPosition)
|
|
136
135
|
commandFunctionsMap:set("gigabomb", commands.gigaBomb)
|
|
137
136
|
commandFunctionsMap:set("goldbomb", commands.goldBomb)
|
|
137
|
+
commandFunctionsMap:set("goldhearts", commands.goldHearts)
|
|
138
|
+
commandFunctionsMap:set("goldkey", commands.goldKey)
|
|
138
139
|
commandFunctionsMap:set("goldenbomb", commands.goldenBomb)
|
|
139
140
|
commandFunctionsMap:set("goldenhearts", commands.goldenHearts)
|
|
140
141
|
commandFunctionsMap:set("goldenkey", commands.goldenKey)
|
|
141
|
-
commandFunctionsMap:set("goldhearts", commands.goldHearts)
|
|
142
|
-
commandFunctionsMap:set("goldkey", commands.goldKey)
|
|
143
142
|
commandFunctionsMap:set("grid", commands.grid)
|
|
144
143
|
commandFunctionsMap:set("grid2", commands.grid2)
|
|
145
144
|
commandFunctionsMap:set("h", commands.h)
|
|
146
145
|
commandFunctionsMap:set("hearts", commands.hearts)
|
|
147
146
|
commandFunctionsMap:set("hitboxes", commands.hitboxes)
|
|
148
|
-
commandFunctionsMap:set("iamerror", commands.
|
|
147
|
+
commandFunctionsMap:set("iamerror", commands.iAmError)
|
|
149
148
|
commandFunctionsMap:set("key", commands.key)
|
|
150
149
|
commandFunctionsMap:set("keys", commands.keys)
|
|
151
150
|
commandFunctionsMap:set("library", commands.library)
|
|
@@ -173,8 +172,8 @@ commandFunctionsMap:set("rottenhearts", commands.rottenHearts)
|
|
|
173
172
|
commandFunctionsMap:set("s", commands.s)
|
|
174
173
|
commandFunctionsMap:set("sacrifice", commands.sacrifice)
|
|
175
174
|
commandFunctionsMap:set("secret", commands.secret)
|
|
176
|
-
commandFunctionsMap:set("seeds", commands.seedsCommand)
|
|
177
175
|
commandFunctionsMap:set("seedstick", commands.seedStick)
|
|
176
|
+
commandFunctionsMap:set("seeds", commands.seedsCommand)
|
|
178
177
|
commandFunctionsMap:set("setcharges", commands.setCharges)
|
|
179
178
|
commandFunctionsMap:set("setposition", commands.setPosition)
|
|
180
179
|
commandFunctionsMap:set("sh", commands.sh)
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
/**
|
|
3
3
|
* Helper function to get all of the collectibles that the player has gotten so far on this run, in
|
|
4
|
-
* order.
|
|
4
|
+
* order.
|
|
5
|
+
*
|
|
6
|
+
* Note that this does not include active collectibles that have since been dropped for other
|
|
7
|
+
* collectibles.
|
|
8
|
+
*
|
|
9
|
+
* In the case of inventory initialization or the case where the player rerolls their build in the
|
|
10
|
+
* middle of the run (e.g. with D4), the order of the inventory will not correspond to the order
|
|
11
|
+
* that the items were actually given to the player. In this case, the inventory will be in the
|
|
12
|
+
* order of the lowest `CollectibleType` to the highest.
|
|
5
13
|
*/
|
|
6
|
-
export declare function getPlayerInventory(player: EntityPlayer): CollectibleType[];
|
|
14
|
+
export declare function getPlayerInventory(player: EntityPlayer, includeActiveCollectibles?: boolean): CollectibleType[];
|
|
7
15
|
/**
|
|
8
16
|
* Helper function to add a collectible to a player. Use this instead of the
|
|
9
17
|
* `EntityPlayer.AddCollectible` method if you want the collectible that is added to be
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
1
|
local ____lualib = require("lualib_bundle")
|
|
3
|
-
local __TS__New = ____lualib.__TS__New
|
|
4
2
|
local Set = ____lualib.Set
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
5
4
|
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
6
5
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
6
|
+
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
7
7
|
local ____exports = {}
|
|
8
|
-
local newPlayerInventory, useItemD4, postGameStarted, postItemPickup, v
|
|
8
|
+
local newPlayerInventory, useItemD4, postGameStarted, postItemPickup, addCollectibleToInventory, COLLECTIBLE_ITEM_TYPES, v
|
|
9
9
|
local ____DefaultMap = require("classes.DefaultMap")
|
|
10
10
|
local DefaultMap = ____DefaultMap.DefaultMap
|
|
11
11
|
local ____ModCallbacksCustom = require("enums.ModCallbacksCustom")
|
|
@@ -13,7 +13,10 @@ local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
|
|
|
13
13
|
local ____featuresInitialized = require("featuresInitialized")
|
|
14
14
|
local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
|
|
15
15
|
local ____array = require("functions.array")
|
|
16
|
+
local arrayRemoveInPlace = ____array.arrayRemoveInPlace
|
|
16
17
|
local copyArray = ____array.copyArray
|
|
18
|
+
local ____collectibles = require("functions.collectibles")
|
|
19
|
+
local isActiveCollectible = ____collectibles.isActiveCollectible
|
|
17
20
|
local ____collectibleSet = require("functions.collectibleSet")
|
|
18
21
|
local getCollectibleSet = ____collectibleSet.getCollectibleSet
|
|
19
22
|
local ____player = require("functions.player")
|
|
@@ -53,28 +56,62 @@ function postGameStarted(self)
|
|
|
53
56
|
end
|
|
54
57
|
end
|
|
55
58
|
function postItemPickup(self, player, pickingUpItem)
|
|
56
|
-
if
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
if not COLLECTIBLE_ITEM_TYPES:has(pickingUpItem.itemType) then
|
|
60
|
+
return
|
|
61
|
+
end
|
|
62
|
+
addCollectibleToInventory(nil, player, pickingUpItem.subType)
|
|
63
|
+
end
|
|
64
|
+
function addCollectibleToInventory(self, player, collectibleType)
|
|
65
|
+
local playerIndex = getPlayerIndex(nil, player)
|
|
66
|
+
local inventory = v.run.playersInventory:getAndSetDefault(playerIndex, player)
|
|
67
|
+
__TS__ArrayPush(inventory, collectibleType)
|
|
68
|
+
if not isActiveCollectible(nil, collectibleType) then
|
|
69
|
+
return
|
|
70
|
+
end
|
|
71
|
+
local activeCollectibleTypes = v.run.playersActiveCollectibleTypes:getAndSetDefault(playerIndex)
|
|
72
|
+
__TS__ArrayPush(activeCollectibleTypes, collectibleType)
|
|
73
|
+
local droppedActiveCollectibleTypes = __TS__ArrayFilter(
|
|
74
|
+
activeCollectibleTypes,
|
|
75
|
+
function(____, activeCollectibleType) return not player:HasCollectible(activeCollectibleType) end
|
|
76
|
+
)
|
|
77
|
+
for ____, activeCollectibleType in ipairs(droppedActiveCollectibleTypes) do
|
|
78
|
+
arrayRemoveInPlace(nil, inventory, activeCollectibleType)
|
|
79
|
+
arrayRemoveInPlace(nil, activeCollectibleTypes, activeCollectibleType)
|
|
60
80
|
end
|
|
61
81
|
end
|
|
62
82
|
local FEATURE_NAME = "player inventory tracker"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
83
|
+
COLLECTIBLE_ITEM_TYPES = __TS__New(Set, {ItemType.ITEM_PASSIVE, ItemType.ITEM_ACTIVE, ItemType.ITEM_FAMILIAR})
|
|
84
|
+
v = {run = {
|
|
85
|
+
playersInventory = __TS__New(
|
|
86
|
+
DefaultMap,
|
|
87
|
+
function(____, _key, player) return newPlayerInventory(nil, player) end
|
|
88
|
+
),
|
|
89
|
+
playersActiveCollectibleTypes = __TS__New(
|
|
90
|
+
DefaultMap,
|
|
91
|
+
function() return {} end
|
|
92
|
+
)
|
|
93
|
+
}}
|
|
67
94
|
function ____exports.playerInventoryInit(self, mod)
|
|
68
95
|
saveDataManager(nil, "playerInventory", v)
|
|
69
96
|
mod:AddCallback(ModCallbacks.MC_USE_ITEM, useItemD4, CollectibleType.COLLECTIBLE_D4)
|
|
70
97
|
mod:AddCallback(ModCallbacks.MC_POST_GAME_STARTED, postGameStarted)
|
|
71
98
|
mod:AddCallbackCustom(ModCallbacksCustom.MC_POST_ITEM_PICKUP, postItemPickup)
|
|
72
99
|
end
|
|
73
|
-
function ____exports.getPlayerInventory(self, player)
|
|
100
|
+
function ____exports.getPlayerInventory(self, player, includeActiveCollectibles)
|
|
101
|
+
if includeActiveCollectibles == nil then
|
|
102
|
+
includeActiveCollectibles = true
|
|
103
|
+
end
|
|
74
104
|
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
75
105
|
local playerIndex = getPlayerIndex(nil, player)
|
|
76
106
|
local inventory = v.run.playersInventory:getAndSetDefault(playerIndex, player)
|
|
77
|
-
|
|
107
|
+
local copiedInventory = copyArray(nil, inventory)
|
|
108
|
+
if includeActiveCollectibles then
|
|
109
|
+
return copiedInventory
|
|
110
|
+
end
|
|
111
|
+
return __TS__ArrayFilter(
|
|
112
|
+
copiedInventory,
|
|
113
|
+
function(____, collectibleType) return not isActiveCollectible(nil, collectibleType) end
|
|
114
|
+
)
|
|
78
115
|
end
|
|
79
116
|
function ____exports.addCollectible(self, player, collectibleType, charge, firstTimePickingUp, activeSlot, varData)
|
|
80
117
|
player:AddCollectible(
|
|
@@ -84,8 +121,6 @@ function ____exports.addCollectible(self, player, collectibleType, charge, first
|
|
|
84
121
|
activeSlot,
|
|
85
122
|
varData
|
|
86
123
|
)
|
|
87
|
-
|
|
88
|
-
local inventory = v.run.playersInventory:getAndSetDefault(playerIndex, player)
|
|
89
|
-
__TS__ArrayPush(inventory, collectibleType)
|
|
124
|
+
addCollectibleToInventory(nil, player, collectibleType)
|
|
90
125
|
end
|
|
91
126
|
return ____exports
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const SAVE_DATA_MANAGER_FEATURE_NAME = "save data manager";
|
|
2
1
|
/** Set this to true to enable more verbosity in the save data manger. */
|
|
3
2
|
export declare const SAVE_DATA_MANAGER_DEBUG = false;
|
|
3
|
+
export declare const SAVE_DATA_MANAGER_FEATURE_NAME = "save data manager";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____exports = {}
|
|
3
|
-
____exports.SAVE_DATA_MANAGER_FEATURE_NAME = "save data manager"
|
|
4
3
|
____exports.SAVE_DATA_MANAGER_DEBUG = false
|
|
4
|
+
____exports.SAVE_DATA_MANAGER_FEATURE_NAME = "save data manager"
|
|
5
5
|
return ____exports
|
|
@@ -76,12 +76,6 @@ import { SaveData } from "../../types/private/SaveData";
|
|
|
76
76
|
* variables on run/level/room, but not clutter the the "save#.dat" file with unnecessary keys.
|
|
77
77
|
*/
|
|
78
78
|
export declare function saveDataManager(key: string, v: SaveData, conditionalFunc?: () => boolean): void;
|
|
79
|
-
/**
|
|
80
|
-
* The save data manager will automatically save variables to disk at the appropriate times (i.e.
|
|
81
|
-
* when the run is exited). Use this function to explicitly force the save data manager to write all
|
|
82
|
-
* of its variables to disk immediately.
|
|
83
|
-
*/
|
|
84
|
-
export declare function saveDataManagerSave(): void;
|
|
85
79
|
/**
|
|
86
80
|
* The save data manager will automatically load variables from disk at the appropriate times (i.e.
|
|
87
81
|
* when a new run is started). Use this function to explicitly force the save data manager to load
|
|
@@ -90,6 +84,12 @@ export declare function saveDataManagerSave(): void;
|
|
|
90
84
|
* Note that doing this will overwrite current data, which can potentially result in lost state.
|
|
91
85
|
*/
|
|
92
86
|
export declare function saveDataManagerLoad(): void;
|
|
87
|
+
/**
|
|
88
|
+
* The save data manager will automatically save variables to disk at the appropriate times (i.e.
|
|
89
|
+
* when the run is exited). Use this function to explicitly force the save data manager to write all
|
|
90
|
+
* of its variables to disk immediately.
|
|
91
|
+
*/
|
|
92
|
+
export declare function saveDataManagerSave(): void;
|
|
93
93
|
/**
|
|
94
94
|
* Sets the global variable of "g" equal to all of the save data variables for this mod.
|
|
95
95
|
* Sets the global variable of "gd" equal to all of the save data default variables for this mod.
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
1
|
local ____lualib = require("lualib_bundle")
|
|
3
2
|
local Map = ____lualib.Map
|
|
4
3
|
local __TS__ObjectKeys = ____lualib.__TS__ObjectKeys
|
|
@@ -40,14 +39,14 @@ function ____exports.saveDataManager(self, key, v, conditionalFunc)
|
|
|
40
39
|
saveDataConditionalFuncMap:set(key, conditionalFunc)
|
|
41
40
|
end
|
|
42
41
|
end
|
|
43
|
-
function ____exports.saveDataManagerSave(self)
|
|
44
|
-
errorIfFeaturesNotInitialized(nil, SAVE_DATA_MANAGER_FEATURE_NAME)
|
|
45
|
-
forceSaveDataManagerSave(nil)
|
|
46
|
-
end
|
|
47
42
|
function ____exports.saveDataManagerLoad(self)
|
|
48
43
|
errorIfFeaturesNotInitialized(nil, SAVE_DATA_MANAGER_FEATURE_NAME)
|
|
49
44
|
forceSaveDataManagerLoad(nil)
|
|
50
45
|
end
|
|
46
|
+
function ____exports.saveDataManagerSave(self)
|
|
47
|
+
errorIfFeaturesNotInitialized(nil, SAVE_DATA_MANAGER_FEATURE_NAME)
|
|
48
|
+
forceSaveDataManagerSave(nil)
|
|
49
|
+
end
|
|
51
50
|
function ____exports.saveDataManagerSetGlobal(self)
|
|
52
51
|
g = saveDataMap
|
|
53
52
|
gd = saveDataDefaultsMap
|