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
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import { game } from "../../cachedClasses";
|
|
9
9
|
import { HealthType } from "../../enums/HealthType";
|
|
10
10
|
import { directionToVector } from "../../functions/direction";
|
|
11
|
-
import {
|
|
11
|
+
import { spawnGridEntityWithVariant } from "../../functions/gridEntities";
|
|
12
12
|
import { logEntities, logGridEntities } from "../../functions/log";
|
|
13
13
|
import { addPlayerHealthType } from "../../functions/playerHealth";
|
|
14
14
|
import { getRoomData, getRoomDescriptor } from "../../functions/roomData";
|
|
@@ -118,7 +118,7 @@ export function spawnTrapdoorOrCrawlSpace(trapdoor: boolean): void {
|
|
|
118
118
|
? GridEntityType.TRAPDOOR
|
|
119
119
|
: GridEntityType.CRAWL_SPACE;
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
spawnGridEntityWithVariant(gridEntityType, 0, gridIndex);
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
export function warpToRoomType(roomType: RoomType): void {
|
|
@@ -53,10 +53,10 @@ import { getCardName } from "../../functions/cards";
|
|
|
53
53
|
import { getCharacterName } from "../../functions/character";
|
|
54
54
|
import { addCharge } from "../../functions/charge";
|
|
55
55
|
import { isValidCollectibleType } from "../../functions/collectibles";
|
|
56
|
-
import { getNPCs } from "../../functions/
|
|
56
|
+
import { getNPCs } from "../../functions/entitiesSpecific";
|
|
57
57
|
import { getEnumValues } from "../../functions/enums";
|
|
58
58
|
import { addFlag } from "../../functions/flag";
|
|
59
|
-
import {
|
|
59
|
+
import { spawnGridEntity } from "../../functions/gridEntities";
|
|
60
60
|
import {
|
|
61
61
|
logEffects,
|
|
62
62
|
logRoom,
|
|
@@ -64,15 +64,19 @@ import {
|
|
|
64
64
|
logSounds,
|
|
65
65
|
} from "../../functions/log";
|
|
66
66
|
import { getMapPartialMatch } from "../../functions/map";
|
|
67
|
-
import {
|
|
67
|
+
import {
|
|
68
|
+
spawnCard,
|
|
69
|
+
spawnPill,
|
|
70
|
+
spawnTrinket,
|
|
71
|
+
} from "../../functions/pickupsSpecific";
|
|
68
72
|
import { getPillEffectName } from "../../functions/pills";
|
|
73
|
+
import { getPlayers } from "../../functions/playerIndex";
|
|
69
74
|
import {
|
|
70
75
|
addCollectibleCostume,
|
|
71
76
|
getPlayerName,
|
|
72
77
|
removeCollectibleCostume,
|
|
73
78
|
useActiveItemTemp,
|
|
74
|
-
} from "../../functions/
|
|
75
|
-
import { getPlayers } from "../../functions/playerIndex";
|
|
79
|
+
} from "../../functions/players";
|
|
76
80
|
import { gridCoordinatesToWorldPosition } from "../../functions/roomGrid";
|
|
77
81
|
import { changeRoom, getRoomGridIndexesForType } from "../../functions/rooms";
|
|
78
82
|
import { onSetSeed, restart, setUnseeded } from "../../functions/run";
|
|
@@ -337,7 +341,7 @@ export function cards(): void {
|
|
|
337
341
|
|
|
338
342
|
const position = gridCoordinatesToWorldPosition(x, y);
|
|
339
343
|
spawnCard(cardType as Card, position);
|
|
340
|
-
cardType
|
|
344
|
+
cardType++;
|
|
341
345
|
}
|
|
342
346
|
}
|
|
343
347
|
}
|
|
@@ -647,14 +651,14 @@ export function gridEntities(): void {
|
|
|
647
651
|
let gridEntityTypeIndex = -1;
|
|
648
652
|
for (let y = 0; y <= 6; y++) {
|
|
649
653
|
for (let x = 0; x <= 12; x++) {
|
|
650
|
-
gridEntityTypeIndex
|
|
654
|
+
gridEntityTypeIndex++;
|
|
651
655
|
const gridEntityType = gridEntityTypes[gridEntityTypeIndex];
|
|
652
656
|
if (gridEntityType === undefined) {
|
|
653
657
|
return;
|
|
654
658
|
}
|
|
655
659
|
|
|
656
660
|
const position = gridCoordinatesToWorldPosition(x, y);
|
|
657
|
-
|
|
661
|
+
spawnGridEntity(gridEntityType, position);
|
|
658
662
|
}
|
|
659
663
|
}
|
|
660
664
|
}
|
|
@@ -884,7 +888,7 @@ export function pills(): void {
|
|
|
884
888
|
let pillColorIndex = -1;
|
|
885
889
|
for (let y = 0; y <= 6; y++) {
|
|
886
890
|
for (let x = 0; x <= 12; x++) {
|
|
887
|
-
pillColorIndex
|
|
891
|
+
pillColorIndex++;
|
|
888
892
|
const pillColor = pillColors[pillColorIndex];
|
|
889
893
|
if (pillColor === undefined) {
|
|
890
894
|
return;
|
package/src/features/pause.ts
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
ModCallback,
|
|
6
6
|
} from "isaac-typescript-definitions";
|
|
7
7
|
import { logError } from "../functions/log";
|
|
8
|
-
import { useActiveItemTemp } from "../functions/
|
|
8
|
+
import { useActiveItemTemp } from "../functions/players";
|
|
9
9
|
import { disableAllInputsExceptFor, enableAllInputs } from "./disableInputs";
|
|
10
10
|
import { saveDataManager } from "./saveDataManager/exports";
|
|
11
11
|
|
|
@@ -7,7 +7,7 @@ import { game } from "../cachedClasses";
|
|
|
7
7
|
import { ModUpgraded } from "../classes/ModUpgraded";
|
|
8
8
|
import { ModCallbackCustom } from "../enums/ModCallbackCustom";
|
|
9
9
|
import { errorIfFeaturesNotInitialized } from "../featuresInitialized";
|
|
10
|
-
import { spawn } from "../functions/
|
|
10
|
+
import { spawn } from "../functions/entities";
|
|
11
11
|
import { getRoomListIndex } from "../functions/roomData";
|
|
12
12
|
import { saveDataManager } from "./saveDataManager/exports";
|
|
13
13
|
|
|
@@ -123,7 +123,7 @@ export function spawnPersistentEntity(
|
|
|
123
123
|
): [Entity, int] {
|
|
124
124
|
errorIfFeaturesNotInitialized(FEATURE_NAME);
|
|
125
125
|
|
|
126
|
-
persistentEntityIndexCounter
|
|
126
|
+
persistentEntityIndexCounter++;
|
|
127
127
|
|
|
128
128
|
const entity = spawnAndTrack(
|
|
129
129
|
entityType,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { game } from "../cachedClasses";
|
|
11
11
|
import { errorIfFeaturesNotInitialized } from "../featuresInitialized";
|
|
12
12
|
import { setCollectibleSubType } from "../functions/collectibles";
|
|
13
|
-
import { getEntityID } from "../functions/
|
|
13
|
+
import { getEntityID } from "../functions/entities";
|
|
14
14
|
import { isCollectible } from "../functions/pickupVariants";
|
|
15
15
|
import { saveDataManager } from "./saveDataManager/exports";
|
|
16
16
|
|
|
@@ -169,8 +169,11 @@ export function saveDataManagerSave(): void {
|
|
|
169
169
|
forceSaveDataManagerSave();
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
|
|
173
|
-
declare let
|
|
172
|
+
/** "g" stands for "globals". */
|
|
173
|
+
declare let g: LuaTable<string, SaveData>; // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
174
|
+
|
|
175
|
+
/** "gd" stands for "globals defaults". */
|
|
176
|
+
declare let gd: LuaTable<string, SaveData>; // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
174
177
|
|
|
175
178
|
/**
|
|
176
179
|
* - Sets the global variable of "g" equal to all of the save data variables for this mod.
|
|
@@ -182,8 +185,8 @@ declare let gd: LuaTable<string, SaveData>; // Globals defaults
|
|
|
182
185
|
export function saveDataManagerSetGlobal(): void {
|
|
183
186
|
errorIfFeaturesNotInitialized(SAVE_DATA_MANAGER_FEATURE_NAME);
|
|
184
187
|
|
|
185
|
-
g = saveDataMap;
|
|
186
|
-
gd = saveDataDefaultsMap;
|
|
188
|
+
g = saveDataMap;
|
|
189
|
+
gd = saveDataDefaultsMap;
|
|
187
190
|
}
|
|
188
191
|
|
|
189
192
|
/**
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
isSerializedIsaacAPIClass,
|
|
9
9
|
} from "../../functions/serialization";
|
|
10
10
|
import { clearTable, iterateTableInOrder } from "../../functions/table";
|
|
11
|
-
import { isTSTLMap, isTSTLSet } from "../../functions/tstlClass";
|
|
11
|
+
import { isDefaultMap, isTSTLMap, isTSTLSet } from "../../functions/tstlClass";
|
|
12
12
|
import { isTable } from "../../functions/types";
|
|
13
13
|
import { getTraversalDescription } from "../../functions/utils";
|
|
14
14
|
import { SAVE_DATA_MANAGER_DEBUG } from "./saveDataManagerConstants";
|
|
@@ -65,7 +65,7 @@ export function merge(
|
|
|
65
65
|
|
|
66
66
|
// Depending on whether we are working on a Lua table or a TypeScriptToLua object, we need to
|
|
67
67
|
// iterate in a specific way.
|
|
68
|
-
if (isTSTLMap(oldObject) || isTSTLSet(oldObject)) {
|
|
68
|
+
if (isTSTLMap(oldObject) || isTSTLSet(oldObject) || isDefaultMap(oldObject)) {
|
|
69
69
|
mergeTSTLObject(oldObject, newTable, traversalDescription);
|
|
70
70
|
} else {
|
|
71
71
|
mergeTable(oldObject, newTable, traversalDescription);
|
|
@@ -118,7 +118,7 @@ function mergeTSTLObject(
|
|
|
118
118
|
keyToUse = numberKey;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
if (isTSTLMap(oldObject)) {
|
|
121
|
+
if (isTSTLMap(oldObject) || isDefaultMap(oldObject)) {
|
|
122
122
|
let valueCopy: unknown;
|
|
123
123
|
if (isTable(value)) {
|
|
124
124
|
valueCopy = deepCopy(
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
ModCallback,
|
|
5
5
|
} from "isaac-typescript-definitions";
|
|
6
6
|
import { errorIfFeaturesNotInitialized } from "../featuresInitialized";
|
|
7
|
-
import { getEntities } from "../functions/
|
|
7
|
+
import { getEntities } from "../functions/entities";
|
|
8
8
|
import { saveDataManager } from "./saveDataManager/exports";
|
|
9
9
|
|
|
10
10
|
const FEATURE_NAME = "sirenHelpers";
|
package/src/functions/ambush.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SackSubType } from "isaac-typescript-definitions";
|
|
2
2
|
import { runNextGameFrame } from "../features/runInNFrames";
|
|
3
|
-
import { removeEntities } from "./
|
|
4
|
-
import { getCoins, spawnSackWithSeed } from "./
|
|
3
|
+
import { removeEntities } from "./entities";
|
|
4
|
+
import { getCoins, spawnSackWithSeed } from "./pickupsSpecific";
|
|
5
5
|
|
|
6
6
|
/** Hard-coding this makes it easier to clean up the pickups afterwards. */
|
|
7
7
|
const SACK_SEED_THAT_SPAWNS_TWO_COINS = 6 as Seed;
|
package/src/functions/array.ts
CHANGED
|
@@ -443,7 +443,10 @@ export function isArray(object: unknown): object is unknown[] {
|
|
|
443
443
|
return false;
|
|
444
444
|
}
|
|
445
445
|
|
|
446
|
-
|
|
446
|
+
// Third, handle the case of an "empty" table. We cannot use the "LuaTable.length" method to
|
|
447
|
+
// determine this, since that will not actually return the number of keys. (It will only work
|
|
448
|
+
// properly for tables that are being used as arrays, which is not necessarily the case here.)
|
|
449
|
+
const tableLength = Object.keys(object).length;
|
|
447
450
|
if (tableLength === 0) {
|
|
448
451
|
return true;
|
|
449
452
|
}
|
|
@@ -524,7 +527,7 @@ export function shuffleArrayInPlace<T>(
|
|
|
524
527
|
const rng = isRNG(seedOrRNG) ? seedOrRNG : newRNG(seedOrRNG);
|
|
525
528
|
|
|
526
529
|
while (currentIndex > 0) {
|
|
527
|
-
currentIndex
|
|
530
|
+
currentIndex--;
|
|
528
531
|
|
|
529
532
|
const randomIndex = getRandomArrayIndex(array, rng);
|
|
530
533
|
swapArrayElements(array, currentIndex, randomIndex);
|
package/src/functions/bitwise.ts
CHANGED
|
@@ -57,7 +57,7 @@ export function countSetBits(n: int): int {
|
|
|
57
57
|
|
|
58
58
|
while (n > 0) {
|
|
59
59
|
n &= n - 1;
|
|
60
|
-
count
|
|
60
|
+
count++;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
return count;
|
|
@@ -72,7 +72,7 @@ export function getKBitOfN(k: int, n: int): int {
|
|
|
72
72
|
export function getNumBitsOfN(n: int): int {
|
|
73
73
|
let numBits = 0;
|
|
74
74
|
while (n > 0) {
|
|
75
|
-
numBits
|
|
75
|
+
numBits++;
|
|
76
76
|
n >>>= 1;
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
STAGE_TO_STAGE_TYPE_TO_BOSS_SET_MAP,
|
|
11
11
|
} from "../sets/bossSets";
|
|
12
12
|
import { SIN_ENTITY_TYPES_SET } from "../sets/sinEntityTypesSet";
|
|
13
|
-
import { getNPCs, spawnNPC } from "./
|
|
14
|
-
import { getAliveNPCs } from "./
|
|
13
|
+
import { getNPCs, spawnNPC } from "./entitiesSpecific";
|
|
14
|
+
import { getAliveNPCs } from "./npcs";
|
|
15
15
|
import { isRNG } from "./rng";
|
|
16
16
|
import { copySet } from "./set";
|
|
17
17
|
import { repeat } from "./utils";
|
|
@@ -31,19 +31,22 @@ const DEFAULT_BOSS_MULTI_SEGMENTS = 4;
|
|
|
31
31
|
*
|
|
32
32
|
* This function will not include bosses on an internal blacklist, such as Death's scythes or Big
|
|
33
33
|
* Horn holes.
|
|
34
|
+
*
|
|
35
|
+
* @param entityType Optional. If specified, will only get the bosses that match the type. Default
|
|
36
|
+
* is -1, which matches every type.
|
|
37
|
+
* @param variant Optional. If specified, will only get the bosses that match the variant. Default
|
|
38
|
+
* is -1, which matches every variant.
|
|
39
|
+
* @param subType Optional. If specified, will only get the bosses that match the sub-type. Default
|
|
40
|
+
* is -1, which matches every sub-type.
|
|
41
|
+
* @param ignoreFriendly Optional. Default is false.
|
|
34
42
|
*/
|
|
35
43
|
export function getAliveBosses(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
entityType: EntityType = -1,
|
|
45
|
+
variant = -1,
|
|
46
|
+
subType = -1,
|
|
39
47
|
ignoreFriendly = false,
|
|
40
48
|
): EntityNPC[] {
|
|
41
|
-
const aliveNPCs = getAliveNPCs(
|
|
42
|
-
matchingEntityType,
|
|
43
|
-
matchingVariant,
|
|
44
|
-
matchingSubType,
|
|
45
|
-
ignoreFriendly,
|
|
46
|
-
);
|
|
49
|
+
const aliveNPCs = getAliveNPCs(entityType, variant, subType, ignoreFriendly);
|
|
47
50
|
return aliveNPCs.filter((aliveNPC) => aliveNPC.IsBoss());
|
|
48
51
|
}
|
|
49
52
|
|
|
@@ -83,19 +86,24 @@ export function getBossSet(
|
|
|
83
86
|
return copySet(bossSet);
|
|
84
87
|
}
|
|
85
88
|
|
|
86
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* Helper function to get all of the bosses in the room.
|
|
91
|
+
*
|
|
92
|
+
* @param entityType Optional. If specified, will only get the bosses that match the type. Default
|
|
93
|
+
* is -1, which matches every type.
|
|
94
|
+
* @param variant Optional. If specified, will only get the bosses that match the variant. Default
|
|
95
|
+
* is -1, which matches every variant.
|
|
96
|
+
* @param subType Optional. If specified, will only get the bosses that match the sub-type. Default
|
|
97
|
+
* is -1, which matches every sub-type.
|
|
98
|
+
* @param ignoreFriendly Optional. Default is false.
|
|
99
|
+
*/
|
|
87
100
|
export function getBosses(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
101
|
+
entityType?: EntityType,
|
|
102
|
+
variant?: int,
|
|
103
|
+
subType?: int,
|
|
91
104
|
ignoreFriendly = false,
|
|
92
105
|
): EntityNPC[] {
|
|
93
|
-
const npcs = getNPCs(
|
|
94
|
-
matchingEntityType,
|
|
95
|
-
matchingVariant,
|
|
96
|
-
matchingSubType,
|
|
97
|
-
ignoreFriendly,
|
|
98
|
-
);
|
|
106
|
+
const npcs = getNPCs(entityType, variant, subType, ignoreFriendly);
|
|
99
107
|
return npcs.filter((npc) => npc.IsBoss());
|
|
100
108
|
}
|
|
101
109
|
|
|
@@ -3,7 +3,7 @@ import { itemConfig } from "../cachedClasses";
|
|
|
3
3
|
import { getCollectibleArray } from "./collectibleSet";
|
|
4
4
|
import { getEnumValues } from "./enums";
|
|
5
5
|
import { getFlagName } from "./flag";
|
|
6
|
-
import { getPlayerCollectibleCount } from "./
|
|
6
|
+
import { getPlayerCollectibleCount } from "./players";
|
|
7
7
|
import { copySet } from "./set";
|
|
8
8
|
|
|
9
9
|
const TAG_TO_COLLECTIBLE_TYPES_MAP = new Map<
|
|
@@ -27,10 +27,10 @@ import {
|
|
|
27
27
|
} from "../maps/collectibleNameMap";
|
|
28
28
|
import { SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES_SET } from "../sets/singleUseActiveCollectibleTypesSet";
|
|
29
29
|
import { CollectibleIndex } from "../types/CollectibleIndex";
|
|
30
|
-
import { getEntityID } from "./
|
|
30
|
+
import { getEntityID } from "./entities";
|
|
31
31
|
import { isCollectible } from "./pickupVariants";
|
|
32
32
|
import { getRoomListIndex } from "./roomData";
|
|
33
|
-
import { clearSprite, spriteEquals } from "./
|
|
33
|
+
import { clearSprite, spriteEquals } from "./sprites";
|
|
34
34
|
import { irange } from "./utils";
|
|
35
35
|
|
|
36
36
|
const COLLECTIBLE_SPRITE_LAYER = 1;
|
|
@@ -51,15 +51,19 @@ const COPYABLE_ISAAC_API_CLASS_TYPES_SET = new Set<string>(
|
|
|
51
51
|
* - other Isaac API objects such as `EntityPtr` (that have a type of "userdata")
|
|
52
52
|
*
|
|
53
53
|
* @param value The primitive or object to copy.
|
|
54
|
-
* @param serializationType Has 3 possible values. Can
|
|
55
|
-
* to Lua tables, or can deserialize Lua tables to
|
|
56
|
-
* `SerializationType.NONE`.
|
|
57
|
-
* @param traversalDescription Used to track the current key that we are operating on.
|
|
54
|
+
* @param serializationType Optional. Has 3 possible values. Can copy objects as-is, or can
|
|
55
|
+
* serialize objects to Lua tables, or can deserialize Lua tables to
|
|
56
|
+
* objects. Default is `SerializationType.NONE`.
|
|
57
|
+
* @param traversalDescription Optional. Used to track the current key that we are operating on.
|
|
58
|
+
* Default is an empty string.
|
|
59
|
+
* @param insideMap Optional. Tracks whether or not the deep copy function is in the process of
|
|
60
|
+
* recursively copying a TSTL Map. Default is false.
|
|
58
61
|
*/
|
|
59
62
|
export function deepCopy(
|
|
60
63
|
value: unknown,
|
|
61
64
|
serializationType = SerializationType.NONE,
|
|
62
65
|
traversalDescription = "",
|
|
66
|
+
insideMap = false,
|
|
63
67
|
): unknown {
|
|
64
68
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
65
69
|
if (SAVE_DATA_MANAGER_DEBUG) {
|
|
@@ -98,7 +102,12 @@ export function deepCopy(
|
|
|
98
102
|
|
|
99
103
|
case "table": {
|
|
100
104
|
const luaTable = value as LuaTable<AnyNotNil, unknown>;
|
|
101
|
-
return deepCopyTable(
|
|
105
|
+
return deepCopyTable(
|
|
106
|
+
luaTable,
|
|
107
|
+
serializationType,
|
|
108
|
+
traversalDescription,
|
|
109
|
+
insideMap,
|
|
110
|
+
);
|
|
102
111
|
}
|
|
103
112
|
|
|
104
113
|
case "userdata": {
|
|
@@ -111,6 +120,7 @@ function deepCopyTable(
|
|
|
111
120
|
luaTable: LuaTable<AnyNotNil, unknown>,
|
|
112
121
|
serializationType: SerializationType,
|
|
113
122
|
traversalDescription: string,
|
|
123
|
+
insideMap: boolean,
|
|
114
124
|
) {
|
|
115
125
|
// First, handle the cases of TSTL classes or serialized TSTL classes.
|
|
116
126
|
if (isDefaultMap(luaTable) || luaTable.has(SerializationBrand.DEFAULT_MAP)) {
|
|
@@ -118,15 +128,26 @@ function deepCopyTable(
|
|
|
118
128
|
luaTable,
|
|
119
129
|
serializationType,
|
|
120
130
|
traversalDescription,
|
|
131
|
+
insideMap,
|
|
121
132
|
);
|
|
122
133
|
}
|
|
123
134
|
|
|
124
135
|
if (isTSTLMap(luaTable) || luaTable.has(SerializationBrand.MAP)) {
|
|
125
|
-
return deepCopyMap(
|
|
136
|
+
return deepCopyMap(
|
|
137
|
+
luaTable,
|
|
138
|
+
serializationType,
|
|
139
|
+
traversalDescription,
|
|
140
|
+
insideMap,
|
|
141
|
+
);
|
|
126
142
|
}
|
|
127
143
|
|
|
128
144
|
if (isTSTLSet(luaTable) || luaTable.has(SerializationBrand.SET)) {
|
|
129
|
-
return deepCopySet(
|
|
145
|
+
return deepCopySet(
|
|
146
|
+
luaTable,
|
|
147
|
+
serializationType,
|
|
148
|
+
traversalDescription,
|
|
149
|
+
insideMap,
|
|
150
|
+
);
|
|
130
151
|
}
|
|
131
152
|
|
|
132
153
|
const className = getTSTLClassName(luaTable);
|
|
@@ -144,7 +165,12 @@ function deepCopyTable(
|
|
|
144
165
|
}
|
|
145
166
|
|
|
146
167
|
if (isUserDefinedTSTLClass(luaTable)) {
|
|
147
|
-
return deepCopyTSTLClass(
|
|
168
|
+
return deepCopyTSTLClass(
|
|
169
|
+
luaTable,
|
|
170
|
+
serializationType,
|
|
171
|
+
traversalDescription,
|
|
172
|
+
insideMap,
|
|
173
|
+
);
|
|
148
174
|
}
|
|
149
175
|
|
|
150
176
|
// This is not a TSTL Map/Set/class. If it has a metatable, abort.
|
|
@@ -160,7 +186,12 @@ function deepCopyTable(
|
|
|
160
186
|
|
|
161
187
|
// Handle the special case of an array.
|
|
162
188
|
if (isArray(luaTable)) {
|
|
163
|
-
return deepCopyArray(
|
|
189
|
+
return deepCopyArray(
|
|
190
|
+
luaTable,
|
|
191
|
+
serializationType,
|
|
192
|
+
traversalDescription,
|
|
193
|
+
insideMap,
|
|
194
|
+
);
|
|
164
195
|
}
|
|
165
196
|
|
|
166
197
|
// Base case: copy a normal Lua table
|
|
@@ -168,6 +199,7 @@ function deepCopyTable(
|
|
|
168
199
|
luaTable,
|
|
169
200
|
serializationType,
|
|
170
201
|
traversalDescription,
|
|
202
|
+
insideMap,
|
|
171
203
|
);
|
|
172
204
|
}
|
|
173
205
|
|
|
@@ -175,19 +207,39 @@ function deepCopyDefaultMap(
|
|
|
175
207
|
defaultMap: DefaultMap<AnyNotNil, unknown> | LuaTable<AnyNotNil, unknown>,
|
|
176
208
|
serializationType: SerializationType,
|
|
177
209
|
traversalDescription: string,
|
|
210
|
+
insideMap: boolean,
|
|
178
211
|
) {
|
|
179
|
-
// First, handle the special case of serializing a DefaultMap instantiated with a factory
|
|
180
|
-
// function. If this is the case, then we cannot serialize it, so we serialize it as a normal
|
|
181
|
-
// `Map` instead. We do not throw a runtime error because the merge function does not need to
|
|
182
|
-
// instantiate the DefaultMap class in most circumstances.
|
|
183
212
|
const constructorArg = isDefaultMap(defaultMap)
|
|
184
213
|
? defaultMap.getConstructorArg()
|
|
185
|
-
: undefined;
|
|
214
|
+
: undefined; // The undefined case is handled explicitly in the "getNewDefaultMap" function.
|
|
215
|
+
|
|
216
|
+
// First, handle the special case of serializing a DefaultMap instantiated with a factory
|
|
217
|
+
// function. If this is the case, then we cannot serialize it (because there is no way to
|
|
218
|
+
// serialize a function).
|
|
186
219
|
if (
|
|
187
220
|
serializationType === SerializationType.SERIALIZE &&
|
|
188
221
|
!isPrimitive(constructorArg)
|
|
189
222
|
) {
|
|
190
|
-
|
|
223
|
+
if (insideMap) {
|
|
224
|
+
// The case of a DefaultMap within another map is complicated. Unlike a DefaultMap attached to
|
|
225
|
+
// a "normal" object, the `merge` function will have no reference to the factory function that
|
|
226
|
+
// was used to instantiate it. Thus, there is no way to copy this object. In this case, we
|
|
227
|
+
// throw a run-time error to immediately alert the end-user that their data structure is
|
|
228
|
+
// invalid.
|
|
229
|
+
error(
|
|
230
|
+
'Failed to deep copy a DefaultMap because it was instantiated with a factory function and was also inside of another map. You cannot use a nested DefaultMap in this way because factory functions are not serializable. (In other words, there is no way to copy the function that you are using for the DefaultMap into the "save#.dat" file.) Instead, refactor your data structure so that the DefaultMap is not nested.',
|
|
231
|
+
);
|
|
232
|
+
} else {
|
|
233
|
+
// In most cases, the DefaultMap will be attached to a normal table element. In this case, if
|
|
234
|
+
// we serialize it as a normal `Map`, then everything will work out fine, because the `merge`
|
|
235
|
+
// function only needs to copy the values (and not instantiate the object itself).
|
|
236
|
+
return deepCopyMap(
|
|
237
|
+
defaultMap,
|
|
238
|
+
serializationType,
|
|
239
|
+
traversalDescription,
|
|
240
|
+
insideMap,
|
|
241
|
+
);
|
|
242
|
+
}
|
|
191
243
|
}
|
|
192
244
|
|
|
193
245
|
const newDefaultMap = getNewDefaultMap(
|
|
@@ -196,11 +248,13 @@ function deepCopyDefaultMap(
|
|
|
196
248
|
traversalDescription,
|
|
197
249
|
constructorArg,
|
|
198
250
|
);
|
|
251
|
+
insideMap = true;
|
|
199
252
|
|
|
200
253
|
const { entries, convertedNumberKeysToStrings } = getCopiedEntries(
|
|
201
254
|
defaultMap,
|
|
202
255
|
serializationType,
|
|
203
256
|
traversalDescription,
|
|
257
|
+
insideMap,
|
|
204
258
|
);
|
|
205
259
|
|
|
206
260
|
if (convertedNumberKeysToStrings) {
|
|
@@ -223,12 +277,14 @@ function deepCopyDefaultMap(
|
|
|
223
277
|
}
|
|
224
278
|
}
|
|
225
279
|
|
|
280
|
+
insideMap = false;
|
|
281
|
+
|
|
226
282
|
return newDefaultMap;
|
|
227
283
|
}
|
|
228
284
|
|
|
229
285
|
/**
|
|
230
|
-
* The new default map with either be a TSTL `DefaultMap` class or a Lua table, depending on
|
|
231
|
-
* we are serializing or not.
|
|
286
|
+
* The new copied default map with either be a TSTL `DefaultMap` class or a Lua table, depending on
|
|
287
|
+
* whether we are serializing or not.
|
|
232
288
|
*/
|
|
233
289
|
function getNewDefaultMap(
|
|
234
290
|
defaultMap: DefaultMap<AnyNotNil, unknown> | LuaTable<AnyNotNil, unknown>,
|
|
@@ -278,6 +334,7 @@ function deepCopyMap(
|
|
|
278
334
|
map: Map<AnyNotNil, unknown> | LuaTable<AnyNotNil, unknown>,
|
|
279
335
|
serializationType: SerializationType,
|
|
280
336
|
traversalDescription: string,
|
|
337
|
+
insideMap: boolean,
|
|
281
338
|
) {
|
|
282
339
|
let newMap: Map<AnyNotNil, unknown> | LuaTable<AnyNotNil, unknown>;
|
|
283
340
|
if (serializationType === SerializationType.SERIALIZE) {
|
|
@@ -287,11 +344,13 @@ function deepCopyMap(
|
|
|
287
344
|
} else {
|
|
288
345
|
newMap = new Map();
|
|
289
346
|
}
|
|
347
|
+
insideMap = true;
|
|
290
348
|
|
|
291
349
|
const { entries, convertedNumberKeysToStrings } = getCopiedEntries(
|
|
292
350
|
map,
|
|
293
351
|
serializationType,
|
|
294
352
|
traversalDescription,
|
|
353
|
+
insideMap,
|
|
295
354
|
);
|
|
296
355
|
|
|
297
356
|
if (convertedNumberKeysToStrings) {
|
|
@@ -314,6 +373,8 @@ function deepCopyMap(
|
|
|
314
373
|
}
|
|
315
374
|
}
|
|
316
375
|
|
|
376
|
+
insideMap = false;
|
|
377
|
+
|
|
317
378
|
return newMap;
|
|
318
379
|
}
|
|
319
380
|
|
|
@@ -321,6 +382,7 @@ function deepCopySet(
|
|
|
321
382
|
set: Set<AnyNotNil> | LuaTable<AnyNotNil, unknown>,
|
|
322
383
|
serializationType: SerializationType,
|
|
323
384
|
traversalDescription: string,
|
|
385
|
+
insideMap: boolean,
|
|
324
386
|
) {
|
|
325
387
|
let newSet: Set<AnyNotNil> | LuaTable<AnyNotNil, string>;
|
|
326
388
|
if (serializationType === SerializationType.SERIALIZE) {
|
|
@@ -336,6 +398,7 @@ function deepCopySet(
|
|
|
336
398
|
set,
|
|
337
399
|
serializationType,
|
|
338
400
|
traversalDescription,
|
|
401
|
+
insideMap,
|
|
339
402
|
);
|
|
340
403
|
|
|
341
404
|
if (convertedNumberKeysToStrings) {
|
|
@@ -368,6 +431,7 @@ function deepCopyTSTLClass(
|
|
|
368
431
|
tstlClass: TSTLClass,
|
|
369
432
|
serializationType: SerializationType,
|
|
370
433
|
traversalDescription: string,
|
|
434
|
+
insideMap: boolean,
|
|
371
435
|
) {
|
|
372
436
|
let newClass: TSTLClass | LuaTable<AnyNotNil, unknown>;
|
|
373
437
|
if (serializationType === SerializationType.SERIALIZE) {
|
|
@@ -383,6 +447,7 @@ function deepCopyTSTLClass(
|
|
|
383
447
|
tstlClass,
|
|
384
448
|
serializationType,
|
|
385
449
|
traversalDescription,
|
|
450
|
+
insideMap,
|
|
386
451
|
);
|
|
387
452
|
|
|
388
453
|
if (convertedNumberKeysToStrings) {
|
|
@@ -400,11 +465,17 @@ function deepCopyArray(
|
|
|
400
465
|
array: unknown[],
|
|
401
466
|
serializationType: SerializationType,
|
|
402
467
|
traversalDescription: string,
|
|
468
|
+
insideMap: boolean,
|
|
403
469
|
) {
|
|
404
470
|
const newArray: unknown[] = [];
|
|
405
471
|
|
|
406
472
|
for (const value of array) {
|
|
407
|
-
const newValue = deepCopy(
|
|
473
|
+
const newValue = deepCopy(
|
|
474
|
+
value,
|
|
475
|
+
serializationType,
|
|
476
|
+
traversalDescription,
|
|
477
|
+
insideMap,
|
|
478
|
+
);
|
|
408
479
|
newArray.push(newValue);
|
|
409
480
|
}
|
|
410
481
|
|
|
@@ -415,12 +486,14 @@ function deepCopyNormalLuaTable(
|
|
|
415
486
|
luaTable: LuaTable<AnyNotNil, unknown>,
|
|
416
487
|
serializationType: SerializationType,
|
|
417
488
|
traversalDescription: string,
|
|
489
|
+
insideMap: boolean,
|
|
418
490
|
) {
|
|
419
491
|
const newTable = new LuaTable<AnyNotNil, unknown>();
|
|
420
492
|
const { entries, convertedNumberKeysToStrings } = getCopiedEntries(
|
|
421
493
|
luaTable,
|
|
422
494
|
serializationType,
|
|
423
495
|
traversalDescription,
|
|
496
|
+
insideMap,
|
|
424
497
|
);
|
|
425
498
|
|
|
426
499
|
if (convertedNumberKeysToStrings) {
|
|
@@ -442,6 +515,7 @@ function getCopiedEntries(
|
|
|
442
515
|
object: unknown,
|
|
443
516
|
serializationType: SerializationType,
|
|
444
517
|
traversalDescription: string,
|
|
518
|
+
insideMap: boolean,
|
|
445
519
|
): {
|
|
446
520
|
entries: Array<[key: AnyNotNil, value: unknown]>;
|
|
447
521
|
convertedNumberKeysToStrings: boolean;
|
|
@@ -479,7 +553,12 @@ function getCopiedEntries(
|
|
|
479
553
|
}
|
|
480
554
|
|
|
481
555
|
traversalDescription = getTraversalDescription(key, traversalDescription);
|
|
482
|
-
const newValue = deepCopy(
|
|
556
|
+
const newValue = deepCopy(
|
|
557
|
+
value,
|
|
558
|
+
serializationType,
|
|
559
|
+
traversalDescription,
|
|
560
|
+
insideMap,
|
|
561
|
+
);
|
|
483
562
|
|
|
484
563
|
const keyToUse = convertNumberKeysToStrings ? tostring(key) : key;
|
|
485
564
|
copiedEntries.push([keyToUse, newValue]);
|