isaacscript-common 6.2.1 → 6.3.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.
Files changed (55) hide show
  1. package/callbacks/reorderedCallbacks.d.ts +9 -0
  2. package/callbacks/reorderedCallbacks.lua +9 -0
  3. package/constants.d.ts +9 -0
  4. package/constants.lua +7 -0
  5. package/enums/CornerType.d.ts +6 -0
  6. package/enums/CornerType.lua +11 -0
  7. package/features/customStage/backdrop.d.ts +2 -0
  8. package/features/customStage/backdrop.lua +200 -0
  9. package/features/customStage/boss.d.ts +2 -0
  10. package/features/customStage/boss.lua +74 -0
  11. package/features/customStage/exports.d.ts +1 -0
  12. package/features/customStage/exports.lua +28 -1
  13. package/features/customStage/init.d.ts +2 -1
  14. package/features/customStage/init.lua +39 -10
  15. package/features/customStage/stageAPIBoss.d.ts +29 -0
  16. package/features/customStage/stageAPIBoss.lua +9 -0
  17. package/features/customStage/v.d.ts +7 -0
  18. package/features/customStage/v.lua +2 -0
  19. package/features/debugDisplay/debugDisplay.lua +2 -0
  20. package/features/debugDisplay/exports.d.ts +108 -0
  21. package/features/debugDisplay/exports.lua +145 -0
  22. package/features/debugDisplay/v.d.ts +2 -0
  23. package/features/debugDisplay/v.lua +9 -0
  24. package/features/extraConsoleCommands/init.lua +8 -1
  25. package/features/extraConsoleCommands/listCommands.d.ts +12 -4
  26. package/features/extraConsoleCommands/listCommands.lua +30 -15
  27. package/features/extraConsoleCommands/v.d.ts +1 -0
  28. package/features/extraConsoleCommands/v.lua +2 -1
  29. package/features/pause.d.ts +11 -0
  30. package/features/pause.lua +71 -0
  31. package/features/runNextRoom.d.ts +8 -0
  32. package/features/runNextRoom.lua +40 -0
  33. package/functions/chargeBar.lua +4 -6
  34. package/functions/direction.d.ts +1 -1
  35. package/functions/doors.d.ts +2 -2
  36. package/functions/playerCenter.lua +4 -5
  37. package/functions/playerIndex.d.ts +3 -0
  38. package/functions/playerIndex.lua +3 -0
  39. package/functions/roomShape.d.ts +10 -4
  40. package/functions/roomShape.lua +15 -2
  41. package/functions/sprite.d.ts +1 -1
  42. package/functions/sprite.lua +1 -1
  43. package/index.d.ts +1 -1
  44. package/index.lua +2 -0
  45. package/initFeatures.lua +7 -1
  46. package/interfaces/Corner.d.ts +6 -0
  47. package/interfaces/Corner.lua +2 -0
  48. package/interfaces/CustomStageLua.d.ts +13 -9
  49. package/objects/roomShapeCorners.d.ts +6 -0
  50. package/objects/roomShapeCorners.lua +259 -0
  51. package/objects/roomShapeToBottomRightPosition.d.ts +1 -1
  52. package/objects/roomShapeToTopLeftPosition.d.ts +1 -1
  53. package/package.json +1 -1
  54. package/sets/narrowRoomShapesSet.d.ts +2 -0
  55. package/sets/narrowRoomShapesSet.lua +8 -0
@@ -10,6 +10,15 @@ end
10
10
  function defaultGridEntityDisplayCallback(self, gridEntity)
11
11
  return getGridEntityID(nil, gridEntity)
12
12
  end
13
+ local debugDisplayEnabled = false
14
+ function ____exports.setDebugDisplayEnabled(self)
15
+ debugDisplayEnabled = true
16
+ end
17
+ function ____exports.errorIfDebugDisplayNotInitialized(self)
18
+ if not debugDisplayEnabled then
19
+ error("The \"debugDisplay\" feature is not initialized. You must run the \"enableExtraConsoleCommands\" function once at the beginning of your mod in order for this feature to work.")
20
+ end
21
+ end
13
22
  local v = {run = {
14
23
  player = false,
15
24
  tear = false,
@@ -1,7 +1,7 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local Map = ____lualib.Map
3
3
  local ____exports = {}
4
- local initMap, initCallbacks, postUpdate, evaluateCacheFireDelay, evaluateCacheSpeed, entityTakeDmgPlayer, postCurseEval, executeCmd, postFireTear
4
+ local initMap, initCallbacks, postUpdate, evaluateCacheFireDelay, evaluateCacheSpeed, evaluateCacheFlying, entityTakeDmgPlayer, postCurseEval, executeCmd, postFireTear
5
5
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
6
6
  local CacheFlag = ____isaac_2Dtypescript_2Ddefinitions.CacheFlag
7
7
  local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
@@ -72,6 +72,7 @@ function initMap(self)
72
72
  extraConsoleCommandsFunctionMap:set("eternalHearts", commands.eternalHearts)
73
73
  extraConsoleCommandsFunctionMap:set("familiarDisplay", commandsDisplay.familiarDisplay)
74
74
  extraConsoleCommandsFunctionMap:set("familiarsDisplay", commandsDisplay.familiarsDisplay)
75
+ extraConsoleCommandsFunctionMap:set("flight", commands.flight)
75
76
  extraConsoleCommandsFunctionMap:set("fool", commands.fool)
76
77
  extraConsoleCommandsFunctionMap:set("getPosition", commands.getPosition)
77
78
  extraConsoleCommandsFunctionMap:set("gigaBomb", commands.gigaBomb)
@@ -174,6 +175,7 @@ function initCallbacks(self, mod)
174
175
  mod:AddCallback(ModCallback.POST_UPDATE, postUpdate)
175
176
  mod:AddCallback(ModCallback.EVALUATE_CACHE, evaluateCacheFireDelay, CacheFlag.FIRE_DELAY)
176
177
  mod:AddCallback(ModCallback.EVALUATE_CACHE, evaluateCacheSpeed, CacheFlag.SPEED)
178
+ mod:AddCallback(ModCallback.EVALUATE_CACHE, evaluateCacheFlying, CacheFlag.FLYING)
177
179
  mod:AddCallback(ModCallback.ENTITY_TAKE_DMG, entityTakeDmgPlayer, EntityType.PLAYER)
178
180
  mod:AddCallback(ModCallback.POST_CURSE_EVAL, postCurseEval)
179
181
  mod:AddCallback(ModCallback.EXECUTE_CMD, executeCmd)
@@ -195,6 +197,11 @@ function evaluateCacheSpeed(self, player)
195
197
  player.MoveSpeed = MAX_SPEED_STAT
196
198
  end
197
199
  end
200
+ function evaluateCacheFlying(self, player)
201
+ if v.run.flight then
202
+ player.CanFly = true
203
+ end
204
+ end
198
205
  function entityTakeDmgPlayer(self)
199
206
  if v.run.spamBloodRights then
200
207
  return false
@@ -65,7 +65,10 @@ export declare function card(params: string): void;
65
65
  export declare function cards(): void;
66
66
  /** Alias for the "chaosCardTears" command. */
67
67
  export declare function cc(): void;
68
- /** Toggles Chaos Card tears. Useful for killing enemies very fast without using "debug 10". */
68
+ /**
69
+ * Toggles Chaos Card tears for the player. Useful for killing enemies very fast without using
70
+ * "debug 10".
71
+ */
69
72
  export declare function chaosCardTears(): void;
70
73
  /**
71
74
  * Restart as the specified character. Accepts either the character sub-type or the partial name of
@@ -96,7 +99,7 @@ export declare function crawlSpace(): void;
96
99
  export declare function d20(): void;
97
100
  /** Uses the D6. */
98
101
  export declare function d6(): void;
99
- /** Toggles extremely high-damage tears. */
102
+ /** Toggles extremely high-damage tears for the player. */
100
103
  export declare function damage(): void;
101
104
  /** Alias for the "devil" command. */
102
105
  export declare function dd(): void;
@@ -124,6 +127,8 @@ export declare function error(): void;
124
127
  * numbers to remove hearts.)
125
128
  */
126
129
  export declare function eternalHearts(params: string): void;
130
+ /** Toggles flight for the player. */
131
+ export declare function flight(params: string): void;
127
132
  /** Alias for the "startingRoom" command. */
128
133
  export declare function fool(): void;
129
134
  /** Prints the current position of all players. */
@@ -324,13 +329,16 @@ export declare function sounds(): void;
324
329
  export declare function spam(): void;
325
330
  /** Spawns a golden version of the specified trinket type. */
326
331
  export declare function spawnGoldenTrinket(params: string): void;
327
- /** Toggles maximum movement speed and flight. */
332
+ /** Toggles maximum movement speed and flight for the player. */
328
333
  export declare function speed(): void;
329
334
  /** Warps to the starting room of the floor. */
330
335
  export declare function startingRoom(): void;
331
336
  /** Warps to the first Super Secret Room on the floor. */
332
337
  export declare function superSecret(): void;
333
- /** Toggles extremely high tears stat (e.g. fire rate), equivalent of that to soy milk. */
338
+ /**
339
+ * Toggles an extremely high tears stat (e.g. fire rate) for the player, equivalent of that to soy
340
+ * milk.
341
+ */
334
342
  export declare function tears(): void;
335
343
  /** Creates a trapdoor next to the player. */
336
344
  export declare function trapdoorCommand(): void;
@@ -64,7 +64,9 @@ local spawnTrinket = ____pickups.spawnTrinket
64
64
  local ____pills = require("functions.pills")
65
65
  local getPillEffectName = ____pills.getPillEffectName
66
66
  local ____player = require("functions.player")
67
+ local addCollectibleCostume = ____player.addCollectibleCostume
67
68
  local getPlayerName = ____player.getPlayerName
69
+ local removeCollectibleCostume = ____player.removeCollectibleCostume
68
70
  local useActiveItemTemp = ____player.useActiveItemTemp
69
71
  local ____playerIndex = require("functions.playerIndex")
70
72
  local getPlayers = ____playerIndex.getPlayers
@@ -104,7 +106,8 @@ local v = ____v.default
104
106
  function ____exports.blackHearts(self, params)
105
107
  addHeart(nil, params, HealthType.BLACK)
106
108
  end
107
- --- Toggles Chaos Card tears. Useful for killing enemies very fast without using "debug 10".
109
+ --- Toggles Chaos Card tears for the player. Useful for killing enemies very fast without using
110
+ -- "debug 10".
108
111
  function ____exports.chaosCardTears(self)
109
112
  v.run.chaosCardTears = not v.run.chaosCardTears
110
113
  printEnabled(nil, v.run.chaosCardTears, "Chaos Card tears")
@@ -480,7 +483,7 @@ function ____exports.d6(self)
480
483
  local player = Isaac.GetPlayer()
481
484
  useActiveItemTemp(nil, player, CollectibleType.D6)
482
485
  end
483
- --- Toggles extremely high-damage tears.
486
+ --- Toggles extremely high-damage tears for the player.
484
487
  function ____exports.damage(self)
485
488
  v.run.maxDamage = not v.run.maxDamage
486
489
  printEnabled(nil, v.run.maxDamage, "debug damage")
@@ -520,6 +523,25 @@ end
520
523
  function ____exports.error(self)
521
524
  ____exports.iAmError(nil)
522
525
  end
526
+ --- Toggles flight for the player.
527
+ function ____exports.flight(self, params)
528
+ local player = Isaac.GetPlayer()
529
+ v.run.flight = not v.run.flight
530
+ if params == "true" then
531
+ v.run.flight = true
532
+ elseif params == "false" then
533
+ v.run.flight = false
534
+ end
535
+ player:AddCacheFlags(CacheFlag.FLYING)
536
+ player:EvaluateItems()
537
+ local collectibleUsedToShowFlight = CollectibleType.FATE
538
+ if v.run.flight then
539
+ addCollectibleCostume(nil, player, collectibleUsedToShowFlight)
540
+ else
541
+ removeCollectibleCostume(nil, player, collectibleUsedToShowFlight)
542
+ end
543
+ printEnabled(nil, v.run.maxSpeed, "max speed")
544
+ end
523
545
  --- Alias for the "startingRoom" command.
524
546
  function ____exports.fool(self)
525
547
  ____exports.startingRoom(nil)
@@ -1018,29 +1040,22 @@ function ____exports.spawnGoldenTrinket(self, params)
1018
1040
  local centerPos = room:GetCenterPos()
1019
1041
  spawnTrinket(nil, goldenTrinketType, centerPos)
1020
1042
  end
1021
- --- Toggles maximum movement speed and flight.
1043
+ --- Toggles maximum movement speed and flight for the player.
1022
1044
  function ____exports.speed(self)
1023
1045
  local player = Isaac.GetPlayer()
1024
1046
  v.run.maxSpeed = not v.run.maxSpeed
1025
- if v.run.maxSpeed and not player.CanFly then
1026
- local numEternalHearts = player:GetEternalHearts()
1027
- if numEternalHearts == 0 then
1028
- player:AddCollectible(CollectibleType.FATE)
1029
- player:AddEternalHearts(-1)
1030
- else
1031
- player:AddEternalHearts(-1)
1032
- player:AddCollectible(CollectibleType.FATE)
1033
- end
1034
- end
1035
1047
  player:AddCacheFlags(CacheFlag.SPEED)
1036
1048
  player:EvaluateItems()
1037
- printEnabled(nil, v.run.maxSpeed, "max speed")
1049
+ local value = tostring(v.run.maxSpeed)
1050
+ ____exports.flight(nil, value)
1051
+ printEnabled(nil, v.run.maxSpeed, "max speed and flight")
1038
1052
  end
1039
1053
  --- Warps to the first Super Secret Room on the floor.
1040
1054
  function ____exports.superSecret(self)
1041
1055
  warpToRoomType(nil, RoomType.SUPER_SECRET)
1042
1056
  end
1043
- --- Toggles extremely high tears stat (e.g. fire rate), equivalent of that to soy milk.
1057
+ --- Toggles an extremely high tears stat (e.g. fire rate) for the player, equivalent of that to soy
1058
+ -- milk.
1044
1059
  function ____exports.tears(self)
1045
1060
  v.run.maxTears = not v.run.maxTears
1046
1061
  local player = Isaac.GetPlayer()
@@ -8,6 +8,7 @@ declare const v: {
8
8
  maxDamage: boolean;
9
9
  maxSpeed: boolean;
10
10
  maxTears: boolean;
11
+ flight: boolean;
11
12
  };
12
13
  };
13
14
  export default v;
@@ -7,7 +7,8 @@ local v = {persistent = {disableCurses = false}, run = {
7
7
  spamBloodRights = false,
8
8
  maxDamage = false,
9
9
  maxSpeed = false,
10
- maxTears = false
10
+ maxTears = false,
11
+ flight = false
11
12
  }}
12
13
  ____exports.default = v
13
14
  --- The contents of the map are initialized in the "init.ts" file.
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Helper function to emulate what happens when the player pauses the game. Use the `unpause`
3
+ * function to return things back to normal.
4
+ *
5
+ * Under the hood, this function:
6
+ * - uses the Pause collectible on every game frame
7
+ * - disables any player inputs (except for `ButtonAction.MENU_CONFIRM`)
8
+ */
9
+ export declare function pause(): void;
10
+ /** Helper function to put things back to normal after the `pause` function was used. */
11
+ export declare function unpause(): void;
@@ -0,0 +1,71 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local Set = ____lualib.Set
3
+ local __TS__New = ____lualib.__TS__New
4
+ local ____exports = {}
5
+ local postUpdate, inputActionGetActionValue, v
6
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
7
+ local ButtonAction = ____isaac_2Dtypescript_2Ddefinitions.ButtonAction
8
+ local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
9
+ local InputHook = ____isaac_2Dtypescript_2Ddefinitions.InputHook
10
+ local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
11
+ local ____log = require("functions.log")
12
+ local logError = ____log.logError
13
+ local ____player = require("functions.player")
14
+ local useActiveItemTemp = ____player.useActiveItemTemp
15
+ local ____disableInputs = require("features.disableInputs")
16
+ local disableAllInputsExceptFor = ____disableInputs.disableAllInputsExceptFor
17
+ local enableAllInputs = ____disableInputs.enableAllInputs
18
+ local ____exports = require("features.saveDataManager.exports")
19
+ local saveDataManager = ____exports.saveDataManager
20
+ function postUpdate(self)
21
+ if not v.run.isPseudoPaused then
22
+ return
23
+ end
24
+ local player = Isaac.GetPlayer()
25
+ useActiveItemTemp(nil, player, CollectibleType.PAUSE)
26
+ end
27
+ function inputActionGetActionValue(self, _entity, _inputHook, buttonAction)
28
+ if buttonAction ~= ButtonAction.SHOOT_RIGHT then
29
+ return
30
+ end
31
+ if not v.run.shouldUnpause then
32
+ return
33
+ end
34
+ v.run.shouldUnpause = false
35
+ return 1
36
+ end
37
+ local FEATURE_NAME = "pause"
38
+ v = {run = {isPseudoPaused = false, shouldUnpause = false}}
39
+ ---
40
+ -- @internal
41
+ function ____exports.pauseInit(self, mod)
42
+ saveDataManager(nil, FEATURE_NAME, v)
43
+ mod:AddCallback(ModCallback.POST_UPDATE, postUpdate)
44
+ mod:AddCallback(ModCallback.INPUT_ACTION, inputActionGetActionValue, InputHook.GET_ACTION_VALUE)
45
+ end
46
+ --- Helper function to emulate what happens when the player pauses the game. Use the `unpause`
47
+ -- function to return things back to normal.
48
+ --
49
+ -- Under the hood, this function:
50
+ -- - uses the Pause collectible on every game frame
51
+ -- - disables any player inputs (except for `ButtonAction.MENU_CONFIRM`)
52
+ function ____exports.pause(self)
53
+ if v.run.isPseudoPaused then
54
+ logError("Failed to pseudo-pause the game, since it was already pseudo-paused.")
55
+ return
56
+ end
57
+ v.run.isPseudoPaused = true
58
+ local whitelist = __TS__New(Set, {ButtonAction.MENU_CONFIRM})
59
+ disableAllInputsExceptFor(nil, FEATURE_NAME, whitelist)
60
+ end
61
+ --- Helper function to put things back to normal after the `pause` function was used.
62
+ function ____exports.unpause(self)
63
+ if not v.run.isPseudoPaused then
64
+ logError("Failed to pseudo-unpause the game, since it was not already pseudo-paused.")
65
+ return
66
+ end
67
+ v.run.isPseudoPaused = false
68
+ enableAllInputs(nil, FEATURE_NAME)
69
+ v.run.shouldUnpause = true
70
+ end
71
+ return ____exports
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Supply a function to run on the next `POST_NEW_ROOM` callback.
3
+ *
4
+ * Note that this function will not handle saving and quitting. If a player saving and quitting
5
+ * before the deferred function fires would cause a bug in your mod, then you should handle deferred
6
+ * functions manually using serializable data.
7
+ */
8
+ export declare function runNextRoom(func: () => void): void;
@@ -0,0 +1,40 @@
1
+ local ____exports = {}
2
+ local postNewRoomReordered, v
3
+ local ____ModCallbackCustom = require("enums.ModCallbackCustom")
4
+ local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
5
+ local ____featuresInitialized = require("featuresInitialized")
6
+ local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
7
+ local ____array = require("functions.array")
8
+ local emptyArray = ____array.emptyArray
9
+ local ____exports = require("features.saveDataManager.exports")
10
+ local saveDataManager = ____exports.saveDataManager
11
+ function postNewRoomReordered(self)
12
+ for ____, func in ipairs(v.run.queuedFunctions) do
13
+ func(nil)
14
+ end
15
+ emptyArray(nil, v.run.queuedFunctions)
16
+ end
17
+ local FEATURE_NAME = "runNextRoom"
18
+ v = {run = {queuedFunctions = {}}}
19
+ ---
20
+ -- @internal
21
+ function ____exports.runNextRoomInit(self, mod)
22
+ saveDataManager(
23
+ nil,
24
+ FEATURE_NAME,
25
+ v,
26
+ function() return false end
27
+ )
28
+ mod:AddCallbackCustom(ModCallbackCustom.POST_NEW_ROOM_REORDERED, postNewRoomReordered)
29
+ end
30
+ --- Supply a function to run on the next `POST_NEW_ROOM` callback.
31
+ --
32
+ -- Note that this function will not handle saving and quitting. If a player saving and quitting
33
+ -- before the deferred function fires would cause a bug in your mod, then you should handle deferred
34
+ -- functions manually using serializable data.
35
+ function ____exports.runNextRoom(self, func)
36
+ errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
37
+ local ____v_run_queuedFunctions_0 = v.run.queuedFunctions
38
+ ____v_run_queuedFunctions_0[#____v_run_queuedFunctions_0 + 1] = func
39
+ end
40
+ return ____exports
@@ -1,7 +1,5 @@
1
1
  local ____exports = {}
2
2
  local getChargeBarClamp
3
- local ____constants = require("constants")
4
- local VectorZero = ____constants.VectorZero
5
3
  function getChargeBarClamp(self, charges, maxCharges)
6
4
  local meterMultiplier = 24 / maxCharges
7
5
  local meterClip = 26 - charges * meterMultiplier
@@ -37,11 +35,11 @@ end
37
35
  --- Helper function to render a charge bar on the screen. First, call the `newChargeBarSprites`
38
36
  -- function to initialize the sprites, and then call this function on every render frame.
39
37
  function ____exports.renderChargeBar(self, sprites, position, normalCharges, batteryCharges)
40
- sprites.back:Render(position, VectorZero, VectorZero)
38
+ sprites.back:Render(position)
41
39
  local normalChargesClamp = getChargeBarClamp(nil, normalCharges, sprites.maxCharges)
42
- sprites.meter:Render(position, normalChargesClamp, VectorZero)
40
+ sprites.meter:Render(position, normalChargesClamp)
43
41
  local batteryChargesClamp = getChargeBarClamp(nil, batteryCharges, sprites.maxCharges)
44
- sprites.meterBattery:Render(position, batteryChargesClamp, VectorZero)
45
- sprites.lines:Render(position, VectorZero, VectorZero)
42
+ sprites.meterBattery:Render(position, batteryChargesClamp)
43
+ sprites.lines:Render(position)
46
44
  end
47
45
  return ____exports
@@ -8,5 +8,5 @@ import { Direction } from "isaac-typescript-definitions";
8
8
  */
9
9
  export declare function angleToDirection(angleDegrees: int): Direction;
10
10
  export declare function directionToDegrees(direction: Direction): int;
11
- export declare function directionToVector(direction: Direction): Vector;
11
+ export declare function directionToVector(direction: Direction): Readonly<Vector>;
12
12
  export declare function getDirectionName(direction: Direction): string | undefined;
@@ -22,7 +22,7 @@ export declare function getDevilRoomOrAngelRoomDoor(): GridEntityDoor | undefine
22
22
  * they would immediately collide with the loading zone. Instead, they are offset by a certain
23
23
  * amount of units.
24
24
  */
25
- export declare function getDoorEnterPosition(door: GridEntityDoor): Vector;
25
+ export declare function getDoorEnterPosition(door: GridEntityDoor): Readonly<Vector>;
26
26
  /**
27
27
  * Helper function to get the offset from a door position that a player will enter a room at.
28
28
  *
@@ -30,7 +30,7 @@ export declare function getDoorEnterPosition(door: GridEntityDoor): Vector;
30
30
  * they would immediately collide with the loading zone. Instead, they are offset by a certain
31
31
  * amount of units.
32
32
  */
33
- export declare function getDoorSlotEnterPositionOffset(doorSlot: DoorSlot): Vector;
33
+ export declare function getDoorSlotEnterPositionOffset(doorSlot: DoorSlot): Readonly<Vector>;
34
34
  /**
35
35
  * Helper function to convert an array of door slots or a set of door slots to the resulting bit
36
36
  * flag number.
@@ -4,6 +4,9 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
4
4
  local Direction = ____isaac_2Dtypescript_2Ddefinitions.Direction
5
5
  local ____cachedClasses = require("cachedClasses")
6
6
  local game = ____cachedClasses.game
7
+ local ____constants = require("constants")
8
+ local NEW_FLOOR_STARTING_POSITION_GREED_MODE = ____constants.NEW_FLOOR_STARTING_POSITION_GREED_MODE
9
+ local NEW_FLOOR_STARTING_POSITION_NORMAL_MODE = ____constants.NEW_FLOOR_STARTING_POSITION_NORMAL_MODE
7
10
  local ____familiars = require("functions.familiars")
8
11
  local getPlayerFamiliars = ____familiars.getPlayerFamiliars
9
12
  local ____math = require("functions.math")
@@ -17,10 +20,6 @@ function movePlayerAndTheirFamiliars(self, player, position)
17
20
  familiar.Position = position
18
21
  end
19
22
  end
20
- --- This is in the center of the room.
21
- local NORMAL_MODE_NEW_FLOOR_STARTING_POSITION = Vector(320, 380)
22
- --- This is near the top door.
23
- local GREED_MODE_NEW_FLOOR_STARTING_POSITION = Vector(320, 280)
24
23
  local CIRCLE_RADIUS_BETWEEN_PLAYERS = 50
25
24
  --- Helper function to move all of the players to where they would normally go when arriving at a new
26
25
  -- floor. (In normal mode, this is the center of the room. In Greed Mode, this is below the top
@@ -31,7 +30,7 @@ local CIRCLE_RADIUS_BETWEEN_PLAYERS = 50
31
30
  -- This function emulates what happens in the vanilla game when you travel to a new floor.
32
31
  function ____exports.movePlayersToCenter(self)
33
32
  local isGreedMode = game:IsGreedMode()
34
- local startingPosition = isGreedMode and GREED_MODE_NEW_FLOOR_STARTING_POSITION or NORMAL_MODE_NEW_FLOOR_STARTING_POSITION
33
+ local startingPosition = isGreedMode and NEW_FLOOR_STARTING_POSITION_GREED_MODE or NEW_FLOOR_STARTING_POSITION_NORMAL_MODE
35
34
  local players = getPlayers(nil)
36
35
  local firstPlayer = players[1]
37
36
  if firstPlayer == nil then
@@ -44,6 +44,9 @@ export declare function getPlayerIndex(player: EntityPlayer, differentiateForgot
44
44
  /**
45
45
  * Helper function to return the index of this player with respect to the output of the
46
46
  * `Isaac.GetPlayer` method.
47
+ *
48
+ * Note that if you storing information about a player in a data structure, you never want to use
49
+ * this index; use the `getPlayerIndex` function instead.
47
50
  */
48
51
  export declare function getPlayerIndexVanilla(playerToFind: EntityPlayer): int | undefined;
49
52
  /**
@@ -155,6 +155,9 @@ function ____exports.getPlayerFromIndex(self, playerIndex)
155
155
  end
156
156
  --- Helper function to return the index of this player with respect to the output of the
157
157
  -- `Isaac.GetPlayer` method.
158
+ --
159
+ -- Note that if you storing information about a player in a data structure, you never want to use
160
+ -- this index; use the `getPlayerIndex` function instead.
158
161
  function ____exports.getPlayerIndexVanilla(self, playerToFind)
159
162
  local numPlayers = game:GetNumPlayers()
160
163
  local playerToFindHash = GetPtrHash(playerToFind)
@@ -1,4 +1,5 @@
1
1
  import { DoorSlot, RoomShape } from "isaac-typescript-definitions";
2
+ import { Corner } from "../interfaces/Corner";
2
3
  /**
3
4
  * Helper function to get the grid index delta that a door out of the given room shape would lead
4
5
  * to. For example, if you went through the bottom door in a room of `RoomShape.SHAPE_1x2`, you
@@ -12,7 +13,7 @@ export declare function getGridIndexDelta(roomShape: RoomShape, doorSlot: DoorSl
12
13
  *
13
14
  * For example, `RoomShape.SHAPE_2x2` will return 2.
14
15
  */
15
- export declare function getRoomShapeBottomRightPosition(roomShape: RoomShape): Vector;
16
+ export declare function getRoomShapeBottomRightPosition(roomShape: RoomShape): Readonly<Vector>;
16
17
  /**
17
18
  * Helper function to get the grid position of the bottom-right tile of a given room shape.
18
19
  *
@@ -21,10 +22,14 @@ export declare function getRoomShapeBottomRightPosition(roomShape: RoomShape): V
21
22
  */
22
23
  export declare function getRoomShapeBounds(roomShape: RoomShape): readonly [width: int, height: int];
23
24
  /**
24
- * Helper function to get the bounds of a room shape, which are a box representing its contents.
25
- * This does not include the tiles that the walls are on. L rooms use the same bounds as a 2x2 room.
25
+ * Helper function to get the number of charges that a given room shape will grant to a player upon
26
+ * clearing it.
27
+ *
28
+ * For example, `RoomShape.SHAPE_2x2` will return 2.
26
29
  */
27
30
  export declare function getRoomShapeCharges(roomShape: RoomShape): int;
31
+ /** Helper function to get the corners that exist in the given room shape. */
32
+ export declare function getRoomShapeCorners(roomShape: RoomShape): readonly Corner[];
28
33
  /**
29
34
  * Helper function to get the dimensions of a room shape's layout. This is NOT the size of the
30
35
  * room's actual contents! For that, use the `getRoomShapeBounds` function.
@@ -38,7 +43,7 @@ export declare function getRoomShapeLayoutSize(roomShape: RoomShape): readonly [
38
43
  * "Vector(0, 0)" corresponds to the top left tile of a room, not including the walls. (The top-left
39
44
  * wall would be at "Vector(-1, -1)".)
40
45
  */
41
- export declare function getRoomShapeTopLeftPosition(roomShape: RoomShape): Vector;
46
+ export declare function getRoomShapeTopLeftPosition(roomShape: RoomShape): Readonly<Vector>;
42
47
  /**
43
48
  * Helper function to get the volume of a room shape, which is the amount of tiles that are inside
44
49
  * the room.
@@ -48,6 +53,7 @@ export declare function getRoomShapeTopLeftPosition(roomShape: RoomShape): Vecto
48
53
  export declare function getRoomShapeVolume(roomShape: RoomShape): int;
49
54
  export declare function getRoomShapeWidth(roomShape: RoomShape): int;
50
55
  export declare function isLRoom(roomShape: RoomShape): boolean;
56
+ export declare function isNarrowRoom(roomShape: RoomShape): boolean;
51
57
  /**
52
58
  * Helper function to see if a given room shape will grant a single charge or a double charge to the
53
59
  * player's active item(s).
@@ -5,6 +5,8 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
5
5
  local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
6
6
  local ____roomShapeBounds = require("objects.roomShapeBounds")
7
7
  local ROOM_SHAPE_BOUNDS = ____roomShapeBounds.ROOM_SHAPE_BOUNDS
8
+ local ____roomShapeCorners = require("objects.roomShapeCorners")
9
+ local ROOM_SHAPE_CORNERS = ____roomShapeCorners.ROOM_SHAPE_CORNERS
8
10
  local ____roomShapeLayoutSizes = require("objects.roomShapeLayoutSizes")
9
11
  local ROOM_SHAPE_LAYOUT_SIZES = ____roomShapeLayoutSizes.ROOM_SHAPE_LAYOUT_SIZES
10
12
  local ____roomShapeToBottomRightPosition = require("objects.roomShapeToBottomRightPosition")
@@ -19,6 +21,8 @@ local ____roomShapeVolumes = require("objects.roomShapeVolumes")
19
21
  local ROOM_SHAPE_VOLUMES = ____roomShapeVolumes.ROOM_SHAPE_VOLUMES
20
22
  local ____LRoomShapesSet = require("sets.LRoomShapesSet")
21
23
  local L_ROOM_SHAPES_SET = ____LRoomShapesSet.L_ROOM_SHAPES_SET
24
+ local ____narrowRoomShapesSet = require("sets.narrowRoomShapesSet")
25
+ local NARROW_ROOM_SHAPES_SET = ____narrowRoomShapesSet.NARROW_ROOM_SHAPES_SET
22
26
  --- Helper function to see if a given room shape will grant a single charge or a double charge to the
23
27
  -- player's active item(s).
24
28
  --
@@ -48,11 +52,17 @@ end
48
52
  function ____exports.getRoomShapeBounds(self, roomShape)
49
53
  return ROOM_SHAPE_BOUNDS[roomShape]
50
54
  end
51
- --- Helper function to get the bounds of a room shape, which are a box representing its contents.
52
- -- This does not include the tiles that the walls are on. L rooms use the same bounds as a 2x2 room.
55
+ --- Helper function to get the number of charges that a given room shape will grant to a player upon
56
+ -- clearing it.
57
+ --
58
+ -- For example, `RoomShape.SHAPE_2x2` will return 2.
53
59
  function ____exports.getRoomShapeCharges(self, roomShape)
54
60
  return ____exports.isRoomShapeDoubleCharge(nil, roomShape) and 2 or 1
55
61
  end
62
+ --- Helper function to get the corners that exist in the given room shape.
63
+ function ____exports.getRoomShapeCorners(self, roomShape)
64
+ return ROOM_SHAPE_CORNERS[roomShape]
65
+ end
56
66
  --- Helper function to get the dimensions of a room shape's layout. This is NOT the size of the
57
67
  -- room's actual contents! For that, use the `getRoomShapeBounds` function.
58
68
  --
@@ -80,4 +90,7 @@ end
80
90
  function ____exports.isLRoom(self, roomShape)
81
91
  return L_ROOM_SHAPES_SET:has(roomShape)
82
92
  end
93
+ function ____exports.isNarrowRoom(self, roomShape)
94
+ return NARROW_ROOM_SHAPES_SET:has(roomShape)
95
+ end
83
96
  return ____exports
@@ -2,7 +2,7 @@
2
2
  /// <reference types="isaac-typescript-definitions" />
3
3
  /// <reference types="isaac-typescript-definitions" />
4
4
  /**
5
- * Helper function to clear a specific layer from a sprite.
5
+ * Helper function to clear all layers or specific layers from a sprite.
6
6
  *
7
7
  * This function is variadic, so pass as many layer IDs as you want to clear. If no specific layers
8
8
  * are passed, it will clear every layer.
@@ -12,7 +12,7 @@ function ____exports.texelEquals(self, sprite1, sprite2, position, layerID)
12
12
  local kColor2 = sprite2:GetTexel(position, VectorZero, 1, layerID)
13
13
  return kColorEquals(nil, kColor1, kColor2)
14
14
  end
15
- --- Helper function to clear a specific layer from a sprite.
15
+ --- Helper function to clear all layers or specific layers from a sprite.
16
16
  --
17
17
  -- This function is variadic, so pass as many layer IDs as you want to clear. If no specific layers
18
18
  -- are passed, it will clear every layer.
package/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export * from "./cachedClasses";
2
2
  export { initCustomDoor, spawnCustomDoor, } from "./callbacks/postCustomDoorEnter";
3
- export { forceNewLevelCallback, forceNewRoomCallback, } from "./callbacks/reorderedCallbacks";
3
+ export { forceNewLevelCallback, forceNewRoomCallback, reorderedCallbacksSetStage, } from "./callbacks/reorderedCallbacks";
4
4
  export * from "./classes/DefaultMap";
5
5
  export * from "./classes/ModUpgraded";
6
6
  export * from "./constants";
package/index.lua CHANGED
@@ -18,8 +18,10 @@ do
18
18
  local ____reorderedCallbacks = require("callbacks.reorderedCallbacks")
19
19
  local forceNewLevelCallback = ____reorderedCallbacks.forceNewLevelCallback
20
20
  local forceNewRoomCallback = ____reorderedCallbacks.forceNewRoomCallback
21
+ local reorderedCallbacksSetStage = ____reorderedCallbacks.reorderedCallbacksSetStage
21
22
  ____exports.forceNewLevelCallback = forceNewLevelCallback
22
23
  ____exports.forceNewRoomCallback = forceNewRoomCallback
24
+ ____exports.reorderedCallbacksSetStage = reorderedCallbacksSetStage
23
25
  end
24
26
  do
25
27
  local ____export = require("classes.DefaultMap")
package/initFeatures.lua CHANGED
@@ -21,6 +21,8 @@ local ____fastReset = require("features.fastReset")
21
21
  local fastResetInit = ____fastReset.fastResetInit
22
22
  local ____forgottenSwitch = require("features.forgottenSwitch")
23
23
  local forgottenSwitchInit = ____forgottenSwitch.forgottenSwitchInit
24
+ local ____pause = require("features.pause")
25
+ local pauseInit = ____pause.pauseInit
24
26
  local ____persistentEntities = require("features.persistentEntities")
25
27
  local persistentEntitiesInit = ____persistentEntities.persistentEntitiesInit
26
28
  local ____playerInventory = require("features.playerInventory")
@@ -35,6 +37,8 @@ local ____roomClearFrame = require("features.roomClearFrame")
35
37
  local roomClearFrameInit = ____roomClearFrame.roomClearFrameInit
36
38
  local ____runInNFrames = require("features.runInNFrames")
37
39
  local runInNFramesInit = ____runInNFrames.runInNFramesInit
40
+ local ____runNextRoom = require("features.runNextRoom")
41
+ local runNextRoomInit = ____runNextRoom.runNextRoomInit
38
42
  local ____sirenHelpers = require("features.sirenHelpers")
39
43
  local sirenHelpersInit = ____sirenHelpers.sirenHelpersInit
40
44
  local ____stageHistory = require("features.stageHistory")
@@ -42,7 +46,7 @@ local stageHistoryInit = ____stageHistory.stageHistoryInit
42
46
  local ____taintedLazarusPlayers = require("features.taintedLazarusPlayers")
43
47
  local taintedLazarusPlayersInit = ____taintedLazarusPlayers.taintedLazarusPlayersInit
44
48
  function ____exports.initFeaturesMajor(self, mod)
45
- customStageInit(nil)
49
+ customStageInit(nil, mod)
46
50
  deployJSONRoomInit(nil, mod)
47
51
  runInNFramesInit(nil, mod)
48
52
  characterStatsInit(nil, mod)
@@ -56,12 +60,14 @@ function ____exports.initFeaturesMinor(self, mod)
56
60
  fastResetInit(nil, mod)
57
61
  forgottenSwitchInit(nil, mod)
58
62
  collectibleItemPoolTypeInit(nil, mod)
63
+ pauseInit(nil, mod)
59
64
  persistentEntitiesInit(nil, mod)
60
65
  playerInventoryInit(nil, mod)
61
66
  ponyDetectionInit(nil, mod)
62
67
  preventCollectibleRotationInit(nil, mod)
63
68
  registerHotkeyInit(nil, mod)
64
69
  roomClearFrameInit(nil, mod)
70
+ runNextRoomInit(nil, mod)
65
71
  sirenHelpersInit(nil, mod)
66
72
  stageHistoryInit(nil, mod)
67
73
  taintedLazarusPlayersInit(nil, mod)
@@ -0,0 +1,6 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ import { CornerType } from "../enums/CornerType";
3
+ export interface Corner {
4
+ readonly type: CornerType;
5
+ readonly position: Readonly<Vector>;
6
+ }
@@ -0,0 +1,2 @@
1
+ local ____exports = {}
2
+ return ____exports