isaacscript-common 1.2.136 → 1.2.137

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.
Files changed (36) hide show
  1. package/dist/callbacks/postCustomDoorEnter.d.ts +8 -0
  2. package/dist/callbacks/postCustomDoorEnter.lua +35 -0
  3. package/dist/callbacks/subscriptions/postCustomDoorEnter.d.ts +2 -0
  4. package/dist/callbacks/subscriptions/postCustomDoorEnter.lua +25 -0
  5. package/dist/constants.d.ts +5 -0
  6. package/dist/constants.lua +1 -0
  7. package/dist/features/extraConsoleCommands/commands.d.ts +162 -0
  8. package/dist/features/extraConsoleCommands/commands.lua +530 -0
  9. package/dist/features/extraConsoleCommands/init.d.ts +25 -0
  10. package/dist/features/extraConsoleCommands/init.lua +133 -0
  11. package/dist/features/extraConsoleCommands/v.d.ts +9 -0
  12. package/dist/features/extraConsoleCommands/v.lua +5 -0
  13. package/dist/functions/log.d.ts +5 -1
  14. package/dist/functions/log.lua +172 -2
  15. package/dist/functions/map.d.ts +16 -0
  16. package/dist/functions/map.lua +24 -0
  17. package/dist/functions/run.d.ts +12 -0
  18. package/dist/functions/run.lua +25 -0
  19. package/dist/functions/utils.d.ts +0 -6
  20. package/dist/functions/utils.lua +0 -8
  21. package/dist/functions/vector.lua +8 -8
  22. package/dist/index.d.ts +6 -0
  23. package/dist/index.lua +46 -0
  24. package/dist/maps/cardMap.d.ts +3 -0
  25. package/dist/maps/cardMap.lua +202 -0
  26. package/dist/maps/characterMap.d.ts +3 -0
  27. package/dist/maps/characterMap.lua +90 -0
  28. package/dist/maps/pillEffectMap.d.ts +3 -0
  29. package/dist/maps/pillEffectMap.lua +88 -0
  30. package/dist/types/CallbackParametersCustom.d.ts +4 -0
  31. package/dist/types/ModCallbacksCustom.d.ts +2 -1
  32. package/dist/types/ModCallbacksCustom.lua +2 -0
  33. package/dist/types/ModUpgraded.lua +8 -0
  34. package/dist/types/PlayerIndex.d.ts +2 -2
  35. package/dist/upgradeMod.lua +3 -0
  36. package/package.json +1 -1
@@ -0,0 +1,530 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____lualib = require("lualib_bundle")
3
+ local Map = ____lualib.Map
4
+ local __TS__StringSlice = ____lualib.__TS__StringSlice
5
+ local ____exports = {}
6
+ local devilAngel, listEntities, listGridEntities, movePlayer, printEnabled, spawnTrapdoorOrCrawlspace, warpToRoomType, DEFAULT_MOVE_UNITS
7
+ local ____cachedClasses = require("cachedClasses")
8
+ local game = ____cachedClasses.game
9
+ local sfxManager = ____cachedClasses.sfxManager
10
+ local ____constants = require("constants")
11
+ local PILL_GIANT_FLAG = ____constants.PILL_GIANT_FLAG
12
+ local ____gridEntity = require("functions.gridEntity")
13
+ local spawnGridEntityWithVariant = ____gridEntity.spawnGridEntityWithVariant
14
+ local ____log = require("functions.log")
15
+ local logAllSeedEffects = ____log.logAllSeedEffects
16
+ local logEntities = ____log.logEntities
17
+ local logGridEntities = ____log.logGridEntities
18
+ local logRoom = ____log.logRoom
19
+ local logSounds = ____log.logSounds
20
+ local logTemporaryEffects = ____log.logTemporaryEffects
21
+ local ____map = require("functions.map")
22
+ local getMapPartialMatch = ____map.getMapPartialMatch
23
+ local ____npc = require("functions.npc")
24
+ local getNPCs = ____npc.getNPCs
25
+ local ____player = require("functions.player")
26
+ local getPlayers = ____player.getPlayers
27
+ local ____rooms = require("functions.rooms")
28
+ local changeRoom = ____rooms.changeRoom
29
+ local getRoomData = ____rooms.getRoomData
30
+ local getRoomGridIndexesForType = ____rooms.getRoomGridIndexesForType
31
+ local gridToPos = ____rooms.gridToPos
32
+ local ____run = require("functions.run")
33
+ local restart = ____run.restart
34
+ local ____utils = require("functions.utils")
35
+ local printConsole = ____utils.printConsole
36
+ local ____vector = require("functions.vector")
37
+ local directionToVector = ____vector.directionToVector
38
+ local ____cardMap = require("maps.cardMap")
39
+ local CARD_MAP = ____cardMap.CARD_MAP
40
+ local ____characterMap = require("maps.characterMap")
41
+ local CHARACTER_MAP = ____characterMap.CHARACTER_MAP
42
+ local ____pillEffectMap = require("maps.pillEffectMap")
43
+ local PILL_EFFECT_MAP = ____pillEffectMap.PILL_EFFECT_MAP
44
+ local ____v = require("features.extraConsoleCommands.v")
45
+ local v = ____v.default
46
+ function ____exports.chaosCardTears(self)
47
+ v.run.chaosCardTears = not v.run.chaosCardTears
48
+ printEnabled(nil, v.run.chaosCardTears, "Chaos Card tears")
49
+ end
50
+ function ____exports.devil(self)
51
+ devilAngel(nil, true)
52
+ end
53
+ function ____exports.goldenBomb(self)
54
+ local player = Isaac.GetPlayer()
55
+ player:AddGoldenBomb()
56
+ end
57
+ function ____exports.goldenKey(self)
58
+ local player = Isaac.GetPlayer()
59
+ player:AddGoldenKey()
60
+ end
61
+ function ____exports.IAMERROR(self)
62
+ changeRoom(nil, GridRooms.ROOM_ERROR_IDX)
63
+ end
64
+ function ____exports.startingRoom(self)
65
+ local level = game:GetLevel()
66
+ local startingRoomIndex = level:GetStartingRoomIndex()
67
+ changeRoom(nil, startingRoomIndex)
68
+ end
69
+ function devilAngel(self, useDevil)
70
+ local level = game:GetLevel()
71
+ local devilAngelRoomData = getRoomData(nil, GridRooms.ROOM_DEVIL_IDX)
72
+ if devilAngelRoomData ~= nil then
73
+ local roomType = devilAngelRoomData.Type
74
+ local conflictingType = useDevil and RoomType.ROOM_ANGEL or RoomType.ROOM_DEVIL
75
+ if roomType == conflictingType then
76
+ local roomDesc = level:GetRoomByIdx(GridRooms.ROOM_DEVIL_IDX)
77
+ roomDesc.Data = nil
78
+ end
79
+ end
80
+ if useDevil then
81
+ level:InitializeDevilAngelRoom(false, true)
82
+ else
83
+ level:InitializeDevilAngelRoom(true, false)
84
+ end
85
+ changeRoom(nil, GridRooms.ROOM_DEVIL_IDX)
86
+ end
87
+ function listEntities(self, params, includeBackgroundEffects)
88
+ local entityTypeFilter
89
+ if params ~= "" then
90
+ entityTypeFilter = tonumber(params)
91
+ if entityTypeFilter == nil then
92
+ printConsole(nil, "That is an invalid entity type to filter by.")
93
+ return
94
+ end
95
+ end
96
+ logEntities(includeBackgroundEffects, entityTypeFilter)
97
+ printConsole(nil, "Logged the entities in the room to the \"log.txt\" file.")
98
+ end
99
+ function listGridEntities(self, params, includeWalls)
100
+ local gridEntityTypeFilter
101
+ if params ~= "" then
102
+ gridEntityTypeFilter = tonumber(params)
103
+ if gridEntityTypeFilter == nil then
104
+ printConsole(nil, "That is an invalid grid entity type to filter by.")
105
+ return
106
+ end
107
+ end
108
+ logGridEntities(includeWalls, gridEntityTypeFilter)
109
+ printConsole(nil, "Logged the grid entities in the room to the \"log.txt\" file.")
110
+ end
111
+ function movePlayer(self, params, direction)
112
+ local amount = DEFAULT_MOVE_UNITS
113
+ if params ~= "" then
114
+ local num = tonumber(params)
115
+ if num == nil then
116
+ printConsole(nil, "That is an invalid amount of units to move.")
117
+ return
118
+ end
119
+ amount = num
120
+ end
121
+ local player = Isaac.GetPlayer()
122
+ local vector = directionToVector(nil, direction)
123
+ local modifiedVector = vector * amount
124
+ player.Position = player.Position + modifiedVector
125
+ end
126
+ function printEnabled(self, enabled, description)
127
+ local enabledText = enabled and "Enabled" or "Disabled"
128
+ printConsole(nil, ((enabledText .. " ") .. description) .. ".")
129
+ end
130
+ function spawnTrapdoorOrCrawlspace(self, trapdoor)
131
+ local room = game:GetRoom()
132
+ local player = Isaac.GetPlayer()
133
+ local position = room:FindFreeTilePosition(player.Position, 0)
134
+ local gridIndex = room:GetGridIndex(position)
135
+ local gridEntityType = trapdoor and GridEntityType.GRID_TRAPDOOR or GridEntityType.GRID_STAIRS
136
+ spawnGridEntityWithVariant(nil, gridEntityType, 0, gridIndex)
137
+ end
138
+ function warpToRoomType(self, roomType, roomTypeName)
139
+ local gridIndexes = getRoomGridIndexesForType(nil, roomType)
140
+ if #gridIndexes == 0 then
141
+ printConsole(nil, ("There are no " .. roomTypeName) .. "s on this floor.")
142
+ return
143
+ end
144
+ local firstGridIndex = gridIndexes[1]
145
+ changeRoom(nil, firstGridIndex)
146
+ end
147
+ DEFAULT_MOVE_UNITS = 0.5
148
+ function ____exports.angel(self)
149
+ devilAngel(nil, false)
150
+ end
151
+ function ____exports.ascent(self)
152
+ game:SetStateFlag(GameStateFlag.STATE_BACKWARDS_PATH_INIT, true)
153
+ game:SetStateFlag(GameStateFlag.STATE_BACKWARDS_PATH, true)
154
+ printConsole(nil, "Set Ascent flags.")
155
+ end
156
+ function ____exports.blackMarket(self)
157
+ changeRoom(nil, GridRooms.ROOM_BLACK_MARKET_IDX)
158
+ end
159
+ function ____exports.bomb(self, params)
160
+ local numBombs = 1
161
+ if params ~= "" then
162
+ local num = tonumber(params)
163
+ if num == nil then
164
+ printConsole(nil, "That is an invalid amount of bombs to add.")
165
+ return
166
+ end
167
+ numBombs = num
168
+ end
169
+ local player = Isaac.GetPlayer()
170
+ player:AddBombs(numBombs)
171
+ end
172
+ function ____exports.bombs(self)
173
+ local player = Isaac.GetPlayer()
174
+ player:AddBombs(99)
175
+ end
176
+ function ____exports.boss(self)
177
+ warpToRoomType(nil, RoomType.ROOM_BOSS, "Boss Room")
178
+ end
179
+ function ____exports.bm(self)
180
+ ____exports.blackMarket(nil)
181
+ end
182
+ function ____exports.card(self, params)
183
+ if params == "" then
184
+ printConsole(nil, "You must specify a card name or number.")
185
+ return
186
+ end
187
+ local num = tonumber(params)
188
+ if num ~= nil then
189
+ if num < 1 or num >= Card.NUM_CARDS then
190
+ printConsole(nil, "That is an invalid card sub-type.")
191
+ return
192
+ end
193
+ Isaac.ExecuteCommand("g k" .. tostring(num))
194
+ printConsole(
195
+ nil,
196
+ "Gave card: " .. tostring(num)
197
+ )
198
+ return
199
+ end
200
+ local match = getMapPartialMatch(nil, params, CARD_MAP)
201
+ if match == nil then
202
+ printConsole(nil, "Unknown card: " .. params)
203
+ return
204
+ end
205
+ Isaac.ExecuteCommand("g k" .. tostring(match))
206
+ printConsole(
207
+ nil,
208
+ "Gave card: " .. tostring(match)
209
+ )
210
+ end
211
+ function ____exports.cards(self)
212
+ local cardType = 1
213
+ do
214
+ local y = 0
215
+ while y <= 6 do
216
+ do
217
+ local x = 0
218
+ while x <= 12 do
219
+ if cardType == Card.NUM_CARDS then
220
+ return
221
+ end
222
+ local position = gridToPos(nil, x, y)
223
+ Isaac.Spawn(
224
+ EntityType.ENTITY_PICKUP,
225
+ PickupVariant.PICKUP_TAROTCARD,
226
+ cardType,
227
+ position,
228
+ Vector.Zero,
229
+ nil
230
+ )
231
+ cardType = cardType + 1
232
+ x = x + 1
233
+ end
234
+ end
235
+ y = y + 1
236
+ end
237
+ end
238
+ end
239
+ function ____exports.cc(self)
240
+ ____exports.chaosCardTears(nil)
241
+ end
242
+ function ____exports.characterCommand(self, params)
243
+ if params == "" then
244
+ printConsole(nil, "You must specify a character name or number.")
245
+ return
246
+ end
247
+ local num = tonumber(params)
248
+ if num ~= nil then
249
+ if num < 0 or num >= PlayerType.NUM_PLAYER_TYPES then
250
+ printConsole(nil, "That is an invalid player sub-type.")
251
+ return
252
+ end
253
+ printConsole(
254
+ nil,
255
+ "Restarting as character: " .. tostring(num)
256
+ )
257
+ restart(nil, num)
258
+ return
259
+ end
260
+ local match = getMapPartialMatch(nil, params, CHARACTER_MAP)
261
+ if match == nil then
262
+ printConsole(nil, "Unknown character: " .. params)
263
+ return
264
+ end
265
+ restart(nil, match)
266
+ printConsole(
267
+ nil,
268
+ "Restarting as character: " .. tostring(match)
269
+ )
270
+ end
271
+ function ____exports.coin(self, params)
272
+ local numCoins = 1
273
+ if params ~= "" then
274
+ local num = tonumber(params)
275
+ if num == nil then
276
+ printConsole(nil, "That is an invalid amount of coins to add.")
277
+ return
278
+ end
279
+ numCoins = num
280
+ end
281
+ local player = Isaac.GetPlayer()
282
+ player:AddCoins(numCoins)
283
+ end
284
+ function ____exports.coins(self)
285
+ local player = Isaac.GetPlayer()
286
+ player:AddCoins(999)
287
+ end
288
+ function ____exports.crawlspace(self)
289
+ spawnTrapdoorOrCrawlspace(nil, false)
290
+ end
291
+ function ____exports.damage(self)
292
+ v.run.maxDamage = not v.run.maxDamage
293
+ printEnabled(nil, v.run.maxDamage, "debug damage")
294
+ end
295
+ function ____exports.dd(self)
296
+ ____exports.devil(nil)
297
+ end
298
+ function ____exports.down(self, params)
299
+ movePlayer(nil, params, Direction.DOWN)
300
+ end
301
+ function ____exports.effects(self)
302
+ local player = Isaac.GetPlayer()
303
+ logTemporaryEffects(player)
304
+ printConsole(nil, "Logged the player's effects to the \"log.txt\" file.")
305
+ end
306
+ function ____exports.error(self)
307
+ ____exports.IAMERROR(nil)
308
+ end
309
+ function ____exports.fool(self)
310
+ ____exports.startingRoom(nil)
311
+ end
312
+ function ____exports.goldBomb(self)
313
+ ____exports.goldenBomb(nil)
314
+ end
315
+ function ____exports.goldKey(self)
316
+ ____exports.goldenKey(nil)
317
+ end
318
+ function ____exports.key(self, params)
319
+ local numKeys = 1
320
+ if params ~= "" then
321
+ local num = tonumber(params)
322
+ if num == nil then
323
+ printConsole(nil, "That is an invalid amount of keys to add.")
324
+ return
325
+ end
326
+ numKeys = num
327
+ end
328
+ local player = Isaac.GetPlayer()
329
+ player:AddKeys(numKeys)
330
+ end
331
+ function ____exports.keys(self)
332
+ local player = Isaac.GetPlayer()
333
+ player:AddKeys(99)
334
+ end
335
+ function ____exports.list(self, params)
336
+ listEntities(nil, params, false)
337
+ end
338
+ function ____exports.listAll(self, params)
339
+ listEntities(nil, params, true)
340
+ end
341
+ function ____exports.listGrid(self, params)
342
+ listGridEntities(nil, params, false)
343
+ end
344
+ function ____exports.listGridAll(self, params)
345
+ listGridEntities(nil, params, true)
346
+ end
347
+ function ____exports.lowHP(self)
348
+ for ____, npc in ipairs(getNPCs(nil)) do
349
+ npc.HitPoints = 1
350
+ end
351
+ printConsole(nil, "Set every NPC to 1 HP.")
352
+ end
353
+ function ____exports.luck(self)
354
+ Isaac.ExecuteCommand("debug 9")
355
+ end
356
+ function ____exports.pill(self, params)
357
+ if params == "" then
358
+ printConsole(nil, "You must specify a pill name or number.")
359
+ return
360
+ end
361
+ local num = tonumber(params)
362
+ if num ~= nil then
363
+ if num < 1 or num >= PillEffect.NUM_PILL_EFFECTS then
364
+ printConsole(nil, "That is an invalid pill effect ID.")
365
+ return
366
+ end
367
+ Isaac.ExecuteCommand("g p" .. tostring(num))
368
+ printConsole(
369
+ nil,
370
+ "Gave pill: " .. tostring(num)
371
+ )
372
+ return
373
+ end
374
+ local match = getMapPartialMatch(nil, params, PILL_EFFECT_MAP)
375
+ if match == nil then
376
+ printConsole(nil, "Unknown pill effect: " .. params)
377
+ return
378
+ end
379
+ Isaac.ExecuteCommand("g p" .. tostring(match))
380
+ printConsole(
381
+ nil,
382
+ "Gave pill: " .. tostring(match)
383
+ )
384
+ end
385
+ function ____exports.pills(self)
386
+ local pillColor = 1
387
+ local horse = false
388
+ do
389
+ local y = 0
390
+ while y <= 6 do
391
+ do
392
+ local x = 0
393
+ while x <= 12 do
394
+ if pillColor == PillColor.NUM_PILLS then
395
+ if horse then
396
+ return
397
+ end
398
+ horse = true
399
+ pillColor = 1
400
+ end
401
+ local horsePillColor = pillColor + PILL_GIANT_FLAG
402
+ local subType = horse and horsePillColor or pillColor
403
+ local position = gridToPos(nil, x, y)
404
+ Isaac.Spawn(
405
+ EntityType.ENTITY_PICKUP,
406
+ PickupVariant.PICKUP_PILL,
407
+ subType,
408
+ position,
409
+ Vector.Zero,
410
+ nil
411
+ )
412
+ pillColor = pillColor + 1
413
+ x = x + 1
414
+ end
415
+ end
416
+ y = y + 1
417
+ end
418
+ end
419
+ end
420
+ function ____exports.planetarium(self)
421
+ warpToRoomType(nil, RoomType.ROOM_PLANETARIUM, "Planetarium")
422
+ end
423
+ function ____exports.pocket(self, params)
424
+ if params == "" then
425
+ printConsole(nil, "You must supply a collectible type to put as the pocket item.")
426
+ return
427
+ end
428
+ local num = tonumber(params)
429
+ if num == nil then
430
+ printConsole(nil, "That is an invalid collectible type.")
431
+ return
432
+ end
433
+ local player = Isaac.GetPlayer()
434
+ player:SetPocketActiveItem(num, ActiveSlot.SLOT_POCKET)
435
+ end
436
+ function ____exports.positionCommand(self)
437
+ for ____, player in ipairs(getPlayers(nil)) do
438
+ local character = player:GetPlayerType()
439
+ printConsole(
440
+ nil,
441
+ ((((("Player position for character " .. tostring(character)) .. ": (") .. tostring(player.Position.X)) .. ", ") .. tostring(player.Position.Y)) .. ")"
442
+ )
443
+ end
444
+ end
445
+ function ____exports.roomCommand(self)
446
+ logRoom()
447
+ end
448
+ function ____exports.s(self, params)
449
+ if params == "" then
450
+ printConsole(nil, "You must specify a stage number.")
451
+ return
452
+ end
453
+ local finalCharacter = string.sub(params, -1)
454
+ local stageString
455
+ local stageTypeLetter
456
+ if finalCharacter == "a" or finalCharacter == "b" or finalCharacter == "c" or finalCharacter == "d" then
457
+ stageString = __TS__StringSlice(params, 0, #params - 1)
458
+ stageTypeLetter = finalCharacter
459
+ else
460
+ stageString = params
461
+ stageTypeLetter = ""
462
+ end
463
+ local stage = tonumber(stageString)
464
+ if stage == nil then
465
+ printConsole(
466
+ nil,
467
+ "That is an invalid stage number: " .. tostring(stage)
468
+ )
469
+ return
470
+ end
471
+ local minStage = 1
472
+ local maxStage = 13
473
+ if stage < minStage or stage > maxStage then
474
+ printConsole(
475
+ nil,
476
+ ((("Invalid stage number; must be between " .. tostring(minStage)) .. " and ") .. tostring(maxStage)) .. "."
477
+ )
478
+ return
479
+ end
480
+ Isaac.ExecuteCommand(("stage " .. tostring(stage)) .. stageTypeLetter)
481
+ end
482
+ function ____exports.seeds(self)
483
+ logAllSeedEffects()
484
+ printConsole(nil, "Logged the seed effects to the \"log.txt\" file.")
485
+ end
486
+ function ____exports.shop(self)
487
+ warpToRoomType(nil, RoomType.ROOM_SHOP, "shop")
488
+ end
489
+ function ____exports.sound(self, params)
490
+ local soundEffect = tonumber(params)
491
+ if soundEffect == nil then
492
+ printConsole(nil, "That is an invalid sound effect ID.")
493
+ return
494
+ end
495
+ sfxManager:Play(soundEffect)
496
+ end
497
+ function ____exports.sounds(self)
498
+ logSounds()
499
+ printConsole(nil, "Logged the currently playing sound effects to the \"log.txt\" file.")
500
+ end
501
+ function ____exports.spam(self)
502
+ v.run.spamBloodRights = not v.run.spamBloodRights
503
+ end
504
+ function ____exports.speed(self)
505
+ local player = Isaac.GetPlayer()
506
+ v.run.maxSpeed = not v.run.maxSpeed
507
+ if v.run.maxSpeed and not player:HasCollectible(CollectibleType.COLLECTIBLE_FATE) then
508
+ local eternalHearts = player:GetEternalHearts()
509
+ if eternalHearts == 0 then
510
+ player:AddCollectible(CollectibleType.COLLECTIBLE_FATE)
511
+ player:AddEternalHearts(-1)
512
+ else
513
+ player:AddEternalHearts(-1)
514
+ player:AddCollectible(CollectibleType.COLLECTIBLE_FATE)
515
+ end
516
+ end
517
+ player:AddCacheFlags(CacheFlag.CACHE_SPEED)
518
+ player:EvaluateItems()
519
+ printEnabled(nil, v.run.maxSpeed, "max speed")
520
+ end
521
+ function ____exports.trapdoorCommand(self)
522
+ spawnTrapdoorOrCrawlspace(nil, true)
523
+ end
524
+ function ____exports.treasure(self)
525
+ warpToRoomType(nil, RoomType.ROOM_TREASURE, "Treasure Room")
526
+ end
527
+ function ____exports.ultra(self)
528
+ warpToRoomType(nil, RoomType.ROOM_ULTRASECRET, "Ultra Secret Room")
529
+ end
530
+ return ____exports
@@ -0,0 +1,25 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ /**
3
+ * Enables extra console commands which are useful for debugging. See the `isaacscript-common`
4
+ * documentation for details on the commands that are added.
5
+ */
6
+ export declare function enableExtraConsoleCommands(mod: Mod): void;
7
+ /**
8
+ * Helper function to add a custom console command.
9
+ *
10
+ * The standard library comes with many existing console commands that are useful for debugging, but
11
+ * you can also add your own commands that are useful for your particular mod. It's easier to add
12
+ * commands to the existing command system than to add logic manually to the ExecuteCmd callback.
13
+ *
14
+ * Before using this function, you must first invoke `enableExtraConsoleCommands`.
15
+ */
16
+ export declare function addConsoleCommand(commandName: string, commandFunction: (params: string) => void): void;
17
+ /**
18
+ * Helper function to remove a custom console command.
19
+ *
20
+ * The standard library comes with many existing console commands that are useful for debugging. If
21
+ * you want to disable one of them, use this function.
22
+ *
23
+ * Before using this function, you must first invoke `enableExtraConsoleCommands`.
24
+ */
25
+ export declare function removeConsoleCommand(commandName: string): void;
@@ -0,0 +1,133 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____lualib = require("lualib_bundle")
3
+ local Map = ____lualib.Map
4
+ local __TS__New = ____lualib.__TS__New
5
+ local ____exports = {}
6
+ local postUpdate, evaluateCacheSpeed, entityTakeDmgPlayer, executeCmd, postFireTear, commandFunctionsMap
7
+ local ____constants = require("constants")
8
+ local MAX_SPEED_STAT = ____constants.MAX_SPEED_STAT
9
+ local ____map = require("functions.map")
10
+ local getMapPartialMatch = ____map.getMapPartialMatch
11
+ local ____utils = require("functions.utils")
12
+ local printConsole = ____utils.printConsole
13
+ local ____exports = require("features.saveDataManager.exports")
14
+ local saveDataManager = ____exports.saveDataManager
15
+ local commands = require("features.extraConsoleCommands.commands")
16
+ local ____v = require("features.extraConsoleCommands.v")
17
+ local v = ____v.default
18
+ function postUpdate(self)
19
+ if v.run.spamBloodRights then
20
+ local player = Isaac.GetPlayer()
21
+ player:UseActiveItem(CollectibleType.COLLECTIBLE_BLOOD_RIGHTS)
22
+ end
23
+ end
24
+ function evaluateCacheSpeed(self, player)
25
+ if v.run.maxSpeed then
26
+ player.MoveSpeed = MAX_SPEED_STAT
27
+ end
28
+ end
29
+ function entityTakeDmgPlayer(self)
30
+ if v.run.spamBloodRights then
31
+ return false
32
+ end
33
+ return nil
34
+ end
35
+ function executeCmd(self, command, params)
36
+ local commandFunction = getMapPartialMatch(nil, command, commandFunctionsMap)
37
+ if commandFunction == nil then
38
+ printConsole(nil, "That is an invalid console command.")
39
+ else
40
+ commandFunction(nil, params)
41
+ end
42
+ end
43
+ function postFireTear(self, tear)
44
+ if v.run.chaosCardTears then
45
+ tear:ChangeVariant(TearVariant.CHAOS_CARD)
46
+ end
47
+ if v.run.maxDamage then
48
+ tear.CollisionDamage = tear.CollisionDamage * 1000
49
+ tear:ChangeVariant(TearVariant.TOOTH)
50
+ end
51
+ end
52
+ commandFunctionsMap = __TS__New(Map)
53
+ local initialized = false
54
+ function ____exports.enableExtraConsoleCommands(self, mod)
55
+ initialized = true
56
+ saveDataManager(nil, "extraConsoleCommands", v)
57
+ mod:AddCallback(ModCallbacks.MC_POST_UPDATE, postUpdate)
58
+ mod:AddCallback(ModCallbacks.MC_EVALUATE_CACHE, evaluateCacheSpeed, CacheFlag.CACHE_SPEED)
59
+ mod:AddCallback(ModCallbacks.MC_ENTITY_TAKE_DMG, entityTakeDmgPlayer, EntityType.ENTITY_PLAYER)
60
+ mod:AddCallback(ModCallbacks.MC_EXECUTE_CMD, executeCmd)
61
+ mod:AddCallback(ModCallbacks.MC_POST_FIRE_TEAR, postFireTear)
62
+ end
63
+ function ____exports.addConsoleCommand(self, commandName, commandFunction)
64
+ if not initialized then
65
+ error("Before adding extra console commands, you must first enable the feature by invoking the \"enableExtraConsoleCommands\" function.")
66
+ end
67
+ if commandFunctionsMap:has(commandName) then
68
+ error(("You cannot add a new console command of \"" .. commandName) .. "\" because there is already an existing command by that name. If you want to overwrite a command from the standard library, you can use the \"removeExtraConsoleCommand\" function.")
69
+ end
70
+ commandFunctionsMap:set(commandName, commandFunction)
71
+ end
72
+ function ____exports.removeConsoleCommand(self, commandName)
73
+ if not initialized then
74
+ error("Before removing console commands, you must first enable the feature by invoking the \"enableExtraConsoleCommands\" function.")
75
+ end
76
+ if not commandFunctionsMap:has(commandName) then
77
+ error(("The console command of \"" .. commandName) .. "\" does not exist, so you cannot remove it.")
78
+ end
79
+ commandFunctionsMap:delete(commandName)
80
+ end
81
+ commandFunctionsMap:set("angel", commands.angel)
82
+ commandFunctionsMap:set("ascent", commands.ascent)
83
+ commandFunctionsMap:set("blackmarket", commands.blackMarket)
84
+ commandFunctionsMap:set("bomb", commands.bomb)
85
+ commandFunctionsMap:set("bombs", commands.bombs)
86
+ commandFunctionsMap:set("boss", commands.boss)
87
+ commandFunctionsMap:set("bm", commands.bm)
88
+ commandFunctionsMap:set("card", commands.card)
89
+ commandFunctionsMap:set("cards", commands.cards)
90
+ commandFunctionsMap:set("cc", commands.cc)
91
+ commandFunctionsMap:set("chaoscardtears", commands.chaosCardTears)
92
+ commandFunctionsMap:set("character", commands.characterCommand)
93
+ commandFunctionsMap:set("coin", commands.coin)
94
+ commandFunctionsMap:set("coins", commands.coins)
95
+ commandFunctionsMap:set("crawlspace", commands.crawlspace)
96
+ commandFunctionsMap:set("damage", commands.damage)
97
+ commandFunctionsMap:set("dd", commands.dd)
98
+ commandFunctionsMap:set("devil", commands.devil)
99
+ commandFunctionsMap:set("down", commands.down)
100
+ commandFunctionsMap:set("effects", commands.effects)
101
+ commandFunctionsMap:set("error", commands.error)
102
+ commandFunctionsMap:set("fool", commands.fool)
103
+ commandFunctionsMap:set("goldbomb", commands.goldBomb)
104
+ commandFunctionsMap:set("goldenbomb", commands.goldenBomb)
105
+ commandFunctionsMap:set("goldkey", commands.goldKey)
106
+ commandFunctionsMap:set("goldenkey", commands.goldenKey)
107
+ commandFunctionsMap:set("iamerror", commands.IAMERROR)
108
+ commandFunctionsMap:set("key", commands.key)
109
+ commandFunctionsMap:set("keys", commands.keys)
110
+ commandFunctionsMap:set("list", commands.list)
111
+ commandFunctionsMap:set("listall", commands.listAll)
112
+ commandFunctionsMap:set("listgrid", commands.listGrid)
113
+ commandFunctionsMap:set("listgridall", commands.listGridAll)
114
+ commandFunctionsMap:set("lowhp", commands.lowHP)
115
+ commandFunctionsMap:set("luck", commands.luck)
116
+ commandFunctionsMap:set("pill", commands.pill)
117
+ commandFunctionsMap:set("pills", commands.pills)
118
+ commandFunctionsMap:set("planetarium", commands.planetarium)
119
+ commandFunctionsMap:set("pocket", commands.pocket)
120
+ commandFunctionsMap:set("position", commands.positionCommand)
121
+ commandFunctionsMap:set("room", commands.roomCommand)
122
+ commandFunctionsMap:set("s", commands.s)
123
+ commandFunctionsMap:set("seeds", commands.seeds)
124
+ commandFunctionsMap:set("shop", commands.shop)
125
+ commandFunctionsMap:set("sound", commands.sound)
126
+ commandFunctionsMap:set("sounds", commands.sounds)
127
+ commandFunctionsMap:set("spam", commands.spam)
128
+ commandFunctionsMap:set("speed", commands.speed)
129
+ commandFunctionsMap:set("startingroom", commands.startingRoom)
130
+ commandFunctionsMap:set("trapdoor", commands.trapdoorCommand)
131
+ commandFunctionsMap:set("treasure", commands.treasure)
132
+ commandFunctionsMap:set("ultra", commands.ultra)
133
+ return ____exports
@@ -0,0 +1,9 @@
1
+ declare const v: {
2
+ run: {
3
+ chaosCardTears: boolean;
4
+ spamBloodRights: boolean;
5
+ maxSpeed: boolean;
6
+ maxDamage: boolean;
7
+ };
8
+ };
9
+ export default v;