isaacscript-common 1.2.138 → 1.2.139

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 (34) hide show
  1. package/dist/constants.d.ts +2 -0
  2. package/dist/features/deployJSONRoom.lua +11 -22
  3. package/dist/features/disableInputs.lua +6 -20
  4. package/dist/features/disableSound.lua +4 -12
  5. package/dist/features/extraConsoleCommands/commands.d.ts +88 -4
  6. package/dist/features/extraConsoleCommands/commands.lua +299 -27
  7. package/dist/features/extraConsoleCommands/init.lua +46 -5
  8. package/dist/features/extraConsoleCommands/v.d.ts +5 -1
  9. package/dist/features/extraConsoleCommands/v.lua +7 -1
  10. package/dist/features/forgottenSwitch.lua +3 -8
  11. package/dist/features/getCollectibleItemPoolType.lua +4 -9
  12. package/dist/features/isPonyActive.lua +3 -8
  13. package/dist/features/preventCollectibleRotate.lua +3 -8
  14. package/dist/features/runInNFrames.lua +6 -20
  15. package/dist/features/saveDataManager/constants.d.ts +3 -0
  16. package/dist/features/saveDataManager/constants.lua +5 -0
  17. package/dist/features/saveDataManager/exports.lua +9 -18
  18. package/dist/features/saveDataManager/load.lua +4 -3
  19. package/dist/features/saveDataManager/main.lua +4 -10
  20. package/dist/features/saveDataManager/merge.lua +2 -2
  21. package/dist/features/saveDataManager/save.lua +3 -1
  22. package/dist/features/sirenHelpers.lua +4 -8
  23. package/dist/featuresInitialized.d.ts +1 -1
  24. package/dist/featuresInitialized.lua +5 -0
  25. package/dist/functions/deepCopy.lua +2 -2
  26. package/dist/functions/log.lua +3 -0
  27. package/dist/functions/rooms.lua +4 -5
  28. package/dist/index.d.ts +2 -0
  29. package/dist/index.lua +16 -0
  30. package/dist/maps/roomTypeMap.d.ts +3 -0
  31. package/dist/maps/roomTypeMap.lua +43 -0
  32. package/dist/maps/roomTypeNameMap.d.ts +2 -0
  33. package/dist/maps/roomTypeNameMap.lua +38 -0
  34. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____exports = {}
3
3
  local isActionTriggered, v
4
- local ____errors = require("errors")
5
- local getUpgradeErrorMsg = ____errors.getUpgradeErrorMsg
4
+ local ____featuresInitialized = require("featuresInitialized")
5
+ local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
6
6
  local ____exports = require("features.saveDataManager.exports")
7
7
  local saveDataManager = ____exports.saveDataManager
8
8
  function isActionTriggered(self, _entity, _inputHook, buttonAction)
@@ -13,18 +13,13 @@ function isActionTriggered(self, _entity, _inputHook, buttonAction)
13
13
  return nil
14
14
  end
15
15
  local FEATURE_NAME = "forgotten switcher"
16
- local initialized = false
17
16
  v = {run = {shouldSwitch = false}}
18
17
  function ____exports.forgottenSwitchInit(self, mod)
19
- initialized = true
20
18
  saveDataManager(nil, "forgottenSwitch", v)
21
19
  mod:AddCallback(ModCallbacks.MC_INPUT_ACTION, isActionTriggered, InputHook.IS_ACTION_TRIGGERED)
22
20
  end
23
21
  function ____exports.forgottenSwitch(self)
24
- if not initialized then
25
- local msg = getUpgradeErrorMsg(nil, FEATURE_NAME)
26
- error(msg)
27
- end
22
+ errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
28
23
  v.run.shouldSwitch = true
29
24
  end
30
25
  return ____exports
@@ -6,8 +6,8 @@ local ____exports = {}
6
6
  local postPickupInitCollectible, v
7
7
  local ____cachedClasses = require("cachedClasses")
8
8
  local game = ____cachedClasses.game
9
- local ____errors = require("errors")
10
- local getUpgradeErrorMsg = ____errors.getUpgradeErrorMsg
9
+ local ____featuresInitialized = require("featuresInitialized")
10
+ local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
11
11
  local ____entity = require("functions.entity")
12
12
  local getEntityID = ____entity.getEntityID
13
13
  local ____rooms = require("functions.rooms")
@@ -21,21 +21,16 @@ function postPickupInitCollectible(self, pickup)
21
21
  v.run.collectibleItemPoolTypeMap:set(ptrHash, lastItemPoolType)
22
22
  end
23
23
  local FEATURE_NAME = "get collectible item pool type"
24
- local initialized = false
25
24
  v = {run = {collectibleItemPoolTypeMap = __TS__New(Map)}}
26
25
  function ____exports.getCollectibleItemPoolTypeInit(self, mod)
27
- initialized = true
28
26
  saveDataManager(nil, "getCollectibleItemPoolType", v)
29
27
  mod:AddCallback(ModCallbacks.MC_POST_PICKUP_INIT, postPickupInitCollectible, PickupVariant.PICKUP_COLLECTIBLE)
30
28
  end
31
29
  function ____exports.getCollectibleItemPoolType(self, collectible)
32
- if not initialized then
33
- local msg = getUpgradeErrorMsg(nil, FEATURE_NAME)
34
- error(msg)
35
- end
30
+ errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
36
31
  if collectible.Type ~= EntityType.ENTITY_PICKUP or collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
37
32
  local entityID = getEntityID(nil, collectible)
38
- error("The \"getCollectibleItemPoolType()\" function was given a non-collectible: " .. entityID)
33
+ error("The \"getCollectibleItemPoolType\" function was given a non-collectible: " .. entityID)
39
34
  end
40
35
  local ptrHash = GetPtrHash(collectible)
41
36
  local itemPoolType = v.run.collectibleItemPoolTypeMap:get(ptrHash)
@@ -4,8 +4,8 @@ local Set = ____lualib.Set
4
4
  local __TS__New = ____lualib.__TS__New
5
5
  local ____exports = {}
6
6
  local postPEffectUpdate, FLAGS_WHEN_PONY_IS_ACTIVE, v
7
- local ____errors = require("errors")
8
- local getUpgradeErrorMsg = ____errors.getUpgradeErrorMsg
7
+ local ____featuresInitialized = require("featuresInitialized")
8
+ local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
9
9
  local ____flag = require("functions.flag")
10
10
  local hasFlag = ____flag.hasFlag
11
11
  local ____playerDataStructures = require("functions.playerDataStructures")
@@ -33,18 +33,13 @@ function postPEffectUpdate(self, player)
33
33
  end
34
34
  local FEATURE_NAME = "pony activation detector"
35
35
  FLAGS_WHEN_PONY_IS_ACTIVE = {EntityFlag.FLAG_NO_KNOCKBACK, EntityFlag.FLAG_NO_PHYSICS_KNOCKBACK, EntityFlag.FLAG_NO_DAMAGE_BLINK}
36
- local initialized = false
37
36
  v = {run = {playersIsPonyActive = __TS__New(Set)}}
38
37
  function ____exports.isPonyActiveInit(self, mod)
39
- initialized = true
40
38
  saveDataManager(nil, "isPonyActive", v)
41
39
  mod:AddCallback(ModCallbacks.MC_POST_PEFFECT_UPDATE, postPEffectUpdate)
42
40
  end
43
41
  function ____exports.isPonyActive(self, player)
44
- if not initialized then
45
- local msg = getUpgradeErrorMsg(nil, FEATURE_NAME)
46
- error(msg)
47
- end
42
+ errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
48
43
  return setHasPlayer(nil, v.run.playersIsPonyActive, player)
49
44
  end
50
45
  return ____exports
@@ -4,8 +4,8 @@ local Map = ____lualib.Map
4
4
  local __TS__New = ____lualib.__TS__New
5
5
  local ____exports = {}
6
6
  local useCardSoulOfIsaac, postPickupUpdateCollectible, v
7
- local ____errors = require("errors")
8
- local getUpgradeErrorMsg = ____errors.getUpgradeErrorMsg
7
+ local ____featuresInitialized = require("featuresInitialized")
8
+ local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
9
9
  local ____collectibles = require("functions.collectibles")
10
10
  local setCollectibleSubType = ____collectibles.setCollectibleSubType
11
11
  local ____exports = require("features.saveDataManager.exports")
@@ -23,19 +23,14 @@ function postPickupUpdateCollectible(self, pickup)
23
23
  end
24
24
  end
25
25
  local FEATURE_NAME = "prevent collectible rotation"
26
- local initialized = false
27
26
  v = {room = {trackedItems = __TS__New(Map)}}
28
27
  function ____exports.preventCollectibleRotateInit(self, mod)
29
- initialized = true
30
28
  saveDataManager(nil, "preventCollectibleRotate", v)
31
29
  mod:AddCallback(ModCallbacks.MC_USE_CARD, useCardSoulOfIsaac, Card.CARD_SOUL_ISAAC)
32
30
  mod:AddCallback(ModCallbacks.MC_POST_PICKUP_UPDATE, postPickupUpdateCollectible, PickupVariant.PICKUP_COLLECTIBLE)
33
31
  end
34
32
  function ____exports.preventCollectibleRotate(self, collectible, collectibleType)
35
- if not initialized then
36
- local msg = getUpgradeErrorMsg(nil, FEATURE_NAME)
37
- error(msg)
38
- end
33
+ errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
39
34
  if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
40
35
  error("You cannot prevent the rotation for pickups of variant: " .. tostring(collectible.Variant))
41
36
  end
@@ -7,8 +7,8 @@ local ____exports = {}
7
7
  local postUpdate, postRender, checkExecuteQueuedFunctions, v
8
8
  local ____cachedClasses = require("cachedClasses")
9
9
  local game = ____cachedClasses.game
10
- local ____errors = require("errors")
11
- local getUpgradeErrorMsg = ____errors.getUpgradeErrorMsg
10
+ local ____featuresInitialized = require("featuresInitialized")
11
+ local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
12
12
  local ____exports = require("features.saveDataManager.exports")
13
13
  local saveDataManager = ____exports.saveDataManager
14
14
  function postUpdate(self)
@@ -40,46 +40,32 @@ function checkExecuteQueuedFunctions(self, frameCount, functionTuples)
40
40
  end
41
41
  end
42
42
  local FEATURE_NAME = "run in N frames"
43
- local initialized = false
44
43
  v = {dontSave = true, run = {queuedGameFunctionTuples = {}, queuedRenderFunctionTuples = {}}}
45
44
  function ____exports.runInNFramesInit(self, mod)
46
- initialized = true
47
45
  saveDataManager(nil, "runInNFrames", v)
48
46
  mod:AddCallback(ModCallbacks.MC_POST_UPDATE, postUpdate)
49
47
  mod:AddCallback(ModCallbacks.MC_POST_RENDER, postRender)
50
48
  end
51
49
  function ____exports.runInNGameFrames(self, func, frames)
52
- if not initialized then
53
- local msg = getUpgradeErrorMsg(nil, FEATURE_NAME)
54
- error(msg)
55
- end
50
+ errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
56
51
  local gameFrameCount = game:GetFrameCount()
57
52
  local functionFireFrame = gameFrameCount + frames
58
53
  local tuple = {functionFireFrame, func}
59
54
  __TS__ArrayPush(v.run.queuedGameFunctionTuples, tuple)
60
55
  end
61
56
  function ____exports.runInNRenderFrames(self, func, frames)
62
- if not initialized then
63
- local msg = getUpgradeErrorMsg(nil, FEATURE_NAME)
64
- error(msg)
65
- end
57
+ errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
66
58
  local isaacFrameCount = Isaac.GetFrameCount()
67
59
  local functionFireFrame = isaacFrameCount + frames
68
60
  local tuple = {functionFireFrame, func}
69
61
  __TS__ArrayPush(v.run.queuedRenderFunctionTuples, tuple)
70
62
  end
71
63
  function ____exports.runNextGameFrame(self, func)
72
- if not initialized then
73
- local msg = getUpgradeErrorMsg(nil, FEATURE_NAME)
74
- error(msg)
75
- end
64
+ errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
76
65
  ____exports.runInNGameFrames(nil, func, 1)
77
66
  end
78
67
  function ____exports.runNextRenderFrame(self, func)
79
- if not initialized then
80
- local msg = getUpgradeErrorMsg(nil, FEATURE_NAME)
81
- error(msg)
82
- end
68
+ errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
83
69
  ____exports.runInNRenderFrames(nil, func, 1)
84
70
  end
85
71
  return ____exports
@@ -0,0 +1,3 @@
1
+ export declare const SAVE_DATA_MANAGER_FEATURE_NAME = "save data manager";
2
+ /** Set this to true to enable more verbosity in the save data manger. */
3
+ export declare const SAVE_DATA_MANAGER_DEBUG = false;
@@ -0,0 +1,5 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ ____exports.SAVE_DATA_MANAGER_FEATURE_NAME = "save data manager"
4
+ ____exports.SAVE_DATA_MANAGER_DEBUG = false
5
+ return ____exports
@@ -3,31 +3,28 @@ local ____lualib = require("lualib_bundle")
3
3
  local Map = ____lualib.Map
4
4
  local __TS__ObjectKeys = ____lualib.__TS__ObjectKeys
5
5
  local ____exports = {}
6
- local ____errors = require("errors")
7
- local getUpgradeErrorMsg = ____errors.getUpgradeErrorMsg
6
+ local ____featuresInitialized = require("featuresInitialized")
7
+ local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
8
8
  local ____deepCopy = require("functions.deepCopy")
9
9
  local deepCopy = ____deepCopy.deepCopy
10
10
  local SerializationType = ____deepCopy.SerializationType
11
+ local ____constants = require("features.saveDataManager.constants")
12
+ local SAVE_DATA_MANAGER_FEATURE_NAME = ____constants.SAVE_DATA_MANAGER_FEATURE_NAME
11
13
  local ____main = require("features.saveDataManager.main")
12
- local FEATURE_NAME = ____main.FEATURE_NAME
13
14
  local forceSaveDataManagerLoad = ____main.forceSaveDataManagerLoad
14
15
  local forceSaveDataManagerSave = ____main.forceSaveDataManagerSave
15
- local isSaveDataManagerInitialized = ____main.isSaveDataManagerInitialized
16
16
  local ____maps = require("features.saveDataManager.maps")
17
17
  local saveDataConditionalFuncMap = ____maps.saveDataConditionalFuncMap
18
18
  local saveDataDefaultsMap = ____maps.saveDataDefaultsMap
19
19
  local saveDataMap = ____maps.saveDataMap
20
20
  function ____exports.saveDataManager(self, key, saveData, conditionalFunc)
21
- if not isSaveDataManagerInitialized(nil) then
22
- local msg = getUpgradeErrorMsg(nil, FEATURE_NAME)
23
- error(msg)
24
- end
21
+ errorIfFeaturesNotInitialized(nil, SAVE_DATA_MANAGER_FEATURE_NAME)
25
22
  local keyType = type(key)
26
23
  if keyType ~= "string" then
27
- error("The save data manager requires that keys are strings. You tried to use a key of type: " .. keyType)
24
+ error((("The " .. SAVE_DATA_MANAGER_FEATURE_NAME) .. " requires that keys are strings. You tried to use a key of type: ") .. keyType)
28
25
  end
29
26
  if saveDataMap[key] ~= nil then
30
- error("The save data manager is already managing save data for a key of: " .. key)
27
+ error((("The " .. SAVE_DATA_MANAGER_FEATURE_NAME) .. " is already managing save data for a key of: ") .. key)
31
28
  end
32
29
  saveDataMap[key] = saveData
33
30
  local saveDataKeys = __TS__ObjectKeys(saveData)
@@ -43,17 +40,11 @@ function ____exports.saveDataManager(self, key, saveData, conditionalFunc)
43
40
  end
44
41
  end
45
42
  function ____exports.saveDataManagerSave(self)
46
- if not isSaveDataManagerInitialized(nil) then
47
- local msg = getUpgradeErrorMsg(nil, FEATURE_NAME)
48
- error(msg)
49
- end
43
+ errorIfFeaturesNotInitialized(nil, SAVE_DATA_MANAGER_FEATURE_NAME)
50
44
  forceSaveDataManagerSave(nil)
51
45
  end
52
46
  function ____exports.saveDataManagerLoad(self)
53
- if not isSaveDataManagerInitialized(nil) then
54
- local msg = getUpgradeErrorMsg(nil, FEATURE_NAME)
55
- error(msg)
56
- end
47
+ errorIfFeaturesNotInitialized(nil, SAVE_DATA_MANAGER_FEATURE_NAME)
57
48
  forceSaveDataManagerLoad(nil)
58
49
  end
59
50
  function ____exports.saveDataManagerSetGlobal(self)
@@ -7,8 +7,9 @@ local ____jsonHelpers = require("functions.jsonHelpers")
7
7
  local jsonDecode = ____jsonHelpers.jsonDecode
8
8
  local ____log = require("functions.log")
9
9
  local log = ____log.log
10
- local ____debug = require("features.saveDataManager.debug")
11
- local SAVE_DATA_MANAGER_DEBUG = ____debug.SAVE_DATA_MANAGER_DEBUG
10
+ local ____constants = require("features.saveDataManager.constants")
11
+ local SAVE_DATA_MANAGER_DEBUG = ____constants.SAVE_DATA_MANAGER_DEBUG
12
+ local SAVE_DATA_MANAGER_FEATURE_NAME = ____constants.SAVE_DATA_MANAGER_FEATURE_NAME
12
13
  local ____merge = require("features.saveDataManager.merge")
13
14
  local merge = ____merge.merge
14
15
  function readSaveDatFile(self, mod)
@@ -60,6 +61,6 @@ function ____exports.loadFromDisk(self, mod, oldSaveData)
60
61
  end
61
62
  ::__continue5::
62
63
  end
63
- log("The save data manager loaded data from the \"save#.dat\" file.")
64
+ log(("The " .. SAVE_DATA_MANAGER_FEATURE_NAME) .. " loaded data from the \"save#.dat\" file.")
64
65
  end
65
66
  return ____exports
@@ -5,8 +5,6 @@ local ____exports = {}
5
5
  local postPlayerInit, preGameExit, postNewLevel, postNewRoomEarly, restoreDefaultsAll, restoreDefaults, clearAndCopyAllElements, mod, loadedDataOnThisRun
6
6
  local ____cachedClasses = require("cachedClasses")
7
7
  local game = ____cachedClasses.game
8
- local ____errors = require("errors")
9
- local getUpgradeErrorMsg = ____errors.getUpgradeErrorMsg
10
8
  local ____deepCopy = require("functions.deepCopy")
11
9
  local deepCopy = ____deepCopy.deepCopy
12
10
  local SerializationType = ____deepCopy.SerializationType
@@ -16,6 +14,8 @@ local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
16
14
  local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
17
15
  local ____SaveData = require("types.private.SaveData")
18
16
  local SaveDataKeys = ____SaveData.SaveDataKeys
17
+ local ____constants = require("features.saveDataManager.constants")
18
+ local SAVE_DATA_MANAGER_FEATURE_NAME = ____constants.SAVE_DATA_MANAGER_FEATURE_NAME
19
19
  local ____load = require("features.saveDataManager.load")
20
20
  local loadFromDisk = ____load.loadFromDisk
21
21
  local ____maps = require("features.saveDataManager.maps")
@@ -26,8 +26,7 @@ local ____save = require("features.saveDataManager.save")
26
26
  local saveToDisk = ____save.saveToDisk
27
27
  function postPlayerInit(self)
28
28
  if mod == nil then
29
- local msg = getUpgradeErrorMsg(nil, ____exports.FEATURE_NAME)
30
- error(msg)
29
+ error(("The mod for the " .. SAVE_DATA_MANAGER_FEATURE_NAME) .. " was not initialized.")
31
30
  end
32
31
  if loadedDataOnThisRun then
33
32
  return
@@ -42,8 +41,7 @@ function postPlayerInit(self)
42
41
  end
43
42
  function preGameExit(self)
44
43
  if mod == nil then
45
- local msg = getUpgradeErrorMsg(nil, ____exports.FEATURE_NAME)
46
- error(msg)
44
+ error(("The mod for the " .. SAVE_DATA_MANAGER_FEATURE_NAME) .. " was not initialized.")
47
45
  end
48
46
  saveToDisk(nil, mod, saveDataMap, saveDataConditionalFuncMap)
49
47
  restoreDefaultsAll(nil)
@@ -91,7 +89,6 @@ function clearAndCopyAllElements(self, oldTable, newTable)
91
89
  oldTable[key] = value
92
90
  end
93
91
  end
94
- ____exports.FEATURE_NAME = "save data manager"
95
92
  mod = nil
96
93
  loadedDataOnThisRun = false
97
94
  function ____exports.saveDataManagerInit(self, incomingMod)
@@ -101,9 +98,6 @@ function ____exports.saveDataManagerInit(self, incomingMod)
101
98
  mod:AddCallback(ModCallbacks.MC_POST_NEW_LEVEL, postNewLevel)
102
99
  mod:AddCallbackCustom(ModCallbacksCustom.MC_POST_NEW_ROOM_EARLY, postNewRoomEarly)
103
100
  end
104
- function ____exports.isSaveDataManagerInitialized(self)
105
- return mod ~= nil
106
- end
107
101
  function ____exports.forceSaveDataManagerSave(self)
108
102
  if mod == nil then
109
103
  return
@@ -20,8 +20,8 @@ local clearTable = ____table.clearTable
20
20
  local ____SerializationBrand = require("types.private.SerializationBrand")
21
21
  local isSerializationBrand = ____SerializationBrand.isSerializationBrand
22
22
  local SerializationBrand = ____SerializationBrand.SerializationBrand
23
- local ____debug = require("features.saveDataManager.debug")
24
- local SAVE_DATA_MANAGER_DEBUG = ____debug.SAVE_DATA_MANAGER_DEBUG
23
+ local ____constants = require("features.saveDataManager.constants")
24
+ local SAVE_DATA_MANAGER_DEBUG = ____constants.SAVE_DATA_MANAGER_DEBUG
25
25
  function ____exports.merge(self, oldObject, newTable, traversalDescription)
26
26
  local oldObjectType = type(oldObject)
27
27
  if oldObjectType ~= "table" then
@@ -11,6 +11,8 @@ local ____jsonHelpers = require("functions.jsonHelpers")
11
11
  local jsonEncode = ____jsonHelpers.jsonEncode
12
12
  local ____log = require("functions.log")
13
13
  local log = ____log.log
14
+ local ____constants = require("features.saveDataManager.constants")
15
+ local SAVE_DATA_MANAGER_FEATURE_NAME = ____constants.SAVE_DATA_MANAGER_FEATURE_NAME
14
16
  function getAllSaveDataToWriteToDisk(self, saveDataMap, saveDataConditionalFuncMap)
15
17
  local allSaveData = {}
16
18
  for subscriberName, saveData in pairs(saveDataMap) do
@@ -40,6 +42,6 @@ function ____exports.saveToDisk(self, mod, saveDataMap, saveDataConditionalFuncM
40
42
  local allSaveData = getAllSaveDataToWriteToDisk(nil, saveDataMap, saveDataConditionalFuncMap)
41
43
  local jsonString = jsonEncode(nil, allSaveData)
42
44
  mod:SaveData(jsonString)
43
- log("The save data manager wrote data to the \"save#.dat\" file.")
45
+ log(("The " .. SAVE_DATA_MANAGER_FEATURE_NAME) .. " wrote data to the \"save#.dat\" file.")
44
46
  end
45
47
  return ____exports
@@ -4,8 +4,8 @@ local __TS__ArrayPush = ____lualib.__TS__ArrayPush
4
4
  local __TS__ArrayFind = ____lualib.__TS__ArrayFind
5
5
  local ____exports = {}
6
6
  local postNPCInitSirenHelper, checkReturnFamiliarToPlayer, blacklistEntryExists, getSirenHelper, v
7
- local ____errors = require("errors")
8
- local getUpgradeErrorMsg = ____errors.getUpgradeErrorMsg
7
+ local ____featuresInitialized = require("featuresInitialized")
8
+ local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
9
9
  local ____entity = require("functions.entity")
10
10
  local getEntities = ____entity.getEntities
11
11
  local ____exports = require("features.saveDataManager.exports")
@@ -48,24 +48,20 @@ function getSirenHelper(self, familiar)
48
48
  )
49
49
  end
50
50
  local FEATURE_NAME = "siren helpers"
51
- local initialized = false
52
51
  v = {run = {familiarBlacklist = {}}}
53
52
  function ____exports.sirenHelpersInit(self, mod)
54
- initialized = true
55
53
  saveDataManager(nil, "sirenHelpers", v)
56
54
  mod:AddCallback(ModCallbacks.MC_POST_NPC_INIT, postNPCInitSirenHelper, EntityType.ENTITY_SIREN_HELPER)
57
55
  end
58
56
  function ____exports.setFamiliarNoSirenSteal(self, familiarVariant, familiarSubType)
59
- if not initialized then
60
- local msg = getUpgradeErrorMsg(nil, FEATURE_NAME)
61
- error(msg)
62
- end
57
+ errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
63
58
  if blacklistEntryExists(nil, familiarVariant, familiarSubType) then
64
59
  return
65
60
  end
66
61
  __TS__ArrayPush(v.run.familiarBlacklist, {familiarVariant, familiarSubType})
67
62
  end
68
63
  function ____exports.hasSirenStolenFamiliar(self, familiar)
64
+ errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
69
65
  return getSirenHelper(nil, familiar) ~= nil
70
66
  end
71
67
  return ____exports
@@ -1 +1 @@
1
- export {};
1
+ export declare function errorIfFeaturesNotInitialized(featureName: string): void;
@@ -7,4 +7,9 @@ end
7
7
  function ____exports.setFeaturesInitialized(self)
8
8
  featuresInitialized = true
9
9
  end
10
+ function ____exports.errorIfFeaturesNotInitialized(self, featureName)
11
+ if not ____exports.areFeaturesInitialized(nil) then
12
+ error(("The " .. featureName) .. " is not initialized. You must first upgrade your mod object by calling the \"upgradeMod\" function.")
13
+ end
14
+ end
10
15
  return ____exports
@@ -7,8 +7,8 @@ local __TS__InstanceOf = ____lualib.__TS__InstanceOf
7
7
  local __TS__Iterator = ____lualib.__TS__Iterator
8
8
  local ____exports = {}
9
9
  local isTSTLClass, copyClass, getNewClassFromMetatable, deepCopyValue, copyVector, checkMetatable, validateValue, TSTL_CLASS_KEYS
10
- local ____debug = require("features.saveDataManager.debug")
11
- local SAVE_DATA_MANAGER_DEBUG = ____debug.SAVE_DATA_MANAGER_DEBUG
10
+ local ____constants = require("features.saveDataManager.constants")
11
+ local SAVE_DATA_MANAGER_DEBUG = ____constants.SAVE_DATA_MANAGER_DEBUG
12
12
  local ____DefaultMap = require("types.DefaultMap")
13
13
  local DefaultMap = ____DefaultMap.DefaultMap
14
14
  local ____SerializationBrand = require("types.private.SerializationBrand")
@@ -207,6 +207,7 @@ function ____exports.logEntities(includeBackgroundEffects, entityTypeFilter)
207
207
  debugString = debugString .. (" (DropSeed: " .. tostring(entity.DropSeed)) .. ")"
208
208
  debugString = debugString .. (((" (Position: " .. tostring(entity.Position.X)) .. ", ") .. tostring(entity.Position.Y)) .. ")"
209
209
  debugString = debugString .. (((" (Velocity: " .. tostring(entity.Velocity.X)) .. ", ") .. tostring(entity.Velocity.Y)) .. ")"
210
+ debugString = debugString .. (((" (HP: " .. tostring(entity.HitPoints)) .. " / ") .. tostring(entity.MaxHitPoints)) .. ")"
210
211
  ____exports.log(debugString)
211
212
  numMatchedEntities = numMatchedEntities + 1
212
213
  end
@@ -315,7 +316,9 @@ function ____exports.logRoom()
315
316
  if roomData == nil then
316
317
  ____exports.log("Current room data is undefined.")
317
318
  else
319
+ ____exports.log("Current room stage ID: " .. tostring(roomData.StageID))
318
320
  ____exports.log((((("Current room type/variant/sub-type: " .. tostring(roomData.Type)) .. ".") .. tostring(roomData.Variant)) .. ".") .. tostring(roomData.Subtype))
321
+ ____exports.log("Current room name: " .. roomData.Name)
319
322
  end
320
323
  ____exports.log("Current room grid index: " .. tostring(roomGridIndex))
321
324
  ____exports.log("Current room list index: " .. tostring(roomListIndex))
@@ -221,10 +221,8 @@ function ____exports.inLRoom(self)
221
221
  return roomShape == RoomShape.ROOMSHAPE_LTL or roomShape == RoomShape.ROOMSHAPE_LTR or roomShape == RoomShape.ROOMSHAPE_LBL or roomShape == RoomShape.ROOMSHAPE_LBR
222
222
  end
223
223
  function ____exports.inGenesisRoom(self)
224
- local room = game:GetRoom()
225
- local roomType = room:GetType()
226
- local roomSubType = ____exports.getRoomSubType(nil)
227
- return roomType == RoomType.ROOM_ISAACS and roomSubType == 99
224
+ local roomGridIndex = ____exports.getRoomGridIndex(nil)
225
+ return roomGridIndex == GridRooms.ROOM_GENESIS_IDX
228
226
  end
229
227
  function ____exports.inMegaSatanRoom(self)
230
228
  local roomGridIndex = ____exports.getRoomGridIndex(nil)
@@ -238,7 +236,8 @@ function ____exports.inMinibossRoomOf(self, minibossID)
238
236
  return roomType == RoomType.ROOM_MINIBOSS and roomStageID == 0 and roomSubType == minibossID
239
237
  end
240
238
  function ____exports.inSecretShop(self)
241
- return ____exports.getRoomGridIndex(nil) == GridRooms.ROOM_SECRET_SHOP_IDX
239
+ local roomGridIndex = ____exports.getRoomGridIndex(nil)
240
+ return roomGridIndex == GridRooms.ROOM_SECRET_SHOP_IDX
242
241
  end
243
242
  function ____exports.inStartingRoom(self)
244
243
  local level = game:GetLevel()
package/dist/index.d.ts CHANGED
@@ -83,6 +83,8 @@ export * from "./maps/pillEffectMap";
83
83
  export * from "./maps/pillEffectNameMap";
84
84
  export * from "./maps/pillEffectTypeMap";
85
85
  export * from "./maps/roomShapeToTopLeftWallGridIndexMap";
86
+ export * from "./maps/roomTypeMap";
87
+ export * from "./maps/roomTypeNameMap";
86
88
  export * from "./maps/transformationNameMap";
87
89
  export * from "./maps/trinketDescriptionMap";
88
90
  export * from "./maps/trinketNameMap";
package/dist/index.lua CHANGED
@@ -671,6 +671,22 @@ do
671
671
  end
672
672
  end
673
673
  end
674
+ do
675
+ local ____export = require("maps.roomTypeMap")
676
+ for ____exportKey, ____exportValue in pairs(____export) do
677
+ if ____exportKey ~= "default" then
678
+ ____exports[____exportKey] = ____exportValue
679
+ end
680
+ end
681
+ end
682
+ do
683
+ local ____export = require("maps.roomTypeNameMap")
684
+ for ____exportKey, ____exportValue in pairs(____export) do
685
+ if ____exportKey ~= "default" then
686
+ ____exports[____exportKey] = ____exportValue
687
+ end
688
+ end
689
+ end
674
690
  do
675
691
  local ____export = require("maps.transformationNameMap")
676
692
  for ____exportKey, ____exportValue in pairs(____export) do
@@ -0,0 +1,3 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ /** Maps room type names to room types. */
3
+ export declare const ROOM_TYPE_MAP: ReadonlyMap<string, RoomType>;
@@ -0,0 +1,43 @@
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
+ ____exports.ROOM_TYPE_MAP = __TS__New(Map, {
7
+ {"null", RoomType.ROOM_NULL},
8
+ {"default", RoomType.ROOM_DEFAULT},
9
+ {"shop", RoomType.ROOM_SHOP},
10
+ {"error", RoomType.ROOM_ERROR},
11
+ {"iamerror", RoomType.ROOM_ERROR},
12
+ {"treasure", RoomType.ROOM_TREASURE},
13
+ {"boss", RoomType.ROOM_BOSS},
14
+ {"miniboss", RoomType.ROOM_MINIBOSS},
15
+ {"secret", RoomType.ROOM_SECRET},
16
+ {"supersecret", RoomType.ROOM_SUPERSECRET},
17
+ {"arcade", RoomType.ROOM_ARCADE},
18
+ {"curse", RoomType.ROOM_CURSE},
19
+ {"challenge", RoomType.ROOM_CHALLENGE},
20
+ {"library", RoomType.ROOM_LIBRARY},
21
+ {"sacrifice", RoomType.ROOM_SACRIFICE},
22
+ {"devil", RoomType.ROOM_DEVIL},
23
+ {"angel", RoomType.ROOM_ANGEL},
24
+ {"dungeon", RoomType.ROOM_DUNGEON},
25
+ {"crawlspace", RoomType.ROOM_DUNGEON},
26
+ {"bossrush", RoomType.ROOM_BOSSRUSH},
27
+ {"isaacs", RoomType.ROOM_ISAACS},
28
+ {"bedroom", RoomType.ROOM_ISAACS},
29
+ {"cleanbedroom", RoomType.ROOM_ISAACS},
30
+ {"barren", RoomType.ROOM_BARREN},
31
+ {"dirtybedroom", RoomType.ROOM_BARREN},
32
+ {"chest", RoomType.ROOM_CHEST},
33
+ {"dice", RoomType.ROOM_DICE},
34
+ {"blackmarket", RoomType.ROOM_BLACK_MARKET},
35
+ {"greedexit", RoomType.ROOM_GREED_EXIT},
36
+ {"planetarium", RoomType.ROOM_PLANETARIUM},
37
+ {"teleporter", RoomType.ROOM_TELEPORTER},
38
+ {"teleporterexit", RoomType.ROOM_TELEPORTER_EXIT},
39
+ {"secretexit", RoomType.ROOM_SECRET_EXIT},
40
+ {"blue", RoomType.ROOM_BLUE},
41
+ {"ultrasecret", RoomType.ROOM_ULTRASECRET}
42
+ })
43
+ return ____exports
@@ -0,0 +1,2 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare const ROOM_TYPE_NAME_MAP: ReadonlyMap<RoomType, string>;
@@ -0,0 +1,38 @@
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
+ ____exports.ROOM_TYPE_NAME_MAP = __TS__New(Map, {
7
+ {RoomType.ROOM_NULL, "null room"},
8
+ {RoomType.ROOM_DEFAULT, "default room"},
9
+ {RoomType.ROOM_SHOP, "shop"},
10
+ {RoomType.ROOM_ERROR, "IAMERROR Room"},
11
+ {RoomType.ROOM_TREASURE, "Treasure Room"},
12
+ {RoomType.ROOM_BOSS, "Boss Room"},
13
+ {RoomType.ROOM_MINIBOSS, "Miniboss Room"},
14
+ {RoomType.ROOM_SECRET, "Secret Room"},
15
+ {RoomType.ROOM_SUPERSECRET, "Super Secret Room"},
16
+ {RoomType.ROOM_ARCADE, "Arcade"},
17
+ {RoomType.ROOM_CURSE, "Curse Room"},
18
+ {RoomType.ROOM_CHALLENGE, "Challenge Room"},
19
+ {RoomType.ROOM_LIBRARY, "Library"},
20
+ {RoomType.ROOM_SACRIFICE, "Sacrifice Room"},
21
+ {RoomType.ROOM_DEVIL, "Devil Room"},
22
+ {RoomType.ROOM_ANGEL, "Angel Room"},
23
+ {RoomType.ROOM_DUNGEON, "Crawlspace"},
24
+ {RoomType.ROOM_BOSSRUSH, "Boss Rush"},
25
+ {RoomType.ROOM_ISAACS, "Clean Bedroom"},
26
+ {RoomType.ROOM_BARREN, "Dirty Bedroom"},
27
+ {RoomType.ROOM_CHEST, "Chest Room"},
28
+ {RoomType.ROOM_DICE, "Dice Room"},
29
+ {RoomType.ROOM_BLACK_MARKET, "Black Market"},
30
+ {RoomType.ROOM_GREED_EXIT, "Greed Exit Room"},
31
+ {RoomType.ROOM_PLANETARIUM, "Planetarium"},
32
+ {RoomType.ROOM_TELEPORTER, "Teleporter Room"},
33
+ {RoomType.ROOM_TELEPORTER_EXIT, "Teleporter Exit Room"},
34
+ {RoomType.ROOM_SECRET_EXIT, "Secret Exit"},
35
+ {RoomType.ROOM_BLUE, "Blue Room"},
36
+ {RoomType.ROOM_ULTRASECRET, "Ultra Secret Room"}
37
+ })
38
+ return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.138",
3
+ "version": "1.2.139",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",