isaacscript-common 6.6.3 → 6.7.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/customRevive.lua +4 -4
- package/dist/callbacks/postCursedTeleport.lua +2 -2
- package/dist/callbacks/postCustomDoorEnter.d.ts +1 -1
- package/dist/callbacks/postCustomDoorEnter.lua +6 -6
- package/dist/callbacks/postDiceRoomActivated.lua +2 -2
- package/dist/callbacks/postFlip.lua +3 -3
- package/dist/callbacks/postGridEntity.lua +3 -3
- package/dist/callbacks/postGridEntityCollision.lua +3 -3
- package/dist/callbacks/postGridEntityRender.lua +2 -2
- package/dist/callbacks/postNewRoomEarly.lua +5 -5
- package/dist/callbacks/postPickupCollect.lua +2 -2
- package/dist/callbacks/postPitRender.lua +2 -2
- package/dist/callbacks/postPitUpdate.lua +2 -2
- package/dist/callbacks/postPlayerCollectible.lua +2 -2
- package/dist/callbacks/postPoopRender.lua +2 -2
- package/dist/callbacks/postPoopUpdate.lua +2 -2
- package/dist/callbacks/postPressurePlateRender.lua +2 -2
- package/dist/callbacks/postPressurePlateUpdate.lua +2 -2
- package/dist/callbacks/postPurchase.lua +2 -2
- package/dist/callbacks/postRockRender.lua +2 -2
- package/dist/callbacks/postRockUpdate.lua +2 -2
- package/dist/callbacks/postSlotInitUpdate.lua +2 -2
- package/dist/callbacks/postSlotRender.lua +2 -2
- package/dist/callbacks/postSpikesRender.lua +2 -2
- package/dist/callbacks/postSpikesUpdate.lua +2 -2
- package/dist/callbacks/postTNTRender.lua +2 -2
- package/dist/callbacks/postTNTUpdate.lua +2 -2
- package/dist/callbacks/preBerserkDeath.lua +2 -2
- package/dist/callbacks/preNewLevel.lua +2 -2
- package/dist/callbacks/subscriptions/postDoorRender.d.ts +2 -3
- package/dist/callbacks/subscriptions/postDoorRender.d.ts.map +1 -1
- package/dist/callbacks/subscriptions/postDoorRender.lua +3 -3
- package/dist/callbacks/subscriptions/postDoorUpdate.d.ts +2 -3
- package/dist/callbacks/subscriptions/postDoorUpdate.d.ts.map +1 -1
- package/dist/callbacks/subscriptions/postDoorUpdate.lua +3 -3
- package/dist/callbacks/subscriptions/postPitRender.d.ts +2 -3
- package/dist/callbacks/subscriptions/postPitRender.d.ts.map +1 -1
- package/dist/callbacks/subscriptions/postPitRender.lua +3 -3
- package/dist/callbacks/subscriptions/postPitUpdate.d.ts +2 -3
- package/dist/callbacks/subscriptions/postPitUpdate.d.ts.map +1 -1
- package/dist/callbacks/subscriptions/postPitUpdate.lua +3 -3
- package/dist/callbacks/subscriptions/postPoopRender.d.ts +2 -3
- package/dist/callbacks/subscriptions/postPoopRender.d.ts.map +1 -1
- package/dist/callbacks/subscriptions/postPoopRender.lua +3 -3
- package/dist/callbacks/subscriptions/postPoopUpdate.d.ts +2 -3
- package/dist/callbacks/subscriptions/postPoopUpdate.d.ts.map +1 -1
- package/dist/callbacks/subscriptions/postPoopUpdate.lua +3 -3
- package/dist/callbacks/subscriptions/postPressurePlateRender.d.ts +2 -3
- package/dist/callbacks/subscriptions/postPressurePlateRender.d.ts.map +1 -1
- package/dist/callbacks/subscriptions/postPressurePlateRender.lua +3 -3
- package/dist/callbacks/subscriptions/postPressurePlateUpdate.d.ts +2 -3
- package/dist/callbacks/subscriptions/postPressurePlateUpdate.d.ts.map +1 -1
- package/dist/callbacks/subscriptions/postPressurePlateUpdate.lua +3 -3
- package/dist/enums/private/SerializationBrand.d.ts +0 -4
- package/dist/enums/private/SerializationBrand.d.ts.map +1 -1
- package/dist/features/characterStats.lua +2 -2
- package/dist/features/collectibleItemPoolType.lua +2 -2
- package/dist/features/customGridEntity.d.ts.map +1 -1
- package/dist/features/customGridEntity.lua +5 -5
- package/dist/features/customStage/backdrop.lua +2 -2
- package/dist/features/customStage/{gridEntities.d.ts → customStageGridEntities.d.ts} +1 -1
- package/dist/features/customStage/customStageGridEntities.d.ts.map +1 -0
- package/dist/features/customStage/{gridEntities.lua → customStageGridEntities.lua} +8 -8
- package/dist/features/customStage/{util.d.ts → customStageUtils.d.ts} +1 -1
- package/dist/features/customStage/customStageUtils.d.ts.map +1 -0
- package/dist/features/customStage/{util.lua → customStageUtils.lua} +0 -0
- package/dist/features/customStage/exports.lua +4 -4
- package/dist/features/customStage/init.lua +6 -6
- package/dist/features/customStage/shadows.lua +2 -2
- package/dist/features/customStage/versusScreen.lua +4 -4
- package/dist/features/debugDisplay/v.lua +4 -4
- package/dist/features/deployJSONRoom.lua +20 -20
- package/dist/features/extraConsoleCommands/commandsSubroutines.lua +3 -3
- package/dist/features/extraConsoleCommands/listCommands.d.ts.map +1 -1
- package/dist/features/extraConsoleCommands/listCommands.lua +14 -14
- package/dist/features/pause.lua +2 -2
- package/dist/features/persistentEntities.lua +2 -2
- package/dist/features/preventCollectibleRotation.lua +2 -2
- package/dist/features/saveDataManager/exports.d.ts.map +1 -1
- package/dist/features/saveDataManager/merge.lua +4 -3
- package/dist/features/sirenHelpers.lua +2 -2
- package/dist/functions/ambush.lua +5 -5
- package/dist/functions/array.d.ts.map +1 -1
- package/dist/functions/array.lua +1 -1
- package/dist/functions/{boss.d.ts → bosses.d.ts} +22 -4
- package/dist/functions/bosses.d.ts.map +1 -0
- package/dist/functions/{boss.lua → bosses.lua} +38 -13
- package/dist/functions/collectibleTag.lua +2 -2
- package/dist/functions/collectibles.lua +5 -5
- package/dist/functions/deepCopy.d.ts +8 -5
- package/dist/functions/deepCopy.d.ts.map +1 -1
- package/dist/functions/deepCopy.lua +142 -38
- package/dist/functions/deepCopyTests.d.ts +6 -1
- package/dist/functions/deepCopyTests.d.ts.map +1 -1
- package/dist/functions/deepCopyTests.lua +19 -16
- package/dist/functions/{entity.d.ts → entities.d.ts} +21 -19
- package/dist/functions/entities.d.ts.map +1 -0
- package/dist/functions/{entity.lua → entities.lua} +25 -20
- package/dist/functions/{entitySpecific.d.ts → entitiesSpecific.d.ts} +145 -68
- package/dist/functions/entitiesSpecific.d.ts.map +1 -0
- package/dist/functions/{entitySpecific.lua → entitiesSpecific.lua} +203 -65
- package/dist/functions/familiars.lua +2 -2
- package/dist/functions/{gridEntity.d.ts → gridEntities.d.ts} +48 -17
- package/dist/functions/gridEntities.d.ts.map +1 -0
- package/dist/functions/{gridEntity.lua → gridEntities.lua} +140 -90
- package/dist/functions/gridEntitiesSpecific.d.ts +141 -0
- package/dist/functions/gridEntitiesSpecific.d.ts.map +1 -0
- package/dist/functions/gridEntitiesSpecific.lua +366 -0
- package/dist/functions/log.d.ts +1 -1
- package/dist/functions/log.d.ts.map +1 -1
- package/dist/functions/log.lua +16 -12
- package/dist/functions/mergeTests.d.ts +7 -1
- package/dist/functions/mergeTests.d.ts.map +1 -1
- package/dist/functions/mergeTests.lua +86 -7
- package/dist/functions/{npc.d.ts → npcs.d.ts} +24 -2
- package/dist/functions/npcs.d.ts.map +1 -0
- package/dist/functions/{npc.lua → npcs.lua} +44 -9
- package/dist/functions/pickups.d.ts +4 -119
- package/dist/functions/pickups.d.ts.map +1 -1
- package/dist/functions/pickups.lua +10 -439
- package/dist/functions/pickupsSpecific.d.ts +229 -0
- package/dist/functions/pickupsSpecific.d.ts.map +1 -0
- package/dist/functions/pickupsSpecific.lua +560 -0
- package/dist/functions/playerHealth.lua +6 -6
- package/dist/functions/{player.d.ts → players.d.ts} +1 -1
- package/dist/functions/players.d.ts.map +1 -0
- package/dist/functions/{player.lua → players.lua} +0 -0
- package/dist/functions/pocketItems.lua +2 -2
- package/dist/functions/positionVelocity.lua +6 -6
- package/dist/functions/pressurePlate.d.ts +10 -0
- package/dist/functions/pressurePlate.d.ts.map +1 -0
- package/dist/functions/pressurePlate.lua +29 -0
- package/dist/functions/revive.lua +7 -7
- package/dist/functions/rooms.lua +2 -2
- package/dist/functions/saveFile.lua +3 -3
- package/dist/functions/spawnCollectible.lua +4 -4
- package/dist/functions/{sprite.d.ts → sprites.d.ts} +1 -1
- package/dist/functions/sprites.d.ts.map +1 -0
- package/dist/functions/{sprite.lua → sprites.lua} +0 -0
- package/dist/functions/table.d.ts +1 -1
- package/dist/functions/table.lua +1 -1
- package/dist/functions/transformations.lua +2 -2
- package/dist/functions/trinketGive.lua +2 -2
- package/dist/functions/trinkets.lua +6 -6
- package/dist/functions/utils.d.ts +7 -0
- package/dist/functions/utils.d.ts.map +1 -1
- package/dist/functions/utils.lua +35 -22
- package/dist/index.d.ts +10 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.lua +26 -10
- package/dist/types/AnyGridEntity.d.ts +10 -0
- package/dist/types/AnyGridEntity.d.ts.map +1 -0
- package/dist/types/AnyGridEntity.lua +2 -0
- package/package.json +2 -2
- package/src/callbacks/customRevive.ts +2 -2
- package/src/callbacks/postCursedTeleport.ts +2 -2
- package/src/callbacks/postCustomDoorEnter.ts +3 -3
- package/src/callbacks/postDiceRoomActivated.ts +1 -1
- package/src/callbacks/postFlip.ts +1 -1
- package/src/callbacks/postGridEntity.ts +1 -1
- package/src/callbacks/postGridEntityCollision.ts +1 -1
- package/src/callbacks/postGridEntityRender.ts +1 -1
- package/src/callbacks/postNewRoomEarly.ts +9 -3
- package/src/callbacks/postPickupCollect.ts +1 -1
- package/src/callbacks/postPitRender.ts +1 -1
- package/src/callbacks/postPitUpdate.ts +1 -1
- package/src/callbacks/postPlayerCollectible.ts +2 -2
- package/src/callbacks/postPoopRender.ts +1 -1
- package/src/callbacks/postPoopUpdate.ts +1 -1
- package/src/callbacks/postPressurePlateRender.ts +1 -1
- package/src/callbacks/postPressurePlateUpdate.ts +1 -1
- package/src/callbacks/postPurchase.ts +1 -1
- package/src/callbacks/postRockRender.ts +1 -1
- package/src/callbacks/postRockUpdate.ts +1 -1
- package/src/callbacks/postSacrifice.ts +1 -1
- package/src/callbacks/postSlotInitUpdate.ts +1 -1
- package/src/callbacks/postSlotRender.ts +1 -1
- package/src/callbacks/postSpikesRender.ts +1 -1
- package/src/callbacks/postSpikesUpdate.ts +1 -1
- package/src/callbacks/postTNTRender.ts +1 -1
- package/src/callbacks/postTNTUpdate.ts +1 -1
- package/src/callbacks/preBerserkDeath.ts +1 -1
- package/src/callbacks/preNewLevel.ts +1 -1
- package/src/callbacks/subscriptions/postDoorRender.ts +7 -5
- package/src/callbacks/subscriptions/postDoorUpdate.ts +7 -5
- package/src/callbacks/subscriptions/postPitRender.ts +6 -7
- package/src/callbacks/subscriptions/postPitUpdate.ts +6 -7
- package/src/callbacks/subscriptions/postPoopRender.ts +7 -5
- package/src/callbacks/subscriptions/postPoopUpdate.ts +7 -5
- package/src/callbacks/subscriptions/postPressurePlateRender.ts +7 -5
- package/src/callbacks/subscriptions/postPressurePlateUpdate.ts +7 -5
- package/src/enums/private/SerializationBrand.ts +0 -4
- package/src/features/characterStats.ts +1 -1
- package/src/features/collectibleItemPoolType.ts +1 -1
- package/src/features/customGridEntity.ts +6 -3
- package/src/features/customStage/backdrop.ts +1 -1
- package/src/features/customStage/{gridEntities.ts → customStageGridEntities.ts} +3 -3
- package/src/features/customStage/{util.ts → customStageUtils.ts} +0 -0
- package/src/features/customStage/exports.ts +2 -2
- package/src/features/customStage/init.ts +1 -1
- package/src/features/customStage/shadows.ts +1 -1
- package/src/features/customStage/versusScreen.ts +2 -2
- package/src/features/debugDisplay/v.ts +2 -2
- package/src/features/deployJSONRoom.ts +11 -7
- package/src/features/extraConsoleCommands/commandsSubroutines.ts +2 -2
- package/src/features/extraConsoleCommands/listCommands.ts +13 -9
- package/src/features/pause.ts +1 -1
- package/src/features/persistentEntities.ts +2 -2
- package/src/features/preventCollectibleRotation.ts +1 -1
- package/src/features/saveDataManager/exports.ts +7 -4
- package/src/features/saveDataManager/merge.ts +3 -3
- package/src/features/sirenHelpers.ts +1 -1
- package/src/functions/ambush.ts +2 -2
- package/src/functions/array.ts +5 -2
- package/src/functions/bitwise.ts +2 -2
- package/src/functions/{boss.ts → bosses.ts} +29 -21
- package/src/functions/collectibleTag.ts +1 -1
- package/src/functions/collectibles.ts +2 -2
- package/src/functions/deepCopy.ts +98 -19
- package/src/functions/deepCopyTests.ts +75 -19
- package/src/functions/{entity.ts → entities.ts} +23 -21
- package/src/functions/{entitySpecific.ts → entitiesSpecific.ts} +170 -99
- package/src/functions/familiars.ts +1 -1
- package/src/functions/{gridEntity.ts → gridEntities.ts} +110 -34
- package/src/functions/gridEntitiesSpecific.ts +490 -0
- package/src/functions/log.ts +19 -10
- package/src/functions/mergeTests.ts +152 -4
- package/src/functions/{npc.ts → npcs.ts} +42 -11
- package/src/functions/pickups.ts +8 -475
- package/src/functions/pickupsSpecific.ts +613 -0
- package/src/functions/playerHealth.ts +1 -1
- package/src/functions/{player.ts → players.ts} +0 -0
- package/src/functions/pocketItems.ts +1 -1
- package/src/functions/positionVelocity.ts +3 -3
- package/src/functions/pressurePlate.ts +29 -0
- package/src/functions/revive.ts +2 -2
- package/src/functions/rooms.ts +1 -1
- package/src/functions/saveFile.ts +1 -1
- package/src/functions/spawnCollectible.ts +2 -2
- package/src/functions/{sprite.ts → sprites.ts} +0 -0
- package/src/functions/table.ts +1 -1
- package/src/functions/transformations.ts +1 -1
- package/src/functions/trinketGive.ts +4 -4
- package/src/functions/trinkets.ts +3 -3
- package/src/functions/tstlClass.ts +1 -1
- package/src/functions/ui.ts +3 -3
- package/src/functions/utils.ts +32 -13
- package/src/index.ts +10 -8
- package/src/types/AnyGridEntity.ts +9 -0
- package/dist/features/customStage/gridEntities.d.ts.map +0 -1
- package/dist/features/customStage/util.d.ts.map +0 -1
- package/dist/functions/boss.d.ts.map +0 -1
- package/dist/functions/entity.d.ts.map +0 -1
- package/dist/functions/entitySpecific.d.ts.map +0 -1
- package/dist/functions/gridEntity.d.ts.map +0 -1
- package/dist/functions/gridEntitySpecific.d.ts +0 -29
- package/dist/functions/gridEntitySpecific.d.ts.map +0 -1
- package/dist/functions/gridEntitySpecific.lua +0 -114
- package/dist/functions/npc.d.ts.map +0 -1
- package/dist/functions/player.d.ts.map +0 -1
- package/dist/functions/sprite.d.ts.map +0 -1
- package/src/functions/gridEntitySpecific.ts +0 -143
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DefaultMap } from "../classes/DefaultMap";
|
|
1
2
|
import { SerializationType } from "../enums/SerializationType";
|
|
2
3
|
import { merge } from "../features/saveDataManager/merge";
|
|
3
4
|
import { deepCopy } from "./deepCopy";
|
|
@@ -6,13 +7,22 @@ import { isRNG, newRNG } from "./rng";
|
|
|
6
7
|
import { isSerializedIsaacAPIClass } from "./serialization";
|
|
7
8
|
import { copyVector, isVector } from "./vector";
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Run the suite of tests that prove that the "merge" helper function works properly. (This function
|
|
12
|
+
* is not exported but is used internally in the save data manager.)
|
|
13
|
+
*
|
|
14
|
+
* This function is only useful if you are troubleshooting the save data manager.
|
|
15
|
+
*/
|
|
16
|
+
export function runMergeTests(): void {
|
|
10
17
|
oldTableHasUpdatedValue();
|
|
11
18
|
newTableHasSameValue();
|
|
12
19
|
oldTableHasUpdatedValueFromNull();
|
|
13
20
|
oldTableHasSerializedIsaacAPIClass();
|
|
14
21
|
|
|
15
|
-
|
|
22
|
+
oldTableHasFilledChildTable();
|
|
23
|
+
oldTableHasFilledMap();
|
|
24
|
+
oldTableHasFilledDefaultMap();
|
|
25
|
+
|
|
16
26
|
oldTableHasVector();
|
|
17
27
|
oldTableHasVectorSerialized();
|
|
18
28
|
oldTableHasRNG();
|
|
@@ -90,7 +100,7 @@ function oldTableHasSerializedIsaacAPIClass() {
|
|
|
90
100
|
}
|
|
91
101
|
}
|
|
92
102
|
|
|
93
|
-
function
|
|
103
|
+
function oldTableHasFilledChildTable() {
|
|
94
104
|
interface Foo {
|
|
95
105
|
bar: string;
|
|
96
106
|
}
|
|
@@ -107,7 +117,7 @@ function oldTableHasFilledInterface() {
|
|
|
107
117
|
foo,
|
|
108
118
|
} as unknown as LuaTable<AnyNotNil, unknown>;
|
|
109
119
|
|
|
110
|
-
merge(oldTable, newTable, "
|
|
120
|
+
merge(oldTable, newTable, "oldTableHasFilledChildTable");
|
|
111
121
|
|
|
112
122
|
const oldTableValue = oldTable.get(key) as Foo | undefined;
|
|
113
123
|
if (oldTableValue === undefined) {
|
|
@@ -119,6 +129,142 @@ function oldTableHasFilledInterface() {
|
|
|
119
129
|
}
|
|
120
130
|
}
|
|
121
131
|
|
|
132
|
+
function oldTableHasFilledMap() {
|
|
133
|
+
const v = {
|
|
134
|
+
run: {
|
|
135
|
+
myMap: new Map<string, string>(),
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const saveData = {
|
|
140
|
+
run: {
|
|
141
|
+
myMap: new Map<string, string>([
|
|
142
|
+
["foo1", "bar1"],
|
|
143
|
+
["foo2", "bar2"],
|
|
144
|
+
["foo3", "bar3"],
|
|
145
|
+
]),
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
const serializedSaveData = deepCopy(saveData, SerializationType.SERIALIZE);
|
|
149
|
+
|
|
150
|
+
merge(
|
|
151
|
+
v as unknown as LuaTable,
|
|
152
|
+
serializedSaveData as LuaTable,
|
|
153
|
+
"oldTableHasFilledMap",
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
const expectedSize = 3;
|
|
157
|
+
if (v.run.myMap.size !== expectedSize) {
|
|
158
|
+
error(
|
|
159
|
+
`The size of the merged map was equal to ${v.run.myMap.size}, but it should be equal to: ${expectedSize}`,
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
{
|
|
164
|
+
const key = "foo1";
|
|
165
|
+
const expectedValue = "bar1";
|
|
166
|
+
|
|
167
|
+
const value = v.run.myMap.get(key);
|
|
168
|
+
if (value !== expectedValue) {
|
|
169
|
+
error(
|
|
170
|
+
`The old table's map key of "${key}" was not equal to "${expectedValue}" and was instead equal to: ${value}`,
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
{
|
|
176
|
+
const key = "foo2";
|
|
177
|
+
const expectedValue = "bar2";
|
|
178
|
+
|
|
179
|
+
const value = v.run.myMap.get(key);
|
|
180
|
+
if (value !== expectedValue) {
|
|
181
|
+
error(
|
|
182
|
+
`The old table's map key of "${key}" was not equal to "${expectedValue}" and was instead equal to: ${value}`,
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
{
|
|
188
|
+
const key = "foo3";
|
|
189
|
+
const expectedValue = "bar3";
|
|
190
|
+
|
|
191
|
+
const value = v.run.myMap.get(key);
|
|
192
|
+
if (value !== expectedValue) {
|
|
193
|
+
error(
|
|
194
|
+
`The old table's map key of "${key}" was not equal to "${expectedValue}" and was instead equal to: ${value}`,
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function oldTableHasFilledDefaultMap() {
|
|
201
|
+
const v = {
|
|
202
|
+
run: {
|
|
203
|
+
myDefaultMap: new DefaultMap<string, string>("default"),
|
|
204
|
+
},
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
const saveData = {
|
|
208
|
+
run: {
|
|
209
|
+
myDefaultMap: new DefaultMap<string, string>("default", [
|
|
210
|
+
["foo1", "bar1"],
|
|
211
|
+
["foo2", "bar2"],
|
|
212
|
+
["foo3", "bar3"],
|
|
213
|
+
]),
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
const serializedSaveData = deepCopy(saveData, SerializationType.SERIALIZE);
|
|
217
|
+
|
|
218
|
+
merge(
|
|
219
|
+
v as unknown as LuaTable,
|
|
220
|
+
serializedSaveData as LuaTable,
|
|
221
|
+
"oldTableHasFilledDefaultMap",
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
const expectedSize = 3;
|
|
225
|
+
if (v.run.myDefaultMap.size !== expectedSize) {
|
|
226
|
+
error(
|
|
227
|
+
`The size of the merged default map was equal to ${v.run.myDefaultMap.size}, but it should be equal to: ${expectedSize}`,
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
{
|
|
232
|
+
const key = "foo1";
|
|
233
|
+
const expectedValue = "bar1";
|
|
234
|
+
|
|
235
|
+
const value = v.run.myDefaultMap.get(key);
|
|
236
|
+
if (value !== expectedValue) {
|
|
237
|
+
error(
|
|
238
|
+
`The old table's default map key of "${key}" was not equal to "${expectedValue}" and was instead equal to: ${value}`,
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
{
|
|
244
|
+
const key = "foo2";
|
|
245
|
+
const expectedValue = "bar2";
|
|
246
|
+
|
|
247
|
+
const value = v.run.myDefaultMap.get(key);
|
|
248
|
+
if (value !== expectedValue) {
|
|
249
|
+
error(
|
|
250
|
+
`The old table's default map key of "${key}" was not equal to "${expectedValue}" and was instead equal to: ${value}`,
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
{
|
|
256
|
+
const key = "foo3";
|
|
257
|
+
const expectedValue = "bar3";
|
|
258
|
+
|
|
259
|
+
const value = v.run.myDefaultMap.get(key);
|
|
260
|
+
if (value !== expectedValue) {
|
|
261
|
+
error(
|
|
262
|
+
`The old table's default map key of "${key}" was not equal to "${expectedValue}" and was instead equal to: ${value}`,
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
122
268
|
function oldTableHasVector() {
|
|
123
269
|
log("Starting test: oldTableHasVector");
|
|
124
270
|
|
|
@@ -183,6 +329,7 @@ function oldTableHasVectorSerialized() {
|
|
|
183
329
|
const newTableSerialized = deepCopy(
|
|
184
330
|
newTable,
|
|
185
331
|
SerializationType.SERIALIZE,
|
|
332
|
+
"oldTableHasVectorSerialized",
|
|
186
333
|
) as LuaTable<AnyNotNil, unknown>;
|
|
187
334
|
|
|
188
335
|
merge(oldTable, newTableSerialized, "oldTableHasVectorSerialized");
|
|
@@ -266,6 +413,7 @@ function oldTableHasRNGSerialized() {
|
|
|
266
413
|
const newTableSerialized = deepCopy(
|
|
267
414
|
newTable,
|
|
268
415
|
SerializationType.SERIALIZE,
|
|
416
|
+
"oldTableHasRNGSerialized",
|
|
269
417
|
) as LuaTable<AnyNotNil, unknown>;
|
|
270
418
|
|
|
271
419
|
merge(oldTable, newTableSerialized, "oldTableHasRNGSerialized");
|
|
@@ -16,8 +16,8 @@ import {
|
|
|
16
16
|
VisVariant,
|
|
17
17
|
} from "isaac-typescript-definitions";
|
|
18
18
|
import { EGGY_STATE_FRAME_OF_FINAL_SPIDER } from "../constants";
|
|
19
|
-
import { getFilteredNewEntities } from "./
|
|
20
|
-
import { getNPCs, getProjectiles } from "./
|
|
19
|
+
import { getFilteredNewEntities } from "./entities";
|
|
20
|
+
import { getNPCs, getProjectiles } from "./entitiesSpecific";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Used to filter out certain NPCs when determining of an NPC is "alive" and/or should keep the
|
|
@@ -78,19 +78,22 @@ export function fireProjectiles(
|
|
|
78
78
|
*
|
|
79
79
|
* This function will not include NPCs on an internal blacklist, such as Death's scythes or Big Horn
|
|
80
80
|
* holes.
|
|
81
|
+
*
|
|
82
|
+
* @param entityType Optional. If specified, will only get the NPCs that match the type. Default is
|
|
83
|
+
* -1, which matches every type.
|
|
84
|
+
* @param variant Optional. If specified, will only get the NPCs that match the variant. Default is
|
|
85
|
+
* -1, which matches every variant.
|
|
86
|
+
* @param subType Optional. If specified, will only get the NPCs that match the sub-type. Default is
|
|
87
|
+
* -1, which matches every sub-type.
|
|
88
|
+
* @param ignoreFriendly Optional. Default is false.
|
|
81
89
|
*/
|
|
82
90
|
export function getAliveNPCs(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
91
|
+
entityType: EntityType = -1,
|
|
92
|
+
variant = -1,
|
|
93
|
+
subType = -1,
|
|
86
94
|
ignoreFriendly = false,
|
|
87
95
|
): EntityNPC[] {
|
|
88
|
-
const npcs = getNPCs(
|
|
89
|
-
matchingEntityType,
|
|
90
|
-
matchingVariant,
|
|
91
|
-
matchingSubType,
|
|
92
|
-
ignoreFriendly,
|
|
93
|
-
);
|
|
96
|
+
const npcs = getNPCs(entityType, variant, subType, ignoreFriendly);
|
|
94
97
|
return npcs.filter((npc) => !npc.IsDead() && !isAliveExceptionNPC(npc));
|
|
95
98
|
}
|
|
96
99
|
|
|
@@ -146,3 +149,31 @@ export function isRaglingDeathPatch(npc: EntityNPC): boolean {
|
|
|
146
149
|
npc.State === NpcState.SPECIAL
|
|
147
150
|
);
|
|
148
151
|
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* The base game `EntityNPC.FireProjectiles` method does not return anything, which is a problem in
|
|
155
|
+
* situations where you need to work with the fired projectiles. This function invokes that method,
|
|
156
|
+
* and then returns the projectiles that were spawned.
|
|
157
|
+
*
|
|
158
|
+
* @param npc The EntityNPC firing projectiles.
|
|
159
|
+
* @param position The starting position of the projectiles.
|
|
160
|
+
* @param velocity The starting velocity of the projectiles.
|
|
161
|
+
* @param projectilesMode A ProjectilesMode enum value defining how to fire the projectiles.
|
|
162
|
+
* @param projectileParams A ProjectileParams object containing various parameters for the
|
|
163
|
+
* projectiles.
|
|
164
|
+
* @returns An array of EntityProjectiles containing all fired projectiles.
|
|
165
|
+
*/
|
|
166
|
+
export function npcFireProjectiles(
|
|
167
|
+
npc: EntityNPC,
|
|
168
|
+
position: Vector,
|
|
169
|
+
velocity: Vector,
|
|
170
|
+
projectilesMode: ProjectilesMode,
|
|
171
|
+
projectileParams: ProjectileParams,
|
|
172
|
+
): EntityProjectile[] {
|
|
173
|
+
const oldEntities = getProjectiles();
|
|
174
|
+
npc.FireProjectiles(position, velocity, projectilesMode, projectileParams);
|
|
175
|
+
const newEntities = getProjectiles();
|
|
176
|
+
const filteredNewEntities = getFilteredNewEntities(oldEntities, newEntities);
|
|
177
|
+
|
|
178
|
+
return filteredNewEntities;
|
|
179
|
+
}
|