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
|
@@ -7,7 +7,12 @@ import { log } from "./log";
|
|
|
7
7
|
import { isDefaultMap, isTSTLMap, isTSTLSet } from "./tstlClass";
|
|
8
8
|
import { isNumber, isString, isTable } from "./types";
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Run the suite of tests that prove that the "deepCopy" helper function works properly.
|
|
12
|
+
*
|
|
13
|
+
* This function is only useful if you are troubleshooting the "deepCopy" function.
|
|
14
|
+
*/
|
|
15
|
+
export function runDeepCopyTests(): void {
|
|
11
16
|
copiedObjectIsTable();
|
|
12
17
|
copiedObjectHasKeyAndValueString();
|
|
13
18
|
copiedTableHasKeyAndValueNumber();
|
|
@@ -34,7 +39,11 @@ function copiedObjectIsTable() {
|
|
|
34
39
|
const oldObject = {
|
|
35
40
|
abc: "def",
|
|
36
41
|
};
|
|
37
|
-
const newObject = deepCopy(
|
|
42
|
+
const newObject = deepCopy(
|
|
43
|
+
oldObject as unknown as LuaTable,
|
|
44
|
+
SerializationType.NONE,
|
|
45
|
+
"copiedObjectIsTable",
|
|
46
|
+
);
|
|
38
47
|
if (!isTable(newObject)) {
|
|
39
48
|
error(`The copied object had a type of: ${typeof newObject}`);
|
|
40
49
|
}
|
|
@@ -46,7 +55,11 @@ function copiedObjectHasKeyAndValueString() {
|
|
|
46
55
|
const oldObject = {
|
|
47
56
|
abc: valueToLookFor,
|
|
48
57
|
};
|
|
49
|
-
const newTable = deepCopy(
|
|
58
|
+
const newTable = deepCopy(
|
|
59
|
+
oldObject as unknown as LuaTable,
|
|
60
|
+
SerializationType.NONE,
|
|
61
|
+
"copiedObjectHasKeyAndValueString",
|
|
62
|
+
);
|
|
50
63
|
const newObject = newTable as typeof oldObject;
|
|
51
64
|
|
|
52
65
|
const value = newObject[keyToLookFor];
|
|
@@ -69,7 +82,11 @@ function copiedTableHasKeyAndValueNumber() {
|
|
|
69
82
|
const oldTable = new LuaTable<AnyNotNil, unknown>();
|
|
70
83
|
oldTable.set(keyToLookFor, valueToLookFor);
|
|
71
84
|
|
|
72
|
-
const newObject = deepCopy(
|
|
85
|
+
const newObject = deepCopy(
|
|
86
|
+
oldTable,
|
|
87
|
+
SerializationType.NONE,
|
|
88
|
+
"copiedTableHasKeyAndValueNumber",
|
|
89
|
+
);
|
|
73
90
|
const newTable = newObject as LuaTable<AnyNotNil, unknown>;
|
|
74
91
|
|
|
75
92
|
const value = newTable.get(keyToLookFor) as number | undefined;
|
|
@@ -91,7 +108,11 @@ function copiedTableDoesNotCoerceTypes() {
|
|
|
91
108
|
const oldTable = new LuaTable<AnyNotNil, unknown>();
|
|
92
109
|
oldTable.set(keyToLookFor, valueToLookFor);
|
|
93
110
|
|
|
94
|
-
const newObject = deepCopy(
|
|
111
|
+
const newObject = deepCopy(
|
|
112
|
+
oldTable,
|
|
113
|
+
SerializationType.NONE,
|
|
114
|
+
"copiedTableDoesNotCoerceTypes",
|
|
115
|
+
);
|
|
95
116
|
const newTable = newObject as LuaTable<AnyNotNil, unknown>;
|
|
96
117
|
|
|
97
118
|
const keyString = tostring(keyToLookFor);
|
|
@@ -110,6 +131,7 @@ function copiedTableDoesNotCoerceTypes() {
|
|
|
110
131
|
}
|
|
111
132
|
}
|
|
112
133
|
|
|
134
|
+
/** In this context, a reference is a pointer. */
|
|
113
135
|
function copiedObjectHasNoReferencesForPrimitivesForward() {
|
|
114
136
|
const originalStringValue = "abcdef";
|
|
115
137
|
const originalNumberValue = 123;
|
|
@@ -117,7 +139,11 @@ function copiedObjectHasNoReferencesForPrimitivesForward() {
|
|
|
117
139
|
abc: originalStringValue,
|
|
118
140
|
def: originalNumberValue,
|
|
119
141
|
};
|
|
120
|
-
const newTable = deepCopy(
|
|
142
|
+
const newTable = deepCopy(
|
|
143
|
+
oldObject as unknown as LuaTable,
|
|
144
|
+
SerializationType.NONE,
|
|
145
|
+
"copiedObjectHasNoReferencesForPrimitivesForward",
|
|
146
|
+
);
|
|
121
147
|
const newObject = newTable as typeof oldObject;
|
|
122
148
|
|
|
123
149
|
oldObject.abc = "newValue";
|
|
@@ -138,7 +164,11 @@ function copiedObjectHasNoReferencesForPrimitivesBackward() {
|
|
|
138
164
|
abc: originalStringValue,
|
|
139
165
|
def: originalNumberValue,
|
|
140
166
|
};
|
|
141
|
-
const newTable = deepCopy(
|
|
167
|
+
const newTable = deepCopy(
|
|
168
|
+
oldObject as unknown as LuaTable,
|
|
169
|
+
SerializationType.NONE,
|
|
170
|
+
"copiedObjectHasNoReferencesForPrimitivesBackward",
|
|
171
|
+
);
|
|
142
172
|
const newObject = newTable as typeof oldObject;
|
|
143
173
|
|
|
144
174
|
newObject.abc = "newValue";
|
|
@@ -152,11 +182,16 @@ function copiedObjectHasNoReferencesForPrimitivesBackward() {
|
|
|
152
182
|
}
|
|
153
183
|
}
|
|
154
184
|
|
|
185
|
+
/** In this context, a reference is a pointer. */
|
|
155
186
|
function copiedObjectHasNoReferencesForArray() {
|
|
156
187
|
const oldObject = {
|
|
157
188
|
abc: [1, 2, 3],
|
|
158
189
|
};
|
|
159
|
-
const newTable = deepCopy(
|
|
190
|
+
const newTable = deepCopy(
|
|
191
|
+
oldObject as unknown as LuaTable,
|
|
192
|
+
SerializationType.NONE,
|
|
193
|
+
"copiedObjectHasNoReferencesForArray",
|
|
194
|
+
);
|
|
160
195
|
const newObject = newTable as typeof oldObject;
|
|
161
196
|
|
|
162
197
|
if (oldObject.abc === newObject.abc) {
|
|
@@ -167,21 +202,21 @@ function copiedObjectHasNoReferencesForArray() {
|
|
|
167
202
|
error("The copied object does not have an equal array.");
|
|
168
203
|
}
|
|
169
204
|
|
|
170
|
-
oldObject.abc[0]
|
|
205
|
+
oldObject.abc[0]++;
|
|
171
206
|
if (arrayEquals(oldObject.abc, newObject.abc)) {
|
|
172
207
|
error(
|
|
173
208
|
"The copied object has an equal array after a modification to the old array.",
|
|
174
209
|
);
|
|
175
210
|
}
|
|
176
|
-
oldObject.abc[0]
|
|
211
|
+
oldObject.abc[0]--;
|
|
177
212
|
|
|
178
|
-
newObject.abc[0]
|
|
213
|
+
newObject.abc[0]++;
|
|
179
214
|
if (arrayEquals(oldObject.abc, newObject.abc)) {
|
|
180
215
|
error(
|
|
181
216
|
"The copied object has an equal array after a modification to the new array.",
|
|
182
217
|
);
|
|
183
218
|
}
|
|
184
|
-
newObject.abc[0]
|
|
219
|
+
newObject.abc[0]--;
|
|
185
220
|
}
|
|
186
221
|
|
|
187
222
|
function copiedObjectHasChildObject() {
|
|
@@ -193,7 +228,11 @@ function copiedObjectHasChildObject() {
|
|
|
193
228
|
def: valueToLookFor,
|
|
194
229
|
},
|
|
195
230
|
};
|
|
196
|
-
const newTable = deepCopy(
|
|
231
|
+
const newTable = deepCopy(
|
|
232
|
+
oldObject as unknown as LuaTable,
|
|
233
|
+
SerializationType.NONE,
|
|
234
|
+
"copiedObjectHasChildObject",
|
|
235
|
+
);
|
|
197
236
|
const newObject = newTable as typeof oldObject;
|
|
198
237
|
|
|
199
238
|
const childObject = newObject[childObjectIndex];
|
|
@@ -226,7 +265,7 @@ function copiedMapIsMap() {
|
|
|
226
265
|
const oldMap = new Map<string, string>();
|
|
227
266
|
oldMap.set(keyToLookFor, valueToLookFor);
|
|
228
267
|
|
|
229
|
-
const newObject = deepCopy(oldMap);
|
|
268
|
+
const newObject = deepCopy(oldMap, SerializationType.NONE, "copiedMapIsMap");
|
|
230
269
|
const newMap = newObject as Map<string, string>;
|
|
231
270
|
|
|
232
271
|
if (!isTable(newMap)) {
|
|
@@ -243,7 +282,11 @@ function copiedMapHasValue() {
|
|
|
243
282
|
const oldMap = new Map<string, string>();
|
|
244
283
|
oldMap.set(keyToLookFor, valueToLookFor);
|
|
245
284
|
|
|
246
|
-
const newTable = deepCopy(
|
|
285
|
+
const newTable = deepCopy(
|
|
286
|
+
oldMap,
|
|
287
|
+
SerializationType.NONE,
|
|
288
|
+
"copiedMapHasValue",
|
|
289
|
+
);
|
|
247
290
|
const newMap = newTable as typeof oldMap;
|
|
248
291
|
|
|
249
292
|
const value = newMap.get(keyToLookFor);
|
|
@@ -260,7 +303,7 @@ function copiedSetIsSet() {
|
|
|
260
303
|
const oldSet = new Set<string>();
|
|
261
304
|
oldSet.add(valueToLookFor);
|
|
262
305
|
|
|
263
|
-
const newTable = deepCopy(oldSet);
|
|
306
|
+
const newTable = deepCopy(oldSet, SerializationType.NONE, "copiedSetIsSet");
|
|
264
307
|
const newSet = newTable as Set<string>;
|
|
265
308
|
|
|
266
309
|
if (!isTable(newSet)) {
|
|
@@ -276,7 +319,11 @@ function copiedSetHasValue() {
|
|
|
276
319
|
const oldSet = new Set<string>();
|
|
277
320
|
oldSet.add(valueToLookFor);
|
|
278
321
|
|
|
279
|
-
const newTable = deepCopy(
|
|
322
|
+
const newTable = deepCopy(
|
|
323
|
+
oldSet,
|
|
324
|
+
SerializationType.NONE,
|
|
325
|
+
"copiedSetHasValue",
|
|
326
|
+
);
|
|
280
327
|
const newSet = newTable as Set<string>;
|
|
281
328
|
|
|
282
329
|
const hasValue = newSet.has(valueToLookFor);
|
|
@@ -295,7 +342,11 @@ function copiedMapHasChildMap() {
|
|
|
295
342
|
const oldMap = new Map<string, Map<number, number>>();
|
|
296
343
|
oldMap.set(keyToLookFor, oldChildMap);
|
|
297
344
|
|
|
298
|
-
const newTable = deepCopy(
|
|
345
|
+
const newTable = deepCopy(
|
|
346
|
+
oldMap,
|
|
347
|
+
SerializationType.NONE,
|
|
348
|
+
"copiedMapHasChildMap",
|
|
349
|
+
);
|
|
299
350
|
const newMap = newTable as typeof oldMap;
|
|
300
351
|
|
|
301
352
|
const newChildMap = newMap.get(keyToLookFor);
|
|
@@ -332,7 +383,11 @@ function copiedDefaultMapHasChildDefaultMap() {
|
|
|
332
383
|
oldChildMap.getAndSetDefault(childMapKey1);
|
|
333
384
|
oldChildMap.set(childMapKey2, childMapCustomValue);
|
|
334
385
|
|
|
335
|
-
const newTable = deepCopy(
|
|
386
|
+
const newTable = deepCopy(
|
|
387
|
+
oldParentMap,
|
|
388
|
+
SerializationType.NONE,
|
|
389
|
+
"copiedDefaultMapHasChildDefaultMap",
|
|
390
|
+
);
|
|
336
391
|
const newParentMap = newTable as typeof oldParentMap;
|
|
337
392
|
|
|
338
393
|
const newChildMap = newParentMap.get(parentMapKey);
|
|
@@ -376,6 +431,7 @@ function copiedDefaultMapHasBrand() {
|
|
|
376
431
|
const newTable = deepCopy(
|
|
377
432
|
oldDefaultMap,
|
|
378
433
|
SerializationType.SERIALIZE,
|
|
434
|
+
"copiedDefaultMapHasBrand",
|
|
379
435
|
) as LuaTable<AnyNotNil, unknown>;
|
|
380
436
|
|
|
381
437
|
if (!newTable.has(SerializationBrand.DEFAULT_MAP)) {
|
|
@@ -13,10 +13,10 @@ import { isPrimitive } from "./types";
|
|
|
13
13
|
* `Isaac.CountEntities` method to avoid having to specify a spawner and to handle ignoring charmed
|
|
14
14
|
* enemies.
|
|
15
15
|
*
|
|
16
|
-
* @param entityType Default is -1
|
|
17
|
-
* @param variant Default is -1
|
|
18
|
-
* @param subType Default is -1
|
|
19
|
-
* @param ignoreFriendly Default is false.
|
|
16
|
+
* @param entityType Optional. Default is -1, which matches every entity type.
|
|
17
|
+
* @param variant Optional. Default is -1, which matches every variant.
|
|
18
|
+
* @param subType Optional. Default is -1, which matches every sub-type.
|
|
19
|
+
* @param ignoreFriendly Optional. Default is false.
|
|
20
20
|
*/
|
|
21
21
|
export function countEntities(
|
|
22
22
|
entityType: EntityType = -1,
|
|
@@ -43,10 +43,10 @@ export function countEntities(
|
|
|
43
43
|
* Helper function to check if one or more of a specific kind of entity is present in the current
|
|
44
44
|
* room. It uses the `countEntities` helper function to determine this.
|
|
45
45
|
*
|
|
46
|
-
* @param entityType Default is -1
|
|
47
|
-
* @param variant Default is -1
|
|
48
|
-
* @param subType Default is -1
|
|
49
|
-
* @param ignoreFriendly Default is false.
|
|
46
|
+
* @param entityType Optional. Default is -1, which matches every entity type.
|
|
47
|
+
* @param variant Optional. Default is -1, which matches every variant.
|
|
48
|
+
* @param subType Optional. Default is -1, which matches every sub-type.
|
|
49
|
+
* @param ignoreFriendly Optional. Default is false.
|
|
50
50
|
*/
|
|
51
51
|
export function doesEntityExist(
|
|
52
52
|
entityType: EntityType = -1,
|
|
@@ -99,28 +99,29 @@ export function getClosestEntityTo<T extends AnyEntity>(
|
|
|
99
99
|
* For example:
|
|
100
100
|
*
|
|
101
101
|
* ```ts
|
|
102
|
-
* // Make all of the entities in the room invisible
|
|
102
|
+
* // Make all of the entities in the room invisible.
|
|
103
103
|
* for (const entity of getEntities()) {
|
|
104
104
|
* entity.Visible = false;
|
|
105
105
|
* }
|
|
106
106
|
* ```
|
|
107
107
|
*
|
|
108
|
-
* @param entityType Optional. If specified, will only
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
108
|
+
* @param entityType Optional. If specified, will only get the entities that match the type. Default
|
|
109
|
+
* is -1, which matches every type.
|
|
110
|
+
* @param variant Optional. If specified, will only get the entities that match the variant. Default
|
|
111
|
+
* is -1, which matches every variant.
|
|
112
|
+
* @param subType Optional. If specified, will only get the entities that match the sub-type.
|
|
113
|
+
* Default is -1, which matches every sub-type.
|
|
113
114
|
* @param ignoreFriendly Optional. If set to true, it will exclude friendly NPCs from being
|
|
114
|
-
* returned. Default is false. Will only be taken into account if
|
|
115
|
-
* `
|
|
115
|
+
* returned. Default is false. Will only be taken into account if the
|
|
116
|
+
* `entityType` is specified.
|
|
116
117
|
*/
|
|
117
118
|
export function getEntities(
|
|
118
|
-
entityType
|
|
119
|
+
entityType: EntityType = -1,
|
|
119
120
|
variant = -1,
|
|
120
121
|
subType = -1,
|
|
121
122
|
ignoreFriendly = false,
|
|
122
123
|
): Entity[] {
|
|
123
|
-
if (entityType ===
|
|
124
|
+
if ((entityType as int) === -1) {
|
|
124
125
|
return Isaac.GetRoomEntities();
|
|
125
126
|
}
|
|
126
127
|
|
|
@@ -317,8 +318,9 @@ export function parseEntityTypeVariantString(
|
|
|
317
318
|
* Helper function to remove all of the matching entities in the room.
|
|
318
319
|
*
|
|
319
320
|
* @param entityType The entity type to match.
|
|
320
|
-
* @param entityVariant Optional. The variant to match. Default is -1
|
|
321
|
-
* @param entitySubType Optional. The sub-type to match. Default is -1
|
|
321
|
+
* @param entityVariant Optional. The variant to match. Default is -1, which matches every variant.
|
|
322
|
+
* @param entitySubType Optional. The sub-type to match. Default is -1, which matches every
|
|
323
|
+
* sub-type.
|
|
322
324
|
* @param cap Optional. If specified, will only remove the given amount of collectibles.
|
|
323
325
|
* @returns An array of the entities that were removed.
|
|
324
326
|
*/
|
|
@@ -353,7 +355,7 @@ export function removeEntities<T extends AnyEntity>(
|
|
|
353
355
|
|
|
354
356
|
entitiesRemoved.push(entity);
|
|
355
357
|
if (cap !== undefined && entitiesRemoved.length >= cap) {
|
|
356
|
-
|
|
358
|
+
break;
|
|
357
359
|
}
|
|
358
360
|
}
|
|
359
361
|
|