isaacscript-common 1.2.149 → 1.2.152

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 (54) hide show
  1. package/dist/callbacks/customRevive.lua +23 -3
  2. package/dist/callbacks/postCustomDoorEnter.d.ts +27 -3
  3. package/dist/callbacks/postCustomDoorEnter.lua +75 -6
  4. package/dist/callbacks/postPurchase.lua +5 -3
  5. package/dist/features/extraConsoleCommands/commands.lua +4 -4
  6. package/dist/features/isPonyActive.lua +5 -3
  7. package/dist/features/runInNFrames.d.ts +2 -2
  8. package/dist/features/runInNFrames.lua +7 -7
  9. package/dist/features/saveDataManager/load.lua +2 -2
  10. package/dist/functions/cards.lua +12 -12
  11. package/dist/functions/challenges.lua +4 -4
  12. package/dist/functions/doors.d.ts +1 -0
  13. package/dist/functions/doors.lua +7 -2
  14. package/dist/functions/log.lua +4 -0
  15. package/dist/functions/math.lua +4 -44
  16. package/dist/functions/pills.lua +12 -12
  17. package/dist/functions/player.lua +4 -4
  18. package/dist/functions/stage.lua +3 -46
  19. package/dist/functions/transformations.lua +4 -4
  20. package/dist/functions/vector.lua +3 -40
  21. package/dist/index.d.ts +1 -20
  22. package/dist/index.lua +2 -152
  23. package/dist/objects/callbackRegisterFunctions.d.ts +4 -0
  24. package/dist/objects/callbackRegisterFunctions.lua +160 -0
  25. package/dist/objects/cardDescriptions.d.ts +5 -0
  26. package/dist/objects/cardDescriptions.lua +106 -0
  27. package/dist/objects/cardNames.d.ts +5 -0
  28. package/dist/objects/cardNames.lua +106 -0
  29. package/dist/objects/cardTypes.d.ts +6 -0
  30. package/dist/objects/cardTypes.lua +108 -0
  31. package/dist/objects/challengeNames.d.ts +5 -0
  32. package/dist/objects/challengeNames.lua +53 -0
  33. package/dist/objects/characterNames.d.ts +5 -0
  34. package/dist/objects/characterNames.lua +49 -0
  35. package/dist/objects/directionToVector.d.ts +4 -0
  36. package/dist/objects/directionToVector.lua +10 -0
  37. package/dist/objects/doorSlotToDirection.d.ts +4 -0
  38. package/dist/objects/doorSlotToDirection.lua +15 -0
  39. package/dist/objects/pillEffectClasses.d.ts +6 -0
  40. package/dist/objects/pillEffectClasses.lua +61 -0
  41. package/dist/objects/pillEffectNames.d.ts +5 -0
  42. package/dist/objects/pillEffectNames.lua +58 -0
  43. package/dist/objects/pillEffectTypes.d.ts +6 -0
  44. package/dist/objects/pillEffectTypes.lua +60 -0
  45. package/dist/objects/roomTypeNames.d.ts +5 -0
  46. package/dist/objects/roomTypeNames.lua +37 -0
  47. package/dist/objects/stageTypeToLetter.d.ts +4 -0
  48. package/dist/objects/stageTypeToLetter.lua +11 -0
  49. package/dist/objects/transformationNames.d.ts +5 -0
  50. package/dist/objects/transformationNames.lua +22 -0
  51. package/dist/types/ModUpgraded.d.ts +2 -2
  52. package/dist/types/ModUpgraded.lua +5 -425
  53. package/dist/upgradeMod.lua +1 -1
  54. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____exports = {}
3
- local hasSubscriptions, postRender, postPEffectUpdateReordered, checkWaitingForItemAnimation, postPlayerFatalDamage, preBerserkDeath, playerIsAboutToDie, CustomReviveState, v
3
+ local hasSubscriptions, postRender, postNewRoom, postPEffectUpdateReordered, checkWaitingForItemAnimation, postPlayerFatalDamage, preBerserkDeath, playerIsAboutToDie, logStateChanged, DEBUG, CustomReviveState, v
4
4
  local ____cachedClasses = require("cachedClasses")
5
5
  local sfxManager = ____cachedClasses.sfxManager
6
6
  local ____runInNFrames = require("features.runInNFrames")
@@ -11,6 +11,8 @@ local ____collectibles = require("functions.collectibles")
11
11
  local removeCollectibleFromItemTracker = ____collectibles.removeCollectibleFromItemTracker
12
12
  local ____familiars = require("functions.familiars")
13
13
  local removeAllFamiliars = ____familiars.removeAllFamiliars
14
+ local ____log = require("functions.log")
15
+ local log = ____log.log
14
16
  local ____player = require("functions.player")
15
17
  local getPlayerFromIndex = ____player.getPlayerFromIndex
16
18
  local getPlayerIndex = ____player.getPlayerIndex
@@ -31,6 +33,13 @@ function postRender(self)
31
33
  end
32
34
  sfxManager:Stop(SoundEffect.SOUND_1UP)
33
35
  end
36
+ function postNewRoom(self)
37
+ if v.run.state ~= CustomReviveState.WAITING_FOR_ROOM_TRANSITION then
38
+ return
39
+ end
40
+ v.run.state = CustomReviveState.WAITING_FOR_ITEM_ANIMATION
41
+ logStateChanged(nil)
42
+ end
34
43
  function postPEffectUpdateReordered(self, player)
35
44
  checkWaitingForItemAnimation(nil, player)
36
45
  end
@@ -62,6 +71,7 @@ function checkWaitingForItemAnimation(self, player)
62
71
  v.run.state = CustomReviveState.DISABLED
63
72
  v.run.revivalType = nil
64
73
  v.run.dyingPlayerIndex = nil
74
+ logStateChanged(nil)
65
75
  end
66
76
  function postPlayerFatalDamage(self, player)
67
77
  if not hasSubscriptions(nil) then
@@ -80,9 +90,10 @@ function playerIsAboutToDie(self, player)
80
90
  if revivalType == nil then
81
91
  return
82
92
  end
83
- v.run.state = CustomReviveState.WAITING_FOR_ITEM_ANIMATION
93
+ v.run.state = CustomReviveState.WAITING_FOR_ROOM_TRANSITION
84
94
  v.run.revivalType = revivalType
85
95
  v.run.dyingPlayerIndex = getPlayerIndex(nil, player)
96
+ logStateChanged(nil)
86
97
  player:AddCollectible(CollectibleType.COLLECTIBLE_1UP, 0, false)
87
98
  removeAllFamiliars(nil, FamiliarVariant.ONE_UP)
88
99
  removeCollectibleFromItemTracker(nil, CollectibleType.COLLECTIBLE_1UP)
@@ -108,15 +119,24 @@ function playerIsAboutToDie(self, player)
108
119
  end
109
120
  )
110
121
  end
122
+ function logStateChanged(self)
123
+ if DEBUG then
124
+ log(((("Custom revive state changed: " .. CustomReviveState[v.run.state]) .. " (") .. tostring(v.run.state)) .. ")")
125
+ end
126
+ end
127
+ DEBUG = false
111
128
  CustomReviveState = CustomReviveState or ({})
112
129
  CustomReviveState.DISABLED = 0
113
130
  CustomReviveState[CustomReviveState.DISABLED] = "DISABLED"
114
- CustomReviveState.WAITING_FOR_ITEM_ANIMATION = 1
131
+ CustomReviveState.WAITING_FOR_ROOM_TRANSITION = 1
132
+ CustomReviveState[CustomReviveState.WAITING_FOR_ROOM_TRANSITION] = "WAITING_FOR_ROOM_TRANSITION"
133
+ CustomReviveState.WAITING_FOR_ITEM_ANIMATION = 2
115
134
  CustomReviveState[CustomReviveState.WAITING_FOR_ITEM_ANIMATION] = "WAITING_FOR_ITEM_ANIMATION"
116
135
  v = {run = {state = CustomReviveState.DISABLED, revivalType = nil, dyingPlayerIndex = nil}}
117
136
  function ____exports.customReviveCallbacksInit(self, mod)
118
137
  saveDataManager(nil, "customRevive", v, hasSubscriptions)
119
138
  mod:AddCallback(ModCallbacks.MC_POST_RENDER, postRender)
139
+ mod:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, postNewRoom)
120
140
  mod:AddCallbackCustom(ModCallbacksCustom.MC_POST_PEFFECT_UPDATE_REORDERED, postPEffectUpdateReordered)
121
141
  mod:AddCallbackCustom(ModCallbacksCustom.MC_POST_PLAYER_FATAL_DAMAGE, postPlayerFatalDamage)
122
142
  mod:AddCallbackCustom(ModCallbacksCustom.MC_PRE_BERSERK_DEATH, preBerserkDeath)
@@ -1,8 +1,32 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  /**
3
- * Helper function to spawn a custom muting all sound effects and music.
3
+ * `isaacscript-common` provides custom doors that can be spawned where any wall segment is. If you
4
+ * use this feature, you must first call this initialization function at the beginning of your mod.
4
5
  *
5
- * Use this function to set things back to normal after having used [[`disableAllSounds`]].
6
+ * Each kind of custom door that you create must have an entry in the "content/entities2.xml" file,
7
+ * like so:
6
8
  *
9
+ * ```xml
10
+ * <entity id="1000" name="Foo Custom Door" anm2path="grid/door_foo.anm2" />
11
+ * ```
12
+ *
13
+ * (Custom door entities must have an id of "1000", which corresponds to an effect. If you do not
14
+ * specify the variant, then the game will automatically assign it.)
15
+ *
16
+ * Next, pass the variant into this function:
17
+ *
18
+ * ```ts
19
+ * const modVanilla = RegisterMod("My Mod", 1);
20
+ * const mod = upgradeMod(modVanilla);
21
+ * const fooEffectVariant = Isaac.GetEntityVariantByName("Foo Custom Door");
22
+ * initCustomDoor(mod, fooEffectVariant);
23
+ * ```
24
+ */
25
+ export declare function initCustomDoor(mod: Mod, effectVariant: int): void;
26
+ /**
27
+ * Helper function to spawn a custom door. Handle when a player enters the door by hooking the
28
+ * custom `MC_POST_CUSTOM_DOOR_ENTER` callback.
29
+ *
30
+ * Before using this function, you must first initialize it with the `initCustomDoor` function.
7
31
  */
8
- export declare function spawnCustomDoor(_customDoorType: int, _anm2: string, _slot: DoorSlot): void;
32
+ export declare function spawnCustomDoor(effectVariant: int, doorSlot: DoorSlot): void;
@@ -2,19 +2,25 @@
2
2
  local ____lualib = require("lualib_bundle")
3
3
  local Set = ____lualib.Set
4
4
  local __TS__New = ____lualib.__TS__New
5
+ local Map = ____lualib.Map
5
6
  local ____exports = {}
6
- local hasSubscriptions, postRender
7
+ local hasSubscriptions, postEffectRenderCustomEntity, getPositionOffset, getAnimation, POSITION_OFFSET_MULTIPLIER
8
+ local ____cachedClasses = require("cachedClasses")
9
+ local game = ____cachedClasses.game
7
10
  local ____exports = require("features.saveDataManager.exports")
8
11
  local saveDataManager = ____exports.saveDataManager
9
12
  local ____doors = require("functions.doors")
13
+ local doorSlotToDirection = ____doors.doorSlotToDirection
10
14
  local getDoors = ____doors.getDoors
15
+ local ____vector = require("functions.vector")
16
+ local directionToVector = ____vector.directionToVector
11
17
  local ____postCustomDoorEnter = require("callbacks.subscriptions.postCustomDoorEnter")
12
18
  local postCustomDoorEnterFire = ____postCustomDoorEnter.postCustomDoorEnterFire
13
19
  local postCustomDoorEnterHasSubscriptions = ____postCustomDoorEnter.postCustomDoorEnterHasSubscriptions
14
20
  function hasSubscriptions(self)
15
21
  return postCustomDoorEnterHasSubscriptions(nil)
16
22
  end
17
- function postRender(self)
23
+ function postEffectRenderCustomEntity(self)
18
24
  if not hasSubscriptions(nil) then
19
25
  return
20
26
  end
@@ -25,11 +31,74 @@ function postRender(self)
25
31
  local door = doors[1]
26
32
  postCustomDoorEnterFire(nil, door)
27
33
  end
28
- local v = {run = {disableSoundSet = __TS__New(Set)}}
29
- function ____exports.postCustomDoorEnterCallbackInit(self, mod)
34
+ function getPositionOffset(self, doorSlot)
35
+ local direction = doorSlotToDirection(nil, doorSlot)
36
+ local vector = directionToVector(nil, direction)
37
+ return vector * POSITION_OFFSET_MULTIPLIER
38
+ end
39
+ function getAnimation(self, effect)
40
+ repeat
41
+ local ____switch15 = effect.State
42
+ local ____cond15 = ____switch15 == DoorState.STATE_OPEN
43
+ if ____cond15 then
44
+ do
45
+ return "Opened"
46
+ end
47
+ end
48
+ ____cond15 = ____cond15 or ____switch15 == DoorState.STATE_CLOSED
49
+ if ____cond15 then
50
+ do
51
+ return "Closed"
52
+ end
53
+ end
54
+ do
55
+ do
56
+ return "Opened"
57
+ end
58
+ end
59
+ until true
60
+ end
61
+ POSITION_OFFSET_MULTIPLIER = 23
62
+ local initializedEffectVariants = __TS__New(Set)
63
+ local v = {room = {doors = __TS__New(Map)}}
64
+ function ____exports.postCustomDoorEnterCallbackInit(self)
30
65
  saveDataManager(nil, "postCustomDoorEnter", v, hasSubscriptions)
31
- mod:AddCallback(ModCallbacks.MC_POST_RENDER, postRender)
32
66
  end
33
- function ____exports.spawnCustomDoor(self, _customDoorType, _anm2, _slot)
67
+ function ____exports.initCustomDoor(self, mod, effectVariant)
68
+ initializedEffectVariants:add(effectVariant)
69
+ mod:AddCallback(ModCallbacks.MC_POST_EFFECT_RENDER, postEffectRenderCustomEntity, effectVariant)
70
+ end
71
+ function ____exports.spawnCustomDoor(self, effectVariant, doorSlot)
72
+ if not initializedEffectVariants:has(effectVariant) then
73
+ error("In order to spawn custom doors, you must first initialize them with the \"initCustomDoor\" function at the beginning of your mod.")
74
+ end
75
+ local room = game:GetRoom()
76
+ local roomClear = room:IsClear()
77
+ local position = room:GetDoorSlotPosition(doorSlot)
78
+ local effect = Isaac.Spawn(
79
+ EntityType.ENTITY_EFFECT,
80
+ effectVariant,
81
+ 0,
82
+ position,
83
+ Vector.Zero,
84
+ nil
85
+ ):ToEffect()
86
+ if effect == nil then
87
+ error("Failed to spawn a custom door with variant: " .. tostring(effectVariant))
88
+ end
89
+ effect.State = roomClear and DoorState.STATE_OPEN or DoorState.STATE_CLOSED
90
+ effect.RenderZOffset = -10000
91
+ effect.PositionOffset = getPositionOffset(nil, doorSlot)
92
+ local sprite = effect:GetSprite()
93
+ local animation = getAnimation(nil, effect)
94
+ sprite:Play(animation, true)
95
+ sprite.Rotation = doorSlot * 90 - 90
96
+ if effect.State == DoorState.STATE_OPEN then
97
+ local gridIndex = room:GetGridIndex(position)
98
+ local wall = room:GetGridEntity(gridIndex)
99
+ if wall ~= nil then
100
+ wall.CollisionClass = GridCollisionClass.COLLISION_WALL_EXCEPT_PLAYER
101
+ end
102
+ end
34
103
  end
35
104
  return ____exports
@@ -3,7 +3,7 @@ local ____lualib = require("lualib_bundle")
3
3
  local __TS__New = ____lualib.__TS__New
4
4
  local __TS__ArrayFind = ____lualib.__TS__ArrayFind
5
5
  local ____exports = {}
6
- local hasSubscriptions, postPEffectUpdate, playerPickedUpNewItem, v
6
+ local hasSubscriptions, postPEffectUpdateReordered, playerPickedUpNewItem, v
7
7
  local ____exports = require("features.saveDataManager.exports")
8
8
  local saveDataManager = ____exports.saveDataManager
9
9
  local ____pickups = require("functions.pickups")
@@ -13,13 +13,15 @@ local defaultMapGetPlayer = ____playerDataStructures.defaultMapGetPlayer
13
13
  local mapSetPlayer = ____playerDataStructures.mapSetPlayer
14
14
  local ____DefaultMap = require("types.DefaultMap")
15
15
  local DefaultMap = ____DefaultMap.DefaultMap
16
+ local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
17
+ local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
16
18
  local ____postPurchase = require("callbacks.subscriptions.postPurchase")
17
19
  local postPurchaseFire = ____postPurchase.postPurchaseFire
18
20
  local postPurchaseHasSubscriptions = ____postPurchase.postPurchaseHasSubscriptions
19
21
  function hasSubscriptions(self)
20
22
  return postPurchaseHasSubscriptions(nil)
21
23
  end
22
- function postPEffectUpdate(self, player)
24
+ function postPEffectUpdateReordered(self, player)
23
25
  if not hasSubscriptions(nil) then
24
26
  return
25
27
  end
@@ -43,6 +45,6 @@ end
43
45
  v = {room = {playersHoldingItemOnLastFrameMap = __TS__New(DefaultMap, false)}}
44
46
  function ____exports.postPurchaseCallbackInit(self, mod)
45
47
  saveDataManager(nil, "postPurchase", v, hasSubscriptions)
46
- mod:AddCallback(ModCallbacks.MC_POST_PEFFECT_UPDATE, postPEffectUpdate)
48
+ mod:AddCallbackCustom(ModCallbacksCustom.MC_POST_PEFFECT_UPDATE_REORDERED, postPEffectUpdateReordered)
47
49
  end
48
50
  return ____exports
@@ -53,9 +53,9 @@ local ____pillEffectMap = require("maps.pillEffectMap")
53
53
  local PILL_EFFECT_MAP = ____pillEffectMap.PILL_EFFECT_MAP
54
54
  local ____roomTypeMap = require("maps.roomTypeMap")
55
55
  local ROOM_TYPE_MAP = ____roomTypeMap.ROOM_TYPE_MAP
56
- local ____roomTypeNameMap = require("maps.roomTypeNameMap")
57
- local DEFAULT_ROOM_TYPE_NAME = ____roomTypeNameMap.DEFAULT_ROOM_TYPE_NAME
58
- local ROOM_TYPE_NAME_MAP = ____roomTypeNameMap.ROOM_TYPE_NAME_MAP
56
+ local ____roomTypeNames = require("objects.roomTypeNames")
57
+ local DEFAULT_ROOM_TYPE_NAME = ____roomTypeNames.DEFAULT_ROOM_TYPE_NAME
58
+ local ROOM_TYPE_NAMES = ____roomTypeNames.ROOM_TYPE_NAMES
59
59
  local ____HealthType = require("types.HealthType")
60
60
  local HealthType = ____HealthType.HealthType
61
61
  local ____v = require("features.extraConsoleCommands.v")
@@ -182,7 +182,7 @@ function spawnTrapdoorOrCrawlspace(self, trapdoor)
182
182
  spawnGridEntityWithVariant(nil, gridEntityType, 0, gridIndex)
183
183
  end
184
184
  function warpToRoomType(self, roomType)
185
- local roomTypeName = ROOM_TYPE_NAME_MAP[roomType]
185
+ local roomTypeName = ROOM_TYPE_NAMES[roomType]
186
186
  if roomTypeName == nil or roomTypeName == DEFAULT_ROOM_TYPE_NAME then
187
187
  printConsole(
188
188
  nil,
@@ -3,7 +3,7 @@ local ____lualib = require("lualib_bundle")
3
3
  local Set = ____lualib.Set
4
4
  local __TS__New = ____lualib.__TS__New
5
5
  local ____exports = {}
6
- local postPEffectUpdate, FLAGS_WHEN_PONY_IS_ACTIVE, v
6
+ local postPEffectUpdateReordered, FLAGS_WHEN_PONY_IS_ACTIVE, v
7
7
  local ____featuresInitialized = require("featuresInitialized")
8
8
  local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
9
9
  local ____flag = require("functions.flag")
@@ -12,9 +12,11 @@ local ____playerDataStructures = require("functions.playerDataStructures")
12
12
  local setAddPlayer = ____playerDataStructures.setAddPlayer
13
13
  local setDeletePlayer = ____playerDataStructures.setDeletePlayer
14
14
  local setHasPlayer = ____playerDataStructures.setHasPlayer
15
+ local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
16
+ local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
15
17
  local ____exports = require("features.saveDataManager.exports")
16
18
  local saveDataManager = ____exports.saveDataManager
17
- function postPEffectUpdate(self, player)
19
+ function postPEffectUpdateReordered(self, player)
18
20
  local effects = player:GetEffects()
19
21
  local entityFlags = player:GetEntityFlags()
20
22
  local hasPonyCollectibleEffect = effects:HasCollectibleEffect(CollectibleType.COLLECTIBLE_PONY) or effects:HasCollectibleEffect(CollectibleType.COLLECTIBLE_WHITE_PONY)
@@ -36,7 +38,7 @@ FLAGS_WHEN_PONY_IS_ACTIVE = {EntityFlag.FLAG_NO_KNOCKBACK, EntityFlag.FLAG_NO_PH
36
38
  v = {run = {playersIsPonyActive = __TS__New(Set)}}
37
39
  function ____exports.isPonyActiveInit(self, mod)
38
40
  saveDataManager(nil, "isPonyActive", v)
39
- mod:AddCallback(ModCallbacks.MC_POST_PEFFECT_UPDATE, postPEffectUpdate)
41
+ mod:AddCallbackCustom(ModCallbacksCustom.MC_POST_PEFFECT_UPDATE_REORDERED, postPEffectUpdateReordered)
40
42
  end
41
43
  function ____exports.isPonyActive(self, player)
42
44
  errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
@@ -9,7 +9,7 @@
9
9
  * before the deferred function fires would cause a bug in your mod, then you should handle deferred
10
10
  * functions manually using serializable data.
11
11
  */
12
- export declare function runInNGameFrames(func: () => void, frames: int): void;
12
+ export declare function runInNGameFrames(func: () => void, gameFrames: int): void;
13
13
  /**
14
14
  * Supply a function to run N render frames from now in the PostRender callback.
15
15
  *
@@ -20,7 +20,7 @@ export declare function runInNGameFrames(func: () => void, frames: int): void;
20
20
  * before the deferred function fires would cause a bug in your mod, then you should handle deferred
21
21
  * functions manually using serializable data.
22
22
  */
23
- export declare function runInNRenderFrames(func: () => void, frames: int): void;
23
+ export declare function runInNRenderFrames(func: () => void, renderFrames: int): void;
24
24
  /**
25
25
  * Supply a function to run on the next PostUpdate callback.
26
26
  *
@@ -16,8 +16,8 @@ function postUpdate(self)
16
16
  checkExecuteQueuedFunctions(nil, gameFrameCount, v.run.queuedGameFunctionTuples)
17
17
  end
18
18
  function postRender(self)
19
- local isaacFrameCount = Isaac.GetFrameCount()
20
- checkExecuteQueuedFunctions(nil, isaacFrameCount, v.run.queuedRenderFunctionTuples)
19
+ local renderFrameCount = Isaac.GetFrameCount()
20
+ checkExecuteQueuedFunctions(nil, renderFrameCount, v.run.queuedRenderFunctionTuples)
21
21
  end
22
22
  function checkExecuteQueuedFunctions(self, frameCount, functionTuples)
23
23
  local functionsToFire = {}
@@ -46,17 +46,17 @@ function ____exports.runInNFramesInit(self, mod)
46
46
  mod:AddCallback(ModCallbacks.MC_POST_UPDATE, postUpdate)
47
47
  mod:AddCallback(ModCallbacks.MC_POST_RENDER, postRender)
48
48
  end
49
- function ____exports.runInNGameFrames(self, func, frames)
49
+ function ____exports.runInNGameFrames(self, func, gameFrames)
50
50
  errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
51
51
  local gameFrameCount = game:GetFrameCount()
52
- local functionFireFrame = gameFrameCount + frames
52
+ local functionFireFrame = gameFrameCount + gameFrames
53
53
  local tuple = {functionFireFrame, func}
54
54
  __TS__ArrayPush(v.run.queuedGameFunctionTuples, tuple)
55
55
  end
56
- function ____exports.runInNRenderFrames(self, func, frames)
56
+ function ____exports.runInNRenderFrames(self, func, renderFrames)
57
57
  errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
58
- local isaacFrameCount = Isaac.GetFrameCount()
59
- local functionFireFrame = isaacFrameCount + frames
58
+ local renderFrameCount = Isaac.GetFrameCount()
59
+ local functionFireFrame = renderFrameCount + renderFrames
60
60
  local tuple = {functionFireFrame, func}
61
61
  __TS__ArrayPush(v.run.queuedRenderFunctionTuples, tuple)
62
62
  end
@@ -13,10 +13,10 @@ local SAVE_DATA_MANAGER_FEATURE_NAME = ____constants.SAVE_DATA_MANAGER_FEATURE_N
13
13
  local ____merge = require("features.saveDataManager.merge")
14
14
  local merge = ____merge.merge
15
15
  function readSaveDatFile(self, mod)
16
- local isaacFrameCount = Isaac.GetFrameCount()
16
+ local renderFrameCount = Isaac.GetFrameCount()
17
17
  local ok, jsonStringOrErrMsg = pcall(tryLoadModData, mod)
18
18
  if not ok then
19
- log((("Failed to read from the \"save#.dat\" file on Isaac frame " .. tostring(isaacFrameCount)) .. ": ") .. jsonStringOrErrMsg)
19
+ log((("Failed to read from the \"save#.dat\" file on render frame " .. tostring(renderFrameCount)) .. ": ") .. jsonStringOrErrMsg)
20
20
  return DEFAULT_MOD_DATA
21
21
  end
22
22
  if jsonStringOrErrMsg == nil then
@@ -8,15 +8,15 @@ local ____exports = {}
8
8
  local initCardObjects, CARD_TYPE_TO_CARDS_MAP, CARD_SET
9
9
  local ____cachedClasses = require("cachedClasses")
10
10
  local itemConfig = ____cachedClasses.itemConfig
11
- local ____cardDescriptionMap = require("maps.cardDescriptionMap")
12
- local CARD_DESCRIPTION_MAP = ____cardDescriptionMap.CARD_DESCRIPTION_MAP
13
- local DEFAULT_CARD_DESCRIPTION = ____cardDescriptionMap.DEFAULT_CARD_DESCRIPTION
14
- local ____cardNameMap = require("maps.cardNameMap")
15
- local CARD_NAME_MAP = ____cardNameMap.CARD_NAME_MAP
16
- local DEFAULT_CARD_NAME = ____cardNameMap.DEFAULT_CARD_NAME
17
- local ____cardTypeMap = require("maps.cardTypeMap")
18
- local CARD_TYPE_MAP = ____cardTypeMap.CARD_TYPE_MAP
19
- local DEFAULT_CARD_TYPE = ____cardTypeMap.DEFAULT_CARD_TYPE
11
+ local ____cardDescriptions = require("objects.cardDescriptions")
12
+ local CARD_DESCRIPTIONS = ____cardDescriptions.CARD_DESCRIPTIONS
13
+ local DEFAULT_CARD_DESCRIPTION = ____cardDescriptions.DEFAULT_CARD_DESCRIPTION
14
+ local ____cardNames = require("objects.cardNames")
15
+ local CARD_NAMES = ____cardNames.CARD_NAMES
16
+ local DEFAULT_CARD_NAME = ____cardNames.DEFAULT_CARD_NAME
17
+ local ____cardTypes = require("objects.cardTypes")
18
+ local CARD_TYPES = ____cardTypes.CARD_TYPES
19
+ local DEFAULT_CARD_TYPE = ____cardTypes.DEFAULT_CARD_TYPE
20
20
  local ____CardType = require("types.CardType")
21
21
  local CardType = ____CardType.CardType
22
22
  local ____math = require("functions.math")
@@ -69,7 +69,7 @@ function ____exports.getCardsOfType(self, ...)
69
69
  return matchingCards
70
70
  end
71
71
  function ____exports.getCardType(self, card)
72
- local cardType = CARD_TYPE_MAP[card]
72
+ local cardType = CARD_TYPES[card]
73
73
  return cardType == nil and DEFAULT_CARD_TYPE or cardType
74
74
  end
75
75
  function ____exports.getMaxCards(self)
@@ -78,7 +78,7 @@ end
78
78
  CARD_TYPE_TO_CARDS_MAP = __TS__New(Map)
79
79
  CARD_SET = __TS__New(Set)
80
80
  function ____exports.getCardDescription(self, card)
81
- local cardDescription = CARD_DESCRIPTION_MAP[card]
81
+ local cardDescription = CARD_DESCRIPTIONS[card]
82
82
  if cardDescription ~= nil then
83
83
  return cardDescription
84
84
  end
@@ -89,7 +89,7 @@ function ____exports.getCardDescription(self, card)
89
89
  return DEFAULT_CARD_DESCRIPTION
90
90
  end
91
91
  function ____exports.getCardName(self, card)
92
- local cardName = CARD_NAME_MAP[card]
92
+ local cardName = CARD_NAMES[card]
93
93
  if cardName ~= nil and cardName ~= DEFAULT_CARD_NAME then
94
94
  return cardName
95
95
  end
@@ -1,10 +1,10 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____exports = {}
3
- local ____challengeNameMap = require("maps.challengeNameMap")
4
- local CHALLENGE_NAME_MAP = ____challengeNameMap.CHALLENGE_NAME_MAP
5
- local DEFAULT_CHALLENGE_NAME = ____challengeNameMap.DEFAULT_CHALLENGE_NAME
3
+ local ____challengeNames = require("objects.challengeNames")
4
+ local CHALLENGE_NAMES = ____challengeNames.CHALLENGE_NAMES
5
+ local DEFAULT_CHALLENGE_NAME = ____challengeNames.DEFAULT_CHALLENGE_NAME
6
6
  function ____exports.getChallengeName(self, challenge)
7
- local challengeName = CHALLENGE_NAME_MAP[challenge]
7
+ local challengeName = CHALLENGE_NAMES[challenge]
8
8
  return challengeName == nil and DEFAULT_CHALLENGE_NAME or challengeName
9
9
  end
10
10
  return ____exports
@@ -5,6 +5,7 @@ export declare function closeAllDoors(): void;
5
5
  * without an animation.
6
6
  */
7
7
  export declare function closeDoorFast(door: GridEntityDoor): void;
8
+ export declare function doorSlotToDirection(doorSlot: DoorSlot): Direction;
8
9
  /**
9
10
  * Helper function to get all of the doors in the room. By default, it will return every door. You
10
11
  * can optionally specify one or more room types to return only the doors that match the specified
@@ -10,6 +10,8 @@ local ____cachedClasses = require("cachedClasses")
10
10
  local game = ____cachedClasses.game
11
11
  local ____constants = require("constants")
12
12
  local MAX_NUM_DOORS = ____constants.MAX_NUM_DOORS
13
+ local ____doorSlotToDirection = require("objects.doorSlotToDirection")
14
+ local DOOR_SLOT_TO_DIRECTION = ____doorSlotToDirection.DOOR_SLOT_TO_DIRECTION
13
15
  function ____exports.getDoors(self, ...)
14
16
  local roomTypes = {...}
15
17
  local room = game:GetRoom()
@@ -21,13 +23,13 @@ function ____exports.getDoors(self, ...)
21
23
  do
22
24
  local door = room:GetDoor(i)
23
25
  if door == nil then
24
- goto __continue7
26
+ goto __continue8
25
27
  end
26
28
  if #roomTypes == 0 or roomTypesSet:has(door.TargetRoomType) then
27
29
  __TS__ArrayPush(doors, door)
28
30
  end
29
31
  end
30
- ::__continue7::
32
+ ::__continue8::
31
33
  i = i + 1
32
34
  end
33
35
  end
@@ -61,6 +63,9 @@ function ____exports.closeDoorFast(self, door)
61
63
  local sprite = door:GetSprite()
62
64
  sprite:Play("Closed", true)
63
65
  end
66
+ function ____exports.doorSlotToDirection(self, doorSlot)
67
+ return DOOR_SLOT_TO_DIRECTION[doorSlot]
68
+ end
64
69
  function ____exports.getDoorsToRoomIndex(self, ...)
65
70
  local roomGridIndex = {...}
66
71
  local roomGridIndexesSet = __TS__New(Set, roomGridIndex)
@@ -214,6 +214,8 @@ function ____exports.logEntities(includeBackgroundEffects, entityTypeFilter)
214
214
  )
215
215
  if numMatchedEntities == 0 then
216
216
  ____exports.log("(no entities matched)")
217
+ else
218
+ ____exports.log(("(" .. tostring(numMatchedEntities)) .. " total entities)")
217
219
  end
218
220
  end
219
221
  function ____exports.logGridEntities(includeWalls, gridEntityTypeFilter)
@@ -278,6 +280,8 @@ function ____exports.logGridEntities(includeWalls, gridEntityTypeFilter)
278
280
  )
279
281
  if numMatchedEntities == 0 then
280
282
  ____exports.log("(no grid entities matched)")
283
+ else
284
+ ____exports.log(("(" .. tostring(numMatchedEntities)) .. " total grid entities)")
281
285
  end
282
286
  end
283
287
  function ____exports.logKColor(kColor)
@@ -2,49 +2,8 @@
2
2
  local ____lualib = require("lualib_bundle")
3
3
  local __TS__ArrayPush = ____lualib.__TS__ArrayPush
4
4
  local ____exports = {}
5
- local getCircleInitialPosition
6
- local ____utils = require("functions.utils")
7
- local ensureAllCases = ____utils.ensureAllCases
8
- function getCircleInitialPosition(self, direction, radius)
9
- repeat
10
- local ____switch6 = direction
11
- local ____cond6 = ____switch6 == Direction.NO_DIRECTION
12
- if ____cond6 then
13
- do
14
- return Vector.Zero
15
- end
16
- end
17
- ____cond6 = ____cond6 or ____switch6 == Direction.LEFT
18
- if ____cond6 then
19
- do
20
- return Vector(-radius, 0)
21
- end
22
- end
23
- ____cond6 = ____cond6 or ____switch6 == Direction.UP
24
- if ____cond6 then
25
- do
26
- return Vector(0, -radius)
27
- end
28
- end
29
- ____cond6 = ____cond6 or ____switch6 == Direction.RIGHT
30
- if ____cond6 then
31
- do
32
- return Vector(radius, 0)
33
- end
34
- end
35
- ____cond6 = ____cond6 or ____switch6 == Direction.DOWN
36
- if ____cond6 then
37
- do
38
- return Vector(0, radius)
39
- end
40
- end
41
- do
42
- do
43
- return ensureAllCases(nil, direction)
44
- end
45
- end
46
- until true
47
- end
5
+ local ____vector = require("functions.vector")
6
+ local directionToVector = ____vector.directionToVector
48
7
  function ____exports.getAngleDifference(self, angle1, angle2)
49
8
  local subtractedAngle = angle1 - angle2
50
9
  return (subtractedAngle + 180) % 360 - 180
@@ -59,7 +18,8 @@ function ____exports.getCircleDiscretizedPoints(self, centerPos, radius, numPoin
59
18
  if initialDirection == nil then
60
19
  initialDirection = Direction.UP
61
20
  end
62
- local initialPosition = getCircleInitialPosition(nil, initialDirection, radius)
21
+ local vector = directionToVector(nil, initialDirection)
22
+ local initialPosition = vector * radius
63
23
  local positions = {}
64
24
  do
65
25
  local i = 0
@@ -2,24 +2,24 @@
2
2
  local ____exports = {}
3
3
  local ____cachedClasses = require("cachedClasses")
4
4
  local itemConfig = ____cachedClasses.itemConfig
5
- local ____pillEffectClassMap = require("maps.pillEffectClassMap")
6
- local DEFAULT_PILL_EFFECT_CLASS = ____pillEffectClassMap.DEFAULT_PILL_EFFECT_CLASS
7
- local PILL_EFFECT_CLASS_MAP = ____pillEffectClassMap.PILL_EFFECT_CLASS_MAP
8
- local ____pillEffectNameMap = require("maps.pillEffectNameMap")
9
- local DEFAULT_PILL_EFFECT_NAME = ____pillEffectNameMap.DEFAULT_PILL_EFFECT_NAME
10
- local PILL_EFFECT_NAME_MAP = ____pillEffectNameMap.PILL_EFFECT_NAME_MAP
11
- local ____pillEffectTypeMap = require("maps.pillEffectTypeMap")
12
- local DEFAULT_PILL_EFFECT_TYPE = ____pillEffectTypeMap.DEFAULT_PILL_EFFECT_TYPE
13
- local PILL_EFFECT_TYPE_MAP = ____pillEffectTypeMap.PILL_EFFECT_TYPE_MAP
5
+ local ____pillEffectClasses = require("objects.pillEffectClasses")
6
+ local DEFAULT_PILL_EFFECT_CLASS = ____pillEffectClasses.DEFAULT_PILL_EFFECT_CLASS
7
+ local PILL_EFFECT_CLASSES = ____pillEffectClasses.PILL_EFFECT_CLASSES
8
+ local ____pillEffectNames = require("objects.pillEffectNames")
9
+ local DEFAULT_PILL_EFFECT_NAME = ____pillEffectNames.DEFAULT_PILL_EFFECT_NAME
10
+ local PILL_EFFECT_NAMES = ____pillEffectNames.PILL_EFFECT_NAMES
11
+ local ____pillEffectTypes = require("objects.pillEffectTypes")
12
+ local DEFAULT_PILL_EFFECT_TYPE = ____pillEffectTypes.DEFAULT_PILL_EFFECT_TYPE
13
+ local PILL_EFFECT_TYPES = ____pillEffectTypes.PILL_EFFECT_TYPES
14
14
  function ____exports.getMaxPillEffects(self)
15
15
  return itemConfig:GetPillEffects().Size - 1
16
16
  end
17
17
  function ____exports.getPillEffectClass(self, pillEffect)
18
- local pillEffectClass = PILL_EFFECT_CLASS_MAP[pillEffect]
18
+ local pillEffectClass = PILL_EFFECT_CLASSES[pillEffect]
19
19
  return pillEffectClass == nil and DEFAULT_PILL_EFFECT_CLASS or pillEffectClass
20
20
  end
21
21
  function ____exports.getPillEffectName(self, pillEffect)
22
- local pillEffectName = PILL_EFFECT_NAME_MAP[pillEffect]
22
+ local pillEffectName = PILL_EFFECT_NAMES[pillEffect]
23
23
  if pillEffectName ~= nil and pillEffectName ~= DEFAULT_PILL_EFFECT_NAME then
24
24
  return pillEffectName
25
25
  end
@@ -30,7 +30,7 @@ function ____exports.getPillEffectName(self, pillEffect)
30
30
  return DEFAULT_PILL_EFFECT_NAME
31
31
  end
32
32
  function ____exports.getPillEffectType(self, pillEffect)
33
- local pillEffectClass = PILL_EFFECT_TYPE_MAP[pillEffect]
33
+ local pillEffectClass = PILL_EFFECT_TYPES[pillEffect]
34
34
  return pillEffectClass == nil and DEFAULT_PILL_EFFECT_TYPE or pillEffectClass
35
35
  end
36
36
  return ____exports
@@ -22,9 +22,9 @@ local CHARACTERS_WITH_NO_RED_HEARTS = ____constants.CHARACTERS_WITH_NO_RED_HEART
22
22
  local CHARACTERS_WITH_NO_SOUL_HEARTS = ____constants.CHARACTERS_WITH_NO_SOUL_HEARTS
23
23
  local LOST_STYLE_PLAYER_TYPES = ____constants.LOST_STYLE_PLAYER_TYPES
24
24
  local MAX_VANILLA_CHARACTER = ____constants.MAX_VANILLA_CHARACTER
25
- local ____characterNameMap = require("maps.characterNameMap")
26
- local CHARACTER_NAME_MAP = ____characterNameMap.CHARACTER_NAME_MAP
27
- local DEFAULT_CHARACTER_NAME = ____characterNameMap.DEFAULT_CHARACTER_NAME
25
+ local ____characterNames = require("objects.characterNames")
26
+ local CHARACTER_NAMES = ____characterNames.CHARACTER_NAMES
27
+ local DEFAULT_CHARACTER_NAME = ____characterNames.DEFAULT_CHARACTER_NAME
28
28
  local ____HealthType = require("types.HealthType")
29
29
  local HealthType = ____HealthType.HealthType
30
30
  local ____array = require("functions.array")
@@ -265,7 +265,7 @@ function ____exports.getCharacterName(self, character)
265
265
  if character >= PlayerType.NUM_PLAYER_TYPES then
266
266
  return "unknown"
267
267
  end
268
- local characterName = CHARACTER_NAME_MAP[character]
268
+ local characterName = CHARACTER_NAMES[character]
269
269
  return characterName == nil and DEFAULT_CHARACTER_NAME or characterName
270
270
  end
271
271
  function ____exports.getClosestPlayer(self, position)