isaacscript-common 9.0.1 → 9.2.0
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/postPlayerCollectible.d.ts.map +1 -1
- package/dist/callbacks/postPlayerCollectible.lua +63 -58
- package/dist/enums/ModCallbackCustom.d.ts +4 -2
- package/dist/enums/ModCallbackCustom.d.ts.map +1 -1
- package/dist/features/customTrapdoor/exports.d.ts +0 -6
- package/dist/features/customTrapdoor/exports.d.ts.map +1 -1
- package/dist/features/customTrapdoor/exports.lua +0 -6
- package/dist/features/playerInventory.d.ts.map +1 -1
- package/dist/features/playerInventory.lua +4 -48
- package/dist/features/saveDataManager/main.d.ts.map +1 -1
- package/dist/features/saveDataManager/main.lua +8 -0
- package/dist/functions/debug.d.ts +25 -0
- package/dist/functions/debug.d.ts.map +1 -1
- package/dist/functions/debug.lua +50 -0
- package/dist/functions/log.d.ts +2 -7
- package/dist/functions/log.d.ts.map +1 -1
- package/dist/functions/log.lua +9 -31
- package/dist/functions/stage.d.ts +7 -0
- package/dist/functions/stage.d.ts.map +1 -1
- package/dist/functions/stage.lua +9 -0
- package/dist/index.d.ts +14 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.lua +0 -8
- package/package.json +1 -1
- package/src/callbacks/postPlayerCollectible.ts +126 -69
- package/src/enums/ModCallbackCustom.ts +4 -2
- package/src/features/customTrapdoor/exports.ts +0 -6
- package/src/features/playerInventory.ts +5 -61
- package/src/features/saveDataManager/main.ts +15 -0
- package/src/functions/debug.ts +49 -0
- package/src/functions/log.ts +15 -35
- package/src/functions/stage.ts +13 -0
- package/src/index.ts +0 -1
- package/dist/functions/dev.d.ts +0 -20
- package/dist/functions/dev.d.ts.map +0 -1
- package/dist/functions/dev.lua +0 -34
- package/src/functions/dev.ts +0 -31
package/dist/index.d.ts
CHANGED
|
@@ -6489,6 +6489,8 @@ export declare function logAllGridEntities(this: void, includeWalls: boolean, gr
|
|
|
6489
6489
|
|
|
6490
6490
|
export declare function logArray<T>(this: void, array: T[] | readonly T[]): void;
|
|
6491
6491
|
|
|
6492
|
+
export declare function logCollectibleTypes(this: void, collectibleTypes: CollectibleType[]): void;
|
|
6493
|
+
|
|
6492
6494
|
export declare function logColor(this: void, color: Color): void;
|
|
6493
6495
|
|
|
6494
6496
|
/** Helper function for printing out every damage flag that is turned on. Useful when debugging. */
|
|
@@ -7581,7 +7583,8 @@ export declare enum ModCallbackCustom {
|
|
|
7581
7583
|
POST_PLAYER_CHANGE_TYPE = 57,
|
|
7582
7584
|
/**
|
|
7583
7585
|
* Fires from the `POST_PEFFECT_UPDATE` callback when a player's collectible count is higher than
|
|
7584
|
-
* what it was on the previous frame or when
|
|
7586
|
+
* what it was on the previous frame, or when the active items change, or when the build is
|
|
7587
|
+
* rerolled.
|
|
7585
7588
|
*
|
|
7586
7589
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
7587
7590
|
* only fire if the collectible matches the `CollectibleType` provided.
|
|
@@ -7596,7 +7599,8 @@ export declare enum ModCallbackCustom {
|
|
|
7596
7599
|
POST_PLAYER_COLLECTIBLE_ADDED = 58,
|
|
7597
7600
|
/**
|
|
7598
7601
|
* Fires from the `POST_PEFFECT_UPDATE` callback when a player's collectible count is lower than
|
|
7599
|
-
* what it was on the previous frame or when
|
|
7602
|
+
* what it was on the previous frame, or when the active items change, or when the build is
|
|
7603
|
+
* rerolled.
|
|
7600
7604
|
*
|
|
7601
7605
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
7602
7606
|
* only fire if the collectible matches the `CollectibleType` provided.
|
|
@@ -8251,6 +8255,14 @@ export declare const ONE_BY_ONE_ROOM_GRID_SIZE = 135;
|
|
|
8251
8255
|
*/
|
|
8252
8256
|
export declare function onFinalFloor(): boolean;
|
|
8253
8257
|
|
|
8258
|
+
/**
|
|
8259
|
+
* Returns whether or not the player is on the first floor of the particular run.
|
|
8260
|
+
*
|
|
8261
|
+
* This is tricky to determine because we have to handle the cases of Downpour/Dross 1 not being the
|
|
8262
|
+
* first floor and The Ascent.
|
|
8263
|
+
*/
|
|
8264
|
+
export declare function onFirstFloor(): boolean;
|
|
8265
|
+
|
|
8254
8266
|
export declare function onRepentanceStage(): boolean;
|
|
8255
8267
|
|
|
8256
8268
|
/**
|
|
@@ -10859,12 +10871,6 @@ export declare function spawnCustomGridEntity(gridEntityTypeCustom: GridEntityTy
|
|
|
10859
10871
|
* want to create a custom trapdoor that goes to a vanilla stage instead, use the
|
|
10860
10872
|
* `spawnCustomTrapdoorToVanilla` helper function.
|
|
10861
10873
|
*
|
|
10862
|
-
* Custom trapdoors can have one or more of the following attributes:
|
|
10863
|
-
*
|
|
10864
|
-
* - custom destination (or custom logic for after the player enters)
|
|
10865
|
-
* - custom graphics
|
|
10866
|
-
* - custom logic for opening/closing
|
|
10867
|
-
*
|
|
10868
10874
|
* Under the hood, the custom trapdoor is represented by a decoration grid entity and is manually
|
|
10869
10875
|
* respawned every time the player re-enters the room.
|
|
10870
10876
|
*
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AACjC,cAAc,sCAAsC,CAAC;AACrD,cAAc,2BAA2B,CAAC;AAC1C,cAAc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 do
|
|
|
551
551
|
end
|
|
552
552
|
end
|
|
553
553
|
end
|
|
554
|
-
do
|
|
555
|
-
local ____export = require("functions.dev")
|
|
556
|
-
for ____exportKey, ____exportValue in pairs(____export) do
|
|
557
|
-
if ____exportKey ~= "default" then
|
|
558
|
-
____exports[____exportKey] = ____exportValue
|
|
559
|
-
end
|
|
560
|
-
end
|
|
561
|
-
end
|
|
562
554
|
do
|
|
563
555
|
local ____export = require("functions.dimensions")
|
|
564
556
|
for ____exportKey, ____exportValue in pairs(____export) do
|
package/package.json
CHANGED
|
@@ -5,15 +5,19 @@
|
|
|
5
5
|
import {
|
|
6
6
|
ActiveSlot,
|
|
7
7
|
CollectibleType,
|
|
8
|
+
DamageFlag,
|
|
9
|
+
EntityType,
|
|
8
10
|
ModCallback,
|
|
11
|
+
PlayerType,
|
|
9
12
|
} from "isaac-typescript-definitions";
|
|
10
13
|
import { DefaultMap } from "../classes/DefaultMap";
|
|
14
|
+
import { runNextGameFrame } from "../features/runInNFrames";
|
|
11
15
|
import { saveDataManager } from "../features/saveDataManager/exports";
|
|
12
16
|
import { arrayEquals } from "../functions/array";
|
|
13
17
|
import { getEnumValues } from "../functions/enums";
|
|
18
|
+
import { hasFlag } from "../functions/flag";
|
|
14
19
|
import {
|
|
15
20
|
defaultMapGetPlayer,
|
|
16
|
-
mapGetPlayer,
|
|
17
21
|
mapSetPlayer,
|
|
18
22
|
} from "../functions/playerDataStructures";
|
|
19
23
|
import { getPlayerCollectibleMap } from "../functions/players";
|
|
@@ -30,7 +34,7 @@ import {
|
|
|
30
34
|
|
|
31
35
|
const v = {
|
|
32
36
|
run: {
|
|
33
|
-
playersCollectibleCount: new
|
|
37
|
+
playersCollectibleCount: new DefaultMap<PlayerIndex, int>(0),
|
|
34
38
|
playersCollectibleMap: new DefaultMap<
|
|
35
39
|
PlayerIndex,
|
|
36
40
|
Map<CollectibleType, int>
|
|
@@ -45,7 +49,13 @@ const v = {
|
|
|
45
49
|
export function postPlayerCollectibleCallbacksInit(mod: Mod): void {
|
|
46
50
|
saveDataManager("postPlayerCollectible", v, hasSubscriptions);
|
|
47
51
|
|
|
52
|
+
mod.AddCallback(ModCallback.POST_USE_ITEM, useItemD4, CollectibleType.D4); // 3
|
|
48
53
|
mod.AddCallback(ModCallback.POST_PEFFECT_UPDATE, postPEffectUpdate); // 4
|
|
54
|
+
mod.AddCallback(
|
|
55
|
+
ModCallback.ENTITY_TAKE_DMG,
|
|
56
|
+
entityTakeDmgPlayer,
|
|
57
|
+
EntityType.PLAYER,
|
|
58
|
+
); // 11
|
|
49
59
|
}
|
|
50
60
|
|
|
51
61
|
function hasSubscriptions() {
|
|
@@ -55,37 +65,20 @@ function hasSubscriptions() {
|
|
|
55
65
|
);
|
|
56
66
|
}
|
|
57
67
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (oldCollectibleCount === undefined) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const difference = newCollectibleCount - oldCollectibleCount;
|
|
76
|
-
|
|
77
|
-
if (difference > 0) {
|
|
78
|
-
collectibleCountChanged(player, difference);
|
|
79
|
-
} else if (difference < 0) {
|
|
80
|
-
collectibleCountChanged(player, difference * -1);
|
|
81
|
-
} else if (difference === 0) {
|
|
82
|
-
checkActiveItemsChanged(player);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function collectibleCountChanged(
|
|
68
|
+
/**
|
|
69
|
+
* This is called when the collectible count changes and in situations where the entire build is
|
|
70
|
+
* rerolled.
|
|
71
|
+
*
|
|
72
|
+
* Since getting a new player collectible map is expensive, we want to only run this function when
|
|
73
|
+
* necessary, and not on e.g. every frame. Unfortunately, this has the side effect of missing out on
|
|
74
|
+
* collectible changes from mods that add and remove a collectible on the same frame.
|
|
75
|
+
*
|
|
76
|
+
* @param player The player to update.
|
|
77
|
+
* @param numCollectiblesChanged Pass undefined for situations where the entire build was rerolled.
|
|
78
|
+
*/
|
|
79
|
+
function updateCollectibleMapAndFire(
|
|
87
80
|
player: EntityPlayer,
|
|
88
|
-
numCollectiblesChanged: int,
|
|
81
|
+
numCollectiblesChanged: int | undefined,
|
|
89
82
|
) {
|
|
90
83
|
const oldCollectibleMap = defaultMapGetPlayer(
|
|
91
84
|
v.run.playersCollectibleMap,
|
|
@@ -94,13 +87,13 @@ function collectibleCountChanged(
|
|
|
94
87
|
const newCollectibleMap = getPlayerCollectibleMap(player);
|
|
95
88
|
mapSetPlayer(v.run.playersCollectibleMap, player, newCollectibleMap);
|
|
96
89
|
|
|
97
|
-
const
|
|
90
|
+
const collectibleTypesSet = new Set<CollectibleType>([
|
|
98
91
|
...oldCollectibleMap.keys(),
|
|
99
92
|
...newCollectibleMap.keys(),
|
|
100
93
|
]);
|
|
101
94
|
|
|
102
95
|
let numFired = 0;
|
|
103
|
-
for (const collectibleType of
|
|
96
|
+
for (const collectibleType of collectibleTypesSet.values()) {
|
|
104
97
|
const oldNum = oldCollectibleMap.get(collectibleType) ?? 0;
|
|
105
98
|
const newNum = newCollectibleMap.get(collectibleType) ?? 0;
|
|
106
99
|
const difference = newNum - oldNum;
|
|
@@ -122,9 +115,63 @@ function collectibleCountChanged(
|
|
|
122
115
|
}
|
|
123
116
|
}
|
|
124
117
|
|
|
118
|
+
// ModCallback.POST_USE_ITEM (3)
|
|
119
|
+
// CollectibleType.D4 (284)
|
|
120
|
+
function useItemD4(
|
|
121
|
+
_collectibleType: CollectibleType,
|
|
122
|
+
_rng: RNG,
|
|
123
|
+
player: EntityPlayer,
|
|
124
|
+
): boolean | undefined {
|
|
125
|
+
// This function is also triggered for:
|
|
126
|
+
// - D100
|
|
127
|
+
// - D Infinity copying D4 or D100
|
|
128
|
+
// - 1-pip dice room
|
|
129
|
+
// - 6-pip dice room
|
|
130
|
+
// - Reverse Wheel of Fortune copying 1-pip or 6-pip dice room
|
|
131
|
+
// - First getting Missing No.
|
|
132
|
+
// - Arriving on a new floor with Missing No.
|
|
133
|
+
|
|
134
|
+
// This function is not triggered for:
|
|
135
|
+
// - Tainted Eden getting hit (this is explicitly handled elsewhere)
|
|
136
|
+
// - Genesis (which is automatically handled by the collectibles being removed in the normal
|
|
137
|
+
// `POST_PLAYER_COLLECTIBLE_REMOVED` callback)
|
|
138
|
+
updateCollectibleMapAndFire(player, undefined);
|
|
139
|
+
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// ModCallback.POST_PEFFECT_UPDATE (4)
|
|
144
|
+
function postPEffectUpdate(player: EntityPlayer) {
|
|
145
|
+
if (!hasSubscriptions()) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const oldCollectibleCount = defaultMapGetPlayer(
|
|
150
|
+
v.run.playersCollectibleCount,
|
|
151
|
+
player,
|
|
152
|
+
);
|
|
153
|
+
const newCollectibleCount = player.GetCollectibleCount();
|
|
154
|
+
mapSetPlayer(v.run.playersCollectibleCount, player, newCollectibleCount);
|
|
155
|
+
|
|
156
|
+
const difference = newCollectibleCount - oldCollectibleCount;
|
|
157
|
+
|
|
158
|
+
if (difference > 0) {
|
|
159
|
+
updateCollectibleMapAndFire(player, difference);
|
|
160
|
+
} else if (difference < 0) {
|
|
161
|
+
updateCollectibleMapAndFire(player, difference * -1);
|
|
162
|
+
} else if (difference === 0) {
|
|
163
|
+
checkActiveItemsChanged(player);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
125
167
|
/**
|
|
126
|
-
*
|
|
127
|
-
*
|
|
168
|
+
* Checking for collectible count will work to detect when a player swaps their active item for
|
|
169
|
+
* another active item. This is because the collectible count will decrement by 1 when the item is
|
|
170
|
+
* swapped onto the pedestal and the hold animation begins, and increment by 1 when the item is
|
|
171
|
+
* dequeued and the hold animation ends.
|
|
172
|
+
*
|
|
173
|
+
* However, we also want to explicitly check for the case where a mod swaps in a custom active
|
|
174
|
+
* collectible on the same frame, since doing so is cheap.
|
|
128
175
|
*/
|
|
129
176
|
function checkActiveItemsChanged(player: EntityPlayer) {
|
|
130
177
|
const activeItemMap = defaultMapGetPlayer(v.run.playersActiveItemMap, player);
|
|
@@ -143,48 +190,58 @@ function checkActiveItemsChanged(player: EntityPlayer) {
|
|
|
143
190
|
}
|
|
144
191
|
|
|
145
192
|
// For example, it is possible for the player to switch Schoolbag items, which will cause the
|
|
146
|
-
// collectibles in the array to be the same, but in a different order. Thus, sort both arrays
|
|
193
|
+
// collectibles in the array to be the same, but in a different order. Thus, we sort both arrays
|
|
147
194
|
// before comparing them.
|
|
148
195
|
oldCollectibleTypes.sort();
|
|
149
196
|
newCollectibleTypes.sort();
|
|
150
197
|
|
|
151
198
|
if (!arrayEquals(oldCollectibleTypes, newCollectibleTypes)) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
]);
|
|
156
|
-
activeItemsChanged(player, collectibleTypeSet);
|
|
199
|
+
// One or more active items have changed (with the player's total collectible count remaining
|
|
200
|
+
// the same).
|
|
201
|
+
updateCollectibleMapAndFire(player, undefined);
|
|
157
202
|
}
|
|
158
203
|
}
|
|
159
204
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
)
|
|
172
|
-
|
|
173
|
-
|
|
205
|
+
// ModCallback.ENTITY_TAKE_DMG (11)
|
|
206
|
+
// EntityType.PLAYER (1)
|
|
207
|
+
// We need to handle the case of Tainted Eden taking damage.
|
|
208
|
+
function entityTakeDmgPlayer(
|
|
209
|
+
entity: Entity,
|
|
210
|
+
_amount: float,
|
|
211
|
+
damageFlags: BitFlags<DamageFlag>,
|
|
212
|
+
_source: EntityRef,
|
|
213
|
+
_countdownFrames: int,
|
|
214
|
+
): boolean | undefined {
|
|
215
|
+
// Tainted Eden's mechanic does not apply if she e.g. uses Dull Razor.
|
|
216
|
+
if (hasFlag(damageFlags, DamageFlag.FAKE)) {
|
|
217
|
+
return undefined;
|
|
218
|
+
}
|
|
174
219
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
const increased = difference > 0;
|
|
180
|
-
const absoluteDifference = Math.abs(difference);
|
|
220
|
+
const player = entity.ToPlayer();
|
|
221
|
+
if (player === undefined) {
|
|
222
|
+
return undefined;
|
|
223
|
+
}
|
|
181
224
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
} else {
|
|
186
|
-
postPlayerCollectibleRemovedFire(player, collectibleType);
|
|
187
|
-
}
|
|
188
|
-
});
|
|
225
|
+
const character = player.GetPlayerType();
|
|
226
|
+
if (character !== PlayerType.EDEN_B) {
|
|
227
|
+
return undefined;
|
|
189
228
|
}
|
|
229
|
+
|
|
230
|
+
// The items will only be rerolled after the damage is successfully applied.
|
|
231
|
+
const ptr = EntityPtr(player);
|
|
232
|
+
runNextGameFrame(() => {
|
|
233
|
+
const futureEntity = ptr.Ref;
|
|
234
|
+
if (futureEntity === undefined) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const futurePlayer = futureEntity.ToPlayer();
|
|
239
|
+
if (futurePlayer === undefined) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
updateCollectibleMapAndFire(player, undefined);
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
return undefined;
|
|
190
247
|
}
|
|
@@ -959,7 +959,8 @@ export enum ModCallbackCustom {
|
|
|
959
959
|
|
|
960
960
|
/**
|
|
961
961
|
* Fires from the `POST_PEFFECT_UPDATE` callback when a player's collectible count is higher than
|
|
962
|
-
* what it was on the previous frame or when
|
|
962
|
+
* what it was on the previous frame, or when the active items change, or when the build is
|
|
963
|
+
* rerolled.
|
|
963
964
|
*
|
|
964
965
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
965
966
|
* only fire if the collectible matches the `CollectibleType` provided.
|
|
@@ -975,7 +976,8 @@ export enum ModCallbackCustom {
|
|
|
975
976
|
|
|
976
977
|
/**
|
|
977
978
|
* Fires from the `POST_PEFFECT_UPDATE` callback when a player's collectible count is lower than
|
|
978
|
-
* what it was on the previous frame or when
|
|
979
|
+
* what it was on the previous frame, or when the active items change, or when the build is
|
|
980
|
+
* rerolled.
|
|
979
981
|
*
|
|
980
982
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
981
983
|
* only fire if the collectible matches the `CollectibleType` provided.
|
|
@@ -10,12 +10,6 @@ import { spawnCustomTrapdoorToDestination } from "./spawn";
|
|
|
10
10
|
* want to create a custom trapdoor that goes to a vanilla stage instead, use the
|
|
11
11
|
* `spawnCustomTrapdoorToVanilla` helper function.
|
|
12
12
|
*
|
|
13
|
-
* Custom trapdoors can have one or more of the following attributes:
|
|
14
|
-
*
|
|
15
|
-
* - custom destination (or custom logic for after the player enters)
|
|
16
|
-
* - custom graphics
|
|
17
|
-
* - custom logic for opening/closing
|
|
18
|
-
*
|
|
19
13
|
* Under the hood, the custom trapdoor is represented by a decoration grid entity and is manually
|
|
20
14
|
* respawned every time the player re-enters the room.
|
|
21
15
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CollectibleType
|
|
1
|
+
import { CollectibleType } from "isaac-typescript-definitions";
|
|
2
2
|
import { DefaultMap } from "../classes/DefaultMap";
|
|
3
3
|
import { ModUpgraded } from "../classes/ModUpgraded";
|
|
4
4
|
import { ModCallbackCustom } from "../enums/ModCallbackCustom";
|
|
@@ -9,13 +9,7 @@ import {
|
|
|
9
9
|
getLastElement,
|
|
10
10
|
} from "../functions/array";
|
|
11
11
|
import { isActiveCollectible } from "../functions/collectibles";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
defaultMapGetPlayer,
|
|
15
|
-
mapSetPlayer,
|
|
16
|
-
} from "../functions/playerDataStructures";
|
|
17
|
-
import { getAllPlayers, getPlayerIndex } from "../functions/playerIndex";
|
|
18
|
-
import { repeat } from "../functions/utils";
|
|
12
|
+
import { defaultMapGetPlayer } from "../functions/playerDataStructures";
|
|
19
13
|
import { PlayerIndex } from "../types/PlayerIndex";
|
|
20
14
|
import { saveDataManager } from "./saveDataManager/exports";
|
|
21
15
|
|
|
@@ -27,36 +21,14 @@ const v = {
|
|
|
27
21
|
PlayerIndex,
|
|
28
22
|
CollectibleType[],
|
|
29
23
|
[player: EntityPlayer]
|
|
30
|
-
>((
|
|
24
|
+
>(() => []),
|
|
31
25
|
},
|
|
32
26
|
};
|
|
33
27
|
|
|
34
|
-
function newPlayerInventory(player: EntityPlayer) {
|
|
35
|
-
const inventory: CollectibleType[] = [];
|
|
36
|
-
|
|
37
|
-
for (const collectibleType of getCollectibleArray()) {
|
|
38
|
-
// We need to specify "true" as the second argument here to filter out things like Lilith's
|
|
39
|
-
// Incubus.
|
|
40
|
-
const numCollectibles = player.GetCollectibleNum(collectibleType, true);
|
|
41
|
-
repeat(numCollectibles, () => {
|
|
42
|
-
inventory.push(collectibleType);
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return inventory;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function resetInventory(player: EntityPlayer) {
|
|
50
|
-
const inventory = newPlayerInventory(player);
|
|
51
|
-
mapSetPlayer(v.run.playersInventory, player, inventory);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
28
|
/** @internal */
|
|
55
29
|
export function playerInventoryInit(mod: ModUpgraded): void {
|
|
56
30
|
saveDataManager(FEATURE_NAME, v);
|
|
57
31
|
|
|
58
|
-
mod.AddCallback(ModCallback.POST_USE_ITEM, useItemD4, CollectibleType.D4); // 3
|
|
59
|
-
mod.AddCallback(ModCallback.POST_GAME_STARTED, postGameStarted); // 15
|
|
60
32
|
mod.AddCallbackCustom(
|
|
61
33
|
ModCallbackCustom.POST_PLAYER_COLLECTIBLE_ADDED,
|
|
62
34
|
postCollectibleAdded,
|
|
@@ -67,33 +39,6 @@ export function playerInventoryInit(mod: ModUpgraded): void {
|
|
|
67
39
|
);
|
|
68
40
|
}
|
|
69
41
|
|
|
70
|
-
// ModCallback.POST_USE_ITEM (3)
|
|
71
|
-
// CollectibleType.D4 (284)
|
|
72
|
-
function useItemD4(
|
|
73
|
-
_collectibleType: CollectibleType,
|
|
74
|
-
_rng: RNG,
|
|
75
|
-
player: EntityPlayer,
|
|
76
|
-
): boolean | undefined {
|
|
77
|
-
// This function is also triggered when the player uses D100, D Infinity, a 1-pip dice room, or a
|
|
78
|
-
// 6-pip dice room. (Genesis should be automatically handled by the
|
|
79
|
-
// `POST_PLAYER_COLLECTIBLE_REMOVED` callback.)
|
|
80
|
-
resetInventory(player);
|
|
81
|
-
|
|
82
|
-
return undefined;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// ModCallback.POST_GAME_STARTED (15)
|
|
86
|
-
function postGameStarted() {
|
|
87
|
-
// We don't use the `POST_PLAYER_INIT` callback because some items are not given to the player at
|
|
88
|
-
// that point.
|
|
89
|
-
for (const player of getAllPlayers()) {
|
|
90
|
-
const playerIndex = getPlayerIndex(player);
|
|
91
|
-
if (!v.run.playersInventory.has(playerIndex)) {
|
|
92
|
-
resetInventory(player);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
42
|
// ModCallbackCustom.POST_PLAYER_COLLECTIBLE_ADDED
|
|
98
43
|
function postCollectibleAdded(
|
|
99
44
|
player: EntityPlayer,
|
|
@@ -140,12 +85,11 @@ export function getPlayerInventory(
|
|
|
140
85
|
|
|
141
86
|
const inventory = defaultMapGetPlayer(v.run.playersInventory, player, player);
|
|
142
87
|
|
|
143
|
-
const copiedInventory = copyArray(inventory);
|
|
144
88
|
if (includeActiveCollectibles) {
|
|
145
|
-
return
|
|
89
|
+
return copyArray(inventory);
|
|
146
90
|
}
|
|
147
91
|
|
|
148
|
-
return
|
|
92
|
+
return inventory.filter(
|
|
149
93
|
(collectibleType) => !isActiveCollectible(collectibleType),
|
|
150
94
|
);
|
|
151
95
|
}
|
|
@@ -6,6 +6,7 @@ import { SaveDataKey } from "../../enums/SaveDataKey";
|
|
|
6
6
|
import { SerializationType } from "../../enums/SerializationType";
|
|
7
7
|
import { deepCopy } from "../../functions/deepCopy";
|
|
8
8
|
import { logError } from "../../functions/log";
|
|
9
|
+
import { onFirstFloor } from "../../functions/stage";
|
|
9
10
|
import { clearTable, iterateTableInOrder } from "../../functions/table";
|
|
10
11
|
import { SaveData } from "../../interfaces/SaveData";
|
|
11
12
|
import { loadFromDisk } from "./load";
|
|
@@ -49,6 +50,8 @@ function postPlayerInit() {
|
|
|
49
50
|
);
|
|
50
51
|
}
|
|
51
52
|
|
|
53
|
+
// We want to only load data once per run to handle the case of a player using Genesis, a second
|
|
54
|
+
// player joining the run, and so on.
|
|
52
55
|
if (loadedDataOnThisRun) {
|
|
53
56
|
return;
|
|
54
57
|
}
|
|
@@ -86,7 +89,19 @@ function preGameExit() {
|
|
|
86
89
|
|
|
87
90
|
// ModCallback.POST_NEW_LEVEL (18)
|
|
88
91
|
function postNewLevel() {
|
|
92
|
+
if (mod === null) {
|
|
93
|
+
error(
|
|
94
|
+
`The mod for the ${SAVE_DATA_MANAGER_FEATURE_NAME} was not initialized.`,
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
89
98
|
restoreDefaults(SaveDataKey.LEVEL);
|
|
99
|
+
|
|
100
|
+
// We save data to disk at the beginning of every floor (for the 2nd floor and beyond) to emulate
|
|
101
|
+
// what the game does internally. (This mitigates data loss in the event of a crash).
|
|
102
|
+
if (!onFirstFloor()) {
|
|
103
|
+
saveToDisk(mod, saveDataMap, saveDataConditionalFuncMap);
|
|
104
|
+
}
|
|
90
105
|
}
|
|
91
106
|
|
|
92
107
|
// ModCallbackCustom.POST_NEW_ROOM_EARLY
|
package/src/functions/debug.ts
CHANGED
|
@@ -1,4 +1,36 @@
|
|
|
1
|
+
import { ModUpgraded } from "../classes/ModUpgraded";
|
|
2
|
+
import { enableExtraConsoleCommands } from "../features/extraConsoleCommands/exports";
|
|
3
|
+
import { removeFadeIn } from "../features/fadeInRemover";
|
|
4
|
+
import { enableFastReset } from "../features/fastReset";
|
|
5
|
+
import { saveDataManagerSetGlobal } from "../features/saveDataManager/exports";
|
|
6
|
+
import * as logExports from "./log";
|
|
1
7
|
import { log } from "./log";
|
|
8
|
+
import * as logEntitiesExports from "./logEntities";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Helper function to enable some IsaacScript features that are useful when developing a mod. They
|
|
12
|
+
* should not be enabled when your mod goes to production (i.e. when it is uploaded to the Steam
|
|
13
|
+
* Workshop).
|
|
14
|
+
*
|
|
15
|
+
* The list of development features that are enabled are as follows:
|
|
16
|
+
*
|
|
17
|
+
* - `saveDataManagerSetGlobal` - Sets your local variables registered with the save data manager as
|
|
18
|
+
* global variables so you can access them from the in-game console.
|
|
19
|
+
* - `setLogFunctionsGlobal` - Sets the various log functions global so that you can access them
|
|
20
|
+
* from the in-game console.
|
|
21
|
+
* - `enableExtraConsoleCommands` - Enables many extra in-game console commands that make warping
|
|
22
|
+
* around easier (like e.g. `angel` to warp to the Angel Room).
|
|
23
|
+
* - `enableFastReset` - Makes it so that the r key resets the game instantaneously.
|
|
24
|
+
* - `removeFadeIn` - Removes the slow fade in that occurs at the beginning of the run, so that you
|
|
25
|
+
* can immediately start playing or testing.
|
|
26
|
+
*/
|
|
27
|
+
export function enableDevFeatures(mod: ModUpgraded): void {
|
|
28
|
+
saveDataManagerSetGlobal();
|
|
29
|
+
setLogFunctionsGlobal();
|
|
30
|
+
enableExtraConsoleCommands(mod);
|
|
31
|
+
enableFastReset();
|
|
32
|
+
removeFadeIn();
|
|
33
|
+
}
|
|
2
34
|
|
|
3
35
|
/**
|
|
4
36
|
* Helper function to get a stack trace.
|
|
@@ -37,6 +69,23 @@ export function isLuaDebugEnabled(): boolean {
|
|
|
37
69
|
return _G.package !== undefined;
|
|
38
70
|
}
|
|
39
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Converts every `isaacscript-common` function that begins with "log" to a global function.
|
|
74
|
+
*
|
|
75
|
+
* This is useful when printing out variables from the in-game debug console.
|
|
76
|
+
*/
|
|
77
|
+
export function setLogFunctionsGlobal(): void {
|
|
78
|
+
const globals = _G as Record<string, unknown>;
|
|
79
|
+
|
|
80
|
+
for (const [logFuncName, logFunc] of Object.entries(logExports)) {
|
|
81
|
+
globals[logFuncName] = logFunc;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
for (const [logFuncName, logFunc] of Object.entries(logEntitiesExports)) {
|
|
85
|
+
globals[logFuncName] = logFunc;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
40
89
|
/**
|
|
41
90
|
* Helper function to print a stack trace to the "log.txt" file, similar to JavaScript's
|
|
42
91
|
* `console.trace` function.
|
package/src/functions/log.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
CollectibleType,
|
|
2
3
|
DamageFlag,
|
|
3
4
|
EntityFlag,
|
|
4
5
|
GameStateFlag,
|
|
@@ -73,6 +74,20 @@ export function logArray<T>(this: void, array: T[] | readonly T[]): void {
|
|
|
73
74
|
log(`Array: ${arrayString}`);
|
|
74
75
|
}
|
|
75
76
|
|
|
77
|
+
export function logCollectibleTypes(
|
|
78
|
+
this: void,
|
|
79
|
+
collectibleTypes: CollectibleType[],
|
|
80
|
+
): void {
|
|
81
|
+
log("Collectibles:");
|
|
82
|
+
|
|
83
|
+
let i = 1;
|
|
84
|
+
for (const collectibleType of collectibleTypes) {
|
|
85
|
+
const collectibleName = getCollectibleName(collectibleType);
|
|
86
|
+
log(`${i}) ${collectibleName} (${collectibleType})`);
|
|
87
|
+
i++;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
76
91
|
export function logColor(this: void, color: Color): void {
|
|
77
92
|
log(
|
|
78
93
|
`Color: R${color.R}, G${color.G}, B${color.B}, A${color.A}, RO${color.RO}, BO${color.BO}, GO${color.GO}`,
|
|
@@ -482,38 +497,3 @@ export function logVector(this: void, vector: Vector, round = false): void {
|
|
|
482
497
|
const vectorString = vectorToString(vector, round);
|
|
483
498
|
log(`Vector: ${vectorString}`);
|
|
484
499
|
}
|
|
485
|
-
|
|
486
|
-
/**
|
|
487
|
-
* Converts every `isaacscript-common` function that begins with "log" to a global function.
|
|
488
|
-
*
|
|
489
|
-
* This is useful when printing out variables from the in-game debug console.
|
|
490
|
-
*/
|
|
491
|
-
export function setLogFunctionsGlobal(): void {
|
|
492
|
-
const globals = _G as Record<string, unknown>;
|
|
493
|
-
|
|
494
|
-
globals["log"] = log;
|
|
495
|
-
globals["logArray"] = logArray;
|
|
496
|
-
globals["logColor"] = logColor;
|
|
497
|
-
globals["logDamageFlags"] = logDamageFlags;
|
|
498
|
-
globals["logEntityID"] = logEntityID;
|
|
499
|
-
globals["logEntityFlags"] = logEntityFlags;
|
|
500
|
-
globals["logError"] = logError;
|
|
501
|
-
globals["logFlags"] = logFlags;
|
|
502
|
-
globals["logGameStateFlags"] = logGameStateFlags;
|
|
503
|
-
globals["logKColor"] = logKColor;
|
|
504
|
-
globals["logLevelStateFlags"] = logLevelStateFlags;
|
|
505
|
-
globals["logMap"] = logMap;
|
|
506
|
-
globals["logPlayerEffects"] = logPlayerEffects;
|
|
507
|
-
globals["logPlayerHealth"] = logPlayerHealth;
|
|
508
|
-
globals["logProjectileFlags"] = logProjectileFlags;
|
|
509
|
-
globals["logRoom"] = logRoom;
|
|
510
|
-
globals["logSeedEffects"] = logSeedEffects;
|
|
511
|
-
globals["logSet"] = logSet;
|
|
512
|
-
globals["logSounds"] = logSounds;
|
|
513
|
-
globals["logTable"] = logTable;
|
|
514
|
-
globals["logTableDifferences"] = logTableDifferences;
|
|
515
|
-
globals["logTearFlags"] = logTearFlags;
|
|
516
|
-
globals["logUseFlags"] = logUseFlags;
|
|
517
|
-
globals["logUserdata"] = logUserdata;
|
|
518
|
-
globals["logVector"] = logVector;
|
|
519
|
-
}
|