isaacscript-common 1.2.212 → 1.2.213

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.
@@ -10,6 +10,7 @@
10
10
  * - TSTL `Set`
11
11
  * - TSTL classes
12
12
  * - `DefaultMap`
13
+ * - Isaac `Color` objects
13
14
  * - Isaac `RNG` objects
14
15
  * - Isaac `Vector` objects
15
16
  *
@@ -11,6 +11,7 @@ import { SerializationType } from "../enums/SerializationType";
11
11
  * - TSTL `Set`
12
12
  * - TSTL classes
13
13
  * - `DefaultMap`
14
+ * - Isaac `Color` objects
14
15
  * - Isaac `RNG` objects
15
16
  * - Isaac `Vector` objects
16
17
  *
@@ -5,7 +5,7 @@ local Map = ____lualib.Map
5
5
  local __TS__InstanceOf = ____lualib.__TS__InstanceOf
6
6
  local __TS__Iterator = ____lualib.__TS__Iterator
7
7
  local ____exports = {}
8
- local isTSTLClass, copyClass, getNewClassFromMetatable, deepCopyValue, checkMetatable, validateValue, TSTL_CLASS_KEYS
8
+ local isTSTLClass, copyClass, getNewClassFromMetatable, deepCopyValue, checkMetatable, validateValue, isCopyableIsaacAPIClass, TSTL_CLASS_KEYS
9
9
  local ____DefaultMap = require("classes.DefaultMap")
10
10
  local DefaultMap = ____DefaultMap.DefaultMap
11
11
  local ____SerializationBrand = require("enums.private.SerializationBrand")
@@ -15,6 +15,8 @@ local ____SerializationType = require("enums.SerializationType")
15
15
  local SerializationType = ____SerializationType.SerializationType
16
16
  local ____constants = require("features.saveDataManager.constants")
17
17
  local SAVE_DATA_MANAGER_DEBUG = ____constants.SAVE_DATA_MANAGER_DEBUG
18
+ local ____color = require("functions.color")
19
+ local isColor = ____color.isColor
18
20
  local ____log = require("functions.log")
19
21
  local log = ____log.log
20
22
  local ____rng = require("functions.rng")
@@ -236,12 +238,15 @@ function checkMetatable(self, ____table, traversalDescription)
236
238
  error(("The deepCopy function detected that \"" .. tableDescription) .. "\" has a metatable. Copying tables with metatables is not supported, unless they are explicitly handled by the save data manager. (e.g. Vectors, TypeScriptToLua Maps, etc.)")
237
239
  end
238
240
  function validateValue(self, value, valueType, traversalDescription)
239
- if isVector(nil, value) then
241
+ if isCopyableIsaacAPIClass(nil, value) then
240
242
  return
241
243
  end
242
244
  if valueType == "function" or valueType == "nil" or valueType == "thread" or valueType == "userdata" then
243
- error(((("The deepCopy function detected that \"" .. traversalDescription) .. "\" is of type \"") .. valueType) .. "\", which is not supported.")
245
+ error(((("The deepCopy function detected that \"" .. traversalDescription) .. "\" has a value of type \"") .. valueType) .. "\", which is not supported.")
244
246
  end
245
247
  end
248
+ function isCopyableIsaacAPIClass(self, value)
249
+ return isColor(nil, value) or isRNG(nil, value) or isVector(nil, value)
250
+ end
246
251
  TSTL_CLASS_KEYS = __TS__New(Set, {"____constructor", "__index", "constructor"})
247
252
  return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.212",
3
+ "version": "1.2.213",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",