isaacscript-common 12.2.0 → 12.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.
package/dist/index.d.ts CHANGED
@@ -10422,7 +10422,8 @@ export declare enum SaveDataKey {
10422
10422
  * Note that when the player uses Glowing Hour Glass, the save data manager will automatically
10423
10423
  * restore any variables on a "run" or "level" object with a backup that was created when the room
10424
10424
  * was entered. Thus, you should not have to explicitly program support for Glowing Hour Glass into
10425
- * your mod features that use the save data manager.
10425
+ * your mod features that use the save data manager. If this is undesired for your specific
10426
+ * use-case, then add a key of `__ignoreGlowingHourGlass: true` to your "run" or "level" object.
10426
10427
  *
10427
10428
  * @param key The name of the file or feature that is submitting data to be managed by the save data
10428
10429
  * manager. The save data manager will throw an error if the key is already registered.
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 12.2.0
3
+ isaacscript-common 12.3.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -26950,6 +26950,7 @@ ____exports.SAVE_DATA_MANAGER_FEATURE_NAME = "save data manager"
26950
26950
  --- When the Glowing Hour Glass is used, certain save data keys will automatically be restored to a
26951
26951
  -- backup.
26952
26952
  ____exports.SAVE_DATA_MANAGER_GLOWING_HOUR_GLASS_BACKUP_KEYS = {SaveDataKey.RUN, SaveDataKey.LEVEL}
26953
+ ____exports.SAVE_DATA_MANAGER_GLOWING_HOUR_GLASS_IGNORE_KEY = "__ignoreGlowingHourGlass"
26953
26954
  return ____exports
26954
26955
  end,
26955
26956
  ["src.features.saveDataManager.serializationBrands"] = function(...)
@@ -31673,6 +31674,7 @@ local ____constants = require("src.features.saveDataManager.constants")
31673
31674
  local SAVE_DATA_MANAGER_DEBUG = ____constants.SAVE_DATA_MANAGER_DEBUG
31674
31675
  local SAVE_DATA_MANAGER_FEATURE_NAME = ____constants.SAVE_DATA_MANAGER_FEATURE_NAME
31675
31676
  local SAVE_DATA_MANAGER_GLOWING_HOUR_GLASS_BACKUP_KEYS = ____constants.SAVE_DATA_MANAGER_GLOWING_HOUR_GLASS_BACKUP_KEYS
31677
+ local SAVE_DATA_MANAGER_GLOWING_HOUR_GLASS_IGNORE_KEY = ____constants.SAVE_DATA_MANAGER_GLOWING_HOUR_GLASS_IGNORE_KEY
31676
31678
  local ____load = require("src.features.saveDataManager.load")
31677
31679
  local loadFromDisk = ____load.loadFromDisk
31678
31680
  local ____maps = require("src.features.saveDataManager.maps")
@@ -31740,9 +31742,14 @@ function makeGlowingHourGlassBackup(self)
31740
31742
  if childTable == nil then
31741
31743
  goto __continue18
31742
31744
  end
31745
+ local childTableLuaMap = childTable
31746
+ if childTableLuaMap[SAVE_DATA_MANAGER_GLOWING_HOUR_GLASS_IGNORE_KEY] ~= nil then
31747
+ goto __continue18
31748
+ end
31743
31749
  local saveDataGlowingHourGlass = saveDataGlowingHourGlassMap[subscriberName]
31744
31750
  if saveDataGlowingHourGlass == nil then
31745
31751
  saveDataGlowingHourGlass = {}
31752
+ saveDataGlowingHourGlassMap[subscriberName] = saveDataGlowingHourGlass
31746
31753
  end
31747
31754
  local copiedChildTable = deepCopy(nil, childTable)
31748
31755
  saveDataGlowingHourGlass[saveDataKey] = copiedChildTable
@@ -31762,19 +31769,19 @@ function restoreGlowingHourGlassBackup(self)
31762
31769
  do
31763
31770
  local childTable = saveData[saveDataKey]
31764
31771
  if childTable == nil then
31765
- goto __continue24
31772
+ goto __continue25
31766
31773
  end
31767
31774
  local saveDataGlowingHourGlass = saveDataGlowingHourGlassMap[subscriberName]
31768
31775
  if saveDataGlowingHourGlass == nil then
31769
- goto __continue24
31776
+ goto __continue25
31770
31777
  end
31771
31778
  local childTableBackup = saveDataGlowingHourGlass[saveDataKey]
31772
31779
  if childTableBackup == nil then
31773
- goto __continue24
31780
+ goto __continue25
31774
31781
  end
31775
31782
  merge(nil, childTable, childTableBackup, subscriberName .. "__glowingHourGlass")
31776
31783
  end
31777
- ::__continue24::
31784
+ ::__continue25::
31778
31785
  end
31779
31786
  end,
31780
31787
  SAVE_DATA_MANAGER_DEBUG
@@ -31949,7 +31956,8 @@ local saveDataMap = ____maps.saveDataMap
31949
31956
  -- Note that when the player uses Glowing Hour Glass, the save data manager will automatically
31950
31957
  -- restore any variables on a "run" or "level" object with a backup that was created when the room
31951
31958
  -- was entered. Thus, you should not have to explicitly program support for Glowing Hour Glass into
31952
- -- your mod features that use the save data manager.
31959
+ -- your mod features that use the save data manager. If this is undesired for your specific
31960
+ -- use-case, then add a key of `__ignoreGlowingHourGlass: true` to your "run" or "level" object.
31953
31961
  --
31954
31962
  -- @param key The name of the file or feature that is submitting data to be managed by the save data
31955
31963
  -- manager. The save data manager will throw an error if the key is already registered.
@@ -47052,7 +47060,7 @@ return ____exports
47052
47060
  ["package"] = function(...)
47053
47061
  return {
47054
47062
  name = "isaacscript-common",
47055
- version = "12.2.0",
47063
+ version = "12.3.0",
47056
47064
  description = "Helper functions and features for IsaacScript mods.",
47057
47065
  keywords = {"isaac", "rebirth", "afterbirth", "repentance"},
47058
47066
  homepage = "https://isaacscript.github.io/",
package/dist/package.lua CHANGED
@@ -1,6 +1,6 @@
1
1
  return {
2
2
  name = "isaacscript-common",
3
- version = "12.2.0",
3
+ version = "12.3.0",
4
4
  description = "Helper functions and features for IsaacScript mods.",
5
5
  keywords = {"isaac", "rebirth", "afterbirth", "repentance"},
6
6
  homepage = "https://isaacscript.github.io/",
@@ -7,4 +7,5 @@ export declare const SAVE_DATA_MANAGER_FEATURE_NAME = "save data manager";
7
7
  * backup.
8
8
  */
9
9
  export declare const SAVE_DATA_MANAGER_GLOWING_HOUR_GLASS_BACKUP_KEYS: SaveDataKey[];
10
+ export declare const SAVE_DATA_MANAGER_GLOWING_HOUR_GLASS_IGNORE_KEY = "__ignoreGlowingHourGlass";
10
11
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/features/saveDataManager/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,yEAAyE;AACzE,eAAO,MAAM,uBAAuB,SAAmB,CAAC;AAExD,eAAO,MAAM,8BAA8B,sBAAsB,CAAC;AAElE;;;GAGG;AACH,eAAO,MAAM,gDAAgD,eAG5D,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/features/saveDataManager/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,yEAAyE;AACzE,eAAO,MAAM,uBAAuB,SAAmB,CAAC;AAExD,eAAO,MAAM,8BAA8B,sBAAsB,CAAC;AAElE;;;GAGG;AACH,eAAO,MAAM,gDAAgD,eAG5D,CAAC;AAEF,eAAO,MAAM,+CAA+C,6BAChC,CAAC"}
@@ -7,4 +7,5 @@ ____exports.SAVE_DATA_MANAGER_FEATURE_NAME = "save data manager"
7
7
  --- When the Glowing Hour Glass is used, certain save data keys will automatically be restored to a
8
8
  -- backup.
9
9
  ____exports.SAVE_DATA_MANAGER_GLOWING_HOUR_GLASS_BACKUP_KEYS = {SaveDataKey.RUN, SaveDataKey.LEVEL}
10
+ ____exports.SAVE_DATA_MANAGER_GLOWING_HOUR_GLASS_IGNORE_KEY = "__ignoreGlowingHourGlass"
10
11
  return ____exports
@@ -79,7 +79,8 @@ import { SaveData } from "../../interfaces/SaveData";
79
79
  * Note that when the player uses Glowing Hour Glass, the save data manager will automatically
80
80
  * restore any variables on a "run" or "level" object with a backup that was created when the room
81
81
  * was entered. Thus, you should not have to explicitly program support for Glowing Hour Glass into
82
- * your mod features that use the save data manager.
82
+ * your mod features that use the save data manager. If this is undesired for your specific
83
+ * use-case, then add a key of `__ignoreGlowingHourGlass: true` to your "run" or "level" object.
83
84
  *
84
85
  * @param key The name of the file or feature that is submitting data to be managed by the save data
85
86
  * manager. The save data manager will throw an error if the key is already registered.
@@ -1 +1 @@
1
- {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../../../src/features/saveDataManager/exports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAKtD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAarD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8FG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,GAAG,EAAE,KAAK,EACpD,GAAG,EAAE,MAAM,EAAE,qEAAqE;AAClF,CAAC,EAAE,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE,KAAK,CAAC,EACnC,eAAe,CAAC,EAAE,MAAM,OAAO,GAC9B,IAAI,CAAC;AACR,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,EAAE,kEAAkE;AAC/E,CAAC,EAAE,QAAQ,EACX,eAAe,EAAE,KAAK,GACrB,IAAI,CAAC;AA+CR;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAG1C;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAG1C;AAQD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,IAAI,IAAI,CAK/C;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,WAAW,GAC1B,IAAI,CAiBN"}
1
+ {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../../../src/features/saveDataManager/exports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAKtD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAarD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+FG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,GAAG,EAAE,KAAK,EACpD,GAAG,EAAE,MAAM,EAAE,qEAAqE;AAClF,CAAC,EAAE,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE,KAAK,CAAC,EACnC,eAAe,CAAC,EAAE,MAAM,OAAO,GAC9B,IAAI,CAAC;AACR,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,EAAE,kEAAkE;AAC/E,CAAC,EAAE,QAAQ,EACX,eAAe,EAAE,KAAK,GACrB,IAAI,CAAC;AA+CR;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAG1C;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAG1C;AAQD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,IAAI,IAAI,CAK/C;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,WAAW,GAC1B,IAAI,CAiBN"}
@@ -98,7 +98,8 @@ local saveDataMap = ____maps.saveDataMap
98
98
  -- Note that when the player uses Glowing Hour Glass, the save data manager will automatically
99
99
  -- restore any variables on a "run" or "level" object with a backup that was created when the room
100
100
  -- was entered. Thus, you should not have to explicitly program support for Glowing Hour Glass into
101
- -- your mod features that use the save data manager.
101
+ -- your mod features that use the save data manager. If this is undesired for your specific
102
+ -- use-case, then add a key of `__ignoreGlowingHourGlass: true` to your "run" or "level" object.
102
103
  --
103
104
  -- @param key The name of the file or feature that is submitting data to be managed by the save data
104
105
  -- manager. The save data manager will throw an error if the key is already registered.
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../../src/features/saveDataManager/main.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAMtD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AA0BrD,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAelE;AAiKD,wBAAgB,sBAAsB,CACpC,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,GACvB,IAAI,CA4CN;AAiBD,wBAAgB,wBAAwB,IAAI,IAAI,CAM/C;AAED,wBAAgB,wBAAwB,IAAI,IAAI,CAM/C"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../../src/features/saveDataManager/main.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAMtD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AA2BrD,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAelE;AA6KD,wBAAgB,sBAAsB,CACpC,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,GACvB,IAAI,CA4CN;AAiBD,wBAAgB,wBAAwB,IAAI,IAAI,CAM/C;AAED,wBAAgB,wBAAwB,IAAI,IAAI,CAM/C"}
@@ -27,6 +27,7 @@ local ____constants = require("src.features.saveDataManager.constants")
27
27
  local SAVE_DATA_MANAGER_DEBUG = ____constants.SAVE_DATA_MANAGER_DEBUG
28
28
  local SAVE_DATA_MANAGER_FEATURE_NAME = ____constants.SAVE_DATA_MANAGER_FEATURE_NAME
29
29
  local SAVE_DATA_MANAGER_GLOWING_HOUR_GLASS_BACKUP_KEYS = ____constants.SAVE_DATA_MANAGER_GLOWING_HOUR_GLASS_BACKUP_KEYS
30
+ local SAVE_DATA_MANAGER_GLOWING_HOUR_GLASS_IGNORE_KEY = ____constants.SAVE_DATA_MANAGER_GLOWING_HOUR_GLASS_IGNORE_KEY
30
31
  local ____load = require("src.features.saveDataManager.load")
31
32
  local loadFromDisk = ____load.loadFromDisk
32
33
  local ____maps = require("src.features.saveDataManager.maps")
@@ -94,9 +95,14 @@ function makeGlowingHourGlassBackup(self)
94
95
  if childTable == nil then
95
96
  goto __continue18
96
97
  end
98
+ local childTableLuaMap = childTable
99
+ if childTableLuaMap[SAVE_DATA_MANAGER_GLOWING_HOUR_GLASS_IGNORE_KEY] ~= nil then
100
+ goto __continue18
101
+ end
97
102
  local saveDataGlowingHourGlass = saveDataGlowingHourGlassMap[subscriberName]
98
103
  if saveDataGlowingHourGlass == nil then
99
104
  saveDataGlowingHourGlass = {}
105
+ saveDataGlowingHourGlassMap[subscriberName] = saveDataGlowingHourGlass
100
106
  end
101
107
  local copiedChildTable = deepCopy(nil, childTable)
102
108
  saveDataGlowingHourGlass[saveDataKey] = copiedChildTable
@@ -116,19 +122,19 @@ function restoreGlowingHourGlassBackup(self)
116
122
  do
117
123
  local childTable = saveData[saveDataKey]
118
124
  if childTable == nil then
119
- goto __continue24
125
+ goto __continue25
120
126
  end
121
127
  local saveDataGlowingHourGlass = saveDataGlowingHourGlassMap[subscriberName]
122
128
  if saveDataGlowingHourGlass == nil then
123
- goto __continue24
129
+ goto __continue25
124
130
  end
125
131
  local childTableBackup = saveDataGlowingHourGlass[saveDataKey]
126
132
  if childTableBackup == nil then
127
- goto __continue24
133
+ goto __continue25
128
134
  end
129
135
  merge(nil, childTable, childTableBackup, subscriberName .. "__glowingHourGlass")
130
136
  end
131
- ::__continue24::
137
+ ::__continue25::
132
138
  end
133
139
  end,
134
140
  SAVE_DATA_MANAGER_DEBUG
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "12.2.0",
3
+ "version": "12.3.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -13,3 +13,6 @@ export const SAVE_DATA_MANAGER_GLOWING_HOUR_GLASS_BACKUP_KEYS = [
13
13
  SaveDataKey.RUN,
14
14
  SaveDataKey.LEVEL,
15
15
  ];
16
+
17
+ export const SAVE_DATA_MANAGER_GLOWING_HOUR_GLASS_IGNORE_KEY =
18
+ "__ignoreGlowingHourGlass";
@@ -95,7 +95,8 @@ import {
95
95
  * Note that when the player uses Glowing Hour Glass, the save data manager will automatically
96
96
  * restore any variables on a "run" or "level" object with a backup that was created when the room
97
97
  * was entered. Thus, you should not have to explicitly program support for Glowing Hour Glass into
98
- * your mod features that use the save data manager.
98
+ * your mod features that use the save data manager. If this is undesired for your specific
99
+ * use-case, then add a key of `__ignoreGlowingHourGlass: true` to your "run" or "level" object.
99
100
  *
100
101
  * @param key The name of the file or feature that is submitting data to be managed by the save data
101
102
  * manager. The save data manager will throw an error if the key is already registered.
@@ -13,6 +13,7 @@ import {
13
13
  SAVE_DATA_MANAGER_DEBUG,
14
14
  SAVE_DATA_MANAGER_FEATURE_NAME,
15
15
  SAVE_DATA_MANAGER_GLOWING_HOUR_GLASS_BACKUP_KEYS,
16
+ SAVE_DATA_MANAGER_GLOWING_HOUR_GLASS_IGNORE_KEY,
16
17
  } from "./constants";
17
18
  import { loadFromDisk } from "./load";
18
19
  import {
@@ -144,10 +145,22 @@ function makeGlowingHourGlassBackup() {
144
145
  continue;
145
146
  }
146
147
 
148
+ // Ignore child tables that the end-user has explicitly annotated.
149
+ const childTableLuaMap = childTable as LuaMap<AnyNotNil, unknown>;
150
+ if (
151
+ childTableLuaMap.has(SAVE_DATA_MANAGER_GLOWING_HOUR_GLASS_IGNORE_KEY)
152
+ ) {
153
+ continue;
154
+ }
155
+
147
156
  let saveDataGlowingHourGlass =
148
157
  saveDataGlowingHourGlassMap.get(subscriberName);
149
158
  if (saveDataGlowingHourGlass === undefined) {
150
159
  saveDataGlowingHourGlass = new LuaMap<string, unknown>() as SaveData;
160
+ saveDataGlowingHourGlassMap.set(
161
+ subscriberName,
162
+ saveDataGlowingHourGlass,
163
+ );
151
164
  }
152
165
 
153
166
  const copiedChildTable = deepCopy(childTable);