isaacscript-common 12.1.1 → 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.
@@ -10764,6 +10765,13 @@ export declare function setDoorDisplay(textCallback: (door: GridEntityDoor) => s
10764
10765
  */
10765
10766
  export declare function setEffectDisplay(textCallback: (effect: EntityEffect) => string): void;
10766
10767
 
10768
+ /**
10769
+ * Helper function to make an entity flash red like it is taking damage. This is useful when you
10770
+ * want to make it appear as if an entity is taking damage without actually dealing any damage to
10771
+ * it.
10772
+ */
10773
+ export declare function setEntityDamageFlash(entity: Entity): void;
10774
+
10767
10775
  /**
10768
10776
  * Helper function to set the position of every entity in the room based on a map of positions. If
10769
10777
  * an entity is found that does not have matching element in the provided map, then that entity will
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 12.1.1
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
 
@@ -20380,6 +20380,16 @@ function ____exports.removeEntities(self, entities, cap)
20380
20380
  end
20381
20381
  return entitiesRemoved
20382
20382
  end
20383
+ --- From DeadInfinity.
20384
+ local DAMAGE_FLASH_COLOR = Color(
20385
+ 0.5,
20386
+ 0.5,
20387
+ 0.5,
20388
+ 1,
20389
+ 200 / 255,
20390
+ 0 / 255,
20391
+ 0 / 255
20392
+ )
20383
20393
  --- Helper function to count the number of entities in room. Use this over the vanilla
20384
20394
  -- `Isaac.CountEntities` method to avoid having to specify a spawner and to handle ignoring charmed
20385
20395
  -- enemies.
@@ -20672,6 +20682,12 @@ function ____exports.rerollEnemy(self, entity)
20672
20682
  end
20673
20683
  return filteredNewEntities[1]
20674
20684
  end
20685
+ --- Helper function to make an entity flash red like it is taking damage. This is useful when you
20686
+ -- want to make it appear as if an entity is taking damage without actually dealing any damage to
20687
+ -- it.
20688
+ function ____exports.setEntityDamageFlash(self, entity)
20689
+ entity:SetColor(DAMAGE_FLASH_COLOR, 2, 0)
20690
+ end
20675
20691
  function ____exports.setEntityRandomColor(self, entity)
20676
20692
  local rng = newRNG(nil, entity.InitSeed)
20677
20693
  local r = getRandom(nil, rng)
@@ -26934,6 +26950,7 @@ ____exports.SAVE_DATA_MANAGER_FEATURE_NAME = "save data manager"
26934
26950
  --- When the Glowing Hour Glass is used, certain save data keys will automatically be restored to a
26935
26951
  -- backup.
26936
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"
26937
26954
  return ____exports
26938
26955
  end,
26939
26956
  ["src.features.saveDataManager.serializationBrands"] = function(...)
@@ -31657,6 +31674,7 @@ local ____constants = require("src.features.saveDataManager.constants")
31657
31674
  local SAVE_DATA_MANAGER_DEBUG = ____constants.SAVE_DATA_MANAGER_DEBUG
31658
31675
  local SAVE_DATA_MANAGER_FEATURE_NAME = ____constants.SAVE_DATA_MANAGER_FEATURE_NAME
31659
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
31660
31678
  local ____load = require("src.features.saveDataManager.load")
31661
31679
  local loadFromDisk = ____load.loadFromDisk
31662
31680
  local ____maps = require("src.features.saveDataManager.maps")
@@ -31724,9 +31742,14 @@ function makeGlowingHourGlassBackup(self)
31724
31742
  if childTable == nil then
31725
31743
  goto __continue18
31726
31744
  end
31745
+ local childTableLuaMap = childTable
31746
+ if childTableLuaMap[SAVE_DATA_MANAGER_GLOWING_HOUR_GLASS_IGNORE_KEY] ~= nil then
31747
+ goto __continue18
31748
+ end
31727
31749
  local saveDataGlowingHourGlass = saveDataGlowingHourGlassMap[subscriberName]
31728
31750
  if saveDataGlowingHourGlass == nil then
31729
31751
  saveDataGlowingHourGlass = {}
31752
+ saveDataGlowingHourGlassMap[subscriberName] = saveDataGlowingHourGlass
31730
31753
  end
31731
31754
  local copiedChildTable = deepCopy(nil, childTable)
31732
31755
  saveDataGlowingHourGlass[saveDataKey] = copiedChildTable
@@ -31746,19 +31769,19 @@ function restoreGlowingHourGlassBackup(self)
31746
31769
  do
31747
31770
  local childTable = saveData[saveDataKey]
31748
31771
  if childTable == nil then
31749
- goto __continue24
31772
+ goto __continue25
31750
31773
  end
31751
31774
  local saveDataGlowingHourGlass = saveDataGlowingHourGlassMap[subscriberName]
31752
31775
  if saveDataGlowingHourGlass == nil then
31753
- goto __continue24
31776
+ goto __continue25
31754
31777
  end
31755
31778
  local childTableBackup = saveDataGlowingHourGlass[saveDataKey]
31756
31779
  if childTableBackup == nil then
31757
- goto __continue24
31780
+ goto __continue25
31758
31781
  end
31759
31782
  merge(nil, childTable, childTableBackup, subscriberName .. "__glowingHourGlass")
31760
31783
  end
31761
- ::__continue24::
31784
+ ::__continue25::
31762
31785
  end
31763
31786
  end,
31764
31787
  SAVE_DATA_MANAGER_DEBUG
@@ -31933,7 +31956,8 @@ local saveDataMap = ____maps.saveDataMap
31933
31956
  -- Note that when the player uses Glowing Hour Glass, the save data manager will automatically
31934
31957
  -- restore any variables on a "run" or "level" object with a backup that was created when the room
31935
31958
  -- was entered. Thus, you should not have to explicitly program support for Glowing Hour Glass into
31936
- -- 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.
31937
31961
  --
31938
31962
  -- @param key The name of the file or feature that is submitting data to be managed by the save data
31939
31963
  -- manager. The save data manager will throw an error if the key is already registered.
@@ -47036,7 +47060,7 @@ return ____exports
47036
47060
  ["package"] = function(...)
47037
47061
  return {
47038
47062
  name = "isaacscript-common",
47039
- version = "12.1.1",
47063
+ version = "12.3.0",
47040
47064
  description = "Helper functions and features for IsaacScript mods.",
47041
47065
  keywords = {"isaac", "rebirth", "afterbirth", "repentance"},
47042
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.1.1",
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;AAK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AC,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
@@ -151,6 +151,12 @@ export declare function removeEntities<T extends AnyEntity>(entities: T[], cap?:
151
151
  * rerolled entity.
152
152
  */
153
153
  export declare function rerollEnemy(entity: Entity): Entity | undefined;
154
+ /**
155
+ * Helper function to make an entity flash red like it is taking damage. This is useful when you
156
+ * want to make it appear as if an entity is taking damage without actually dealing any damage to
157
+ * it.
158
+ */
159
+ export declare function setEntityDamageFlash(entity: Entity): void;
154
160
  export declare function setEntityRandomColor(entity: Entity): void;
155
161
  /**
156
162
  * Helper function to spawn an entity. Use this instead of the `Isaac.Spawn` method if you do not
@@ -1 +1 @@
1
- {"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../../src/functions/entities.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAI1D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAO/C;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,UAAU,GAAE,UAAe,EAC3B,OAAO,SAAK,EACZ,OAAO,SAAK,EACZ,cAAc,UAAQ,GACrB,GAAG,CAcL;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,UAAU,GAAE,UAAe,EAC3B,OAAO,SAAK,EACZ,OAAO,SAAK,EACZ,cAAc,UAAQ,GACrB,OAAO,CAGT;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,SAAS,EACpD,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,CAAC,EAAE,GACZ,CAAC,GAAG,SAAS,CAaf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,WAAW,CACzB,UAAU,GAAE,UAAe,EAC3B,OAAO,SAAK,EACZ,OAAO,SAAK,EACZ,cAAc,UAAQ,GACrB,MAAM,EAAE,CAMV;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,GACb,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,CA8B3C;AA0BD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAGzE;AAED,2FAA2F;AAC3F,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,GAAG,GACX,MAAM,CAER;AAED;;;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C,EAAE,EACb,GAAG,CAAC,EAAE,GAAG,GACR,CAAC,EAAE,CAgBL;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAgB9D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEzD;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CASzD;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CACnB,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,GAAG,EACZ,QAAQ,EAAE,MAAM,EAChB,QAAQ,GAAE,MAAmB,EAC7B,OAAO,GAAE,MAAM,GAAG,SAAqB,EACvC,SAAS,GAAE,IAAI,GAAG,GAAG,GAAG,SAAqB,GAC5C,MAAM,CAsCR;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,GAAG,EACZ,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,IAAI,GAAG,GAAG,EACrB,QAAQ,GAAE,MAAmB,EAC7B,OAAO,GAAE,MAAM,GAAG,SAAqB,GACtC,MAAM,CAUR"}
@@ -59,6 +59,16 @@ function ____exports.removeEntities(self, entities, cap)
59
59
  end
60
60
  return entitiesRemoved
61
61
  end
62
+ --- From DeadInfinity.
63
+ local DAMAGE_FLASH_COLOR = Color(
64
+ 0.5,
65
+ 0.5,
66
+ 0.5,
67
+ 1,
68
+ 200 / 255,
69
+ 0 / 255,
70
+ 0 / 255
71
+ )
62
72
  --- Helper function to count the number of entities in room. Use this over the vanilla
63
73
  -- `Isaac.CountEntities` method to avoid having to specify a spawner and to handle ignoring charmed
64
74
  -- enemies.
@@ -351,6 +361,12 @@ function ____exports.rerollEnemy(self, entity)
351
361
  end
352
362
  return filteredNewEntities[1]
353
363
  end
364
+ --- Helper function to make an entity flash red like it is taking damage. This is useful when you
365
+ -- want to make it appear as if an entity is taking damage without actually dealing any damage to
366
+ -- it.
367
+ function ____exports.setEntityDamageFlash(self, entity)
368
+ entity:SetColor(DAMAGE_FLASH_COLOR, 2, 0)
369
+ end
354
370
  function ____exports.setEntityRandomColor(self, entity)
355
371
  local rng = newRNG(nil, entity.InitSeed)
356
372
  local r = getRandom(nil, rng)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "12.1.1",
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);
@@ -9,6 +9,17 @@ import { isRNG, newRNG } from "./rng";
9
9
  import { asNumber, isPrimitive } from "./types";
10
10
  import { isVector, vectorToString } from "./vector";
11
11
 
12
+ /** From DeadInfinity. */
13
+ const DAMAGE_FLASH_COLOR: Readonly<Color> = Color(
14
+ 0.5,
15
+ 0.5,
16
+ 0.5,
17
+ 1.0,
18
+ 200 / 255,
19
+ 0 / 255,
20
+ 0 / 255,
21
+ );
22
+
12
23
  /**
13
24
  * Helper function to count the number of entities in room. Use this over the vanilla
14
25
  * `Isaac.CountEntities` method to avoid having to specify a spawner and to handle ignoring charmed
@@ -404,6 +415,15 @@ export function rerollEnemy(entity: Entity): Entity | undefined {
404
415
  return filteredNewEntities[0];
405
416
  }
406
417
 
418
+ /**
419
+ * Helper function to make an entity flash red like it is taking damage. This is useful when you
420
+ * want to make it appear as if an entity is taking damage without actually dealing any damage to
421
+ * it.
422
+ */
423
+ export function setEntityDamageFlash(entity: Entity): void {
424
+ entity.SetColor(DAMAGE_FLASH_COLOR, 2, 0);
425
+ }
426
+
407
427
  export function setEntityRandomColor(entity: Entity): void {
408
428
  const rng = newRNG(entity.InitSeed);
409
429