isaacscript-common 20.3.2 → 20.4.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/index.d.ts +103 -50
- package/dist/isaacscript-common.lua +414 -389
- package/dist/src/classes/callbacks/PostSlotDestroyed.d.ts +0 -8
- package/dist/src/classes/callbacks/PostSlotDestroyed.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostSlotDestroyed.lua +3 -51
- package/dist/src/classes/features/callbackLogic/SlotDestroyedDetection.d.ts +36 -0
- package/dist/src/classes/features/callbackLogic/SlotDestroyedDetection.d.ts.map +1 -0
- package/dist/src/classes/features/callbackLogic/SlotDestroyedDetection.lua +91 -0
- package/dist/src/classes/features/other/ExtraConsoleCommands.d.ts.map +1 -1
- package/dist/src/classes/features/other/ExtraConsoleCommands.lua +2 -3
- package/dist/src/classes/features/other/RoomHistory.d.ts.map +1 -1
- package/dist/src/classes/features/other/RoomHistory.lua +6 -1
- package/dist/src/classes/features/other/extraConsoleCommands/commands.d.ts.map +1 -1
- package/dist/src/classes/features/other/extraConsoleCommands/commands.lua +69 -127
- package/dist/src/classes/features/other/extraConsoleCommands/subroutines.d.ts.map +1 -1
- package/dist/src/classes/features/other/extraConsoleCommands/subroutines.lua +11 -22
- package/dist/src/enums/ISCFeature.d.ts +44 -43
- package/dist/src/enums/ISCFeature.d.ts.map +1 -1
- package/dist/src/enums/ISCFeature.lua +45 -43
- package/dist/src/enums/SlotDestructionType.d.ts +13 -0
- package/dist/src/enums/SlotDestructionType.d.ts.map +1 -1
- package/dist/src/features.d.ts +46 -43
- package/dist/src/features.d.ts.map +1 -1
- package/dist/src/features.lua +3 -0
- package/dist/src/functions/deepCopyTests.d.ts.map +1 -1
- package/dist/src/functions/deepCopyTests.lua +1 -3
- package/dist/src/functions/logMisc.d.ts.map +1 -1
- package/dist/src/functions/logMisc.lua +1 -3
- package/dist/src/functions/mergeTests.d.ts.map +1 -1
- package/dist/src/functions/mergeTests.lua +2 -5
- package/dist/src/functions/slots.d.ts +4 -0
- package/dist/src/functions/slots.d.ts.map +1 -0
- package/dist/src/functions/slots.lua +27 -0
- package/dist/src/functions/utils.d.ts +3 -4
- package/dist/src/functions/utils.d.ts.map +1 -1
- package/dist/src/functions/utils.lua +8 -6
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.lua +8 -0
- package/dist/src/interfaces/RoomDescription.d.ts +1 -0
- package/dist/src/interfaces/RoomDescription.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/classes/callbacks/PostSlotDestroyed.ts +2 -72
- package/src/classes/features/callbackLogic/SlotDestroyedDetection.ts +163 -0
- package/src/classes/features/other/ExtraConsoleCommands.ts +3 -6
- package/src/classes/features/other/RoomHistory.ts +6 -0
- package/src/classes/features/other/extraConsoleCommands/commands.ts +70 -78
- package/src/classes/features/other/extraConsoleCommands/subroutines.ts +11 -12
- package/src/enums/ISCFeature.ts +1 -0
- package/src/enums/SlotDestructionType.ts +14 -0
- package/src/features.ts +6 -0
- package/src/functions/deepCopyTests.ts +1 -2
- package/src/functions/logMisc.ts +1 -2
- package/src/functions/mergeTests.ts +2 -4
- package/src/functions/slots.ts +23 -0
- package/src/functions/utils.ts +7 -6
- package/src/index.ts +1 -0
- package/src/interfaces/RoomDescription.ts +1 -0
|
@@ -111,11 +111,7 @@ import {
|
|
|
111
111
|
asCollectibleType,
|
|
112
112
|
asTrinketType,
|
|
113
113
|
} from "../../../../functions/types";
|
|
114
|
-
import {
|
|
115
|
-
iRange,
|
|
116
|
-
printConsole,
|
|
117
|
-
printEnabled,
|
|
118
|
-
} from "../../../../functions/utils";
|
|
114
|
+
import { iRange, printEnabled } from "../../../../functions/utils";
|
|
119
115
|
import { CARD_NAME_TO_TYPE_MAP } from "../../../../maps/cardNameToTypeMap";
|
|
120
116
|
import { CHARACTER_NAME_TO_TYPE_MAP } from "../../../../maps/characterNameToTypeMap";
|
|
121
117
|
import { COLLECTIBLE_NAME_TO_TYPE_MAP } from "../../../../maps/collectibleNameToTypeMap";
|
|
@@ -141,7 +137,7 @@ import { v } from "./v";
|
|
|
141
137
|
*/
|
|
142
138
|
export function addCharges(params: string): void {
|
|
143
139
|
if (params === "") {
|
|
144
|
-
|
|
140
|
+
print(
|
|
145
141
|
"You must specify a slot number. (Use 0 for the primary slot, 1 for the Schoolbag slot, 2 for the pocket item slot, and 3 for the Dice Bag slot.)",
|
|
146
142
|
);
|
|
147
143
|
return;
|
|
@@ -150,7 +146,7 @@ export function addCharges(params: string): void {
|
|
|
150
146
|
const args = params.split(" ");
|
|
151
147
|
|
|
152
148
|
if (args.length !== 1 && args.length !== 2) {
|
|
153
|
-
|
|
149
|
+
print("That is an invalid amount of arguments.");
|
|
154
150
|
return;
|
|
155
151
|
}
|
|
156
152
|
|
|
@@ -158,7 +154,7 @@ export function addCharges(params: string): void {
|
|
|
158
154
|
|
|
159
155
|
const activeSlot = tonumber(activeSlotString) as ActiveSlot | undefined;
|
|
160
156
|
if (activeSlot === undefined) {
|
|
161
|
-
|
|
157
|
+
print(`The provided slot number is invalid: ${activeSlotString}`);
|
|
162
158
|
return;
|
|
163
159
|
}
|
|
164
160
|
|
|
@@ -166,7 +162,7 @@ export function addCharges(params: string): void {
|
|
|
166
162
|
activeSlot < ActiveSlot.PRIMARY ||
|
|
167
163
|
activeSlot > ActiveSlot.POCKET_SINGLE_USE
|
|
168
164
|
) {
|
|
169
|
-
|
|
165
|
+
print(`The provided slot number is invalid: ${activeSlot}`);
|
|
170
166
|
return;
|
|
171
167
|
}
|
|
172
168
|
|
|
@@ -174,7 +170,7 @@ export function addCharges(params: string): void {
|
|
|
174
170
|
if (numChargeString !== undefined) {
|
|
175
171
|
const numChargesAttempt = tonumber(numChargeString);
|
|
176
172
|
if (numChargesAttempt === undefined) {
|
|
177
|
-
|
|
173
|
+
print(`The provided charge amount is invalid: ${numChargeString}`);
|
|
178
174
|
return;
|
|
179
175
|
}
|
|
180
176
|
numCharges = numChargesAttempt;
|
|
@@ -197,7 +193,7 @@ export function ascent(): void {
|
|
|
197
193
|
game.SetStateFlag(GameStateFlag.BACKWARDS_PATH_INIT, true);
|
|
198
194
|
game.SetStateFlag(GameStateFlag.BACKWARDS_PATH, true);
|
|
199
195
|
|
|
200
|
-
|
|
196
|
+
print("Set Ascent flags.");
|
|
201
197
|
}
|
|
202
198
|
|
|
203
199
|
/** Warps to the first Clean Bedroom or Dirty Bedroom on the floor. */
|
|
@@ -218,7 +214,7 @@ export function bedroom(): void {
|
|
|
218
214
|
return;
|
|
219
215
|
}
|
|
220
216
|
|
|
221
|
-
|
|
217
|
+
print("There are no Clean Bedrooms or Dirty Bedrooms on this floor.");
|
|
222
218
|
}
|
|
223
219
|
|
|
224
220
|
/**
|
|
@@ -249,7 +245,7 @@ export function bloodCharges(params: string): void {
|
|
|
249
245
|
if (params !== "") {
|
|
250
246
|
const num = tonumber(params);
|
|
251
247
|
if (num === undefined) {
|
|
252
|
-
|
|
248
|
+
print("That is an invalid amount of charges to add.");
|
|
253
249
|
return;
|
|
254
250
|
}
|
|
255
251
|
|
|
@@ -274,7 +270,7 @@ export function bomb(params: string): void {
|
|
|
274
270
|
if (params !== "") {
|
|
275
271
|
const num = tonumber(params);
|
|
276
272
|
if (num === undefined) {
|
|
277
|
-
|
|
273
|
+
print("That is an invalid amount of bombs to add.");
|
|
278
274
|
return;
|
|
279
275
|
}
|
|
280
276
|
|
|
@@ -294,7 +290,7 @@ export function bombs(params: string): void {
|
|
|
294
290
|
if (params !== "") {
|
|
295
291
|
const num = tonumber(params);
|
|
296
292
|
if (num === undefined) {
|
|
297
|
-
|
|
293
|
+
print("That is an invalid amount of bombs to add.");
|
|
298
294
|
return;
|
|
299
295
|
}
|
|
300
296
|
|
|
@@ -350,7 +346,7 @@ export function brokenHearts(params: string): void {
|
|
|
350
346
|
*/
|
|
351
347
|
export function card(params: string): void {
|
|
352
348
|
if (params === "") {
|
|
353
|
-
|
|
349
|
+
print("You must specify a card name or number.");
|
|
354
350
|
return;
|
|
355
351
|
}
|
|
356
352
|
|
|
@@ -359,14 +355,14 @@ export function card(params: string): void {
|
|
|
359
355
|
if (num === undefined) {
|
|
360
356
|
const match = getMapPartialMatch(params, CARD_NAME_TO_TYPE_MAP);
|
|
361
357
|
if (match === undefined) {
|
|
362
|
-
|
|
358
|
+
print(`Unknown card: ${params}`);
|
|
363
359
|
return;
|
|
364
360
|
}
|
|
365
361
|
|
|
366
362
|
cardType = match[1];
|
|
367
363
|
} else {
|
|
368
364
|
if (num < FIRST_CARD_TYPE || num > LAST_VANILLA_CARD_TYPE) {
|
|
369
|
-
|
|
365
|
+
print(`Invalid card sub-type: ${num}`);
|
|
370
366
|
return;
|
|
371
367
|
}
|
|
372
368
|
|
|
@@ -375,7 +371,7 @@ export function card(params: string): void {
|
|
|
375
371
|
|
|
376
372
|
const cardName = getCardName(cardType);
|
|
377
373
|
Isaac.ExecuteCommand(`g k${cardType}`);
|
|
378
|
-
|
|
374
|
+
print(`Gave card: ${cardName} (${cardType})`);
|
|
379
375
|
}
|
|
380
376
|
|
|
381
377
|
/** Spawns every card on the ground, starting at the top-left-most tile. */
|
|
@@ -418,7 +414,7 @@ export function chaosCardTears(): void {
|
|
|
418
414
|
*/
|
|
419
415
|
export function character(params: string): void {
|
|
420
416
|
if (params === "") {
|
|
421
|
-
|
|
417
|
+
print("You must specify a character name or number.");
|
|
422
418
|
return;
|
|
423
419
|
}
|
|
424
420
|
|
|
@@ -427,14 +423,14 @@ export function character(params: string): void {
|
|
|
427
423
|
if (num === undefined) {
|
|
428
424
|
const match = getMapPartialMatch(params, CHARACTER_NAME_TO_TYPE_MAP);
|
|
429
425
|
if (match === undefined) {
|
|
430
|
-
|
|
426
|
+
print(`Unknown character: ${params}`);
|
|
431
427
|
return;
|
|
432
428
|
}
|
|
433
429
|
|
|
434
430
|
playerType = match[1];
|
|
435
431
|
} else {
|
|
436
432
|
if (num < FIRST_CHARACTER || num > LAST_VANILLA_CHARACTER) {
|
|
437
|
-
|
|
433
|
+
print(`Invalid player sub-type: ${num}`);
|
|
438
434
|
return;
|
|
439
435
|
}
|
|
440
436
|
|
|
@@ -443,7 +439,7 @@ export function character(params: string): void {
|
|
|
443
439
|
|
|
444
440
|
const characterName = getCharacterName(playerType);
|
|
445
441
|
restart(playerType);
|
|
446
|
-
|
|
442
|
+
print(`Restarting as character: ${characterName} (${playerType})`);
|
|
447
443
|
}
|
|
448
444
|
|
|
449
445
|
/** Alias for the "addCharges" command. */
|
|
@@ -465,7 +461,7 @@ export function coin(params: string): void {
|
|
|
465
461
|
if (params !== "") {
|
|
466
462
|
const num = tonumber(params);
|
|
467
463
|
if (num === undefined) {
|
|
468
|
-
|
|
464
|
+
print("That is an invalid amount of coins to add.");
|
|
469
465
|
return;
|
|
470
466
|
}
|
|
471
467
|
|
|
@@ -485,7 +481,7 @@ export function coins(params: string): void {
|
|
|
485
481
|
if (params !== "") {
|
|
486
482
|
const num = tonumber(params);
|
|
487
483
|
if (num === undefined) {
|
|
488
|
-
|
|
484
|
+
print("That is an invalid amount of coins to add.");
|
|
489
485
|
return;
|
|
490
486
|
}
|
|
491
487
|
|
|
@@ -534,7 +530,7 @@ export function damage(params: string): void {
|
|
|
534
530
|
if (params !== "") {
|
|
535
531
|
const num = tonumber(params);
|
|
536
532
|
if (num === undefined) {
|
|
537
|
-
|
|
533
|
+
print(`The provided damage amount is invalid: ${params}`);
|
|
538
534
|
return;
|
|
539
535
|
}
|
|
540
536
|
|
|
@@ -600,7 +596,7 @@ export function dungeon(): void {
|
|
|
600
596
|
export function effects(): void {
|
|
601
597
|
const player = Isaac.GetPlayer();
|
|
602
598
|
logPlayerEffects(player);
|
|
603
|
-
|
|
599
|
+
print('Logged the player\'s effects to the "log.txt" file.');
|
|
604
600
|
}
|
|
605
601
|
|
|
606
602
|
/** Alias for the "iAmError" command. */
|
|
@@ -657,7 +653,7 @@ export function getChallenge(): void {
|
|
|
657
653
|
challengeName === undefined
|
|
658
654
|
? `${challenge} (custom)`
|
|
659
655
|
: `Challenge.${challengeName} (${challenge})`;
|
|
660
|
-
|
|
656
|
+
print(`The current challenge is: ${challengeDescription}`);
|
|
661
657
|
}
|
|
662
658
|
|
|
663
659
|
/** Prints the charge for the specified slot. By default, will use `ActiveSlot.PRIMARY`. */
|
|
@@ -666,7 +662,7 @@ export function getCharge(params: string): void {
|
|
|
666
662
|
if (params !== "") {
|
|
667
663
|
const num = tonumber(params) as ActiveSlot | undefined;
|
|
668
664
|
if (num === undefined) {
|
|
669
|
-
|
|
665
|
+
print(`The provided slot number is invalid: ${params}`);
|
|
670
666
|
return;
|
|
671
667
|
}
|
|
672
668
|
|
|
@@ -675,7 +671,7 @@ export function getCharge(params: string): void {
|
|
|
675
671
|
|
|
676
672
|
const player = Isaac.GetPlayer();
|
|
677
673
|
const totalCharge = getTotalCharge(player, activeSlot);
|
|
678
|
-
|
|
674
|
+
print(
|
|
679
675
|
`Total charge for ActiveSlot.${ActiveSlot[activeSlot]} (${activeSlot}) is: ${totalCharge}`,
|
|
680
676
|
);
|
|
681
677
|
}
|
|
@@ -684,7 +680,7 @@ export function getCharge(params: string): void {
|
|
|
684
680
|
export function getPosition(): void {
|
|
685
681
|
for (const player of getPlayers()) {
|
|
686
682
|
const playerName = getPlayerName(player);
|
|
687
|
-
|
|
683
|
+
print(
|
|
688
684
|
`Player position for ${playerName}: (${player.Position.X}, ${player.Position.Y})`,
|
|
689
685
|
);
|
|
690
686
|
}
|
|
@@ -705,7 +701,7 @@ export function gigaBomb(params: string): void {
|
|
|
705
701
|
if (params !== "") {
|
|
706
702
|
const num = tonumber(params);
|
|
707
703
|
if (num === undefined) {
|
|
708
|
-
|
|
704
|
+
print("That is an invalid amount of Giga Bombs to add.");
|
|
709
705
|
return;
|
|
710
706
|
}
|
|
711
707
|
|
|
@@ -821,7 +817,7 @@ export function key(params: string): void {
|
|
|
821
817
|
if (params !== "") {
|
|
822
818
|
const num = tonumber(params);
|
|
823
819
|
if (num === undefined) {
|
|
824
|
-
|
|
820
|
+
print("That is an invalid amount of keys to add.");
|
|
825
821
|
return;
|
|
826
822
|
}
|
|
827
823
|
|
|
@@ -841,7 +837,7 @@ export function keys(params: string): void {
|
|
|
841
837
|
if (params !== "") {
|
|
842
838
|
const num = tonumber(params);
|
|
843
839
|
if (num === undefined) {
|
|
844
|
-
|
|
840
|
+
print("That is an invalid amount of keys to add.");
|
|
845
841
|
return;
|
|
846
842
|
}
|
|
847
843
|
|
|
@@ -976,7 +972,7 @@ export function oneHP(): void {
|
|
|
976
972
|
npc.HitPoints = 1;
|
|
977
973
|
}
|
|
978
974
|
|
|
979
|
-
|
|
975
|
+
print("Set every NPC to 1 HP.");
|
|
980
976
|
}
|
|
981
977
|
|
|
982
978
|
/**
|
|
@@ -990,7 +986,7 @@ export function oneHP(): void {
|
|
|
990
986
|
*/
|
|
991
987
|
export function pill(params: string): void {
|
|
992
988
|
if (params === "") {
|
|
993
|
-
|
|
989
|
+
print("You must specify a pill name or number.");
|
|
994
990
|
return;
|
|
995
991
|
}
|
|
996
992
|
|
|
@@ -999,14 +995,14 @@ export function pill(params: string): void {
|
|
|
999
995
|
if (num === undefined) {
|
|
1000
996
|
const match = getMapPartialMatch(params, PILL_NAME_TO_EFFECT_MAP);
|
|
1001
997
|
if (match === undefined) {
|
|
1002
|
-
|
|
998
|
+
print(`Unknown pill effect: ${params}`);
|
|
1003
999
|
return;
|
|
1004
1000
|
}
|
|
1005
1001
|
|
|
1006
1002
|
pillEffect = match[1];
|
|
1007
1003
|
} else {
|
|
1008
1004
|
if (num < FIRST_PILL_EFFECT || num > LAST_VANILLA_PILL_EFFECT) {
|
|
1009
|
-
|
|
1005
|
+
print(`Invalid pill effect ID: ${num}`);
|
|
1010
1006
|
return;
|
|
1011
1007
|
}
|
|
1012
1008
|
|
|
@@ -1015,7 +1011,7 @@ export function pill(params: string): void {
|
|
|
1015
1011
|
|
|
1016
1012
|
const pillEffectName = getPillEffectName(pillEffect);
|
|
1017
1013
|
Isaac.ExecuteCommand(`g p${pillEffect}`);
|
|
1018
|
-
|
|
1014
|
+
print(`Gave pill: ${pillEffectName} (${pillEffect})`);
|
|
1019
1015
|
}
|
|
1020
1016
|
|
|
1021
1017
|
/** Spawns every pill on the ground, starting at the top-left-most tile. */
|
|
@@ -1047,20 +1043,18 @@ export function playSound(params: string): void {
|
|
|
1047
1043
|
/** Sets the player's pocket item to the specified collectible type. */
|
|
1048
1044
|
export function pocket(params: string): void {
|
|
1049
1045
|
if (params === "") {
|
|
1050
|
-
|
|
1051
|
-
"You must supply a collectible type to put as the pocket item.",
|
|
1052
|
-
);
|
|
1046
|
+
print("You must supply a collectible type to put as the pocket item.");
|
|
1053
1047
|
return;
|
|
1054
1048
|
}
|
|
1055
1049
|
|
|
1056
1050
|
const collectibleType = tonumber(params) as CollectibleType | undefined;
|
|
1057
1051
|
if (collectibleType === undefined) {
|
|
1058
|
-
|
|
1052
|
+
print("That is an invalid collectible type.");
|
|
1059
1053
|
return;
|
|
1060
1054
|
}
|
|
1061
1055
|
|
|
1062
1056
|
if (!isValidCollectibleType(collectibleType)) {
|
|
1063
|
-
|
|
1057
|
+
print("That is an invalid collectible type.");
|
|
1064
1058
|
return;
|
|
1065
1059
|
}
|
|
1066
1060
|
|
|
@@ -1077,7 +1071,7 @@ export function poopMana(params: string): void {
|
|
|
1077
1071
|
if (params !== "") {
|
|
1078
1072
|
const num = tonumber(params);
|
|
1079
1073
|
if (num === undefined) {
|
|
1080
|
-
|
|
1074
|
+
print("That is an invalid amount of mana to add.");
|
|
1081
1075
|
return;
|
|
1082
1076
|
}
|
|
1083
1077
|
|
|
@@ -1111,7 +1105,7 @@ export function right(params: string): void {
|
|
|
1111
1105
|
/** Logs information about the room to the "log.txt" file. */
|
|
1112
1106
|
export function room(): void {
|
|
1113
1107
|
logRoom();
|
|
1114
|
-
|
|
1108
|
+
print('Logged room information to the "log.txt" file.');
|
|
1115
1109
|
}
|
|
1116
1110
|
|
|
1117
1111
|
/**
|
|
@@ -1143,7 +1137,7 @@ export function runTests(): void {
|
|
|
1143
1137
|
*/
|
|
1144
1138
|
export function s(params: string): void {
|
|
1145
1139
|
if (params === "") {
|
|
1146
|
-
|
|
1140
|
+
print("You must specify a stage number.");
|
|
1147
1141
|
return;
|
|
1148
1142
|
}
|
|
1149
1143
|
|
|
@@ -1167,12 +1161,12 @@ export function s(params: string): void {
|
|
|
1167
1161
|
|
|
1168
1162
|
const stage = tonumber(stageString) as LevelStage | undefined;
|
|
1169
1163
|
if (stage === undefined) {
|
|
1170
|
-
|
|
1164
|
+
print(`That is an invalid stage number: ${stage}`);
|
|
1171
1165
|
return;
|
|
1172
1166
|
}
|
|
1173
1167
|
|
|
1174
1168
|
if (stage < FIRST_STAGE || stage > LAST_STAGE) {
|
|
1175
|
-
|
|
1169
|
+
print(
|
|
1176
1170
|
`Invalid stage number; must be between ${FIRST_STAGE} and ${LAST_STAGE}.`,
|
|
1177
1171
|
);
|
|
1178
1172
|
return;
|
|
@@ -1206,7 +1200,7 @@ export function seedStick(): void {
|
|
|
1206
1200
|
/** Logs all of the current run's seed effects to the "log.txt" file. */
|
|
1207
1201
|
export function seeds(): void {
|
|
1208
1202
|
logSeedEffects();
|
|
1209
|
-
|
|
1203
|
+
print('Logged the seed effects to the "log.txt" file.');
|
|
1210
1204
|
}
|
|
1211
1205
|
|
|
1212
1206
|
/**
|
|
@@ -1215,7 +1209,7 @@ export function seeds(): void {
|
|
|
1215
1209
|
*/
|
|
1216
1210
|
export function setCharges(params: string): void {
|
|
1217
1211
|
if (params === "") {
|
|
1218
|
-
|
|
1212
|
+
print(
|
|
1219
1213
|
"You must specify a slot number and a charge amount. (Use 0 for the primary slot, 1 for the Schoolbag slot, 2 for the pocket item slot, and 3 for the Dice Bag slot.)",
|
|
1220
1214
|
);
|
|
1221
1215
|
return;
|
|
@@ -1224,12 +1218,12 @@ export function setCharges(params: string): void {
|
|
|
1224
1218
|
const args = params.split(" ");
|
|
1225
1219
|
|
|
1226
1220
|
if (args.length === 1) {
|
|
1227
|
-
|
|
1221
|
+
print("You must specify the amount of charge to set.");
|
|
1228
1222
|
return;
|
|
1229
1223
|
}
|
|
1230
1224
|
|
|
1231
1225
|
if (args.length !== 2) {
|
|
1232
|
-
|
|
1226
|
+
print("That is an invalid amount of arguments.");
|
|
1233
1227
|
return;
|
|
1234
1228
|
}
|
|
1235
1229
|
|
|
@@ -1237,24 +1231,24 @@ export function setCharges(params: string): void {
|
|
|
1237
1231
|
|
|
1238
1232
|
const activeSlot = tonumber(activeSlotString) as ActiveSlot | undefined;
|
|
1239
1233
|
if (activeSlot === undefined) {
|
|
1240
|
-
|
|
1234
|
+
print(`The provided slot number is invalid: ${activeSlotString}`);
|
|
1241
1235
|
return;
|
|
1242
1236
|
}
|
|
1243
1237
|
|
|
1244
1238
|
const activeSlots = getEnumValues(ActiveSlot);
|
|
1245
1239
|
if (!activeSlots.includes(activeSlot)) {
|
|
1246
|
-
|
|
1240
|
+
print(`The provided slot number is invalid: ${activeSlot}`);
|
|
1247
1241
|
return;
|
|
1248
1242
|
}
|
|
1249
1243
|
|
|
1250
1244
|
const chargeNum = tonumber(chargeString);
|
|
1251
1245
|
if (chargeNum === undefined) {
|
|
1252
|
-
|
|
1246
|
+
print(`The provided charge amount is invalid: ${chargeString}`);
|
|
1253
1247
|
return;
|
|
1254
1248
|
}
|
|
1255
1249
|
|
|
1256
1250
|
if (chargeNum < 0) {
|
|
1257
|
-
|
|
1251
|
+
print(`The provided charge amount is invalid: ${chargeNum}`);
|
|
1258
1252
|
return;
|
|
1259
1253
|
}
|
|
1260
1254
|
|
|
@@ -1270,13 +1264,13 @@ export function setCharges(params: string): void {
|
|
|
1270
1264
|
*/
|
|
1271
1265
|
export function setPosition(params: string): void {
|
|
1272
1266
|
if (params === "") {
|
|
1273
|
-
|
|
1267
|
+
print('You must specify a position. (e.g. "setPosition 100 50")');
|
|
1274
1268
|
return;
|
|
1275
1269
|
}
|
|
1276
1270
|
|
|
1277
1271
|
const args = params.split(" ");
|
|
1278
1272
|
if (args.length !== 2) {
|
|
1279
|
-
|
|
1273
|
+
print('You must specify a position. (e.g. "setPosition 100 50")');
|
|
1280
1274
|
return;
|
|
1281
1275
|
}
|
|
1282
1276
|
|
|
@@ -1284,13 +1278,13 @@ export function setPosition(params: string): void {
|
|
|
1284
1278
|
|
|
1285
1279
|
const x = tonumber(xString);
|
|
1286
1280
|
if (x === undefined) {
|
|
1287
|
-
|
|
1281
|
+
print(`That is an invalid x value: ${xString}`);
|
|
1288
1282
|
return;
|
|
1289
1283
|
}
|
|
1290
1284
|
|
|
1291
1285
|
const y = tonumber(yString);
|
|
1292
1286
|
if (y === undefined) {
|
|
1293
|
-
|
|
1287
|
+
print(`That is an invalid y value: ${yString}`);
|
|
1294
1288
|
return;
|
|
1295
1289
|
}
|
|
1296
1290
|
|
|
@@ -1319,7 +1313,7 @@ export function soulCharges(params: string): void {
|
|
|
1319
1313
|
if (params !== "") {
|
|
1320
1314
|
const num = tonumber(params);
|
|
1321
1315
|
if (num === undefined) {
|
|
1322
|
-
|
|
1316
|
+
print("That is an invalid amount of charges to add.");
|
|
1323
1317
|
return;
|
|
1324
1318
|
}
|
|
1325
1319
|
|
|
@@ -1347,7 +1341,7 @@ export function soulHearts(params: string): void {
|
|
|
1347
1341
|
export function sound(params: string): void {
|
|
1348
1342
|
const soundEffect = tonumber(params) as SoundEffect | undefined;
|
|
1349
1343
|
if (soundEffect === undefined) {
|
|
1350
|
-
|
|
1344
|
+
print("That is an invalid sound effect ID.");
|
|
1351
1345
|
return;
|
|
1352
1346
|
}
|
|
1353
1347
|
|
|
@@ -1357,9 +1351,7 @@ export function sound(params: string): void {
|
|
|
1357
1351
|
/** Logs all of the currently playing sound effects to the "log.txt" file. */
|
|
1358
1352
|
export function sounds(): void {
|
|
1359
1353
|
logSounds();
|
|
1360
|
-
|
|
1361
|
-
'Logged the currently playing sound effects to the "log.txt" file.',
|
|
1362
|
-
);
|
|
1354
|
+
print('Logged the currently playing sound effects to the "log.txt" file.');
|
|
1363
1355
|
}
|
|
1364
1356
|
|
|
1365
1357
|
/**
|
|
@@ -1373,7 +1365,7 @@ export function spam(): void {
|
|
|
1373
1365
|
|
|
1374
1366
|
export function spawnCollectible(params: string): void {
|
|
1375
1367
|
if (params === "") {
|
|
1376
|
-
|
|
1368
|
+
print(
|
|
1377
1369
|
"You must specify the name or number corresponding to the collectible type.",
|
|
1378
1370
|
);
|
|
1379
1371
|
return;
|
|
@@ -1384,7 +1376,7 @@ export function spawnCollectible(params: string): void {
|
|
|
1384
1376
|
if (collectibleTypeNumber === undefined) {
|
|
1385
1377
|
const match = getMapPartialMatch(params, COLLECTIBLE_NAME_TO_TYPE_MAP);
|
|
1386
1378
|
if (match === undefined) {
|
|
1387
|
-
|
|
1379
|
+
print(`Unknown collectible: ${params}`);
|
|
1388
1380
|
return;
|
|
1389
1381
|
}
|
|
1390
1382
|
|
|
@@ -1401,7 +1393,7 @@ export function spawnCollectible(params: string): void {
|
|
|
1401
1393
|
/** Spawns a golden version of the specified trinket type. */
|
|
1402
1394
|
export function spawnGoldenTrinket(params: string): void {
|
|
1403
1395
|
if (params === "") {
|
|
1404
|
-
|
|
1396
|
+
print(
|
|
1405
1397
|
"You must specify the name or number corresponding to the trinket type.",
|
|
1406
1398
|
);
|
|
1407
1399
|
return;
|
|
@@ -1412,7 +1404,7 @@ export function spawnGoldenTrinket(params: string): void {
|
|
|
1412
1404
|
if (trinketTypeNumber === undefined) {
|
|
1413
1405
|
const match = getMapPartialMatch(params, TRINKET_NAME_TO_TYPE_MAP);
|
|
1414
1406
|
if (match === undefined) {
|
|
1415
|
-
|
|
1407
|
+
print(`Unknown trinket: ${params}`);
|
|
1416
1408
|
return;
|
|
1417
1409
|
}
|
|
1418
1410
|
|
|
@@ -1429,7 +1421,7 @@ export function spawnGoldenTrinket(params: string): void {
|
|
|
1429
1421
|
|
|
1430
1422
|
export function spawnTrinket(params: string): void {
|
|
1431
1423
|
if (params === "") {
|
|
1432
|
-
|
|
1424
|
+
print(
|
|
1433
1425
|
"You must specify the name or number corresponding to the trinket type.",
|
|
1434
1426
|
);
|
|
1435
1427
|
return;
|
|
@@ -1440,7 +1432,7 @@ export function spawnTrinket(params: string): void {
|
|
|
1440
1432
|
if (trinketTypeNumber === undefined) {
|
|
1441
1433
|
const match = getMapPartialMatch(params, TRINKET_NAME_TO_TYPE_MAP);
|
|
1442
1434
|
if (match === undefined) {
|
|
1443
|
-
|
|
1435
|
+
print(`Unknown trinket: ${params}`);
|
|
1444
1436
|
return;
|
|
1445
1437
|
}
|
|
1446
1438
|
|
|
@@ -1465,7 +1457,7 @@ export function speed(params: string): void {
|
|
|
1465
1457
|
if (params !== "") {
|
|
1466
1458
|
const num = tonumber(params);
|
|
1467
1459
|
if (num === undefined) {
|
|
1468
|
-
|
|
1460
|
+
print(`The provided speed amount is invalid: ${params}`);
|
|
1469
1461
|
return;
|
|
1470
1462
|
}
|
|
1471
1463
|
|
|
@@ -1509,7 +1501,7 @@ export function tears(params: string): void {
|
|
|
1509
1501
|
if (params !== "") {
|
|
1510
1502
|
const num = tonumber(params);
|
|
1511
1503
|
if (num === undefined) {
|
|
1512
|
-
|
|
1504
|
+
print(`The provided tear delay amount is invalid: ${params}`);
|
|
1513
1505
|
return;
|
|
1514
1506
|
}
|
|
1515
1507
|
|
|
@@ -1554,7 +1546,7 @@ export function unknown(): void {
|
|
|
1554
1546
|
/** If currently on a set seed, changes to an unseeded state and restarts the game. */
|
|
1555
1547
|
export function unseed(): void {
|
|
1556
1548
|
if (!onSetSeed()) {
|
|
1557
|
-
|
|
1549
|
+
print("You are not on a set seed, so you cannot unseed the run.");
|
|
1558
1550
|
return;
|
|
1559
1551
|
}
|
|
1560
1552
|
|
|
@@ -1577,7 +1569,7 @@ export function up(params: string): void {
|
|
|
1577
1569
|
*/
|
|
1578
1570
|
export function warp(params: string): void {
|
|
1579
1571
|
if (params === "") {
|
|
1580
|
-
|
|
1572
|
+
print("You must specify a room type name or number.");
|
|
1581
1573
|
return;
|
|
1582
1574
|
}
|
|
1583
1575
|
|
|
@@ -1586,14 +1578,14 @@ export function warp(params: string): void {
|
|
|
1586
1578
|
if (num === undefined) {
|
|
1587
1579
|
const match = getMapPartialMatch(params, ROOM_NAME_TO_TYPE_MAP);
|
|
1588
1580
|
if (match === undefined) {
|
|
1589
|
-
|
|
1581
|
+
print(`Unknown room type: ${params}`);
|
|
1590
1582
|
return;
|
|
1591
1583
|
}
|
|
1592
1584
|
|
|
1593
1585
|
roomType = match[1];
|
|
1594
1586
|
} else {
|
|
1595
1587
|
if (num < FIRST_ROOM_TYPE || num > LAST_ROOM_TYPE) {
|
|
1596
|
-
|
|
1588
|
+
print(`Invalid room type: ${num}`);
|
|
1597
1589
|
return;
|
|
1598
1590
|
}
|
|
1599
1591
|
|
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
import { addPlayerHealthType } from "../../../../functions/playerHealth";
|
|
21
21
|
import { getRoomData, getRoomDescriptor } from "../../../../functions/roomData";
|
|
22
22
|
import { changeRoom } from "../../../../functions/rooms";
|
|
23
|
-
import { printConsole } from "../../../../functions/utils";
|
|
24
23
|
import { ROOM_TYPE_NAMES } from "../../../../objects/roomTypeNames";
|
|
25
24
|
|
|
26
25
|
const DEFAULT_MOVE_UNITS = 0.5;
|
|
@@ -30,7 +29,7 @@ export function addHeart(params: string, healthType: HealthType): void {
|
|
|
30
29
|
if (params !== "") {
|
|
31
30
|
const num = tonumber(params);
|
|
32
31
|
if (num === undefined) {
|
|
33
|
-
|
|
32
|
+
print("That is an invalid amount of hearts to add.");
|
|
34
33
|
return;
|
|
35
34
|
}
|
|
36
35
|
|
|
@@ -72,13 +71,13 @@ export function listEntities(
|
|
|
72
71
|
if (params !== "") {
|
|
73
72
|
entityTypeFilter = tonumber(params);
|
|
74
73
|
if (entityTypeFilter === undefined) {
|
|
75
|
-
|
|
74
|
+
print("That is an invalid entity type to filter by.");
|
|
76
75
|
return;
|
|
77
76
|
}
|
|
78
77
|
}
|
|
79
78
|
|
|
80
79
|
logAllEntities(includeBackgroundEffects, entityTypeFilter);
|
|
81
|
-
|
|
80
|
+
print('Logged the entities in the room to the "log.txt" file.');
|
|
82
81
|
}
|
|
83
82
|
|
|
84
83
|
export function listGridEntities(params: string, includeWalls: boolean): void {
|
|
@@ -86,13 +85,13 @@ export function listGridEntities(params: string, includeWalls: boolean): void {
|
|
|
86
85
|
if (params !== "") {
|
|
87
86
|
gridEntityTypeFilter = tonumber(params);
|
|
88
87
|
if (gridEntityTypeFilter === undefined) {
|
|
89
|
-
|
|
88
|
+
print("That is an invalid grid entity type to filter by.");
|
|
90
89
|
return;
|
|
91
90
|
}
|
|
92
91
|
}
|
|
93
92
|
|
|
94
93
|
logAllGridEntities(includeWalls, gridEntityTypeFilter);
|
|
95
|
-
|
|
94
|
+
print('Logged the grid entities in the room to the "log.txt" file.');
|
|
96
95
|
}
|
|
97
96
|
|
|
98
97
|
export function movePlayer(params: string, direction: Direction): void {
|
|
@@ -100,7 +99,7 @@ export function movePlayer(params: string, direction: Direction): void {
|
|
|
100
99
|
if (params !== "") {
|
|
101
100
|
const num = tonumber(params);
|
|
102
101
|
if (num === undefined) {
|
|
103
|
-
|
|
102
|
+
print("That is an invalid amount of units to move.");
|
|
104
103
|
return;
|
|
105
104
|
}
|
|
106
105
|
|
|
@@ -130,12 +129,12 @@ export function warpToRoomType(roomType: RoomType): void {
|
|
|
130
129
|
const gridIndexes = getRoomGridIndexesForType(roomType);
|
|
131
130
|
const firstGridIndex = gridIndexes[0];
|
|
132
131
|
if (firstGridIndex === undefined) {
|
|
133
|
-
|
|
132
|
+
print(`There are no ${roomTypeName}s on this floor.`);
|
|
134
133
|
return;
|
|
135
134
|
}
|
|
136
135
|
|
|
137
136
|
changeRoom(firstGridIndex);
|
|
138
|
-
|
|
137
|
+
print(`Warped to room type: ${roomTypeName} (${roomType})`);
|
|
139
138
|
}
|
|
140
139
|
|
|
141
140
|
export function warpNextToRoomType(roomType: RoomType): void {
|
|
@@ -143,7 +142,7 @@ export function warpNextToRoomType(roomType: RoomType): void {
|
|
|
143
142
|
const gridIndexes = getRoomGridIndexesForType(roomType);
|
|
144
143
|
const firstGridIndex = gridIndexes[0];
|
|
145
144
|
if (firstGridIndex === undefined) {
|
|
146
|
-
|
|
145
|
+
print(`There are no ${roomTypeName}s on this floor.`);
|
|
147
146
|
return;
|
|
148
147
|
}
|
|
149
148
|
|
|
@@ -153,12 +152,12 @@ export function warpNextToRoomType(roomType: RoomType): void {
|
|
|
153
152
|
const roomData = getRoomData(roomGridIndex);
|
|
154
153
|
if (roomData !== undefined && roomData.Type === RoomType.DEFAULT) {
|
|
155
154
|
changeRoom(roomGridIndex);
|
|
156
|
-
|
|
155
|
+
print(`Warped next to room type: ${roomTypeName} (${roomType})`);
|
|
157
156
|
return;
|
|
158
157
|
}
|
|
159
158
|
}
|
|
160
159
|
|
|
161
|
-
|
|
160
|
+
print(
|
|
162
161
|
`Failed to find the room next to room type: ${roomTypeName} (${roomType})`,
|
|
163
162
|
);
|
|
164
163
|
}
|